tinacms 0.0.0-e48ff80-20251203000400 → 0.0.0-e52f289-20251216060413

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.
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { WidgetProps } from './color-input';
3
+ export declare const BlockWidget: React.FC<WidgetProps>;
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ export interface WidgetProps {
3
+ presetColors: string[];
4
+ color: string;
5
+ onChange: (color: string | null) => void;
6
+ width: string;
7
+ }
8
+ export declare const useHexInput: (color: string, onChange: (color: string | null) => void) => {
9
+ inputValue: string;
10
+ handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
+ handleFocus: () => void;
12
+ handleBlur: () => void;
13
+ handleSwatchClick: (c: string) => void;
14
+ };
15
+ export declare const SwatchButton: React.FC<{
16
+ color: string;
17
+ isSelected: boolean;
18
+ onClick: () => void;
19
+ }>;
20
+ export declare const ColorPreview: React.FC<{
21
+ color: string;
22
+ size?: 'sm' | 'lg';
23
+ }>;
24
+ export declare const HexInput: React.FC<{
25
+ value: string;
26
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
27
+ onFocus: () => void;
28
+ onBlur: () => void;
29
+ fullWidth?: boolean;
30
+ }>;
31
+ export declare const SwatchGrid: React.FC<{
32
+ colors: string[];
33
+ selectedColor: string;
34
+ onSelect: (color: string) => void;
35
+ }>;
@@ -1,11 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { ColorFormat } from './color-formatter';
3
- type WrappedFieldProps = any;
3
+ interface FieldInput {
4
+ value: string | null;
5
+ onChange: (value: string | null) => void;
6
+ }
4
7
  interface Props {
5
8
  colorFormat: ColorFormat;
6
9
  userColors: string[];
7
10
  widget?: 'sketch' | 'block';
8
- input: WrappedFieldProps['input'];
11
+ width?: string;
12
+ input: FieldInput;
9
13
  }
10
14
  export declare const ColorPicker: React.FC<Props>;
11
15
  export {};
@@ -0,0 +1,37 @@
1
+ export declare const TRANSPARENT = "transparent";
2
+ export declare const isValidHex: (value: string) => boolean;
3
+ export declare const expandHex: (hex: string) => string;
4
+ export declare const hexToRgb: (hex: string) => {
5
+ r: number;
6
+ g: number;
7
+ b: number;
8
+ } | null;
9
+ /**
10
+ * Converts RGB color values to a hex color string (e.g., "#FF0000" for red).
11
+ *
12
+ * How it works:
13
+ * We need to convert three numbers (r, g, b) each ranging 0-255 into a 6-digit hex string.
14
+ * For example: rgb(255, 128, 0) should become "#FF8000"
15
+ *
16
+ * The bit-shifting approach combines all three values into one number:
17
+ * - (1 << 24) = 16777216 (0x1000000) - This adds a leading '1' to guarantee we always
18
+ * get 7 hex digits, which we later remove. Without this, rgb(0, 0, 255) would give
19
+ * us "FF" instead of "0000FF".
20
+ * - (r << 16) shifts red left by 16 bits, placing it in positions for the first two hex digits
21
+ * - (g << 8) shifts green left by 8 bits, placing it in positions for the middle two hex digits
22
+ * - b stays as-is, occupying the last two hex digits
23
+ *
24
+ * Example with rgb(255, 128, 0):
25
+ * 16777216 + (255 << 16) + (128 << 8) + 0
26
+ * = 16777216 + 16711680 + 32768 + 0
27
+ * = 33521664
28
+ * = 0x1FF8000 (as hex string: "1FF8000")
29
+ * After slice(1): "FF8000"
30
+ * Final result: "#FF8000"
31
+ */
32
+ export declare const rgbToHex: (r: number, g: number, b: number) => string;
33
+ export declare const checkerboardStyle: (size?: number) => {
34
+ backgroundImage: string;
35
+ backgroundSize: string;
36
+ backgroundPosition: string;
37
+ };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { WidgetProps } from './color-input';
3
+ export declare const SketchWidget: React.FC<WidgetProps>;
@@ -4,6 +4,7 @@ export interface ColorFieldProps {
4
4
  colorFormat: string;
5
5
  colors: string[];
6
6
  widget?: 'sketch' | 'block';
7
+ width?: string;
7
8
  }
8
9
  export declare const ColorField: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, ColorFieldProps>) => React.JSX.Element;
9
10
  export declare const ColorFieldPlugin: {
@@ -11,7 +11,7 @@ export declare const EditorContainer: {
11
11
  declare const editorVariants: (props?: {
12
12
  disabled?: boolean;
13
13
  focused?: boolean;
14
- variant?: "default" | "select" | "none" | "comment" | "demo" | "ai" | "aiChat" | "fullWidth";
14
+ variant?: "default" | "select" | "none" | "fullWidth" | "comment" | "demo" | "ai" | "aiChat";
15
15
  } & import("class-variance-authority/types").ClassProp) => string;
16
16
  export type EditorProps = PlateContentProps & VariantProps<typeof editorVariants>;
17
17
  export declare const Editor: React.ForwardRefExoticComponent<Omit<import("@udecode/plate").EditableProps, "decorate"> & {
@@ -22,6 +22,6 @@ export declare const Editor: React.ForwardRefExoticComponent<Omit<import("@udeco
22
22
  } & VariantProps<(props?: {
23
23
  disabled?: boolean;
24
24
  focused?: boolean;
25
- variant?: "default" | "select" | "none" | "comment" | "demo" | "ai" | "aiChat" | "fullWidth";
25
+ variant?: "default" | "select" | "none" | "fullWidth" | "comment" | "demo" | "ai" | "aiChat";
26
26
  } & import("class-variance-authority/types").ClassProp) => string> & React.RefAttributes<HTMLDivElement>>;
27
27
  export {};
@@ -3,12 +3,12 @@ import { type VariantProps } from 'class-variance-authority';
3
3
  export declare const buttonVariants: (props?: {
4
4
  isMenu?: boolean;
5
5
  size?: "default" | "none" | "icon" | "sm" | "lg" | "sms" | "xs";
6
- variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink";
6
+ variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink" | "tinaPrimary";
7
7
  } & import("class-variance-authority/types").ClassProp) => string;
8
8
  export declare const Button: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
9
9
  asChild?: boolean;
10
10
  } & VariantProps<(props?: {
11
11
  isMenu?: boolean;
12
12
  size?: "default" | "none" | "icon" | "sm" | "lg" | "sms" | "xs";
13
- variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink";
13
+ variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink" | "tinaPrimary";
14
14
  } & import("class-variance-authority/types").ClassProp) => string> & React.RefAttributes<HTMLButtonElement>>;
@@ -6,7 +6,7 @@ export declare const Command: React.ForwardRefExoticComponent<Omit<Omit<{
6
6
  ref?: React.Ref<HTMLDivElement>;
7
7
  } & {
8
8
  asChild?: boolean;
9
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
9
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
10
10
  label?: string;
11
11
  shouldFilter?: boolean;
12
12
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -22,7 +22,7 @@ export declare const Command: React.ForwardRefExoticComponent<Omit<Omit<{
22
22
  ref?: React.Ref<HTMLDivElement>;
23
23
  } & {
24
24
  asChild?: boolean;
25
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
25
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
26
26
  label?: string;
27
27
  shouldFilter?: boolean;
28
28
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -68,7 +68,7 @@ export declare const CommandList: React.ForwardRefExoticComponent<Omit<{
68
68
  ref?: React.Ref<HTMLDivElement>;
69
69
  } & {
70
70
  asChild?: boolean;
71
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
71
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
72
72
  label?: string;
73
73
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
74
74
  export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -77,14 +77,14 @@ export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
77
77
  ref?: React.Ref<HTMLDivElement>;
78
78
  } & {
79
79
  asChild?: boolean;
80
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
80
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
81
81
  export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
82
82
  children?: React.ReactNode;
83
83
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
84
84
  ref?: React.Ref<HTMLDivElement>;
85
85
  } & {
86
86
  asChild?: boolean;
87
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
87
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
88
88
  heading?: React.ReactNode;
89
89
  value?: string;
90
90
  forceMount?: boolean;
@@ -93,7 +93,7 @@ export declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick
93
93
  ref?: React.Ref<HTMLDivElement>;
94
94
  } & {
95
95
  asChild?: boolean;
96
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
96
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
97
97
  alwaysRender?: boolean;
98
98
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
99
99
  export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -102,7 +102,7 @@ export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
102
102
  ref?: React.Ref<HTMLDivElement>;
103
103
  } & {
104
104
  asChild?: boolean;
105
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
105
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "disabled" | "onSelect"> & {
106
106
  disabled?: boolean;
107
107
  onSelect?: (value: string) => void;
108
108
  value?: string;
@@ -9,8 +9,33 @@ export interface FormHeaderProps {
9
9
  activeFieldName?: string;
10
10
  tinaForm: Form;
11
11
  };
12
+ branch?: string;
13
+ isLocalMode?: boolean;
14
+ repoProvider?: {
15
+ defaultBranchName?: string;
16
+ historyUrl?: (context: {
17
+ relativePath: string;
18
+ branch: string;
19
+ }) => {
20
+ url: string;
21
+ };
22
+ };
23
+ }
24
+ export declare const FormHeader: ({ activeForm, repoProvider, branch, isLocalMode, }: FormHeaderProps) => React.JSX.Element;
25
+ interface RepositoryProviderProps {
26
+ contentRelativePath: string;
27
+ tinaBranch?: string;
28
+ isLocalMode?: boolean;
29
+ defaultBranchName?: string;
30
+ historyUrl?: (context: {
31
+ relativePath: string;
32
+ branch: string;
33
+ }) => {
34
+ url: string;
35
+ };
12
36
  }
13
- export declare const FormHeader: ({ activeForm }: FormHeaderProps) => React.JSX.Element;
37
+ export declare const FileHistoryProvider: ({ contentRelativePath, tinaBranch, defaultBranchName, historyUrl, isLocalMode, }: RepositoryProviderProps) => React.JSX.Element;
14
38
  export declare const FormBreadcrumbs: ({ rootBreadcrumbName, ...props }: {
15
39
  rootBreadcrumbName?: string;
16
40
  } & React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
41
+ export {};
@@ -29,7 +29,7 @@ export declare class TinaClient<GenQueries> {
29
29
  initialized: boolean;
30
30
  cacheLock: AsyncLock | undefined;
31
31
  cacheDir: string;
32
- cache: Cache;
32
+ cache: Cache | null;
33
33
  constructor({ token, url, queries, errorPolicy, cacheDir, }: TinaClientArgs<GenQueries>);
34
34
  init(): Promise<void>;
35
35
  request<DataType extends Record<string, any> = any>({ errorPolicy, ...args }: TinaClientRequestArgs, options: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tinacms",
3
3
  "type": "module",
4
4
  "typings": "dist/index.d.ts",
5
- "version": "0.0.0-e48ff80-20251203000400",
5
+ "version": "0.0.0-e52f289-20251216060413",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -25,18 +25,11 @@
25
25
  "src/rich-text/static.tsx",
26
26
  "src/rich-text/prism.tsx",
27
27
  "src/react.tsx",
28
- "src/client.ts"
29
- ],
30
- "build": {
31
- "rollupOptions": {
32
- "external": [
33
- "crypto",
34
- "fs",
35
- "path",
36
- "os"
37
- ]
28
+ {
29
+ "name": "src/client.ts",
30
+ "target": "node"
38
31
  }
39
- }
32
+ ]
40
33
  },
41
34
  "license": "Apache-2.0",
42
35
  "dependencies": {
@@ -105,7 +98,7 @@
105
98
  "monaco-editor": "0.31.0",
106
99
  "prism-react-renderer": "^2.4.1",
107
100
  "prop-types": "15.7.2",
108
- "react-color": "^2.19.3",
101
+ "react-colorful": "^5.6.1",
109
102
  "react-datetime": "^3.3.1",
110
103
  "react-day-picker": "^9.11.1",
111
104
  "react-dropzone": "14.2.3",
@@ -117,9 +110,9 @@
117
110
  "webfontloader": "1.6.28",
118
111
  "yup": "^1.6.1",
119
112
  "zod": "^3.24.2",
120
- "@tinacms/mdx": "2.0.0",
121
- "@tinacms/schema-tools": "2.0.0",
122
- "@tinacms/search": "1.1.4"
113
+ "@tinacms/mdx": "2.0.1",
114
+ "@tinacms/search": "1.1.6",
115
+ "@tinacms/schema-tools": "2.1.0"
123
116
  },
124
117
  "devDependencies": {
125
118
  "@graphql-tools/utils": "^10.8.1",
@@ -133,14 +126,12 @@
133
126
  "@types/node": "^22.13.1",
134
127
  "@types/prop-types": "^15.7.14",
135
128
  "@types/react": "^18.3.18",
136
- "@types/react-color": "^3.0.13",
137
129
  "@types/react-dom": "^18.3.5",
138
130
  "happy-dom": "15.10.2",
139
131
  "identity-obj-proxy": "^3.0.0",
140
- "isomorphic-fetch": "^3.0.0",
141
132
  "jest-file-snapshot": "^0.7.0",
142
133
  "lowlight": "^3.3.0",
143
- "next": "14.2.10",
134
+ "next": "14.2.35",
144
135
  "react": "^18.3.1",
145
136
  "react-dom": "^18.3.1",
146
137
  "react-is": "^18.3.1",
@@ -149,7 +140,7 @@
149
140
  "typescript": "^5.7.3",
150
141
  "vite": "^5.4.14",
151
142
  "vitest": "^2.1.9",
152
- "@tinacms/scripts": "1.4.1"
143
+ "@tinacms/scripts": "1.4.2"
153
144
  },
154
145
  "peerDependencies": {
155
146
  "react": ">=16.14.0",
@@ -1,4 +0,0 @@
1
- const __viteBrowserExternal = {};
2
- export {
3
- __viteBrowserExternal as default
4
- };
@@ -1,63 +0,0 @@
1
- const makeCacheDir = async (dir, fs, path, os) => {
2
- const pathParts = dir.split(path.sep).filter(Boolean);
3
- const cacheHash = pathParts[pathParts.length - 1];
4
- const rootUser = pathParts[0];
5
- let cacheDir = dir;
6
- if (!fs.existsSync(path.join(path.sep, rootUser))) {
7
- cacheDir = path.join(os.tmpdir(), cacheHash);
8
- }
9
- try {
10
- fs.mkdirSync(cacheDir, { recursive: true });
11
- } catch (error) {
12
- throw new Error(`Failed to create cache directory: ${error.message}`);
13
- }
14
- return cacheDir;
15
- };
16
- const NodeCache = async (dir) => {
17
- const fs = await import("./__vite-browser-external-d06ac358.js");
18
- const path = await import("./__vite-browser-external-d06ac358.js");
19
- const os = await import("./__vite-browser-external-d06ac358.js");
20
- const crypto = await import("./__vite-browser-external-d06ac358.js");
21
- const cacheDir = await makeCacheDir(dir, fs, path, os);
22
- return {
23
- makeKey: (key) => {
24
- const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
25
- return crypto.createHash("sha256").update(input).digest("hex");
26
- },
27
- get: async (key) => {
28
- let readValue;
29
- const cacheFilename = `${cacheDir}/${key}`;
30
- try {
31
- const data = await fs.promises.readFile(cacheFilename, "utf-8");
32
- readValue = JSON.parse(data);
33
- } catch (e) {
34
- if (e.code !== "ENOENT") {
35
- console.error(
36
- `Failed to read cache file to ${cacheFilename}: ${e.message}`
37
- );
38
- }
39
- }
40
- return readValue;
41
- },
42
- set: async (key, value) => {
43
- const cacheFilename = `${cacheDir}/${key}`;
44
- try {
45
- await fs.promises.writeFile(cacheFilename, JSON.stringify(value), {
46
- encoding: "utf-8",
47
- flag: "wx"
48
- // Don't overwrite existing caches
49
- });
50
- } catch (e) {
51
- if (e.code !== "EEXIST") {
52
- console.error(
53
- `Failed to write cache file to ${cacheFilename}: ${e.message}`
54
- );
55
- }
56
- }
57
- }
58
- };
59
- };
60
- export {
61
- NodeCache,
62
- makeCacheDir
63
- };