@mylasertools/kerfscript 0.2.0 → 0.3.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.
- package/CHANGELOG.md +97 -0
- package/CLA.md +8 -5
- package/COMMERCIAL-LICENSE.md +23 -28
- package/LANGUAGE.md +194 -60
- package/README.md +89 -39
- package/THIRD-PARTY-NOTICES.md +68 -4
- package/TRADEMARKS.md +16 -10
- package/dist/cli.js +773 -297
- package/dist/evaluator.d.cts +26 -0
- package/dist/evaluator.d.ts +26 -0
- package/dist/export/dxf.d.cts +1 -1
- package/dist/export/dxf.d.ts +1 -1
- package/dist/export/svg.d.cts +2 -0
- package/dist/export/svg.d.ts +2 -0
- package/dist/font.d.cts +3 -0
- package/dist/font.d.ts +3 -0
- package/dist/functions.d.cts +21 -2
- package/dist/functions.d.ts +21 -2
- package/dist/index.cjs +14 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -14
- package/dist/lexer.d.cts +4 -1
- package/dist/lexer.d.ts +4 -1
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/render.d.cts +3 -2
- package/dist/render.d.ts +3 -2
- package/dist/values.d.cts +10 -2
- package/dist/values.d.ts +10 -2
- package/dist/wasm.d.cts +1 -0
- package/dist/wasm.d.ts +1 -0
- package/docs/cli.md +69 -28
- package/docs/compatibility.md +40 -65
- package/docs/customizer.md +40 -28
- package/docs/desktop.md +96 -0
- package/docs/getting-started.md +48 -31
- package/docs/javascript.md +108 -51
- package/docs/kerf.md +36 -39
- package/docs/layers.md +71 -37
- package/docs/openscad.md +52 -48
- package/docs/parts-and-sheets.md +45 -31
- package/docs/versions.md +20 -30
- package/docs/webassembly.md +131 -0
- package/fonts/OFL.txt +92 -0
- package/package.json +10 -6
package/dist/evaluator.d.cts
CHANGED
|
@@ -14,7 +14,19 @@ export interface EvalOptions {
|
|
|
14
14
|
resolve?: (path: string) => string | undefined;
|
|
15
15
|
fonts?: FontBook;
|
|
16
16
|
maxSteps?: number;
|
|
17
|
+
limits?: Partial<Limits>;
|
|
17
18
|
}
|
|
19
|
+
export interface Limits {
|
|
20
|
+
maxParts: number;
|
|
21
|
+
maxSegments: number;
|
|
22
|
+
maxListLength: number;
|
|
23
|
+
maxListItems: number;
|
|
24
|
+
maxTextLength: number;
|
|
25
|
+
maxPoints: number;
|
|
26
|
+
maxOutputPoints: number;
|
|
27
|
+
maxSheets: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const DEFAULT_LIMITS: Limits;
|
|
18
30
|
interface ModDef {
|
|
19
31
|
params: Param[];
|
|
20
32
|
body: Stmt[];
|
|
@@ -63,6 +75,10 @@ export declare class Evaluator {
|
|
|
63
75
|
private steps;
|
|
64
76
|
private depth;
|
|
65
77
|
private maxSteps;
|
|
78
|
+
readonly limits: Limits;
|
|
79
|
+
private pointCount;
|
|
80
|
+
private itemCount;
|
|
81
|
+
private copies;
|
|
66
82
|
readonly echoes: string[];
|
|
67
83
|
readonly warnings: string[];
|
|
68
84
|
readonly layers: Map<string, LayerDef>;
|
|
@@ -73,6 +89,7 @@ export declare class Evaluator {
|
|
|
73
89
|
private tick;
|
|
74
90
|
private load;
|
|
75
91
|
private hoist;
|
|
92
|
+
private included;
|
|
76
93
|
private assign;
|
|
77
94
|
block(stmts: Stmt[], env: Env, top?: boolean): Shape;
|
|
78
95
|
private stmt;
|
|
@@ -81,13 +98,19 @@ export declare class Evaluator {
|
|
|
81
98
|
private loop;
|
|
82
99
|
private evalArgs;
|
|
83
100
|
private bindParams;
|
|
101
|
+
private unknownArg;
|
|
102
|
+
private warn;
|
|
84
103
|
private callModule;
|
|
85
104
|
private childStmts;
|
|
86
105
|
callFunction(f: FnDef | Closure, args: Args, caller: Env, name: string): Value;
|
|
87
106
|
expr(x: Expr, env: Env): Value;
|
|
88
107
|
private listItem;
|
|
108
|
+
private grow;
|
|
109
|
+
private charge;
|
|
89
110
|
private call;
|
|
90
111
|
private specialFunction;
|
|
112
|
+
private assert;
|
|
113
|
+
private echo;
|
|
91
114
|
private echoText;
|
|
92
115
|
private arith;
|
|
93
116
|
private arg;
|
|
@@ -95,6 +118,9 @@ export declare class Evaluator {
|
|
|
95
118
|
private vec2;
|
|
96
119
|
private points;
|
|
97
120
|
private dyn;
|
|
121
|
+
private spend;
|
|
122
|
+
private checkValue;
|
|
123
|
+
private checkSize;
|
|
98
124
|
private segs;
|
|
99
125
|
private thickness;
|
|
100
126
|
private fingerWidth;
|
package/dist/evaluator.d.ts
CHANGED
|
@@ -14,7 +14,19 @@ export interface EvalOptions {
|
|
|
14
14
|
resolve?: (path: string) => string | undefined;
|
|
15
15
|
fonts?: FontBook;
|
|
16
16
|
maxSteps?: number;
|
|
17
|
+
limits?: Partial<Limits>;
|
|
17
18
|
}
|
|
19
|
+
export interface Limits {
|
|
20
|
+
maxParts: number;
|
|
21
|
+
maxSegments: number;
|
|
22
|
+
maxListLength: number;
|
|
23
|
+
maxListItems: number;
|
|
24
|
+
maxTextLength: number;
|
|
25
|
+
maxPoints: number;
|
|
26
|
+
maxOutputPoints: number;
|
|
27
|
+
maxSheets: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const DEFAULT_LIMITS: Limits;
|
|
18
30
|
interface ModDef {
|
|
19
31
|
params: Param[];
|
|
20
32
|
body: Stmt[];
|
|
@@ -63,6 +75,10 @@ export declare class Evaluator {
|
|
|
63
75
|
private steps;
|
|
64
76
|
private depth;
|
|
65
77
|
private maxSteps;
|
|
78
|
+
readonly limits: Limits;
|
|
79
|
+
private pointCount;
|
|
80
|
+
private itemCount;
|
|
81
|
+
private copies;
|
|
66
82
|
readonly echoes: string[];
|
|
67
83
|
readonly warnings: string[];
|
|
68
84
|
readonly layers: Map<string, LayerDef>;
|
|
@@ -73,6 +89,7 @@ export declare class Evaluator {
|
|
|
73
89
|
private tick;
|
|
74
90
|
private load;
|
|
75
91
|
private hoist;
|
|
92
|
+
private included;
|
|
76
93
|
private assign;
|
|
77
94
|
block(stmts: Stmt[], env: Env, top?: boolean): Shape;
|
|
78
95
|
private stmt;
|
|
@@ -81,13 +98,19 @@ export declare class Evaluator {
|
|
|
81
98
|
private loop;
|
|
82
99
|
private evalArgs;
|
|
83
100
|
private bindParams;
|
|
101
|
+
private unknownArg;
|
|
102
|
+
private warn;
|
|
84
103
|
private callModule;
|
|
85
104
|
private childStmts;
|
|
86
105
|
callFunction(f: FnDef | Closure, args: Args, caller: Env, name: string): Value;
|
|
87
106
|
expr(x: Expr, env: Env): Value;
|
|
88
107
|
private listItem;
|
|
108
|
+
private grow;
|
|
109
|
+
private charge;
|
|
89
110
|
private call;
|
|
90
111
|
private specialFunction;
|
|
112
|
+
private assert;
|
|
113
|
+
private echo;
|
|
91
114
|
private echoText;
|
|
92
115
|
private arith;
|
|
93
116
|
private arg;
|
|
@@ -95,6 +118,9 @@ export declare class Evaluator {
|
|
|
95
118
|
private vec2;
|
|
96
119
|
private points;
|
|
97
120
|
private dyn;
|
|
121
|
+
private spend;
|
|
122
|
+
private checkValue;
|
|
123
|
+
private checkSize;
|
|
98
124
|
private segs;
|
|
99
125
|
private thickness;
|
|
100
126
|
private fingerWidth;
|
package/dist/export/dxf.d.cts
CHANGED
package/dist/export/dxf.d.ts
CHANGED
package/dist/export/svg.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LayerDef } from '../evaluator.cjs';
|
|
2
|
+
import { type Poly } from '../geometry.cjs';
|
|
2
3
|
import type { Placed } from '../render.cjs';
|
|
3
4
|
export declare const n: (v: number) => string;
|
|
5
|
+
export declare function tidy(p: Poly, closed: boolean): [string, string][];
|
|
4
6
|
export interface LayerPath {
|
|
5
7
|
name: string;
|
|
6
8
|
mode: LayerDef['mode'];
|
package/dist/export/svg.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LayerDef } from '../evaluator.js';
|
|
2
|
+
import { type Poly } from '../geometry.js';
|
|
2
3
|
import type { Placed } from '../render.js';
|
|
3
4
|
export declare const n: (v: number) => string;
|
|
5
|
+
export declare function tidy(p: Poly, closed: boolean): [string, string][];
|
|
4
6
|
export interface LayerPath {
|
|
5
7
|
name: string;
|
|
6
8
|
mode: LayerDef['mode'];
|
package/dist/font.d.cts
ADDED
package/dist/font.d.ts
ADDED
package/dist/functions.d.cts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { type Value } from './values.cjs';
|
|
2
|
-
|
|
3
|
-
|
|
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 {};
|
package/dist/functions.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { type Value } from './values.js';
|
|
2
|
-
|
|
3
|
-
|
|
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 {};
|