@gui-chat-plugin/present3d 0.0.1 → 0.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/dist/core/index.d.ts +7 -7
- package/dist/core/plugin.d.ts +3 -3
- package/dist/core/samples.d.ts +1 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core.cjs +1 -0
- package/dist/core.js +4 -4
- package/dist/index-BXHIfuts.js +20881 -0
- package/dist/index-BrL881Mh.cjs +3971 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -0
- package/dist/shapescript/evaluator.d.ts +1 -1
- package/dist/shapescript/parser.d.ts +1 -1
- package/dist/shapescript/toThreeJS.d.ts +1 -1
- package/dist/style.css +1 -0
- package/dist/vue/Preview.vue.d.ts +8 -0
- package/dist/vue/Preview.vue.d.ts.map +1 -0
- package/dist/vue/View.vue.d.ts +12 -0
- package/dist/vue/View.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +12 -11
- package/dist/vue.cjs +82 -0
- package/dist/vue.js +154 -156
- package/package.json +12 -8
- package/dist/present3d.css +0 -1
- package/dist/toThreeJS-EXFMlO7B.js +0 -2171
package/dist/vue.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import {
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
|
|
5
|
-
import { Controls as Pt, Vector3 as E, MOUSE as C, TOUCH as x, Quaternion as B, Spherical as Q, Vector2 as P, Ray as Et, Plane as St, MathUtils as Dt } from "three";
|
|
6
|
-
const $ = { type: "change" }, F = { type: "start" }, ot = { type: "end" }, z = new Et(), J = new St(), Tt = Math.cos(70 * Dt.DEG2RAD), d = new E(), f = 2 * Math.PI, l = {
|
|
1
|
+
import { C as Pt, V as P, M as x, T as O, Q as G, S as q, a as w, R as Et, P as St, b as Dt, c as J, d as tt, e as et, W as it, A as st, D as ot, G as Tt, p as z, f as Y, s as vt, g as Mt } from "./index-BXHIfuts.js";
|
|
2
|
+
import { h as ue, i as me } from "./index-BXHIfuts.js";
|
|
3
|
+
import { defineComponent as at, ref as M, computed as nt, onMounted as rt, nextTick as B, onUnmounted as ht, watch as R, createElementBlock as Z, openBlock as K, createElementVNode as _, createCommentVNode as Rt, toDisplayString as A, createTextVNode as k, withDirectives as Ot, vModelText as xt } from "vue";
|
|
4
|
+
const Q = { type: "change" }, F = { type: "start" }, lt = { type: "end" }, j = new Et(), $ = new St(), Ct = Math.cos(70 * Dt.DEG2RAD), d = new P(), f = 2 * Math.PI, l = {
|
|
7
5
|
NONE: -1,
|
|
8
6
|
ROTATE: 0,
|
|
9
7
|
DOLLY: 1,
|
|
@@ -12,10 +10,10 @@ const $ = { type: "change" }, F = { type: "start" }, ot = { type: "end" }, z = n
|
|
|
12
10
|
TOUCH_PAN: 4,
|
|
13
11
|
TOUCH_DOLLY_PAN: 5,
|
|
14
12
|
TOUCH_DOLLY_ROTATE: 6
|
|
15
|
-
},
|
|
16
|
-
class
|
|
13
|
+
}, U = 1e-6;
|
|
14
|
+
class Lt extends Pt {
|
|
17
15
|
constructor(t, e = null) {
|
|
18
|
-
super(t, e), this.state = l.NONE, this.enabled = !0, this.target = new
|
|
16
|
+
super(t, e), this.state = l.NONE, this.enabled = !0, this.target = new P(), this.cursor = new P(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: x.ROTATE, MIDDLE: x.DOLLY, RIGHT: x.PAN }, this.touches = { ONE: O.ROTATE, TWO: O.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new P(), this._lastQuaternion = new G(), this._lastTargetPosition = new P(), this._quat = new G().setFromUnitVectors(t.up, new P(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new q(), this._sphericalDelta = new q(), this._scale = 1, this._panOffset = new P(), this._rotateStart = new w(), this._rotateEnd = new w(), this._rotateDelta = new w(), this._panStart = new w(), this._panEnd = new w(), this._panDelta = new w(), this._dollyStart = new w(), this._dollyEnd = new w(), this._dollyDelta = new w(), this._dollyDirection = new P(), this._mouse = new w(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = kt.bind(this), this._onPointerDown = At.bind(this), this._onPointerUp = jt.bind(this), this._onContextMenu = Kt.bind(this), this._onMouseWheel = It.bind(this), this._onKeyDown = Ut.bind(this), this._onTouchStart = Yt.bind(this), this._onTouchMove = Zt.bind(this), this._onMouseDown = zt.bind(this), this._onMouseMove = Nt.bind(this), this._interceptControlDown = Ft.bind(this), this._interceptControlUp = Ht.bind(this), this.domElement !== null && this.connect(), this.update();
|
|
19
17
|
}
|
|
20
18
|
connect() {
|
|
21
19
|
this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -45,7 +43,7 @@ class vt extends Pt {
|
|
|
45
43
|
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
46
44
|
}
|
|
47
45
|
reset() {
|
|
48
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
46
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Q), this.update(), this.state = l.NONE;
|
|
49
47
|
}
|
|
50
48
|
update(t = null) {
|
|
51
49
|
const e = this.object.position;
|
|
@@ -67,20 +65,20 @@ class vt extends Pt {
|
|
|
67
65
|
const u = p - c;
|
|
68
66
|
this.object.position.addScaledVector(this._dollyDirection, u), this.object.updateMatrixWorld(), n = !!u;
|
|
69
67
|
} else if (this.object.isOrthographicCamera) {
|
|
70
|
-
const p = new
|
|
68
|
+
const p = new P(this._mouse.x, this._mouse.y, 0);
|
|
71
69
|
p.unproject(this.object);
|
|
72
70
|
const u = this.object.zoom;
|
|
73
71
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), n = u !== this.object.zoom;
|
|
74
|
-
const
|
|
75
|
-
|
|
72
|
+
const T = new P(this._mouse.x, this._mouse.y, 0);
|
|
73
|
+
T.unproject(this.object), this.object.position.sub(T).add(p), this.object.updateMatrixWorld(), c = d.length();
|
|
76
74
|
} else
|
|
77
75
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
78
|
-
c !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(c).add(this.object.position) : (
|
|
76
|
+
c !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(c).add(this.object.position) : (j.origin.copy(this.object.position), j.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(j.direction)) < Ct ? this.object.lookAt(this.target) : ($.setFromNormalAndCoplanarPoint(this.object.up, this.target), j.intersectPlane($, this.target))));
|
|
79
77
|
} else if (this.object.isOrthographicCamera) {
|
|
80
78
|
const c = this.object.zoom;
|
|
81
79
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), c !== this.object.zoom && (this.object.updateProjectionMatrix(), n = !0);
|
|
82
80
|
}
|
|
83
|
-
return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) >
|
|
81
|
+
return this._scale = 1, this._performCursorZoom = !1, n || this._lastPosition.distanceToSquared(this.object.position) > U || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > U || this._lastTargetPosition.distanceToSquared(this.target) > U ? (this.dispatchEvent(Q), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
84
82
|
}
|
|
85
83
|
_getAutoRotationAngle(t) {
|
|
86
84
|
return t !== null ? f / 60 * this.autoRotateSpeed * t : f / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -248,7 +246,7 @@ class vt extends Pt {
|
|
|
248
246
|
}
|
|
249
247
|
_trackPointer(t) {
|
|
250
248
|
let e = this._pointerPositions[t.pointerId];
|
|
251
|
-
e === void 0 && (e = new
|
|
249
|
+
e === void 0 && (e = new w(), this._pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
|
|
252
250
|
}
|
|
253
251
|
_getSecondPointerPosition(t) {
|
|
254
252
|
const e = t.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
@@ -272,16 +270,16 @@ class vt extends Pt {
|
|
|
272
270
|
return t.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
273
271
|
}
|
|
274
272
|
}
|
|
275
|
-
function
|
|
273
|
+
function At(i) {
|
|
276
274
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
|
|
277
275
|
}
|
|
278
|
-
function
|
|
276
|
+
function kt(i) {
|
|
279
277
|
this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
|
|
280
278
|
}
|
|
281
|
-
function
|
|
279
|
+
function jt(i) {
|
|
282
280
|
switch (this._removePointer(i), this._pointers.length) {
|
|
283
281
|
case 0:
|
|
284
|
-
this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
282
|
+
this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(lt), this.state = l.NONE;
|
|
285
283
|
break;
|
|
286
284
|
case 1:
|
|
287
285
|
const t = this._pointers[0], e = this._pointerPositions[t];
|
|
@@ -289,7 +287,7 @@ function Ot(i) {
|
|
|
289
287
|
break;
|
|
290
288
|
}
|
|
291
289
|
}
|
|
292
|
-
function
|
|
290
|
+
function zt(i) {
|
|
293
291
|
let t;
|
|
294
292
|
switch (i.button) {
|
|
295
293
|
case 0:
|
|
@@ -305,11 +303,11 @@ function xt(i) {
|
|
|
305
303
|
t = -1;
|
|
306
304
|
}
|
|
307
305
|
switch (t) {
|
|
308
|
-
case
|
|
306
|
+
case x.DOLLY:
|
|
309
307
|
if (this.enableZoom === !1) return;
|
|
310
308
|
this._handleMouseDownDolly(i), this.state = l.DOLLY;
|
|
311
309
|
break;
|
|
312
|
-
case
|
|
310
|
+
case x.ROTATE:
|
|
313
311
|
if (i.ctrlKey || i.metaKey || i.shiftKey) {
|
|
314
312
|
if (this.enablePan === !1) return;
|
|
315
313
|
this._handleMouseDownPan(i), this.state = l.PAN;
|
|
@@ -318,7 +316,7 @@ function xt(i) {
|
|
|
318
316
|
this._handleMouseDownRotate(i), this.state = l.ROTATE;
|
|
319
317
|
}
|
|
320
318
|
break;
|
|
321
|
-
case
|
|
319
|
+
case x.PAN:
|
|
322
320
|
if (i.ctrlKey || i.metaKey || i.shiftKey) {
|
|
323
321
|
if (this.enableRotate === !1) return;
|
|
324
322
|
this._handleMouseDownRotate(i), this.state = l.ROTATE;
|
|
@@ -332,7 +330,7 @@ function xt(i) {
|
|
|
332
330
|
}
|
|
333
331
|
this.state !== l.NONE && this.dispatchEvent(F);
|
|
334
332
|
}
|
|
335
|
-
function
|
|
333
|
+
function Nt(i) {
|
|
336
334
|
switch (this.state) {
|
|
337
335
|
case l.ROTATE:
|
|
338
336
|
if (this.enableRotate === !1) return;
|
|
@@ -348,21 +346,21 @@ function Ct(i) {
|
|
|
348
346
|
break;
|
|
349
347
|
}
|
|
350
348
|
}
|
|
351
|
-
function
|
|
352
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (i.preventDefault(), this.dispatchEvent(F), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(
|
|
349
|
+
function It(i) {
|
|
350
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== l.NONE || (i.preventDefault(), this.dispatchEvent(F), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(lt));
|
|
353
351
|
}
|
|
354
|
-
function
|
|
352
|
+
function Ut(i) {
|
|
355
353
|
this.enabled !== !1 && this._handleKeyDown(i);
|
|
356
354
|
}
|
|
357
|
-
function
|
|
355
|
+
function Yt(i) {
|
|
358
356
|
switch (this._trackPointer(i), this._pointers.length) {
|
|
359
357
|
case 1:
|
|
360
358
|
switch (this.touches.ONE) {
|
|
361
|
-
case
|
|
359
|
+
case O.ROTATE:
|
|
362
360
|
if (this.enableRotate === !1) return;
|
|
363
361
|
this._handleTouchStartRotate(i), this.state = l.TOUCH_ROTATE;
|
|
364
362
|
break;
|
|
365
|
-
case
|
|
363
|
+
case O.PAN:
|
|
366
364
|
if (this.enablePan === !1) return;
|
|
367
365
|
this._handleTouchStartPan(i), this.state = l.TOUCH_PAN;
|
|
368
366
|
break;
|
|
@@ -372,11 +370,11 @@ function kt(i) {
|
|
|
372
370
|
break;
|
|
373
371
|
case 2:
|
|
374
372
|
switch (this.touches.TWO) {
|
|
375
|
-
case
|
|
373
|
+
case O.DOLLY_PAN:
|
|
376
374
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
377
375
|
this._handleTouchStartDollyPan(i), this.state = l.TOUCH_DOLLY_PAN;
|
|
378
376
|
break;
|
|
379
|
-
case
|
|
377
|
+
case O.DOLLY_ROTATE:
|
|
380
378
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
381
379
|
this._handleTouchStartDollyRotate(i), this.state = l.TOUCH_DOLLY_ROTATE;
|
|
382
380
|
break;
|
|
@@ -389,7 +387,7 @@ function kt(i) {
|
|
|
389
387
|
}
|
|
390
388
|
this.state !== l.NONE && this.dispatchEvent(F);
|
|
391
389
|
}
|
|
392
|
-
function
|
|
390
|
+
function Zt(i) {
|
|
393
391
|
switch (this._trackPointer(i), this.state) {
|
|
394
392
|
case l.TOUCH_ROTATE:
|
|
395
393
|
if (this.enableRotate === !1) return;
|
|
@@ -411,93 +409,93 @@ function jt(i) {
|
|
|
411
409
|
this.state = l.NONE;
|
|
412
410
|
}
|
|
413
411
|
}
|
|
414
|
-
function
|
|
412
|
+
function Kt(i) {
|
|
415
413
|
this.enabled !== !1 && i.preventDefault();
|
|
416
414
|
}
|
|
417
|
-
function
|
|
415
|
+
function Ft(i) {
|
|
418
416
|
i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
419
417
|
}
|
|
420
|
-
function
|
|
418
|
+
function Ht(i) {
|
|
421
419
|
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
422
420
|
}
|
|
423
|
-
const
|
|
421
|
+
const Vt = { class: "present3d-container" }, Wt = { class: "header" }, Xt = { class: "controls" }, Gt = { class: "material-icons" }, qt = { class: "material-icons" }, Bt = {
|
|
424
422
|
key: 0,
|
|
425
423
|
class: "error"
|
|
426
|
-
},
|
|
424
|
+
}, Qt = { class: "script-source" }, $t = ["disabled"], Jt = /* @__PURE__ */ at({
|
|
427
425
|
__name: "View",
|
|
428
426
|
props: {
|
|
429
427
|
selectedResult: {}
|
|
430
428
|
},
|
|
431
429
|
emits: ["updateResult"],
|
|
432
430
|
setup(i, { emit: t }) {
|
|
433
|
-
var
|
|
434
|
-
const e = i, s = t, o =
|
|
431
|
+
var X;
|
|
432
|
+
const e = i, s = t, o = M(((X = e.selectedResult.data) == null ? void 0 : X.script) ?? ""), n = M(null), c = M(null), p = M(!1), u = M(!0), T = nt(() => {
|
|
435
433
|
var a;
|
|
436
434
|
return o.value !== ((a = e.selectedResult.data) == null ? void 0 : a.script);
|
|
437
435
|
});
|
|
438
|
-
let
|
|
439
|
-
|
|
440
|
-
|
|
436
|
+
let g, m, y, r, b, E, C = [], S = null, v = null;
|
|
437
|
+
rt(() => {
|
|
438
|
+
pt(), I(), H(), B(() => {
|
|
441
439
|
V();
|
|
442
440
|
});
|
|
443
|
-
}),
|
|
444
|
-
|
|
445
|
-
}),
|
|
441
|
+
}), ht(() => {
|
|
442
|
+
bt();
|
|
443
|
+
}), R(
|
|
446
444
|
() => {
|
|
447
445
|
var a;
|
|
448
446
|
return (a = e.selectedResult.data) == null ? void 0 : a.script;
|
|
449
447
|
},
|
|
450
448
|
() => {
|
|
451
|
-
|
|
449
|
+
I();
|
|
452
450
|
}
|
|
453
|
-
),
|
|
454
|
-
|
|
455
|
-
}),
|
|
456
|
-
|
|
451
|
+
), R(p, () => {
|
|
452
|
+
I();
|
|
453
|
+
}), R(u, (a) => {
|
|
454
|
+
E && (E.visible = a);
|
|
457
455
|
});
|
|
458
|
-
function
|
|
456
|
+
function pt() {
|
|
459
457
|
if (!n.value) return;
|
|
460
|
-
|
|
458
|
+
g = new J(), g.background = new tt(1710618);
|
|
461
459
|
const a = n.value.clientWidth, h = n.value.clientHeight;
|
|
462
|
-
m = new
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}),
|
|
460
|
+
m = new et(50, a / h, 0.1, 1e3), m.position.set(5, 5, 10), m.lookAt(0, 0, 0), y = new it({ antialias: !0 }), y.setSize(a, h), y.setPixelRatio(window.devicePixelRatio), n.value.appendChild(y.domElement), r = new Lt(m, y.domElement), r.enableDamping = !0, r.dampingFactor = 0.05, r.addEventListener("change", W);
|
|
461
|
+
const D = new st(16777215, 0.6);
|
|
462
|
+
g.add(D);
|
|
463
|
+
const L = new ot(16777215, 0.8);
|
|
464
|
+
L.position.set(10, 10, 10), g.add(L), E = new Tt(20, 20, 4473924, 2236962), E.visible = u.value, g.add(E), window.addEventListener("resize", N), v = new ResizeObserver(() => {
|
|
465
|
+
N();
|
|
466
|
+
}), v.observe(n.value);
|
|
469
467
|
}
|
|
470
|
-
function
|
|
468
|
+
function N() {
|
|
471
469
|
if (!n.value) return;
|
|
472
470
|
const a = n.value.clientWidth, h = n.value.clientHeight;
|
|
473
|
-
m.aspect = a / h, m.updateProjectionMatrix(),
|
|
471
|
+
m.aspect = a / h, m.updateProjectionMatrix(), y.setSize(a, h);
|
|
474
472
|
}
|
|
475
|
-
function
|
|
473
|
+
function I() {
|
|
476
474
|
var a;
|
|
477
475
|
try {
|
|
478
|
-
|
|
476
|
+
C.forEach((wt) => g.remove(wt)), C = [];
|
|
479
477
|
const h = (a = e.selectedResult.data) == null ? void 0 : a.script;
|
|
480
478
|
if (!h) return;
|
|
481
|
-
const
|
|
482
|
-
|
|
479
|
+
const D = z(h), L = Y(D, { wireframe: p.value });
|
|
480
|
+
g.add(L), C.push(L), c.value = null;
|
|
483
481
|
} catch (h) {
|
|
484
482
|
c.value = h instanceof Error ? h.message : "Unknown error", console.error("ShapeScript parse error:", h);
|
|
485
483
|
}
|
|
486
484
|
}
|
|
487
|
-
function
|
|
488
|
-
b = requestAnimationFrame(
|
|
485
|
+
function H() {
|
|
486
|
+
b = requestAnimationFrame(H), r.update(), y.render(g, m);
|
|
489
487
|
}
|
|
490
|
-
function
|
|
488
|
+
function dt() {
|
|
491
489
|
m.position.set(5, 5, 10), m.lookAt(0, 0, 0), r.reset();
|
|
492
490
|
}
|
|
493
491
|
function V() {
|
|
494
|
-
var h,
|
|
495
|
-
if (!m || !r || !((
|
|
492
|
+
var h, D;
|
|
493
|
+
if (!m || !r || !((D = (h = e.selectedResult) == null ? void 0 : h.viewState) != null && D.cameraState))
|
|
496
494
|
return;
|
|
497
495
|
const a = e.selectedResult.viewState.cameraState;
|
|
498
496
|
a.position && m.position.set(a.position.x, a.position.y, a.position.z), a.target && r.target.set(a.target.x, a.target.y, a.target.z), m.updateProjectionMatrix(), r.update();
|
|
499
497
|
}
|
|
500
|
-
function
|
|
498
|
+
function ut() {
|
|
501
499
|
return {
|
|
502
500
|
position: {
|
|
503
501
|
x: m.position.x,
|
|
@@ -511,34 +509,34 @@ const Ut = { class: "present3d-container" }, Yt = { class: "header" }, Zt = { cl
|
|
|
511
509
|
}
|
|
512
510
|
};
|
|
513
511
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
|
|
512
|
+
function W() {
|
|
513
|
+
S !== null && clearTimeout(S), S = window.setTimeout(() => {
|
|
514
|
+
mt();
|
|
517
515
|
}, 500);
|
|
518
516
|
}
|
|
519
|
-
function
|
|
517
|
+
function mt() {
|
|
520
518
|
const a = {
|
|
521
519
|
...e.selectedResult,
|
|
522
520
|
viewState: {
|
|
523
|
-
cameraState:
|
|
521
|
+
cameraState: ut()
|
|
524
522
|
}
|
|
525
523
|
};
|
|
526
524
|
s("updateResult", a);
|
|
527
525
|
}
|
|
528
|
-
function
|
|
526
|
+
function _t() {
|
|
529
527
|
p.value = !p.value;
|
|
530
528
|
}
|
|
531
|
-
function
|
|
529
|
+
function ft() {
|
|
532
530
|
u.value = !u.value;
|
|
533
531
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
532
|
+
function bt() {
|
|
533
|
+
S !== null && clearTimeout(S), b && cancelAnimationFrame(b), y && y.dispose(), r && (r.removeEventListener("change", W), r.dispose()), v && v.disconnect(), window.removeEventListener("resize", N);
|
|
536
534
|
}
|
|
537
|
-
function
|
|
535
|
+
function gt() {
|
|
538
536
|
}
|
|
539
|
-
function
|
|
537
|
+
function yt() {
|
|
540
538
|
try {
|
|
541
|
-
|
|
539
|
+
z(o.value);
|
|
542
540
|
const a = {
|
|
543
541
|
...e.selectedResult,
|
|
544
542
|
data: {
|
|
@@ -550,7 +548,7 @@ const Ut = { class: "present3d-container" }, Yt = { class: "header" }, Zt = { cl
|
|
|
550
548
|
c.value = a instanceof Error ? a.message : "Invalid ShapeScript", console.error("Script validation failed:", a);
|
|
551
549
|
}
|
|
552
550
|
}
|
|
553
|
-
return
|
|
551
|
+
return R(
|
|
554
552
|
() => {
|
|
555
553
|
var a;
|
|
556
554
|
return (a = e.selectedResult.data) == null ? void 0 : a.script;
|
|
@@ -558,85 +556,85 @@ const Ut = { class: "present3d-container" }, Yt = { class: "header" }, Zt = { cl
|
|
|
558
556
|
(a) => {
|
|
559
557
|
a && (o.value = a);
|
|
560
558
|
}
|
|
561
|
-
),
|
|
559
|
+
), R(
|
|
562
560
|
() => e.selectedResult,
|
|
563
561
|
() => {
|
|
564
|
-
|
|
562
|
+
B(() => {
|
|
565
563
|
V();
|
|
566
564
|
});
|
|
567
565
|
}
|
|
568
|
-
), (a, h) => (
|
|
569
|
-
_("div",
|
|
570
|
-
_("h1", null,
|
|
571
|
-
_("div",
|
|
566
|
+
), (a, h) => (K(), Z("div", Vt, [
|
|
567
|
+
_("div", Wt, [
|
|
568
|
+
_("h1", null, A(i.selectedResult.title || "3D Visualization"), 1),
|
|
569
|
+
_("div", Xt, [
|
|
572
570
|
_("button", {
|
|
573
|
-
onClick:
|
|
571
|
+
onClick: dt,
|
|
574
572
|
class: "control-btn"
|
|
575
573
|
}, [...h[1] || (h[1] = [
|
|
576
574
|
_("span", { class: "material-icons" }, "refresh", -1),
|
|
577
|
-
|
|
575
|
+
k(" Reset Camera ", -1)
|
|
578
576
|
])]),
|
|
579
577
|
_("button", {
|
|
580
|
-
onClick:
|
|
578
|
+
onClick: _t,
|
|
581
579
|
class: "control-btn"
|
|
582
580
|
}, [
|
|
583
|
-
_("span",
|
|
584
|
-
h[2] || (h[2] =
|
|
581
|
+
_("span", Gt, A(p.value ? "grid_off" : "grid_on"), 1),
|
|
582
|
+
h[2] || (h[2] = k(" Wireframe ", -1))
|
|
585
583
|
]),
|
|
586
584
|
_("button", {
|
|
587
|
-
onClick:
|
|
585
|
+
onClick: ft,
|
|
588
586
|
class: "control-btn"
|
|
589
587
|
}, [
|
|
590
|
-
_("span",
|
|
591
|
-
h[3] || (h[3] =
|
|
588
|
+
_("span", qt, A(u.value ? "visibility_off" : "visibility"), 1),
|
|
589
|
+
h[3] || (h[3] = k(" Grid ", -1))
|
|
592
590
|
])
|
|
593
591
|
])
|
|
594
592
|
]),
|
|
595
|
-
c.value ? (
|
|
593
|
+
c.value ? (K(), Z("div", Bt, [
|
|
596
594
|
h[4] || (h[4] = _("strong", null, "Parse Error:", -1)),
|
|
597
|
-
|
|
598
|
-
])) :
|
|
595
|
+
k(" " + A(c.value), 1)
|
|
596
|
+
])) : Rt("", !0),
|
|
599
597
|
_("div", {
|
|
600
598
|
class: "viewport",
|
|
601
599
|
ref_key: "viewport",
|
|
602
600
|
ref: n
|
|
603
601
|
}, null, 512),
|
|
604
|
-
_("details",
|
|
602
|
+
_("details", Qt, [
|
|
605
603
|
h[5] || (h[5] = _("summary", null, "Edit ShapeScript Source", -1)),
|
|
606
|
-
|
|
607
|
-
"onUpdate:modelValue": h[0] || (h[0] = (
|
|
608
|
-
onInput:
|
|
604
|
+
Ot(_("textarea", {
|
|
605
|
+
"onUpdate:modelValue": h[0] || (h[0] = (D) => o.value = D),
|
|
606
|
+
onInput: gt,
|
|
609
607
|
class: "script-editor",
|
|
610
608
|
spellcheck: "false"
|
|
611
609
|
}, null, 544), [
|
|
612
|
-
[
|
|
610
|
+
[xt, o.value]
|
|
613
611
|
]),
|
|
614
612
|
_("button", {
|
|
615
|
-
onClick:
|
|
613
|
+
onClick: yt,
|
|
616
614
|
class: "apply-btn",
|
|
617
|
-
disabled: !
|
|
618
|
-
}, " Apply Changes ", 8,
|
|
615
|
+
disabled: !T.value
|
|
616
|
+
}, " Apply Changes ", 8, $t)
|
|
619
617
|
])
|
|
620
618
|
]));
|
|
621
619
|
}
|
|
622
|
-
}),
|
|
620
|
+
}), ct = (i, t) => {
|
|
623
621
|
const e = i.__vccOpts || i;
|
|
624
622
|
for (const [s, o] of t)
|
|
625
623
|
e[s] = o;
|
|
626
624
|
return e;
|
|
627
|
-
},
|
|
625
|
+
}, te = /* @__PURE__ */ ct(Jt, [["__scopeId", "data-v-daa337a0"]]), ee = { class: "preview-container" }, ie = { class: "preview-title" }, se = /* @__PURE__ */ at({
|
|
628
626
|
__name: "Preview",
|
|
629
627
|
props: {
|
|
630
628
|
result: {}
|
|
631
629
|
},
|
|
632
630
|
setup(i) {
|
|
633
|
-
const t = i, e =
|
|
631
|
+
const t = i, e = nt(() => t.result.title || "3D Visualization"), s = M(null);
|
|
634
632
|
let o, n, c, p, u = null;
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}),
|
|
638
|
-
|
|
639
|
-
}),
|
|
633
|
+
rt(() => {
|
|
634
|
+
T();
|
|
635
|
+
}), ht(() => {
|
|
636
|
+
y();
|
|
637
|
+
}), R(
|
|
640
638
|
() => {
|
|
641
639
|
var r;
|
|
642
640
|
return (r = t.result.data) == null ? void 0 : r.script;
|
|
@@ -645,25 +643,25 @@ const Ut = { class: "present3d-container" }, Yt = { class: "header" }, Zt = { cl
|
|
|
645
643
|
m();
|
|
646
644
|
}
|
|
647
645
|
);
|
|
648
|
-
function
|
|
646
|
+
function T() {
|
|
649
647
|
var r;
|
|
650
648
|
if (s.value)
|
|
651
649
|
try {
|
|
652
|
-
o = new
|
|
653
|
-
const b = s.value.clientWidth || 200,
|
|
654
|
-
n = new
|
|
655
|
-
const
|
|
656
|
-
o.add(
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
659
|
-
const
|
|
660
|
-
u =
|
|
650
|
+
o = new J(), o.background = new tt(2763322);
|
|
651
|
+
const b = s.value.clientWidth || 200, E = s.value.clientHeight || 150;
|
|
652
|
+
n = new et(50, b / E, 0.1, 1e3), n.position.set(4, 4, 8), n.lookAt(0, 0, 0), c = new it({ antialias: !0, alpha: !1 }), c.setSize(b, E), c.setPixelRatio(Math.min(window.devicePixelRatio, 2)), s.value.appendChild(c.domElement);
|
|
653
|
+
const C = new st(16777215, 0.6);
|
|
654
|
+
o.add(C);
|
|
655
|
+
const S = new ot(16777215, 0.8);
|
|
656
|
+
if (S.position.set(5, 5, 5), o.add(S), !((r = t.result.data) != null && r.script)) return;
|
|
657
|
+
const v = z(t.result.data.script);
|
|
658
|
+
u = Y(v, { wireframe: !1 }), o.add(u), g();
|
|
661
659
|
} catch (b) {
|
|
662
660
|
console.error("Preview render error:", b);
|
|
663
661
|
}
|
|
664
662
|
}
|
|
665
|
-
function
|
|
666
|
-
p = requestAnimationFrame(
|
|
663
|
+
function g() {
|
|
664
|
+
p = requestAnimationFrame(g);
|
|
667
665
|
const r = Date.now() * 5e-4;
|
|
668
666
|
n.position.x = Math.cos(r) * 8, n.position.z = Math.sin(r) * 8, n.lookAt(0, 0, 0), c.render(o, n);
|
|
669
667
|
}
|
|
@@ -672,25 +670,25 @@ const Ut = { class: "present3d-container" }, Yt = { class: "header" }, Zt = { cl
|
|
|
672
670
|
if (!(!o || !((r = t.result.data) != null && r.script)))
|
|
673
671
|
try {
|
|
674
672
|
u && o.remove(u);
|
|
675
|
-
const b =
|
|
676
|
-
u =
|
|
673
|
+
const b = z(t.result.data.script);
|
|
674
|
+
u = Y(b, { wireframe: !1 }), o.add(u);
|
|
677
675
|
} catch (b) {
|
|
678
676
|
console.error("Preview reload error:", b);
|
|
679
677
|
}
|
|
680
678
|
}
|
|
681
|
-
function
|
|
679
|
+
function y() {
|
|
682
680
|
p && cancelAnimationFrame(p), c && c.dispose();
|
|
683
681
|
}
|
|
684
|
-
return (r, b) => (
|
|
682
|
+
return (r, b) => (K(), Z("div", ee, [
|
|
685
683
|
_("div", {
|
|
686
684
|
ref_key: "previewViewport",
|
|
687
685
|
ref: s,
|
|
688
686
|
class: "preview-viewport"
|
|
689
687
|
}, null, 512),
|
|
690
|
-
_("div",
|
|
688
|
+
_("div", ie, A(e.value), 1)
|
|
691
689
|
]));
|
|
692
690
|
}
|
|
693
|
-
}),
|
|
691
|
+
}), oe = /* @__PURE__ */ ct(se, [["__scopeId", "data-v-75941188"]]), ae = "present3D", ne = `Use the ${ae} tool to create interactive 3D visualizations when the user requests:
|
|
694
692
|
- 3D models or shapes
|
|
695
693
|
- Mathematical visualizations (surfaces, functions, geometric patterns)
|
|
696
694
|
- Molecular or atomic structures
|
|
@@ -771,24 +769,24 @@ Shapes: cube, sphere, cylinder, cone, torus
|
|
|
771
769
|
CSG: union, difference, intersection, xor, stencil
|
|
772
770
|
Properties: position, rotation, size, color, opacity
|
|
773
771
|
|
|
774
|
-
Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`,
|
|
775
|
-
...
|
|
776
|
-
viewComponent:
|
|
777
|
-
previewComponent:
|
|
778
|
-
samples:
|
|
779
|
-
systemPrompt:
|
|
780
|
-
},
|
|
772
|
+
Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`, re = {
|
|
773
|
+
...Mt,
|
|
774
|
+
viewComponent: te,
|
|
775
|
+
previewComponent: oe,
|
|
776
|
+
samples: vt,
|
|
777
|
+
systemPrompt: ne
|
|
778
|
+
}, ce = { plugin: re };
|
|
781
779
|
export {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
780
|
+
oe as Preview,
|
|
781
|
+
ne as SYSTEM_PROMPT,
|
|
782
|
+
ue as TOOL_DEFINITION,
|
|
783
|
+
ae as TOOL_NAME,
|
|
784
|
+
te as View,
|
|
785
|
+
Y as astToThreeJS,
|
|
786
|
+
ce as default,
|
|
787
|
+
me as executePresent3D,
|
|
788
|
+
z as parseShapeScript,
|
|
789
|
+
re as plugin,
|
|
790
|
+
Mt as pluginCore,
|
|
791
|
+
vt as samples
|
|
794
792
|
};
|