### Install Dependencies and Start Plugin Source: https://github.com/sigmacomputing/plugin/blob/main/README.md These commands install the necessary dependencies for a Sigma plugin using Yarn and then start the plugin for local testing and development. ```javascript yarn && yarn start ``` -------------------------------- ### Start Sigma Plugin Development Project Source: https://github.com/sigmacomputing/plugin/blob/main/README.md This command starts the development server for a Sigma plugin project. It installs project dependencies using Yarn and then starts the development process. ```sh yarn && yarn start ``` -------------------------------- ### Navigate and Run Project Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Commands to navigate into the newly created project directory and start the development server. ```Shell cd ``` ```Shell yarn && yarn dev ``` -------------------------------- ### Clone Repository Source: https://github.com/sigmacomputing/plugin/blob/main/CONTRIBUTING.md Clone the Sigma Computing plugin repository locally to begin development. Ensure you have Git installed. ```sh git clone https://github.com/your-username/sigmacomputing-plugin.git ``` -------------------------------- ### Install Dependencies Source: https://github.com/sigmacomputing/plugin/blob/main/CONTRIBUTING.md Install project dependencies using Yarn. This step requires Node.js version 18 or higher. It also includes setting up the Node Version Manager (nvm). ```sh # Ensure you have node version 18 installed (suggestion: v18.16.1). nvm install yarn install ``` -------------------------------- ### Run Development Scripts Source: https://github.com/sigmacomputing/plugin/blob/main/CONTRIBUTING.md Execute scripts defined in the package.json file using Yarn. Examples include building the project or running the build in watch mode. ```sh yarn ``` ```sh yarn build # Or in watch mode yarn build:watch ``` -------------------------------- ### Install Sigma Plugin Library Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Installs the Sigma Computing plugin library using either Yarn or npm package managers. This is a prerequisite for developing plugins. ```Shell yarn add @sigmacomputing/plugin ``` ```Shell npm install @sigmacomputing/plugin ``` -------------------------------- ### Run Test Suite Source: https://github.com/sigmacomputing/plugin/blob/main/CONTRIBUTING.md Execute the project's test suite using Yarn to ensure code quality and prevent regressions before submitting a pull request. ```sh yarn test ``` -------------------------------- ### Format Code with Yarn Source: https://github.com/sigmacomputing/plugin/blob/main/README.md This command formats your code to adhere to the Sigma Computing style guide, ensuring consistency across the project. ```javascript yarn format ``` -------------------------------- ### useLoadingState: Manage Plugin Loading State Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Gets the current loading state of the plugin and returns a tuple containing the state and a setter function to update it. It takes an initial boolean value for the loading state. ```TypeScript function useLoadingState( initialState: boolean, ): [boolean, (nextState: boolean) => void]; ``` -------------------------------- ### useVariable: Get and Set Workbook Variable Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Returns a variable's current value and a setter function to update it. It takes a configuration ID and the setter accepts one or more values. ```TypeScript function useVariable( configId: string, ): [WorkbookVariable | undefined, (...values: unknown[]) => void]; ``` ```TypeScript function setVariableCallback(...values: unknown[]): void; ``` -------------------------------- ### Initialize Sigma Computing Plugin Client Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Demonstrates how to initialize and use the pre-initialized Sigma Computing plugin client. It shows configuring the editor panel with source and dimension settings. ```javascript import { client } from '@sigmacomputing/plugin'; client.config.configureEditorPanel([ { name: 'source', type: 'element' }, { name: 'dimension', type: 'column', source: 'source', allowMultiple: true }, ]); ``` -------------------------------- ### Create Custom Sigma Computing Plugin Instance Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Illustrates how to create a custom plugin instance using the `initialize` function. This custom instance can then be used to interact with the Sigma Computing environment, including configuring the editor panel. ```javascript import { initialize } from '@sigmacomputing/plugin'; const myClient: PluginInstance = initialize(); myClient.config.configureEditorPanel([ { name: 'source', type: 'element' }, { name: 'dimension', type: 'column', source: 'source', allowMultiple: true }, ]); ``` -------------------------------- ### Navigate to Plugin Directory Source: https://github.com/sigmacomputing/plugin/blob/main/README.md This command navigates your terminal into a specific plugin's directory within the cloned repository, preparing it for local execution. ```sh cd sigma-sample-plugins/ ``` -------------------------------- ### Clone Sigma Sample Plugins Repository Source: https://github.com/sigmacomputing/plugin/blob/main/README.md This command clones the Sigma sample plugins repository from GitHub, allowing you to access the source code for various sample plugins. ```sh git clone https://github.com/sigmacomputing/sigma-sample-plugins.git ``` -------------------------------- ### PluginInstance Interface for Sigma Computing Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Defines the core `PluginInstance` interface for Sigma Computing plugins. It includes methods for managing plugin configuration, interacting with workbook elements, handling selections, triggering actions, and managing subscriptions. ```typescript interface PluginInstance { sigmaEnv: 'author' | 'viewer' | 'explorer'; config: { /** * Getter for entire Plugin Config */ get(): Partial | undefined; /** * Performs a shallow merge between current config and passed in config */ set(config: Partial): void; /** * Getter for key within plugin config */ getKey(key: K): Pick; /** * Assigns key value pair within plugin */ setKey(key: K, value: Pick): void; /** * Subscriber for Plugin Config */ subscribe(listener: (arg0: T) => void): Unsubscriber; /** * Set possible options for plugin config */ configureEditorPanel(options: CustomPluginConfigOptions[]): void; /** * Gets a static image of a workbook variable */ getVariable(configId: string): WorkbookVariable; /** * Setter for workbook variable passed in */ setVariable(configId: string, ...values: unknown[]): void; /** * Getter for interaction selection state */ getInteraction(configId: string): WorkbookSelection[]; /** * Setter for interaction selection state */ setInteraction( configId: string, elementId: string, selection: WorkbookSelection[], ): void; /** * Triggers an action based on the provided action trigger ID */ triggerAction(configId: string): void; /** * Registers an effect with the provided action effect ID */ registerEffect(configId: string, effect: Function): void; /** * Overrider function for Config Ready state */ setLoadingState(ready: boolean): void; /** * Allows users to subscribe to changes in the passed in variable */ subscribeToWorkbookVariable( configId: string, callback: (input: WorkbookVariable) => void, ): Unsubscriber; /** * @deprecated Use Action API instead * Allows users to subscribe to changes in the passed in interaction ID */ subscribeToWorkbookInteraction( configId: string, callback: (input: WorkbookSelection[]) => void, ): Unsubscriber; }; elements: { /** * Getter for Column Data by parent sheet ID */ getElementColumns(configId: string): Promise; /** * Subscriber to changes in column data by ID */ subscribeToElementColumns( configId: string, callback: (cols: WbElementColumns) => void, ): Unsubscriber; /** * Subscriber for the data within a given sheet */ subscribeToElementData( configId: string, callback: (data: WbElementData) => void, ): Unsubscriber; }; /** * Destroys plugin instance and removes all subscribers */ destroy(): void; } ``` -------------------------------- ### Create Vite Project Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Scaffolds a new project using Vite, a fast build tool. It can be used to create a basic project structure for a Sigma plugin. ```Shell yarn create vite ``` ```Shell npm create vite@latest ``` ```Shell yarn create vite my-vue-app --template vue ``` -------------------------------- ### Run Unit Tests with Yarn Source: https://github.com/sigmacomputing/plugin/blob/main/README.md This command executes all unit tests for the Sigma plugin to verify its functionality. The `--watch` flag can be used to automatically re-run tests when code changes. ```javascript yarn test ``` ```javascript yarn test:watch ``` -------------------------------- ### useConfig: Retrieve Workbook Element Configuration Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Returns the current configuration of a workbook element. Optionally, if a key is provided, it returns only the configuration associated with that key. ```TypeScript function useConfig(key?: string): any; ``` -------------------------------- ### Use Sigma Computing Plugin Instance in React Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Demonstrates the `usePlugin` hook for accessing the entire plugin instance within a React component. This allows direct interaction with the plugin's functionalities. ```typescript function usePlugin(): PluginInstance; ``` -------------------------------- ### usePaginatedElementData: Fetch Paginated Workbook Element Data Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Fetches initial data (up to 25000 values) from a sheet and provides a callback for fetching more data in chunks. It requires a configuration ID. ```TypeScript function useElementData(configId: string): [WorkbookElementData, () => void]; ``` ```TypeScript interface WorkbookElementData { [colId: string]: any[]; } ``` -------------------------------- ### SigmaClientProvider for React Plugins Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Shows the usage of `SigmaClientProvider` in React applications. This component acts as a context provider, enabling other React API hooks within the plugin's component tree. ```typescript interface SigmaClientProviderProps { client: PluginInstance; children?: ReactNode; } function SigmaClientProvider(props: SigmaClientProviderProps): ReactNode; ``` -------------------------------- ### useElementData: Fetch Workbook Element Data Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Fetches the latest data values from a corresponding sheet, up to 25000 values. It requires a configuration ID and returns an object containing the row data. ```TypeScript function useElementData(configId: string): WorkbookElementData; ``` ```TypeScript interface WorkbookElementData { [colId: string]: any[]; } ``` -------------------------------- ### useElementColumns: Retrieve Column Information for a Workbook Element Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Provides the latest column values for a specified workbook element. It requires the element's unique identifier and returns an object mapping column IDs to column details. ```TypeScript function useElementColumns(elementId: string): WorkbookElementColumns; ``` ```TypeScript interface WorkbookElementColumn { id: string; name: string; columnType: ValueType; } interface WorkbookElementColumns { [colId: string]: WbElementColumn; } ``` -------------------------------- ### useActionTrigger: Trigger Action Effects Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Returns a callback function that can be used to trigger one or more action effects for a given action trigger. It requires a configuration ID. ```TypeScript function useActionTrigger(configId: string): () => void; ``` ```TypeScript function triggerActionCallback(configId: string): void; ``` -------------------------------- ### useEditorPanelConfig: Set Plugin Configuration Options Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Provides a setter function to update the plugin's configuration options. It accepts an array of `CustomPluginConfigOptions` to define the available configurations. ```TypeScript function useEditorPanelConfig(nextOptions: CustomPluginConfigOptions[]): void; ``` -------------------------------- ### useInteraction: Manage Workbook Interaction Selection State Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Returns the selection state of an interaction and a setter function to update it. It requires configuration and element IDs, and the setter accepts an array of workbook selection elements. ```TypeScript function useInteraction( configId: string, elementId: string, ): [WorkbookSelection | undefined, (value: WorkbookSelection[]) => void]; ``` ```TypeScript function setVariableCallback(value: WorkbookSelection[]): void; ``` -------------------------------- ### Define Control Types for Sigma Computing Plugin Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Defines the various control types that can be used within a Sigma Computing plugin's configuration. These types specify the expected data format for different input fields. ```typescript type ControlType = | 'boolean' | 'date' | 'number' | 'text' | 'text-list' | 'number-list' | 'date-list' | 'number-range' | 'date-range'; ``` -------------------------------- ### Define CustomPluginConfigOptions Type Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Defines the comprehensive TypeScript type for custom plugin configuration options, encompassing various field types like group, element, column, text, toggle, checkbox, radio, dropdown, color, and variable. ```typescript 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 secure?: boolean; // if true will omit from prehydrated configs 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?: boolean; } | { type: 'dropdown'; name: string; label?: string; source?: string; width?: string; values: string[]; defaultValue?: boolean; } | { 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; }; ``` -------------------------------- ### useActionEffect: Register and Unregister Action Effects Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Allows registering and unregistering an action effect within the plugin. It takes a configuration ID and the effect function to be executed. ```TypeScript function useActionEffect(configId: string, effect: () => void); ``` -------------------------------- ### Define ValueType Enum Source: https://github.com/sigmacomputing/plugin/blob/main/README.md Defines the possible data types that a column can accept in Sigma Computing plugins. ```typescript type ValueType = | 'boolean' | 'datetime' | 'number' | 'integer' | 'text' | 'variant' | 'link' | 'error'; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.