@bitbybit-dev/jscad 0.21.1 → 1.0.0-rc.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/babel.config.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  module.exports = {
2
3
  presets: [
3
4
  [
@@ -11,4 +12,3 @@ module.exports = {
11
12
  '@babel/preset-typescript'
12
13
  ],
13
14
  };
14
- export {};
@@ -1,4 +1,4 @@
1
- export const presets: (string | (string | {
1
+ export let presets: (string | (string | {
2
2
  targets: {
3
3
  node: string;
4
4
  };
@@ -72,9 +72,9 @@ let CSG;
72
72
  */
73
73
  const serialize = (options, ...objects) => {
74
74
  const defaults = {
75
- unit: 'millimeter',
75
+ unit: 'millimeter', // micron, millimeter, centimeter, inch, foot, meter
76
76
  metadata: true,
77
- defaultcolor: [255 / 255, 160 / 255, 0, 1],
77
+ defaultcolor: [255 / 255, 160 / 255, 0, 1], // JSCAD Orange
78
78
  compress: true
79
79
  };
80
80
  options = Object.assign({}, defaults, options);
@@ -3494,7 +3494,7 @@ ENDSEC`;
3494
3494
  * AutoCAD 2017 2018 Color Index (1-255) as RGB + ALPHA colors
3495
3495
  */
3496
3496
  const colorIndex = [
3497
- [0, 0, 0, 255],
3497
+ [0, 0, 0, 255], // index 0, added for easy maintenance
3498
3498
  // 1
3499
3499
  [255, 0, 0, 255],
3500
3500
  [255, 255, 0, 255],
@@ -3827,8 +3827,8 @@ ENDSEC`;
3827
3827
  */
3828
3828
  const serialize = (options, ...objects) => {
3829
3829
  const defaults = {
3830
- geom2To: 'lwpolyline',
3831
- geom3To: '3dface',
3830
+ geom2To: 'lwpolyline', // or polyline
3831
+ geom3To: '3dface', // or polyline
3832
3832
  pathTo: 'lwpolyline',
3833
3833
  statusCallback: null,
3834
3834
  colorIndex: colorindex2017
@@ -6017,7 +6017,7 @@ ${face[3]}
6017
6017
  */
6018
6018
  const appendArc = (options, geometry) => {
6019
6019
  const defaults = {
6020
- radius: [0, 0],
6020
+ radius: [0, 0], // X and Y radius
6021
6021
  xaxisrotation: 0,
6022
6022
  clockwise: false,
6023
6023
  large: false,
@@ -7989,7 +7989,7 @@ ${face[3]}
7989
7989
  * @alias module:modeling/maths/line3.create
7990
7990
  */
7991
7991
  const create = () => [
7992
- vec3.fromValues(0, 0, 0),
7992
+ vec3.fromValues(0, 0, 0), // origin
7993
7993
  vec3.fromValues(0, 0, 1) // direction
7994
7994
  ];
7995
7995
  module.exports = create;
@@ -15135,7 +15135,7 @@ ${face[3]}
15135
15135
  */
15136
15136
  const project = (options, ...objects) => {
15137
15137
  const defaults = {
15138
- axis: [0, 0, 1],
15138
+ axis: [0, 0, 1], // Z axis
15139
15139
  origin: [0, 0, 0]
15140
15140
  };
15141
15141
  const { axis, origin } = Object.assign({}, defaults, options);
@@ -20525,8 +20525,8 @@ ${face[3]}
20525
20525
  input: '?',
20526
20526
  align: 'left',
20527
20527
  font: defaultFont,
20528
- height: 14,
20529
- lineSpacing: 2.142857142857143,
20528
+ height: 14, // == old vector_xxx simplex font height
20529
+ lineSpacing: 2.142857142857143, // == 30/14 == old vector_xxx ratio
20530
20530
  letterSpacing: 1,
20531
20531
  extrudeOffset: 0
20532
20532
  };
@@ -1,67 +1,5 @@
1
- export declare namespace Base {
2
- type Color = string;
3
- type ColorRGB = {
4
- r: number;
5
- g: number;
6
- b: number;
7
- };
8
- type Point2 = [number, number];
9
- type Vector2 = [number, number];
10
- type Point3 = [number, number, number];
11
- type Vector3 = [number, number, number];
12
- type Axis3 = {
13
- origin: Base.Point3;
14
- direction: Base.Vector3;
15
- };
16
- type Axis2 = {
17
- origin: Base.Point2;
18
- direction: Base.Vector2;
19
- };
20
- type Segment2 = [Point2, Point2];
21
- type Segment3 = [Point3, Point3];
22
- type TrianglePlane3 = {
23
- normal: Vector3;
24
- d: number;
25
- };
26
- type Triangle3 = [Base.Point3, Base.Point3, Base.Point3];
27
- type Mesh3 = Triangle3[];
28
- type Plane3 = {
29
- origin: Base.Point3;
30
- normal: Base.Vector3;
31
- direction: Base.Vector3;
32
- };
33
- type BoundingBox = {
34
- min: Base.Point3;
35
- max: Base.Point3;
36
- center?: Base.Point3;
37
- width?: number;
38
- height?: number;
39
- length?: number;
40
- };
41
- type Line2 = {
42
- start: Base.Point2;
43
- end: Base.Point2;
44
- };
45
- type Line3 = {
46
- start: Base.Point3;
47
- end: Base.Point3;
48
- };
49
- type Polyline3 = {
50
- points: Base.Point3[];
51
- isClosed?: boolean;
52
- };
53
- type Polyline2 = {
54
- points: Base.Point2[];
55
- isClosed?: boolean;
56
- };
57
- type VerbCurve = {
58
- tessellate: (options: any) => any;
59
- };
60
- type VerbSurface = {
61
- tessellate: (options: any) => any;
62
- };
63
- type TransformMatrix3x3 = [number, number, number, number, number, number, number, number, number];
64
- type TransformMatrixes3x3 = TransformMatrix3x3[];
65
- type TransformMatrix = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
66
- type TransformMatrixes = TransformMatrix[];
67
- }
1
+ /**
2
+ * Re-export Base namespace from @bitbybit-dev/base.
3
+ * JSCAD package uses the same foundational types without additions.
4
+ */
5
+ export { Base } from "@bitbybit-dev/base";
@@ -1 +1,6 @@
1
- export {};
1
+ /* eslint-disable @typescript-eslint/no-namespace */
2
+ /**
3
+ * Re-export Base namespace from @bitbybit-dev/base.
4
+ * JSCAD package uses the same foundational types without additions.
5
+ */
6
+ export { Base } from "@bitbybit-dev/base";
@@ -1,2 +1,3 @@
1
1
  export * from "./jscad-inputs";
2
+ export * from "./base-inputs";
2
3
  export * from "@bitbybit-dev/base/lib/api/inputs";
@@ -1,2 +1,3 @@
1
1
  export * from "./jscad-inputs";
2
+ export * from "./base-inputs";
2
3
  export * from "@bitbybit-dev/base/lib/api/inputs";
@@ -1,2 +1 @@
1
- export * from "./jscad-inputs";
2
- export * from "./base-inputs";
1
+ export * from "./index";
@@ -1,2 +1,2 @@
1
- export * from "./jscad-inputs";
2
- export * from "./base-inputs";
1
+ // Re-export everything from index for backward compatibility
2
+ export * from "./index";
package/package.json CHANGED
@@ -1,99 +1,98 @@
1
1
  {
2
- "name": "@bitbybit-dev/jscad",
3
- "version": "0.21.1",
4
- "description": "Bit By Bit Developers JSCAD based CAD Library to Program Geometry",
5
- "main": "index.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/bitbybit-dev/bitbybit"
9
- },
10
- "keywords": [
11
- "Bit By Bit Developers",
12
- "bitbybit",
13
- "bitbybit.dev",
14
- "Geometry",
15
- "CAD",
16
- "3D",
17
- "JSCAD",
18
- "OCCT",
19
- "OpenCascade",
20
- "Creative coding",
21
- "CSG",
22
- "Mesh",
23
- "Meshing",
24
- "Manifold",
25
- "Manifold-3D",
26
- "WebGL",
27
- "WebGPU",
28
- "Parametric",
29
- "Modeling",
30
- "Browser CAD",
31
- "3D algorithms",
32
- "3D modeling",
33
- "3D printing",
34
- "3D printing algorithms",
35
- "3D software",
36
- "OpenCascade Technology",
37
- "AEC",
38
- "Automotive",
39
- "Engineering",
40
- "CAE",
41
- "CAM"
42
- ],
43
- "directories": {
44
- "lib": "lib"
45
- },
46
- "scripts": {
47
- "build": "tsc -p tsconfig.bitbybit.json",
48
- "build-p": "npm run build && npm run copy-package && npm run copy-readme && npm run delete-coverage",
49
- "copy-package": "shx cp -R ./package.json ./dist",
50
- "copy-readme": "shx cp -R ./README.md ./dist && shx cp -R ./LICENSE ./dist",
51
- "delete-coverage": "shx rm -rf ./dist/coverage || true",
52
- "test": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --watchAll=true",
53
- "test-c": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=false",
54
- "test-c-l": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=true"
55
- },
56
- "author": "Bit by bit developers",
57
- "license": "MIT",
58
- "types": "./index.d.ts",
59
- "type": "module",
60
- "dependencies": {
61
- "@bitbybit-dev/base": "0.21.1",
62
- "@jscad/io-utils": "2.0.28",
63
- "@jscad/modeling": "2.12.3",
64
- "@jscad/stl-serializer": "2.1.18",
65
- "@jscad/dxf-serializer": "2.1.18",
66
- "@jscad/3mf-serializer": "2.1.12"
67
- },
68
- "devDependencies": {
69
- "shx":"0.4.0",
70
- "sass": "1.57.1",
71
- "@testing-library/jest-dom": "5.14.1",
72
- "mvdir": "1.0.21",
73
- "jest": "29.4.1",
74
- "ts-node": "10.9.1",
75
- "ts-jest": "29.0.0",
76
- "typescript": "4.8.2",
77
- "@types/jest": "29.0.0",
78
- "babel-jest": "29.0.0",
79
- "@babel/core": "7.16.0",
80
- "@babel/preset-env": "7.16.0",
81
- "@babel/preset-typescript": "7.16.0",
82
- "jest-html-reporters": "3.0.11"
83
- },
84
- "jest": {
85
- "preset": "ts-jest",
86
- "transform": {
87
- "\\.[jt]sx?$": "babel-jest"
2
+ "name": "@bitbybit-dev/jscad",
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Bit By Bit Developers JSCAD based CAD Library to Program Geometry",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/bitbybit-dev/bitbybit"
88
9
  },
89
- "extensionsToTreatAsEsm": [
90
- ".ts"
10
+ "keywords": [
11
+ "Bit By Bit Developers",
12
+ "bitbybit",
13
+ "bitbybit.dev",
14
+ "Geometry",
15
+ "CAD",
16
+ "3D",
17
+ "JSCAD",
18
+ "OCCT",
19
+ "OpenCascade",
20
+ "Creative coding",
21
+ "CSG",
22
+ "Mesh",
23
+ "Meshing",
24
+ "Manifold",
25
+ "Manifold-3D",
26
+ "WebGL",
27
+ "WebGPU",
28
+ "Parametric",
29
+ "Modeling",
30
+ "Browser CAD",
31
+ "3D algorithms",
32
+ "3D modeling",
33
+ "3D printing",
34
+ "3D printing algorithms",
35
+ "3D software",
36
+ "OpenCascade Technology",
37
+ "AEC",
38
+ "Automotive",
39
+ "Engineering",
40
+ "CAE",
41
+ "CAM"
91
42
  ],
92
- "transformIgnorePatterns": [
93
- "node_modules/(?!@bitbybit-dev)/"
94
- ],
95
- "collectCoverageFrom": [
96
- "lib/api/**/*"
97
- ]
98
- }
99
- }
43
+ "directories": {
44
+ "lib": "lib"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc -p tsconfig.bitbybit.json",
48
+ "build-p": "npm run build && npm run copy-package && npm run copy-readme && npm run delete-coverage",
49
+ "copy-package": "shx cp -R ./package.json ./dist",
50
+ "copy-readme": "shx cp -R ./README.md ./dist && shx cp -R ./LICENSE ./dist",
51
+ "delete-coverage": "shx rm -rf ./dist/coverage || true",
52
+ "test": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --watchAll=true",
53
+ "test-c": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=false",
54
+ "test-c-l": "set NODE_OPTIONS=--experimental-specifier-resolution=node && jest --coverage --watchAll=true"
55
+ },
56
+ "author": "Bit by bit developers",
57
+ "license": "MIT",
58
+ "types": "./index.d.ts",
59
+ "type": "module",
60
+ "dependencies": {
61
+ "@bitbybit-dev/base": "1.0.0-rc.1",
62
+ "@jscad/io-utils": "2.0.28",
63
+ "@jscad/modeling": "2.12.3",
64
+ "@jscad/stl-serializer": "2.1.18",
65
+ "@jscad/dxf-serializer": "2.1.18",
66
+ "@jscad/3mf-serializer": "2.1.12"
67
+ },
68
+ "devDependencies": {
69
+ "shx": "0.4.0",
70
+ "@testing-library/jest-dom": "6.9.1",
71
+ "mvdir": "1.0.22",
72
+ "jest": "30.2.0",
73
+ "ts-node": "10.9.2",
74
+ "ts-jest": "29.4.6",
75
+ "typescript": "5.9.3",
76
+ "@types/jest": "30.0.0",
77
+ "babel-jest": "30.2.0",
78
+ "@babel/core": "7.28.6",
79
+ "@babel/preset-env": "7.28.6",
80
+ "@babel/preset-typescript": "7.28.5",
81
+ "jest-html-reporters": "3.1.7"
82
+ },
83
+ "jest": {
84
+ "preset": "ts-jest",
85
+ "transform": {
86
+ "\\.[jt]sx?$": "babel-jest"
87
+ },
88
+ "extensionsToTreatAsEsm": [
89
+ ".ts"
90
+ ],
91
+ "transformIgnorePatterns": [
92
+ "node_modules/(?!@bitbybit-dev)/"
93
+ ],
94
+ "collectCoverageFrom": [
95
+ "lib/api/**/*"
96
+ ]
97
+ }
98
+ }