@sveltia/cms 0.87.3 → 0.87.4
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 +57 -28
- package/dist/sveltia-cms.js +72 -72
- package/dist/sveltia-cms.js.map +1 -1
- package/dist/sveltia-cms.mjs +70 -70
- package/dist/sveltia-cms.mjs.map +1 -1
- package/package.json +1 -1
- package/schema/sveltia-cms.json +1160 -580
- package/types/public.d.ts +117 -69
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ Due to its unfortunate abandonment in early 2022, Netlify CMS spawned 3 successo
|
|
|
112
112
|
- **Sveltia CMS**: not a fork but a **complete rewrite** or “total reboot”, started in November 2022, first appeared on GitHub in March 2023
|
|
113
113
|
- [Decap CMS](https://github.com/decaporg/decap-cms): a rebranded version, [announced in February 2023](https://www.netlify.com/blog/netlify-cms-to-become-decap-cms/) as the official successor with a Netlify agency partner taking ownership — mostly stagnant, with only occasional releases
|
|
114
114
|
|
|
115
|
-
Sveltia CMS is the only project that doesn’t inherit the complexity, technical debt, and numerous bugs of Netlify CMS, which was launched in 2015. Our product is better by design: We rebuilt the app from the ground up using a [modern framework](https://svelte.dev/)
|
|
115
|
+
Sveltia CMS is the only project that doesn’t inherit the complexity, technical debt, and numerous bugs of Netlify CMS, which was launched in 2015. Our product is better by design: We have rebuilt the app from the ground up using a [modern framework](https://svelte.dev/) while closely monitoring and analyzing the Netlify/Decap CMS issue tracker. We don’t use any of the predecessor’s code. This allows us to make [hundreds of improvements](#differentiators) without getting stuck in the old system.
|
|
116
116
|
|
|
117
117
|
While Sveltia CMS was created to replace legacy Netlify CMS instances, it can also be used as an alternative to other Netlify CMS successors. With its [solid i18n support](#better-i18n-support), we’re hoping our product will eventually be an appearing option for anyone looking for a free headless CMS.
|
|
118
118
|
|
|
@@ -227,15 +227,16 @@ Note: This lengthy section compares Sveltia CMS with both Netlify CMS and Decap
|
|
|
227
227
|
|
|
228
228
|
- Sveltia CMS is built with [Svelte](https://svelte.dev/), and we only publish compiled vanilla JavaScript bundles, so there are no React compatibility issues that might prevent developers from upgrading a project for many months.[^177] We haven’t actually integrated React for custom widgets and other features yet, but anyway, no dependencies will be installed when you [install the app with npm](#installing-with-npm).
|
|
229
229
|
- Sveltia CMS also won’t cause peer dependency conflicts mainly due to legacy third-party React UI libraries.[^175][^237] We build the app using [our own Svelte UI component library](https://github.com/sveltia/sveltia-ui) to reduce reliance on third parties.
|
|
230
|
-
- Some servers and frameworks are known to remove the trailing slash from the CMS URL (`/admin`) depending on the configuration. In such cases, the config file is loaded from
|
|
230
|
+
- Some servers and frameworks are known to remove the trailing slash from the CMS URL (`/admin`) depending on the configuration. In such cases, the config file is loaded from the proper URL (`/admin/config.yml`) instead of a regular relative URL (`./config.yml` = `/config.yml`), which results in a 404 Not Found error.[^107]
|
|
231
231
|
- The [robots `meta` tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag) is automatically added to HTML to prevent the admin page from being indexed by search engines.[^174] Developers are still encouraged to manually add `<meta name="robots" content="noindex">` to `index.html`, as not all crawlers support dynamically added tags. However, our solution should at least work with Google in case you forget to do so.
|
|
232
|
-
- Initializing the CMS twice (due to the incorrect or missing placement of `CMS_MANUAL_INIT`) will not result in a `NotFoundError`.[^251]
|
|
232
|
+
- Initializing the CMS twice (due to the incorrect or missing placement of `window.CMS_MANUAL_INIT`) will not result in a `NotFoundError`.[^251]
|
|
233
|
+
- Sveltia CMS automatically enables [manual initialization](https://decapcms.org/docs/manual-initialization/) when you import the JavaScript module, so you don’t need to have `window.CMS_MANUAL_INIT = true` in your code.
|
|
233
234
|
|
|
234
235
|
### Better configuration
|
|
235
236
|
|
|
236
237
|
- Sveltia CMS supports a [JSON configuration file](#providing-a-json-configuration-file) that can be generated for bulk or complex collections.[^60]
|
|
237
238
|
- Also supports [multiple configuration files](#providing-multiple-configuration-files) to allow developers to modularize the configuration.[^197]
|
|
238
|
-
- We provide an [up-to-date JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for YAML/JSON configuration files, which enables autocomplete and validation in
|
|
239
|
+
- We provide an [up-to-date JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for YAML/JSON configuration files, which enables autocomplete and validation in VS Code and other code editors.[^253]
|
|
239
240
|
- Improved TypeScript support: We keep our type definitions for `CMS.init()` and other methods complete, accurate, up-to-date and annotated.[^190][^191][^192][^193][^227] This makes it easier to provide a site config object when [manually initializing](https://decapcms.org/docs/manual-initialization/) the CMS.
|
|
240
241
|
|
|
241
242
|
### Better backend support
|
|
@@ -257,7 +258,7 @@ Note: This lengthy section compares Sveltia CMS with both Netlify CMS and Decap
|
|
|
257
258
|
|
|
258
259
|
### Better i18n support
|
|
259
260
|
|
|
260
|
-
Sveltia CMS has been built with a multilingual architecture from the very beginning. You can expect
|
|
261
|
+
Sveltia CMS has been built with a multilingual architecture from the very beginning. You can expect first-class internationalization (i18n) support, as it’s required by clients of maintainer [@kyoshino](https://github.com/kyoshino), who himself was a long-time Japanese localizer for [Mozilla](https://www.mozilla.org/) and currently lives in the [most diverse city in the world](https://en.wikipedia.org/wiki/Toronto) where 150+ languages are spoken.
|
|
261
262
|
|
|
262
263
|
- Configuration
|
|
263
264
|
- The [i18n limitations](https://decapcms.org/docs/i18n/#limitations) in Netlify/Decap CMS do not apply to Sveltia CMS:
|
|
@@ -279,8 +280,6 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
|
|
|
279
280
|
- Language labels appear in human-readable display names instead of ISO 639 language codes because it’s not easy for everyone to recognize `DE` as German, `NL` as Dutch, `ZH` as Chinese, and so on.
|
|
280
281
|
- Content editing
|
|
281
282
|
- [Integrates a translation service](#translating-entry-fields-with-one-click) to allow translation of text fields from another locale with one click.
|
|
282
|
-
- Earlier versions of Sveltia CMS included DeepL integration, but it’s disabled for now [due to an API limitation](https://github.com/sveltia/sveltia-cms/issues/437).
|
|
283
|
-
- More translation services will be added in the future.
|
|
284
283
|
- The Content Editor supports [RTL scripts](https://en.wikipedia.org/wiki/Right-to-left_script) such as Arabic, Hebrew and Persian.[^146]
|
|
285
284
|
- It’s possible to [disable non-default locale content](#disabling-non-default-locale-content).[^15]
|
|
286
285
|
- Boolean, DateTime, List and Number fields in the entry preview are displayed in a localized format.
|
|
@@ -436,7 +435,7 @@ Sveltia CMS supports all [built-in widgets](https://decapcms.org/docs/widgets/)
|
|
|
436
435
|
- A collapsed List field will not display a programmatic summary like `List [ Map { "key": "value" } ]` if the `summary` option is not set.[^183]
|
|
437
436
|
- Map
|
|
438
437
|
- A search bar enables users to quickly locate a specific place on the map.[^252]
|
|
439
|
-
- With the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API), users can get their current location.
|
|
438
|
+
- With the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API), users can get their current location with one click.
|
|
440
439
|
- The value can be cleared if the field is optional.
|
|
441
440
|
- The map’s zoom level is adjusted more intuitively using pinch gestures.
|
|
442
441
|
- The map looks good in dark mode.
|
|
@@ -632,7 +631,7 @@ Sveltia CMS provides partial compatibility with [Static CMS](https://github.com/
|
|
|
632
631
|
- I18n support
|
|
633
632
|
- The `enforce_required_non_default` i18n option will not be supported. Sveitia CMS enforces required fields in all locales by default. However, the `save_all_locales` or `initial_locales` i18n option allows users to [disable non-default locales](#disabling-non-default-locale-content) if needed. Developers can also specify a subset of locales with the `required` field option, e.g. `required: [en]`.
|
|
634
633
|
- Widgets
|
|
635
|
-
- The date/time format options for the DateTime widget are
|
|
634
|
+
- The date/time format options for the DateTime widget are **not compatible** since Static CMS [switched to date-fns](https://staticjscms.netlify.app/docs/decap-migration-guide#dates) while Sveltia CMS continues to use Moment.js (and will soon switch to Day.js). Update your formats accordingly.
|
|
636
635
|
- The KeyValue widget is implemented in Sveltia CMS with the same options.
|
|
637
636
|
- The UUID widget is also implemented, but with different options.
|
|
638
637
|
- The `prefix` and `suffix` options for the Boolean, Number and String widgets are implemented as `before_input` and `after_input` in Sveltia CMS, respectively. Our `prefix` and `suffix` options for the String widget are literally a prefix and suffix to the value.
|
|
@@ -716,7 +715,7 @@ You can now open `https://[hostname]/admin/` as usual to start editing. There is
|
|
|
716
715
|
|
|
717
716
|
#### Editing the configuration file
|
|
718
717
|
|
|
719
|
-
For a better DX, we recommend [setting up the JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for the site configuration file in your code editor. If you have the YAML extension installed, VS Code may automatically apply the Netlify
|
|
718
|
+
For a better DX, we recommend [setting up the JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for the site configuration file in your code editor. If you have the YAML extension installed, VS Code may automatically apply the outdated Netlify CMS config schema to `config.yml`. To use the latest Sveltia CMS config schema instead, you need to specify its URL.
|
|
720
719
|
|
|
721
720
|
#### Migrating from Git Gateway backend
|
|
722
721
|
|
|
@@ -740,7 +739,7 @@ For advanced users, we have also made the bundle available as an [npm package](h
|
|
|
740
739
|
|
|
741
740
|
Updating Sveltia CMS is transparent, unless you include a specific version in the `<script>` source URL or use the npm package. Whenever you (re)load the CMS, the latest version will be served via [UNPKG](https://unpkg.com/). The CMS also periodically checks for updates and notifies you when a new version is available. After the product reaches GA, you could use a semantic version range (`^1.0.0`) like Netlify/Decap CMS.
|
|
742
741
|
|
|
743
|
-
If you’ve chosen to install with npm, updating the package is your responsibility. We recommend using [`ncu`](https://www.npmjs.com/package/npm-check-updates) or a service like [Dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/) to keep dependencies up to date,
|
|
742
|
+
If you’ve chosen to install with npm, updating the package is your responsibility. We strongly recommend using [`ncu`](https://www.npmjs.com/package/npm-check-updates) or a service like [Dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/) to keep dependencies up to date. Otherwise, you’ll miss important bug fixes and new features. (ProTip: We update our dependencies using `ncu -u && pnpm up`.)
|
|
744
743
|
|
|
745
744
|
## Tips & tricks
|
|
746
745
|
|
|
@@ -750,7 +749,7 @@ You can host your Sveltia CMS-managed site anywhere, such as [Cloudflare Pages](
|
|
|
750
749
|
|
|
751
750
|
### Enabling autocomplete and validation for the configuration file
|
|
752
751
|
|
|
753
|
-
Sveltia CMS provides a [JSON schema](https://json-schema.org/) for the configuration file, so you can get autocomplete and validation in your favourite code editor while editing the site configuration. The schema is generated from the source and always up to date with the latest CMS version.
|
|
752
|
+
Sveltia CMS provides a full [JSON schema](https://json-schema.org/) for the configuration file, so you can get autocomplete and validation in your favourite code editor while editing the site configuration. The schema is generated from the source and always up to date with the latest CMS version.
|
|
754
753
|
|
|
755
754
|
If you use VS Code, you can enable it for the YAML configuration file by installing the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and adding the following to your project’s [VS Code settings file](https://code.visualstudio.com/docs/configure/settings#_settings-json-file) at `.vscode/settings.json`:
|
|
756
755
|
|
|
@@ -961,41 +960,47 @@ Note that the special index file is placed right under the `folder`, regardless
|
|
|
961
960
|
|
|
962
961
|
### Using singletons
|
|
963
962
|
|
|
964
|
-
The singleton collection is an unnamed, non-nested variant of a [file collection](https://decapcms.org/docs/collection-file/) that can be used to manage
|
|
963
|
+
The singleton collection is an unnamed, non-nested variant of a [file collection](https://decapcms.org/docs/collection-file/) that can be used to manage a set of pre-defined data files. Singleton files appear in the content library’s sidebar under the Files group, and users can open the Content Editor directly without navigating to a file list.
|
|
965
964
|
|
|
966
|
-
To create this special file collection, add the new `singletons` option, along with an array of file definitions, to the root level of your site configuration
|
|
965
|
+
To create this special file collection, add the new `singletons` option, along with an array of file definitions, to the root level of your site configuration.
|
|
966
|
+
|
|
967
|
+
This is a conventional file collection:
|
|
967
968
|
|
|
968
969
|
```yaml
|
|
969
970
|
collections:
|
|
970
|
-
# A conventional file collection
|
|
971
971
|
- name: data
|
|
972
972
|
label: Data
|
|
973
973
|
files:
|
|
974
974
|
- name: home
|
|
975
975
|
label: Home Page
|
|
976
976
|
file: content/home.yaml
|
|
977
|
-
|
|
977
|
+
icon: home
|
|
978
|
+
fields: ...
|
|
978
979
|
- name: settings
|
|
979
980
|
label: Site Settings
|
|
980
981
|
file: content/settings.yaml
|
|
981
|
-
|
|
982
|
+
icon: settings
|
|
983
|
+
fields: ...
|
|
984
|
+
```
|
|
982
985
|
|
|
983
|
-
|
|
986
|
+
It can be converted to the singleton collection like this:
|
|
987
|
+
|
|
988
|
+
```yaml
|
|
984
989
|
singletons:
|
|
985
990
|
- name: home
|
|
986
991
|
label: Home Page
|
|
987
992
|
file: content/home.yaml
|
|
988
|
-
icon: home
|
|
989
|
-
...
|
|
990
|
-
- divider: true # You can
|
|
993
|
+
icon: home
|
|
994
|
+
fields: ...
|
|
995
|
+
- divider: true # You can add dividers
|
|
991
996
|
- name: settings
|
|
992
997
|
label: Site Settings
|
|
993
998
|
file: content/settings.yaml
|
|
994
999
|
icon: settings
|
|
995
|
-
...
|
|
1000
|
+
fields: ...
|
|
996
1001
|
```
|
|
997
1002
|
|
|
998
|
-
If you want to reference a singleton file with a Relation field, use `_singletons` as the `collection` name.
|
|
1003
|
+
If you want to reference a singleton file with a Relation field, use `_singletons` (note an underscore prefix) as the `collection` name.
|
|
999
1004
|
|
|
1000
1005
|
### Using keyboard shortcuts
|
|
1001
1006
|
|
|
@@ -1023,6 +1028,8 @@ Sveltia CMS comes with a handy Google Cloud Translation API integration so that
|
|
|
1023
1028
|
|
|
1024
1029
|
Note that the Translation button on the pane header only translates empty fields, while in-field Translation buttons override any filled text.
|
|
1025
1030
|
|
|
1031
|
+
Earlier versions of Sveltia CMS included DeepL integration, but it has been disabled [due to an API limitation](https://github.com/sveltia/sveltia-cms/issues/437). More translation services will be added in the future.
|
|
1032
|
+
|
|
1026
1033
|
### Localizing entry slugs
|
|
1027
1034
|
|
|
1028
1035
|
In Sveltia CMS, it’s possible to localize entry slugs (filenames) if the i18n structure is `multiple_files` or `multiple_folders`. All you need is the `localize` filter for `slug` template tags:
|
|
@@ -1183,7 +1190,7 @@ In case you’re not aware, [WebP](https://developers.google.com/speed/webp) off
|
|
|
1183
1190
|
- The `width` and `height` options are the maximum width and height, respectively. If an image is larger than the specified dimension, it will be scaled down. Smaller images will not be resized.
|
|
1184
1191
|
- File processing is a bit slow on Safari because [native WebP encoding](https://caniuse.com/mdn-api_htmlcanvaselement_toblob_type_parameter_webp) is [not supported](https://bugs.webkit.org/show_bug.cgi?id=183257) and the [jSquash](https://github.com/jamsinclair/jSquash) library is used instead.
|
|
1185
1192
|
- AVIF conversion is not supported because no browser has native AVIF encoding support ([Chromium won’t fix it](https://issues.chromium.org/issues/40848792)) and the third-party library (and AVIF encoding in general) is very slow.
|
|
1186
|
-
- This feature is not intended for creating image variants in different formats and sizes. It should be done with a framework during the build process.
|
|
1193
|
+
- This feature is not intended for creating image variants in different formats and sizes. It should be done with a framework during the build process. Popular frameworks like [Astro](https://docs.astro.build/en/guides/images/), [Eleventy](https://www.11ty.dev/docs/plugins/image/), [Hugo](https://gohugo.io/content-management/image-processing/), [Next.js](https://nextjs.org/docs/pages/api-reference/components/image) and [SvelteKit](https://svelte.dev/docs/kit/images) have built-in image processing capabilities.
|
|
1187
1194
|
- We may add more transformation options in the future.
|
|
1188
1195
|
|
|
1189
1196
|
### Disabling stock assets
|
|
@@ -1208,6 +1215,7 @@ collections:
|
|
|
1208
1215
|
- name: members
|
|
1209
1216
|
label: Member List
|
|
1210
1217
|
file: _data/members.yml
|
|
1218
|
+
icon: group
|
|
1211
1219
|
fields:
|
|
1212
1220
|
- name: members
|
|
1213
1221
|
label: Members
|
|
@@ -1221,13 +1229,34 @@ collections:
|
|
|
1221
1229
|
label: GitHub account
|
|
1222
1230
|
```
|
|
1223
1231
|
|
|
1224
|
-
|
|
1232
|
+
It also works with a [singleton](#using-singletons):
|
|
1233
|
+
|
|
1234
|
+
```yaml
|
|
1235
|
+
singletons:
|
|
1236
|
+
- name: members
|
|
1237
|
+
label: Member List
|
|
1238
|
+
file: _data/members.yml
|
|
1239
|
+
icon: group
|
|
1240
|
+
fields:
|
|
1241
|
+
- name: members
|
|
1242
|
+
label: Members
|
|
1243
|
+
label_singular: Member
|
|
1244
|
+
widget: list
|
|
1245
|
+
root: true # This does the trick
|
|
1246
|
+
fields:
|
|
1247
|
+
- name: name
|
|
1248
|
+
label: Name
|
|
1249
|
+
- name: github
|
|
1250
|
+
label: GitHub account
|
|
1251
|
+
```
|
|
1252
|
+
|
|
1253
|
+
Note: The `root` option is ignored if the file or singleton contains multiple fields. You can still have subfields under the List field.
|
|
1225
1254
|
|
|
1226
1255
|
### Changing the input type of a DateTime field
|
|
1227
1256
|
|
|
1228
1257
|
It may be worth mentioning this topic here because the current [Decap CMS doc about the DateTime widget](https://decapcms.org/docs/widgets/#datetime) is unclear. By default, a DateTime field lets users pick both [date and time](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local), but developers can change the input type if needed.
|
|
1229
1258
|
|
|
1230
|
-
|
|
1259
|
+
Set `time_format` to `false` to hide the time picker and make the input [date only](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date):
|
|
1231
1260
|
|
|
1232
1261
|
```yaml
|
|
1233
1262
|
- label: Start Date
|
|
@@ -1236,7 +1265,7 @@ Use `time_format: false` to hide the time picker and make the input [date only](
|
|
|
1236
1265
|
time_format: false
|
|
1237
1266
|
```
|
|
1238
1267
|
|
|
1239
|
-
|
|
1268
|
+
Set `date_format` to `false` to hide the date picker and make the input [time only](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time):
|
|
1240
1269
|
|
|
1241
1270
|
```yaml
|
|
1242
1271
|
- label: Start Time
|
|
@@ -1245,7 +1274,7 @@ Use `date_format: false` to hide the date picker and make the input [time only](
|
|
|
1245
1274
|
date_format: false
|
|
1246
1275
|
```
|
|
1247
1276
|
|
|
1248
|
-
We understand that this configuration may be a bit confusing, but it’s necessary to maintain backward compatibility with Netlify CMS. We plan to
|
|
1277
|
+
We understand that this configuration may be a bit confusing, but it’s necessary to maintain backward compatibility with Netlify CMS. We plan to add the `type` option to the DateTime widget and introduce new input types: year, [month](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/month) and [week](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week).
|
|
1249
1278
|
|
|
1250
1279
|
### Rendering soft line breaks as hard line breaks in Markdown
|
|
1251
1280
|
|