@tinacms/schema-tools 0.1.6 → 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.
@@ -67,8 +67,8 @@ export declare type TinaIndex = {
67
67
  };
68
68
  export interface UICollection {
69
69
  filename?: {
70
- slugify?: (values: unknown) => string;
71
- disabled?: boolean;
70
+ slugify?: (values: Record<string, any>) => string;
71
+ readonly?: boolean;
72
72
  };
73
73
  /**
74
74
  * Forms for this collection will be editable from the global sidebar rather than the form panel
@@ -92,17 +92,19 @@ export interface UICollection {
92
92
  collection: TinaCloudCollection<true>;
93
93
  }) => string | undefined;
94
94
  }
95
+ declare type DefaultItem<ReturnType> = () => ReturnType | ReturnType;
95
96
  interface BaseCollection {
96
97
  label?: string;
97
98
  name: string;
98
99
  path: string;
99
- defaultItem?: () => unknown | unknown;
100
+ defaultItem?: DefaultItem<Record<string, any>>;
100
101
  indexes?: TinaIndex[];
101
102
  format?: FormatType;
102
103
  ui?: UICollection;
103
104
  match?: string;
104
105
  }
105
- 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>;
106
108
  interface CollectionTemplatesInner<WithNamespace extends boolean> extends BaseCollection {
107
109
  templates: (string | GlobalTemplate<WithNamespace>)[];
108
110
  fields?: undefined;
@@ -170,7 +172,9 @@ declare type StringField = {
170
172
  isBody?: boolean;
171
173
  list: true;
172
174
  isTitle?: never;
173
- ui?: UIField<any, string[]>;
175
+ ui?: UIField<any, string[]> & {
176
+ defaultItem?: DefaultItem<string>;
177
+ };
174
178
  };
175
179
  declare type BooleanField = {
176
180
  type: 'boolean';
@@ -288,6 +292,9 @@ interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends Ti
288
292
  type: 'object';
289
293
  visualSelector?: boolean;
290
294
  required?: false;
295
+ ui?: UIField<any, Record<string, any>> & {
296
+ defaultItem?: DefaultItem<Record<string, any>>;
297
+ };
291
298
  list?: boolean;
292
299
  /**
293
300
  * templates can either be an array of Tina templates or a reference to
@@ -306,6 +313,9 @@ interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
306
313
  type: 'object';
307
314
  visualSelector?: boolean;
308
315
  required?: false;
316
+ ui?: UIField<any, Record<string, any>> & {
317
+ defaultItem?: DefaultItem<Record<string, any>>;
318
+ };
309
319
  /**
310
320
  * fields can either be an array of Tina fields, or a reference to the fields
311
321
  * of a global template definition.
@@ -320,6 +330,9 @@ interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends
320
330
  type: 'object';
321
331
  visualSelector?: boolean;
322
332
  required?: false;
333
+ ui?: UIField<any, Record<string, any>> & {
334
+ defaultItem?: DefaultItem<Record<string, any>>;
335
+ };
323
336
  /**
324
337
  * fields can either be an array of Tina fields, or a reference to the fields
325
338
  * of a global template definition.
@@ -386,6 +399,9 @@ export declare type CollectionTemplateableObject = {
386
399
  namespace: string[];
387
400
  type: 'object';
388
401
  visualSelector?: boolean;
402
+ ui?: UIField<any, Record<string, any>> & {
403
+ defaultItem?: DefaultItem<Record<string, any>>;
404
+ };
389
405
  required?: false;
390
406
  template: Templateable;
391
407
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {