From da61524505b010c84823caf2b4777ed49bc06353 Mon Sep 17 00:00:00 2001 From: Pai Lee Wai Date: Sat, 4 Feb 2023 18:08:28 +0800 Subject: [PATCH] chore: update dev packages and formatting --- index.tsx | 56 +- package.json | 2 +- yarn.lock | 7197 +++++++++++++++++++++----------------------------- 3 files changed, 2984 insertions(+), 4271 deletions(-) diff --git a/index.tsx b/index.tsx index 55782ea..ebb99f0 100644 --- a/index.tsx +++ b/index.tsx @@ -34,6 +34,9 @@ type ActionState = { }; type Events = { actionDispatched: ActionState; actionInit: ActionState }; +type Methods = { + dispatchAction(params: { type: string; payload: any }): Promise; +}; const columns = [ { @@ -65,7 +68,7 @@ function createRows(actions: ActionState[]): Record[] { }); } -export function plugin(client: PluginClient) { +export function plugin(client: PluginClient) { const selectedID = createState(null, { persist: "selection" }); const actions = createState([], { persist: "actions" }); const actionType = createState(); @@ -105,11 +108,14 @@ export function plugin(client: PluginClient) { async function sendDispatchMessage() { if (client.isConnected) { try { - const payloadStringValue = actionPayloadString.get(); - const actionTypeValue = actionType.get(); + const payloadStringValue = actionPayloadString.get() ?? ""; + const actionTypeValue = actionType.get() ?? ""; let actionPayload; try { - actionPayload = payloadStringValue.trim() == "" ? [] : JSON.parse(payloadStringValue); + actionPayload = + payloadStringValue.trim() == "" + ? [] + : JSON.parse(payloadStringValue); } catch (e) { // can happen when we try to parse a string input message.error("Invalid JSON format in the payload"); @@ -143,8 +149,8 @@ export function plugin(client: PluginClient) { const Container = styled.div({ // Styling DataInspector's 'added' objects '& div[class*="-Added"]': { - backgroundColor: '#deffdd', - '@media (prefers-color-scheme: dark)': { + backgroundColor: "#deffdd", + "@media (prefers-color-scheme: dark)": { backgroundColor: theme.semanticColors.diffAddedBackground, }, }, @@ -163,8 +169,16 @@ export function Component() { return ( <> - -