@sveltia/cms 0.121.5 → 0.122.1
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 +40 -20
- package/dist/sveltia-cms.js +317 -293
- package/dist/sveltia-cms.js.map +1 -1
- package/dist/sveltia-cms.mjs +317 -293
- package/dist/sveltia-cms.mjs.map +1 -1
- package/main.d.ts +7 -1
- package/package.json +3 -2
- package/schema/sveltia-cms.json +1 -1
- package/types/public.d.ts +121 -8
package/types/public.d.ts
CHANGED
|
@@ -833,7 +833,7 @@ export type ComplexListField = ListFieldWithSubField | ListFieldWithSubFields |
|
|
|
833
833
|
/**
|
|
834
834
|
* List field definition.
|
|
835
835
|
*/
|
|
836
|
-
export type ListField = SimpleListField |
|
|
836
|
+
export type ListField = SimpleListField | ListFieldWithSubField | ListFieldWithSubFields | ListFieldWithTypes;
|
|
837
837
|
/**
|
|
838
838
|
* Map field properties.
|
|
839
839
|
*/
|
|
@@ -2316,6 +2316,119 @@ export type EditorComponentDefinition = {
|
|
|
2316
2316
|
* Supported event type.
|
|
2317
2317
|
*/
|
|
2318
2318
|
export type AppEventType = "prePublish" | "postPublish" | "preUnpublish" | "postUnpublish" | "preSave" | "postSave";
|
|
2319
|
+
/**
|
|
2320
|
+
* Author information for an event.
|
|
2321
|
+
*/
|
|
2322
|
+
export type AppEventAuthor = {
|
|
2323
|
+
/**
|
|
2324
|
+
* Author login name.
|
|
2325
|
+
*/
|
|
2326
|
+
login?: string;
|
|
2327
|
+
/**
|
|
2328
|
+
* Author display name.
|
|
2329
|
+
*/
|
|
2330
|
+
name?: string;
|
|
2331
|
+
};
|
|
2332
|
+
/**
|
|
2333
|
+
* Event entry media file data.
|
|
2334
|
+
*/
|
|
2335
|
+
export type AppEventEntryMedia = {
|
|
2336
|
+
/**
|
|
2337
|
+
* Media file ID.
|
|
2338
|
+
*/
|
|
2339
|
+
id: string;
|
|
2340
|
+
/**
|
|
2341
|
+
* Media file path.
|
|
2342
|
+
*/
|
|
2343
|
+
path: string;
|
|
2344
|
+
/**
|
|
2345
|
+
* Media file name.
|
|
2346
|
+
*/
|
|
2347
|
+
name: string;
|
|
2348
|
+
/**
|
|
2349
|
+
* Media file URL.
|
|
2350
|
+
*/
|
|
2351
|
+
url: string;
|
|
2352
|
+
/**
|
|
2353
|
+
* Media file display URL.
|
|
2354
|
+
*/
|
|
2355
|
+
displayURL: string;
|
|
2356
|
+
/**
|
|
2357
|
+
* Media file size in bytes.
|
|
2358
|
+
*/
|
|
2359
|
+
size: number;
|
|
2360
|
+
/**
|
|
2361
|
+
* Media file object.
|
|
2362
|
+
*/
|
|
2363
|
+
file: File;
|
|
2364
|
+
};
|
|
2365
|
+
/**
|
|
2366
|
+
* Event entry data.
|
|
2367
|
+
*/
|
|
2368
|
+
export type AppEventEntry = {
|
|
2369
|
+
/**
|
|
2370
|
+
* Entry data for the default locale.
|
|
2371
|
+
*/
|
|
2372
|
+
data: Record<string, any>;
|
|
2373
|
+
/**
|
|
2374
|
+
* Entry data for other locales with locale codes as keys.
|
|
2375
|
+
*/
|
|
2376
|
+
i18n: Record<string, any>;
|
|
2377
|
+
/**
|
|
2378
|
+
* Entry slug.
|
|
2379
|
+
*/
|
|
2380
|
+
slug: string;
|
|
2381
|
+
/**
|
|
2382
|
+
* Entry file path.
|
|
2383
|
+
*/
|
|
2384
|
+
path: string;
|
|
2385
|
+
/**
|
|
2386
|
+
* Whether the entry is newly created.
|
|
2387
|
+
*/
|
|
2388
|
+
newRecord: boolean;
|
|
2389
|
+
/**
|
|
2390
|
+
* Name of the collection.
|
|
2391
|
+
*/
|
|
2392
|
+
collection: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* List of media files associated with the entry.
|
|
2395
|
+
*/
|
|
2396
|
+
mediaFiles: AppEventEntryMedia[];
|
|
2397
|
+
/**
|
|
2398
|
+
* Entry meta data.
|
|
2399
|
+
*/
|
|
2400
|
+
meta: {
|
|
2401
|
+
path: string;
|
|
2402
|
+
};
|
|
2403
|
+
/**
|
|
2404
|
+
* Unknown. Always `null`.
|
|
2405
|
+
*/
|
|
2406
|
+
isModification: null;
|
|
2407
|
+
/**
|
|
2408
|
+
* Unknown. Always `null`.
|
|
2409
|
+
*/
|
|
2410
|
+
label: null;
|
|
2411
|
+
/**
|
|
2412
|
+
* Unknown. Always `false`.
|
|
2413
|
+
*/
|
|
2414
|
+
partial: boolean;
|
|
2415
|
+
/**
|
|
2416
|
+
* Unknown. Always an empty string.
|
|
2417
|
+
*/
|
|
2418
|
+
author: string;
|
|
2419
|
+
/**
|
|
2420
|
+
* Unknown. Always an empty string.
|
|
2421
|
+
*/
|
|
2422
|
+
raw: string;
|
|
2423
|
+
/**
|
|
2424
|
+
* Unknown. Always an empty string.
|
|
2425
|
+
*/
|
|
2426
|
+
status: string;
|
|
2427
|
+
/**
|
|
2428
|
+
* Unknown. Always an empty string.
|
|
2429
|
+
*/
|
|
2430
|
+
updatedOn: string;
|
|
2431
|
+
};
|
|
2319
2432
|
/**
|
|
2320
2433
|
* Event listener properties.
|
|
2321
2434
|
*/
|
|
@@ -2325,15 +2438,14 @@ export type AppEventListener = {
|
|
|
2325
2438
|
*/
|
|
2326
2439
|
name: AppEventType;
|
|
2327
2440
|
/**
|
|
2328
|
-
* Event handler.
|
|
2441
|
+
* Event handler. For
|
|
2442
|
+
* the `preSave` event, the handler can return a modified entry object in Immutable Map format to
|
|
2443
|
+
* change the data before it is saved. For other events, the return value is ignored.
|
|
2329
2444
|
*/
|
|
2330
2445
|
handler: (args: {
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
name: string;
|
|
2335
|
-
};
|
|
2336
|
-
}) => any;
|
|
2446
|
+
author: AppEventAuthor;
|
|
2447
|
+
entry: MapOf<AppEventEntry>;
|
|
2448
|
+
}) => void | MapOf<AppEventEntry> | Promise<void> | Promise<MapOf<AppEventEntry>>;
|
|
2337
2449
|
};
|
|
2338
2450
|
export type CustomPreviewTemplateProps = {
|
|
2339
2451
|
entry: Record<string, any>;
|
|
@@ -2363,3 +2475,4 @@ export type CustomWidgetSchema = {
|
|
|
2363
2475
|
properties: Record<string, any>;
|
|
2364
2476
|
};
|
|
2365
2477
|
import type { JSX } from 'react';
|
|
2478
|
+
import type { MapOf } from 'immutable';
|