@upstart.gg/sdk
Version:
You can test the CLI without recompiling by running:
61 lines (60 loc) • 1.82 kB
TypeScript
import { Brick } from "../../bricks.js";
import { BrickManifest } from "../../brick-manifest.js";
import { Static, TObject, TProperties, TSchema } from "@sinclair/typebox";
//#region src/shared/bricks/props/types.d.ts
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
type BrickProps<T extends BrickManifest> = {
brick: Omit<Brick, "props" | "mobileProps"> & {
props: Static<T["props"]> & {};
mobileProps?: Partial<Static<T["props"]>> & {};
};
/**
* True if we are in the context of the Editor
*/
editable?: boolean;
/**
* True if the brick is selected in the Editor
*/
selected?: boolean;
/**
* True if the brick is a child of a container (e.g. Section, Box)
*/
isContainerChild?: boolean;
isDynamicPreview?: boolean;
level?: number;
iterationIndex?: number;
};
type BrickPropCategory = "settings" | "presets" | "content";
type CommonMetadata = {
"ui:responsive"?: boolean | "mobile" | "mobile-only";
"ui:hidden"?: boolean | "if-empty";
"ui:tab"?: BrickPropCategory;
};
type FieldMetadata = CommonMetadata & {
"ui:field"?: string;
[key: string]: unknown;
};
type GroupMetadata = CommonMetadata & {
group?: string;
groupTab?: string;
[key: string]: string | number | boolean | undefined;
};
interface PropSchema extends TSchema {
title: string;
}
type Prop<T = TSchema> = {
title: string;
description?: string;
schema: T;
[key: string]: unknown;
};
type PropGroup<T extends TProperties = TProperties> = {
title: string;
category: BrickPropCategory;
children: T | TObject<T>;
metadata?: GroupMetadata;
options?: Record<string, any>;
};
//#endregion
export { BrickPropCategory, BrickProps, FieldMetadata, GroupMetadata, PartialBy, Prop, PropGroup, PropSchema, type TSchema };
//# sourceMappingURL=types.d.ts.map