@pooder/kit 6.0.0 → 6.1.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/BackgroundTool.js +524 -0
- package/.test-dist/src/extensions/background/index.js +17 -0
- package/.test-dist/src/extensions/background.js +1 -1
- package/.test-dist/src/extensions/dieline/DielineTool.js +748 -0
- package/.test-dist/src/extensions/dieline/commands.js +127 -0
- package/.test-dist/src/extensions/dieline/config.js +107 -0
- package/.test-dist/src/extensions/dieline/index.js +21 -0
- package/.test-dist/src/extensions/dieline/model.js +2 -0
- package/.test-dist/src/extensions/dieline/renderer.js +2 -0
- package/.test-dist/src/extensions/dieline.js +4 -0
- package/.test-dist/src/extensions/feature/FeatureTool.js +914 -0
- package/.test-dist/src/extensions/feature/index.js +17 -0
- package/.test-dist/src/extensions/film/FilmTool.js +207 -0
- package/.test-dist/src/extensions/film/index.js +17 -0
- package/.test-dist/src/extensions/image/ImageTool.js +1499 -0
- package/.test-dist/src/extensions/image/commands.js +162 -0
- package/.test-dist/src/extensions/image/config.js +129 -0
- package/.test-dist/src/extensions/image/index.js +21 -0
- package/.test-dist/src/extensions/image/model.js +2 -0
- package/.test-dist/src/extensions/image/renderer.js +5 -0
- package/.test-dist/src/extensions/image.js +182 -7
- package/.test-dist/src/extensions/mirror/MirrorTool.js +104 -0
- package/.test-dist/src/extensions/mirror/index.js +17 -0
- package/.test-dist/src/extensions/ruler/RulerTool.js +442 -0
- package/.test-dist/src/extensions/ruler/index.js +17 -0
- package/.test-dist/src/extensions/sceneLayout.js +2 -93
- package/.test-dist/src/extensions/sceneLayoutModel.js +15 -200
- package/.test-dist/src/extensions/size/SizeTool.js +332 -0
- package/.test-dist/src/extensions/size/index.js +17 -0
- package/.test-dist/src/extensions/white-ink/WhiteInkTool.js +1003 -0
- package/.test-dist/src/extensions/white-ink/commands.js +148 -0
- package/.test-dist/src/extensions/white-ink/config.js +31 -0
- package/.test-dist/src/extensions/white-ink/index.js +21 -0
- package/.test-dist/src/extensions/white-ink/model.js +2 -0
- package/.test-dist/src/extensions/white-ink/renderer.js +5 -0
- package/.test-dist/src/services/CanvasService.js +34 -13
- package/.test-dist/src/services/SceneLayoutService.js +96 -0
- package/.test-dist/src/services/index.js +1 -0
- package/.test-dist/src/services/visibility.js +3 -0
- package/.test-dist/src/shared/constants/layers.js +25 -0
- package/.test-dist/src/shared/imaging/sourceSizeCache.js +82 -0
- package/.test-dist/src/shared/index.js +22 -0
- package/.test-dist/src/shared/runtime/sessionState.js +74 -0
- package/.test-dist/src/shared/runtime/subscriptions.js +30 -0
- package/.test-dist/src/shared/scene/frame.js +34 -0
- package/.test-dist/src/shared/scene/sceneLayoutModel.js +202 -0
- package/.test-dist/tests/run.js +118 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +403 -366
- package/dist/index.d.ts +403 -366
- package/dist/index.js +5172 -4752
- package/dist/index.mjs +1410 -2027
- package/dist/tracer-PO7CRBYY.mjs +1016 -0
- package/package.json +1 -1
- package/src/extensions/{background.ts → background/BackgroundTool.ts} +33 -50
- package/src/extensions/background/index.ts +1 -0
- package/src/extensions/{dieline.ts → dieline/DielineTool.ts} +18 -218
- package/src/extensions/dieline/commands.ts +109 -0
- package/src/extensions/dieline/config.ts +106 -0
- package/src/extensions/dieline/index.ts +5 -0
- package/src/extensions/dieline/model.ts +1 -0
- package/src/extensions/dieline/renderer.ts +1 -0
- package/src/extensions/{feature.ts → feature/FeatureTool.ts} +27 -21
- package/src/extensions/feature/index.ts +1 -0
- package/src/extensions/{film.ts → film/FilmTool.ts} +36 -48
- package/src/extensions/film/index.ts +1 -0
- package/src/extensions/{image.ts → image/ImageTool.ts} +289 -335
- package/src/extensions/image/commands.ts +176 -0
- package/src/extensions/image/config.ts +128 -0
- package/src/extensions/image/index.ts +5 -0
- package/src/extensions/image/model.ts +1 -0
- package/src/extensions/image/renderer.ts +1 -0
- package/src/extensions/{mirror.ts → mirror/MirrorTool.ts} +1 -1
- package/src/extensions/mirror/index.ts +1 -0
- package/src/extensions/{ruler.ts → ruler/RulerTool.ts} +4 -5
- package/src/extensions/ruler/index.ts +1 -0
- package/src/extensions/sceneLayout.ts +1 -140
- package/src/extensions/sceneLayoutModel.ts +1 -364
- package/src/extensions/{size.ts → size/SizeTool.ts} +7 -6
- package/src/extensions/size/index.ts +1 -0
- package/src/extensions/{white-ink.ts → white-ink/WhiteInkTool.ts} +130 -317
- package/src/extensions/white-ink/commands.ts +157 -0
- package/src/extensions/white-ink/config.ts +30 -0
- package/src/extensions/white-ink/index.ts +5 -0
- package/src/extensions/white-ink/model.ts +1 -0
- package/src/extensions/white-ink/renderer.ts +1 -0
- package/src/services/CanvasService.ts +43 -12
- package/src/services/SceneLayoutService.ts +139 -0
- package/src/services/index.ts +1 -0
- package/src/services/renderSpec.ts +2 -0
- package/src/services/visibility.ts +5 -0
- package/src/shared/constants/layers.ts +23 -0
- package/src/shared/imaging/sourceSizeCache.ts +103 -0
- package/src/shared/index.ts +6 -0
- package/src/shared/runtime/sessionState.ts +105 -0
- package/src/shared/runtime/subscriptions.ts +45 -0
- package/src/shared/scene/frame.ts +46 -0
- package/src/shared/scene/sceneLayoutModel.ts +367 -0
- package/tests/run.ts +151 -0
package/tests/run.ts
CHANGED
|
@@ -15,6 +15,12 @@ import {
|
|
|
15
15
|
} from "../src/extensions/maskOps";
|
|
16
16
|
import { computeDetectEdgeSize } from "../src/extensions/edgeScale";
|
|
17
17
|
import { evaluateVisibilityExpr } from "../src/services/visibility";
|
|
18
|
+
import { createImageCommands } from "../src/extensions/image/commands";
|
|
19
|
+
import { createImageConfigurations } from "../src/extensions/image/config";
|
|
20
|
+
import { createWhiteInkCommands } from "../src/extensions/white-ink/commands";
|
|
21
|
+
import { createWhiteInkConfigurations } from "../src/extensions/white-ink/config";
|
|
22
|
+
import { createDielineCommands } from "../src/extensions/dieline/commands";
|
|
23
|
+
import { createDielineConfigurations } from "../src/extensions/dieline/config";
|
|
18
24
|
|
|
19
25
|
function assert(condition: unknown, message: string) {
|
|
20
26
|
if (!condition) throw new Error(message);
|
|
@@ -123,6 +129,7 @@ function testVisibilityDsl() {
|
|
|
123
129
|
const context = {
|
|
124
130
|
activeToolId: "pooder.kit.image",
|
|
125
131
|
isSessionActive: (toolId: string) => toolId === "pooder.kit.feature",
|
|
132
|
+
hasAnyActiveSession: () => true,
|
|
126
133
|
layers,
|
|
127
134
|
};
|
|
128
135
|
|
|
@@ -162,6 +169,10 @@ function testVisibilityDsl() {
|
|
|
162
169
|
) === false,
|
|
163
170
|
"sessionActive false failed",
|
|
164
171
|
);
|
|
172
|
+
assert(
|
|
173
|
+
evaluateVisibilityExpr({ op: "anySessionActive" }, context) === true,
|
|
174
|
+
"anySessionActive true failed",
|
|
175
|
+
);
|
|
165
176
|
assert(
|
|
166
177
|
evaluateVisibilityExpr(
|
|
167
178
|
{ op: "layerExists", layerId: "ruler-overlay" },
|
|
@@ -241,12 +252,152 @@ function testVisibilityDsl() {
|
|
|
241
252
|
);
|
|
242
253
|
}
|
|
243
254
|
|
|
255
|
+
function testContributionCompatibility() {
|
|
256
|
+
const imageCommandNames = createImageCommands({} as any).map(
|
|
257
|
+
(entry) => entry.command,
|
|
258
|
+
);
|
|
259
|
+
const whiteInkCommandNames = createWhiteInkCommands({} as any).map(
|
|
260
|
+
(entry) => entry.command,
|
|
261
|
+
);
|
|
262
|
+
const dielineCommandNames = createDielineCommands({} as any, {
|
|
263
|
+
width: 0,
|
|
264
|
+
height: 0,
|
|
265
|
+
}).map((entry) => entry.command);
|
|
266
|
+
|
|
267
|
+
const expectedImageCommands = [
|
|
268
|
+
"addImage",
|
|
269
|
+
"upsertImage",
|
|
270
|
+
"getWorkingImages",
|
|
271
|
+
"setWorkingImage",
|
|
272
|
+
"resetWorkingImages",
|
|
273
|
+
"completeImages",
|
|
274
|
+
"exportUserCroppedImage",
|
|
275
|
+
"fitImageToArea",
|
|
276
|
+
"fitImageToDefaultArea",
|
|
277
|
+
"focusImage",
|
|
278
|
+
"removeImage",
|
|
279
|
+
"updateImage",
|
|
280
|
+
"clearImages",
|
|
281
|
+
"bringToFront",
|
|
282
|
+
"sendToBack",
|
|
283
|
+
];
|
|
284
|
+
const expectedWhiteInkCommands = [
|
|
285
|
+
"addWhiteInk",
|
|
286
|
+
"upsertWhiteInk",
|
|
287
|
+
"getWhiteInks",
|
|
288
|
+
"getWhiteInkSettings",
|
|
289
|
+
"setWhiteInkPrintEnabled",
|
|
290
|
+
"setWhiteInkPreviewImageVisible",
|
|
291
|
+
"getWorkingWhiteInks",
|
|
292
|
+
"setWorkingWhiteInk",
|
|
293
|
+
"updateWhiteInk",
|
|
294
|
+
"removeWhiteInk",
|
|
295
|
+
"clearWhiteInks",
|
|
296
|
+
"resetWorkingWhiteInks",
|
|
297
|
+
"completeWhiteInks",
|
|
298
|
+
"setWhiteInkImage",
|
|
299
|
+
];
|
|
300
|
+
const expectedDielineCommands = [
|
|
301
|
+
"updateFeaturePosition",
|
|
302
|
+
"exportCutImage",
|
|
303
|
+
"detectEdge",
|
|
304
|
+
];
|
|
305
|
+
|
|
306
|
+
assert(
|
|
307
|
+
JSON.stringify(imageCommandNames) === JSON.stringify(expectedImageCommands),
|
|
308
|
+
`image command set changed: ${JSON.stringify(imageCommandNames)}`,
|
|
309
|
+
);
|
|
310
|
+
assert(
|
|
311
|
+
JSON.stringify(whiteInkCommandNames) ===
|
|
312
|
+
JSON.stringify(expectedWhiteInkCommands),
|
|
313
|
+
`white-ink command set changed: ${JSON.stringify(whiteInkCommandNames)}`,
|
|
314
|
+
);
|
|
315
|
+
assert(
|
|
316
|
+
JSON.stringify(dielineCommandNames) ===
|
|
317
|
+
JSON.stringify(expectedDielineCommands),
|
|
318
|
+
`dieline command set changed: ${JSON.stringify(dielineCommandNames)}`,
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
const imageConfigKeys = createImageConfigurations().map((entry) => entry.id);
|
|
322
|
+
const whiteInkConfigKeys = createWhiteInkConfigurations().map(
|
|
323
|
+
(entry) => entry.id,
|
|
324
|
+
);
|
|
325
|
+
const dielineConfigKeys = createDielineConfigurations({
|
|
326
|
+
shape: "rect",
|
|
327
|
+
radius: 0,
|
|
328
|
+
shapeStyle: {},
|
|
329
|
+
showBleedLines: true,
|
|
330
|
+
mainLine: { width: 1, color: "#000", dashLength: 1, style: "solid" },
|
|
331
|
+
offsetLine: { width: 1, color: "#000", dashLength: 1, style: "solid" },
|
|
332
|
+
insideColor: "#000",
|
|
333
|
+
features: [],
|
|
334
|
+
}).map((entry) => entry.id);
|
|
335
|
+
|
|
336
|
+
const expectedImageConfigKeys = [
|
|
337
|
+
"image.items",
|
|
338
|
+
"image.debug",
|
|
339
|
+
"image.control.cornerSize",
|
|
340
|
+
"image.control.touchCornerSize",
|
|
341
|
+
"image.control.cornerStyle",
|
|
342
|
+
"image.control.cornerColor",
|
|
343
|
+
"image.control.cornerStrokeColor",
|
|
344
|
+
"image.control.transparentCorners",
|
|
345
|
+
"image.control.borderColor",
|
|
346
|
+
"image.control.borderScaleFactor",
|
|
347
|
+
"image.control.padding",
|
|
348
|
+
"image.frame.strokeColor",
|
|
349
|
+
"image.frame.strokeWidth",
|
|
350
|
+
"image.frame.strokeStyle",
|
|
351
|
+
"image.frame.dashLength",
|
|
352
|
+
"image.frame.innerBackground",
|
|
353
|
+
"image.frame.outerBackground",
|
|
354
|
+
];
|
|
355
|
+
const expectedWhiteInkConfigKeys = [
|
|
356
|
+
"whiteInk.items",
|
|
357
|
+
"whiteInk.printWithWhiteInk",
|
|
358
|
+
"whiteInk.previewImageVisible",
|
|
359
|
+
"whiteInk.debug",
|
|
360
|
+
];
|
|
361
|
+
const expectedDielineConfigKeys = [
|
|
362
|
+
"dieline.shape",
|
|
363
|
+
"dieline.radius",
|
|
364
|
+
"dieline.shapeStyle",
|
|
365
|
+
"dieline.showBleedLines",
|
|
366
|
+
"dieline.strokeWidth",
|
|
367
|
+
"dieline.strokeColor",
|
|
368
|
+
"dieline.dashLength",
|
|
369
|
+
"dieline.style",
|
|
370
|
+
"dieline.offsetStrokeWidth",
|
|
371
|
+
"dieline.offsetStrokeColor",
|
|
372
|
+
"dieline.offsetDashLength",
|
|
373
|
+
"dieline.offsetStyle",
|
|
374
|
+
"dieline.insideColor",
|
|
375
|
+
"dieline.features",
|
|
376
|
+
];
|
|
377
|
+
|
|
378
|
+
assert(
|
|
379
|
+
JSON.stringify(imageConfigKeys) === JSON.stringify(expectedImageConfigKeys),
|
|
380
|
+
`image config keys changed: ${JSON.stringify(imageConfigKeys)}`,
|
|
381
|
+
);
|
|
382
|
+
assert(
|
|
383
|
+
JSON.stringify(whiteInkConfigKeys) ===
|
|
384
|
+
JSON.stringify(expectedWhiteInkConfigKeys),
|
|
385
|
+
`white-ink config keys changed: ${JSON.stringify(whiteInkConfigKeys)}`,
|
|
386
|
+
);
|
|
387
|
+
assert(
|
|
388
|
+
JSON.stringify(dielineConfigKeys) ===
|
|
389
|
+
JSON.stringify(expectedDielineConfigKeys),
|
|
390
|
+
`dieline config keys changed: ${JSON.stringify(dielineConfigKeys)}`,
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
244
394
|
function main() {
|
|
245
395
|
testWrappedOffsets();
|
|
246
396
|
testBridgeSelection();
|
|
247
397
|
testMaskOps();
|
|
248
398
|
testEdgeScale();
|
|
249
399
|
testVisibilityDsl();
|
|
400
|
+
testContributionCompatibility();
|
|
250
401
|
console.log("ok");
|
|
251
402
|
}
|
|
252
403
|
|