## class: `WyPost`, `wy-post`

Wrapper component for a single post, delegating rendering to view/edit/trashed subcomponents.

**Used sub components:**

*   [`<wy-post-trashed>`](./wy-post-trashed)
*   [`<wy-post-edit>`](./wy-post-edit)
*   [`<wy-post-view>`](./wy-post-view)

### Fields

| Name   | Type                                    | Default | Description                                                                | Inherited From        |
| ------ | --------------------------------------- | ------- | -------------------------------------------------------------------------- | --------------------- |
| `post` | `PostType`                              |         | Post data                                                                  |                       |
| `app`  | `AppType \| undefined`                  |         | The app data. Must be directly specified or by using the \`uid\` property. |                       |
| `uid`  | `number \| string \| null \| undefined` |         | Optional appId to specify post specific app context                        |                       |
| `link` | `LinkType \| undefined`                 |         | Any provided link that should be loaded, shown and highlighted.            | WeavySubTypeComponent |

### Methods

| Name        | Description                                          | Parameters | Return                       | Inherited From        |
| ----------- | ---------------------------------------------------- | ---------- | ---------------------------- | --------------------- |
| `whenApp`   | Resolves when app data is available.                 |            | `Promise<AppType>`           |                       |
| `whenLink`  | Resolves when a provided link is available.          |            | `Promise<LinkType>`          | WeavySubTypeComponent |
| `whenReady` | Resolves when the component has rendered first time. |            | `Promise<WeavySubComponent>` | WeavySubComponent     |

### Events

| Name               | Type                      | Description                                       | Inherited From    |
| ------------------ | ------------------------- | ------------------------------------------------- | ----------------- |
| `vote`             | `PollVoteEventType`       | Emitted when a poll option is voted.              |                   |
| `subscribe`        | `PostSubscribeEventType`  | Emitted when subscribe/unsubscribe is requested.  |                   |
| `trash`            | `PostTrashEventType`      | Emitted when the post should be trashed.          |                   |
| `restore`          | `PostRestoreEventType`    | Emitted when the post should be restored.         |                   |
| `wy-action`        | `WyActionEventType`       | Emitted when an embed action button is triggered. |                   |
| `wy-preview-open`  | `WyPreviewOpenEventType`  | Fired when a preview overlay is about to open.    |                   |
| `wy-preview-close` | `WyPreviewCloseEventType` | Fired when a preview overlay is closed.           |                   |
| `ready`            | `CustomEvent`             | When the component has rendered.                  | WeavySubComponent |

### Attributes

| Name  | Field | Inherited From |
| ----- | ----- | -------------- |
| `uid` | uid   |                |

<details><summary>Private API</summary>

### Fields

| Name                        | Privacy | Type                                                               | Default                                                                               | Description | Inherited From        |
| --------------------------- | ------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | ----------- | --------------------- |
| `#resolveApp`               | private | `(app: AppType) => void \| undefined`                              |                                                                                       |             |                       |
| `#whenApp`                  | private |                                                                    | `new Promise<AppType>((r) => { this.#resolveApp = r; })`                              |             |                       |
| `#appQuery`                 | private |                                                                    | `new QueryController<AppType>(this)`                                                  |             |                       |
| `#resolveContextDataBlobs`  | private | `(blobs: ContextDataBlobsType) => void \| undefined`               |                                                                                       |             | WeavySubTypeComponent |
| `#whenContextDataBlobs`     | private |                                                                    | `new Promise<ContextDataBlobsType>((r) => { this.#resolveContextDataBlobs = r; })`    |             | WeavySubTypeComponent |
| `#resolveComponentFeatures` | private | `(componentFeatures: ComponentFeaturePolicy) => void \| undefined` |                                                                                       |             | WeavySubTypeComponent |
| `#whenComponentFeatures`    | private |                                                                    | `new Promise<ComponentFeaturePolicy>((r) => { this.#resolveComponentFeatures = r; })` |             | WeavySubTypeComponent |
| `#resolveLink`              | private | `(link: LinkType) => void \| undefined`                            |                                                                                       |             | WeavySubTypeComponent |
| `#whenLink`                 | private |                                                                    | `new Promise<LinkType>((r) => { this.#resolveLink = r; })`                            |             | WeavySubTypeComponent |
| `#resolveSettings`          | private | `(settings: WeavyComponentSettingsType) => void \| undefined`      |                                                                                       |             | WeavySubTypeComponent |
| `#whenSettings`             | private |                                                                    | `new Promise<WeavyComponentSettingsType>((r) => { this.#resolveSettings = r; })`      |             | WeavySubTypeComponent |
| `#resolveContextId`         | private | `(contextId: ContextIdType) => void \| undefined`                  |                                                                                       |             | WeavySubComponent     |
| `#whenContextId`            | private |                                                                    | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })`                  |             | WeavySubComponent     |
| `#resolveUser`              | private | `(user: UserType) => void \| undefined`                            |                                                                                       |             | WeavySubComponent     |
| `#whenUser`                 | private |                                                                    | `new Promise<UserType>((r) => { this.#resolveUser = r; })`                            |             | WeavySubComponent     |
| `#resolveWeavy`             | private | `(weavy: WeavyType) => void \| undefined`                          |                                                                                       |             | WeavySubComponent     |
| `#whenWeavy`                | private |                                                                    | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`                          |             | WeavySubComponent     |
| `#resolveReady`             | private | `(component: WeavySubComponent) => void \| undefined`              |                                                                                       |             | WeavySubComponent     |
| `#whenReady`                | private |                                                                    | `new Promise<WeavySubComponent>((r) => { this.#resolveReady = r; })`                  |             | WeavySubComponent     |

</details>

<hr/>

## Exports

| Kind                        | Name      | Declaration | Module                    | Package |
| --------------------------- | --------- | ----------- | ------------------------- | ------- |
| `js`                        | `WyPost`  | WyPost      | lib/components/wy-post.ts |         |
| `custom-element-definition` | `wy-post` | WyPost      | lib/components/wy-post.ts |         |
