@pooder/kit 6.2.2 → 6.3.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/image/ImageTool.js +134 -119
- package/.test-dist/src/extensions/image/commands.js +60 -40
- package/.test-dist/src/extensions/image/imageOperations.js +75 -0
- package/.test-dist/src/extensions/image/index.js +1 -0
- package/.test-dist/src/extensions/image/model.js +4 -0
- package/.test-dist/tests/run.js +39 -5
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +250 -163
- package/dist/index.d.ts +250 -163
- package/dist/index.js +265 -157
- package/dist/index.mjs +261 -156
- package/package.json +1 -1
- package/src/extensions/image/ImageTool.ts +172 -145
- package/src/extensions/image/commands.ts +69 -48
- package/src/extensions/image/imageOperations.ts +135 -0
- package/src/extensions/image/index.ts +1 -0
- package/src/extensions/image/model.ts +13 -1
- package/tests/run.ts +49 -8
package/.test-dist/tests/run.js
CHANGED
|
@@ -12,6 +12,7 @@ const config_2 = require("../src/extensions/white-ink/config");
|
|
|
12
12
|
const commands_3 = require("../src/extensions/dieline/commands");
|
|
13
13
|
const config_3 = require("../src/extensions/dieline/config");
|
|
14
14
|
const featureCoordinates_1 = require("../src/extensions/featureCoordinates");
|
|
15
|
+
const model_1 = require("../src/extensions/image/model");
|
|
15
16
|
function assert(condition, message) {
|
|
16
17
|
if (!condition)
|
|
17
18
|
throw new Error(message);
|
|
@@ -169,6 +170,39 @@ function testVisibilityDsl() {
|
|
|
169
170
|
],
|
|
170
171
|
}, context) === true, "any failed");
|
|
171
172
|
}
|
|
173
|
+
function testImageViewStateHelper() {
|
|
174
|
+
assert((0, model_1.hasAnyImageInViewState)(null) === false, "null image state should be empty");
|
|
175
|
+
assert((0, model_1.hasAnyImageInViewState)({
|
|
176
|
+
items: [],
|
|
177
|
+
hasAnyImage: false,
|
|
178
|
+
focusedId: null,
|
|
179
|
+
focusedItem: null,
|
|
180
|
+
isToolActive: false,
|
|
181
|
+
isImageSelectionActive: false,
|
|
182
|
+
hasWorkingChanges: false,
|
|
183
|
+
source: "committed",
|
|
184
|
+
}) === false, "empty image state should report false");
|
|
185
|
+
assert((0, model_1.hasAnyImageInViewState)({
|
|
186
|
+
items: [
|
|
187
|
+
{
|
|
188
|
+
id: "img-1",
|
|
189
|
+
url: "blob:test",
|
|
190
|
+
opacity: 1,
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
hasAnyImage: true,
|
|
194
|
+
focusedId: "img-1",
|
|
195
|
+
focusedItem: {
|
|
196
|
+
id: "img-1",
|
|
197
|
+
url: "blob:test",
|
|
198
|
+
opacity: 1,
|
|
199
|
+
},
|
|
200
|
+
isToolActive: true,
|
|
201
|
+
isImageSelectionActive: true,
|
|
202
|
+
hasWorkingChanges: true,
|
|
203
|
+
source: "working",
|
|
204
|
+
}) === true, "non-empty image state should report true");
|
|
205
|
+
}
|
|
172
206
|
function testContributionCompatibility() {
|
|
173
207
|
const imageCommandNames = (0, commands_1.createImageCommands)({}).map((entry) => entry.command);
|
|
174
208
|
const whiteInkCommandNames = (0, commands_2.createWhiteInkCommands)({}).map((entry) => entry.command);
|
|
@@ -179,13 +213,12 @@ function testContributionCompatibility() {
|
|
|
179
213
|
const expectedImageCommands = [
|
|
180
214
|
"addImage",
|
|
181
215
|
"upsertImage",
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
216
|
+
"applyImageOperation",
|
|
217
|
+
"getImageViewState",
|
|
218
|
+
"setImageTransform",
|
|
219
|
+
"imageSessionReset",
|
|
185
220
|
"completeImages",
|
|
186
221
|
"exportUserCroppedImage",
|
|
187
|
-
"fitImageToArea",
|
|
188
|
-
"fitImageToDefaultArea",
|
|
189
222
|
"focusImage",
|
|
190
223
|
"removeImage",
|
|
191
224
|
"updateImage",
|
|
@@ -285,6 +318,7 @@ function main() {
|
|
|
285
318
|
testEdgeScale();
|
|
286
319
|
testFeaturePlacementProjection();
|
|
287
320
|
testVisibilityDsl();
|
|
321
|
+
testImageViewStateHelper();
|
|
288
322
|
testContributionCompatibility();
|
|
289
323
|
console.log("ok");
|
|
290
324
|
}
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _pooder_core from '@pooder/core';
|
|
2
|
-
import { Extension, ExtensionContext, ContributionPointIds, ConfigurationContribution, CommandContribution,
|
|
2
|
+
import { Extension, ExtensionContext, ContributionPointIds, ConfigurationContribution, CommandContribution, Service, ServiceContext, EventBus, ConfigurationService } from '@pooder/core';
|
|
3
3
|
import { Canvas, FabricObject } from 'fabric';
|
|
4
4
|
|
|
5
5
|
type BackgroundLayerKind = "color" | "image";
|
|
@@ -87,6 +87,23 @@ interface ImageItem {
|
|
|
87
87
|
sourceUrl?: string;
|
|
88
88
|
committedUrl?: string;
|
|
89
89
|
}
|
|
90
|
+
interface ImageTransformUpdates {
|
|
91
|
+
scale?: number;
|
|
92
|
+
angle?: number;
|
|
93
|
+
left?: number;
|
|
94
|
+
top?: number;
|
|
95
|
+
opacity?: number;
|
|
96
|
+
}
|
|
97
|
+
interface ImageViewState {
|
|
98
|
+
items: ImageItem[];
|
|
99
|
+
hasAnyImage: boolean;
|
|
100
|
+
focusedId: string | null;
|
|
101
|
+
focusedItem: ImageItem | null;
|
|
102
|
+
isToolActive: boolean;
|
|
103
|
+
isImageSelectionActive: boolean;
|
|
104
|
+
hasWorkingChanges: boolean;
|
|
105
|
+
source: "working" | "committed";
|
|
106
|
+
}
|
|
90
107
|
declare class ImageTool implements Extension {
|
|
91
108
|
id: string;
|
|
92
109
|
metadata: {
|
|
@@ -175,21 +192,21 @@ declare class ImageTool implements Extension {
|
|
|
175
192
|
private normalizeItem;
|
|
176
193
|
private normalizeItems;
|
|
177
194
|
private cloneItems;
|
|
195
|
+
private getViewItems;
|
|
196
|
+
private getImageViewState;
|
|
197
|
+
private emitImageStateChange;
|
|
178
198
|
private emitWorkingChange;
|
|
179
199
|
private generateId;
|
|
180
200
|
private hasImageItem;
|
|
181
201
|
private setImageFocus;
|
|
182
202
|
private addImageEntry;
|
|
183
203
|
private upsertImageEntry;
|
|
184
|
-
private addItemToWorkingSessionIfNeeded;
|
|
185
204
|
private updateImage;
|
|
186
205
|
private getConfig;
|
|
187
206
|
private applyCommittedItems;
|
|
188
207
|
private updateConfig;
|
|
189
208
|
private getFrameRect;
|
|
190
209
|
private getFrameRectScreen;
|
|
191
|
-
private resolveDefaultFitArea;
|
|
192
|
-
private fitImageToDefaultArea;
|
|
193
210
|
private getImageObjects;
|
|
194
211
|
private getOverlayObjects;
|
|
195
212
|
private getImageObject;
|
|
@@ -212,12 +229,14 @@ declare class ImageTool implements Extension {
|
|
|
212
229
|
private updateImages;
|
|
213
230
|
private updateImagesAsync;
|
|
214
231
|
private clampNormalized;
|
|
232
|
+
private setImageTransform;
|
|
233
|
+
private resetImageSession;
|
|
215
234
|
private onObjectModified;
|
|
216
235
|
private updateImageInWorking;
|
|
217
236
|
private updateImageInConfig;
|
|
218
237
|
private waitImageLoaded;
|
|
219
|
-
private
|
|
220
|
-
private
|
|
238
|
+
private resolveImageSourceSize;
|
|
239
|
+
private applyImageOperation;
|
|
221
240
|
private commitWorkingImagesAsCropped;
|
|
222
241
|
private exportCroppedImageByIds;
|
|
223
242
|
private exportUserCroppedImage;
|
|
@@ -227,160 +246,6 @@ declare function createImageCommands(tool: any): CommandContribution[];
|
|
|
227
246
|
|
|
228
247
|
declare function createImageConfigurations(): ConfigurationContribution[];
|
|
229
248
|
|
|
230
|
-
interface RectLike$1 {
|
|
231
|
-
width: number;
|
|
232
|
-
height: number;
|
|
233
|
-
}
|
|
234
|
-
declare function getCoverScale(frame: RectLike$1, source: RectLike$1): number;
|
|
235
|
-
|
|
236
|
-
declare class SizeTool implements Extension {
|
|
237
|
-
id: string;
|
|
238
|
-
metadata: {
|
|
239
|
-
name: string;
|
|
240
|
-
};
|
|
241
|
-
private context?;
|
|
242
|
-
private canvasService?;
|
|
243
|
-
activate(context: ExtensionContext): void;
|
|
244
|
-
deactivate(_context: ExtensionContext): void;
|
|
245
|
-
contribute(): {
|
|
246
|
-
[ContributionPointIds.TOOLS]: {
|
|
247
|
-
id: string;
|
|
248
|
-
name: string;
|
|
249
|
-
interaction: string;
|
|
250
|
-
}[];
|
|
251
|
-
[ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
|
|
252
|
-
[ContributionPointIds.COMMANDS]: CommandContribution[];
|
|
253
|
-
};
|
|
254
|
-
private getConfigService;
|
|
255
|
-
private ensureDefaults;
|
|
256
|
-
private emitStateChanged;
|
|
257
|
-
private getStateForUI;
|
|
258
|
-
private updateDimensions;
|
|
259
|
-
private setConstraintMode;
|
|
260
|
-
private setUnit;
|
|
261
|
-
private setCut;
|
|
262
|
-
private getSelectedImageSize;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
declare const DIELINE_SHAPES: readonly ["rect", "circle", "ellipse", "heart", "custom"];
|
|
266
|
-
type DielineShape = (typeof DIELINE_SHAPES)[number];
|
|
267
|
-
type ShapeFitMode = "contain" | "stretch";
|
|
268
|
-
interface DielineShapeStyle {
|
|
269
|
-
fitMode: ShapeFitMode;
|
|
270
|
-
[key: string]: unknown;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
type FeatureOperation = "add" | "subtract";
|
|
274
|
-
type FeatureShape = "rect" | "circle";
|
|
275
|
-
interface DielineFeature {
|
|
276
|
-
id: string;
|
|
277
|
-
groupId?: string;
|
|
278
|
-
operation: FeatureOperation;
|
|
279
|
-
shape: FeatureShape;
|
|
280
|
-
x: number;
|
|
281
|
-
y: number;
|
|
282
|
-
width?: number;
|
|
283
|
-
height?: number;
|
|
284
|
-
radius?: number;
|
|
285
|
-
rotation?: number;
|
|
286
|
-
renderBehavior?: "edge" | "surface";
|
|
287
|
-
color?: string;
|
|
288
|
-
strokeDash?: number[];
|
|
289
|
-
skipCut?: boolean;
|
|
290
|
-
bridge?: {
|
|
291
|
-
type: "vertical";
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
interface DielineGeometry {
|
|
296
|
-
shape: DielineShape;
|
|
297
|
-
shapeStyle: DielineShapeStyle;
|
|
298
|
-
unit: "px";
|
|
299
|
-
x: number;
|
|
300
|
-
y: number;
|
|
301
|
-
width: number;
|
|
302
|
-
height: number;
|
|
303
|
-
radius: number;
|
|
304
|
-
offset: number;
|
|
305
|
-
borderLength?: number;
|
|
306
|
-
scale?: number;
|
|
307
|
-
strokeWidth?: number;
|
|
308
|
-
pathData?: string;
|
|
309
|
-
customSourceWidthPx?: number;
|
|
310
|
-
customSourceHeightPx?: number;
|
|
311
|
-
}
|
|
312
|
-
interface LineStyle {
|
|
313
|
-
width: number;
|
|
314
|
-
color: string;
|
|
315
|
-
dashLength: number;
|
|
316
|
-
style: "solid" | "dashed" | "hidden";
|
|
317
|
-
}
|
|
318
|
-
interface DielineState {
|
|
319
|
-
shape: DielineShape;
|
|
320
|
-
shapeStyle: DielineShapeStyle;
|
|
321
|
-
width: number;
|
|
322
|
-
height: number;
|
|
323
|
-
radius: number;
|
|
324
|
-
offset: number;
|
|
325
|
-
padding: number | string;
|
|
326
|
-
mainLine: LineStyle;
|
|
327
|
-
offsetLine: LineStyle;
|
|
328
|
-
insideColor: string;
|
|
329
|
-
showBleedLines: boolean;
|
|
330
|
-
features: DielineFeature[];
|
|
331
|
-
pathData?: string;
|
|
332
|
-
customSourceWidthPx?: number;
|
|
333
|
-
customSourceHeightPx?: number;
|
|
334
|
-
}
|
|
335
|
-
declare function createDefaultDielineState(): DielineState;
|
|
336
|
-
declare function readDielineState(configService: ConfigurationService, fallback?: Partial<DielineState>): DielineState;
|
|
337
|
-
|
|
338
|
-
declare class DielineTool implements Extension {
|
|
339
|
-
id: string;
|
|
340
|
-
metadata: {
|
|
341
|
-
name: string;
|
|
342
|
-
};
|
|
343
|
-
private state;
|
|
344
|
-
private canvasService?;
|
|
345
|
-
private context?;
|
|
346
|
-
private specs;
|
|
347
|
-
private effects;
|
|
348
|
-
private renderSeq;
|
|
349
|
-
private renderProducerDisposable?;
|
|
350
|
-
private onCanvasResized;
|
|
351
|
-
constructor(options?: Partial<DielineState>);
|
|
352
|
-
activate(context: ExtensionContext): void;
|
|
353
|
-
deactivate(context: ExtensionContext): void;
|
|
354
|
-
contribute(): {
|
|
355
|
-
[ContributionPointIds.TOOLS]: {
|
|
356
|
-
id: string;
|
|
357
|
-
name: string;
|
|
358
|
-
interaction: string;
|
|
359
|
-
session: {
|
|
360
|
-
autoBegin: boolean;
|
|
361
|
-
leavePolicy: string;
|
|
362
|
-
};
|
|
363
|
-
}[];
|
|
364
|
-
[ContributionPointIds.CONFIGURATIONS]: _pooder_core.ConfigurationContribution[];
|
|
365
|
-
[ContributionPointIds.COMMANDS]: _pooder_core.CommandContribution[];
|
|
366
|
-
};
|
|
367
|
-
private createHatchPattern;
|
|
368
|
-
private getConfigService;
|
|
369
|
-
private hasImageItems;
|
|
370
|
-
private buildDielineSpecs;
|
|
371
|
-
private buildImageClipEffects;
|
|
372
|
-
updateDieline(_emitEvent?: boolean): void;
|
|
373
|
-
private updateDielineAsync;
|
|
374
|
-
getGeometry(): DielineGeometry | null;
|
|
375
|
-
exportCutImage(options?: {
|
|
376
|
-
debug?: boolean;
|
|
377
|
-
}): Promise<string | null>;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
declare function createDielineCommands(tool: any, state: any): CommandContribution[];
|
|
381
|
-
|
|
382
|
-
declare function createDielineConfigurations(state: any): ConfigurationContribution[];
|
|
383
|
-
|
|
384
249
|
interface Point {
|
|
385
250
|
x: number;
|
|
386
251
|
y: number;
|
|
@@ -510,7 +375,7 @@ type RenderProducer = () => RenderProducerResult | undefined | Promise<RenderPro
|
|
|
510
375
|
interface RegisterRenderProducerOptions {
|
|
511
376
|
priority?: number;
|
|
512
377
|
}
|
|
513
|
-
interface RectLike {
|
|
378
|
+
interface RectLike$1 {
|
|
514
379
|
left: number;
|
|
515
380
|
top: number;
|
|
516
381
|
width: number;
|
|
@@ -629,7 +494,7 @@ declare class CanvasService implements Service {
|
|
|
629
494
|
width: number;
|
|
630
495
|
height: number;
|
|
631
496
|
};
|
|
632
|
-
getScreenViewportRect(): RectLike;
|
|
497
|
+
getScreenViewportRect(): RectLike$1;
|
|
633
498
|
private toSpaceRect;
|
|
634
499
|
private resolveLayoutLength;
|
|
635
500
|
private resolveLayoutInsets;
|
|
@@ -669,6 +534,14 @@ declare class CanvasService implements Service {
|
|
|
669
534
|
private createFabricObject;
|
|
670
535
|
}
|
|
671
536
|
|
|
537
|
+
declare const DIELINE_SHAPES: readonly ["rect", "circle", "ellipse", "heart", "custom"];
|
|
538
|
+
type DielineShape = (typeof DIELINE_SHAPES)[number];
|
|
539
|
+
type ShapeFitMode = "contain" | "stretch";
|
|
540
|
+
interface DielineShapeStyle {
|
|
541
|
+
fitMode: ShapeFitMode;
|
|
542
|
+
[key: string]: unknown;
|
|
543
|
+
}
|
|
544
|
+
|
|
672
545
|
type CutMode = "trim" | "outset" | "inset";
|
|
673
546
|
interface SceneRect {
|
|
674
547
|
left: number;
|
|
@@ -737,6 +610,220 @@ interface VisibilityEvalContext {
|
|
|
737
610
|
}
|
|
738
611
|
declare function evaluateVisibilityExpr(expr: VisibilityExpr | undefined, context: VisibilityEvalContext): boolean;
|
|
739
612
|
|
|
613
|
+
interface FrameRect {
|
|
614
|
+
left: number;
|
|
615
|
+
top: number;
|
|
616
|
+
width: number;
|
|
617
|
+
height: number;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
interface SourceSize {
|
|
621
|
+
width: number;
|
|
622
|
+
height: number;
|
|
623
|
+
}
|
|
624
|
+
interface RectLike {
|
|
625
|
+
width: number;
|
|
626
|
+
height: number;
|
|
627
|
+
}
|
|
628
|
+
declare function getCoverScale(frame: RectLike, source: RectLike): number;
|
|
629
|
+
|
|
630
|
+
interface ImageOperationArea {
|
|
631
|
+
width: number;
|
|
632
|
+
height: number;
|
|
633
|
+
centerX: number;
|
|
634
|
+
centerY: number;
|
|
635
|
+
}
|
|
636
|
+
interface ImageOperationViewport {
|
|
637
|
+
left: number;
|
|
638
|
+
top: number;
|
|
639
|
+
width: number;
|
|
640
|
+
height: number;
|
|
641
|
+
}
|
|
642
|
+
type ImageOperationAreaSpec = {
|
|
643
|
+
type: "frame";
|
|
644
|
+
} | {
|
|
645
|
+
type: "viewport";
|
|
646
|
+
} | ({
|
|
647
|
+
type: "custom";
|
|
648
|
+
} & ImageOperationArea);
|
|
649
|
+
type ImageOperation = {
|
|
650
|
+
type: "cover";
|
|
651
|
+
area?: ImageOperationAreaSpec;
|
|
652
|
+
} | {
|
|
653
|
+
type: "contain";
|
|
654
|
+
area?: ImageOperationAreaSpec;
|
|
655
|
+
} | {
|
|
656
|
+
type: "maximizeWidth";
|
|
657
|
+
area?: ImageOperationAreaSpec;
|
|
658
|
+
} | {
|
|
659
|
+
type: "maximizeHeight";
|
|
660
|
+
area?: ImageOperationAreaSpec;
|
|
661
|
+
} | {
|
|
662
|
+
type: "center";
|
|
663
|
+
area?: ImageOperationAreaSpec;
|
|
664
|
+
} | {
|
|
665
|
+
type: "resetTransform";
|
|
666
|
+
};
|
|
667
|
+
interface ComputeImageOperationArgs {
|
|
668
|
+
frame: FrameRect;
|
|
669
|
+
source: SourceSize;
|
|
670
|
+
operation: ImageOperation;
|
|
671
|
+
area: ImageOperationArea;
|
|
672
|
+
}
|
|
673
|
+
declare function resolveImageOperationArea(args: {
|
|
674
|
+
frame: FrameRect;
|
|
675
|
+
viewport: ImageOperationViewport;
|
|
676
|
+
area?: ImageOperationAreaSpec;
|
|
677
|
+
}): ImageOperationArea;
|
|
678
|
+
declare function computeImageOperationUpdates(args: ComputeImageOperationArgs): {
|
|
679
|
+
scale?: number;
|
|
680
|
+
left?: number;
|
|
681
|
+
top?: number;
|
|
682
|
+
angle?: number;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
declare function hasAnyImageInViewState(state: ImageViewState | null | undefined): boolean;
|
|
686
|
+
|
|
687
|
+
declare class SizeTool implements Extension {
|
|
688
|
+
id: string;
|
|
689
|
+
metadata: {
|
|
690
|
+
name: string;
|
|
691
|
+
};
|
|
692
|
+
private context?;
|
|
693
|
+
private canvasService?;
|
|
694
|
+
activate(context: ExtensionContext): void;
|
|
695
|
+
deactivate(_context: ExtensionContext): void;
|
|
696
|
+
contribute(): {
|
|
697
|
+
[ContributionPointIds.TOOLS]: {
|
|
698
|
+
id: string;
|
|
699
|
+
name: string;
|
|
700
|
+
interaction: string;
|
|
701
|
+
}[];
|
|
702
|
+
[ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
|
|
703
|
+
[ContributionPointIds.COMMANDS]: CommandContribution[];
|
|
704
|
+
};
|
|
705
|
+
private getConfigService;
|
|
706
|
+
private ensureDefaults;
|
|
707
|
+
private emitStateChanged;
|
|
708
|
+
private getStateForUI;
|
|
709
|
+
private updateDimensions;
|
|
710
|
+
private setConstraintMode;
|
|
711
|
+
private setUnit;
|
|
712
|
+
private setCut;
|
|
713
|
+
private getSelectedImageSize;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
type FeatureOperation = "add" | "subtract";
|
|
717
|
+
type FeatureShape = "rect" | "circle";
|
|
718
|
+
interface DielineFeature {
|
|
719
|
+
id: string;
|
|
720
|
+
groupId?: string;
|
|
721
|
+
operation: FeatureOperation;
|
|
722
|
+
shape: FeatureShape;
|
|
723
|
+
x: number;
|
|
724
|
+
y: number;
|
|
725
|
+
width?: number;
|
|
726
|
+
height?: number;
|
|
727
|
+
radius?: number;
|
|
728
|
+
rotation?: number;
|
|
729
|
+
renderBehavior?: "edge" | "surface";
|
|
730
|
+
color?: string;
|
|
731
|
+
strokeDash?: number[];
|
|
732
|
+
skipCut?: boolean;
|
|
733
|
+
bridge?: {
|
|
734
|
+
type: "vertical";
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
interface DielineGeometry {
|
|
739
|
+
shape: DielineShape;
|
|
740
|
+
shapeStyle: DielineShapeStyle;
|
|
741
|
+
unit: "px";
|
|
742
|
+
x: number;
|
|
743
|
+
y: number;
|
|
744
|
+
width: number;
|
|
745
|
+
height: number;
|
|
746
|
+
radius: number;
|
|
747
|
+
offset: number;
|
|
748
|
+
borderLength?: number;
|
|
749
|
+
scale?: number;
|
|
750
|
+
strokeWidth?: number;
|
|
751
|
+
pathData?: string;
|
|
752
|
+
customSourceWidthPx?: number;
|
|
753
|
+
customSourceHeightPx?: number;
|
|
754
|
+
}
|
|
755
|
+
interface LineStyle {
|
|
756
|
+
width: number;
|
|
757
|
+
color: string;
|
|
758
|
+
dashLength: number;
|
|
759
|
+
style: "solid" | "dashed" | "hidden";
|
|
760
|
+
}
|
|
761
|
+
interface DielineState {
|
|
762
|
+
shape: DielineShape;
|
|
763
|
+
shapeStyle: DielineShapeStyle;
|
|
764
|
+
width: number;
|
|
765
|
+
height: number;
|
|
766
|
+
radius: number;
|
|
767
|
+
offset: number;
|
|
768
|
+
padding: number | string;
|
|
769
|
+
mainLine: LineStyle;
|
|
770
|
+
offsetLine: LineStyle;
|
|
771
|
+
insideColor: string;
|
|
772
|
+
showBleedLines: boolean;
|
|
773
|
+
features: DielineFeature[];
|
|
774
|
+
pathData?: string;
|
|
775
|
+
customSourceWidthPx?: number;
|
|
776
|
+
customSourceHeightPx?: number;
|
|
777
|
+
}
|
|
778
|
+
declare function createDefaultDielineState(): DielineState;
|
|
779
|
+
declare function readDielineState(configService: ConfigurationService, fallback?: Partial<DielineState>): DielineState;
|
|
780
|
+
|
|
781
|
+
declare class DielineTool implements Extension {
|
|
782
|
+
id: string;
|
|
783
|
+
metadata: {
|
|
784
|
+
name: string;
|
|
785
|
+
};
|
|
786
|
+
private state;
|
|
787
|
+
private canvasService?;
|
|
788
|
+
private context?;
|
|
789
|
+
private specs;
|
|
790
|
+
private effects;
|
|
791
|
+
private renderSeq;
|
|
792
|
+
private renderProducerDisposable?;
|
|
793
|
+
private onCanvasResized;
|
|
794
|
+
constructor(options?: Partial<DielineState>);
|
|
795
|
+
activate(context: ExtensionContext): void;
|
|
796
|
+
deactivate(context: ExtensionContext): void;
|
|
797
|
+
contribute(): {
|
|
798
|
+
[ContributionPointIds.TOOLS]: {
|
|
799
|
+
id: string;
|
|
800
|
+
name: string;
|
|
801
|
+
interaction: string;
|
|
802
|
+
session: {
|
|
803
|
+
autoBegin: boolean;
|
|
804
|
+
leavePolicy: string;
|
|
805
|
+
};
|
|
806
|
+
}[];
|
|
807
|
+
[ContributionPointIds.CONFIGURATIONS]: _pooder_core.ConfigurationContribution[];
|
|
808
|
+
[ContributionPointIds.COMMANDS]: _pooder_core.CommandContribution[];
|
|
809
|
+
};
|
|
810
|
+
private createHatchPattern;
|
|
811
|
+
private getConfigService;
|
|
812
|
+
private hasImageItems;
|
|
813
|
+
private buildDielineSpecs;
|
|
814
|
+
private buildImageClipEffects;
|
|
815
|
+
updateDieline(_emitEvent?: boolean): void;
|
|
816
|
+
private updateDielineAsync;
|
|
817
|
+
getGeometry(): DielineGeometry | null;
|
|
818
|
+
exportCutImage(options?: {
|
|
819
|
+
debug?: boolean;
|
|
820
|
+
}): Promise<string | null>;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
declare function createDielineCommands(tool: any, state: any): CommandContribution[];
|
|
824
|
+
|
|
825
|
+
declare function createDielineConfigurations(state: any): ConfigurationContribution[];
|
|
826
|
+
|
|
740
827
|
interface ConstraintFeature extends DielineFeature {
|
|
741
828
|
constraints?: Array<{
|
|
742
829
|
type: string;
|
|
@@ -1059,4 +1146,4 @@ declare function createWhiteInkCommands(tool: any): CommandContribution[];
|
|
|
1059
1146
|
|
|
1060
1147
|
declare function createWhiteInkConfigurations(): ConfigurationContribution[];
|
|
1061
1148
|
|
|
1062
|
-
export { type BackgroundConfig, type BackgroundFitMode, type BackgroundLayer, type BackgroundLayerKind, type BackgroundRegionUnit, type BackgroundRegistration, type BackgroundRegistrationFrame, type BackgroundRegistrationRegion, BackgroundTool, CanvasService, type DielineGeometry, type DielineState, DielineTool, FeatureTool, FilmTool, type ImageItem, ImageTool, type LayerObjectCountComparator, type LineStyle, MirrorTool, type RenderClipPathEffectSpec, type RenderCoordinateSpace, type RenderEffectSpec, type RenderLayoutAlign, type RenderLayoutInsets, type RenderLayoutLength, type RenderLayoutRect, type RenderLayoutReference, type RenderObjectLayoutSpec, type RenderObjectSpec, type RenderObjectType, type RenderPassSpec, type RenderProps, RulerTool, SceneLayoutService, SizeTool, ViewportSystem, type VisibilityEvalContext, type VisibilityExpr, type VisibilityLayerState, type WhiteInkItem, WhiteInkTool, getCoverScale as computeImageCoverScale, getCoverScale as computeWhiteInkCoverScale, createDefaultDielineState, createDielineCommands, createDielineConfigurations, createImageCommands, createImageConfigurations, createWhiteInkCommands, createWhiteInkConfigurations, evaluateVisibilityExpr, readDielineState };
|
|
1149
|
+
export { type BackgroundConfig, type BackgroundFitMode, type BackgroundLayer, type BackgroundLayerKind, type BackgroundRegionUnit, type BackgroundRegistration, type BackgroundRegistrationFrame, type BackgroundRegistrationRegion, BackgroundTool, CanvasService, type ComputeImageOperationArgs, type DielineGeometry, type DielineState, DielineTool, FeatureTool, FilmTool, type ImageItem, type ImageOperation, type ImageOperationArea, type ImageOperationAreaSpec, type ImageOperationViewport, ImageTool, type ImageTransformUpdates, type ImageViewState, type LayerObjectCountComparator, type LineStyle, MirrorTool, type RenderClipPathEffectSpec, type RenderCoordinateSpace, type RenderEffectSpec, type RenderLayoutAlign, type RenderLayoutInsets, type RenderLayoutLength, type RenderLayoutRect, type RenderLayoutReference, type RenderObjectLayoutSpec, type RenderObjectSpec, type RenderObjectType, type RenderPassSpec, type RenderProps, RulerTool, SceneLayoutService, SizeTool, ViewportSystem, type VisibilityEvalContext, type VisibilityExpr, type VisibilityLayerState, type WhiteInkItem, WhiteInkTool, getCoverScale as computeImageCoverScale, computeImageOperationUpdates, getCoverScale as computeWhiteInkCoverScale, createDefaultDielineState, createDielineCommands, createDielineConfigurations, createImageCommands, createImageConfigurations, createWhiteInkCommands, createWhiteInkConfigurations, evaluateVisibilityExpr, hasAnyImageInViewState, readDielineState, resolveImageOperationArea };
|