baselode 0.1.23 → 0.1.24
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,8 +1,8 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
2
|
import { jsxs as w, jsx as u } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as x, useState as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { useMemo as x, useState as q, useEffect as $, useRef as H } from "react";
|
|
4
|
+
import Y from "plotly.js-dist-min";
|
|
5
|
+
import { u as ne, O as re, c as ie, aa as se, a8 as ae, aL as pe, k as D, m as k, aK as ee, o as Q, q as de, n as ue, v as ce, h as ye, W as be, aJ as fe } from "./baselode3dScene-vx7nOB46.js";
|
|
6
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
7
|
label: e.string().optional(),
|
|
8
8
|
unit: e.string().nullish(),
|
|
@@ -105,12 +105,12 @@ function _e(o) {
|
|
|
105
105
|
"--baselode-tool-primary": o.primary || o.accent
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function W(o) {
|
|
109
109
|
return o === "baselode-dark" || o === "black" ? "baselode-dark" : "baselode";
|
|
110
110
|
}
|
|
111
111
|
function oe(o) {
|
|
112
112
|
return _e(
|
|
113
|
-
|
|
113
|
+
W(o) === "baselode-dark" ? ne : re
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
function ve(o) {
|
|
@@ -193,7 +193,7 @@ function Pe({
|
|
|
193
193
|
onIntervalClick: s,
|
|
194
194
|
onDepthRangeChange: a
|
|
195
195
|
}) {
|
|
196
|
-
const S =
|
|
196
|
+
const S = H(null), i = t.displayType === D || t.chartType === "categorical", v = n == null ? void 0 : n[t.property], T = Q(t.label || t.property, v), C = x(
|
|
197
197
|
() => de(o, t.property, i),
|
|
198
198
|
[o, i, t.property]
|
|
199
199
|
), _ = x(() => {
|
|
@@ -218,7 +218,7 @@ function Pe({
|
|
|
218
218
|
[t.displayType]
|
|
219
219
|
);
|
|
220
220
|
return $(() => {
|
|
221
|
-
var O,
|
|
221
|
+
var O, M, I, d;
|
|
222
222
|
const l = S.current;
|
|
223
223
|
if (!l) return;
|
|
224
224
|
if (!_.data.length) {
|
|
@@ -226,8 +226,8 @@ function Pe({
|
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
228
|
const F = (B) => {
|
|
229
|
-
var
|
|
230
|
-
const g = (
|
|
229
|
+
var J, R;
|
|
230
|
+
const g = (J = B == null ? void 0 : B.points) == null ? void 0 : J[0];
|
|
231
231
|
if (!g || !s) return;
|
|
232
232
|
const E = Array.isArray(g.customdata) ? g.customdata : [];
|
|
233
233
|
s({
|
|
@@ -245,7 +245,7 @@ function Pe({
|
|
|
245
245
|
depthRange: g
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
|
-
return (O = l.removeAllListeners) == null || O.call(l, "plotly_click"), (
|
|
248
|
+
return (O = l.removeAllListeners) == null || O.call(l, "plotly_click"), (M = l.removeAllListeners) == null || M.call(l, "plotly_relayout"), Y.react(
|
|
249
249
|
l,
|
|
250
250
|
_.data,
|
|
251
251
|
{
|
|
@@ -259,7 +259,7 @@ function Pe({
|
|
|
259
259
|
responsive: !0
|
|
260
260
|
}
|
|
261
261
|
), s && ((I = l.on) == null || I.call(l, "plotly_click", F)), a && ((d = l.on) == null || d.call(l, "plotly_relayout", c)), () => {
|
|
262
|
-
|
|
262
|
+
Y.purge(l);
|
|
263
263
|
};
|
|
264
264
|
}, [
|
|
265
265
|
r,
|
|
@@ -287,7 +287,7 @@ function Pe({
|
|
|
287
287
|
property: l.target.value
|
|
288
288
|
});
|
|
289
289
|
},
|
|
290
|
-
children: t.propertyOptions.map((l) => /* @__PURE__ */ u("option", { value: l, children:
|
|
290
|
+
children: t.propertyOptions.map((l) => /* @__PURE__ */ u("option", { value: l, children: Q(l, n == null ? void 0 : n[l]) }, l))
|
|
291
291
|
}
|
|
292
292
|
)
|
|
293
293
|
] }),
|
|
@@ -349,15 +349,15 @@ function De({
|
|
|
349
349
|
), O = x(
|
|
350
350
|
() => le(c, s),
|
|
351
351
|
[c, s]
|
|
352
|
-
),
|
|
352
|
+
), M = x(() => {
|
|
353
353
|
const p = a && typeof a == "object" ? a : null;
|
|
354
354
|
if (!S) return p ?? void 0;
|
|
355
355
|
const m = [...c.numericCols, ...c.categoricalCols].filter((z) => z !== se && z !== ae), h = pe((r == null ? void 0 : r.points) || [], m);
|
|
356
356
|
if (!p) return h;
|
|
357
|
-
const
|
|
357
|
+
const K = { ...h };
|
|
358
358
|
return Object.entries(p).forEach(([z, U]) => {
|
|
359
|
-
|
|
360
|
-
}),
|
|
359
|
+
K[z] = { ...h[z], ...U };
|
|
360
|
+
}), K;
|
|
361
361
|
}, [a, S, c, r]), I = x(
|
|
362
362
|
() => y.map((p, m) => Z(p, {
|
|
363
363
|
trackIndex: m,
|
|
@@ -368,21 +368,21 @@ function De({
|
|
|
368
368
|
showLegend: T
|
|
369
369
|
})),
|
|
370
370
|
[v, i, c, O, T, y]
|
|
371
|
-
), d = G(C), B = d ?? G(_), [g, E] =
|
|
371
|
+
), d = G(C), B = d ?? G(_), [g, E] = q(I), [J, R] = q(B);
|
|
372
372
|
$(() => {
|
|
373
373
|
E(I);
|
|
374
374
|
}, [I]), $(() => {
|
|
375
375
|
d && R(d);
|
|
376
376
|
}, [d == null ? void 0 : d[0], d == null ? void 0 : d[1]]);
|
|
377
|
-
const
|
|
377
|
+
const V = d ?? J;
|
|
378
378
|
function L(p) {
|
|
379
379
|
const m = g.map((h) => {
|
|
380
380
|
if ((h.id || h.property) !== (p.id || p.property))
|
|
381
381
|
return h;
|
|
382
|
-
const
|
|
382
|
+
const K = p.property ?? h.property, z = c.byType[K] === D ? D : "numeric", U = Z({
|
|
383
383
|
...h,
|
|
384
384
|
...p,
|
|
385
|
-
property:
|
|
385
|
+
property: K,
|
|
386
386
|
displayType: p.chartType === "categorical" ? D : z,
|
|
387
387
|
chartType: p.property && p.property !== h.property ? ee(z) : p.chartType ?? h.chartType,
|
|
388
388
|
label: te(h.label, h.property) ? h.label : void 0
|
|
@@ -393,7 +393,7 @@ function De({
|
|
|
393
393
|
allowChartTypeSelection: v,
|
|
394
394
|
showLegend: T
|
|
395
395
|
});
|
|
396
|
-
return P == null || P(U),
|
|
396
|
+
return P == null || P(U), K !== h.property && (A == null || A({
|
|
397
397
|
trackId: U.id || U.property,
|
|
398
398
|
property: U.property,
|
|
399
399
|
displayType: U.displayType,
|
|
@@ -407,7 +407,7 @@ function De({
|
|
|
407
407
|
{
|
|
408
408
|
className: "baselode-tool-strip-log",
|
|
409
409
|
"data-tool-ui-id": o,
|
|
410
|
-
"data-baselode-theme":
|
|
410
|
+
"data-baselode-theme": W(b),
|
|
411
411
|
style: oe(b),
|
|
412
412
|
children: [
|
|
413
413
|
/* @__PURE__ */ w("header", { className: "baselode-tool-strip-log__header", children: [
|
|
@@ -422,11 +422,11 @@ function De({
|
|
|
422
422
|
{
|
|
423
423
|
hole: r,
|
|
424
424
|
track: p,
|
|
425
|
-
propertyMeta:
|
|
425
|
+
propertyMeta: M,
|
|
426
426
|
height: j,
|
|
427
427
|
template: b,
|
|
428
428
|
showModeBar: f,
|
|
429
|
-
depthRange:
|
|
429
|
+
depthRange: V,
|
|
430
430
|
onTrackChange: L,
|
|
431
431
|
onIntervalClick: l,
|
|
432
432
|
onDepthRangeChange: (m) => {
|
|
@@ -453,7 +453,7 @@ function ze({
|
|
|
453
453
|
rasterOverlays: S = [],
|
|
454
454
|
camera: i
|
|
455
455
|
}) {
|
|
456
|
-
const v =
|
|
456
|
+
const v = H(null), T = H(null), [C, _] = q("");
|
|
457
457
|
return $(() => {
|
|
458
458
|
const A = v.current;
|
|
459
459
|
if (!A) return;
|
|
@@ -461,7 +461,7 @@ function ze({
|
|
|
461
461
|
const l = new be();
|
|
462
462
|
T.current = l;
|
|
463
463
|
async function F() {
|
|
464
|
-
var O,
|
|
464
|
+
var O, M, I, d, B, g, E, J, R, V;
|
|
465
465
|
try {
|
|
466
466
|
_(""), l.init(A), l.setBackground(y), l.setControlMode(j);
|
|
467
467
|
const L = (b == null ? void 0 : b.holes) || [];
|
|
@@ -469,7 +469,7 @@ function ze({
|
|
|
469
469
|
s.structures,
|
|
470
470
|
L,
|
|
471
471
|
s.options || {}
|
|
472
|
-
), s.visible !== void 0 && l.setStructuralDiscsVisible(s.visible)), (
|
|
472
|
+
), s.visible !== void 0 && l.setStructuralDiscsVisible(s.visible)), (M = a == null ? void 0 : a.data) != null && M.length && l.setBlocks(
|
|
473
473
|
a.data,
|
|
474
474
|
a.selectedProperty,
|
|
475
475
|
a.stats || {},
|
|
@@ -478,7 +478,7 @@ function ze({
|
|
|
478
478
|
for (const p of S) {
|
|
479
479
|
const m = await fe(p);
|
|
480
480
|
if (P) {
|
|
481
|
-
(B = (d = (I = m.mesh) == null ? void 0 : I.geometry) == null ? void 0 : d.dispose) == null || B.call(d), (
|
|
481
|
+
(B = (d = (I = m.mesh) == null ? void 0 : I.geometry) == null ? void 0 : d.dispose) == null || B.call(d), (J = (E = (g = m.mesh) == null ? void 0 : g.material) == null ? void 0 : E.dispose) == null || J.call(E), (V = (R = m.texture) == null ? void 0 : R.dispose) == null || V.call(R);
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
484
|
l.addRasterOverlay(m);
|
|
@@ -507,7 +507,7 @@ function ze({
|
|
|
507
507
|
{
|
|
508
508
|
className: "baselode-tool-3d-scene",
|
|
509
509
|
"data-tool-ui-id": o,
|
|
510
|
-
"data-baselode-theme":
|
|
510
|
+
"data-baselode-theme": W(y),
|
|
511
511
|
style: oe(y),
|
|
512
512
|
children: [
|
|
513
513
|
(t || n) && /* @__PURE__ */ w("header", { className: "baselode-tool-3d-scene__header", children: [
|