Skip to content

Implement interactive list of plugins, settings component demo, and visual SettingsTemplate.yaml editor #82

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

Merged
merged 4 commits into from
Apr 30, 2024
Merged
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
61 changes: 32 additions & 29 deletions .github/workflows/plugin-updater.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
name: Plugin Updater

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
- main
paths:
- webcomponents/**.js
- webcomponents/**.ts
- webcomponents/**.json
- webcomponents/**.svelte

jobs:
Update:
build-webcomponents:
name: Build web components
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ secrets.UPDATER }}

- uses: actions/setup-python@v2
- name: Setup Node
uses: actions/setup-node@v4
with:
python-version: "3.x"

- name: Install Dependencies
run: pip install -r ./ci/envs/requirements-plugin.txt

- name: Update Plugin Informations
run: python ./ci/src/plugin_updater.py
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: "Flow-Launcher/Flow.Launcher.PluginsManifest"
PLUGIN_JSON: "plugins.json"
PLUGIN_MARKDOWN: "plugins.md"
PLUGIN_NAME: "Name"
PLUGIN_AUTHOR: "Author"
PLUGIN_DESCRIPTION: "Description"
PLUGIN_VERSION: "Version"
PLUGIN_WEBSITE: "Website"

- name: Commit & Push changes
uses: stefanzweifel/git-auto-commit-action@v4
node-version: 20
- name: Get version
id: version
run: |
version=$(jq -r .version webcomponents/package.json)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Build
run: |
cd webcomponents
npm install
npm run build
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add dist
git commit -m "Update web components build artifact"
- name: Put new build into the repo
uses: ad-m/github-push-action@master
with:
commit_message: "DOC: update plugin list"
push_options: --force
branch: main
github_token: ${{ secrets.UPDATER }}
branch: ${{ github.ref }}
1 change: 1 addition & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- JSONRPC
- [**JSON RPC Introduction**](/json-rpc.md)
- [**JSON RPC Plugin Settings**](/json-rpc-settings.md)
- [**Visual SettingsTemplate.yaml editor**](/json-rpc-visual-settingstemplate-editor.md)
- Porting Plugins
- [**Porting Plugins Guide**](/port-plugins.md)
- [**How To Create A Theme**](/how-to-create-a-theme.md)
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
coverpage: false,
mergeNavbar: true,
loadSidebar: true,
executeScript: true,
subMaxLevel: 4,
search: 'auto',
auto2top: true,
Expand Down Expand Up @@ -57,4 +58,4 @@
</script>
</body>

</html>
</html>
37 changes: 34 additions & 3 deletions json-rpc-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You might need to have some settings in your plugins that are easily changeable


### SettingsTemplate.yaml
This is a YAML files that contains the settings page layout for your plugin. It contains an object with a single property called `body`. The `body` property contains an array of objects that define the layout of the settings page. Each object in the `body` array is a section of the settings page. Each section takes up the entire width of the page, which means you can't have one input on the left and one on the right. The layout of each section is always static: input description on the left, input on the right. Every object in the `body` array has the same structure: a `type` property that defines the type of this input (text input, textarea etc.), and an `attributes` property that contains everything else the object needs to render, such as label, description, or default value. The following is a list of the different types of inputs that can be used in the `SettingsTemplate.yaml` file.
This is a YAML file that contains the settings page layout for your plugin. It contains an object with a single property called `body`. The `body` property contains an array of objects that define the layout of the settings page. Each object in the `body` array is a section of the settings page. Each section takes up the entire width of the page, which means you can't have one input on the left and one on the right. The layout of each section is always static: input description on the left, input on the right. Every object in the `body` array has the same structure: a `type` property that defines the type of this input (text input, textarea etc.), and an `attributes` property that contains everything else the object needs to render, such as label, description, or default value. The following is a list of the different input types that can be used in the `SettingsTemplate.yaml` file.

---

Expand All @@ -15,6 +15,8 @@ type: textBlock
attributes:
description: This is a block of text.
```
<settings-component-demo type="textBlock" description="This is a block of text."></settings-component-demo>

| Property name | Property description |
|---------------|----------------------|
| `description` | The text to display. |
Expand All @@ -29,6 +31,8 @@ attributes:
description: Description of the input
defaultValue: Hello there
```
<settings-component-demo type="input" label="This is a text input" description="Description of the input" value="Hello there"></settings-component-demo>

| Property name | Property description |
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the input. This is the key that you will use to access the value of the input in the settings object. |
Expand All @@ -46,6 +50,8 @@ attributes:
description: Description of the input
defaultValue: Hello there
```
<settings-component-demo type="inputWithFileBtn" label="This is a text input with a Browse button" description="Description of the input" value="Hello there"></settings-component-demo>

| Property name | Property description |
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the input. This is the key that you will use to access the value of the input in the settings object. |
Expand All @@ -64,6 +70,8 @@ attributes:
description: Description of the input
defaultValue: Hello there
```
<settings-component-demo type="textarea" label="This is a multiline text input" description="Description of the input" value="Hello there"></settings-component-demo>

| Property name | Property description |
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the input. This is the key that you will use to access the value of the input in the settings object. |
Expand All @@ -81,6 +89,8 @@ attributes:
description: Description of the input
defaultValue: secret password
```
<settings-component-demo type="passwordBox" label="This is a password input" description="Description of the input" value="secret password"></settings-component-demo>

| Property name | Property description |
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the input. This is the key that you will use to access the value of the input in the settings object. |
Expand All @@ -102,6 +112,8 @@ attributes:
- Option 2
- Option 3
```
<settings-component-demo type="dropdown" label="This is a dropdown input" description="Description of the input" value="Option 1" options='["Option 1", "Option 2", "Option 3"]'></settings-component-demo>

| Property name | Property description |
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the input. This is the key that you will use to access the value of the input in the settings object. |
Expand All @@ -120,6 +132,8 @@ attributes:
description: Description of the checkbox
defaultValue: true
```
<settings-component-demo type="checkbox" label="This is a checkbox" description="Description of the checkbox" value="true"></settings-component-demo>

| Property name | Property description |
|----------------|-------------------------------------------------------------------------------------------------------------------------|
| `name` | The name of the checkbox. This is the key that you will use to access the value of the checkbox in the settings object. |
Expand Down Expand Up @@ -158,10 +172,27 @@ body:
- "C#"
- type: checkbox
attributes:
name: Prefer shorter answers
name: preferShorterAnswers
label: Prefer shorter answers
description: If checked, the plugin will try to give answer much shorter than the usual ones.
defaultValue: false
```
<settings-component-demo type="textBlock" description="Welcome to the settings page for my plugin. Here you can configure the plugin to your liking."></settings-component-demo>
<settings-component-demo type="input" label="How should I call you?" value="the user"></settings-component-demo>
<settings-component-demo type="textarea" label="Text to prepend to result output" description='This text will be added to the beginning of the result output. For example, if you set this to "The result is: ", and the result is "42", the output will be "The result is: 42".'></settings-component-demo>
<settings-component-demo type="dropdown" label="Programming language to prefer for answers" value="TypeScript" options='["JavaScript", "TypeScript", "Python", "C#"]'></settings-component-demo>
<settings-component-demo type="checkbox" label="Prefer shorter answers" description="If checked, the plugin will try to give answer much shorter than the usual ones."></settings-component-demo>

### Visual editor for `SettingsTemplate.yaml`
You can use a [visual editor](https://flow-launcher-plugin-settings-generator.pages.dev/) for creating the `SettingsTemplate.yaml` file. When you're done editing, click the `Generate SettingsTemplate.yaml` file and copy-paste its contents into your `SettingsTemplate.yaml` file. Optionally, you can also copy the generated typings for your settings object in your preferred programming language.
You can use a [visual editor](#/json-rpc-visual-settingstemplate-editor) for creating the `SettingsTemplate.yaml` file. When you're done editing, click the `Generate SettingsTemplate.yaml` file and copy-paste its contents into your `SettingsTemplate.yaml` file. Optionally, you can also copy the generated typings for your settings object in your preferred programming language.

<script>
const element = document.querySelector('#__settings-script__');
if (!element) {
const script = document.createElement('script');
script.id = '__settings-script__';
script.src = 'https://www.flowlauncher.com/docs/webcomponents/dist/flow-launcher-docs-web-components.js';
script.type = 'module';
document.body.appendChild(script);
}
</script>
18 changes: 18 additions & 0 deletions json-rpc-visual-settingstemplate-editor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## SettingsTemplate.yaml editor

Note that data in the editor below is not persisted. It will be lost once you close your browser. Remember to press "Generate SettingsTemplate.yaml" and save the result if you want to keep it.

If you already have a SettingsTemplate.yaml file and would like to try editing it here, just copy its contents and paste it on this page.

<settings-generator></settings-generator>

<script>
const element = document.querySelector('#__settings-script__');
if (!element) {
const script = document.createElement('script');
script.id = '__settings-script__';
script.src = 'https://www.flowlauncher.com/docs/webcomponents/dist/flow-launcher-docs-web-components.js';
script.type = 'module';
document.body.appendChild(script);
}
</script>
Loading