@wix/editor-react-types 1.0.1 → 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/README.md +45 -2
- package/dist/a11y.d.ts +45 -0
- package/dist/a11y.d.ts.map +1 -1
- package/dist/audio.d.ts +34 -4
- package/dist/audio.d.ts.map +1 -1
- package/dist/base.d.ts +250 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +4 -0
- package/dist/base.js.map +1 -1
- package/dist/builderAudio.d.ts +3 -14
- package/dist/builderAudio.d.ts.map +1 -1
- package/dist/image.d.ts +25 -0
- package/dist/image.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/links.d.ts +19 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/menuItems.d.ts +20 -0
- package/dist/menuItems.d.ts.map +1 -1
- package/dist/statics/docs-ts-model.json +4864 -0
- package/dist/vectorArt.d.ts +25 -0
- package/dist/vectorArt.d.ts.map +1 -1
- package/dist/video.d.ts +31 -0
- package/dist/video.d.ts.map +1 -1
- package/dist/wix.d.ts +27 -0
- package/dist/wix.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/a11y.ts +45 -0
- package/src/audio.ts +35 -9
- package/src/base.ts +289 -22
- package/src/builderAudio.ts +3 -24
- package/src/image.ts +25 -9
- package/src/index.ts +2 -2
- package/src/links.ts +20 -4
- package/src/menuItems.ts +20 -3
- package/src/vectorArt.ts +25 -6
- package/src/video.ts +32 -16
- package/src/wix.ts +28 -0
package/src/image.ts
CHANGED
|
@@ -7,23 +7,39 @@ type Crop = Point & {
|
|
|
7
7
|
height: number
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An image from Wix Media.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import type { Image } from '@wix/editor-react-types';
|
|
16
|
+
*
|
|
17
|
+
* interface MyComponentProps {
|
|
18
|
+
* image?: Image;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* const MyComponent = ({ image }: MyComponentProps) => (
|
|
22
|
+
* <img src={image?.url} alt={image?.alt} />
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
10
26
|
export type Image = {
|
|
11
|
-
|
|
27
|
+
/** The image URI. */
|
|
12
28
|
uri?: string
|
|
13
|
-
|
|
29
|
+
/** The image URL. */
|
|
14
30
|
url: string
|
|
15
|
-
|
|
31
|
+
/** The image file name. */
|
|
16
32
|
name?: string
|
|
17
|
-
|
|
33
|
+
/** The image height in pixels. */
|
|
18
34
|
height?: number
|
|
19
|
-
|
|
35
|
+
/** The image width in pixels. */
|
|
20
36
|
width?: number
|
|
21
|
-
|
|
37
|
+
/** Whether the image is animated (e.g. GIF). */
|
|
22
38
|
animated?: boolean
|
|
23
|
-
|
|
39
|
+
/** The crop region applied to the image. */
|
|
24
40
|
crop?: Crop
|
|
25
|
-
|
|
41
|
+
/** The image quality, as a percentage from 0 to 100. */
|
|
26
42
|
quality?: number
|
|
27
|
-
|
|
43
|
+
/** The image alt text for accessibility. */
|
|
28
44
|
alt?: string
|
|
29
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ export type { Image } from './image'
|
|
|
3
3
|
export type { Video, VideoSource, AdaptiveVideoSource, VideoSourceType } from './video'
|
|
4
4
|
export type { VectorArt } from './vectorArt'
|
|
5
5
|
export type { A11y } from './a11y'
|
|
6
|
-
export type { Audio } from './audio'
|
|
7
|
-
export type { BuilderAudio
|
|
6
|
+
export type { Audio, AudioSource } from './audio'
|
|
7
|
+
export type { BuilderAudio } from './builderAudio'
|
|
8
8
|
export type { MenuItems, MenuItem } from './menuItems'
|
|
9
9
|
export type { Wix } from './wix'
|
|
10
10
|
export type {
|
package/src/links.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
type LinkTarget = '_self' | '_blank'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A link to a URL, used for navigation within components.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import type { Link } from '@wix/editor-react-types';
|
|
9
|
+
*
|
|
10
|
+
* interface MyComponentProps {
|
|
11
|
+
* link?: Link;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
3
15
|
export type Link = {
|
|
4
|
-
|
|
16
|
+
/** The link URL. */
|
|
5
17
|
href?: string
|
|
6
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Where this link should open.
|
|
20
|
+
* - `'_self'` — opens in the same page.
|
|
21
|
+
* - `'_blank'` — opens in a new tab.
|
|
22
|
+
*/
|
|
7
23
|
target?: LinkTarget
|
|
8
|
-
|
|
9
|
-
rel?: string
|
|
24
|
+
/** The `rel` attribute of the link. Accepts LinkRel values separated by a space. */
|
|
25
|
+
rel?: string
|
|
10
26
|
}
|
package/src/menuItems.ts
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import type { ReactElement } from 'react'
|
|
2
2
|
import type { Link } from './links'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A single item in a menu, optionally containing nested sub-items.
|
|
6
|
+
*/
|
|
4
7
|
export type MenuItem = {
|
|
5
|
-
|
|
8
|
+
/** A unique identifier for the menu item. */
|
|
6
9
|
id: string
|
|
7
|
-
|
|
10
|
+
/** The display label shown to the user. */
|
|
8
11
|
label: string
|
|
9
|
-
|
|
12
|
+
/** The navigation link for this menu item. */
|
|
10
13
|
link?: Link
|
|
14
|
+
/** An optional container element rendered alongside the menu item. */
|
|
11
15
|
container?: ReactElement
|
|
16
|
+
/** Nested child menu items, for building multi-level menus. */
|
|
12
17
|
items?: Array<MenuItem>
|
|
13
18
|
}
|
|
14
19
|
|
|
20
|
+
/**
|
|
21
|
+
* A list of menu items.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* import type { MenuItems } from '@wix/editor-react-types';
|
|
26
|
+
*
|
|
27
|
+
* interface MyComponentProps {
|
|
28
|
+
* items?: MenuItems;
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
15
32
|
export type MenuItems = Array<MenuItem>
|
package/src/vectorArt.ts
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A vector art (SVG) asset from Wix Media.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import type { VectorArt } from '@wix/editor-react-types';
|
|
7
|
+
*
|
|
8
|
+
* interface MyComponentProps {
|
|
9
|
+
* icon?: VectorArt;
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
1
13
|
export type VectorArt = {
|
|
2
|
-
|
|
14
|
+
/** The SVG URI. */
|
|
3
15
|
uri: string
|
|
4
|
-
|
|
16
|
+
/** The SVG `viewBox` attribute value. */
|
|
5
17
|
viewBox: string
|
|
6
|
-
|
|
18
|
+
/** The SVG content box dimensions. */
|
|
7
19
|
contentBox: string
|
|
8
|
-
|
|
20
|
+
/** A map of color IDs to their resolved color values, for themeable SVGs. */
|
|
9
21
|
colors: Record<string, string>
|
|
10
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The SVG content type, which determines how colors and theming are applied.
|
|
24
|
+
* - `'shape'` — a simple monochromatic shape.
|
|
25
|
+
* - `'color'` — a multi-color SVG.
|
|
26
|
+
* - `'tint'` — a single-color tintable SVG.
|
|
27
|
+
* - `'ugc'` — user-generated content.
|
|
28
|
+
* - `'textpath'` — text along a path.
|
|
29
|
+
*/
|
|
11
30
|
contentType: 'shape' | 'color' | 'tint' | 'ugc' | 'textpath'
|
|
12
|
-
|
|
31
|
+
/** The raw SVG markup. */
|
|
13
32
|
svgContent: string
|
|
14
33
|
}
|
package/src/video.ts
CHANGED
|
@@ -1,44 +1,60 @@
|
|
|
1
1
|
import type { Image } from './image'
|
|
2
2
|
|
|
3
|
+
/** A single video file format for a given quality level. */
|
|
3
4
|
export type VideoSourceType = {
|
|
4
|
-
|
|
5
|
+
/** The video format. */
|
|
5
6
|
format: 'mp4' | 'mp4-luminance'
|
|
6
|
-
|
|
7
|
+
/** The video URI. */
|
|
7
8
|
uri: string
|
|
8
|
-
|
|
9
|
+
/** The fully resolved video URL. */
|
|
9
10
|
url: string
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
/** An adaptive streaming video source (HLS or DASH). */
|
|
12
14
|
export type AdaptiveVideoSource = {
|
|
13
|
-
|
|
15
|
+
/** The adaptive streaming format. */
|
|
14
16
|
format: 'hls' | 'dash'
|
|
15
|
-
|
|
17
|
+
/** The video URI. */
|
|
16
18
|
uri: string
|
|
17
|
-
|
|
19
|
+
/** The fully resolved video URL. */
|
|
18
20
|
url: string
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
/** A set of video files for a specific quality level. */
|
|
21
24
|
export type VideoSource = {
|
|
22
|
-
|
|
25
|
+
/** The video quality level. */
|
|
23
26
|
quality: '1080p' | '720p' | '480p' | '360p'
|
|
24
|
-
|
|
27
|
+
/** The video width in pixels at this quality level. */
|
|
25
28
|
width: number
|
|
26
|
-
|
|
29
|
+
/** The video height in pixels at this quality level. */
|
|
27
30
|
height: number
|
|
28
|
-
|
|
31
|
+
/** The available file types for this quality level. */
|
|
29
32
|
types: Array<VideoSourceType>
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
/**
|
|
36
|
+
* A video from Wix Media, including all available sources and quality levels.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* import type { Video } from '@wix/editor-react-types';
|
|
41
|
+
*
|
|
42
|
+
* interface MyComponentProps {
|
|
43
|
+
* video?: Video;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
32
47
|
export type Video = {
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
/** The original video URI. */
|
|
49
|
+
uri: string
|
|
50
|
+
/** All available quality-level sources for progressive playback. */
|
|
35
51
|
sources: Array<VideoSource>
|
|
36
|
-
|
|
52
|
+
/** Adaptive streaming sources (HLS/DASH) for streaming playback. */
|
|
37
53
|
adaptiveSources: Array<AdaptiveVideoSource>
|
|
38
|
-
|
|
54
|
+
/** Whether the video contains an audio track. */
|
|
39
55
|
hasAudio: boolean
|
|
40
|
-
|
|
56
|
+
/** The video frame rate in frames per second. */
|
|
41
57
|
fps: number
|
|
42
|
-
|
|
58
|
+
/** A poster image to display before the video plays. */
|
|
43
59
|
poster?: Image
|
|
44
60
|
}
|
package/src/wix.ts
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
type REMOVED = 'REMOVED'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wix framework props.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import type { Wix } from '@wix/editor-react-types';
|
|
9
|
+
*
|
|
10
|
+
* interface MyComponentProps {
|
|
11
|
+
* className: string;
|
|
12
|
+
* wix?: Wix;
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* const MyComponent = ({ className, wix }: MyComponentProps) => (
|
|
16
|
+
* <div {...wix?.presetsWrapperProps}>
|
|
17
|
+
* <div className={className}>...</div>
|
|
18
|
+
* </div>
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
2
22
|
export interface Wix {
|
|
23
|
+
/**
|
|
24
|
+
* Tracks which removable elements have been removed by the Wix user.
|
|
25
|
+
* Keys are element keys (as defined in the manifest), values are `'REMOVED'`.
|
|
26
|
+
*/
|
|
3
27
|
elementsRemovalState: Record<string, REMOVED>
|
|
28
|
+
/**
|
|
29
|
+
* Props to spread onto the outermost wrapper element when using presets.
|
|
30
|
+
* Required for the preset picker to work correctly in the editor.
|
|
31
|
+
*/
|
|
4
32
|
presetsWrapperProps?: { className: string }
|
|
5
33
|
}
|