From 495807fa68f826cad2259368e25c5c1067841de0 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Mon, 5 Jan 2026 14:49:47 -0800 Subject: [PATCH 1/3] Fan out types, update variable type --- src/types.ts | 177 +++++++++++++++++++++++++-------------------------- 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/src/types.ts b/src/types.ts index 8548e29..d35814b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -39,7 +39,7 @@ export interface PluginStyle { */ export interface WorkbookVariable { name: string; - defaultValue: { type: string }; + defaultValue: { type: string; value: any }; } export type WorkbookSelection = Record; @@ -90,6 +90,80 @@ export interface WorkbookElementColumns { */ export type Unsubscriber = () => void; +export interface CustomPluginConfigOptionBase { + name: string; + label?: string; +} +export interface CustomPluginConfigGroup extends CustomPluginConfigOptionBase { + type: 'group'; +} +export interface CustomPluginConfigElement + extends CustomPluginConfigOptionBase { + type: 'element'; +} +export interface CustomPluginConfigColumn extends CustomPluginConfigOptionBase { + type: 'column'; + allowedTypes?: ValueType[]; + source: string; + allowMultiple: boolean; +} +export interface CustomPluginConfigText extends CustomPluginConfigOptionBase { + type: 'text'; + source?: string; // can point to a group or element config + // if true will omit from prehydrated configs passed through querystring + secure?: boolean; + multiline?: boolean; + placeholder?: string; + defaultValue?: string; +} +export interface CustomPluginConfigToggle extends CustomPluginConfigOptionBase { + type: 'toggle'; + source?: string; + defaultValue?: number; +} +export interface CustomPluginConfigCheckbox + extends CustomPluginConfigOptionBase { + type: 'checkbox'; + source?: string; + defaultValue?: number; +} +export interface CustomPluginConfigRadio extends CustomPluginConfigOptionBase { + type: 'radio'; + source?: string; + singleLine?: boolean; + values: string[]; + defaultValue?: string; +} +export interface CustomPluginConfigDropdown + extends CustomPluginConfigOptionBase { + type: 'dropdown'; + source?: string; + width?: string; + values: string[]; + defaultValue?: string; +} +export interface CustomPluginConfigColor extends CustomPluginConfigOptionBase { + type: 'color'; + source?: string; +} +export interface CustomPluginConfigVariable + extends CustomPluginConfigOptionBase { + type: 'variable'; + allowedTypes?: ControlType[]; +} +export interface CustomPluginConfigInteraction + extends CustomPluginConfigOptionBase { + type: 'interaction'; +} +export interface CustomPluginConfigActionTrigger + extends CustomPluginConfigOptionBase { + type: 'action-trigger'; +} +export interface CustomPluginConfigActionEffect + extends CustomPluginConfigOptionBase { + type: 'action-effect'; +} + /** * Different types Plugin Config Options * @typedef {object} CustomPluginConfigOptions @@ -98,94 +172,19 @@ export type Unsubscriber = () => void; * @property {(string | undefined)} label Displayed label for config option */ export type CustomPluginConfigOptions = - | { - type: 'group'; - name: string; - label?: string; - } - | { - type: 'element'; - name: string; - label?: string; - } - | { - type: 'column'; - name: string; - label?: string; - allowedTypes?: ValueType[]; - source: string; - allowMultiple: boolean; - } - | { - type: 'text'; - name: string; - label?: string; - source?: string; // can point to a group or element config - // if true will omit from prehydrated configs passed through querystring - secure?: boolean; - multiline?: boolean; - placeholder?: string; - defaultValue?: string; - } - | { - type: 'toggle'; - name: string; - label?: string; - source?: string; - defaultValue?: boolean; - } - | { - type: 'checkbox'; - name: string; - label?: string; - source?: string; - defaultValue?: boolean; - } - | { - type: 'radio'; - name: string; - label?: string; - source?: string; - values: string[]; - singleLine?: boolean; - defaultValue?: string; - } - | { - type: 'dropdown'; - name: string; - label?: string; - source?: string; - width?: string; - values: string[]; - defaultValue?: string; - } - | { - type: 'color'; - name: string; - label?: string; - source?: string; - } - | { - type: 'variable'; - name: string; - label?: string; - allowedTypes?: ControlType[]; - } - | { - type: 'interaction'; - name: string; - label?: string; - } - | { - type: 'action-trigger'; - name: string; - label?: string; - } - | { - type: 'action-effect'; - name: string; - label?: string; - }; + | CustomPluginConfigGroup + | CustomPluginConfigElement + | CustomPluginConfigColumn + | CustomPluginConfigText + | CustomPluginConfigToggle + | CustomPluginConfigCheckbox + | CustomPluginConfigRadio + | CustomPluginConfigDropdown + | CustomPluginConfigColor + | CustomPluginConfigVariable + | CustomPluginConfigInteraction + | CustomPluginConfigActionTrigger + | CustomPluginConfigActionEffect; /** * @typedef {object} PluginInstance From ffaec9399442b6bd0d07b4d20e71e1da60330d05 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Thu, 29 Jan 2026 15:17:27 -0800 Subject: [PATCH 2/3] almost --- src/types.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index 58da228..c5f8515 100644 --- a/src/types.ts +++ b/src/types.ts @@ -173,8 +173,7 @@ export interface CustomPluginConfigActionEffect } export interface CustomPluginConfigUrlParameter extends Omit { - type: 'url-parameter', - name: string + type: 'url-parameter'; } /** From ca55934e9f0155c878c3498e8e14e3e779df443e Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Thu, 29 Jan 2026 15:23:18 -0800 Subject: [PATCH 3/3] type issue --- src/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index c5f8515..c8e9cc5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -127,13 +127,13 @@ export interface CustomPluginConfigText extends CustomPluginConfigOptionBase { export interface CustomPluginConfigToggle extends CustomPluginConfigOptionBase { type: 'toggle'; source?: string; - defaultValue?: number; + defaultValue?: boolean; } export interface CustomPluginConfigCheckbox extends CustomPluginConfigOptionBase { type: 'checkbox'; source?: string; - defaultValue?: number; + defaultValue?: boolean; } export interface CustomPluginConfigRadio extends CustomPluginConfigOptionBase { type: 'radio';