@tinacms/app 2.2.8 → 2.2.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @tinacms/app
2
2
 
3
+ ## 2.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5833](https://github.com/tinacms/tinacms/pull/5833) [`5269d65`](https://github.com/tinacms/tinacms/commit/5269d6578d361c55326f39375eaa175707342d51) Thanks [@JackDevAU](https://github.com/JackDevAU)! - 🐛 FIX - Visual Editor Webpack HMR loading issue
8
+
9
+ - Updated dependencies [[`5269d65`](https://github.com/tinacms/tinacms/commit/5269d6578d361c55326f39375eaa175707342d51), [`3026a2b`](https://github.com/tinacms/tinacms/commit/3026a2b492113a53c036e43d5d85837cea4a6de3), [`28a94a6`](https://github.com/tinacms/tinacms/commit/28a94a602186f48b528b91236007839e5d02a9de)]:
10
+ - tinacms@2.7.10
11
+
12
+ ## 2.2.9
13
+
14
+ ### Patch Changes
15
+
16
+ - [#5741](https://github.com/tinacms/tinacms/pull/5741) [`0e9de37`](https://github.com/tinacms/tinacms/commit/0e9de379dab2970206b9b60eb014808662f67287) Thanks [@wicksipedia](https://github.com/wicksipedia)! - CMS admin UI - Refactor Sidebar and Branch Button Components
17
+ Forms header - Adds breadcrumb navigation
18
+
19
+ - [#5784](https://github.com/tinacms/tinacms/pull/5784) [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab) Thanks [@JackDevAU](https://github.com/JackDevAU)! - - Fixed padding issues in FormLists
20
+
21
+ - Fixed Visual Editing's "Edit" button (Reference Fields)
22
+
23
+ - [#5789](https://github.com/tinacms/tinacms/pull/5789) [`5040a6a`](https://github.com/tinacms/tinacms/commit/5040a6aa24e62166d942c47b61a3f18585caded6) Thanks [@JackDevAU](https://github.com/JackDevAU)! - ✨ Adds click to focus for nested objects
24
+
25
+ - Updated dependencies [[`2a3ed6c`](https://github.com/tinacms/tinacms/commit/2a3ed6c3ec3233fd90fd94f3dd3d0243aaad079a), [`bc47f93`](https://github.com/tinacms/tinacms/commit/bc47f938431c400714808613f633b05659a87be1), [`0e9de37`](https://github.com/tinacms/tinacms/commit/0e9de379dab2970206b9b60eb014808662f67287), [`468f0ee`](https://github.com/tinacms/tinacms/commit/468f0eefc0a15a9a9a23737d29ea9a5cb5c6aef6), [`e27c017`](https://github.com/tinacms/tinacms/commit/e27c0172005797af93b908152d51b2966c0cf059), [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab), [`5040a6a`](https://github.com/tinacms/tinacms/commit/5040a6aa24e62166d942c47b61a3f18585caded6), [`dbef36f`](https://github.com/tinacms/tinacms/commit/dbef36f594b949024d5525184b6a9e1b9085b759), [`3ba6d78`](https://github.com/tinacms/tinacms/commit/3ba6d78f35f817d55bfc3d12b750e54b7e0d11f2)]:
26
+ - tinacms@2.7.9
27
+ - @tinacms/mdx@1.7.0
28
+
3
29
  ## 2.2.8
4
30
 
5
31
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "main": "src/main.tsx",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
@@ -24,7 +24,7 @@
24
24
  "react-router-dom": "6.3.0",
25
25
  "typescript": "^5.7.3",
26
26
  "zod": "^3.24.2",
27
- "@tinacms/mdx": "1.6.3",
28
- "tinacms": "2.7.8"
27
+ "@tinacms/mdx": "1.7.0",
28
+ "tinacms": "2.7.10"
29
29
  }
30
30
  }
@@ -100,7 +100,7 @@ const Playground = () => {
100
100
  false
101
101
  ? 'bg-gray-100 text-gray-900'
102
102
  : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900',
103
- 'flex items-center rounded-md px-3 py-2 text-sm font-medium w-full text-left'
103
+ 'flex items-center rounded px-3 py-2 text-sm font-medium w-full text-left'
104
104
  )}
105
105
  onClick={async () => {
106
106
  if (typeof value === 'function') {
@@ -1,16 +1,16 @@
1
- /**
2
-
3
-
4
-
5
- */
6
- import React from 'react';
7
- import { XCircleIcon } from '@heroicons/react/solid';
8
1
  import {
9
2
  Popover,
10
3
  PopoverButton,
11
4
  PopoverPanel,
12
5
  Transition,
13
6
  } from '@headlessui/react';
7
+ import { XCircleIcon } from '@heroicons/react/solid';
8
+ /**
9
+
10
+
11
+
12
+ */
13
+ import React from 'react';
14
14
  import { Fragment } from 'react';
15
15
  // import { InvalidMarkdownElement } from '@tinacms/mdx/src/parse/plate'
16
16
  export type EmptyTextElement = { type: 'text'; text: '' };
@@ -93,7 +93,7 @@ export function ErrorMessage({ error }: { error: InvalidMarkdownElement }) {
93
93
  >
94
94
  <PopoverPanel className='absolute top-8 w-[300px] -right-3 z-10 mt-3 px-4 sm:px-0'>
95
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'>
96
+ <div className='rounded bg-red-50 p-4 overflow-scroll'>
97
97
  <div className='flex'>
98
98
  <div className='flex-shrink-0'>
99
99
  <XCircleIcon
@@ -4,7 +4,6 @@
4
4
 
5
5
  */
6
6
 
7
- import React from 'react';
8
7
  import MonacoEditor, { useMonaco, loader } from '@monaco-editor/react';
9
8
  /**
10
9
  * MDX is built directly to the app because of how we load dependencies.
@@ -12,15 +11,16 @@ import MonacoEditor, { useMonaco, loader } from '@monaco-editor/react';
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';
14
+ import { parseMDX, serializeMDX } from '@tinacms/mdx';
17
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,
21
+ buildError,
22
22
  } from './error-message';
23
- import { RichTextType } from 'tinacms';
23
+ import { useDebounce } from './use-debounce';
24
24
 
25
25
  export const uuid = () => {
26
26
  // @ts-ignore
@@ -68,7 +68,7 @@ export const RawEditor = (props: RichTextType) => {
68
68
  const field = props.field;
69
69
  const inputValue = React.useMemo(() => {
70
70
  // @ts-ignore no access to the rich-text type from this package
71
- const res = stringifyMDX(props.input.value, field, (value) => value);
71
+ const res = serializeMDX(props.input.value, field, (value) => value);
72
72
  return typeof props.input.value === 'string' ? props.input.value : res;
73
73
  }, []);
74
74
  const [value, setValue] = React.useState(inputValue);
@@ -219,10 +219,8 @@ const Button = (props) => {
219
219
  return (
220
220
  <button
221
221
  className={`${
222
- props.align === 'left'
223
- ? 'rounded-l-md border-r-0'
224
- : 'rounded-r-md border-l-0'
225
- } 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`}
222
+ props.align === 'left' ? 'rounded-l border-r-0' : 'rounded-r border-l-0'
223
+ } flex justify-center w-full shadow rounded 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
224
  type='button'
227
225
  onClick={props.onClick}
228
226
  >
@@ -103,12 +103,11 @@ const addMetadataField = (
103
103
  kind: 'SelectionSet',
104
104
  selections: [],
105
105
  }),
106
- selections:
107
- [
108
- ...(node.selectionSet?.selections || []),
109
- METADATA_FIELD,
110
- CONTENT_SOURCE_FIELD,
111
- ] || [],
106
+ selections: [
107
+ ...(node.selectionSet?.selections || []),
108
+ METADATA_FIELD,
109
+ CONTENT_SOURCE_FIELD,
110
+ ],
112
111
  },
113
112
  };
114
113
  };
@@ -127,8 +126,7 @@ const addMetaFieldsToQuery = (
127
126
  kind: 'SelectionSet',
128
127
  selections: [],
129
128
  }),
130
- selections:
131
- [...(node.selectionSet?.selections || []), ...metaFields] || [],
129
+ selections: [...(node.selectionSet?.selections || []), ...metaFields],
132
130
  },
133
131
  };
134
132
  };
@@ -242,6 +240,7 @@ export const isNodeType = (type: G.GraphQLOutputType) => {
242
240
  return true;
243
241
  }
244
242
  }
243
+ return false;
245
244
  };
246
245
 
247
246
  export const isConnectionType = (type: G.GraphQLOutputType) => {
@@ -270,4 +269,5 @@ export const isConnectionType = (type: G.GraphQLOutputType) => {
270
269
  return true;
271
270
  }
272
271
  }
272
+ return false;
273
273
  };
@@ -45,7 +45,7 @@ const sysSchema = z.object({
45
45
  collection: z.object({
46
46
  name: z.string(),
47
47
  slug: z.string(),
48
- label: z.string(),
48
+ label: z.string().optional().nullable(),
49
49
  path: z.string(),
50
50
  format: z.string().optional().nullable(),
51
51
  matches: z.string().optional().nullable(),
@@ -305,6 +305,7 @@ export const useGraphQLReducer = (
305
305
  prefix: '',
306
306
  };
307
307
  }
308
+
308
309
  if (isConnectionType(info.returnType)) {
309
310
  const name = G.getNamedType(info.returnType).name;
310
311
  const connectionCollection = tinaSchema
@@ -339,6 +340,7 @@ export const useGraphQLReducer = (
339
340
  const maybeResolvedDocument = resolvedDocuments.find(
340
341
  (doc) => doc._internalSys.path === value
341
342
  );
343
+
342
344
  // If we already have this document, use it.
343
345
  if (maybeResolvedDocument) {
344
346
  resolvedDocument = maybeResolvedDocument;
@@ -349,6 +351,7 @@ export const useGraphQLReducer = (
349
351
  // here and just grab it from the response
350
352
  const maybeResolvedDocument =
351
353
  documentSchema.parse(valueFromSetup);
354
+
352
355
  if (maybeResolvedDocument._internalSys.path === value) {
353
356
  resolvedDocument = maybeResolvedDocument;
354
357
  } else {
@@ -559,12 +562,14 @@ export const useGraphQLReducer = (
559
562
  payload,
560
563
  ]);
561
564
  }
562
- if (event.data.type === 'url-changed') {
563
- cms.dispatch({
564
- type: 'sidebar:set-loading-state',
565
- value: true,
566
- });
567
- }
565
+ // TODO: This is causing a webpack HMR issue - look into refactoring this logic
566
+ // if (event.data.type === 'url-changed') {
567
+ // console.log('[EVENT_TRIGGERED] url-changed: ', event);
568
+ // cms.dispatch({
569
+ // type: 'sidebar:set-loading-state',
570
+ // value: true,
571
+ // });
572
+ // }
568
573
  },
569
574
  [cms, JSON.stringify(results)]
570
575
  );
package/src/lib/util.ts CHANGED
@@ -108,27 +108,22 @@ export const getFormAndFieldNameFromMetadata = (
108
108
  object: object,
109
109
  eventFieldName: string
110
110
  ) => {
111
- let formId;
112
- let n;
113
- const value = getDeepestMetadata(object, eventFieldName);
114
- if (value) {
115
- if (value.prefix) {
116
- const fieldName = eventFieldName.slice(value?.prefix?.length + 1);
117
- const localFieldName = value.name
118
- ? fieldName.slice(value?.name?.length + 1)
119
- : fieldName;
120
- if (localFieldName) {
121
- // If localFieldName is tags.2, just use `tags`
122
- if (!isNaN(Number(localFieldName.split('.')[1]))) {
123
- n = value.fields[localFieldName.split('.')[0]];
124
- } else {
125
- n = value.fields[localFieldName];
126
- }
127
- } else {
128
- n = value.name;
129
- }
130
- formId = value.id;
131
- }
111
+ const metadata = getDeepestMetadata(object, eventFieldName);
112
+
113
+ if (!metadata) {
114
+ console.warn(
115
+ '[getFormAndFieldNameFromMetadata] No metadata found for:',
116
+ eventFieldName
117
+ );
118
+ return { formId: undefined, fieldName: undefined };
132
119
  }
133
- return { formId, fieldName: n };
120
+
121
+ const { id: formId, prefix } = metadata;
122
+ const prefixLength = prefix?.length ?? 0;
123
+ const localFieldName = eventFieldName.slice(prefixLength + 1);
124
+
125
+ return {
126
+ formId,
127
+ fieldName: localFieldName,
128
+ };
134
129
  };