tinacms 2.10.1 → 3.0.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/dist/__vite-browser-external-d06ac358.js +4 -0
- package/dist/admin/api.d.ts +1 -1
- package/dist/client.js +131 -185
- package/dist/index.js +118281 -118351
- package/dist/internalClient/index.d.ts +1 -1
- package/dist/{node-cache-5e8db9f0.mjs → node-cache-c9558e1e.js} +5 -5
- package/dist/react.js +210 -213
- package/dist/rich-text/index.js +234 -237
- package/dist/rich-text/prism.js +16 -18
- package/dist/rich-text/static.js +229 -232
- package/dist/toolkit/components/ui/button.d.ts +11 -0
- package/dist/toolkit/components/ui/calendar.d.ts +8 -0
- package/dist/toolkit/components/ui/date-time-picker.d.ts +111 -0
- package/dist/toolkit/components/ui/input.d.ts +3 -0
- package/dist/toolkit/components/ui/popover.d.ts +7 -0
- package/dist/toolkit/components/ui/select.d.ts +13 -0
- package/dist/toolkit/fields/plugins/button-toggle-field-plugin.d.ts +2 -2
- package/dist/toolkit/fields/plugins/checkbox-group-field-plugin.d.ts +2 -2
- package/dist/toolkit/fields/plugins/date-field-plugin.d.ts +0 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/blockquote-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block/code-block-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-line-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/list-element.d.ts +2 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/paragraph-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/slash-input-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-cell-element.d.ts +2 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-row-element.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/use-floating-toolbar-hook.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +18 -18
- package/dist/toolkit/fields/plugins/radio-group-field-plugin.d.ts +2 -2
- package/dist/toolkit/fields/plugins/select-field-plugin.d.ts +2 -2
- package/dist/toolkit/fields/plugins/toggle-field-plugin.d.ts +2 -2
- package/dist/toolkit/index.d.ts +1 -1
- package/dist/toolkit/react-sidebar/components/NavMenuTrigger.d.ts +11 -0
- package/dist/toolkit/react-sidebar/components/nav-components.d.ts +11 -0
- package/dist/toolkit/react-sidebar/components/nav-context.d.ts +15 -0
- package/dist/toolkit/react-sidebar/components/nav.d.ts +3 -3
- package/dist/toolkit/react-sidebar/index.d.ts +3 -0
- package/package.json +20 -43
- package/dist/client.mjs +0 -132
- package/dist/index.mjs +0 -123232
- package/dist/react.mjs +0 -254
- package/dist/rich-text/index.mjs +0 -256
- package/dist/rich-text/prism.mjs +0 -16
- package/dist/rich-text/static.mjs +0 -243
- package/dist/toolkit/react-datetime/DateTime.d.ts +0 -135
- /package/dist/admin/components/{Sidebar.d.ts → AdminNav.d.ts} +0 -0
package/dist/rich-text/index.js
CHANGED
|
@@ -1,259 +1,256 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
const TinaMarkdown = ({
|
|
3
|
+
content,
|
|
4
|
+
components = {}
|
|
5
|
+
}) => {
|
|
6
|
+
if (!content) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const nodes = Array.isArray(content) ? content : content.children;
|
|
10
|
+
if (!nodes) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(MemoNode, { components, key: index, child });
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
const Leaf = (props) => {
|
|
18
|
+
if (props.bold) {
|
|
19
|
+
const { bold, ...rest } = props;
|
|
20
|
+
if (props.components.bold) {
|
|
21
|
+
const Component = props.components.bold;
|
|
22
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
return /* @__PURE__ */ React.createElement("strong", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
25
|
+
}
|
|
26
|
+
if (props.italic) {
|
|
27
|
+
const { italic, ...rest } = props;
|
|
28
|
+
if (props.components.italic) {
|
|
29
|
+
const Component = props.components.italic;
|
|
30
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
15
31
|
}
|
|
16
|
-
return /* @__PURE__ */ React.createElement(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (props.components.bold) {
|
|
24
|
-
const Component = props.components.bold;
|
|
25
|
-
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
26
|
-
}
|
|
27
|
-
return /* @__PURE__ */ React.createElement("strong", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
32
|
+
return /* @__PURE__ */ React.createElement("em", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
33
|
+
}
|
|
34
|
+
if (props.underline) {
|
|
35
|
+
const { underline, ...rest } = props;
|
|
36
|
+
if (props.components.underline) {
|
|
37
|
+
const Component = props.components.underline;
|
|
38
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return /* @__PURE__ */ React.createElement(
|
|
40
|
+
return /* @__PURE__ */ React.createElement("u", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
41
|
+
}
|
|
42
|
+
if (props.strikethrough) {
|
|
43
|
+
const { strikethrough, ...rest } = props;
|
|
44
|
+
if (props.components.strikethrough) {
|
|
45
|
+
const Component = props.components.strikethrough;
|
|
46
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
36
47
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return /* @__PURE__ */ React.createElement(
|
|
48
|
+
return /* @__PURE__ */ React.createElement("s", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
49
|
+
}
|
|
50
|
+
if (props.code) {
|
|
51
|
+
const { code, ...rest } = props;
|
|
52
|
+
if (props.components.code) {
|
|
53
|
+
const Component = props.components.code;
|
|
54
|
+
return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
44
55
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
return /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
|
|
57
|
+
}
|
|
58
|
+
if (props.components.text) {
|
|
59
|
+
const Component = props.components.text;
|
|
60
|
+
return /* @__PURE__ */ React.createElement(Component, null, props.text);
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
|
|
63
|
+
};
|
|
64
|
+
const MemoNode = (props) => {
|
|
65
|
+
const MNode = React.useMemo(
|
|
66
|
+
() => /* @__PURE__ */ React.createElement(Node, { ...props }),
|
|
67
|
+
[JSON.stringify(props)]
|
|
68
|
+
);
|
|
69
|
+
return MNode;
|
|
70
|
+
};
|
|
71
|
+
const Node = ({ components, child }) => {
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
73
|
+
const { children, ...props } = child;
|
|
74
|
+
switch (child.type) {
|
|
75
|
+
case "h1":
|
|
76
|
+
case "h2":
|
|
77
|
+
case "h3":
|
|
78
|
+
case "h4":
|
|
79
|
+
case "h5":
|
|
80
|
+
case "h6":
|
|
81
|
+
case "p":
|
|
82
|
+
case "ol":
|
|
83
|
+
case "ul":
|
|
84
|
+
case "li":
|
|
85
|
+
if (components[child.type]) {
|
|
86
|
+
const Component2 = components[child.type];
|
|
87
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
|
|
50
88
|
}
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */ React.createElement(
|
|
89
|
+
return React.createElement(child.type, {
|
|
90
|
+
children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
|
|
91
|
+
});
|
|
92
|
+
case "lic":
|
|
93
|
+
if (components.lic) {
|
|
94
|
+
const Component2 = components.lic;
|
|
95
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
|
|
58
96
|
}
|
|
59
|
-
return /* @__PURE__ */ React.createElement("
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
()
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
switch (child.type) {
|
|
78
|
-
case "h1":
|
|
79
|
-
case "h2":
|
|
80
|
-
case "h3":
|
|
81
|
-
case "h4":
|
|
82
|
-
case "h5":
|
|
83
|
-
case "h6":
|
|
84
|
-
case "p":
|
|
85
|
-
case "ol":
|
|
86
|
-
case "ul":
|
|
87
|
-
case "li":
|
|
88
|
-
if (components[child.type]) {
|
|
89
|
-
const Component2 = components[child.type];
|
|
90
|
-
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
|
|
91
|
-
}
|
|
92
|
-
return React.createElement(child.type, {
|
|
93
|
-
children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
|
|
94
|
-
});
|
|
95
|
-
case "lic":
|
|
96
|
-
if (components.lic) {
|
|
97
|
-
const Component2 = components.lic;
|
|
98
|
-
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
|
|
99
|
-
}
|
|
100
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: child.children }));
|
|
101
|
-
case "blockquote":
|
|
102
|
-
const BlockquoteComponent = components.blockquote || components.block_quote;
|
|
103
|
-
if (BlockquoteComponent) {
|
|
104
|
-
return /* @__PURE__ */ React.createElement(BlockquoteComponent, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
|
|
105
|
-
}
|
|
106
|
-
return React.createElement("blockquote", {
|
|
107
|
-
children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
|
|
108
|
-
});
|
|
109
|
-
case "img":
|
|
110
|
-
if (components[child.type]) {
|
|
111
|
-
const Component2 = components[child.type];
|
|
112
|
-
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
113
|
-
}
|
|
114
|
-
return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
|
|
115
|
-
case "a":
|
|
116
|
-
if (components[child.type]) {
|
|
117
|
-
const Component2 = components[child.type];
|
|
118
|
-
return (
|
|
119
|
-
// @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
|
|
120
|
-
/* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
|
|
121
|
-
);
|
|
122
|
-
}
|
|
97
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: child.children }));
|
|
98
|
+
case "blockquote":
|
|
99
|
+
const BlockquoteComponent = components.blockquote || components.block_quote;
|
|
100
|
+
if (BlockquoteComponent) {
|
|
101
|
+
return /* @__PURE__ */ React.createElement(BlockquoteComponent, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
|
|
102
|
+
}
|
|
103
|
+
return React.createElement("blockquote", {
|
|
104
|
+
children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
|
|
105
|
+
});
|
|
106
|
+
case "img":
|
|
107
|
+
if (components[child.type]) {
|
|
108
|
+
const Component2 = components[child.type];
|
|
109
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
110
|
+
}
|
|
111
|
+
return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
|
|
112
|
+
case "a":
|
|
113
|
+
if (components[child.type]) {
|
|
114
|
+
const Component2 = components[child.type];
|
|
123
115
|
return (
|
|
124
116
|
// @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
|
|
125
|
-
/* @__PURE__ */ React.createElement(
|
|
117
|
+
/* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
|
|
126
118
|
);
|
|
127
|
-
case "code_block": {
|
|
128
|
-
let codeString = "";
|
|
129
|
-
if (Array.isArray(child.children)) {
|
|
130
|
-
codeString = child.children.map(
|
|
131
|
-
(line) => Array.isArray(line.children) ? line.children.map((t) => t.text).join("") : ""
|
|
132
|
-
).join("\n");
|
|
133
|
-
} else if (typeof child.value === "string") {
|
|
134
|
-
codeString = child.value;
|
|
135
|
-
}
|
|
136
|
-
if (components[child.type]) {
|
|
137
|
-
const Component2 = components[child.type];
|
|
138
|
-
return (
|
|
139
|
-
// @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
|
|
140
|
-
/* @__PURE__ */ React.createElement(Component2, { ...props, value: codeString })
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, codeString));
|
|
144
119
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
120
|
+
return (
|
|
121
|
+
// @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
|
|
122
|
+
/* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
|
|
123
|
+
);
|
|
124
|
+
case "code_block": {
|
|
125
|
+
let codeString = "";
|
|
126
|
+
if (Array.isArray(child.children)) {
|
|
127
|
+
codeString = child.children.map(
|
|
128
|
+
(line) => Array.isArray(line.children) ? line.children.map((t) => t.text).join("") : ""
|
|
129
|
+
).join("\n");
|
|
130
|
+
} else if (typeof child.value === "string") {
|
|
131
|
+
codeString = child.value;
|
|
132
|
+
}
|
|
133
|
+
if (components[child.type]) {
|
|
134
|
+
const Component2 = components[child.type];
|
|
135
|
+
return (
|
|
136
|
+
// @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
|
|
137
|
+
/* @__PURE__ */ React.createElement(Component2, { ...props, value: codeString })
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, codeString));
|
|
141
|
+
}
|
|
142
|
+
case "hr":
|
|
143
|
+
if (components[child.type]) {
|
|
144
|
+
const Component2 = components[child.type];
|
|
145
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
146
|
+
}
|
|
147
|
+
return /* @__PURE__ */ React.createElement("hr", null);
|
|
148
|
+
case "break":
|
|
149
|
+
if (components[child.type]) {
|
|
150
|
+
const Component2 = components[child.type];
|
|
151
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
152
|
+
}
|
|
153
|
+
return /* @__PURE__ */ React.createElement("br", null);
|
|
154
|
+
case "text":
|
|
155
|
+
return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
|
|
156
|
+
case "mdxJsxTextElement":
|
|
157
|
+
case "mdxJsxFlowElement":
|
|
158
|
+
const Component = components[child.name];
|
|
159
|
+
if (Component) {
|
|
160
|
+
const props2 = child.props ? child.props : {};
|
|
161
|
+
return /* @__PURE__ */ React.createElement(Component, { ...props2 });
|
|
162
|
+
} else {
|
|
163
|
+
if (child.name === "table") {
|
|
164
|
+
const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
|
|
165
|
+
const rows2 = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
|
|
166
|
+
const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
|
|
167
|
+
const TableComponent2 = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }));
|
|
168
|
+
const TrComponent2 = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
|
|
169
|
+
const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
|
|
170
|
+
const TdComponent2 = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
|
|
171
|
+
const align2 = ((_f = child.props) == null ? void 0 : _f.align) || [];
|
|
172
|
+
return /* @__PURE__ */ React.createElement(TableComponent2, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent2, null, header.tableCells.map((c, i) => {
|
|
173
|
+
return /* @__PURE__ */ React.createElement(
|
|
174
|
+
TinaMarkdown,
|
|
175
|
+
{
|
|
176
|
+
key: i,
|
|
177
|
+
components: {
|
|
178
|
+
p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align2[i], ...props2 })
|
|
179
|
+
},
|
|
180
|
+
content: c.value
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}))), /* @__PURE__ */ React.createElement("tbody", null, rows2.map((row, i) => {
|
|
184
|
+
var _a2;
|
|
185
|
+
return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
|
|
176
186
|
return /* @__PURE__ */ React.createElement(
|
|
177
187
|
TinaMarkdown,
|
|
178
188
|
{
|
|
179
|
-
key:
|
|
189
|
+
key: i2,
|
|
180
190
|
components: {
|
|
181
|
-
p: (props2) => /* @__PURE__ */ React.createElement(
|
|
191
|
+
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
|
|
182
192
|
},
|
|
183
193
|
content: c.value
|
|
184
194
|
}
|
|
185
195
|
);
|
|
186
|
-
}))
|
|
187
|
-
|
|
188
|
-
return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
|
|
189
|
-
return /* @__PURE__ */ React.createElement(
|
|
190
|
-
TinaMarkdown,
|
|
191
|
-
{
|
|
192
|
-
key: i2,
|
|
193
|
-
components: {
|
|
194
|
-
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
|
|
195
|
-
},
|
|
196
|
-
content: c.value
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
}));
|
|
200
|
-
})));
|
|
201
|
-
}
|
|
202
|
-
const ComponentMissing = components["component_missing"];
|
|
203
|
-
if (ComponentMissing) {
|
|
204
|
-
return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
|
|
205
|
-
} else {
|
|
206
|
-
return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
|
|
207
|
-
}
|
|
196
|
+
}));
|
|
197
|
+
})));
|
|
208
198
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"td",
|
|
215
|
-
{
|
|
216
|
-
style: {
|
|
217
|
-
textAlign: (props2 == null ? void 0 : props2.align) || "auto",
|
|
218
|
-
border: "1px solid #EDECF3",
|
|
219
|
-
padding: "0.25rem"
|
|
220
|
-
},
|
|
221
|
-
...props2
|
|
222
|
-
}
|
|
223
|
-
));
|
|
224
|
-
const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
|
|
225
|
-
return /* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
|
|
226
|
-
var _a2;
|
|
227
|
-
return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
|
|
228
|
-
return /* @__PURE__ */ React.createElement(
|
|
229
|
-
TinaMarkdown,
|
|
230
|
-
{
|
|
231
|
-
key: i2,
|
|
232
|
-
components: {
|
|
233
|
-
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
|
|
234
|
-
},
|
|
235
|
-
content: cell.children
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
}));
|
|
239
|
-
})));
|
|
240
|
-
case "maybe_mdx":
|
|
241
|
-
return null;
|
|
242
|
-
case "html":
|
|
243
|
-
case "html_inline":
|
|
244
|
-
if (components[child.type]) {
|
|
245
|
-
const Component2 = components[child.type];
|
|
246
|
-
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
199
|
+
const ComponentMissing = components["component_missing"];
|
|
200
|
+
if (ComponentMissing) {
|
|
201
|
+
return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
|
|
202
|
+
} else {
|
|
203
|
+
return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
|
|
247
204
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
205
|
+
}
|
|
206
|
+
case "table":
|
|
207
|
+
const rows = child.children || [];
|
|
208
|
+
const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { style: { border: "1px solid #EDECF3" }, ...props2 }));
|
|
209
|
+
const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
|
|
210
|
+
const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement(
|
|
211
|
+
"td",
|
|
212
|
+
{
|
|
213
|
+
style: {
|
|
214
|
+
textAlign: (props2 == null ? void 0 : props2.align) || "auto",
|
|
215
|
+
border: "1px solid #EDECF3",
|
|
216
|
+
padding: "0.25rem"
|
|
217
|
+
},
|
|
218
|
+
...props2
|
|
254
219
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
})
|
|
220
|
+
));
|
|
221
|
+
const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
|
|
222
|
+
return /* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
|
|
223
|
+
var _a2;
|
|
224
|
+
return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
|
|
225
|
+
return /* @__PURE__ */ React.createElement(
|
|
226
|
+
TinaMarkdown,
|
|
227
|
+
{
|
|
228
|
+
key: i2,
|
|
229
|
+
components: {
|
|
230
|
+
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
|
|
231
|
+
},
|
|
232
|
+
content: cell.children
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}));
|
|
236
|
+
})));
|
|
237
|
+
case "maybe_mdx":
|
|
238
|
+
return null;
|
|
239
|
+
case "html":
|
|
240
|
+
case "html_inline":
|
|
241
|
+
if (components[child.type]) {
|
|
242
|
+
const Component2 = components[child.type];
|
|
243
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
244
|
+
}
|
|
245
|
+
return child.value;
|
|
246
|
+
case "invalid_markdown":
|
|
247
|
+
return /* @__PURE__ */ React.createElement("pre", null, child.value);
|
|
248
|
+
default:
|
|
249
|
+
if (typeof child.text === "string") {
|
|
250
|
+
return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
export {
|
|
255
|
+
TinaMarkdown
|
|
256
|
+
};
|
package/dist/rich-text/prism.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
});
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Highlight, themes } from "prism-react-renderer";
|
|
3
|
+
const Prism = (props) => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(
|
|
5
|
+
Highlight,
|
|
6
|
+
{
|
|
7
|
+
theme: themes[props.theme || "github"],
|
|
8
|
+
code: props.value || "",
|
|
9
|
+
language: props.lang || ""
|
|
10
|
+
},
|
|
11
|
+
({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React.createElement("pre", { className, style }, tokens.map((line, i) => /* @__PURE__ */ React.createElement("div", { ...getLineProps({ line, key: i }) }, line.map((token, key) => /* @__PURE__ */ React.createElement("span", { ...getTokenProps({ token, key }) })))))
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
Prism
|
|
16
|
+
};
|