@tinacms/schema-tools 0.1.5 → 0.1.7
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.
|
@@ -49,9 +49,7 @@ export declare class TinaSchema {
|
|
|
49
49
|
getGlobalTemplate: (templateName: string) => {
|
|
50
50
|
label: string;
|
|
51
51
|
name: string;
|
|
52
|
-
ui?:
|
|
53
|
-
previewSrc: string;
|
|
54
|
-
});
|
|
52
|
+
ui?: import("../types").UICollection;
|
|
55
53
|
fields: import("../types").TinaFieldInner<true>[];
|
|
56
54
|
namespace: string[];
|
|
57
55
|
};
|
|
@@ -65,49 +65,52 @@ export declare type TinaIndex = {
|
|
|
65
65
|
name: string;
|
|
66
66
|
}[];
|
|
67
67
|
};
|
|
68
|
+
export interface UICollection {
|
|
69
|
+
filename?: {
|
|
70
|
+
slugify?: (values: Record<string, any>) => string;
|
|
71
|
+
readonly?: boolean;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Forms for this collection will be editable from the global sidebar rather than the form panel
|
|
75
|
+
*/
|
|
76
|
+
global?: boolean | {
|
|
77
|
+
icon?: any;
|
|
78
|
+
layout: 'fullscreen' | 'popup';
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Provide the path that your document is viewable on your site
|
|
82
|
+
*
|
|
83
|
+
* eg:
|
|
84
|
+
* ```ts
|
|
85
|
+
* router: ({ document }) => {
|
|
86
|
+
* return `blog-posts/${document._sys.filename}`;
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
router?: (args: {
|
|
91
|
+
document: Document;
|
|
92
|
+
collection: TinaCloudCollection<true>;
|
|
93
|
+
}) => string | undefined;
|
|
94
|
+
}
|
|
95
|
+
declare type DefaultItem<ReturnType> = () => ReturnType | ReturnType;
|
|
68
96
|
interface BaseCollection {
|
|
69
97
|
label?: string;
|
|
70
98
|
name: string;
|
|
71
99
|
path: string;
|
|
72
|
-
defaultItem?:
|
|
100
|
+
defaultItem?: DefaultItem<Record<string, any>>;
|
|
73
101
|
indexes?: TinaIndex[];
|
|
74
102
|
format?: FormatType;
|
|
75
|
-
ui?:
|
|
76
|
-
filename?: {
|
|
77
|
-
slugify?: (values: unknown) => string;
|
|
78
|
-
disabled?: boolean;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Forms for this collection will be editable from the global sidebar rather than the form panel
|
|
82
|
-
*/
|
|
83
|
-
global?: boolean | {
|
|
84
|
-
icon?: any;
|
|
85
|
-
layout: 'fullscreen' | 'popup';
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Provide the path that your document is viewable on your site
|
|
89
|
-
*
|
|
90
|
-
* eg:
|
|
91
|
-
* ```ts
|
|
92
|
-
* router: ({ document }) => {
|
|
93
|
-
* return `blog-posts/${document._sys.filename}`;
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
router?: (args: {
|
|
98
|
-
document: Document;
|
|
99
|
-
collection: TinaCloudCollection<true>;
|
|
100
|
-
}) => string | undefined;
|
|
101
|
-
};
|
|
103
|
+
ui?: UICollection;
|
|
102
104
|
match?: string;
|
|
103
105
|
}
|
|
104
|
-
declare type CollectionTemplates<WithNamespace extends boolean> = WithNamespace extends true ? CollectionTemplatesWithNamespace<WithNamespace> : CollectionTemplatesInner<WithNamespace>;
|
|
106
|
+
export declare type CollectionTemplates<WithNamespace extends boolean> = WithNamespace extends true ? CollectionTemplatesWithNamespace<WithNamespace> : CollectionTemplatesInner<WithNamespace>;
|
|
107
|
+
export declare type TinaTemplate = Template<false>;
|
|
105
108
|
interface CollectionTemplatesInner<WithNamespace extends boolean> extends BaseCollection {
|
|
106
|
-
templates: (string |
|
|
109
|
+
templates: (string | GlobalTemplate<WithNamespace>)[];
|
|
107
110
|
fields?: undefined;
|
|
108
111
|
}
|
|
109
112
|
export interface CollectionTemplatesWithNamespace<WithNamespace extends boolean> extends BaseCollection {
|
|
110
|
-
templates: (string |
|
|
113
|
+
templates: (string | GlobalTemplate<WithNamespace>)[];
|
|
111
114
|
fields?: undefined;
|
|
112
115
|
references?: ReferenceType<WithNamespace>[];
|
|
113
116
|
namespace: WithNamespace extends true ? string[] : undefined;
|
|
@@ -169,7 +172,9 @@ declare type StringField = {
|
|
|
169
172
|
isBody?: boolean;
|
|
170
173
|
list: true;
|
|
171
174
|
isTitle?: never;
|
|
172
|
-
ui?: UIField<any, string[]
|
|
175
|
+
ui?: UIField<any, string[]> & {
|
|
176
|
+
defaultItem?: DefaultItem<string>;
|
|
177
|
+
};
|
|
173
178
|
};
|
|
174
179
|
declare type BooleanField = {
|
|
175
180
|
type: 'boolean';
|
|
@@ -287,6 +292,9 @@ interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends Ti
|
|
|
287
292
|
type: 'object';
|
|
288
293
|
visualSelector?: boolean;
|
|
289
294
|
required?: false;
|
|
295
|
+
ui?: UIField<any, Record<string, any>> & {
|
|
296
|
+
defaultItem?: DefaultItem<Record<string, any>>;
|
|
297
|
+
};
|
|
290
298
|
list?: boolean;
|
|
291
299
|
/**
|
|
292
300
|
* templates can either be an array of Tina templates or a reference to
|
|
@@ -305,6 +313,9 @@ interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
|
|
|
305
313
|
type: 'object';
|
|
306
314
|
visualSelector?: boolean;
|
|
307
315
|
required?: false;
|
|
316
|
+
ui?: UIField<any, Record<string, any>> & {
|
|
317
|
+
defaultItem?: DefaultItem<Record<string, any>>;
|
|
318
|
+
};
|
|
308
319
|
/**
|
|
309
320
|
* fields can either be an array of Tina fields, or a reference to the fields
|
|
310
321
|
* of a global template definition.
|
|
@@ -319,6 +330,9 @@ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends
|
|
|
319
330
|
type: 'object';
|
|
320
331
|
visualSelector?: boolean;
|
|
321
332
|
required?: false;
|
|
333
|
+
ui?: UIField<any, Record<string, any>> & {
|
|
334
|
+
defaultItem?: DefaultItem<Record<string, any>>;
|
|
335
|
+
};
|
|
322
336
|
/**
|
|
323
337
|
* fields can either be an array of Tina fields, or a reference to the fields
|
|
324
338
|
* of a global template definition.
|
|
@@ -338,17 +352,13 @@ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends
|
|
|
338
352
|
export declare type GlobalTemplate<WithNamespace extends boolean> = WithNamespace extends true ? {
|
|
339
353
|
label: string;
|
|
340
354
|
name: string;
|
|
341
|
-
ui?:
|
|
342
|
-
previewSrc: string;
|
|
343
|
-
});
|
|
355
|
+
ui?: UICollection;
|
|
344
356
|
fields: TinaFieldInner<WithNamespace>[];
|
|
345
357
|
namespace: WithNamespace extends true ? string[] : undefined;
|
|
346
358
|
} : {
|
|
347
359
|
label: string;
|
|
348
360
|
name: string;
|
|
349
|
-
ui?:
|
|
350
|
-
previewSrc: string;
|
|
351
|
-
});
|
|
361
|
+
ui?: UICollection;
|
|
352
362
|
fields: TinaFieldInner<WithNamespace>[];
|
|
353
363
|
};
|
|
354
364
|
export declare type TinaCloudTemplateBase = GlobalTemplate<false>;
|
|
@@ -389,6 +399,9 @@ export declare type CollectionTemplateableObject = {
|
|
|
389
399
|
namespace: string[];
|
|
390
400
|
type: 'object';
|
|
391
401
|
visualSelector?: boolean;
|
|
402
|
+
ui?: UIField<any, Record<string, any>> & {
|
|
403
|
+
defaultItem?: DefaultItem<Record<string, any>>;
|
|
404
|
+
};
|
|
392
405
|
required?: false;
|
|
393
406
|
template: Templateable;
|
|
394
407
|
};
|