@mulmoclaude/shapescript-plugin 1.3.0 → 2.0.0

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.
Files changed (52) hide show
  1. package/README.md +84 -14
  2. package/dist/core/definition.d.ts.map +1 -1
  3. package/dist/core/dispatch.d.ts +8 -3
  4. package/dist/core/dispatch.d.ts.map +1 -1
  5. package/dist/core/index.d.ts +5 -2
  6. package/dist/core/index.d.ts.map +1 -1
  7. package/dist/core/paths.d.ts +5 -0
  8. package/dist/core/paths.d.ts.map +1 -1
  9. package/dist/core-BvTjfhU2.js +53 -0
  10. package/dist/core-DZvhTmuk.cjs +1 -0
  11. package/dist/core.cjs +1 -1
  12. package/dist/core.js +4 -3
  13. package/dist/export/tool.d.ts +45 -0
  14. package/dist/export/tool.d.ts.map +1 -0
  15. package/dist/export/usdz.d.ts +17 -0
  16. package/dist/export/usdz.d.ts.map +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +4 -4
  19. package/dist/lang/de.d.ts.map +1 -1
  20. package/dist/lang/en.d.ts.map +1 -1
  21. package/dist/lang/es.d.ts.map +1 -1
  22. package/dist/lang/fr.d.ts.map +1 -1
  23. package/dist/lang/ja.d.ts.map +1 -1
  24. package/dist/lang/ko.d.ts.map +1 -1
  25. package/dist/lang/messages.d.ts +2 -0
  26. package/dist/lang/messages.d.ts.map +1 -1
  27. package/dist/lang/ptBR.d.ts.map +1 -1
  28. package/dist/lang/zh.d.ts.map +1 -1
  29. package/dist/render.cjs +2 -2
  30. package/dist/render.js +9 -9
  31. package/dist/samples-CXhuDdDd.js +1038 -0
  32. package/dist/samples-DGD0Kjwg.cjs +276 -0
  33. package/dist/shapescript/evaluator.d.ts +27 -4
  34. package/dist/shapescript/evaluator.d.ts.map +1 -1
  35. package/dist/shapescript/parser.d.ts +18 -0
  36. package/dist/shapescript/parser.d.ts.map +1 -1
  37. package/dist/shapescript/toThreeJS.d.ts +42 -2
  38. package/dist/shapescript/toThreeJS.d.ts.map +1 -1
  39. package/dist/shapescript/types.d.ts +22 -4
  40. package/dist/shapescript/types.d.ts.map +1 -1
  41. package/dist/style.css +1 -1
  42. package/dist/{toThreeJS-B5LiF110.js → toThreeJS-FsP-Na75.js} +341 -284
  43. package/dist/toThreeJS-MvllBF9e.cjs +10 -0
  44. package/dist/vue/View.vue.d.ts.map +1 -1
  45. package/dist/vue/index.d.ts +1 -1
  46. package/dist/vue/index.d.ts.map +1 -1
  47. package/dist/vue.cjs +41 -22
  48. package/dist/vue.js +1784 -1721
  49. package/package.json +1 -1
  50. package/dist/samples-DHEKUNs5.cjs +0 -186
  51. package/dist/samples-SaXsqbHJ.js +0 -180
  52. package/dist/toThreeJS-BOBpx5Dc.cjs +0 -10
@@ -1 +1 @@
1
- {"version":3,"file":"View.vue.d.ts","sourceRoot":"","sources":["../../src/vue/View.vue"],"names":[],"mappings":"AAklBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAuB5D,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,UAAU,CAAC,sBAAsB,CAAC,CAAC;CACpD,CAAC;AAkhBF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"View.vue.d.ts","sourceRoot":"","sources":["../../src/vue/View.vue"],"names":[],"mappings":"AAupBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAyB5D,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,UAAU,CAAC,sBAAsB,CAAC,CAAC;CACpD,CAAC;AA4lBF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -3,7 +3,7 @@ import type { ToolPlugin } from "gui-chat-protocol/vue";
3
3
  import type { PresentShapeScriptData, PresentShapeScriptArgs } from "../core/types";
4
4
  import View from "./View.vue";
5
5
  import Preview from "./Preview.vue";
6
- export declare const SYSTEM_PROMPT = "Use the presentShapeScript 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## Supported ShapeScript Features:\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\nBuilders: extrude, fill, lathe, loft, hull. Example: loft { square translate 0 0 2 circle }.\nStencil preserves the first shape's volume and paints the intersecting surface.\nConstants: pi, tau, true, false. Tuple/string access: values[0], vector.x, value.count.\nPolygon supports sides (3\u2013256). String literals and join/trim are supported.\nUse the tool schema for exact syntax and builder limits. This is a modeling subset of upstream ShapeScript;\nimports, textures, text/fonts and general user-defined functions are not supported.\nIf presentShapeScript returns an error diagnostic, correct the script and retry; no visualization was created.\n\nKeep visualizations clear, well-organized, and use expressions and control flow.";
6
+ export declare const SYSTEM_PROMPT = "Use the presentShapeScript 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## Supported ShapeScript Features:\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 {\n position (i * 2 - 6) 0 0\n size 1\n }\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!\nSeparate arguments with spaces, upstream style: max(0 (j - 1)). Commas work here but not in the upstream app.\nOne statement per line; the upstream app rejects two statements on one line.\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 {\n position (x * 0.3) y (z * 0.3)\n size 0.2\n }\n }\n}\n\n### Primitives & CSG:\nShapes: cube, sphere, cylinder, cone, torus\nCSG: union, difference, intersection, xor, stencil\nProperties: position, orientation (alias rotation), size, color, opacity\n\n### Units (upstream ShapeScript conventions):\n- size = DIAMETER for sphere/cylinder/cone/circle/polygon/torus, edge length for cube/square. A bare sphere fits the unit cube.\n- orientation / rotate = HALF-TURNS as roll yaw pitch (Z, Y, X): 0.5 = 90\u00B0. A lone value is a roll. Trig functions still use radians.\n- Path point/curve coordinates are absolute; curve is a B\u00E9zier control point; rotate/translate/scale inside a path move the frame.\n- A path can carry its own position/orientation/size; give loft/extrude path children (not fill{}), as the upstream app requires.\n\nBuilders: extrude, fill, lathe, loft, hull. Example:\nloft {\n square\n translate 0 0 2\n circle\n}\nStencil preserves the first shape's volume and paints the intersecting surface.\nConstants: pi, true, false (avoid tau, upstream lacks it; write 2 * pi). Tuple/string access: values[0], vector.x, value.count.\nPolygon supports sides (3\u2013256). String literals and join/trim are supported.\nUse the tool schema for exact syntax and builder limits. This is a modeling subset of upstream ShapeScript;\nimports, textures, text/fonts and general user-defined functions are not supported.\nIf presentShapeScript returns an error diagnostic, correct the script and retry; no visualization was created.\n\nKeep visualizations clear, well-organized, and use expressions and control flow.";
7
7
  export declare const plugin: ToolPlugin<PresentShapeScriptData, unknown, PresentShapeScriptArgs>;
8
8
  export type { PresentShapeScriptData, PresentShapeScriptArgs, PresentShapeScriptResult, PresentShapeScriptRenderedResult, PresentShapeScriptErrorResult, PresentShapeScriptExecutionResult, ShapeScriptDiagnostic, } from "../core/types";
9
9
  export { TOOL_NAME, TOOL_DEFINITION } from "../core/definition";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAIpF,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,eAAO,MAAM,aAAa,i7FAyFuD,CAAC;AAElF,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,sBAAsB,EAAE,OAAO,EAAE,sBAAsB,CAMtF,CAAC;AAEF,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvG,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAGzB,OAAO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