@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.
Files changed (65) hide show
  1. package/.test-dist/src/extensions/background.js +475 -131
  2. package/.test-dist/src/extensions/dieline.js +283 -180
  3. package/.test-dist/src/extensions/dielineShape.js +66 -0
  4. package/.test-dist/src/extensions/feature.js +388 -303
  5. package/.test-dist/src/extensions/film.js +133 -74
  6. package/.test-dist/src/extensions/geometry.js +120 -56
  7. package/.test-dist/src/extensions/image.js +296 -212
  8. package/.test-dist/src/extensions/index.js +1 -3
  9. package/.test-dist/src/extensions/maskOps.js +75 -20
  10. package/.test-dist/src/extensions/ruler.js +312 -215
  11. package/.test-dist/src/extensions/sceneLayoutModel.js +9 -3
  12. package/.test-dist/src/extensions/sceneVisibility.js +3 -10
  13. package/.test-dist/src/extensions/tracer.js +229 -58
  14. package/.test-dist/src/extensions/white-ink.js +139 -129
  15. package/.test-dist/src/services/CanvasService.js +888 -126
  16. package/.test-dist/src/services/index.js +1 -0
  17. package/.test-dist/src/services/visibility.js +54 -0
  18. package/.test-dist/tests/run.js +58 -4
  19. package/CHANGELOG.md +12 -0
  20. package/dist/index.d.mts +377 -82
  21. package/dist/index.d.ts +377 -82
  22. package/dist/index.js +3920 -2178
  23. package/dist/index.mjs +3992 -2247
  24. package/package.json +1 -1
  25. package/src/extensions/background.ts +631 -145
  26. package/src/extensions/dieline.ts +280 -187
  27. package/src/extensions/dielineShape.ts +109 -0
  28. package/src/extensions/feature.ts +485 -366
  29. package/src/extensions/film.ts +152 -76
  30. package/src/extensions/geometry.ts +203 -104
  31. package/src/extensions/image.ts +319 -238
  32. package/src/extensions/index.ts +0 -1
  33. package/src/extensions/ruler.ts +481 -268
  34. package/src/extensions/sceneLayoutModel.ts +18 -6
  35. package/src/extensions/white-ink.ts +157 -171
  36. package/src/services/CanvasService.ts +1126 -140
  37. package/src/services/index.ts +1 -0
  38. package/src/services/renderSpec.ts +69 -4
  39. package/src/services/visibility.ts +78 -0
  40. package/tests/run.ts +139 -4
  41. package/.test-dist/src/CanvasService.js +0 -249
  42. package/.test-dist/src/ViewportSystem.js +0 -75
  43. package/.test-dist/src/background.js +0 -203
  44. package/.test-dist/src/bridgeSelection.js +0 -20
  45. package/.test-dist/src/constraints.js +0 -237
  46. package/.test-dist/src/dieline.js +0 -818
  47. package/.test-dist/src/edgeScale.js +0 -12
  48. package/.test-dist/src/feature.js +0 -826
  49. package/.test-dist/src/featureComplete.js +0 -32
  50. package/.test-dist/src/film.js +0 -167
  51. package/.test-dist/src/geometry.js +0 -506
  52. package/.test-dist/src/image.js +0 -1250
  53. package/.test-dist/src/maskOps.js +0 -270
  54. package/.test-dist/src/mirror.js +0 -104
  55. package/.test-dist/src/renderSpec.js +0 -2
  56. package/.test-dist/src/ruler.js +0 -343
  57. package/.test-dist/src/sceneLayout.js +0 -99
  58. package/.test-dist/src/sceneLayoutModel.js +0 -196
  59. package/.test-dist/src/sceneView.js +0 -40
  60. package/.test-dist/src/sceneVisibility.js +0 -42
  61. package/.test-dist/src/size.js +0 -332
  62. package/.test-dist/src/tracer.js +0 -544
  63. package/.test-dist/src/white-ink.js +0 -829
  64. package/.test-dist/src/wrappedOffsets.js +0 -33
  65. 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
+ }