Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: initial version of super-capacitor docs #267

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions website/docs/for-super-capacitor/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Overview

Super Capacitor is a Capacitor plugin designed to allow Capacitor apps to utilize the capabilities of Ionic Portals.

## Install

```bash
npm install @ionic-enterprise/super-capacitor
npx cap sync
```

## Types

### MicroappOptions

The options for configuring your microapp when using [`presentMicroapp`](#presentmicroapp).

```typescript
interface MicroappOptions {
name: string;
type: 'push' | 'modal';
modalStyle?: 'fullScreen' | 'pageSheet';
startDir?: string;
initialContext?: InitialContext;
liveUpdateConfig?: LiveUpdateConfig;
}
```

## Methods

- [`presentMicroapp(options: MicroappOptions)`](#presentmicroapp)
- [`dismissMicroapp()`](#dismissmicroapp)

### presentMicroapp

```typescript
presentMicroapp(options: MicroappOptions) => Promise<void>
```

#### Usage

```typescript
import { presentMicroapp } from '@ionic-enterprise/super-capacitor/superapp';

presentMicroapp({
name: 'checkoutApp',
startDir: 'microapps/checkout',
type: 'push',
});
```

> **_NOTE:_** A TypeScript module resolution Node16, NodeNext, or Bundler is required to recognize Super Capacitor's use of subpath exports.

#### Parameters

| Name | Type | Description |
| --------- | ------------------------------------- | --------------------------------------------------------------------------- |
| `options` | [`MicroappOptions`](#microappoptions) | The [`MicroappOptions`](#microappoptions) object to configure the microapp. |

### dismissMicroapp

```typescript
dismissMicroapp() => Promise<void>
```

#### Usage

```typescript
import { dismissMicroapp } from '@ionic-enterprise/super-capacitor/microapp';

dismissMicroapp();
```

> **_NOTE:_** A TypeScript module resolution Node16, NodeNext, or Bundler is required to recognize Super Capacitor's use of subpath exports.


## Plugins
A microapp can only use plugins installed in its superapp. All superapp plugins are automatically available to its microapps. If a microapp requires a plugin not used by its superapp, that plugin must still be installed in the superapp.
63 changes: 63 additions & 0 deletions website/docs/for-super-capacitor/presentation-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import useBaseUrl from '@docusaurus/useBaseUrl';

# Presentation Types

The `type` option within the `MicroappOptions` interface allows you to specify how the microapp will be presented to users. This section of the documentation provides an example of the available presentation types.

## Push

```typescript
const microappOptions: MicroappOptions = {
name: 'Microapp Name';
type: 'push';
}
```

<em
style={{
textAlign: 'center',
display: 'block',
}}
>
<img src={useBaseUrl('/img/super-capacitor/presentation-types/push.gif')} width="300px" />
</em>

## Modal

### FullScreen

```typescript
const microappOptions: MicroappOptions = {
name: 'Microapp Name';
type: 'modal';
modalStyle: 'fullScreen';
}
```

<em
style={{
textAlign: 'center',
display: 'block',
}}
>
<img src={useBaseUrl('/img/super-capacitor/presentation-types/fullscreen.gif')} width="300px" />
</em>

### PageSheet

```typescript
const microappOptions: MicroappOptions = {
name: 'Microapp Name';
type: 'modal';
modalStyle: 'pageSheet';
}
```

<em
style={{
textAlign: 'center',
display: 'block',
}}
>
<img src={useBaseUrl('/img/super-capacitor/presentation-types/pagesheet.gif')} width="300px" />
</em>
Loading
Loading