@mylasertools/kerfscript 0.9.0 → 0.11.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 (67) hide show
  1. package/CHANGELOG.md +287 -0
  2. package/LANGUAGE.md +100 -44
  3. package/README.md +2 -1
  4. package/dist/assembly.d.cts +22 -1
  5. package/dist/assembly.d.ts +22 -1
  6. package/dist/bores.d.cts +10 -0
  7. package/dist/bores.d.ts +10 -0
  8. package/dist/cli.js +9977 -6847
  9. package/dist/colors.d.cts +4 -0
  10. package/dist/colors.d.ts +4 -0
  11. package/dist/customizer.d.cts +3 -0
  12. package/dist/customizer.d.ts +3 -0
  13. package/dist/effects.d.cts +31 -0
  14. package/dist/effects.d.ts +31 -0
  15. package/dist/evaluator.d.cts +10 -1
  16. package/dist/evaluator.d.ts +10 -1
  17. package/dist/export/mesh.d.cts +66 -0
  18. package/dist/export/mesh.d.ts +66 -0
  19. package/dist/export/model.d.cts +14 -0
  20. package/dist/export/model.d.ts +14 -0
  21. package/dist/export/pages.d.cts +23 -0
  22. package/dist/export/pages.d.ts +23 -0
  23. package/dist/export/triangulate.d.cts +5 -0
  24. package/dist/export/triangulate.d.ts +5 -0
  25. package/dist/export/zip.d.cts +5 -0
  26. package/dist/export/zip.d.ts +5 -0
  27. package/dist/geometry.d.cts +21 -0
  28. package/dist/geometry.d.ts +21 -0
  29. package/dist/hardware.d.cts +2 -0
  30. package/dist/hardware.d.ts +2 -0
  31. package/dist/highlight.cjs +2 -2
  32. package/dist/highlight.js +2 -2
  33. package/dist/import/dbg.d.cts +1 -0
  34. package/dist/import/dbg.d.ts +1 -0
  35. package/dist/index.cjs +1693 -75
  36. package/dist/index.d.cts +9 -3
  37. package/dist/index.d.ts +9 -3
  38. package/dist/index.js +1693 -75
  39. package/dist/instructions.d.cts +27 -0
  40. package/dist/instructions.d.ts +27 -0
  41. package/dist/language.cjs +1664 -53
  42. package/dist/language.js +1664 -53
  43. package/dist/libraries.cjs +1641 -36
  44. package/dist/libraries.js +1641 -36
  45. package/dist/lights.d.cts +38 -0
  46. package/dist/lights.d.ts +38 -0
  47. package/dist/png.d.cts +14 -0
  48. package/dist/png.d.ts +14 -0
  49. package/dist/render.d.cts +8 -0
  50. package/dist/render.d.ts +8 -0
  51. package/dist/signatures.cjs +98 -9
  52. package/dist/signatures.js +98 -9
  53. package/dist/text.d.cts +29 -0
  54. package/dist/text.d.ts +29 -0
  55. package/dist/verify/types.d.cts +6 -0
  56. package/dist/verify/types.d.ts +6 -0
  57. package/docs/3d-files.md +93 -0
  58. package/docs/cli.md +38 -22
  59. package/docs/customizer.md +69 -0
  60. package/docs/javascript.md +51 -0
  61. package/docs/layers.md +24 -1
  62. package/docs/library.md +574 -16
  63. package/docs/openscad.md +15 -13
  64. package/docs/parts-and-sheets.md +207 -29
  65. package/docs/verification.md +1 -1
  66. package/docs/versions.md +2 -2
  67. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ export declare const PAINT_COLORS: Record<string, string>;
2
+ /** A colour as "#rrggbb": a hex colour as it is (lower case), or one of
3
+ * PAINT_COLORS by name; undefined for anything else */
4
+ export declare function paintColor(v: string): string | undefined;
@@ -0,0 +1,4 @@
1
+ export declare const PAINT_COLORS: Record<string, string>;
2
+ /** A colour as "#rrggbb": a hex colour as it is (lower case), or one of
3
+ * PAINT_COLORS by name; undefined for anything else */
4
+ export declare function paintColor(v: string): string | undefined;
@@ -13,8 +13,11 @@ export interface Parameter {
13
13
  value: number | string;
14
14
  }[];
15
15
  drive?: boolean;
16
+ when?: string;
17
+ whenProblem?: string;
16
18
  span: [number, number];
17
19
  }
18
20
  export declare function parameters(source: string): {
19
21
  parameters: Parameter[];
20
22
  };
23
+ export declare function shown(param: Parameter, values: Record<string, Value>, params: Parameter[]): boolean;
@@ -13,8 +13,11 @@ export interface Parameter {
13
13
  value: number | string;
14
14
  }[];
15
15
  drive?: boolean;
16
+ when?: string;
17
+ whenProblem?: string;
16
18
  span: [number, number];
17
19
  }
18
20
  export declare function parameters(source: string): {
19
21
  parameters: Parameter[];
20
22
  };
23
+ export declare function shown(param: Parameter, values: Record<string, Value>, params: Parameter[]): boolean;
@@ -0,0 +1,31 @@
1
+ import { type RenderOptions } from './render.cjs';
2
+ import type { Value } from './values.cjs';
3
+ export interface SettingEffect {
4
+ name: string;
5
+ /** The values tried, in order */
6
+ tried: Value[];
7
+ /** "files": what is cut changes (the files, the sheets' material and
8
+ * thickness, or the parts list); "view": only the assembled view (its
9
+ * paint, folds and lights too), the steps or the hardware; "nothing": neither; "failed": the program stops
10
+ * at all values but one, or all of them; "skipped": not tried */
11
+ effect: 'files' | 'view' | 'nothing' | 'failed' | 'skipped';
12
+ /** Values tried that give the same files and view: for a range, each
13
+ * run of neighbouring values; for a menu, each group of choices */
14
+ same?: Value[][];
15
+ /** Values the program stops at, with the error */
16
+ errors?: {
17
+ value: Value;
18
+ message: string;
19
+ }[];
20
+ /** Why the setting was not tried */
21
+ reason?: string;
22
+ }
23
+ /** What each setting of the program changes. `samples` is how many values
24
+ * of a range are tried (5). */
25
+ export declare function settingEffects(source: string, options?: RenderOptions, samples?: number): SettingEffect[];
26
+ /** The effects as lines to read, and whether any setting changes nothing
27
+ * or fails */
28
+ export declare function effectsText(effects: SettingEffect[]): {
29
+ lines: string[];
30
+ idle: boolean;
31
+ };
@@ -0,0 +1,31 @@
1
+ import { type RenderOptions } from './render.js';
2
+ import type { Value } from './values.js';
3
+ export interface SettingEffect {
4
+ name: string;
5
+ /** The values tried, in order */
6
+ tried: Value[];
7
+ /** "files": what is cut changes (the files, the sheets' material and
8
+ * thickness, or the parts list); "view": only the assembled view (its
9
+ * paint, folds and lights too), the steps or the hardware; "nothing": neither; "failed": the program stops
10
+ * at all values but one, or all of them; "skipped": not tried */
11
+ effect: 'files' | 'view' | 'nothing' | 'failed' | 'skipped';
12
+ /** Values tried that give the same files and view: for a range, each
13
+ * run of neighbouring values; for a menu, each group of choices */
14
+ same?: Value[][];
15
+ /** Values the program stops at, with the error */
16
+ errors?: {
17
+ value: Value;
18
+ message: string;
19
+ }[];
20
+ /** Why the setting was not tried */
21
+ reason?: string;
22
+ }
23
+ /** What each setting of the program changes. `samples` is how many values
24
+ * of a range are tried (5). */
25
+ export declare function settingEffects(source: string, options?: RenderOptions, samples?: number): SettingEffect[];
26
+ /** The effects as lines to read, and whether any setting changes nothing
27
+ * or fails */
28
+ export declare function effectsText(effects: SettingEffect[]): {
29
+ lines: string[];
30
+ idle: boolean;
31
+ };
@@ -2,12 +2,13 @@ import type { Expr, Param, Program, Stmt } from './ast.cjs';
2
2
  import { type Shape } from './geometry.cjs';
3
3
  import { type Vec3 } from './assembly.cjs';
4
4
  import { type Pos } from './lexer.cjs';
5
+ import { type Light } from './lights.cjs';
5
6
  import { type FontBook } from './text.cjs';
6
7
  import { type Closure, type Value } from './values.cjs';
7
8
  export declare const MAX_HARDWARE_SIDES = 128;
8
9
  export interface LayerDef {
9
10
  name: string;
10
- mode: 'cut' | 'line' | 'fill' | 'guide';
11
+ mode: 'cut' | 'line' | 'fill' | 'guide' | 'paint';
11
12
  color: string;
12
13
  side?: 'back';
13
14
  order?: number;
@@ -22,6 +23,7 @@ export interface HardwareItem {
22
23
  sides: number;
23
24
  step: number;
24
25
  label?: string;
26
+ mass?: number;
25
27
  }
26
28
  export declare const DEFAULT_LAYERS: LayerDef[];
27
29
  export interface EvalOptions {
@@ -96,6 +98,7 @@ export interface EvalResult {
96
98
  echoes: string[];
97
99
  warnings: string[];
98
100
  hardware: HardwareItem[];
101
+ lights: Light[];
99
102
  steps: string[];
100
103
  }
101
104
  export declare const STDLIB: Record<string, string>;
@@ -110,11 +113,13 @@ export declare class Evaluator {
110
113
  private itemCount;
111
114
  private retained;
112
115
  private copies;
116
+ private layerDefs;
113
117
  private frame;
114
118
  private step;
115
119
  readonly stepNames: string[];
116
120
  private stepFolded;
117
121
  readonly hardware: HardwareItem[];
122
+ readonly lights: Light[];
118
123
  readonly echoes: string[];
119
124
  readonly warnings: string[];
120
125
  readonly layers: Map<string, LayerDef>;
@@ -128,6 +133,7 @@ export declare class Evaluator {
128
133
  private clashed;
129
134
  private clash;
130
135
  private childCache;
136
+ private copyReads;
131
137
  private childKey;
132
138
  private effects;
133
139
  private unscaled?;
@@ -179,11 +185,14 @@ export declare class Evaluator {
179
185
  private checkSize;
180
186
  private segs;
181
187
  private thickness;
188
+ private kerf;
182
189
  private fingerWidth;
183
190
  private measure;
184
191
  private textOpts;
192
+ private textBlock;
185
193
  private edges;
186
194
  private backLayer;
195
+ private folds;
187
196
  private bends;
188
197
  private makeBuiltins;
189
198
  }
@@ -2,12 +2,13 @@ import type { Expr, Param, Program, Stmt } from './ast.js';
2
2
  import { type Shape } from './geometry.js';
3
3
  import { type Vec3 } from './assembly.js';
4
4
  import { type Pos } from './lexer.js';
5
+ import { type Light } from './lights.js';
5
6
  import { type FontBook } from './text.js';
6
7
  import { type Closure, type Value } from './values.js';
7
8
  export declare const MAX_HARDWARE_SIDES = 128;
8
9
  export interface LayerDef {
9
10
  name: string;
10
- mode: 'cut' | 'line' | 'fill' | 'guide';
11
+ mode: 'cut' | 'line' | 'fill' | 'guide' | 'paint';
11
12
  color: string;
12
13
  side?: 'back';
13
14
  order?: number;
@@ -22,6 +23,7 @@ export interface HardwareItem {
22
23
  sides: number;
23
24
  step: number;
24
25
  label?: string;
26
+ mass?: number;
25
27
  }
26
28
  export declare const DEFAULT_LAYERS: LayerDef[];
27
29
  export interface EvalOptions {
@@ -96,6 +98,7 @@ export interface EvalResult {
96
98
  echoes: string[];
97
99
  warnings: string[];
98
100
  hardware: HardwareItem[];
101
+ lights: Light[];
99
102
  steps: string[];
100
103
  }
101
104
  export declare const STDLIB: Record<string, string>;
@@ -110,11 +113,13 @@ export declare class Evaluator {
110
113
  private itemCount;
111
114
  private retained;
112
115
  private copies;
116
+ private layerDefs;
113
117
  private frame;
114
118
  private step;
115
119
  readonly stepNames: string[];
116
120
  private stepFolded;
117
121
  readonly hardware: HardwareItem[];
122
+ readonly lights: Light[];
118
123
  readonly echoes: string[];
119
124
  readonly warnings: string[];
120
125
  readonly layers: Map<string, LayerDef>;
@@ -128,6 +133,7 @@ export declare class Evaluator {
128
133
  private clashed;
129
134
  private clash;
130
135
  private childCache;
136
+ private copyReads;
131
137
  private childKey;
132
138
  private effects;
133
139
  private unscaled?;
@@ -179,11 +185,14 @@ export declare class Evaluator {
179
185
  private checkSize;
180
186
  private segs;
181
187
  private thickness;
188
+ private kerf;
182
189
  private fingerWidth;
183
190
  private measure;
184
191
  private textOpts;
192
+ private textBlock;
185
193
  private edges;
186
194
  private backLayer;
195
+ private folds;
187
196
  private bends;
188
197
  private makeBuiltins;
189
198
  }
@@ -0,0 +1,66 @@
1
+ import { type AssemblyPart } from '../assembly.cjs';
2
+ import type { HardwareItem } from '../evaluator.cjs';
3
+ import type { Light } from '../lights.cjs';
4
+ export interface Body {
5
+ /** "Lid", "Lid engrave", "dowel" */
6
+ name: string;
7
+ kind: 'part' | 'mark' | 'hardware';
8
+ /** The part a part or mark body belongs to, which copy, and which
9
+ * placed part (the same number for a part and its marks) */
10
+ part?: string;
11
+ copy?: number;
12
+ instance?: number;
13
+ /** The material, as $material or a hardware kind, or the mark's layer */
14
+ material: string;
15
+ /** #rrggbb */
16
+ color: string;
17
+ metal?: boolean;
18
+ clear?: boolean;
19
+ /** Lets light through without being clear, as vellum or frosted acrylic */
20
+ translucent?: boolean;
21
+ /** Gives off light, as an LED or a flame */
22
+ glow?: boolean;
23
+ /** x, y, z of each vertex, in millimetres, z up */
24
+ positions: number[];
25
+ /** Three vertex indices per triangle, counter-clockwise seen from outside */
26
+ indices: number[];
27
+ }
28
+ export interface MeshOptions {
29
+ /** "assembled" puts each part where the program places it; "flat" lays
30
+ * them side by side on the bed, front face up; "print" lays them out
31
+ * as "flat" does, but each part with everything glued on it as one
32
+ * object, its layers where the assembly has them */
33
+ layout?: 'assembled' | 'flat' | 'print';
34
+ /** How far engraving and scoring stand off the face, in mm; 0 leaves
35
+ * them out */
36
+ markHeight?: number;
37
+ /** How wide a score line is drawn, in mm */
38
+ lineWidth?: number;
39
+ /** Hardware from hardware(), in the assembled layout */
40
+ hardware?: boolean;
41
+ /** Space between parts laid flat, in mm */
42
+ gap?: number;
43
+ /** How wide a cut inside a part (a living hinge's slits) is opened, in mm */
44
+ slitWidth?: number;
45
+ }
46
+ export interface MeshSource {
47
+ assembly: AssemblyPart[];
48
+ /** Every part flat, for the flat layout and for a model nothing places */
49
+ flat?: AssemblyPart[];
50
+ hardware?: HardwareItem[];
51
+ /** Light sources, from tealights, LEDs, bulbs and light() */
52
+ lights?: Light[];
53
+ /** The layers, to tell cuts inside a part from marks on it */
54
+ layers?: {
55
+ name: string;
56
+ mode: string;
57
+ }[];
58
+ }
59
+ /** The colour a 3D view gives a sheet material: a #rrggbb in its name,
60
+ * else one for a wood, sheet or colour named in it, else a light wood */
61
+ export declare function materialColor(material: string): string;
62
+ /** Whether a sheet material lets light through without being clear:
63
+ * vellum, tracing paper, parchment, rice paper, frosted acrylic, paper */
64
+ export declare const isTranslucent: (material: string) => boolean;
65
+ /** The model as solid bodies, for the 3D file writers */
66
+ export declare function meshBodies(source: MeshSource, options?: MeshOptions): Body[];
@@ -0,0 +1,66 @@
1
+ import { type AssemblyPart } from '../assembly.js';
2
+ import type { HardwareItem } from '../evaluator.js';
3
+ import type { Light } from '../lights.js';
4
+ export interface Body {
5
+ /** "Lid", "Lid engrave", "dowel" */
6
+ name: string;
7
+ kind: 'part' | 'mark' | 'hardware';
8
+ /** The part a part or mark body belongs to, which copy, and which
9
+ * placed part (the same number for a part and its marks) */
10
+ part?: string;
11
+ copy?: number;
12
+ instance?: number;
13
+ /** The material, as $material or a hardware kind, or the mark's layer */
14
+ material: string;
15
+ /** #rrggbb */
16
+ color: string;
17
+ metal?: boolean;
18
+ clear?: boolean;
19
+ /** Lets light through without being clear, as vellum or frosted acrylic */
20
+ translucent?: boolean;
21
+ /** Gives off light, as an LED or a flame */
22
+ glow?: boolean;
23
+ /** x, y, z of each vertex, in millimetres, z up */
24
+ positions: number[];
25
+ /** Three vertex indices per triangle, counter-clockwise seen from outside */
26
+ indices: number[];
27
+ }
28
+ export interface MeshOptions {
29
+ /** "assembled" puts each part where the program places it; "flat" lays
30
+ * them side by side on the bed, front face up; "print" lays them out
31
+ * as "flat" does, but each part with everything glued on it as one
32
+ * object, its layers where the assembly has them */
33
+ layout?: 'assembled' | 'flat' | 'print';
34
+ /** How far engraving and scoring stand off the face, in mm; 0 leaves
35
+ * them out */
36
+ markHeight?: number;
37
+ /** How wide a score line is drawn, in mm */
38
+ lineWidth?: number;
39
+ /** Hardware from hardware(), in the assembled layout */
40
+ hardware?: boolean;
41
+ /** Space between parts laid flat, in mm */
42
+ gap?: number;
43
+ /** How wide a cut inside a part (a living hinge's slits) is opened, in mm */
44
+ slitWidth?: number;
45
+ }
46
+ export interface MeshSource {
47
+ assembly: AssemblyPart[];
48
+ /** Every part flat, for the flat layout and for a model nothing places */
49
+ flat?: AssemblyPart[];
50
+ hardware?: HardwareItem[];
51
+ /** Light sources, from tealights, LEDs, bulbs and light() */
52
+ lights?: Light[];
53
+ /** The layers, to tell cuts inside a part from marks on it */
54
+ layers?: {
55
+ name: string;
56
+ mode: string;
57
+ }[];
58
+ }
59
+ /** The colour a 3D view gives a sheet material: a #rrggbb in its name,
60
+ * else one for a wood, sheet or colour named in it, else a light wood */
61
+ export declare function materialColor(material: string): string;
62
+ /** Whether a sheet material lets light through without being clear:
63
+ * vellum, tracing paper, parchment, rice paper, frosted acrylic, paper */
64
+ export declare const isTranslucent: (material: string) => boolean;
65
+ /** The model as solid bodies, for the 3D file writers */
66
+ export declare function meshBodies(source: MeshSource, options?: MeshOptions): Body[];
@@ -0,0 +1,14 @@
1
+ import { type Body, type MeshOptions, type MeshSource } from './mesh.cjs';
2
+ import { type Light } from '../lights.cjs';
3
+ export type ModelFormat = 'glb' | '3mf' | 'stl';
4
+ /** Binary STL of all the bodies as one mesh, in millimetres */
5
+ export declare function toStl(bodies: Body[]): Uint8Array;
6
+ /** A 3MF package in millimetres: each part one object, its engraving and
7
+ * scoring coloured parts of it, so a slicer prints them in their colours */
8
+ export declare function to3mf(bodies: Body[]): Uint8Array;
9
+ /** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
10
+ * y up as glTF has it; each node's extras give its kind, part and copy.
11
+ * Lights become point lights (KHR_lights_punctual), a strip several. */
12
+ export declare function toGlb(bodies: Body[], lights?: Light[]): Uint8Array;
13
+ /** The model as a 3D file: "glb", "3mf" or "stl" */
14
+ export declare function toModel(source: MeshSource, format: ModelFormat, options?: MeshOptions): Uint8Array;
@@ -0,0 +1,14 @@
1
+ import { type Body, type MeshOptions, type MeshSource } from './mesh.js';
2
+ import { type Light } from '../lights.js';
3
+ export type ModelFormat = 'glb' | '3mf' | 'stl';
4
+ /** Binary STL of all the bodies as one mesh, in millimetres */
5
+ export declare function toStl(bodies: Body[]): Uint8Array;
6
+ /** A 3MF package in millimetres: each part one object, its engraving and
7
+ * scoring coloured parts of it, so a slicer prints them in their colours */
8
+ export declare function to3mf(bodies: Body[]): Uint8Array;
9
+ /** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
10
+ * y up as glTF has it; each node's extras give its kind, part and copy.
11
+ * Lights become point lights (KHR_lights_punctual), a strip several. */
12
+ export declare function toGlb(bodies: Body[], lights?: Light[]): Uint8Array;
13
+ /** The model as a 3D file: "glb", "3mf" or "stl" */
14
+ export declare function toModel(source: MeshSource, format: ModelFormat, options?: MeshOptions): Uint8Array;
@@ -0,0 +1,23 @@
1
+ import type { RenderResult } from '../render.cjs';
2
+ import { type FontBook } from '../text.cjs';
3
+ type Ring = [number, number][];
4
+ /** Something drawn on a page, in points from its top left, y down: filled
5
+ * rings (even-odd), or with no fill a line `width` wide through them */
6
+ export interface PageItem {
7
+ rings: Ring[];
8
+ fill: string;
9
+ stroke: string;
10
+ width: number;
11
+ }
12
+ export interface Page {
13
+ w: number;
14
+ h: number;
15
+ items: PageItem[];
16
+ }
17
+ /** The instructions as pages */
18
+ export declare function instructionPages(r: RenderResult, title: string, fonts: FontBook): Page[];
19
+ /** Pages as a PDF: filled vector paths, the text as the font's outlines */
20
+ export declare function pagesPdf(pages: Page[]): Uint8Array;
21
+ /** A page as a PNG `width` pixels wide */
22
+ export declare function pagePng(page: Page, width?: number): Uint8Array;
23
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { RenderResult } from '../render.js';
2
+ import { type FontBook } from '../text.js';
3
+ type Ring = [number, number][];
4
+ /** Something drawn on a page, in points from its top left, y down: filled
5
+ * rings (even-odd), or with no fill a line `width` wide through them */
6
+ export interface PageItem {
7
+ rings: Ring[];
8
+ fill: string;
9
+ stroke: string;
10
+ width: number;
11
+ }
12
+ export interface Page {
13
+ w: number;
14
+ h: number;
15
+ items: PageItem[];
16
+ }
17
+ /** The instructions as pages */
18
+ export declare function instructionPages(r: RenderResult, title: string, fonts: FontBook): Page[];
19
+ /** Pages as a PDF: filled vector paths, the text as the font's outlines */
20
+ export declare function pagesPdf(pages: Page[]): Uint8Array;
21
+ /** A page as a PNG `width` pixels wide */
22
+ export declare function pagePng(page: Page, width?: number): Uint8Array;
23
+ export {};
@@ -0,0 +1,5 @@
1
+ type Pt = [number, number];
2
+ /** Triangles of an outline with holes, as index triples into the
3
+ * outline's points followed by each hole's, turning counter-clockwise */
4
+ export declare function triangulate(outer: Pt[], holes?: Pt[][]): [number, number, number][];
5
+ export {};
@@ -0,0 +1,5 @@
1
+ type Pt = [number, number];
2
+ /** Triangles of an outline with holes, as index triples into the
3
+ * outline's points followed by each hole's, turning counter-clockwise */
4
+ export declare function triangulate(outer: Pt[], holes?: Pt[][]): [number, number, number][];
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /** A zip archive holding the files, uncompressed */
2
+ export declare function zip(files: {
3
+ name: string;
4
+ data: Uint8Array;
5
+ }[]): Uint8Array;
@@ -0,0 +1,5 @@
1
+ /** A zip archive holding the files, uncompressed */
2
+ export declare function zip(files: {
3
+ name: string;
4
+ data: Uint8Array;
5
+ }[]): Uint8Array;
@@ -13,9 +13,18 @@ export interface PartShape {
13
13
  thickness: number;
14
14
  kerf: number;
15
15
  material: string;
16
+ paint?: string;
17
+ pieces?: number | 'any';
16
18
  placements?: Placement[];
17
19
  stack?: number;
18
20
  bends?: Bend[];
21
+ folds?: Fold[];
22
+ split?: true | [number, number];
23
+ joins?: string[];
24
+ hang?: {
25
+ at: Pt;
26
+ cord: number;
27
+ };
19
28
  on?: string;
20
29
  slots?: string[];
21
30
  clearance?: number;
@@ -28,13 +37,24 @@ export interface PartShape {
28
37
  host: string;
29
38
  face: 'top' | 'bottom';
30
39
  };
40
+ pressFit?: boolean;
31
41
  mirrored?: boolean;
32
42
  copies?: number[];
43
+ layerOf?: {
44
+ part: PartShape;
45
+ k: number;
46
+ };
47
+ }
48
+ export interface Fold {
49
+ from: Pt;
50
+ to: Pt;
51
+ angle: number;
33
52
  }
34
53
  export interface Bend {
35
54
  x0: number;
36
55
  x1: number;
37
56
  angle: number;
57
+ mirrored?: boolean;
38
58
  }
39
59
  export interface Shape {
40
60
  layers: Map<string, Layer>;
@@ -53,6 +73,7 @@ export declare function clipLines(lines: Poly[], region: Poly[], keep: 'inside'
53
73
  export declare function offset(regions: Poly[], delta: number, join?: 'round' | 'miter' | 'square', arcTolerance?: number): Poly[];
54
74
  export declare function strokeLines(lines: Poly[], width: number): Poly[];
55
75
  export declare function pieces(regions: Poly[]): Poly[][];
76
+ export declare function cutOrder(rings: Poly[]): number[];
56
77
  export declare function area(p: Poly): number;
57
78
  /** The area of regions (holes counting against it) and their centroid. */
58
79
  export declare function regionMoments(regions: Poly[]): {
@@ -13,9 +13,18 @@ export interface PartShape {
13
13
  thickness: number;
14
14
  kerf: number;
15
15
  material: string;
16
+ paint?: string;
17
+ pieces?: number | 'any';
16
18
  placements?: Placement[];
17
19
  stack?: number;
18
20
  bends?: Bend[];
21
+ folds?: Fold[];
22
+ split?: true | [number, number];
23
+ joins?: string[];
24
+ hang?: {
25
+ at: Pt;
26
+ cord: number;
27
+ };
19
28
  on?: string;
20
29
  slots?: string[];
21
30
  clearance?: number;
@@ -28,13 +37,24 @@ export interface PartShape {
28
37
  host: string;
29
38
  face: 'top' | 'bottom';
30
39
  };
40
+ pressFit?: boolean;
31
41
  mirrored?: boolean;
32
42
  copies?: number[];
43
+ layerOf?: {
44
+ part: PartShape;
45
+ k: number;
46
+ };
47
+ }
48
+ export interface Fold {
49
+ from: Pt;
50
+ to: Pt;
51
+ angle: number;
33
52
  }
34
53
  export interface Bend {
35
54
  x0: number;
36
55
  x1: number;
37
56
  angle: number;
57
+ mirrored?: boolean;
38
58
  }
39
59
  export interface Shape {
40
60
  layers: Map<string, Layer>;
@@ -53,6 +73,7 @@ export declare function clipLines(lines: Poly[], region: Poly[], keep: 'inside'
53
73
  export declare function offset(regions: Poly[], delta: number, join?: 'round' | 'miter' | 'square', arcTolerance?: number): Poly[];
54
74
  export declare function strokeLines(lines: Poly[], width: number): Poly[];
55
75
  export declare function pieces(regions: Poly[]): Poly[][];
76
+ export declare function cutOrder(rings: Poly[]): number[];
56
77
  export declare function area(p: Poly): number;
57
78
  /** The area of regions (holes counting against it) and their centroid. */
58
79
  export declare function regionMoments(regions: Poly[]): {
@@ -5,6 +5,8 @@ export interface HardwareKind {
5
5
  metal?: boolean;
6
6
  /** Gives off light, as an LED */
7
7
  glow?: boolean;
8
+ /** Lets light through, as vellum: translucent in the 3D view */
9
+ translucent?: boolean;
8
10
  /** What it is, for the docs */
9
11
  doc: string;
10
12
  }
@@ -5,6 +5,8 @@ export interface HardwareKind {
5
5
  metal?: boolean;
6
6
  /** Gives off light, as an LED */
7
7
  glow?: boolean;
8
+ /** Lets light through, as vellum: translucent in the 3D view */
9
+ translucent?: boolean;
8
10
  /** What it is, for the docs */
9
11
  doc: string;
10
12
  }
@@ -43,14 +43,14 @@ var KEYWORDS = /* @__PURE__ */ new Set([
43
43
  var CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "undef", "PI"]);
44
44
  var LAYERS = /* @__PURE__ */ new Set(["cut", "score", "engrave", "guide", "layer"]);
45
45
  var BUILTINS = new Set(
46
- "rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics finger_count".split(" ")
46
+ "rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware light material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip wall cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect heart teardrop egg lens crescent capsule diamond rounded_polygon shield arrow chevron banner house tag ring scalloped flower cloud speech_bubble stand stand_tabs stand_slots figure figure_layer figure_parts figure_shapes figure_details drawers layered ball inlaid scene_rails scene_floor standee scene_figure figure_base drip_edge wave_edge abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics text_size finger_count".split(" ")
47
47
  );
48
48
  var NUMBER = /(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:(?:mm|cm|m|in|ft)(?![A-Za-z0-9_]))?/y;
49
49
  var WORD = /\$?[A-Za-z_][A-Za-z0-9_]*/y;
50
50
  var CALL = /\s*\(/y;
51
51
  var PATH = /<[^>]*>?/y;
52
52
  var SECTION = /\/\*\s*\[[^\]]*\]\s*\*\//y;
53
- var CONTROL = /\/\/\s*\[[^\]]*\]\s*$/y;
53
+ var CONTROL = /\/\/\s*\[[^\]]*\](?:\s+drive)?(?:\s+when\s.*)?\s*$/y;
54
54
  var MODIFIER = /[*#%](?=\s*[A-Za-z_$])/y;
55
55
  var at = (re, line, i) => {
56
56
  re.lastIndex = i;
package/dist/highlight.js CHANGED
@@ -16,14 +16,14 @@ var KEYWORDS = /* @__PURE__ */ new Set([
16
16
  var CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "undef", "PI"]);
17
17
  var LAYERS = /* @__PURE__ */ new Set(["cut", "score", "engrave", "guide", "layer"]);
18
18
  var BUILTINS = new Set(
19
- "rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics finger_count".split(" ")
19
+ "rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware light material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip wall cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect heart teardrop egg lens crescent capsule diamond rounded_polygon shield arrow chevron banner house tag ring scalloped flower cloud speech_bubble stand stand_tabs stand_slots figure figure_layer figure_parts figure_shapes figure_details drawers layered ball inlaid scene_rails scene_floor standee scene_figure figure_base drip_edge wave_edge abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics text_size finger_count".split(" ")
20
20
  );
21
21
  var NUMBER = /(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:(?:mm|cm|m|in|ft)(?![A-Za-z0-9_]))?/y;
22
22
  var WORD = /\$?[A-Za-z_][A-Za-z0-9_]*/y;
23
23
  var CALL = /\s*\(/y;
24
24
  var PATH = /<[^>]*>?/y;
25
25
  var SECTION = /\/\*\s*\[[^\]]*\]\s*\*\//y;
26
- var CONTROL = /\/\/\s*\[[^\]]*\]\s*$/y;
26
+ var CONTROL = /\/\/\s*\[[^\]]*\](?:\s+drive)?(?:\s+when\s.*)?\s*$/y;
27
27
  var MODIFIER = /[*#%](?=\s*[A-Za-z_$])/y;
28
28
  var at = (re, line, i) => {
29
29
  re.lastIndex = i;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};