-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom component extension type & extension preferences (#10443)
feat: extension points, custom components, preferences
- Loading branch information
Showing
46 changed files
with
1,493 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Enhancement: Custom component extension type | ||
|
||
We've introduced a new extension type `customComponent`. This allows to register a custom component via an extension which | ||
can then be rendered in a custom component render target. For the mapping to the render target, an extension point needs to be | ||
registered and a CustomComponentTarget for this extension point needs to be in place in a vue template. | ||
|
||
https://github.com/owncloud/web/pull/10443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Enhancement: Add extensionPoint concept | ||
|
||
The extension system now allows developers to register extension points. An extension point defines the metadata for the | ||
integration of a certain extension type in a certain context. Examples for extension points are render targets for | ||
custom components, targets for file actions (e.g. the right click context menu, the batch actions, the whitespace context | ||
menu), etc. | ||
|
||
Extensions can now specify that they are only valid for a certain or multiple extension points. This way a file action extension | ||
can e.g. specify to be rendered only in the context menu, but not in the batch actions. Consequently, the extension points | ||
concept is the next iteration of the `scopes` concept. The `scopes` concept will most likely be removed in a future release. | ||
|
||
Extension points can define if users should be able to choose preferences for the extension point. E.g. for the global progress | ||
bar extension point, users can choose which of the available progress bar extensions should be used, since the extension point | ||
only allows one extension to be active. At the moment we persist the user choice in the local storage of the browser. | ||
|
||
https://github.com/owncloud/web/pull/10443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
docs/extension-system/extension-types/custom-components.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: 'Custom component extensions' | ||
date: 2024-02-14T00:00:00+00:00 | ||
weight: 60 | ||
geekdocRepo: https://github.com/owncloud/web | ||
geekdocEditPath: edit/master/docs/extension-system/extension-types | ||
geekdocFilePath: custom-components.md | ||
geekdocCollapseSection: true | ||
--- | ||
|
||
{{< toc >}} | ||
|
||
## Extension Type CustomComponent | ||
|
||
CustomComponent extensions need to define one or multiple `extensionPointId`s as render target. A `CustomComponentTarget` component for this very | ||
extension point needs to be mounted in the current view. | ||
|
||
### Configuration | ||
|
||
To define a custom component extension, you implement the `CustomComponentExtension` interface. | ||
Here's what it looks like: | ||
|
||
```typescript | ||
interface CustomComponentExtension { | ||
id: string, | ||
type: 'customComponent', | ||
extensionPointIds: string[], | ||
content: Slot | Component | ||
} | ||
``` | ||
|
||
For `id`, `type`, and `extensionPointIds`, please see [extension base section]({{< ref "../_index.md#extension-base-configuration" >}}) in the top level docs. | ||
|
||
The `content` property specifies a render function or a Component for the target extension point. | ||
|
||
### Example | ||
|
||
A simple example for a custom component extension could be a `NyanCat` progress bar component, being | ||
targeted at the `global-progress-bar` extension point as render target. | ||
|
||
```typescript | ||
const extension = { | ||
id: 'com.github.owncloud.web.app.progress-bars.nyan-cat', | ||
type: 'customComponent', | ||
extensionPointIds: ['app.runtime.global-progress-bar'], | ||
content: (slots) => [h(NyanCat, slots)], | ||
userPreference: { | ||
optionLabel: $gettext('Nyan Cat progress bar') | ||
} | ||
} | ||
``` | ||
|
||
The `content` property in this example can also be defined as `content: NyanCat`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.