@tinacms/schema-tools 1.10.1 → 2.1.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.
@@ -13,7 +13,7 @@ export declare const resolveForm: ({ collection, basename, template, schema, }:
13
13
  fields: {
14
14
  [key: string]: unknown;
15
15
  name: string;
16
- component: NonNullable<import("../types/index").TinaField<true>["ui"]>["component"];
16
+ component: NonNullable<import("..").TinaField<true>["ui"]>["component"];
17
17
  type: string;
18
18
  }[];
19
19
  };
@@ -125,6 +125,26 @@ export type UIField<Type, List extends boolean> = {
125
125
  * @deprecated use `defaultItem` at the collection level instead
126
126
  */
127
127
  defaultValue?: List extends true ? Type[] : Type;
128
+ /**
129
+ * The color format for the color picker component.
130
+ * Can be 'hex' or 'rgb'.
131
+ */
132
+ colorFormat?: 'hex' | 'rgb';
133
+ /**
134
+ * The widget style for the color picker component.
135
+ * Can be 'sketch' or 'block'.
136
+ */
137
+ widget?: 'sketch' | 'block';
138
+ /**
139
+ * The width of the color picker component.
140
+ * Accepts CSS width values (e.g., '350px').
141
+ */
142
+ width?: string;
143
+ /**
144
+ * Preset colors for the color picker component.
145
+ * An array of color strings (e.g., ['#D0021B', '#F5A623']).
146
+ */
147
+ colors?: string[];
128
148
  };
129
149
  type FieldGeneric<Type, List extends boolean | undefined, ExtraFieldUIProps = {}> = List extends true ? {
130
150
  list: true;
@@ -173,8 +193,8 @@ type DateFormatProps = {
173
193
  * dateFormat: 'YYYY MM DD'
174
194
  * ```
175
195
  */
176
- dateFormat?: string;
177
- timeFormat?: string;
196
+ dateFormat?: string | boolean;
197
+ timeFormat?: string | boolean;
178
198
  };
179
199
  export type DateTimeField = (FieldGeneric<string, undefined, DateFormatProps> | FieldGeneric<string, true, DateFormatProps> | FieldGeneric<string, false, DateFormatProps>) & BaseField & {
180
200
  type: 'datetime';
@@ -558,6 +578,54 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
558
578
  loadCustomStore?: never;
559
579
  accept?: string | string[];
560
580
  };
581
+ /**
582
+ * Configuration for repository-related UI features.
583
+ *
584
+ * This allows you to configure how the CMS displays repository information
585
+ * and generates links to view file history in your Git provider (e.g., GitHub, GitLab).
586
+ *
587
+ * @example
588
+ *
589
+ * repoProvider: {
590
+ * defaultBranchName: 'main',
591
+ * historyUrl: ({ relativePath, branch }) => ({
592
+ * url: `https://github.com/owner/repo/commits/${branch}/${relativePath}`
593
+ * })
594
+ * }
595
+ * */
596
+ repoProvider?: {
597
+ /**
598
+ * The default branch name to use when in local mode or when no branch is specified.
599
+ * When not in local mode, TinaCMS will use the branch selected in the editor.
600
+ *
601
+ * This is typically your main/master branch name (e.g., "main", "master").
602
+ */
603
+ defaultBranchName?: string;
604
+ /**
605
+ * A function that generates a URL to view the commit history for a specific file.
606
+ *
607
+ * This URL is used to link to your Git provider's history view (e.g., GitHub's commits page).
608
+ * The function receives the file's relative path and current branch, and should return
609
+ * a URL object with the full URL to the history page.
610
+ *
611
+ * @param context - Context object containing file and branch information
612
+ * @param context.relativePath - The relative path of the file from the repository root
613
+ * @param context.branch - The current branch name
614
+ * @returns An object with a `url` property containing the full URL to the history page
615
+ *
616
+ * @example
617
+ *s
618
+ * historyUrl: ({ relativePath, branch }) => ({
619
+ * url: `https://github.com/tinacms/tinacms/commits/${branch}/examples/next-2024/${relativePath}`
620
+ * })
621
+ * */
622
+ historyUrl?: (context: {
623
+ relativePath: string;
624
+ branch: string;
625
+ }) => {
626
+ url: string;
627
+ };
628
+ };
561
629
  search?: ({
562
630
  /**
563
631
  * An instance of a search client like Algolia
@@ -718,6 +786,7 @@ export interface UICollection<Form = any, CMS = any, TinaForm = any> {
718
786
  allowedActions?: {
719
787
  create?: boolean;
720
788
  delete?: boolean;
789
+ createFolder?: boolean;
721
790
  createNestedFolder?: boolean;
722
791
  };
723
792
  /**
@@ -30,44 +30,44 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
30
30
  isAuthCollection: z.ZodOptional<z.ZodBoolean>;
31
31
  isDetached: z.ZodOptional<z.ZodBoolean>;
32
32
  }, {
33
- fields: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("../types/index").TinaField, z.ZodTypeDef, import("../types/index").TinaField>, "many">>, import("../types/index").TinaField[], import("../types/index").TinaField[]>, import("../types/index").TinaField[], import("../types/index").TinaField[]>, import("../types/index").TinaField[], import("../types/index").TinaField[]>, import("../types/index").TinaField[], import("../types/index").TinaField[]>;
33
+ fields: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodType<import("..").TinaField, z.ZodTypeDef, import("..").TinaField>, "many">>, import("..").TinaField[], import("..").TinaField[]>, import("..").TinaField[], import("..").TinaField[]>, import("..").TinaField[], import("..").TinaField[]>, import("..").TinaField[], import("..").TinaField[]>;
34
34
  templates: z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
35
35
  label: z.ZodString;
36
36
  name: z.ZodEffects<z.ZodString, string, string>;
37
- fields: z.ZodArray<z.ZodType<import("../types/index").TinaField, z.ZodTypeDef, import("../types/index").TinaField>, "many">;
37
+ fields: z.ZodArray<z.ZodType<import("..").TinaField, z.ZodTypeDef, import("..").TinaField>, "many">;
38
38
  }, "strip", z.ZodTypeAny, {
39
39
  name?: string;
40
- fields?: import("../types/index").TinaField[];
40
+ fields?: import("..").TinaField[];
41
41
  label?: string;
42
42
  }, {
43
43
  name?: string;
44
- fields?: import("../types/index").TinaField[];
44
+ fields?: import("..").TinaField[];
45
45
  label?: string;
46
46
  }>, {
47
47
  name?: string;
48
- fields?: import("../types/index").TinaField[];
48
+ fields?: import("..").TinaField[];
49
49
  label?: string;
50
50
  }, {
51
51
  name?: string;
52
- fields?: import("../types/index").TinaField[];
52
+ fields?: import("..").TinaField[];
53
53
  label?: string;
54
54
  }>, "many">>, {
55
55
  name?: string;
56
- fields?: import("../types/index").TinaField[];
56
+ fields?: import("..").TinaField[];
57
57
  label?: string;
58
58
  }[], {
59
59
  name?: string;
60
- fields?: import("../types/index").TinaField[];
60
+ fields?: import("..").TinaField[];
61
61
  label?: string;
62
62
  }[]>;
63
63
  }>, "strip", z.ZodTypeAny, {
64
64
  name?: string;
65
65
  templates?: {
66
66
  name?: string;
67
- fields?: import("../types/index").TinaField[];
67
+ fields?: import("..").TinaField[];
68
68
  label?: string;
69
69
  }[];
70
- fields?: import("../types/index").TinaField[];
70
+ fields?: import("..").TinaField[];
71
71
  label?: string;
72
72
  path?: string;
73
73
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -77,10 +77,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
77
77
  name?: string;
78
78
  templates?: {
79
79
  name?: string;
80
- fields?: import("../types/index").TinaField[];
80
+ fields?: import("..").TinaField[];
81
81
  label?: string;
82
82
  }[];
83
- fields?: import("../types/index").TinaField[];
83
+ fields?: import("..").TinaField[];
84
84
  label?: string;
85
85
  path?: string;
86
86
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -90,10 +90,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
90
90
  name?: string;
91
91
  templates?: {
92
92
  name?: string;
93
- fields?: import("../types/index").TinaField[];
93
+ fields?: import("..").TinaField[];
94
94
  label?: string;
95
95
  }[];
96
- fields?: import("../types/index").TinaField[];
96
+ fields?: import("..").TinaField[];
97
97
  label?: string;
98
98
  path?: string;
99
99
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -103,10 +103,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
103
103
  name?: string;
104
104
  templates?: {
105
105
  name?: string;
106
- fields?: import("../types/index").TinaField[];
106
+ fields?: import("..").TinaField[];
107
107
  label?: string;
108
108
  }[];
109
- fields?: import("../types/index").TinaField[];
109
+ fields?: import("..").TinaField[];
110
110
  label?: string;
111
111
  path?: string;
112
112
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -274,10 +274,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
274
274
  name?: string;
275
275
  templates?: {
276
276
  name?: string;
277
- fields?: import("../types/index").TinaField[];
277
+ fields?: import("..").TinaField[];
278
278
  label?: string;
279
279
  }[];
280
- fields?: import("../types/index").TinaField[];
280
+ fields?: import("..").TinaField[];
281
281
  label?: string;
282
282
  path?: string;
283
283
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -319,10 +319,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
319
319
  name?: string;
320
320
  templates?: {
321
321
  name?: string;
322
- fields?: import("../types/index").TinaField[];
322
+ fields?: import("..").TinaField[];
323
323
  label?: string;
324
324
  }[];
325
- fields?: import("../types/index").TinaField[];
325
+ fields?: import("..").TinaField[];
326
326
  label?: string;
327
327
  path?: string;
328
328
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -364,10 +364,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
364
364
  name?: string;
365
365
  templates?: {
366
366
  name?: string;
367
- fields?: import("../types/index").TinaField[];
367
+ fields?: import("..").TinaField[];
368
368
  label?: string;
369
369
  }[];
370
- fields?: import("../types/index").TinaField[];
370
+ fields?: import("..").TinaField[];
371
371
  label?: string;
372
372
  path?: string;
373
373
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
@@ -409,10 +409,10 @@ export declare const TinaCloudSchemaZod: z.ZodEffects<z.ZodObject<{
409
409
  name?: string;
410
410
  templates?: {
411
411
  name?: string;
412
- fields?: import("../types/index").TinaField[];
412
+ fields?: import("..").TinaField[];
413
413
  label?: string;
414
414
  }[];
415
- fields?: import("../types/index").TinaField[];
415
+ fields?: import("..").TinaField[];
416
416
  label?: string;
417
417
  path?: string;
418
418
  format?: "mdx" | "md" | "markdown" | "json" | "yaml" | "yml" | "toml";
package/package.json CHANGED
@@ -1,16 +1,9 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "1.10.1",
3
+ "type": "module",
4
+ "version": "2.1.0",
4
5
  "main": "dist/index.js",
5
- "module": "./dist/index.mjs",
6
- "exports": {
7
- ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.mjs",
10
- "require": "./dist/index.js"
11
- }
12
- },
13
- "typings": "dist/index.d.ts",
6
+ "types": "dist/index.d.ts",
14
7
  "files": [
15
8
  "dist"
16
9
  ],
@@ -31,7 +24,7 @@
31
24
  "ts-jest": "^29.2.5",
32
25
  "typescript": "^5.7.3",
33
26
  "yup": "^1.6.1",
34
- "@tinacms/scripts": "1.4.1"
27
+ "@tinacms/scripts": "1.4.2"
35
28
  },
36
29
  "peerDependencies": {
37
30
  "react": ">=16.14.0",