Skip to content

Commit

Permalink
Docs: Generate API reference
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulmann committed Sep 27, 2021
1 parent 8e2354d commit 6a2af66
Show file tree
Hide file tree
Showing 24 changed files with 15,944 additions and 15,023 deletions.
15,082 changes: 15,082 additions & 0 deletions docs/api-reference.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/api-reference/clipboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ async function pasteText(text: string): Promise<void>
#### Return

A promise that resolves when the text got pasted.

6 changes: 3 additions & 3 deletions docs/api-reference/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Contains environment values such as the Raycast version, extension info, and pat

### Environment

Holds data about the environment the command is running in. Passed to a command on initialization.
Holds data about the environment the command is running in.
Passed to a command on initialization.

#### Properties

Expand All @@ -21,7 +22,6 @@ Holds data about the environment the command is running in. Passed to a command
| assetsPath | `string` | Yes | The absolute path to the assets directory of the extension. Use to load icons, images, and other packaged resources. |
| commandName | `string` | Yes | The name of the launched command, as specified in package.json |
| extensionName | `string` | Yes | The name of the extension, as specified in package.json |
| isDevelopment | `boolean` | Yes | Indicates whether the command is a development command \(vs. an installed store command\). |
| isDevelopment | `boolean` | Yes | Indicates whether the command is a development command (vs. an installed store command). |
| raycastVersion | `string` | Yes | The version of the main Raycast app |
| supportPath | `string` | Yes | The absolute path for the support directory of an extension. Use to read and write files for the extension. Note that the directory at this path might not physically exist already, so make sure to first create it. For instance using Node's fs module with the recursive option: |

31 changes: 31 additions & 0 deletions docs/api-reference/keyboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Keyboard

## API Reference

### KeyboardShortcut

A keyboard shortcut is defined by one or more modifier keys (command, control, etc.) and a single key equivalent (a character or special key).
See [KeyModifier](../keyboard.md#keymodifier) and [KeyEquivalent](../keyboard.md#keyequivalent) for supported values.

#### Properties

| Name | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| key | `KeyEquivalent` | Yes | |
| modifiers | `KeyModifier[]` | Yes | |

### KeyEquivalent

```typescript
KeyEquivalent: "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "." | "," | ";" | "=" | "+" | "-" | "[" | "]" | "{" | "}" | "«" | "»" | "(" | ")" | "/" | "\\" | "'" | "`" | "§" | "^" | "@" | "$" | "return" | "delete" | "deleteForward" | "tab" | "arrowUp" | "arrowDown" | "arrowLeft" | "arrowRight" | "pageUp" | "pageDown" | "home" | "end" | "space" | "escape" | "enter" | "backspace"
```

KeyEquivalent of a [KeyboardShortcut](../keyboard.md#keyboardshortcut)

### KeyModifier

```typescript
KeyModifier: "cmd" | "ctrl" | "opt" | "shift"
```

Modifier of a [KeyboardShortcut](../keyboard.md#keyboardshortcut)
3 changes: 3 additions & 0 deletions docs/api-reference/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Other

## API Reference
42 changes: 37 additions & 5 deletions docs/api-reference/preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,64 @@

## API Reference

### getPreferenceValues

Generically typed convenience function that returns a [preferences](../preferences.md#preferences) object where each preference name is mapped to its value.
Note that the values fall back to defined default values.

#### Signature

```typescript
function getPreferenceValues(): Values
```

#### Return



### preferences

```typescript
preferences: Preferences = ...
```

Contains the preference values \(entered in Raycast Preferences\) that have been passed to the command.
Contains the preference values (entered in Raycast Preferences) that have been passed to the command.

### Preference

Holds data about a single preference item \(entered in Raycast Preferences\). Maps to the properties declared in package.json.
Holds data about a single preference item (entered in Raycast Preferences).
Maps to the properties declared in package.json.

#### Properties

| Name | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| data | `unknown[]` | No | |
| default | `unknown` | No | |
| description | `string` | Yes | |
| label | `string` | No | |
| link | `string` | No | |
| name | `string` | Yes | |
| placeholder | `string` | No | |
| required | `boolean` | Yes | |
| type | `string` | Yes | |
| title | `string` | Yes | |
| type | `"textfield"` or `"password"` or `"checkbox"` or `"dropdown"` | Yes | |
| value | `unknown` | No | |

### PreferenceValues

Values of preference items.

#### Properties

| Name | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| [name: string] | `any` | Yes | |

### Preferences

```typescript
Preferences: Record<string, Preference>
```

A record type holding the preferences \(entered in Raycast Preferences\) that have been passed to the command

A record type holding the preferences (entered in Raycast Preferences) that have been passed to the command.
3 changes: 1 addition & 2 deletions docs/api-reference/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function setLocalStorageItem(key: string, value: LocalStorageValue): Promi
| Name | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| key | `string` | Yes | The key you want to create or update the value of. |
| value | [`LocalStorageValue`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/storage.md#localstoragevalue) | Yes | The value you want to create or update for the given key. |
| value | `LocalStorageValue` | Yes | The value you want to create or update for the given key. |

#### Return

Expand All @@ -104,4 +104,3 @@ LocalStorageValue: string | number | boolean
```

Supported storage value types.

28 changes: 14 additions & 14 deletions docs/api-reference/user-interface/action-panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Represents a list of actions in the user interface, accessible through the actio

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| children | [`ActionPanelChildren`](action-panel.md#actionpanelchildren) | No | - | Sections or items. If [ActionPanel.Item](action-panel.md#actionpanel-item) elements are specified, a default section is automatically created. |
| children | `ActionPanelChildren` | No | - | Sections or items. If [ActionPanel.Item](../user-interface/action-panel.md#actionpanelitem) elements are specified, a default section is automatically created. |
| title | `string` | No | - | The title displayed at the top of the panel |

### ActionPanel.Item
Expand All @@ -17,19 +17,20 @@ Represents a context-specific action that can be selected in the user interface

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | - | The icon displayed for the action. |
| id | [`ID`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/user-interface.md#id) | No | - | ID of the item. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the item. |
| icon | `ImageLike` | No | - | The icon displayed for the action. |
| id | `string` | No | - | ID of the item. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the item. |
| title | `string` | Yes | - | The title displayed for the item. |
| onAction | `() => void` | No | - | |
| onAction | <code>() => void</code> | No | - | |

### ActionPanel.Section

Visually separated group of items. Use sections to group related menu items together.
Visually separated group of items.
Use sections to group related menu items together.

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| children | [`ActionPanelSectionChildren`](action-panel.md#actionpanelsectionchildren) | No | - | The item elements of the section. When used for the action panel, the first item in the list is the _primary_ action that will be triggered by the default shortcut \(ENTER\), while the second item is the _secondary_ action triggered by CMD + ENTER. |
| children | `ActionPanelSectionChildren` | No | - | The item elements of the section. When used for the action panel, the first item in the list is the *primary* action that will be triggered by the default shortcut (ENTER), while the second item is the *secondary* action triggered by CMD + ENTER. |
| title | `string` | No | - | Title displayed above the section |

### ActionPanel.Submenu
Expand All @@ -38,10 +39,10 @@ Represents a context-specific action that can be selected in the user interface

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| children | [`ActionPanelChildren`](action-panel.md#actionpanelchildren) | No | - | Items of the submenu. |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | - | The icon displayed for the submenu. |
| id | [`ID`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/user-interface.md#id) | No | - | ID of the submenu. Make sure to assign each section a unique ID or a UUID will be auto-generated. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the submenu. |
| children | `ActionPanelChildren` | No | - | Items of the submenu. |
| icon | `ImageLike` | No | - | The icon displayed for the submenu. |
| id | `string` | No | - | ID of the submenu. Make sure to assign each section a unique ID or a UUID will be auto-generated. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the submenu. |
| title | `string` | Yes | - | The title displayed for submenu. |

### ActionPanelChildren
Expand All @@ -50,13 +51,12 @@ Represents a context-specific action that can be selected in the user interface
ActionPanelChildren: ActionPanel.Section | ActionPanel.Section[] | ActionPanelSectionChildren | null
```

Supported children for the [ActionPanel](action-panel.md#actionpanel) and [ActionPanelSubmenu](action-panel.md#actionpanel-submenu) components.
Supported children for the [ActionPanel](../user-interface/action-panel.md#actionpanel) and [ActionPanelSubmenu](../user-interface/action-panel.md#actionpanelsubmenu) components.

### ActionPanelSectionChildren

```typescript
ActionPanelSectionChildren: ActionPanel.Item | ActionPanel.Item[] | ReactElement<ActionPanelSubmenuProps> | ReactElement<ActionPanelSubmenuProps>[] | null
```

Supported children for the [ActionPanelSection](action-panel.md#actionpanel-section) component.

Supported children for the [ActionPanelSection](../user-interface/action-panel.md#actionpanelsection) component.
54 changes: 27 additions & 27 deletions docs/api-reference/user-interface/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,48 @@ Action that copies the content to the clipboard.
| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| content | `string` or `number` | Yes | - | The contents that will be written to the clipboard as string. |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Clipboard | A optional icon displayed for the item. See [ImageLike](icons-and-images.md#imagelike) for the supported formats and types. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the action. |
| icon | `ImageLike` | No | Icon.Clipboard | A optional icon displayed for the item. See [ImageLike](../user-interface/icons-and-images.md#imagelike) for the supported formats and types. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the action. |
| title | `string` | No | - | An optional title for the action. |
| onCopy | `(content: string | number) => void` | No | - | |
| onCopy | <code>(content: string \| number) => void</code> | No | - | |

### OpenAction

An action to open a file or folder with a specific application, just as if you had double-clicked the file's icon.
An action to open a file or folder with a specific application, just as if you had double-clicked the
file's icon.

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| application | `string` or [`Application`](../utilities/application.md#application) | No | - | The application name to use for opening the file. |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Finder | The icon displayed for the action. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the action. |
| application | `string` or `Application` | No | - | The application name to use for opening the file. |
| icon | `ImageLike` | No | Icon.Finder | The icon displayed for the action. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the action. |
| target | `string` | Yes | - | The file, folder or URL to open. |
| title | `string` | Yes | - | The title for the action. |
| onOpen | `(target: string) => void` | No | - | |
| onOpen | <code>(target: string) => void</code> | No | - | |

### OpenInBrowserAction

Action that opens a URL in the default browser..

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Globe | The icon displayed for the action. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The optional keyboard shortcut for the menu item |
| icon | `ImageLike` | No | Icon.Globe | The icon displayed for the action. |
| shortcut | `KeyboardShortcut` | No | - | The optional keyboard shortcut for the menu item |
| title | `string` | No | - | An optional title for the action. |
| url | `string` | Yes | - | The URL to open. |
| onOpen | `(url: string) => void` | No | - | |
| onOpen | <code>(url: string) => void</code> | No | - | |

### OpenWithAction

An action to open a file or folder with a specific application.

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Upload | The icon displayed for the action. |
| icon | `ImageLike` | No | Icon.Upload | The icon displayed for the action. |
| path | `string` | Yes | - | The path to open. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the action. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the action. |
| title | `string` | No | Open With | The title for the action. |
| onOpen | `(path: string) => void` | No | - | |
| onOpen | <code>(path: string) => void</code> | No | - | |

### PasteAction

Expand All @@ -58,44 +59,43 @@ Action that pastes the content to the front-most applications.
| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| content | `string` or `number` | Yes | - | The contents that will be written to the clipboard as string. |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Clipboard | The icon displayed for the action. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the action. |
| icon | `ImageLike` | No | Icon.Clipboard | The icon displayed for the action. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the action. |
| title | `string` | No | - | An optional title for the action. |
| onPaste | `(content: string | number) => void` | No | - | |
| onPaste | <code>(content: string \| number) => void</code> | No | - | |

### PushAction

Action that allows to push a new view to the navigation stack.

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | - | The icon displayed for the action. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the action. |
| icon | `ImageLike` | No | - | The icon displayed for the action. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the action. |
| target | `ReactNode` | Yes | - | The target view that will be pushed to the navigation stack. |
| title | `string` | Yes | - | The title displayed for the item. |
| onPush | `() => void` | No | - | |
| onPush | <code>() => void</code> | No | - | |

### ShowInFinderAction

Action that shows a file or folder in the Finder.

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Finder | A optional icon displayed for the item. See [ImageLike](icons-and-images.md#imagelike) for the supported formats and types. |
| icon | `ImageLike` | No | Icon.Finder | A optional icon displayed for the item. See [ImageLike](../user-interface/icons-and-images.md#imagelike) for the supported formats and types. |
| path | `PathLike` | Yes | - | The path to open. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The keyboard shortcut for the action. |
| shortcut | `KeyboardShortcut` | No | - | The keyboard shortcut for the action. |
| title | `string` | No | Show in Finder | An optional title for the action. |
| onShow | `(path: PathLike) => void` | No | - | |
| onShow | <code>(path: PathLike) => void</code> | No | - | |

### TrashAction

Action that moves a file or folder to the Trash.

| Prop | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| icon | [`ImageLike`](icons-and-images.md#imagelike) | No | Icon.Trash | A optional icon displayed for the action. |
| icon | `ImageLike` | No | Icon.Trash | A optional icon displayed for the action. |
| paths | `PathLike` or `PathLike[]` | Yes | - | The item or items to move to the trash. |
| shortcut | [`KeyboardShortcut`](https://github.com/raycast/api-docs/tree/321f849e249b8db494717dccaf744773ff492d89/api-reference/keyboard.md#keyboardshortcut) | No | - | The optional keyboard shortcut for the action. |
| shortcut | `KeyboardShortcut` | No | - | The optional keyboard shortcut for the action. |
| title | `string` | No | Move to Trash | An optional title for the action. |
| onTrash | `(paths: PathLike | PathLike[]) => void` | No | - | |

| onTrash | <code>(paths: PathLike \| PathLike[]) => void</code> | No | - | |
18 changes: 8 additions & 10 deletions docs/api-reference/user-interface/colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ ColorLike: Color | string
Union type for the supported color types.

Besides the {@link Color}, you can use any of the following color formats:

* HEX, e.g `#FF0000`
* Short HEX, e.g. `#F00`
* RGBA, e.g. `rgb(255, 0, 0)`
* RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
* HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
* Keywords, e.g. `red`

Colors different to the standard ones \(see {@link Color}\) will be dynamically adjusted to fit the contrast.

- HEX, e.g `#FF0000`
- Short HEX, e.g. `#F00`
- RGBA, e.g. `rgb(255, 0, 0)`
- RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
- HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
- Keywords, e.g. `red`

Colors different to the standard ones (see {@link Color}) will be dynamically adjusted to fit the contrast.
3 changes: 3 additions & 0 deletions docs/api-reference/user-interface/detail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Detail

## API Reference
Loading

0 comments on commit 6a2af66

Please sign in to comment.