@malloy-publisher/app 0.0.76 → 0.0.78
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-BAZuT25g-D9KeGh71.cjs +1 -0
- package/dist/RenderedResult-BAZuT25g-zsmphQm1.js +117 -0
- package/dist/index.cjs.js +133 -70
- package/dist/index.es.js +28246 -9519
- package/package.json +3 -2
- package/dist/RenderedResult-DXlUZo0k-CH-bOsNE.cjs +0 -1
- package/dist/RenderedResult-DXlUZo0k-Ck_Iae33.js +0 -79
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloy-publisher/app",
|
|
3
3
|
"description": "Malloy Publisher App",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.78",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"preview": "bunx vite preview",
|
|
31
31
|
"lint": "bunx eslint ./src --ext .ts,.tsx --ignore-path .gitignore --fix",
|
|
32
32
|
"format": "bunx prettier --write --parser typescript '**/*.{ts,tsx}'",
|
|
33
|
+
"analyze": "bunx vite-bundle-visualizer",
|
|
33
34
|
"generate-api-types": ""
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@malloy-publisher/sdk": "^v0.0.
|
|
37
|
+
"@malloy-publisher/sdk": "^v0.0.78",
|
|
37
38
|
"@mui/icons-material": "^7.0.2",
|
|
38
39
|
"@mui/material": "^7.0.2",
|
|
39
40
|
"@vitejs/plugin-react": "^4.3.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),C=require("@malloydata/render"),r=require("react");function S({result:c,height:m,isFillElement:o,onSizeChange:a,onDrill:y}){const e=r.useRef(null),[d,h]=r.useState(!1),[g,b]=r.useState(!1),[E,w]=r.useState(!1),n=r.useRef(null),t=r.useRef(null);if(r.useLayoutEffect(()=>{if(e.current&&c&&!g){b(!0),n.current||(n.current=new Promise(s=>{t.current=s}));const u=new C.MalloyRenderer({onClick:y}).createViz();for(;e.current.firstChild;)e.current.removeChild(e.current.firstChild);const l=new MutationObserver(s=>{for(const i of s)if(i.type==="childList"&&i.addedNodes.length>0&&Array.from(i.addedNodes).some(f=>f.nodeType===Node.ELEMENT_NODE)){l.disconnect(),setTimeout(()=>{h(!0),t.current&&(t.current(),t.current=null,n.current=null)},50);break}});if(e.current){l.observe(e.current,{childList:!0,subtree:!0,characterData:!0});try{u.setResult(JSON.parse(c)),u.render(e.current)}catch(s){console.error("Error rendering visualization:",s),l.disconnect(),h(!0),t.current&&(t.current(),t.current=null,n.current=null)}}}},[c,y,g]),r.useEffect(()=>{h(!1),b(!1),n.current=null,t.current=null},[c]),g&&!d&&n.current)throw n.current;return r.useEffect(()=>{if(!e.current||!d)return;const u=e.current,l=()=>{if(u){const f=u.offsetHeight;f>0?a&&a(f):o&&u.firstChild&&(u.firstChild.offsetHeight==0?o(!0):o(!1))}},s=setTimeout(l,100);let i=null;return E||(i=new MutationObserver(l),i.observe(u,{childList:!0,subtree:!0,attributes:!0})),()=>{clearTimeout(s),i?.disconnect()}},[a,c,o,d]),v.jsx("div",{ref:e,style:{width:"100%",height:m?`${m}px`:"100%"}})}exports.default=S;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
-
import { MalloyRenderer as w } from "@malloydata/render";
|
|
3
|
-
import { useRef as m, useState as g, useLayoutEffect as L, useEffect as b } from "react";
|
|
4
|
-
function O({
|
|
5
|
-
result: s,
|
|
6
|
-
height: p,
|
|
7
|
-
isFillElement: o,
|
|
8
|
-
onSizeChange: f,
|
|
9
|
-
onDrill: y
|
|
10
|
-
}) {
|
|
11
|
-
const e = m(null), [a, d] = g(!1), [h, E] = g(!1), [v, N] = g(!1), n = m(null), r = m(null);
|
|
12
|
-
if (L(() => {
|
|
13
|
-
if (e.current && s && !h) {
|
|
14
|
-
E(!0), n.current || (n.current = new Promise((u) => {
|
|
15
|
-
r.current = u;
|
|
16
|
-
}));
|
|
17
|
-
const t = new w({
|
|
18
|
-
onClick: y
|
|
19
|
-
}).createViz();
|
|
20
|
-
for (; e.current.firstChild; )
|
|
21
|
-
e.current.removeChild(e.current.firstChild);
|
|
22
|
-
const l = new MutationObserver((u) => {
|
|
23
|
-
for (const i of u)
|
|
24
|
-
if (i.type === "childList" && i.addedNodes.length > 0 && Array.from(i.addedNodes).some(
|
|
25
|
-
(c) => c.nodeType === Node.ELEMENT_NODE
|
|
26
|
-
)) {
|
|
27
|
-
l.disconnect(), setTimeout(() => {
|
|
28
|
-
d(!0), r.current && (r.current(), r.current = null, n.current = null);
|
|
29
|
-
}, 50);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
if (e.current) {
|
|
34
|
-
l.observe(e.current, {
|
|
35
|
-
childList: !0,
|
|
36
|
-
subtree: !0,
|
|
37
|
-
characterData: !0
|
|
38
|
-
});
|
|
39
|
-
try {
|
|
40
|
-
t.setResult(JSON.parse(s)), t.render(e.current);
|
|
41
|
-
} catch (u) {
|
|
42
|
-
console.error("Error rendering visualization:", u), l.disconnect(), d(!0), r.current && (r.current(), r.current = null, n.current = null);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}, [s, y, h]), b(() => {
|
|
47
|
-
d(!1), E(!1), n.current = null, r.current = null;
|
|
48
|
-
}, [s]), h && !a && n.current)
|
|
49
|
-
throw n.current;
|
|
50
|
-
return b(() => {
|
|
51
|
-
if (!e.current || !a) return;
|
|
52
|
-
const t = e.current, l = () => {
|
|
53
|
-
if (t) {
|
|
54
|
-
const c = t.offsetHeight;
|
|
55
|
-
c > 0 ? f && f(c) : o && t.firstChild && (t.firstChild.offsetHeight == 0 ? o(!0) : o(!1));
|
|
56
|
-
}
|
|
57
|
-
}, u = setTimeout(l, 100);
|
|
58
|
-
let i = null;
|
|
59
|
-
return v || (i = new MutationObserver(l), i.observe(t, {
|
|
60
|
-
childList: !0,
|
|
61
|
-
subtree: !0,
|
|
62
|
-
attributes: !0
|
|
63
|
-
})), () => {
|
|
64
|
-
clearTimeout(u), i?.disconnect();
|
|
65
|
-
};
|
|
66
|
-
}, [f, s, o, a]), /* @__PURE__ */ C(
|
|
67
|
-
"div",
|
|
68
|
-
{
|
|
69
|
-
ref: e,
|
|
70
|
-
style: {
|
|
71
|
-
width: "100%",
|
|
72
|
-
height: p ? `${p}px` : "100%"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
O as default
|
|
79
|
-
};
|