@aixa-transformation/pptx-viewer 2.0.2
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/CHANGELOG.md +369 -0
- package/LICENSE +202 -0
- package/NOTICE +18 -0
- package/README.md +249 -0
- package/dist/GLTFLoader-CV33YWNT.js +2613 -0
- package/dist/GLTFLoader-FQJ2I67K.mjs +2611 -0
- package/dist/Model3DScene-5ODZLKJM.mjs +49 -0
- package/dist/Model3DScene-VLHFNN5B.js +51 -0
- package/dist/OrbitControls-HI6CI76Z.mjs +3 -0
- package/dist/OrbitControls-XGY7XEC6.js +12 -0
- package/dist/SmartArt3DScene-3FL5JELA.mjs +333 -0
- package/dist/SmartArt3DScene-7IZ3IJYV.js +335 -0
- package/dist/SurfaceChart3DScene-C6GQQQB7.mjs +77 -0
- package/dist/SurfaceChart3DScene-KHMGQAGP.js +79 -0
- package/dist/chunk-2TOLRBFU.js +27629 -0
- package/dist/chunk-2X72MOPZ.mjs +2796 -0
- package/dist/chunk-6DZX6EAA.mjs +33 -0
- package/dist/chunk-AD2CLKY6.js +92338 -0
- package/dist/chunk-CUUYYYC5.js +2800 -0
- package/dist/chunk-DAKELFNP.js +915 -0
- package/dist/chunk-F2HFXS2Z.mjs +19063 -0
- package/dist/chunk-F3LO2NKI.mjs +913 -0
- package/dist/chunk-HNI6JYAI.js +34591 -0
- package/dist/chunk-IKBO6CZC.js +2 -0
- package/dist/chunk-KVM4DBEU.mjs +91768 -0
- package/dist/chunk-MOEXMRVK.js +19220 -0
- package/dist/chunk-QGM4M3NI.js +37 -0
- package/dist/chunk-SQY54X47.js +43506 -0
- package/dist/chunk-T5U6P2JH.mjs +1 -0
- package/dist/chunk-TB5ZWNMX.mjs +34577 -0
- package/dist/chunk-W5V6CEFL.mjs +43064 -0
- package/dist/chunk-XAVVR6OX.mjs +27204 -0
- package/dist/chunk-Y6FQDUJU.js +1160 -0
- package/dist/chunk-YI3G35EC.mjs +1076 -0
- package/dist/dist-LQJHTLHL.mjs +2 -0
- package/dist/dist-NVA3FEUV.js +2275 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.js +19 -0
- package/dist/i18n.mjs +2 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +135 -0
- package/dist/index.mjs +6 -0
- package/dist/internals.d.ts +1 -0
- package/dist/internals.js +311 -0
- package/dist/internals.mjs +6 -0
- package/dist/pptx-viewer.css +2 -0
- package/dist/presentation.d.ts +1 -0
- package/dist/presentation.js +11 -0
- package/dist/presentation.mjs +2 -0
- package/dist/three.module-HOXVV2KF.mjs +2 -0
- package/dist/three.module-QSJWIYNI.js +1771 -0
- package/dist/viewer/index.d.ts +1 -0
- package/dist/viewer/index.js +76 -0
- package/dist/viewer/index.mjs +7 -0
- package/dist/y-webrtc-DFUKFWCA.mjs +4279 -0
- package/dist/y-webrtc-RRACJ6WX.js +4284 -0
- package/dist/y-websocket-T5R5YGVE.mjs +378 -0
- package/dist/y-websocket-WMSHYIGX.js +384 -0
- package/package.json +141 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkDAKELFNP_js = require('./chunk-DAKELFNP.js');
|
|
4
|
+
var chunkSQY54X47_js = require('./chunk-SQY54X47.js');
|
|
5
|
+
require('./chunk-QGM4M3NI.js');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
// ../shared/dist/smartart-3d/index.mjs
|
|
10
|
+
var SUPERSAMPLE = 4;
|
|
11
|
+
var FILL = 0.86;
|
|
12
|
+
function wrapLines(ctx, text, maxWidth) {
|
|
13
|
+
const words = text.split(/\s+/u).filter(Boolean);
|
|
14
|
+
if (words.length === 0) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const lines = [];
|
|
18
|
+
let line = words[0];
|
|
19
|
+
for (let i = 1; i < words.length; i++) {
|
|
20
|
+
const candidate = `${line} ${words[i]}`;
|
|
21
|
+
if (ctx.measureText(candidate).width <= maxWidth) {
|
|
22
|
+
line = candidate;
|
|
23
|
+
} else {
|
|
24
|
+
lines.push(line);
|
|
25
|
+
line = words[i];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
lines.push(line);
|
|
29
|
+
return lines;
|
|
30
|
+
}
|
|
31
|
+
function makeTextTexture(text, color, fontSize, footW, footH) {
|
|
32
|
+
if (typeof document === "undefined" || !text.trim() || footW <= 0 || footH <= 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const worldWidth = footW * FILL;
|
|
36
|
+
const worldHeight = footH * FILL;
|
|
37
|
+
const canvas = document.createElement("canvas");
|
|
38
|
+
canvas.width = Math.max(8, Math.round(worldWidth * SUPERSAMPLE));
|
|
39
|
+
canvas.height = Math.max(8, Math.round(worldHeight * SUPERSAMPLE));
|
|
40
|
+
const ctx = canvas.getContext("2d");
|
|
41
|
+
if (!ctx) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const family = "system-ui, -apple-system, Segoe UI, Roboto, sans-serif";
|
|
45
|
+
const maxTextWidth = canvas.width * 0.94;
|
|
46
|
+
let px = Math.max(6, fontSize) * SUPERSAMPLE;
|
|
47
|
+
let lines = [];
|
|
48
|
+
for (let attempt = 0; attempt < 12; attempt++) {
|
|
49
|
+
ctx.font = `600 ${px}px ${family}`;
|
|
50
|
+
lines = wrapLines(ctx, text, maxTextWidth);
|
|
51
|
+
const lineHeight2 = px * 1.2;
|
|
52
|
+
if (lines.length * lineHeight2 <= canvas.height * 0.96 || px <= 6 * SUPERSAMPLE) {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
px *= 0.88;
|
|
56
|
+
}
|
|
57
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
58
|
+
ctx.fillStyle = color;
|
|
59
|
+
ctx.textAlign = "center";
|
|
60
|
+
ctx.textBaseline = "middle";
|
|
61
|
+
ctx.font = `600 ${px}px ${family}`;
|
|
62
|
+
const lineHeight = px * 1.2;
|
|
63
|
+
const blockHeight = lines.length * lineHeight;
|
|
64
|
+
const startY = canvas.height / 2 - blockHeight / 2 + lineHeight / 2;
|
|
65
|
+
for (let i = 0; i < lines.length; i++) {
|
|
66
|
+
ctx.fillText(lines[i], canvas.width / 2, startY + i * lineHeight);
|
|
67
|
+
}
|
|
68
|
+
const texture = new chunkSQY54X47_js.CanvasTexture(canvas);
|
|
69
|
+
texture.colorSpace = chunkSQY54X47_js.SRGBColorSpace;
|
|
70
|
+
texture.minFilter = chunkSQY54X47_js.LinearFilter;
|
|
71
|
+
texture.magFilter = chunkSQY54X47_js.LinearFilter;
|
|
72
|
+
texture.flipY = false;
|
|
73
|
+
texture.premultiplyAlpha = false;
|
|
74
|
+
texture.wrapT = chunkSQY54X47_js.RepeatWrapping;
|
|
75
|
+
texture.repeat.set(1, -1);
|
|
76
|
+
texture.offset.set(0, 1);
|
|
77
|
+
texture.needsUpdate = true;
|
|
78
|
+
return { texture, worldWidth, worldHeight };
|
|
79
|
+
}
|
|
80
|
+
function extrudeGeometry(m) {
|
|
81
|
+
const shape = new chunkSQY54X47_js.Shape();
|
|
82
|
+
m.outline.forEach((p, i) => {
|
|
83
|
+
if (i === 0) {
|
|
84
|
+
shape.moveTo(p.x, p.y);
|
|
85
|
+
} else {
|
|
86
|
+
shape.lineTo(p.x, p.y);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
shape.closePath();
|
|
90
|
+
const bevelEnabled = m.bevel > 0;
|
|
91
|
+
return new chunkSQY54X47_js.ExtrudeGeometry(shape, {
|
|
92
|
+
depth: m.depth,
|
|
93
|
+
bevelEnabled,
|
|
94
|
+
bevelThickness: m.bevel,
|
|
95
|
+
bevelSize: m.bevel,
|
|
96
|
+
bevelSegments: 2,
|
|
97
|
+
curveSegments: m.rounded ? 24 : 1,
|
|
98
|
+
steps: 1
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function addBlock(group, disposables, m) {
|
|
102
|
+
const geo = extrudeGeometry(m);
|
|
103
|
+
const material = new chunkSQY54X47_js.MeshStandardMaterial({
|
|
104
|
+
color: new chunkSQY54X47_js.Color(m.fill),
|
|
105
|
+
metalness: 0.12,
|
|
106
|
+
roughness: 0.52,
|
|
107
|
+
transparent: m.opacity < 1,
|
|
108
|
+
opacity: m.opacity
|
|
109
|
+
});
|
|
110
|
+
const mesh = new chunkSQY54X47_js.Mesh(geo, material);
|
|
111
|
+
mesh.position.set(m.position.x, m.position.y, m.position.z);
|
|
112
|
+
mesh.rotation.set(m.rotation.x, m.rotation.y, m.rotation.z);
|
|
113
|
+
group.add(mesh);
|
|
114
|
+
disposables.push(geo, material);
|
|
115
|
+
if (m.strokeWidth > 0) {
|
|
116
|
+
const edges = new chunkSQY54X47_js.EdgesGeometry(geo, 30);
|
|
117
|
+
const lineMaterial = new chunkSQY54X47_js.LineBasicMaterial({ color: new chunkSQY54X47_js.Color(m.stroke) });
|
|
118
|
+
const line = new chunkSQY54X47_js.LineSegments(edges, lineMaterial);
|
|
119
|
+
line.position.copy(mesh.position);
|
|
120
|
+
line.rotation.copy(mesh.rotation);
|
|
121
|
+
group.add(line);
|
|
122
|
+
disposables.push(edges, lineMaterial);
|
|
123
|
+
}
|
|
124
|
+
return geo;
|
|
125
|
+
}
|
|
126
|
+
function addLabel(group, disposables, m) {
|
|
127
|
+
if (!m.text) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const tex = makeTextTexture(m.text, m.textColor, m.fontSize, m.halfWidth * 2, m.halfHeight * 2);
|
|
131
|
+
if (!tex) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const planeGeo = new chunkSQY54X47_js.PlaneGeometry(tex.worldWidth, tex.worldHeight);
|
|
135
|
+
const planeMaterial = new chunkSQY54X47_js.MeshBasicMaterial({
|
|
136
|
+
map: tex.texture,
|
|
137
|
+
transparent: true,
|
|
138
|
+
depthWrite: false
|
|
139
|
+
});
|
|
140
|
+
const plane = new chunkSQY54X47_js.Mesh(planeGeo, planeMaterial);
|
|
141
|
+
const euler = new chunkSQY54X47_js.Euler(m.rotation.x, m.rotation.y, m.rotation.z);
|
|
142
|
+
const offset = new chunkSQY54X47_js.Vector3(0, 0, m.depth + m.bevel + 0.4).applyEuler(euler);
|
|
143
|
+
plane.position.set(m.position.x + offset.x, m.position.y + offset.y, m.position.z + offset.z);
|
|
144
|
+
plane.rotation.copy(euler);
|
|
145
|
+
group.add(plane);
|
|
146
|
+
disposables.push(planeGeo, planeMaterial, tex.texture);
|
|
147
|
+
}
|
|
148
|
+
function addConnectors(group, disposables, model) {
|
|
149
|
+
for (const c of model.connectors) {
|
|
150
|
+
if (c.points.length < 2) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const geo = new chunkSQY54X47_js.BufferGeometry().setFromPoints(c.points.map((p) => new chunkSQY54X47_js.Vector3(p.x, p.y, p.z)));
|
|
154
|
+
const material = new chunkSQY54X47_js.LineBasicMaterial({
|
|
155
|
+
color: new chunkSQY54X47_js.Color(c.color),
|
|
156
|
+
transparent: true,
|
|
157
|
+
opacity: 0.7
|
|
158
|
+
});
|
|
159
|
+
group.add(new chunkSQY54X47_js.Line(geo, material));
|
|
160
|
+
disposables.push(geo, material);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function buildMeshGroup(model) {
|
|
164
|
+
const group = new chunkSQY54X47_js.Group();
|
|
165
|
+
const disposables = [];
|
|
166
|
+
for (const m of model.meshes) {
|
|
167
|
+
addBlock(group, disposables, m);
|
|
168
|
+
addLabel(group, disposables, m);
|
|
169
|
+
}
|
|
170
|
+
addConnectors(group, disposables, model);
|
|
171
|
+
return {
|
|
172
|
+
group,
|
|
173
|
+
dispose() {
|
|
174
|
+
for (const d of disposables) {
|
|
175
|
+
d.dispose();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
var FOV = 42;
|
|
181
|
+
function contentSphere(model) {
|
|
182
|
+
let minX = Infinity;
|
|
183
|
+
let minY = Infinity;
|
|
184
|
+
let minZ = Infinity;
|
|
185
|
+
let maxX = -Infinity;
|
|
186
|
+
let maxY = -Infinity;
|
|
187
|
+
let maxZ = -Infinity;
|
|
188
|
+
const expand = (x, y, z, r) => {
|
|
189
|
+
minX = Math.min(minX, x - r);
|
|
190
|
+
minY = Math.min(minY, y - r);
|
|
191
|
+
minZ = Math.min(minZ, z - r);
|
|
192
|
+
maxX = Math.max(maxX, x + r);
|
|
193
|
+
maxY = Math.max(maxY, y + r);
|
|
194
|
+
maxZ = Math.max(maxZ, z + r);
|
|
195
|
+
};
|
|
196
|
+
for (const m of model.meshes) {
|
|
197
|
+
const r = Math.max(m.halfWidth, m.halfHeight) + m.depth + m.bevel;
|
|
198
|
+
expand(m.position.x, m.position.y, m.position.z, r);
|
|
199
|
+
}
|
|
200
|
+
for (const c of model.connectors) {
|
|
201
|
+
for (const p of c.points) {
|
|
202
|
+
expand(p.x, p.y, p.z, 1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (!Number.isFinite(minX)) {
|
|
206
|
+
const fallback = Math.max(model.bounds.width, model.bounds.height) / 2 || 1;
|
|
207
|
+
return { cx: 0, cy: 0, cz: 0, radius: fallback };
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
cx: (minX + maxX) / 2,
|
|
211
|
+
cy: (minY + maxY) / 2,
|
|
212
|
+
cz: (minZ + maxZ) / 2,
|
|
213
|
+
radius: 0.5 * Math.hypot(maxX - minX, maxY - minY, maxZ - minZ) || 1
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function frameDistance(radius, aspect) {
|
|
217
|
+
const vFov = FOV * Math.PI / 180;
|
|
218
|
+
const hFov = 2 * Math.atan(Math.tan(vFov / 2) * aspect);
|
|
219
|
+
const minFov = Math.min(vFov, hFov);
|
|
220
|
+
return radius / Math.sin(minFov / 2) * 1.1;
|
|
221
|
+
}
|
|
222
|
+
function mountSmartArt3D(canvas, model, width, height, options = {}) {
|
|
223
|
+
const renderer = new chunkSQY54X47_js.WebGLRenderer({ canvas, antialias: true, alpha: !options.background });
|
|
224
|
+
renderer.setPixelRatio(
|
|
225
|
+
Math.min(
|
|
226
|
+
typeof window === "undefined" ? 1 : window.devicePixelRatio || 1,
|
|
227
|
+
options.maxPixelRatio ?? 2
|
|
228
|
+
)
|
|
229
|
+
);
|
|
230
|
+
renderer.setSize(width, height, false);
|
|
231
|
+
const scene = new chunkSQY54X47_js.Scene();
|
|
232
|
+
if (options.background) {
|
|
233
|
+
scene.background = new chunkSQY54X47_js.Color(options.background);
|
|
234
|
+
}
|
|
235
|
+
const { cx, cy, cz, radius } = contentSphere(model);
|
|
236
|
+
const aspect = width / Math.max(1, height);
|
|
237
|
+
const dist = frameDistance(radius, aspect);
|
|
238
|
+
const camera = new chunkSQY54X47_js.PerspectiveCamera(FOV, aspect, 0.1, dist * 8 + radius * 4);
|
|
239
|
+
camera.position.set(cx + radius * 0.25, cy + radius * 0.3, cz + dist);
|
|
240
|
+
camera.lookAt(cx, cy, cz);
|
|
241
|
+
scene.add(new chunkSQY54X47_js.AmbientLight(16777215, 0.62));
|
|
242
|
+
const key = new chunkSQY54X47_js.DirectionalLight(16777215, 0.95);
|
|
243
|
+
key.position.set(cx + radius, cy + radius * 1.4, cz + dist);
|
|
244
|
+
scene.add(key);
|
|
245
|
+
const fill = new chunkSQY54X47_js.DirectionalLight(16777215, 0.3);
|
|
246
|
+
fill.position.set(cx - radius, cy - radius * 0.6, cz + dist * 0.6);
|
|
247
|
+
scene.add(fill);
|
|
248
|
+
const built = buildMeshGroup(model);
|
|
249
|
+
scene.add(built.group);
|
|
250
|
+
let controls = null;
|
|
251
|
+
const enableControls = (on) => {
|
|
252
|
+
if (on && !controls) {
|
|
253
|
+
controls = new chunkDAKELFNP_js.OrbitControls(camera, canvas);
|
|
254
|
+
controls.enablePan = false;
|
|
255
|
+
controls.target.set(cx, cy, cz);
|
|
256
|
+
controls.minDistance = dist * 0.4;
|
|
257
|
+
controls.maxDistance = dist * 3;
|
|
258
|
+
controls.update();
|
|
259
|
+
} else if (!on && controls) {
|
|
260
|
+
controls.dispose();
|
|
261
|
+
controls = null;
|
|
262
|
+
}
|
|
263
|
+
if (controls) {
|
|
264
|
+
controls.autoRotate = Boolean(options.autoRotate);
|
|
265
|
+
controls.autoRotateSpeed = 1.2;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
enableControls(Boolean(options.interactive));
|
|
269
|
+
let frame = 0;
|
|
270
|
+
let disposed = false;
|
|
271
|
+
const renderLoop = () => {
|
|
272
|
+
if (disposed) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
frame = requestAnimationFrame(renderLoop);
|
|
276
|
+
controls?.update();
|
|
277
|
+
renderer.render(scene, camera);
|
|
278
|
+
};
|
|
279
|
+
frame = requestAnimationFrame(renderLoop);
|
|
280
|
+
return {
|
|
281
|
+
resize(w, h) {
|
|
282
|
+
camera.aspect = w / Math.max(1, h);
|
|
283
|
+
camera.updateProjectionMatrix();
|
|
284
|
+
renderer.setSize(w, h, false);
|
|
285
|
+
},
|
|
286
|
+
setInteractive(on) {
|
|
287
|
+
enableControls(on);
|
|
288
|
+
},
|
|
289
|
+
dispose() {
|
|
290
|
+
disposed = true;
|
|
291
|
+
cancelAnimationFrame(frame);
|
|
292
|
+
controls?.dispose();
|
|
293
|
+
built.dispose();
|
|
294
|
+
renderer.dispose();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function SmartArt3DScene({
|
|
299
|
+
model,
|
|
300
|
+
width,
|
|
301
|
+
height,
|
|
302
|
+
interactive
|
|
303
|
+
}) {
|
|
304
|
+
const canvasRef = react.useRef(null);
|
|
305
|
+
const handleRef = react.useRef(null);
|
|
306
|
+
react.useEffect(() => {
|
|
307
|
+
const canvas = canvasRef.current;
|
|
308
|
+
if (!canvas) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const handle = mountSmartArt3D(canvas, model, width, height, {
|
|
312
|
+
interactive
|
|
313
|
+
});
|
|
314
|
+
handleRef.current = handle;
|
|
315
|
+
return () => {
|
|
316
|
+
handle.dispose();
|
|
317
|
+
handleRef.current = null;
|
|
318
|
+
};
|
|
319
|
+
}, [model]);
|
|
320
|
+
react.useEffect(() => {
|
|
321
|
+
handleRef.current?.resize(width, height);
|
|
322
|
+
}, [width, height]);
|
|
323
|
+
react.useEffect(() => {
|
|
324
|
+
handleRef.current?.setInteractive(interactive);
|
|
325
|
+
}, [interactive]);
|
|
326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
327
|
+
"canvas",
|
|
328
|
+
{
|
|
329
|
+
ref: canvasRef,
|
|
330
|
+
style: { width, height, display: "block", pointerEvents: interactive ? "auto" : "none" }
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
module.exports = SmartArt3DScene;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { mountSurfaceChart3D } from './chunk-XAVVR6OX.mjs';
|
|
2
|
+
import './chunk-KVM4DBEU.mjs';
|
|
3
|
+
import './chunk-6DZX6EAA.mjs';
|
|
4
|
+
import { useRef, useEffect } from 'react';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function SurfaceChart3DScene({
|
|
8
|
+
cols,
|
|
9
|
+
rows,
|
|
10
|
+
heightMap,
|
|
11
|
+
colorMap,
|
|
12
|
+
wireframe,
|
|
13
|
+
categoryLabels,
|
|
14
|
+
seriesNames,
|
|
15
|
+
title,
|
|
16
|
+
width,
|
|
17
|
+
height
|
|
18
|
+
}) {
|
|
19
|
+
const containerRef = useRef(null);
|
|
20
|
+
const handleRef = useRef(null);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const container = containerRef.current;
|
|
23
|
+
if (!container) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let disposed = false;
|
|
27
|
+
void mountSurfaceChart3D(container, {
|
|
28
|
+
cols,
|
|
29
|
+
rows,
|
|
30
|
+
heightMap,
|
|
31
|
+
colorMap,
|
|
32
|
+
wireframe,
|
|
33
|
+
categoryLabels,
|
|
34
|
+
seriesNames,
|
|
35
|
+
width,
|
|
36
|
+
height
|
|
37
|
+
}).then((handle) => {
|
|
38
|
+
if (disposed) {
|
|
39
|
+
handle.dispose();
|
|
40
|
+
} else {
|
|
41
|
+
handleRef.current = handle;
|
|
42
|
+
}
|
|
43
|
+
return void 0;
|
|
44
|
+
});
|
|
45
|
+
return () => {
|
|
46
|
+
disposed = true;
|
|
47
|
+
handleRef.current?.dispose();
|
|
48
|
+
handleRef.current = null;
|
|
49
|
+
};
|
|
50
|
+
}, [cols, rows, heightMap, colorMap, wireframe, categoryLabels, seriesNames]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
handleRef.current?.resize(width, height);
|
|
53
|
+
}, [width, height]);
|
|
54
|
+
return /* @__PURE__ */ jsxs("div", { style: { width, height, position: "relative" }, children: [
|
|
55
|
+
title && /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
style: {
|
|
59
|
+
position: "absolute",
|
|
60
|
+
top: 4,
|
|
61
|
+
left: 0,
|
|
62
|
+
right: 0,
|
|
63
|
+
textAlign: "center",
|
|
64
|
+
fontSize: "12px",
|
|
65
|
+
fontWeight: 600,
|
|
66
|
+
color: "#333",
|
|
67
|
+
zIndex: 1,
|
|
68
|
+
pointerEvents: "none"
|
|
69
|
+
},
|
|
70
|
+
children: title
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, style: { width, height, willChange: "transform" } })
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { SurfaceChart3DScene as default };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2TOLRBFU_js = require('./chunk-2TOLRBFU.js');
|
|
4
|
+
require('./chunk-AD2CLKY6.js');
|
|
5
|
+
require('./chunk-QGM4M3NI.js');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function SurfaceChart3DScene({
|
|
10
|
+
cols,
|
|
11
|
+
rows,
|
|
12
|
+
heightMap,
|
|
13
|
+
colorMap,
|
|
14
|
+
wireframe,
|
|
15
|
+
categoryLabels,
|
|
16
|
+
seriesNames,
|
|
17
|
+
title,
|
|
18
|
+
width,
|
|
19
|
+
height
|
|
20
|
+
}) {
|
|
21
|
+
const containerRef = react.useRef(null);
|
|
22
|
+
const handleRef = react.useRef(null);
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
const container = containerRef.current;
|
|
25
|
+
if (!container) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let disposed = false;
|
|
29
|
+
void chunk2TOLRBFU_js.mountSurfaceChart3D(container, {
|
|
30
|
+
cols,
|
|
31
|
+
rows,
|
|
32
|
+
heightMap,
|
|
33
|
+
colorMap,
|
|
34
|
+
wireframe,
|
|
35
|
+
categoryLabels,
|
|
36
|
+
seriesNames,
|
|
37
|
+
width,
|
|
38
|
+
height
|
|
39
|
+
}).then((handle) => {
|
|
40
|
+
if (disposed) {
|
|
41
|
+
handle.dispose();
|
|
42
|
+
} else {
|
|
43
|
+
handleRef.current = handle;
|
|
44
|
+
}
|
|
45
|
+
return void 0;
|
|
46
|
+
});
|
|
47
|
+
return () => {
|
|
48
|
+
disposed = true;
|
|
49
|
+
handleRef.current?.dispose();
|
|
50
|
+
handleRef.current = null;
|
|
51
|
+
};
|
|
52
|
+
}, [cols, rows, heightMap, colorMap, wireframe, categoryLabels, seriesNames]);
|
|
53
|
+
react.useEffect(() => {
|
|
54
|
+
handleRef.current?.resize(width, height);
|
|
55
|
+
}, [width, height]);
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width, height, position: "relative" }, children: [
|
|
57
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
style: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
top: 4,
|
|
63
|
+
left: 0,
|
|
64
|
+
right: 0,
|
|
65
|
+
textAlign: "center",
|
|
66
|
+
fontSize: "12px",
|
|
67
|
+
fontWeight: 600,
|
|
68
|
+
color: "#333",
|
|
69
|
+
zIndex: 1,
|
|
70
|
+
pointerEvents: "none"
|
|
71
|
+
},
|
|
72
|
+
children: title
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, style: { width, height, willChange: "transform" } })
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = SurfaceChart3DScene;
|