@tinacms/schema-tools 0.1.5 → 0.1.6
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,6 +65,33 @@ export declare type TinaIndex = {
|
|
|
65
65
|
name: string;
|
|
66
66
|
}[];
|
|
67
67
|
};
|
|
68
|
+
export interface UICollection {
|
|
69
|
+
filename?: {
|
|
70
|
+
slugify?: (values: unknown) => string;
|
|
71
|
+
disabled?: 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
|
+
}
|
|
68
95
|
interface BaseCollection {
|
|
69
96
|
label?: string;
|
|
70
97
|
name: string;
|
|
@@ -72,42 +99,16 @@ interface BaseCollection {
|
|
|
72
99
|
defaultItem?: () => unknown | unknown;
|
|
73
100
|
indexes?: TinaIndex[];
|
|
74
101
|
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
|
-
};
|
|
102
|
+
ui?: UICollection;
|
|
102
103
|
match?: string;
|
|
103
104
|
}
|
|
104
105
|
declare type CollectionTemplates<WithNamespace extends boolean> = WithNamespace extends true ? CollectionTemplatesWithNamespace<WithNamespace> : CollectionTemplatesInner<WithNamespace>;
|
|
105
106
|
interface CollectionTemplatesInner<WithNamespace extends boolean> extends BaseCollection {
|
|
106
|
-
templates: (string |
|
|
107
|
+
templates: (string | GlobalTemplate<WithNamespace>)[];
|
|
107
108
|
fields?: undefined;
|
|
108
109
|
}
|
|
109
110
|
export interface CollectionTemplatesWithNamespace<WithNamespace extends boolean> extends BaseCollection {
|
|
110
|
-
templates: (string |
|
|
111
|
+
templates: (string | GlobalTemplate<WithNamespace>)[];
|
|
111
112
|
fields?: undefined;
|
|
112
113
|
references?: ReferenceType<WithNamespace>[];
|
|
113
114
|
namespace: WithNamespace extends true ? string[] : undefined;
|
|
@@ -338,17 +339,13 @@ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends
|
|
|
338
339
|
export declare type GlobalTemplate<WithNamespace extends boolean> = WithNamespace extends true ? {
|
|
339
340
|
label: string;
|
|
340
341
|
name: string;
|
|
341
|
-
ui?:
|
|
342
|
-
previewSrc: string;
|
|
343
|
-
});
|
|
342
|
+
ui?: UICollection;
|
|
344
343
|
fields: TinaFieldInner<WithNamespace>[];
|
|
345
344
|
namespace: WithNamespace extends true ? string[] : undefined;
|
|
346
345
|
} : {
|
|
347
346
|
label: string;
|
|
348
347
|
name: string;
|
|
349
|
-
ui?:
|
|
350
|
-
previewSrc: string;
|
|
351
|
-
});
|
|
348
|
+
ui?: UICollection;
|
|
352
349
|
fields: TinaFieldInner<WithNamespace>[];
|
|
353
350
|
};
|
|
354
351
|
export declare type TinaCloudTemplateBase = GlobalTemplate<false>;
|