@tinacms/app 0.0.0-bf22bf8-20241004045704 → 0.0.0-c312c38-20250414065513

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,45 +3,45 @@
3
3
 
4
4
 
5
5
  */
6
- import React from 'react'
7
- import { XCircleIcon } from '@heroicons/react/solid'
6
+ import React from 'react';
7
+ import { XCircleIcon } from '@heroicons/react/solid';
8
8
  import {
9
9
  Popover,
10
10
  PopoverButton,
11
11
  PopoverPanel,
12
12
  Transition,
13
- } from '@headlessui/react'
14
- import { Fragment } from 'react'
13
+ } from '@headlessui/react';
14
+ import { Fragment } from 'react';
15
15
  // import { InvalidMarkdownElement } from '@tinacms/mdx/src/parse/plate'
16
- export type EmptyTextElement = { type: 'text'; text: '' }
16
+ export type EmptyTextElement = { type: 'text'; text: '' };
17
17
  export type PositionItem = {
18
- line?: number | null
19
- column?: number | null
20
- offset?: number | null
21
- _index?: number | null
22
- _bufferIndex?: number | null
23
- }
18
+ line?: number | null;
19
+ column?: number | null;
20
+ offset?: number | null;
21
+ _index?: number | null;
22
+ _bufferIndex?: number | null;
23
+ };
24
24
  export type Position = {
25
- start: PositionItem
26
- end: PositionItem
27
- }
25
+ start: PositionItem;
26
+ end: PositionItem;
27
+ };
28
28
  export type InvalidMarkdownElement = {
29
- type: 'invalid_markdown'
30
- value: string
31
- message: string
32
- position?: Position
33
- children: [EmptyTextElement]
34
- }
29
+ type: 'invalid_markdown';
30
+ value: string;
31
+ message: string;
32
+ position?: Position;
33
+ children: [EmptyTextElement];
34
+ };
35
35
 
36
36
  type ErrorType = {
37
- message: string
37
+ message: string;
38
38
  position?: {
39
- startColumn: number
40
- endColumn: number
41
- startLineNumber: number
42
- endLineNumber: number
43
- }
44
- }
39
+ startColumn: number;
40
+ endColumn: number;
41
+ startLineNumber: number;
42
+ endLineNumber: number;
43
+ };
44
+ };
45
45
  export const buildError = (element: InvalidMarkdownElement): ErrorType => {
46
46
  return {
47
47
  message: element.message,
@@ -51,28 +51,28 @@ export const buildError = (element: InvalidMarkdownElement): ErrorType => {
51
51
  startLineNumber: element.position.start.line,
52
52
  endLineNumber: element.position.end.line,
53
53
  },
54
- }
55
- }
54
+ };
55
+ };
56
56
  export const buildErrorMessage = (element: InvalidMarkdownElement): string => {
57
57
  if (!element) {
58
- return ''
58
+ return '';
59
59
  }
60
- const errorMessage = buildError(element)
60
+ const errorMessage = buildError(element);
61
61
  const message = errorMessage
62
62
  ? `${errorMessage.message}${
63
63
  errorMessage.position
64
64
  ? ` at line: ${errorMessage.position.startLineNumber}, column: ${errorMessage.position.startColumn}`
65
65
  : ''
66
66
  }`
67
- : null
68
- return message
69
- }
67
+ : null;
68
+ return message;
69
+ };
70
70
 
71
71
  export function ErrorMessage({ error }: { error: InvalidMarkdownElement }) {
72
- const message = buildErrorMessage(error)
72
+ const message = buildErrorMessage(error);
73
73
 
74
74
  return (
75
- <Popover className="relative">
75
+ <Popover className='relative'>
76
76
  {() => (
77
77
  <>
78
78
  <PopoverButton
@@ -80,29 +80,29 @@ export function ErrorMessage({ error }: { error: InvalidMarkdownElement }) {
80
80
  error ? '' : ' opacity-0 hidden '
81
81
  }`}
82
82
  >
83
- <span className="sr-only">Errors</span>
84
- <XCircleIcon className="h-5 w-5 text-red-400" aria-hidden="true" />
83
+ <span className='sr-only'>Errors</span>
84
+ <XCircleIcon className='h-5 w-5 text-red-400' aria-hidden='true' />
85
85
  </PopoverButton>
86
86
  <Transition
87
- enter="transition ease-out duration-200"
88
- enterFrom="opacity-0 translate-y-1"
89
- enterTo="opacity-100 translate-y-0"
90
- leave="transition ease-in duration-150"
91
- leaveFrom="opacity-100 translate-y-0"
92
- leaveTo="opacity-0 translate-y-1"
87
+ enter='transition ease-out duration-200'
88
+ enterFrom='opacity-0 translate-y-1'
89
+ enterTo='opacity-100 translate-y-0'
90
+ leave='transition ease-in duration-150'
91
+ leaveFrom='opacity-100 translate-y-0'
92
+ leaveTo='opacity-0 translate-y-1'
93
93
  >
94
- <PopoverPanel className="absolute top-8 w-[300px] -right-3 z-10 mt-3 px-4 sm:px-0">
95
- <div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
96
- <div className="rounded-md bg-red-50 p-4 overflow-scroll">
97
- <div className="flex">
98
- <div className="flex-shrink-0">
94
+ <PopoverPanel className='absolute top-8 w-[300px] -right-3 z-10 mt-3 px-4 sm:px-0'>
95
+ <div className='overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5'>
96
+ <div className='rounded-md bg-red-50 p-4 overflow-scroll'>
97
+ <div className='flex'>
98
+ <div className='flex-shrink-0'>
99
99
  <XCircleIcon
100
- className="h-5 w-5 text-red-400"
101
- aria-hidden="true"
100
+ className='h-5 w-5 text-red-400'
101
+ aria-hidden='true'
102
102
  />
103
103
  </div>
104
- <div className="ml-3">
105
- <h3 className="text-sm font-medium text-red-800 whitespace-pre-wrap">
104
+ <div className='ml-3'>
105
+ <h3 className='text-sm font-medium text-red-800 whitespace-pre-wrap'>
106
106
  {message}
107
107
  </h3>
108
108
  </div>
@@ -114,5 +114,5 @@ export function ErrorMessage({ error }: { error: InvalidMarkdownElement }) {
114
114
  </>
115
115
  )}
116
116
  </Popover>
117
- )
117
+ );
118
118
  }
@@ -4,23 +4,24 @@
4
4
 
5
5
  */
6
6
 
7
- import React from 'react'
8
- import MonacoEditor, { useMonaco, loader } from '@monaco-editor/react'
7
+ import MonacoEditor, { loader } from '@monaco-editor/react';
9
8
  /**
10
9
  * MDX is built directly to the app because of how we load dependencies.
11
10
  * Since we drop the package.json in to the end users folder, we can't
12
11
  * easily install the current version of the mdx package in all scenarios
13
12
  * (when we're working in the monorepo, or working with a tagged npm version)
14
13
  */
15
- import { parseMDX, stringifyMDX } from '@tinacms/mdx'
16
- import { useDebounce } from './use-debounce'
17
- import type * as monaco from 'monaco-editor'
14
+ import { parseMDX, stringifyMDX } from '@tinacms/mdx';
15
+ import type * as monaco from 'monaco-editor';
16
+ import React from 'react';
17
+ import { RichTextType } from 'tinacms';
18
18
  import {
19
- buildError,
20
19
  ErrorMessage,
21
20
  InvalidMarkdownElement,
22
- } from './error-message'
23
- import { RichTextType } from 'tinacms'
21
+ buildError,
22
+ } from './error-message';
23
+ import { useDebounce } from './use-debounce';
24
+ import useCustomMonaco from './use-monaco';
24
25
 
25
26
  export const uuid = () => {
26
27
  // @ts-ignore
@@ -29,15 +30,15 @@ export const uuid = () => {
29
30
  c ^
30
31
  (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
31
32
  ).toString(16)
32
- )
33
- }
33
+ );
34
+ };
34
35
 
35
- type Monaco = typeof monaco
36
+ type Monaco = typeof monaco;
36
37
 
37
38
  // 0.33.0 has a bug https://github.com/microsoft/monaco-editor/issues/2947
38
39
  loader.config({
39
40
  paths: { vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs' },
40
- })
41
+ });
41
42
 
42
43
  /**
43
44
  * Since monaco lazy-loads we may have a delay from when the block is inserted
@@ -45,81 +46,81 @@ loader.config({
45
46
  *
46
47
  * Will try for 3 seconds before moving on
47
48
  */
48
- let retryCount = 0
49
+ let retryCount = 0;
49
50
  const retryFocus = (ref) => {
50
51
  if (ref.current) {
51
- ref.current.focus()
52
+ ref.current.focus();
52
53
  } else {
53
54
  if (retryCount < 30) {
54
55
  setTimeout(() => {
55
- retryCount = retryCount + 1
56
- retryFocus(ref)
57
- }, 100)
56
+ retryCount = retryCount + 1;
57
+ retryFocus(ref);
58
+ }, 100);
58
59
  }
59
60
  }
60
- }
61
+ };
61
62
 
62
63
  export const RawEditor = (props: RichTextType) => {
63
- const monaco = useMonaco() as Monaco
64
+ const monaco = useCustomMonaco() as Monaco;
64
65
  const monacoEditorRef =
65
- React.useRef<monaco.editor.IStandaloneCodeEditor>(null)
66
- const [height, setHeight] = React.useState(100)
67
- const id = React.useMemo(() => uuid(), [])
68
- const field = props.field
66
+ React.useRef<monaco.editor.IStandaloneCodeEditor>(null);
67
+ const [height, setHeight] = React.useState(100);
68
+ const id = React.useMemo(() => uuid(), []);
69
+ const field = props.field;
69
70
  const inputValue = React.useMemo(() => {
70
71
  // @ts-ignore no access to the rich-text type from this package
71
- const res = stringifyMDX(props.input.value, field, (value) => value)
72
- return typeof props.input.value === 'string' ? props.input.value : res
73
- }, [])
74
- const [value, setValue] = React.useState(inputValue)
75
- const [error, setError] = React.useState<InvalidMarkdownElement>(null)
72
+ const res = stringifyMDX(props.input.value, field, (value) => value);
73
+ return typeof props.input.value === 'string' ? props.input.value : res;
74
+ }, []);
75
+ const [value, setValue] = React.useState(inputValue);
76
+ const [error, setError] = React.useState<InvalidMarkdownElement>(null);
76
77
 
77
- const debouncedValue = useDebounce(value, 500)
78
+ const debouncedValue = useDebounce(value, 500);
78
79
 
79
80
  React.useEffect(() => {
80
81
  // @ts-ignore no access to the rich-text type from this package
81
- const parsedValue = parseMDX(value, field, (value) => value)
82
+ const parsedValue = parseMDX(value, field, (value) => value);
82
83
  if (
83
84
  parsedValue.children[0] &&
84
85
  parsedValue.children[0].type === 'invalid_markdown'
85
86
  ) {
86
- const invalidMarkdown = parsedValue.children[0]
87
- setError(invalidMarkdown)
87
+ const invalidMarkdown = parsedValue.children[0];
88
+ setError(invalidMarkdown);
88
89
  } else {
89
- setError(null)
90
+ setError(null);
90
91
  }
91
- props.input.onChange(parsedValue)
92
- }, [JSON.stringify(debouncedValue)])
92
+ props.input.onChange(parsedValue);
93
+ }, [JSON.stringify(debouncedValue)]);
93
94
 
94
95
  React.useEffect(() => {
95
96
  if (monacoEditorRef.current) {
96
97
  if (error) {
97
- const errorMessage = buildError(error)
98
+ const errorMessage = buildError(error);
98
99
  monaco.editor.setModelMarkers(monacoEditorRef.current.getModel(), id, [
99
100
  {
100
101
  ...errorMessage.position,
101
102
  message: errorMessage.message,
102
103
  severity: 8,
103
104
  },
104
- ])
105
+ ]);
105
106
  } else {
106
107
  monaco.editor.setModelMarkers(
107
108
  monacoEditorRef.current.getModel(),
108
109
  id,
109
110
  []
110
- )
111
+ );
111
112
  }
112
113
  }
113
- }, [JSON.stringify(error), monacoEditorRef.current])
114
+ }, [JSON.stringify(error), monacoEditorRef.current]);
114
115
 
115
116
  React.useEffect(() => {
116
117
  if (monaco) {
117
- monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true)
118
+ monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
118
119
  monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
119
120
  // disable errors
120
121
  noSemanticValidation: true,
121
122
  noSyntaxValidation: true,
122
- })
123
+ });
123
124
  // TODO: autocomplete suggestions
124
125
  // monaco.languages.registerCompletionItemProvider('markdown', {
125
126
  // provideCompletionItems: function (model, position) {
@@ -143,24 +144,24 @@ export const RawEditor = (props: RichTextType) => {
143
144
  // },
144
145
  // })
145
146
  }
146
- }, [monaco])
147
+ }, [monaco]);
147
148
 
148
149
  function handleEditorDidMount(
149
150
  monacoEditor: monaco.editor.IStandaloneCodeEditor,
150
151
  monaco: Monaco
151
152
  ) {
152
- monacoEditorRef.current = monacoEditor
153
+ monacoEditorRef.current = monacoEditor;
153
154
  monacoEditor.onDidContentSizeChange(() => {
154
155
  // FIXME: if the window is too tall the performance degrades, come up with a nice
155
156
  // balance between the two
156
- setHeight(Math.min(Math.max(100, monacoEditor.getContentHeight()), 1000))
157
- monacoEditor.layout()
158
- })
157
+ setHeight(Math.min(Math.max(100, monacoEditor.getContentHeight()), 1000));
158
+ monacoEditor.layout();
159
+ });
159
160
  }
160
161
 
161
162
  return (
162
- <div className="relative">
163
- <div className="sticky top-1 w-full flex justify-between mb-2 z-50 max-w-full bg-white">
163
+ <div className='relative'>
164
+ <div className='sticky top-1 w-full flex justify-between mb-2 z-50 max-w-full bg-white'>
164
165
  <Button onClick={() => props.setRawMode(false)}>
165
166
  View in rich-text editor 📝
166
167
  </Button>
@@ -204,16 +205,16 @@ export const RawEditor = (props: RichTextType) => {
204
205
  value={value}
205
206
  onChange={(value) => {
206
207
  try {
207
- setValue(value)
208
+ setValue(value);
208
209
  } catch (e) {
209
- console.log('error', e)
210
+ console.log('error', e);
210
211
  }
211
212
  }}
212
213
  />
213
214
  </div>
214
215
  </div>
215
- )
216
- }
216
+ );
217
+ };
217
218
 
218
219
  const Button = (props) => {
219
220
  return (
@@ -223,14 +224,14 @@ const Button = (props) => {
223
224
  ? 'rounded-l-md border-r-0'
224
225
  : 'rounded-r-md border-l-0'
225
226
  } flex justify-center w-full shadow rounded-md bg-white cursor-pointer relative inline-flex items-center px-2 py-2 border border-gray-200 hover:text-white text-sm font-medium transition-all ease-out duration-150 hover:bg-blue-500 focus:z-10 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500`}
226
- type="button"
227
+ type='button'
227
228
  onClick={props.onClick}
228
229
  >
229
- <span className="text-sm font-semibold tracking-wide align-baseline mr-1">
230
+ <span className='text-sm font-semibold tracking-wide align-baseline mr-1'>
230
231
  {props.children}
231
232
  </span>
232
233
  </button>
233
- )
234
- }
234
+ );
235
+ };
235
236
 
236
- export default RawEditor
237
+ export default RawEditor;
@@ -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
  }
@@ -0,0 +1,53 @@
1
+ import { loader } from '@monaco-editor/react';
2
+ import * as monaco from 'monaco-editor';
3
+ // hooks/useCustomMonaco.ts
4
+ import { useEffect, useRef, useState } from 'react';
5
+
6
+ export function useCustomMonaco() {
7
+ const [monacoInstance, setMonacoInstance] = useState<typeof monaco | null>(
8
+ null
9
+ );
10
+ const mountedRef = useRef(true);
11
+ const loaderRef = useRef<any>(null);
12
+
13
+ useEffect(() => {
14
+ const instance = loader.__getMonacoInstance();
15
+
16
+ if (instance) {
17
+ setMonacoInstance(instance);
18
+ return;
19
+ }
20
+
21
+ if (!loaderRef.current) {
22
+ loader.config({
23
+ 'vs/nls': { availableLanguages: {} },
24
+ });
25
+
26
+ try {
27
+ loaderRef.current = loader.init();
28
+
29
+ loaderRef.current
30
+ .then((monacoApi: typeof monaco) => {
31
+ if (mountedRef.current) {
32
+ setMonacoInstance(monacoApi);
33
+ }
34
+ })
35
+ .catch((error: any) => {
36
+ if (mountedRef.current && error.type !== 'cancelation') {
37
+ console.error('Monaco initialization error:', error);
38
+ }
39
+ });
40
+ } catch (err) {
41
+ console.error('Failed to initialize Monaco:', err);
42
+ }
43
+ }
44
+
45
+ return () => {
46
+ mountedRef.current = false;
47
+ };
48
+ }, []);
49
+
50
+ return monacoInstance;
51
+ }
52
+
53
+ export default useCustomMonaco;
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;
@@ -16,15 +16,15 @@
16
16
  body {
17
17
  margin: 0;
18
18
  padding: 0;
19
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
20
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
19
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
20
+ "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
21
21
  sans-serif;
22
22
  -webkit-font-smoothing: antialiased;
23
23
  -moz-osx-font-smoothing: grayscale;
24
24
  }
25
25
 
26
26
  code {
27
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
27
+ font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
28
28
  monospace;
29
29
  }
30
30
 
@@ -38,32 +38,32 @@ div.graphiql-explorer-root > div:last-child {
38
38
  }
39
39
 
40
40
  /* 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'] {
41
+ .tina-prose [data-slate-editor="true"] {
42
42
  padding-bottom: 0.5em;
43
43
  /* Outline is placed on the parent element for styling consistency with other elements */
44
44
  outline: none;
45
45
  }
46
46
  /* prose adds backticks, which look like they should be editable */
47
- .tina-prose [data-slate-editor='true'] .slate-code::before {
48
- content: '';
47
+ .tina-prose [data-slate-editor="true"] .slate-code::before {
48
+ content: "";
49
49
  }
50
- .tina-prose [data-slate-editor='true'] .slate-code::after {
51
- content: '';
50
+ .tina-prose [data-slate-editor="true"] .slate-code::after {
51
+ content: "";
52
52
  }
53
- .tina-prose [data-slate-editor='true'] .slate-code_block {
53
+ .tina-prose [data-slate-editor="true"] .slate-code_block {
54
54
  margin: 0;
55
55
  }
56
56
  /* 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 {
57
+ .tina-prose [data-slate-editor="true"] .slate-code_block .slate-code {
58
58
  background: none;
59
59
  }
60
60
  /* prose makes the first p in a block slightly larger */
61
- .tina-prose [data-slate-editor='true'] p:first-of-type {
61
+ .tina-prose [data-slate-editor="true"] p:first-of-type {
62
62
  font-size: 1em;
63
63
  }
64
64
 
65
65
  /* experimental floating toolbar doesn't need a large text area */
66
- .with-toolbar [data-slate-editor='true'] {
66
+ .with-toolbar [data-slate-editor="true"] {
67
67
  min-height: 72px;
68
68
  }
69
69
 
@@ -190,7 +190,7 @@ div.graphiql-explorer-root > div:last-child {
190
190
  }
191
191
 
192
192
  .tina-date-field .rdtPicker td.rdtToday:before {
193
- content: '';
193
+ content: "";
194
194
  display: inline-block;
195
195
  border-left: 7px solid transparent;
196
196
  border-bottom: 7px solid var(--tina-color-primary);
@@ -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
+ };