@gui-chat-plugin/present3d 0.0.1

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/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # @gui-chat-plugin/present3d
2
+
3
+ [![npm version](https://badge.fury.io/js/%40gui-chat-plugin%2Fpresent3d.svg)](https://www.npmjs.com/package/@gui-chat-plugin/present3d)
4
+
5
+ 3D shape presentation plugin using ShapeScript for GUI Chat applications. Create interactive 3D visualizations with a powerful DSL.
6
+
7
+ ![Screenshot](https://raw.githubusercontent.com/receptron/GUIChatPluginPresent3D/main/images/screen.png)
8
+
9
+ ## Features
10
+
11
+ - Full ShapeScript language support (variables, expressions, control flow)
12
+ - Interactive 3D viewport with camera controls
13
+ - Wireframe and grid toggle
14
+ - CSG operations (union, difference, intersection)
15
+ - Built-in math and trigonometric functions
16
+ - Inline script editing
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ yarn add @gui-chat-plugin/present3d
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ### Vue Integration
27
+
28
+ ```typescript
29
+ // In src/tools/index.ts
30
+ import Present3DPlugin from "@gui-chat-plugin/present3d/vue";
31
+
32
+ const pluginList = [
33
+ // ... other plugins
34
+ Present3DPlugin,
35
+ ];
36
+
37
+ // In src/main.ts
38
+ import "@gui-chat-plugin/present3d/style.css";
39
+ ```
40
+
41
+ ### Core-only Usage
42
+
43
+ ```typescript
44
+ import { executePresent3D, TOOL_DEFINITION } from "@gui-chat-plugin/present3d";
45
+
46
+ // Create a 3D visualization
47
+ const result = await executePresent3D(context, {
48
+ title: "Circular Pattern",
49
+ script: `
50
+ define count 12
51
+ for i in 1 to count {
52
+ define angle ((i / count) * 6.283)
53
+ cube {
54
+ position (cos(angle) * 3) 0 (sin(angle) * 3)
55
+ color (i / count) 0.5 (1 - i / count)
56
+ size 0.5
57
+ }
58
+ }
59
+ `,
60
+ });
61
+ ```
62
+
63
+ ## API
64
+
65
+ ### Present3DArgs
66
+
67
+ ```typescript
68
+ interface Present3DArgs {
69
+ title: string; // Title for the visualization
70
+ script: string; // ShapeScript code
71
+ }
72
+ ```
73
+
74
+ ### Present3DToolData
75
+
76
+ ```typescript
77
+ interface Present3DToolData {
78
+ script: string; // The ShapeScript source code
79
+ }
80
+ ```
81
+
82
+ ## ShapeScript Language
83
+
84
+ ### Primitives
85
+ - `cube`, `sphere`, `cylinder`, `cone`, `torus`
86
+
87
+ ### Properties
88
+ - `position X Y Z` - 3D position
89
+ - `rotation X Y Z` - Rotation in half-turns
90
+ - `size X Y Z` - Scale
91
+ - `color R G B` - RGB color (0-1)
92
+ - `opacity` - Transparency (0-1)
93
+
94
+ ### Variables & Expressions
95
+ ```shapescript
96
+ define radius 2
97
+ define red (1 0 0)
98
+ sphere { size radius color red }
99
+ ```
100
+
101
+ ### Control Flow
102
+ ```shapescript
103
+ for i in 1 to 5 {
104
+ cube { position (i * 2) 0 0 }
105
+ }
106
+
107
+ if condition {
108
+ sphere
109
+ } else {
110
+ cube
111
+ }
112
+ ```
113
+
114
+ ### CSG Operations
115
+ ```shapescript
116
+ difference {
117
+ sphere { size 2 }
118
+ cube { size 1.5 }
119
+ }
120
+ ```
121
+
122
+ ### Built-in Functions
123
+ - Math: `round`, `floor`, `ceil`, `abs`, `sqrt`, `pow`, `min`, `max`
124
+ - Trig: `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`
125
+
126
+ ## Development
127
+
128
+ ```bash
129
+ # Install dependencies
130
+ yarn install
131
+
132
+ # Run demo
133
+ yarn dev
134
+
135
+ # Build
136
+ yarn build
137
+
138
+ # Lint
139
+ yarn lint
140
+ ```
141
+
142
+ ## Test Prompts
143
+
144
+ Try these prompts to test the plugin:
145
+
146
+ 1. "Create a 3D visualization of a simple house with a roof"
147
+ 2. "Show me a 3D spiral staircase"
148
+ 3. "Generate a 3D model of the solar system with planets orbiting the sun"
149
+
150
+ ## License
151
+
152
+ MIT
@@ -0,0 +1,21 @@
1
+ export declare const TOOL_NAME = "present3D";
2
+ export declare const TOOL_DEFINITION: {
3
+ type: "function";
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: "object";
8
+ properties: {
9
+ title: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ script: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ };
18
+ required: string[];
19
+ };
20
+ };
21
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/core/definition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CA6I3B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type { Present3DToolData, Present3DArgs, Present3DResult } from './types';
2
+ export { TOOL_NAME, TOOL_DEFINITION } from './definition';
3
+ export { pluginCore, present3D, executePresent3D } from './plugin';
4
+ export { samples } from './samples';
5
+ export { parseShapeScript } from '../shapescript/parser';
6
+ export { astToThreeJS } from '../shapescript/toThreeJS';
7
+ export type { SceneNode } from '../shapescript/types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ToolContext, ToolPluginCore } from 'gui-chat-protocol';
2
+ import { Present3DArgs, Present3DToolData, Present3DResult } from './types';
3
+ import { TOOL_NAME, TOOL_DEFINITION } from './definition';
4
+ export declare const present3D: (_context: ToolContext, args: Present3DArgs) => Promise<Present3DResult>;
5
+ export declare const pluginCore: ToolPluginCore<Present3DToolData, unknown, Present3DArgs>;
6
+ export { TOOL_NAME, TOOL_DEFINITION };
7
+ export declare const executePresent3D: (_context: ToolContext, args: Present3DArgs) => Promise<Present3DResult>;
8
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/core/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1D,eAAO,MAAM,SAAS,GACpB,UAAU,WAAW,EACrB,MAAM,aAAa,KAClB,OAAO,CAAC,eAAe,CAezB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,iBAAiB,EAAE,OAAO,EAAE,aAAa,CAOhF,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AACtC,eAAO,MAAM,gBAAgB,aA7BjB,WAAW,QACf,aAAa,KAClB,OAAO,CAAC,eAAe,CA2Be,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ToolSample } from 'gui-chat-protocol';
2
+ export declare const samples: ToolSample[];
3
+ //# sourceMappingURL=samples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/core/samples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,OAAO,EAAE,UAAU,EAuC/B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ToolResult } from 'gui-chat-protocol';
2
+ export interface Present3DToolData {
3
+ script: string;
4
+ }
5
+ export interface Present3DArgs {
6
+ title: string;
7
+ script: string;
8
+ }
9
+ export type Present3DResult = ToolResult<Present3DToolData>;
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC"}
package/dist/core.js ADDED
@@ -0,0 +1,11 @@
1
+ import { a, T as p, d as r, e as t, c as T, p as O, b as o, s as c } from "./toThreeJS-EXFMlO7B.js";
2
+ export {
3
+ a as TOOL_DEFINITION,
4
+ p as TOOL_NAME,
5
+ r as astToThreeJS,
6
+ t as executePresent3D,
7
+ T as parseShapeScript,
8
+ O as pluginCore,
9
+ o as present3D,
10
+ c as samples
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './core/index';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@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-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;--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%;-moz-tab-size:4;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]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance: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}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.resize{resize:both}.border{border-style:var(--tw-border-style);border-width:1px}.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))}}@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-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,22 @@
1
+ import { Expression, Vector3, Color } from './types';
2
+ export type Value = number | boolean | string | Value[];
3
+ export declare class SymbolTable {
4
+ private scopes;
5
+ constructor();
6
+ pushScope(): void;
7
+ popScope(): void;
8
+ set(name: string, value: Value): void;
9
+ get(name: string): Value | undefined;
10
+ has(name: string): boolean;
11
+ }
12
+ export declare class Evaluator {
13
+ private symbols;
14
+ constructor(symbols?: SymbolTable);
15
+ getSymbols(): SymbolTable;
16
+ evaluate(expr: Expression | number | string | Vector3 | Color): Value;
17
+ evaluateToNumber(expr: Expression | number): number;
18
+ evaluateToBoolean(expr: Expression): boolean;
19
+ evaluateToVector3(expr: Expression | Vector3): Vector3;
20
+ evaluateToColor(expr: Expression | Color): Color;
21
+ }
22
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../src/shapescript/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AAExD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAA4B;;IAM1C,SAAS,IAAI,IAAI;IAIjB,QAAQ,IAAI,IAAI;IAMhB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAIrC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAUpC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B;AAkHD,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAc;gBAEjB,OAAO,CAAC,EAAE,WAAW;IAIjC,UAAU,IAAI,WAAW;IAIzB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK;IAwLrE,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM;IAKnD,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO;IAK5C,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO;IAmBtD,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,KAAK,GAAG,KAAK;CAkBjD"}
@@ -0,0 +1,39 @@
1
+ import { Token, SceneNode } from './types';
2
+ export declare class Parser {
3
+ private tokens;
4
+ private pos;
5
+ constructor(tokens: Token[]);
6
+ private current;
7
+ private peek;
8
+ private advance;
9
+ private expect;
10
+ private expectIdentifier;
11
+ private skipNewlines;
12
+ private parseExpression;
13
+ private parsePrimary;
14
+ private getPrecedence;
15
+ private tokenTypeToOperator;
16
+ private parseVectorOrExpression;
17
+ private parseProperties;
18
+ private parseBlockContents;
19
+ private parseBlock;
20
+ private parseShape;
21
+ private parseCSG;
22
+ private parseForLoop;
23
+ private parseIf;
24
+ private parseSwitch;
25
+ private parseDefine;
26
+ private parseDetail;
27
+ private parseBackground;
28
+ private parseTexture;
29
+ private parseGroup;
30
+ private parseBuilder;
31
+ private parsePathValue;
32
+ private isStartOfNewValue;
33
+ private parsePathPrimary;
34
+ private parsePath;
35
+ private parseNode;
36
+ parse(): SceneNode[];
37
+ }
38
+ export declare function parseShapeScript(script: string): SceneNode[];
39
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/shapescript/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,SAAS,EAqBV,MAAM,SAAS,CAAC;AA6djB,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,GAAG,CAAK;gBAEJ,MAAM,EAAE,KAAK,EAAE;IAI3B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,YAAY;IA2IpB,OAAO,CAAC,aAAa;IA0BrB,OAAO,CAAC,mBAAmB;IAmC3B,OAAO,CAAC,uBAAuB;IA2D/B,OAAO,CAAC,eAAe;IAyDvB,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,UAAU;IA4BlB,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,YAAY;IA2EpB,OAAO,CAAC,OAAO;IA8Bf,OAAO,CAAC,WAAW;IA6FnB,OAAO,CAAC,WAAW;IA2DnB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,YAAY;IAgJpB,OAAO,CAAC,cAAc;IAoCtB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,gBAAgB;IA2ExB,OAAO,CAAC,SAAS;IAuOjB,OAAO,CAAC,SAAS;IAgLjB,KAAK,IAAI,SAAS,EAAE;CAarB;AAGD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,CAkB5D"}
@@ -0,0 +1,51 @@
1
+ import { SceneNode } from './types';
2
+ import * as THREE from "three";
3
+ export interface ConversionOptions {
4
+ wireframe?: boolean;
5
+ }
6
+ export declare class Converter {
7
+ private options;
8
+ private evaluator;
9
+ private symbols;
10
+ private detailLevel;
11
+ private transformStack;
12
+ constructor(options?: ConversionOptions);
13
+ convert(nodes: SceneNode[]): THREE.Group;
14
+ private convertNode;
15
+ private convertBlock;
16
+ private convertShape;
17
+ private createGeometry;
18
+ private createMaterial;
19
+ private convertCSG;
20
+ private convertForLoop;
21
+ private convertIf;
22
+ private convertSwitch;
23
+ private handleDefine;
24
+ private convertCustomShape;
25
+ private pushTransform;
26
+ private popTransform;
27
+ private currentTransform;
28
+ private applyCurrentTransform;
29
+ private applyExplicitTransforms;
30
+ private handleDetail;
31
+ private handleColorCommand;
32
+ private handleRotateCommand;
33
+ private handleOrientationCommand;
34
+ private handleTranslateCommand;
35
+ private handleScaleCommand;
36
+ private convertExtrude;
37
+ private buildPath;
38
+ private convertLathe;
39
+ private convertGroupBuilder;
40
+ private convertLoft;
41
+ private convertFill;
42
+ private convertHull;
43
+ private evaluateNumber;
44
+ private evaluateVector3;
45
+ private evaluateTranslateVector;
46
+ private evaluateColor;
47
+ private evaluateVector3OrColor;
48
+ private valuesEqual;
49
+ }
50
+ export declare function astToThreeJS(nodes: SceneNode[], options?: ConversionOptions): THREE.Group;
51
+ //# sourceMappingURL=toThreeJS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toThreeJS.d.ts","sourceRoot":"","sources":["../../src/shapescript/toThreeJS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,SAAS,EAwBV,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAOD,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,cAAc,CAAwB;gBAElC,OAAO,GAAE,iBAAsB;IAQ3C,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,KAAK;IAaxC,OAAO,CAAC,WAAW;IAuDnB,OAAO,CAAC,YAAY;IAqBpB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,cAAc;IAuFtB,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,UAAU;IAoIlB,OAAO,CAAC,cAAc;IAiEtB,OAAO,CAAC,SAAS;IAmCjB,OAAO,CAAC,aAAa;IAmDrB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,kBAAkB;IAsD1B,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,uBAAuB;IAqB/B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,cAAc;IA8BtB,OAAO,CAAC,SAAS;IAoHjB,OAAO,CAAC,YAAY;IAkIpB,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,WAAW;IA2CnB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,uBAAuB;IAoB/B,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,sBAAsB;IA8B9B,OAAO,CAAC,WAAW;CAWpB;AAGD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAAE,EAClB,OAAO,GAAE,iBAAsB,GAC9B,KAAK,CAAC,KAAK,CAGb"}