From 011d63d7a96dd5649ca2de8b9795caa2e0e68483 Mon Sep 17 00:00:00 2001 From: Ryan Collins Date: Fri, 21 Jun 2024 16:17:39 +1200 Subject: [PATCH 1/2] Update some types --- src/index.d.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 32390d1..7aeacec 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -466,10 +466,6 @@ export interface BaseInputOptions { } export interface BaseInput { - /** - * Controls the type of input, changing how it is displayed and interacted with. - */ - type?: InputType; /** * Changes the subtext below the _Label_. Has no default. Supports a limited set of Markdown: * links, bold, italic, subscript, superscript, and inline code elements are allowed. @@ -654,6 +650,7 @@ export interface RichTextInput extends BaseInput { } export interface DateInputOptions extends BaseInputOptions { + minimal?: boolean; /** * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the * date is persisted to the file with. Defaults to the global `timezone`. @@ -670,6 +667,11 @@ export interface FileInputOptions extends BaseInputOptions, WithReducedPaths { * Restricts which file types are available to select or upload to this input. */ accepts_mime_types?: MimeType[] | '*'; + /** + * If you have one or more DAMs connected to your site, you can use this key to list which asset + * sources can be uploaded to and selected from. + */ + allowed_sources?: string[]; } export interface FileInput extends BaseInput { @@ -800,8 +802,12 @@ export interface ArrayInput extends BaseInput { type: 'array'; } +export interface UnknownInput extends BaseInput { + type?: undefined | null; +} + export type Input = - | BaseInput + | UnknownInput | TextInput | CodeInput | ColorInput @@ -852,6 +858,10 @@ export interface ReducedPaths { * @default '' */ dam_static?: string; + /** + * When set to true, CloudCannon will reference files relative to the path of the file they were uploaded to. + */ + uploads_use_relative_path?: boolean; } export interface Paths extends ReducedPaths { From 52a71e7f81837b48d8a94c732bf8ef70112853d6 Mon Sep 17 00:00:00 2001 From: Ryan Collins Date: Wed, 26 Jun 2024 16:59:04 +1200 Subject: [PATCH 2/2] Add some more types --- src/index.d.ts | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 7aeacec..9b6a2c3 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -12,7 +12,7 @@ export type EditorKey = 'visual' | 'content' | 'data'; export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc'; // TODO: use SnippetConfig from @cloudcannon/scrap-booker when ParserConfig issue resolved. -interface SnippetConfig extends ReducedCascade, Previewable, PickerPreviewable { +export interface SnippetConfig extends ReducedCascade, Previewable, PickerPreviewable { /** * Name of the snippet. */ @@ -184,12 +184,12 @@ interface ImageResizeable { * A number suffixed with "x" (relative size) or "w" (fixed width) for setting the dimensions of * the image (e.g. 2x, 3x, 100w, 360w). */ - size: 'string'; + size: string; /** * A reference to another input that is given the path to this additional image file. */ - target?: 'string'; - }; + target?: string; + }[]; } export interface Editables { @@ -466,6 +466,7 @@ export interface BaseInputOptions { } export interface BaseInput { + type?: InputType | undefined | null; /** * Changes the subtext below the _Label_. Has no default. Supports a limited set of Markdown: * links, bold, italic, subscript, superscript, and inline code elements are allowed. @@ -650,7 +651,6 @@ export interface RichTextInput extends BaseInput { } export interface DateInputOptions extends BaseInputOptions { - minimal?: boolean; /** * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the * date is persisted to the file with. Defaults to the global `timezone`. @@ -739,6 +739,14 @@ export interface MultichoiceInput extends BaseInput { type: 'multichoice'; } +export interface ObjectInputGroup { + heading?: string; + comment?: string; + collapsed?: boolean; + inputs?: string[]; + documentation?: Documentation; +} + export interface ObjectInputOptions extends BaseInputOptions { /** * Changes the appearance and behavior of the input. @@ -778,6 +786,21 @@ export interface ObjectInputOptions extends BaseInputOptions { * itself. */ structures?: string | Structure; + + /** + * Allows you to group the inputs inside this object together without changing the data structure. + */ + groups?: ObjectInputGroup[]; + + /** + * Controls which order input groups and ungrouped inputs appear in. + */ + place_groups_below?: boolean; + + /** + * Controls whether or not labels on mutable object entries are formatted. + */ + allow_label_formatting?: boolean; } export interface ObjectInput extends BaseInput { @@ -807,6 +830,7 @@ export interface UnknownInput extends BaseInput { } export type Input = + | BaseInput | UnknownInput | TextInput | CodeInput