@tinacms/schema-tools 2.0.0 → 2.2.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.
@@ -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;
@@ -159,6 +179,7 @@ export type StringField = (FieldGeneric<string, undefined> | FieldGeneric<string
159
179
  isTitle?: boolean;
160
180
  isBody?: boolean;
161
181
  options?: Option[];
182
+ width?: 'full' | 'half';
162
183
  };
163
184
  export type NumberField = (FieldGeneric<number, undefined> | FieldGeneric<number, true> | FieldGeneric<number, false>) & BaseField & {
164
185
  type: 'number';
@@ -558,6 +579,54 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
558
579
  loadCustomStore?: never;
559
580
  accept?: string | string[];
560
581
  };
582
+ /**
583
+ * Configuration for repository-related UI features.
584
+ *
585
+ * This allows you to configure how the CMS displays repository information
586
+ * and generates links to view file history in your Git provider (e.g., GitHub, GitLab).
587
+ *
588
+ * @example
589
+ *
590
+ * repoProvider: {
591
+ * defaultBranchName: 'main',
592
+ * historyUrl: ({ relativePath, branch }) => ({
593
+ * url: `https://github.com/owner/repo/commits/${branch}/${relativePath}`
594
+ * })
595
+ * }
596
+ * */
597
+ repoProvider?: {
598
+ /**
599
+ * The default branch name to use when in local mode or when no branch is specified.
600
+ * When not in local mode, TinaCMS will use the branch selected in the editor.
601
+ *
602
+ * This is typically your main/master branch name (e.g., "main", "master").
603
+ */
604
+ defaultBranchName?: string;
605
+ /**
606
+ * A function that generates a URL to view the commit history for a specific file.
607
+ *
608
+ * This URL is used to link to your Git provider's history view (e.g., GitHub's commits page).
609
+ * The function receives the file's relative path and current branch, and should return
610
+ * a URL object with the full URL to the history page.
611
+ *
612
+ * @param context - Context object containing file and branch information
613
+ * @param context.relativePath - The relative path of the file from the repository root
614
+ * @param context.branch - The current branch name
615
+ * @returns An object with a `url` property containing the full URL to the history page
616
+ *
617
+ * @example
618
+ *s
619
+ * historyUrl: ({ relativePath, branch }) => ({
620
+ * url: `https://github.com/tinacms/tinacms/commits/${branch}/examples/next-2024/${relativePath}`
621
+ * })
622
+ * */
623
+ historyUrl?: (context: {
624
+ relativePath: string;
625
+ branch: string;
626
+ }) => {
627
+ url: string;
628
+ };
629
+ };
561
630
  search?: ({
562
631
  /**
563
632
  * An instance of a search client like Algolia
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
3
  "type": "module",
4
- "version": "2.0.0",
4
+ "version": "2.2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -24,7 +24,7 @@
24
24
  "ts-jest": "^29.2.5",
25
25
  "typescript": "^5.7.3",
26
26
  "yup": "^1.6.1",
27
- "@tinacms/scripts": "1.4.1"
27
+ "@tinacms/scripts": "1.4.2"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=16.14.0",