/** * Standard [IETF locale tag](https://en.wikipedia.org/wiki/IETF_language_tag) like `en` or `en-US`. */ export type LocaleCode = string; /** * An entry field name. It can be written in dot notation like `author.name` if the field is nested * with an Object field. For a List subfield, a wildcard can be used like `authors.*.name`. We call * this a key path, which is derived from the [IndexedDB API * terminology](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Terminology#key_path), * and use it everywhere, as entry data is managed as a [flatten * object](https://www.npmjs.com/package/flat) for easier access. */ export type FieldKeyPath = string; /** * Name of a cloud media storage service with an S3-compatible API. */ export type S3MediaLibraryName = "aws_s3" | "backblaze_b2" | "bunny_storage" | "cloudflare_r2" | "digitalocean_spaces" | "neon_object_storage" | "scaleway_object_storage" | "supabase_storage"; /** * Cloud media storage name. */ export type CloudMediaLibraryName = "cloudinary" | "uploadcare" | "azure_blob_storage" | S3MediaLibraryName; /** * Supported media storage name. */ export type MediaLibraryName = "default" | CloudMediaLibraryName | "stock_assets"; /** * Supported raster image format. HEIC (HEIF) is an input format: browsers other than Safari can’t * display it, so a `heic` or `raster_image` transformation converts it to a format they can. */ export type RasterImageFormat = "avif" | "gif" | "heic" | "jpeg" | "png" | "webp"; /** * Supported vector image format. */ export type VectorImageFormat = "svg"; /** * Supported raster image conversion format. We don’t support AVIF at this time because no browser * supports AVIF encoding natively and `@jsquash/avif` is slow. Meanwhile, browsers other than * Safari support WebP encoding and `@jsquash/webp` is relatively fast. */ export type RasterImageConversionFormat = "webp"; /** * Raster image transformation options. See the * [documentation](https://sveltiacms.app/en/docs/media#image-optimization) for details. */ export type RasterImageTransformationOptions = { /** * New format. Default: `webp`. If the browser * can’t encode WebP, the image may be saved as PNG instead, with the file extension changed * accordingly. */ format?: "webp" | undefined; /** * Image quality as an integer between 0 and 100. Default: `85`. */ quality?: number | undefined; /** * Maximum width in pixels. A wider image is scaled down, keeping the * aspect ratio, while a smaller one is never scaled up. Default: original width. */ width?: number | undefined; /** * Maximum height in pixels. A taller image is scaled down, keeping the * aspect ratio, while a smaller one is never scaled up. Default: original height. */ height?: number | undefined; }; /** * Raster image transformation option map. */ export type RasterImageTransformations = { /** * Raster image transformation options * that apply to any supported raster image format. */ raster_image?: RasterImageTransformationOptions | undefined; /** * AVIF image transformation options. */ avif?: RasterImageTransformationOptions | undefined; /** * GIF image transformation options. */ gif?: RasterImageTransformationOptions | undefined; /** * HEIC image transformation options. */ heic?: RasterImageTransformationOptions | undefined; /** * JPEG image transformation options. */ jpeg?: RasterImageTransformationOptions | undefined; /** * PNG image transformation options. */ png?: RasterImageTransformationOptions | undefined; /** * WebP image transformation options. */ webp?: RasterImageTransformationOptions | undefined; }; /** * Vector image transformation options. */ export type VectorImageTransformationOptions = { /** * Whether to optimize the image with [SVGO](https://svgo.dev/), * which removes unnecessary data such as comments and editor metadata. Default: `false`. */ optimize?: boolean | undefined; }; /** * Vector image transformation option map. */ export type VectorImageTransformations = { /** * SVG image transformation options. */ svg?: VectorImageTransformationOptions | undefined; }; /** * Image transformation option map. */ export type ImageTransformations = RasterImageTransformations & VectorImageTransformations; /** * File transformation option map. */ export type FileTransformations = ImageTransformations; /** * Options shared by the media libraries that accept file uploads. */ export type SharedMediaLibraryOptions = { /** * Maximum file size in bytes that can be accepted for uploading. * Default: `Infinity`, meaning no limit. */ max_file_size?: number | undefined; /** * Whether to rename an original asset file when saving it, * according to the global `slug` option. Default: `false`, meaning that the original file name is * kept by default, while Netlify/Decap CMS forces to slugify file names. If set to `true`, for * example, `Hello World (1).webp` would be `hello-world-1.webp`. */ slugify_filename?: boolean | undefined; /** * Template to rename an uploaded file with, like * `{{slug}}-{{uuid_short}}`. It supports the same tags and transformations as the entry `slug` * option, including `{{slug}}`, `{{fields.title}}`, date/time tags and `{{uuid}}`, as well as * `{{filename}}` and `{{extension}}` for the original file name and extension. The extension is * always appended, so the template shouldn’t include it. The values of the tags are slugified, and * the entry tags are filled with the default locale’s content when the entry is saved. A file * uploaded to a cloud storage service from an entry is named right away with the content at that * time, and a tag with no value yet gets a random one. A file uploaded in the asset library has no * entry, so only the other tags make sense there. Cloudinary keeps the name as the original file * name of an asset whose public ID is generated. A file renamed by hand before saving keeps that * name, and a file replacing an existing asset takes over its name. Default: `undefined`, meaning * that the original file name is kept, or slugified if the `slugify_filename` option is enabled. */ filename_template?: string | undefined; /** * File transformation option map. The key is an * original format like `png` or `jpeg`. It can also be `raster_image` that matches any supported * raster image format. See the * [documentation](https://sveltiacms.app/en/docs/media#image-optimization) for details. */ transformations?: ImageTransformations | undefined; }; /** * Configuration for the default media storage. */ export type DefaultMediaLibraryBaseConfig = { /** * Whether to allow multiple file selection in the media storage. * This option is available for compatibility with the Cloudinary and Uploadcare media storage * providers, but you can simply use the `multiple` option for the File/Image field types instead, * which takes precedence over this option. */ multiple?: boolean | undefined; }; /** * Configuration for the default media storage. */ export type DefaultMediaLibraryConfig = SharedMediaLibraryOptions & DefaultMediaLibraryBaseConfig; /** * Options for the default media storage. */ export type DefaultMediaLibrary = { /** * Configuration for the default media storage. */ config?: DefaultMediaLibraryConfig | undefined; }; /** * Options for the [Cloudinary media storage](https://sveltiacms.app/en/docs/media/cloudinary). */ export type CloudinaryMediaLibrary = { /** * Whether to output a file name instead of a full URL. * Default: `false`. */ output_filename_only?: boolean | undefined; /** * Whether to include transformation segments in an output * URL. Default: `true`. */ use_transformations?: boolean | undefined; /** * Options to be passed to the Cloudinary Media Library * widget, such as `multiple`, `max_files`, `default_transformations` and `folder`. The `cloud_name` * and `api_key` options are required. A field-level `config` is merged over the site-level one, so * the credentials only need to be set at the site level. See the [Cloudinary * documentation](https://cloudinary.com/documentation/media_library_widget#2_set_the_configuration_options) * for a full list of available options. The `multiple` option is overridden by the field’s own * `multiple` option, and `max_files` by the field’s `max` option. Default `max_files`: `20`. */ config?: Record | undefined; }; /** * Settings for the [Uploadcare media storage](https://sveltiacms.app/en/docs/media/uploadcare). */ export type UploadcareMediaLibrarySettings = { /** * Whether to append a file name to an output URL. Default: * `false`. */ autoFilename?: boolean | undefined; /** * [Transformation * operations](https://uploadcare.com/docs/transformations/image/) to be included in the output URL * of an image, starting with a slash, e.g. `/resize/800x600/`. Default: none. */ defaultOperations?: string | undefined; }; /** * Options for the [Uploadcare media storage](https://sveltiacms.app/en/docs/media/uploadcare). */ export type UploadcareMediaLibrary = { /** * Options to be passed to Uploadcare, such as `multiple`. * The `publicKey` option is required. A field-level `config` is merged over the site-level one, so * the key can be set at either the site or field level. The `cdnBase` option sets the CDN origin * used in output URLs. Default: the origin of the file URL returned by Uploadcare, typically * `https://ucarecdn.com`. See the [Uploadcare * documentation](https://uploadcare.com/docs/uploads/file-uploader-options/) for a full list of * available options. Some options, including `previewStep`, will be ignored in Sveltia CMS because * we use an API-based integration instead of Uploadcare’s deprecated jQuery File Uploader. */ config?: Record | undefined; /** * Integration settings. Field-level settings * are merged over the site-level ones. */ settings?: UploadcareMediaLibrarySettings | undefined; }; /** * Options for S3-compatible media libraries. */ export type S3MediaLibrary = { /** * Name to show for the service in the Asset Library, the Select Assets * dialog and the Settings dialog, instead of the default one, e.g. `Garage` for a self-hosted * server configured as `aws_s3`. It’s not localized, and it’s only read from the site-level * options, so it’s ignored in the `media_libraries` option of a field. Default: the service name, * e.g. `Amazon S3`. */ label?: string | undefined; /** * AWS access key ID or equivalent (safe to store in config). * Required for all services except Bunny Storage, where it defaults to `bucket`, as the storage * zone name serves as the access key ID. */ access_key_id?: string | undefined; /** * Bucket name. For Bunny Storage, this is the storage zone name. */ bucket: string; /** * Region, e.g. `us-east-1`. Required for Amazon S3, Backblaze B2, Bunny * Storage (two-letter storage region code, e.g. `de`), DigitalOcean Spaces and Scaleway Object * Storage. For Supabase Storage, set it to the project’s region; it defaults to `us-east-1`. For * Neon Object Storage, it defaults to the region in the `endpoint` hostname. * Ignored for Cloudflare R2, which always uses `auto`. With a custom `endpoint`, it’s only used to * sign requests and must match the server’s region, e.g. Garage’s `s3_region` (`garage` by * default) or MinIO’s `us-east-1`; otherwise every request fails with a signature mismatch. */ region?: string | undefined; /** * Cloudflare account ID. Required for Cloudflare R2. */ account_id?: string | undefined; /** * Cloudflare R2 jurisdiction. Required for * buckets created in the EU or FedRAMP jurisdictions; the global endpoint returns an error for * those buckets. Default: `'default'`. */ jurisdiction?: "default" | "eu" | "fedramp" | undefined; /** * Supabase project reference ID. Required for Supabase Storage. */ project_id?: string | undefined; /** * Custom endpoint URL for another S3-compatible service, such as a * self-hosted Garage or MinIO server, configured as `aws_s3`, e.g. `https://s3.example.com`. * Objects are addressed with path-style URLs (`{endpoint}/{bucket}/{key}`), so no wildcard DNS is * needed. Required for Neon Object Storage; set it to the branch’s `AWS_ENDPOINT_URL_S3` shown in * the Neon Console, e.g. `https://br-cool-darkness-a1b2c3d4.storage.c-1.us-east-2.aws.neon.tech`. * Ignored for the other services, whose endpoints are derived from their own options. */ endpoint?: string | undefined; /** * Path prefix within the bucket, e.g. `uploads/`. A trailing slash is * added if missing. In the `media_libraries` option of a field, it can contain template tags to * keep the files of an entry in a folder of their own, e.g. `{{fields.release}}/`. Each value is * slugified, and files can’t be listed or uploaded until the fields it depends on are filled in. * The tags aren’t supported at the site level, where there’s no entry to read the values from. */ prefix?: string | undefined; /** * Whether to use path-style URLs * (`https://s3.region.amazonaws.com/bucket/key`) instead of virtual-hosted-style URLs * (`https://bucket.s3.region.amazonaws.com/key`) for Amazon S3. Path-style URLs are always used * with a custom `endpoint`. Default: `false`. */ force_path_style?: boolean | undefined; /** * Base URL for public asset access. When set, asset preview and * download URLs are constructed as `{public_url}/{key}` instead of the S3 API endpoint URL. * Required for Cloudflare R2 (S3 API endpoint always requires authentication); set to the `r2.dev` * development URL (e.g. `https://pub-abcd1234.r2.dev`) or a custom domain. Also required for Bunny * Storage; set to the hostname of a pull zone connected to the storage zone (e.g. * `https://my-zone.b-cdn.net`) or a custom domain. Optional for Amazon S3 and DigitalOcean Spaces — * use when serving assets through a CDN or custom domain (e.g. CloudFront or Route 53 for S3, CDN * endpoint for Spaces). Backblaze B2, DigitalOcean Spaces, Scaleway Object Storage and Supabase * Storage have a default public URL derived from the other options. For Neon Object Storage, the * default `{endpoint}/{bucket}/{key}` URL only works with a `public_read` bucket; set `public_url` * for a private bucket fronted by a CDN. */ public_url?: string | undefined; }; /** * Options for the Azure Blob Storage media library. Unlike the S3-compatible services, which are * authorized with an access key pair, the Blob service is accessed with a [shared access signature * (SAS)](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview) token that * each user enters in the CMS’s Settings dialog, so no credential belongs in this configuration. * The token needs the Read, Write, Create and List permissions on the container, and the storage * account needs a [CORS * rule](https://learn.microsoft.com/en-us/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) * that allows the `GET`, `PUT` and `OPTIONS` methods along with the `x-ms-blob-type` and * `content-type` headers from the CMS’s origin. */ export type AzureMediaLibrary = { /** * Name to show for the service in the Asset Library, the Select Assets * dialog and the Settings dialog, instead of the default one, e.g. the name of a server configured * with `endpoint`. It’s not localized, and it’s only read from the site-level options, so * it’s ignored in the `media_libraries` option of a field. Default: the service name, e.g. * `Azure Blob Storage`. */ label?: string | undefined; /** * Storage account name. Required unless `endpoint` is given. */ account_name?: string | undefined; /** * Blob container name. */ container: string; /** * Custom Blob service endpoint including the account, such as a * custom domain or the Azurite emulator URL. Overrides `account_name`. */ endpoint?: string | undefined; /** * Path prefix within the container, e.g. `uploads/`. A trailing slash * is added if missing. In the `media_libraries` option of a field, it can contain template tags to * keep the files of an entry in a folder of their own, e.g. `{{fields.release}}/`. Each value is * slugified, and files can’t be listed or uploaded until the fields it depends on are filled in. * The tags aren’t supported at the site level, where there’s no entry to read the values from. */ prefix?: string | undefined; /** * Base URL for public asset access. When set, asset download URLs * are constructed as `{public_url}/{blob_name}` instead of the Blob service URL. Required unless * the container allows anonymous read access, because the URL stored in an entry can’t contain the * SAS token, which expires. Set it to an Azure CDN or Front Door endpoint, or a custom domain. */ public_url?: string | undefined; }; /** * Name of supported stock photo/video provider. */ export type StockAssetProviderName = "pexels" | "picsum" | "pixabay" | "unsplash"; /** * Options for the unified stock photo/video providers. */ export type StockMediaLibrary = { /** * Enabled stock photo/video providers. The stock * photo/video section in the asset browser is hidden if an empty array is given. Default: all * supported providers. */ providers?: StockAssetProviderName[] | undefined; }; /** * Supported cloud media storage options. */ export type CloudMediaLibrary = CloudinaryMediaLibrary | UploadcareMediaLibrary | S3MediaLibrary | AzureMediaLibrary; /** * Supported [media storage](https://sveltiacms.app/en/docs/media). */ export type MediaLibrary = DefaultMediaLibrary | CloudMediaLibrary | StockMediaLibrary; /** * Options of a named media storage in the legacy `media_library` option, identified by its `name`, * so the options are checked against those of that storage. */ export type NamedLegacyMediaLibrary = (CloudinaryMediaLibrary & { name: "cloudinary"; }) | (UploadcareMediaLibrary & { name: "uploadcare"; }) | (S3MediaLibrary & { name: S3MediaLibraryName; }) | (AzureMediaLibrary & { name: "azure_blob_storage"; }) | (StockMediaLibrary & { name: "stock_assets"; }); /** * Global legacy media storage option, which applies to the default media storage without a `name`. */ export type GlobalLegacyMediaLibrary = (DefaultMediaLibrary & { name?: "default"; }) | NamedLegacyMediaLibrary; /** * Field-level legacy media storage option without a `name`, which applies to the storage named in * the global `media_library` option, so its options can be those of any storage. */ export type UnnamedLegacyMediaLibrary = MediaLibrary & { name?: undefined; }; /** * Options of a named media storage in the field-level legacy `media_library` option. They’re merged * over the global options of the same storage, so the options the storage requires, such as an S3 * `bucket`, can be left to the global ones. */ export type FieldNamedLegacyMediaLibrary = (CloudinaryMediaLibrary & { name: "cloudinary"; }) | (UploadcareMediaLibrary & { name: "uploadcare"; }) | (Partial & { name: S3MediaLibraryName; }) | (Partial & { name: "azure_blob_storage"; }) | (StockMediaLibrary & { name: "stock_assets"; }); /** * Field-level legacy media storage option. */ export type FieldLegacyMediaLibrary = (DefaultMediaLibrary & { name: "default"; }) | FieldNamedLegacyMediaLibrary | UnnamedLegacyMediaLibrary; /** * Options of a storage in the `media_libraries` option, on top of the storage’s own options. The * legacy `media_library` option configures a single storage, so they’re not available there. */ export type MediaLibrarySelectionOptions = { /** * Whether the Select Assets dialog opens on the storage instead of * the first repository folder, so files aren’t uploaded to the repository by mistake. Set it on one * storage only; if more are marked, the first one offered wins. A storage marked at the field level * takes precedence over one marked at the site level, and `false` clears the mark of a storage * marked at the site level. Set it on the default storage in a field to open the repository folder * again. Default: `false`. */ default?: boolean | undefined; }; /** * Options of the media storages in the `media_libraries` option that are the same at the global and * field levels. */ export type CommonMediaLibraries = { /** * Default options that apply to the default media * storage and to files uploaded to the cloud storage services, except for Cloudinary, which uses * its own widget. For the default media storage, these options can be overridden by the options in * `default.config` at the same level. Field-level `all` options take precedence over global * `default.config` options. */ all?: SharedMediaLibraryOptions | undefined; /** * Options for * the default media storage. Set to `false` to explicitly disable the default (internal) storage. */ default?: false | (DefaultMediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the Cloudinary media storage. Set to `false` to explicitly disable. */ cloudinary?: false | (CloudinaryMediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the Uploadcare media storage. Set to `false` to explicitly disable. */ uploadcare?: false | (UploadcareMediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the unified stock photo/video * media library. Set to `false` to explicitly disable. */ stock_assets?: false | StockMediaLibrary | undefined; }; /** * Options of the cloud storages in the global `media_libraries` option. */ export type GlobalCloudMediaLibraries = { /** * Options for the * Amazon S3 media storage. Set to `false` to explicitly disable. */ aws_s3?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the Azure Blob Storage media storage. Set to `false` to explicitly disable. */ azure_blob_storage?: false | (AzureMediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for * the Cloudflare R2 media storage. Set to `false` to explicitly disable. */ cloudflare_r2?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the DigitalOcean Spaces media storage. Set to `false` to explicitly disable. */ digitalocean_spaces?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for * the Backblaze B2 media storage. Set to `false` to explicitly disable. */ backblaze_b2?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for * the Bunny Storage media storage. Set to `false` to explicitly disable. */ bunny_storage?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the Neon Object Storage media storage. Set to `false` to explicitly disable. */ neon_object_storage?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options for the Scaleway Object Storage media storage. Set to `false` to explicitly disable. */ scaleway_object_storage?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; /** * Options * for the Supabase Storage media storage. Set to `false` to explicitly disable. */ supabase_storage?: false | (S3MediaLibrary & MediaLibrarySelectionOptions) | undefined; }; /** * Options of the cloud storages in the field-level `media_libraries` option. Unlike the global * ones, they’re all optional. */ export type FieldCloudMediaLibraries = { /** * Options * for the Amazon S3 media storage. Set to `false` to explicitly disable. */ aws_s3?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Azure Blob Storage media storage. Set to `false` to * explicitly disable. */ azure_blob_storage?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Cloudflare R2 media storage. Set to `false` to explicitly disable. */ cloudflare_r2?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the DigitalOcean Spaces media storage. Set to `false` to * explicitly disable. */ digitalocean_spaces?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Backblaze B2 media storage. Set to `false` to explicitly disable. */ backblaze_b2?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Bunny Storage media storage. Set to `false` to explicitly disable. */ bunny_storage?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Neon Object Storage media storage. Set to `false` to * explicitly disable. */ neon_object_storage?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Scaleway Object Storage media storage. Set to `false` * to explicitly disable. */ scaleway_object_storage?: false | (Partial & MediaLibrarySelectionOptions) | undefined; /** * Options for the Supabase Storage media storage. Set to `false` to explicitly disable. */ supabase_storage?: false | (Partial & MediaLibrarySelectionOptions) | undefined; }; /** * Unified media storage option that supports multiple storage providers. See the * [documentation](https://sveltiacms.app/en/docs/media#configuration) for details. */ export type MediaLibraries = CommonMediaLibraries & GlobalCloudMediaLibraries; /** * Field-level `media_libraries` option. The options of a storage are merged over the global options * of the same storage, so the options the storage requires, such as an S3 `bucket`, can be left to * the global ones. */ export type FieldMediaLibraries = CommonMediaLibraries & FieldCloudMediaLibraries; /** * Parsed, localized entry content. */ export type RawEntryContent = Record; /** * Common field properties that are shared among all field types, except for the `i18n` option, * whose accepted values depend on the field type. */ export type BaseFieldProps = { /** * Unique identifier for the field among its sibling fields. It cannot * contain spaces, periods, asterisks, colons or angle brackets. */ name: string; /** * Label of the field to be displayed in the editor UI. Default: `name` * field value. */ label?: string | undefined; /** * Labels for specific locales, keyed by * locale code, taking precedence over `label`. The editor shows the label for the locale being * edited; elsewhere, the label for the UI locale is used. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ label_localized?: Record | undefined; /** * Comment to be written before the field in a YAML file or YAML front * matter, for developers reading the file. It’s not displayed in the editor UI; use `hint` for * that. A line break can be given as `\n`. The comment on a subfield of an Object field is written * before the subfield, while the one on a subfield of a List field or a variable-type Object field * is ignored. TOML and JSON files don’t support comments. */ comment?: string | undefined; }; /** * Field-level i18n strategy supported by every field type. Some field types support another * strategy as well: see {@link KeyValueFieldI18nProps} and {@link SimpleFieldI18nProps}. */ export type FieldI18nStrategy = boolean | "duplicate" | "sync" | "translate" | "none"; /** * Field-level i18n option shared among most field types. */ export type FieldI18nProps = { /** * Whether to enable the editor UI in locales other than the * default locale. Default: `false`, or the option of a field using `duplicate` or `sync` for its * subfield. `duplicate` makes the field read-only in non-default locales and automatically copies * the default locale’s value to them. `sync` keeps the value the same in every locale as well, but * the field can be edited in any locale, and the value is copied from there to the others. In a * rich text editor component, whose values are stored in each locale’s text, it works like * `translate`. `translate` and `none` are aliases of `true` and `false`, respectively. This option * only works when i18n is set up with the global and collection-level `i18n` option. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#field-level-configuration) for * details. */ i18n?: FieldI18nStrategy | undefined; }; /** * Field-level i18n option for the KeyValue field, which supports the `duplicate_keys` strategy in * addition to the common ones. */ export type KeyValueFieldI18nProps = { /** * Whether to enable the editor UI in * locales other than the default locale. Default: `false`, or the option of a field using * `duplicate` or `sync` for its subfield. `duplicate` makes the field read-only in non-default * locales and automatically copies the default locale’s key-value pairs to them. `sync` keeps the * pairs the same in every locale as well, but the field can be edited in any locale, and the pairs * are copied from there to the others, except in a rich text editor component, where it works like * `translate`. `duplicate_keys` copies the keys only: the keys are read-only in non-default locales * and kept in sync with the default locale, while the values can be edited in each locale. * `translate` and `none` are aliases of `true` and `false`, respectively. This option only works * when i18n is set up with the global and collection-level `i18n` option. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#field-level-configuration) for * details. */ i18n?: FieldI18nStrategy | "duplicate_keys" | undefined; }; /** * Field-level i18n option for the fields holding a single, simple value, which support the * `duplicate_if_empty` strategy in addition to the common ones. */ export type SimpleFieldI18nProps = { /** * Whether to enable the editor UI in * locales other than the default locale. Default: `false`, or the option of a field using * `duplicate` or `sync` for its subfield. `duplicate` makes the field read-only in non-default * locales and automatically copies the default locale’s value to them. `sync` keeps the value the * same in every locale as well, but the field can be edited in any locale, and the value is copied * from there to the others, except in a rich text editor component, where it works like * `translate`. `duplicate_if_empty` copies the default locale’s value to non-default locales only * where the value is empty, or still the same as the default locale’s value, while the field can be * edited in every locale. It’s not supported for a File, Image, Relation or Select field that * accepts multiple values. `translate` and `none` are aliases of `true` and `false`, respectively. * This option only works when i18n is set up with the global and collection-level `i18n` option. * See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#field-level-configuration) for * details. */ i18n?: FieldI18nStrategy | "duplicate_if_empty" | undefined; }; /** * Common field properties that are shared among all field types. */ export type CommonFieldProps = BaseFieldProps & FieldI18nProps; /** * Common field properties that are shared among the fields holding a single, simple value. */ export type SimpleCommonFieldProps = BaseFieldProps & SimpleFieldI18nProps; /** * Properties for a field that is visible in the editor UI. */ export type VisibleFieldProps = { /** * Help message to be displayed below the input UI. Limited Markdown * formatting is supported: bold, italic, strikethrough, inline code and links. A line break can be * given as a literal backslash followed by `n`, e.g. `\n` in a plain or single-quoted YAML string; * in JSON or a double-quoted string, the backslash itself has to be escaped. The hint is not * displayed while the field is read-only. */ hint?: string | undefined; /** * Help messages for specific locales, keyed * by locale code, taking precedence over `hint`. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ hint_localized?: Record | undefined; /** * Whether to show the preview of the field. Default: `true`. */ preview?: boolean | undefined; /** * Whether to make data input on the field required. * Default: `true`. This option also affects data output if the `omit_empty_optional_fields` global * output option is `true`. If i18n is enabled and the field doesn’t require input in all locales, * required locale codes can be passed as an array like `[en, fr]` instead of a boolean. */ required?: boolean | string[] | undefined; /** * Whether to make the field read-only. Default: `false`, or `true` * for the UUID field type. This is useful when a `default` value is provided and the field should * not be editable by users. */ readonly?: boolean | undefined; }; /** * Field validation properties. */ export type FieldValidationProps = { /** * Validation format. The first argument is a * regular expression matching pattern for a valid input value, and the second argument is an error * message to be displayed when the input value does not match the pattern. */ pattern?: [string | RegExp, string] | undefined; }; /** * Media field properties. */ export type MediaFieldProps = { /** * Default value. Accepts a file path or complete URL. If * the `multiple` option is set to `true`, it accepts an array of file paths or URLs. */ default?: string | string[] | undefined; /** * Default values for specific * locales, keyed by locale code. A value given for a locale takes precedence over `default` in that * locale. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ default_localized?: Record | undefined; /** * Whether to allow multiple file selection for the field. Default: * `false`, unless the `multiple` option is enabled in a media library’s `config`. */ multiple?: boolean | undefined; /** * Minimum number of files that can be selected. Ignored unless the * `multiple` option is set to `true`. Default: `0`. */ min?: number | undefined; /** * Maximum number of files that can be selected. Ignored unless the * `multiple` option is set to `true`. Default: `Infinity`. */ max?: number | undefined; /** * File types that the field should accept. The value would be a * comma-separated list of unique file type specifiers, the format used for the HTML * [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept) * attribute. Default: any file for a File field; the supported image formats for an Image field, * including HEIC if a `heic` or `raster_image` transformation is defined. */ accept?: string | undefined; /** * Whether to show the URL input UI. Default: `true`. */ choose_url?: boolean | undefined; /** * Internal media folder path for the field. Default: global or * collection-level `media_folder` value. */ media_folder?: string | undefined; /** * Public media folder path for the field. Default: * `media_folder` option value. */ public_folder?: string | undefined; /** * Legacy media storage option * that allows only one library. It overrides the global options of the same library in the same way * as `media_libraries`; without a `name`, it applies to the library named in the global * `media_library` option. Use `media_libraries` instead to support multiple libraries. */ media_library?: FieldLegacyMediaLibrary | undefined; /** * Unified media storage option that supports * multiple libraries. Each library’s options, including `all`, are merged over the same library’s * global options, one level deep, so a field only needs to set what it overrides: nested objects * such as `config` are merged key by key, while other values, including arrays, are replaced. * `false` disables the library for the field. Libraries not defined here fall back to the global * configuration. */ media_libraries?: FieldMediaLibraries | undefined; }; /** * Options for a field accepting multiple values. */ export type MultiValueFieldProps = { /** * Minimum number of items that can be added. Default: `0`. */ min?: number | undefined; /** * Maximum number of items that can be added. Default: `Infinity`. */ max?: number | undefined; }; /** * Options for a field showing multiple options. */ export type MultiOptionFieldProps = { /** * Whether to accept multiple values. Default: `false`. */ multiple?: boolean | undefined; /** * Minimum number of items that can be selected. Ignored if `multiple` is * `false`. Default: `0`. */ min?: number | undefined; /** * Maximum number of items that can be selected. Ignored if `multiple` is * `false`. Default: `Infinity`. */ max?: number | undefined; /** * Maximum number of options to be displayed as radio * buttons (single-select) or checkboxes (multi-select) rather than a dropdown list. Default: `5`. */ dropdown_threshold?: number | undefined; }; /** * Validation options for a field that can take multiple values. */ export type MultiValueFieldValidationProps = { /** * Validation format. The first argument is a * regular expression matching pattern for a valid input value, and the second argument is an error * message to be displayed when the input value does not match the pattern. If the field takes * multiple values, like Decap CMS, the pattern is tested against all the values joined with commas, * e.g. `foo,bar,baz`, rather than against each value, and not at all while the field is empty. * Numbers are tested as strings, and a file just uploaded is tested by its name. */ pattern?: [string | RegExp, string] | undefined; }; /** * Variable type for List/Object fields. */ export type VariableFieldType = { /** * Unique identifier for the type. */ name: string; /** * Label of the type to be displayed in the editor UI. Default: `name` * field value. */ label?: string | undefined; /** * Labels of the type for specific * locales, keyed by locale code, taking precedence over `label`. */ label_localized?: Record | undefined; /** * Field type. Only `object` is supported: another value is a * configuration error. */ widget?: "object" | undefined; /** * Short description of the type to be displayed below its label * in the menu of the Add button. */ description?: string | undefined; /** * Help message to be displayed above the subfields of an object of the * type. Limited Markdown formatting is supported, as with a field’s `hint` option. The hint is not * displayed while the field is read-only. */ hint?: string | undefined; /** * Help messages of the type for specific * locales, keyed by locale code, taking precedence over `hint`. */ hint_localized?: Record | undefined; /** * Template of a label to be displayed on a collapsed object. */ summary?: string | undefined; /** * Set of subfields. This option can be omitted; in that case, only the * `type` property will be saved. */ fields?: Field[] | undefined; }; /** * Variable field properties. */ export type VariableFieldProps = { /** * Set of nested Object fields to be selected or added. */ types: VariableFieldType[]; /** * Property name to store the type name in nested objects. Default: * `type`. */ typeKey?: string | undefined; }; /** * Options for a field with a simple input UI that allows for extra labels. */ export type AdjacentLabelProps = { /** * An extra label to be displayed before the input UI. Markdown is * supported. Default: empty string. */ before_input?: string | undefined; /** * An extra label to be displayed after the input UI. Markdown is * supported. Default: empty string. */ after_input?: string | undefined; }; /** * Options for a field with a string-type input UI that counts the number of characters. */ export type CharCountProps = { /** * Minimum number of characters that can be entered in the input. * Default: `0`. */ minlength?: number | undefined; /** * Maximum number of characters that can be entered in the input. * Default: `Infinity`. */ maxlength?: number | undefined; }; /** * Options for a field whose value can be required to be unique within the collection. */ export type UniqueValueProps = { /** * Whether the value must be different from the value of the same * field in every other entry of the collection, like a `UNIQUE` constraint in a relational * database. An empty value is not checked; combine it with `required: true` to make sure every * entry has a distinct value. Only available in an entry collection, and ignored for a field that * takes multiple values, or a field in a List field or a rich text editor component. A Color field * value is compared regardless of case, a Number field value by its numeric value, and a File or * Image field value just uploaded isn’t compared, as it’s a new file. Default: `false`. */ unique?: boolean | undefined; }; /** * Boolean field properties. */ export type BooleanFieldProps = { /** * Field type. */ widget: "boolean"; /** * Default value. Accepts `true` or `false`. Default: `false`. */ default?: boolean | undefined; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for * details. */ default_localized?: Record | undefined; }; /** * Boolean field definition. */ export type BooleanField = CommonFieldProps & VisibleFieldProps & BooleanFieldProps & AdjacentLabelProps; /** * Code field properties. */ export type CodeFieldProps = { /** * Field type. */ widget: "code"; /** * Default value. It must be a string if * `output_code_only` is `true`. Otherwise it should be an object that matches the `keys` option, * like `{ code: 'let x = 1;', lang: 'js' }`; a string is used as the code. */ default?: string | Record | undefined; /** * Default * values for specific locales, keyed by locale code. A value given for a locale takes precedence * over `default` in that locale. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ default_localized?: Record> | undefined; /** * Default language to be selected, like `js`. See the [Shiki * documentation](https://shiki.style/languages) for a list of supported languages. Default: empty * string, which is plaintext. */ default_language?: string | undefined; /** * Whether to show a language switcher so that users * can change the language mode. Default: `true` (the Decap CMS document is wrong). */ allow_language_selection?: boolean | undefined; /** * Whether to save the code only, as a string, instead of an * object containing the code and the language. Default: `false`. */ output_code_only?: boolean | undefined; /** * Output property names. It has no effect if * `output_code_only` is `true`. Default: `{ code: 'code', lang: 'lang' }`. */ keys?: { code: string; lang: string; } | undefined; }; /** * Code field definition. */ export type CodeField = SimpleCommonFieldProps & VisibleFieldProps & FieldValidationProps & CodeFieldProps; /** * Color field properties. */ export type ColorFieldProps = { /** * Field type. */ widget: "color"; /** * Default value. Accepts a Hex color code in the six-value (`#RRGGBB`) * or eight-value (`#RRGGBBAA`) syntax. */ default?: string | undefined; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for * details. */ default_localized?: Record | undefined; /** * Whether to show a textbox that allows users to manually edit the * value. Default: `false`. */ allowInput?: boolean | undefined; /** * Whether to edit/save the alpha channel value. Default: `false`. */ enableAlpha?: boolean | undefined; }; /** * Color field definition. */ export type ColorField = CommonFieldProps & VisibleFieldProps & FieldValidationProps & ColorFieldProps & UniqueValueProps; /** * Compute field properties. */ export type ComputeFieldProps = { /** * Field type. */ widget: "compute"; /** * Value template, like `posts-{{fields.slug}}`. Besides the `fields.*` * tags, which support transformations like `{{fields.title | upper}}`, `{{index}}` is the position * of the item in a list, which is saved as a number when used alone, and `{{uuid}}`, * `{{uuid_short}}` and `{{uuid_shorter}}` generate a UUID, which is kept once the value is saved. * In a list item, a `*` in a `fields.*` tag stands for the current item, so * `{{fields.lines.*.price}}` is the price of the item the field is in. With a numeric * `value_type`, it’s an arithmetic expression instead, like `{{fields.price}} * * {{fields.quantity}}`, which can have numbers, template tags other than the UUID tags, the `+`, * `-`, `*`, `/` and `%` operators, parentheses, the `abs`, `ceil`, `floor` and `round` functions * and the `avg`, `count`, `max`, `min` and `sum` aggregate functions, in which the last `*` of a * tag stands for every item of the list, like `sum({{fields.lines.*.amount}})`, and empty values * are left out. The field is always hidden in the editor, and its value can’t be edited. */ value: string; /** * Type of the * value. `string` makes the `value` option a template and saves the result as a string. The other * types make it an arithmetic expression: `int` and `float` save the result as an integer or a * floating-point number, respectively, and `int/string` and `float/string` save it as a string. * An integer is rounded to the nearest one, and the result is left empty if a template tag resolves * to an empty value or something other than a number. Default: `string`. */ value_type?: "string" | "float" | "int" | "int/string" | "float/string" | undefined; }; /** * Compute field definition. */ export type ComputeField = CommonFieldProps & VisibleFieldProps & ComputeFieldProps; /** * DateTime input type. It’s based on the supported date/time input types defined in the HTML spec. */ export type DateTimeInputType = "datetime-local" | "date" | "time"; /** * DateTime field properties. */ export type DateTimeFieldProps = { /** * Field type. */ widget: "datetime"; /** * Default value. Accepts a date/time string that matches the `format`, * or `{{now}}` to populate the current date/time. Default: empty string. */ default?: string | undefined; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for * details. */ default_localized?: Record | undefined; /** * The * [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types) * HTML attribute value for the date/time input. If `type` is set to `date`, the input will only * accept date values and the time part will be disabled. If `type` is set to `time`, the input will * only accept time values and the date part will be disabled. Default: `datetime-local`, which * accepts both date and time values. */ type?: DateTimeInputType | undefined; /** * The * [`min`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/min) HTML * attribute value for the date/time input. The expected format depends on the `type` option: * `YYYY-MM-DDTHH:mm` for `datetime-local`, `YYYY-MM-DD` for `date`, and `HH:mm` for `time`. */ min?: string | undefined; /** * The * [`max`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/max) HTML * attribute value for the date/time input. The expected format depends on the `type` option: * `YYYY-MM-DDTHH:mm` for `datetime-local`, `YYYY-MM-DD` for `date`, and `HH:mm` for `time`. * Default: `9999-12-31T23:59` for `datetime-local`, `9999-12-31` for `date`, and none for `time`. */ max?: string | undefined; /** * The * [`step`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/step) HTML * attribute value for the date/time input. Accepts a positive integer or `'any'`. For * `datetime-local` and `time` inputs, the integer represents the step in seconds (e.g. `300` for * 5-minute steps). For `date` inputs, the integer represents the step in days (e.g. `7` for weekly * steps). Default: `60` seconds for `datetime-local` and `time`; `1` day for `date`. */ step?: number | "any" | undefined; /** * Storage format written in [Day.js * tokens](https://day.js.org/docs/en/display/format). Default: ISO 8601 format. */ format?: string | undefined; /** * Date storage format written in [Day.js * tokens](https://day.js.org/docs/en/display/format) if the value is a string and the `format` * option is not defined. If `true`, ISO 8601 format is used unless the `format` option is defined. * If `false`, date input/output is disabled. This option is available for backward compatibility * with Netlify CMS; use the `format` or `type` option instead. */ date_format?: string | boolean | undefined; /** * Time storage format written in [Day.js * tokens](https://day.js.org/docs/en/display/format) if the value is a string and the `format` * option is not defined. If `true`, ISO 8601 format is used unless the `format` option is defined. * If `false`, time input/output is disabled. This option is available for backward compatibility * with Netlify CMS; use the `format` or `type` option instead. */ time_format?: string | boolean | undefined; /** * Whether to write the month and weekday names, * the AM/PM marker and other locale-dependent parts of the `format` in a language other than * English. If `true`, the locale of the content the value belongs to is used, so each locale of an * i18n-enabled entry gets the value in its own language, and a value copied to another locale, as * with the `duplicate` i18n strategy, is written again in that locale. A locale code like `de` or * `pt-BR` uses that locale for every value, which also works without i18n. The value is parsed in * the same locale. The locale data is loaded from a CDN, or bundled with the npm package; a locale * Day.js doesn’t support falls back to English. Ignored without a custom format, as an ISO 8601 * value doesn’t depend on the locale. Default: `false`. */ localize_format?: string | boolean | undefined; /** * Whether to make the date input/output UTC. Default: `false`. * This option is available for backward compatibility with Netlify/Decap CMS. The newer * `input_timezone` and `output_utc` options provide more flexibility and supersede this option when * explicitly set. `picker_utc: true` is equivalent to `input_timezone: 'utc'`. */ picker_utc?: boolean | undefined; /** * Timezone used by the date/time input. This * option supersedes `picker_utc`. If set to `local`, the browser’s local timezone is used. If set * to `utc`, UTC is used. A custom IANA timezone name such as `America/New_York` or `Asia/Tokyo` may * also be provided as a string. Default: `local`. */ input_timezone?: string | undefined; /** * Whether to convert stored values to UTC. This option supersedes * `picker_utc`. If `false`, output values preserve the timezone semantics of `input_timezone`: * `local` omits timezone information, `utc` appends a `Z` suffix, and custom timezones preserve * their offset (e.g., `-05:00`). If `true`, the input value is converted to UTC for storage. When * no custom `format` is specified, a `Z` suffix is appended to the ISO 8601 output. When a custom * `format` is used, the value is stored in UTC but formatted according to that pattern — which * won’t include an explicit timezone indicator unless the format itself contains `Z`. Note that * `input_timezone: 'utc'` already implies UTC semantics, so `output_utc` has no additional effect * in that case. Default: `false`. */ output_utc?: boolean | undefined; /** * Whether to set the field to the current * date/time automatically when an entry is saved. `true` means both when an entry is created and * whenever it’s updated, `false` means neither, and an array like `[create]` or `[update]` picks * the stages. `create` also covers a value that hasn’t been set yet, such as one in a List item * added to an existing entry. `[create]` suits a creation date, and `true` a last modified date. * The value is formatted like the `{{now}}` default value, with seconds, but set at save time * rather than when a draft is created. The field is shown as text, isn’t validated, and is hidden * while an entry is being created. The time is shared by all locales. The option is ignored in a * rich text editor component. Default: `false`. */ auto_now?: boolean | DateTimeAutoNowStage[] | undefined; }; /** * Stage of an entry’s life at which a DateTime field is set to the current date/time: when the * entry is first saved, or whenever it’s saved after that. */ export type DateTimeAutoNowStage = "create" | "update"; /** * DateTime field definition. */ export type DateTimeField = SimpleCommonFieldProps & VisibleFieldProps & FieldValidationProps & DateTimeFieldProps & UniqueValueProps; /** * File field properties. */ export type FileFieldProps = { /** * Field type. */ widget: "file"; /** * Whether to select a folder instead of a file. The public * path of the selected folder, e.g. `/images/gallery`, is saved as the field value. Only an asset * folder with a fixed path can be browsed, so entry-relative folders and folders with template tags * are not available, nor are external media storage providers. Default: `false`. */ select_folder?: boolean | undefined; }; /** * File field definition. */ export type FileField = SimpleCommonFieldProps & VisibleFieldProps & MultiValueFieldValidationProps & MediaFieldProps & FileFieldProps & UniqueValueProps; /** * Hidden field properties. */ export type HiddenFieldProps = { /** * Field type. */ widget: "hidden"; /** * Default value. Accepts any data type that can be stored with the * configured file format. A string can contain the `{{locale}}`, `{{datetime}}`, `{{uuid}}`, * `{{uuid_short}}`, `{{uuid_shorter}}`, `{{author-email}}`, `{{author-login}}` and * `{{author-name}}` tags, which are filled when a new entry draft is created. */ default?: any; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for * details. */ default_localized?: Record | undefined; }; /** * Hidden field definition. */ export type HiddenField = CommonFieldProps & HiddenFieldProps; /** * Image field properties. */ export type ImageFieldProps = { /** * Field type. */ widget: "image"; }; /** * Image field definition. */ export type ImageField = SimpleCommonFieldProps & VisibleFieldProps & MultiValueFieldValidationProps & MediaFieldProps & ImageFieldProps & UniqueValueProps; /** * KeyValue field properties compatible with Static CMS. */ export type KeyValueFieldProps = { /** * Field type. */ widget: "keyvalue"; /** * Default key-value pairs. */ default?: Record | undefined; /** * Default values for * specific locales, keyed by locale code. A value given for a locale takes precedence over * `default` in that locale. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ default_localized?: Record> | undefined; /** * Label for the key column. Default: Key or its localized version. */ key_label?: string | undefined; /** * Label for the value column. Default: Value or its localized * version. */ value_label?: string | undefined; /** * Label to be displayed on the Add button. Default: `label` * field value. */ label_singular?: string | undefined; /** * Singular labels for specific * locales, keyed by locale code, taking precedence over `label_singular`. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ label_singular_localized?: Record | undefined; /** * Whether to save the field value at the top-level of the data file * without the field name. It only works if the field is the only field in the collection or file. * If the `single_file` i18n structure is enabled, the key-value pairs will still be saved under * locale keys. Default: `false`. See the * [documentation](https://sveltiacms.app/en/docs/fields/keyvalue#top-level-key-value-pairs) for * details. */ root?: boolean | undefined; }; /** * KeyValue field definition. */ export type KeyValueField = BaseFieldProps & KeyValueFieldI18nProps & VisibleFieldProps & KeyValueFieldProps & MultiValueFieldProps; /** * List field properties. */ export type ListFieldProps = { /** * Field type. */ widget: "list"; /** * Default value. The format depends on how the field is configured, * with or without `field`, `fields` or `types`: strings for a simple list, values of the subfield * for a list with `field`, e.g. numbers for a Number subfield, or objects for a list with `fields` * or `types`. See the [documentation](https://sveltiacms.app/en/docs/fields/list) for details. */ default?: any[] | undefined; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ default_localized?: Record | undefined; /** * Label to be displayed on the Add button. Default: `label` * field value. */ label_singular?: string | undefined; /** * Singular labels for specific * locales, keyed by locale code, taking precedence over `label_singular`. See the * [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for details. */ label_singular_localized?: Record | undefined; }; /** * Base properties for a List field. */ export type ListFieldBaseProps = CommonFieldProps & VisibleFieldProps & ListFieldProps & MultiValueFieldProps; /** * Simple List field properties. */ export type SimpleListFieldProps = { /** * Validation format. The first argument is a * regular expression matching pattern for a valid input value, and the second argument is an error * message to be displayed when the input value does not match the pattern. Like Decap CMS, the * pattern is tested against all the list items joined with commas, e.g. `foo,bar,baz`, rather than * against each item, and not at all while the list is empty. */ pattern?: [string | RegExp, string] | undefined; /** * Whether to save the field value at the top-level of the data file * without the field name. It only works if the field is the only field in the collection or file, * and the file format is not TOML. If the `single_file` i18n structure is enabled, the lists will * still be saved under locale keys. Default: `false`. See the * [documentation](https://sveltiacms.app/en/docs/fields/list#top-level-list) for details. */ root?: boolean | undefined; }; /** * Simple List field definition with primitive item types. */ export type SimpleListField = ListFieldBaseProps & SimpleListFieldProps; /** * Base properties for a complex List field with subfields or variable types. */ export type ComplexListFieldBaseProps = { /** * Whether to allow users to add new items to the list. Default: * `true`. */ allow_add?: boolean | undefined; /** * Whether to allow users to remove items from the list. Default: * `true`. */ allow_remove?: boolean | undefined; /** * Whether to allow users to duplicate items in the list. * Default: `true`. */ allow_duplicate?: boolean | undefined; /** * Whether to allow users to reorder items in the list. Default: * `true`. */ allow_reorder?: boolean | undefined; /** * Whether to add new items to the top of the list instead of the * bottom. Default: `false`. */ add_to_top?: boolean | undefined; /** * Template of a label to be displayed on a collapsed list item. */ summary?: string | undefined; /** * Subfield name to be used as a thumbnail image for a list item. It * will be displayed along with the summary label when the item is collapsed. The subfield must be * an Image or File field. Default: none. */ thumbnail?: string | undefined; /** * Whether to collapse the list items by default. Default: * `false`. If set to `auto`, the UI is collapsed if the item has any filled subfields and expanded * if all the subfields are empty. */ collapsed?: boolean | "auto" | undefined; /** * Whether to collapse the entire list. Default: * `false`. If set to `auto`, the UI is collapsed if the list has any items and expanded if it’s * empty. */ minimize_collapsed?: boolean | "auto" | undefined; /** * Whether to save the field value at the top-level of the data file * without the field name. It only works if the field is the only field in the collection or file, * and the file format is not TOML, unless the `map_key_field` option stores the list as a map. If * the `single_file` i18n structure is enabled, the lists will still be saved under locale keys. * Default: `false`. See the * [documentation](https://sveltiacms.app/en/docs/fields/list#top-level-list) for details. */ root?: boolean | undefined; }; /** * Properties for a complex List field with subfields or variable types. */ export type ComplexListFieldProps = ListFieldBaseProps & ComplexListFieldBaseProps; /** * Properties for a List field with a single subfield. */ export type ListFieldSubFieldProps = { /** * Single field to be included in a list item. */ field: Field; }; /** * List field definition with a single subfield. */ export type ListFieldWithSubField = ComplexListFieldProps & ListFieldSubFieldProps; /** * Properties for a List field with multiple subfields. */ export type ListFieldSubFieldsProps = { /** * Set of fields to be included in a list item. */ fields: Field[]; }; /** * Properties for a List field whose items can be stored as a map rather than an array. */ export type MapListFieldProps = { /** * Name of the subfield whose value becomes the key of each * item, so the list is stored as a map of the keys to the items, without the subfield, rather than * as an array, e.g. `{ harry: { title: … }, ron: { title: … } }`. The subfield must be a String * field, a Relation field or a Select field with string option values, without the `multiple` * option, that is required in every locale, and with variable types, every type must have it. Its * value must be unique within the list, and can’t be a whole number such as `1` or `2024`, as such * keys don’t keep their order. The items are kept in the order of the map. An existing array is * still loaded, and saved as a map. Default: none. See the * [documentation](https://sveltiacms.app/en/docs/fields/list#keyed-list) for details. */ map_key_field?: string | undefined; }; /** * List field definition with multiple subfields. */ export type ListFieldWithSubFields = ComplexListFieldProps & ListFieldSubFieldsProps & MapListFieldProps; /** * List field definition with variable types. */ export type ListFieldWithTypes = ComplexListFieldProps & VariableFieldProps & MapListFieldProps; /** * List field definition with complex items. */ export type ComplexListField = ListFieldWithSubField | ListFieldWithSubFields | ListFieldWithTypes; /** * List field definition. */ export type ListField = SimpleListField | ListFieldWithSubField | ListFieldWithSubFields | ListFieldWithTypes; /** * Map field properties. */ export type MapFieldProps = { /** * Field type. */ widget: "map"; /** * Default value. Accepts a stringified single * [GeoJSON](https://geojson.org/) geometry object that contains `type` and `coordinates` * properties. */ default?: string | undefined; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for * details. */ default_localized?: Record | undefined; /** * Precision of coordinates to be saved. Default: `7`. */ decimals?: number | undefined; /** * Geometry type. Default: `Point`. */ type?: "Point" | "LineString" | "Polygon" | undefined; /** * Default center coordinates as `[longitude, latitude]`. * Default: `[0, 0]`. */ center?: [number, number] | undefined; /** * Default zoom level. Default: `2`. */ zoom?: number | undefined; }; /** * Map field definition. */ export type MapField = CommonFieldProps & VisibleFieldProps & FieldValidationProps & MapFieldProps; /** * Supported button name for the rich text editor. `underline` underlines text with the `` * element, and `align` shows the text alignment menu. Both are only available with the `html` * format, as Markdown has no syntax for them. `task-list` creates a GitHub Flavored Markdown task * list, written as `- [ ] item` and `- [x] item` in Markdown. None of them are enabled by default; * add them to the `buttons` option to enable them. */ export type RichTextEditorButtonName = "bold" | "italic" | "underline" | "strikethrough" | "code" | "link" | "heading-one" | "heading-two" | "heading-three" | "heading-four" | "heading-five" | "heading-six" | "quote" | "bulleted-list" | "numbered-list" | "task-list" | "align"; /** * Built-in editor component name for the rich text editor. `table` and `hr` (horizontal rule) are * not enabled by default; add them to the `editor_components` option to enable them. */ export type RichTextEditorComponentName = "code-block" | "image" | "table" | "hr"; /** * Supported mode name for the rich text editor. */ export type RichTextEditorMode = "rich_text" | "raw"; /** * Value format of a RichText field. */ export type RichTextValueFormat = "markdown" | "html"; /** * RichText field base properties. */ export type RichTextFieldBaseProps = { /** * Default value. */ default?: string | undefined; /** * Default values for specific locales, * keyed by locale code. A value given for a locale takes precedence over `default` in that locale. * See the [documentation](https://sveltiacms.app/en/docs/i18n/options#localized-field-options) for * details. */ default_localized?: Record | undefined; /** * Whether to make the editor compact: it starts with the height of a * single line and stops growing at 240 pixels, making the content scrollable. Default: `false`. */ minimal?: boolean | undefined; /** * Whether the content can span multiple paragraphs and lines. * Default: `true`. With `false`, the editor keeps the content in a single paragraph, which suits a * title or caption with inline formatting: the Enter key doesn’t start a new line, and the * paragraphs and lines of pasted text are joined with spaces. Only the inline formatting buttons * (`bold`, `italic`, `underline`, `strikethrough`, `code` and `link`) and inline editor components, * like `image`, can be used then, and the HTML output format has no raw mode. A stored value with * several paragraphs is kept as is until the content is edited. */ multiline?: boolean | undefined; /** * Names of formatting buttons and menu items to be * enabled in the editor UI. Default: all the supported button names except `underline`, `align` * and `task-list`. */ buttons?: RichTextEditorButtonName[] | undefined; /** * Names of components to * be enabled in the editor UI. This may include custom component names. Default: all the built-in * and registered custom component names, except `table` and `hr`, which have to be listed to * enable them. */ editor_components?: string[] | undefined; /** * Whether to allow nested rich text * editor components in the editor UI. If set to `'exclude_self'`, nested components are disabled if * the parent components include the current component; this is useful to prevent unexpected * behavior due to regex matching limitations. Default: `true`. */ allow_nested_components?: boolean | "exclude_self" | undefined; /** * Editor modes to be enabled. The first one is selected * initially, so with `[raw, rich_text]`, the editor opens in raw mode. Default: `[rich_text, raw]`. */ modes?: RichTextEditorMode[] | undefined; /** * Whether to sanitize the preview HTML. Default: `true`. * Note that Sveltia CMS has changed the default value from `false` to `true` to enhance security, * whereas Netlify/Decap CMS keeps it as `false`. We recommend keeping this option enabled unless * disabling it fixes a broken preview and you fully trust all users of your CMS. `javascript:` * URLs, e.g. in links, are removed from the preview either way. */ sanitize_preview?: boolean | undefined; /** * Whether to enable the linked images feature for the built-in * `image` component. Default: `true`. When enabled, the image component provides an additional text * field for specifying a URL to wrap the image as a link. The resulting Markdown output will be in * the format `[![alt](src)](link)`, where clicking the image navigates to the provided link. This * feature can be disabled if it causes conflicts with certain frameworks. */ linked_images?: boolean | undefined; /** * Whether to enable the image caption feature for the * built-in `image` component. Default: `true`. When enabled, the image component provides an * additional Caption field. Markdown has no syntax for a caption, so an image with a caption is * written as an HTML `
` element with a `
`, which can contain links and text * formatting. This feature can be disabled if your framework or theme doesn’t support such HTML, * or you don’t want editors to write it. A `
` element is then left as raw HTML in * Markdown, and can only be edited in the raw mode with the `html` format. */ captioned_images?: boolean | undefined; /** * Whether to enable emoji autocomplete in the rich * text editor. Default: `true`. When enabled, typing `:` followed by a few letters will show a list * of matching emojis that can be selected to insert into the text. */ use_emoji_autocomplete?: boolean | undefined; /** * Whether to enable Markdown shortcuts in the rich * text editor. Default: `true`. When enabled, typing `-` or `*` at the start of a line creates a * bulleted list, `1.` creates a numbered list, `>` creates a blockquote, and `#`, `##`, `###` * create headings. Note that standard keyboard shortcuts like `Ctrl+B` for bold and `Ctrl+I` for * italic are always enabled regardless of this option. */ use_markdown_shortcuts?: boolean | undefined; }; /** * RichText field properties for the value format, which the Markdown field type doesn’t support. */ export type RichTextFieldFormatProps = { /** * Format of the field value: `markdown` or `html`. * Default: `markdown`. With `html`, the value is saved as HTML, and the raw mode shows the HTML * source. Only the editor components that support HTML with the `htmlSelector`, `fromBlockHTML` * and `toBlockHTML` options are available, including the built-in `code-block`, `image`, `table` * and `hr` components. HTML with an element the rich text mode cannot handle, like `