@sigmacomputing/plugin 0.7.57 → 1.0.0-rc.1
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.
- package/.gitignore +30 -0
- package/.lintstagedrc +3 -0
- package/.nvmrc +1 -0
- package/.prettierrc +5 -0
- package/CHANGELOG.md +25 -0
- package/CONTRIBUTING.md +60 -0
- package/{LICENSE.md → LICENSE} +0 -0
- package/README.md +782 -8
- package/assets/sigma-logo-dark.svg +54 -0
- package/assets/sigma-logo-light.svg +50 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/{client.js → client/index.js} +2 -1
- package/dist/client/initialize.d.ts +3 -0
- package/dist/client/initialize.d.ts.map +1 -0
- package/dist/{initialize.js → client/initialize.js} +1 -1
- package/dist/client/react/Context.d.ts +4 -0
- package/dist/client/react/Context.d.ts.map +1 -0
- package/dist/client/react/Context.js +6 -0
- package/dist/client/react/Provider.d.ts +8 -0
- package/dist/client/react/Provider.d.ts.map +1 -0
- package/dist/client/react/Provider.js +9 -0
- package/dist/client/react/hooks.d.ts +48 -0
- package/dist/client/react/hooks.d.ts.map +1 -0
- package/dist/{react/index.js → client/react/hooks.js} +23 -60
- package/dist/client/react/index.d.ts +4 -0
- package/dist/client/react/index.d.ts.map +1 -0
- package/dist/client/react/index.js +21 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -9
- package/dist/types.d.ts +262 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/{deepEqual.d.ts → utils/deepEqual.d.ts} +0 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +29 -0
- package/jest.config.ts +22 -0
- package/package.json +50 -17
- package/src/client/__tests__/initialize.test.ts +30 -0
- package/src/client/index.ts +5 -0
- package/src/client/initialize.ts +199 -0
- package/src/client/react/Context.ts +6 -0
- package/src/client/react/Provider.tsx +19 -0
- package/src/client/react/hooks.ts +178 -0
- package/src/client/react/index.tsx +6 -0
- package/src/index.ts +3 -0
- package/src/types.ts +322 -0
- package/src/utils/deepEqual.ts +24 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +35 -0
- package/yarn.lock +3226 -0
- package/dist/client.d.ts +0 -2
- package/dist/client.d.ts.map +0 -1
- package/dist/deepEqual.d.ts.map +0 -1
- package/dist/deepEqual.js +0 -46
- package/dist/initialize.d.ts +0 -3
- package/dist/initialize.d.ts.map +0 -1
- package/dist/initialize.test.d.ts +0 -2
- package/dist/initialize.test.d.ts.map +0 -1
- package/dist/initialize.test.js +0 -26
- package/dist/react/index.d.ts +0 -58
- package/dist/react/index.d.ts.map +0 -1
package/dist/client.d.ts
DELETED
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,2DAAe,CAAC"}
|
package/dist/deepEqual.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepEqual.d.ts","sourceRoot":"","sources":["../src/deepEqual.ts"],"names":[],"mappings":"AAkBA,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,uBAuB7C"}
|
package/dist/deepEqual.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Deep Equality comparison example
|
|
3
|
-
//
|
|
4
|
-
// This is an example of how to implement an object-comparison function in
|
|
5
|
-
// JavaScript (ES5+). A few points of interest here:
|
|
6
|
-
//
|
|
7
|
-
// * You can get an array of all an object's properties in ES5+ by calling
|
|
8
|
-
// the class method Object.keys(obj).
|
|
9
|
-
// * The function recursively calls itself in the for / in loop when it
|
|
10
|
-
// compares the contents of each property
|
|
11
|
-
// * You can hide a "private" function inside a function of this kind by
|
|
12
|
-
// placing one function declaration inside of another. The inner function
|
|
13
|
-
// is not hoisted out into the global scope, so it is only visible inside
|
|
14
|
-
// of the parent function.
|
|
15
|
-
// * The reason this nested helper function is necessary is that
|
|
16
|
-
// `typeof null` is still "object" in JS, a major "gotcha" to watch out for.
|
|
17
|
-
//
|
|
18
|
-
// https://gist.github.com/egardner/efd34f270cc33db67c0246e837689cb9
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.deepEqual = void 0;
|
|
21
|
-
function deepEqual(obj1, obj2) {
|
|
22
|
-
if (obj1 === obj2) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
else if (isObject(obj1) && isObject(obj2)) {
|
|
26
|
-
if (Object.keys(obj1).length !== Object.keys(obj2).length) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
for (const prop in obj1) {
|
|
30
|
-
if (!deepEqual(obj1[prop], obj2[prop])) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
// Private
|
|
37
|
-
function isObject(obj) {
|
|
38
|
-
if (typeof obj === 'object' && obj != null) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.deepEqual = deepEqual;
|
package/dist/initialize.d.ts
DELETED
package/dist/initialize.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AAEvD,wBAAgB,UAAU,CAAC,CAAC,GAAG,EAAE,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CA2L7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.test.d.ts","sourceRoot":"","sources":["../src/initialize.test.ts"],"names":[],"mappings":""}
|
package/dist/initialize.test.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const initialize_1 = require("./initialize");
|
|
4
|
-
describe('initialize', () => {
|
|
5
|
-
let originalAddEventListener;
|
|
6
|
-
let originalRemoveEventListener;
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
originalAddEventListener = window.addEventListener;
|
|
9
|
-
originalRemoveEventListener = window.removeEventListener;
|
|
10
|
-
window.addEventListener = jest.fn();
|
|
11
|
-
window.removeEventListener = jest.fn();
|
|
12
|
-
});
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
jest.resetAllMocks();
|
|
15
|
-
});
|
|
16
|
-
test('should initialize and be destroyable', () => {
|
|
17
|
-
const client = (0, initialize_1.initialize)();
|
|
18
|
-
expect(window.addEventListener).toHaveBeenCalled();
|
|
19
|
-
client.destroy();
|
|
20
|
-
expect(window.removeEventListener).toHaveBeenCalled();
|
|
21
|
-
});
|
|
22
|
-
afterAll(() => {
|
|
23
|
-
window.addEventListener = originalAddEventListener;
|
|
24
|
-
window.removeEventListener = originalRemoveEventListener;
|
|
25
|
-
});
|
|
26
|
-
});
|
package/dist/react/index.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as plugin from '@sigmacomputing/plugin-types';
|
|
3
|
-
/**
|
|
4
|
-
* Wrapper for plugin client using a Provider
|
|
5
|
-
* @param {{client: plugin.PluginInstance, children: React.ReachChildren}} props Plugin instance and any children elements
|
|
6
|
-
* @returns {JSXElement} Context Provider for passed in props
|
|
7
|
-
*/
|
|
8
|
-
export declare function SigmaClientProvider(props: {
|
|
9
|
-
client: plugin.PluginInstance<any>;
|
|
10
|
-
children?: React.ReactChildren;
|
|
11
|
-
}): JSX.Element;
|
|
12
|
-
/**
|
|
13
|
-
* A constantly updating getter for the entire Plugin Instance
|
|
14
|
-
* @returns {plugin.PluginInstance} Context for the current plugin instance
|
|
15
|
-
*/
|
|
16
|
-
export declare function usePlugin(): plugin.PluginInstance<any>;
|
|
17
|
-
/**
|
|
18
|
-
* Provides a setter for the Plugin's Config Options
|
|
19
|
-
* @param {plugin.CustomPluginConfigOptions[]} nextOptions Updated possible Config Options
|
|
20
|
-
*/
|
|
21
|
-
export declare function useEditorPanelConfig(nextOptions: plugin.CustomPluginConfigOptions[]): void;
|
|
22
|
-
/**
|
|
23
|
-
* React hook for Plugin Config loading state
|
|
24
|
-
* @param {boolean} initialState Initial value to set loading state to
|
|
25
|
-
* @returns {[boolean, Function]} Boolean value corresponding to loading state for plugin config and setter for loading state
|
|
26
|
-
*/
|
|
27
|
-
export declare function useLoadingState(initialState: boolean): [boolean, (nextState: boolean) => void];
|
|
28
|
-
/**
|
|
29
|
-
* Provides constantly updating column values from corresponding sheet
|
|
30
|
-
* @param {string} id Sheet ID to retrieve from workbook
|
|
31
|
-
* @returns {plugin.WbElementColumns} Values of corresponding columns contained within the sheet
|
|
32
|
-
*/
|
|
33
|
-
export declare function useElementColumns(id: string): plugin.WbElementColumns;
|
|
34
|
-
/**
|
|
35
|
-
* Provides constantly updating data values from corresponding sheet
|
|
36
|
-
* @param {string} id Sheet ID to get element data from
|
|
37
|
-
* @returns {plugin.WbElementData} Element Data for corresponding sheet, if any
|
|
38
|
-
*/
|
|
39
|
-
export declare function useElementData(id: string): plugin.WbElementData;
|
|
40
|
-
/**
|
|
41
|
-
* Provides a constantly updating value for entire config or certain key within config
|
|
42
|
-
* @param {string} key Key within Plugin Config, optional
|
|
43
|
-
* @returns Entire config if no key passed in or value for key within plugin config
|
|
44
|
-
*/
|
|
45
|
-
export declare function useConfig(key?: string): any;
|
|
46
|
-
/**
|
|
47
|
-
* React hook for accessing a workbook variable
|
|
48
|
-
* @param {string} id ID of variable within Plugin Config to use
|
|
49
|
-
* @returns {[(plugin.WorkbookVariable | undefined), Function]} Constantly updating value of the variable and setter for the variable
|
|
50
|
-
*/
|
|
51
|
-
export declare function useVariable(id: string): [plugin.WorkbookVariable | undefined, Function];
|
|
52
|
-
/**
|
|
53
|
-
* React hook for accessing a workbook interaction selections state
|
|
54
|
-
* @param {string} id ID of variable within Plugin Config to use
|
|
55
|
-
* @returns {[(plugin.WorkbookSelection | undefined), Function]} Constantly updating selection state and setter thereof
|
|
56
|
-
*/
|
|
57
|
-
export declare function useInteraction(id: string, elementId: string): [unknown, Function];
|
|
58
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AAOvD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAChC,eAIA;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAEtD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,CAAC,yBAAyB,EAAE,GAC9C,IAAI,CAUN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,OAAO,GACpB,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC,CAczC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,gBAAgB,CASrE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,aAAa,CAO/D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAiB3C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,GACT,CAAC,MAAM,CAAC,gBAAgB,GAAG,SAAS,EAAE,QAAQ,CAAC,CAcjD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,GAChB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAmBrB"}
|