Skip to content

Commit eaee5bc

Browse files
authored
chore: Add docgen script and generate plugin docs (#62)
1 parent 898fb36 commit eaee5bc

24 files changed

+1237
-4
lines changed

action-sheet/README.md

+72
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,75 @@
11
# @capacitor/action-sheet
22

33
The Action Sheet API provides access to native Action Sheets, which come up from the bottom of the screen and display actions a user can take.
4+
5+
<!--DOCGEN_INDEX_START-->
6+
* [`showActions(...)`](#showactions)
7+
* [Interfaces](#interfaces)
8+
* [Enums](#enums)
9+
<!--DOCGEN_INDEX_END-->
10+
11+
<!--DOCGEN_API_START-->
12+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
13+
## API
14+
15+
### showActions(...)
16+
17+
```typescript
18+
showActions(options: ActionSheetOptions) => Promise<ActionSheetResult>
19+
```
20+
21+
Show an Action Sheet style modal with various options for the user
22+
to select.
23+
24+
| Param | Type |
25+
| ----------- | ----------------------------------------------------------------- |
26+
| **options** | <code><a href="#actionsheetoptions">ActionSheetOptions</a></code> |
27+
28+
**Returns:** <code>Promise&lt;<a href="#actionsheetresult">ActionSheetResult</a>&gt;</code>
29+
30+
**Since:** 1.0.0
31+
32+
--------------------
33+
34+
35+
### Interfaces
36+
37+
38+
#### ActionSheetResult
39+
40+
| Prop | Type | Description | Since |
41+
| ----------- | ------------------- | -------------------------------------------- | ----- |
42+
| **`index`** | <code>number</code> | The index of the clicked option (Zero-based) | 1.0.0 |
43+
44+
45+
#### ActionSheetOptions
46+
47+
| Prop | Type | Description | Since |
48+
| ------------- | -------------------------------- | ------------------------------------------------------------------------ | ----- |
49+
| **`title`** | <code>string</code> | The title of the Action Sheet. | 1.0.0 |
50+
| **`message`** | <code>string</code> | A message to show under the title. This option is only supported on iOS. | 1.0.0 |
51+
| **`options`** | <code>ActionSheetOption[]</code> | Options the user can choose from. | 1.0.0 |
52+
53+
54+
#### ActionSheetOption
55+
56+
| Prop | Type | Description | Since |
57+
| ----------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ----- |
58+
| **`title`** | <code>string</code> | The title of the option | 1.0.0 |
59+
| **`style`** | <code><a href="#actionsheetoptionstyle">ActionSheetOptionStyle</a></code> | The style of the option This option is only supported on iOS. | 1.0.0 |
60+
| **`icon`** | <code>string</code> | Icon for the option (ionicon naming convention) This option is only supported on Web. | 1.0.0 |
61+
62+
63+
### Enums
64+
65+
66+
#### ActionSheetOptionStyle
67+
68+
| Members | Value | Description | Since |
69+
| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------- | ----- |
70+
| **`Default`** | <code>'DEFAULT'</code> | Default style of the option. | 1.0.0 |
71+
| **`Destructive`** | <code>'DESTRUCTIVE'</code> | Style to use on destructive options. | 1.0.0 |
72+
| **`Cancel`** | <code>'CANCEL'</code> | Style to use on the option that cancels the Action Sheet. If used, should be on the latest availabe option. | 1.0.0 |
73+
74+
75+
<!--DOCGEN_API_END-->

action-sheet/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"eslint": "eslint . --ext ts",
3030
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
3131
"swiftlint": "node-swiftlint",
32+
"docgen": "docgen --api ActionSheetPlugin --output-readme README.md --output-json dist/docs.json",
3233
"build": "npm run clean && tsc && rollup -c rollup.config.js",
3334
"clean": "rimraf ./dist",
3435
"watch": "tsc --watch",
@@ -37,6 +38,7 @@
3738
"devDependencies": {
3839
"@capacitor/android": "^3.0.0-alpha.5",
3940
"@capacitor/core": "^3.0.0-alpha.5",
41+
"@capacitor/docgen": "^0.0.5",
4042
"@capacitor/ios": "^3.0.0-alpha.5",
4143
"@ionic/eslint-config": "^0.3.0",
4244
"@ionic/prettier-config": "^1.0.0",

clipboard/README.md

+71
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
11
# @capacitor/clipboard
22

33
The Clipboard API enables copy and pasting to/from the system clipboard.
4+
5+
<!--DOCGEN_INDEX_START-->
6+
* [`write(...)`](#write)
7+
* [`read()`](#read)
8+
* [Interfaces](#interfaces)
9+
<!--DOCGEN_INDEX_END-->
10+
11+
<!--DOCGEN_API_START-->
12+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
13+
## API
14+
15+
### write(...)
16+
17+
```typescript
18+
write(options: ClipboardWriteOptions) => Promise<void>
19+
```
20+
21+
Write a value to the clipboard (the "copy" action)
22+
23+
| Param | Type |
24+
| ----------- | ----------------------------------------------------------------------- |
25+
| **options** | <code><a href="#clipboardwriteoptions">ClipboardWriteOptions</a></code> |
26+
27+
**Returns:** <code>Promise&lt;void&gt;</code>
28+
29+
**Since:** 1.0.0
30+
31+
--------------------
32+
33+
34+
### read()
35+
36+
```typescript
37+
read() => Promise<ClipboardReadResult>
38+
```
39+
40+
Read a value from the clipboard (the "paste" action)
41+
42+
**Returns:** <code>Promise&lt;<a href="#clipboardreadresult">ClipboardReadResult</a>&gt;</code>
43+
44+
**Since:** 1.0.0
45+
46+
--------------------
47+
48+
49+
### Interfaces
50+
51+
52+
#### ClipboardWriteOptions
53+
54+
Represents the data to be written to the clipboard.
55+
56+
| Prop | Type | Description | Since |
57+
| ------------ | ------------------- | --------------------------------------------------------------------------------------------------------------- | ----- |
58+
| **`string`** | <code>string</code> | Text value to copy. | 1.0.0 |
59+
| **`image`** | <code>string</code> | Image in [Data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format to copy. | 1.0.0 |
60+
| **`url`** | <code>string</code> | URL string to copy. | 1.0.0 |
61+
| **`label`** | <code>string</code> | User visible label to accompany the copied data (Android Only). | 1.0.0 |
62+
63+
64+
#### ClipboardReadResult
65+
66+
Represents the data read from the clipboard.
67+
68+
| Prop | Type | Description | Since |
69+
| ----------- | ------------------- | ------------------------------ | ----- |
70+
| **`value`** | <code>string</code> | Data read from the clipboard. | 1.0.0 |
71+
| **`type`** | <code>string</code> | Type of data in the clipboard. | 1.0.0 |
72+
73+
74+
<!--DOCGEN_API_END-->

clipboard/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"eslint": "eslint . --ext ts",
1616
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
1717
"swiftlint": "node-swiftlint",
18+
"docgen": "docgen --api ClipboardPlugin --output-readme README.md --output-json dist/docs.json",
1819
"build": "npm run clean && tsc && rollup -c rollup.config.js",
1920
"clean": "rimraf ./dist",
2021
"watch": "tsc --watch",
@@ -25,6 +26,7 @@
2526
"devDependencies": {
2627
"@capacitor/android": "^3.0.0-alpha.5",
2728
"@capacitor/core": "^3.0.0-alpha.5",
29+
"@capacitor/docgen": "^0.0.5",
2830
"@capacitor/ios": "^3.0.0-alpha.5",
2931
"@ionic/eslint-config": "^0.3.0",
3032
"@ionic/prettier-config": "^1.0.0",

device/README.md

+94-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,96 @@
11
# @capacitor/device
22

3-
The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.
3+
The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.
4+
5+
<!--DOCGEN_INDEX_START-->
6+
* [`getInfo()`](#getinfo)
7+
* [`getBatteryInfo()`](#getbatteryinfo)
8+
* [`getLanguageCode()`](#getlanguagecode)
9+
* [Interfaces](#interfaces)
10+
<!--DOCGEN_INDEX_END-->
11+
12+
<!--DOCGEN_API_START-->
13+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
14+
## API
15+
16+
### getInfo()
17+
18+
```typescript
19+
getInfo() => Promise<DeviceInfo>
20+
```
21+
22+
Return information about the underlying device/os/platform.
23+
24+
**Returns:** <code>Promise&lt;<a href="#deviceinfo">DeviceInfo</a>&gt;</code>
25+
26+
**Since:** 1.0.0
27+
28+
--------------------
29+
30+
31+
### getBatteryInfo()
32+
33+
```typescript
34+
getBatteryInfo() => Promise<DeviceBatteryInfo>
35+
```
36+
37+
Return information about the battery.
38+
39+
**Returns:** <code>Promise&lt;<a href="#devicebatteryinfo">DeviceBatteryInfo</a>&gt;</code>
40+
41+
**Since:** 1.0.0
42+
43+
--------------------
44+
45+
46+
### getLanguageCode()
47+
48+
```typescript
49+
getLanguageCode() => Promise<DeviceLanguageCodeResult>
50+
```
51+
52+
Get the device's current language locale code.
53+
54+
**Returns:** <code>Promise&lt;<a href="#devicelanguagecoderesult">DeviceLanguageCodeResult</a>&gt;</code>
55+
56+
**Since:** 1.0.0
57+
58+
--------------------
59+
60+
61+
### Interfaces
62+
63+
64+
#### DeviceInfo
65+
66+
| Prop | Type | Description | Since |
67+
| --------------------- | ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
68+
| **`name`** | <code>string</code> | The name of the device. For example, "John's iPhone". This is only supported on iOS. | 1.0.0 |
69+
| **`model`** | <code>string</code> | The device model. For example, "iPhone". | 1.0.0 |
70+
| **`platform`** | <code>"ios" \| "android" \| "web"</code> | The device platform (lowercase). | 1.0.0 |
71+
| **`uuid`** | <code>string</code> | The UUID of the device as available to the app. This identifier may change on modern mobile platforms that only allow per-app install UUIDs. | 1.0.0 |
72+
| **`operatingSystem`** | <code>"ios" \| "android" \| "windows" \| "mac" \| "unknown"</code> | The operating system of the device. | 1.0.0 |
73+
| **`osVersion`** | <code>string</code> | The version of the device OS. | 1.0.0 |
74+
| **`manufacturer`** | <code>string</code> | The manufacturer of the device. | 1.0.0 |
75+
| **`isVirtual`** | <code>boolean</code> | Whether the app is running in a simulator/emulator. | 1.0.0 |
76+
| **`memUsed`** | <code>number</code> | Approximate memory used by the current app, in bytes. Divide by 1048576 to get the number of MBs used. | 1.0.0 |
77+
| **`diskFree`** | <code>number</code> | How much free disk space is available on the the normal data storage. path for the os, in bytes | 1.0.0 |
78+
| **`diskTotal`** | <code>number</code> | The total size of the normal data storage path for the OS, in bytes. | 1.0.0 |
79+
80+
81+
#### DeviceBatteryInfo
82+
83+
| Prop | Type | Description | Since |
84+
| ------------------ | -------------------- | ----------------------------------------------------------------- | ----- |
85+
| **`batteryLevel`** | <code>number</code> | A percentage (0 to 1) indicating how much the battery is charged. | 1.0.0 |
86+
| **`isCharging`** | <code>boolean</code> | Whether the device is charging. | 1.0.0 |
87+
88+
89+
#### DeviceLanguageCodeResult
90+
91+
| Prop | Type | Description | Since |
92+
| ----------- | ------------------- | ---------------------------- | ----- |
93+
| **`value`** | <code>string</code> | Two character language code. | 1.0.0 |
94+
95+
96+
<!--DOCGEN_API_END-->

device/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"eslint": "eslint . --ext ts",
3030
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
3131
"swiftlint": "node-swiftlint",
32+
"docgen": "docgen --api DevicePlugin --output-readme README.md --output-json dist/docs.json",
3233
"build": "npm run clean && tsc && rollup -c rollup.config.js",
3334
"clean": "rimraf ./dist",
3435
"watch": "tsc --watch",
@@ -37,6 +38,7 @@
3738
"devDependencies": {
3839
"@capacitor/android": "^3.0.0-alpha.5",
3940
"@capacitor/core": "^3.0.0-alpha.5",
41+
"@capacitor/docgen": "^0.0.5",
4042
"@capacitor/ios": "^3.0.0-alpha.5",
4143
"@ionic/eslint-config": "^0.3.0",
4244
"@ionic/prettier-config": "^1.0.0",

0 commit comments

Comments
 (0)