@tinacms/app 0.0.0-d80714b-20241205222511 → 0.0.0-d94de9b-20250707010010
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 +151 -9
- package/package.json +13 -11
- package/src/App.tsx +24 -24
- package/src/Playground.tsx +56 -56
- package/src/dummy-client.ts +1 -1
- package/src/fields/rich-text/index.tsx +2 -2
- package/src/fields/rich-text/monaco/error-message.tsx +59 -59
- package/src/fields/rich-text/monaco/index.tsx +59 -61
- package/src/fields/rich-text/monaco/use-debounce.ts +8 -8
- package/src/global.css +3 -3
- package/src/index.css +15 -15
- package/src/lib/build-form.ts +24 -24
- package/src/lib/errors.tsx +7 -7
- package/src/lib/expand-query.ts +74 -69
- package/src/lib/graphql-reducer.ts +301 -276
- package/src/lib/types.ts +35 -33
- package/src/lib/util.ts +48 -53
- package/src/main.tsx +7 -7
- package/src/preflight.css +10 -10
- package/src/preview.tsx +12 -12
- package/src/vite-env.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,153 @@
|
|
|
1
1
|
# @tinacms/app
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-d94de9b-20250707010010
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5833](https://github.com/tinacms/tinacms/pull/5833) [`c708436`](https://github.com/tinacms/tinacms/commit/c70843645d772dc6f661e544d3e0efaf03d27bb7) Thanks [@JackDevAU](https://github.com/JackDevAU)! - 🐛 FIX - Visual Editor Webpack HMR loading issue
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`c708436`](https://github.com/tinacms/tinacms/commit/c70843645d772dc6f661e544d3e0efaf03d27bb7), [`3026a2b`](https://github.com/tinacms/tinacms/commit/3026a2b492113a53c036e43d5d85837cea4a6de3), [`28a94a6`](https://github.com/tinacms/tinacms/commit/28a94a602186f48b528b91236007839e5d02a9de)]:
|
|
10
|
+
- tinacms@0.0.0-d94de9b-20250707010010
|
|
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
|
+
|
|
29
|
+
## 2.2.8
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`5e36123`](https://github.com/tinacms/tinacms/commit/5e361239a372e21dda624d17b4ff274bab23ce90), [`856e07a`](https://github.com/tinacms/tinacms/commit/856e07a0b8d742ee78d5eba565623cf081a61534), [`4d9c8ab`](https://github.com/tinacms/tinacms/commit/4d9c8abf6badd1bcc833bda432ab22dace4925ae), [`7346dc9`](https://github.com/tinacms/tinacms/commit/7346dc996fd81ecb395b62f373976512e8224c21)]:
|
|
34
|
+
- tinacms@2.7.8
|
|
35
|
+
- @tinacms/mdx@1.6.3
|
|
36
|
+
|
|
37
|
+
## 2.2.7
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- [#5607](https://github.com/tinacms/tinacms/pull/5607) [`1965236`](https://github.com/tinacms/tinacms/commit/19652363784e48b065ec1924a9cd9611c8e79cae) Thanks [@jeffsee55](https://github.com/jeffsee55)! - Specify react and react-dom as peer deps
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [[`1965236`](https://github.com/tinacms/tinacms/commit/19652363784e48b065ec1924a9cd9611c8e79cae)]:
|
|
44
|
+
- tinacms@2.7.7
|
|
45
|
+
|
|
46
|
+
## 2.2.6
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [[`65cee5d`](https://github.com/tinacms/tinacms/commit/65cee5d6ae16c7320a4a14f0d9a82dc5f9103e34)]:
|
|
51
|
+
- tinacms@2.7.6
|
|
52
|
+
|
|
53
|
+
## 2.2.5
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- [#5602](https://github.com/tinacms/tinacms/pull/5602) [`ab43169`](https://github.com/tinacms/tinacms/commit/ab43169af5a95f31fa27bb0236623a031883a1fd) Thanks [@wicksipedia](https://github.com/wicksipedia)! - fix naming of TinaCloud
|
|
58
|
+
|
|
59
|
+
- [#5588](https://github.com/tinacms/tinacms/pull/5588) [`fd664d8`](https://github.com/tinacms/tinacms/commit/fd664d8f4e83941ed1b1f234668ab6341a6178f8) Thanks [@JackDevAU](https://github.com/JackDevAU)! - - Fix server-side branch queries by storing the active branch in a cookie and passing it via the x-branch header.
|
|
60
|
+
- Ensure GraphQL playground correctly updates when switching branches.
|
|
61
|
+
- Updated dependencies [[`921f235`](https://github.com/tinacms/tinacms/commit/921f2356e4615d532d02eefa7103fdb70f83b97a), [`ab43169`](https://github.com/tinacms/tinacms/commit/ab43169af5a95f31fa27bb0236623a031883a1fd), [`b551232`](https://github.com/tinacms/tinacms/commit/b5512326ad0ad9855bc75e2073a3ab2a8ec4c064), [`ea204c9`](https://github.com/tinacms/tinacms/commit/ea204c9045451f3ebea04f503e6158d2016613e4), [`fd664d8`](https://github.com/tinacms/tinacms/commit/fd664d8f4e83941ed1b1f234668ab6341a6178f8)]:
|
|
62
|
+
- tinacms@2.7.5
|
|
63
|
+
- @tinacms/mdx@1.6.2
|
|
64
|
+
|
|
65
|
+
## 2.2.3
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`991db1f`](https://github.com/tinacms/tinacms/commit/991db1f10c1f9cf9211d7e82bd56658cdcce24c7)]:
|
|
70
|
+
- tinacms@2.7.3
|
|
71
|
+
|
|
72
|
+
## 2.2.2
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [[`619e601`](https://github.com/tinacms/tinacms/commit/619e6010d6f95d893e980952bef64f747808c956), [`602b4d0`](https://github.com/tinacms/tinacms/commit/602b4d07f94de4c10d5bb059a5edc49546a2031c)]:
|
|
77
|
+
- tinacms@2.7.2
|
|
78
|
+
- @tinacms/mdx@1.6.1
|
|
79
|
+
|
|
80
|
+
## 2.2.1
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [[`74513b3`](https://github.com/tinacms/tinacms/commit/74513b357aa27165aa86f7b3218c697c663539e8), [`06c1716`](https://github.com/tinacms/tinacms/commit/06c17163b558a96275b0ef66c746b005a6f90d13)]:
|
|
85
|
+
- tinacms@2.7.1
|
|
86
|
+
|
|
87
|
+
## 2.2.0
|
|
88
|
+
|
|
89
|
+
### Minor Changes
|
|
90
|
+
|
|
91
|
+
- [#5503](https://github.com/tinacms/tinacms/pull/5503) [`99bb59f`](https://github.com/tinacms/tinacms/commit/99bb59ff7b9f3cf27a1382b91826eb81831ecb95) Thanks [@JackDevAU](https://github.com/JackDevAU)! - feat: add experimental user form select to the useTina hook
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- [#5486](https://github.com/tinacms/tinacms/pull/5486) [`d7c5ec1`](https://github.com/tinacms/tinacms/commit/d7c5ec1b174419dcc6ddba3cfb3684dd469da571) Thanks [@JackDevAU](https://github.com/JackDevAU)! - Update dependencies across packages
|
|
96
|
+
|
|
97
|
+
- Updated dependencies [[`3974aa7`](https://github.com/tinacms/tinacms/commit/3974aa759192713140733b99ee0254a1a056e124), [`7541614`](https://github.com/tinacms/tinacms/commit/7541614527a02268ea453b23ce84637f978dcf2d), [`d7c5ec1`](https://github.com/tinacms/tinacms/commit/d7c5ec1b174419dcc6ddba3cfb3684dd469da571), [`99bb59f`](https://github.com/tinacms/tinacms/commit/99bb59ff7b9f3cf27a1382b91826eb81831ecb95)]:
|
|
98
|
+
- tinacms@2.7.0
|
|
99
|
+
- @tinacms/mdx@1.6.0
|
|
100
|
+
|
|
101
|
+
## 2.1.19
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies []:
|
|
106
|
+
- tinacms@2.6.4
|
|
107
|
+
|
|
108
|
+
## 2.1.18
|
|
109
|
+
|
|
110
|
+
### Patch Changes
|
|
111
|
+
|
|
112
|
+
- Updated dependencies [[`05ba069`](https://github.com/tinacms/tinacms/commit/05ba0692a7e990fbb671177829562869d517e7c1), [`42daaf7`](https://github.com/tinacms/tinacms/commit/42daaf7af125da265d2c5998168e9c7345dc0a59), [`bc986dd`](https://github.com/tinacms/tinacms/commit/bc986dd48f9a7da264281b55926ec51ce1068bb7), [`3af2354`](https://github.com/tinacms/tinacms/commit/3af23542b984c10e138d0cf10a165d50b99bb0e9)]:
|
|
113
|
+
- tinacms@2.6.3
|
|
114
|
+
|
|
115
|
+
## 2.1.17
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies []:
|
|
120
|
+
- tinacms@2.6.2
|
|
121
|
+
|
|
122
|
+
## 2.1.16
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [[`61c45f4`](https://github.com/tinacms/tinacms/commit/61c45f49a2abe82336b661dedbbe2a15d0f3da05)]:
|
|
127
|
+
- tinacms@2.6.1
|
|
128
|
+
|
|
129
|
+
## 2.1.15
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Updated dependencies [[`9931d5a`](https://github.com/tinacms/tinacms/commit/9931d5a0d7e5e9e5165170047cf5653041bddd7a), [`4aadf3e`](https://github.com/tinacms/tinacms/commit/4aadf3ee0b5e7ba6614baee9507a3b51abc92053), [`92b683b`](https://github.com/tinacms/tinacms/commit/92b683bd3d73b47271eee5b8ff648ed4dcde51e3), [`82b0039`](https://github.com/tinacms/tinacms/commit/82b00393da8bbcc2cf357fbbb546904f07e8d89c), [`877699d`](https://github.com/tinacms/tinacms/commit/877699d08b3e2c2470742a3acf25d02a95e440b3)]:
|
|
134
|
+
- tinacms@2.6.0
|
|
135
|
+
- @tinacms/mdx@1.5.4
|
|
136
|
+
|
|
137
|
+
## 2.1.14
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [[`b54b303`](https://github.com/tinacms/tinacms/commit/b54b303a8290528230dc83d8fb1b7535df7199f6), [`0345852`](https://github.com/tinacms/tinacms/commit/0345852e3a7568b61a1417cd037715ab0d0dca01)]:
|
|
142
|
+
- tinacms@2.5.2
|
|
143
|
+
- @tinacms/mdx@1.5.3
|
|
144
|
+
|
|
145
|
+
## 2.1.13
|
|
4
146
|
|
|
5
147
|
### Patch Changes
|
|
6
148
|
|
|
7
149
|
- Updated dependencies [[`bbfd415`](https://github.com/tinacms/tinacms/commit/bbfd415762a8b2c62b7653b497b94d67aaa8501a), [`83a25cf`](https://github.com/tinacms/tinacms/commit/83a25cf61b736e1867d37bee37f7514d349e4427)]:
|
|
8
|
-
- tinacms@
|
|
150
|
+
- tinacms@2.5.1
|
|
9
151
|
|
|
10
152
|
## 2.1.12
|
|
11
153
|
|
|
@@ -381,7 +523,7 @@
|
|
|
381
523
|
|
|
382
524
|
fix: Use clean page-sizes on media manager (to make pagination more obvious)
|
|
383
525
|
|
|
384
|
-
Fix issue with uploading media in a folder with
|
|
526
|
+
Fix issue with uploading media in a folder with TinaCloud
|
|
385
527
|
|
|
386
528
|
- Updated dependencies [9c27087fb]
|
|
387
529
|
- Updated dependencies [65d0a701f]
|
|
@@ -704,7 +846,7 @@
|
|
|
704
846
|
> NOTE: Relative paths are fine to use here, but make sure it's relative to the `.tina/config` file
|
|
705
847
|
|
|
706
848
|
```ts
|
|
707
|
-
localContentPath: process.env.REMOTE_ROOT_PATH // eg. '../../my-content-repo'
|
|
849
|
+
localContentPath: process.env.REMOTE_ROOT_PATH; // eg. '../../my-content-repo'
|
|
708
850
|
```
|
|
709
851
|
|
|
710
852
|
### Production workflow
|
|
@@ -748,18 +890,18 @@
|
|
|
748
890
|
EX:
|
|
749
891
|
|
|
750
892
|
```ts
|
|
751
|
-
import { defineConfig } from
|
|
893
|
+
import { defineConfig } from "tinacms";
|
|
752
894
|
|
|
753
895
|
export default defineConfig({
|
|
754
896
|
admin: {
|
|
755
897
|
auth: {
|
|
756
898
|
onLogin: () => {
|
|
757
|
-
console.log(
|
|
899
|
+
console.log("On Log in!");
|
|
758
900
|
},
|
|
759
901
|
},
|
|
760
902
|
},
|
|
761
903
|
/// ...
|
|
762
|
-
})
|
|
904
|
+
});
|
|
763
905
|
```
|
|
764
906
|
|
|
765
907
|
- 9d4943a82: Fix issue resolving alias fields when passing through the `useTina` hook
|
|
@@ -982,13 +1124,13 @@
|
|
|
982
1124
|
|
|
983
1125
|
```ts
|
|
984
1126
|
// .tina/config.ts
|
|
985
|
-
import schema from
|
|
1127
|
+
import schema from "./schema";
|
|
986
1128
|
|
|
987
1129
|
export default defineConfig({
|
|
988
1130
|
schema: schema,
|
|
989
1131
|
//.. Everything from define config in `schema.ts`
|
|
990
1132
|
//.. Everything from `schema.config`
|
|
991
|
-
})
|
|
1133
|
+
});
|
|
992
1134
|
```
|
|
993
1135
|
|
|
994
1136
|
2. Add Build config
|
package/package.json
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/app",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-d94de9b-20250707010010",
|
|
4
4
|
"main": "src/main.tsx",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@types/react": "^18.3.
|
|
8
|
-
"@types/react-dom": "^18.3.
|
|
9
|
-
"typescript": "^5.
|
|
7
|
+
"@types/react": "^18.3.18",
|
|
8
|
+
"@types/react-dom": "^18.3.5",
|
|
9
|
+
"typescript": "^5.7.3"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"react": ">=18.3.1 <20.0.0",
|
|
13
|
+
"react-dom": ">=18.3.1 <20.0.0"
|
|
10
14
|
},
|
|
11
15
|
"dependencies": {
|
|
12
16
|
"@graphiql/toolkit": "0.8.4",
|
|
13
17
|
"@headlessui/react": "2.1.8",
|
|
14
18
|
"@heroicons/react": "^1.0.6",
|
|
15
|
-
"@monaco-editor/react": "4.
|
|
19
|
+
"@monaco-editor/react": "4.7.0-rc.0",
|
|
16
20
|
"final-form": "4.20.10",
|
|
17
21
|
"graphiql": "3.0.0-alpha.1",
|
|
18
22
|
"graphql": "15.8.0",
|
|
19
23
|
"monaco-editor": "0.31.0",
|
|
20
|
-
"react": "^18.3.1",
|
|
21
|
-
"react-dom": "^18.3.1",
|
|
22
24
|
"react-router-dom": "6.3.0",
|
|
23
|
-
"typescript": "^5.
|
|
24
|
-
"zod": "^3.
|
|
25
|
-
"
|
|
26
|
-
"tinacms": "
|
|
25
|
+
"typescript": "^5.7.3",
|
|
26
|
+
"zod": "^3.24.2",
|
|
27
|
+
"tinacms": "0.0.0-d94de9b-20250707010010",
|
|
28
|
+
"@tinacms/mdx": "1.7.0"
|
|
27
29
|
}
|
|
28
30
|
}
|
package/src/App.tsx
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import React, { Suspense } from 'react'
|
|
2
|
-
import TinaCMS, { TinaAdmin, useCMS, MdxFieldPluginExtendible } from 'tinacms'
|
|
3
|
-
import { Preview } from './preview'
|
|
4
|
-
import Playground from './Playground'
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
|
+
import TinaCMS, { TinaAdmin, useCMS, MdxFieldPluginExtendible } from 'tinacms';
|
|
3
|
+
import { Preview } from './preview';
|
|
4
|
+
import Playground from './Playground';
|
|
5
5
|
|
|
6
6
|
// TODO: Resolve this to local file in tsconfig.json
|
|
7
7
|
// @ts-expect-error
|
|
8
|
-
import config from 'TINA_IMPORT'
|
|
8
|
+
import config from 'TINA_IMPORT';
|
|
9
9
|
// @ts-expect-error
|
|
10
|
-
import schemaJson from 'SCHEMA_IMPORT'
|
|
10
|
+
import schemaJson from 'SCHEMA_IMPORT';
|
|
11
11
|
// @ts-expect-error
|
|
12
|
-
import staticMedia from 'STATIC_MEDIA_IMPORT'
|
|
12
|
+
import staticMedia from 'STATIC_MEDIA_IMPORT';
|
|
13
13
|
|
|
14
|
-
const RawEditor = React.lazy(() => import('./fields/rich-text'))
|
|
14
|
+
const RawEditor = React.lazy(() => import('./fields/rich-text'));
|
|
15
15
|
|
|
16
16
|
const Editor = (props) => {
|
|
17
|
-
const [rawMode, setRawMode] = React.useState(false)
|
|
17
|
+
const [rawMode, setRawMode] = React.useState(false);
|
|
18
18
|
return (
|
|
19
19
|
<MdxFieldPluginExtendible.Component
|
|
20
20
|
rawMode={rawMode}
|
|
@@ -26,32 +26,32 @@ const Editor = (props) => {
|
|
|
26
26
|
</Suspense>
|
|
27
27
|
}
|
|
28
28
|
/>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
31
|
|
|
32
32
|
const SetPreview = () => {
|
|
33
|
-
const cms = useCMS()
|
|
33
|
+
const cms = useCMS();
|
|
34
34
|
React.useEffect(() => {
|
|
35
35
|
// Override original 'rich-text' field with one that has raw mode support
|
|
36
36
|
cms.fields.add({
|
|
37
37
|
...MdxFieldPluginExtendible,
|
|
38
38
|
Component: Editor,
|
|
39
|
-
})
|
|
40
|
-
const basePath = __BASE_PATH__.replace(/^\/|\/$/g, '')
|
|
41
|
-
cms.flags.set('tina-basepath', basePath)
|
|
39
|
+
});
|
|
40
|
+
const basePath = __BASE_PATH__.replace(/^\/|\/$/g, '');
|
|
41
|
+
cms.flags.set('tina-basepath', basePath);
|
|
42
42
|
cms.flags.set(
|
|
43
43
|
'tina-preview',
|
|
44
44
|
`${basePath ? `${basePath}/` : ''}${config.build.outputFolder.replace(
|
|
45
45
|
/^\/|\/$/g,
|
|
46
46
|
''
|
|
47
47
|
)}`
|
|
48
|
-
)
|
|
49
|
-
}, [])
|
|
50
|
-
return null
|
|
51
|
-
}
|
|
48
|
+
);
|
|
49
|
+
}, []);
|
|
50
|
+
return null;
|
|
51
|
+
};
|
|
52
52
|
|
|
53
53
|
export const TinaAdminWrapper = () => {
|
|
54
|
-
const schema = { ...config?.schema, config }
|
|
54
|
+
const schema = { ...config?.schema, config };
|
|
55
55
|
return (
|
|
56
56
|
// @ts-ignore JSX element type 'TinaCMS' does not have any construct or call signatures.ts(2604)
|
|
57
57
|
<TinaCMS
|
|
@@ -70,10 +70,10 @@ export const TinaAdminWrapper = () => {
|
|
|
70
70
|
schemaJson={schemaJson}
|
|
71
71
|
/>
|
|
72
72
|
</TinaCMS>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
75
|
|
|
76
76
|
function App() {
|
|
77
|
-
return <TinaAdminWrapper
|
|
77
|
+
return <TinaAdminWrapper />;
|
|
78
78
|
}
|
|
79
|
-
export default App
|
|
79
|
+
export default App;
|
package/src/Playground.tsx
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { createGraphiQLFetcher } from '@graphiql/toolkit'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import { createGraphiQLFetcher } from '@graphiql/toolkit';
|
|
2
|
+
import { FolderIcon } from '@heroicons/react/outline';
|
|
3
|
+
import { queries } from 'CLIENT_IMPORT';
|
|
4
|
+
import { GraphiQL } from 'graphiql';
|
|
5
|
+
import { parse, print } from 'graphql';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useCMS } from 'tinacms';
|
|
8
8
|
|
|
9
|
-
import 'graphiql/graphiql.min.css'
|
|
9
|
+
import 'graphiql/graphiql.min.css';
|
|
10
10
|
|
|
11
11
|
const Playground = () => {
|
|
12
|
-
const cms = useCMS()
|
|
13
|
-
const [query, setQuery] = React.useState('')
|
|
14
|
-
const [variables, setVariables] = React.useState('')
|
|
15
|
-
const [autoQueries, setAutoQueries] = React.useState()
|
|
12
|
+
const cms = useCMS();
|
|
13
|
+
const [query, setQuery] = React.useState('');
|
|
14
|
+
const [variables, setVariables] = React.useState('');
|
|
15
|
+
const [autoQueries, setAutoQueries] = React.useState();
|
|
16
16
|
const [collectionInfo, setCollectionInfo] = React.useState<{
|
|
17
17
|
collections: {
|
|
18
|
-
name: string
|
|
19
|
-
documents: { edges: { node: { _sys: { relativePath: string } } }[] }
|
|
20
|
-
}[]
|
|
21
|
-
}>()
|
|
18
|
+
name: string;
|
|
19
|
+
documents: { edges: { node: { _sys: { relativePath: string } } }[] };
|
|
20
|
+
}[];
|
|
21
|
+
}>();
|
|
22
22
|
React.useEffect(() => {
|
|
23
23
|
const run = async () => {
|
|
24
24
|
if (queries) {
|
|
25
|
-
const q = queries({ request: async () => query })
|
|
25
|
+
const q = queries({ request: async () => query });
|
|
26
26
|
setCollectionInfo(
|
|
27
27
|
await cms.api.tina.request(
|
|
28
28
|
`
|
|
@@ -45,52 +45,52 @@ const Playground = () => {
|
|
|
45
45
|
`,
|
|
46
46
|
{ variables: {} }
|
|
47
47
|
)
|
|
48
|
-
)
|
|
49
|
-
setAutoQueries(q)
|
|
48
|
+
);
|
|
49
|
+
setAutoQueries(q);
|
|
50
50
|
} else {
|
|
51
|
-
setAutoQueries({})
|
|
51
|
+
setAutoQueries({});
|
|
52
52
|
}
|
|
53
|
-
}
|
|
54
|
-
run()
|
|
55
|
-
}, [])
|
|
53
|
+
};
|
|
54
|
+
run();
|
|
55
|
+
}, []);
|
|
56
56
|
|
|
57
|
-
const ref = React.useRef()
|
|
57
|
+
const ref = React.useRef();
|
|
58
58
|
|
|
59
59
|
const getToken = () => {
|
|
60
|
-
return JSON.parse(localStorage.getItem('tinacms-auth') || '{}')?.id_token
|
|
61
|
-
}
|
|
60
|
+
return JSON.parse(localStorage.getItem('tinacms-auth') || '{}')?.id_token;
|
|
61
|
+
};
|
|
62
62
|
|
|
63
63
|
if (!autoQueries) {
|
|
64
|
-
return null
|
|
64
|
+
return null;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const Plugin = () => {
|
|
68
|
-
const noAutoQueries = Object.keys(autoQueries).length === 0
|
|
68
|
+
const noAutoQueries = Object.keys(autoQueries).length === 0;
|
|
69
69
|
return (
|
|
70
70
|
<div>
|
|
71
|
-
<div className=
|
|
72
|
-
<div className=
|
|
73
|
-
<div className=
|
|
71
|
+
<div className='graphiql-doc-explorer-title'>Queries</div>
|
|
72
|
+
<div className='graphiql-doc-explorer-content'>
|
|
73
|
+
<div className='graphiql-markdown-description'>
|
|
74
74
|
{noAutoQueries
|
|
75
75
|
? 'No auto-generated queries found, the Tina config is likely set to client.skip = true'
|
|
76
76
|
: "Tina's auto-generated queries can be found here as well as any queries you may have defined yourself."}{' '}
|
|
77
|
-
<a href=
|
|
77
|
+
<a href='https://tina.io/docs/data-fetching/custom-queries/'>
|
|
78
78
|
Learn more here
|
|
79
79
|
</a>
|
|
80
80
|
</div>
|
|
81
|
-
<nav className=
|
|
81
|
+
<nav className='space-y-1' aria-label='Sidebar'>
|
|
82
82
|
<ul>
|
|
83
83
|
{Object.entries(autoQueries).map(([key, value]) => {
|
|
84
84
|
const collection = collectionInfo?.collections.find(
|
|
85
85
|
({ name }) => name === key
|
|
86
|
-
)
|
|
87
|
-
let variables = ''
|
|
88
|
-
let relativePath = ''
|
|
86
|
+
);
|
|
87
|
+
let variables = '';
|
|
88
|
+
let relativePath = '';
|
|
89
89
|
if (collection) {
|
|
90
90
|
relativePath =
|
|
91
91
|
collection?.documents?.edges[0]?.node?._sys.relativePath ||
|
|
92
|
-
''
|
|
93
|
-
variables = JSON.stringify({ relativePath }, null, 2)
|
|
92
|
+
'';
|
|
93
|
+
variables = JSON.stringify({ relativePath }, null, 2);
|
|
94
94
|
}
|
|
95
95
|
return (
|
|
96
96
|
<li>
|
|
@@ -100,47 +100,47 @@ 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
|
|
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') {
|
|
107
|
-
const v = await value({})
|
|
108
|
-
const ast = parse(v.query)
|
|
109
|
-
setVariables(variables)
|
|
110
|
-
setQuery(print(ast))
|
|
107
|
+
const v = await value({});
|
|
108
|
+
const ast = parse(v.query);
|
|
109
|
+
setVariables(variables);
|
|
110
|
+
setQuery(print(ast));
|
|
111
111
|
}
|
|
112
112
|
}}
|
|
113
113
|
>
|
|
114
|
-
<span className=
|
|
114
|
+
<span className='truncate'>
|
|
115
115
|
{key}{' '}
|
|
116
116
|
{relativePath && (
|
|
117
|
-
<span className=
|
|
117
|
+
<span className='pl-2 text-sm text-gray-300'>
|
|
118
118
|
({relativePath})
|
|
119
119
|
</span>
|
|
120
120
|
)}{' '}
|
|
121
121
|
</span>
|
|
122
122
|
</button>
|
|
123
123
|
</li>
|
|
124
|
-
)
|
|
124
|
+
);
|
|
125
125
|
})}
|
|
126
126
|
</ul>
|
|
127
127
|
</nav>
|
|
128
128
|
</div>
|
|
129
129
|
</div>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
132
|
return (
|
|
133
133
|
<div style={{ height: '100vh' }}>
|
|
134
134
|
<GraphiQL
|
|
135
135
|
fetcher={async (params, options) => {
|
|
136
136
|
const fetcher = createGraphiQLFetcher({
|
|
137
|
-
url: __API_URL__,
|
|
137
|
+
url: cms.api.tina.contentApiUrl || __API_URL__,
|
|
138
138
|
headers: { Authorization: `Bearer ${getToken()}` },
|
|
139
|
-
})
|
|
140
|
-
return fetcher(params, options)
|
|
139
|
+
});
|
|
140
|
+
return fetcher(params, options);
|
|
141
141
|
}}
|
|
142
142
|
query={query}
|
|
143
|
-
defaultEditorToolsVisibility=
|
|
143
|
+
defaultEditorToolsVisibility='variables'
|
|
144
144
|
isHeadersEditorEnabled={false}
|
|
145
145
|
defaultTabs={[]}
|
|
146
146
|
plugins={[
|
|
@@ -153,11 +153,11 @@ const Playground = () => {
|
|
|
153
153
|
variables={variables}
|
|
154
154
|
></GraphiQL>
|
|
155
155
|
</div>
|
|
156
|
-
)
|
|
157
|
-
}
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
158
|
|
|
159
|
-
export default Playground
|
|
159
|
+
export default Playground;
|
|
160
160
|
|
|
161
161
|
function classNames(...classes: string[]) {
|
|
162
|
-
return classes.filter(Boolean).join(' ')
|
|
162
|
+
return classes.filter(Boolean).join(' ');
|
|
163
163
|
}
|
package/src/dummy-client.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const queries = false
|
|
1
|
+
export const queries = false;
|