Skip to content

Commit 869399c

Browse files
authored
Merge pull request #71 from ClayPulse/add-canvas
Add workflow states management hook
2 parents d5eb394 + 3441580 commit 869399c

35 files changed

+803
-475
lines changed

.changeset/fuzzy-sheep-pay.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Make action return type any

.changeset/pre.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"free-ears-swim",
3333
"fruity-goats-look",
3434
"full-beans-stop",
35+
"fuzzy-sheep-pay",
3536
"hot-symbols-fry",
3637
"hot-windows-march",
3738
"large-moose-tap",
@@ -56,6 +57,7 @@
5657
"tough-aliens-appear",
5758
"true-suits-fly",
5859
"vast-places-rhyme",
60+
"weak-beers-watch",
5961
"wicked-spoons-fry"
6062
]
6163
}

.changeset/weak-beers-watch.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Update action register hook

npm-packages/react-api/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# @pulse-editor/react-api
22

3+
## 0.1.1-alpha.45
4+
5+
### Patch Changes
6+
7+
- Make action return type any
8+
- Updated dependencies
9+
- @pulse-editor/shared-utils@0.1.1-alpha.45
10+
11+
## 0.1.1-alpha.44
12+
13+
### Patch Changes
14+
15+
- Update action register hook
16+
- Updated dependencies
17+
- @pulse-editor/shared-utils@0.1.1-alpha.44
18+
319
## 0.1.1-alpha.43
420

521
### Patch Changes

npm-packages/react-api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pulse-editor/react-api",
3-
"version": "0.1.1-alpha.43",
3+
"version": "0.1.1-alpha.45",
44
"main": "dist/main.js",
55
"files": [
66
"dist"
@@ -38,7 +38,7 @@
3838
"typescript-eslint": "^8.30.1"
3939
},
4040
"peerDependencies": {
41-
"@pulse-editor/shared-utils": "0.1.1-alpha.43",
41+
"@pulse-editor/shared-utils": "0.1.1-alpha.45",
4242
"react": "^19.0.0",
4343
"react-dom": "^19.0.0"
4444
}

npm-packages/react-api/src/hooks/editor/use-register-action.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
ReceiverHandler,
66
TypedVariable,
77
} from "@pulse-editor/shared-utils";
8-
import { useEffect, useRef, useState } from "react";
8+
import { DependencyList, useEffect, useRef, useState } from "react";
99
import useIMC from "../../lib/use-imc";
1010

1111
/**
@@ -17,7 +17,8 @@ import useIMC from "../../lib/use-imc";
1717
* @param parameters Parameters of the command.
1818
* @param returns Return values of the command.
1919
* @param callbackHandler Callback handler function to handle the command.
20-
* @param isExtReady Whether the extension is ready to receive commands.
20+
* @param deps Dependency list to re-register the action when changed.
21+
* @param isExtReady Whether the extension is ready to receive commands.
2122
* Useful for actions that need to wait for some certain app state to be ready.
2223
*
2324
*/
@@ -28,7 +29,8 @@ export default function useRegisterAction(
2829
parameters?: Record<string, TypedVariable>;
2930
returns?: Record<string, TypedVariable>;
3031
},
31-
callbackHandler?: (args: any) => Promise<string | void>,
32+
callbackHandler: (args: any) => Promise<any>,
33+
deps: DependencyList,
3234
isExtReady: boolean = true
3335
) {
3436
const { isReady, imc } = useIMC(getReceiverHandlerMap());
@@ -85,8 +87,9 @@ export default function useRegisterAction(
8587
description: actionInfo.description,
8688
parameters: actionInfo.parameters ?? {},
8789
returns: actionInfo.returns ?? {},
90+
handler: callbackHandler,
8891
}));
89-
}, [callbackHandler]);
92+
}, [...deps]);
9093

9194
async function executeAction(args: any) {
9295
if (!action.handler) return;

npm-packages/shared-utils/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @pulse-editor/shared-utils
22

3+
## 0.1.1-alpha.45
4+
5+
### Patch Changes
6+
7+
- Make action return type any
8+
9+
## 0.1.1-alpha.44
10+
11+
### Patch Changes
12+
13+
- Update action register hook
14+
315
## 0.1.1-alpha.43
416

517
### Patch Changes

npm-packages/shared-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pulse-editor/shared-utils",
3-
"version": "0.1.1-alpha.43",
3+
"version": "0.1.1-alpha.45",
44
"main": "dist/main.js",
55
"files": [
66
"dist"

npm-packages/shared-utils/src/imc/inter-module-communication.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ export class InterModuleCommunication {
7272
}
7373

7474
const message = event.data;
75-
if (
76-
process.env.NODE_ENV === "development" &&
77-
message.from !== undefined
78-
) {
75+
if (message.from !== undefined) {
7976
console.log(
8077
`Module ${this.thisWindowId} received message from module ${
8178
message.from

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)