@yoobic/yobi 8.2.0-28 → 8.2.0-29

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.
@@ -23,7 +23,7 @@ const YooTruncatedLineComponent = class {
23
23
  return (index.h("yoo-tooltip", { ref: (el) => this.tooltipElement = el, content: this.content, placement: this.tooltipPlacement }, this.renderContent()));
24
24
  };
25
25
  this.renderContent = () => {
26
- return (index.h("div", { class: "content", ref: (el) => this.contentElement = el }, this.content, index.h("slot", null)));
26
+ return (index.h("div", { class: "content", ref: (el) => this.contentElement = el }, index$1.translateMulti(this.content), index.h("slot", null)));
27
27
  };
28
28
  this.toggleTooltip = (isEnabled) => {
29
29
  if (this.tooltipElement) {
@@ -1,4 +1,4 @@
1
- import { isTruncated } from '@shared/utils';
1
+ import { isTruncated, translateMulti } from '@shared/utils';
2
2
  import { Component, Element, h, Host, Prop } from '@stencil/core';
3
3
  //! Things to note:
4
4
  //* - This component is for single line ONLY
@@ -18,7 +18,7 @@ export class YooTruncatedLineComponent {
18
18
  };
19
19
  this.renderContent = () => {
20
20
  return (h("div", { class: "content", ref: (el) => this.contentElement = el },
21
- this.content,
21
+ translateMulti(this.content),
22
22
  h("slot", null)));
23
23
  };
24
24
  this.toggleTooltip = (isEnabled) => {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
- import { eU as isTruncated } from './index-60d331ff.js';
2
+ import { T as translateMulti, eU as isTruncated } from './index-60d331ff.js';
3
3
  import './lodash-b0ad17f3.js';
4
4
  import './_commonjsHelpers-f4d11124.js';
5
5
  import './index-da54e081.js';
@@ -19,7 +19,7 @@ const YooTruncatedLineComponent = class {
19
19
  return (h("yoo-tooltip", { ref: (el) => this.tooltipElement = el, content: this.content, placement: this.tooltipPlacement }, this.renderContent()));
20
20
  };
21
21
  this.renderContent = () => {
22
- return (h("div", { class: "content", ref: (el) => this.contentElement = el }, this.content, h("slot", null)));
22
+ return (h("div", { class: "content", ref: (el) => this.contentElement = el }, translateMulti(this.content), h("slot", null)));
23
23
  };
24
24
  this.toggleTooltip = (isEnabled) => {
25
25
  if (this.tooltipElement) {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, e as Host, g as getElement } from './index-019c1b1a.js';
2
- import { eU as isTruncated } from './index-60d331ff.js';
2
+ import { T as translateMulti, eU as isTruncated } from './index-60d331ff.js';
3
3
  import './lodash-b0ad17f3.js';
4
4
  import './_commonjsHelpers-f4d11124.js';
5
5
  import './index-da54e081.js';
@@ -19,7 +19,7 @@ const YooTruncatedLineComponent = class {
19
19
  return (h("yoo-tooltip", { ref: (el) => this.tooltipElement = el, content: this.content, placement: this.tooltipPlacement }, this.renderContent()));
20
20
  };
21
21
  this.renderContent = () => {
22
- return (h("div", { class: "content", ref: (el) => this.contentElement = el }, this.content, h("slot", null)));
22
+ return (h("div", { class: "content", ref: (el) => this.contentElement = el }, translateMulti(this.content), h("slot", null)));
23
23
  };
24
24
  this.toggleTooltip = (isEnabled) => {
25
25
  if (this.tooltipElement) {
@@ -0,0 +1,1070 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ type ProgressCallback = (event: ProgressEvent) => void;
3
+
4
+ type Percentage = string;
5
+
6
+ interface PinturaMetadata {
7
+ [key: string]: any;
8
+ }
9
+
10
+ // prettier-ignore
11
+ /**
12
+ * A matrix of 20 digits based on the SVG <feColorMatrix> filter
13
+ *
14
+ * @example
15
+ * ```
16
+ * R G B A W
17
+ * R | 1 0 0 0 0
18
+ * G | 0 1 0 0 0
19
+ * B | 0 0 1 0 0
20
+ * A | 0 0 0 1 0
21
+ * ```
22
+ * @link Utility to generate a color matrix: https://fecolormatrix.com
23
+ * @link More information on color matrices: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feColorMatrix
24
+ */
25
+ type ColorMatrix = [
26
+ number, number, number, number, number,
27
+ number, number, number, number, number,
28
+ number, number, number, number, number,
29
+ number, number, number, number, number
30
+ ];
31
+
32
+ // prettier-ignore
33
+ /**
34
+ * A matrix of 9 digits based on the SVG <feConvolveMatrix> filter
35
+ *
36
+ * @example
37
+ * ```
38
+ * 1 0 0
39
+ * 0 1 0
40
+ * 0 0 1
41
+ * ```
42
+ * @link More information on convolution matrices: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feConvolveMatrix
43
+ */
44
+ type ConvolutionMatrix = [
45
+ number, number, number,
46
+ number, number, number,
47
+ number, number, number
48
+ ];
49
+
50
+ type Color = number[];
51
+
52
+ type TextAlign = 'left' | 'center' | 'right';
53
+
54
+ type TextLayout = 'auto-width' | 'auto-height' | 'fixed-size';
55
+
56
+ type SizeCategory =
57
+ | 'extraSmall'
58
+ | 'small'
59
+ | 'mediumSmall'
60
+ | 'medium'
61
+ | 'mediumLarge'
62
+ | 'large'
63
+ | 'extraLarge';
64
+
65
+ type LineEndStyle =
66
+ | 'bar'
67
+ | 'arrow'
68
+ | 'arrowSolid'
69
+ | 'circle'
70
+ | 'circleSolid'
71
+ | 'square'
72
+ | 'squareSolid';
73
+
74
+ interface ColorPalette {
75
+ transparent?: Color;
76
+ white?: Color;
77
+ silver?: Color;
78
+ gray?: Color;
79
+ black?: Color;
80
+ navy?: Color;
81
+ blue?: Color;
82
+ aqua?: Color;
83
+ teal?: Color;
84
+ olive?: Color;
85
+ green?: Color;
86
+ yellow?: Color;
87
+ orange?: Color;
88
+ red?: Color;
89
+ maroon?: Color;
90
+ fuchsia?: Color;
91
+ purple?: Color;
92
+ }
93
+
94
+ type SizeCategories = Record<SizeCategory, Percentage | number>;
95
+
96
+ interface LocaleCollection {
97
+ [shapeProperty: string]: string;
98
+ }
99
+
100
+ type LocaleString = string | ((locale: LocaleCollection) => string);
101
+
102
+ interface Vector {
103
+ x: number;
104
+ y: number;
105
+ }
106
+
107
+ interface Size {
108
+ width: number;
109
+ height: number;
110
+ }
111
+
112
+ interface Rect {
113
+ x: number;
114
+ y: number;
115
+ width: number;
116
+ height: number;
117
+ }
118
+
119
+ interface ShapeToolOptions {
120
+ position?: string;
121
+ }
122
+
123
+ interface ShapeRectangle {
124
+ x?: number | Percentage;
125
+ y?: number | Percentage;
126
+ width?: number | Percentage;
127
+ height?: number | Percentage;
128
+ }
129
+
130
+ interface Shape {
131
+ x?: number | Percentage;
132
+ y?: number | Percentage;
133
+ width?: number | Percentage;
134
+ height?: number | Percentage;
135
+ left?: number | Percentage;
136
+ top?: number | Percentage;
137
+ right?: number | Percentage;
138
+ bottom?: number | Percentage;
139
+ rx?: number | Percentage;
140
+ ry?: number | Percentage;
141
+ x1?: number | Percentage;
142
+ y1?: number | Percentage;
143
+ x2?: number | Percentage;
144
+ y2?: number | Percentage;
145
+ x3?: number | Percentage;
146
+ y3?: number | Percentage;
147
+ strokeColor?: Color;
148
+ strokeWidth?: number | Percentage;
149
+ cornerRadius?: number | Percentage;
150
+ fontSize?: number | Percentage;
151
+ fontFamily?: string;
152
+ lineHeight?: number | Percentage;
153
+ textAlign?: undefined | 'left' | 'center' | 'right';
154
+ text?: string;
155
+ aspectRatio?: number;
156
+ rotation?: number;
157
+ points?: Vector[];
158
+ color?: Color;
159
+ backgroundColor?: Color;
160
+ eraseRadius?: number;
161
+ lineStart?:
162
+ | undefined
163
+ | 'bar'
164
+ | 'arrow'
165
+ | 'arrow-solid'
166
+ | 'square'
167
+ | 'square-solid'
168
+ | 'circle'
169
+ | 'circle-solid';
170
+ lineEnd?:
171
+ | undefined
172
+ | 'bar'
173
+ | 'arrow'
174
+ | 'arrow-solid'
175
+ | 'square'
176
+ | 'square-solid'
177
+ | 'circle'
178
+ | 'circle-solid';
179
+ isSelected?: boolean;
180
+ isEditing?: boolean;
181
+ disableStyle?: boolean | string[];
182
+ disableErase?: boolean;
183
+ disableSelect?: boolean;
184
+ disableRemove?: boolean;
185
+ disableDuplicate?: boolean;
186
+ disableReorder?: boolean;
187
+ disableFlip?: boolean;
188
+ disableInput?: boolean | ((text: string) => string);
189
+ disableManipulate?: boolean;
190
+ disableMove?: boolean;
191
+ disableResize?: boolean;
192
+ disableRotate?: boolean;
193
+ disableTextLayout?: boolean | TextLayout[];
194
+
195
+ // private
196
+ readonly _context?: Rect | Size;
197
+ readonly _isDraft?: boolean;
198
+ readonly _isComplete?: boolean;
199
+ readonly _isError?: boolean;
200
+ readonly _isLoading?: boolean;
201
+ readonly _isFormatted?: boolean;
202
+ }
203
+
204
+ type SvelteComponent = any;
205
+ type SvelteComponentProps = any;
206
+
207
+ type ShapeControl = [
208
+ // Component to use
209
+ SvelteComponent,
210
+
211
+ // Component properties to map
212
+ {
213
+ title?: LocaleString;
214
+ label?: LocaleString;
215
+ options?: SvelteComponentProps;
216
+ optionIconStyle?: LocaleString;
217
+ optionLabelStyle?: LocaleString;
218
+ }
219
+ ];
220
+
221
+ type ShapeColorOption = [Color, string] | [Color, string, any];
222
+ type ShapeSizeOption = [number | Percentage, string] | [number | Percentage, string, any];
223
+
224
+ type ShapeLineEndOption = [LineEndStyle, string] | [LineEndStyle, string, any];
225
+ type ShapeFontFamilyOption = [string, string] | [string, string, any];
226
+ type ShapeFontStyleOption = [string, string] | [string, string, any];
227
+
228
+ interface ShapeControlOptions {
229
+ colorOptions?: false | ShapeColorOption[];
230
+ lineEndStyleOptions?: false | ShapeLineEndOption[];
231
+ fontFamilyOptions?: false | ShapeFontFamilyOption[];
232
+ fontStyleOptions?: false | ShapeFontStyleOption[];
233
+ textAlignOptions?: false | [TextAlign, string][];
234
+ strokeWidthOptions?: false | ShapeSizeOption[] | number[];
235
+ fontSizeOptions?: false | ShapeSizeOption[] | number[];
236
+ lineHeightOptions?: false | ShapeSizeOption[] | number[];
237
+ }
238
+
239
+ interface ShapeControlConfiguration {
240
+ // A mapping of a shapeProperty to a Component
241
+ [shapeProperty: string]: ShapeControl;
242
+ }
243
+
244
+ type StickerSrc = string; // emoji or URL
245
+
246
+ interface StickerTemplate {
247
+ thumb?: StickerSrc;
248
+ src?: StickerSrc;
249
+ width?: number;
250
+ height?: number;
251
+ alt?: string;
252
+ disabled?: boolean;
253
+ shape?: Shape;
254
+ mount?: (
255
+ element: HTMLElement,
256
+ sticker: StickerTemplate
257
+ ) => { update?: (sticker: StickerTemplate) => void; destroy?: () => void };
258
+ }
259
+
260
+ type Sticker = StickerSrc | StickerTemplate;
261
+
262
+ interface StickerGroupOptions {
263
+ icon?: string;
264
+ hideLabel?: boolean;
265
+ disabled?: boolean;
266
+ }
267
+
268
+ type StickerGroup = [string, Sticker[]] | [string, Sticker[], StickerGroupOptions];
269
+
270
+ type ImageSource = File | Blob | string | HTMLImageElement | HTMLCanvasElement;
271
+
272
+ interface Store {
273
+ subscribe: (value: (value: any) => void) => () => void;
274
+ set?: (value: any) => void;
275
+ update?: (fn: (value: any) => any) => void;
276
+ }
277
+
278
+ interface StoreCollection {
279
+ [shapeProperty: string]: Store;
280
+ }
281
+
282
+ type Filter = () => ColorMatrix;
283
+
284
+ interface Frame {
285
+ shape: any;
286
+ thumb: string; // HTML or SVG
287
+ }
288
+
289
+ interface Effect {
290
+ base: number;
291
+ min: number;
292
+ max: number;
293
+ getLabel?: (value: number) => number;
294
+ getStore: (stores: StoreCollection) => Store;
295
+ getValue: (store: Store) => number;
296
+ setValue: (store: Store, value: number) => void;
297
+ }
298
+
299
+ interface EditorHistory {
300
+ undo: () => number;
301
+ redo: () => number;
302
+ revert: () => void;
303
+ write: (imageState?: any) => void;
304
+ get: () => any[];
305
+ getCollapsed: () => any[];
306
+ set: (imageStates: any[]) => void;
307
+ readonly length: number;
308
+ readonly index: number;
309
+ }
310
+
311
+ interface EditorMethods {
312
+ on: (event: string, cb: (detail?: any) => void) => void;
313
+ loadImage: (
314
+ src: ImageSource,
315
+ options: ImageOptions
316
+ ) => Promise<PinturaDefaultImageReaderResult>;
317
+ editImage: (
318
+ src: ImageSource,
319
+ options: ImageOptions
320
+ ) => Promise<PinturaDefaultImageWriterResult>;
321
+ processImage: () => Promise<PinturaDefaultImageWriterResult>;
322
+ abortLoadImage: () => void;
323
+ abortProcessImage: () => void;
324
+ updateImage: (src: ImageSource) => Promise<PinturaDefaultImageReaderResult>;
325
+ updateImagePreview: (src: ImageSource) => void;
326
+ readonly history: EditorHistory;
327
+ close: () => void;
328
+ destroy: () => void;
329
+ }
330
+
331
+ type CropOption = [number | undefined, string];
332
+
333
+ type SizeOption = [[number, number], string];
334
+
335
+ type CropPresetOption = CropOption | SizeOption;
336
+
337
+ type OptionGroup = [string, any[]] | [string, any[], any];
338
+
339
+ interface CropPluginOptions {
340
+ cropAutoCenterImageSelectionTimeout?: undefined | number;
341
+ cropWillRenderImageSelectionGuides?:
342
+ | undefined
343
+ | ((
344
+ interaction: string,
345
+ interactionFraction: number
346
+ ) => { rows: number; cols: number; opacity: number });
347
+ cropEnableButtonFlipHorizontal?: boolean;
348
+ cropEnableButtonFlipVertical?: boolean;
349
+ cropEnableButtonRotateLeft?: boolean;
350
+ cropEnableButtonRotateRight?: boolean;
351
+ cropEnableButtonToggleCropLimit?: boolean;
352
+ cropEnableCenterImageSelection?: boolean;
353
+ cropEnableImageSelection?: boolean;
354
+ cropEnableInfoIndicator?: boolean;
355
+ cropEnableLimitWheelInputToCropSelection?: boolean;
356
+ cropEnableRotationInput?: boolean;
357
+ cropEnableSelectPreset?: boolean;
358
+ cropEnableZoomInput?: boolean;
359
+ cropEnableZoomMatchImageAspectRatio?: boolean;
360
+ cropEnableZoomTowardsWheelPosition?: boolean;
361
+ cropEnableZoomAutoHide?: boolean;
362
+ cropImageSelectionCornerStyle?: undefined | 'hook' | 'round' | 'invisible';
363
+ cropSelectPresetOptions?: OptionGroup[] | CropPresetOption[];
364
+ cropEnableRotateMatchImageAspectRatio?: 'never' | 'custom' | 'always';
365
+ cropWillRenderTools?: (nodes: PinturaNode[], env: any, redraw: () => void) => PinturaNode[];
366
+ }
367
+
368
+ interface ShapeToolButtonOptions {
369
+ icon?: string;
370
+ }
371
+
372
+ type ShapeTool = [string, LocaleString] | [string, LocaleString, ShapeToolButtonOptions];
373
+
374
+ interface MarkupEditorProperties {
375
+ markupEditorToolbar?: [string, LocaleString, any][];
376
+ markupEditorToolStyles?: MarkupEditorToolStyleDefaults;
377
+ markupEditorShapeStyleControls?: MarkupEditorShapeStyleControlDefaults;
378
+ markupEditorToolSelectRadius?: number;
379
+ markupEditorTextInputMode?: 'modal' | 'inline';
380
+ enableSelectToolToAddShape?: boolean;
381
+ enableTapToAddText?: boolean;
382
+ enableZoom?: boolean;
383
+ enablePan?: boolean;
384
+ enableZoomControls?: boolean;
385
+ markupEditorZoomLevels?: number[];
386
+ markupEditorZoomAdjustStep?: number;
387
+ markupEditorZoomAdjustFactor?: number;
388
+ markupEditorWillStartInteraction?: (point: Vector, image: Rect) => boolean;
389
+ }
390
+
391
+ interface AnnotatePluginOptions extends MarkupEditorProperties {
392
+ annotateActiveTool?: string;
393
+ annotateEnableButtonFlipVertical?: boolean;
394
+ annotatePresets?: Sticker[] | StickerGroup[];
395
+ }
396
+
397
+ interface DecoratePluginOptions extends MarkupEditorProperties {
398
+ decorateActiveTool?: string;
399
+ decorateEnableButtonFlipVertical?: boolean;
400
+ decoratePresets?: Sticker[] | StickerGroup[];
401
+ }
402
+
403
+ interface FilterPluginOptions {
404
+ filterFunctions?: { [key: string]: Filter };
405
+ filterOptions?: any;
406
+ }
407
+
408
+ interface FinetunePluginOptions {
409
+ finetuneControlConfiguration?: { [key: string]: Effect };
410
+ finetuneOptions?: [string | undefined, LocaleString];
411
+ }
412
+
413
+ interface ResizePluginOptions {
414
+ resizeMaxSize?: Size;
415
+ resizeMinSize?: Size;
416
+ resizeSizePresetOptions?: OptionGroup[] | SizeOption[];
417
+ resizeWidthPresetOptions?: OptionGroup[] | SizeOption[];
418
+ resizeHeightPresetOptions?: OptionGroup[] | SizeOption[];
419
+ resizeWillRenderFooter?: (nodes: PinturaNode[], env: any, redraw: () => void) => PinturaNode[];
420
+ }
421
+
422
+ interface FramePluginOptions {
423
+ frameStyles?: {
424
+ [key: string]: {
425
+ shape: {
426
+ frameStyle: string;
427
+ [key: string]: any;
428
+ };
429
+ thumb: string;
430
+ };
431
+ };
432
+ frameOptions?: [string | undefined, LocaleString];
433
+ }
434
+
435
+ interface StickerPluginOptions {
436
+ stickers?: Sticker[] | StickerGroup[];
437
+ stickerStickToImage?: boolean;
438
+ stickersEnableButtonFlipVertical?: boolean;
439
+ }
440
+
441
+ interface PinturaImageState {
442
+ backgroundColor?: Color;
443
+ colorMatrix?: ColorMatrix;
444
+ convolutionMatrix?: ConvolutionMatrix;
445
+ crop?: Rect;
446
+ cropAspectRatio?: number | undefined;
447
+ cropLimitToImage?: boolean;
448
+ cropMaxSize?: Size;
449
+ cropMinSize?: Size;
450
+ redaction?: ShapeRectangle[];
451
+ annotation?: Shape[];
452
+ decoration?: Shape[];
453
+ flipX?: boolean;
454
+ flipY?: boolean;
455
+ frame?: string;
456
+ gamma?: number;
457
+ rotation?: number;
458
+ vignette?: number;
459
+ targetSize?: Size;
460
+ metadata?: PinturaMetadata;
461
+ }
462
+
463
+ interface ImageOptions extends PinturaImageState {
464
+ readonly size: Size;
465
+ readonly aspectRatio: number;
466
+ readonly cropSize: Size;
467
+ readonly cropRectAspectRatio: number;
468
+ readonly file: File;
469
+ readonly loadState: any;
470
+ readonly processState: any;
471
+ readonly rotationRange: [number, number];
472
+ state?: any;
473
+ }
474
+
475
+ interface EditorImageOptionsReadonly {
476
+ readonly imageSize: Size;
477
+ readonly imageAspectRatio: number;
478
+ readonly imageCropSize: Size;
479
+ readonly imageCropRectAspectRatio: number;
480
+ readonly imageFile: File;
481
+ readonly imageLoadState: any;
482
+ readonly imageProcessState: any;
483
+ readonly imageRotationRange: [number, number];
484
+ }
485
+
486
+ interface EditorImageOptions {
487
+ imageBackgroundColor?: Color;
488
+ imageColorMatrix?: ColorMatrix;
489
+ imageConvolutionMatrix?: ConvolutionMatrix;
490
+ imageCrop?: Rect;
491
+ imageCropAspectRatio?: number | undefined;
492
+ imageCropLimitToImage?: boolean;
493
+ imageCropMaxSize?: Size;
494
+ imageCropMinSize?: Size;
495
+ imageRedaction?: ShapeRectangle[];
496
+ imageAnnotation?: Shape[];
497
+ imageDecoration?: Shape[];
498
+ imageFlipX?: boolean;
499
+ imageFlipY?: boolean;
500
+ imageGamma?: number;
501
+ imageNoise?: number;
502
+ imageRotation?: number;
503
+ imageVignette?: number;
504
+ imageTargetSize?: Size;
505
+ imageFrame?:
506
+ | string
507
+ | {
508
+ [key: string]: any;
509
+ frameStyle: string;
510
+ };
511
+ imageMetadata?: PinturaMetadata;
512
+ imageState?: any;
513
+ }
514
+
515
+ interface EditorOptionsReadonly {
516
+ readonly element?: HTMLElement;
517
+ readonly stores?: any[];
518
+ readonly images?: any;
519
+ }
520
+
521
+ interface PinturaNodeOptions {
522
+ [key: string]: any;
523
+ }
524
+
525
+ type PinturaComponent = 'Button' | 'Dropdown';
526
+
527
+ type PinturaNodeType = string | SvelteComponent | PinturaComponent;
528
+
529
+ type PinturaNode =
530
+ | [PinturaNodeType, string]
531
+ | [PinturaNodeType, string, PinturaNodeOptions]
532
+ | [PinturaNodeType, string, PinturaNode[]]
533
+ | [PinturaNodeType, string, PinturaNodeOptions, PinturaNode[]];
534
+
535
+ type PinturaEditorStatus = string | [string] | [string, number] | [string, false] | undefined;
536
+
537
+ interface EditorOptions {
538
+ id?: string;
539
+ class?: string;
540
+ animations?: boolean;
541
+ src?: ImageSource;
542
+ util?: string;
543
+ utils?: string[];
544
+ disabled?: boolean;
545
+ status?: PinturaEditorStatus;
546
+ elasticityMultiplier?: number;
547
+ layoutDirectionPreference?: 'auto' | 'horizontal' | 'vertical';
548
+ layoutVerticalUtilsPreference?: 'left' | 'right';
549
+ layoutHorizontalUtilsPreference?: 'bottom' | 'top';
550
+ imageSourceToImageData?: (src: any) => Promise<ImageData>;
551
+ previewImageData?: ImageBitmap | ImageData | HTMLCanvasElement;
552
+ previewImageDataMaxSize?: Size;
553
+ previewUpscale?: boolean;
554
+ shapePreprocessor?: any;
555
+ enableButtonClose?: boolean;
556
+ enableButtonExport?: boolean;
557
+ enableButtonResetHistory?: boolean;
558
+ enableButtonRevert?: boolean;
559
+ enableNavigateHistory?: boolean;
560
+ enableToolbar?: boolean;
561
+ enableUtils?: boolean;
562
+ enableDropImage?: boolean;
563
+ enablePasteImage?: boolean;
564
+ handleEvent?: (type: string, detail: any) => void;
565
+ willRequestResource?: (url: string) => boolean;
566
+ willClose?: () => Promise<boolean>;
567
+ willRevert?: () => Promise<boolean>;
568
+ willProcessImage?: () => Promise<boolean>;
569
+ willRenderCanvas?: (
570
+ shapes: {
571
+ decorationShapes: Shape[];
572
+ annotationShapes: Shape[];
573
+ interfaceShapes: Shape[];
574
+ },
575
+ state: any
576
+ ) => {
577
+ decorationShapes: Shape[];
578
+ annotationShapes: Shape[];
579
+ interfaceShapes: Shape[];
580
+ };
581
+ willSetHistoryInitialState?: (initialState: any) => any;
582
+ willRenderToolbar?: (nodes: PinturaNode[], env: any, redraw: () => void) => PinturaNode[];
583
+ beforeSelectShape?: (current: Shape | undefined, target: Shape) => boolean;
584
+ beforeDeselectShape?: (current: Shape, target: Shape | undefined) => boolean;
585
+ beforeAddShape?: (shape: Shape) => boolean;
586
+ beforeRemoveShape?: (shape: Shape) => boolean;
587
+ beforeUpdateShape?: (shape: Shape, props: any, context: Rect) => Shape;
588
+ willRenderShapeControls?: (nodes: PinturaNode[], shapeId: string) => PinturaNode[];
589
+ willRenderShapePresetToolbar?: (
590
+ nodes: PinturaNode[],
591
+ addPreset: (sticker: Sticker) => void,
592
+ env: any,
593
+ redraw: () => void
594
+ ) => PinturaNode[];
595
+ }
596
+
597
+ interface PinturaEditorOptions
598
+ extends EditorOptions,
599
+ EditorImageOptions,
600
+ AnnotatePluginOptions,
601
+ CropPluginOptions,
602
+ DecoratePluginOptions,
603
+ FilterPluginOptions,
604
+ FinetunePluginOptions,
605
+ StickerPluginOptions {
606
+ locale: any;
607
+ imageReader: any[];
608
+ imageWriter?: any[];
609
+ imageOrienter?: any;
610
+ imageScrambler?: any;
611
+ }
612
+
613
+ interface PinturaEditorDefaultOptions
614
+ extends EditorOptions,
615
+ EditorImageOptions,
616
+ AnnotatePluginOptions,
617
+ CropPluginOptions,
618
+ DecoratePluginOptions,
619
+ FilterPluginOptions,
620
+ FinetunePluginOptions,
621
+ StickerPluginOptions {
622
+ locale?: any;
623
+ imageReader?: any[];
624
+ imageWriter?: any[];
625
+ imageOrienter?: any;
626
+ }
627
+
628
+ interface PinturaEditorHeadlessOptions extends EditorImageOptions {
629
+ imageReader?: any[];
630
+ imageWriter?: any[];
631
+ imageScrambler?: any;
632
+ shapePreprocessor?: any;
633
+ }
634
+
635
+ interface PinturaEditor
636
+ extends EditorMethods,
637
+ PinturaEditorOptions,
638
+ EditorOptionsReadonly,
639
+ EditorImageOptionsReadonly {}
640
+
641
+ interface PinturaEditorModalOptions {
642
+ preventZoomViewport?: boolean;
643
+ preventScrollBodyIfNeeded?: boolean;
644
+ preventFooterOverlapIfNeeded?: boolean;
645
+ enableAutoHide?: boolean;
646
+ enableAutoDestroy?: boolean;
647
+ readonly modal?: HTMLElement;
648
+ }
649
+
650
+ interface PinturaEditorModal extends PinturaEditor, PinturaEditorModalOptions {
651
+ show: () => void;
652
+ hide: () => void;
653
+ }
654
+
655
+ interface PinturaReadState {
656
+ index: number;
657
+ task: string;
658
+ taskLengthComputable: boolean;
659
+ taskProgress: number;
660
+ timeStamp: number;
661
+ error?: unknown;
662
+ }
663
+
664
+ interface PinturaWriteState {
665
+ index: number;
666
+ task: string;
667
+ taskLengthComputable: boolean;
668
+ taskProgress: number;
669
+ timeStamp: number;
670
+ error?: unknown;
671
+ }
672
+
673
+ // Default image reader and writer
674
+ interface PinturaDefaultImageReaderResult {
675
+ readonly src: ImageSource;
676
+ readonly dest: File;
677
+ readonly size: Size;
678
+ }
679
+
680
+ interface PinturaDefaultImageWriterResult {
681
+ readonly src: ImageSource;
682
+ readonly dest: File;
683
+ readonly imageState: any;
684
+ readonly store: any;
685
+ }
686
+
687
+ interface PinturaTargetSize {
688
+ width?: number;
689
+ height?: number;
690
+ fit?: 'contain' | 'cover' | 'force';
691
+ upscale?: boolean;
692
+ }
693
+
694
+ interface PinturaDefaultImageReaderOptions {
695
+ orientImage?: boolean;
696
+ outputProps?: string[];
697
+ preprocessImageFile?: (file: File, options: any, onprogress: ProgressCallback) => Promise<File>;
698
+ }
699
+
700
+ type PinturaStoreField = [string, string] | [string, Blob | File, string];
701
+
702
+ interface PinturaDefaultImageWriterOptions {
703
+ canvasMemoryLimit?: number;
704
+ orientImage?: boolean;
705
+ copyImageHead?: boolean;
706
+ mimeType?: string;
707
+ quality?: number;
708
+ format?: 'file' | 'imageData' | 'canvas';
709
+ renameFile?: (file: File) => string;
710
+ targetSize?: PinturaTargetSize;
711
+ imageDataResizer?: (imageData: ImageData, width: number, height: number) => Promise<ImageData>;
712
+ store?:
713
+ | string
714
+ | { url: string; dataset?: (imageState: any) => PinturaStoreField[] }
715
+ | ((imageState: any, options: any, onprogress: ProgressCallback) => Promise<any>);
716
+ outputProps?: string[];
717
+ preprocessImageSource?: (
718
+ imageSource: Blob | File,
719
+ options: any,
720
+ onprogress: ProgressCallback
721
+ ) => Promise<Blob | File>;
722
+ preprocessImageState?: (
723
+ imageState: any,
724
+ options: any,
725
+ onprogress: ProgressCallback
726
+ ) => Promise<any>;
727
+ postprocessImageData?: (
728
+ imageData: any,
729
+ options: any,
730
+ onprogress: ProgressCallback
731
+ ) => Promise<ImageData>;
732
+
733
+ postprocessImageBlob?: (
734
+ output: {
735
+ blob: Blob;
736
+ imageData: ImageData;
737
+ src: File;
738
+ },
739
+ options: any,
740
+ onprogress: ProgressCallback
741
+ ) => Promise<ImageData>;
742
+ }
743
+
744
+ interface PinturaDefaultImageScramblerOptions {
745
+ blurAmount: number;
746
+ scrambleAmount: number;
747
+ // enableSmoothing: boolean;
748
+ }
749
+
750
+ interface PinturaImageOrienter {
751
+ read: (file: Blob | File, onprogress?: ProgressCallback) => Promise<number>;
752
+ apply: (imageData: ImageData, orientation: number) => ImageData;
753
+ }
754
+
755
+ // exports
756
+ export const setPlugins: (...plugins: any[]) => void;
757
+
758
+ export const getEditorDefaults: (
759
+ options?: PinturaEditorDefaultOptions
760
+ ) => PinturaEditorDefaultOptions;
761
+
762
+ export const appendEditor: (
763
+ target: HTMLElement | string,
764
+ options?: PinturaEditorOptions
765
+ ) => PinturaEditor;
766
+
767
+ export const appendDefaultEditor: (
768
+ target: HTMLElement | string,
769
+ options?: PinturaEditorDefaultOptions
770
+ ) => PinturaEditor;
771
+
772
+ export const appendEditors: (
773
+ target: HTMLElement | string,
774
+ options?: PinturaEditorOptions
775
+ ) => PinturaEditor[];
776
+
777
+ export const appendDefaultEditors: (
778
+ target: HTMLElement | string,
779
+ options?: PinturaEditorDefaultOptions
780
+ ) => PinturaEditor[];
781
+
782
+ export const overlayEditor: (
783
+ target: HTMLElement | string,
784
+ options?: PinturaEditorOptions
785
+ ) => PinturaEditor;
786
+
787
+ export const overlayDefaultEditor: (
788
+ target: HTMLElement | string,
789
+ options?: PinturaEditorDefaultOptions
790
+ ) => PinturaEditor;
791
+
792
+ export const openEditor: (options: PinturaEditorOptions) => PinturaEditorModal;
793
+
794
+ export const openDefaultEditor: (options: PinturaEditorDefaultOptions) => PinturaEditorModal;
795
+
796
+ export const defineCustomElements: (options?: PinturaEditorOptions) => Promise<PinturaEditor>;
797
+
798
+ export const defineDefaultCustomElements: (
799
+ options?: PinturaEditorDefaultOptions
800
+ ) => Promise<PinturaEditor>;
801
+
802
+ export const processImage: (
803
+ src: ImageSource,
804
+ options: PinturaEditorHeadlessOptions
805
+ ) => Promise<PinturaDefaultImageWriterResult>;
806
+
807
+ export const processDefaultImage: (
808
+ src: ImageSource,
809
+ options: PinturaEditorHeadlessOptions
810
+ ) => Promise<PinturaDefaultImageWriterResult>;
811
+
812
+ export const createDefaultImageReader: (options?: PinturaDefaultImageReaderOptions) => any[];
813
+
814
+ export const createDefaultImageWriter: (options?: PinturaDefaultImageWriterOptions) => any[];
815
+
816
+ export const createDefaultImageOrienter: () => PinturaImageOrienter;
817
+
818
+ export const createDefaultImageScrambler: (
819
+ options?: PinturaDefaultImageScramblerOptions
820
+ ) => (imageData: ImageData | ImageBitmap) => HTMLCanvasElement;
821
+
822
+ export const createDefaultShapePreprocessor: () => any;
823
+
824
+ export const createDefaultFrameStyles: () => {
825
+ [key: string]: (shape: Shape, options?: { isPreview: boolean }) => Shape[];
826
+ };
827
+
828
+ export const createDefaultLineEndStyles: () => {
829
+ [key: string]: (shape: Shape, options?: { isPreview: boolean }) => Shape[];
830
+ };
831
+
832
+ export const createFrameStyleProcessor: (styles: any) => any;
833
+
834
+ export const createLineEndProcessor: (styles: any) => any;
835
+
836
+ // node tree helpers
837
+ export function createNode(
838
+ name: PinturaNodeType,
839
+ id: string,
840
+ props: PinturaNodeOptions | undefined,
841
+ children: PinturaNode[]
842
+ ): PinturaNode;
843
+
844
+ export function createNode(name: PinturaNodeType, id: string): PinturaNode;
845
+
846
+ export function createNode(name: PinturaNodeType, id: string, children: PinturaNode[]): PinturaNode;
847
+
848
+ export function createNode(
849
+ name: PinturaNodeType,
850
+ id: string,
851
+ props: PinturaNodeOptions
852
+ ): PinturaNode;
853
+
854
+ export function findNode(id: string, haystack: PinturaNode | PinturaNode[]): void;
855
+ export function appendNode(node: PinturaNode, haystack: PinturaNode | PinturaNode[]): void;
856
+ export function removeNode(id: string): void;
857
+ export function insertNodeBefore(
858
+ node: PinturaNode,
859
+ targetId: string,
860
+ haystack: PinturaNode | PinturaNode[]
861
+ ): void;
862
+ export function insertNodeAfter(
863
+ node: PinturaNode,
864
+ targetId: string,
865
+ haystack: PinturaNode | PinturaNode[]
866
+ ): void;
867
+
868
+ // utils
869
+ export const supportsWebGL: () => boolean;
870
+ export const degToRad: (deg: number) => number;
871
+ export const naturalAspectRatioToNumber: (
872
+ aspectRatio: string | number | undefined
873
+ ) => number | false | undefined;
874
+ export const colorStringToColorArray: (Color: string) => Color;
875
+ export const legacyDataToImageState: (data: any) => ImageOptions;
876
+ export const dispatchEditorEvents: (
877
+ editor: PinturaEditor,
878
+ element: HTMLElement,
879
+ options?: { prefix?: string }
880
+ ) => any[];
881
+ export const blobToFile: (blob: Blob) => File;
882
+ export const isSupported: () => boolean;
883
+
884
+ // locale
885
+ export const locale_en_gb: LocaleCollection;
886
+
887
+ //
888
+ // markup editor
889
+ //
890
+ interface MarkupEditorToolStyleDefaults {
891
+ sharpie: [Shape, ShapeToolOptions];
892
+ line: [Shape, ShapeToolOptions];
893
+ arrow: [Shape, ShapeToolOptions];
894
+ rectangle: [Shape, ShapeToolOptions];
895
+ ellipse: [Shape, ShapeToolOptions];
896
+ text: [Shape, ShapeToolOptions];
897
+ [custom: string]: [Shape, ShapeToolOptions];
898
+ }
899
+
900
+ interface MarkupEditorShapeStyleControlDefaults {
901
+ backgroundColor: undefined | ShapeControl;
902
+ strokeColor: undefined | ShapeControl;
903
+ strokeWidth: undefined | ShapeControl;
904
+ lineStart: undefined | ShapeControl;
905
+ lineEnd: undefined | ShapeControl;
906
+ color: undefined | ShapeControl;
907
+ fontFamily: undefined | ShapeControl;
908
+ fontStyleFontWeight: undefined | ShapeControl;
909
+ fontSize: undefined | ShapeControl;
910
+ textAlign: undefined | ShapeControl;
911
+ lineHeight: undefined | ShapeControl;
912
+ }
913
+
914
+ type ToolbarItem =
915
+ | string
916
+ | [string, { disabled?: boolean; icon: string }]
917
+ | [string, LocaleString, { disabled?: boolean; icon: string }];
918
+
919
+ /**
920
+ * Create tools available in the markup editor
921
+ */
922
+ export const createMarkupEditorToolbar: (tools?: ToolbarItem[]) => [string, LocaleString, any][];
923
+
924
+ /**
925
+ * Create default shape styles for each tool, optionally add custom shape styles
926
+ */
927
+
928
+ export const createMarkupEditorToolStyles: (toolStyles?: {
929
+ [key: string]: [Shape, ShapeToolOptions];
930
+ }) => MarkupEditorToolStyleDefaults;
931
+
932
+ /**
933
+ * Create a custom tool style based on one of the existing types
934
+ */
935
+ export const createMarkupEditorToolStyle: (
936
+ type: 'path' | 'rectangle' | 'ellipse' | 'line' | 'text',
937
+ shape?: Shape,
938
+ options?: ShapeToolOptions
939
+ ) => [Shape, ShapeToolOptions];
940
+
941
+ /**
942
+ * Create default shape style controls
943
+ */
944
+ export const createMarkupEditorShapeStyleControls: (
945
+ shapeControlOptions?: ShapeControlOptions
946
+ ) => MarkupEditorShapeStyleControlDefaults;
947
+
948
+ export const createDefaultColorOptions: () => ColorPalette;
949
+ export const createDefaultFontSizeOptions: () => number[];
950
+ export const createDefaultFontScaleOptions: () => SizeCategories;
951
+ export const createDefaultLineHeightOptions: () => number[];
952
+ export const createDefaultLineHeightScaleOptions: () => SizeCategories;
953
+ export const createDefaultStrokeWidthOptions: () => number[];
954
+ export const createDefaultStrokeScaleOptions: () => SizeCategories;
955
+ export const createDefaultLineEndStyleOptions: () => LineEndStyle[];
956
+ export const createDefaultFontFamilyOptions: () => [string, string][];
957
+ export const createDefaultFontStyleOptions: () => [string, string][];
958
+ export const createDefaultTextAlignOptions: () => TextAlign[];
959
+
960
+ export const createMarkupEditorColorOptions: (colors: ColorPalette) => ShapeColorOption[];
961
+ export const createMarkupEditorFontSizeOptions: (sizes: number[]) => ShapeSizeOption[];
962
+ export const createMarkupEditorFontScaleOptions: (sizes: SizeCategories) => ShapeSizeOption[];
963
+ export const createMarkupEditorLineHeightOptions: (sizes: number[]) => ShapeSizeOption[];
964
+ export const createMarkupEditorLineHeightScaleOptions: (sizes: SizeCategories) => ShapeSizeOption[];
965
+ export const createMarkupEditorStrokeWidthOptions: (widths: number[]) => ShapeSizeOption[];
966
+ export const createMarkupEditorStrokeScaleOptions: (sizes: SizeCategories) => ShapeSizeOption[];
967
+ export const createMarkupEditorFontFamilyOptions: (
968
+ families: [string, string][]
969
+ ) => ShapeFontFamilyOption[];
970
+ export const createMarkupEditorFontStyleOptions: (
971
+ styles: [string, string][]
972
+ ) => ShapeFontStyleOption[];
973
+ export const createMarkupEditorLineEndStyleOptions: (
974
+ styles: LineEndStyle[]
975
+ ) => [LineEndStyle, string][];
976
+
977
+ export const createMarkupEditorBackgroundColorControl: (colors: ShapeColorOption[]) => ShapeControl;
978
+ export const createMarkupEditorStrokeColorControl: (
979
+ colors: ShapeColorOption[],
980
+ options?: { defaultStrokeWidth: number | string }
981
+ ) => ShapeControl;
982
+ export const createMarkupEditorStrokeWidthControl: (widths: ShapeSizeOption[]) => ShapeControl;
983
+ export const createMarkupEditorLineStartStyleControl: (
984
+ styles: [LineEndStyle, string][]
985
+ ) => ShapeControl;
986
+ export const createMarkupEditorLineEndStyleControl: (
987
+ styles: [LineEndStyle, string][]
988
+ ) => ShapeControl;
989
+ export const createMarkupEditorFontColorControl: (colors: ShapeColorOption[]) => ShapeControl;
990
+ export const createMarkupEditorFontFamilyControl: (
991
+ fontFamilies: [string, string][],
992
+ options?: { defaultKey: string | undefined }
993
+ ) => ShapeControl;
994
+ export const createMarkupEditorFontStyleControl: (fontStyles: [string, string][]) => ShapeControl;
995
+ export const createMarkupEditorFontSizeControl: (sizes: ShapeSizeOption[]) => ShapeControl;
996
+ export const createMarkupEditorTextAlignControl: (textAlignments: TextAlign[]) => ShapeControl;
997
+ export const createMarkupEditorLineHeightControl: (lineHeights: [number, string][]) => ShapeControl;
998
+
999
+ export const markup_editor_defaults: {
1000
+ markupEditorToolbar: [string, LocaleString, any][];
1001
+ markupEditorToolStyles: MarkupEditorToolStyleDefaults;
1002
+ markupEditorShapeStyleControls: MarkupEditorShapeStyleControlDefaults;
1003
+ };
1004
+
1005
+ export const markup_editor_locale_en_gb: LocaleCollection;
1006
+
1007
+ //
1008
+ // plugins
1009
+ //
1010
+ interface PinturaUtilPlugin {
1011
+ util: [string, any];
1012
+ }
1013
+
1014
+ export const plugin_annotate: PinturaUtilPlugin;
1015
+ export const plugin_crop: PinturaUtilPlugin;
1016
+ export const plugin_decorate: PinturaUtilPlugin;
1017
+ export const plugin_filter: PinturaUtilPlugin;
1018
+ export const plugin_finetune: PinturaUtilPlugin;
1019
+ export const plugin_resize: PinturaUtilPlugin;
1020
+ export const plugin_sticker: PinturaUtilPlugin;
1021
+ export const plugin_redact: PinturaUtilPlugin;
1022
+ export const plugin_frame: PinturaUtilPlugin;
1023
+
1024
+ export const plugin_annotate_locale_en_gb: LocaleCollection;
1025
+ export const plugin_crop_locale_en_gb: LocaleCollection;
1026
+ export const plugin_decorate_locale_en_gb: LocaleCollection;
1027
+ export const plugin_filter_locale_en_gb: LocaleCollection;
1028
+ export const plugin_finetune_locale_en_gb: LocaleCollection;
1029
+ export const plugin_resize_locale_en_gb: LocaleCollection;
1030
+ export const plugin_sticker_locale_en_gb: LocaleCollection;
1031
+ export const plugin_redact_locale_en_gb: LocaleCollection;
1032
+ export const plugin_frame_locale_en_gb: LocaleCollection;
1033
+
1034
+ export const plugin_frame_defaults: FramePluginOptions;
1035
+ export const plugin_filter_defaults: FilterPluginOptions;
1036
+ export const plugin_finetune_defaults: FinetunePluginOptions;
1037
+
1038
+ export const effectBrightness: Effect;
1039
+ export const effectContrast: Effect;
1040
+ export const effectSaturation: Effect;
1041
+ export const effectExposure: Effect;
1042
+ export const effectGamma: Effect;
1043
+ export const effectVignette: Effect;
1044
+ export const effectClarity: Effect;
1045
+ export const effectTemperature: Effect;
1046
+
1047
+ export const filterPastel: Filter;
1048
+ export const filterChrome: Filter;
1049
+ export const filterFade: Filter;
1050
+ export const filterWarm: Filter;
1051
+ export const filterCold: Filter;
1052
+ export const filterInvert: Filter;
1053
+ export const filterMonoDefault: Filter;
1054
+ export const filterMonoNoir: Filter;
1055
+ export const filterMonoWash: Filter;
1056
+ export const filterMonoStark: Filter;
1057
+ export const filterSepiaDefault: Filter;
1058
+ export const filterSepiaBlues: Filter;
1059
+ export const filterSepiaRust: Filter;
1060
+ export const filterSepiaColor: Filter;
1061
+
1062
+ export const frameSolidSharp: Frame;
1063
+ export const frameSolidRound: Frame;
1064
+ export const frameLineSingle: Frame;
1065
+ export const frameLineMultiple: Frame;
1066
+ export const frameEdgeSeparate: Frame;
1067
+ export const frameEdgeCross: Frame;
1068
+ export const frameEdgeOverlap: Frame;
1069
+ export const frameHook: Frame;
1070
+ export const framePolaroid: Frame;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoobic/yobi",
3
- "version": "8.2.0-28",
3
+ "version": "8.2.0-29",
4
4
  "description": "Yobi - Yoobic Design System",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.cjs.js",