@tinacms/app 0.0.0-cd50b85-20250226055430 → 0.0.0-ce1414c-20251110052442
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 +145 -9
- package/index.html +1 -1
- package/package.json +7 -3
- package/src/App.tsx +24 -24
- package/src/Playground.tsx +56 -58
- 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 +68 -74
- package/src/fields/rich-text/monaco/use-debounce.ts +8 -8
- package/src/global.css +3 -3
- package/src/index.css +24 -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 +295 -277
- package/src/lib/types.ts +34 -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,147 @@
|
|
|
1
1
|
# @tinacms/app
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-ce1414c-20251110052442
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6087](https://github.com/tinacms/tinacms/pull/6087) [`1286e87`](https://github.com/tinacms/tinacms/commit/1286e87323694dc819edc56360613dc654f3d3ca) Thanks [@kulesy](https://github.com/kulesy)! - feat: Enhance branch creation modal with improved UI/UX and dropdown button component
|
|
8
|
+
|
|
9
|
+
- [#6098](https://github.com/tinacms/tinacms/pull/6098) [`a2d983e`](https://github.com/tinacms/tinacms/commit/a2d983ed886f66db2c133e902eacaa8d07e88bdb) Thanks [@Pat-Stuart](https://github.com/Pat-Stuart)! - Change from blue accent coloring to orange
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`1286e87`](https://github.com/tinacms/tinacms/commit/1286e87323694dc819edc56360613dc654f3d3ca), [`4416a28`](https://github.com/tinacms/tinacms/commit/4416a283ac1cfea5e9c4890cd71f2edf3b704344), [`6cba118`](https://github.com/tinacms/tinacms/commit/6cba118c90f7c7ab6356c0ef83fca18526e47f8d), [`572fb28`](https://github.com/tinacms/tinacms/commit/572fb28236b56db4ede5fe53b177b80323ae7284), [`ce1414c`](https://github.com/tinacms/tinacms/commit/ce1414ce1b82e6755a96c9c12949cd469b43e283), [`f224124`](https://github.com/tinacms/tinacms/commit/f224124220811fb44749122d46eb7100af89ee77), [`a2d983e`](https://github.com/tinacms/tinacms/commit/a2d983ed886f66db2c133e902eacaa8d07e88bdb), [`bc35474`](https://github.com/tinacms/tinacms/commit/bc354740d0cb359c372ba287974e7e9db3c5119c)]:
|
|
12
|
+
- tinacms@0.0.0-ce1414c-20251110052442
|
|
13
|
+
|
|
14
|
+
## 2.3.5
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`003e348`](https://github.com/tinacms/tinacms/commit/003e348472ddc08eee63d78190038097542b6311), [`5527e8a`](https://github.com/tinacms/tinacms/commit/5527e8ab5821c8613fcfd1b0b8bc6d93291a6d03), [`5ffd60e`](https://github.com/tinacms/tinacms/commit/5ffd60e7b07b19cde6fab36a911503276c83715f), [`b23aa0c`](https://github.com/tinacms/tinacms/commit/b23aa0c5defc51b8f9fe00a59dd87e1d2f8b9f0b), [`5d13c0d`](https://github.com/tinacms/tinacms/commit/5d13c0d023373692233c8be2127ae6e3d7d68b47)]:
|
|
19
|
+
- tinacms@2.9.1
|
|
20
|
+
|
|
21
|
+
## 2.3.4
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`0bbe080`](https://github.com/tinacms/tinacms/commit/0bbe0804e334238850a4f8f33be5cd123ff68ab3), [`98fbc94`](https://github.com/tinacms/tinacms/commit/98fbc941a07fbc52edafaeb43b49b5ea30ea4172), [`ced9076`](https://github.com/tinacms/tinacms/commit/ced9076d25d7177bd8d9ae3c6133d0560366511c)]:
|
|
26
|
+
- tinacms@2.9.0
|
|
27
|
+
|
|
28
|
+
## 2.3.3
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`ea917dd`](https://github.com/tinacms/tinacms/commit/ea917dd2840c955d462b66b58009d2a16da39377), [`b012b6c`](https://github.com/tinacms/tinacms/commit/b012b6c7fae2674c613fd4c54e1819a86c6d2c3e), [`39e5b05`](https://github.com/tinacms/tinacms/commit/39e5b0562af7bca1e2923fc94b7c8119e12a0133), [`55e018b`](https://github.com/tinacms/tinacms/commit/55e018b9826a540005bbadf8fd51e9bac456d531)]:
|
|
33
|
+
- tinacms@2.8.3
|
|
34
|
+
|
|
35
|
+
## 2.3.2
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [[`eaa6ed5`](https://github.com/tinacms/tinacms/commit/eaa6ed551c76349c5849cd1e19a8066ecbbe205c), [`60a15d5`](https://github.com/tinacms/tinacms/commit/60a15d533b85a0c3f9f483f6f0f0b6824616284b), [`2fb1c4e`](https://github.com/tinacms/tinacms/commit/2fb1c4e79d1cae5ab29c3f93b0867214e193f59c)]:
|
|
40
|
+
- tinacms@2.8.2
|
|
41
|
+
- @tinacms/mdx@1.8.1
|
|
42
|
+
|
|
43
|
+
## 2.3.1
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`41359ed`](https://github.com/tinacms/tinacms/commit/41359edaf08def7a5e26969ec114155038c09752), [`b20a2c4`](https://github.com/tinacms/tinacms/commit/b20a2c4fd64fa2d06711850db63fb317302ee361), [`41359ed`](https://github.com/tinacms/tinacms/commit/41359edaf08def7a5e26969ec114155038c09752)]:
|
|
48
|
+
- tinacms@2.8.1
|
|
49
|
+
|
|
50
|
+
## 2.3.0
|
|
51
|
+
|
|
52
|
+
### Minor Changes
|
|
53
|
+
|
|
54
|
+
- [#5744](https://github.com/tinacms/tinacms/pull/5744) [`98a61e2`](https://github.com/tinacms/tinacms/commit/98a61e2d263978a7096cc23ac7e94aa0039981be) Thanks [@Ben0189](https://github.com/Ben0189)! - Upgrade Plate editor to v48 beta, integrating latest features and improvements.
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [[`98a61e2`](https://github.com/tinacms/tinacms/commit/98a61e2d263978a7096cc23ac7e94aa0039981be)]:
|
|
59
|
+
- @tinacms/mdx@1.8.0
|
|
60
|
+
- tinacms@2.8.0
|
|
61
|
+
|
|
62
|
+
## 2.2.10
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- [#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
|
|
67
|
+
|
|
68
|
+
- 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)]:
|
|
69
|
+
- tinacms@2.7.10
|
|
70
|
+
|
|
71
|
+
## 2.2.9
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- [#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
|
|
76
|
+
Forms header - Adds breadcrumb navigation
|
|
77
|
+
|
|
78
|
+
- [#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
|
|
79
|
+
|
|
80
|
+
- Fixed Visual Editing's "Edit" button (Reference Fields)
|
|
81
|
+
|
|
82
|
+
- [#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
|
|
83
|
+
|
|
84
|
+
- 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)]:
|
|
85
|
+
- tinacms@2.7.9
|
|
86
|
+
- @tinacms/mdx@1.7.0
|
|
87
|
+
|
|
88
|
+
## 2.2.8
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- 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)]:
|
|
93
|
+
- tinacms@2.7.8
|
|
94
|
+
- @tinacms/mdx@1.6.3
|
|
95
|
+
|
|
96
|
+
## 2.2.7
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- [#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
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [[`1965236`](https://github.com/tinacms/tinacms/commit/19652363784e48b065ec1924a9cd9611c8e79cae)]:
|
|
103
|
+
- tinacms@2.7.7
|
|
104
|
+
|
|
105
|
+
## 2.2.6
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies [[`65cee5d`](https://github.com/tinacms/tinacms/commit/65cee5d6ae16c7320a4a14f0d9a82dc5f9103e34)]:
|
|
110
|
+
- tinacms@2.7.6
|
|
111
|
+
|
|
112
|
+
## 2.2.5
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- [#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
|
|
117
|
+
|
|
118
|
+
- [#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.
|
|
119
|
+
- Ensure GraphQL playground correctly updates when switching branches.
|
|
120
|
+
- 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)]:
|
|
121
|
+
- tinacms@2.7.5
|
|
122
|
+
- @tinacms/mdx@1.6.2
|
|
123
|
+
|
|
124
|
+
## 2.2.3
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- Updated dependencies [[`991db1f`](https://github.com/tinacms/tinacms/commit/991db1f10c1f9cf9211d7e82bd56658cdcce24c7)]:
|
|
129
|
+
- tinacms@2.7.3
|
|
130
|
+
|
|
131
|
+
## 2.2.2
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- Updated dependencies [[`619e601`](https://github.com/tinacms/tinacms/commit/619e6010d6f95d893e980952bef64f747808c956), [`602b4d0`](https://github.com/tinacms/tinacms/commit/602b4d07f94de4c10d5bb059a5edc49546a2031c)]:
|
|
136
|
+
- tinacms@2.7.2
|
|
137
|
+
- @tinacms/mdx@1.6.1
|
|
138
|
+
|
|
139
|
+
## 2.2.1
|
|
4
140
|
|
|
5
141
|
### Patch Changes
|
|
6
142
|
|
|
7
143
|
- Updated dependencies [[`74513b3`](https://github.com/tinacms/tinacms/commit/74513b357aa27165aa86f7b3218c697c663539e8), [`06c1716`](https://github.com/tinacms/tinacms/commit/06c17163b558a96275b0ef66c746b005a6f90d13)]:
|
|
8
|
-
- tinacms@
|
|
144
|
+
- tinacms@2.7.1
|
|
9
145
|
|
|
10
146
|
## 2.2.0
|
|
11
147
|
|
|
@@ -446,7 +582,7 @@
|
|
|
446
582
|
|
|
447
583
|
fix: Use clean page-sizes on media manager (to make pagination more obvious)
|
|
448
584
|
|
|
449
|
-
Fix issue with uploading media in a folder with
|
|
585
|
+
Fix issue with uploading media in a folder with TinaCloud
|
|
450
586
|
|
|
451
587
|
- Updated dependencies [9c27087fb]
|
|
452
588
|
- Updated dependencies [65d0a701f]
|
|
@@ -769,7 +905,7 @@
|
|
|
769
905
|
> NOTE: Relative paths are fine to use here, but make sure it's relative to the `.tina/config` file
|
|
770
906
|
|
|
771
907
|
```ts
|
|
772
|
-
localContentPath: process.env.REMOTE_ROOT_PATH // eg. '../../my-content-repo'
|
|
908
|
+
localContentPath: process.env.REMOTE_ROOT_PATH; // eg. '../../my-content-repo'
|
|
773
909
|
```
|
|
774
910
|
|
|
775
911
|
### Production workflow
|
|
@@ -813,18 +949,18 @@
|
|
|
813
949
|
EX:
|
|
814
950
|
|
|
815
951
|
```ts
|
|
816
|
-
import { defineConfig } from
|
|
952
|
+
import { defineConfig } from "tinacms";
|
|
817
953
|
|
|
818
954
|
export default defineConfig({
|
|
819
955
|
admin: {
|
|
820
956
|
auth: {
|
|
821
957
|
onLogin: () => {
|
|
822
|
-
console.log(
|
|
958
|
+
console.log("On Log in!");
|
|
823
959
|
},
|
|
824
960
|
},
|
|
825
961
|
},
|
|
826
962
|
/// ...
|
|
827
|
-
})
|
|
963
|
+
});
|
|
828
964
|
```
|
|
829
965
|
|
|
830
966
|
- 9d4943a82: Fix issue resolving alias fields when passing through the `useTina` hook
|
|
@@ -1047,13 +1183,13 @@
|
|
|
1047
1183
|
|
|
1048
1184
|
```ts
|
|
1049
1185
|
// .tina/config.ts
|
|
1050
|
-
import schema from
|
|
1186
|
+
import schema from "./schema";
|
|
1051
1187
|
|
|
1052
1188
|
export default defineConfig({
|
|
1053
1189
|
schema: schema,
|
|
1054
1190
|
//.. Everything from define config in `schema.ts`
|
|
1055
1191
|
//.. Everything from `schema.config`
|
|
1056
|
-
})
|
|
1192
|
+
});
|
|
1057
1193
|
```
|
|
1058
1194
|
|
|
1059
1195
|
2. Add Build config
|
package/index.html
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
the assets for this page.\
|
|
52
52
|
</p>\
|
|
53
53
|
<p>\
|
|
54
|
-
Please visit <a href="https://tina.io/docs/
|
|
54
|
+
Please visit <a href="https://tina.io/docs/r/FAQ/#13-how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.\
|
|
55
55
|
</p>\
|
|
56
56
|
</div>'
|
|
57
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/app",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-ce1414c-20251110052442",
|
|
4
4
|
"main": "src/main.tsx",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"@types/react-dom": "^18.3.5",
|
|
9
9
|
"typescript": "^5.7.3"
|
|
10
10
|
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"react": ">=18.3.1 <20.0.0",
|
|
13
|
+
"react-dom": ">=18.3.1 <20.0.0"
|
|
14
|
+
},
|
|
11
15
|
"dependencies": {
|
|
12
16
|
"@graphiql/toolkit": "0.8.4",
|
|
13
17
|
"@headlessui/react": "2.1.8",
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
"react-router-dom": "6.3.0",
|
|
23
27
|
"typescript": "^5.7.3",
|
|
24
28
|
"zod": "^3.24.2",
|
|
25
|
-
"tinacms": "
|
|
26
|
-
"
|
|
29
|
+
"@tinacms/mdx": "1.8.1",
|
|
30
|
+
"tinacms": "0.0.0-ce1414c-20251110052442"
|
|
27
31
|
}
|
|
28
32
|
}
|
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,50 @@ 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=
|
|
78
|
-
Learn more here
|
|
79
|
-
</a>
|
|
77
|
+
<a href='https://tina.io/docs/r/custom-queries/'>Learn more here</a>
|
|
80
78
|
</div>
|
|
81
|
-
<nav className=
|
|
79
|
+
<nav className='space-y-1' aria-label='Sidebar'>
|
|
82
80
|
<ul>
|
|
83
81
|
{Object.entries(autoQueries).map(([key, value]) => {
|
|
84
82
|
const collection = collectionInfo?.collections.find(
|
|
85
83
|
({ name }) => name === key
|
|
86
|
-
)
|
|
87
|
-
let variables = ''
|
|
88
|
-
let relativePath = ''
|
|
84
|
+
);
|
|
85
|
+
let variables = '';
|
|
86
|
+
let relativePath = '';
|
|
89
87
|
if (collection) {
|
|
90
88
|
relativePath =
|
|
91
89
|
collection?.documents?.edges[0]?.node?._sys.relativePath ||
|
|
92
|
-
''
|
|
93
|
-
variables = JSON.stringify({ relativePath }, null, 2)
|
|
90
|
+
'';
|
|
91
|
+
variables = JSON.stringify({ relativePath }, null, 2);
|
|
94
92
|
}
|
|
95
93
|
return (
|
|
96
94
|
<li>
|
|
@@ -100,47 +98,47 @@ const Playground = () => {
|
|
|
100
98
|
false
|
|
101
99
|
? 'bg-gray-100 text-gray-900'
|
|
102
100
|
: 'text-gray-600 hover:bg-gray-50 hover:text-gray-900',
|
|
103
|
-
'flex items-center rounded
|
|
101
|
+
'flex items-center rounded px-3 py-2 text-sm font-medium w-full text-left'
|
|
104
102
|
)}
|
|
105
103
|
onClick={async () => {
|
|
106
104
|
if (typeof value === 'function') {
|
|
107
|
-
const v = await value({})
|
|
108
|
-
const ast = parse(v.query)
|
|
109
|
-
setVariables(variables)
|
|
110
|
-
setQuery(print(ast))
|
|
105
|
+
const v = await value({});
|
|
106
|
+
const ast = parse(v.query);
|
|
107
|
+
setVariables(variables);
|
|
108
|
+
setQuery(print(ast));
|
|
111
109
|
}
|
|
112
110
|
}}
|
|
113
111
|
>
|
|
114
|
-
<span className=
|
|
112
|
+
<span className='truncate'>
|
|
115
113
|
{key}{' '}
|
|
116
114
|
{relativePath && (
|
|
117
|
-
<span className=
|
|
115
|
+
<span className='pl-2 text-sm text-gray-300'>
|
|
118
116
|
({relativePath})
|
|
119
117
|
</span>
|
|
120
118
|
)}{' '}
|
|
121
119
|
</span>
|
|
122
120
|
</button>
|
|
123
121
|
</li>
|
|
124
|
-
)
|
|
122
|
+
);
|
|
125
123
|
})}
|
|
126
124
|
</ul>
|
|
127
125
|
</nav>
|
|
128
126
|
</div>
|
|
129
127
|
</div>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
132
130
|
return (
|
|
133
131
|
<div style={{ height: '100vh' }}>
|
|
134
132
|
<GraphiQL
|
|
135
133
|
fetcher={async (params, options) => {
|
|
136
134
|
const fetcher = createGraphiQLFetcher({
|
|
137
|
-
url: __API_URL__,
|
|
135
|
+
url: cms.api.tina.contentApiUrl || __API_URL__,
|
|
138
136
|
headers: { Authorization: `Bearer ${getToken()}` },
|
|
139
|
-
})
|
|
140
|
-
return fetcher(params, options)
|
|
137
|
+
});
|
|
138
|
+
return fetcher(params, options);
|
|
141
139
|
}}
|
|
142
140
|
query={query}
|
|
143
|
-
defaultEditorToolsVisibility=
|
|
141
|
+
defaultEditorToolsVisibility='variables'
|
|
144
142
|
isHeadersEditorEnabled={false}
|
|
145
143
|
defaultTabs={[]}
|
|
146
144
|
plugins={[
|
|
@@ -153,11 +151,11 @@ const Playground = () => {
|
|
|
153
151
|
variables={variables}
|
|
154
152
|
></GraphiQL>
|
|
155
153
|
</div>
|
|
156
|
-
)
|
|
157
|
-
}
|
|
154
|
+
);
|
|
155
|
+
};
|
|
158
156
|
|
|
159
|
-
export default Playground
|
|
157
|
+
export default Playground;
|
|
160
158
|
|
|
161
159
|
function classNames(...classes: string[]) {
|
|
162
|
-
return classes.filter(Boolean).join(' ')
|
|
160
|
+
return classes.filter(Boolean).join(' ');
|
|
163
161
|
}
|
package/src/dummy-client.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const queries = false
|
|
1
|
+
export const queries = false;
|