fluidcad 0.0.2 → 0.0.4

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 (123) hide show
  1. package/README.md +7 -7
  2. package/lib/dist/common/shape-factory.d.ts +1 -1
  3. package/lib/dist/oc/boolean-ops.d.ts +2 -2
  4. package/lib/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +3 -2
  6. package/lib/dist/constraints/constraint.d.ts +0 -11
  7. package/lib/dist/constraints/constraint.js +0 -51
  8. package/lib/dist/constraints/outside.d.ts +0 -3
  9. package/lib/dist/constraints/outside.js +0 -4
  10. package/lib/dist/core/2d/aslot.d.ts +0 -12
  11. package/lib/dist/core/2d/aslot.js +0 -40
  12. package/lib/dist/core/2d/crect.d.ts +0 -12
  13. package/lib/dist/core/2d/crect.js +0 -74
  14. package/lib/dist/core/2d/face-maker.d.ts +0 -13
  15. package/lib/dist/core/2d/face-maker.js +0 -119
  16. package/lib/dist/core/2d/face-maker2.d.ts +0 -6
  17. package/lib/dist/core/2d/face-maker2.js +0 -54
  18. package/lib/dist/core/region.d.ts +0 -13
  19. package/lib/dist/core/region.js +0 -18
  20. package/lib/dist/features/2d/amove.d.ts +0 -14
  21. package/lib/dist/features/2d/amove.js +0 -33
  22. package/lib/dist/features/2d/constraints/constraint.d.ts +0 -11
  23. package/lib/dist/features/2d/constraints/constraint.js +0 -49
  24. package/lib/dist/features/2d/constraints/outside.d.ts +0 -3
  25. package/lib/dist/features/2d/constraints/outside.js +0 -4
  26. package/lib/dist/features/2d/tarc-two-circles.d.ts +0 -18
  27. package/lib/dist/features/2d/tarc-two-circles.js +0 -61
  28. package/lib/dist/features/2d/tcircle-three-tan.d.ts +0 -13
  29. package/lib/dist/features/2d/tcircle-three-tan.js +0 -33
  30. package/lib/dist/features/2d/tcircle-two-tan.d.ts +0 -13
  31. package/lib/dist/features/2d/tcircle-two-tan.js +0 -33
  32. package/lib/dist/features/Extrude.d.ts +0 -1
  33. package/lib/dist/features/Extrude.js +0 -1
  34. package/lib/dist/features/cut-base.d.ts +0 -49
  35. package/lib/dist/features/cut-base.js +0 -312
  36. package/lib/dist/features/cut-symmetric.d.ts +0 -23
  37. package/lib/dist/features/cut-symmetric.js +0 -119
  38. package/lib/dist/features/cut-two-distances.d.ts +0 -24
  39. package/lib/dist/features/cut-two-distances.js +0 -110
  40. package/lib/dist/features/cut.d.ts +0 -27
  41. package/lib/dist/features/cut.js +0 -101
  42. package/lib/dist/features/extrude-symmetric.d.ts +0 -28
  43. package/lib/dist/features/extrude-symmetric.js +0 -177
  44. package/lib/dist/features/region2d.d.ts +0 -25
  45. package/lib/dist/features/region2d.js +0 -185
  46. package/lib/dist/features/repeat-circular2d.d.ts +0 -17
  47. package/lib/dist/features/repeat-circular2d.js +0 -90
  48. package/lib/dist/features/repeat-linear2d.d.ts +0 -17
  49. package/lib/dist/features/repeat-linear2d.js +0 -114
  50. package/lib/dist/features/revolve-options.d.ts +0 -6
  51. package/lib/dist/features/revolve-options.js +0 -1
  52. package/lib/dist/features/split.d.ts +0 -14
  53. package/lib/dist/features/split.js +0 -74
  54. package/lib/dist/features/state-scene-object.d.ts +0 -15
  55. package/lib/dist/features/state-scene-object.js +0 -44
  56. package/lib/dist/features/state-select.d.ts +0 -21
  57. package/lib/dist/features/state-select.js +0 -73
  58. package/lib/dist/features/translate2d.d.ts +0 -16
  59. package/lib/dist/features/translate2d.js +0 -61
  60. package/lib/dist/filters/all-filter.d.ts +0 -8
  61. package/lib/dist/filters/all-filter.js +0 -12
  62. package/lib/dist/filters/near-point-filter.d.ts +0 -11
  63. package/lib/dist/filters/near-point-filter.js +0 -33
  64. package/lib/dist/helpers/resolve-filters.d.ts +0 -6
  65. package/lib/dist/helpers/resolve-filters.js +0 -25
  66. package/lib/dist/math/axis.test.d.ts +0 -1
  67. package/lib/dist/math/axis.test.js +0 -287
  68. package/lib/dist/math/coordinate-system.test.d.ts +0 -1
  69. package/lib/dist/math/coordinate-system.test.js +0 -308
  70. package/lib/dist/math/matrix4.test.d.ts +0 -1
  71. package/lib/dist/math/matrix4.test.js +0 -357
  72. package/lib/dist/math/plane.test.d.ts +0 -1
  73. package/lib/dist/math/plane.test.js +0 -398
  74. package/lib/dist/math/point.test.d.ts +0 -1
  75. package/lib/dist/math/point.test.js +0 -385
  76. package/lib/dist/math/quaternion.test.d.ts +0 -1
  77. package/lib/dist/math/quaternion.test.js +0 -278
  78. package/lib/dist/math/vector3d.test.d.ts +0 -1
  79. package/lib/dist/math/vector3d.test.js +0 -276
  80. package/lib/dist/oc/constraint-resolver.d.ts +0 -7
  81. package/lib/dist/oc/constraint-resolver.js +0 -31
  82. package/lib/dist/oc/constraints/curve-constraint-solver.d.ts +0 -1
  83. package/lib/dist/oc/constraints/curve-constraint-solver.js +0 -2
  84. package/lib/dist/oc/constraints/geometric-constraint-solver.d.ts +0 -1
  85. package/lib/dist/oc/constraints/geometric-constraint-solver.js +0 -5
  86. package/lib/dist/oc/face-maker.d.ts +0 -14
  87. package/lib/dist/oc/face-maker.js +0 -191
  88. package/lib/dist/oc/measure.d.ts +0 -21
  89. package/lib/dist/oc/measure.js +0 -256
  90. package/lib/dist/oc/tangent-circle-solver.d.ts +0 -17
  91. package/lib/dist/oc/tangent-circle-solver.js +0 -72
  92. package/lib/dist/oc/tangent-line-solver.d.ts +0 -17
  93. package/lib/dist/oc/tangent-line-solver.js +0 -83
  94. package/lib/dist/oc/tangent-solver.d.ts +0 -14
  95. package/lib/dist/oc/tangent-solver.js +0 -199
  96. package/lib/dist/rendering/builder-context.d.ts +0 -16
  97. package/lib/dist/rendering/builder-context.js +0 -63
  98. package/lib/dist/tests/extrude.test.d.ts +0 -1
  99. package/lib/dist/tests/extrude.test.js +0 -48
  100. package/lib/dist/tests/features/copy.test.d.ts +0 -1
  101. package/lib/dist/tests/features/copy.test.js +0 -158
  102. package/lib/dist/tests/features/dispose.test.d.ts +0 -1
  103. package/lib/dist/tests/features/dispose.test.js +0 -189
  104. package/lib/dist/tests/features/part-pick.test.d.ts +0 -1
  105. package/lib/dist/tests/features/part-pick.test.js +0 -73
  106. package/lib/dist/tests/features/part-repeat.test.d.ts +0 -1
  107. package/lib/dist/tests/features/part-repeat.test.js +0 -109
  108. package/server/dist/fluidcad-server.d.ts +0 -32
  109. package/server/dist/fluidcad-server.js +0 -150
  110. package/server/dist/index.d.ts +0 -1
  111. package/server/dist/index.js +0 -290
  112. package/server/dist/routes/actions.d.ts +0 -3
  113. package/server/dist/routes/actions.js +0 -100
  114. package/server/dist/routes/export.d.ts +0 -3
  115. package/server/dist/routes/export.js +0 -55
  116. package/server/dist/routes/properties.d.ts +0 -3
  117. package/server/dist/routes/properties.js +0 -46
  118. package/server/dist/routes/screenshot.d.ts +0 -2
  119. package/server/dist/routes/screenshot.js +0 -76
  120. package/server/dist/vite-manager.d.ts +0 -10
  121. package/server/dist/vite-manager.js +0 -64
  122. package/server/dist/ws-protocol.d.ts +0 -138
  123. package/server/dist/ws-protocol.js +0 -4
@@ -1,46 +0,0 @@
1
- import { Router } from 'express';
2
- import { getMaterials } from '../../../lib/dist/common/materials.js';
3
- export function createPropertiesRouter(fluidCadServer) {
4
- const router = Router();
5
- router.get('/materials', (_req, res) => {
6
- res.json(getMaterials());
7
- });
8
- router.get('/shape-properties', (req, res) => {
9
- const shapeId = req.query.shapeId || '';
10
- const props = fluidCadServer.getShapeProperties(shapeId);
11
- if (!props) {
12
- res.status(404).json({ error: 'Shape not found' });
13
- return;
14
- }
15
- res.json(props);
16
- });
17
- router.get('/face-properties', (req, res) => {
18
- const shapeId = req.query.shapeId || '';
19
- const faceIndex = parseInt(req.query.faceIndex || '', 10);
20
- if (!shapeId || isNaN(faceIndex) || faceIndex < 0) {
21
- res.status(400).json({ error: 'Missing or invalid shapeId / faceIndex' });
22
- return;
23
- }
24
- const props = fluidCadServer.getFaceProperties(shapeId, faceIndex);
25
- if (!props) {
26
- res.status(404).json({ error: 'Face not found' });
27
- return;
28
- }
29
- res.json(props);
30
- });
31
- router.get('/edge-properties', (req, res) => {
32
- const shapeId = req.query.shapeId || '';
33
- const edgeIndex = parseInt(req.query.edgeIndex || '', 10);
34
- if (!shapeId || isNaN(edgeIndex) || edgeIndex < 0) {
35
- res.status(400).json({ error: 'Missing or invalid shapeId / edgeIndex' });
36
- return;
37
- }
38
- const props = fluidCadServer.getEdgeProperties(shapeId, edgeIndex);
39
- if (!props) {
40
- res.status(404).json({ error: 'Edge not found' });
41
- return;
42
- }
43
- res.json(props);
44
- });
45
- return router;
46
- }
@@ -1,2 +0,0 @@
1
- import { Router } from 'express';
2
- export declare function createScreenshotRouter(requestScreenshot: (options: Record<string, unknown>) => Promise<Buffer>): Router;
@@ -1,76 +0,0 @@
1
- import { Router } from 'express';
2
- export function createScreenshotRouter(requestScreenshot) {
3
- const router = Router();
4
- router.post('/screenshot', async (req, res) => {
5
- const { width, height, showGrid, showAxes, transparent, autoCrop, fitToModel, margin } = req.body;
6
- const options = {};
7
- if (width !== undefined) {
8
- if (typeof width !== 'number' || width < 1 || width > 8192) {
9
- res.status(400).json({ error: 'width must be a number between 1 and 8192.' });
10
- return;
11
- }
12
- options.width = width;
13
- }
14
- if (height !== undefined) {
15
- if (typeof height !== 'number' || height < 1 || height > 8192) {
16
- res.status(400).json({ error: 'height must be a number between 1 and 8192.' });
17
- return;
18
- }
19
- options.height = height;
20
- }
21
- if (showGrid !== undefined) {
22
- if (typeof showGrid !== 'boolean') {
23
- res.status(400).json({ error: 'showGrid must be a boolean.' });
24
- return;
25
- }
26
- options.showGrid = showGrid;
27
- }
28
- if (showAxes !== undefined) {
29
- if (typeof showAxes !== 'boolean') {
30
- res.status(400).json({ error: 'showAxes must be a boolean.' });
31
- return;
32
- }
33
- options.showAxes = showAxes;
34
- }
35
- if (transparent !== undefined) {
36
- if (typeof transparent !== 'boolean') {
37
- res.status(400).json({ error: 'transparent must be a boolean.' });
38
- return;
39
- }
40
- options.transparent = transparent;
41
- }
42
- if (autoCrop !== undefined) {
43
- if (typeof autoCrop !== 'boolean') {
44
- res.status(400).json({ error: 'autoCrop must be a boolean.' });
45
- return;
46
- }
47
- options.autoCrop = autoCrop;
48
- }
49
- if (fitToModel !== undefined) {
50
- if (typeof fitToModel !== 'boolean') {
51
- res.status(400).json({ error: 'fitToModel must be a boolean.' });
52
- return;
53
- }
54
- options.fitToModel = fitToModel;
55
- }
56
- if (margin !== undefined) {
57
- if (typeof margin !== 'number' || margin < 0) {
58
- res.status(400).json({ error: 'margin must be a non-negative number.' });
59
- return;
60
- }
61
- options.margin = margin;
62
- }
63
- try {
64
- const png = await requestScreenshot(options);
65
- res.setHeader('Content-Type', 'image/png');
66
- res.setHeader('Content-Disposition', 'inline; filename="screenshot.png"');
67
- res.send(png);
68
- }
69
- catch (err) {
70
- const message = err.message || String(err);
71
- const status = message.includes('No UI client') || message.includes('timed out') ? 503 : 500;
72
- res.status(status).json({ error: message });
73
- }
74
- });
75
- return router;
76
- }
@@ -1,10 +0,0 @@
1
- import { type ViteDevServer } from 'vite';
2
- export declare class ViteManager {
3
- server: ViteDevServer;
4
- private rootPath;
5
- private buffers;
6
- init(rootPath: string): Promise<void>;
7
- setBuffer(id: string, code: string): void;
8
- loadModule(filePath: string): Promise<Record<string, any>>;
9
- invalidateModule(): void;
10
- }
@@ -1,64 +0,0 @@
1
- import { createServer } from 'vite';
2
- import { dirname, resolve, isAbsolute } from 'path';
3
- export class ViteManager {
4
- server;
5
- rootPath = '';
6
- buffers = new Map();
7
- async init(rootPath) {
8
- this.rootPath = rootPath;
9
- const that = this;
10
- this.server = await createServer({
11
- root: rootPath,
12
- server: {
13
- watch: {
14
- ignoreInitial: true,
15
- ignored: ['**/node_modules/**']
16
- }
17
- },
18
- optimizeDeps: {
19
- noDiscovery: true,
20
- include: []
21
- },
22
- plugins: [
23
- {
24
- name: 'virtual-module',
25
- resolveId(id, importer) {
26
- if (id.startsWith('virtual:')) {
27
- return id;
28
- }
29
- // Resolve relative imports from virtual modules against the real file path
30
- if (importer && importer.startsWith('virtual:live-render:') && !isAbsolute(id)) {
31
- const realImporter = importer.replace('virtual:live-render:', '');
32
- return resolve(dirname(realImporter), id);
33
- }
34
- },
35
- load(id) {
36
- if (id.startsWith('virtual:live-render')) {
37
- let mod = this.getModuleInfo(id);
38
- if (mod) {
39
- that.server.moduleGraph.invalidateModule(that.server.moduleGraph.getModuleById(id));
40
- }
41
- return that.buffers.get(id) || '';
42
- }
43
- else if (that.buffers.has(`virtual:live-render:${id}`)) {
44
- return that.buffers.get(`virtual:live-render:${id}`);
45
- }
46
- }
47
- }
48
- ]
49
- });
50
- }
51
- setBuffer(id, code) {
52
- this.buffers.set(id, code);
53
- }
54
- async loadModule(filePath) {
55
- return this.server.ssrLoadModule(filePath);
56
- }
57
- invalidateModule() {
58
- for (const [id, mod] of this.server.moduleGraph.idToModuleMap) {
59
- if (id.startsWith(this.rootPath) || id.startsWith('virtual:live-render')) {
60
- this.server.moduleGraph.invalidateModule(mod);
61
- }
62
- }
63
- }
64
- }
@@ -1,138 +0,0 @@
1
- export type ProcessFileMessage = {
2
- type: 'process-file';
3
- filePath: string;
4
- };
5
- export type LiveUpdateMessage = {
6
- type: 'live-update';
7
- fileName: string;
8
- code: string;
9
- };
10
- export type RollbackMessage = {
11
- type: 'rollback';
12
- fileName: string;
13
- index: number;
14
- };
15
- export type ImportFileMessage = {
16
- type: 'import-file';
17
- workspacePath: string;
18
- fileName: string;
19
- data: string;
20
- };
21
- export type HighlightShapeMessage = {
22
- type: 'highlight-shape';
23
- shapeId: string;
24
- };
25
- export type ClearHighlightMessage = {
26
- type: 'clear-highlight';
27
- };
28
- export type ShowShapePropertiesMessage = {
29
- type: 'show-shape-properties';
30
- shapeId: string;
31
- };
32
- export type ExportSceneMessage = {
33
- type: 'export-scene';
34
- shapeIds: string[];
35
- options: {
36
- format: 'step' | 'stl';
37
- includeColors?: boolean;
38
- resolution?: string;
39
- customLinearDeflection?: number;
40
- customAngularDeflectionDeg?: number;
41
- };
42
- };
43
- export type ExtensionMessage = ProcessFileMessage | LiveUpdateMessage | RollbackMessage | ImportFileMessage | HighlightShapeMessage | ClearHighlightMessage | ShowShapePropertiesMessage | ExportSceneMessage;
44
- export type ReadyMessage = {
45
- type: 'ready';
46
- port: number;
47
- url: string;
48
- };
49
- export type InitCompleteMessage = {
50
- type: 'init-complete';
51
- success: boolean;
52
- error?: string;
53
- };
54
- export type SceneRenderedMessage = {
55
- type: 'scene-rendered';
56
- absPath: string;
57
- result: any[];
58
- rollbackStop: number;
59
- };
60
- export type ErrorMessage = {
61
- type: 'error';
62
- message: string;
63
- };
64
- export type ImportCompleteMessage = {
65
- type: 'import-complete';
66
- success: boolean;
67
- };
68
- export type InsertPointMessage = {
69
- type: 'insert-point';
70
- point: [number, number];
71
- sourceLocation: {
72
- line: number;
73
- column: number;
74
- };
75
- };
76
- export type RemovePointMessage = {
77
- type: 'remove-point';
78
- point: [number, number];
79
- sourceLocation: {
80
- line: number;
81
- column: number;
82
- };
83
- };
84
- export type SetPickPointsMessage = {
85
- type: 'set-pick-points';
86
- points: [number, number][];
87
- sourceLocation: {
88
- line: number;
89
- column: number;
90
- };
91
- };
92
- export type ExportCompleteMessage = {
93
- type: 'export-complete';
94
- success: boolean;
95
- data?: string;
96
- fileName?: string;
97
- error?: string;
98
- };
99
- export type ServerToExtensionMessage = ReadyMessage | InitCompleteMessage | SceneRenderedMessage | ErrorMessage | ImportCompleteMessage | InsertPointMessage | RemovePointMessage | SetPickPointsMessage | ExportCompleteMessage;
100
- export type UISceneRenderedMessage = {
101
- type: 'scene-rendered';
102
- result: any[];
103
- absPath: string;
104
- rollbackStop?: number;
105
- };
106
- export type UIHighlightShapeMessage = {
107
- type: 'highlight-shape';
108
- shapeId: string;
109
- };
110
- export type UIClearHighlightMessage = {
111
- type: 'clear-highlight';
112
- };
113
- export type UIShowShapePropertiesMessage = {
114
- type: 'show-shape-properties';
115
- shapeId: string;
116
- };
117
- export type UIInitCompleteMessage = {
118
- type: 'init-complete';
119
- success: boolean;
120
- error?: string;
121
- };
122
- export type UIProcessingFileMessage = {
123
- type: 'processing-file';
124
- };
125
- export type UITakeScreenshotMessage = {
126
- type: 'take-screenshot';
127
- requestId: string;
128
- options: {
129
- width?: number;
130
- height?: number;
131
- showGrid?: boolean;
132
- showAxes?: boolean;
133
- transparent?: boolean;
134
- autoCrop?: boolean;
135
- margin?: number;
136
- };
137
- };
138
- export type ServerToUIMessage = UIInitCompleteMessage | UIProcessingFileMessage | UISceneRenderedMessage | UIHighlightShapeMessage | UIClearHighlightMessage | UIShowShapePropertiesMessage | UITakeScreenshotMessage;
@@ -1,4 +0,0 @@
1
- // ---------------------------------------------------------------------------
2
- // IPC: Extension → Server messages
3
- // ---------------------------------------------------------------------------
4
- export {};