@pooder/kit 5.3.0 → 5.3.1

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 (60) hide show
  1. package/.test-dist/src/CanvasService.js +249 -249
  2. package/.test-dist/src/ViewportSystem.js +75 -75
  3. package/.test-dist/src/background.js +203 -203
  4. package/.test-dist/src/bridgeSelection.js +20 -20
  5. package/.test-dist/src/constraints.js +237 -237
  6. package/.test-dist/src/dieline.js +818 -818
  7. package/.test-dist/src/edgeScale.js +12 -12
  8. package/.test-dist/src/feature.js +826 -826
  9. package/.test-dist/src/featureComplete.js +32 -32
  10. package/.test-dist/src/film.js +167 -167
  11. package/.test-dist/src/geometry.js +506 -506
  12. package/.test-dist/src/image.js +1250 -1250
  13. package/.test-dist/src/maskOps.js +270 -270
  14. package/.test-dist/src/mirror.js +104 -104
  15. package/.test-dist/src/renderSpec.js +2 -2
  16. package/.test-dist/src/ruler.js +343 -343
  17. package/.test-dist/src/sceneLayout.js +99 -99
  18. package/.test-dist/src/sceneLayoutModel.js +196 -196
  19. package/.test-dist/src/sceneView.js +40 -40
  20. package/.test-dist/src/sceneVisibility.js +42 -42
  21. package/.test-dist/src/size.js +332 -332
  22. package/.test-dist/src/tracer.js +544 -544
  23. package/.test-dist/src/white-ink.js +829 -829
  24. package/.test-dist/src/wrappedOffsets.js +33 -33
  25. package/CHANGELOG.md +6 -0
  26. package/dist/index.d.mts +6 -0
  27. package/dist/index.d.ts +6 -0
  28. package/dist/index.js +108 -20
  29. package/dist/index.mjs +108 -20
  30. package/package.json +1 -1
  31. package/src/coordinate.ts +106 -106
  32. package/src/extensions/background.ts +230 -230
  33. package/src/extensions/bridgeSelection.ts +17 -17
  34. package/src/extensions/constraints.ts +322 -322
  35. package/src/extensions/dieline.ts +46 -0
  36. package/src/extensions/edgeScale.ts +19 -19
  37. package/src/extensions/feature.ts +1021 -1021
  38. package/src/extensions/featureComplete.ts +46 -46
  39. package/src/extensions/film.ts +194 -194
  40. package/src/extensions/geometry.ts +752 -719
  41. package/src/extensions/image.ts +1926 -1924
  42. package/src/extensions/index.ts +11 -11
  43. package/src/extensions/maskOps.ts +283 -283
  44. package/src/extensions/mirror.ts +128 -128
  45. package/src/extensions/ruler.ts +451 -451
  46. package/src/extensions/sceneLayout.ts +140 -140
  47. package/src/extensions/sceneLayoutModel.ts +352 -342
  48. package/src/extensions/sceneVisibility.ts +71 -71
  49. package/src/extensions/size.ts +389 -389
  50. package/src/extensions/tracer.ts +58 -19
  51. package/src/extensions/white-ink.ts +1400 -1400
  52. package/src/extensions/wrappedOffsets.ts +33 -33
  53. package/src/index.ts +2 -2
  54. package/src/services/CanvasService.ts +300 -300
  55. package/src/services/ViewportSystem.ts +95 -95
  56. package/src/services/index.ts +3 -3
  57. package/src/services/renderSpec.ts +18 -18
  58. package/src/units.ts +27 -27
  59. package/tests/run.ts +118 -118
  60. package/tsconfig.test.json +15 -15
@@ -1,104 +1,104 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MirrorTool = void 0;
4
- const core_1 = require("@pooder/core");
5
- class MirrorTool {
6
- constructor(options) {
7
- this.id = "pooder.kit.mirror";
8
- this.metadata = {
9
- name: "MirrorTool",
10
- };
11
- this.enabled = false;
12
- if (options) {
13
- Object.assign(this, options);
14
- }
15
- }
16
- toJSON() {
17
- return {
18
- enabled: this.enabled,
19
- };
20
- }
21
- loadFromJSON(json) {
22
- this.enabled = json.enabled;
23
- }
24
- activate(context) {
25
- this.canvasService = context.services.get("CanvasService");
26
- if (!this.canvasService) {
27
- console.warn("CanvasService not found for MirrorTool");
28
- return;
29
- }
30
- const configService = context.services.get("ConfigurationService");
31
- if (configService) {
32
- // Load initial config
33
- this.enabled = configService.get("mirror.enabled", this.enabled);
34
- // Listen for changes
35
- configService.onAnyChange((e) => {
36
- if (e.key === "mirror.enabled") {
37
- this.applyMirror(e.value);
38
- }
39
- });
40
- }
41
- // Initialize with current state (if enabled was persisted)
42
- if (this.enabled) {
43
- this.applyMirror(true);
44
- }
45
- }
46
- deactivate(context) {
47
- this.applyMirror(false);
48
- this.canvasService = undefined;
49
- }
50
- contribute() {
51
- return {
52
- [core_1.ContributionPointIds.CONFIGURATIONS]: [
53
- {
54
- id: "mirror.enabled",
55
- type: "boolean",
56
- label: "Enable Mirror",
57
- default: false,
58
- },
59
- ],
60
- [core_1.ContributionPointIds.COMMANDS]: [
61
- {
62
- command: "setMirror",
63
- title: "Set Mirror",
64
- handler: (enabled) => {
65
- this.applyMirror(enabled);
66
- return true;
67
- },
68
- },
69
- ],
70
- };
71
- }
72
- applyMirror(enabled) {
73
- if (!this.canvasService)
74
- return;
75
- const canvas = this.canvasService.canvas;
76
- if (!canvas)
77
- return;
78
- const width = canvas.width || 800;
79
- // Fabric.js v6+ uses viewportTransform property
80
- let vpt = canvas.viewportTransform || [1, 0, 0, 1, 0, 0];
81
- // Create a copy to avoid mutating the reference directly before setting
82
- vpt = [...vpt];
83
- // If we are enabling and currently not flipped (scaleX > 0)
84
- // Or disabling and currently flipped (scaleX < 0)
85
- const isFlipped = vpt[0] < 0;
86
- if (enabled && !isFlipped) {
87
- // Flip scale X
88
- vpt[0] = -vpt[0]; // Flip scale
89
- vpt[4] = width - vpt[4]; // Adjust pan X
90
- canvas.setViewportTransform(vpt);
91
- canvas.requestRenderAll();
92
- this.enabled = true;
93
- }
94
- else if (!enabled && isFlipped) {
95
- // Restore
96
- vpt[0] = -vpt[0]; // Unflip scale
97
- vpt[4] = width - vpt[4]; // Restore pan X
98
- canvas.setViewportTransform(vpt);
99
- canvas.requestRenderAll();
100
- this.enabled = false;
101
- }
102
- }
103
- }
104
- exports.MirrorTool = MirrorTool;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MirrorTool = void 0;
4
+ const core_1 = require("@pooder/core");
5
+ class MirrorTool {
6
+ constructor(options) {
7
+ this.id = "pooder.kit.mirror";
8
+ this.metadata = {
9
+ name: "MirrorTool",
10
+ };
11
+ this.enabled = false;
12
+ if (options) {
13
+ Object.assign(this, options);
14
+ }
15
+ }
16
+ toJSON() {
17
+ return {
18
+ enabled: this.enabled,
19
+ };
20
+ }
21
+ loadFromJSON(json) {
22
+ this.enabled = json.enabled;
23
+ }
24
+ activate(context) {
25
+ this.canvasService = context.services.get("CanvasService");
26
+ if (!this.canvasService) {
27
+ console.warn("CanvasService not found for MirrorTool");
28
+ return;
29
+ }
30
+ const configService = context.services.get("ConfigurationService");
31
+ if (configService) {
32
+ // Load initial config
33
+ this.enabled = configService.get("mirror.enabled", this.enabled);
34
+ // Listen for changes
35
+ configService.onAnyChange((e) => {
36
+ if (e.key === "mirror.enabled") {
37
+ this.applyMirror(e.value);
38
+ }
39
+ });
40
+ }
41
+ // Initialize with current state (if enabled was persisted)
42
+ if (this.enabled) {
43
+ this.applyMirror(true);
44
+ }
45
+ }
46
+ deactivate(context) {
47
+ this.applyMirror(false);
48
+ this.canvasService = undefined;
49
+ }
50
+ contribute() {
51
+ return {
52
+ [core_1.ContributionPointIds.CONFIGURATIONS]: [
53
+ {
54
+ id: "mirror.enabled",
55
+ type: "boolean",
56
+ label: "Enable Mirror",
57
+ default: false,
58
+ },
59
+ ],
60
+ [core_1.ContributionPointIds.COMMANDS]: [
61
+ {
62
+ command: "setMirror",
63
+ title: "Set Mirror",
64
+ handler: (enabled) => {
65
+ this.applyMirror(enabled);
66
+ return true;
67
+ },
68
+ },
69
+ ],
70
+ };
71
+ }
72
+ applyMirror(enabled) {
73
+ if (!this.canvasService)
74
+ return;
75
+ const canvas = this.canvasService.canvas;
76
+ if (!canvas)
77
+ return;
78
+ const width = canvas.width || 800;
79
+ // Fabric.js v6+ uses viewportTransform property
80
+ let vpt = canvas.viewportTransform || [1, 0, 0, 1, 0, 0];
81
+ // Create a copy to avoid mutating the reference directly before setting
82
+ vpt = [...vpt];
83
+ // If we are enabling and currently not flipped (scaleX > 0)
84
+ // Or disabling and currently flipped (scaleX < 0)
85
+ const isFlipped = vpt[0] < 0;
86
+ if (enabled && !isFlipped) {
87
+ // Flip scale X
88
+ vpt[0] = -vpt[0]; // Flip scale
89
+ vpt[4] = width - vpt[4]; // Adjust pan X
90
+ canvas.setViewportTransform(vpt);
91
+ canvas.requestRenderAll();
92
+ this.enabled = true;
93
+ }
94
+ else if (!enabled && isFlipped) {
95
+ // Restore
96
+ vpt[0] = -vpt[0]; // Unflip scale
97
+ vpt[4] = width - vpt[4]; // Restore pan X
98
+ canvas.setViewportTransform(vpt);
99
+ canvas.requestRenderAll();
100
+ this.enabled = false;
101
+ }
102
+ }
103
+ }
104
+ exports.MirrorTool = MirrorTool;
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });