tinacms 1.6.7 → 2.0.0

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 (185) hide show
  1. package/dist/admin/components/AuthTemplate.d.ts +2 -2
  2. package/dist/admin/components/ErrorDialog.d.ts +2 -2
  3. package/dist/admin/components/FullscreenError.d.ts +2 -2
  4. package/dist/admin/components/GetCMS.d.ts +2 -2
  5. package/dist/admin/components/GetCollection.d.ts +2 -2
  6. package/dist/admin/components/GetCollections.d.ts +2 -2
  7. package/dist/admin/components/GetDocument.d.ts +2 -2
  8. package/dist/admin/components/Layout.d.ts +2 -2
  9. package/dist/admin/components/LoadingPage.d.ts +2 -2
  10. package/dist/admin/components/Page.d.ts +11 -11
  11. package/dist/admin/components/Sidebar.d.ts +2 -2
  12. package/dist/admin/index.d.ts +2 -2
  13. package/dist/admin/pages/CollectionCreatePage.d.ts +3 -3
  14. package/dist/admin/pages/CollectionDuplicatePage.d.ts +2 -2
  15. package/dist/admin/pages/CollectionListPage.d.ts +2 -2
  16. package/dist/admin/pages/CollectionUpdatePage.d.ts +2 -2
  17. package/dist/admin/pages/DashboardPage.d.ts +2 -2
  18. package/dist/admin/pages/ScreenPage.d.ts +2 -2
  19. package/dist/auth/AuthModal.d.ts +3 -3
  20. package/dist/auth/TinaCloudProvider.d.ts +3 -3
  21. package/dist/index.js +26 -185
  22. package/dist/index.mjs +26 -186
  23. package/dist/internalClient/formify.d.ts +1 -1
  24. package/dist/rich-text/index.d.ts +2 -2
  25. package/dist/rich-text/prism.d.ts +2 -2
  26. package/dist/tina-cms.d.ts +3 -9
  27. package/dist/toolkit/alerts/alerts.d.ts +1 -1
  28. package/dist/toolkit/components/account/update-password.d.ts +2 -2
  29. package/dist/toolkit/components/active-field-indicator.d.ts +2 -2
  30. package/dist/toolkit/components/media/breadcrumb.d.ts +2 -2
  31. package/dist/toolkit/components/media/copy-field.d.ts +2 -2
  32. package/dist/toolkit/components/media/media-item.d.ts +3 -3
  33. package/dist/toolkit/components/media/media-manager.d.ts +3 -3
  34. package/dist/toolkit/components/media/modal.d.ts +3 -3
  35. package/dist/toolkit/components/media/pagination.d.ts +2 -2
  36. package/dist/toolkit/components/mutation-signal.d.ts +1 -1
  37. package/dist/toolkit/fields/components/image-upload/image-upload.d.ts +3 -3
  38. package/dist/toolkit/fields/components/input.d.ts +2 -2
  39. package/dist/toolkit/fields/components/password-field.d.ts +1 -1
  40. package/dist/toolkit/fields/components/text-field.d.ts +1 -1
  41. package/dist/toolkit/fields/components/textarea.d.ts +1 -1
  42. package/dist/toolkit/fields/plugins/blocks-field-plugin/block-selector-big.d.ts +2 -2
  43. package/dist/toolkit/fields/plugins/blocks-field-plugin/block-selector.d.ts +2 -2
  44. package/dist/toolkit/fields/plugins/blocks-field-plugin/index.d.ts +3 -3
  45. package/dist/toolkit/fields/plugins/button-toggle-field-plugin.d.ts +2 -2
  46. package/dist/toolkit/fields/plugins/checkbox-group-field-plugin.d.ts +2 -2
  47. package/dist/toolkit/fields/plugins/color-field-plugin.d.ts +3 -3
  48. package/dist/toolkit/fields/plugins/date-field-plugin.d.ts +4 -4
  49. package/dist/toolkit/fields/plugins/group-field-plugin.d.ts +7 -7
  50. package/dist/toolkit/fields/plugins/group-list-field-plugin.d.ts +8 -8
  51. package/dist/toolkit/fields/plugins/hidden-field-plugin.d.ts +3 -3
  52. package/dist/toolkit/fields/plugins/image-field-plugin.d.ts +3 -3
  53. package/dist/toolkit/fields/plugins/list-field-meta.d.ts +6 -6
  54. package/dist/toolkit/fields/plugins/list-field-plugin.d.ts +3 -3
  55. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +2 -2
  56. package/dist/toolkit/fields/plugins/mdx-field-plugin/monaco/error-message.d.ts +2 -2
  57. package/dist/toolkit/fields/plugins/mdx-field-plugin/monaco/index.d.ts +2 -2
  58. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +2 -2
  59. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/nested-form.d.ts +2 -2
  60. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-img-plugin/component.d.ts +3 -3
  61. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-invalid-markdown-plugin/index.d.ts +2 -2
  62. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-link-plugin/index.d.ts +2 -2
  63. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-mdx-plugins/component.d.ts +3 -3
  64. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +1 -1
  65. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +21 -21
  66. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/dropdown.d.ts +1 -1
  67. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/icons.d.ts +17 -17
  68. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/toolbar/floating-toolbar.d.ts +2 -2
  69. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/toolbar/index.d.ts +4 -4
  70. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/toolbar/overflow-menu.d.ts +2 -2
  71. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/toolbar/toolbar-item.d.ts +4 -4
  72. package/dist/toolkit/fields/plugins/number-field-plugin.d.ts +3 -3
  73. package/dist/toolkit/fields/plugins/password-field-plugin.d.ts +3 -3
  74. package/dist/toolkit/fields/plugins/radio-group-field-plugin.d.ts +2 -2
  75. package/dist/toolkit/fields/plugins/reference-field-plugin.d.ts +2 -2
  76. package/dist/toolkit/fields/plugins/select-field-plugin.d.ts +2 -2
  77. package/dist/toolkit/fields/plugins/tags-field-plugin.d.ts +3 -3
  78. package/dist/toolkit/fields/plugins/text-field-plugin.d.ts +3 -3
  79. package/dist/toolkit/fields/plugins/textarea-field-plugin.d.ts +3 -3
  80. package/dist/toolkit/fields/plugins/toggle-field-plugin.d.ts +2 -2
  81. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +7 -7
  82. package/dist/toolkit/form-builder/fields-builder.d.ts +3 -3
  83. package/dist/toolkit/form-builder/form-actions.d.ts +2 -1
  84. package/dist/toolkit/form-builder/form-builder.d.ts +6 -6
  85. package/dist/toolkit/form-builder/form-portal.d.ts +5 -1
  86. package/dist/toolkit/form-builder/form.d.ts +2 -2
  87. package/dist/toolkit/form-builder/loading-dots.d.ts +2 -2
  88. package/dist/toolkit/icons/Add.d.ts +2 -2
  89. package/dist/toolkit/icons/Alert.d.ts +2 -2
  90. package/dist/toolkit/icons/AlignCenter.d.ts +2 -2
  91. package/dist/toolkit/icons/AlignLeft.d.ts +2 -2
  92. package/dist/toolkit/icons/AlignRight.d.ts +2 -2
  93. package/dist/toolkit/icons/Bold.d.ts +2 -2
  94. package/dist/toolkit/icons/ChevronDown.d.ts +2 -2
  95. package/dist/toolkit/icons/ChevronLeft.d.ts +2 -2
  96. package/dist/toolkit/icons/ChevronRight.d.ts +2 -2
  97. package/dist/toolkit/icons/ChevronUp.d.ts +2 -2
  98. package/dist/toolkit/icons/Circle.d.ts +2 -2
  99. package/dist/toolkit/icons/CircleCheck.d.ts +2 -2
  100. package/dist/toolkit/icons/Close.d.ts +2 -2
  101. package/dist/toolkit/icons/Code.d.ts +2 -2
  102. package/dist/toolkit/icons/Drag.d.ts +2 -2
  103. package/dist/toolkit/icons/Duplicate.d.ts +2 -2
  104. package/dist/toolkit/icons/Edit.d.ts +2 -2
  105. package/dist/toolkit/icons/EllipsisVertical.d.ts +2 -2
  106. package/dist/toolkit/icons/Error.d.ts +2 -2
  107. package/dist/toolkit/icons/Exit.d.ts +2 -2
  108. package/dist/toolkit/icons/File.d.ts +2 -2
  109. package/dist/toolkit/icons/Folder.d.ts +2 -2
  110. package/dist/toolkit/icons/Hamburger.d.ts +2 -2
  111. package/dist/toolkit/icons/Heading.d.ts +2 -2
  112. package/dist/toolkit/icons/Info.d.ts +2 -2
  113. package/dist/toolkit/icons/Italic.d.ts +2 -2
  114. package/dist/toolkit/icons/LeftArrow.d.ts +2 -2
  115. package/dist/toolkit/icons/Link.d.ts +2 -2
  116. package/dist/toolkit/icons/Lock.d.ts +2 -2
  117. package/dist/toolkit/icons/Markdown.d.ts +2 -2
  118. package/dist/toolkit/icons/Media.d.ts +2 -2
  119. package/dist/toolkit/icons/OrderedList.d.ts +2 -2
  120. package/dist/toolkit/icons/PullRequest.d.ts +2 -2
  121. package/dist/toolkit/icons/Quote.d.ts +2 -2
  122. package/dist/toolkit/icons/Redo.d.ts +2 -2
  123. package/dist/toolkit/icons/Reorder.d.ts +2 -2
  124. package/dist/toolkit/icons/ReorderRow.d.ts +2 -2
  125. package/dist/toolkit/icons/Reset.d.ts +2 -2
  126. package/dist/toolkit/icons/RightArrow.d.ts +2 -2
  127. package/dist/toolkit/icons/Settings.d.ts +2 -2
  128. package/dist/toolkit/icons/Strikethrough.d.ts +2 -2
  129. package/dist/toolkit/icons/Table.d.ts +2 -2
  130. package/dist/toolkit/icons/Tina.d.ts +2 -2
  131. package/dist/toolkit/icons/Trash.d.ts +2 -2
  132. package/dist/toolkit/icons/Underline.d.ts +2 -2
  133. package/dist/toolkit/icons/Undo.d.ts +2 -2
  134. package/dist/toolkit/icons/UnorderedList.d.ts +2 -2
  135. package/dist/toolkit/icons/Upload.d.ts +2 -2
  136. package/dist/toolkit/icons/Warning.d.ts +2 -2
  137. package/dist/toolkit/plugin-branch-switcher/branch-banner.d.ts +2 -2
  138. package/dist/toolkit/plugin-branch-switcher/branch-button.d.ts +2 -2
  139. package/dist/toolkit/plugin-branch-switcher/branch-data.d.ts +2 -2
  140. package/dist/toolkit/plugin-branch-switcher/branch-modal.d.ts +2 -2
  141. package/dist/toolkit/plugin-branch-switcher/branch-switcher-legacy.d.ts +1 -1
  142. package/dist/toolkit/plugin-branch-switcher/branch-switcher.d.ts +3 -3
  143. package/dist/toolkit/plugin-branch-switcher/plugin.d.ts +2 -2
  144. package/dist/toolkit/plugin-fields/markdown.d.ts +3 -3
  145. package/dist/toolkit/react-alerts/alerts.d.ts +3 -3
  146. package/dist/toolkit/react-core/with-plugin.d.ts +2 -2
  147. package/dist/toolkit/react-datetime/DateTime.d.ts +3 -3
  148. package/dist/toolkit/react-datetime/parts/ViewNavigation.d.ts +2 -1
  149. package/dist/toolkit/react-datetime/views/DaysView.d.ts +6 -6
  150. package/dist/toolkit/react-datetime/views/MonthsView.d.ts +3 -3
  151. package/dist/toolkit/react-datetime/views/TimeView.d.ts +3 -3
  152. package/dist/toolkit/react-datetime/views/YearsView.d.ts +4 -4
  153. package/dist/toolkit/react-dismissible/dismissible.d.ts +1 -0
  154. package/dist/toolkit/react-forms/form-modal.d.ts +2 -2
  155. package/dist/toolkit/react-modals/fullscreen-modal.d.ts +3 -3
  156. package/dist/toolkit/react-modals/modal/modal-actions.d.ts +2 -2
  157. package/dist/toolkit/react-modals/modal/modal-body.d.ts +2 -2
  158. package/dist/toolkit/react-modals/modal/modal-header.d.ts +1 -1
  159. package/dist/toolkit/react-modals/modal/modal-overlay.d.ts +2 -2
  160. package/dist/toolkit/react-modals/modal-provider.d.ts +5 -1
  161. package/dist/toolkit/react-modals/popup-modal.d.ts +3 -3
  162. package/dist/toolkit/react-sidebar/components/form-list.d.ts +4 -4
  163. package/dist/toolkit/react-sidebar/components/local-warning.d.ts +3 -3
  164. package/dist/toolkit/react-sidebar/components/nav.d.ts +1 -1
  165. package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +3 -3
  166. package/dist/toolkit/react-sidebar/components/resize-handle.d.ts +2 -2
  167. package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +4 -4
  168. package/dist/toolkit/react-sidebar/components/sidebar.d.ts +1 -1
  169. package/dist/toolkit/react-sidebar/components/sync-status.d.ts +4 -4
  170. package/dist/toolkit/react-tinacms/with-tina.d.ts +2 -2
  171. package/dist/toolkit/styles/button.d.ts +2 -2
  172. package/dist/toolkit/styles/container.d.ts +2 -2
  173. package/dist/toolkit/styles/message.d.ts +1 -1
  174. package/dist/toolkit/styles/overflow-menu.d.ts +2 -2
  175. package/dist/types/cms.d.ts +1 -0
  176. package/package.json +16 -25
  177. package/dist/admin/pages/LoginPage.d.ts +0 -6
  178. package/dist/admin/pages/LogoutPage.d.ts +0 -7
  179. package/dist/dev-tools.d.ts +0 -21
  180. package/dist/dev-tools.js +0 -492
  181. package/dist/dev-tools.mjs +0 -489
  182. package/dist/edit-state.d.ts +0 -38
  183. package/dist/edit-state.js +0 -110
  184. package/dist/edit-state.mjs +0 -103
  185. package/dist/toolkit/react-core/tina-error-boundary.d.ts +0 -21
package/dist/dev-tools.js DELETED
@@ -1,492 +0,0 @@
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 TinaMarkdown = ({
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(MemoNode, { components, key: index, child });
18
- }));
19
- };
20
- const Leaf = (props) => {
21
- if (props.bold) {
22
- const { bold, ...rest } = props;
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 }));
28
- }
29
- if (props.italic) {
30
- const { italic, ...rest } = props;
31
- if (props.components.italic) {
32
- const Component = props.components.italic;
33
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
34
- }
35
- return /* @__PURE__ */ React.createElement("em", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
36
- }
37
- if (props.underline) {
38
- const { underline, ...rest } = props;
39
- if (props.components.underline) {
40
- const Component = props.components.underline;
41
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
42
- }
43
- return /* @__PURE__ */ React.createElement("u", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
44
- }
45
- if (props.strikethrough) {
46
- const { strikethrough, ...rest } = props;
47
- if (props.components.strikethrough) {
48
- const Component = props.components.strikethrough;
49
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
50
- }
51
- return /* @__PURE__ */ React.createElement("s", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
52
- }
53
- if (props.code) {
54
- const { code, ...rest } = props;
55
- if (props.components.code) {
56
- const Component = props.components.code;
57
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
58
- }
59
- return /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
60
- }
61
- if (props.components.text) {
62
- const Component = props.components.text;
63
- return /* @__PURE__ */ React.createElement(Component, null, props.text);
64
- }
65
- return /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
66
- };
67
- const MemoNode = (props) => {
68
- const MNode = React.useMemo(
69
- () => /* @__PURE__ */ React.createElement(Node, { ...props }),
70
- [JSON.stringify(props)]
71
- );
72
- return MNode;
73
- };
74
- const Node = ({ components, child }) => {
75
- var _a, _b, _c, _d, _e, _f;
76
- const { children, ...props } = child;
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 "blockquote":
86
- case "ol":
87
- case "ul":
88
- case "li":
89
- if (components[child.type]) {
90
- const Component2 = components[child.type];
91
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
92
- }
93
- return React.createElement(child.type, {
94
- children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
95
- });
96
- case "lic":
97
- if (components.lic) {
98
- const Component2 = components.lic;
99
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
100
- }
101
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: child.children }));
102
- case "img":
103
- if (components[child.type]) {
104
- const Component2 = components[child.type];
105
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
106
- }
107
- return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.caption });
108
- case "a":
109
- if (components[child.type]) {
110
- const Component2 = components[child.type];
111
- return (
112
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
113
- /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
114
- );
115
- }
116
- return (
117
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
118
- /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
119
- );
120
- case "code_block":
121
- const value = child.value;
122
- if (components[child.type]) {
123
- const Component2 = components[child.type];
124
- return (
125
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
126
- /* @__PURE__ */ React.createElement(Component2, { ...props })
127
- );
128
- }
129
- return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
130
- case "hr":
131
- if (components[child.type]) {
132
- const Component2 = components[child.type];
133
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
134
- }
135
- return /* @__PURE__ */ React.createElement("hr", null);
136
- case "break":
137
- if (components[child.type]) {
138
- const Component2 = components[child.type];
139
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
140
- }
141
- return /* @__PURE__ */ React.createElement("br", null);
142
- case "text":
143
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...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, { ...props2 });
150
- } else {
151
- if (child.name === "table") {
152
- const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
153
- const rows = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
154
- const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
155
- const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }));
156
- const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
157
- const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
158
- const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
159
- const align = ((_f = child.props) == null ? void 0 : _f.align) || [];
160
- return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
161
- return /* @__PURE__ */ React.createElement(
162
- TinaMarkdown,
163
- {
164
- key: i,
165
- components: {
166
- p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align[i], ...props2 })
167
- },
168
- content: c.value
169
- }
170
- );
171
- }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
172
- var _a2;
173
- return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
174
- return /* @__PURE__ */ React.createElement(
175
- TinaMarkdown,
176
- {
177
- key: i2,
178
- components: {
179
- p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
180
- },
181
- content: c.value
182
- }
183
- );
184
- }));
185
- })));
186
- }
187
- const ComponentMissing = components["component_missing"];
188
- if (ComponentMissing) {
189
- return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
190
- } else {
191
- return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
192
- }
193
- }
194
- case "maybe_mdx":
195
- return null;
196
- case "html":
197
- case "html_inline":
198
- if (components[child.type]) {
199
- const Component2 = components[child.type];
200
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
201
- }
202
- return child.value;
203
- case "invalid_markdown":
204
- return /* @__PURE__ */ React.createElement("pre", null, child.value);
205
- default:
206
- if (typeof child.text === "string") {
207
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
208
- }
209
- }
210
- };
211
- const tinaField = (object, property, index) => {
212
- var _a, _b, _c;
213
- if (!object) {
214
- return "";
215
- }
216
- if (object._content_source) {
217
- if (!property) {
218
- return [
219
- (_a = object._content_source) == null ? void 0 : _a.queryId,
220
- object._content_source.path.join(".")
221
- ].join("---");
222
- }
223
- if (typeof index === "number") {
224
- return [
225
- (_b = object._content_source) == null ? void 0 : _b.queryId,
226
- [...object._content_source.path, property, index].join(".")
227
- ].join("---");
228
- }
229
- return [
230
- (_c = object._content_source) == null ? void 0 : _c.queryId,
231
- [...object._content_source.path, property].join(".")
232
- ].join("---");
233
- }
234
- return "";
235
- };
236
- const Explorer = (props) => {
237
- return /* @__PURE__ */ React.createElement("div", { className: "font-mono" }, /* @__PURE__ */ React.createElement(ObjectValueRenderer, { ...props }));
238
- };
239
- const ObjectValueRenderer = (props) => {
240
- const subEntries = Object.entries(props.value).map(([keyName, subValue]) => {
241
- return /* @__PURE__ */ React.createElement("div", { key: keyName, className: "gap-2" }, /* @__PURE__ */ React.createElement(
242
- UnknownRenderer,
243
- {
244
- keyName,
245
- value: subValue,
246
- parentValue: props.value,
247
- parentKeyName: props.parentKeyName,
248
- renderValue: props.renderValue,
249
- renderRichText: props.renderRichText,
250
- showMetaFields: props.showMetaFields
251
- }
252
- ));
253
- });
254
- return /* @__PURE__ */ React.createElement("div", null, subEntries);
255
- };
256
- const UnknownRenderer = ({
257
- keyName,
258
- value,
259
- parentValue,
260
- parentKeyName,
261
- renderValue,
262
- renderRichText,
263
- showMetaFields
264
- }) => {
265
- const typeOfValue = typeof value;
266
- const [expanded, setExpanded] = React.useState(
267
- /* @ts-ignore */
268
- (value == null ? void 0 : value.type) === "root" ? false : true
269
- );
270
- if (!showMetaFields) {
271
- if ([
272
- // 'id',
273
- "_sys",
274
- "__typename",
275
- // '_tina_metadata',
276
- "_internalValues",
277
- "_internalSys"
278
- ].includes(keyName)) {
279
- return;
280
- }
281
- }
282
- if (Array.isArray(value)) {
283
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
284
- "button",
285
- {
286
- onClick: () => setExpanded((exp) => !exp),
287
- className: "min-w-[48px] flex justify-start gap-2"
288
- },
289
- keyName,
290
- ": ",
291
- "[",
292
- !expanded && `...]`
293
- ), expanded && /* @__PURE__ */ React.createElement("div", { className: "pl-4" }, value.map((item, index) => /* @__PURE__ */ React.createElement(
294
- UnknownRenderer,
295
- {
296
- key: String(index),
297
- keyName: String(index),
298
- value: item,
299
- parentKeyName: keyName,
300
- parentValue,
301
- renderValue,
302
- renderRichText
303
- }
304
- ))), expanded && /* @__PURE__ */ React.createElement("div", null, "]"));
305
- }
306
- if (typeOfValue === "object") {
307
- if ((value == null ? void 0 : value.type) === "root" && renderRichText) {
308
- return /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement(
309
- "button",
310
- {
311
- onClick: () => setExpanded((exp) => !exp),
312
- className: "min-w-[48px] flex justify-start gap-2"
313
- },
314
- keyName,
315
- ": ",
316
- !expanded && "{...}"
317
- ), /* @__PURE__ */ React.createElement("div", null, expanded && // @ts-ignore
318
- renderRichText({ value, keyName, parentValue, parentKeyName })));
319
- }
320
- return /* @__PURE__ */ React.createElement(
321
- ObjectRenderer,
322
- {
323
- keyName,
324
- value,
325
- parentValue,
326
- parentKeyName,
327
- renderValue,
328
- renderRichText
329
- }
330
- );
331
- }
332
- return /* @__PURE__ */ React.createElement(
333
- Value,
334
- {
335
- keyName,
336
- value,
337
- parentValue,
338
- parentKeyName,
339
- renderValue
340
- }
341
- );
342
- };
343
- const Value = ({
344
- keyName,
345
- value,
346
- parentValue,
347
- parentKeyName,
348
- renderValue
349
- }) => {
350
- const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
351
- return /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement("div", null, keyDisplay), /* @__PURE__ */ React.createElement("div", null, renderValue({ value, keyName, parentValue, parentKeyName })));
352
- };
353
- const ObjectRenderer = ({
354
- keyName,
355
- value,
356
- parentValue,
357
- parentKeyName,
358
- renderValue,
359
- renderRichText
360
- }) => {
361
- const { withDataTinaFieldState } = React.useContext(JsonContext);
362
- const [showMetaFields, setShowMetaFields] = React.useState(false);
363
- const [expanded, setExpanded] = React.useState(true);
364
- const v = value;
365
- const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
366
- if (value === null) {
367
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement("div", { className: "" }, keyDisplay), /* @__PURE__ */ React.createElement("div", { className: "text-gray-400" }, "null")));
368
- } else {
369
- const fieldName = tinaField(v);
370
- const extraProps = {};
371
- if (fieldName !== "undefined#undefined" && withDataTinaFieldState) {
372
- extraProps["data-tina-field"] = fieldName;
373
- }
374
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React.createElement(
375
- "button",
376
- {
377
- onClick: () => setExpanded((exp) => !exp),
378
- className: "min-w-[48px] flex justify-start gap-2"
379
- },
380
- keyDisplay,
381
- "{",
382
- !expanded && `...}`
383
- ), expanded && /* @__PURE__ */ React.createElement(
384
- "button",
385
- {
386
- onClick: () => {
387
- setShowMetaFields((show) => !show);
388
- },
389
- className: "min-w-[48px] text-sm text-gray-400"
390
- },
391
- showMetaFields ? "Hide meta fields" : "Show meta fields"
392
- )), expanded && /* @__PURE__ */ React.createElement("div", { className: "pl-4", ...extraProps }, /* @__PURE__ */ React.createElement(
393
- ObjectValueRenderer,
394
- {
395
- value: v,
396
- parentValue,
397
- parentKeyName,
398
- renderValue,
399
- renderRichText,
400
- showMetaFields
401
- }
402
- )), expanded && /* @__PURE__ */ React.createElement("div", null, "}"));
403
- }
404
- };
405
- const JsonContext = React.createContext({ withDataTinaFieldState: true });
406
- function Json({
407
- src,
408
- withDataTinaFieldState = true
409
- }) {
410
- const [isClient, setIsClient] = React.useState(false);
411
- React.useEffect(() => {
412
- setIsClient(true);
413
- }, []);
414
- if (!isClient) {
415
- return null;
416
- }
417
- return /* @__PURE__ */ React.createElement(React.Suspense, { fallback: /* @__PURE__ */ React.createElement("div", { className: "" }, "Loading...") }, /* @__PURE__ */ React.createElement(
418
- JsonContext.Provider,
419
- {
420
- value: {
421
- withDataTinaFieldState: withDataTinaFieldState === false ? false : true
422
- }
423
- },
424
- /* @__PURE__ */ React.createElement("div", { className: "px-4" }, /* @__PURE__ */ React.createElement("div", { className: "mx-auto my-8 border rounded-lg p-8 shadow-lg max-w-5xl mx-auto shadow-lg" }, /* @__PURE__ */ React.createElement("div", { className: "h-full overflow-scroll" }, /* @__PURE__ */ React.createElement(
425
- Explorer,
426
- {
427
- value: src,
428
- renderRichText: ({
429
- value,
430
- // @ts-ignore
431
- keyName,
432
- // @ts-ignore
433
- parentValue,
434
- // @ts-ignore
435
- parentKeyName
436
- }) => {
437
- let fieldName = "";
438
- if (!isNaN(Number(keyName))) {
439
- fieldName = `${tinaField(
440
- parentValue,
441
- parentKeyName
442
- )}.${keyName}`;
443
- } else {
444
- fieldName = tinaField(parentValue, keyName);
445
- }
446
- const extraProps = {};
447
- if (fieldName !== "undefined#undefined") {
448
- if (fieldName && withDataTinaFieldState) {
449
- extraProps["data-tina-field"] = fieldName;
450
- }
451
- }
452
- return /* @__PURE__ */ React.createElement(
453
- "div",
454
- {
455
- className: "font-sans px-2 border-l-2 bg-gray-50 w-full prose",
456
- ...extraProps
457
- },
458
- /* @__PURE__ */ React.createElement(TinaMarkdown, { content: value })
459
- );
460
- },
461
- renderValue: ({
462
- value,
463
- keyName,
464
- parentValue,
465
- parentKeyName
466
- }) => {
467
- let fieldName = "";
468
- if (!isNaN(Number(keyName))) {
469
- fieldName = `${tinaField(
470
- parentValue,
471
- // @ts-ignore
472
- parentKeyName
473
- )}.${keyName}`;
474
- } else {
475
- fieldName = tinaField(parentValue, keyName);
476
- }
477
- const extraProps = {};
478
- if (fieldName !== "undefined#undefined") {
479
- if (fieldName && withDataTinaFieldState) {
480
- extraProps["data-tina-field"] = fieldName;
481
- }
482
- }
483
- return /* @__PURE__ */ React.createElement("span", { className: "text-orange-600", ...extraProps }, value);
484
- }
485
- }
486
- ))))
487
- ));
488
- }
489
- exports2.Explorer = Explorer;
490
- exports2.Json = Json;
491
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
492
- });