@sveltia/cms 0.63.1 → 0.65.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 +59 -15
- package/dist/sveltia-cms.js +177 -177
- package/dist/sveltia-cms.js.map +1 -1
- package/dist/sveltia-cms.mjs +177 -177
- package/dist/sveltia-cms.mjs.map +1 -1
- package/package.json +1 -1
- package/types/public.d.ts +79 -31
package/package.json
CHANGED
package/types/public.d.ts
CHANGED
|
@@ -91,6 +91,23 @@ export type UploadcareMediaLibrary = {
|
|
|
91
91
|
* Supported media library.
|
|
92
92
|
*/
|
|
93
93
|
export type MediaLibrary = DefaultMediaLibrary | CloudinaryMediaLibrary | UploadcareMediaLibrary;
|
|
94
|
+
/**
|
|
95
|
+
* Unified media library option that supports multiple libraries.
|
|
96
|
+
*/
|
|
97
|
+
export type MediaLibraries = {
|
|
98
|
+
/**
|
|
99
|
+
* Options for the built-in media library.
|
|
100
|
+
*/
|
|
101
|
+
default?: DefaultMediaLibrary;
|
|
102
|
+
/**
|
|
103
|
+
* Options for the Cloudinary media library.
|
|
104
|
+
*/
|
|
105
|
+
cloudinary?: CloudinaryMediaLibrary;
|
|
106
|
+
/**
|
|
107
|
+
* Options for the Uploadcare media library.
|
|
108
|
+
*/
|
|
109
|
+
uploadcare?: UploadcareMediaLibrary;
|
|
110
|
+
};
|
|
94
111
|
/**
|
|
95
112
|
* Common field properties.
|
|
96
113
|
*/
|
|
@@ -158,7 +175,7 @@ export type FieldMediaLibraryOptions = {
|
|
|
158
175
|
*/
|
|
159
176
|
export type MediaFieldProps = {
|
|
160
177
|
/**
|
|
161
|
-
* Default value.
|
|
178
|
+
* Default value. Accepts a file path or complete URL.
|
|
162
179
|
*/
|
|
163
180
|
default?: string;
|
|
164
181
|
/**
|
|
@@ -176,10 +193,15 @@ export type MediaFieldProps = {
|
|
|
176
193
|
*/
|
|
177
194
|
public_folder?: string;
|
|
178
195
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
196
|
+
* Legacy media library option
|
|
197
|
+
* that allows only one library. Use `media_libraries` to support multiple libraries.
|
|
181
198
|
*/
|
|
182
199
|
media_library?: MediaLibrary & FieldMediaLibraryOptions;
|
|
200
|
+
/**
|
|
201
|
+
* Unified media library option that supports multiple
|
|
202
|
+
* libraries.
|
|
203
|
+
*/
|
|
204
|
+
media_libraries?: MediaLibraries;
|
|
183
205
|
/**
|
|
184
206
|
* Whether to enable multiple item selection in an external
|
|
185
207
|
* media library. Default: `true`.
|
|
@@ -303,7 +325,7 @@ export type BooleanFieldProps = {
|
|
|
303
325
|
*/
|
|
304
326
|
widget: "boolean";
|
|
305
327
|
/**
|
|
306
|
-
* Default value.
|
|
328
|
+
* Default value. Accepts `true` or `false`.
|
|
307
329
|
*/
|
|
308
330
|
default?: boolean;
|
|
309
331
|
};
|
|
@@ -340,7 +362,7 @@ export type CodeFieldProps = {
|
|
|
340
362
|
output_code_only?: boolean;
|
|
341
363
|
/**
|
|
342
364
|
* Output property names. It has no effect if
|
|
343
|
-
* `output_code_only` is `true`.
|
|
365
|
+
* `output_code_only` is `true`. Default: `{ code: 'code', lang: 'lang' }`.
|
|
344
366
|
*/
|
|
345
367
|
keys?: {
|
|
346
368
|
code: string;
|
|
@@ -360,7 +382,8 @@ export type ColorFieldProps = {
|
|
|
360
382
|
*/
|
|
361
383
|
widget: "color";
|
|
362
384
|
/**
|
|
363
|
-
* Default value. Accepts a Hex color code
|
|
385
|
+
* Default value. Accepts a Hex color code in the six-value (`#RRGGBB`)
|
|
386
|
+
* or eight-value (`#RRGGBBAA`) syntax.
|
|
364
387
|
*/
|
|
365
388
|
default?: string;
|
|
366
389
|
/**
|
|
@@ -511,7 +534,9 @@ export type ListFieldProps = {
|
|
|
511
534
|
*/
|
|
512
535
|
widget: "list";
|
|
513
536
|
/**
|
|
514
|
-
* Default value.
|
|
537
|
+
* Default value. The
|
|
538
|
+
* format depends on how the field is configured, with or without `field`, `fields` or `types`. See
|
|
539
|
+
* the document for details.
|
|
515
540
|
*/
|
|
516
541
|
default?: string[] | Record<string, any>[] | Record<string, any>;
|
|
517
542
|
/**
|
|
@@ -569,7 +594,8 @@ export type MapFieldProps = {
|
|
|
569
594
|
*/
|
|
570
595
|
widget: "map";
|
|
571
596
|
/**
|
|
572
|
-
* Default value. Accepts a stringified single GeoJSON geometry object
|
|
597
|
+
* Default value. Accepts a stringified single GeoJSON geometry object
|
|
598
|
+
* that contains `type` and `coordinates` properties.
|
|
573
599
|
*/
|
|
574
600
|
default?: string;
|
|
575
601
|
/**
|
|
@@ -736,12 +762,14 @@ export type RelationFieldProps = {
|
|
|
736
762
|
file?: string;
|
|
737
763
|
/**
|
|
738
764
|
* Field name to be stored as the value, or
|
|
739
|
-
* `{{slug}}
|
|
765
|
+
* `{{slug}}` (entry slug). It can contain a locale prefix like `{{locale}}/{{slug}}` if i18n is
|
|
766
|
+
* enabled. Default: `{{slug}}`.
|
|
740
767
|
*/
|
|
741
|
-
value_field
|
|
768
|
+
value_field?: FieldKeyPath | string;
|
|
742
769
|
/**
|
|
743
770
|
* Name of fields to be displayed. It can
|
|
744
|
-
* contain string templates. Default: `value_field` field value
|
|
771
|
+
* contain string templates. Default: `value_field` field value or the referenced collection’s
|
|
772
|
+
* `identifier_field`, which is `title` by default.
|
|
745
773
|
*/
|
|
746
774
|
display_fields?: (FieldKeyPath | string)[];
|
|
747
775
|
/**
|
|
@@ -854,13 +882,17 @@ export type UuidFieldProps = {
|
|
|
854
882
|
*/
|
|
855
883
|
export type UuidField = CommonFieldProps & UuidFieldProps;
|
|
856
884
|
/**
|
|
857
|
-
*
|
|
885
|
+
* Entry field using a built-in widget.
|
|
886
|
+
*/
|
|
887
|
+
export type StandardField = BooleanField | CodeField | ColorField | ComputeField | DateTimeField | FileField | HiddenField | ImageField | KeyValueField | ListField | MapField | MarkdownField | NumberField | ObjectField | RelationField | SelectField | StringField | TextField | UuidField;
|
|
888
|
+
/**
|
|
889
|
+
* Entry field using a custom widget. It can contain any properties.
|
|
858
890
|
*/
|
|
859
891
|
export type CustomField = CommonFieldProps & Record<string, any>;
|
|
860
892
|
/**
|
|
861
893
|
* Entry field.
|
|
862
894
|
*/
|
|
863
|
-
export type Field =
|
|
895
|
+
export type Field = StandardField | CustomField;
|
|
864
896
|
/**
|
|
865
897
|
* Internationalization (i18n) file structure type.
|
|
866
898
|
*/
|
|
@@ -1171,7 +1203,8 @@ export type Collection = {
|
|
|
1171
1203
|
*/
|
|
1172
1204
|
extension?: FileExtension;
|
|
1173
1205
|
/**
|
|
1174
|
-
* File format.
|
|
1206
|
+
* File format. It should match the file extension. Default:
|
|
1207
|
+
* `yaml-frontmatter`.
|
|
1175
1208
|
*/
|
|
1176
1209
|
format?: FileFormat;
|
|
1177
1210
|
/**
|
|
@@ -1263,7 +1296,7 @@ export type Collection = {
|
|
|
1263
1296
|
/**
|
|
1264
1297
|
* Supported backend name.
|
|
1265
1298
|
*/
|
|
1266
|
-
export type BackendName = "github" | "gitlab";
|
|
1299
|
+
export type BackendName = "github" | "gitlab" | "test-repo";
|
|
1267
1300
|
/**
|
|
1268
1301
|
* Custom commit messages.
|
|
1269
1302
|
*/
|
|
@@ -1309,28 +1342,34 @@ export type BackendOptions = {
|
|
|
1309
1342
|
repo?: string;
|
|
1310
1343
|
/**
|
|
1311
1344
|
* Git branch name. If omitted, the default branch, usually `main` or
|
|
1312
|
-
* `master`, will be used.
|
|
1345
|
+
* `master`, will be used. Git backends only.
|
|
1313
1346
|
*/
|
|
1314
1347
|
branch?: string;
|
|
1315
1348
|
/**
|
|
1316
|
-
* API endpoint
|
|
1317
|
-
* Server or a self-hosted GitLab instance.
|
|
1318
|
-
* `https://gitlab.com/api/v4` (GitLab).
|
|
1349
|
+
* REST API endpoint for the backend. Required when using GitHub
|
|
1350
|
+
* Enterprise Server or a self-hosted GitLab instance. Git backends only. Default:
|
|
1351
|
+
* `https://api.github.com` (GitHub) or `https://gitlab.com/api/v4` (GitLab).
|
|
1319
1352
|
*/
|
|
1320
1353
|
api_root?: string;
|
|
1354
|
+
/**
|
|
1355
|
+
* GraphQL API endpoint for the backend. Git backends only.
|
|
1356
|
+
* Default: inferred from `api_root` option value.
|
|
1357
|
+
*/
|
|
1358
|
+
graphql_api_root?: string;
|
|
1321
1359
|
/**
|
|
1322
1360
|
* Site domain used for OAuth, which will be included in the
|
|
1323
|
-
* `site_id` param to be sent to the API endpoint. Default: `location.hostname`.
|
|
1361
|
+
* `site_id` param to be sent to the API endpoint. Git backends only. Default: `location.hostname`.
|
|
1324
1362
|
*/
|
|
1325
1363
|
site_domain?: string;
|
|
1326
1364
|
/**
|
|
1327
1365
|
* OAuth base URL origin. Required when using an OAuth client other
|
|
1328
|
-
* than Netlify, including Sveltia CMS Authenticator. Default:
|
|
1366
|
+
* than Netlify, including Sveltia CMS Authenticator. Git backends only. Default:
|
|
1367
|
+
* `https://api.netlify.com`.
|
|
1329
1368
|
*/
|
|
1330
1369
|
base_url?: string;
|
|
1331
1370
|
/**
|
|
1332
|
-
* OAuth base URL path. Default: `auth`
|
|
1333
|
-
* `oauth/authorize` (GitLab).
|
|
1371
|
+
* OAuth base URL path. Git backends only. Default: `auth`
|
|
1372
|
+
* (GitHub) or `oauth/authorize` (GitLab).
|
|
1334
1373
|
*/
|
|
1335
1374
|
auth_endpoint?: string;
|
|
1336
1375
|
/**
|
|
@@ -1343,7 +1382,7 @@ export type BackendOptions = {
|
|
|
1343
1382
|
*/
|
|
1344
1383
|
app_id?: string;
|
|
1345
1384
|
/**
|
|
1346
|
-
* Custom commit messages.
|
|
1385
|
+
* Custom commit messages. Git backends only.
|
|
1347
1386
|
*/
|
|
1348
1387
|
commit_messages?: CommitMessages;
|
|
1349
1388
|
/**
|
|
@@ -1351,21 +1390,23 @@ export type BackendOptions = {
|
|
|
1351
1390
|
*/
|
|
1352
1391
|
preview_context?: string;
|
|
1353
1392
|
/**
|
|
1354
|
-
* Pull request label prefix for Editorial Workflow.
|
|
1355
|
-
* `sveltia-cms/`.
|
|
1393
|
+
* Pull request label prefix for Editorial Workflow. Git
|
|
1394
|
+
* backends only. Default: `sveltia-cms/`.
|
|
1356
1395
|
*/
|
|
1357
1396
|
cms_label_prefix?: string;
|
|
1358
1397
|
/**
|
|
1359
|
-
* Whether to use squash marge for Editorial Workflow.
|
|
1360
|
-
* `false`.
|
|
1398
|
+
* Whether to use squash marge for Editorial Workflow. Git
|
|
1399
|
+
* backends only. Default: `false`.
|
|
1361
1400
|
*/
|
|
1362
1401
|
squash_merges?: boolean;
|
|
1363
1402
|
/**
|
|
1364
|
-
* Whether to use Open Authoring. Default:
|
|
1403
|
+
* Whether to use Open Authoring. Git backends only. Default:
|
|
1404
|
+
* `false`.
|
|
1365
1405
|
*/
|
|
1366
1406
|
open_authoring?: boolean;
|
|
1367
1407
|
/**
|
|
1368
|
-
* Authentication scope for Open Authoring.
|
|
1408
|
+
* Authentication scope for Open Authoring. Git
|
|
1409
|
+
* backends only.
|
|
1369
1410
|
*/
|
|
1370
1411
|
auth_scope?: "repo" | "public_repo";
|
|
1371
1412
|
/**
|
|
@@ -1475,9 +1516,16 @@ export type SiteConfig = {
|
|
|
1475
1516
|
*/
|
|
1476
1517
|
public_folder?: string;
|
|
1477
1518
|
/**
|
|
1478
|
-
*
|
|
1519
|
+
* Legacy media library option
|
|
1520
|
+
* that allows only one library. This overrides the global `media_library` option. Use
|
|
1521
|
+
* `media_libraries` to support multiple libraries.
|
|
1479
1522
|
*/
|
|
1480
1523
|
media_library?: MediaLibrary & GlobalMediaLibraryOptions;
|
|
1524
|
+
/**
|
|
1525
|
+
* Unified media library option that supports multiple
|
|
1526
|
+
* libraries. This overrides the global `media_libraries` option.
|
|
1527
|
+
*/
|
|
1528
|
+
media_libraries?: MediaLibraries;
|
|
1481
1529
|
/**
|
|
1482
1530
|
* Site URL. Default: `location.origin`.
|
|
1483
1531
|
*/
|