svelte-product-mockup 1.0.12 → 1.0.13

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/dist/types.d.ts CHANGED
@@ -14,28 +14,36 @@ export interface Layer {
14
14
  visible?: boolean;
15
15
  effects?: LayerEffect[];
16
16
  }
17
+ type LoosePartial<T> = Partial<T> & Record<string, unknown>;
18
+ type ConfigWarpEffect = Extract<LayerEffect, {
19
+ type: 'warp';
20
+ }>;
17
21
  export type MockupLayerEffect = ({
18
22
  type: 'restyle';
19
- } & Partial<Extract<LayerEffect, {
23
+ } & Partial<Omit<Extract<LayerEffect, {
20
24
  type: 'restyle';
21
- }>>) | ({
25
+ }>, 'type'>>) | ({
22
26
  type: 'resize';
23
27
  width: number;
24
28
  height: number;
25
- } & Partial<Extract<LayerEffect, {
29
+ } & Partial<Omit<Extract<LayerEffect, {
26
30
  type: 'resize';
27
- }>>) | ({
31
+ }>, 'type' | 'width' | 'height'>>) | ({
28
32
  type: 'position';
29
33
  containerWidth: number;
30
34
  containerHeight: number;
31
- } & Partial<Extract<LayerEffect, {
35
+ } & Partial<Omit<Extract<LayerEffect, {
32
36
  type: 'position';
33
- }>>) | ({
37
+ }>, 'type' | 'containerWidth' | 'containerHeight'>>) | ({
34
38
  type: 'warp';
35
39
  enabled: boolean;
36
- } & Partial<Extract<LayerEffect, {
37
- type: 'warp';
38
- }>>) | Extract<LayerEffect, {
40
+ image?: LoosePartial<NonNullable<ConfigWarpEffect['image']>>;
41
+ debug?: LoosePartial<NonNullable<ConfigWarpEffect['debug']>>;
42
+ cylinder?: LoosePartial<NonNullable<ConfigWarpEffect['cylinder']>>;
43
+ plane?: LoosePartial<NonNullable<ConfigWarpEffect['plane']>>;
44
+ sphere?: LoosePartial<NonNullable<ConfigWarpEffect['sphere']>>;
45
+ custom?: LoosePartial<NonNullable<ConfigWarpEffect['custom']>>;
46
+ } & Partial<Omit<ConfigWarpEffect, 'type' | 'enabled' | 'image' | 'debug' | 'cylinder' | 'plane' | 'sphere' | 'custom'>>) | Extract<LayerEffect, {
39
47
  type: 'svg';
40
48
  }>;
41
49
  export interface MockupLayer {
@@ -103,3 +111,4 @@ export declare const defaultTransform: LayerTransform;
103
111
  export declare const defaultLayer: Omit<Layer, 'id' | 'src'>;
104
112
  export declare const defaultView: ViewSettings;
105
113
  export declare const defaultComposition: Composition;
114
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-product-mockup",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
package/src/lib/types.ts CHANGED
@@ -17,11 +17,23 @@ export interface Layer {
17
17
  effects?: LayerEffect[];
18
18
  }
19
19
 
20
+ type LoosePartial<T> = Partial<T> & Record<string, unknown>;
21
+ type ConfigWarpEffect = Extract<LayerEffect, { type: 'warp' }>;
22
+
20
23
  export type MockupLayerEffect =
21
- | ({ type: 'restyle' } & Partial<Extract<LayerEffect, { type: 'restyle' }>>)
22
- | ({ type: 'resize'; width: number; height: number } & Partial<Extract<LayerEffect, { type: 'resize' }>>)
23
- | ({ type: 'position'; containerWidth: number; containerHeight: number } & Partial<Extract<LayerEffect, { type: 'position' }>>)
24
- | ({ type: 'warp'; enabled: boolean } & Partial<Extract<LayerEffect, { type: 'warp' }>>)
24
+ | ({ type: 'restyle' } & Partial<Omit<Extract<LayerEffect, { type: 'restyle' }>, 'type'>>)
25
+ | ({ type: 'resize'; width: number; height: number } & Partial<Omit<Extract<LayerEffect, { type: 'resize' }>, 'type' | 'width' | 'height'>>)
26
+ | ({ type: 'position'; containerWidth: number; containerHeight: number } & Partial<Omit<Extract<LayerEffect, { type: 'position' }>, 'type' | 'containerWidth' | 'containerHeight'>>)
27
+ | ({
28
+ type: 'warp';
29
+ enabled: boolean;
30
+ image?: LoosePartial<NonNullable<ConfigWarpEffect['image']>>;
31
+ debug?: LoosePartial<NonNullable<ConfigWarpEffect['debug']>>;
32
+ cylinder?: LoosePartial<NonNullable<ConfigWarpEffect['cylinder']>>;
33
+ plane?: LoosePartial<NonNullable<ConfigWarpEffect['plane']>>;
34
+ sphere?: LoosePartial<NonNullable<ConfigWarpEffect['sphere']>>;
35
+ custom?: LoosePartial<NonNullable<ConfigWarpEffect['custom']>>;
36
+ } & Partial<Omit<ConfigWarpEffect, 'type' | 'enabled' | 'image' | 'debug' | 'cylinder' | 'plane' | 'sphere' | 'custom'>>)
25
37
  | Extract<LayerEffect, { type: 'svg' }>;
26
38
 
27
39
  export interface MockupLayer {