@pooder/kit 5.3.1 → 6.0.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/.test-dist/src/extensions/background.js +475 -131
- package/.test-dist/src/extensions/dieline.js +283 -180
- package/.test-dist/src/extensions/dielineShape.js +66 -0
- package/.test-dist/src/extensions/feature.js +388 -303
- package/.test-dist/src/extensions/film.js +133 -74
- package/.test-dist/src/extensions/geometry.js +120 -56
- package/.test-dist/src/extensions/image.js +296 -212
- package/.test-dist/src/extensions/index.js +1 -3
- package/.test-dist/src/extensions/maskOps.js +75 -20
- package/.test-dist/src/extensions/ruler.js +312 -215
- package/.test-dist/src/extensions/sceneLayoutModel.js +9 -3
- package/.test-dist/src/extensions/sceneVisibility.js +3 -10
- package/.test-dist/src/extensions/tracer.js +229 -58
- package/.test-dist/src/extensions/white-ink.js +139 -129
- package/.test-dist/src/services/CanvasService.js +888 -126
- package/.test-dist/src/services/index.js +1 -0
- package/.test-dist/src/services/visibility.js +54 -0
- package/.test-dist/tests/run.js +58 -4
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +377 -82
- package/dist/index.d.ts +377 -82
- package/dist/index.js +3920 -2178
- package/dist/index.mjs +3992 -2247
- package/package.json +1 -1
- package/src/extensions/background.ts +631 -145
- package/src/extensions/dieline.ts +280 -187
- package/src/extensions/dielineShape.ts +109 -0
- package/src/extensions/feature.ts +485 -366
- package/src/extensions/film.ts +152 -76
- package/src/extensions/geometry.ts +203 -104
- package/src/extensions/image.ts +319 -238
- package/src/extensions/index.ts +0 -1
- package/src/extensions/ruler.ts +481 -268
- package/src/extensions/sceneLayoutModel.ts +18 -6
- package/src/extensions/white-ink.ts +157 -171
- package/src/services/CanvasService.ts +1126 -140
- package/src/services/index.ts +1 -0
- package/src/services/renderSpec.ts +69 -4
- package/src/services/visibility.ts +78 -0
- package/tests/run.ts +139 -4
- package/.test-dist/src/CanvasService.js +0 -249
- package/.test-dist/src/ViewportSystem.js +0 -75
- package/.test-dist/src/background.js +0 -203
- package/.test-dist/src/bridgeSelection.js +0 -20
- package/.test-dist/src/constraints.js +0 -237
- package/.test-dist/src/dieline.js +0 -818
- package/.test-dist/src/edgeScale.js +0 -12
- package/.test-dist/src/feature.js +0 -826
- package/.test-dist/src/featureComplete.js +0 -32
- package/.test-dist/src/film.js +0 -167
- package/.test-dist/src/geometry.js +0 -506
- package/.test-dist/src/image.js +0 -1250
- package/.test-dist/src/maskOps.js +0 -270
- package/.test-dist/src/mirror.js +0 -104
- package/.test-dist/src/renderSpec.js +0 -2
- package/.test-dist/src/ruler.js +0 -343
- package/.test-dist/src/sceneLayout.js +0 -99
- package/.test-dist/src/sceneLayoutModel.js +0 -196
- package/.test-dist/src/sceneView.js +0 -40
- package/.test-dist/src/sceneVisibility.js +0 -42
- package/.test-dist/src/size.js +0 -332
- package/.test-dist/src/tracer.js +0 -544
- package/.test-dist/src/white-ink.js +0 -829
- package/.test-dist/src/wrappedOffsets.js +0 -33
- package/src/extensions/sceneVisibility.ts +0 -71
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_DIELINE_SHAPE_STYLE = exports.DEFAULT_DIELINE_SHAPE = exports.DIELINE_SHAPES = exports.BUILTIN_DIELINE_SHAPES = void 0;
|
|
4
|
+
exports.isDielineShape = isDielineShape;
|
|
5
|
+
exports.normalizeDielineShape = normalizeDielineShape;
|
|
6
|
+
exports.normalizeShapeStyle = normalizeShapeStyle;
|
|
7
|
+
exports.getShapeFitMode = getShapeFitMode;
|
|
8
|
+
exports.getHeartShapeParams = getHeartShapeParams;
|
|
9
|
+
exports.BUILTIN_DIELINE_SHAPES = [
|
|
10
|
+
"rect",
|
|
11
|
+
"circle",
|
|
12
|
+
"ellipse",
|
|
13
|
+
"heart",
|
|
14
|
+
];
|
|
15
|
+
exports.DIELINE_SHAPES = [...exports.BUILTIN_DIELINE_SHAPES, "custom"];
|
|
16
|
+
exports.DEFAULT_DIELINE_SHAPE = "rect";
|
|
17
|
+
const DEFAULT_HEART_SHAPE_PARAMS = {
|
|
18
|
+
lobeSpread: 0.46,
|
|
19
|
+
notchDepth: 0.24,
|
|
20
|
+
tipSharpness: 0,
|
|
21
|
+
};
|
|
22
|
+
exports.DEFAULT_DIELINE_SHAPE_STYLE = {
|
|
23
|
+
fitMode: "stretch",
|
|
24
|
+
...DEFAULT_HEART_SHAPE_PARAMS,
|
|
25
|
+
};
|
|
26
|
+
function isDielineShape(value) {
|
|
27
|
+
return (typeof value === "string" &&
|
|
28
|
+
exports.DIELINE_SHAPES.includes(value));
|
|
29
|
+
}
|
|
30
|
+
function normalizeFitMode(value, fallback) {
|
|
31
|
+
if (value === "contain" || value === "stretch")
|
|
32
|
+
return value;
|
|
33
|
+
return fallback;
|
|
34
|
+
}
|
|
35
|
+
function normalizeUnitInterval(value, fallback) {
|
|
36
|
+
const num = Number(value);
|
|
37
|
+
if (!Number.isFinite(num))
|
|
38
|
+
return fallback;
|
|
39
|
+
return Math.max(0, Math.min(1, num));
|
|
40
|
+
}
|
|
41
|
+
function normalizeDielineShape(value, fallback = exports.DEFAULT_DIELINE_SHAPE) {
|
|
42
|
+
return isDielineShape(value) ? value : fallback;
|
|
43
|
+
}
|
|
44
|
+
function normalizeShapeStyle(value, fallback = exports.DEFAULT_DIELINE_SHAPE_STYLE) {
|
|
45
|
+
const raw = value && typeof value === "object"
|
|
46
|
+
? value
|
|
47
|
+
: {};
|
|
48
|
+
return {
|
|
49
|
+
...fallback,
|
|
50
|
+
fitMode: normalizeFitMode(raw.fitMode, fallback.fitMode),
|
|
51
|
+
lobeSpread: normalizeUnitInterval(raw.lobeSpread, Number(fallback.lobeSpread ?? DEFAULT_HEART_SHAPE_PARAMS.lobeSpread)),
|
|
52
|
+
notchDepth: normalizeUnitInterval(raw.notchDepth, Number(fallback.notchDepth ?? DEFAULT_HEART_SHAPE_PARAMS.notchDepth)),
|
|
53
|
+
tipSharpness: normalizeUnitInterval(raw.tipSharpness, Number(fallback.tipSharpness ?? DEFAULT_HEART_SHAPE_PARAMS.tipSharpness)),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function getShapeFitMode(style) {
|
|
57
|
+
return normalizeShapeStyle(style).fitMode;
|
|
58
|
+
}
|
|
59
|
+
function getHeartShapeParams(style) {
|
|
60
|
+
const normalized = normalizeShapeStyle(style);
|
|
61
|
+
return {
|
|
62
|
+
lobeSpread: Number(normalized.lobeSpread),
|
|
63
|
+
notchDepth: Number(normalized.notchDepth),
|
|
64
|
+
tipSharpness: Number(normalized.tipSharpness),
|
|
65
|
+
};
|
|
66
|
+
}
|