tinacms 3.3.0 → 3.3.2

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.
package/dist/react.js CHANGED
@@ -54,15 +54,6 @@ function useTina(props) {
54
54
  }
55
55
  }
56
56
  if (fieldName) {
57
- if (lastHoveredField !== null) {
58
- lastHoveredField = null;
59
- if (isInTinaIframe) {
60
- parent.postMessage(
61
- { type: "field:hovered", fieldName: null },
62
- window.location.origin
63
- );
64
- }
65
- }
66
57
  if (isInTinaIframe) {
67
58
  parent.postMessage(
68
59
  { type: "field:selected", fieldName },
@@ -70,40 +61,6 @@ function useTina(props) {
70
61
  );
71
62
  }
72
63
  }
73
- }, mouseEnterHandler = function(e) {
74
- if (!(e.target instanceof Element)) {
75
- return;
76
- }
77
- const attributeNames = e.target.getAttributeNames();
78
- const tinaAttribute = attributeNames.find(
79
- (name) => name.startsWith("data-tina-field")
80
- );
81
- let fieldName;
82
- if (tinaAttribute) {
83
- fieldName = e.target.getAttribute(tinaAttribute);
84
- } else {
85
- const ancestor = e.target.closest(
86
- "[data-tina-field], [data-tina-field-overlay]"
87
- );
88
- if (ancestor) {
89
- const attributeNames2 = ancestor.getAttributeNames();
90
- const tinaAttribute2 = attributeNames2.find(
91
- (name) => name.startsWith("data-tina-field")
92
- );
93
- if (tinaAttribute2) {
94
- fieldName = ancestor.getAttribute(tinaAttribute2);
95
- }
96
- }
97
- }
98
- if (fieldName && fieldName !== lastHoveredField) {
99
- lastHoveredField = fieldName;
100
- if (isInTinaIframe) {
101
- parent.postMessage(
102
- { type: "field:hovered", fieldName },
103
- window.location.origin
104
- );
105
- }
106
- }
107
64
  };
108
65
  const style = document.createElement("style");
109
66
  style.type = "text/css";
@@ -117,15 +74,6 @@ function useTina(props) {
117
74
  outline: 2px solid rgba(34,150,254,1);
118
75
  cursor: pointer;
119
76
  }
120
- [data-tina-field-focused] {
121
- outline: 2px dashed #C2410C !important;
122
- box-shadow: none !important;
123
- }
124
- [data-tina-field-focused]:hover {
125
- box-shadow: inset 100vi 100vh rgba(194, 65, 12, 0.3) !important;
126
- outline: 2px solid #C2410C !important;
127
- cursor: pointer;
128
- }
129
77
  [data-tina-field-overlay] {
130
78
  outline: 2px dashed rgba(34,150,254,0.5);
131
79
  position: relative;
@@ -146,19 +94,12 @@ function useTina(props) {
146
94
  [data-tina-field-overlay]:hover::after {
147
95
  opacity: 1;
148
96
  }
149
- [data-tina-field-overlay][data-tina-field-focused]::after {
150
- background-color: rgba(194, 65, 12, 0.3);
151
- opacity: 1;
152
- }
153
97
  `;
154
98
  document.head.appendChild(style);
155
99
  document.body.classList.add("__tina-quick-editing-enabled");
156
- let lastHoveredField = null;
157
100
  document.addEventListener("click", mouseDownHandler, true);
158
- document.addEventListener("mouseenter", mouseEnterHandler, true);
159
101
  return () => {
160
102
  document.removeEventListener("click", mouseDownHandler, true);
161
- document.removeEventListener("mouseenter", mouseEnterHandler, true);
162
103
  document.body.classList.remove("__tina-quick-editing-enabled");
163
104
  style.remove();
164
105
  };
@@ -172,7 +113,6 @@ function useTina(props) {
172
113
  });
173
114
  }
174
115
  }, [id]);
175
- const lastFocusedFieldRef = React.useRef(null);
176
116
  React.useEffect(() => {
177
117
  const { experimental___selectFormByFormId, ...rest } = props;
178
118
  parent.postMessage({ type: "open", ...rest, id }, window.location.origin);
@@ -202,40 +142,6 @@ function useTina(props) {
202
142
  );
203
143
  }
204
144
  }
205
- if (event.data.type === "field:set-focused") {
206
- const newFieldName = event.data.fieldName;
207
- if (newFieldName === lastFocusedFieldRef.current) {
208
- return;
209
- }
210
- lastFocusedFieldRef.current = newFieldName;
211
- const allTinaFields = document.querySelectorAll("[data-tina-field]");
212
- allTinaFields.forEach((el) => {
213
- el.removeAttribute("data-tina-field-focused");
214
- });
215
- if (newFieldName) {
216
- let targetElement = document.querySelector(
217
- `[data-tina-field="${newFieldName}"]`
218
- );
219
- if (!targetElement) {
220
- const allFields = Array.from(allTinaFields);
221
- targetElement = allFields.find((el) => {
222
- const fieldValue = el.getAttribute("data-tina-field");
223
- return fieldValue && fieldValue.endsWith(newFieldName.split("---")[1]);
224
- });
225
- }
226
- if (targetElement) {
227
- targetElement.setAttribute("data-tina-field-focused", "true");
228
- const rect = targetElement.getBoundingClientRect();
229
- const isInViewport = rect.top >= 0 && rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth;
230
- if (!isInViewport) {
231
- targetElement.scrollIntoView({
232
- behavior: "smooth",
233
- block: "center"
234
- });
235
- }
236
- }
237
- }
238
- }
239
145
  };
240
146
  window.addEventListener("message", handleMessage);
241
147
  return () => {
@@ -1,3 +1,2 @@
1
1
  import * as React from 'react';
2
2
  export declare const ActiveFieldIndicator: () => React.JSX.Element;
3
- export declare const HoveredFieldIndicator: () => React.JSX.Element;
@@ -4,6 +4,6 @@ export interface PasswordFieldProps extends a {
4
4
  error?: boolean;
5
5
  ref?: any;
6
6
  }
7
- export declare const passwordFieldClasses = "shadow-inner focus:shadow-outline focus:border-tina-orange-dark focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
7
+ export declare const passwordFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
8
8
  export declare const BasePasswordField: React.ForwardRefExoticComponent<Omit<PasswordFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
9
9
  export {};
@@ -18,6 +18,6 @@ export interface SelectProps {
18
18
  options?: (Option | string)[];
19
19
  className?: string;
20
20
  }
21
- export declare const selectFieldClasses = "shadow appearance-none h-full bg-white block pl-3 pr-8 py-2 truncate w-full text-base cursor-pointer border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-tina-orange-dark focus:border-tina-orange-dark sm:text-sm rounded";
21
+ export declare const selectFieldClasses = "shadow appearance-none h-full bg-white block pl-3 pr-8 py-2 truncate w-full text-base cursor-pointer border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded";
22
22
  export declare const Select: React.FC<SelectProps>;
23
23
  export {};
@@ -4,6 +4,6 @@ export interface TextFieldProps extends a {
4
4
  error?: boolean;
5
5
  ref?: any;
6
6
  }
7
- export declare const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-tina-orange-dark focus-visible:ring-0 focus:outline-none focus:ring-2 block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
7
+ export declare const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
8
8
  export declare const BaseTextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
9
9
  export {};
@@ -22,16 +22,12 @@ interface FieldMetaProps extends React.HTMLAttributes<HTMLElement> {
22
22
  index?: number;
23
23
  tinaForm: Form;
24
24
  field?: Field;
25
- focusIntent?: boolean;
26
- hoverIntent?: boolean;
27
25
  }
28
- export declare const FieldMeta: ({ name, label, description, error, margin, children, index, tinaForm, field, focusIntent, hoverIntent, ...props }: FieldMetaProps) => React.JSX.Element;
29
- export declare const FieldWrapper: ({ margin, children, field, "data-tina-field-active": dataActive, "data-tina-field-hovering": dataHovering, ...props }: {
26
+ export declare const FieldMeta: ({ name, label, description, error, margin, children, index, tinaForm, field, ...props }: FieldMetaProps) => React.JSX.Element;
27
+ export declare const FieldWrapper: ({ margin, children, field, ...props }: {
30
28
  margin: boolean;
31
29
  children: React.ReactNode;
32
30
  field?: Field;
33
- "data-tina-field-active"?: string;
34
- "data-tina-field-hovering"?: string;
35
31
  } & Partial<React.ComponentPropsWithoutRef<"div">>) => React.JSX.Element;
36
32
  export interface FieldLabel extends React.HTMLAttributes<HTMLLabelElement> {
37
33
  children?: any | any[];
@@ -3,11 +3,10 @@ import * as React from 'react';
3
3
  export interface FieldsBuilderProps {
4
4
  form: Form;
5
5
  activeFieldName?: string;
6
- hoveringFieldName?: string;
7
6
  fields: Field[];
8
7
  padding?: boolean;
9
8
  }
10
- export declare function FieldsBuilder({ form, fields, activeFieldName, hoveringFieldName, padding, }: FieldsBuilderProps): React.JSX.Element;
9
+ export declare function FieldsBuilder({ form, fields, activeFieldName, padding, }: FieldsBuilderProps): React.JSX.Element;
11
10
  export declare const FieldsGroup: ({ children, }: {
12
11
  children?: any | any[];
13
12
  }) => React.JSX.Element;
@@ -5,7 +5,6 @@ export interface FormBuilderProps {
5
5
  form: {
6
6
  tinaForm: Form;
7
7
  activeFieldName?: string;
8
- hoveringFieldName?: string;
9
8
  };
10
9
  hideFooter?: boolean;
11
10
  label?: string;
@@ -21,10 +21,9 @@ export interface Field<F extends Field = AnyField> {
21
21
  * a guarantee that the given field will receive focus since that functionality
22
22
  * needs to be built on a per-component basis.
23
23
  *
24
- * This is also a one-way street. The "active field" for a given form isn't
24
+ * This is also a one-way stree. The "active field" for a given form isn't
25
25
  * necessarily updated when a user clicks on a new field. So you can have a
26
26
  * field which is marked as the active field, and have focus on another field
27
27
  */
28
- focusIntent?: boolean;
29
- hoverIntent?: boolean;
28
+ experimental_focusIntent?: boolean;
30
29
  }
@@ -1,24 +1,5 @@
1
1
  import { Form } from './react-tinacms';
2
2
  import { TinaCMS } from './tina-cms';
3
- export declare const ACTION_TYPES: {
4
- readonly FORMS_ADD: "forms:add";
5
- readonly FORMS_REMOVE: "forms:remove";
6
- readonly FORMS_CLEAR: "forms:clear";
7
- readonly FORMS_SET_ACTIVE_FORM_ID: "forms:set-active-form-id";
8
- readonly FORMS_SET_ACTIVE_FIELD_NAME: "forms:set-active-field-name";
9
- readonly FORMS_SET_HOVERED_FIELD_NAME: "forms:set-hovered-field-name";
10
- readonly FORM_LISTS_ADD: "form-lists:add";
11
- readonly FORM_LISTS_REMOVE: "form-lists:remove";
12
- readonly FORM_LISTS_CLEAR: "form-lists:clear";
13
- readonly SET_EDIT_MODE: "set-edit-mode";
14
- readonly INCREMENT_OPERATION_INDEX: "increment-operation-index";
15
- readonly SET_QUICK_EDITING_SUPPORTED: "set-quick-editing-supported";
16
- readonly SET_QUICK_EDITING_ENABLED: "set-quick-editing-enabled";
17
- readonly TOGGLE_QUICK_EDITING_ENABLED: "toggle-quick-editing-enabled";
18
- readonly TOGGLE_EDIT_STATE: "toggle-edit-state";
19
- readonly SIDEBAR_SET_DISPLAY_STATE: "sidebar:set-display-state";
20
- readonly SIDEBAR_SET_LOADING_STATE: "sidebar:set-loading-state";
21
- };
22
3
  type FormListItem = {
23
4
  type: 'document';
24
5
  path: string;
@@ -41,56 +22,50 @@ type Breadcrumb = {
41
22
  namespace: string[];
42
23
  };
43
24
  export type TinaAction = {
44
- type: typeof ACTION_TYPES.FORMS_ADD;
25
+ type: 'forms:add';
45
26
  value: Form;
46
27
  } | {
47
- type: typeof ACTION_TYPES.FORMS_REMOVE;
28
+ type: 'forms:remove';
48
29
  value: string;
49
30
  } | {
50
- type: typeof ACTION_TYPES.FORMS_CLEAR;
31
+ type: 'forms:clear';
51
32
  } | {
52
- type: typeof ACTION_TYPES.FORM_LISTS_ADD;
33
+ type: 'form-lists:add';
53
34
  value: FormList;
54
35
  } | {
55
- type: typeof ACTION_TYPES.FORM_LISTS_REMOVE;
36
+ type: 'form-lists:remove';
56
37
  value: string;
57
38
  } | {
58
- type: typeof ACTION_TYPES.FORMS_SET_ACTIVE_FORM_ID;
39
+ type: 'forms:set-active-form-id';
59
40
  value: string;
60
41
  } | {
61
- type: typeof ACTION_TYPES.FORMS_SET_ACTIVE_FIELD_NAME;
42
+ type: 'forms:set-active-field-name';
62
43
  value: {
63
44
  formId: string;
64
45
  fieldName: string;
65
46
  };
66
47
  } | {
67
- type: typeof ACTION_TYPES.FORMS_SET_HOVERED_FIELD_NAME;
68
- value: {
69
- formId: string;
70
- fieldName: string | null;
71
- };
72
- } | {
73
- type: typeof ACTION_TYPES.FORM_LISTS_CLEAR;
48
+ type: 'form-lists:clear';
74
49
  } | {
75
- type: typeof ACTION_TYPES.SET_EDIT_MODE;
50
+ type: 'set-edit-mode';
76
51
  value: 'visual' | 'basic';
77
52
  } | {
78
- type: typeof ACTION_TYPES.INCREMENT_OPERATION_INDEX;
53
+ type: 'increment-operation-index';
79
54
  } | {
80
- type: typeof ACTION_TYPES.SET_QUICK_EDITING_SUPPORTED;
55
+ type: 'set-quick-editing-supported';
81
56
  value: boolean;
82
57
  } | {
83
- type: typeof ACTION_TYPES.SET_QUICK_EDITING_ENABLED;
58
+ type: 'set-quick-editing-enabled';
84
59
  value?: boolean;
85
60
  } | {
86
- type: typeof ACTION_TYPES.TOGGLE_QUICK_EDITING_ENABLED;
61
+ type: 'toggle-quick-editing-enabled';
87
62
  } | {
88
- type: typeof ACTION_TYPES.TOGGLE_EDIT_STATE;
63
+ type: 'toggle-edit-state';
89
64
  } | {
90
- type: typeof ACTION_TYPES.SIDEBAR_SET_DISPLAY_STATE;
65
+ type: 'sidebar:set-display-state';
91
66
  value: TinaState['sidebarDisplayState'] | 'openOrFull';
92
67
  } | {
93
- type: typeof ACTION_TYPES.SIDEBAR_SET_LOADING_STATE;
68
+ type: 'sidebar:set-loading-state';
94
69
  value: boolean;
95
70
  };
96
71
  export interface TinaState {
@@ -108,7 +83,6 @@ export interface TinaState {
108
83
  forms: {
109
84
  activeFieldName?: string | null;
110
85
  tinaForm: Form;
111
- hoveringFieldName?: string | null;
112
86
  }[];
113
87
  formLists: FormList[];
114
88
  editingMode: 'visual' | 'basic';
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": "3.3.0",
5
+ "version": "3.3.2",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -110,9 +110,9 @@
110
110
  "webfontloader": "1.6.28",
111
111
  "yup": "^1.6.1",
112
112
  "zod": "^3.24.2",
113
- "@tinacms/mdx": "2.0.3",
114
- "@tinacms/schema-tools": "2.3.0",
115
- "@tinacms/search": "1.2.0"
113
+ "@tinacms/mdx": "2.0.4",
114
+ "@tinacms/search": "1.2.1",
115
+ "@tinacms/schema-tools": "2.4.0"
116
116
  },
117
117
  "devDependencies": {
118
118
  "@graphql-tools/utils": "^10.8.1",