@preschen/gen-vis 0.5.0 → 0.6.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 CHANGED
@@ -15,7 +15,7 @@ the styles, and provides two global functions:
15
15
  ```html
16
16
  <div class="genVis" data-def-file="/data/bev/def.json"></div>
17
17
 
18
- <script src="gen-vis-0.5.0.js"></script>
18
+ <script src="gen-vis-0.6.0.js"></script>
19
19
  <script>mountGenVisByClass('genVis')</script>
20
20
  ```
21
21
 
@@ -54,6 +54,23 @@ Every visualisation has its own state, several of them can be used on a page.
54
54
  If the props change, the visualisation is loaded again. Errors are shown in
55
55
  place of the visualisation.
56
56
 
57
+ ### Styles
58
+
59
+ The styles of the package are in the cascade layer `gen-vis`, so every style
60
+ of the page overrides them, regardless of its specificity and of the order of
61
+ the styles, e.g.:
62
+
63
+ ```css
64
+ .formElement { display: block; margin: 6px 4px; }
65
+ .vis-header .subtitle { font-size: 15px; }
66
+ ```
67
+
68
+ The main classes are `vis`, `vis-header` (with `title` and `subtitle`),
69
+ `vis-form-elements` (with a `formElement` for every form element),
70
+ `vis-legends`, `facet-title` and `vis-footer`. Styles of the page which are in
71
+ a cascade layer themselves only override the package if their layer is
72
+ declared after it, e.g. `@layer gen-vis, page;`.
73
+
57
74
  ## Definition
58
75
 
59
76
  ```json
@@ -154,10 +171,13 @@ the definition refer to these names.
154
171
  `name` by default.
155
172
  - `props`: the categories and their props, e.g. colors. `common` props are
156
173
  used for all `manual` entries, `name` and `visible` are set by default. Only
157
- visible categories are shown.
174
+ visible categories are shown. The order of the `manual` entries is the order
175
+ of the legend, the facets and the stacks, not the order of the rows. Keys
176
+ which are integers, e.g. years, are ordered ascending by JavaScript.
158
177
  - `legend`: a toggle for every category, `symbol` draws svg `elements` (with
159
178
  props) of the given `size` before the name.
160
- - `stacked`: stacks the values of a vertical axis, see `stackedBar`.
179
+ - `stacked`: stacks the values of a vertical axis, see `stackedBar`, the first
180
+ category is at the bottom.
161
181
 
162
182
  ### `plot`
163
183
 
@@ -225,6 +245,31 @@ the column of an axis:
225
245
  }]
226
246
  ```
227
247
 
248
+ If the column depends on several form elements, it can be a template of the
249
+ globals, e.g. the values and their shares in the columns `twh`, `co2`,
250
+ `twh.share` and `co2.share`:
251
+
252
+ ```json
253
+ "globals": { "values": "twh", "share": "" },
254
+ "formElements": [{
255
+ "id": "values", "name": "Werte", "ref": "values", "type": "switch",
256
+ "values": [
257
+ { "id": "twh", "name": "TWh", "value": "twh" },
258
+ { "id": "co2", "name": "CO₂", "value": "co2" }
259
+ ]
260
+ }, {
261
+ "id": "share", "name": "Darstellung", "ref": "share", "type": "switch",
262
+ "values": [
263
+ { "id": "abs", "name": "Absolut", "value": "" },
264
+ { "id": "rel", "name": "Anteil", "value": ".share", "mapping": { "y": { "axis": { "format": ".0%" } } } }
265
+ ]
266
+ }],
267
+ "mapping": { "y": { "column": "{values}{share}" } }
268
+ ```
269
+
270
+ `{name}` is replaced by the value of the global, unknown globals are kept and
271
+ reported as warnings.
272
+
228
273
  ## Development
229
274
 
230
275
  ```sh
package/dist/gen-vis.js CHANGED
@@ -1,22 +1,22 @@
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";
1
+ (() => { const s = document.createElement("style"); s.textContent = "@layer gen-vis {\n.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-ec3facd5]{margin:2px 16px 2px 4px;font-size:13px;display:inline-block}.formElement .title[data-v-ec3facd5]{margin-right:5px;font-weight:700;display:inline-block}.formElement .entries[data-v-ec3facd5]{display:inline-block}.formElement .entries>div[data-v-ec3facd5]{margin-right:5px;display:inline-block}.formElement .entries>div input[data-v-ec3facd5]{display:inline-block;position:relative;top:1px}.vis[data-v-b07c17d2] text,.vis[data-v-b07c17d2] span,.vis[data-v-b07c17d2] div{font-family:var(--gen-vis-font-family,Century Gothic, sans-serif)}.vis-header .title[data-v-b07c17d2]{font-size:22px;font-weight:700}.vis-header .subtitle[data-v-b07c17d2]{margin-top:3px;font-size:13px}.vis-header[data-v-b07c17d2]{margin-bottom:10px}.vis-footer span[data-v-b07c17d2]{font-size:13px}.facet-title[data-v-b07c17d2]{margin-top:8px;font-size:13px;font-weight:700}.vis-error[data-v-a9d47434]{color:#b00;font-size:13px}\n/*$vite$:1*/\n}"; 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 ee } from "vue";
3
+ import * as m from "d3";
4
+ import h from "deepmerge";
5
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 = {
6
+ var g = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(e) ? JSON.parse(e) : m.csvParse(e)) : e, _ = (e) => e == null || e === "", te = {
7
7
  numeric: (e) => {
8
- let t = v(e) ? NaN : +e;
8
+ let t = _(e) ? NaN : +e;
9
9
  return isNaN(t) ? null : t;
10
10
  },
11
11
  date: (e) => {
12
- let t = v(e) ? NaN : typeof e == "number" ? e : Date.parse(e);
12
+ let t = _(e) ? NaN : typeof e == "number" ? e : Date.parse(e);
13
13
  return isNaN(t) ? null : t;
14
14
  }
15
- }, te = (e, t) => {
15
+ }, ne = (e, t) => {
16
16
  let n = Object.keys(t.mapping).map((e) => ({
17
17
  name: e,
18
18
  column: t.mapping[e].column,
19
- convert: ee[t.mapping[e].type] ?? ((e) => e)
19
+ convert: te[t.mapping[e].type] ?? ((e) => e)
20
20
  }));
21
21
  return e.map((e) => {
22
22
  let t = {};
@@ -24,23 +24,35 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
24
24
  t[n.name] = n.convert(e[n.column]);
25
25
  }), t;
26
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);
27
+ }, re = (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 ? m.extent(t.map((t) => t[`${e.dim}:st:e`])) : m.extent(e.values));
29
+ }, ie = (e) => {
30
+ let t = e.map(({ dim: e, keys: t }) => ({
31
+ dim: e,
32
+ rank: new Map(t.map((e, t) => [e, t]))
33
+ }));
34
+ return (e, n) => {
35
+ for (let { dim: r, rank: i } of t) {
36
+ let t = (i.get(e[r]) ?? Infinity) - (i.get(n[r]) ?? Infinity);
37
+ if (t) return t;
38
+ }
39
+ return 0;
40
+ };
41
+ }, ae = (e, t, n = [], r = null) => {
42
+ y(e, [...n, t.h]).forEach((e) => {
43
+ let n = 0, i = 0;
44
+ (r ? [...e.entries].sort(r) : e.entries).forEach((e) => {
45
+ let r = e[t.v];
46
+ r >= 0 ? (e[`${t.v}:st:s`] = n, n += r, e[`${t.v}:st:e`] = n) : (e[`${t.v}:st:s`] = i, i += r, e[`${t.v}:st:e`] = i);
35
47
  });
36
48
  });
37
- }, y = (e, t) => {
49
+ }, v = (e, t) => {
38
50
  e.forEach((e) => {
39
51
  Object.values(t).forEach((t) => {
40
52
  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
53
  });
42
54
  });
43
- }, b = (e, t) => {
55
+ }, y = (e, t) => {
44
56
  let n = /* @__PURE__ */ new Map();
45
57
  return e.forEach((e) => {
46
58
  let r = JSON.stringify(t.map((t) => e[t]));
@@ -49,14 +61,14 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
49
61
  entries: []
50
62
  }), n.get(r).entries.push(e);
51
63
  }), [...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) => ({
64
+ }, b = (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)), oe = (e, t, n) => t, x = (e) => h.all(e, { arrayMerge: oe }), S = (e, t) => e == t || JSON.stringify(e) == JSON.stringify(t), C = (e, t) => Object.fromEntries(Object.entries(e).map(([e, n], r) => [e, t(n, e)])), se = (e, t) => Array.isArray(e) ? e.map(t) : C(e, t), ce = (e, t, n, r) => e.map((e) => ({
53
65
  group: Object.keys(e.group).map((t) => ({
54
66
  dim: t,
55
67
  key: e.group[t]
56
68
  })),
57
69
  props: t._fill(Object.assign({}, n, ...Object.keys(e.group).map((t) => r[t].props[e.group[t]]))),
58
70
  values: e.entries
59
- })), oe = (e, t, n = !0, r = !1) => {
71
+ })), le = (e, t, n = !0, r = !1) => {
60
72
  if (e.value === void 0 || e.value === null || r) {
61
73
  if (e.prop == "ref") {
62
74
  let n = t[e.ref];
@@ -74,8 +86,8 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
74
86
  }
75
87
  }
76
88
  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);
89
+ }, w = (e, t) => le({ ...k(e) }, t, !0), T = (e, t, n = !0) => E(se(e, k), t, n), E = (e, t, n = !1) => se(e, (e) => le({ ...e }, t, n)), D = (e) => e.prop !== void 0, O = (e) => Object.values(e).flatMap((e) => typeof e != "object" || !e ? [] : D(e) ? typeof e.ref == "string" ? [e.ref.split(":")[0]] : [] : O(e)), k = (e) => {
90
+ if (typeof e == "object" && !Array.isArray(e) && e !== null) return D(e) ? e : C(e, k);
79
91
  if (typeof e == "string" && e.charAt() == "@") {
80
92
  let t = e.substring(1);
81
93
  return {
@@ -88,7 +100,7 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
88
100
  prop: "fixed",
89
101
  value: e
90
102
  };
91
- }, M = (e) => {
103
+ }, A = (e) => {
92
104
  if (e.props) {
93
105
  let t = e.props;
94
106
  e.props = Object.fromEntries(Object.keys(t.manual).map((e) => {
@@ -97,19 +109,21 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
97
109
  }));
98
110
  }
99
111
  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) => {
112
+ }, ue = (e) => (Object.values(e.mapping).forEach(A), 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
113
  e.categories ??= [], e.id ??= `plot-${t}`, e.highlightProps = Object.keys(e.props).filter((e) => e.startsWith("highlight-")).map((e) => e.substring(10));
102
114
  }), 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 ?? {}))));
115
+ e.props = C(e.props, k), e._fill = (t) => E(e.props, t);
116
+ }), e), j = (e) => typeof e == "string" ? [...e.matchAll(/\{(\w+)\}/g)].map((e) => e[1]) : [], de = (e, t = {}) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), M = (e, t) => {
117
+ let n = e.formElements ?? [], r = /* @__PURE__ */ new Set([...n.flatMap((e) => e.values.flatMap((e) => Object.keys(e.mapping ?? {}))), ...Object.keys(t.mapping ?? {}).filter((e) => j(t.mapping[e].column).length > 0)]);
106
118
  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);
119
+ let i = n.map((t) => t.values.find((n) => S(n.value, e.globals?.[t.ref]))).filter((e) => e && e.mapping);
108
120
  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;
121
+ let r = i.filter((e) => e.mapping[n]).map((e) => e.mapping[n]), a = x([t.mapping[n] ?? {}, ...r]);
122
+ typeof a.column == "string" && (a.column = de(a.column, e.globals));
123
+ let o = A(a);
124
+ e.mapping[n] && "props" in e.mapping[n] && (o.props = e.mapping[n].props), e.mapping[n] = o;
111
125
  }), !0;
112
- }, P = (e) => e.charAt(0).toUpperCase() + e.slice(1), F = {
126
+ }, N = (e) => e.charAt(0).toUpperCase() + e.slice(1), P = {
113
127
  de: {
114
128
  number: {
115
129
  decimal: ",",
@@ -250,35 +264,35 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
250
264
  year: "%Y"
251
265
  }
252
266
  }
253
- }, ce = Object.keys(F), I = {
267
+ }, fe = Object.keys(P), F = {
254
268
  time: [
255
- h.timeSecond,
256
- h.timeMinute,
257
- h.timeHour,
258
- h.timeDay,
259
- h.timeWeek,
260
- h.timeMonth,
261
- h.timeYear
269
+ m.timeSecond,
270
+ m.timeMinute,
271
+ m.timeHour,
272
+ m.timeDay,
273
+ m.timeWeek,
274
+ m.timeMonth,
275
+ m.timeYear
262
276
  ],
263
277
  utc: [
264
- h.utcSecond,
265
- h.utcMinute,
266
- h.utcHour,
267
- h.utcDay,
268
- h.utcWeek,
269
- h.utcMonth,
270
- h.utcYear
278
+ m.utcSecond,
279
+ m.utcMinute,
280
+ m.utcHour,
281
+ m.utcDay,
282
+ m.utcWeek,
283
+ m.utcMonth,
284
+ m.utcYear
271
285
  ]
272
- }, L = (e, t, n) => {
286
+ }, I = (e, t, n) => {
273
287
  let r = Object.fromEntries(Object.entries(t).map(([t, n]) => [t, e(n)])), [i, a, o, s, c, l, u] = n;
274
288
  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({
289
+ }, pe = (e = "de") => {
290
+ let t = typeof e == "string" ? { base: e } : e, n = P[t.base ?? "de"];
291
+ if (!n) throw Error(`Unknown locale '${t.base}', expected one of ${fe.map((e) => `'${e}'`).join(", ")}`);
292
+ let r = m.formatLocale({
279
293
  ...n.number,
280
294
  ...t.number
281
- }), i = h.timeFormatLocale({
295
+ }), i = m.timeFormatLocale({
282
296
  ...n.time,
283
297
  ...t.time
284
298
  }), a = {
@@ -294,13 +308,13 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
294
308
  "pow",
295
309
  "sqrt"
296
310
  ].includes(t)) {
297
- let [t, i] = e.domain(), a = h.precisionFixed(h.tickStep(t, i, n));
311
+ let [t, i] = e.domain(), a = m.precisionFixed(m.tickStep(t, i, n));
298
312
  return r.format(`,.${Number.isFinite(a) ? a : 0}f`);
299
313
  }
300
- return t == "time" ? L(i.format, a, I.time) : t == "utc" ? L(i.utcFormat, a, I.utc) : null;
314
+ return t == "time" ? I(i.format, a, F.time) : t == "utc" ? I(i.utcFormat, a, F.utc) : null;
301
315
  }
302
316
  };
303
- }, R = [
317
+ }, L = [
304
318
  "svg:path",
305
319
  "svg:circle",
306
320
  "svg:line",
@@ -309,24 +323,24 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
309
323
  "base:area",
310
324
  "bar",
311
325
  "stackedBar"
312
- ], z = [
326
+ ], R = [
313
327
  "numeric",
314
328
  "date",
315
329
  "categorical"
316
- ], B = ["horizontal", "vertical"], V = [
330
+ ], z = ["horizontal", "vertical"], B = [
317
331
  "top",
318
332
  "bottom",
319
333
  "left",
320
334
  "right"
321
- ], H = [
335
+ ], V = [
322
336
  "fixed",
323
337
  "ref",
324
338
  "relative",
325
339
  "steps"
326
- ], U = (e) => e.map((e) => `'${e}'`).join(", "), W = (e, t, n) => {
340
+ ], H = (e) => e.map((e) => `'${e}'`).join(", "), U = (e, t, n) => {
327
341
  if (typeof e != "object" || !e || Array.isArray(e)) return;
328
342
  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)}`);
343
+ V.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 ${H(V)}`);
330
344
  return;
331
345
  }
332
346
  let r = [
@@ -335,66 +349,67 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
335
349
  "ref",
336
350
  "mode"
337
351
  ].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) => {
352
+ if (r.length > 0) return n(t, `has ${H(r)} but no 'prop', so it is not evaluated`);
353
+ Object.entries(e).forEach(([e, r]) => U(r, `${t}.${e}`, n));
354
+ }, me = (e) => {
341
355
  let t = [], n = (e, n) => t.push(`${e}: ${n}`), r = e.mapping ?? {};
342
356
  e.mapping || n("mapping", "missing"), Object.entries(r).forEach(([e, t]) => {
343
357
  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)}`);
358
+ if (typeof t.column != "string" && n(r, "no 'column'"), t.type !== void 0 && !R.includes(t.type) && n(`${r}.type`, `unknown type '${t.type}', expected one of ${H(R)}`), t.props && !t.props.manual && n(`${r}.props`, "expected 'manual' (and optional 'common') entries"), t.scale) {
359
+ let e = t.scale.type ?? "linear", i = m[`scale${N(e)}`];
360
+ 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 && !z.includes(t.scale.orientation) && n(`${r}.scale.orientation`, `unknown orientation '${t.scale.orientation}', expected one of ${H(z)}`);
347
361
  }
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));
362
+ t.axis && (t.scale || n(`${r}.axis`, "an axis needs a 'scale'"), B.includes(t.axis.position) || n(`${r}.axis.position`, `unknown position '${t.axis.position}', expected one of ${H(B)}`), U(t.axis.ticks, `${r}.axis.ticks`, n));
349
363
  });
350
364
  let i = [].concat(e.plot ?? []);
351
365
  if (i.length == 0 && n("plot", "missing"), i.forEach((e, t) => {
352
366
  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);
367
+ L.includes(e.type) || n(`${i}.type`, `unknown type '${e.type}', expected one of ${H(L)}`), (e.categories ?? []).filter((e) => !(e in r)).forEach((e) => n(`${i}.categories`, `unknown mapping '${e}'`)), U(e.props, `${i}.props`, n);
354
368
  }), e.facets) {
355
369
  let t = [].concat(e.facets.dim ?? []);
356
370
  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
371
  }
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) => {
372
+ let a = (t, r) => j(t).filter((t) => !(t in (e.globals ?? {}))).forEach((e) => n(r, `unknown global '${e}' in the column template`));
373
+ return Object.entries(r).forEach(([e, t]) => a(t.column, `mapping.${e}.column`)), (e.formElements ?? []).forEach((e, t) => (e.values ?? []).forEach((e, n) => Object.entries(e.mapping ?? {}).forEach(([e, r]) => a(r.column, `formElements[${t}].values[${n}].mapping.${e}.column`)))), U(e.options?.height, "options.height", n), U(e.facets?.cols, "facets.cols", n), t;
374
+ }, W = (e, t = document.baseURI) => new URL(e, t).href, G = async (e) => {
360
375
  try {
361
- return await h.text(e);
376
+ return await m.text(e);
362
377
  } catch (t) {
363
378
  throw Error(`Could not load '${e}': ${t.message}`);
364
379
  }
365
- }, q = (e, t) => {
380
+ }, K = (e, t) => {
366
381
  try {
367
382
  return JSON.parse(e);
368
383
  } catch (e) {
369
384
  throw Error(`Invalid JSON in definition ${t}: ${e.message}`);
370
385
  }
371
- }, de = async (e, t, n = K) => {
386
+ }, he = async (e, t, n = G) => {
372
387
  let r = [e], i = /* @__PURE__ */ new Set();
373
388
  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);
389
+ if (t = W(e.parent, t), i.has(t)) throw Error(`Cyclic parent definition '${t}'`);
390
+ i.add(t), e = K(await n(t), `'${t}'`), r.unshift(e);
376
391
  }
377
- return S(r);
378
- }, J = (e) => o(Array.from(m(e))), fe = async ({ def: e = null, defUrl: t = null, data: n = null }) => {
392
+ return x(r);
393
+ }, q = (e) => o(Array.from(ee(e))), ge = async ({ def: e = null, defUrl: t = null, data: n = null }) => {
379
394
  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) {
395
+ e === null ? (r = W(t), e = K(await G(r), `'${r}'`)) : typeof e == "string" && (e = K(e, "attribute"));
396
+ let i = await he(JSON.parse(JSON.stringify(e)), r);
397
+ me(i).forEach((e) => console.warn(`gen-vis ${r ?? "inline definition"}: ${e}`));
398
+ let a = ue(JSON.parse(JSON.stringify(i)));
399
+ if (M(a, i), n === null) {
385
400
  if (!i.data) throw Error("No data given, neither in the definition nor as attribute.");
386
- n = await K(G(i.data, r));
401
+ n = await G(W(i.data, r));
387
402
  }
388
- let s = J(_(n));
403
+ let s = q(g(n));
389
404
  return {
390
405
  defUrl: r ?? null,
391
406
  defOrg: i,
392
- locale: o(le(i.options?.locale)),
407
+ locale: o(pe(i.options?.locale)),
393
408
  rows: s,
394
409
  def: a,
395
- data: J(te(s, a))
410
+ data: q(ne(s, a))
396
411
  };
397
- }, pe = class {
412
+ }, _e = class {
398
413
  defUrl = null;
399
414
  defOrg = null;
400
415
  locale = null;
@@ -428,31 +443,31 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
428
443
  let t = ++this.runs;
429
444
  this.def = this.data = null;
430
445
  try {
431
- let n = await fe(e);
446
+ let n = await ge(e);
432
447
  t == this.runs && Object.assign(this, n);
433
448
  } catch (e) {
434
449
  if (t == this.runs) throw e;
435
450
  }
436
451
  }
437
452
  applyFormElements() {
438
- N(this.def, this.defOrg) && (this.data = J(te(this.rows, this.def)));
453
+ M(this.def, this.defOrg) && (this.data = q(ne(this.rows, this.def)));
439
454
  }
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) {
455
+ }, ve = () => u(new _e()), J = (e, t) => {
456
+ let n = e.mapping.scale, r = m[`scale${N(n.type)}`]();
457
+ if (r.range(T(n.range, t)), e.extent) {
443
458
  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
459
  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))];
460
+ 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[m.bisectCenter(e.values, r.invert(t))];
446
461
  } else e.domain = e.values, n.padding ??= .4, r.padding(n.padding), r.invertCustom = (e) => {
447
462
  let t = Math.floor(e / r.step());
448
463
  return r.domain()[Math.max(0, Math.min(t, r.domain().length - 1))];
449
464
  };
450
465
  r.domain(e.domain), e.scale = r;
451
- }, X = function(e) {
452
- let t = h.select(this);
466
+ }, Y = function(e) {
467
+ let t = m.select(this);
453
468
  Object.entries(e).forEach(([e, n], r) => {
454
469
  if (n instanceof Object) {
455
- if (!k(n)) return;
470
+ if (!D(n)) return;
456
471
  n = n.value;
457
472
  }
458
473
  if (e == "text") {
@@ -461,14 +476,14 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
461
476
  }
462
477
  t.attr(e, n);
463
478
  });
464
- }, he = function(e) {
465
- let t = h.select(this);
479
+ }, ye = function(e) {
480
+ let t = m.select(this);
466
481
  e.group.forEach((e) => {
467
482
  t.attr(`data-group-${e.dim}`, e.key);
468
483
  }), e.group.forEach((e) => {
469
484
  t.attr(`data-visible-${e.dim}`, e.visible);
470
485
  }), t.attr("data-visible", e.group.reduce((e, t) => e && t.visible, !0));
471
- }, ge = (e, t, n) => {
486
+ }, be = (e, t, n) => {
472
487
  let r = t.categories.filter((e) => e in n).map((e) => ({
473
488
  attr: `data-group-${e}`,
474
489
  value: String(n[e])
@@ -476,25 +491,25 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
476
491
  return r.length == 0 ? null : e.selectAll(`g.plotGroup.${t.id} [${r[0].attr}]`).filter(function() {
477
492
  return r.every((e) => this.getAttribute(e.attr) === e.value);
478
493
  });
479
- }, Z = (e, t, n = null) => {
494
+ }, X = (e, t, n = null) => {
480
495
  t.filter((e) => e.highlightProps.length > 0).forEach((t) => {
481
496
  e.selectAll(`g.plotGroup.${t.id} .highlight`).classed("highlight", !1).each(function() {
482
- let e = h.select(this);
497
+ let e = m.select(this);
483
498
  t.highlightProps.forEach((t) => e.attr(t, e.attr(`default-${t}`)));
484
499
  });
485
- let r = n && ge(e, t, n);
500
+ let r = n && be(e, t, n);
486
501
  r && r.classed("highlight", !0).raise().each(function() {
487
- let e = h.select(this);
502
+ let e = m.select(this);
488
503
  t.highlightProps.forEach((t) => {
489
504
  e.attr(`default-${t}`, e.attr(t)).attr(t, e.attr(`highlight-${t}`));
490
505
  });
491
506
  });
492
507
  });
493
- }, Q = (e, t) => {
508
+ }, Z = (e, t) => {
494
509
  let n = e.__vccOpts || e;
495
510
  for (let [e, r] of t) n[e] = r;
496
511
  return n;
497
- }, _e = {
512
+ }, xe = {
498
513
  props: [
499
514
  "title",
500
515
  "axis",
@@ -516,14 +531,14 @@ var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(
516
531
  watch: { data: "render" },
517
532
  methods: { render() {
518
533
  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);
534
+ let e = [...this.data].sort((e, t) => t.entries[this.axis.v.col].value - e.entries[this.axis.v.col].value), t = m.select(this.$refs.entries).selectAll("tr.entry").data(e).join("tr").attr("class", "entry").classed("nearest", (e) => e.nearest);
520
535
  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
536
  } }
522
- }, ve = { class: "title" }, ye = {
537
+ }, Se = { class: "title" }, Ce = {
523
538
  class: "entries",
524
539
  ref: "entries"
525
540
  };
526
- function be(e, t, n, o, s, u) {
541
+ function we(e, t, n, o, s, u) {
527
542
  return n.axis && n.axis.h ? (l(), i("div", {
528
543
  key: 0,
529
544
  class: "hover",
@@ -532,9 +547,9 @@ function be(e, t, n, o, s, u) {
532
547
  left: u.left,
533
548
  transform: u.transform
534
549
  })
535
- }, [a("div", ve, p(n.axis.h.name), 1), a("table", ye, null, 512)], 4)) : r("", !0);
550
+ }, [a("div", Se, p(n.axis.h.name), 1), a("table", Ce, null, 512)], 4)) : r("", !0);
536
551
  }
537
- var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]]), Se = (...e) => e.every((e) => Number.isFinite(e)), Ce = {
552
+ var Te = /*#__PURE__*/ Z(xe, [["render", we], ["__scopeId", "data-v-364032d4"]]), Ee = (...e) => e.every((e) => Number.isFinite(e)), De = {
538
553
  props: [
539
554
  "filter",
540
555
  "shared",
@@ -566,12 +581,12 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
566
581
  };
567
582
  }
568
583
  },
569
- components: { Hover: xe },
584
+ components: { Hover: Te },
570
585
  created() {
571
586
  this.def = this.store.def;
572
587
  },
573
588
  mounted() {
574
- this.inner = h.select(this.$refs.inner), this.scales(), this.axis(), this.plot(), this.hoverInit();
589
+ this.inner = m.select(this.$refs.inner), this.scales(), this.axis(), this.plot(), this.hoverInit();
575
590
  },
576
591
  unmounted() {
577
592
  document.removeEventListener("pointerdown", this.hideOnPointerOutside);
@@ -579,23 +594,23 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
579
594
  methods: {
580
595
  plot() {
581
596
  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);
597
+ let t = ce(y(this.data, e.categories), e, this.relativeBases, this.def.mapping), n = this.inner.append("g").classed("plotGroup", !0).classed(e.id, !0);
583
598
  this[e.type](t, n);
584
599
  });
585
600
  },
586
601
  _groupwise: function(e, t) {
587
602
  return t.classed("paths", !0).selectAll("path").data(e).enter().append("path").each(function(e) {
588
- X.call(this, e.props);
589
- }).each(he);
603
+ Y.call(this, e.props);
604
+ }).each(ye);
590
605
  },
591
606
  _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);
607
+ return t.classed(n, !0).selectAll("g.group").data(e).enter().append("g").attr("class", "group").each(ye).selectAll(n).data((e) => {
608
+ let t = O(e.props);
609
+ return e.values.filter((e) => t.every((t) => e[t] !== null)).map((t) => r(E(e.props, t)));
610
+ }).enter().append(n).each(Y);
596
611
  },
597
612
  "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))));
613
+ this._groupwise(e, t).attr("d", (e) => m.line().defined((e) => Ee(e.x, e.y)).x((e) => e.x).y((e) => e.y)(e.values.map((t) => E(e.props.d, t, !0))));
599
614
  },
600
615
  "svg:circle": function(e, t) {
601
616
  this._pointwise(e, t, "circle");
@@ -610,7 +625,7 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
610
625
  this._pointwise(e, t, "text");
611
626
  },
612
627
  "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))));
628
+ this._groupwise(e, t).attr("d", (e) => m.area().defined((e) => Ee(e.x, e.y0, e.y1)).x((e) => e.x).y1((e) => e.y1).y0((e) => e.y0)(e.values.map((t) => E(e.props.d, t, !0))));
614
629
  },
615
630
  bar(e, t) {
616
631
  let n = this;
@@ -618,15 +633,15 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
618
633
  let t = e.height.parts[0], r = n.info[t].scale(0);
619
634
  if (e.width === void 0) {
620
635
  let t = e.cx.parts[0];
621
- e.width = j(n.info[t].scale.step() * (1 - n.info[t].scale.padding()));
636
+ e.width = k(n.info[t].scale.step() * (1 - n.info[t].scale.padding()));
622
637
  }
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;
638
+ return e.x = k(e.cx.value - e.width.value / 2), delete e.cx, e.y = k(e.height.value), e.height = k(r - e.height.value), e;
624
639
  });
625
640
  },
626
641
  stackedBar(e, t) {
627
642
  e.forEach((e) => {
628
643
  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)`);
644
+ e.props.x = k(`@${t}:scaled`), e.props.y = k(`@${n}:st:e:scaled`), e.props.height = k(`@${n}:st:h:scaled`), e.props.transform = k(`translate(-${e.props.width.value / 2} 0)`);
630
645
  }), this._pointwise(e, t, "rect", (e) => (e.height.value < 0 && (e.y.value += e.height.value, e.height.value = -e.height.value), e));
631
646
  },
632
647
  scales() {
@@ -636,18 +651,18 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
636
651
  dim: t,
637
652
  mapping: this.store.mapping(t)
638
653
  };
639
- ne(n, this.data), Y(n, {
654
+ re(n, this.data), J(n, {
640
655
  width: this.innerWidth,
641
656
  height: this.innerHeight
642
657
  }), e[t] = n;
643
- }), y(this.data, e), this.info = {
658
+ }), v(this.data, e), this.info = {
644
659
  ...this.shared,
645
660
  ...e
646
661
  };
647
662
  },
648
663
  axis() {
649
664
  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);
665
+ let t = this.store.mapping(e), n = t.axis, r = this.info[e].scale, i = w(n.ticks, this.relativeBases), a = m[`axis${N(n.position)}`](r).tickSizeInner(9).tickSizeOuter(0).ticks(i).tickPadding(n.padding);
651
666
  if (n.format) a.tickFormat(this.store.formatter(t.scale.type)(n.format));
652
667
  else if (!n.values) {
653
668
  let e = this.store.locale.tickFormat(r, t.scale.type, i);
@@ -678,18 +693,18 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
678
693
  name: t,
679
694
  formatter: this.store.formatter(n.scale.type)(r)
680
695
  }];
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);
696
+ })), r = this.store.mappingNamesWithKey("hover").filter((e) => e != t.h && e != t.v && this.store.mapping(e).props), i = m.select(this.$refs.hoverMarker).select("line"), a = () => {
697
+ e.hover.visible = !1, X(e.inner, e.def.plot);
683
698
  };
684
699
  this.hideOnPointerOutside = (t) => {
685
700
  e.hover.visible && !e.$refs.svg.contains(t.target) && a();
686
701
  }, 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
702
  e.hover.visible = !0;
688
- let a = h.pointer(t), o = e.info[n.h.name], s = o.scale.invertCustom(a[0]);
703
+ let a = m.pointer(t), o = e.info[n.h.name], s = o.scale.invertCustom(a[0]);
689
704
  if (s === void 0) return;
690
705
  let c = o.scale(s);
691
706
  i.attr("x1", c).attr("x2", c).attr("y1", 0).attr("y2", e.innerHeight);
692
- let l = x(e.data, [{
707
+ let l = b(e.data, [{
693
708
  dim: n.h.name,
694
709
  key: s
695
710
  }]).filter((e) => e[n.v.name] !== null).map((t) => {
@@ -699,16 +714,16 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
699
714
  nearest: !1
700
715
  };
701
716
  return r.forEach((n) => {
702
- i.entries[n] = D(e.store.mapping(n).hover.props, e.store.prop(n, t[n]));
717
+ i.entries[n] = T(e.store.mapping(n).hover.props, e.store.prop(n, t[n]));
703
718
  }), i.entries[n.v.name] = {
704
719
  value: t[n.v.name],
705
720
  name: n.v.formatter(t[n.v.name])
706
721
  }, i;
707
722
  }), 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`]]);
723
+ f = e.store.mapping(d).stacked ? m.least(l, (e) => {
724
+ let [t, n] = m.extent([e.data[`${d}:st:s`], e.data[`${d}:st:e`]]);
710
725
  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 = {
726
+ }) : m.least(l, (e) => Math.abs(e.data[d] - u)), f && (f.nearest = !0), X(e.inner, e.def.plot, f?.data), e.hover.data = l, e.hover.axis = {
712
727
  h: {
713
728
  col: n.h.name,
714
729
  value: c,
@@ -724,12 +739,12 @@ var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]])
724
739
  }).on("pointercancel", a);
725
740
  }
726
741
  }
727
- }, we = ["width", "height"], Te = ["transform"], Ee = ["visibility"], De = {
742
+ }, Oe = ["width", "height"], ke = ["transform"], Ae = ["visibility"], je = {
728
743
  key: 0,
729
744
  class: "debug"
730
745
  };
731
- function Oe(e, t, o, s, u, d) {
732
- let m = f("hover");
746
+ function Me(e, t, o, s, u, d) {
747
+ let ee = f("hover");
733
748
  return l(), i("div", {
734
749
  style: c(`width: ${o.width}px;`),
735
750
  class: "vis-inner"
@@ -746,8 +761,8 @@ function Oe(e, t, o, s, u, d) {
746
761
  visibility: e.hover.visible ? "visible" : "hidden",
747
762
  class: "hoverMarker",
748
763
  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, {
764
+ }, [...t[0] ||= [a("line", null, null, -1)]], 8, Ae)], 8, ke)], 8, Oe)),
765
+ 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(ee, {
751
766
  key: 0,
752
767
  data: e.hover.data,
753
768
  side: e.hover.side,
@@ -757,41 +772,41 @@ function Oe(e, t, o, s, u, d) {
757
772
  "side",
758
773
  "axis"
759
774
  ])) : r("", !0)], 4),
760
- e.debug ? (l(), i("span", De, p(e.debug), 1)) : r("", !0)
775
+ e.debug ? (l(), i("span", je, p(e.debug), 1)) : r("", !0)
761
776
  ], 4);
762
777
  }
763
- var ke = /*#__PURE__*/ Q(Ce, [["render", Oe], ["__scopeId", "data-v-1f05a06e"]]), Ae = {
778
+ var Ne = /*#__PURE__*/ Z(De, [["render", Me], ["__scopeId", "data-v-1f05a06e"]]), Pe = {
764
779
  props: ["info", "props"],
765
780
  mounted() {
766
- let e = h.select(this.$refs.legendSymbol);
781
+ let e = m.select(this.$refs.legendSymbol);
767
782
  this.info.elements.forEach((t) => {
768
783
  let n = e.append(t.type);
769
- X.call(n.node(), D(t.props, this.props));
784
+ Y.call(n.node(), T(t.props, this.props));
770
785
  });
771
786
  }
772
- }, je = ["width", "height"];
773
- function Me(e, t, n, r, a, o) {
787
+ }, Fe = ["width", "height"];
788
+ function Ie(e, t, n, r, a, o) {
774
789
  return l(), i("svg", {
775
790
  width: n.info.size,
776
791
  height: n.info.size,
777
792
  ref: "legendSymbol"
778
- }, null, 8, je);
793
+ }, null, 8, Fe);
779
794
  }
780
795
  //#endregion
781
796
  //#region src/comp/Legend.vue
782
- var Ne = {
797
+ var Le = {
783
798
  props: ["legend"],
784
799
  inject: ["store"],
785
800
  data: () => ({
786
801
  info: {},
787
802
  entries: []
788
803
  }),
789
- components: { LegendSymbol: /* @__PURE__ */ Q(Ae, [["render", Me], ["__scopeId", "data-v-ce0e972e"]]) },
804
+ components: { LegendSymbol: /* @__PURE__ */ Z(Pe, [["render", Ie], ["__scopeId", "data-v-ce0e972e"]]) },
790
805
  mounted() {
791
806
  this.info = this.store.mapping(this.legend), this.entries = Object.keys(this.info.props).map((e) => ({
792
807
  key: e,
793
808
  props: this.info.props[e],
794
- filled: D(this.info.legend.props, this.info.props[e])
809
+ filled: T(this.info.legend.props, this.info.props[e])
795
810
  }));
796
811
  },
797
812
  methods: { switched(e) {
@@ -801,34 +816,34 @@ var Ne = {
801
816
  selected: e.props.visible
802
817
  });
803
818
  } }
804
- }, Pe = ["data-dim"], Fe = { class: "title" }, Ie = { class: "entries" }, Le = [
819
+ }, Re = ["data-dim"], ze = { class: "title" }, Be = { class: "entries" }, Ve = [
805
820
  "data-visible",
806
821
  "data-key",
807
822
  "onClick",
808
823
  "onMouseenter"
809
- ], Re = ["innerHTML"];
810
- function ze(t, o, c, u, m, h) {
811
- let g = f("LegendSymbol");
824
+ ], He = ["innerHTML"];
825
+ function Ue(t, o, c, u, ee, m) {
826
+ let h = f("LegendSymbol");
812
827
  return l(), i("div", {
813
828
  class: "legend",
814
829
  "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({
830
+ }, [a("div", ze, p(t.info.name), 1), a("div", Be, [(l(!0), i(e, null, d(t.entries, (e) => (l(), i("div", s({
816
831
  "data-visible": e.props.visible,
817
832
  "data-key": e.key
818
833
  }, { ref_for: !0 }, Object.assign({ ...e.filled }, { name: null }), {
819
- onClick: (t) => h.switched(e),
834
+ onClick: (t) => m.switched(e),
820
835
  onMouseenter: (n) => t.$emit("highlight", {
821
836
  dim: this.legend,
822
837
  key: e.key
823
838
  }),
824
839
  onMouseleave: o[0] ||= (e) => t.$emit("highlight", {})
825
- }), [t.info.legend.symbol ? (l(), n(g, {
840
+ }), [t.info.legend.symbol ? (l(), n(h, {
826
841
  key: 0,
827
842
  info: t.info.legend.symbol,
828
843
  props: e.props
829
- }, null, 8, ["info", "props"])) : r("", !0), a("span", { innerHTML: e.filled.name }, null, 8, Re)], 16, Le))), 256))])], 8, Pe);
844
+ }, null, 8, ["info", "props"])) : r("", !0), a("span", { innerHTML: e.filled.name }, null, 8, He)], 16, Ve))), 256))])], 8, Re);
830
845
  }
831
- var Be = /*#__PURE__*/ Q(Ne, [["render", ze], ["__scopeId", "data-v-1bc8d55f"]]), Ve = {
846
+ var We = /*#__PURE__*/ Z(Le, [["render", Ue], ["__scopeId", "data-v-1bc8d55f"]]), Ge = {
832
847
  props: ["element", "globals"],
833
848
  computed: { vg() {
834
849
  return this.globals[this.element.ref];
@@ -838,22 +853,22 @@ var Be = /*#__PURE__*/ Q(Ne, [["render", ze], ["__scopeId", "data-v-1bc8d55f"]])
838
853
  this.globals[this.element.ref] = e.value, this.$emit("changeSelected", {});
839
854
  },
840
855
  equal(e) {
841
- return C(e, this.vg);
856
+ return S(e, this.vg);
842
857
  }
843
858
  }
844
- }, He = ["id"], Ue = { class: "title" }, We = {
859
+ }, Ke = ["id"], qe = { class: "title" }, Je = {
845
860
  key: 0,
846
861
  class: "entries"
847
- }, Ge = ["id", "onClick"], Ke = [
862
+ }, Ye = ["id", "onClick"], Xe = [
848
863
  "name",
849
864
  "value",
850
865
  "checked"
851
- ], qe = ["for"];
852
- function Je(t, n, o, s, c, u) {
866
+ ], Ze = ["for"];
867
+ function Qe(t, n, o, s, c, u) {
853
868
  return l(), i("div", {
854
869
  class: "formElement",
855
870
  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", {
871
+ }, [a("div", qe, p(o.element.name) + ":", 1), o.element.type == "switch" ? (l(), i("div", Je, [(l(!0), i(e, null, d(o.element.values, (e) => (l(), i("div", {
857
872
  id: `container-${e.id}`,
858
873
  onClick: (t) => u.switched(e)
859
874
  }, [a("input", {
@@ -861,11 +876,11 @@ function Je(t, n, o, s, c, u) {
861
876
  name: o.element.id,
862
877
  value: e.id,
863
878
  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);
879
+ }, null, 8, Xe), a("label", { for: e.id }, p(e.name), 9, Ze)], 8, Ye))), 256))])) : r("", !0)], 8, Ke);
865
880
  }
866
881
  //#endregion
867
882
  //#region src/comp/Vis.vue
868
- var Ye = {
883
+ var $e = {
869
884
  inject: ["store"],
870
885
  data: () => ({
871
886
  initialized: !1,
@@ -897,9 +912,9 @@ var Ye = {
897
912
  }
898
913
  },
899
914
  components: {
900
- Facet: ke,
901
- LegendEntry: Be,
902
- FormElement: /* @__PURE__ */ Q(Ve, [["render", Je], ["__scopeId", "data-v-b7f59ae7"]])
915
+ Facet: Ne,
916
+ LegendEntry: We,
917
+ FormElement: /* @__PURE__ */ Z(Ge, [["render", Qe], ["__scopeId", "data-v-ec3facd5"]])
903
918
  },
904
919
  mounted() {
905
920
  this.baseInit(), this.dataInit(), this.scales(), this.store.def.options.width || (this.resizeObserver = new ResizeObserver(() => {
@@ -915,7 +930,7 @@ var Ye = {
915
930
  },
916
931
  measure() {
917
932
  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 });
933
+ this.options.width = e.width || this.$refs.vis.getBoundingClientRect().width, this.options.height = w(e.height, { totalWidth: this.options.width });
919
934
  },
920
935
  resized() {
921
936
  let e = this.$refs.vis?.getBoundingClientRect().width;
@@ -926,12 +941,19 @@ var Ye = {
926
941
  if (this.filter = this.store.mappingNamesWithKey("props").map((e) => ({
927
942
  dim: e,
928
943
  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) {
944
+ })), this.data = o(b(this.store.data, this.filter)), t.v && this.store.mapping(t.v).stacked) {
945
+ let n = ie(this.filter.map((e) => ({
946
+ dim: e.dim,
947
+ keys: e.key
948
+ })));
949
+ ae(this.data, t, e.facets ? [e.facets.dim] : [], n);
950
+ }
951
+ if (e.facets) {
930
952
  this.facets.margins = this.options.margins, this.facets.height = this.options.height;
931
- let t = E(e.facets.cols, { totalWidth: this.options.width });
953
+ let t = w(e.facets.cols, { totalWidth: this.options.width });
932
954
  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) => ({
955
+ let n = e.facets.dim, r = Object.keys(this.store.mapping(n).props), i = y(this.data, [n]);
956
+ this.facets.entries = i.filter((e) => r.includes(e.group[n])).sort((e, t) => r.indexOf(e.group[n]) - r.indexOf(t.group[n])).map((e) => ({
935
957
  filter: {
936
958
  dim: e.group[n],
937
959
  key: n,
@@ -944,17 +966,17 @@ var Ye = {
944
966
  scales() {
945
967
  let e = this.store.def;
946
968
  if (e.facets && e.facets.scales) {
947
- let t = E(e.facets.scales, e.globals).map((e) => {
969
+ let t = w(e.facets.scales, e.globals).map((e) => {
948
970
  let t = {
949
971
  dim: e,
950
972
  mapping: this.store.mapping(e)
951
973
  };
952
- return ne(t, this.data), Y(t, {
974
+ return re(t, this.data), J(t, {
953
975
  width: this.facets.width - (this.facets.margins.left + this.facets.margins.right),
954
976
  height: this.facets.height - (this.facets.margins.top + this.facets.margins.bottom)
955
977
  }), t;
956
978
  });
957
- y(this.data, t), this.facets.shared = Object.fromEntries(t.map((e) => [e.dim, e]));
979
+ v(this.data, t), this.facets.shared = Object.fromEntries(t.map((e) => [e.dim, e]));
958
980
  }
959
981
  this.initialized = !0;
960
982
  },
@@ -965,49 +987,49 @@ var Ye = {
965
987
  this.store.applyFormElements(), this.changeSelected(e);
966
988
  },
967
989
  highlight(e) {
968
- Z(h.select(this.$refs.vis), this.store.def.plot, { [e.dim]: e.key });
990
+ X(m.select(this.$refs.vis), this.store.def.plot, { [e.dim]: e.key });
969
991
  }
970
992
  }
971
- }, Xe = { class: "vis-header" }, Ze = { class: "title" }, Qe = { class: "subtitle" }, $e = {
993
+ }, et = { class: "vis-header" }, tt = { class: "title" }, nt = { class: "subtitle" }, rt = {
972
994
  ref: "form",
973
995
  class: "vis-form-elements"
974
- }, et = {
996
+ }, it = {
975
997
  ref: "legends",
976
998
  class: "vis-legends"
977
- }, tt = {
999
+ }, at = {
978
1000
  key: 0,
979
1001
  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");
1002
+ }, ot = { class: "vis-footer" }, st = ["innerHTML"];
1003
+ function ct(t, o, s, u, ee, m) {
1004
+ let h = f("form-element"), g = f("legend-entry"), _ = f("facet");
983
1005
  return l(), i("div", {
984
1006
  class: "vis",
985
1007
  ref: "vis",
986
1008
  style: c({ "--gen-vis-font-family": t.options.fontFamily })
987
1009
  }, [
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, {
1010
+ a("div", et, [a("div", tt, p(t.options.title), 1), a("div", nt, p(t.options.subtitle), 1)]),
1011
+ a("div", rt, [(l(!0), i(e, null, d(t.formElements, (e) => (l(), n(h, {
990
1012
  element: e,
991
1013
  globals: t.globals,
992
- onChangeSelected: h.formChanged
1014
+ onChangeSelected: m.formChanged
993
1015
  }, null, 8, [
994
1016
  "element",
995
1017
  "globals",
996
1018
  "onChangeSelected"
997
1019
  ]))), 256))], 512),
998
- a("div", et, [(l(!0), i(e, null, d(t.legends, (e) => (l(), n(_, {
1020
+ a("div", it, [(l(!0), i(e, null, d(t.legends, (e) => (l(), n(g, {
999
1021
  legend: e,
1000
- onChangeSelected: h.changeSelected,
1001
- onHighlight: h.highlight
1022
+ onChangeSelected: m.changeSelected,
1023
+ onHighlight: m.highlight
1002
1024
  }, null, 8, [
1003
1025
  "legend",
1004
1026
  "onChangeSelected",
1005
1027
  "onHighlight"
1006
1028
  ]))), 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", {
1029
+ t.initialized ? (l(), i("div", at, [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
1030
  class: "facet-title",
1009
1031
  style: c(`margin-left: ${t.facets.margins.left}px`)
1010
- }, p(e.filter.name), 5), (l(), n(v, {
1032
+ }, p(e.filter.name), 5), (l(), n(_, {
1011
1033
  key: e.data,
1012
1034
  data: e.data,
1013
1035
  shared: t.facets.shared,
@@ -1020,7 +1042,7 @@ function it(t, o, s, u, m, h) {
1020
1042
  "height",
1021
1043
  "width",
1022
1044
  "margins"
1023
- ]))], 4))), 256)) : (l(), n(v, {
1045
+ ]))], 4))), 256)) : (l(), n(_, {
1024
1046
  key: t.data,
1025
1047
  data: t.data,
1026
1048
  shared: {},
@@ -1033,12 +1055,12 @@ function it(t, o, s, u, m, h) {
1033
1055
  "width",
1034
1056
  "margins"
1035
1057
  ]))])) : r("", !0),
1036
- a("div", nt, [a("span", { innerHTML: t.options.footer }, null, 8, rt)])
1058
+ a("div", ot, [a("span", { innerHTML: t.options.footer }, null, 8, st)])
1037
1059
  ], 4);
1038
1060
  }
1039
1061
  //#endregion
1040
1062
  //#region src/comp/App.vue
1041
- var at = {
1063
+ var lt = {
1042
1064
  name: "GenVis",
1043
1065
  props: {
1044
1066
  debug: {
@@ -1059,13 +1081,13 @@ var at = {
1059
1081
  }
1060
1082
  },
1061
1083
  data: () => ({
1062
- store: me(),
1084
+ store: ve(),
1063
1085
  error: null
1064
1086
  }),
1065
1087
  provide() {
1066
1088
  return { store: this.store };
1067
1089
  },
1068
- components: { VisBase: /* @__PURE__ */ Q(Ye, [["render", it], ["__scopeId", "data-v-f8fa11d2"]]) },
1090
+ components: { VisBase: /* @__PURE__ */ Z($e, [["render", ct], ["__scopeId", "data-v-b07c17d2"]]) },
1069
1091
  watch: {
1070
1092
  def: "init",
1071
1093
  defFile: "init",
@@ -1094,34 +1116,34 @@ var at = {
1094
1116
  console.error(e), this.error = e.message;
1095
1117
  }
1096
1118
  }
1097
- }, ot = { class: "vis-outer" }, st = {
1119
+ }, ut = { class: "vis-outer" }, dt = {
1098
1120
  key: 0,
1099
1121
  class: "vis-error"
1100
- }, ct = { key: 2 }, lt = { style: {
1122
+ }, ft = { key: 2 }, pt = { style: {
1101
1123
  height: "500px",
1102
1124
  overflow: "auto",
1103
1125
  "font-size": "11px"
1104
- } }, ut = { style: {
1126
+ } }, mt = { style: {
1105
1127
  height: "500px",
1106
1128
  overflow: "auto",
1107
1129
  "font-size": "11px"
1108
1130
  } };
1109
- function dt(e, t, o, s, c, u) {
1131
+ function ht(e, t, o, s, c, u) {
1110
1132
  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, [
1133
+ return l(), i("div", ut, [e.error ? (l(), i("div", dt, p(e.error), 1)) : e.store.loaded ? (l(), n(d, { key: 1 })) : r("", !0), o.debug && e.store.def ? (l(), i("div", ft, [
1112
1134
  t[0] ||= a("h3", null, "prepared:", -1),
1113
- a("pre", lt, p(JSON.stringify(e.store.def, null, 4)), 1),
1135
+ a("pre", pt, p(JSON.stringify(e.store.def, null, 4)), 1),
1114
1136
  t[1] ||= a("h3", null, "org:", -1),
1115
- a("pre", ut, p(JSON.stringify(e.store.defOrg, null, 4)), 1)
1137
+ a("pre", mt, p(JSON.stringify(e.store.defOrg, null, 4)), 1)
1116
1138
  ])) : r("", !0)]);
1117
1139
  }
1118
- var $ = /*#__PURE__*/ Q(at, [["render", dt], ["__scopeId", "data-v-a9d47434"]]), ft = { install(e) {
1119
- e.component("GenVis", $);
1120
- } }, pt = (e) => {
1140
+ var Q = /*#__PURE__*/ Z(lt, [["render", ht], ["__scopeId", "data-v-a9d47434"]]), gt = { install(e) {
1141
+ e.component("GenVis", Q);
1142
+ } }, $ = (e) => {
1121
1143
  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));
1144
+ return t(Q, n).mount(e);
1145
+ }, _t = (e) => {
1146
+ for (let t of document.getElementsByClassName(e)) t.classList.contains("gen-vis-attached") || (t.classList.add("gen-vis-attached"), $(t));
1125
1147
  };
1126
1148
  //#endregion
1127
- export { $ as GenVis, ft as default, mt as mountGenVisByClass, pt as mountGenVisElement };
1149
+ export { Q as GenVis, gt as default, _t as mountGenVisByClass, $ as mountGenVisElement };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preschen/gen-vis",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "A declarative d3 visualisation library",
5
5
  "type": "module",
6
6
  "main": "dist/gen-vis.js",
package/schema.json CHANGED
@@ -229,7 +229,10 @@
229
229
  "type": "object",
230
230
  "additionalProperties": false,
231
231
  "properties": {
232
- "column": { "type": "string" },
232
+ "column": {
233
+ "type": "string",
234
+ "description": "The column of the data, can be a template of globals, e.g. \"{values}{share}\", see formElements."
235
+ },
233
236
  "type": {
234
237
  "enum": ["numeric", "date", "categorical"],
235
238
  "description": "Missing and invalid numeric and date values are null, dates are parsed with Date.parse or are timestamps."