cyclecad 2.0.0 → 2.1.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 (33) hide show
  1. package/IMPLEMENTATION_GUIDE.md +502 -0
  2. package/INTEGRATION-GUIDE.md +377 -0
  3. package/MODULES_PHASES_6_7.md +780 -0
  4. package/app/index.html +106 -2
  5. package/app/js/brep-kernel.js +1353 -455
  6. package/app/js/help-module.js +1437 -0
  7. package/app/js/kernel.js +364 -40
  8. package/app/js/modules/animation-module.js +967 -0
  9. package/app/js/modules/assembly-module.js +47 -3
  10. package/app/js/modules/cam-module.js +1067 -0
  11. package/app/js/modules/collaboration-module.js +1102 -0
  12. package/app/js/modules/data-module.js +1656 -0
  13. package/app/js/modules/drawing-module.js +54 -8
  14. package/app/js/modules/formats-module.js +1173 -0
  15. package/app/js/modules/inspection-module.js +937 -0
  16. package/app/js/modules/mesh-module.js +968 -0
  17. package/app/js/modules/operations-module.js +40 -7
  18. package/app/js/modules/plugin-module.js +957 -0
  19. package/app/js/modules/rendering-module.js +1306 -0
  20. package/app/js/modules/scripting-module.js +955 -0
  21. package/app/js/modules/simulation-module.js +60 -3
  22. package/app/js/modules/sketch-module.js +1032 -90
  23. package/app/js/modules/step-module.js +47 -6
  24. package/app/js/modules/surface-module.js +728 -0
  25. package/app/js/modules/version-module.js +1410 -0
  26. package/app/js/modules/viewport-module.js +95 -8
  27. package/app/test-agent-v2.html +881 -1316
  28. package/docs/ARCHITECTURE.html +838 -1408
  29. package/docs/DEVELOPER-GUIDE.md +1504 -0
  30. package/docs/TUTORIAL.md +740 -0
  31. package/package.json +1 -1
  32. package/.github/scripts/cad-diff.js +0 -590
  33. package/.github/workflows/cad-diff.yml +0 -117
@@ -1,17 +1,104 @@
1
1
  /**
2
- * ViewportModule — Core 3D Rendering Engine
3
- * Foundational LEGO block for Three.js scene, camera, renderer, and interaction
2
+ * @file viewport-module.js
3
+ * @description ViewportModule Core 3D Rendering Engine for cycleCAD
4
+ * Foundational LEGO block providing Three.js scene, camera, renderer, and 3D interaction.
5
+ * Zero dependencies — this is the bedrock layer that all other modules depend on.
6
+ *
7
+ * @version 1.0.0
8
+ * @author cycleCAD Team
9
+ * @license MIT
10
+ * @see {@link https://github.com/vvlars-cmd/cyclecad}
11
+ *
12
+ * @module viewport-module
13
+ * @requires Three.js r170 (loaded globally)
14
+ * @requires OrbitControls from Three.js examples
4
15
  *
5
16
  * Provides:
6
- * - Scene setup (lights, grid, fog)
7
- * - Camera (perspective + orbit controls)
8
- * - Renderer (WebGL, shadows, MSAA)
9
- * - Selection (raycaster + click detection)
10
- * - View controls (preset views, fit-to-bounds)
17
+ * - Three.js WebGL renderer (antialias, shadows, high-DPI support)
18
+ * - Perspective camera with preset views (front, back, left, right, top, bottom, isometric)
19
+ * - Lighting setup (3x directional lights + ambient for realistic shadows)
20
+ * - Grid floor with shadow plane
21
+ * - OrbitControls for rotation (left), pan (right), zoom (scroll)
22
+ * - Selection via raycaster + click detection
23
+ * - Fit-to-object camera animation
24
+ * - View management (preset views, custom scale)
25
+ * - Display modes (wireframe, grid toggle, shadow toggle)
26
+ * - High-res screenshot capture
27
+ * - Background color management
28
+ * - Event emissions for part selection/deselection
29
+ *
30
+ * Architecture (Three.js Scene Structure):
31
+ * Scene
32
+ * ├── Lights
33
+ * │ ├── AmbientLight (0.5 intensity)
34
+ * │ ├── DirectionalLight 1 (main, casts shadow)
35
+ * │ ├── DirectionalLight 2 (fill)
36
+ * │ └── DirectionalLight 3 (back)
37
+ * ├── Grid floor (2000x2000 units, 20 divisions)
38
+ * └── User meshes
39
+ * ├── mesh_0 (with shadow, selection tracking)
40
+ * ├── mesh_1
41
+ * └── ...
42
+ *
43
+ * Commands Registered:
44
+ * - viewport.fitAll() - Fit camera to all objects
45
+ * - viewport.fitTo(meshId) - Fit to specific mesh
46
+ * - viewport.setView(name) - Set preset view (front/back/left/right/top/bottom/iso)
47
+ * - viewport.toggleGrid() - Show/hide grid
48
+ * - viewport.toggleWireframe() - Toggle wireframe mode on all meshes
49
+ * - viewport.toggleShadows() - Enable/disable shadow rendering
50
+ * - viewport.addMesh(geometry, material, name) - Add mesh to scene
51
+ * - viewport.removeMesh(meshId) - Remove mesh from scene
52
+ * - viewport.setBackground(color) - Change background color
53
+ * - viewport.screenshot(w, h) - Capture high-res screenshot
54
+ *
55
+ * Events Emitted:
56
+ * - viewport:ready - Viewport fully loaded and ready to use
57
+ * - viewport:resize - Window resized, new dimensions in data
58
+ * - part:selected - Mesh clicked, data includes {meshId, point, face, object}
59
+ * - part:deselected - Clicked on empty area, no geometry at cursor
60
+ *
61
+ * Usage Example:
62
+ * ```javascript
63
+ * import kernel from './kernel.js';
64
+ * import ViewportModule from './modules/viewport-module.js';
65
+ *
66
+ * // Register viewport module
67
+ * kernel.register(ViewportModule);
11
68
  *
12
- * No dependencies this is the base layer.
69
+ * // Activate it (loads Three.js, creates scene, attaches to DOM)
70
+ * await kernel.activate('viewport');
71
+ *
72
+ * // Now viewport is ready
73
+ * await kernel.exec('viewport.setView', {viewName: 'front'});
74
+ *
75
+ * // Listen for selections
76
+ * kernel.on('part:selected', (data) => {
77
+ * console.log('Selected:', data.meshId);
78
+ * });
79
+ *
80
+ * // Fit camera to all objects
81
+ * await kernel.exec('viewport.fitAll');
82
+ * ```
13
83
  */
14
84
 
85
+ /**
86
+ * ViewportModule definition for kernel registration
87
+ *
88
+ * @type {Object}
89
+ * @property {string} id - Module ID ('viewport')
90
+ * @property {string} name - Human-readable name ('3D Viewport')
91
+ * @property {string} version - Semantic version ('1.0.0')
92
+ * @property {string} category - Module category ('engine' — foundational)
93
+ * @property {Array} dependencies - Required modules (empty — no deps)
94
+ * @property {number} memoryEstimate - Estimated memory (30 MB for Three.js + textures)
95
+ * @property {Array} replaces - Modules this replaces (none)
96
+ * @property {Function} load - Async lifecycle: load hook
97
+ * @property {Function} activate - Async lifecycle: activate hook
98
+ * @property {Function} deactivate - Async lifecycle: deactivate hook
99
+ * @property {Function} unload - Async lifecycle: unload hook
100
+ * @property {Object} provides - Exported API (commands and events)
101
+ */
15
102
  const ViewportModule = {
16
103
  id: 'viewport',
17
104
  name: '3D Viewport',