tinacms 0.56.2 → 0.57.2
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 +35 -0
- package/dist/admin/components/GetCMS.d.ts +16 -0
- package/dist/admin/components/GetCollection.d.ts +42 -0
- package/dist/admin/components/GetCollections.d.ts +23 -0
- package/dist/admin/components/GetDocument.d.ts +35 -0
- package/dist/admin/components/GetDocumentFields.d.ts +34 -0
- package/dist/admin/components/Layout.d.ts +16 -0
- package/dist/admin/hooks/useEmbedTailwind.d.ts +14 -0
- package/dist/admin/index.d.ts +13 -0
- package/dist/admin/pages/CollectionCreatePage.d.ts +14 -0
- package/dist/admin/pages/CollectionListPage.d.ts +14 -0
- package/dist/admin/pages/CollectionUpdatePage.d.ts +14 -0
- package/dist/admin/pages/DashboardPage.d.ts +14 -0
- package/dist/admin/pages/LoginPage.d.ts +14 -0
- package/dist/edit-state.es.js +3 -0
- package/dist/edit-state.js +3 -0
- package/dist/hooks/use-graphql-forms.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +634 -21
- package/dist/index.js +633 -21
- package/dist/rich-text.d.ts +118 -0
- package/dist/rich-text.es.js +217 -0
- package/dist/rich-text.js +227 -0
- package/package.json +10 -5
|
@@ -0,0 +1,118 @@
|
|
|
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 type BaseComponents = {
|
|
14
|
+
h1?: {
|
|
15
|
+
children: JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
h2?: {
|
|
18
|
+
children: JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
h3?: {
|
|
21
|
+
children: JSX.Element;
|
|
22
|
+
};
|
|
23
|
+
h4?: {
|
|
24
|
+
children: JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
h5?: {
|
|
27
|
+
children: JSX.Element;
|
|
28
|
+
};
|
|
29
|
+
h6?: {
|
|
30
|
+
children: JSX.Element;
|
|
31
|
+
};
|
|
32
|
+
p?: {
|
|
33
|
+
children: JSX.Element;
|
|
34
|
+
};
|
|
35
|
+
a?: {
|
|
36
|
+
url: string;
|
|
37
|
+
children: JSX.Element;
|
|
38
|
+
};
|
|
39
|
+
italic?: {
|
|
40
|
+
children: JSX.Element;
|
|
41
|
+
};
|
|
42
|
+
bold?: {
|
|
43
|
+
children: JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
strikethrough?: {
|
|
46
|
+
children: JSX.Element;
|
|
47
|
+
};
|
|
48
|
+
underline?: {
|
|
49
|
+
children: JSX.Element;
|
|
50
|
+
};
|
|
51
|
+
code?: {
|
|
52
|
+
children: JSX.Element;
|
|
53
|
+
};
|
|
54
|
+
ul?: {
|
|
55
|
+
children: JSX.Element;
|
|
56
|
+
};
|
|
57
|
+
ol?: {
|
|
58
|
+
children: JSX.Element;
|
|
59
|
+
};
|
|
60
|
+
block_quote?: {
|
|
61
|
+
children: JSX.Element;
|
|
62
|
+
};
|
|
63
|
+
code_block?: {
|
|
64
|
+
language?: string;
|
|
65
|
+
children: JSX.Element;
|
|
66
|
+
};
|
|
67
|
+
img?: {
|
|
68
|
+
url: string;
|
|
69
|
+
caption?: string;
|
|
70
|
+
alt?: string;
|
|
71
|
+
};
|
|
72
|
+
hr?: {};
|
|
73
|
+
component_missing?: {
|
|
74
|
+
name: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
declare type BaseComponentSignature = {
|
|
78
|
+
[BK in keyof BaseComponents]: (props: BaseComponents[BK]) => JSX.Element;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Define the allowed components and their props
|
|
82
|
+
* ```ts
|
|
83
|
+
* const components:
|
|
84
|
+
* Components<{
|
|
85
|
+
* BlockQuote: {
|
|
86
|
+
* children: TinaMarkdownContent;
|
|
87
|
+
* authorName: string;
|
|
88
|
+
* };
|
|
89
|
+
* }> = {
|
|
90
|
+
* BlockQuote: (props: {
|
|
91
|
+
* children: TinaMarkdownContent;
|
|
92
|
+
* authorName: string;
|
|
93
|
+
* }) => {
|
|
94
|
+
* return (
|
|
95
|
+
* <div>
|
|
96
|
+
* <blockquote>
|
|
97
|
+
* <TinaMarkdown content={props.children} />
|
|
98
|
+
* {props.authorName}
|
|
99
|
+
* </blockquote>
|
|
100
|
+
* </div>
|
|
101
|
+
* );
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare type Components<ComponentAndProps extends object> = {
|
|
108
|
+
[K in keyof ComponentAndProps]: (props: ComponentAndProps[K]) => JSX.Element;
|
|
109
|
+
} & BaseComponentSignature;
|
|
110
|
+
export declare type TinaMarkdownContent = {
|
|
111
|
+
type: string;
|
|
112
|
+
children: TinaMarkdownContent[];
|
|
113
|
+
};
|
|
114
|
+
export declare const TinaMarkdown: ({ content, components, }: {
|
|
115
|
+
content: TinaMarkdownContent | TinaMarkdownContent[];
|
|
116
|
+
components?: Components<{}>;
|
|
117
|
+
}) => JSX.Element;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import React from "react";
|
|
33
|
+
const TinaMarkdown = ({
|
|
34
|
+
content,
|
|
35
|
+
components = {}
|
|
36
|
+
}) => {
|
|
37
|
+
if (!content) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const nodes = Array.isArray(content) ? content : content.children;
|
|
41
|
+
if (!nodes) {
|
|
42
|
+
console.log(`Expected to find structured content for TinaMarkdown`);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
|
|
46
|
+
const key = index;
|
|
47
|
+
const _a = child, { children } = _a, props = __objRest(_a, ["children"]);
|
|
48
|
+
switch (child.type) {
|
|
49
|
+
case "h1":
|
|
50
|
+
case "h2":
|
|
51
|
+
case "h3":
|
|
52
|
+
case "h4":
|
|
53
|
+
case "h5":
|
|
54
|
+
case "h6":
|
|
55
|
+
case "p":
|
|
56
|
+
case "blockquote":
|
|
57
|
+
case "ol":
|
|
58
|
+
case "ul":
|
|
59
|
+
case "li":
|
|
60
|
+
if (components[child.type]) {
|
|
61
|
+
const Component2 = components[child.type];
|
|
62
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadProps(__spreadValues({
|
|
63
|
+
key
|
|
64
|
+
}, props), {
|
|
65
|
+
childrenRaw: children
|
|
66
|
+
}), /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
67
|
+
components,
|
|
68
|
+
content: children
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
return React.createElement(child.type, {
|
|
72
|
+
key,
|
|
73
|
+
children: /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
74
|
+
components,
|
|
75
|
+
content: children
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
case "lic":
|
|
79
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
80
|
+
key
|
|
81
|
+
}, /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
82
|
+
components,
|
|
83
|
+
content: child.children
|
|
84
|
+
}));
|
|
85
|
+
case "img":
|
|
86
|
+
if (components[child.type]) {
|
|
87
|
+
const Component2 = components[child.type];
|
|
88
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
|
|
89
|
+
key
|
|
90
|
+
}, props));
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ React.createElement("img", {
|
|
93
|
+
key,
|
|
94
|
+
src: child.url,
|
|
95
|
+
alt: child.caption
|
|
96
|
+
});
|
|
97
|
+
case "a":
|
|
98
|
+
if (components[child.type]) {
|
|
99
|
+
const Component2 = components[child.type];
|
|
100
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
|
|
101
|
+
key
|
|
102
|
+
}, props), /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
103
|
+
components,
|
|
104
|
+
content: children
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ React.createElement("a", {
|
|
108
|
+
key,
|
|
109
|
+
href: child.url
|
|
110
|
+
}, /* @__PURE__ */ React.createElement(TinaMarkdown, {
|
|
111
|
+
components,
|
|
112
|
+
content: children
|
|
113
|
+
}));
|
|
114
|
+
case "code_block":
|
|
115
|
+
const value = child.children.map((item) => {
|
|
116
|
+
return item.children[0].text;
|
|
117
|
+
}).join("\n");
|
|
118
|
+
if (components[child.type]) {
|
|
119
|
+
const Component2 = components[child.type];
|
|
120
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadProps(__spreadValues({
|
|
121
|
+
key
|
|
122
|
+
}, props), {
|
|
123
|
+
childrenRaw: children
|
|
124
|
+
}), value);
|
|
125
|
+
}
|
|
126
|
+
return /* @__PURE__ */ React.createElement("pre", {
|
|
127
|
+
key
|
|
128
|
+
}, /* @__PURE__ */ React.createElement("code", null, value));
|
|
129
|
+
case "hr":
|
|
130
|
+
if (components[child.type]) {
|
|
131
|
+
const Component2 = components[child.type];
|
|
132
|
+
return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
|
|
133
|
+
key
|
|
134
|
+
}, props));
|
|
135
|
+
}
|
|
136
|
+
return /* @__PURE__ */ React.createElement("hr", {
|
|
137
|
+
key
|
|
138
|
+
});
|
|
139
|
+
case "text":
|
|
140
|
+
return /* @__PURE__ */ React.createElement(Leaf, __spreadValues({
|
|
141
|
+
key,
|
|
142
|
+
components
|
|
143
|
+
}, child));
|
|
144
|
+
case "mdxJsxTextElement":
|
|
145
|
+
case "mdxJsxFlowElement":
|
|
146
|
+
const Component = components[child.name];
|
|
147
|
+
if (Component) {
|
|
148
|
+
const props2 = child.props ? child.props : {};
|
|
149
|
+
return /* @__PURE__ */ React.createElement(Component, __spreadValues({
|
|
150
|
+
key
|
|
151
|
+
}, props2));
|
|
152
|
+
} else {
|
|
153
|
+
const ComponentMissing = components["component_missing"];
|
|
154
|
+
if (ComponentMissing) {
|
|
155
|
+
return /* @__PURE__ */ React.createElement(ComponentMissing, {
|
|
156
|
+
key,
|
|
157
|
+
name: child.name
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
throw new Error(`No component provided for ${child.name}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
default:
|
|
164
|
+
if (typeof child.text === "string") {
|
|
165
|
+
return /* @__PURE__ */ React.createElement(Leaf, __spreadValues({
|
|
166
|
+
key,
|
|
167
|
+
components
|
|
168
|
+
}, child));
|
|
169
|
+
}
|
|
170
|
+
console.log(`No tina renderer for ${child.type}`, child);
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
};
|
|
174
|
+
const Leaf = (props) => {
|
|
175
|
+
if (props.bold) {
|
|
176
|
+
const _a = props, { bold } = _a, rest = __objRest(_a, ["bold"]);
|
|
177
|
+
if (props.components.bold) {
|
|
178
|
+
const Component = props.components.bold;
|
|
179
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
180
|
+
}
|
|
181
|
+
return /* @__PURE__ */ React.createElement("strong", null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
182
|
+
}
|
|
183
|
+
if (props.italic) {
|
|
184
|
+
const _b = props, { italic } = _b, rest = __objRest(_b, ["italic"]);
|
|
185
|
+
if (props.components.italic) {
|
|
186
|
+
const Component = props.components.italic;
|
|
187
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ React.createElement("em", null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
190
|
+
}
|
|
191
|
+
if (props.underline) {
|
|
192
|
+
const _c = props, { underline } = _c, rest = __objRest(_c, ["underline"]);
|
|
193
|
+
if (props.components.underline) {
|
|
194
|
+
const Component = props.components.underline;
|
|
195
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
196
|
+
}
|
|
197
|
+
return /* @__PURE__ */ React.createElement("u", null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
198
|
+
}
|
|
199
|
+
if (props.strikethrough) {
|
|
200
|
+
const _d = props, { strikethrough } = _d, rest = __objRest(_d, ["strikethrough"]);
|
|
201
|
+
if (props.components.strikethrough) {
|
|
202
|
+
const Component = props.components.strikethrough;
|
|
203
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ React.createElement("s", null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
206
|
+
}
|
|
207
|
+
if (props.code) {
|
|
208
|
+
const _e = props, { code } = _e, rest = __objRest(_e, ["code"]);
|
|
209
|
+
if (props.components.code) {
|
|
210
|
+
const Component = props.components.code;
|
|
211
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
212
|
+
}
|
|
213
|
+
return /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(Leaf, __spreadValues({}, rest)));
|
|
214
|
+
}
|
|
215
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
|
|
216
|
+
};
|
|
217
|
+
export { TinaMarkdown };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
(function(global, factory) {
|
|
33
|
+
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));
|
|
34
|
+
})(this, function(exports2, React) {
|
|
35
|
+
"use strict";
|
|
36
|
+
function _interopDefaultLegacy(e) {
|
|
37
|
+
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
38
|
+
}
|
|
39
|
+
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
40
|
+
const TinaMarkdown = ({
|
|
41
|
+
content,
|
|
42
|
+
components = {}
|
|
43
|
+
}) => {
|
|
44
|
+
if (!content) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const nodes = Array.isArray(content) ? content : content.children;
|
|
48
|
+
if (!nodes) {
|
|
49
|
+
console.log(`Expected to find structured content for TinaMarkdown`);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, nodes.map((child, index) => {
|
|
53
|
+
const key = index;
|
|
54
|
+
const _a = child, { children } = _a, props = __objRest(_a, ["children"]);
|
|
55
|
+
switch (child.type) {
|
|
56
|
+
case "h1":
|
|
57
|
+
case "h2":
|
|
58
|
+
case "h3":
|
|
59
|
+
case "h4":
|
|
60
|
+
case "h5":
|
|
61
|
+
case "h6":
|
|
62
|
+
case "p":
|
|
63
|
+
case "blockquote":
|
|
64
|
+
case "ol":
|
|
65
|
+
case "ul":
|
|
66
|
+
case "li":
|
|
67
|
+
if (components[child.type]) {
|
|
68
|
+
const Component2 = components[child.type];
|
|
69
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadProps(__spreadValues({
|
|
70
|
+
key
|
|
71
|
+
}, props), {
|
|
72
|
+
childrenRaw: children
|
|
73
|
+
}), /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
74
|
+
components,
|
|
75
|
+
content: children
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
return React__default["default"].createElement(child.type, {
|
|
79
|
+
key,
|
|
80
|
+
children: /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
81
|
+
components,
|
|
82
|
+
content: children
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
case "lic":
|
|
86
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
87
|
+
key
|
|
88
|
+
}, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
89
|
+
components,
|
|
90
|
+
content: child.children
|
|
91
|
+
}));
|
|
92
|
+
case "img":
|
|
93
|
+
if (components[child.type]) {
|
|
94
|
+
const Component2 = components[child.type];
|
|
95
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
|
|
96
|
+
key
|
|
97
|
+
}, props));
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ React__default["default"].createElement("img", {
|
|
100
|
+
key,
|
|
101
|
+
src: child.url,
|
|
102
|
+
alt: child.caption
|
|
103
|
+
});
|
|
104
|
+
case "a":
|
|
105
|
+
if (components[child.type]) {
|
|
106
|
+
const Component2 = components[child.type];
|
|
107
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
|
|
108
|
+
key
|
|
109
|
+
}, props), /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
110
|
+
components,
|
|
111
|
+
content: children
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
115
|
+
key,
|
|
116
|
+
href: child.url
|
|
117
|
+
}, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
|
|
118
|
+
components,
|
|
119
|
+
content: children
|
|
120
|
+
}));
|
|
121
|
+
case "code_block":
|
|
122
|
+
const value = child.children.map((item) => {
|
|
123
|
+
return item.children[0].text;
|
|
124
|
+
}).join("\n");
|
|
125
|
+
if (components[child.type]) {
|
|
126
|
+
const Component2 = components[child.type];
|
|
127
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadProps(__spreadValues({
|
|
128
|
+
key
|
|
129
|
+
}, props), {
|
|
130
|
+
childrenRaw: children
|
|
131
|
+
}), value);
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ React__default["default"].createElement("pre", {
|
|
134
|
+
key
|
|
135
|
+
}, /* @__PURE__ */ React__default["default"].createElement("code", null, value));
|
|
136
|
+
case "hr":
|
|
137
|
+
if (components[child.type]) {
|
|
138
|
+
const Component2 = components[child.type];
|
|
139
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
|
|
140
|
+
key
|
|
141
|
+
}, props));
|
|
142
|
+
}
|
|
143
|
+
return /* @__PURE__ */ React__default["default"].createElement("hr", {
|
|
144
|
+
key
|
|
145
|
+
});
|
|
146
|
+
case "text":
|
|
147
|
+
return /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({
|
|
148
|
+
key,
|
|
149
|
+
components
|
|
150
|
+
}, child));
|
|
151
|
+
case "mdxJsxTextElement":
|
|
152
|
+
case "mdxJsxFlowElement":
|
|
153
|
+
const Component = components[child.name];
|
|
154
|
+
if (Component) {
|
|
155
|
+
const props2 = child.props ? child.props : {};
|
|
156
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadValues({
|
|
157
|
+
key
|
|
158
|
+
}, props2));
|
|
159
|
+
} else {
|
|
160
|
+
const ComponentMissing = components["component_missing"];
|
|
161
|
+
if (ComponentMissing) {
|
|
162
|
+
return /* @__PURE__ */ React__default["default"].createElement(ComponentMissing, {
|
|
163
|
+
key,
|
|
164
|
+
name: child.name
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
throw new Error(`No component provided for ${child.name}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
default:
|
|
171
|
+
if (typeof child.text === "string") {
|
|
172
|
+
return /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({
|
|
173
|
+
key,
|
|
174
|
+
components
|
|
175
|
+
}, child));
|
|
176
|
+
}
|
|
177
|
+
console.log(`No tina renderer for ${child.type}`, child);
|
|
178
|
+
}
|
|
179
|
+
}));
|
|
180
|
+
};
|
|
181
|
+
const Leaf = (props) => {
|
|
182
|
+
if (props.bold) {
|
|
183
|
+
const _a = props, { bold } = _a, rest = __objRest(_a, ["bold"]);
|
|
184
|
+
if (props.components.bold) {
|
|
185
|
+
const Component = props.components.bold;
|
|
186
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
187
|
+
}
|
|
188
|
+
return /* @__PURE__ */ React__default["default"].createElement("strong", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
189
|
+
}
|
|
190
|
+
if (props.italic) {
|
|
191
|
+
const _b = props, { italic } = _b, rest = __objRest(_b, ["italic"]);
|
|
192
|
+
if (props.components.italic) {
|
|
193
|
+
const Component = props.components.italic;
|
|
194
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
195
|
+
}
|
|
196
|
+
return /* @__PURE__ */ React__default["default"].createElement("em", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
197
|
+
}
|
|
198
|
+
if (props.underline) {
|
|
199
|
+
const _c = props, { underline } = _c, rest = __objRest(_c, ["underline"]);
|
|
200
|
+
if (props.components.underline) {
|
|
201
|
+
const Component = props.components.underline;
|
|
202
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
203
|
+
}
|
|
204
|
+
return /* @__PURE__ */ React__default["default"].createElement("u", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
205
|
+
}
|
|
206
|
+
if (props.strikethrough) {
|
|
207
|
+
const _d = props, { strikethrough } = _d, rest = __objRest(_d, ["strikethrough"]);
|
|
208
|
+
if (props.components.strikethrough) {
|
|
209
|
+
const Component = props.components.strikethrough;
|
|
210
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
211
|
+
}
|
|
212
|
+
return /* @__PURE__ */ React__default["default"].createElement("s", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
213
|
+
}
|
|
214
|
+
if (props.code) {
|
|
215
|
+
const _e = props, { code } = _e, rest = __objRest(_e, ["code"]);
|
|
216
|
+
if (props.components.code) {
|
|
217
|
+
const Component = props.components.code;
|
|
218
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
219
|
+
}
|
|
220
|
+
return /* @__PURE__ */ React__default["default"].createElement("code", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({}, rest)));
|
|
221
|
+
}
|
|
222
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.text);
|
|
223
|
+
};
|
|
224
|
+
exports2.TinaMarkdown = TinaMarkdown;
|
|
225
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
226
|
+
exports2[Symbol.toStringTag] = "Module";
|
|
227
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"buildConfig": {
|
|
9
9
|
"entryPoints": [
|
|
10
10
|
"src/index.ts",
|
|
11
|
-
"src/edit-state.tsx"
|
|
11
|
+
"src/edit-state.tsx",
|
|
12
|
+
"src/rich-text.tsx"
|
|
12
13
|
]
|
|
13
14
|
},
|
|
14
15
|
"typings": "dist/index.d.ts",
|
|
@@ -22,7 +23,9 @@
|
|
|
22
23
|
"@graphql-codegen/core": "^1.15.4",
|
|
23
24
|
"@graphql-codegen/typescript": "^1.15.4",
|
|
24
25
|
"@graphql-codegen/typescript-operations": "^1.15.4",
|
|
25
|
-
"@
|
|
26
|
+
"@headlessui/react": "^1.4.1",
|
|
27
|
+
"@heroicons/react": "^1.0.4",
|
|
28
|
+
"@tinacms/toolkit": "0.55.1",
|
|
26
29
|
"@xstate/react": "^1.1.0",
|
|
27
30
|
"codemirror": "^5.55.0",
|
|
28
31
|
"cors": "^2.8.5",
|
|
@@ -39,6 +42,8 @@
|
|
|
39
42
|
"next": "9.4.2",
|
|
40
43
|
"node-fetch": "^2.6.0",
|
|
41
44
|
"prop-types": "15.7.2",
|
|
45
|
+
"react-icons": "^4.3.1",
|
|
46
|
+
"react-router-dom": "^5.3.0",
|
|
42
47
|
"ts-jest": "^26.5.3",
|
|
43
48
|
"xstate": "^4.15.1",
|
|
44
49
|
"yup": "^0.32.0"
|
|
@@ -50,14 +55,14 @@
|
|
|
50
55
|
"@types/react": "^16.9.38",
|
|
51
56
|
"@types/yup": "^0.29.10",
|
|
52
57
|
"next": "9.4.2",
|
|
53
|
-
"react": "16.
|
|
58
|
+
"react": "16.14.0",
|
|
54
59
|
"react-dom": "16.13.1",
|
|
55
60
|
"styled-components": "^5.2.0",
|
|
56
61
|
"tsup": "4.12.5",
|
|
57
62
|
"typescript": "^4.3.5"
|
|
58
63
|
},
|
|
59
64
|
"peerDependencies": {
|
|
60
|
-
"react": ">=16.
|
|
65
|
+
"react": ">=16.14.0",
|
|
61
66
|
"react-dom": ">=16.8",
|
|
62
67
|
"react-is": "^16.13.1 || <18.0.0",
|
|
63
68
|
"styled-components": "*"
|