tinacms 0.0.0-bf22bf8-20241004045704 → 0.0.0-c0f1b7d-20250702023438

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.
Files changed (104) hide show
  1. package/README.md +1 -1
  2. package/dist/admin/api.d.ts +1 -0
  3. package/dist/admin/components/GetCollection.d.ts +2 -2
  4. package/dist/admin/components/Page.d.ts +3 -9
  5. package/dist/admin/components/Sidebar.d.ts +0 -3
  6. package/dist/admin/components/ui/tooltip.d.ts +7 -0
  7. package/dist/admin/pages/CollectionCreatePage.d.ts +1 -1
  8. package/dist/admin/pages/CollectionListPage.d.ts +2 -2
  9. package/dist/admin/pages/DashboardPage.d.ts +0 -3
  10. package/dist/admin/pages/ScreenPage.d.ts +0 -3
  11. package/dist/admin/types.d.ts +3 -0
  12. package/dist/auth/TinaCloudProvider.d.ts +1 -1
  13. package/dist/cache/node-cache.d.ts +1 -0
  14. package/dist/client.js +100 -62
  15. package/dist/client.mjs +59 -36
  16. package/dist/hooks/create-page-plugin.d.ts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +11694 -9064
  19. package/dist/index.mjs +14147 -11514
  20. package/dist/internalClient/index.d.ts +9 -3
  21. package/dist/node-cache-5e8db9f0.mjs +63 -0
  22. package/dist/react.d.ts +14 -6
  23. package/dist/react.js +71 -53
  24. package/dist/react.mjs +71 -53
  25. package/dist/rich-text/index.d.ts +3 -0
  26. package/dist/rich-text/index.js +45 -12
  27. package/dist/rich-text/index.mjs +45 -12
  28. package/dist/rich-text/prism.js +1 -1
  29. package/dist/rich-text/prism.mjs +1 -1
  30. package/dist/rich-text/static.d.ts +148 -0
  31. package/dist/rich-text/static.js +239 -0
  32. package/dist/rich-text/static.mjs +236 -0
  33. package/dist/toolkit/components/media/media-item.d.ts +1 -1
  34. package/dist/toolkit/components/media/media-manager.d.ts +1 -1
  35. package/dist/toolkit/components/ui/breadcrumb.d.ts +11 -0
  36. package/dist/toolkit/components/ui/dropdown-menu.d.ts +25 -0
  37. package/dist/toolkit/fields/components/password-field.d.ts +1 -1
  38. package/dist/toolkit/fields/components/reference/components/button.d.ts +1 -1
  39. package/dist/toolkit/fields/components/reference/components/popover.d.ts +1 -1
  40. package/dist/toolkit/fields/components/reference/model/reference-link-props.d.ts +2 -0
  41. package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
  42. package/dist/toolkit/fields/components/select.d.ts +2 -2
  43. package/dist/toolkit/fields/components/text-field.d.ts +1 -1
  44. package/dist/toolkit/fields/plugins/group-field-plugin.d.ts +1 -1
  45. package/dist/toolkit/fields/plugins/list-field-meta.d.ts +1 -1
  46. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +5 -2
  47. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  48. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
  49. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +17 -5
  50. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
  51. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
  52. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
  53. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
  54. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
  55. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
  56. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
  57. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
  58. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
  59. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  60. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
  61. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
  62. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
  63. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +64 -11
  64. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +11 -3
  65. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +3 -3
  66. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/transforms/is-url.d.ts +1 -2
  67. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  68. package/dist/toolkit/form-builder/fields-builder.d.ts +1 -1
  69. package/dist/toolkit/form-builder/form-builder.d.ts +15 -5
  70. package/dist/toolkit/forms/field.d.ts +3 -0
  71. package/dist/toolkit/forms/form.d.ts +22 -3
  72. package/dist/toolkit/git-client/git-client.d.ts +25 -2
  73. package/dist/toolkit/git-client/git-file.d.ts +18 -0
  74. package/dist/toolkit/git-client/git-media-store.d.ts +13 -0
  75. package/dist/toolkit/git-client/use-git-file.d.ts +4 -0
  76. package/dist/toolkit/icons/Tina.d.ts +0 -5
  77. package/dist/toolkit/index.d.ts +1 -1
  78. package/dist/toolkit/plugin-branch-switcher/branch-button.d.ts +1 -0
  79. package/dist/toolkit/plugin-branch-switcher/branch-switcher-legacy.d.ts +1 -1
  80. package/dist/toolkit/plugin-branch-switcher/branch-switcher.d.ts +1 -1
  81. package/dist/toolkit/plugin-branch-switcher/index.d.ts +0 -1
  82. package/dist/toolkit/react-cloud-config/cloud-config-plugin.d.ts +3 -3
  83. package/dist/toolkit/react-sidebar/components/VersionInfo.d.ts +2 -0
  84. package/dist/toolkit/react-sidebar/components/alert.d.ts +5 -0
  85. package/dist/toolkit/react-sidebar/components/form-list.d.ts +1 -1
  86. package/dist/toolkit/react-sidebar/components/nav.d.ts +5 -3
  87. package/dist/toolkit/react-sidebar/components/resize-handle.d.ts +0 -5
  88. package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +7 -10
  89. package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
  90. package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
  91. package/dist/toolkit/react-sidebar/components/sidebar.d.ts +0 -7
  92. package/dist/toolkit/react-sidebar/components/sync-status.d.ts +5 -8
  93. package/dist/toolkit/react-sidebar/index.d.ts +1 -1
  94. package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
  95. package/dist/toolkit/styles/button.d.ts +2 -2
  96. package/dist/toolkit/tina-cms.d.ts +3 -3
  97. package/dist/toolkit/tina-state.d.ts +15 -0
  98. package/dist/unifiedClient/index.d.ts +8 -1
  99. package/dist/utils/cn.d.ts +2 -0
  100. package/package.json +51 -42
  101. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
  102. package/dist/node-cache-7fa2452c.mjs +0 -43
  103. package/dist/toolkit/plugin-branch-switcher/branch-banner.d.ts +0 -2
  104. package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
@@ -69,7 +69,7 @@ const MemoNode = (props) => {
69
69
  return MNode;
70
70
  };
71
71
  const Node = ({ components, child }) => {
72
- var _a, _b, _c, _d, _e, _f;
72
+ var _a, _b, _c, _d, _e, _f, _g;
73
73
  const { children, ...props } = child;
74
74
  switch (child.type) {
75
75
  case "h1":
@@ -114,7 +114,8 @@ const Node = ({ components, child }) => {
114
114
  // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
115
115
  /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
116
116
  );
117
- case "code_block":
117
+ case "mermaid":
118
+ case "code_block": {
118
119
  const value = child.value;
119
120
  if (components[child.type]) {
120
121
  const Component2 = components[child.type];
@@ -124,6 +125,7 @@ const Node = ({ components, child }) => {
124
125
  );
125
126
  }
126
127
  return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
128
+ }
127
129
  case "hr":
128
130
  if (components[child.type]) {
129
131
  const Component2 = components[child.type];
@@ -147,33 +149,33 @@ const Node = ({ components, child }) => {
147
149
  } else {
148
150
  if (child.name === "table") {
149
151
  const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
150
- const rows = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
152
+ const rows2 = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
151
153
  const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
152
- const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }));
153
- const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
154
+ const TableComponent2 = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }));
155
+ const TrComponent2 = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
154
156
  const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
155
- const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
156
- const align = ((_f = child.props) == null ? void 0 : _f.align) || [];
157
- return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
157
+ const TdComponent2 = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
158
+ const align2 = ((_f = child.props) == null ? void 0 : _f.align) || [];
159
+ return /* @__PURE__ */ React.createElement(TableComponent2, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent2, null, header.tableCells.map((c, i) => {
158
160
  return /* @__PURE__ */ React.createElement(
159
161
  TinaMarkdown,
160
162
  {
161
163
  key: i,
162
164
  components: {
163
- p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align[i], ...props2 })
165
+ p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align2[i], ...props2 })
164
166
  },
165
167
  content: c.value
166
168
  }
167
169
  );
168
- }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
170
+ }))), /* @__PURE__ */ React.createElement("tbody", null, rows2.map((row, i) => {
169
171
  var _a2;
170
- return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
172
+ return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
171
173
  return /* @__PURE__ */ React.createElement(
172
174
  TinaMarkdown,
173
175
  {
174
176
  key: i2,
175
177
  components: {
176
- p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
178
+ p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
177
179
  },
178
180
  content: c.value
179
181
  }
@@ -188,6 +190,37 @@ const Node = ({ components, child }) => {
188
190
  return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
189
191
  }
190
192
  }
193
+ case "table":
194
+ const rows = child.children || [];
195
+ const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { style: { border: "1px solid #EDECF3" }, ...props2 }));
196
+ const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
197
+ const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement(
198
+ "td",
199
+ {
200
+ style: {
201
+ textAlign: (props2 == null ? void 0 : props2.align) || "auto",
202
+ border: "1px solid #EDECF3",
203
+ padding: "0.25rem"
204
+ },
205
+ ...props2
206
+ }
207
+ ));
208
+ const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
209
+ return /* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
210
+ var _a2;
211
+ return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
212
+ return /* @__PURE__ */ React.createElement(
213
+ TinaMarkdown,
214
+ {
215
+ key: i2,
216
+ components: {
217
+ p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
218
+ },
219
+ content: cell.children
220
+ }
221
+ );
222
+ }));
223
+ })));
191
224
  case "maybe_mdx":
192
225
  return null;
193
226
  case "html":
@@ -7,7 +7,7 @@
7
7
  prismReactRenderer.Highlight,
8
8
  {
9
9
  theme: prismReactRenderer.themes[props.theme || "github"],
10
- code: props.value,
10
+ code: props.value || "",
11
11
  language: props.lang || ""
12
12
  },
13
13
  ({ 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 }) })))))
@@ -5,7 +5,7 @@ const Prism = (props) => {
5
5
  Highlight,
6
6
  {
7
7
  theme: themes[props.theme || "github"],
8
- code: props.value,
8
+ code: props.value || "",
9
9
  language: props.lang || ""
10
10
  },
11
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 }) })))))
@@ -0,0 +1,148 @@
1
+ /**
2
+ * This is a static-ready version of the TinaMarkdown component.
3
+ * The primary change is the removal of the `MemoNode` wrapper, which used
4
+ * the `React.useMemo` hook. This hook is for client-side performance
5
+ * optimization and is not needed for server-side rendering (SSR).
6
+ * By rendering the `Node` component directly, the component becomes
7
+ * fully static and can be rendered on the server.
8
+ */
9
+ import React from 'react';
10
+ type BaseComponents = {
11
+ h1?: {
12
+ children: JSX.Element;
13
+ };
14
+ h2?: {
15
+ children: JSX.Element;
16
+ };
17
+ h3?: {
18
+ children: JSX.Element;
19
+ };
20
+ h4?: {
21
+ children: JSX.Element;
22
+ };
23
+ h5?: {
24
+ children: JSX.Element;
25
+ };
26
+ h6?: {
27
+ children: JSX.Element;
28
+ };
29
+ p?: {
30
+ children: JSX.Element;
31
+ };
32
+ a?: {
33
+ url: string;
34
+ children: JSX.Element;
35
+ };
36
+ italic?: {
37
+ children: JSX.Element;
38
+ };
39
+ bold?: {
40
+ children: JSX.Element;
41
+ };
42
+ strikethrough?: {
43
+ children: JSX.Element;
44
+ };
45
+ underline?: {
46
+ children: JSX.Element;
47
+ };
48
+ code?: {
49
+ children: JSX.Element;
50
+ };
51
+ text?: {
52
+ children: string;
53
+ };
54
+ ul?: {
55
+ children: JSX.Element;
56
+ };
57
+ ol?: {
58
+ children: JSX.Element;
59
+ };
60
+ li?: {
61
+ children: JSX.Element;
62
+ };
63
+ lic?: {
64
+ children: JSX.Element;
65
+ };
66
+ block_quote?: {
67
+ children: JSX.Element;
68
+ };
69
+ code_block?: {
70
+ lang?: string;
71
+ value: string;
72
+ };
73
+ mermaid?: {
74
+ value: string;
75
+ };
76
+ img?: {
77
+ url: string;
78
+ caption?: string;
79
+ alt?: string;
80
+ };
81
+ hr?: {};
82
+ break?: {};
83
+ maybe_mdx?: {
84
+ children: JSX.Element;
85
+ };
86
+ html?: {
87
+ value: string;
88
+ };
89
+ html_inline?: {
90
+ value: string;
91
+ };
92
+ table?: {
93
+ align?: ('left' | 'right' | 'center')[];
94
+ tableRows: {
95
+ tableCells: {
96
+ value: TinaMarkdownContent;
97
+ }[];
98
+ }[];
99
+ };
100
+ component_missing?: {
101
+ name: string;
102
+ };
103
+ };
104
+ type BaseComponentSignature = {
105
+ [BK in keyof BaseComponents]: (props: BaseComponents[BK]) => JSX.Element;
106
+ };
107
+ /**
108
+ * Define the allowed components and their props
109
+ * ```ts
110
+ * const components:
111
+ * Components<{
112
+ * BlockQuote: {
113
+ * children: TinaMarkdownContent;
114
+ * authorName: string;
115
+ * };
116
+ * }> = {
117
+ * BlockQuote: (props: {
118
+ * children: TinaMarkdownContent;
119
+ * authorName: string;
120
+ * }) => {
121
+ * return (
122
+ * <div>
123
+ * <blockquote>
124
+ * <TinaMarkdown content={props.children} />
125
+ * {props.authorName}
126
+ * </blockquote>
127
+ * </div>
128
+ * );
129
+ * }
130
+ * }
131
+ * }
132
+ * ```
133
+ */
134
+ export type Components<ComponentAndProps extends object> = {
135
+ [K in keyof ComponentAndProps]: (props: ComponentAndProps[K]) => JSX.Element;
136
+ } & BaseComponentSignature;
137
+ export type TinaMarkdownContent = {
138
+ type: string;
139
+ children: TinaMarkdownContent[];
140
+ [key: string]: any;
141
+ };
142
+ export declare const StaticTinaMarkdown: <CustomComponents extends {
143
+ [key: string]: object;
144
+ } = any>({ content, components, }: {
145
+ content: TinaMarkdownContent | TinaMarkdownContent[];
146
+ components?: Components<{}> | Components<{ [BK in keyof CustomComponents]: (props: CustomComponents[BK]) => JSX.Element; }>;
147
+ }) => React.JSX.Element;
148
+ export {};
@@ -0,0 +1,239 @@
1
+ (function(global, factory) {
2
+ 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));
3
+ })(this, function(exports2, React) {
4
+ "use strict";
5
+ const StaticTinaMarkdown = ({
6
+ content,
7
+ components = {}
8
+ }) => {
9
+ if (!content) {
10
+ return null;
11
+ }
12
+ const nodes = Array.isArray(content) ? content : content.children;
13
+ if (!nodes) {
14
+ return null;
15
+ }
16
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
17
+ return /* @__PURE__ */ React.createElement(Node, { components, key: index, child });
18
+ }));
19
+ };
20
+ const Leaf = (props) => {
21
+ let el = /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
22
+ if (props.components.text) {
23
+ const Component = props.components.text;
24
+ el = /* @__PURE__ */ React.createElement(Component, null, props.text);
25
+ }
26
+ if (props.bold) {
27
+ const Component = props.components.bold || "strong";
28
+ el = /* @__PURE__ */ React.createElement(Component, null, el);
29
+ }
30
+ if (props.italic) {
31
+ const Component = props.components.italic || "em";
32
+ el = /* @__PURE__ */ React.createElement(Component, null, el);
33
+ }
34
+ if (props.underline) {
35
+ const Component = props.components.underline || "u";
36
+ el = /* @__PURE__ */ React.createElement(Component, null, el);
37
+ }
38
+ if (props.strikethrough) {
39
+ const Component = props.components.strikethrough || "s";
40
+ el = /* @__PURE__ */ React.createElement(Component, null, el);
41
+ }
42
+ if (props.code) {
43
+ const Component = props.components.code || "code";
44
+ el = /* @__PURE__ */ React.createElement(Component, null, el);
45
+ }
46
+ return el;
47
+ };
48
+ const Node = ({
49
+ components,
50
+ child
51
+ }) => {
52
+ var _a, _b, _c, _d, _e, _f, _g;
53
+ const { children, ...props } = child;
54
+ switch (child.type) {
55
+ case "h1":
56
+ case "h2":
57
+ case "h3":
58
+ case "h4":
59
+ case "h5":
60
+ case "h6":
61
+ case "p":
62
+ case "blockquote":
63
+ case "ol":
64
+ case "ul":
65
+ case "li":
66
+ if (components[child.type]) {
67
+ const Component2 = components[child.type];
68
+ return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
69
+ }
70
+ return React.createElement(child.type, {
71
+ children: /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children })
72
+ });
73
+ case "lic":
74
+ if (components.lic) {
75
+ const Component2 = components.lic;
76
+ return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
77
+ }
78
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
79
+ StaticTinaMarkdown,
80
+ {
81
+ components,
82
+ content: child.children
83
+ }
84
+ ));
85
+ case "img":
86
+ if (components[child.type]) {
87
+ const Component2 = components[child.type];
88
+ return /* @__PURE__ */ React.createElement(Component2, { ...props });
89
+ }
90
+ return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
91
+ case "a":
92
+ if (components[child.type]) {
93
+ const Component2 = components[child.type];
94
+ return (
95
+ //@ts-ignore Same issue with TinaMarkdown
96
+ /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }))
97
+ );
98
+ }
99
+ return /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
100
+ case "code_block": {
101
+ let codeString = "";
102
+ if (Array.isArray(child.children)) {
103
+ codeString = child.children.map(
104
+ (line) => Array.isArray(line.children) ? line.children.map((t) => t.text).join("") : ""
105
+ ).join("\n");
106
+ } else if (typeof child.value === "string") {
107
+ codeString = child.value;
108
+ }
109
+ if (components[child.type]) {
110
+ const Component2 = components[child.type];
111
+ return /* @__PURE__ */ React.createElement(Component2, { ...props, value: codeString });
112
+ }
113
+ return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, codeString));
114
+ }
115
+ case "hr":
116
+ if (components[child.type]) {
117
+ const Component2 = components[child.type];
118
+ return /* @__PURE__ */ React.createElement(Component2, { ...props });
119
+ }
120
+ return /* @__PURE__ */ React.createElement("hr", null);
121
+ case "break":
122
+ if (components[child.type]) {
123
+ const Component2 = components[child.type];
124
+ return /* @__PURE__ */ React.createElement(Component2, { ...props });
125
+ }
126
+ return /* @__PURE__ */ React.createElement("br", null);
127
+ case "text":
128
+ return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
129
+ case "mdxJsxTextElement":
130
+ case "mdxJsxFlowElement":
131
+ const Component = components[child.name];
132
+ if (Component) {
133
+ const props2 = child.props ? child.props : {};
134
+ return /* @__PURE__ */ React.createElement(Component, { ...props2 });
135
+ } else {
136
+ if (child.name === "table") {
137
+ const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
138
+ const rows2 = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
139
+ const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
140
+ const TableComponent2 = (
141
+ //@ts-ignore Same issue with TinaMarkdown
142
+ components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }))
143
+ );
144
+ const TrComponent2 = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
145
+ const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
146
+ const TdComponent2 = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
147
+ const align2 = ((_f = child.props) == null ? void 0 : _f.align) || [];
148
+ return (
149
+ //@ts-ignore Same issue with TinaMarkdown
150
+ /* @__PURE__ */ React.createElement(TableComponent2, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent2, null, header.tableCells.map((c, i) => {
151
+ return /* @__PURE__ */ React.createElement(
152
+ StaticTinaMarkdown,
153
+ {
154
+ key: i,
155
+ components: {
156
+ p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align2[i], ...props2 })
157
+ },
158
+ content: c.value
159
+ }
160
+ );
161
+ }))), /* @__PURE__ */ React.createElement("tbody", null, rows2.map((row, i) => {
162
+ var _a2;
163
+ return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
164
+ return /* @__PURE__ */ React.createElement(
165
+ StaticTinaMarkdown,
166
+ {
167
+ key: i2,
168
+ components: {
169
+ p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
170
+ },
171
+ content: c.value
172
+ }
173
+ );
174
+ }));
175
+ })))
176
+ );
177
+ }
178
+ const ComponentMissing = components["component_missing"];
179
+ if (ComponentMissing) {
180
+ return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
181
+ } else {
182
+ return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
183
+ }
184
+ }
185
+ case "table":
186
+ const rows = child.children || [];
187
+ const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { style: { border: "1px solid #EDECF3" }, ...props2 }));
188
+ const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
189
+ const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement(
190
+ "td",
191
+ {
192
+ style: {
193
+ textAlign: (props2 == null ? void 0 : props2.align) || "auto",
194
+ border: "1px solid #EDECF3",
195
+ padding: "0.25rem"
196
+ },
197
+ ...props2
198
+ }
199
+ ));
200
+ const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
201
+ return (
202
+ //@ts-ignore Same issue with TinaMarkdown
203
+ /* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
204
+ var _a2;
205
+ return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
206
+ return /* @__PURE__ */ React.createElement(
207
+ StaticTinaMarkdown,
208
+ {
209
+ key: i2,
210
+ components: {
211
+ p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
212
+ },
213
+ content: cell.children
214
+ }
215
+ );
216
+ }));
217
+ })))
218
+ );
219
+ case "maybe_mdx":
220
+ return null;
221
+ case "html":
222
+ case "html_inline":
223
+ if (components[child.type]) {
224
+ const Component2 = components[child.type];
225
+ return /* @__PURE__ */ React.createElement(Component2, { ...props });
226
+ }
227
+ return child.value;
228
+ case "invalid_markdown":
229
+ return /* @__PURE__ */ React.createElement("pre", null, child.value);
230
+ default:
231
+ if (typeof child.text === "string") {
232
+ return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
233
+ }
234
+ return null;
235
+ }
236
+ };
237
+ exports2.StaticTinaMarkdown = StaticTinaMarkdown;
238
+ Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
239
+ });