@malloy-publisher/sdk 0.0.37 → 0.0.39
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/RenderedResult-BkosOmHn.js +79 -0
- package/dist/RenderedResult-Cw08MPat.cjs +1 -0
- package/dist/client/api.d.ts +2 -2
- package/dist/components/ApiErrorDisplay.d.ts +1 -1
- package/dist/components/Loading.d.ts +37 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/{index-7mmEVMId.cjs → index-CBFYy63L.cjs} +517 -517
- package/dist/{index-DdtGkJIk.js → index-CgV5BrBn.js} +23194 -23152
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +17 -16
- package/dist/{vendor-C6w9JpPA.js → vendor-BCM56_2K.js} +60 -59
- package/dist/{vendor-DAoHVNwq.cjs → vendor-Bg9-K32d.cjs} +66 -66
- package/package.json +1 -1
- package/src/components/ApiErrorDisplay.tsx +1 -3
- package/src/components/Home/Home.tsx +2 -3
- package/src/components/Loading.tsx +103 -0
- package/src/components/Model/Model.tsx +2 -6
- package/src/components/Notebook/Notebook.tsx +13 -7
- package/src/components/Package/Config.tsx +17 -17
- package/src/components/Package/Databases.tsx +2 -3
- package/src/components/Package/Models.tsx +8 -8
- package/src/components/Package/Notebooks.tsx +8 -6
- package/src/components/Package/Schedules.tsx +2 -5
- package/src/components/Project/About.tsx +2 -5
- package/src/components/Project/ConnectionExplorer.tsx +4 -15
- package/src/components/Project/Packages.tsx +2 -5
- package/src/components/QueryResult/QueryResult.tsx +2 -6
- package/src/components/RenderedResult/RenderedResult.tsx +107 -18
- package/src/components/RenderedResult/ResultContainer.tsx +5 -2
- package/src/components/index.ts +1 -0
- package/dist/RenderedResult-ChKXzRBq.cjs +0 -1
- package/dist/RenderedResult-DkEsDzXb.js +0 -51
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { j as C } from "./vendor-BCM56_2K.js";
|
|
2
|
+
import { i as E } from "./index-CgV5BrBn.js";
|
|
3
|
+
import { useRef as m, useState as R, useLayoutEffect as M, useEffect as w } from "react";
|
|
4
|
+
function O({
|
|
5
|
+
result: c,
|
|
6
|
+
height: v,
|
|
7
|
+
isFillElement: d,
|
|
8
|
+
onSizeChange: f,
|
|
9
|
+
onDrill: b
|
|
10
|
+
}) {
|
|
11
|
+
const e = m(null), [l, a] = R(!1), [h, p] = R(!1), [x, N] = R(!1), n = m(null), t = m(null);
|
|
12
|
+
if (M(() => {
|
|
13
|
+
if (e.current && c && !h) {
|
|
14
|
+
p(!0), n.current || (n.current = new Promise((r) => {
|
|
15
|
+
t.current = r;
|
|
16
|
+
}));
|
|
17
|
+
const i = new E.MalloyRenderer({
|
|
18
|
+
onClick: b
|
|
19
|
+
}).createViz();
|
|
20
|
+
for (; e.current.firstChild; )
|
|
21
|
+
e.current.removeChild(e.current.firstChild);
|
|
22
|
+
const o = new MutationObserver((r) => {
|
|
23
|
+
for (const u of r)
|
|
24
|
+
if (u.type === "childList" && u.addedNodes.length > 0 && Array.from(u.addedNodes).some(
|
|
25
|
+
(g) => g.nodeType === Node.ELEMENT_NODE
|
|
26
|
+
)) {
|
|
27
|
+
o.disconnect(), setTimeout(() => {
|
|
28
|
+
a(!0), t.current && (t.current(), t.current = null, n.current = null);
|
|
29
|
+
}, 50);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (e.current) {
|
|
34
|
+
o.observe(e.current, {
|
|
35
|
+
childList: !0,
|
|
36
|
+
subtree: !0,
|
|
37
|
+
characterData: !0
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
i.setResult(JSON.parse(c)), i.render(e.current);
|
|
41
|
+
} catch (r) {
|
|
42
|
+
console.error("Error rendering visualization:", r), o.disconnect(), a(!0), t.current && (t.current(), t.current = null, n.current = null);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, [c, b, h]), w(() => {
|
|
47
|
+
a(!1), p(!1), n.current = null, t.current = null;
|
|
48
|
+
}, [c]), h && !l && n.current)
|
|
49
|
+
throw n.current;
|
|
50
|
+
return w(() => {
|
|
51
|
+
if (!e.current || !l) return;
|
|
52
|
+
const s = e.current, i = () => {
|
|
53
|
+
if (s) {
|
|
54
|
+
const u = s.offsetHeight;
|
|
55
|
+
u > 0 ? f && f(u) : d && s.firstChild && (s.firstChild.offsetHeight == 0 ? d(!0) : d(!1));
|
|
56
|
+
}
|
|
57
|
+
}, o = setTimeout(i, 100);
|
|
58
|
+
let r = null;
|
|
59
|
+
return x || (r = new MutationObserver(i), r.observe(s, {
|
|
60
|
+
childList: !0,
|
|
61
|
+
subtree: !0,
|
|
62
|
+
attributes: !0
|
|
63
|
+
})), () => {
|
|
64
|
+
clearTimeout(o), r?.disconnect();
|
|
65
|
+
};
|
|
66
|
+
}, [f, c, d, l]), /* @__PURE__ */ C.jsx(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
ref: e,
|
|
70
|
+
style: {
|
|
71
|
+
width: "100%",
|
|
72
|
+
height: v ? `${v}px` : "100%"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
O as default
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./vendor-Bg9-K32d.cjs"),x=require("./index-CBFYy63L.cjs"),t=require("react");function E({result:i,height:m,isFillElement:f,onSizeChange:l,onDrill:v}){const e=t.useRef(null),[a,h]=t.useState(!1),[R,b]=t.useState(!1),[y,M]=t.useState(!1),s=t.useRef(null),n=t.useRef(null);if(t.useLayoutEffect(()=>{if(e.current&&i&&!R){b(!0),s.current||(s.current=new Promise(r=>{n.current=r}));const o=new x.index_umdExports.MalloyRenderer({onClick:v}).createViz();for(;e.current.firstChild;)e.current.removeChild(e.current.firstChild);const d=new MutationObserver(r=>{for(const c of r)if(c.type==="childList"&&c.addedNodes.length>0&&Array.from(c.addedNodes).some(g=>g.nodeType===Node.ELEMENT_NODE)){d.disconnect(),setTimeout(()=>{h(!0),n.current&&(n.current(),n.current=null,s.current=null)},50);break}});if(e.current){d.observe(e.current,{childList:!0,subtree:!0,characterData:!0});try{o.setResult(JSON.parse(i)),o.render(e.current)}catch(r){console.error("Error rendering visualization:",r),d.disconnect(),h(!0),n.current&&(n.current(),n.current=null,s.current=null)}}}},[i,v,R]),t.useEffect(()=>{h(!1),b(!1),s.current=null,n.current=null},[i]),R&&!a&&s.current)throw s.current;return t.useEffect(()=>{if(!e.current||!a)return;const u=e.current,o=()=>{if(u){const c=u.offsetHeight;c>0?l&&l(c):f&&u.firstChild&&(u.firstChild.offsetHeight==0?f(!0):f(!1))}},d=setTimeout(o,100);let r=null;return y||(r=new MutationObserver(o),r.observe(u,{childList:!0,subtree:!0,attributes:!0})),()=>{clearTimeout(d),r?.disconnect()}},[l,i,f,a]),p.jsxRuntimeExports.jsx("div",{ref:e,style:{width:"100%",height:m?`${m}px`:"100%"}})}exports.default=E;
|
package/dist/client/api.d.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface LoadingProps {
|
|
2
|
+
/**
|
|
3
|
+
* The text to display below the spinner
|
|
4
|
+
*/
|
|
5
|
+
text?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The size of the CircularProgress component
|
|
8
|
+
* @default 20
|
|
9
|
+
*/
|
|
10
|
+
size?: number | string;
|
|
11
|
+
/**
|
|
12
|
+
* The color of the CircularProgress component
|
|
13
|
+
* @default "primary"
|
|
14
|
+
*/
|
|
15
|
+
color?: "primary" | "secondary" | "error" | "info" | "success" | "warning" | "inherit";
|
|
16
|
+
/**
|
|
17
|
+
* The thickness of the circular progress
|
|
18
|
+
* @default 3.6
|
|
19
|
+
*/
|
|
20
|
+
thickness?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to center the component
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
centered?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Custom spacing between spinner and text
|
|
28
|
+
* @default 2
|
|
29
|
+
*/
|
|
30
|
+
spacing?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Typography variant for the text
|
|
33
|
+
* @default "body1"
|
|
34
|
+
*/
|
|
35
|
+
textVariant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "subtitle1" | "subtitle2" | "body1" | "body2" | "caption" | "overline";
|
|
36
|
+
}
|
|
37
|
+
export declare function Loading({ text, size, color, thickness, centered, spacing, textVariant, }: LoadingProps): import("react/jsx-runtime").JSX.Element;
|