@wix/editor-react-types 1.0.1 → 1.0.14

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/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
- // The image URI.
27
+ /** The image URI. */
12
28
  uri?: string
13
- // The image resolved URL.
29
+ /** The image URL. */
14
30
  url: string
15
- // The image name.
31
+ /** The image file name. */
16
32
  name?: string
17
- // The image height.
33
+ /** The image height in pixels. */
18
34
  height?: number
19
- // The image width.
35
+ /** The image width in pixels. */
20
36
  width?: number
21
- // Whether the image is animated.
37
+ /** Whether the image is animated (e.g. GIF). */
22
38
  animated?: boolean
23
- // The image crop.
39
+ /** The crop region applied to the image. */
24
40
  crop?: Crop
25
- // The image quality.
41
+ /** The image quality, as a percentage from 0 to 100. */
26
42
  quality?: number
27
- // The image alt text.
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, AudioSource } from './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
- // The link URL.
16
+ /** The link URL. */
5
17
  href?: string
6
- // Where this link should open, supports _self and _blank. _self means same page, _blank means new page.
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
- // The rel of link
9
- rel?: string // LinkRel values separated by space
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
- // Menu item ID.
8
+ /** A unique identifier for the menu item. */
6
9
  id: string
7
- // Menu item label.
10
+ /** The display label shown to the user. */
8
11
  label: string
9
- // Menu item link.
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
- // The SVG URI.
14
+ /** The SVG URI. */
3
15
  uri: string
4
- // The SVG viewbox.
16
+ /** The SVG `viewBox` attribute value. */
5
17
  viewBox: string
6
- // The SVG content box.
18
+ /** The SVG content box dimensions. */
7
19
  contentBox: string
8
- // The SVG colors.
20
+ /** A map of color IDs to their resolved color values, for themeable SVGs. */
9
21
  colors: Record<string, string>
10
- // The SVG content type.
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
- // The SVG content.
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
- // The video format.
5
+ /** The video format. */
5
6
  format: 'mp4' | 'mp4-luminance'
6
- // The video URI.
7
+ /** The video URI. */
7
8
  uri: string
8
- // The video resolved URL.
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
- // The video format.
15
+ /** The adaptive streaming format. */
14
16
  format: 'hls' | 'dash'
15
- // The video URI.
17
+ /** The video URI. */
16
18
  uri: string
17
- // The video resolved URL.
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
- // The video quality.
25
+ /** The video quality level. */
23
26
  quality: '1080p' | '720p' | '480p' | '360p'
24
- // The video width.
27
+ /** The video width in pixels at this quality level. */
25
28
  width: number
26
- // The video height.
29
+ /** The video height in pixels at this quality level. */
27
30
  height: number
28
- // The video types.
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
- uri: string // original uri
34
- // The video sources.
48
+ /** The original video URI. */
49
+ uri: string
50
+ /** All available quality-level sources for progressive playback. */
35
51
  sources: Array<VideoSource>
36
- // The video adaptive sources.
52
+ /** Adaptive streaming sources (HLS/DASH) for streaming playback. */
37
53
  adaptiveSources: Array<AdaptiveVideoSource>
38
- // Whether the video has audio.
54
+ /** Whether the video contains an audio track. */
39
55
  hasAudio: boolean
40
- // The video frames per second.
56
+ /** The video frame rate in frames per second. */
41
57
  fps: number
42
- // The video poster image.
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
  }