@mylasertools/kerfscript 0.2.1 → 0.4.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.
@@ -25,6 +25,7 @@ export interface Limits {
25
25
  maxPoints: number;
26
26
  maxOutputPoints: number;
27
27
  maxSheets: number;
28
+ maxCollisionPairs: number;
28
29
  }
29
30
  export declare const DEFAULT_LIMITS: Limits;
30
31
  interface ModDef {
@@ -98,6 +99,8 @@ export declare class Evaluator {
98
99
  private loop;
99
100
  private evalArgs;
100
101
  private bindParams;
102
+ private unknownArg;
103
+ private warn;
101
104
  private callModule;
102
105
  private childStmts;
103
106
  callFunction(f: FnDef | Closure, args: Args, caller: Env, name: string): Value;
@@ -107,12 +110,15 @@ export declare class Evaluator {
107
110
  private charge;
108
111
  private call;
109
112
  private specialFunction;
113
+ private assert;
110
114
  private echo;
111
115
  private echoText;
112
116
  private arith;
113
117
  private arg;
114
118
  private num;
115
119
  private vec2;
120
+ private vec3;
121
+ private placements;
116
122
  private points;
117
123
  private dyn;
118
124
  private spend;
@@ -25,6 +25,7 @@ export interface Limits {
25
25
  maxPoints: number;
26
26
  maxOutputPoints: number;
27
27
  maxSheets: number;
28
+ maxCollisionPairs: number;
28
29
  }
29
30
  export declare const DEFAULT_LIMITS: Limits;
30
31
  interface ModDef {
@@ -98,6 +99,8 @@ export declare class Evaluator {
98
99
  private loop;
99
100
  private evalArgs;
100
101
  private bindParams;
102
+ private unknownArg;
103
+ private warn;
101
104
  private callModule;
102
105
  private childStmts;
103
106
  callFunction(f: FnDef | Closure, args: Args, caller: Env, name: string): Value;
@@ -107,12 +110,15 @@ export declare class Evaluator {
107
110
  private charge;
108
111
  private call;
109
112
  private specialFunction;
113
+ private assert;
110
114
  private echo;
111
115
  private echoText;
112
116
  private arith;
113
117
  private arg;
114
118
  private num;
115
119
  private vec2;
120
+ private vec3;
121
+ private placements;
116
122
  private points;
117
123
  private dyn;
118
124
  private spend;
@@ -1,3 +1,3 @@
1
- import type { LayerDef } from '../evaluator.cjs';
1
+ import { type LayerDef } from '../evaluator.cjs';
2
2
  import type { Placed } from '../render.cjs';
3
3
  export declare function toDxf(items: Placed[], _width: number, height: number, layers: LayerDef[]): string;
@@ -1,3 +1,3 @@
1
- import type { LayerDef } from '../evaluator.js';
1
+ import { type LayerDef } from '../evaluator.js';
2
2
  import type { Placed } from '../render.js';
3
3
  export declare function toDxf(items: Placed[], _width: number, height: number, layers: LayerDef[]): string;
@@ -0,0 +1,3 @@
1
+ export declare const BUILTIN_FONT = "Atkinson";
2
+ /** Adds the built-in font after the given fonts, unless one has its name. */
3
+ export declare function withBuiltinFont(fonts: Record<string, Uint8Array>): Record<string, Uint8Array>;
package/dist/font.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const BUILTIN_FONT = "Atkinson";
2
+ /** Adds the built-in font after the given fonts, unless one has its name. */
3
+ export declare function withBuiltinFont(fonts: Record<string, Uint8Array>): Record<string, Uint8Array>;
@@ -1,4 +1,23 @@
1
1
  import { type Value } from './values.cjs';
2
- type Fn = (args: Value[], named: Map<string, Value>) => Value;
3
- export declare const FUNCTIONS: Record<string, Fn>;
2
+ export interface FnCtx {
3
+ maxLength: number;
4
+ step: (n?: number) => void;
5
+ given: number;
6
+ }
7
+ type Run = (args: Value[], c: FnCtx) => Value;
8
+ export interface Builtin {
9
+ params: string[];
10
+ rest: boolean;
11
+ order?: (n: number) => string[];
12
+ run: Run;
13
+ }
14
+ export declare function givenTwice(f: Builtin, pos: Value[], named: Map<string, Value>): string[];
15
+ export declare function bindArgs(f: Builtin, pos: Value[], named: Map<string, Value>): Value[];
16
+ /**
17
+ * Steps a built-in takes to go through its arguments: one for each item of a
18
+ * list or range and each character of a string. len() of a list is a single
19
+ * step. A range is counted up to just past max, the most items it may hold.
20
+ */
21
+ export declare function argumentWork(name: string, args: Value[], max: number): number;
22
+ export declare const FUNCTIONS: Record<string, Builtin>;
4
23
  export {};
@@ -1,4 +1,23 @@
1
1
  import { type Value } from './values.js';
2
- type Fn = (args: Value[], named: Map<string, Value>) => Value;
3
- export declare const FUNCTIONS: Record<string, Fn>;
2
+ export interface FnCtx {
3
+ maxLength: number;
4
+ step: (n?: number) => void;
5
+ given: number;
6
+ }
7
+ type Run = (args: Value[], c: FnCtx) => Value;
8
+ export interface Builtin {
9
+ params: string[];
10
+ rest: boolean;
11
+ order?: (n: number) => string[];
12
+ run: Run;
13
+ }
14
+ export declare function givenTwice(f: Builtin, pos: Value[], named: Map<string, Value>): string[];
15
+ export declare function bindArgs(f: Builtin, pos: Value[], named: Map<string, Value>): Value[];
16
+ /**
17
+ * Steps a built-in takes to go through its arguments: one for each item of a
18
+ * list or range and each character of a string. len() of a list is a single
19
+ * step. A range is counted up to just past max, the most items it may hold.
20
+ */
21
+ export declare function argumentWork(name: string, args: Value[], max: number): number;
22
+ export declare const FUNCTIONS: Record<string, Builtin>;
4
23
  export {};
@@ -1,3 +1,4 @@
1
+ import type { Placement } from './assembly.cjs';
1
2
  export type Pt = [number, number];
2
3
  export type Poly = Pt[];
3
4
  export type Matrix = [number, number, number, number, number, number];
@@ -12,6 +13,7 @@ export interface PartShape {
12
13
  thickness: number;
13
14
  kerf: number;
14
15
  material: string;
16
+ placements?: Placement[];
15
17
  }
16
18
  export interface Shape {
17
19
  layers: Map<string, Layer>;
@@ -1,3 +1,4 @@
1
+ import type { Placement } from './assembly.js';
1
2
  export type Pt = [number, number];
2
3
  export type Poly = Pt[];
3
4
  export type Matrix = [number, number, number, number, number, number];
@@ -12,6 +13,7 @@ export interface PartShape {
12
13
  thickness: number;
13
14
  kerf: number;
14
15
  material: string;
16
+ placements?: Placement[];
15
17
  }
16
18
  export interface Shape {
17
19
  layers: Map<string, Layer>;