@gui-chat-plugin/present3d 0.0.1 → 0.0.3
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/samples.d.ts.map +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-B8W7aPbA.js +27687 -0
- package/dist/index-CIaq2DFf.cjs +4175 -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 +9 -0
- package/dist/vue/Preview.vue.d.ts.map +1 -0
- package/dist/vue/View.vue.d.ts +13 -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 +247 -229
- package/package.json +30 -16
- package/dist/present3d.css +0 -1
- package/dist/toThreeJS-EXFMlO7B.js +0 -2171
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CIaq2DFf.cjs");exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.astToThreeJS=e.astToThreeJS;exports.executePresent3D=e.executePresent3D;exports.parseShapeScript=e.parseShapeScript;exports.pluginCore=e.pluginCore;exports.present3D=e.present3D;exports.samples=e.samples;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./core/index";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { h as a, j as p, f as r, i as t, p as O, g as T, k as o, s as h } from "./index-B8W7aPbA.js";
|
|
2
|
+
export {
|
|
3
|
+
a as TOOL_DEFINITION,
|
|
4
|
+
p as TOOL_NAME,
|
|
5
|
+
r as astToThreeJS,
|
|
6
|
+
t as executePresent3D,
|
|
7
|
+
O as parseShapeScript,
|
|
8
|
+
T as pluginCore,
|
|
9
|
+
o as present3D,
|
|
10
|
+
h as samples
|
|
11
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-600:oklch(57.7% .245 27.325);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.m-0{margin:calc(var(--spacing)*0)}.mx-auto{margin-inline:auto}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline{display:inline}.h-\[600px\]{height:600px}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.whitespace-pre-wrap{white-space:pre-wrap}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-indigo-700{color:var(--color-indigo-700)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.present3d-container[data-v-daa337a0]{width:100%;height:100%;display:flex;flex-direction:column;background:#1a1a1a;color:#fff}.header[data-v-daa337a0]{padding:1rem;background:#2a2a2a;border-bottom:1px solid #444;display:flex;justify-content:space-between;align-items:center}.header h1[data-v-daa337a0]{margin:0;font-size:1.5rem;font-weight:600}.controls[data-v-daa337a0]{display:flex;gap:.5rem}.control-btn[data-v-daa337a0]{display:flex;align-items:center;gap:.25rem;padding:.5rem 1rem;background:#3a3a3a;color:#fff;border:1px solid #555;border-radius:4px;cursor:pointer;font-size:.9rem;transition:background .2s}.control-btn[data-v-daa337a0]:hover{background:#4a4a4a}.control-btn .material-icons[data-v-daa337a0]{font-size:1.2rem}.viewport[data-v-daa337a0]{flex:1;min-height:0;position:relative}.error[data-v-daa337a0]{padding:1rem;background:#ff000020;color:#f66;font-family:monospace;border-bottom:1px solid #ff000040}.script-source[data-v-daa337a0]{padding:.5rem;background:#00000040;border-top:1px solid #444;font-family:monospace;font-size:.85rem}.script-source summary[data-v-daa337a0]{cursor:pointer;-webkit-user-select:none;user-select:none;padding:.5rem;background:#2a2a2a;border-radius:4px}.script-source[open] summary[data-v-daa337a0]{margin-bottom:.5rem}.script-source summary[data-v-daa337a0]:hover{background:#3a3a3a}.script-editor[data-v-daa337a0]{width:100%;min-height:150px;padding:1rem;background:#1a1a1a;border:1px solid #444;border-radius:4px;color:#aaa;font-family:Courier New,monospace;font-size:.9rem;resize:vertical;margin-bottom:.5rem}.script-editor[data-v-daa337a0]:focus{outline:none;border-color:#666;background:#222}.apply-btn[data-v-daa337a0]{padding:.5rem 1rem;background:#4caf50;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:.9rem;transition:background .2s}.apply-btn[data-v-daa337a0]:hover{background:#45a049}.apply-btn[data-v-daa337a0]:active{background:#3d8b40}.apply-btn[data-v-daa337a0]:disabled{background:#ccc;color:#666;cursor:not-allowed;opacity:.6}.apply-btn[data-v-daa337a0]:disabled:hover{background:#ccc}.preview-container[data-v-75941188]{position:relative;width:100%;height:100%;min-height:150px;background:linear-gradient(135deg,#667eea,#764ba2);border-radius:8px;overflow:hidden}.preview-viewport[data-v-75941188]{width:100%;height:100%}.preview-title[data-v-75941188]{position:absolute;bottom:0;left:0;right:0;padding:.5rem;background:#000000b3;color:#fff;font-size:.75rem;font-weight:500;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolResult } from "gui-chat-protocol";
|
|
2
|
+
import type { Present3DToolData } from "../core/types";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
result: ToolResult<Present3DToolData>;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=Preview.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Preview.vue.d.ts","sourceRoot":"","sources":["../../src/vue/Preview.vue"],"names":[],"mappings":"AAyKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;CACvC,CAAC;AA0JF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolResult } from "gui-chat-protocol";
|
|
2
|
+
import type { Present3DToolData } from "../core/types";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
selectedResult: ToolResult<Present3DToolData>;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
updateResult: (result: ToolResult<Present3DToolData, unknown>) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onUpdateResult?: ((result: ToolResult<Present3DToolData, unknown>) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=View.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"View.vue.d.ts","sourceRoot":"","sources":["../../src/vue/View.vue"],"names":[],"mappings":"AA6fA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AASvD,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;CAC/C,CAAC;AAwbF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import "../style.css";
|
|
2
|
+
import type { ToolPlugin } from "gui-chat-protocol/vue";
|
|
3
|
+
import type { Present3DToolData, Present3DArgs } from "../core/types";
|
|
4
|
+
import View from "./View.vue";
|
|
5
|
+
import Preview from "./Preview.vue";
|
|
5
6
|
export declare const TOOL_NAME = "present3D";
|
|
6
7
|
export declare const SYSTEM_PROMPT = "Use the present3D tool to create interactive 3D visualizations when the user requests:\n- 3D models or shapes\n- Mathematical visualizations (surfaces, functions, geometric patterns)\n- Molecular or atomic structures\n- Data visualization in 3D (scatter plots, surface plots)\n- Architectural layouts\n- Game boards or 3D game states\n- Any spatial or geometric concepts\n\n## ShapeScript Language Features (FULL SUPPORT):\n\n### Variables & Expressions:\n- Define variables: define radius 2, define spacing 1.5\n- Use expressions: position (i * 2) 0 0, size (radius * 1.5)\n- Math operators: +, -, *, /, % with proper precedence\n- Parentheses for grouping: (2 + 3) * 4\n\n### Control Flow:\n\nFor loops with variables (use loop variable in calculations):\nfor i in 1 to 5 {\n cube { position (i * 2 - 6) 0 0 size 1 }\n}\n\nFor loops with step:\nfor i in 0 to 10 step 2 {\n sphere { position 0 i 0 }\n}\n\nIf/else conditionals:\nif x > 0 {\n sphere\n} else {\n cube\n}\n\nSwitch statements for multiple cases\n\n### Built-in Functions:\n- Math: round, floor, ceil, abs, sign, sqrt, pow, min, max\n- Trig: sin, cos, tan, asin, acos, atan, atan2 (radians!)\n- Vector: dot, cross, length, normalize, sum\n\nCRITICAL: Function calls require NO space between name and (\n- sin(x) \u2713 correct\n- sin (x) \u2717 wrong - this is NOT a function call!\n\n### Best Practices:\n1. Use variables for repeated values\n2. Use loop variables (i) for positioning and calculations\n3. Use trig functions for circular/spiral patterns\n4. Use conditionals for parametric designs\n5. Keep code readable with meaningful variable names\n\n### Common Patterns:\n\nLinear arrangement:\nfor i in 1 to 5 {\n cube { position (i * 2) 0 0 }\n}\n\nCircular pattern:\ndefine count 12\nfor i in 1 to count {\n define angle ((i / count) * 6.283)\n cube { position (cos(angle) * 3) 0 (sin(angle) * 3) }\n}\n\nParametric surface:\nfor x in -5 to 5 {\n for z in -5 to 5 {\n define y (sin(x * 0.5) * cos(z * 0.5))\n cube { position (x * 0.3) y (z * 0.3) size 0.2 }\n }\n}\n\n### Primitives & CSG:\nShapes: cube, sphere, cylinder, cone, torus\nCSG: union, difference, intersection, xor, stencil\nProperties: position, rotation, size, color, opacity\n\nKeep visualizations clear, well-organized, and leverage the full power of expressions and control flow.";
|
|
7
8
|
export declare const plugin: ToolPlugin<Present3DToolData, unknown, Present3DArgs>;
|
|
8
|
-
export type { Present3DToolData, Present3DArgs, Present3DResult } from
|
|
9
|
-
export { TOOL_DEFINITION, executePresent3D, pluginCore, } from
|
|
10
|
-
export { samples } from
|
|
9
|
+
export type { Present3DToolData, Present3DArgs, Present3DResult } from "../core/types";
|
|
10
|
+
export { TOOL_DEFINITION, executePresent3D, pluginCore, } from "../core/plugin";
|
|
11
|
+
export { samples } from "../core/samples";
|
|
11
12
|
export { View, Preview };
|
|
12
|
-
export { parseShapeScript } from
|
|
13
|
-
export { astToThreeJS } from
|
|
14
|
-
export type { SceneNode } from
|
|
13
|
+
export { parseShapeScript } from "../shapescript/parser";
|
|
14
|
+
export { astToThreeJS } from "../shapescript/toThreeJS";
|
|
15
|
+
export type { SceneNode } from "../shapescript/types";
|
|
15
16
|
declare const _default: {
|
|
16
|
-
plugin: ToolPlugin<Present3DToolData, unknown, Present3DArgs, import(
|
|
17
|
+
plugin: ToolPlugin<Present3DToolData, unknown, Present3DArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
|
|
17
18
|
};
|
|
18
19
|
export default _default;
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./index-CIaq2DFf.cjs"),o=require("vue"),j={type:"change"},L={type:"start"},V={type:"end"},O=new i.Ray,z=new i.Plane,tt=Math.cos(70*i.MathUtils.DEG2RAD),m=new i.Vector3,g=2*Math.PI,c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},x=1e-6;class et extends i.Controls{constructor(t,e=null){super(t,e),this.state=c.NONE,this.target=new i.Vector3,this.cursor=new i.Vector3,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=.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:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new i.Vector3,this._lastQuaternion=new i.Quaternion,this._lastTargetPosition=new i.Vector3,this._quat=new i.Quaternion().setFromUnitVectors(t.up,new i.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new i.Spherical,this._sphericalDelta=new i.Spherical,this._scale=1,this._panOffset=new i.Vector3,this._rotateStart=new i.Vector2,this._rotateEnd=new i.Vector2,this._rotateDelta=new i.Vector2,this._panStart=new i.Vector2,this._panEnd=new i.Vector2,this._panDelta=new i.Vector2,this._dollyStart=new i.Vector2,this._dollyEnd=new i.Vector2,this._dollyDelta=new i.Vector2,this._dollyDirection=new i.Vector3,this._mouse=new i.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=st.bind(this),this._onPointerDown=it.bind(this),this._onPointerUp=ot.bind(this),this._onContextMenu=pt.bind(this),this._onMouseWheel=rt.bind(this),this._onKeyDown=lt.bind(this),this._onTouchStart=ht.bind(this),this._onTouchMove=ct.bind(this),this._onMouseDown=nt.bind(this),this._onMouseMove=at.bind(this),this._interceptControlDown=dt.bind(this),this._interceptControlUp=ut.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),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"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(j),this.update(),this.state=c.NONE}update(t=null){const e=this.object.position;m.copy(e).sub(this.target),m.applyQuaternion(this._quat),this._spherical.setFromVector3(m),this.autoRotate&&this.state===c.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,a=this.maxAzimuthAngle;isFinite(n)&&isFinite(a)&&(n<-Math.PI?n+=g:n>Math.PI&&(n-=g),a<-Math.PI?a+=g:a>Math.PI&&(a-=g),n<=a?this._spherical.theta=Math.max(n,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+a)/2?Math.max(n,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let l=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const p=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),l=p!=this._spherical.radius}if(m.setFromSpherical(this._spherical),m.applyQuaternion(this._quatInverse),e.copy(this.target).add(m),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let p=null;if(this.object.isPerspectiveCamera){const u=m.length();p=this._clampDistance(u*this._scale);const _=u-p;this.object.position.addScaledVector(this._dollyDirection,_),this.object.updateMatrixWorld(),l=!!_}else if(this.object.isOrthographicCamera){const u=new i.Vector3(this._mouse.x,this._mouse.y,0);u.unproject(this.object);const _=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),l=_!==this.object.zoom;const S=new i.Vector3(this._mouse.x,this._mouse.y,0);S.unproject(this.object),this.object.position.sub(S).add(u),this.object.updateMatrixWorld(),p=m.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;p!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(p).add(this.object.position):(O.origin.copy(this.object.position),O.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(O.direction))<tt?this.object.lookAt(this.target):(z.setFromNormalAndCoplanarPoint(this.object.up,this.target),O.intersectPlane(z,this.target))))}else if(this.object.isOrthographicCamera){const p=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),p!==this.object.zoom&&(this.object.updateProjectionMatrix(),l=!0)}return this._scale=1,this._performCursorZoom=!1,l||this._lastPosition.distanceToSquared(this.object.position)>x||8*(1-this._lastQuaternion.dot(this.object.quaternion))>x||this._lastTargetPosition.distanceToSquared(this.target)>x?(this.dispatchEvent(j),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?g/60*this.autoRotateSpeed*t:g/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){m.setFromMatrixColumn(e,0),m.multiplyScalar(-t),this._panOffset.add(m)}_panUp(t,e){this.screenSpacePanning===!0?m.setFromMatrixColumn(e,1):(m.setFromMatrixColumn(e,0),m.crossVectors(this.object.up,m)),m.multiplyScalar(t),this._panOffset.add(m)}_pan(t,e){const n=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;m.copy(a).sub(this.target);let l=m.length();l*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*l/n.clientHeight,this.object.matrix),this._panUp(2*e*l/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),a=t-n.left,l=e-n.top,p=n.width,u=n.height;this._mouse.x=a/p*2-1,this._mouse.y=-(l/u)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(g*this._rotateDelta.x/e.clientHeight),this._rotateUp(g*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(g*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-g*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(g*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-g*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._rotateStart.set(n,a)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panStart.set(n,a)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,a=t.pageY-e.y,l=Math.sqrt(n*n+a*a);this._dollyStart.set(0,l)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),a=.5*(t.pageX+n.x),l=.5*(t.pageY+n.y);this._rotateEnd.set(a,l)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(g*this._rotateDelta.x/e.clientHeight),this._rotateUp(g*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panEnd.set(n,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,a=t.pageY-e.y,l=Math.sqrt(n*n+a*a);this._dollyEnd.set(0,l),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const p=(t.pageX+e.x)*.5,u=(t.pageY+e.y)*.5;this._updateZoomParameters(p,u)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new i.Vector2,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function it(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s)))}function st(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function ot(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(V),this.state=c.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function nt(s){let t;switch(s.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=c.DOLLY;break;case i.MOUSE.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=c.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=c.ROTATE}break;case i.MOUSE.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=c.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=c.PAN}break;default:this.state=c.NONE}this.state!==c.NONE&&this.dispatchEvent(L)}function at(s){switch(this.state){case c.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case c.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case c.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function rt(s){this.enabled===!1||this.enableZoom===!1||this.state!==c.NONE||(s.preventDefault(),this.dispatchEvent(L),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(V))}function lt(s){this.enabled!==!1&&this._handleKeyDown(s)}function ht(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case i.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=c.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=c.TOUCH_PAN;break;default:this.state=c.NONE}break;case 2:switch(this.touches.TWO){case i.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=c.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=c.TOUCH_DOLLY_ROTATE;break;default:this.state=c.NONE}break;default:this.state=c.NONE}this.state!==c.NONE&&this.dispatchEvent(L)}function ct(s){switch(this._trackPointer(s),this.state){case c.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case c.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case c.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case c.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=c.NONE}}function pt(s){this.enabled!==!1&&s.preventDefault()}function dt(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function ut(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const mt={class:"present3d-container"},_t={class:"header"},ft={class:"controls"},gt={class:"material-icons"},bt={class:"material-icons"},yt={key:0,class:"error"},Et={class:"script-source"},wt=["disabled"],Pt=o.defineComponent({__name:"View",props:{selectedResult:{}},emits:["updateResult"],setup(s,{emit:t}){const e=s,n=t,a=o.ref(e.selectedResult.data?.script??""),l=o.ref(null),p=o.ref(null),u=o.ref(!1),_=o.ref(!0),S=o.computed(()=>a.value!==e.selectedResult.data?.script);let b,f,y,h,E,w,T=[],P=null,v=null;o.onMounted(()=>{F(),C(),k(),o.nextTick(()=>{A()})}),o.onUnmounted(()=>{Q()}),o.watch(()=>e.selectedResult.data?.script,()=>{C()}),o.watch(u,()=>{C()}),o.watch(_,r=>{w&&(w.visible=r)});function F(){if(!l.value)return;b=new i.Scene,b.background=new i.Color(1710618);const r=l.value.clientWidth,d=l.value.clientHeight;f=new i.PerspectiveCamera(50,r/d,.1,1e3),f.position.set(5,5,10),f.lookAt(0,0,0),y=new i.WebGLRenderer({antialias:!0}),y.setSize(r,d),y.setPixelRatio(window.devicePixelRatio),l.value.appendChild(y.domElement),h=new et(f,y.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.addEventListener("change",N);const D=new i.AmbientLight(16777215,.6);b.add(D);const M=new i.DirectionalLight(16777215,.8);M.position.set(10,10,10),b.add(M),w=new i.GridHelper(20,20,4473924,2236962),w.visible=_.value,b.add(w),window.addEventListener("resize",R),v=new ResizeObserver(()=>{R()}),v.observe(l.value)}function R(){if(!l.value)return;const r=l.value.clientWidth,d=l.value.clientHeight;f.aspect=r/d,f.updateProjectionMatrix(),y.setSize(r,d)}function C(){try{T.forEach(M=>b.remove(M)),T=[];const r=e.selectedResult.data?.script;if(!r)return;const d=i.parseShapeScript(r),D=i.astToThreeJS(d,{wireframe:u.value});b.add(D),T.push(D),p.value=null}catch(r){p.value=r instanceof Error?r.message:"Unknown error",console.error("ShapeScript parse error:",r)}}function k(){E=requestAnimationFrame(k),h.update(),y.render(b,f)}function W(){f.position.set(5,5,10),f.lookAt(0,0,0),h.reset()}function A(){if(!f||!h||!e.selectedResult?.viewState?.cameraState)return;const r=e.selectedResult.viewState.cameraState;r.position&&f.position.set(r.position.x,r.position.y,r.position.z),r.target&&h.target.set(r.target.x,r.target.y,r.target.z),f.updateProjectionMatrix(),h.update()}function X(){return{position:{x:f.position.x,y:f.position.y,z:f.position.z},target:{x:h.target.x,y:h.target.y,z:h.target.z}}}function N(){P!==null&&clearTimeout(P),P=window.setTimeout(()=>{G()},500)}function G(){const r={...e.selectedResult,viewState:{cameraState:X()}};n("updateResult",r)}function q(){u.value=!u.value}function B(){_.value=!_.value}function Q(){P!==null&&clearTimeout(P),E&&cancelAnimationFrame(E),y&&y.dispose(),h&&(h.removeEventListener("change",N),h.dispose()),v&&v.disconnect(),window.removeEventListener("resize",R)}function J(){}function $(){try{i.parseShapeScript(a.value);const r={...e.selectedResult,data:{script:a.value}};n("updateResult",r)}catch(r){p.value=r instanceof Error?r.message:"Invalid ShapeScript",console.error("Script validation failed:",r)}}return o.watch(()=>e.selectedResult.data?.script,r=>{r&&(a.value=r)}),o.watch(()=>e.selectedResult,()=>{o.nextTick(()=>{A()})}),(r,d)=>(o.openBlock(),o.createElementBlock("div",mt,[o.createElementVNode("div",_t,[o.createElementVNode("h1",null,o.toDisplayString(s.selectedResult.title||"3D Visualization"),1),o.createElementVNode("div",ft,[o.createElementVNode("button",{onClick:W,class:"control-btn"},[...d[1]||(d[1]=[o.createElementVNode("span",{class:"material-icons"},"refresh",-1),o.createTextVNode(" Reset Camera ",-1)])]),o.createElementVNode("button",{onClick:q,class:"control-btn"},[o.createElementVNode("span",gt,o.toDisplayString(u.value?"grid_off":"grid_on"),1),d[2]||(d[2]=o.createTextVNode(" Wireframe ",-1))]),o.createElementVNode("button",{onClick:B,class:"control-btn"},[o.createElementVNode("span",bt,o.toDisplayString(_.value?"visibility_off":"visibility"),1),d[3]||(d[3]=o.createTextVNode(" Grid ",-1))])])]),p.value?(o.openBlock(),o.createElementBlock("div",yt,[d[4]||(d[4]=o.createElementVNode("strong",null,"Parse Error:",-1)),o.createTextVNode(" "+o.toDisplayString(p.value),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"viewport",ref_key:"viewport",ref:l},null,512),o.createElementVNode("details",Et,[d[5]||(d[5]=o.createElementVNode("summary",null,"Edit ShapeScript Source",-1)),o.withDirectives(o.createElementVNode("textarea",{"onUpdate:modelValue":d[0]||(d[0]=D=>a.value=D),onInput:J,class:"script-editor",spellcheck:"false"},null,544),[[o.vModelText,a.value]]),o.createElementVNode("button",{onClick:$,class:"apply-btn",disabled:!S.value}," Apply Changes ",8,wt)])]))}}),U=(s,t)=>{const e=s.__vccOpts||s;for(const[n,a]of t)e[n]=a;return e},I=U(Pt,[["__scopeId","data-v-daa337a0"]]),St={class:"preview-container"},Tt={class:"preview-title"},Dt=o.defineComponent({__name:"Preview",props:{result:{}},setup(s){const t=s,e=o.computed(()=>t.result.title||"3D Visualization"),n=o.ref(null);let a,l,p,u,_=null;o.onMounted(()=>{S()}),o.onUnmounted(()=>{y()}),o.watch(()=>t.result.data?.script,()=>{f()});function S(){if(n.value)try{a=new i.Scene,a.background=new i.Color(2763322);const h=n.value.clientWidth||200,E=n.value.clientHeight||150;l=new i.PerspectiveCamera(50,h/E,.1,1e3),l.position.set(4,4,8),l.lookAt(0,0,0),p=new i.WebGLRenderer({antialias:!0,alpha:!1}),p.setSize(h,E),p.setPixelRatio(Math.min(window.devicePixelRatio,2)),n.value.appendChild(p.domElement);const w=new i.AmbientLight(16777215,.6);a.add(w);const T=new i.DirectionalLight(16777215,.8);if(T.position.set(5,5,5),a.add(T),!t.result.data?.script)return;const P=i.parseShapeScript(t.result.data.script);_=i.astToThreeJS(P,{wireframe:!1}),a.add(_),b()}catch(h){console.error("Preview render error:",h)}}function b(){u=requestAnimationFrame(b);const h=Date.now()*5e-4;l.position.x=Math.cos(h)*8,l.position.z=Math.sin(h)*8,l.lookAt(0,0,0),p.render(a,l)}function f(){if(!(!a||!t.result.data?.script))try{_&&a.remove(_);const h=i.parseShapeScript(t.result.data.script);_=i.astToThreeJS(h,{wireframe:!1}),a.add(_)}catch(h){console.error("Preview reload error:",h)}}function y(){u&&cancelAnimationFrame(u),p&&p.dispose()}return(h,E)=>(o.openBlock(),o.createElementBlock("div",St,[o.createElementVNode("div",{ref_key:"previewViewport",ref:n,class:"preview-viewport"},null,512),o.createElementVNode("div",Tt,o.toDisplayString(e.value),1)]))}}),Y=U(Dt,[["__scopeId","data-v-75941188"]]),H="present3D",Z=`Use the ${H} tool to create interactive 3D visualizations when the user requests:
|
|
2
|
+
- 3D models or shapes
|
|
3
|
+
- Mathematical visualizations (surfaces, functions, geometric patterns)
|
|
4
|
+
- Molecular or atomic structures
|
|
5
|
+
- Data visualization in 3D (scatter plots, surface plots)
|
|
6
|
+
- Architectural layouts
|
|
7
|
+
- Game boards or 3D game states
|
|
8
|
+
- Any spatial or geometric concepts
|
|
9
|
+
|
|
10
|
+
## ShapeScript Language Features (FULL SUPPORT):
|
|
11
|
+
|
|
12
|
+
### Variables & Expressions:
|
|
13
|
+
- Define variables: define radius 2, define spacing 1.5
|
|
14
|
+
- Use expressions: position (i * 2) 0 0, size (radius * 1.5)
|
|
15
|
+
- Math operators: +, -, *, /, % with proper precedence
|
|
16
|
+
- Parentheses for grouping: (2 + 3) * 4
|
|
17
|
+
|
|
18
|
+
### Control Flow:
|
|
19
|
+
|
|
20
|
+
For loops with variables (use loop variable in calculations):
|
|
21
|
+
for i in 1 to 5 {
|
|
22
|
+
cube { position (i * 2 - 6) 0 0 size 1 }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
For loops with step:
|
|
26
|
+
for i in 0 to 10 step 2 {
|
|
27
|
+
sphere { position 0 i 0 }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
If/else conditionals:
|
|
31
|
+
if x > 0 {
|
|
32
|
+
sphere
|
|
33
|
+
} else {
|
|
34
|
+
cube
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Switch statements for multiple cases
|
|
38
|
+
|
|
39
|
+
### Built-in Functions:
|
|
40
|
+
- Math: round, floor, ceil, abs, sign, sqrt, pow, min, max
|
|
41
|
+
- Trig: sin, cos, tan, asin, acos, atan, atan2 (radians!)
|
|
42
|
+
- Vector: dot, cross, length, normalize, sum
|
|
43
|
+
|
|
44
|
+
CRITICAL: Function calls require NO space between name and (
|
|
45
|
+
- sin(x) ✓ correct
|
|
46
|
+
- sin (x) ✗ wrong - this is NOT a function call!
|
|
47
|
+
|
|
48
|
+
### Best Practices:
|
|
49
|
+
1. Use variables for repeated values
|
|
50
|
+
2. Use loop variables (i) for positioning and calculations
|
|
51
|
+
3. Use trig functions for circular/spiral patterns
|
|
52
|
+
4. Use conditionals for parametric designs
|
|
53
|
+
5. Keep code readable with meaningful variable names
|
|
54
|
+
|
|
55
|
+
### Common Patterns:
|
|
56
|
+
|
|
57
|
+
Linear arrangement:
|
|
58
|
+
for i in 1 to 5 {
|
|
59
|
+
cube { position (i * 2) 0 0 }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Circular pattern:
|
|
63
|
+
define count 12
|
|
64
|
+
for i in 1 to count {
|
|
65
|
+
define angle ((i / count) * 6.283)
|
|
66
|
+
cube { position (cos(angle) * 3) 0 (sin(angle) * 3) }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Parametric surface:
|
|
70
|
+
for x in -5 to 5 {
|
|
71
|
+
for z in -5 to 5 {
|
|
72
|
+
define y (sin(x * 0.5) * cos(z * 0.5))
|
|
73
|
+
cube { position (x * 0.3) y (z * 0.3) size 0.2 }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
### Primitives & CSG:
|
|
78
|
+
Shapes: cube, sphere, cylinder, cone, torus
|
|
79
|
+
CSG: union, difference, intersection, xor, stencil
|
|
80
|
+
Properties: position, rotation, size, color, opacity
|
|
81
|
+
|
|
82
|
+
Keep visualizations clear, well-organized, and leverage the full power of expressions and control flow.`,K={...i.pluginCore,viewComponent:I,previewComponent:Y,samples:i.samples,systemPrompt:Z},vt={plugin:K};exports.TOOL_DEFINITION=i.TOOL_DEFINITION;exports.astToThreeJS=i.astToThreeJS;exports.executePresent3D=i.executePresent3D;exports.parseShapeScript=i.parseShapeScript;exports.pluginCore=i.pluginCore;exports.samples=i.samples;exports.Preview=Y;exports.SYSTEM_PROMPT=Z;exports.TOOL_NAME=H;exports.View=I;exports.default=vt;exports.plugin=K;
|