@builder.io/sdk-vue
Version:
Builder.io SDK for Vue
42 lines (41 loc) • 1.94 kB
TypeScript
import type { BlocksWrapperProps } from '../components/blocks/blocks-wrapper.vue';
import type { ApiVersion } from '../types/api-version';
import type { BuilderContent } from '../types/builder-content';
import type { ComponentInfo } from '../types/components';
import type { Dictionary, Nullable } from '../types/typescript';
import type { ComponentReference } from './component-reference-types';
import type { ExtraContextTypes } from './extra-context-types';
export type RegisteredComponent = ComponentInfo & {
component: ComponentReference;
};
export type RegisteredComponents = Dictionary<RegisteredComponent>;
export type BuilderRenderState = Record<string, unknown>;
export type BuilderRenderContext = Record<string, unknown>;
export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>, ExtraContextTypes {
content: Nullable<BuilderContent>;
context: BuilderRenderContext;
/**
* The state of the application.
*
* NOTE: see `localState` below to understand how it is different from `rootState`.
*/
rootState: BuilderRenderState;
/**
* Some frameworks have a `setState` function which needs to be invoked to notify
* the framework of state change. (other frameworks don't in which case it is `undefined')
*/
rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
/**
* The local state of the current component. This is different from `rootState` in that
* it can be a child state created by a repeater containing local state.
* The `rootState` is where all of the state mutations are actually stored.
*/
localState: BuilderRenderState | undefined;
apiKey: string | null;
apiVersion: ApiVersion | undefined;
componentInfos: Dictionary<ComponentInfo>;
inheritedStyles: Record<string, unknown>;
nonce: string;
model: string;
canTrack?: boolean;
}