@prismicio/types-internal
Advanced tools
Comparing version 2.4.0-alpha.2 to 2.4.0-alpha.3
@@ -104,3 +104,5 @@ "use strict"; | ||
const variationConfig = customType.variations.find((v) => v.id === content.variation); | ||
const primaryConfig = (_a = variationConfig === null || variationConfig === void 0 ? void 0 : variationConfig.primary) !== null && _a !== void 0 ? _a : {}; | ||
// Temporarily filtering out group fields and casting to NestableWidget until | ||
// we support group fields in primary | ||
const primaryConfig = Object.fromEntries(Object.entries((_a = variationConfig === null || variationConfig === void 0 ? void 0 : variationConfig.primary) !== null && _a !== void 0 ? _a : {}).filter(([_, value]) => value.type !== "Group")); | ||
const itemsConfig = (_b = variationConfig === null || variationConfig === void 0 ? void 0 : variationConfig.items) !== null && _b !== void 0 ? _b : {}; | ||
@@ -107,0 +109,0 @@ const updatedPrimaryContent = (0, withDefaultValues_1.withDefaultNestableContentValues)(primaryConfig, content.primary); |
@@ -179,321 +179,3 @@ import type { SharedSlice } from "../widgets/slices"; | ||
}; | ||
}); | ||
}; | ||
items?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}); | ||
}; | ||
fields?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Group"; | ||
@@ -669,180 +351,2 @@ } & { | ||
}; | ||
})[]; | ||
} & { | ||
description?: string; | ||
legacyPaths?: { | ||
[x: string]: string; | ||
}; | ||
}) | undefined, sliceB?: ({ | ||
id: string; | ||
type: "SharedSlice"; | ||
name: string; | ||
variations: readonly ({ | ||
id: string; | ||
name: string; | ||
description: string; | ||
imageUrl: string; | ||
docURL: string; | ||
version: string; | ||
} & { | ||
display?: string; | ||
primary?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}); | ||
}; | ||
items?: { | ||
@@ -1007,3 +511,22 @@ [x: string]: ({ | ||
}; | ||
fields?: { | ||
})[]; | ||
} & { | ||
description?: string; | ||
legacyPaths?: { | ||
[x: string]: string; | ||
}; | ||
}) | undefined, sliceB?: ({ | ||
id: string; | ||
type: "SharedSlice"; | ||
name: string; | ||
variations: readonly ({ | ||
id: string; | ||
name: string; | ||
description: string; | ||
imageUrl: string; | ||
docURL: string; | ||
version: string; | ||
} & { | ||
display?: string; | ||
primary?: { | ||
[x: string]: ({ | ||
@@ -1336,2 +859,161 @@ type: "Boolean"; | ||
}; | ||
items?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}); | ||
}; | ||
})[]; | ||
@@ -1338,0 +1020,0 @@ } & { |
import type { NestableWidget } from "../widgets/nestable"; | ||
import type { SliceWidget } from "../widgets/slices"; | ||
import type { SlicePrimaryWidget } from "../widgets/slices"; | ||
import type { Variation } from "../widgets/slices"; | ||
import { type DiffChange } from "./Changes"; | ||
export declare type VariationMetadata = Omit<Variation, "primary" | "items" | "fields">; | ||
export declare type VariationMetadata = Omit<Variation, "primary" | "items">; | ||
export declare type VariationDiff = DiffChange<Variation, Partial<VariationMetadata> & { | ||
primary?: Record<string, DiffChange<NestableWidget, NestableWidget>>; | ||
primary?: Record<string, DiffChange<SlicePrimaryWidget, SlicePrimaryWidget>>; | ||
items?: Record<string, DiffChange<NestableWidget, NestableWidget>>; | ||
fields?: Record<string, DiffChange<SliceWidget, SliceWidget>>; | ||
}>; | ||
@@ -178,321 +177,3 @@ export declare const VariationComparator: { | ||
}; | ||
}); | ||
}; | ||
items?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}); | ||
}; | ||
fields?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Group"; | ||
@@ -668,170 +349,2 @@ } & { | ||
}; | ||
}) | undefined, variationB?: ({ | ||
id: string; | ||
name: string; | ||
description: string; | ||
imageUrl: string; | ||
docURL: string; | ||
version: string; | ||
} & { | ||
display?: string; | ||
primary?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}); | ||
}; | ||
items?: { | ||
@@ -996,3 +509,12 @@ [x: string]: ({ | ||
}; | ||
fields?: { | ||
}) | undefined, variationB?: ({ | ||
id: string; | ||
name: string; | ||
description: string; | ||
imageUrl: string; | ||
docURL: string; | ||
version: string; | ||
} & { | ||
display?: string; | ||
primary?: { | ||
[x: string]: ({ | ||
@@ -1325,3 +847,162 @@ type: "Boolean"; | ||
}; | ||
items?: { | ||
[x: string]: ({ | ||
type: "Boolean"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
}) | ({ | ||
type: "Color"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Date"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}) | ({ | ||
type: "Embed"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
}; | ||
}) | ({ | ||
type: "GeoPoint"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Image"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
constraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
thumbnails?: readonly ({ | ||
name: string; | ||
} & { | ||
width?: number | null; | ||
height?: number | null; | ||
})[]; | ||
}; | ||
}) | ({ | ||
type: "IntegrationFields"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
}) | ({ | ||
type: "Link"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
select?: "media" | "document" | "web" | null; | ||
customtypes?: readonly string[]; | ||
masks?: readonly string[]; | ||
tags?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Number"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "Range"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
}) | ({ | ||
type: "StructuredText"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
useAsTitle?: boolean; | ||
single?: string; | ||
multi?: string; | ||
imageConstraint?: { | ||
width?: number | null; | ||
height?: number | null; | ||
}; | ||
labels?: readonly string[]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
}) | ({ | ||
type: "Select"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default_value?: string; | ||
options?: readonly string[]; | ||
}; | ||
}) | ({ | ||
type: "Separator"; | ||
} & { | ||
config?: { | ||
label?: string | null | undefined; | ||
}; | ||
}) | ({ | ||
type: "Text"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
useAsTitle?: boolean; | ||
placeholder?: string; | ||
}; | ||
}) | ({ | ||
type: "Timestamp"; | ||
} & { | ||
fieldset?: string | null | undefined; | ||
config?: { | ||
label?: string | null | undefined; | ||
placeholder?: string; | ||
default?: string; | ||
}; | ||
}); | ||
}; | ||
}) | undefined): VariationDiff | undefined; | ||
}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
return Object.entries(zippedVariations).reduce((acc, [key, value]) => { | ||
if (key === `primary` || key === "items" || key === "fields") | ||
if (key === `primary` || key === "items") | ||
return acc; | ||
@@ -63,3 +63,2 @@ if ((value === null || value === void 0 ? void 0 : value.left) === (value === null || value === void 0 ? void 0 : value.right)) | ||
const diffItems = compareWidgets(variationA === null || variationA === void 0 ? void 0 : variationA.items, variationB === null || variationB === void 0 ? void 0 : variationB.items); | ||
const diffFields = compareWidgets(variationA === null || variationA === void 0 ? void 0 : variationA.fields, variationB === null || variationB === void 0 ? void 0 : variationB.fields); | ||
const diffVariation = { | ||
@@ -69,3 +68,2 @@ ...diffMeta, | ||
...(diffItems ? { items: diffItems } : {}), | ||
...(diffFields ? { fields: diffFields } : {}), | ||
}; | ||
@@ -72,0 +70,0 @@ if (utils_1.Objects.isNotEmpty(diffVariation)) { |
@@ -6,4 +6,4 @@ export * from "./CompositeSlice"; | ||
export * from "./Slice"; | ||
export * from "./SlicePrimaryWidget"; | ||
export * from "./Slices"; | ||
export * from "./SlicesTypes"; | ||
export * from "./SliceWidget"; |
@@ -9,4 +9,4 @@ "use strict"; | ||
(0, tslib_1.__exportStar)(require("./Slice"), exports); | ||
(0, tslib_1.__exportStar)(require("./SlicePrimaryWidget"), exports); | ||
(0, tslib_1.__exportStar)(require("./Slices"), exports); | ||
(0, tslib_1.__exportStar)(require("./SlicesTypes"), exports); | ||
(0, tslib_1.__exportStar)(require("./SliceWidget"), exports); |
@@ -9,3 +9,3 @@ "use strict"; | ||
const NestableWidget_1 = require("../nestable/NestableWidget"); | ||
const SliceWidget_1 = require("./SliceWidget"); | ||
const SlicePrimaryWidget_1 = require("./SlicePrimaryWidget"); | ||
const IMAGE_PLACEHOLDER_URL = "https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format"; | ||
@@ -23,5 +23,4 @@ exports.Variation = t.exact(t.intersection([ | ||
display: t.string, | ||
primary: t.record(common_1.WidgetKey, NestableWidget_1.NestableWidget), | ||
primary: t.record(common_1.WidgetKey, SlicePrimaryWidget_1.SlicePrimaryWidget), | ||
items: t.record(common_1.WidgetKey, NestableWidget_1.NestableWidget), | ||
fields: t.record(common_1.WidgetKey, SliceWidget_1.SliceWidget), | ||
}), | ||
@@ -28,0 +27,0 @@ ])); |
{ | ||
"name": "@prismicio/types-internal", | ||
"version": "2.4.0-alpha.2", | ||
"version": "2.4.0-alpha.3", | ||
"description": "Prismic types for Custom Types and Prismic Data", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -12,3 +12,7 @@ import { either } from "fp-ts" | ||
} from "../../../../_internal/utils" | ||
import type { SharedSlice, VariationFields } from "../../../../customtypes" | ||
import type { | ||
NestableWidget, | ||
SharedSlice, | ||
VariationFields, | ||
} from "../../../../customtypes" | ||
import { | ||
@@ -157,3 +161,9 @@ getFieldCtx, | ||
const primaryConfig = variationConfig?.primary ?? {} | ||
// Temporarily filtering out group fields and casting to NestableWidget until | ||
// we support group fields in primary | ||
const primaryConfig = Object.fromEntries( | ||
Object.entries(variationConfig?.primary ?? {}).filter( | ||
([_, value]) => value.type !== "Group", | ||
), | ||
) as Record<string, NestableWidget> | ||
const itemsConfig = variationConfig?.items ?? {} | ||
@@ -160,0 +170,0 @@ |
import { Objects } from "../../utils" | ||
import type { NestableWidget } from "../widgets/nestable" | ||
import type { SliceWidget } from "../widgets/slices" | ||
import type { SlicePrimaryWidget } from "../widgets/slices" | ||
import type { Variation } from "../widgets/slices" | ||
import { type DiffChange, DiffOperation } from "./Changes" | ||
export type VariationMetadata = Omit<Variation, "primary" | "items" | "fields"> | ||
export type VariationMetadata = Omit<Variation, "primary" | "items"> | ||
export type VariationDiff = DiffChange< | ||
Variation, | ||
Partial<VariationMetadata> & { | ||
primary?: Record<string, DiffChange<NestableWidget, NestableWidget>> | ||
primary?: Record<string, DiffChange<SlicePrimaryWidget, SlicePrimaryWidget>> | ||
items?: Record<string, DiffChange<NestableWidget, NestableWidget>> | ||
fields?: Record<string, DiffChange<SliceWidget, SliceWidget>> | ||
} | ||
@@ -24,3 +23,3 @@ > | ||
return Object.entries(zippedVariations).reduce((acc, [key, value]) => { | ||
if (key === `primary` || key === "items" || key === "fields") return acc | ||
if (key === `primary` || key === "items") return acc | ||
@@ -32,6 +31,6 @@ if (value?.left === value?.right) return acc | ||
function compareWidgets<T>( | ||
widgetsA?: { [key: string]: T }, | ||
widgetsB?: { [key: string]: T }, | ||
): Record<string, DiffChange<T, T>> | undefined { | ||
function compareWidgets<TWidget extends NestableWidget | SlicePrimaryWidget>( | ||
widgetsA?: { [key: string]: TWidget }, | ||
widgetsB?: { [key: string]: TWidget }, | ||
): Record<string, DiffChange<TWidget, TWidget>> | undefined { | ||
const zippedWidgets = Objects.zipObjects(widgetsA, widgetsB) | ||
@@ -96,3 +95,2 @@ | ||
const diffItems = compareWidgets(variationA?.items, variationB?.items) | ||
const diffFields = compareWidgets(variationA?.fields, variationB?.fields) | ||
@@ -103,3 +101,2 @@ const diffVariation = { | ||
...(diffItems ? { items: diffItems } : {}), | ||
...(diffFields ? { fields: diffFields } : {}), | ||
} | ||
@@ -106,0 +103,0 @@ |
@@ -6,4 +6,4 @@ export * from "./CompositeSlice" | ||
export * from "./Slice" | ||
export * from "./SlicePrimaryWidget" | ||
export * from "./Slices" | ||
export * from "./SlicesTypes" | ||
export * from "./SliceWidget" |
@@ -8,3 +8,3 @@ import * as t from "io-ts" | ||
import type { DynamicSlice, StaticSlice } from "./Slice" | ||
import { SliceWidget } from "./SliceWidget" | ||
import { SlicePrimaryWidget } from "./SlicePrimaryWidget" | ||
@@ -26,5 +26,4 @@ const IMAGE_PLACEHOLDER_URL = | ||
display: t.string, | ||
primary: t.record(WidgetKey, NestableWidget), | ||
primary: t.record(WidgetKey, SlicePrimaryWidget), | ||
items: t.record(WidgetKey, NestableWidget), | ||
fields: t.record(WidgetKey, SliceWidget), | ||
}), | ||
@@ -31,0 +30,0 @@ ]), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
322
2998946
72378