8000 refactor(!): remove browser import by GeekyEggo · Pull Request #114 · elgatosf/streamdeck · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor(!): remove browser import #114

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

Open
wants to merge 4 commits into
base: 2.0.0-alpha/dev
Choose a base branch
from
Open
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
190 changes: 107 additions & 83 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,193 +12,217 @@

# Change Log

## 2.0.0-alpha.1

This release focuses on relocating the property inspector functionality to a dedicated `@streamdeck/ui` module.

### ♻️ Refactor

- Remove browser import capabilities.
- Remove property inspector types.
- Remove routing with the property inspector.
- Streamline sending messages to the UI:
- Before: `streamDeck.current.ui?.sendToPropertyInspector(...)`
- After: `streamDeck.current.sendToPropertyInspector(...)`
- Relocate property inspector action information:
- Before: `streamDeck.current.ui?`
- After: `streamDeck.current.action`

## 2.0.0-alpha.0

### ♻️ Refactor

This release focuses on preparing plugins for protection.

- Remove manifest namespace.

## 1.3.1

### 🐞 Fix

- Update reading of the manifest to be lazy to improve mocking within tests.
- Update reading of the manifest to be lazy to improve mocking within tests.

## 1.3.0

### ✨ New

- Add support for serializing enumerable collections.
- Add support for serializing enumerable collections.

### ♻️ Update

- Improve documentation for profile switching.
- Update dependencies.
- Improve documentation for profile switching.
- Update dependencies.

## 1.2.1

### ♻️ Update

- Update `@elgato/schemas` dependency.
- Update `@elgato/schemas` dependency.

### 🐞 Fix

- Fix Node.js engine requirements.
- Fix Node.js engine requirements.

## 1.2.0

### ✨ New

- Add support for Chinese (Traditional).
- Add support for Chinese (Traditional).

### 🐞 Fix

- Fix types of `EventEmitter` event arguments.
- Fix types of `EventEmitter` event arguments.

## 1.1.0

### ✨ New

- Add [`.drop()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/drop), [`.flapMap()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/flatMap), [`.take()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/take), and [`.toArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) iterator helper polyfills to `Enumerable`.
- Add [`.drop()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/drop), [`.flapMap()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/flatMap), [`.take()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/take), and [`.toArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) iterator helper polyfills to `Enumerable`.

### ♻️ Update

- Update `SingletonAction.actions` to return an `Enumerable`.
- Update `SingletonAction.actions` to return an `Enumerable`.

## 1.0.1

### ♻️ Update

- Update minimum allowed log level in production to be `DEBUG` to assist with debugging (default remains `INFO`).
- Update minimum allowed log level in production to be `DEBUG` to assist with debugging (default remains `INFO`).

## 1.0.0

### ✨ New

- Add action tracking, allowing access to currently visible actions.
- `streamDeck.actions` — all visible actions.
- `SingletonAction.actions` — visible actions that match the action's UUID.
- Add `setTitle` to `DialAction`, allowing you to set the title of a layout.
- Add `Enumerable` class for creating readonly collections.
- Add device information to `Action` provided in event arguments.
- Add iterator helpers to `streamDeck.devices` and `streamDeck.actions`.
- Add action tracking, allowing access to currently visible actions.
- `streamDeck.actions` — all visible actions.
- `SingletonAction.actions` — visible actions that match the action's UUID.
- Add `setTitle` to `DialAction`, allowing you to set the title of a layout.
- Add `Enumerable` class for creating readonly collections.
- Add device information to `Action` provided in event arguments.
- Add iterator helpers to `streamDeck.devices` and `streamDeck.actions`.

### 🐞 Fix

- Fix missing language support for Korean (ko).
- Fix TypeScript declaration incorrectly exporting types as classes.
- Fix missing language support for Korean (ko).
- Fix TypeScript declaration incorrectly exporting types as classes.

### ♻️ Update

- Remove `streamDeck.actions.createController` in favor of `streamDeck.actions.getActionById`.
- Remove `Action.sendToPropertyInspector` in favour of `streamDeck.ui.current.sendToPropertyInspector`.
- Remove `ev.deviceId` in favour of `ev.action.device.id`.
- Rename `onDidConnect` to `onConnected` within the UI.
- Remove `streamDeck.actions.createController` in favor of `streamDeck.actions.getActionById`.
- Remove `Action.sendToPropertyInspector` in favour of `streamDeck.ui.current.sendToPropertyInspector`.
- Remove `ev.deviceId` in favour of `ev.action.device.id`.
- Rename `onDidConnect` to `onConnected` within the UI.

### ⬆️ Upgrading

- For information on breaking changes, and migrating to the this version, read more about [upgrading to v1.0.0](/UPGRADE.md#v1-0-0).
- For information on breaking changes, and migrating to the this version, read more about [upgrading to v1.0.0](/UPGRADE.md#v1-0-0).

## 0.4.0-beta

### ✨ New

- Package can now be imported in both Node.js and the browser (in the scope of a property inspector).
- Add support for property inspector.
- Add `streamDeck.onDidConnect` event listener.
- Add `streamDeck.settings` namespace for interacting with settings.
- Add `streamDeck.system` namespace for system-related operations.
- Add `streamDeck.plugin` namespace for bi-direction communication with the plugin and the UI.
- Add `isInMultiAction` to the property inspector's action information.
- Package can now be imported in both Node.js and the browser (in the scope of a property inspector).
- Add support for property inspector.
- Add `streamDeck.onDidConnect` event listener.
- Add `streamDeck.settings` namespace for interacting with settings.
- Add `streamDeck.system` namespace for system-related operations.
- Add `streamDeck.plugin` namespace for bi-direction communication with the plugin and the UI.
- Add `isInMultiAction` to the property inspector's action info F438 rmation.

### 🐞 Fix

- `Coordinates` type could erroneously have a non-number type for `row`.
- Fix support for allowed types within payloads.
- Fix localization lookup to index from `Localization`.
- Fix race condition when tracking the property inspector.
- Fix `streamDeck.setGlobalSettings` to require settings that extend `JsonObject`.
- `Coordinates` type could erroneously have a non-number type for `row`.
- Fix support for allowed types within payloads.
- Fix localization lookup to index from `Localization`.
- Fix race condition when tracking the property inspector.
- Fix `streamDeck.setGlobalSettings` to require settings that extend `JsonObject`.

### ♻️ Update

- Update layout and manifest references to propagate from [`@elgato/schemas`](https://github.com/elgatosf/schemas).
- Localization lookup will now return the key if the resource is not defined.
- Update structure of JSON localizations.
- Update `State` type to allow for more than two states.
- Update routing to prevent exposure of internal messages.
- Update build to export Stream Deck API types.
- Update `ws` dependency.
- Update layout and manifest references to propagate from [`@elgato/schemas`](https://github.com/elgatosf/schemas).
- Localization lookup will now return the key if the resource is not defined.
- Update structure of JSON localizations.
- Update `State` type to allow for more than two states.
- Update routing to prevent exposure of internal messages.
- Update build to export Stream Deck API types.
- Update `ws` dependency.

### ⬆️ Upgrading

- For information on breaking changes, and migrating to the this version, read more about [upgrading to v0.4.0](/UPGRADE.md#v0-4-0).
- For information on breaking changes, and migrating to the this version, read more about [upgrading to v0.4.0](/UPGRADE.md#v0-4-0).

## 0.3.0

### ✨ New

- Add cross-compatible event emitter with type support.
- Add pattern validation for manifest's `Version`.
- Add validation of colors defined within the manifest.
- Add cross-compatible event emitter with type support.
- Add pattern validation for manifest's `Version`.
- Add validation of colors defined within the manifest.

### 🐞 Fix

- Fix `PayloadObject` not being exported; enables inheritance of actions.
- Fix manifest layout not allowing `$A0` as a pre-defined value.
- Fix `PayloadObject` not being exported; enables inheritance of actions.
- Fix manifest layout not allowing `$A0` as a pre-defined value.

### ♻️ Update

- Update manifest file path validation to prevent referencing a file outside of the plugin directory.
- Update manifest file path validation to allow periods.
- Update manifest UUID validation to allow more than 3 segments.
- Update manifest UUID validation to prevent underscores.
- Update documentation of `Actions[].Image` to reflect support for .gif files.
- Update default export to be named (improving VSCode intellisense).
- Update manifest file path validation to prevent referencing a file outside of the plugin directory.
- Update manifest file path validation to allow periods.
- Update manifest UUID validation to allow more than 3 segments.
- Update manifest UUID validation to prevent underscores.
- Update documentation of `Actions[].Image` to reflect support for .gif files.
- Update default export to be named (improving VSCode intellisense).

### 🗑️ Remove

- Remove `$A2` incorrectly being listed as a pre-defined layout.
- Remove `$A2` incorrectly being listed as a pre-defined layout.

## 0.2.0

### ✨ New

#### Stream Deck 6.5

- Add support for receiving messages via deep-linking.
- URL format: `streamdeck://plugins/message/<PLUGIN_UUID>/<MESSAGE>`
- Accessible as part of the `system` namespace, `streamDeck.system.onDidReceiveDeepLink`
- Add support for switching to a specific profile page when calling `switchToProfile`.
- Add `controller` information to `WillAppear` and `WillDisappear` events for multi-actions.
- Add support for Node.js plugins with the `.cjs` or `.mjs` file extensions.
- Add support for receiving messages via deep-linking.
- URL format: `streamdeck://plugins/message/<PLUGIN_UUID>/<MESSAGE>`
- Accessible as part of the `system` namespace, `streamDeck.system.onDidReceiveDeepLink`
- Add support for switching to a specific profile page when calling `switchToProfile`.
- Add `controller` information to `WillAppear` and `WillDisappear` events for multi-actions.
- Add support for Node.js plugins with the `.cjs` or `.mjs` file extensions.

#### Node.js SDK

- Add `profiles`, `settings`, `system`, and `ui` namespaces.
- Add `streamDeck.actions.createController(id)` to enable the control of a contextualized action.
- Add `streamDeck.devices.getDeviceBy(deviceId)` to enable the selection of a device by identifier.
- Add `length`, `forEach`, and `[Symbol.iterator]` to `streamDeck.devices` to enable iteration.
10000 - Add `profiles`, `settings`, `system`, and `ui` namespaces.
- Add `streamDeck.actions.createController(id)` to enable the control of a contextualized action.
- Add `streamDeck.devices.getDeviceBy(deviceId)` to enable the selection of a device by identifier.
- Add `length`, `forEach`, and `[Symbol.iterator]` to `streamDeck.devices` to enable iteration.

### ♻️ Improvements

- Refactor `streamDeck.devices` to namespace.
- Update manifest JSON schema to support Stream Deck 6.5.
- Improve enum support in manifest and layout JSON schemas.
- Node.js runtime updated to v20.8.1.
- Refactor `streamDeck.devices` to namespace.
- Update manifest JSON schema to support Stream Deck 6.5.
- Improve enum support in manifest and layout JSON schemas.
- Node.js runtime updated to v20.8.1.

### 🐞 Bug Fixes

- Correctly validate paths without extensions in manifest JSON schema.
- Default `text-overflow` set to `ellipsis` in layout JSON schema.
- Correctly validate paths without extensions in manifest JSON schema.
- Default `text-overflow` set to `ellipsis` in layout JSON schema.

### ⬆️ Upgrading

- For information on breaking changes, and migrating to the this version, read more about [upgrading to v0.2.0](/UPGRADE.md#v0-2-0).
- For information on breaking changes, and migrating to the this version, read more about [upgrading to v0.2.0](/UPGRADE.md#v0-2-0).

## 0.1.0

### ✨ New

- Add Stream Deck communication client (see `streamDeck.client`).
- Add support for receiving all events (Stream Deck 6.4).
- Add support for sending all commands (Stream Deck 6.4).
- Add action routing (see `streamDeck.actions`).
- Add centralized device information tracking (see `streamDeck.devices`).
- Add local file-based logging framework (see `streamDeck.logger`).
- Add localization support (see `streamDeck.i18n`).
- Add manifest information (see `streamDeck.manifest`).
- Add Stream Deck and plugin information (see `streamDeck.info`).
- Add Stream Deck communication client (see `streamDeck.client`).
- Add support for receiving all events (Stream Deck 6.4).
- Add support for sending all commands (Stream Deck 6.4).
- Add action routing (see `streamDeck.actions`).
- Add centralized device information tracking (see `streamDeck.devices`).
- Add local file-based logging framework (see `streamDeck.logger`).
- Add localization support (see `streamDeck.i18n`).
- Add manifest information (see `streamDeck.manifest`).
- Add Stream Deck and plugin information (see `streamDeck.info`).
14 changes: 2 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@
"./dist/*.d.ts",
"./types/**/*d.ts"
],
"exports": {
".": {
"browser": {
"default": "./dist/browser.js",
"types": "./dist/browser.d.ts"
},
"default": {
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
}
}
},
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "rm -rf ./dist && rollup --config rollup.config.mjs && npm run types",
"watch": "rollup --config rollup.config.mjs --watch --watch. run types\"",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function defineConfig(input, output) {
external: ["ws", "@elgato/schemas/streamdeck/plugins"],
plugins: [
typescript({
tsconfig: join("src", dirname(input), "tsconfig.build.json"),
tsconfig: "tsconfig.build.json",
mapRoot: isWatching ? "./" : undefined,
}),
nodeResolve(),
Expand All @@ -58,4 +58,4 @@ export default streamDeck;
/**
* Rollup configuration.
*/
export default [defineConfig("plugin/index.ts", "index.js"), defineConfig("ui/index.ts", "browser.js")];
export default [defineConfig("plugin/index.ts", "index.js")];
23 changes: 1 addition & 22 deletions src/api/command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { JsonObject, JsonValue } from "../plugin";
import type { ActionIdentifier, DidReceiveGlobalSettings, DidReceiveSettings, State } from "./events";
import type { DidReceiveGlobalSettings, DidReceiveSettings, State } from "./events";
import type { FeedbackPayload } from "./layout";
import type { Target } from "./target";

Expand Down Expand Up @@ -48,21 +48,11 @@ type ContextualizedCommandWithPayload<TCommand, TPayload> = ContextualizedComman
*/
export type SetSettings = ContextualizedCommandWithPayload<"setSettings", JsonObject>;

/**
* Sets the settings associated with an instance of an action.
*/
export type UISetSettings = ActionIdentifier & SetSettings;

/**
* Gets the settings associated with an instance of an action. Causes {@link DidReceiveSettings} to be emitted.
*/
export type GetSettings = ContextualizedCommand<"getSettings">;

/**
* Gets the settings associated with an instance of an action. Causes {@link DidReceiveSettings} to be emitted.
*/
export type UIGetSettings = ActionIdentifier & GetSettings;

/**
* Sets the global settings associated with the plugin.
*/
Expand Down Expand Up @@ -254,12 +244,6 @@ export type SendToPropertyInspector<TPayload extends JsonValue = JsonValue> = Co
TPayload
>;

/**
* Sends a message to the plugin.
*/
export type SendToPlugin<TPayload extends JsonValue = JsonValue> = ActionIdentifier &
CommandBaseWithPayload<"sendToPlugin", TPayload>;

/**
* Command sent to Stream Deck, from the plugin.
*/
Expand All @@ -281,8 +265,3 @@ export type PluginCommand =
| ShowAlert
| ShowOk
| SwitchToProfile;

/**
* Command sent to Stream Deck, from the property inspector.
*/
export type UICommand = GetGlobalSettings | OpenUrl | SendToPlugin | SetGlobalSettings | UIGetSettings | UISetSettings;
Loading
0