Add all existing data refs

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2024-01-24 09:39:28 +01:00
parent 5b70e5591d
commit 2a04cef984
2 changed files with 84 additions and 13 deletions
@@ -81,8 +81,6 @@ const extension = createExtension({
Note that while the `createExtension` is public API and used in many places, it is not typically what you use when building plugins and features. Instead there are many extension creator functions exported by both the core APIs and plugins that make it easier to create extensions for more specific usages.
... TODO ...
## Extension Data
Communication between extensions happens in one direction, from one child extension through the attachment point to its parent. The child extension outputs data which is then passed as inputs to the parent extension. This data is called Extension Data, where the shape of each individual piece of data is described by an Extension Data Reference. These references are created separately from the extensions themselves, and can be shared across multiple different kinds of extensions. Each reference consists of an ID and a TypeScript type that the data needs to conform to, and represents one type of data that can be shared between extensions.
@@ -3,22 +3,95 @@ id: built-in-data-refs
title: Built-in data refs
sidebar_label: Built-in data refs
# prettier-ignore
description: Configuring or overriding built-in data refs
description: Configuring or overriding built-in extension data references
---
## Disable built-in data refs
To have a better understanding of extension data references please read [extension data section the extensions architecture documentation](../architecture/03-extensions.md#extension-data) first.
## Override built-in data refs
## Built-in extension data references
## Default built-in data refs
### Frontend Plugin API
### Example
#### Core Extension Data
#### Example
| namespace | name | type | id |
| :-------: | :----------: | :---------: | :-----------------: |
| - | reactElement | JSX.Element | `core.reactElement` |
| - | routePath | string | `core.routing.path` |
| - | routeRef | RouteRef | `core.routing.ref` |
Extensions that provides a default `light` and `dark` app themes.
####
| kind | namespace | name | id |
| :---: | :-------: | :---: | :---------------: |
| theme | app | light | `theme:app/light` |
| theme | app | dark | `theme:app/dark` |
| namespace | name | type | id |
| :----------------: | :------------: | :-----------: | :--------------: |
| createApiExtension | factoryDataRef | AnyApiFactory | core.api.factory |
####
| namespace | name | type | id |
| :---------------------------: | :--------------: | :----------------------------------: | :--------------: |
| createAppRootWrapperExtension | componentDataRef | ComponentType<PropsWithChildren<{}>> | app.root.wrapper |
####
| namespace | name | type | id |
| :-------------------: | :--------------: | :----------------------------------: | :--------------: |
| createRouterExtension | componentDataRef | ComponentType<PropsWithChildren<{}>> | app.root.wrapper |
####
```ts
type DataType = {
title: string;
icon: IconComponent;
routeRef: RouteRef<undefined>;
};
```
| namespace | name | type | id |
| :--------------------: | :-----------: | :------: | :------------------: |
| createNavItemExtension | targetDataRef | DataType | core.nav-item.target |
####
```ts
type DataType = {
logoIcon?: JSX.Element;
logoFull?: JSX.Element;
};
```
| namespace | name | type | id |
| :--------------------: | :-----------------: | :----------------------------------: | :-------------------------: |
| createNavLogoExtension | logoElementsDataRef | ComponentType<PropsWithChildren<{}>> | core.nav-logo.logo-elements |
####
| namespace | name | type | id |
| :-----------------------: | :--------------: | :----------------------------: | :-------------------------: |
| createSignInPageExtension | componentDataRef | ComponentType<SignInPageProps> | core.sign-in-page.component |
####
| namespace | name | type | id |
| :------------------: | :----------: | :------: | :--------------: |
| createThemeExtension | themeDataRef | AppTheme | core.theme.theme |
####
```ts
type DataType = {
ref: ComponentRef;
impl: ComponentType;
};
```
| namespace | name | type | id |
| :----------------------: | :--------------: | :------: | :----------------------: |
| createComponentExtension | componentDataRef | DataType | core.component.component |
####
| namespace | name | type | id |
| :------------------------: | :----------------: | :----------------------------------------: | :--------------------------: |
| createTranslationExtension | translationDataRef | TranslationResource or TranslationMessages | core.translation.translation |