@upstart.gg/sdk
Version:
You can test the CLI without recompiling by running:
52 lines (50 loc) • 1.14 kB
JavaScript
import { commonProps } from "./common.js";
import { Type } from "@sinclair/typebox";
//#region src/shared/bricks/props/helpers.ts
function isTObject(schema) {
return schema.type === "object";
}
function group({ title, children, category = "settings", metadata, options }) {
if (isTObject(children)) return Type.Composite([Type.Object({}), children], {
title,
metadata: {
category,
group: true,
...metadata
},
...options
});
return Type.Object(children, {
title,
...options,
metadata: {
category,
group: true,
...metadata
}
});
}
function getGroupInfo(schema) {
const meta = schema.metadata;
return {
title: schema.title ?? schema.metadata?.title,
meta,
tab: meta.groupTab || "common"
};
}
function defineProps(props, options) {
const { alignSelf, grow,...rest } = {
...commonProps,
...props
};
const finalProps = {
...rest,
...options?.noAlignSelf ? {} : { alignSelf },
...options?.noGrow ? {} : { grow }
};
return Type.Object(finalProps, options);
}
const array = Type.Array;
//#endregion
export { array, defineProps, getGroupInfo, group };
//# sourceMappingURL=helpers.js.map