@tinacms/app 0.0.0-a5bc4cd-20241024211559 → 0.0.0-a63a1f5-20251124043708

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.
@@ -3,23 +3,23 @@
3
3
 
4
4
 
5
5
  */
6
- import { useState, useEffect } from 'react'
6
+ import { useState, useEffect } from 'react';
7
7
  export function useDebounce(value, delay) {
8
- const [debouncedValue, setDebouncedValue] = useState(value)
8
+ const [debouncedValue, setDebouncedValue] = useState(value);
9
9
  useEffect(
10
10
  () => {
11
11
  // Update debounced value after delay
12
12
  const handler = setTimeout(() => {
13
- setDebouncedValue(value)
14
- }, delay)
13
+ setDebouncedValue(value);
14
+ }, delay);
15
15
  // Cancel the timeout if value changes (also on delay change or unmount)
16
16
  // This is how we prevent debounced value from updating if value is changed ...
17
17
  // .. within the delay period. Timeout gets cleared and restarted.
18
18
  return () => {
19
- clearTimeout(handler)
20
- }
19
+ clearTimeout(handler);
20
+ };
21
21
  },
22
22
  [value, delay] // Only re-call effect if value or delay changes
23
- )
24
- return debouncedValue
23
+ );
24
+ return debouncedValue;
25
25
  }
package/src/global.css CHANGED
@@ -40,13 +40,13 @@
40
40
  --tina-font-size-7: 26px;
41
41
  --tina-font-size-8: 32px;
42
42
 
43
- --tina-font-family: 'Inter', sans-serif;
43
+ --tina-font-family: "Inter", sans-serif;
44
44
 
45
45
  --tina-font-weight-regular: 400;
46
46
  --tina-font-weight-bold: 600;
47
47
 
48
- --tina-shadow-big: 0px 2px 3px rgba(0, 0, 0, 0.05),
49
- 0 4px 12px rgba(0, 0, 0, 0.1);
48
+ --tina-shadow-big: 0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px
49
+ rgba(0, 0, 0, 0.1);
50
50
  --tina-shadow-small: 0px 2px 3px rgba(0, 0, 0, 0.12);
51
51
 
52
52
  --tina-timing-short: 85ms;
package/src/index.css CHANGED
@@ -1,5 +1,5 @@
1
- @import 'global.css';
2
- @import 'preflight.css';
1
+ @import "global.css";
2
+ @import "preflight.css";
3
3
  @tailwind base;
4
4
  @tailwind components;
5
5
  @tailwind utilities;
@@ -13,18 +13,22 @@
13
13
  fill: currentColor;
14
14
  }
15
15
 
16
+ .font-libre-baskerville {
17
+ font-family: "Libre Baskerville", serif;
18
+ }
19
+
16
20
  body {
17
21
  margin: 0;
18
22
  padding: 0;
19
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
20
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
23
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
24
+ "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
21
25
  sans-serif;
22
26
  -webkit-font-smoothing: antialiased;
23
27
  -moz-osx-font-smoothing: grayscale;
24
28
  }
25
29
 
26
30
  code {
27
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
31
+ font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
28
32
  monospace;
29
33
  }
30
34
 
@@ -38,32 +42,32 @@ div.graphiql-explorer-root > div:last-child {
38
42
  }
39
43
 
40
44
  /* if the last block has margin-bottom it makes the text box larger but some of it isn't clickable */
41
- .tina-prose [data-slate-editor='true'] {
45
+ .tina-prose [data-slate-editor="true"] {
42
46
  padding-bottom: 0.5em;
43
47
  /* Outline is placed on the parent element for styling consistency with other elements */
44
48
  outline: none;
45
49
  }
46
50
  /* prose adds backticks, which look like they should be editable */
47
- .tina-prose [data-slate-editor='true'] .slate-code::before {
48
- content: '';
51
+ .tina-prose [data-slate-editor="true"] .slate-code::before {
52
+ content: "";
49
53
  }
50
- .tina-prose [data-slate-editor='true'] .slate-code::after {
51
- content: '';
54
+ .tina-prose [data-slate-editor="true"] .slate-code::after {
55
+ content: "";
52
56
  }
53
- .tina-prose [data-slate-editor='true'] .slate-code_block {
57
+ .tina-prose [data-slate-editor="true"] .slate-code_block {
54
58
  margin: 0;
55
59
  }
56
60
  /* code lines as part of a block don't need the same background formatting */
57
- .tina-prose [data-slate-editor='true'] .slate-code_block .slate-code {
61
+ .tina-prose [data-slate-editor="true"] .slate-code_block .slate-code {
58
62
  background: none;
59
63
  }
60
64
  /* prose makes the first p in a block slightly larger */
61
- .tina-prose [data-slate-editor='true'] p:first-of-type {
65
+ .tina-prose [data-slate-editor="true"] p:first-of-type {
62
66
  font-size: 1em;
63
67
  }
64
68
 
65
69
  /* experimental floating toolbar doesn't need a large text area */
66
- .with-toolbar [data-slate-editor='true'] {
70
+ .with-toolbar [data-slate-editor="true"] {
67
71
  min-height: 72px;
68
72
  }
69
73
 
@@ -190,7 +194,7 @@ div.graphiql-explorer-root > div:last-child {
190
194
  }
191
195
 
192
196
  .tina-date-field .rdtPicker td.rdtToday:before {
193
- content: '';
197
+ content: "";
194
198
  display: inline-block;
195
199
  border-left: 7px solid transparent;
196
200
  border-bottom: 7px solid var(--tina-color-primary);
@@ -382,3 +386,8 @@ td.rdtYear:hover {
382
386
  .tina-date-field .rdtTime td {
383
387
  cursor: default;
384
388
  }
389
+
390
+ /* Override Radix UI Portal wrapper z-index for dropdown menus */
391
+ [data-radix-popper-content-wrapper] {
392
+ z-index: 10800 !important;
393
+ }
@@ -1,42 +1,42 @@
1
- import { Field, Form, FormOptions, TinaCMS, TinaField } from 'tinacms'
1
+ import { Field, Form, FormOptions, TinaCMS, TinaField } from 'tinacms';
2
2
 
3
- export type FieldType = Field & TinaField
4
- export type FormValues = Record<string, unknown>
5
- export type FormType = Form<FormValues, FieldType>
3
+ export type FieldType = Field & TinaField;
4
+ export type FormValues = Record<string, unknown>;
5
+ export type FormType = Form<FormValues, FieldType>;
6
6
 
7
- type FormCreator = (formConfig: FormOptions<any>) => Form
7
+ type FormCreator = (formConfig: FormOptions<any>) => Form;
8
8
  interface GlobalFormOptions {
9
- icon?: any
10
- layout: 'fullscreen' | 'popup'
9
+ icon?: any;
10
+ layout: 'fullscreen' | 'popup';
11
11
  }
12
12
  type GlobalFormCreator = (
13
13
  formConfig: FormOptions<any>,
14
14
  options?: GlobalFormOptions
15
- ) => Form
15
+ ) => Form;
16
16
  interface GlobalFormOptions {
17
- icon?: any
18
- layout: 'fullscreen' | 'popup'
17
+ icon?: any;
18
+ layout: 'fullscreen' | 'popup';
19
19
  }
20
20
  export interface FormifyArgs {
21
- formConfig: FormOptions<any>
22
- createForm: FormCreator
23
- createGlobalForm: FormCreator
24
- skip?: () => void
21
+ formConfig: FormOptions<any>;
22
+ createForm: FormCreator;
23
+ createGlobalForm: FormCreator;
24
+ skip?: () => void;
25
25
  }
26
26
 
27
- export type FormifyCallback = (args: FormifyArgs, cms: TinaCMS) => Form | void
27
+ export type FormifyCallback = (args: FormifyArgs, cms: TinaCMS) => Form | void;
28
28
  export type onSubmitArgs = {
29
29
  /**
30
30
  * @deprecated queryString is actually a mutation string, use `mutationString` instead
31
31
  */
32
- queryString: string
33
- mutationString: string
34
- variables: object
35
- }
32
+ queryString: string;
33
+ mutationString: string;
34
+ variables: object;
35
+ };
36
36
 
37
37
  export const createForm = (formConfig: FormOptions<any, any>) => {
38
- return new Form(formConfig)
39
- }
38
+ return new Form(formConfig);
39
+ };
40
40
  export const createGlobalForm: GlobalFormCreator = (
41
41
  formConfig,
42
42
  options?: { icon?: any; layout: 'fullscreen' | 'popup' }
@@ -44,6 +44,6 @@ export const createGlobalForm: GlobalFormCreator = (
44
44
  const form = new Form({
45
45
  ...formConfig,
46
46
  global: { global: true, ...options },
47
- })
48
- return form
49
- }
47
+ });
48
+ return form;
49
+ };
@@ -1,8 +1,8 @@
1
- import React from 'react'
2
- import { TinaCMS } from 'tinacms'
1
+ import React from 'react';
2
+ import { TinaCMS } from 'tinacms';
3
3
 
4
4
  const ErrorModalContent = (props: { title: string; errors: string[] }) => {
5
- const { title, errors } = props
5
+ const { title, errors } = props;
6
6
  return (
7
7
  <>
8
8
  <div>{title}</div>
@@ -12,13 +12,13 @@ const ErrorModalContent = (props: { title: string; errors: string[] }) => {
12
12
  ))}
13
13
  </ul>
14
14
  </>
15
- )
16
- }
15
+ );
16
+ };
17
17
 
18
18
  export const showErrorModal = (
19
19
  title: string,
20
20
  errors: string[],
21
21
  cms: TinaCMS
22
22
  ) => {
23
- cms.alerts.error(() => <ErrorModalContent title={title} errors={errors} />)
24
- }
23
+ cms.alerts.error(() => <ErrorModalContent title={title} errors={errors} />);
24
+ };
@@ -1,19 +1,22 @@
1
- import * as G from 'graphql'
1
+ import * as G from 'graphql';
2
2
 
3
3
  export const expandQuery = ({
4
4
  schema,
5
5
  documentNode,
6
6
  }: {
7
- schema: G.GraphQLSchema
8
- documentNode: G.DocumentNode
7
+ schema: G.GraphQLSchema;
8
+ documentNode: G.DocumentNode;
9
9
  }): G.DocumentNode => {
10
- const documentNodeWithTypenames = addTypenameToDocument(documentNode)
11
- return addMetaFieldsToQuery(documentNodeWithTypenames, new G.TypeInfo(schema))
12
- }
10
+ const documentNodeWithTypenames = addTypenameToDocument(documentNode);
11
+ return addMetaFieldsToQuery(
12
+ documentNodeWithTypenames,
13
+ new G.TypeInfo(schema)
14
+ );
15
+ };
13
16
 
14
17
  const addTypenameToDocument = (doc: G.DocumentNode) => {
15
18
  function isField(selection: G.SelectionNode): selection is G.FieldNode {
16
- return selection.kind === 'Field'
19
+ return selection.kind === 'Field';
17
20
  }
18
21
  return G.visit(doc, {
19
22
  SelectionSet: {
@@ -24,13 +27,13 @@ const addTypenameToDocument = (doc: G.DocumentNode) => {
24
27
  (parent as G.OperationDefinitionNode).kind ===
25
28
  G.Kind.OPERATION_DEFINITION
26
29
  ) {
27
- return
30
+ return;
28
31
  }
29
32
 
30
33
  // No changes if no selections.
31
- const { selections } = node
34
+ const { selections } = node;
32
35
  if (!selections) {
33
- return
36
+ return;
34
37
  }
35
38
 
36
39
  // If selections already have a __typename, or are part of an
@@ -40,32 +43,32 @@ const addTypenameToDocument = (doc: G.DocumentNode) => {
40
43
  isField(selection) &&
41
44
  (selection.name.value === '__typename' ||
42
45
  selection.name.value.lastIndexOf('__', 0) === 0)
43
- )
44
- })
46
+ );
47
+ });
45
48
  if (skip) {
46
- return
49
+ return;
47
50
  }
48
51
 
49
52
  // If this SelectionSet is @export-ed as an input variable, it should
50
53
  // not have a __typename field (see issue #4691).
51
- const field = parent as G.FieldNode
54
+ const field = parent as G.FieldNode;
52
55
  if (
53
56
  isField(field) &&
54
57
  field.directives &&
55
58
  field.directives.some((d) => d.name.value === 'export')
56
59
  ) {
57
- return
60
+ return;
58
61
  }
59
62
 
60
63
  // Create and return a new SelectionSet with a __typename Field.
61
64
  return {
62
65
  ...node,
63
66
  selections: [...selections, TYPENAME_FIELD],
64
- }
67
+ };
65
68
  },
66
69
  },
67
- })
68
- }
70
+ });
71
+ };
69
72
 
70
73
  const CONTENT_SOURCE_FIELD: G.FieldNode = {
71
74
  kind: G.Kind.FIELD,
@@ -73,14 +76,14 @@ const CONTENT_SOURCE_FIELD: G.FieldNode = {
73
76
  kind: G.Kind.NAME,
74
77
  value: '_content_source',
75
78
  },
76
- }
79
+ };
77
80
  const METADATA_FIELD: G.FieldNode = {
78
81
  kind: G.Kind.FIELD,
79
82
  name: {
80
83
  kind: G.Kind.NAME,
81
84
  value: '_tina_metadata',
82
85
  },
83
- }
86
+ };
84
87
 
85
88
  const TYPENAME_FIELD: G.FieldNode = {
86
89
  kind: G.Kind.FIELD,
@@ -88,7 +91,7 @@ const TYPENAME_FIELD: G.FieldNode = {
88
91
  kind: G.Kind.NAME,
89
92
  value: '__typename',
90
93
  },
91
- }
94
+ };
92
95
 
93
96
  const addMetadataField = (
94
97
  node: G.FieldNode | G.InlineFragmentNode | G.FragmentDefinitionNode
@@ -100,15 +103,14 @@ const addMetadataField = (
100
103
  kind: 'SelectionSet',
101
104
  selections: [],
102
105
  }),
103
- selections:
104
- [
105
- ...(node.selectionSet?.selections || []),
106
- METADATA_FIELD,
107
- CONTENT_SOURCE_FIELD,
108
- ] || [],
106
+ selections: [
107
+ ...(node.selectionSet?.selections || []),
108
+ METADATA_FIELD,
109
+ CONTENT_SOURCE_FIELD,
110
+ ],
109
111
  },
110
- }
111
- }
112
+ };
113
+ };
112
114
 
113
115
  const addMetaFieldsToQuery = (
114
116
  documentNode: G.DocumentNode,
@@ -124,65 +126,64 @@ const addMetaFieldsToQuery = (
124
126
  kind: 'SelectionSet',
125
127
  selections: [],
126
128
  }),
127
- selections:
128
- [...(node.selectionSet?.selections || []), ...metaFields] || [],
129
+ selections: [...(node.selectionSet?.selections || []), ...metaFields],
129
130
  },
130
- }
131
- }
131
+ };
132
+ };
132
133
 
133
134
  const formifyVisitor: G.Visitor<G.ASTKindToNode, G.ASTNode> = {
134
135
  FragmentDefinition: {
135
136
  enter: (node, key, parent, path, ancestors) => {
136
- typeInfo.enter(node)
137
- const type = typeInfo.getType()
137
+ typeInfo.enter(node);
138
+ const type = typeInfo.getType();
138
139
  if (type) {
139
- const namedType = G.getNamedType(type)
140
+ const namedType = G.getNamedType(type);
140
141
  if (G.isObjectType(namedType)) {
141
142
  if (namedType.getFields()['_tina_metadata']) {
142
- return addMetadataField(node)
143
+ return addMetadataField(node);
143
144
  }
144
145
  }
145
- return node
146
+ return node;
146
147
  }
147
148
  },
148
149
  },
149
150
  InlineFragment: {
150
151
  enter: (node, key, parent, path, ancestors) => {
151
- typeInfo.enter(node)
152
- const type = typeInfo.getType()
152
+ typeInfo.enter(node);
153
+ const type = typeInfo.getType();
153
154
  if (type) {
154
- const namedType = G.getNamedType(type)
155
+ const namedType = G.getNamedType(type);
155
156
  if (G.isObjectType(namedType)) {
156
157
  if (namedType.getFields()['_tina_metadata']) {
157
- return addMetadataField(node)
158
+ return addMetadataField(node);
158
159
  }
159
160
  }
160
- return node
161
+ return node;
161
162
  }
162
163
  },
163
164
  },
164
165
  Field: {
165
166
  enter: (node, key, parent, path, ancestors) => {
166
- typeInfo.enter(node)
167
- const type = typeInfo.getType()
167
+ typeInfo.enter(node);
168
+ const type = typeInfo.getType();
168
169
  if (type) {
169
170
  if (isNodeType(type)) {
170
- return addMetaFields(node, key, parent, path, ancestors)
171
+ return addMetaFields(node, key, parent, path, ancestors);
171
172
  }
172
- const namedType = G.getNamedType(type)
173
+ const namedType = G.getNamedType(type);
173
174
  if (G.isObjectType(namedType)) {
174
175
  if (namedType.getFields()['_tina_metadata']) {
175
- return addMetadataField(node)
176
+ return addMetadataField(node);
176
177
  }
177
- return node
178
+ return node;
178
179
  }
179
180
  }
180
- return node
181
+ return node;
181
182
  },
182
183
  },
183
- }
184
- return G.visit(documentNode, G.visitWithTypeInfo(typeInfo, formifyVisitor))
185
- }
184
+ };
185
+ return G.visit(documentNode, G.visitWithTypeInfo(typeInfo, formifyVisitor));
186
+ };
186
187
  /**
187
188
  * This is a dummy query which we pull apart and spread
188
189
  * back into the the selectionSet for all "Node" fields
@@ -212,57 +213,61 @@ const node = G.parse(`
212
213
  }
213
214
  }
214
215
  }
215
- }`)
216
+ }`);
216
217
  const metaFields: G.SelectionNode[] =
217
218
  // @ts-ignore
218
- node.definitions[0].selectionSet.selections
219
+ node.definitions[0].selectionSet.selections;
219
220
 
220
221
  export const isNodeType = (type: G.GraphQLOutputType) => {
221
- const namedType = G.getNamedType(type)
222
+ const namedType = G.getNamedType(type);
222
223
  if (G.isInterfaceType(namedType)) {
223
224
  if (namedType.name === 'Node') {
224
- return true
225
+ return true;
225
226
  }
226
227
  }
227
228
  if (G.isUnionType(namedType)) {
228
- const types = namedType.getTypes()
229
+ const types = namedType.getTypes();
229
230
  if (
230
231
  types.every((type) => {
231
- return type.getInterfaces().some((intfc) => intfc.name === 'Node')
232
+ return type.getInterfaces().some((intfc) => intfc.name === 'Node');
232
233
  })
233
234
  ) {
234
- return true
235
+ return true;
235
236
  }
236
237
  }
237
238
  if (G.isObjectType(namedType)) {
238
239
  if (namedType.getInterfaces().some((intfc) => intfc.name === 'Node')) {
239
- return true
240
+ return true;
240
241
  }
241
242
  }
242
- }
243
+ return false;
244
+ };
243
245
 
244
246
  export const isConnectionType = (type: G.GraphQLOutputType) => {
245
- const namedType = G.getNamedType(type)
247
+ const namedType = G.getNamedType(type);
246
248
  if (G.isInterfaceType(namedType)) {
247
249
  if (namedType.name === 'Connection') {
248
- return true
250
+ return true;
249
251
  }
250
252
  }
251
253
  if (G.isUnionType(namedType)) {
252
- const types = namedType.getTypes()
254
+ const types = namedType.getTypes();
253
255
  if (
254
256
  types.every((type) => {
255
- return type.getInterfaces().some((intfc) => intfc.name === 'Connection')
257
+ return type
258
+ .getInterfaces()
259
+ .some((intfc) => intfc.name === 'Connection');
256
260
  })
257
261
  ) {
258
- return true
262
+ return true;
259
263
  }
260
264
  }
261
265
  if (G.isObjectType(namedType)) {
262
266
  if (
263
267
  namedType.getInterfaces().some((intfc) => intfc.name === 'Connection')
264
268
  ) {
265
- return true
269
+ return true;
266
270
  }
267
271
  }
268
- }
272
+ return false;
273
+ };