@mylasertools/kerfscript 0.8.0 → 0.9.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.
@@ -12,6 +12,7 @@ export interface Parameter {
12
12
  name: string;
13
13
  value: number | string;
14
14
  }[];
15
+ drive?: boolean;
15
16
  span: [number, number];
16
17
  }
17
18
  export declare function parameters(source: string): {
@@ -12,6 +12,7 @@ export interface Parameter {
12
12
  name: string;
13
13
  value: number | string;
14
14
  }[];
15
+ drive?: boolean;
15
16
  span: [number, number];
16
17
  }
17
18
  export declare function parameters(source: string): {
@@ -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,10 +103,12 @@ 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;
107
113
  private frame;
108
114
  private step;
@@ -119,6 +125,8 @@ export declare class Evaluator {
119
125
  private tick;
120
126
  private load;
121
127
  private hoist;
128
+ private clashed;
129
+ private clash;
122
130
  private childCache;
123
131
  private childKey;
124
132
  private effects;
@@ -158,6 +166,7 @@ export declare class Evaluator {
158
166
  private echo;
159
167
  private echoText;
160
168
  private arith;
169
+ private fieldFn;
161
170
  private arg;
162
171
  private num;
163
172
  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,10 +103,12 @@ 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;
107
113
  private frame;
108
114
  private step;
@@ -119,6 +125,8 @@ export declare class Evaluator {
119
125
  private tick;
120
126
  private load;
121
127
  private hoist;
128
+ private clashed;
129
+ private clash;
122
130
  private childCache;
123
131
  private childKey;
124
132
  private effects;
@@ -158,6 +166,7 @@ export declare class Evaluator {
158
166
  private echo;
159
167
  private echoText;
160
168
  private arith;
169
+ private fieldFn;
161
170
  private arg;
162
171
  private num;
163
172
  private vec2;
@@ -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;
@@ -59,6 +63,7 @@ export declare function multiply(m: Matrix, n: Matrix): Matrix;
59
63
  export declare function apply(m: Matrix, [x, y]: Pt): Pt;
60
64
  export declare function transform(s: Shape, m: Matrix): Shape;
61
65
  export declare function merge(shapes: Shape[]): Shape;
66
+ export declare const HIDDEN = "\0hidden";
62
67
  export declare function retag(s: Shape, layer: string): Shape;
63
68
  export declare function bounds(polys: Poly[]): [number, number, number, number] | null;
64
69
  export declare function layerBounds(layers: Map<string, Layer>, skip?: (name: string) => boolean): [number, number, number, number] | null;
@@ -66,3 +71,4 @@ export declare function hull(points: Pt[]): Poly;
66
71
  export declare function fragments(r: number, fn: number, fa: number, fs: number): number;
67
72
  export declare function ellipsePoly(rx: number, ry: number, n: number): Poly;
68
73
  export declare function roundedRect(w: number, h: number, r: number, segs: (r: number) => number): Poly;
74
+ 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;
@@ -59,6 +63,7 @@ export declare function multiply(m: Matrix, n: Matrix): Matrix;
59
63
  export declare function apply(m: Matrix, [x, y]: Pt): Pt;
60
64
  export declare function transform(s: Shape, m: Matrix): Shape;
61
65
  export declare function merge(shapes: Shape[]): Shape;
66
+ export declare const HIDDEN = "\0hidden";
62
67
  export declare function retag(s: Shape, layer: string): Shape;
63
68
  export declare function bounds(polys: Poly[]): [number, number, number, number] | null;
64
69
  export declare function layerBounds(layers: Map<string, Layer>, skip?: (name: string) => boolean): [number, number, number, number] | null;
@@ -66,3 +71,4 @@ export declare function hull(points: Pt[]): Poly;
66
71
  export declare function fragments(r: number, fn: number, fa: number, fs: number): number;
67
72
  export declare function ellipsePoly(rx: number, ry: number, n: number): Poly;
68
73
  export declare function roundedRect(w: number, h: number, r: number, segs: (r: number) => number): Poly;
74
+ 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,13 +36,14 @@ 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 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
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;
package/dist/highlight.js CHANGED
@@ -9,13 +9,14 @@ 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 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
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;