Skip to content

Commit d40864d

Browse files
committed
cleanup
1 parent a32953b commit d40864d

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

src/client/initialize.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ export function initialize<T = {}>(): PluginInstance<T> {
3737
emit('config', pluginConfig.config ?? {});
3838
});
3939

40-
on('wb:plugin:style:update', (style: any) => {
41-
emit('style', style);
42-
});
43-
4440
// send initialize event
4541
void execPromise(
4642
'wb:plugin:init',
@@ -230,8 +226,8 @@ export function initialize<T = {}>(): PluginInstance<T> {
230226

231227
style: {
232228
subscribeToStyle(callback: (style: any) => void) {
233-
on('style', callback);
234-
return () => off('style', callback);
229+
on('wb:plugin:style:update', callback);
230+
return () => off('wb:plugin:style:update', callback);
235231
},
236232

237233
getStyle() {

src/react/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export function useActionEffect(configId: string, effect: () => void) {
249249
}
250250

251251
/**
252-
* React hook for accessing plugin style with live updates via PostMessage
252+
* React hook for accessing plugin style with live updates
253253
* @returns {PluginStyle | undefined} Style properties from the workbook if available
254254
*/
255255
export function usePluginStyle(): PluginStyle | undefined {

src/types.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ export type ScalarType = 'boolean' | 'datetime' | 'number' | 'integer' | 'text';
22
export type PrimitiveType = ScalarType | 'variant' | 'link';
33
export type ValueType = PrimitiveType | 'error';
44

5-
/**
6-
* Style properties that can be configured through the plugin format panel
7-
*/
8-
export interface PluginStyle {
9-
backgroundColor?: string;
10-
}
11-
125
/**
136
* All mutable workbook control variable types
147
*/
@@ -30,14 +23,14 @@ export interface PluginConfig<T> {
3023
[key: string]: any;
3124
}
3225

33-
// /**
34-
// * Style colors available to plugins
35-
// * @typedef {object} PluginStyle
36-
// * @property {string} backgroundColor Background color set from workbook
37-
// */
38-
// export interface PluginStyle {
39-
// backgroundColor: string;
40-
// }
26+
/**
27+
* Style colors available to plugins
28+
* @typedef {object} PluginStyle
29+
* @property {string} backgroundColor Background color set from workbook if any
30+
*/
31+
export interface PluginStyle {
32+
backgroundColor?: string;
33+
}
4134

4235
/**
4336
* @typedef {object} WorkbookVariable

0 commit comments

Comments
 (0)