From 4b4d8766d66941513c7f761e32f2d028b3231831 Mon Sep 17 00:00:00 2001 From: Richard Herman Date: Tue, 13 Aug 2024 12:21:08 +0100 Subject: [PATCH 1/3] feat: add JSON schemas to vscode config, remove subjective settings --- template/.vscode/settings.json | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/template/.vscode/settings.json b/template/.vscode/settings.json index 4f809ca..0109b7d 100644 --- a/template/.vscode/settings.json +++ b/template/.vscode/settings.json @@ -1,14 +1,17 @@ { - /* Prefer tabs over spaces for accessibility */ - "editor.insertSpaces": false, - "editor.detectIndentation": false, - /* Explorer */ - "explorer.fileNesting.enabled": true, - "explorer.fileNesting.patterns": { - "*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts", - "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, rollup.config.mjs, tsconfig.json" - }, - "files.exclude": { - "node_modules": true - } + /* JSON schemas */ + "json.schemas": [ + { + "fileMatch": [ + "*/manifest.json" + ], + "url": "https://schemas.elgato.com/streamdeck/plugins/manifest.json" + }, + { + "fileMatch": [ + "*/layouts/*.json" + ], + "url": "https://schemas.elgato.com/streamdeck/plugins/layout.json" + } + ] } \ No newline at end of file From 221650d5c9af7005f7e71696dfdd5ab9d33f3d6f Mon Sep 17 00:00:00 2001 From: Richard Herman Date: Tue, 13 Aug 2024 12:23:11 +0100 Subject: [PATCH 2/3] feat: add JSON schemas to vscode config, remove subjective settings --- template/.vscode/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/.vscode/settings.json b/template/.vscode/settings.json index 0109b7d..ef8832f 100644 --- a/template/.vscode/settings.json +++ b/template/.vscode/settings.json @@ -3,13 +3,13 @@ "json.schemas": [ { "fileMatch": [ - "*/manifest.json" + "**/manifest.json" ], "url": "https://schemas.elgato.com/streamdeck/plugins/manifest.json" }, { "fileMatch": [ - "*/layouts/*.json" + "**/layouts/*.json" ], "url": "https://schemas.elgato.com/streamdeck/plugins/layout.json" } From edf68314c1cf83d7e214a0ce3e6f387cb41756e5 Mon Sep 17 00:00:00 2001 From: Richard Herman Date: Wed, 14 Aug 2024 19:39:58 +0100 Subject: [PATCH 3/3] feat: add basic PI to create command --- src/commands/create.ts | 1 + .../manifest.json.ejs | 1 + .../ui/increment-counter.html | 19 +++++++++++++++++++ template/src/actions/increment-counter.ts.ejs | 16 +++++++++------- 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 template/com.elgato.template.sdPlugin/ui/increment-counter.html diff --git a/src/commands/create.ts b/src/commands/create.ts index a9f6d5d..af63087 100644 --- a/src/commands/create.ts +++ b/src/commands/create.ts @@ -228,6 +228,7 @@ async function renderTemplate(destination: string, pluginInfo: PluginInfo): Prom await Promise.allSettled([ template.copy(".vscode"), template.copy(`${TEMPLATE_PLUGIN_UUID}.sdPlugin/imgs`, `${pluginInfo.uuid}.sdPlugin/imgs`), + template.copy(`${TEMPLATE_PLUGIN_UUID}.sdPlugin/ui`, `${pluginInfo.uuid}.sdPlugin/ui`), template.copy(`${TEMPLATE_PLUGIN_UUID}.sdPlugin/manifest.json.ejs`, `${pluginInfo.uuid}.sdPlugin/manifest.json`), template.copy("src"), template.copy("_.gitignore", ".gitignore"), diff --git a/template/com.elgato.template.sdPlugin/manifest.json.ejs b/template/com.elgato.template.sdPlugin/manifest.json.ejs index fac4a53..61206a8 100644 --- a/template/com.elgato.template.sdPlugin/manifest.json.ejs +++ b/template/com.elgato.template.sdPlugin/manifest.json.ejs @@ -8,6 +8,7 @@ "UUID": "<%- uuid %>.increment", "Icon": "imgs/actions/counter/icon", "Tooltip": "Displays a count, which increments by one on press.", + "PropertyInspectorPath": "ui/increment-counter.html", "Controllers": [ "Keypad" ], diff --git a/template/com.elgato.template.sdPlugin/ui/increment-counter.html b/template/com.elgato.template.sdPlugin/ui/increment-counter.html new file mode 100644 index 0000000..e0d65ee --- /dev/null +++ b/template/com.elgato.template.sdPlugin/ui/increment-counter.html @@ -0,0 +1,19 @@ + + + + + Increment Counter Settings + + + + + + + + + + + + \ No newline at end of file diff --git a/template/src/actions/increment-counter.ts.ejs b/template/src/actions/increment-counter.ts.ejs index b16c1e9..18ae495 100644 --- a/template/src/actions/increment-counter.ts.ejs +++ b/template/src/actions/increment-counter.ts.ejs @@ -6,7 +6,7 @@ import { action, KeyDownEvent, SingletonAction, WillAppearEvent } from "@elgato/ @action({ UUID: "<%- uuid %>.increment" }) export class IncrementCounter extends SingletonAction { /** - * The {@link SingletonAction.onWillAppear} event is useful for setting the visual representation of an action when it become visible. This could be due to the Stream Deck first + * The {@link SingletonAction.onWillAppear} event is useful for setting the visual representation of an action when it becomes visible. This could be due to the Stream Deck first * starting up, or the user navigating between pages / folders etc.. There is also an inverse of this event in the form of {@link streamDeck.client.onWillDisappear}. In this example, * we're setting the title to the "count" that is incremented in {@link IncrementCounter.onKeyDown}. */ @@ -21,13 +21,14 @@ export class IncrementCounter extends SingletonAction { * settings using `setSettings` and `getSettings`. */ async onKeyDown(ev: KeyDownEvent): Promise { - // Determine the current count from the settings. - let count = ev.payload.settings.count ?? 0; - count++; + // Update the count from the settings. + const { settings } = ev.payload; + settings.incrementBy ??= 1; + settings.count = (settings.count ?? 0) + settings.incrementBy; // Update the current count in the action's settings, and change the title. - await ev.action.setSettings({ count }); - await ev.action.setTitle(`${count}`); + await ev.action.setSettings(settings); + await ev.action.setTitle(`${settings.count}`); } } @@ -35,5 +36,6 @@ export class IncrementCounter extends SingletonAction { * Settings for {@link IncrementCounter}. */ type CounterSettings = { - count: number; + count?: number; + incrementBy?: number; };