tinacms 0.57.4 → 0.59.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 +47 -0
- package/dist/admin/components/AuthTemplate.d.ts +17 -0
- package/dist/admin/components/Sidebar.d.ts +17 -0
- package/dist/admin/pages/LogoutPage.d.ts +14 -0
- package/dist/admin/plugins/route-mapping.d.ts +32 -0
- package/dist/client/index.d.ts +3 -2
- package/dist/edit-state.d.ts +2 -11
- package/dist/edit-state.es.js +14 -38
- package/dist/edit-state.js +29 -42
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +415 -322
- package/dist/index.js +415 -322
- package/dist/tina-cms.d.ts +1 -1
- package/dist/utils/client.d.ts +29 -0
- package/package.json +7 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# tinacms
|
|
2
2
|
|
|
3
|
+
## 0.59.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ed9d48abc: Swaps starter's old admin for the new one
|
|
8
|
+
- f6876d30f: Alter empty sidebar message to be more specific to auto-generating logic
|
|
9
|
+
- Updated dependencies [f6876d30f]
|
|
10
|
+
- Updated dependencies [92268fc85]
|
|
11
|
+
- @tinacms/toolkit@0.56.1
|
|
12
|
+
|
|
13
|
+
## 0.59.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- df3030990: Add basic branch switcher
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 9ecceb59f: Always include `collection` for TinaAdmin `createDocument()` and `updateDocument()`
|
|
22
|
+
- Updated dependencies [df3030990]
|
|
23
|
+
- @tinacms/toolkit@0.56.0
|
|
24
|
+
|
|
25
|
+
## 0.58.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- e6995cfcb: Adds README for TinaAdmin
|
|
30
|
+
- 60729f60c: Adds a `reference` field
|
|
31
|
+
- 19e02829f: Add ability to control plugin layout for global plugins from formify
|
|
32
|
+
- Updated dependencies [60729f60c]
|
|
33
|
+
- @tinacms/toolkit@0.55.4
|
|
34
|
+
|
|
35
|
+
## 0.58.0
|
|
36
|
+
|
|
37
|
+
### Minor Changes
|
|
38
|
+
|
|
39
|
+
- d1ed404ba: Add support for auto-generated SDK for type-safe data fetching
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 138ceb8c4: Clean up dependencies
|
|
44
|
+
- 0417e3750: Adds RouteMapperPlugin and FormMetaPlugin
|
|
45
|
+
- Updated dependencies [138ceb8c4]
|
|
46
|
+
- Updated dependencies [0417e3750]
|
|
47
|
+
- Updated dependencies [d9f37ea7e]
|
|
48
|
+
- @tinacms/toolkit@0.55.3
|
|
49
|
+
|
|
3
50
|
## 0.57.4
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
declare const AuthTemplate: ({ message, children, }: {
|
|
14
|
+
message?: string;
|
|
15
|
+
children: any;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
export default AuthTemplate;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
+
declare const Sidebar: ({ cms }: {
|
|
15
|
+
cms: TinaCMS;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
export default Sidebar;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
declare const LogoutPage: () => JSX.Element;
|
|
14
|
+
export default LogoutPage;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Plugin } from '@tinacms/toolkit';
|
|
14
|
+
import { Collection } from '../components/GetCollection';
|
|
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
|
+
}
|
|
26
|
+
export declare class RouteMappingPlugin implements Plugin {
|
|
27
|
+
__type: string;
|
|
28
|
+
name: string;
|
|
29
|
+
mapper: (collection: Collection, document: Document) => string | undefined;
|
|
30
|
+
constructor(mapper: (collection: Collection, document: Document) => string | undefined);
|
|
31
|
+
}
|
|
32
|
+
export {};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare class Client {
|
|
|
33
33
|
identityApiUrl: string;
|
|
34
34
|
schema: GraphQLSchema;
|
|
35
35
|
clientId: string;
|
|
36
|
+
contentApiBase: string;
|
|
36
37
|
query: string;
|
|
37
38
|
setToken: (_token: TokenObject) => void;
|
|
38
39
|
private getToken;
|
|
@@ -64,8 +65,8 @@ export declare class Client {
|
|
|
64
65
|
*/
|
|
65
66
|
fetchWithToken(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
66
67
|
getUser(): Promise<any>;
|
|
67
|
-
listBranches(
|
|
68
|
-
createBranch({
|
|
68
|
+
listBranches(): Promise<any>;
|
|
69
|
+
createBranch({ baseBranch, branchName }: BranchData): Promise<string>;
|
|
69
70
|
}
|
|
70
71
|
export declare const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
|
|
71
72
|
export declare class LocalClient extends Client {
|
package/dist/edit-state.d.ts
CHANGED
|
@@ -10,20 +10,11 @@ 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 { isEditing, setEditing, useEditState } from '@tinacms/sharedctx';
|
|
13
14
|
import React from 'react';
|
|
15
|
+
export { isEditing, setEditing, useEditState };
|
|
14
16
|
export declare const TinaEditProvider: ({ showEditButton, ...props }: {
|
|
15
17
|
showEditButton?: boolean;
|
|
16
18
|
children: React.ReactNode;
|
|
17
19
|
editMode: React.ReactNode;
|
|
18
20
|
}) => JSX.Element;
|
|
19
|
-
export declare const isEditing: () => boolean;
|
|
20
|
-
export declare const setEditing: (isEditing: boolean) => void;
|
|
21
|
-
export declare const EditContext: React.Context<{
|
|
22
|
-
edit: boolean;
|
|
23
|
-
setEdit: (edit: boolean) => void;
|
|
24
|
-
}>;
|
|
25
|
-
export declare const EditProvider: React.FC;
|
|
26
|
-
export declare const useEditState: () => {
|
|
27
|
-
edit: boolean;
|
|
28
|
-
setEdit: (edit: boolean) => void;
|
|
29
|
-
};
|
package/dist/edit-state.es.js
CHANGED
|
@@ -26,7 +26,9 @@ var __objRest = (source, exclude) => {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
|
-
import
|
|
29
|
+
import { EditProvider, useEditState } from "@tinacms/sharedctx";
|
|
30
|
+
export { isEditing, setEditing, useEditState } from "@tinacms/sharedctx";
|
|
31
|
+
import React from "react";
|
|
30
32
|
const TinaEditProvider = (_a) => {
|
|
31
33
|
var _b = _a, {
|
|
32
34
|
showEditButton
|
|
@@ -37,7 +39,16 @@ const TinaEditProvider = (_a) => {
|
|
|
37
39
|
};
|
|
38
40
|
const ToggleButton = () => {
|
|
39
41
|
const { edit } = useEditState();
|
|
40
|
-
|
|
42
|
+
const [isOnAdmin, setIsOnAdmin] = React.useState(false);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
var _a;
|
|
45
|
+
if (window) {
|
|
46
|
+
if ((_a = window.location) == null ? void 0 : _a.pathname.startsWith("/admin")) {
|
|
47
|
+
setIsOnAdmin(true);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, [setIsOnAdmin]);
|
|
51
|
+
return edit || isOnAdmin ? null : /* @__PURE__ */ React.createElement("div", {
|
|
41
52
|
style: { position: "fixed", bottom: "56px", left: "0px", zIndex: 200 }
|
|
42
53
|
}, /* @__PURE__ */ React.createElement("a", {
|
|
43
54
|
href: "/admin",
|
|
@@ -62,39 +73,4 @@ const TinaEditProviderInner = ({ children, editMode }) => {
|
|
|
62
73
|
}
|
|
63
74
|
return children;
|
|
64
75
|
};
|
|
65
|
-
|
|
66
|
-
const isSSR = typeof window === "undefined";
|
|
67
|
-
const isEditing = () => {
|
|
68
|
-
if (!isSSR) {
|
|
69
|
-
const isEdit = window.localStorage.getItem(LOCALSTORAGEKEY);
|
|
70
|
-
return isEdit && isEdit === "true";
|
|
71
|
-
}
|
|
72
|
-
return false;
|
|
73
|
-
};
|
|
74
|
-
const setEditing = (isEditing2) => {
|
|
75
|
-
if (!isSSR) {
|
|
76
|
-
window.localStorage.setItem(LOCALSTORAGEKEY, isEditing2 ? "true" : "false");
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const EditContext = React.createContext({
|
|
80
|
-
edit: isEditing(),
|
|
81
|
-
setEdit: void 0
|
|
82
|
-
});
|
|
83
|
-
const EditProvider = ({ children }) => {
|
|
84
|
-
const [edit, setEditState] = useState(isEditing());
|
|
85
|
-
const setEdit = (edit2) => {
|
|
86
|
-
setEditState(edit2);
|
|
87
|
-
setEditing(edit2);
|
|
88
|
-
};
|
|
89
|
-
return /* @__PURE__ */ React.createElement(EditContext.Provider, {
|
|
90
|
-
value: { edit, setEdit }
|
|
91
|
-
}, children);
|
|
92
|
-
};
|
|
93
|
-
const useEditState = () => {
|
|
94
|
-
const { edit, setEdit } = useContext(EditContext);
|
|
95
|
-
if (!setEdit) {
|
|
96
|
-
throw new Error("No `TinaEditProvider` found");
|
|
97
|
-
}
|
|
98
|
-
return { edit, setEdit };
|
|
99
|
-
};
|
|
100
|
-
export { EditContext, EditProvider, TinaEditProvider, isEditing, setEditing, useEditState };
|
|
76
|
+
export { TinaEditProvider };
|
package/dist/edit-state.js
CHANGED
|
@@ -27,8 +27,8 @@ var __objRest = (source, exclude) => {
|
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
29
|
(function(global, factory) {
|
|
30
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react")) : typeof define === "function" && define.amd ? define(["exports", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
|
|
31
|
-
})(this, function(exports2, React) {
|
|
30
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/sharedctx"), require("react")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/sharedctx", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP));
|
|
31
|
+
})(this, function(exports2, sharedctx, React) {
|
|
32
32
|
"use strict";
|
|
33
33
|
function _interopDefaultLegacy(e) {
|
|
34
34
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
@@ -40,11 +40,20 @@ var __objRest = (source, exclude) => {
|
|
|
40
40
|
} = _b, props = __objRest(_b, [
|
|
41
41
|
"showEditButton"
|
|
42
42
|
]);
|
|
43
|
-
return /* @__PURE__ */ React__default["default"].createElement(EditProvider, null, showEditButton && /* @__PURE__ */ React__default["default"].createElement(ToggleButton, null), /* @__PURE__ */ React__default["default"].createElement(TinaEditProviderInner, __spreadValues({}, props)));
|
|
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
45
|
const ToggleButton = () => {
|
|
46
|
-
const { edit } = useEditState();
|
|
47
|
-
|
|
46
|
+
const { edit } = sharedctx.useEditState();
|
|
47
|
+
const [isOnAdmin, setIsOnAdmin] = React__default["default"].useState(false);
|
|
48
|
+
React__default["default"].useEffect(() => {
|
|
49
|
+
var _a;
|
|
50
|
+
if (window) {
|
|
51
|
+
if ((_a = window.location) == null ? void 0 : _a.pathname.startsWith("/admin")) {
|
|
52
|
+
setIsOnAdmin(true);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, [setIsOnAdmin]);
|
|
56
|
+
return edit || isOnAdmin ? null : /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
48
57
|
style: { position: "fixed", bottom: "56px", left: "0px", zIndex: 200 }
|
|
49
58
|
}, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
50
59
|
href: "/admin",
|
|
@@ -63,53 +72,31 @@ var __objRest = (source, exclude) => {
|
|
|
63
72
|
}, "Edit with Tina"));
|
|
64
73
|
};
|
|
65
74
|
const TinaEditProviderInner = ({ children, editMode }) => {
|
|
66
|
-
const { edit } = useEditState();
|
|
75
|
+
const { edit } = sharedctx.useEditState();
|
|
67
76
|
if (edit) {
|
|
68
77
|
return editMode;
|
|
69
78
|
}
|
|
70
79
|
return children;
|
|
71
80
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const isEdit = window.localStorage.getItem(LOCALSTORAGEKEY);
|
|
77
|
-
return isEdit && isEdit === "true";
|
|
81
|
+
Object.defineProperty(exports2, "isEditing", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function() {
|
|
84
|
+
return sharedctx.isEditing;
|
|
78
85
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports2, "setEditing", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function() {
|
|
90
|
+
return sharedctx.setEditing;
|
|
84
91
|
}
|
|
85
|
-
};
|
|
86
|
-
const EditContext = React__default["default"].createContext({
|
|
87
|
-
edit: isEditing(),
|
|
88
|
-
setEdit: void 0
|
|
89
92
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setEditing(edit2);
|
|
95
|
-
};
|
|
96
|
-
return /* @__PURE__ */ React__default["default"].createElement(EditContext.Provider, {
|
|
97
|
-
value: { edit, setEdit }
|
|
98
|
-
}, children);
|
|
99
|
-
};
|
|
100
|
-
const useEditState = () => {
|
|
101
|
-
const { edit, setEdit } = React.useContext(EditContext);
|
|
102
|
-
if (!setEdit) {
|
|
103
|
-
throw new Error("No `TinaEditProvider` found");
|
|
93
|
+
Object.defineProperty(exports2, "useEditState", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function() {
|
|
96
|
+
return sharedctx.useEditState;
|
|
104
97
|
}
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
exports2.EditContext = EditContext;
|
|
108
|
-
exports2.EditProvider = EditProvider;
|
|
98
|
+
});
|
|
109
99
|
exports2.TinaEditProvider = TinaEditProvider;
|
|
110
|
-
exports2.isEditing = isEditing;
|
|
111
|
-
exports2.setEditing = setEditing;
|
|
112
|
-
exports2.useEditState = useEditState;
|
|
113
100
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
114
101
|
exports2[Symbol.toStringTag] = "Module";
|
|
115
102
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -18,5 +18,6 @@ export { useGraphqlForms } from './hooks/use-graphql-forms';
|
|
|
18
18
|
export { useDocumentCreatorPlugin } from './hooks/use-content-creator';
|
|
19
19
|
export * from '@tinacms/toolkit';
|
|
20
20
|
export { TinaAdmin } from './admin';
|
|
21
|
+
export { RouteMappingPlugin } from './admin/plugins/route-mapping';
|
|
21
22
|
import { TinaCMSProvider2 } from './tina-cms';
|
|
22
23
|
export default TinaCMSProvider2;
|