@sveltia/cms 0.50.1 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,6 +63,7 @@ The free, open source alternative to Netlify/Decap CMS is now in public beta, tu
63
63
  - [Disabling non-default locale content](#disabling-non-default-locale-content)
64
64
  - [Using a random ID for an entry slug](#using-a-random-id-for-an-entry-slug)
65
65
  - [Editing data files with a top-level list](#editing-data-files-with-a-top-level-list)
66
+ - [Controlling data output](#controlling-data-output)
66
67
  - [Disabling automatic deployments](#disabling-automatic-deployments)
67
68
  - [Setting up Content Security Policy](#setting-up-content-security-policy)
68
69
  - [Support \& feedback](#support--feedback)
@@ -108,7 +109,7 @@ While we fix reported bugs as quickly as possible, usually within 24 hours, our
108
109
 
109
110
  - Ensuring substantial [compatibility with Netlify/Decap CMS](#compatibility)
110
111
  - Tackling as many [Netlify/Decap CMS issues](https://github.com/decaporg/decap-cms/issues) as possible
111
- - So far, 145+ of them, or 255+ including duplicates, have been effectively solved in Sveltia CMS
112
+ - So far, 145+ of them, or 265+ including duplicates, have been effectively solved in Sveltia CMS
112
113
  - Target: 250 or all relevant and fixable issues in a future release (Yes, you read it right)
113
114
  - Note: Issues include both feature requests and bug reports; we also track their [stale issues](https://github.com/decaporg/decap-cms/issues?q=is%3Aissue+%22Closing+as+stale%22) and [discussions](https://github.com/decaporg/decap-cms/discussions)
114
115
  - [Let us know](https://github.com/sveltia/sveltia-cms/issues/new?labels=enhancement) if you have any specific issues you’d like to see solved!
@@ -210,7 +211,7 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
210
211
  - The [i18n limitations](https://decapcms.org/docs/i18n/#limitations) in Netlify/Decap CMS do not apply to Sveltia CMS:
211
212
  - File collections support multiple files/folders i18n structures[^87]. To enable it, simply use the `{{locale}}` template tag in the `file` path option, e.g. `content/pages/about.{{locale}}.json` or `content/pages/{{locale}}/about.json`. For backward compatibility, the global `structure` option only applies to folder collections, and the default i18n structure for file collections remains single file.
212
213
  - The List and Object widgets support the `i18n: duplicate` field configuration so that changes made with these widgets are duplicated between locales[^7][^68]. The `i18n` configuration can normally be used for the subfields.
213
- - The `required` field option accepts an array of locale names in addition to a boolean, making the field required for a subset of locales when i18n support is enabled. For example, if only English is required, you could write `required: [en]`. An empty array is equivalent to `required: false`.
214
+ - The `required` field option accepts an array of locale codes in addition to a boolean, making the field required for a subset of locales when i18n support is enabled. For example, if only English is required, you could write `required: [en]`. An empty array is equivalent to `required: false`.
214
215
  - [Entry-relative media folders](https://decapcms.org/docs/collection-folder/#media-and-public-folder) can be used in conjunction with the `multiple_folders` i18n structure[^21].
215
216
  - The `{{locale}}` template tag can be used in the [`preview_path`](https://decapcms.org/docs/configuration-options/#preview_path) collection option to provide site preview links for each language[^63].
216
217
  - It’s possible to [use a random UUID for an entry slug](#using-a-random-id-for-an-entry-slug), which is a good option for locales that write in non-Latin characters.
@@ -292,14 +293,15 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
292
293
  ### Better data output
293
294
 
294
295
  - Keys in generated JSON/TOML/YAML content are always sorted by the order of configured fields, making Git commits clean and consistent[^86].
295
- - Netlify/Decap CMS often, but not always, omits optional and empty fields from the output. Sveltia CMS aims at complete and consistent data output — it always saves proper values, such as an empty string or an empty array, instead of nothing (`undefined`), regardless of the `required` field option[^45][^46][^44].
296
+ - Netlify/Decap CMS often, but not always, omits optional and empty fields from the output. Sveltia CMS aims at complete and consistent data output — it always saves proper values, such as an empty string, an empty array or `null`, instead of nothing (`undefined`), regardless of the `required` field option[^45][^46][^44][^154][^157].
296
297
  - In other words, in Sveltia CMS, `required: false` makes data input optional, but doesn’t make data output optional.
297
- - Note: If you have any data validation (type definition) that expects `undefined` values, you may need to revise it or the output from Sveitia CMS may break it.
298
+ - To omit empty optional fields from data output, use `omit_empty_optional_fields: true` in the [data output options](#controlling-data-output). This is useful if you have data type validations that expect `undefined`[^156].
298
299
  - JSON/TOML/YAML data is saved with a new line at the end of the file to prevent unnecessary changes being made to the file[^11].
299
300
  - Leading and trailing spaces in text-type field values are automatically removed when you save an entry[^37].
300
- - String values in YAML files can be quoted with the new `yaml_quote: true` option for a collection, mainly for framework compatibility[^9].
301
301
  - YAML string folding (maximum line width) is disabled, mainly for framework compatibility[^119].
302
302
  - DateTime field values in ISO 8601 format are stored in native date/time format instead of quoted strings when the data output is TOML[^147].
303
+ - Provides JSON/YAML format options as part of the [data output options](#controlling-data-output), including indentation and quotes[^9][^155].
304
+ - Note: the `yaml_quote: true` collection option added v0.5.10 is now deprecated and will be removed in v1.0.
303
305
 
304
306
  ### Better widgets
305
307
 
@@ -332,6 +334,8 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
332
334
  - The built-in `image` editor component can be inserted with a single click.
333
335
  - The default editor mode can be set by changing the order of the `modes` option[^58]. If you want to use the plain text editor by default, add `modes: [raw, rich_text]` to the field configuration.
334
336
  - Line breaks are rendered as line breaks in the preview pane according to GitHub Flavored Markdown (GFM).
337
+ - Number
338
+ - If the `value_type` option is `int` or `float`, the `required` option is `false`, and the value is not entered, it will be saved as `null` instead of an empty string[^157].
335
339
  - Object
336
340
  - Sveltia CMS offers two ways to have conditional fields in a collection[^30]:
337
341
  - The Object widget supports [variable types](https://decapcms.org/docs/variable-type-widgets/) (the `types` option) just like the List widget.
@@ -380,8 +384,8 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
380
384
  - The experimental `compute` widget allows to reference the value of other fields in the same collection, similar to the `summary` property for the List and Object widgets[^104]. Use the `value` property to define the value template, e.g. `posts-{{fields.slug}}` ([example](https://github.com/sveltia/sveltia-cms/issues/111)).
381
385
  - The `value` property also supports a value of `{{index}}`, which can hold the index of a list item ([example](https://github.com/sveltia/sveltia-cms/issues/172)).
382
386
  - KeyValue (Dictionary)
383
- - The new `keyvalue` widget allows users to add arbitrary key-value pairs to a field[^123].
384
- - The implementation is compatible with [Static CMS](https://staticjscms.netlify.app/docs/widget-keyvalue), but we provide a more intuitive UI. You can press Enter to move focus or add a new row, and the preview is displayed in a clean table.
387
+ - The new `keyvalue` widget allows users to add arbitrary key-value string pairs to a field[^123].
388
+ - The implementation is compatible with [Static CMS](https://staticjscms.netlify.app/docs/widget-keyvalue), but we provide a more intuitive UI. You can press Enter to move focus or add a new row while editing, and the preview is displayed in a clean table.
385
389
  - UUID
386
390
  - In addition to [generating UUIDs for entry slugs](#using-a-random-id-for-an-entry-slug), Sveltia CMS also supports the proposed `uuid` widget with the following properties[^12]:
387
391
  - `prefix`: A string to be prepended to the value. Default: an empty string.
@@ -798,6 +802,21 @@ collections:
798
802
 
799
803
  Note: The `root` option is ignored if the collection or collection file contains multiple fields. You can still have subfields under the List field.
800
804
 
805
+ ### Controlling data output
806
+
807
+ Sveltia CMS supports some data output options, including JSON/YAML formatting preferences, in the configuration file. The default options are listed below:
808
+
809
+ ```yaml
810
+ output:
811
+ omit_empty_optional_fields: false # or true
812
+ json:
813
+ indent_style: space # or tab
814
+ indent_size: 2
815
+ yaml:
816
+ quote: none # or single or double
817
+ indent_size: 2
818
+ ```
819
+
801
820
  ### Disabling automatic deployments
802
821
 
803
822
  You may already have a CI/CD tool set up on your Git repository to automatically deploy changes to production. Occasionally, you make a lot of changes to your content to quickly reach the CI/CD provider’s (free) build limits, or you just don’t want to see builds triggered for every single small change.
@@ -1294,3 +1313,11 @@ This software is provided “as is” without any express or implied warranty. W
1294
1313
  [^152]: Netlify/Decap CMS [#2491](https://github.com/decaporg/decap-cms/issues/2491)
1295
1314
 
1296
1315
  [^153]: Netlify/Decap CMS [#7347](https://github.com/decaporg/decap-cms/issues/7347)
1316
+
1317
+ [^154]: Netlify/Decap CMS [#1449](https://github.com/decaporg/decap-cms/issues/1988), [#1449](https://github.com/decaporg/decap-cms/issues/1988)
1318
+
1319
+ [^155]: Netlify/Decap CMS [#5870](https://github.com/decaporg/decap-cms/issues/5870)
1320
+
1321
+ [^156]: Netlify/Decap CMS [#995](https://github.com/decaporg/decap-cms/issues/995), [#2017](https://github.com/decaporg/decap-cms/issues/2017), [#7120](https://github.com/decaporg/decap-cms/issues/7120), [#7186](https://github.com/decaporg/decap-cms/issues/7186)
1322
+
1323
+ [^157]: Netlify/Decap CMS [#2007](https://github.com/decaporg/decap-cms/issues/2007), [#2848](https://github.com/decaporg/decap-cms/issues/2848)