tinacms 1.6.6 → 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
@@ -1,489 +0,0 @@
1
- import React, { useContext, useState, useEffect, Suspense } 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 }));
23
- }
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 }));
31
- }
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 }));
39
- }
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 }));
47
- }
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 }));
55
- }
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;
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 "blockquote":
83
- case "ol":
84
- case "ul":
85
- case "li":
86
- if (components[child.type]) {
87
- const Component2 = components[child.type];
88
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
89
- }
90
- return React.createElement(child.type, {
91
- children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
92
- });
93
- case "lic":
94
- if (components.lic) {
95
- const Component2 = components.lic;
96
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
97
- }
98
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: child.children }));
99
- case "img":
100
- if (components[child.type]) {
101
- const Component2 = components[child.type];
102
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
103
- }
104
- return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.caption });
105
- case "a":
106
- if (components[child.type]) {
107
- const Component2 = components[child.type];
108
- return (
109
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
110
- /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
111
- );
112
- }
113
- return (
114
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
115
- /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
116
- );
117
- case "code_block":
118
- const value = child.value;
119
- if (components[child.type]) {
120
- const Component2 = components[child.type];
121
- return (
122
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
123
- /* @__PURE__ */ React.createElement(Component2, { ...props })
124
- );
125
- }
126
- return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
127
- case "hr":
128
- if (components[child.type]) {
129
- const Component2 = components[child.type];
130
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
131
- }
132
- return /* @__PURE__ */ React.createElement("hr", null);
133
- case "break":
134
- if (components[child.type]) {
135
- const Component2 = components[child.type];
136
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
137
- }
138
- return /* @__PURE__ */ React.createElement("br", null);
139
- case "text":
140
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
141
- case "mdxJsxTextElement":
142
- case "mdxJsxFlowElement":
143
- const Component = components[child.name];
144
- if (Component) {
145
- const props2 = child.props ? child.props : {};
146
- return /* @__PURE__ */ React.createElement(Component, { ...props2 });
147
- } else {
148
- if (child.name === "table") {
149
- 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) || [];
151
- 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 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) => {
158
- return /* @__PURE__ */ React.createElement(
159
- TinaMarkdown,
160
- {
161
- key: i,
162
- components: {
163
- p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align[i], ...props2 })
164
- },
165
- content: c.value
166
- }
167
- );
168
- }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
169
- var _a2;
170
- return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
171
- return /* @__PURE__ */ React.createElement(
172
- TinaMarkdown,
173
- {
174
- key: i2,
175
- components: {
176
- p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
177
- },
178
- content: c.value
179
- }
180
- );
181
- }));
182
- })));
183
- }
184
- const ComponentMissing = components["component_missing"];
185
- if (ComponentMissing) {
186
- return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
187
- } else {
188
- return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
189
- }
190
- }
191
- case "maybe_mdx":
192
- return null;
193
- case "html":
194
- case "html_inline":
195
- if (components[child.type]) {
196
- const Component2 = components[child.type];
197
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
198
- }
199
- return child.value;
200
- case "invalid_markdown":
201
- return /* @__PURE__ */ React.createElement("pre", null, child.value);
202
- default:
203
- if (typeof child.text === "string") {
204
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
205
- }
206
- }
207
- };
208
- const tinaField = (object, property, index) => {
209
- var _a, _b, _c;
210
- if (!object) {
211
- return "";
212
- }
213
- if (object._content_source) {
214
- if (!property) {
215
- return [
216
- (_a = object._content_source) == null ? void 0 : _a.queryId,
217
- object._content_source.path.join(".")
218
- ].join("---");
219
- }
220
- if (typeof index === "number") {
221
- return [
222
- (_b = object._content_source) == null ? void 0 : _b.queryId,
223
- [...object._content_source.path, property, index].join(".")
224
- ].join("---");
225
- }
226
- return [
227
- (_c = object._content_source) == null ? void 0 : _c.queryId,
228
- [...object._content_source.path, property].join(".")
229
- ].join("---");
230
- }
231
- return "";
232
- };
233
- const Explorer = (props) => {
234
- return /* @__PURE__ */ React.createElement("div", { className: "font-mono" }, /* @__PURE__ */ React.createElement(ObjectValueRenderer, { ...props }));
235
- };
236
- const ObjectValueRenderer = (props) => {
237
- const subEntries = Object.entries(props.value).map(([keyName, subValue]) => {
238
- return /* @__PURE__ */ React.createElement("div", { key: keyName, className: "gap-2" }, /* @__PURE__ */ React.createElement(
239
- UnknownRenderer,
240
- {
241
- keyName,
242
- value: subValue,
243
- parentValue: props.value,
244
- parentKeyName: props.parentKeyName,
245
- renderValue: props.renderValue,
246
- renderRichText: props.renderRichText,
247
- showMetaFields: props.showMetaFields
248
- }
249
- ));
250
- });
251
- return /* @__PURE__ */ React.createElement("div", null, subEntries);
252
- };
253
- const UnknownRenderer = ({
254
- keyName,
255
- value,
256
- parentValue,
257
- parentKeyName,
258
- renderValue,
259
- renderRichText,
260
- showMetaFields
261
- }) => {
262
- const typeOfValue = typeof value;
263
- const [expanded, setExpanded] = React.useState(
264
- /* @ts-ignore */
265
- (value == null ? void 0 : value.type) === "root" ? false : true
266
- );
267
- if (!showMetaFields) {
268
- if ([
269
- // 'id',
270
- "_sys",
271
- "__typename",
272
- // '_tina_metadata',
273
- "_internalValues",
274
- "_internalSys"
275
- ].includes(keyName)) {
276
- return;
277
- }
278
- }
279
- if (Array.isArray(value)) {
280
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
281
- "button",
282
- {
283
- onClick: () => setExpanded((exp) => !exp),
284
- className: "min-w-[48px] flex justify-start gap-2"
285
- },
286
- keyName,
287
- ": ",
288
- "[",
289
- !expanded && `...]`
290
- ), expanded && /* @__PURE__ */ React.createElement("div", { className: "pl-4" }, value.map((item, index) => /* @__PURE__ */ React.createElement(
291
- UnknownRenderer,
292
- {
293
- key: String(index),
294
- keyName: String(index),
295
- value: item,
296
- parentKeyName: keyName,
297
- parentValue,
298
- renderValue,
299
- renderRichText
300
- }
301
- ))), expanded && /* @__PURE__ */ React.createElement("div", null, "]"));
302
- }
303
- if (typeOfValue === "object") {
304
- if ((value == null ? void 0 : value.type) === "root" && renderRichText) {
305
- return /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement(
306
- "button",
307
- {
308
- onClick: () => setExpanded((exp) => !exp),
309
- className: "min-w-[48px] flex justify-start gap-2"
310
- },
311
- keyName,
312
- ": ",
313
- !expanded && "{...}"
314
- ), /* @__PURE__ */ React.createElement("div", null, expanded && // @ts-ignore
315
- renderRichText({ value, keyName, parentValue, parentKeyName })));
316
- }
317
- return /* @__PURE__ */ React.createElement(
318
- ObjectRenderer,
319
- {
320
- keyName,
321
- value,
322
- parentValue,
323
- parentKeyName,
324
- renderValue,
325
- renderRichText
326
- }
327
- );
328
- }
329
- return /* @__PURE__ */ React.createElement(
330
- Value,
331
- {
332
- keyName,
333
- value,
334
- parentValue,
335
- parentKeyName,
336
- renderValue
337
- }
338
- );
339
- };
340
- const Value = ({
341
- keyName,
342
- value,
343
- parentValue,
344
- parentKeyName,
345
- renderValue
346
- }) => {
347
- const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
348
- 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 })));
349
- };
350
- const ObjectRenderer = ({
351
- keyName,
352
- value,
353
- parentValue,
354
- parentKeyName,
355
- renderValue,
356
- renderRichText
357
- }) => {
358
- const { withDataTinaFieldState } = useContext(JsonContext);
359
- const [showMetaFields, setShowMetaFields] = React.useState(false);
360
- const [expanded, setExpanded] = React.useState(true);
361
- const v = value;
362
- const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
363
- if (value === null) {
364
- 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")));
365
- } else {
366
- const fieldName = tinaField(v);
367
- const extraProps = {};
368
- if (fieldName !== "undefined#undefined" && withDataTinaFieldState) {
369
- extraProps["data-tina-field"] = fieldName;
370
- }
371
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between" }, /* @__PURE__ */ React.createElement(
372
- "button",
373
- {
374
- onClick: () => setExpanded((exp) => !exp),
375
- className: "min-w-[48px] flex justify-start gap-2"
376
- },
377
- keyDisplay,
378
- "{",
379
- !expanded && `...}`
380
- ), expanded && /* @__PURE__ */ React.createElement(
381
- "button",
382
- {
383
- onClick: () => {
384
- setShowMetaFields((show) => !show);
385
- },
386
- className: "min-w-[48px] text-sm text-gray-400"
387
- },
388
- showMetaFields ? "Hide meta fields" : "Show meta fields"
389
- )), expanded && /* @__PURE__ */ React.createElement("div", { className: "pl-4", ...extraProps }, /* @__PURE__ */ React.createElement(
390
- ObjectValueRenderer,
391
- {
392
- value: v,
393
- parentValue,
394
- parentKeyName,
395
- renderValue,
396
- renderRichText,
397
- showMetaFields
398
- }
399
- )), expanded && /* @__PURE__ */ React.createElement("div", null, "}"));
400
- }
401
- };
402
- const JsonContext = React.createContext({ withDataTinaFieldState: true });
403
- function Json({
404
- src,
405
- withDataTinaFieldState = true
406
- }) {
407
- const [isClient, setIsClient] = useState(false);
408
- useEffect(() => {
409
- setIsClient(true);
410
- }, []);
411
- if (!isClient) {
412
- return null;
413
- }
414
- return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement("div", { className: "" }, "Loading...") }, /* @__PURE__ */ React.createElement(
415
- JsonContext.Provider,
416
- {
417
- value: {
418
- withDataTinaFieldState: withDataTinaFieldState === false ? false : true
419
- }
420
- },
421
- /* @__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(
422
- Explorer,
423
- {
424
- value: src,
425
- renderRichText: ({
426
- value,
427
- // @ts-ignore
428
- keyName,
429
- // @ts-ignore
430
- parentValue,
431
- // @ts-ignore
432
- parentKeyName
433
- }) => {
434
- let fieldName = "";
435
- if (!isNaN(Number(keyName))) {
436
- fieldName = `${tinaField(
437
- parentValue,
438
- parentKeyName
439
- )}.${keyName}`;
440
- } else {
441
- fieldName = tinaField(parentValue, keyName);
442
- }
443
- const extraProps = {};
444
- if (fieldName !== "undefined#undefined") {
445
- if (fieldName && withDataTinaFieldState) {
446
- extraProps["data-tina-field"] = fieldName;
447
- }
448
- }
449
- return /* @__PURE__ */ React.createElement(
450
- "div",
451
- {
452
- className: "font-sans px-2 border-l-2 bg-gray-50 w-full prose",
453
- ...extraProps
454
- },
455
- /* @__PURE__ */ React.createElement(TinaMarkdown, { content: value })
456
- );
457
- },
458
- renderValue: ({
459
- value,
460
- keyName,
461
- parentValue,
462
- parentKeyName
463
- }) => {
464
- let fieldName = "";
465
- if (!isNaN(Number(keyName))) {
466
- fieldName = `${tinaField(
467
- parentValue,
468
- // @ts-ignore
469
- parentKeyName
470
- )}.${keyName}`;
471
- } else {
472
- fieldName = tinaField(parentValue, keyName);
473
- }
474
- const extraProps = {};
475
- if (fieldName !== "undefined#undefined") {
476
- if (fieldName && withDataTinaFieldState) {
477
- extraProps["data-tina-field"] = fieldName;
478
- }
479
- }
480
- return /* @__PURE__ */ React.createElement("span", { className: "text-orange-600", ...extraProps }, value);
481
- }
482
- }
483
- ))))
484
- ));
485
- }
486
- export {
487
- Explorer,
488
- Json
489
- };
@@ -1,38 +0,0 @@
1
- /**
2
-
3
- */
4
- import { isEditing, setEditing } from '@tinacms/sharedctx';
5
- import React from 'react';
6
- /**
7
- * @deprecated since version 1.0.
8
- * Use "import { useEditState } from 'tinacms/dist/react'" instead.
9
- * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
10
- */
11
- declare const useEditState: () => {
12
- edit: any;
13
- setEdit: any;
14
- };
15
- export { isEditing, setEditing, useEditState };
16
- /**
17
- * @deprecated since version 1.0.
18
- * Tina no longer requires wrapping your site in the TinaProvider
19
- * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
20
- */
21
- export declare const TinaEditProvider: ({ showEditButton, ...props }: {
22
- showEditButton?: boolean;
23
- children: React.ReactNode;
24
- editMode: React.ReactNode;
25
- }) => JSX.Element;
26
- /**
27
- * @deprecated since version 1.0.
28
- * Use "import { useTina } from 'tinacms/dist/react'" instead.
29
- * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
30
- */
31
- export declare function useTina<T extends object>({ query, variables, data, }: {
32
- query: string;
33
- variables: object;
34
- data: T;
35
- }): {
36
- data: T;
37
- isLoading: boolean;
38
- };
@@ -1,110 +0,0 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/sharedctx"), require("react")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/sharedctx", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP));
3
- })(this, function(exports2, sharedctx, React) {
4
- "use strict";
5
- const useEditState = sharedctx.useEditState;
6
- const TinaEditProvider = ({
7
- showEditButton,
8
- ...props
9
- }) => {
10
- return /* @__PURE__ */ React.createElement(sharedctx.EditProvider, null, showEditButton && /* @__PURE__ */ React.createElement(ToggleButton, null), /* @__PURE__ */ React.createElement(TinaEditProviderInner, { ...props }));
11
- };
12
- function useTina({
13
- query,
14
- variables,
15
- data
16
- }) {
17
- React.useEffect(() => {
18
- console.warn(`
19
- "useTina" from 'tinacms/dist/edit-state' is now deprecated
20
- * Use "import { useTina } from 'tinacms/dist/react" instead.
21
- * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
22
- `);
23
- }, []);
24
- const {
25
- setRequest,
26
- state,
27
- isDummyContainer,
28
- isLoading: contextLoading
29
- } = React.useContext(sharedctx.TinaDataContext);
30
- const [waitForContextRerender, setWaitForContextRerender] = React.useState(
31
- !isDummyContainer
32
- );
33
- const isLoading = contextLoading || waitForContextRerender;
34
- React.useEffect(() => {
35
- setRequest({ query, variables });
36
- }, [JSON.stringify(variables), query]);
37
- React.useEffect(() => {
38
- if (!isDummyContainer) {
39
- setTimeout(() => setWaitForContextRerender(false), 0);
40
- }
41
- return () => {
42
- setRequest(void 0);
43
- };
44
- }, [isDummyContainer]);
45
- return {
46
- data: isDummyContainer || isLoading ? data : state.payload,
47
- isLoading
48
- };
49
- }
50
- const ToggleButton = () => {
51
- const { edit } = useEditState();
52
- const [isOnAdmin, setIsOnAdmin] = React.useState(false);
53
- React.useEffect(() => {
54
- var _a;
55
- if (window) {
56
- if ((_a = window.location) == null ? void 0 : _a.pathname.startsWith("/admin")) {
57
- setIsOnAdmin(true);
58
- }
59
- }
60
- }, [setIsOnAdmin]);
61
- return edit || isOnAdmin ? null : /* @__PURE__ */ React.createElement(
62
- "div",
63
- {
64
- style: { position: "fixed", bottom: "56px", left: "0px", zIndex: 200 }
65
- },
66
- /* @__PURE__ */ React.createElement(
67
- "a",
68
- {
69
- href: "/admin",
70
- style: {
71
- borderRadius: "0 50px 50px 0",
72
- fontSize: "16px",
73
- fontFamily: "Inter, 'Helvetica Neue', 'Arial Nova', Helvetica, Arial, sans-serif",
74
- fontWeight: "bold",
75
- textDecoration: "none",
76
- background: "rgb(34, 150, 254)",
77
- boxShadow: "0px 1px 3px rgb(0 0 0 / 10%), 0px 2px 6px rgb(0 0 0 / 20%)",
78
- color: "white",
79
- padding: "14px 20px",
80
- border: "none"
81
- }
82
- },
83
- "Edit with Tina"
84
- )
85
- );
86
- };
87
- const TinaEditProviderInner = ({ children, editMode }) => {
88
- const { edit } = useEditState();
89
- const [isBrowser, setIsBrowser] = React.useState(false);
90
- React.useEffect(() => {
91
- setIsBrowser(true);
92
- }, []);
93
- if (edit && isBrowser) {
94
- return editMode;
95
- }
96
- return children;
97
- };
98
- Object.defineProperty(exports2, "isEditing", {
99
- enumerable: true,
100
- get: () => sharedctx.isEditing
101
- });
102
- Object.defineProperty(exports2, "setEditing", {
103
- enumerable: true,
104
- get: () => sharedctx.setEditing
105
- });
106
- exports2.TinaEditProvider = TinaEditProvider;
107
- exports2.useEditState = useEditState;
108
- exports2.useTina = useTina;
109
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
110
- });