tinacms 0.0.0-e0ddb8c-20241004065742 → 0.0.0-e1b6d05-20251114052813

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