dielines 0.6.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/README.md +7 -0
- package/dist/dielines.js +4814 -0
- package/dist/dielines.js.map +1 -0
- package/dist/dielines.umd.cjs +18 -0
- package/dist/dielines.umd.cjs.map +1 -0
- package/dist/types/Dieline.d.ts +23 -0
- package/dist/types/FoldLockBump.d.ts +16 -0
- package/dist/types/drawFlaps.d.ts +26 -0
- package/dist/types/linearDistribution.d.ts +18 -0
- package/dist/types/main.d.ts +4 -0
- package/package.json +48 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Transformable, Diagram, Strand, TransformationMatrix, Stroke } from "pantograph2d/models";
|
|
2
|
+
export declare class Dieline extends Transformable<Dieline> {
|
|
3
|
+
body: Diagram;
|
|
4
|
+
cutLines: Stroke[];
|
|
5
|
+
foldLinesBackwards: Stroke[];
|
|
6
|
+
foldLinesForwards: Stroke[];
|
|
7
|
+
constructor(body: Diagram, { cutLines, foldLines, foldLinesForwards, foldLinesBackwards, }?: {
|
|
8
|
+
cutLines?: Stroke[];
|
|
9
|
+
foldLines?: Stroke[];
|
|
10
|
+
foldLinesBackwards?: Stroke[];
|
|
11
|
+
foldLinesForwards?: Stroke[];
|
|
12
|
+
});
|
|
13
|
+
get foldLines(): any[];
|
|
14
|
+
clone(): Dieline;
|
|
15
|
+
addCutLine(cut: Strand): this;
|
|
16
|
+
addFoldLine(fold: Strand, direction?: "forwards" | "backwards"): void;
|
|
17
|
+
fuseFold(fold: Diagram | Dieline, direction?: "forwards" | "backwards"): this;
|
|
18
|
+
fuseBody(other: Dieline | Diagram): this;
|
|
19
|
+
cutShape(shape: Diagram): this;
|
|
20
|
+
eraseFolds(shape: Diagram): void;
|
|
21
|
+
transform(matrix: TransformationMatrix): Dieline;
|
|
22
|
+
asSVG(): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Diagram, Strand, Transformable, TransformationMatrix } from "pantograph2d/models";
|
|
2
|
+
import { Dieline } from "./Dieline.js";
|
|
3
|
+
export declare class FoldLockBump extends Transformable<FoldLockBump> {
|
|
4
|
+
cut: Strand;
|
|
5
|
+
unfold: Diagram;
|
|
6
|
+
bump: Diagram;
|
|
7
|
+
constructor(width: number | {
|
|
8
|
+
cut: Strand;
|
|
9
|
+
unfold: Diagram;
|
|
10
|
+
bump: Diagram;
|
|
11
|
+
}, paperThickness?: number);
|
|
12
|
+
clone(): FoldLockBump;
|
|
13
|
+
transform(matrix: TransformationMatrix): FoldLockBump;
|
|
14
|
+
makeCut(dieline: Dieline): void;
|
|
15
|
+
fuseBump(dieline: Dieline): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type FlapContractionMode = "rounded" | "sharp";
|
|
2
|
+
export type HorizontalFlapOptions = {
|
|
3
|
+
fillet?: number;
|
|
4
|
+
contraction?: number;
|
|
5
|
+
contractionMode?: FlapContractionMode;
|
|
6
|
+
contractionLeft?: number;
|
|
7
|
+
contractionRight?: number;
|
|
8
|
+
leftContractionMode?: FlapContractionMode;
|
|
9
|
+
rightContractionMode?: FlapContractionMode;
|
|
10
|
+
};
|
|
11
|
+
export type VerticalFlapTopOptions = HorizontalFlapOptions & {
|
|
12
|
+
contractionTop?: number;
|
|
13
|
+
contractionBottom?: number;
|
|
14
|
+
topContractionMode?: FlapContractionMode;
|
|
15
|
+
bottomContractionMode?: FlapContractionMode;
|
|
16
|
+
};
|
|
17
|
+
export declare function topFlap(width: number, height: number, options?: HorizontalFlapOptions): import("pantograph2d").Diagram;
|
|
18
|
+
export declare function bottomFlap(width: number, height: number, options?: HorizontalFlapOptions): import("pantograph2d").Diagram;
|
|
19
|
+
export declare function leftFlap(width: number, height: number, { contractionTop, contractionBottom, topContractionMode, bottomContractionMode, ...options }?: VerticalFlapTopOptions): import("pantograph2d").Diagram;
|
|
20
|
+
export declare function rightFlap(width: number, height: number, options?: VerticalFlapTopOptions): import("pantograph2d").Diagram;
|
|
21
|
+
export declare const drawFlaps: {
|
|
22
|
+
right: typeof rightFlap;
|
|
23
|
+
left: typeof leftFlap;
|
|
24
|
+
top: typeof topFlap;
|
|
25
|
+
bottom: typeof bottomFlap;
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Vector } from "pantograph2d";
|
|
2
|
+
import { Transformable, TransformationMatrix } from "pantograph2d/models";
|
|
3
|
+
interface Clonable {
|
|
4
|
+
clone(): this;
|
|
5
|
+
}
|
|
6
|
+
interface Translatable {
|
|
7
|
+
translateTo(point: Vector): this;
|
|
8
|
+
}
|
|
9
|
+
declare class PointsDistribution extends Transformable<PointsDistribution> {
|
|
10
|
+
points: Vector[];
|
|
11
|
+
constructor(points: Vector[]);
|
|
12
|
+
transform(matrix: TransformationMatrix): PointsDistribution;
|
|
13
|
+
distribute<T extends Translatable>(s: T): T[];
|
|
14
|
+
cloneDistribute<T extends Translatable & Clonable>(s: T): T[];
|
|
15
|
+
}
|
|
16
|
+
export declare function linearDistribution(totalWidth: number, objectWidth: number, gapShare?: number, margin?: number): PointsDistribution;
|
|
17
|
+
export declare function linearSpread(gap: number, count: number, direction?: "x" | "y"): PointsDistribution;
|
|
18
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dielines",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Create dielines with pantograph APIs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"dielines",
|
|
8
|
+
"pantograph",
|
|
9
|
+
"2d",
|
|
10
|
+
"curves"
|
|
11
|
+
],
|
|
12
|
+
"author": "Steve Genoud <steve@sgenoud.com>",
|
|
13
|
+
"homepage": "https://github.com/sgenoud/pantograph#readme",
|
|
14
|
+
"license": "AGPL-3.0-or-later",
|
|
15
|
+
"main": "lib/dielines.js",
|
|
16
|
+
"directories": {
|
|
17
|
+
"lib": "lib",
|
|
18
|
+
"test": "__tests__"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"start": "vite",
|
|
26
|
+
"build": "vite build"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/sgenoud/pantograph.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/sgenoud/pantograph/issues"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"pantograph2d": "^0.6.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
41
|
+
"eslint": "^8.36.0",
|
|
42
|
+
"prettier": "^2.8.4",
|
|
43
|
+
"typescript": "^5.0.2",
|
|
44
|
+
"vite": "^4.1.4",
|
|
45
|
+
"vite-plugin-dts": "^2.2.0"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "f5ef0d6e05b349cbdf28fb22d4dc62c9dded7396"
|
|
48
|
+
}
|