@stackbit/types
Advanced tools
Comparing version 0.1.9 to 0.1.10-cross-references.0
@@ -13,3 +13,3 @@ /** | ||
export declare const CMS_NAMES: readonly ["git", "contentful", "sanity", "forestry", "netlifycms"]; | ||
export declare const FIELD_TYPES: readonly ["string", "url", "slug", "text", "markdown", "html", "number", "boolean", "enum", "date", "datetime", "color", "image", "file", "json", "richText", "object", "model", "reference", "style", "list"]; | ||
export declare const FIELD_TYPES: readonly ["string", "url", "slug", "text", "markdown", "html", "number", "boolean", "enum", "date", "datetime", "color", "image", "file", "json", "richText", "object", "model", "reference", "cross-reference", "style", "list"]; | ||
export declare const STYLE_PROPS: readonly ["objectFit", "objectPosition", "flexDirection", "justifyContent", "justifyItems", "justifySelf", "alignContent", "alignItems", "alignSelf", "padding", "margin", "width", "height", "fontFamily", "fontSize", "fontStyle", "fontWeight", "textAlign", "textColor", "textDecoration", "backgroundColor", "backgroundPosition", "backgroundSize", "borderRadius", "borderWidth", "borderColor", "borderStyle", "boxShadow", "opacity"]; | ||
@@ -16,0 +16,0 @@ export declare const STYLE_PROPS_VALUES: { |
@@ -49,2 +49,3 @@ "use strict"; | ||
'reference', | ||
'cross-reference', | ||
'style', | ||
@@ -51,0 +52,0 @@ 'list' |
@@ -5,3 +5,3 @@ /** | ||
import { STYLE_PROPS } from './consts'; | ||
export declare type Field = FieldBasic | FieldEnum | FieldImage | FieldNumber | FieldObject | FieldModel | FieldReference | FieldStyle | FieldList; | ||
export declare type Field = FieldBasic | FieldEnum | FieldImage | FieldNumber | FieldObject | FieldModel | FieldReference | FieldCrossReference | FieldStyle | FieldList; | ||
export declare type DistributeFieldsExtension<Type extends Field> = Type extends { | ||
@@ -16,5 +16,7 @@ type: 'object'; | ||
name: string; | ||
items?: DistributePartialListItems<FieldListItems>[]; | ||
items?: DistributePartialListItems<FieldListItems>; | ||
} : Type extends { | ||
type: 'style'; | ||
} ? Type : Type extends { | ||
type: 'cross-reference'; | ||
} ? Type : Partial<Omit<Type, 'name'>> & { | ||
@@ -27,6 +29,8 @@ name: string; | ||
fields?: DistributeFieldsExtension<Field>[]; | ||
} : Partial<Type>; | ||
} : Type extends { | ||
type: 'cross-reference'; | ||
} ? Type : Partial<Type>; | ||
export declare type FieldExtension = DistributeFieldsExtension<Field>; | ||
export declare type FieldType = Field['type']; | ||
export declare type FieldSpecificProps = FieldBasicProps | FieldEnumProps | FieldImageProps | FieldNumberProps | FieldObjectProps | FieldModelProps | FieldReferenceProps | FieldStyleProps | FieldListProps; | ||
export declare type FieldSpecificProps = FieldBasicProps | FieldEnumProps | FieldImageProps | FieldNumberProps | FieldObjectProps | FieldModelProps | FieldReferenceProps | FieldCrossReferenceProps | FieldStyleProps | FieldListProps; | ||
declare type FindByType<Union extends { | ||
@@ -47,2 +51,3 @@ type: FieldType; | ||
export declare type FieldReference = FieldCommonProps & FieldReferenceProps; | ||
export declare type FieldCrossReference = FieldCommonProps & FieldCrossReferenceProps; | ||
export declare type FieldStyle = FieldCommonProps & FieldStyleProps; | ||
@@ -53,2 +58,3 @@ export declare type FieldList = FieldCommonProps & FieldListProps; | ||
export declare type FieldListReference = FieldCommonProps & FieldListItemsReferenceProps; | ||
export declare type FieldListCrossReference = FieldCommonProps & FieldListItemsCrossReferenceProps; | ||
export interface FieldCommonProps { | ||
@@ -134,2 +140,11 @@ name: string; | ||
} | ||
export interface FieldCrossReferenceProps { | ||
type: 'cross-reference'; | ||
models: FieldCrossReferenceModel[]; | ||
} | ||
export interface FieldCrossReferenceModel { | ||
modelName: string; | ||
srcType?: string; | ||
srcProjectId?: string; | ||
} | ||
export declare type StyleProps = typeof STYLE_PROPS[number]; | ||
@@ -140,3 +155,3 @@ export interface FieldStyleProps { | ||
} | ||
export declare type FieldListProps = FieldListItemsBasicProps | FieldListItemsEnumProps | FieldListItemsImageProps | FieldListItemsNumberProps | FieldListItemsObjectProps | FieldListItemsModelProps | FieldListItemsReferenceProps; | ||
export declare type FieldListProps = FieldListItemsBasicProps | FieldListItemsEnumProps | FieldListItemsImageProps | FieldListItemsNumberProps | FieldListItemsObjectProps | FieldListItemsModelProps | FieldListItemsReferenceProps | FieldListItemsCrossReferenceProps; | ||
export declare type FieldListItems = FieldListProps['items']; | ||
@@ -168,3 +183,6 @@ export interface FieldListCommonProps { | ||
} | ||
export interface FieldListItemsCrossReferenceProps extends FieldListCommonProps { | ||
items: FieldCrossReferenceProps; | ||
} | ||
export {}; | ||
//# sourceMappingURL=model-fields.d.ts.map |
{ | ||
"name": "@stackbit/types", | ||
"version": "0.1.9", | ||
"version": "0.1.10-cross-references.0", | ||
"description": "Types for Stackbit config and Content Source Interface", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "15352ac129e230b9daa9b15f989043522b67fb56" | ||
"gitHead": "4f24d161ab31edc0e549d613fcb7105c90adbfcd" | ||
} |
@@ -48,2 +48,3 @@ /** | ||
'reference', | ||
'cross-reference', | ||
'style', | ||
@@ -50,0 +51,0 @@ 'list' |
@@ -15,2 +15,3 @@ /** | ||
| FieldReference | ||
| FieldCrossReference | ||
| FieldStyle | ||
@@ -25,5 +26,7 @@ | FieldList; | ||
Type extends { type: 'list' } ? | ||
Partial<Omit<Type, 'name' | 'items'>> & { name: string; items?: DistributePartialListItems<FieldListItems>[] } : | ||
Partial<Omit<Type, 'name' | 'items'>> & { name: string; items?: DistributePartialListItems<FieldListItems> } : | ||
// do not make style fields partial | ||
Type extends { type: 'style' } ? Type : | ||
// do not make cross-reference fields partial | ||
Type extends { type: 'cross-reference' } ? Type : | ||
Partial<Omit<Type, 'name'>> & { name: string }; | ||
@@ -35,2 +38,4 @@ | ||
Partial<Omit<Type, 'fields'>> & { fields?: DistributeFieldsExtension<Field>[] } : | ||
// do not make cross-reference fields partial | ||
Type extends { type: 'cross-reference' } ? Type : | ||
Partial<Type>; | ||
@@ -50,6 +55,9 @@ | ||
| FieldReferenceProps | ||
| FieldCrossReferenceProps | ||
| FieldStyleProps | ||
| FieldListProps; | ||
type FindByType<Union extends { type: FieldType }, Type extends FieldType> = Union extends { type: Type } ? Union : never; | ||
type FindByType<Union extends { type: FieldType }, Type extends FieldType> = Union extends { type: Type } | ||
? Union | ||
: never; | ||
export type FieldForType<Type extends FieldType> = FindByType<Field, Type>; | ||
@@ -66,2 +74,3 @@ export type FieldSpecificPropsForType<Type extends FieldType> = FindByType<FieldSpecificProps, Type>; | ||
export type FieldReference = FieldCommonProps & FieldReferenceProps; | ||
export type FieldCrossReference = FieldCommonProps & FieldCrossReferenceProps; | ||
export type FieldStyle = FieldCommonProps & FieldStyleProps; | ||
@@ -73,2 +82,3 @@ export type FieldList = FieldCommonProps & FieldListProps; | ||
export type FieldListReference = FieldCommonProps & FieldListItemsReferenceProps; | ||
export type FieldListCrossReference = FieldCommonProps & FieldListItemsCrossReferenceProps; | ||
@@ -186,2 +196,13 @@ export interface FieldCommonProps { | ||
export interface FieldCrossReferenceProps { | ||
type: 'cross-reference'; | ||
models: FieldCrossReferenceModel[]; | ||
} | ||
export interface FieldCrossReferenceModel { | ||
modelName: string; | ||
srcType?: string; | ||
srcProjectId?: string; | ||
} | ||
export type StyleProps = typeof STYLE_PROPS[number]; | ||
@@ -201,3 +222,4 @@ | ||
| FieldListItemsModelProps | ||
| FieldListItemsReferenceProps; | ||
| FieldListItemsReferenceProps | ||
| FieldListItemsCrossReferenceProps; | ||
@@ -238,1 +260,5 @@ export type FieldListItems = FieldListProps['items']; | ||
} | ||
export interface FieldListItemsCrossReferenceProps extends FieldListCommonProps { | ||
items: FieldCrossReferenceProps; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117743
2352