@mylasertools/kerfscript 0.8.0 → 0.10.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 (60) hide show
  1. package/CHANGELOG.md +157 -0
  2. package/LANGUAGE.md +200 -84
  3. package/README.md +4 -3
  4. package/dist/assembly.d.cts +4 -1
  5. package/dist/assembly.d.ts +4 -1
  6. package/dist/ast.d.cts +6 -0
  7. package/dist/ast.d.ts +6 -0
  8. package/dist/bores.d.cts +15 -0
  9. package/dist/bores.d.ts +15 -0
  10. package/dist/cli.js +8959 -6064
  11. package/dist/customizer.d.cts +4 -0
  12. package/dist/customizer.d.ts +4 -0
  13. package/dist/effects.d.cts +31 -0
  14. package/dist/effects.d.ts +31 -0
  15. package/dist/evaluator.d.cts +10 -0
  16. package/dist/evaluator.d.ts +10 -0
  17. package/dist/export/mesh.d.cts +53 -0
  18. package/dist/export/mesh.d.ts +53 -0
  19. package/dist/export/model.d.cts +12 -0
  20. package/dist/export/model.d.ts +12 -0
  21. package/dist/export/triangulate.d.cts +5 -0
  22. package/dist/export/triangulate.d.ts +5 -0
  23. package/dist/export/zip.d.cts +5 -0
  24. package/dist/export/zip.d.ts +5 -0
  25. package/dist/functions.d.cts +2 -0
  26. package/dist/functions.d.ts +2 -0
  27. package/dist/geometry.d.cts +7 -0
  28. package/dist/geometry.d.ts +7 -0
  29. package/dist/halving.d.cts +8 -0
  30. package/dist/halving.d.ts +8 -0
  31. package/dist/highlight.cjs +3 -2
  32. package/dist/highlight.js +3 -2
  33. package/dist/import/dbg.d.cts +1 -0
  34. package/dist/import/dbg.d.ts +1 -0
  35. package/dist/index.cjs +522 -56
  36. package/dist/index.d.cts +6 -2
  37. package/dist/index.d.ts +6 -2
  38. package/dist/index.js +522 -56
  39. package/dist/language.cjs +495 -36
  40. package/dist/language.js +495 -36
  41. package/dist/libraries.cjs +474 -16
  42. package/dist/libraries.js +474 -16
  43. package/dist/plot.d.cts +16 -0
  44. package/dist/plot.d.ts +16 -0
  45. package/dist/render.d.cts +3 -0
  46. package/dist/render.d.ts +3 -0
  47. package/dist/signatures.cjs +182 -5
  48. package/dist/signatures.js +182 -5
  49. package/dist/text.d.cts +6 -0
  50. package/dist/text.d.ts +6 -0
  51. package/docs/3d-files.md +72 -0
  52. package/docs/cli.md +27 -21
  53. package/docs/compatibility.md +0 -8
  54. package/docs/customizer.md +74 -0
  55. package/docs/javascript.md +46 -0
  56. package/docs/library.md +162 -1
  57. package/docs/openscad.md +15 -13
  58. package/docs/parts-and-sheets.md +57 -1
  59. package/docs/versions.md +2 -2
  60. package/package.json +1 -1
@@ -12,8 +12,12 @@ export interface Parameter {
12
12
  name: string;
13
13
  value: number | string;
14
14
  }[];
15
+ drive?: boolean;
16
+ when?: string;
17
+ whenProblem?: string;
15
18
  span: [number, number];
16
19
  }
17
20
  export declare function parameters(source: string): {
18
21
  parameters: Parameter[];
19
22
  };
23
+ export declare function shown(param: Parameter, values: Record<string, Value>, params: Parameter[]): boolean;
@@ -12,8 +12,12 @@ export interface Parameter {
12
12
  name: string;
13
13
  value: number | string;
14
14
  }[];
15
+ drive?: boolean;
16
+ when?: string;
17
+ whenProblem?: string;
15
18
  span: [number, number];
16
19
  }
17
20
  export declare function parameters(source: string): {
18
21
  parameters: Parameter[];
19
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, the
9
+ * 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, the
9
+ * 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
+ };
@@ -48,15 +48,19 @@ interface ModDef {
48
48
  params: Param[];
49
49
  body: Stmt[];
50
50
  env: Env;
51
+ pos?: Pos;
51
52
  }
52
53
  interface FnDef {
53
54
  params: Param[];
54
55
  body: Expr;
55
56
  env: Env;
57
+ pos?: Pos;
56
58
  }
57
59
  interface ChildCtx {
58
60
  stmts: Stmt[];
59
61
  env: Env;
62
+ module?: string;
63
+ pos?: Pos;
60
64
  }
61
65
  declare class Env {
62
66
  parent?: Env | undefined;
@@ -99,11 +103,14 @@ export declare class Evaluator {
99
103
  private opts;
100
104
  private steps;
101
105
  private depth;
106
+ private occluding;
102
107
  private maxSteps;
103
108
  readonly limits: Limits;
104
109
  private pointCount;
105
110
  private itemCount;
111
+ private retained;
106
112
  private copies;
113
+ private layerDefs;
107
114
  private frame;
108
115
  private step;
109
116
  readonly stepNames: string[];
@@ -119,6 +126,8 @@ export declare class Evaluator {
119
126
  private tick;
120
127
  private load;
121
128
  private hoist;
129
+ private clashed;
130
+ private clash;
122
131
  private childCache;
123
132
  private childKey;
124
133
  private effects;
@@ -158,6 +167,7 @@ export declare class Evaluator {
158
167
  private echo;
159
168
  private echoText;
160
169
  private arith;
170
+ private fieldFn;
161
171
  private arg;
162
172
  private num;
163
173
  private vec2;
@@ -48,15 +48,19 @@ interface ModDef {
48
48
  params: Param[];
49
49
  body: Stmt[];
50
50
  env: Env;
51
+ pos?: Pos;
51
52
  }
52
53
  interface FnDef {
53
54
  params: Param[];
54
55
  body: Expr;
55
56
  env: Env;
57
+ pos?: Pos;
56
58
  }
57
59
  interface ChildCtx {
58
60
  stmts: Stmt[];
59
61
  env: Env;
62
+ module?: string;
63
+ pos?: Pos;
60
64
  }
61
65
  declare class Env {
62
66
  parent?: Env | undefined;
@@ -99,11 +103,14 @@ export declare class Evaluator {
99
103
  private opts;
100
104
  private steps;
101
105
  private depth;
106
+ private occluding;
102
107
  private maxSteps;
103
108
  readonly limits: Limits;
104
109
  private pointCount;
105
110
  private itemCount;
111
+ private retained;
106
112
  private copies;
113
+ private layerDefs;
107
114
  private frame;
108
115
  private step;
109
116
  readonly stepNames: string[];
@@ -119,6 +126,8 @@ export declare class Evaluator {
119
126
  private tick;
120
127
  private load;
121
128
  private hoist;
129
+ private clashed;
130
+ private clash;
122
131
  private childCache;
123
132
  private childKey;
124
133
  private effects;
@@ -158,6 +167,7 @@ export declare class Evaluator {
158
167
  private echo;
159
168
  private echoText;
160
169
  private arith;
170
+ private fieldFn;
161
171
  private arg;
162
172
  private num;
163
173
  private vec2;
@@ -0,0 +1,53 @@
1
+ import { type AssemblyPart } from '../assembly.cjs';
2
+ import type { HardwareItem } from '../evaluator.cjs';
3
+ export interface Body {
4
+ /** "Lid", "Lid engrave", "dowel" */
5
+ name: string;
6
+ kind: 'part' | 'mark' | 'hardware';
7
+ /** The part a part or mark body belongs to, which copy, and which
8
+ * placed part (the same number for a part and its marks) */
9
+ part?: string;
10
+ copy?: number;
11
+ instance?: number;
12
+ /** The material, as $material or a hardware kind, or the mark's layer */
13
+ material: string;
14
+ /** #rrggbb */
15
+ color: string;
16
+ metal?: boolean;
17
+ clear?: boolean;
18
+ /** x, y, z of each vertex, in millimetres, z up */
19
+ positions: number[];
20
+ /** Three vertex indices per triangle, counter-clockwise seen from outside */
21
+ indices: number[];
22
+ }
23
+ export interface MeshOptions {
24
+ /** "assembled" puts each part where the program places it; "flat" lays
25
+ * them side by side on the bed, front face up, as for printing */
26
+ layout?: 'assembled' | 'flat';
27
+ /** How far engraving and scoring stand off the face, in mm; 0 leaves
28
+ * them out */
29
+ markHeight?: number;
30
+ /** How wide a score line is drawn, in mm */
31
+ lineWidth?: number;
32
+ /** Hardware from hardware(), in the assembled layout */
33
+ hardware?: boolean;
34
+ /** Space between parts laid flat, in mm */
35
+ gap?: number;
36
+ /** How wide a cut inside a part (a living hinge's slits) is opened, in mm */
37
+ slitWidth?: number;
38
+ }
39
+ export interface MeshSource {
40
+ assembly: AssemblyPart[];
41
+ /** Every part flat, for the flat layout and for a model nothing places */
42
+ flat?: AssemblyPart[];
43
+ hardware?: HardwareItem[];
44
+ /** The layers, to tell cuts inside a part from marks on it */
45
+ layers?: {
46
+ name: string;
47
+ mode: string;
48
+ }[];
49
+ }
50
+ /** The colour a 3D view gives a sheet material */
51
+ export declare function materialColor(material: string): string;
52
+ /** The model as solid bodies, for the 3D file writers */
53
+ export declare function meshBodies(source: MeshSource, options?: MeshOptions): Body[];
@@ -0,0 +1,53 @@
1
+ import { type AssemblyPart } from '../assembly.js';
2
+ import type { HardwareItem } from '../evaluator.js';
3
+ export interface Body {
4
+ /** "Lid", "Lid engrave", "dowel" */
5
+ name: string;
6
+ kind: 'part' | 'mark' | 'hardware';
7
+ /** The part a part or mark body belongs to, which copy, and which
8
+ * placed part (the same number for a part and its marks) */
9
+ part?: string;
10
+ copy?: number;
11
+ instance?: number;
12
+ /** The material, as $material or a hardware kind, or the mark's layer */
13
+ material: string;
14
+ /** #rrggbb */
15
+ color: string;
16
+ metal?: boolean;
17
+ clear?: boolean;
18
+ /** x, y, z of each vertex, in millimetres, z up */
19
+ positions: number[];
20
+ /** Three vertex indices per triangle, counter-clockwise seen from outside */
21
+ indices: number[];
22
+ }
23
+ export interface MeshOptions {
24
+ /** "assembled" puts each part where the program places it; "flat" lays
25
+ * them side by side on the bed, front face up, as for printing */
26
+ layout?: 'assembled' | 'flat';
27
+ /** How far engraving and scoring stand off the face, in mm; 0 leaves
28
+ * them out */
29
+ markHeight?: number;
30
+ /** How wide a score line is drawn, in mm */
31
+ lineWidth?: number;
32
+ /** Hardware from hardware(), in the assembled layout */
33
+ hardware?: boolean;
34
+ /** Space between parts laid flat, in mm */
35
+ gap?: number;
36
+ /** How wide a cut inside a part (a living hinge's slits) is opened, in mm */
37
+ slitWidth?: number;
38
+ }
39
+ export interface MeshSource {
40
+ assembly: AssemblyPart[];
41
+ /** Every part flat, for the flat layout and for a model nothing places */
42
+ flat?: AssemblyPart[];
43
+ hardware?: HardwareItem[];
44
+ /** The layers, to tell cuts inside a part from marks on it */
45
+ layers?: {
46
+ name: string;
47
+ mode: string;
48
+ }[];
49
+ }
50
+ /** The colour a 3D view gives a sheet material */
51
+ export declare function materialColor(material: string): string;
52
+ /** The model as solid bodies, for the 3D file writers */
53
+ export declare function meshBodies(source: MeshSource, options?: MeshOptions): Body[];
@@ -0,0 +1,12 @@
1
+ import { type Body, type MeshOptions, type MeshSource } from './mesh.cjs';
2
+ export type ModelFormat = 'glb' | '3mf' | 'stl';
3
+ /** Binary STL of all the bodies as one mesh, in millimetres */
4
+ export declare function toStl(bodies: Body[]): Uint8Array;
5
+ /** A 3MF package in millimetres: each part one object, its engraving and
6
+ * scoring coloured parts of it, so a slicer prints them in their colours */
7
+ export declare function to3mf(bodies: Body[]): Uint8Array;
8
+ /** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
9
+ * y up as glTF has it; each node's extras give its kind, part and copy */
10
+ export declare function toGlb(bodies: Body[]): Uint8Array;
11
+ /** The model as a 3D file: "glb", "3mf" or "stl" */
12
+ export declare function toModel(source: MeshSource, format: ModelFormat, options?: MeshOptions): Uint8Array;
@@ -0,0 +1,12 @@
1
+ import { type Body, type MeshOptions, type MeshSource } from './mesh.js';
2
+ export type ModelFormat = 'glb' | '3mf' | 'stl';
3
+ /** Binary STL of all the bodies as one mesh, in millimetres */
4
+ export declare function toStl(bodies: Body[]): Uint8Array;
5
+ /** A 3MF package in millimetres: each part one object, its engraving and
6
+ * scoring coloured parts of it, so a slicer prints them in their colours */
7
+ export declare function to3mf(bodies: Body[]): Uint8Array;
8
+ /** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
9
+ * y up as glTF has it; each node's extras give its kind, part and copy */
10
+ export declare function toGlb(bodies: Body[]): Uint8Array;
11
+ /** The model as a 3D file: "glb", "3mf" or "stl" */
12
+ export declare function toModel(source: MeshSource, format: ModelFormat, options?: MeshOptions): Uint8Array;
@@ -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;
@@ -3,6 +3,7 @@ export interface FnCtx {
3
3
  maxLength: number;
4
4
  step: (n?: number) => void;
5
5
  given: number;
6
+ apply: (fn: Value, args: Value[]) => Value;
6
7
  }
7
8
  type Run = (args: Value[], c: FnCtx) => Value;
8
9
  export interface Builtin {
@@ -19,6 +20,7 @@ export declare function bindArgs(f: Builtin, pos: Value[], named: Map<string, Va
19
20
  * step. A range is counted up to just past max, the most items it may hold.
20
21
  */
21
22
  export declare function argumentWork(name: string, args: Value[], max: number): number;
23
+ export declare function perlin(x: number, y: number, z: number, seed: number): number;
22
24
  export declare const FUNCTIONS: Record<string, Builtin>;
23
25
  export declare function catmullRom(p: [number, number][], n: number, closed?: boolean): [number, number][];
24
26
  export {};
@@ -3,6 +3,7 @@ export interface FnCtx {
3
3
  maxLength: number;
4
4
  step: (n?: number) => void;
5
5
  given: number;
6
+ apply: (fn: Value, args: Value[]) => Value;
6
7
  }
7
8
  type Run = (args: Value[], c: FnCtx) => Value;
8
9
  export interface Builtin {
@@ -19,6 +20,7 @@ export declare function bindArgs(f: Builtin, pos: Value[], named: Map<string, Va
19
20
  * step. A range is counted up to just past max, the most items it may hold.
20
21
  */
21
22
  export declare function argumentWork(name: string, args: Value[], max: number): number;
23
+ export declare function perlin(x: number, y: number, z: number, seed: number): number;
22
24
  export declare const FUNCTIONS: Record<string, Builtin>;
23
25
  export declare function catmullRom(p: [number, number][], n: number, closed?: boolean): [number, number][];
24
26
  export {};
@@ -19,6 +19,10 @@ export interface PartShape {
19
19
  on?: string;
20
20
  slots?: string[];
21
21
  clearance?: number;
22
+ slotExtra?: [number, number];
23
+ bores?: string[];
24
+ fit?: number;
25
+ halving?: string[];
22
26
  step?: number;
23
27
  glue?: {
24
28
  host: string;
@@ -31,6 +35,7 @@ export interface Bend {
31
35
  x0: number;
32
36
  x1: number;
33
37
  angle: number;
38
+ mirrored?: boolean;
34
39
  }
35
40
  export interface Shape {
36
41
  layers: Map<string, Layer>;
@@ -59,6 +64,7 @@ export declare function multiply(m: Matrix, n: Matrix): Matrix;
59
64
  export declare function apply(m: Matrix, [x, y]: Pt): Pt;
60
65
  export declare function transform(s: Shape, m: Matrix): Shape;
61
66
  export declare function merge(shapes: Shape[]): Shape;
67
+ export declare const HIDDEN = "\0hidden";
62
68
  export declare function retag(s: Shape, layer: string): Shape;
63
69
  export declare function bounds(polys: Poly[]): [number, number, number, number] | null;
64
70
  export declare function layerBounds(layers: Map<string, Layer>, skip?: (name: string) => boolean): [number, number, number, number] | null;
@@ -66,3 +72,4 @@ export declare function hull(points: Pt[]): Poly;
66
72
  export declare function fragments(r: number, fn: number, fa: number, fs: number): number;
67
73
  export declare function ellipsePoly(rx: number, ry: number, n: number): Poly;
68
74
  export declare function roundedRect(w: number, h: number, r: number, segs: (r: number) => number): Poly;
75
+ export declare function joinIslands(regions: Poly[], w: number): Poly[];
@@ -19,6 +19,10 @@ export interface PartShape {
19
19
  on?: string;
20
20
  slots?: string[];
21
21
  clearance?: number;
22
+ slotExtra?: [number, number];
23
+ bores?: string[];
24
+ fit?: number;
25
+ halving?: string[];
22
26
  step?: number;
23
27
  glue?: {
24
28
  host: string;
@@ -31,6 +35,7 @@ export interface Bend {
31
35
  x0: number;
32
36
  x1: number;
33
37
  angle: number;
38
+ mirrored?: boolean;
34
39
  }
35
40
  export interface Shape {
36
41
  layers: Map<string, Layer>;
@@ -59,6 +64,7 @@ export declare function multiply(m: Matrix, n: Matrix): Matrix;
59
64
  export declare function apply(m: Matrix, [x, y]: Pt): Pt;
60
65
  export declare function transform(s: Shape, m: Matrix): Shape;
61
66
  export declare function merge(shapes: Shape[]): Shape;
67
+ export declare const HIDDEN = "\0hidden";
62
68
  export declare function retag(s: Shape, layer: string): Shape;
63
69
  export declare function bounds(polys: Poly[]): [number, number, number, number] | null;
64
70
  export declare function layerBounds(layers: Map<string, Layer>, skip?: (name: string) => boolean): [number, number, number, number] | null;
@@ -66,3 +72,4 @@ export declare function hull(points: Pt[]): Poly;
66
72
  export declare function fragments(r: number, fn: number, fa: number, fs: number): number;
67
73
  export declare function ellipsePoly(rx: number, ry: number, n: number): Poly;
68
74
  export declare function roundedRect(w: number, h: number, r: number, segs: (r: number) => number): Poly;
75
+ export declare function joinIslands(regions: Poly[], w: number): Poly[];
@@ -0,0 +1,8 @@
1
+ import { type Poly } from './geometry.cjs';
2
+ import type { Solid } from './slots.cjs';
3
+ export interface Halving {
4
+ a: Poly[];
5
+ b: Poly[];
6
+ thin: number;
7
+ }
8
+ export declare function halvingFor(A: Solid, B: Solid, clearance: number): Halving;
@@ -0,0 +1,8 @@
1
+ import { type Poly } from './geometry.js';
2
+ import type { Solid } from './slots.js';
3
+ export interface Halving {
4
+ a: Poly[];
5
+ b: Poly[];
6
+ thin: number;
7
+ }
8
+ export declare function halvingFor(A: Solid, B: Solid, clearance: number): Halving;
@@ -36,20 +36,21 @@ var KEYWORDS = /* @__PURE__ */ new Set([
36
36
  "for",
37
37
  "let",
38
38
  "each",
39
+ "intersection_for",
39
40
  "use",
40
41
  "include"
41
42
  ]);
42
43
  var CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "undef", "PI"]);
43
44
  var LAYERS = /* @__PURE__ */ new Set(["cut", "score", "engrave", "guide", "layer"]);
44
45
  var BUILTINS = new Set(
45
- "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 paint measure fill_holes 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 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 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 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 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 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 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(" ")
46
47
  );
47
48
  var NUMBER = /(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:(?:mm|cm|m|in|ft)(?![A-Za-z0-9_]))?/y;
48
49
  var WORD = /\$?[A-Za-z_][A-Za-z0-9_]*/y;
49
50
  var CALL = /\s*\(/y;
50
51
  var PATH = /<[^>]*>?/y;
51
52
  var SECTION = /\/\*\s*\[[^\]]*\]\s*\*\//y;
52
- var CONTROL = /\/\/\s*\[[^\]]*\]\s*$/y;
53
+ var CONTROL = /\/\/\s*\[[^\]]*\](?:\s+drive)?(?:\s+when\s.*)?\s*$/y;
53
54
  var MODIFIER = /[*#%](?=\s*[A-Za-z_$])/y;
54
55
  var at = (re, line, i) => {
55
56
  re.lastIndex = i;
package/dist/highlight.js CHANGED
@@ -9,20 +9,21 @@ var KEYWORDS = /* @__PURE__ */ new Set([
9
9
  "for",
10
10
  "let",
11
11
  "each",
12
+ "intersection_for",
12
13
  "use",
13
14
  "include"
14
15
  ]);
15
16
  var CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "undef", "PI"]);
16
17
  var LAYERS = /* @__PURE__ */ new Set(["cut", "score", "engrave", "guide", "layer"]);
17
18
  var BUILTINS = new Set(
18
- "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 paint measure fill_holes 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 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 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 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 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 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 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(" ")
19
20
  );
20
21
  var NUMBER = /(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:(?:mm|cm|m|in|ft)(?![A-Za-z0-9_]))?/y;
21
22
  var WORD = /\$?[A-Za-z_][A-Za-z0-9_]*/y;
22
23
  var CALL = /\s*\(/y;
23
24
  var PATH = /<[^>]*>?/y;
24
25
  var SECTION = /\/\*\s*\[[^\]]*\]\s*\*\//y;
25
- var CONTROL = /\/\/\s*\[[^\]]*\]\s*$/y;
26
+ var CONTROL = /\/\/\s*\[[^\]]*\](?:\s+drive)?(?:\s+when\s.*)?\s*$/y;
26
27
  var MODIFIER = /[*#%](?=\s*[A-Za-z_$])/y;
27
28
  var at = (re, line, i) => {
28
29
  re.lastIndex = i;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};