@sigmacomputing/plugin 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +0 -14
  2. package/LICENSE +1 -1
  3. package/README.md +19 -24
  4. package/dist/cjs/index.cjs +506 -0
  5. package/dist/cjs/index.cjs.map +1 -0
  6. package/dist/cjs/index.d.cts +438 -0
  7. package/dist/esm/index.d.ts +438 -0
  8. package/dist/esm/index.js +466 -0
  9. package/dist/esm/index.js.map +1 -0
  10. package/dist/umd/sigmacomputing-plugin.umd.js +2 -0
  11. package/dist/umd/sigmacomputing-plugin.umd.js.map +1 -0
  12. package/package.json +69 -36
  13. package/src/client/initialize.ts +280 -0
  14. package/src/client.ts +3 -0
  15. package/src/globals.d.ts +2 -0
  16. package/{dist/index.d.ts → src/index.ts} +1 -1
  17. package/src/react/Context.ts +6 -0
  18. package/src/react/Provider.tsx +20 -0
  19. package/src/react/hooks.ts +298 -0
  20. package/src/react.ts +3 -0
  21. package/src/types.ts +412 -0
  22. package/src/utils/deepEqual.ts +23 -0
  23. package/src/utils/error.ts +10 -0
  24. package/src/utils/polyfillRequestAnimationFrame.ts +13 -0
  25. package/dist/client/initialize.d.ts +0 -3
  26. package/dist/client/initialize.d.ts.map +0 -1
  27. package/dist/client/initialize.js +0 -223
  28. package/dist/client.d.ts +0 -2
  29. package/dist/client.d.ts.map +0 -1
  30. package/dist/client.js +0 -5
  31. package/dist/error.d.ts +0 -3
  32. package/dist/error.d.ts.map +0 -1
  33. package/dist/error.js +0 -9
  34. package/dist/index.d.ts.map +0 -1
  35. package/dist/index.js +0 -22
  36. package/dist/react/Context.d.ts +0 -4
  37. package/dist/react/Context.d.ts.map +0 -1
  38. package/dist/react/Context.js +0 -6
  39. package/dist/react/Provider.d.ts +0 -8
  40. package/dist/react/Provider.d.ts.map +0 -1
  41. package/dist/react/Provider.js +0 -9
  42. package/dist/react/hooks.d.ts +0 -83
  43. package/dist/react/hooks.d.ts.map +0 -1
  44. package/dist/react/hooks.js +0 -231
  45. package/dist/react.d.ts +0 -3
  46. package/dist/react.d.ts.map +0 -1
  47. package/dist/react.js +0 -20
  48. package/dist/types.d.ts +0 -332
  49. package/dist/types.d.ts.map +0 -1
  50. package/dist/types.js +0 -2
  51. package/dist/utils/deepEqual.d.ts +0 -2
  52. package/dist/utils/deepEqual.d.ts.map +0 -1
  53. package/dist/utils/deepEqual.js +0 -28
  54. package/dist/utils/polyfillRequestAnimationFrame.d.ts +0 -8
  55. package/dist/utils/polyfillRequestAnimationFrame.d.ts.map +0 -1
  56. package/dist/utils/polyfillRequestAnimationFrame.js +0 -16
@@ -1,231 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePluginStyle = exports.useActionEffect = exports.useActionTrigger = exports.useInteraction = exports.useUrlParameter = exports.useVariable = exports.useConfig = exports.usePaginatedElementData = exports.useElementData = exports.useElementColumns = exports.useLoadingState = exports.useEditorPanelConfig = exports.usePlugin = void 0;
4
- const react_1 = require("react");
5
- const Context_1 = require("./Context");
6
- const deepEqual_1 = require("../utils/deepEqual");
7
- /**
8
- * Gets the entire plugin instance
9
- * @returns {PluginInstance} Context for the current plugin instance
10
- */
11
- function usePlugin() {
12
- return (0, react_1.useContext)(Context_1.PluginContext);
13
- }
14
- exports.usePlugin = usePlugin;
15
- /**
16
- * Provides a setter for the Plugin's Config Options
17
- * @param {CustomPluginConfigOptions[]} nextOptions Updated possible Config Options
18
- */
19
- function useEditorPanelConfig(nextOptions) {
20
- const client = usePlugin();
21
- const optionsRef = (0, react_1.useRef)({});
22
- (0, react_1.useEffect)(() => {
23
- if (nextOptions == null)
24
- return;
25
- if (!(0, deepEqual_1.deepEqual)(nextOptions, optionsRef.current)) {
26
- client.config.configureEditorPanel(nextOptions);
27
- optionsRef.current = nextOptions;
28
- }
29
- }, [client, nextOptions]);
30
- }
31
- exports.useEditorPanelConfig = useEditorPanelConfig;
32
- /**
33
- * React hook for Plugin Config loading state
34
- * @param {boolean} initialState Initial value to set loading state to
35
- * @returns {[boolean, Function]} Boolean value corresponding to loading state for plugin config and setter for loading state
36
- */
37
- function useLoadingState(initialState) {
38
- const client = usePlugin();
39
- const [loading, setLoading] = (0, react_1.useState)(() => {
40
- client.config.setLoadingState(initialState);
41
- return initialState;
42
- });
43
- return [
44
- loading,
45
- nextState => {
46
- if (nextState === loading)
47
- return;
48
- setLoading(nextState);
49
- client.config.setLoadingState(nextState);
50
- },
51
- ];
52
- }
53
- exports.useLoadingState = useLoadingState;
54
- /**
55
- * Provides the latest column values from corresponding config element
56
- * @param {string} configId ID from the config for fetching element columns, with type: 'element'
57
- * @returns {WorkbookElementColumns} Values of corresponding columns contained
58
- * within the config element
59
- */
60
- function useElementColumns(configId) {
61
- const client = usePlugin();
62
- const [columns, setColumns] = (0, react_1.useState)({});
63
- (0, react_1.useEffect)(() => {
64
- if (configId) {
65
- return client.elements.subscribeToElementColumns(configId, setColumns);
66
- }
67
- }, [client, configId]);
68
- return columns;
69
- }
70
- exports.useElementColumns = useElementColumns;
71
- /**
72
- * Provides the latest data values from config element (max 25_000)
73
- * @param {string} configId ID from the config for fetching element data, with type: 'element'
74
- * @returns {WorkbookElementData} Element Data for config element, if any
75
- */
76
- function useElementData(configId) {
77
- const client = usePlugin();
78
- const [data, setData] = (0, react_1.useState)({});
79
- (0, react_1.useEffect)(() => {
80
- if (configId) {
81
- return client.elements.subscribeToElementData(configId, setData);
82
- }
83
- }, [client, configId]);
84
- return data;
85
- }
86
- exports.useElementData = useElementData;
87
- /**
88
- * Provides the latest data values from corresponding config element with a callback to
89
- * fetch more in chunks of 25_000 data points
90
- * @param {string} configId ID from the config for fetching paginated
91
- * element data, with type: 'element'
92
- * @returns {WorkbookElementData} Element Data for configured config element, if any
93
- */
94
- function usePaginatedElementData(configId) {
95
- const client = usePlugin();
96
- const [data, setData] = (0, react_1.useState)({});
97
- const loadMore = (0, react_1.useCallback)(() => {
98
- if (configId) {
99
- client.elements.fetchMoreElementData(configId);
100
- }
101
- }, [configId]);
102
- (0, react_1.useEffect)(() => {
103
- if (configId) {
104
- return client.elements.subscribeToElementData(configId, setData);
105
- }
106
- }, [client, configId]);
107
- return [data, loadMore];
108
- }
109
- exports.usePaginatedElementData = usePaginatedElementData;
110
- /**
111
- * Provides the latest value for entire config or certain key within the config
112
- * @param {string} key Key within Plugin Config, optional
113
- * @returns Entire config if no key passed in or value for key within plugin config
114
- */
115
- function useConfig(key) {
116
- const client = usePlugin();
117
- const [config, setConfig] = (0, react_1.useState)(key != null ? client.config.getKey(key) : client.config.get());
118
- (0, react_1.useEffect)(() => client.config.subscribe(newConfig => {
119
- if (key != null && newConfig[key] !== config[key]) {
120
- setConfig(newConfig[key]);
121
- }
122
- else {
123
- setConfig(newConfig);
124
- }
125
- }), [client]);
126
- return config;
127
- }
128
- exports.useConfig = useConfig;
129
- /**
130
- * React hook for accessing a workbook control variable
131
- * @param {string} id ID from the config of type: 'variable'
132
- * @returns {[(WorkbookVariable | undefined), Function]} Constantly updating
133
- * value of the control variable and setter for the variable
134
- */
135
- function useVariable(id) {
136
- const client = usePlugin();
137
- const [workbookVariable, setWorkbookVariable] = (0, react_1.useState)();
138
- const isFirstRender = (0, react_1.useRef)(true);
139
- (0, react_1.useEffect)(() => {
140
- if (isFirstRender.current) {
141
- setWorkbookVariable(client.config.getVariable(id));
142
- isFirstRender.current = false;
143
- }
144
- return client.config.subscribeToWorkbookVariable(id, setWorkbookVariable);
145
- }, [client, id]);
146
- const setVariable = (0, react_1.useCallback)((...values) => client.config.setVariable(id, ...values), [id]);
147
- return [workbookVariable, setVariable];
148
- }
149
- exports.useVariable = useVariable;
150
- /**
151
- * React hook for accessing a url parameter
152
- * @param {string} id ID from the config of type: 'url-parameter'
153
- * @returns {[(UrlParameter | undefined), Function]} Constantly updating value of the url parameter and setter for the url parameter
154
- */
155
- function useUrlParameter(id) {
156
- const client = usePlugin();
157
- const [urlParameter, setUrlParameter] = (0, react_1.useState)();
158
- const isFirstRender = (0, react_1.useRef)(true);
159
- (0, react_1.useEffect)(() => {
160
- if (isFirstRender.current) {
161
- setUrlParameter(client.config.getUrlParameter(id));
162
- isFirstRender.current = false;
163
- }
164
- return client.config.subscribeToUrlParameter(id, setUrlParameter);
165
- }, [client, id]);
166
- const setter = (0, react_1.useCallback)((value) => client.config.setUrlParameter(id, value), [client, id]);
167
- return [urlParameter, setter];
168
- }
169
- exports.useUrlParameter = useUrlParameter;
170
- /**
171
- * @deprecated Use Action API instead
172
- * React hook for accessing a workbook interaction selections state
173
- * @param {string} id ID from the config of type: 'interaction'
174
- * @returns {[(WorkbookSelection | undefined), Function]} Constantly updating selection state and setter thereof
175
- */
176
- function useInteraction(id, elementId) {
177
- const client = usePlugin();
178
- const [workbookInteraction, setWorkbookInteraction] = (0, react_1.useState)();
179
- (0, react_1.useEffect)(() => {
180
- return client.config.subscribeToWorkbookInteraction(id, setWorkbookInteraction);
181
- }, [client, id]);
182
- const setInteraction = (0, react_1.useCallback)((value) => {
183
- client.config.setInteraction(id, elementId, value);
184
- }, [id]);
185
- return [workbookInteraction, setInteraction];
186
- }
187
- exports.useInteraction = useInteraction;
188
- /**
189
- * React hook for returning a triggering callback function for the registered
190
- * action trigger
191
- * @param {string} configId ID from the config of type: 'action-trigger'
192
- * @returns {Function} A callback function to trigger the action
193
- */
194
- function useActionTrigger(configId) {
195
- const client = usePlugin();
196
- return (0, react_1.useCallback)(() => {
197
- client.config.triggerAction(configId);
198
- }, [client, configId]);
199
- }
200
- exports.useActionTrigger = useActionTrigger;
201
- /**
202
- * React hook for registering and unregistering an action effect
203
- * @param {string} configId ID from the config of type: 'action-effect'
204
- * @param {Function} effect The function to be called when the action is triggered
205
- */
206
- function useActionEffect(configId, effect) {
207
- const client = usePlugin();
208
- const effectRef = (0, react_1.useRef)(effect);
209
- (0, react_1.useEffect)(() => {
210
- effectRef.current = effect;
211
- });
212
- (0, react_1.useEffect)(() => {
213
- return client.config.registerEffect(configId, effectRef.current);
214
- }, [client, configId, effect]);
215
- }
216
- exports.useActionEffect = useActionEffect;
217
- /**
218
- * React hook for accessing plugin style with live updates
219
- * @returns {PluginStyle | undefined} Style properties from the workbook if available
220
- */
221
- function usePluginStyle() {
222
- const client = usePlugin();
223
- const [style, setStyle] = (0, react_1.useState)();
224
- (0, react_1.useEffect)(() => {
225
- // Request initial style data on mount and subscribe to updates
226
- void client.style.get().then(response => setStyle(response));
227
- return client.style.subscribe(setStyle);
228
- }, [client]);
229
- return style;
230
- }
231
- exports.usePluginStyle = usePluginStyle;
package/dist/react.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './react/hooks';
2
- export { SigmaClientProviderProps, SigmaClientProvider, } from './react/Provider';
3
- //# sourceMappingURL=react.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
package/dist/react.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SigmaClientProvider = void 0;
18
- __exportStar(require("./react/hooks"), exports);
19
- var Provider_1 = require("./react/Provider");
20
- Object.defineProperty(exports, "SigmaClientProvider", { enumerable: true, get: function () { return Provider_1.SigmaClientProvider; } });
package/dist/types.d.ts DELETED
@@ -1,332 +0,0 @@
1
- export declare type ScalarType = 'boolean' | 'datetime' | 'number' | 'integer' | 'text';
2
- export declare type PrimitiveType = ScalarType | 'variant' | 'link';
3
- export declare type ValueType = PrimitiveType | 'error';
4
- /**
5
- * All mutable workbook control variable types
6
- */
7
- export declare type ControlType = 'boolean' | 'date' | 'number' | 'text' | 'text-list' | 'number-list' | 'date-list' | 'number-range' | 'date-range';
8
- export interface PluginConfig<T> {
9
- id: string;
10
- config: T;
11
- screenshot: boolean;
12
- [key: string]: any;
13
- }
14
- /**
15
- * Style colors available to plugins
16
- * @typedef {object} PluginStyle
17
- * @property {string} backgroundColor Background color set from workbook if any
18
- */
19
- export interface PluginStyle {
20
- backgroundColor: string;
21
- }
22
- /**
23
- * @typedef {object} WorkbookVariable
24
- * @property {string} name Name of control variable within workbook
25
- * @property {{string}} defaultValue Current value containing at least type as string
26
- */
27
- export interface WorkbookVariable {
28
- name: string;
29
- defaultValue: {
30
- type: string;
31
- value: any;
32
- };
33
- }
34
- /**
35
- * @typedef {object} UrlParameter
36
- * @property {string} value Current url value
37
- */
38
- export interface UrlParameter {
39
- value: string;
40
- }
41
- export declare type WorkbookSelection = Record<string, {
42
- type: string;
43
- val?: unknown;
44
- }>;
45
- export declare type PluginMessageResponse = MessageEvent<{
46
- type: string;
47
- result: any[];
48
- error: any;
49
- }>;
50
- export interface WbElement {
51
- id: string;
52
- }
53
- /**
54
- * @typedef {object} WorkbookElementData
55
- * @property {Object<string, any>} data Workbook data sorted by column ID
56
- */
57
- export interface WorkbookElementData {
58
- [colId: string]: any[];
59
- }
60
- /**
61
- * Column data
62
- * @typedef {object} WorkbookElementColumn
63
- * @property {string} id Column ID
64
- * @property {string} name Column Name
65
- * @property {string} columnType Type of data contained within column
66
- */
67
- export interface WorkbookElementColumn {
68
- id: string;
69
- name: string;
70
- columnType: ValueType;
71
- }
72
- /**
73
- * Record of Column data with corresponding IDs
74
- * @typedef {object} WorkbookElementColumns
75
- * @property {Object<string, WorkbookElementColumn>} column Column ID and corresponding column data
76
- */
77
- export interface WorkbookElementColumns {
78
- [colId: string]: WorkbookElementColumn;
79
- }
80
- /**
81
- * Function to Unsubscribe from the corresponding elements
82
- * @typedef {() => void} Unsubscriber
83
- */
84
- export declare type Unsubscriber = () => void;
85
- export interface CustomPluginConfigOptionBase {
86
- name: string;
87
- label?: string;
88
- }
89
- export interface CustomPluginConfigGroup extends CustomPluginConfigOptionBase {
90
- type: 'group';
91
- }
92
- export interface CustomPluginConfigElement extends CustomPluginConfigOptionBase {
93
- type: 'element';
94
- }
95
- export interface CustomPluginConfigColumn extends CustomPluginConfigOptionBase {
96
- type: 'column';
97
- allowedTypes?: ValueType[];
98
- source: string;
99
- allowMultiple: boolean;
100
- }
101
- export interface CustomPluginConfigText extends CustomPluginConfigOptionBase {
102
- type: 'text';
103
- source?: string;
104
- secure?: boolean;
105
- multiline?: boolean;
106
- placeholder?: string;
107
- defaultValue?: string;
108
- }
109
- export interface CustomPluginConfigToggle extends CustomPluginConfigOptionBase {
110
- type: 'toggle';
111
- source?: string;
112
- defaultValue?: boolean;
113
- }
114
- export interface CustomPluginConfigCheckbox extends CustomPluginConfigOptionBase {
115
- type: 'checkbox';
116
- source?: string;
117
- defaultValue?: boolean;
118
- }
119
- export interface CustomPluginConfigRadio extends CustomPluginConfigOptionBase {
120
- type: 'radio';
121
- source?: string;
122
- singleLine?: boolean;
123
- values: string[];
124
- defaultValue?: string;
125
- }
126
- export interface CustomPluginConfigDropdown extends CustomPluginConfigOptionBase {
127
- type: 'dropdown';
128
- source?: string;
129
- width?: string;
130
- values: string[];
131
- defaultValue?: string;
132
- }
133
- export interface CustomPluginConfigColor extends CustomPluginConfigOptionBase {
134
- type: 'color';
135
- source?: string;
136
- }
137
- export interface CustomPluginConfigVariable extends CustomPluginConfigOptionBase {
138
- type: 'variable';
139
- allowedTypes?: ControlType[];
140
- }
141
- export interface CustomPluginConfigInteraction extends CustomPluginConfigOptionBase {
142
- type: 'interaction';
143
- }
144
- export interface CustomPluginConfigActionTrigger extends CustomPluginConfigOptionBase {
145
- type: 'action-trigger';
146
- }
147
- export interface CustomPluginConfigActionEffect extends CustomPluginConfigOptionBase {
148
- type: 'action-effect';
149
- }
150
- export interface CustomPluginConfigUrlParameter extends Omit<CustomPluginConfigOptionBase, 'label'> {
151
- type: 'url-parameter';
152
- }
153
- /**
154
- * Different types Plugin Config Options
155
- * @typedef {object} CustomPluginConfigOptions
156
- * @property {string} type Type of config option
157
- * @property {string} name Name ID of config option
158
- * @property {(string | undefined)} label Displayed label for config option
159
- */
160
- export declare type CustomPluginConfigOptions = CustomPluginConfigGroup | CustomPluginConfigElement | CustomPluginConfigColumn | CustomPluginConfigText | CustomPluginConfigToggle | CustomPluginConfigCheckbox | CustomPluginConfigRadio | CustomPluginConfigDropdown | CustomPluginConfigColor | CustomPluginConfigVariable | CustomPluginConfigInteraction | CustomPluginConfigActionTrigger | CustomPluginConfigActionEffect | CustomPluginConfigUrlParameter;
161
- /**
162
- * @typedef {object} PluginInstance
163
- * @template T Type of Config passed in
164
- * @property {string} sigmaEnv Permissions within Sigma Environment
165
- * @property {object} config Set of helper functions for interacting with Plugin Config
166
- * @property {object} elements Set of helper functions for interacting with Workbook Element Data
167
- * @property {Function} destroy Destroys Plugin Instance and removes all subscriptions
168
- */
169
- export interface PluginInstance<T = any> {
170
- sigmaEnv: 'author' | 'viewer' | 'explorer';
171
- config: {
172
- /**
173
- * Getter for entire Plugin Config
174
- * @template T Config type to be passed in
175
- * @returns {Partial<T>} Current Plugin Config
176
- */
177
- get(): Partial<T> | undefined;
178
- /**
179
- * Performs a shallow merge between current config and passed in config
180
- * @template T Config type to be passed in
181
- * @param {Partial<T>} config Config to directly assign
182
- */
183
- set(config: Partial<T>): void;
184
- /**
185
- * Getter for key within plugin config
186
- * @template K Possible key within CustomPluginConfigOptions
187
- * @param {K} key Key within config to retrieve
188
- * @returns Value within config for passed in key
189
- */
190
- getKey<K extends keyof T>(key: K): Pick<T, K>;
191
- /**
192
- * Assigns key value pair within plugin
193
- * @template K Possible key within CustomPluginConfigOptions
194
- * @template V Value corresponding to K
195
- * @param {K} key Key within config to set
196
- * @param {V} value New value to set key to
197
- */
198
- setKey<K extends keyof T>(key: K, value: Pick<T, K>): void;
199
- /**
200
- * Subscriber for Plugin Config
201
- * @param {Function} listener Function to be called upon changes to Plugin Config
202
- */
203
- subscribe(listener: (arg0: T) => void): Unsubscriber;
204
- /**
205
- * Set possible options for plugin config
206
- * @param {CustomPluginConfigOptions[]} options Possible config options
207
- */
208
- configureEditorPanel(options: CustomPluginConfigOptions[]): void;
209
- /**
210
- * Gets a static image of a workbook variable
211
- * @param {string} configId ID from config of type: 'variable'
212
- * @returns {WorkbookVariable} Current value of the workbook variable
213
- */
214
- getVariable(configId: string): WorkbookVariable;
215
- /**
216
- * Setter for workbook variable passed in
217
- * @param {string} configId ID from config of type: 'variable'
218
- * @param {unknown[]} values Values to assign to the workbook variable
219
- */
220
- setVariable(configId: string, ...values: unknown[]): void;
221
- /**
222
- * @deprecated Use Action API instead
223
- * Getter for interaction selection state
224
- * @param {string} configId ID from config of type: 'interaction'
225
- */
226
- getInteraction(configId: string): WorkbookSelection[];
227
- /**
228
- * @deprecated Use Action API instead
229
- * Setter for interaction selection state
230
- * @param {string} configId ID from config of type: 'interaction'
231
- * @param {string} elementId Source element ID from element type in Plugin Config
232
- * @param {Object} selection List of column IDs or Columns and values and key-value pairs to select
233
- */
234
- setInteraction(configId: string, elementId: string, selection: WorkbookSelection[]): void;
235
- /**
236
- * Triggers an action based on the provided action trigger ID
237
- * @param {string} configId ID from config of type: 'action-trigger'
238
- */
239
- triggerAction(configId: string): void;
240
- /**
241
- * Registers an effect with the provided action effect ID
242
- * @param {string} configId ID from config of type: 'action-effect'
243
- * @param {Function} effect The effect function to register
244
- * @returns {Unsubscriber} A callable unsubscriber
245
- */
246
- registerEffect(configId: string, effect: () => void): () => void;
247
- /**
248
- * Overrider function for Config Ready state
249
- * @param {boolean} loadingState Boolean representing if Plugin Config is still loading
250
- */
251
- setLoadingState(ready: boolean): void;
252
- /**
253
- * Allows users to subscribe to changes in the passed in variable
254
- * @param {string} configId ID from config of type: 'variable'
255
- * @callback callback Function to be called upon receiving an updated workbook variable
256
- * @returns {Unsubscriber} A callable unsubscriber
257
- */
258
- subscribeToWorkbookVariable(configId: string, callback: (input: WorkbookVariable) => void): Unsubscriber;
259
- /**
260
- * Allows users to subscribe to changes in the url parameter
261
- * @param {string} configId ID from config of type: 'url-parameter'
262
- * @callback callback Function to be called upon receiving an updated url parameter
263
- * @returns {Unsubscriber} A callable unsubscriber
264
- */
265
- subscribeToUrlParameter(configId: string, callback: (input: UrlParameter) => void): Unsubscriber;
266
- /**
267
- * Gets the current value of a url parameter
268
- * @param {string} configId ID from config of type: 'url-parameter'
269
- * @returns {UrlParameter} Current value of the url parameter
270
- */
271
- getUrlParameter(configId: string): UrlParameter;
272
- /**
273
- * Setter for url parameter
274
- * @param {string} configId ID from config of type: 'url-parameter'
275
- * @param {string} value Value to assign to the url parameter
276
- */
277
- setUrlParameter(configId: string, value: string): void;
278
- /**
279
- * @deprecated Use Action API instead
280
- * Allows users to subscribe to changes in the passed in interaction ID
281
- * @param {string} configId ID from the config of type: 'interaction'
282
- * @callback callback Function to be called upon receiving an updated interaction selection state
283
- * @returns {Unsubscriber} A callable unsubscriber
284
- */
285
- subscribeToWorkbookInteraction(configId: string, callback: (input: WorkbookSelection[]) => void): Unsubscriber;
286
- };
287
- elements: {
288
- /**
289
- * Getter for Column Data by parent sheet ID
290
- * @param {string} configId ID from config of type: 'element'
291
- * @returns {WorkbookElementColumns} Column values contained within corresponding sheet
292
- */
293
- getElementColumns(configId: string): Promise<WorkbookElementColumns>;
294
- /**
295
- * Subscriber to changes in column data by ID
296
- * @param {string} configId ID from config of type: 'element'
297
- * @callback callback Callback function to be called upon changes to column data
298
- * @returns {Unsubscriber} Callable unsubscriber to column data changes
299
- */
300
- subscribeToElementColumns(configId: string, callback: (cols: WorkbookElementColumns) => void): Unsubscriber;
301
- /**
302
- * Subscriber for the data within a given sheet
303
- * @param {string} configId ID from config of type: 'element'
304
- * @callback callback Function to call on data passed in
305
- * @returns {Unsubscriber} A callable unsubscriber to changes in the data
306
- */
307
- subscribeToElementData(configId: string, callback: (data: WorkbookElementData) => void): Unsubscriber;
308
- /**
309
- * Ask sigma to load more data
310
- * @param {string} configId ID from config of type: 'element'
311
- */
312
- fetchMoreElementData(configId: string): void;
313
- };
314
- style: {
315
- /**
316
- * Subscribe to style updates
317
- * @param callback Function to call when style updates
318
- * @returns Unsubscriber function
319
- */
320
- subscribe(callback: (style: PluginStyle) => void): () => void;
321
- /**
322
- * Request current style from workbook
323
- * @returns Promise with current style
324
- */
325
- get(): Promise<PluginStyle>;
326
- };
327
- /**
328
- * Destroys plugin instance and removes all subscribers
329
- */
330
- destroy(): void;
331
- }
332
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAChF,oBAAY,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAC5D,oBAAY,SAAS,GAAG,aAAa,GAAG,OAAO,CAAC;AAEhD;;GAEG;AACH,oBAAY,WAAW,GACnB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,MAAM,GACN,WAAW,GACX,aAAa,GACb,WAAW,GACX,cAAc,GACd,YAAY,CAAC;AAEjB,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG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AK,EAAE,YAAY,KAAK,IAAI,GACtC,YAAY,CAAC;QAEhB;;;;WAIG;QACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;QAEhD;;;;WAIG;QACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAEvD;;;;;;WAMG;QACH,8BAA8B,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,IAAI,GAC7C,YAAY,CAAC;KACjB,CAAC;IAEF,QAAQ,EAAE;QACR;;;;WAIG;QACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAErE;;;;;WAKG;QACH,yBAAyB,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,GAC/C,YAAY,CAAC;QAEhB;;;;;WAKG;QACH,sBAAsB,CACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,GAC5C,YAAY,CAAC;QAEhB;;;WAGG;QACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9C,CAAC;IAEF,KAAK,EAAE;QACL;;;;WAIG;QACH,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;QAE9D;;;WAGG;QACH,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;KAC7B,CAAC;IAEF;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- export declare function deepEqual(obj1: any, obj2: any): boolean | undefined;
2
- //# sourceMappingURL=deepEqual.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deepEqual.d.ts","sourceRoot":"","sources":["../../src/utils/deepEqual.ts"],"names":[],"mappings":"AAQA,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,uBAc7C"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deepEqual = void 0;
4
- function isObject(obj) {
5
- if (typeof obj === 'object' && obj != null) {
6
- return true;
7
- }
8
- else {
9
- return false;
10
- }
11
- }
12
- function deepEqual(obj1, obj2) {
13
- if (obj1 === obj2) {
14
- return true;
15
- }
16
- else if (isObject(obj1) && isObject(obj2)) {
17
- if (Object.keys(obj1).length !== Object.keys(obj2).length) {
18
- return false;
19
- }
20
- for (const prop in obj1) {
21
- if (!deepEqual(obj1[prop], obj2[prop])) {
22
- return false;
23
- }
24
- }
25
- return true;
26
- }
27
- }
28
- exports.deepEqual = deepEqual;
@@ -1,8 +0,0 @@
1
- /**
2
- * requestAnimationFrame() calls are paused in most browsers when running in background tabs or hidden <iframe>s in order to improve performance and battery life
3
- *
4
- * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
5
- * @param w Window Object
6
- */
7
- export declare function polyfillRequestAnimationFrame(w: Window): void;
8
- //# sourceMappingURL=polyfillRequestAnimationFrame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polyfillRequestAnimationFrame.d.ts","sourceRoot":"","sources":["../../src/utils/polyfillRequestAnimationFrame.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,QAKtD"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.polyfillRequestAnimationFrame = void 0;
4
- /**
5
- * requestAnimationFrame() calls are paused in most browsers when running in background tabs or hidden <iframe>s in order to improve performance and battery life
6
- *
7
- * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
8
- * @param w Window Object
9
- */
10
- function polyfillRequestAnimationFrame(w) {
11
- if ('requestAnimationFrame' in w) {
12
- w.requestAnimationFrame = cb => w.setTimeout(cb, 1000 / 60);
13
- w.cancelAnimationFrame = id => w.clearTimeout(id);
14
- }
15
- }
16
- exports.polyfillRequestAnimationFrame = polyfillRequestAnimationFrame;