Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
deptyped committed Aug 1, 2024
1 parent b86a123 commit 1e53516
Show file tree
Hide file tree
Showing 27 changed files with 353 additions and 421 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,5 @@ data/

docs/.vitepress/dist
docs/.vitepress/cache
docs/generated
package-lock.json
17 changes: 17 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import { defineConfig } from 'vitepress'
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "vue-tg",
description: "Vue-Telegram Documentation",
markdown: {
codeTransformers: [
transformerTwoslash({
twoslashOptions: {
compilerOptions: {
noErrorTruncation: true,
paths: {
'vue-tg': [
'./dist'
]
}
}
}
})
]
},
themeConfig: {
search: {
provider: 'local',
Expand Down
11 changes: 11 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Theme from 'vitepress/theme'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
import '@shikijs/vitepress-twoslash/style.css'
import type { EnhanceAppContext } from 'vitepress'

export default {
extends: Theme,
enhanceApp({ app }: EnhanceAppContext) {
app.use(TwoslashFloatingVue)
},
}
103 changes: 0 additions & 103 deletions docs/mini-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,113 +179,10 @@ If subscription is not managed properly, it can lead to memory leaks and other i

<!--@include: @/mini-apps/composables/use-web-app-requests.md-->

<!--@include: @/mini-apps/composables/use-web-app-send-data.md-->

<!--@include: @/mini-apps/composables/use-web-app-settings-button.md-->

<!--@include: @/mini-apps/composables/use-web-app-share.md-->

<!--@include: @/mini-apps/composables/use-web-app-theme.md-->

<!--@include: @/mini-apps/composables/use-web-app-viewport.md-->

## Type Aliases

### OnClipboardTextReceivedCallback

Ƭ **OnClipboardTextReceivedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :--------------- | :----------------- |
| `eventData` | `Object` |
| `eventData.data` | `string` \| `null` |

### OnContactRequestedCallback

Ƭ **OnContactRequestedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :----------------- | :---------------------- |
| `eventData` | `Object` |
| `eventData.status` | `"sent" \| "cancelled"` |

### OnInvoiceClosedCallback

Ƭ **OnInvoiceClosedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :----------------- | :----------------------------------------------- |
| `eventData` | `Object` |
| `eventData.status` | `"paid" \| "cancelled" \| "failed" \| "pending"` |
| `eventData.url` | `string` |

### OnPopupClosedCallback

Ƭ **OnPopupClosedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :-------------------- | :---------------- |
| `eventData` | `Object` |
| `eventData.button_id` | `string \| null` |

### OnQrTextReceivedCallback

Ƭ **OnQrTextReceivedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :--------------- | :------- |
| `eventData` | `Object` |
| `eventData.data` | `string` |

### OnViewportChangedCallback

Ƭ **OnViewportChangedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :------------------------ | :-------- |
| `eventData` | `Object` |
| `eventData.isStateStable` | `boolean` |

### OnWriteAccessRequestedCallback

Ƭ **OnWriteAccessRequestedCallback**: `(eventData) => void`

##### Parameters

| Name | Type |
| :----------------- | :------------------------- |
| `eventData` | `Object` |
| `eventData.status` | `"allowed" \| "cancelled"` |

### OnBiometricAuthRequested

Ƭ **OnBiometricAuthRequested**: `(eventData) => void`

##### Parameters

| Name | Type |
| :---------------- | :-------------------- |
| `isAuthenticated` | `boolean` |
| `biometricToken` | `string \| undefined` |

### OnBiometricTokenUpdated

Ƭ **OnBiometricTokenUpdated**: `(eventData) => void`

##### Parameters

| Name | Type |
| :---------- | :-------- |
| `isUpdated` | `boolean` |
19 changes: 8 additions & 11 deletions docs/mini-apps/composables/use-web-app-back-button.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
### useWebAppBackButton

```ts
```ts twoslash
// Hover to inspect type
import { useWebAppBackButton } from 'vue-tg'
```

**useWebAppBackButton**(): `Object`

#### Returns

| Name | Type |
| :-------------------- | :----------------------------------- |
| `hideBackButton` | `() => void` |
| `isBackButtonVisible` | `Ref<boolean>` |
| `onBackButtonClicked` | `(eventHandler: () => void) => void` |
| `showBackButton` | `() => void` |
| Name | Description |
| :-------------------- | :-------------------------------------------------------------------------------------------------------------------- |
| `isBackButtonVisible` | <!--@include: @/generated/BackButton-isVisible.md --> <br/> <Badge type="info" text="⚡️ reactive" /> |
| `onBackButtonClicked` | <Badge type="tip" text="Bot API 6.1+" /> A method that sets the `backButtonClicked` [event handler](#event-handling). |
| `showBackButton` | <!--@include: @/generated/BackButton-show.md --> |
| `hideBackButton` | <!--@include: @/generated/BackButton-hide.md --> |
41 changes: 19 additions & 22 deletions docs/mini-apps/composables/use-web-app-biometric-manager.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
### useWebAppBiometricManager

```ts
```ts twoslash
// Hover to inspect type
import { useWebAppBiometricManager } from 'vue-tg'
```

**useWebAppBiometricManager**(): `Object`

#### Returns

| Name | Type |
| :--------------------------- | :---------------------------------------------------------------------------------------------------------------------- |
| `isBiometricInited` | `Readonly<Ref<boolean>>` |
| `isBiometricAvailable` | `Readonly<Ref<boolean>>` |
| `biometricType` | `Readonly<Ref<"finger" \| "face" \| "unknown">>` |
| `isBiometricAccessRequested` | `Readonly<Ref<boolean>>` |
| `isBiometricAccessGranted` | `Readonly<Ref<boolean>>` |
| `isBiometricTokenSaved` | `Readonly<Ref<boolean>>` |
| `biometricDeviceId` | `Readonly<Ref<string>>` |
| `initBiometric` | `(callback?: () => void) => void` |
| `requestBiometricAccess` | `(params: BiometricRequestAccessParams, callback?: (isAccessGranted: boolean) => void) => void` |
| `authenticateBiometric` | `(params: BiometricAuthenticateParams, callback?: (isAuthenticated: boolean, biometricToken?: string) => void) => void` |
| `updateBiometricToken` | `(token: string, callback?: (applied: boolean) => void) => void` |
| `openBiometricSettings` | `() => void` |
| `onBiometricManagerUpdated` | `(eventHandler: () => void) => void` |
| `onBiometricAuthRequested` | `(eventHandler: `[`OnBiometricAuthRequested`](#onbiometricauthrequested)`)) => void` |
| `onBiometricTokenUpdated` | `(eventHandler: `[`OnBiometricTokenUpdated`](#onbiometrictokenupdated)`)) => void` |
| Name | Type |
| :--------------------------- | :---------------------------------------------------------------------------------------------------------------------------- |
| `isBiometricInited` | <!--@include: @/generated/BiometricManager-isInited.md --> <br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `isBiometricAvailable` | <!--@include: @/generated/BiometricManager-isBiometricAvailable.md --> <br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `biometricType` | <!--@include: @/generated/BiometricManager-biometricType.md --><br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `isBiometricAccessRequested` | <!--@include: @/generated/BiometricManager-isAccessRequested.md --><br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `isBiometricAccessGranted` | <!--@include: @/generated/BiometricManager-isAccessGranted.md --><br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `isBiometricTokenSaved` | <!--@include: @/generated/BiometricManager-isBiometricTokenSaved.md --><br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `biometricDeviceId` | <!--@include: @/generated/BiometricManager-deviceId.md --><br/> <Badge type="info" text="⚡️ readonly reactive" /> |
| `initBiometric` | <!--@include: @/generated/BiometricManager-init.md --> |
| `requestBiometricAccess` | <!--@include: @/generated/BiometricManager-requestAccess.md --> |
| `authenticateBiometric` | <!--@include: @/generated/BiometricManager-authenticate.md --> |
| `updateBiometricToken` | <!--@include: @/generated/BiometricManager-updateBiometricToken.md --> |
| `openBiometricSettings` | <!--@include: @/generated/BiometricManager-openSettings.md --> |
| `onBiometricManagerUpdated` | <Badge type="tip" text="Bot API 7.2+" /> A method that sets the `biometricManagerUpdated` [event handler](#event-handling). |
| `onBiometricAuthRequested` | <Badge type="tip" text="Bot API 7.2+" /> A method that sets the `biometricAuthRequested` [event handler](#event-handling). |
| `onBiometricTokenUpdated` | <Badge type="tip" text="Bot API 7.2+" /> A method that sets the `biometricTokenUpdated` [event handler](#event-handling). |
15 changes: 6 additions & 9 deletions docs/mini-apps/composables/use-web-app-clipboard.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
### useWebAppClipboard

```ts
```ts twoslash
// Hover to inspect type
import { useWebAppClipboard } from 'vue-tg'
```

**useWebAppClipboard**(): `Object`

#### Returns

| Name | Type |
| :------------------------ | :------------------------------------------------------------------------------------------------ |
| `onClipboardTextReceived` | `(eventHandler:` [`OnClipboardTextReceivedCallback`](#onclipboardtextreceivedcallback)`) => void` |
| `readTextFromClipboard` | `(callback?: (data: null \| string) => void) => void` |
| Name | Type |
| :------------------------ | :------------------------------------------------------------------------------------------------------------------------ |
| `onClipboardTextReceived` | <Badge type="tip" text="Bot API 6.4+" /> A method that sets the `clipboardTextReceived` [event handler](#event-handling). |
| `readTextFromClipboard` | <!--@include: @/generated/WebApp-readTextFromClipboard.md --> |
17 changes: 7 additions & 10 deletions docs/mini-apps/composables/use-web-app-closing-confirmation.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
### useWebAppClosingConfirmation

```ts
```ts twoslash
// Hover to inspect type
import { useWebAppClosingConfirmation } from 'vue-tg'
```

**useWebAppClosingConfirmation**(): `Object`

#### Returns

| Name | Type |
| :----------------------------- | :------------- |
| `disableClosingConfirmation` | `() => void` |
| `enableClosingConfirmation` | `() => void` |
| `isClosingConfirmationEnabled` | `Ref<boolean>` |
| Name | Type |
| :----------------------------- | :----------------------------------------------------------------------------------------------------------------- |
| `isClosingConfirmationEnabled` | <!--@include: @/generated/WebApp-isClosingConfirmationEnabled.md --> <br/> <Badge type="info" text="⚡️ reactive" /> |
| `enableClosingConfirmation` | <!--@include: @/generated/WebApp-enableClosingConfirmation.md --> |
| `disableClosingConfirmation` | <!--@include: @/generated/WebApp-disableClosingConfirmation.md --> |
23 changes: 10 additions & 13 deletions docs/mini-apps/composables/use-web-app-cloud-storage.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
### useWebAppCloudStorage

```ts
```ts twoslash
// Hover to inspect type
import { useWebAppCloudStorage } from 'vue-tg'
```

**useWebAppCloudStorage**(): `Object`

#### Returns

| Name | Type |
| :------------------- | :------------------------------------------------------ |
| `getStorageItem` | `(key: string) => Promise<null \| string>` |
| `getStorageItems` | `(keys: string[]) => Promise<Record<string, string>>` |
| `getStorageKeys` | `() => Promise<string[]>` |
| `removeStorageItem` | `(key: string) => Promise<null \| true>` |
| `removeStorageItems` | `(keys: string[]) => Promise<null \| true>` |
| `setStorageItem` | `(key: string, value: string) => Promise<null \| true>` |
| Name | Type |
| :------------------- | :-------------------------------------------------------- |
| `setStorageItem` | <!--@include: @/generated/CloudStorage-setItem.md --> |
| `getStorageItem` | <!--@include: @/generated/CloudStorage-getItem.md --> |
| `getStorageItems` | <!--@include: @/generated/CloudStorage-getItems.md --> |
| `removeStorageItem` | <!--@include: @/generated/CloudStorage-removeItem.md --> |
| `removeStorageItems` | <!--@include: @/generated/CloudStorage-removeItems.md --> |
| `getStorageKeys` | <!--@include: @/generated/CloudStorage-getKeys.md --> |
17 changes: 7 additions & 10 deletions docs/mini-apps/composables/use-web-app-haptic-feedback.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
### useWebAppHapticFeedback

```ts
```ts twoslash
// Hover to inspect type
import { useWebAppHapticFeedback } from 'vue-tg'
```

**useWebAppHapticFeedback**(): `Object`

#### Returns

| Name | Type |
| :--------------------- | :--------------------------------------------------------------------------- |
| `impactOccurred` | `(style: "light" \| "medium" \| "heavy" \| "rigid" \| "soft") => () => void` |
| `notificationOccurred` | `(type: "error" \| "success" \| "warning") => () => void` |
| `selectionChanged` | `() => void` |
| Name | Type |
| :--------------------- | :------------------------------------------------------------------- |
| `impactOccurred` | <!--@include: @/generated/HapticFeedback-impactOccurred.md --> |
| `notificationOccurred` | <!--@include: @/generated/HapticFeedback-notificationOccurred.md --> |
| `selectionChanged` | <!--@include: @/generated/HapticFeedback-selectionChanged.md --> |
Loading

0 comments on commit 1e53516

Please sign in to comment.