tinacms 0.64.0 → 0.65.1
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 +39 -0
- package/dist/admin/api.d.ts +36 -0
- package/dist/admin/components/GetCollection.d.ts +1 -28
- package/dist/admin/components/GetCollections.d.ts +1 -4
- package/dist/admin/components/GetDocument.d.ts +2 -15
- package/dist/admin/components/GetDocumentFields.d.ts +0 -7
- package/dist/admin/plugins/route-mapping.d.ts +3 -15
- package/dist/admin/types.d.ts +72 -0
- package/dist/edit-state.d.ts +8 -0
- package/dist/edit-state.es.js +32 -3
- package/dist/edit-state.js +30 -0
- package/dist/hooks/use-graphql-forms.d.ts +2 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1658 -214
- package/dist/index.js +1658 -212
- package/dist/rich-text.d.ts +1 -1
- package/dist/style.css +296 -306
- package/dist/tina-cms.d.ts +54 -13
- package/package.json +7 -5
- package/dist/admin/hooks/useEmbedTailwind.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# tinacms
|
|
2
2
|
|
|
3
|
+
## 0.65.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 68284198a: fix: use user-specific document creator callback
|
|
8
|
+
- ccf4dcbd4: chore: Export low-level data provider from "tinacms", for the playground and other sandboz environments
|
|
9
|
+
- f2431c031: Fix type for code_block TinaMarkdown element
|
|
10
|
+
|
|
11
|
+
## 0.65.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 792f47251: useTina hook for page-level form registration
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 6a50a1368: Updates the look and feel of the Tina Sidebar
|
|
20
|
+
- 239382619: Introduces TinaAdminApi and consolidates types
|
|
21
|
+
- Updated dependencies [8ad8f03fd]
|
|
22
|
+
- Updated dependencies [6a50a1368]
|
|
23
|
+
- Updated dependencies [792f47251]
|
|
24
|
+
- @tinacms/toolkit@0.56.9
|
|
25
|
+
- @tinacms/sharedctx@0.1.0
|
|
26
|
+
|
|
27
|
+
## 0.64.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [7006b38ea]
|
|
32
|
+
- @tinacms/toolkit@0.56.8
|
|
33
|
+
|
|
34
|
+
## 0.64.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 28010a026: Adds tailwind styles to Admin Layout
|
|
39
|
+
- Updated dependencies [e8ca82899]
|
|
40
|
+
- @tinacms/toolkit@0.56.7
|
|
41
|
+
|
|
3
42
|
## 0.64.0
|
|
4
43
|
|
|
5
44
|
### Minor Changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
See the License for the specific language governing permissions and
|
|
11
|
+
limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
import type { Collection, DocumentForm, GetDocumentFields } from './types';
|
|
14
|
+
export declare class TinaAdminApi {
|
|
15
|
+
/**
|
|
16
|
+
* cms.api.tina
|
|
17
|
+
*/
|
|
18
|
+
api: {
|
|
19
|
+
request: (query: string, { variables }: {
|
|
20
|
+
variables: object;
|
|
21
|
+
}) => any;
|
|
22
|
+
};
|
|
23
|
+
constructor(TinaApi: any);
|
|
24
|
+
fetchCollections(): Promise<{
|
|
25
|
+
getCollections: Collection[];
|
|
26
|
+
}>;
|
|
27
|
+
fetchCollection(collectionName: string, includeDocuments: boolean): Promise<{
|
|
28
|
+
getCollection: Collection;
|
|
29
|
+
}>;
|
|
30
|
+
fetchDocument(collectionName: string, relativePath: string): Promise<{
|
|
31
|
+
getDocument: DocumentForm;
|
|
32
|
+
}>;
|
|
33
|
+
fetchDocumentFields(): Promise<GetDocumentFields>;
|
|
34
|
+
createDocument(collectionName: string, relativePath: string, params: Object): Promise<any>;
|
|
35
|
+
updateDocument(collectionName: string, relativePath: string, params: Object): Promise<any>;
|
|
36
|
+
}
|
|
@@ -11,34 +11,7 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
-
|
|
15
|
-
node: {
|
|
16
|
-
sys: {
|
|
17
|
-
template: string;
|
|
18
|
-
breadcrumbs: string[];
|
|
19
|
-
path: string;
|
|
20
|
-
basename: string;
|
|
21
|
-
relativePath: string;
|
|
22
|
-
filename: string;
|
|
23
|
-
extension: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export interface Template {
|
|
28
|
-
name: string;
|
|
29
|
-
label: string;
|
|
30
|
-
fields: any[];
|
|
31
|
-
}
|
|
32
|
-
export interface Collection {
|
|
33
|
-
label: string;
|
|
34
|
-
name: string;
|
|
35
|
-
format: string;
|
|
36
|
-
templates: Template[];
|
|
37
|
-
documents: {
|
|
38
|
-
totalCount: number;
|
|
39
|
-
edges: Document[];
|
|
40
|
-
};
|
|
41
|
-
}
|
|
14
|
+
import type { Collection } from '../types';
|
|
42
15
|
export declare const useGetCollection: (cms: TinaCMS, collectionName: string, includeDocuments?: boolean) => Collection;
|
|
43
16
|
declare const GetCollection: ({ cms, collectionName, includeDocuments, children, }: {
|
|
44
17
|
cms: TinaCMS;
|
|
@@ -11,10 +11,7 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
-
|
|
15
|
-
label: string;
|
|
16
|
-
name: string;
|
|
17
|
-
}
|
|
14
|
+
import type { Collection } from '../types';
|
|
18
15
|
export declare const useGetCollections: (cms: TinaCMS) => Collection[];
|
|
19
16
|
declare const GetCollections: ({ cms, children }: {
|
|
20
17
|
cms: TinaCMS;
|
|
@@ -11,21 +11,8 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
label: string;
|
|
17
|
-
name: string;
|
|
18
|
-
fields: Object[];
|
|
19
|
-
mutationInfo: {
|
|
20
|
-
path: string[];
|
|
21
|
-
string: string;
|
|
22
|
-
includeCollection: boolean;
|
|
23
|
-
includeTemplate: boolean;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
values: Object;
|
|
27
|
-
}
|
|
28
|
-
export declare const useGetDocument: (cms: TinaCMS, collectionName: string, relativePath: string) => Document;
|
|
14
|
+
import type { DocumentForm } from '../types';
|
|
15
|
+
export declare const useGetDocument: (cms: TinaCMS, collectionName: string, relativePath: string) => DocumentForm;
|
|
29
16
|
declare const GetDocument: ({ cms, collectionName, relativePath, children, }: {
|
|
30
17
|
cms: TinaCMS;
|
|
31
18
|
collectionName: string;
|
|
@@ -11,13 +11,6 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
-
interface GetDocumentFields {
|
|
15
|
-
[collectionName: string]: {
|
|
16
|
-
collection: Object;
|
|
17
|
-
templates?: Object[];
|
|
18
|
-
fields?: Object[];
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
14
|
export interface Info {
|
|
22
15
|
collection: Object | undefined;
|
|
23
16
|
template: Object | undefined;
|
|
@@ -11,22 +11,10 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import { Plugin } from '@tinacms/toolkit';
|
|
14
|
-
import { Collection } from '../
|
|
15
|
-
interface Document {
|
|
16
|
-
sys: {
|
|
17
|
-
template: string;
|
|
18
|
-
breadcrumbs: string[];
|
|
19
|
-
path: string;
|
|
20
|
-
basename: string;
|
|
21
|
-
relativePath: string;
|
|
22
|
-
filename: string;
|
|
23
|
-
extension: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
14
|
+
import type { Collection, DocumentSys } from '../types';
|
|
26
15
|
export declare class RouteMappingPlugin implements Plugin {
|
|
27
16
|
__type: string;
|
|
28
17
|
name: string;
|
|
29
|
-
mapper: (collection: Collection, document:
|
|
30
|
-
constructor(mapper: (collection: Collection, document:
|
|
18
|
+
mapper: (collection: Collection, document: DocumentSys) => string | undefined;
|
|
19
|
+
constructor(mapper: (collection: Collection, document: DocumentSys) => string | undefined);
|
|
31
20
|
}
|
|
32
|
-
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
See the License for the specific language governing permissions and
|
|
11
|
+
limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
export interface Template {
|
|
14
|
+
name: string;
|
|
15
|
+
label: string;
|
|
16
|
+
fields: any[];
|
|
17
|
+
}
|
|
18
|
+
export interface DocumentNode {
|
|
19
|
+
node: {
|
|
20
|
+
sys: {
|
|
21
|
+
template: string;
|
|
22
|
+
breadcrumbs: string[];
|
|
23
|
+
path: string;
|
|
24
|
+
basename: string;
|
|
25
|
+
relativePath: string;
|
|
26
|
+
filename: string;
|
|
27
|
+
extension: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface DocumentForm {
|
|
32
|
+
form: {
|
|
33
|
+
label: string;
|
|
34
|
+
name: string;
|
|
35
|
+
fields: Object[];
|
|
36
|
+
mutationInfo: {
|
|
37
|
+
path: string[];
|
|
38
|
+
string: string;
|
|
39
|
+
includeCollection: boolean;
|
|
40
|
+
includeTemplate: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
values: Object;
|
|
44
|
+
}
|
|
45
|
+
export interface DocumentSys {
|
|
46
|
+
sys: {
|
|
47
|
+
template: string;
|
|
48
|
+
breadcrumbs: string[];
|
|
49
|
+
path: string;
|
|
50
|
+
basename: string;
|
|
51
|
+
relativePath: string;
|
|
52
|
+
filename: string;
|
|
53
|
+
extension: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface Collection {
|
|
57
|
+
label: string;
|
|
58
|
+
name: string;
|
|
59
|
+
format?: string;
|
|
60
|
+
templates?: Template[];
|
|
61
|
+
documents?: {
|
|
62
|
+
totalCount?: number;
|
|
63
|
+
edges?: DocumentNode[];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface GetDocumentFields {
|
|
67
|
+
[collectionName: string]: {
|
|
68
|
+
collection: Object;
|
|
69
|
+
templates?: Object[];
|
|
70
|
+
fields?: Object[];
|
|
71
|
+
};
|
|
72
|
+
}
|
package/dist/edit-state.d.ts
CHANGED
|
@@ -18,3 +18,11 @@ export declare const TinaEditProvider: ({ showEditButton, ...props }: {
|
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
editMode: React.ReactNode;
|
|
20
20
|
}) => JSX.Element;
|
|
21
|
+
export declare function useTina<T extends object>({ query, variables, data, }: {
|
|
22
|
+
query: string;
|
|
23
|
+
variables: object;
|
|
24
|
+
data: T;
|
|
25
|
+
}): {
|
|
26
|
+
data: T;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
};
|
package/dist/edit-state.es.js
CHANGED
|
@@ -26,9 +26,9 @@ var __objRest = (source, exclude) => {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
|
-
import { EditProvider, useEditState } from "@tinacms/sharedctx";
|
|
29
|
+
import { EditProvider, TinaDataContext, useEditState } from "@tinacms/sharedctx";
|
|
30
30
|
export { isEditing, setEditing, useEditState } from "@tinacms/sharedctx";
|
|
31
|
-
import React from "react";
|
|
31
|
+
import React, { useState, useEffect } from "react";
|
|
32
32
|
const TinaEditProvider = (_a) => {
|
|
33
33
|
var _b = _a, {
|
|
34
34
|
showEditButton
|
|
@@ -37,6 +37,35 @@ const TinaEditProvider = (_a) => {
|
|
|
37
37
|
]);
|
|
38
38
|
return /* @__PURE__ */ React.createElement(EditProvider, null, showEditButton && /* @__PURE__ */ React.createElement(ToggleButton, null), /* @__PURE__ */ React.createElement(TinaEditProviderInner, __spreadValues({}, props)));
|
|
39
39
|
};
|
|
40
|
+
function useTina({
|
|
41
|
+
query,
|
|
42
|
+
variables,
|
|
43
|
+
data
|
|
44
|
+
}) {
|
|
45
|
+
const {
|
|
46
|
+
setRequest,
|
|
47
|
+
state,
|
|
48
|
+
isDummyContainer,
|
|
49
|
+
isLoading: contextLoading
|
|
50
|
+
} = React.useContext(TinaDataContext);
|
|
51
|
+
const [waitForContextRerender, setWaitForContextRerender] = useState(!isDummyContainer);
|
|
52
|
+
const isLoading = contextLoading || waitForContextRerender;
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
setRequest({ query, variables });
|
|
55
|
+
}, [JSON.stringify(variables), query]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!isDummyContainer) {
|
|
58
|
+
setTimeout(() => setWaitForContextRerender(false), 0);
|
|
59
|
+
}
|
|
60
|
+
return () => {
|
|
61
|
+
setRequest(void 0);
|
|
62
|
+
};
|
|
63
|
+
}, [isDummyContainer]);
|
|
64
|
+
return {
|
|
65
|
+
data: isDummyContainer || isLoading ? data : state.payload,
|
|
66
|
+
isLoading
|
|
67
|
+
};
|
|
68
|
+
}
|
|
40
69
|
const ToggleButton = () => {
|
|
41
70
|
const { edit } = useEditState();
|
|
42
71
|
const [isOnAdmin, setIsOnAdmin] = React.useState(false);
|
|
@@ -73,4 +102,4 @@ const TinaEditProviderInner = ({ children, editMode }) => {
|
|
|
73
102
|
}
|
|
74
103
|
return children;
|
|
75
104
|
};
|
|
76
|
-
export { TinaEditProvider };
|
|
105
|
+
export { TinaEditProvider, useTina };
|
package/dist/edit-state.js
CHANGED
|
@@ -42,6 +42,35 @@ var __objRest = (source, exclude) => {
|
|
|
42
42
|
]);
|
|
43
43
|
return /* @__PURE__ */ React__default["default"].createElement(sharedctx.EditProvider, null, showEditButton && /* @__PURE__ */ React__default["default"].createElement(ToggleButton, null), /* @__PURE__ */ React__default["default"].createElement(TinaEditProviderInner, __spreadValues({}, props)));
|
|
44
44
|
};
|
|
45
|
+
function useTina({
|
|
46
|
+
query,
|
|
47
|
+
variables,
|
|
48
|
+
data
|
|
49
|
+
}) {
|
|
50
|
+
const {
|
|
51
|
+
setRequest,
|
|
52
|
+
state,
|
|
53
|
+
isDummyContainer,
|
|
54
|
+
isLoading: contextLoading
|
|
55
|
+
} = React__default["default"].useContext(sharedctx.TinaDataContext);
|
|
56
|
+
const [waitForContextRerender, setWaitForContextRerender] = React.useState(!isDummyContainer);
|
|
57
|
+
const isLoading = contextLoading || waitForContextRerender;
|
|
58
|
+
React__default["default"].useEffect(() => {
|
|
59
|
+
setRequest({ query, variables });
|
|
60
|
+
}, [JSON.stringify(variables), query]);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (!isDummyContainer) {
|
|
63
|
+
setTimeout(() => setWaitForContextRerender(false), 0);
|
|
64
|
+
}
|
|
65
|
+
return () => {
|
|
66
|
+
setRequest(void 0);
|
|
67
|
+
};
|
|
68
|
+
}, [isDummyContainer]);
|
|
69
|
+
return {
|
|
70
|
+
data: isDummyContainer || isLoading ? data : state.payload,
|
|
71
|
+
isLoading
|
|
72
|
+
};
|
|
73
|
+
}
|
|
45
74
|
const ToggleButton = () => {
|
|
46
75
|
const { edit } = sharedctx.useEditState();
|
|
47
76
|
const [isOnAdmin, setIsOnAdmin] = React__default["default"].useState(false);
|
|
@@ -97,6 +126,7 @@ var __objRest = (source, exclude) => {
|
|
|
97
126
|
}
|
|
98
127
|
});
|
|
99
128
|
exports2.TinaEditProvider = TinaEditProvider;
|
|
129
|
+
exports2.useTina = useTina;
|
|
100
130
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
101
131
|
exports2[Symbol.toStringTag] = "Module";
|
|
102
132
|
});
|
|
@@ -10,12 +10,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
-
import gql from 'graphql-tag';
|
|
14
13
|
import { Form } from '@tinacms/toolkit';
|
|
15
14
|
import type { FormOptions, TinaCMS } from '@tinacms/toolkit';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
query: (gqlTag: typeof gql) => DocumentNode;
|
|
15
|
+
export declare function useGraphqlForms<T extends object>({ variables, onSubmit, formify, query, }: {
|
|
16
|
+
query: string;
|
|
19
17
|
variables: object;
|
|
20
18
|
onSubmit?: (args: onSubmitArgs) => void;
|
|
21
19
|
formify?: formifyCallback;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,6 @@ export { useDocumentCreatorPlugin } from './hooks/use-content-creator';
|
|
|
19
19
|
export * from '@tinacms/toolkit';
|
|
20
20
|
export { TinaAdmin } from './admin';
|
|
21
21
|
export { RouteMappingPlugin } from './admin/plugins/route-mapping';
|
|
22
|
+
export { TinaAdminApi } from './admin/api';
|
|
22
23
|
import { TinaCMSProvider2 } from './tina-cms';
|
|
23
24
|
export default TinaCMSProvider2;
|