baselode 0.1.21 → 0.1.22

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/dist/tool-ui.js CHANGED
@@ -1,90 +1,96 @@
1
- import { z as t } from "zod";
2
- import { jsxs as w, jsx as c } from "react/jsx-runtime";
3
- import { useMemo as x, useState as F, useEffect as V, useRef as H } from "react";
4
- import Y from "plotly.js-dist-min";
5
- import { s as ee, J as oe, c as te, j as R, l as Q, aH as W, o as le, m as ne, t as re, g as ie, U as se, aG as ae } from "./baselode3dScene-CLEvddGM.js";
6
- const pe = t.union([t.string(), t.number(), t.boolean(), t.null()]), v = t.record(t.string(), t.unknown()), q = t.tuple([t.number(), t.number()]), de = t.object({
7
- id: t.string().optional(),
8
- property: t.string().min(1),
9
- label: t.string().optional(),
10
- displayType: t.enum(["numeric", "categorical"]).default("numeric"),
11
- chartType: t.enum(["bar", "markers", "line", "markers+line", "categorical"]).optional(),
12
- colourMap: t.union([t.string(), t.record(t.string(), t.string())]).optional(),
13
- propertyOptions: t.array(t.string().min(1)).optional(),
14
- allowPropertySelection: t.boolean().optional(),
15
- allowChartTypeSelection: t.boolean().optional(),
16
- showLegend: t.boolean().optional()
17
- }), ue = t.object({
18
- id: t.string().min(1),
19
- title: t.string().optional(),
20
- subtitle: t.string().optional(),
21
- hole: t.object({
22
- id: t.string().min(1),
23
- points: t.array(v),
24
- metadata: t.record(t.string(), pe).optional()
1
+ import { z as e } from "zod";
2
+ import { jsxs as w, jsx as u } from "react/jsx-runtime";
3
+ import { useMemo as x, useState as H, useEffect as $, useRef as Y } from "react";
4
+ import Q from "plotly.js-dist-min";
5
+ import { t as ne, K as re, c as ie, a9 as se, a7 as ae, aL as pe, j as D, l as k, aK as ee, n as W, p as de, m as ue, u as ce, g as ye, V as be, aJ as fe } from "./baselode3dScene-4nzt80B1.js";
6
+ const me = e.union([e.string(), e.number(), e.boolean(), e.null()]), N = e.record(e.string(), e.unknown()), X = e.tuple([e.number(), e.number()]), ge = e.object({
7
+ label: e.string().optional(),
8
+ unit: e.string().nullish(),
9
+ sourceAttribute: e.string().nullish()
10
+ }), he = e.object({
11
+ id: e.string().optional(),
12
+ property: e.string().min(1),
13
+ label: e.string().optional(),
14
+ displayType: e.enum(["numeric", "categorical"]).default("numeric"),
15
+ chartType: e.enum(["bar", "markers", "line", "markers+line", "categorical"]).optional(),
16
+ colourMap: e.union([e.string(), e.record(e.string(), e.string())]).optional(),
17
+ propertyOptions: e.array(e.string().min(1)).optional(),
18
+ allowPropertySelection: e.boolean().optional(),
19
+ allowChartTypeSelection: e.boolean().optional(),
20
+ showLegend: e.boolean().optional()
21
+ }), Se = e.object({
22
+ id: e.string().min(1),
23
+ title: e.string().optional(),
24
+ subtitle: e.string().optional(),
25
+ hole: e.object({
26
+ id: e.string().min(1),
27
+ points: e.array(N),
28
+ metadata: e.record(e.string(), me).optional()
25
29
  }),
26
- tracks: t.array(de).min(1),
27
- height: t.number().positive().max(1200).optional(),
28
- template: t.enum(["baselode", "baselode-dark", "plotly-default"]).optional(),
29
- showModeBar: t.boolean().optional(),
30
- propertyOptions: t.array(t.string().min(1)).optional(),
31
- allowPropertySelection: t.boolean().optional(),
32
- allowChartTypeSelection: t.boolean().optional(),
33
- showLegend: t.boolean().optional(),
34
- depthRange: q.optional(),
35
- defaultDepthRange: q.optional()
30
+ tracks: e.array(he).min(1),
31
+ height: e.number().positive().max(1200).optional(),
32
+ template: e.enum(["baselode", "baselode-dark", "plotly-default"]).optional(),
33
+ showModeBar: e.boolean().optional(),
34
+ propertyOptions: e.array(e.string().min(1)).optional(),
35
+ propertyMeta: e.record(e.string(), ge).optional(),
36
+ deriveMetaFromRows: e.boolean().optional(),
37
+ allowPropertySelection: e.boolean().optional(),
38
+ allowChartTypeSelection: e.boolean().optional(),
39
+ showLegend: e.boolean().optional(),
40
+ depthRange: X.optional(),
41
+ defaultDepthRange: X.optional()
36
42
  });
37
- function Le(o) {
38
- const e = ue.safeParse(o);
39
- return e.success ? e.data : null;
43
+ function Ie(o) {
44
+ const t = Se.safeParse(o);
45
+ return t.success ? t.data : null;
40
46
  }
41
- const ye = t.object({
42
- id: t.string().min(1),
43
- title: t.string().optional(),
44
- subtitle: t.string().optional(),
45
- height: t.number().positive().max(1400).optional(),
46
- background: t.enum(["white", "black"]).optional(),
47
- controlMode: t.enum(["orbit", "fly"]).optional(),
48
- drillholes: t.object({
49
- holes: t.array(v),
50
- options: v.optional()
47
+ const Te = e.object({
48
+ id: e.string().min(1),
49
+ title: e.string().optional(),
50
+ subtitle: e.string().optional(),
51
+ height: e.number().positive().max(1400).optional(),
52
+ background: e.enum(["white", "black"]).optional(),
53
+ controlMode: e.enum(["orbit", "fly"]).optional(),
54
+ drillholes: e.object({
55
+ holes: e.array(N),
56
+ options: N.optional()
51
57
  }).optional(),
52
- stripLogs: t.array(v).optional(),
53
- structuralDiscs: t.object({
54
- structures: t.array(v),
55
- options: v.optional(),
56
- visible: t.boolean().optional()
58
+ stripLogs: e.array(N).optional(),
59
+ structuralDiscs: e.object({
60
+ structures: e.array(N),
61
+ options: N.optional(),
62
+ visible: e.boolean().optional()
57
63
  }).optional(),
58
- blocks: t.object({
59
- data: t.array(v),
60
- selectedProperty: t.string().min(1),
61
- stats: v.optional(),
62
- options: v.optional()
64
+ blocks: e.object({
65
+ data: e.array(N),
66
+ selectedProperty: e.string().min(1),
67
+ stats: N.optional(),
68
+ options: N.optional()
63
69
  }).optional(),
64
- rasterOverlays: t.array(t.object({
65
- id: t.string().optional(),
66
- name: t.string().optional(),
67
- source: t.object({
68
- type: t.literal("url"),
69
- url: t.string().min(1)
70
+ rasterOverlays: e.array(e.object({
71
+ id: e.string().optional(),
72
+ name: e.string().optional(),
73
+ source: e.object({
74
+ type: e.literal("url"),
75
+ url: e.string().min(1)
70
76
  }),
71
- bounds: v,
72
- elevation: t.number().optional(),
73
- opacity: t.number().optional(),
74
- visible: t.boolean().optional(),
75
- renderOrder: t.number().optional()
77
+ bounds: N,
78
+ elevation: e.number().optional(),
79
+ opacity: e.number().optional(),
80
+ visible: e.boolean().optional(),
81
+ renderOrder: e.number().optional()
76
82
  })).optional(),
77
- camera: t.object({
78
- viewState: v.optional(),
79
- fitToBounds: t.boolean().optional(),
80
- focusPadding: t.number().positive().optional()
83
+ camera: e.object({
84
+ viewState: N.optional(),
85
+ fitToBounds: e.boolean().optional(),
86
+ focusPadding: e.number().positive().optional()
81
87
  }).optional()
82
88
  });
83
- function Ae(o) {
84
- const e = ye.safeParse(o);
85
- return e.success ? e.data : null;
89
+ function Ue(o) {
90
+ const t = Te.safeParse(o);
91
+ return t.success ? t.data : null;
86
92
  }
87
- function ce(o) {
93
+ function _e(o) {
88
94
  return {
89
95
  "--baselode-tool-bg": o.bg,
90
96
  "--baselode-tool-panel": o.panel,
@@ -99,410 +105,425 @@ function ce(o) {
99
105
  "--baselode-tool-primary": o.primary || o.accent
100
106
  };
101
107
  }
102
- function K(o) {
108
+ function q(o) {
103
109
  return o === "baselode-dark" || o === "black" ? "baselode-dark" : "baselode";
104
110
  }
105
- function X(o) {
106
- return ce(
107
- K(o) === "baselode-dark" ? ee : oe
111
+ function oe(o) {
112
+ return _e(
113
+ q(o) === "baselode-dark" ? ne : re
108
114
  );
109
115
  }
110
- function be(o) {
111
- return o === "baselode-dark" ? re : o === "plotly-default" ? null : ie;
116
+ function ve(o) {
117
+ return o === "baselode-dark" ? ce : o === "plotly-default" ? null : ye;
112
118
  }
113
- function $(o) {
119
+ function G(o) {
114
120
  if (!Array.isArray(o) || o.length !== 2) return null;
115
- const e = Number(o[0]), n = Number(o[1]);
116
- return !Number.isFinite(e) || !Number.isFinite(n) || e === n ? null : e < n ? [e, n] : [n, e];
121
+ const t = Number(o[0]), n = Number(o[1]);
122
+ return !Number.isFinite(t) || !Number.isFinite(n) || t === n ? null : t < n ? [t, n] : [n, t];
117
123
  }
118
- function me(o) {
124
+ function Le(o) {
119
125
  if (o)
120
126
  return [o[1], o[0]];
121
127
  }
122
- function fe(o) {
128
+ function Ne(o) {
123
129
  if (!o || typeof o != "object") return null;
124
- const e = o["yaxis.range"];
125
- if (Array.isArray(e) && e.length === 2)
126
- return $(e);
127
- const n = o["yaxis.range[0]"], i = o["yaxis.range[1]"];
128
- return n !== void 0 && i !== void 0 ? $([n, i]) : null;
130
+ const t = o["yaxis.range"];
131
+ if (Array.isArray(t) && t.length === 2)
132
+ return G(t);
133
+ const n = o["yaxis.range[0]"], r = o["yaxis.range[1]"];
134
+ return n !== void 0 && r !== void 0 ? G([n, r]) : null;
129
135
  }
130
- function Z(o, e) {
131
- return !!(o && o !== e);
136
+ function te(o, t) {
137
+ return !!(o && o !== t);
132
138
  }
133
- function k(o, e) {
139
+ function le(o, t) {
134
140
  const n = [...o.numericCols, ...o.categoricalCols];
135
- if (!(e != null && e.length)) return n;
136
- const i = new Set(n);
137
- return e.filter((b) => i.has(b));
141
+ if (!(t != null && t.length)) return n;
142
+ const r = new Set(n);
143
+ return t.filter((y) => r.has(y));
138
144
  }
139
- function C(o, {
140
- trackIndex: e = 0,
145
+ function Z(o, {
146
+ trackIndex: t = 0,
141
147
  selectableProperties: n,
142
- classified: i,
143
- allowPropertySelection: b,
144
- allowChartTypeSelection: B,
145
- showLegend: p
148
+ classified: r,
149
+ allowPropertySelection: y,
150
+ allowChartTypeSelection: j,
151
+ showLegend: b
146
152
  }) {
147
- const S = k(i, o.propertyOptions ?? n), d = S.includes(o.property) ? o.property : S[0] ?? o.property, m = i.byType[d] === R ? R : "numeric", a = o.chartType === "categorical" || o.displayType === R ? R : m, g = Q(a).some((P) => P.value === o.chartType) ? o.chartType : W(a);
153
+ const f = le(r, o.propertyOptions ?? n), s = f.includes(o.property) ? o.property : f[0] ?? o.property, a = r.byType[s] === D ? D : "numeric", S = o.chartType === "categorical" || o.displayType === D ? D : a, v = k(S).some((T) => T.value === o.chartType) ? o.chartType : ee(S);
148
154
  return {
149
155
  ...o,
150
- id: o.id || `${d}-${e + 1}`,
151
- property: d,
152
- label: Z(o.label, o.property) ? o.label : void 0,
153
- displayType: a,
154
- chartType: g,
155
- propertyOptions: S,
156
- allowPropertySelection: o.allowPropertySelection ?? b ?? !1,
157
- allowChartTypeSelection: o.allowChartTypeSelection ?? B ?? !1,
158
- showLegend: o.showLegend ?? p ?? a === R
156
+ id: o.id || `${s}-${t + 1}`,
157
+ property: s,
158
+ label: te(o.label, o.property) ? o.label : void 0,
159
+ displayType: S,
160
+ chartType: v,
161
+ propertyOptions: f,
162
+ allowPropertySelection: o.allowPropertySelection ?? y ?? !1,
163
+ allowChartTypeSelection: o.allowChartTypeSelection ?? j ?? !1,
164
+ showLegend: o.showLegend ?? b ?? S === D
159
165
  };
160
166
  }
161
- function ge(o) {
162
- return !Array.isArray(o) || !o.length ? [] : o.map((e) => {
163
- var b;
164
- const n = (b = e == null ? void 0 : e.marker) == null ? void 0 : b.color, i = e == null ? void 0 : e.name;
165
- return !i || typeof n != "string" ? null : { label: i, color: n };
167
+ function we(o) {
168
+ return !Array.isArray(o) || !o.length ? [] : o.map((t) => {
169
+ var y;
170
+ const n = (y = t == null ? void 0 : t.marker) == null ? void 0 : y.color, r = t == null ? void 0 : t.name;
171
+ return !r || typeof n != "string" ? null : { label: r, color: n };
166
172
  }).filter(Boolean);
167
173
  }
168
- function he(o, e) {
169
- return e ? {
174
+ function Ae(o, t) {
175
+ return t ? {
170
176
  ...o,
171
177
  yaxis: {
172
178
  ...o.yaxis || {},
173
179
  autorange: !1,
174
- range: me(e)
180
+ range: Le(t)
175
181
  }
176
182
  } : o;
177
183
  }
178
- function Se({
184
+ function Pe({
179
185
  hole: o,
180
- track: e,
181
- height: n,
182
- template: i,
183
- showModeBar: b,
184
- depthRange: B,
185
- onTrackChange: p,
186
- onIntervalClick: S,
187
- onDepthRangeChange: d
186
+ track: t,
187
+ propertyMeta: n,
188
+ height: r,
189
+ template: y,
190
+ showModeBar: j,
191
+ depthRange: b,
192
+ onTrackChange: f,
193
+ onIntervalClick: s,
194
+ onDepthRangeChange: a
188
195
  }) {
189
- const m = H(null), a = e.displayType === R || e.chartType === "categorical", u = x(
190
- () => le(o, e.property, a),
191
- [o, a, e.property]
192
- ), g = x(() => {
193
- const l = ne({
194
- points: u,
195
- isCategorical: a,
196
- property: e.label || e.property,
197
- chartType: e.chartType || (a ? "categorical" : "markers+line"),
198
- colourMap: e.colourMap,
199
- template: be(i)
196
+ const S = Y(null), i = t.displayType === D || t.chartType === "categorical", v = n == null ? void 0 : n[t.property], T = W(t.label || t.property, v), C = x(
197
+ () => de(o, t.property, i),
198
+ [o, i, t.property]
199
+ ), _ = x(() => {
200
+ const l = ue({
201
+ points: C,
202
+ isCategorical: i,
203
+ property: t.label || t.property,
204
+ chartType: t.chartType || (i ? "categorical" : "markers+line"),
205
+ colourMap: t.colourMap,
206
+ template: ve(y),
207
+ meta: v
200
208
  });
201
209
  return {
202
210
  data: l.data,
203
- layout: he(l.layout, B)
211
+ layout: Ae(l.layout, b)
204
212
  };
205
- }, [B, a, u, i, e.chartType, e.colourMap, e.label, e.property]), P = x(
206
- () => e.showLegend && a ? ge(g.data) : [],
207
- [a, g.data, e.showLegend]
208
- ), N = x(
209
- () => Q(e.displayType),
210
- [e.displayType]
213
+ }, [b, i, v, C, y, t.chartType, t.colourMap, t.label, t.property]), A = x(
214
+ () => t.showLegend && i ? we(_.data) : [],
215
+ [i, _.data, t.showLegend]
216
+ ), P = x(
217
+ () => k(t.displayType),
218
+ [t.displayType]
211
219
  );
212
- return V(() => {
213
- var r, j, _, f;
214
- const l = m.current;
220
+ return $(() => {
221
+ var O, K, I, d;
222
+ const l = S.current;
215
223
  if (!l) return;
216
- if (!g.data.length) {
217
- l.replaceChildren(document.createTextNode(`No data for ${e.property}`));
224
+ if (!_.data.length) {
225
+ l.replaceChildren(document.createTextNode(`No data for ${T}`));
218
226
  return;
219
227
  }
220
- const I = (L) => {
221
- var z, O;
222
- const h = (z = L == null ? void 0 : L.points) == null ? void 0 : z[0];
223
- if (!h || !S) return;
224
- const A = Array.isArray(h.customdata) ? h.customdata : [];
225
- S({
226
- trackId: e.id || e.property,
227
- property: e.property,
228
- value: a ? (O = h.data) == null ? void 0 : O.name : h.x,
229
- from: Number(A[0]),
230
- to: Number(A[1]),
231
- pointIndex: h.pointIndex
228
+ const F = (B) => {
229
+ var M, R;
230
+ const g = (M = B == null ? void 0 : B.points) == null ? void 0 : M[0];
231
+ if (!g || !s) return;
232
+ const E = Array.isArray(g.customdata) ? g.customdata : [];
233
+ s({
234
+ trackId: t.id || t.property,
235
+ property: t.property,
236
+ value: i ? (R = g.data) == null ? void 0 : R.name : g.x,
237
+ from: Number(E[0]),
238
+ to: Number(E[1]),
239
+ pointIndex: g.pointIndex
232
240
  });
233
- }, E = (L) => {
234
- const h = fe(L);
235
- h && d && d({
236
- trackId: e.id || e.property,
237
- depthRange: h
241
+ }, c = (B) => {
242
+ const g = Ne(B);
243
+ g && a && a({
244
+ trackId: t.id || t.property,
245
+ depthRange: g
238
246
  });
239
247
  };
240
- return (r = l.removeAllListeners) == null || r.call(l, "plotly_click"), (j = l.removeAllListeners) == null || j.call(l, "plotly_relayout"), Y.react(
248
+ return (O = l.removeAllListeners) == null || O.call(l, "plotly_click"), (K = l.removeAllListeners) == null || K.call(l, "plotly_relayout"), Q.react(
241
249
  l,
242
- g.data,
250
+ _.data,
243
251
  {
244
- ...g.layout,
245
- height: n,
252
+ ..._.layout,
253
+ height: r,
246
254
  title: void 0,
247
- margin: { ...g.layout.margin, t: 12 }
255
+ margin: { ..._.layout.margin, t: 12 }
248
256
  },
249
257
  {
250
- displayModeBar: b,
258
+ displayModeBar: j,
251
259
  responsive: !0
252
260
  }
253
- ), S && ((_ = l.on) == null || _.call(l, "plotly_click", I)), d && ((f = l.on) == null || f.call(l, "plotly_relayout", E)), () => {
254
- Y.purge(l);
261
+ ), s && ((I = l.on) == null || I.call(l, "plotly_click", F)), a && ((d = l.on) == null || d.call(l, "plotly_relayout", c)), () => {
262
+ Q.purge(l);
255
263
  };
256
264
  }, [
257
- n,
258
- d,
259
- S,
260
- g.data,
261
- g.layout,
262
- b,
263
- e.id,
264
- e.property,
265
- a
266
- ]), /* @__PURE__ */ w("section", { className: "baselode-tool-strip-log__track", "aria-label": e.label || e.property, children: [
267
- /* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__track-title", children: e.label || e.property }),
268
- (e.allowPropertySelection || e.allowChartTypeSelection && N.length > 1) && /* @__PURE__ */ w("div", { className: "baselode-tool-strip-log__controls", children: [
269
- e.allowPropertySelection && e.propertyOptions.length > 0 && /* @__PURE__ */ w("label", { className: "baselode-tool-strip-log__control", children: [
270
- /* @__PURE__ */ c("span", { children: "Property" }),
271
- /* @__PURE__ */ c(
265
+ r,
266
+ a,
267
+ s,
268
+ _.data,
269
+ _.layout,
270
+ j,
271
+ t.id,
272
+ t.property,
273
+ T,
274
+ i
275
+ ]), /* @__PURE__ */ w("section", { className: "baselode-tool-strip-log__track", "aria-label": T, children: [
276
+ /* @__PURE__ */ u("div", { className: "baselode-tool-strip-log__track-title", children: T }),
277
+ (t.allowPropertySelection || t.allowChartTypeSelection && P.length > 1) && /* @__PURE__ */ w("div", { className: "baselode-tool-strip-log__controls", children: [
278
+ t.allowPropertySelection && t.propertyOptions.length > 0 && /* @__PURE__ */ w("label", { className: "baselode-tool-strip-log__control", children: [
279
+ /* @__PURE__ */ u("span", { children: "Property" }),
280
+ /* @__PURE__ */ u(
272
281
  "select",
273
282
  {
274
- value: e.property,
283
+ value: t.property,
275
284
  onChange: (l) => {
276
- p == null || p({
277
- ...e,
285
+ f == null || f({
286
+ ...t,
278
287
  property: l.target.value
279
288
  });
280
289
  },
281
- children: e.propertyOptions.map((l) => /* @__PURE__ */ c("option", { value: l, children: l }, l))
290
+ children: t.propertyOptions.map((l) => /* @__PURE__ */ u("option", { value: l, children: W(l, n == null ? void 0 : n[l]) }, l))
282
291
  }
283
292
  )
284
293
  ] }),
285
- e.allowChartTypeSelection && N.length > 1 && /* @__PURE__ */ w("label", { className: "baselode-tool-strip-log__control", children: [
286
- /* @__PURE__ */ c("span", { children: "Chart" }),
287
- /* @__PURE__ */ c(
294
+ t.allowChartTypeSelection && P.length > 1 && /* @__PURE__ */ w("label", { className: "baselode-tool-strip-log__control", children: [
295
+ /* @__PURE__ */ u("span", { children: "Chart" }),
296
+ /* @__PURE__ */ u(
288
297
  "select",
289
298
  {
290
- value: e.chartType,
299
+ value: t.chartType,
291
300
  onChange: (l) => {
292
- p == null || p({
293
- ...e,
301
+ f == null || f({
302
+ ...t,
294
303
  chartType: l.target.value
295
304
  });
296
305
  },
297
- children: N.map((l) => /* @__PURE__ */ c("option", { value: l.value, children: l.label }, l.value))
306
+ children: P.map((l) => /* @__PURE__ */ u("option", { value: l.value, children: l.label }, l.value))
298
307
  }
299
308
  )
300
309
  ] })
301
310
  ] }),
302
- /* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__plot", ref: m }),
303
- P.length > 0 && /* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__legend", children: P.map((l) => /* @__PURE__ */ w("div", { className: "baselode-tool-strip-log__legend-row", children: [
304
- /* @__PURE__ */ c(
311
+ /* @__PURE__ */ u("div", { className: "baselode-tool-strip-log__plot", ref: S }),
312
+ A.length > 0 && /* @__PURE__ */ u("div", { className: "baselode-tool-strip-log__legend", children: A.map((l) => /* @__PURE__ */ w("div", { className: "baselode-tool-strip-log__legend-row", children: [
313
+ /* @__PURE__ */ u(
305
314
  "span",
306
315
  {
307
316
  className: "baselode-tool-strip-log__legend-swatch",
308
317
  style: { backgroundColor: l.color }
309
318
  }
310
319
  ),
311
- /* @__PURE__ */ c("span", { children: l.label })
320
+ /* @__PURE__ */ u("span", { children: l.label })
312
321
  ] }, l.label)) })
313
322
  ] });
314
323
  }
315
- function Be({
324
+ function De({
316
325
  id: o,
317
- title: e,
326
+ title: t,
318
327
  subtitle: n,
319
- hole: i,
320
- tracks: b,
321
- height: B = 420,
322
- template: p = "baselode",
323
- showModeBar: S = !1,
324
- propertyOptions: d,
325
- allowPropertySelection: m = !1,
326
- allowChartTypeSelection: a = !1,
327
- showLegend: u,
328
- depthRange: g,
329
- defaultDepthRange: P,
330
- onPropertyChange: N,
331
- onTrackChange: l,
332
- onIntervalClick: I,
333
- onDepthRangeChange: E
328
+ hole: r,
329
+ tracks: y,
330
+ height: j = 420,
331
+ template: b = "baselode",
332
+ showModeBar: f = !1,
333
+ propertyOptions: s,
334
+ propertyMeta: a,
335
+ deriveMetaFromRows: S = !1,
336
+ allowPropertySelection: i = !1,
337
+ allowChartTypeSelection: v = !1,
338
+ showLegend: T,
339
+ depthRange: C,
340
+ defaultDepthRange: _,
341
+ onPropertyChange: A,
342
+ onTrackChange: P,
343
+ onIntervalClick: l,
344
+ onDepthRangeChange: F
334
345
  }) {
335
- const r = x(
336
- () => te((i == null ? void 0 : i.points) || []),
337
- [i]
338
- ), j = x(
339
- () => k(r, d),
340
- [r, d]
341
- ), _ = x(
342
- () => b.map((y, T) => C(y, {
343
- trackIndex: T,
344
- selectableProperties: j,
345
- classified: r,
346
- allowPropertySelection: m,
347
- allowChartTypeSelection: a,
348
- showLegend: u
346
+ const c = x(
347
+ () => ie((r == null ? void 0 : r.points) || []),
348
+ [r]
349
+ ), O = x(
350
+ () => le(c, s),
351
+ [c, s]
352
+ ), K = x(() => {
353
+ const p = a && typeof a == "object" ? a : null;
354
+ if (!S) return p ?? void 0;
355
+ const m = [...c.numericCols, ...c.categoricalCols].filter((z) => z !== se && z !== ae), h = pe((r == null ? void 0 : r.points) || [], m);
356
+ if (!p) return h;
357
+ const V = { ...h };
358
+ return Object.entries(p).forEach(([z, U]) => {
359
+ V[z] = { ...h[z], ...U };
360
+ }), V;
361
+ }, [a, S, c, r]), I = x(
362
+ () => y.map((p, m) => Z(p, {
363
+ trackIndex: m,
364
+ selectableProperties: O,
365
+ classified: c,
366
+ allowPropertySelection: i,
367
+ allowChartTypeSelection: v,
368
+ showLegend: T
349
369
  })),
350
- [a, m, r, j, u, b]
351
- ), f = $(g), L = f ?? $(P), [h, A] = F(_), [z, O] = F(L);
352
- V(() => {
353
- A(_);
354
- }, [_]), V(() => {
355
- f && O(f);
356
- }, [f == null ? void 0 : f[0], f == null ? void 0 : f[1]]);
357
- const U = f ?? z;
358
- function J(y) {
359
- const T = h.map((s) => {
360
- if ((s.id || s.property) !== (y.id || y.property))
361
- return s;
362
- const G = y.property ?? s.property, D = r.byType[G] === R ? R : "numeric", M = C({
363
- ...s,
364
- ...y,
365
- property: G,
366
- displayType: y.chartType === "categorical" ? R : D,
367
- chartType: y.property && y.property !== s.property ? W(D) : y.chartType ?? s.chartType,
368
- label: Z(s.label, s.property) ? s.label : void 0
370
+ [v, i, c, O, T, y]
371
+ ), d = G(C), B = d ?? G(_), [g, E] = H(I), [M, R] = H(B);
372
+ $(() => {
373
+ E(I);
374
+ }, [I]), $(() => {
375
+ d && R(d);
376
+ }, [d == null ? void 0 : d[0], d == null ? void 0 : d[1]]);
377
+ const J = d ?? M;
378
+ function L(p) {
379
+ const m = g.map((h) => {
380
+ if ((h.id || h.property) !== (p.id || p.property))
381
+ return h;
382
+ const V = p.property ?? h.property, z = c.byType[V] === D ? D : "numeric", U = Z({
383
+ ...h,
384
+ ...p,
385
+ property: V,
386
+ displayType: p.chartType === "categorical" ? D : z,
387
+ chartType: p.property && p.property !== h.property ? ee(z) : p.chartType ?? h.chartType,
388
+ label: te(h.label, h.property) ? h.label : void 0
369
389
  }, {
370
- selectableProperties: j,
371
- classified: r,
372
- allowPropertySelection: m,
373
- allowChartTypeSelection: a,
374
- showLegend: u
390
+ selectableProperties: O,
391
+ classified: c,
392
+ allowPropertySelection: i,
393
+ allowChartTypeSelection: v,
394
+ showLegend: T
375
395
  });
376
- return l == null || l(M), G !== s.property && (N == null || N({
377
- trackId: M.id || M.property,
378
- property: M.property,
379
- displayType: M.displayType,
380
- chartType: M.chartType
381
- })), M;
396
+ return P == null || P(U), V !== h.property && (A == null || A({
397
+ trackId: U.id || U.property,
398
+ property: U.property,
399
+ displayType: U.displayType,
400
+ chartType: U.chartType
401
+ })), U;
382
402
  });
383
- A(T);
403
+ E(m);
384
404
  }
385
405
  return /* @__PURE__ */ w(
386
406
  "article",
387
407
  {
388
408
  className: "baselode-tool-strip-log",
389
409
  "data-tool-ui-id": o,
390
- "data-baselode-theme": K(p),
391
- style: X(p),
410
+ "data-baselode-theme": q(b),
411
+ style: oe(b),
392
412
  children: [
393
413
  /* @__PURE__ */ w("header", { className: "baselode-tool-strip-log__header", children: [
394
414
  /* @__PURE__ */ w("div", { children: [
395
- /* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__eyebrow", children: i.id }),
396
- /* @__PURE__ */ c("h3", { children: e || "Strip log" })
415
+ /* @__PURE__ */ u("div", { className: "baselode-tool-strip-log__eyebrow", children: r.id }),
416
+ /* @__PURE__ */ u("h3", { children: t || "Strip log" })
397
417
  ] }),
398
- n && /* @__PURE__ */ c("p", { children: n })
418
+ n && /* @__PURE__ */ u("p", { children: n })
399
419
  ] }),
400
- /* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__tracks", children: h.map((y) => /* @__PURE__ */ c(
401
- Se,
420
+ /* @__PURE__ */ u("div", { className: "baselode-tool-strip-log__tracks", children: g.map((p) => /* @__PURE__ */ u(
421
+ Pe,
402
422
  {
403
- hole: i,
404
- track: y,
405
- height: B,
406
- template: p,
407
- showModeBar: S,
408
- depthRange: U,
409
- onTrackChange: J,
410
- onIntervalClick: I,
411
- onDepthRangeChange: (T) => {
412
- !f && (T != null && T.depthRange) && O(T.depthRange), E == null || E(T);
423
+ hole: r,
424
+ track: p,
425
+ propertyMeta: K,
426
+ height: j,
427
+ template: b,
428
+ showModeBar: f,
429
+ depthRange: J,
430
+ onTrackChange: L,
431
+ onIntervalClick: l,
432
+ onDepthRangeChange: (m) => {
433
+ !d && (m != null && m.depthRange) && R(m.depthRange), F == null || F(m);
413
434
  }
414
435
  },
415
- y.id || y.property
436
+ p.id || p.property
416
437
  )) })
417
438
  ]
418
439
  }
419
440
  );
420
441
  }
421
- function Pe({
442
+ function ze({
422
443
  id: o,
423
- title: e,
444
+ title: t,
424
445
  subtitle: n,
425
- height: i = 520,
426
- background: b = "white",
427
- controlMode: B = "orbit",
428
- drillholes: p,
429
- stripLogs: S = [],
430
- structuralDiscs: d,
431
- blocks: m,
432
- rasterOverlays: a = [],
433
- camera: u
446
+ height: r = 520,
447
+ background: y = "white",
448
+ controlMode: j = "orbit",
449
+ drillholes: b,
450
+ stripLogs: f = [],
451
+ structuralDiscs: s,
452
+ blocks: a,
453
+ rasterOverlays: S = [],
454
+ camera: i
434
455
  }) {
435
- const g = H(null), P = H(null), [N, l] = F("");
436
- return V(() => {
437
- const I = g.current;
438
- if (!I) return;
439
- let E = !1;
440
- const r = new se();
441
- P.current = r;
442
- async function j() {
443
- var f, L, h, A, z, O, U, J, y, T;
456
+ const v = Y(null), T = Y(null), [C, _] = H("");
457
+ return $(() => {
458
+ const A = v.current;
459
+ if (!A) return;
460
+ let P = !1;
461
+ const l = new be();
462
+ T.current = l;
463
+ async function F() {
464
+ var O, K, I, d, B, g, E, M, R, J;
444
465
  try {
445
- l(""), r.init(I), r.setBackground(b), r.setControlMode(B);
446
- const s = (p == null ? void 0 : p.holes) || [];
447
- s.length && r.setDrillholes(s, (p == null ? void 0 : p.options) || {}), s.length && S.length && r.setStripLogs(s, S), (f = d == null ? void 0 : d.structures) != null && f.length && (r.setStructuralDiscs(
448
- d.structures,
449
- s,
450
- d.options || {}
451
- ), d.visible !== void 0 && r.setStructuralDiscsVisible(d.visible)), (L = m == null ? void 0 : m.data) != null && L.length && r.setBlocks(
452
- m.data,
453
- m.selectedProperty,
454
- m.stats || {},
455
- m.options || {}
466
+ _(""), l.init(A), l.setBackground(y), l.setControlMode(j);
467
+ const L = (b == null ? void 0 : b.holes) || [];
468
+ L.length && l.setDrillholes(L, (b == null ? void 0 : b.options) || {}), L.length && f.length && l.setStripLogs(L, f), (O = s == null ? void 0 : s.structures) != null && O.length && (l.setStructuralDiscs(
469
+ s.structures,
470
+ L,
471
+ s.options || {}
472
+ ), s.visible !== void 0 && l.setStructuralDiscsVisible(s.visible)), (K = a == null ? void 0 : a.data) != null && K.length && l.setBlocks(
473
+ a.data,
474
+ a.selectedProperty,
475
+ a.stats || {},
476
+ a.options || {}
456
477
  );
457
- for (const G of a) {
458
- const D = await ae(G);
459
- if (E) {
460
- (z = (A = (h = D.mesh) == null ? void 0 : h.geometry) == null ? void 0 : A.dispose) == null || z.call(A), (J = (U = (O = D.mesh) == null ? void 0 : O.material) == null ? void 0 : U.dispose) == null || J.call(U), (T = (y = D.texture) == null ? void 0 : y.dispose) == null || T.call(y);
478
+ for (const p of S) {
479
+ const m = await fe(p);
480
+ if (P) {
481
+ (B = (d = (I = m.mesh) == null ? void 0 : I.geometry) == null ? void 0 : d.dispose) == null || B.call(d), (M = (E = (g = m.mesh) == null ? void 0 : g.material) == null ? void 0 : E.dispose) == null || M.call(E), (J = (R = m.texture) == null ? void 0 : R.dispose) == null || J.call(R);
461
482
  return;
462
483
  }
463
- r.addRasterOverlay(D);
484
+ l.addRasterOverlay(m);
464
485
  }
465
- u != null && u.viewState ? r.setViewState(u.viewState) : (u == null ? void 0 : u.fitToBounds) !== !1 && r.focusOnLastBounds((u == null ? void 0 : u.focusPadding) || 1.2);
466
- } catch (s) {
467
- console.error("Baselode 3D Tool UI render error", s), l((s == null ? void 0 : s.message) || "3D scene render error");
486
+ i != null && i.viewState ? l.setViewState(i.viewState) : (i == null ? void 0 : i.fitToBounds) !== !1 && l.focusOnLastBounds((i == null ? void 0 : i.focusPadding) || 1.2);
487
+ } catch (L) {
488
+ console.error("Baselode 3D Tool UI render error", L), _((L == null ? void 0 : L.message) || "3D scene render error");
468
489
  }
469
490
  }
470
- j();
471
- const _ = typeof ResizeObserver < "u" ? new ResizeObserver(() => r.resize()) : null;
472
- return _ == null || _.observe(I), () => {
473
- E = !0, _ == null || _.disconnect(), r.dispose(), P.current = null;
491
+ F();
492
+ const c = typeof ResizeObserver < "u" ? new ResizeObserver(() => l.resize()) : null;
493
+ return c == null || c.observe(A), () => {
494
+ P = !0, c == null || c.disconnect(), l.dispose(), T.current = null;
474
495
  };
475
496
  }, [
476
- b,
477
- m,
478
- u,
479
- B,
480
- p,
497
+ y,
481
498
  a,
499
+ i,
500
+ j,
501
+ b,
482
502
  S,
483
- d
503
+ f,
504
+ s
484
505
  ]), /* @__PURE__ */ w(
485
506
  "article",
486
507
  {
487
508
  className: "baselode-tool-3d-scene",
488
509
  "data-tool-ui-id": o,
489
- "data-baselode-theme": K(b),
490
- style: X(b),
510
+ "data-baselode-theme": q(y),
511
+ style: oe(y),
491
512
  children: [
492
- (e || n) && /* @__PURE__ */ w("header", { className: "baselode-tool-3d-scene__header", children: [
493
- e && /* @__PURE__ */ c("h3", { children: e }),
494
- n && /* @__PURE__ */ c("p", { children: n })
513
+ (t || n) && /* @__PURE__ */ w("header", { className: "baselode-tool-3d-scene__header", children: [
514
+ t && /* @__PURE__ */ u("h3", { children: t }),
515
+ n && /* @__PURE__ */ u("p", { children: n })
495
516
  ] }),
496
- N && /* @__PURE__ */ w("div", { className: "baselode-tool-3d-scene__error", children: [
517
+ C && /* @__PURE__ */ w("div", { className: "baselode-tool-3d-scene__error", children: [
497
518
  "Scene error: ",
498
- N
519
+ C
499
520
  ] }),
500
- /* @__PURE__ */ c(
521
+ /* @__PURE__ */ u(
501
522
  "div",
502
523
  {
503
524
  className: "baselode-tool-3d-scene__viewport",
504
- ref: g,
505
- style: { height: i }
525
+ ref: v,
526
+ style: { height: r }
506
527
  }
507
528
  )
508
529
  ]
@@ -510,12 +531,12 @@ function Pe({
510
531
  );
511
532
  }
512
533
  export {
513
- Pe as Baselode3DSceneToolUI,
514
- Be as BaselodeStripLogToolUI,
515
- ye as SerializableBaselode3DSceneSchema,
516
- ue as SerializableBaselodeStripLogSchema,
517
- de as SerializableBaselodeStripLogTrackSchema,
518
- Ae as safeParseSerializableBaselode3DScene,
519
- Le as safeParseSerializableBaselodeStripLog
534
+ ze as Baselode3DSceneToolUI,
535
+ De as BaselodeStripLogToolUI,
536
+ Te as SerializableBaselode3DSceneSchema,
537
+ Se as SerializableBaselodeStripLogSchema,
538
+ he as SerializableBaselodeStripLogTrackSchema,
539
+ Ue as safeParseSerializableBaselode3DScene,
540
+ Ie as safeParseSerializableBaselodeStripLog
520
541
  };
521
542
  //# sourceMappingURL=tool-ui.js.map