baselode 0.1.19 → 0.1.20
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,9 +1,9 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
2
|
import { jsxs as w, jsx as c } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as x, useState as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
const pe = t.union([t.string(), t.number(), t.boolean(), t.null()]), v = t.record(t.string(), t.unknown()),
|
|
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, i as R, k as Q, aH as W, o as le, l as ne, t as re, g as ie, U as se, aG as ae } from "./baselode3dScene-qMfVRKxK.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
7
|
id: t.string().optional(),
|
|
8
8
|
property: t.string().min(1),
|
|
9
9
|
label: t.string().optional(),
|
|
@@ -31,8 +31,8 @@ const pe = t.union([t.string(), t.number(), t.boolean(), t.null()]), v = t.recor
|
|
|
31
31
|
allowPropertySelection: t.boolean().optional(),
|
|
32
32
|
allowChartTypeSelection: t.boolean().optional(),
|
|
33
33
|
showLegend: t.boolean().optional(),
|
|
34
|
-
depthRange:
|
|
35
|
-
defaultDepthRange:
|
|
34
|
+
depthRange: q.optional(),
|
|
35
|
+
defaultDepthRange: q.optional()
|
|
36
36
|
});
|
|
37
37
|
function Le(o) {
|
|
38
38
|
const e = ue.safeParse(o);
|
|
@@ -99,33 +99,33 @@ function ce(o) {
|
|
|
99
99
|
"--baselode-tool-primary": o.primary || o.accent
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function K(o) {
|
|
103
103
|
return o === "baselode-dark" || o === "black" ? "baselode-dark" : "baselode";
|
|
104
104
|
}
|
|
105
105
|
function X(o) {
|
|
106
106
|
return ce(
|
|
107
|
-
|
|
107
|
+
K(o) === "baselode-dark" ? ee : oe
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
function be(o) {
|
|
111
111
|
return o === "baselode-dark" ? re : o === "plotly-default" ? null : ie;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function $(o) {
|
|
114
114
|
if (!Array.isArray(o) || o.length !== 2) return null;
|
|
115
115
|
const e = Number(o[0]), n = Number(o[1]);
|
|
116
116
|
return !Number.isFinite(e) || !Number.isFinite(n) || e === n ? null : e < n ? [e, n] : [n, e];
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function fe(o) {
|
|
119
119
|
if (o)
|
|
120
120
|
return [o[1], o[0]];
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function me(o) {
|
|
123
123
|
if (!o || typeof o != "object") return null;
|
|
124
124
|
const e = o["yaxis.range"];
|
|
125
125
|
if (Array.isArray(e) && e.length === 2)
|
|
126
|
-
return
|
|
126
|
+
return $(e);
|
|
127
127
|
const n = o["yaxis.range[0]"], i = o["yaxis.range[1]"];
|
|
128
|
-
return n !== void 0 && i !== void 0 ?
|
|
128
|
+
return n !== void 0 && i !== void 0 ? $([n, i]) : null;
|
|
129
129
|
}
|
|
130
130
|
function Z(o, e) {
|
|
131
131
|
return !!(o && o !== e);
|
|
@@ -136,7 +136,7 @@ function k(o, e) {
|
|
|
136
136
|
const i = new Set(n);
|
|
137
137
|
return e.filter((b) => i.has(b));
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function C(o, {
|
|
140
140
|
trackIndex: e = 0,
|
|
141
141
|
selectableProperties: n,
|
|
142
142
|
classified: i,
|
|
@@ -144,7 +144,7 @@ function Y(o, {
|
|
|
144
144
|
allowChartTypeSelection: B,
|
|
145
145
|
showLegend: p
|
|
146
146
|
}) {
|
|
147
|
-
const S = k(i, o.propertyOptions ?? n), d = S.includes(o.property) ? o.property : S[0] ?? o.property,
|
|
147
|
+
const S = k(i, o.propertyOptions ?? n), d = S.includes(o.property) ? o.property : S[0] ?? o.property, f = i.byType[d] === R ? R : "numeric", a = o.chartType === "categorical" || o.displayType === R ? R : f, g = Q(a).some((P) => P.value === o.chartType) ? o.chartType : W(a);
|
|
148
148
|
return {
|
|
149
149
|
...o,
|
|
150
150
|
id: o.id || `${d}-${e + 1}`,
|
|
@@ -171,7 +171,7 @@ function he(o, e) {
|
|
|
171
171
|
yaxis: {
|
|
172
172
|
...o.yaxis || {},
|
|
173
173
|
autorange: !1,
|
|
174
|
-
range:
|
|
174
|
+
range: fe(e)
|
|
175
175
|
}
|
|
176
176
|
} : o;
|
|
177
177
|
}
|
|
@@ -186,7 +186,7 @@ function Se({
|
|
|
186
186
|
onIntervalClick: S,
|
|
187
187
|
onDepthRangeChange: d
|
|
188
188
|
}) {
|
|
189
|
-
const
|
|
189
|
+
const f = H(null), a = e.displayType === R || e.chartType === "categorical", u = x(
|
|
190
190
|
() => le(o, e.property, a),
|
|
191
191
|
[o, a, e.property]
|
|
192
192
|
), g = x(() => {
|
|
@@ -206,12 +206,12 @@ function Se({
|
|
|
206
206
|
() => e.showLegend && a ? ge(g.data) : [],
|
|
207
207
|
[a, g.data, e.showLegend]
|
|
208
208
|
), N = x(
|
|
209
|
-
() =>
|
|
209
|
+
() => Q(e.displayType),
|
|
210
210
|
[e.displayType]
|
|
211
211
|
);
|
|
212
|
-
return
|
|
213
|
-
var r, j, _,
|
|
214
|
-
const l =
|
|
212
|
+
return V(() => {
|
|
213
|
+
var r, j, _, m;
|
|
214
|
+
const l = f.current;
|
|
215
215
|
if (!l) return;
|
|
216
216
|
if (!g.data.length) {
|
|
217
217
|
l.replaceChildren(document.createTextNode(`No data for ${e.property}`));
|
|
@@ -231,13 +231,13 @@ function Se({
|
|
|
231
231
|
pointIndex: h.pointIndex
|
|
232
232
|
});
|
|
233
233
|
}, E = (L) => {
|
|
234
|
-
const h =
|
|
234
|
+
const h = me(L);
|
|
235
235
|
h && d && d({
|
|
236
236
|
trackId: e.id || e.property,
|
|
237
237
|
depthRange: h
|
|
238
238
|
});
|
|
239
239
|
};
|
|
240
|
-
return (r = l.removeAllListeners) == null || r.call(l, "plotly_click"), (j = l.removeAllListeners) == null || j.call(l, "plotly_relayout"),
|
|
240
|
+
return (r = l.removeAllListeners) == null || r.call(l, "plotly_click"), (j = l.removeAllListeners) == null || j.call(l, "plotly_relayout"), Y.react(
|
|
241
241
|
l,
|
|
242
242
|
g.data,
|
|
243
243
|
{
|
|
@@ -250,8 +250,8 @@ function Se({
|
|
|
250
250
|
displayModeBar: b,
|
|
251
251
|
responsive: !0
|
|
252
252
|
}
|
|
253
|
-
), S && ((_ = l.on) == null || _.call(l, "plotly_click", I)), d && ((
|
|
254
|
-
|
|
253
|
+
), S && ((_ = l.on) == null || _.call(l, "plotly_click", I)), d && ((m = l.on) == null || m.call(l, "plotly_relayout", E)), () => {
|
|
254
|
+
Y.purge(l);
|
|
255
255
|
};
|
|
256
256
|
}, [
|
|
257
257
|
n,
|
|
@@ -299,7 +299,7 @@ function Se({
|
|
|
299
299
|
)
|
|
300
300
|
] })
|
|
301
301
|
] }),
|
|
302
|
-
/* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__plot", ref:
|
|
302
|
+
/* @__PURE__ */ c("div", { className: "baselode-tool-strip-log__plot", ref: f }),
|
|
303
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
304
|
/* @__PURE__ */ c(
|
|
305
305
|
"span",
|
|
@@ -322,7 +322,7 @@ function Be({
|
|
|
322
322
|
template: p = "baselode",
|
|
323
323
|
showModeBar: S = !1,
|
|
324
324
|
propertyOptions: d,
|
|
325
|
-
allowPropertySelection:
|
|
325
|
+
allowPropertySelection: f = !1,
|
|
326
326
|
allowChartTypeSelection: a = !1,
|
|
327
327
|
showLegend: u,
|
|
328
328
|
depthRange: g,
|
|
@@ -339,41 +339,41 @@ function Be({
|
|
|
339
339
|
() => k(r, d),
|
|
340
340
|
[r, d]
|
|
341
341
|
), _ = x(
|
|
342
|
-
() => b.map((y, T) =>
|
|
342
|
+
() => b.map((y, T) => C(y, {
|
|
343
343
|
trackIndex: T,
|
|
344
344
|
selectableProperties: j,
|
|
345
345
|
classified: r,
|
|
346
|
-
allowPropertySelection:
|
|
346
|
+
allowPropertySelection: f,
|
|
347
347
|
allowChartTypeSelection: a,
|
|
348
348
|
showLegend: u
|
|
349
349
|
})),
|
|
350
|
-
[a,
|
|
351
|
-
),
|
|
352
|
-
|
|
350
|
+
[a, f, r, j, u, b]
|
|
351
|
+
), m = $(g), L = m ?? $(P), [h, A] = F(_), [z, O] = F(L);
|
|
352
|
+
V(() => {
|
|
353
353
|
A(_);
|
|
354
|
-
}, [_]),
|
|
355
|
-
|
|
356
|
-
}, [
|
|
357
|
-
const U =
|
|
358
|
-
function
|
|
354
|
+
}, [_]), V(() => {
|
|
355
|
+
m && O(m);
|
|
356
|
+
}, [m == null ? void 0 : m[0], m == null ? void 0 : m[1]]);
|
|
357
|
+
const U = m ?? z;
|
|
358
|
+
function J(y) {
|
|
359
359
|
const T = h.map((s) => {
|
|
360
360
|
if ((s.id || s.property) !== (y.id || y.property))
|
|
361
361
|
return s;
|
|
362
|
-
const
|
|
362
|
+
const G = y.property ?? s.property, D = r.byType[G] === R ? R : "numeric", M = C({
|
|
363
363
|
...s,
|
|
364
364
|
...y,
|
|
365
|
-
property:
|
|
365
|
+
property: G,
|
|
366
366
|
displayType: y.chartType === "categorical" ? R : D,
|
|
367
367
|
chartType: y.property && y.property !== s.property ? W(D) : y.chartType ?? s.chartType,
|
|
368
368
|
label: Z(s.label, s.property) ? s.label : void 0
|
|
369
369
|
}, {
|
|
370
370
|
selectableProperties: j,
|
|
371
371
|
classified: r,
|
|
372
|
-
allowPropertySelection:
|
|
372
|
+
allowPropertySelection: f,
|
|
373
373
|
allowChartTypeSelection: a,
|
|
374
374
|
showLegend: u
|
|
375
375
|
});
|
|
376
|
-
return l == null || l(M),
|
|
376
|
+
return l == null || l(M), G !== s.property && (N == null || N({
|
|
377
377
|
trackId: M.id || M.property,
|
|
378
378
|
property: M.property,
|
|
379
379
|
displayType: M.displayType,
|
|
@@ -387,7 +387,7 @@ function Be({
|
|
|
387
387
|
{
|
|
388
388
|
className: "baselode-tool-strip-log",
|
|
389
389
|
"data-tool-ui-id": o,
|
|
390
|
-
"data-baselode-theme":
|
|
390
|
+
"data-baselode-theme": K(p),
|
|
391
391
|
style: X(p),
|
|
392
392
|
children: [
|
|
393
393
|
/* @__PURE__ */ w("header", { className: "baselode-tool-strip-log__header", children: [
|
|
@@ -406,10 +406,10 @@ function Be({
|
|
|
406
406
|
template: p,
|
|
407
407
|
showModeBar: S,
|
|
408
408
|
depthRange: U,
|
|
409
|
-
onTrackChange:
|
|
409
|
+
onTrackChange: J,
|
|
410
410
|
onIntervalClick: I,
|
|
411
411
|
onDepthRangeChange: (T) => {
|
|
412
|
-
!
|
|
412
|
+
!m && (T != null && T.depthRange) && O(T.depthRange), E == null || E(T);
|
|
413
413
|
}
|
|
414
414
|
},
|
|
415
415
|
y.id || y.property
|
|
@@ -428,36 +428,36 @@ function Pe({
|
|
|
428
428
|
drillholes: p,
|
|
429
429
|
stripLogs: S = [],
|
|
430
430
|
structuralDiscs: d,
|
|
431
|
-
blocks:
|
|
431
|
+
blocks: f,
|
|
432
432
|
rasterOverlays: a = [],
|
|
433
433
|
camera: u
|
|
434
434
|
}) {
|
|
435
|
-
const g =
|
|
436
|
-
return
|
|
435
|
+
const g = H(null), P = H(null), [N, l] = F("");
|
|
436
|
+
return V(() => {
|
|
437
437
|
const I = g.current;
|
|
438
438
|
if (!I) return;
|
|
439
439
|
let E = !1;
|
|
440
440
|
const r = new se();
|
|
441
441
|
P.current = r;
|
|
442
442
|
async function j() {
|
|
443
|
-
var
|
|
443
|
+
var m, L, h, A, z, O, U, J, y, T;
|
|
444
444
|
try {
|
|
445
445
|
l(""), r.init(I), r.setBackground(b), r.setControlMode(B);
|
|
446
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), (
|
|
447
|
+
s.length && r.setDrillholes(s, (p == null ? void 0 : p.options) || {}), s.length && S.length && r.setStripLogs(s, S), (m = d == null ? void 0 : d.structures) != null && m.length && (r.setStructuralDiscs(
|
|
448
448
|
d.structures,
|
|
449
449
|
s,
|
|
450
450
|
d.options || {}
|
|
451
|
-
), d.visible !== void 0 && r.setStructuralDiscsVisible(d.visible)), (L =
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
451
|
+
), d.visible !== void 0 && r.setStructuralDiscsVisible(d.visible)), (L = f == null ? void 0 : f.data) != null && L.length && r.setBlocks(
|
|
452
|
+
f.data,
|
|
453
|
+
f.selectedProperty,
|
|
454
|
+
f.stats || {},
|
|
455
|
+
f.options || {}
|
|
456
456
|
);
|
|
457
|
-
for (const
|
|
458
|
-
const D = await ae(
|
|
457
|
+
for (const G of a) {
|
|
458
|
+
const D = await ae(G);
|
|
459
459
|
if (E) {
|
|
460
|
-
(z = (A = (h = D.mesh) == null ? void 0 : h.geometry) == null ? void 0 : A.dispose) == null || z.call(A), (
|
|
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);
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
463
|
r.addRasterOverlay(D);
|
|
@@ -474,7 +474,7 @@ function Pe({
|
|
|
474
474
|
};
|
|
475
475
|
}, [
|
|
476
476
|
b,
|
|
477
|
-
|
|
477
|
+
f,
|
|
478
478
|
u,
|
|
479
479
|
B,
|
|
480
480
|
p,
|
|
@@ -486,7 +486,7 @@ function Pe({
|
|
|
486
486
|
{
|
|
487
487
|
className: "baselode-tool-3d-scene",
|
|
488
488
|
"data-tool-ui-id": o,
|
|
489
|
-
"data-baselode-theme":
|
|
489
|
+
"data-baselode-theme": K(b),
|
|
490
490
|
style: X(b),
|
|
491
491
|
children: [
|
|
492
492
|
(e || n) && /* @__PURE__ */ w("header", { className: "baselode-tool-3d-scene__header", children: [
|