tinacms 1.5.20 → 1.5.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,12 +1,4 @@
1
- Copyright (c) 2023-present Forestry.io Holdings Inc.
2
-
3
- Portions of the TinaCMS software are licensed as follows:
4
-
5
- * All software that resides under the "packages/@tinacms/datalayer/" and the "packages/@tinacms/graphql/" directories (the "Tina Data Layer"), is licensed under the license defined in "packages/@tinacms/datalayer/LICENSE".
6
-
7
- * All software outside of the above-mentioned directories is available under the "Apache 2.0" license as set forth below.
8
-
9
- Apache License
1
+ Apache License
10
2
  Version 2.0, January 2004
11
3
  http://www.apache.org/licenses/
12
4
 
package/dist/client.js CHANGED
@@ -7,12 +7,22 @@
7
7
  const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
8
8
  const TINA_HOST = "content.tinajs.io";
9
9
  class TinaClient {
10
- constructor({ token, url, queries }) {
10
+ constructor({
11
+ token,
12
+ url,
13
+ queries,
14
+ errorPolicy
15
+ }) {
11
16
  this.apiUrl = url;
12
17
  this.readonlyToken = token == null ? void 0 : token.trim();
13
18
  this.queries = queries(this);
19
+ this.errorPolicy = errorPolicy || "throw";
14
20
  }
15
- async request(args) {
21
+ async request({
22
+ errorPolicy,
23
+ ...args
24
+ }) {
25
+ const errorPolicyDefined = errorPolicy || this.errorPolicy;
16
26
  const headers = new HeadersDefined();
17
27
  if (this.readonlyToken) {
18
28
  headers.append("X-API-KEY", this.readonlyToken);
@@ -39,16 +49,16 @@
39
49
  );
40
50
  }
41
51
  const json = await res.json();
42
- if (json.errors) {
52
+ if (json.errors && errorPolicyDefined === "throw") {
43
53
  throw new Error(
44
54
  `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/
45
-
46
55
  Errors:
47
56
  ${json.errors.map((error) => error.message).join("\n")}`
48
57
  );
49
58
  }
50
59
  return {
51
60
  data: json == null ? void 0 : json.data,
61
+ errors: (json == null ? void 0 : json.errors) || null,
52
62
  query: args.query
53
63
  };
54
64
  }
package/dist/client.mjs CHANGED
@@ -4,12 +4,22 @@ const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
4
4
  const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
5
5
  const TINA_HOST = "content.tinajs.io";
6
6
  class TinaClient {
7
- constructor({ token, url, queries }) {
7
+ constructor({
8
+ token,
9
+ url,
10
+ queries,
11
+ errorPolicy
12
+ }) {
8
13
  this.apiUrl = url;
9
14
  this.readonlyToken = token == null ? void 0 : token.trim();
10
15
  this.queries = queries(this);
16
+ this.errorPolicy = errorPolicy || "throw";
11
17
  }
12
- async request(args) {
18
+ async request({
19
+ errorPolicy,
20
+ ...args
21
+ }) {
22
+ const errorPolicyDefined = errorPolicy || this.errorPolicy;
13
23
  const headers = new HeadersDefined();
14
24
  if (this.readonlyToken) {
15
25
  headers.append("X-API-KEY", this.readonlyToken);
@@ -36,16 +46,16 @@ class TinaClient {
36
46
  );
37
47
  }
38
48
  const json = await res.json();
39
- if (json.errors) {
49
+ if (json.errors && errorPolicyDefined === "throw") {
40
50
  throw new Error(
41
51
  `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/
42
-
43
52
  Errors:
44
53
  ${json.errors.map((error) => error.message).join("\n")}`
45
54
  );
46
55
  }
47
56
  return {
48
57
  data: json == null ? void 0 : json.data,
58
+ errors: (json == null ? void 0 : json.errors) || null,
49
59
  query: args.query
50
60
  };
51
61
  }
package/dist/dev-tools.js CHANGED
@@ -72,6 +72,7 @@
72
72
  return MNode;
73
73
  };
74
74
  const Node = ({ components, child }) => {
75
+ var _a, _b, _c, _d, _e;
75
76
  const { children, ...props } = child;
76
77
  switch (child.type) {
77
78
  case "h1":
@@ -147,6 +148,53 @@
147
148
  const props2 = child.props ? child.props : {};
148
149
  return /* @__PURE__ */ React.createElement(Component, { ...props2 });
149
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", { ...props2 }));
158
+ const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { ...props2 }));
159
+ return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
160
+ return /* @__PURE__ */ React.createElement(
161
+ TinaMarkdown,
162
+ {
163
+ key: i,
164
+ components: {
165
+ p: (props2) => {
166
+ if (ThComponent) {
167
+ return /* @__PURE__ */ React.createElement(ThComponent, { ...props2 });
168
+ } else {
169
+ return /* @__PURE__ */ React.createElement("th", { ...props2 });
170
+ }
171
+ }
172
+ },
173
+ content: c.tableCell
174
+ }
175
+ );
176
+ }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
177
+ var _a2;
178
+ return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
179
+ return /* @__PURE__ */ React.createElement(
180
+ TinaMarkdown,
181
+ {
182
+ key: i2,
183
+ components: {
184
+ p: (props2) => {
185
+ if (TdComponent) {
186
+ return /* @__PURE__ */ React.createElement(TdComponent, { ...props2 });
187
+ } else {
188
+ return /* @__PURE__ */ React.createElement("td", { ...props2 });
189
+ }
190
+ }
191
+ },
192
+ content: c.tableCell
193
+ }
194
+ );
195
+ }));
196
+ })));
197
+ }
150
198
  const ComponentMissing = components["component_missing"];
151
199
  if (ComponentMissing) {
152
200
  return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
@@ -69,6 +69,7 @@ const MemoNode = (props) => {
69
69
  return MNode;
70
70
  };
71
71
  const Node = ({ components, child }) => {
72
+ var _a, _b, _c, _d, _e;
72
73
  const { children, ...props } = child;
73
74
  switch (child.type) {
74
75
  case "h1":
@@ -144,6 +145,53 @@ const Node = ({ components, child }) => {
144
145
  const props2 = child.props ? child.props : {};
145
146
  return /* @__PURE__ */ React.createElement(Component, { ...props2 });
146
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", { ...props2 }));
155
+ const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { ...props2 }));
156
+ return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
157
+ return /* @__PURE__ */ React.createElement(
158
+ TinaMarkdown,
159
+ {
160
+ key: i,
161
+ components: {
162
+ p: (props2) => {
163
+ if (ThComponent) {
164
+ return /* @__PURE__ */ React.createElement(ThComponent, { ...props2 });
165
+ } else {
166
+ return /* @__PURE__ */ React.createElement("th", { ...props2 });
167
+ }
168
+ }
169
+ },
170
+ content: c.tableCell
171
+ }
172
+ );
173
+ }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
174
+ var _a2;
175
+ return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
176
+ return /* @__PURE__ */ React.createElement(
177
+ TinaMarkdown,
178
+ {
179
+ key: i2,
180
+ components: {
181
+ p: (props2) => {
182
+ if (TdComponent) {
183
+ return /* @__PURE__ */ React.createElement(TdComponent, { ...props2 });
184
+ } else {
185
+ return /* @__PURE__ */ React.createElement("td", { ...props2 });
186
+ }
187
+ }
188
+ },
189
+ content: c.tableCell
190
+ }
191
+ );
192
+ }));
193
+ })));
194
+ }
147
195
  const ComponentMissing = components["component_missing"];
148
196
  if (ComponentMissing) {
149
197
  return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export type { TinaCMSProviderDefaultProps };
19
19
  export default TinaCMSProvider2;
20
20
  import { MediaStore, TinaCMS } from '@tinacms/toolkit';
21
21
  import { formifyCallback } from './hooks/use-graphql-forms';
22
+ import { RichTextTemplate } from '@tinacms/schema-tools';
22
23
  export { NAMER, resolveField } from '@tinacms/schema-tools';
23
24
  import { TinaSchema, TinaField, Config, Schema, Collection, Template } from '@tinacms/schema-tools';
24
25
  export type { Config, Schema, Collection, Template, TinaField, TinaSchema };
@@ -57,3 +58,7 @@ interface MediaStoreClass {
57
58
  }
58
59
  export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>;
59
60
  export declare const defineConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>;
61
+ /**
62
+ * Out-of-the-box template for rendering basic markdown tables
63
+ */
64
+ export declare const tinaTableTemplate: RichTextTemplate;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/plate-headless"), require("@monaco-editor/react"), require("slate-react"), require("@headlessui/react"), require("slate"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("@radix-ui/react-popover"), require("react-color"), require("color-string"), require("react-dropzone"), require("is-hotkey"), require("@floating-ui/dom"), require("moment"), require("date-fns"), require("@react-hook/window-size"), require("@tinacms/sharedctx"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/plate-headless", "@monaco-editor/react", "slate-react", "@headlessui/react", "slate", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "@radix-ui/react-popover", "react-color", "color-string", "react-dropzone", "is-hotkey", "@floating-ui/dom", "moment", "date-fns", "@react-hook/window-size", "@tinacms/sharedctx", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
- })(this, function(exports2, zod, React, reactDom, plateHeadless, MonacoEditor, slateReact, react, slate, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, Popover$1, pkg$1, pkg, dropzone, isHotkey, dom, moment, dateFns, windowSize, sharedctx, graphql, gql$1, schemaTools, yup, core, reactRouterDom) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/plate-headless"), require("@monaco-editor/react"), require("slate-react"), require("@headlessui/react"), require("slate"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("@radix-ui/react-popover"), require("react-color"), require("color-string"), require("react-dropzone"), require("@tinacms/sharedctx"), require("is-hotkey"), require("@floating-ui/dom"), require("moment"), require("date-fns"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/plate-headless", "@monaco-editor/react", "slate-react", "@headlessui/react", "slate", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "@radix-ui/react-popover", "react-color", "color-string", "react-dropzone", "@tinacms/sharedctx", "is-hotkey", "@floating-ui/dom", "moment", "date-fns", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, zod, React, reactDom, plateHeadless, MonacoEditor, slateReact, react, slate, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, Popover$1, pkg$1, pkg, dropzone, sharedctx, isHotkey, dom, moment, dateFns, windowSize, graphql, gql$1, schemaTools, yup, core, reactRouterDom, mdx) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -2007,7 +2007,7 @@ var __publicField = (obj, key, value) => {
2007
2007
  }
2008
2008
  getFieldGroup({
2009
2009
  formOrObjectField,
2010
- values,
2010
+ values = {},
2011
2011
  namePathIndex,
2012
2012
  namePath
2013
2013
  }) {
@@ -2137,7 +2137,7 @@ var __publicField = (obj, key, value) => {
2137
2137
  };
2138
2138
  } else {
2139
2139
  const childrenIndex = namePathIndex + 1;
2140
- const propsIndex = namePath.findIndex((value2) => value2 === "props");
2140
+ const propsIndex = namePath.slice(childrenIndex).findIndex((value2) => value2 === "props") + childrenIndex;
2141
2141
  const itemName = namePath.slice(childrenIndex, propsIndex).join(".");
2142
2142
  const item = finalForm.getIn(value, itemName);
2143
2143
  const props = item.props;
@@ -9373,7 +9373,7 @@ var __publicField = (obj, key, value) => {
9373
9373
  /* @__PURE__ */ React.createElement("div", { className: "w-16 h-16 bg-gray-50 border-r border-gray-150 overflow-hidden flex justify-center flex-shrink-0" }, isImage(thumbnail) ? /* @__PURE__ */ React.createElement(
9374
9374
  "img",
9375
9375
  {
9376
- className: "object-cover w-full h-full object-center origin-center transition-all duration-150 ease-out group-hover:scale-110",
9376
+ className: "object-contain object-center w-full h-full origin-center transition-all duration-150 ease-out group-hover:scale-110",
9377
9377
  src: thumbnail,
9378
9378
  alt: item.filename
9379
9379
  }
@@ -9411,7 +9411,7 @@ var __publicField = (obj, key, value) => {
9411
9411
  isImage(thumbnail) ? /* @__PURE__ */ React.createElement(
9412
9412
  "img",
9413
9413
  {
9414
- className: "object-cover w-full h-full object-center",
9414
+ className: "object-contain object-center w-full h-full",
9415
9415
  src: thumbnail,
9416
9416
  alt: item.filename
9417
9417
  }
@@ -9901,7 +9901,7 @@ var __publicField = (obj, key, value) => {
9901
9901
  )), isImage(thumbnail) ? /* @__PURE__ */ React.createElement("div", { className: "w-full max-h-[75%]" }, /* @__PURE__ */ React.createElement(
9902
9902
  "img",
9903
9903
  {
9904
- className: "block border border-gray-100 rounded-md overflow-hidden max-w-full max-h-full object-fit h-auto shadow",
9904
+ className: "block border border-gray-100 rounded-md overflow-hidden object-center object-contain max-w-full max-h-full m-auto shadow",
9905
9905
  src: thumbnail,
9906
9906
  alt: activeItem.filename
9907
9907
  }
@@ -11105,7 +11105,7 @@ var __publicField = (obj, key, value) => {
11105
11105
  };
11106
11106
  const NestedForm = (props) => {
11107
11107
  const FormPortal = useFormPortal();
11108
- const id = React.useMemo(() => uuid(), [props.id]);
11108
+ const id = React.useMemo(() => uuid(), [props.id, props.initialValues]);
11109
11109
  const form = React.useMemo(() => {
11110
11110
  return new Form({
11111
11111
  ...props,
@@ -11116,7 +11116,7 @@ var __publicField = (obj, key, value) => {
11116
11116
  onSubmit: () => {
11117
11117
  }
11118
11118
  });
11119
- }, [id]);
11119
+ }, [id, props.onChange]);
11120
11120
  return /* @__PURE__ */ React.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React.createElement(GroupPanel, { isExpanded: true, style: { zIndex: zIndexShift + 1e3 } }, /* @__PURE__ */ React.createElement(PanelHeader$1, { onClick: props.onClose }, props.label), /* @__PURE__ */ React.createElement(FormBuilder, { form: { tinaForm: form }, hideFooter: true })));
11121
11121
  };
11122
11122
  const handleCloseBase = (editor, element) => {
@@ -11140,7 +11140,7 @@ var __publicField = (obj, key, value) => {
11140
11140
  React.useEffect(() => {
11141
11141
  const handleEnter = (e) => {
11142
11142
  if (selected) {
11143
- if (isHotkey(key, e)) {
11143
+ if (isHotkey.isHotkey(key, e)) {
11144
11144
  e.preventDefault();
11145
11145
  callback();
11146
11146
  }
@@ -11501,7 +11501,7 @@ var __publicField = (obj, key, value) => {
11501
11501
  if (!entry)
11502
11502
  return;
11503
11503
  rules.forEach(({ hotkey, query }) => {
11504
- if (isHotkey(hotkey, event) && plateHeadless.queryNode(entry, query)) {
11504
+ if (isHotkey.isHotkey(hotkey, event) && plateHeadless.queryNode(entry, query)) {
11505
11505
  event.preventDefault();
11506
11506
  event.stopPropagation();
11507
11507
  plateHeadless.insertNodes(
@@ -11997,26 +11997,38 @@ var __publicField = (obj, key, value) => {
11997
11997
  }
11998
11998
  plateHeadless.wrapNodes(editor, baseLink, { split: true });
11999
11999
  };
12000
+ const matchLink = (n) => !slate.Editor.isEditor(n) && slate.Element.isElement(n) && n.type === plateHeadless.ELEMENT_LINK;
12000
12001
  const LinkForm = (props) => {
12002
+ const [initialValues, setInitialValues] = React.useState({ url: "", title: "" });
12003
+ const [formValues, setFormValues] = React.useState({});
12001
12004
  const editor = plateHeadless.useEditorState();
12002
12005
  const selection = React.useMemo(() => editor.selection, []);
12003
- const handleChange = (values) => {
12006
+ React.useEffect(() => {
12007
+ const [link] = getLinks(editor);
12008
+ setInitialValues({
12009
+ url: link && link[0].url ? link[0].url : "",
12010
+ title: link && link[0].title ? link[0].title : ""
12011
+ });
12012
+ }, [editor, setInitialValues]);
12013
+ const handleUpdate = React.useCallback(() => {
12004
12014
  const linksInSelection = plateHeadless.getNodeEntries(editor, {
12005
- match: (n) => !slate.Editor.isEditor(n) && slate.Element.isElement(n) && n.type === plateHeadless.ELEMENT_LINK,
12015
+ match: matchLink,
12006
12016
  at: selection
12007
12017
  });
12008
12018
  if (linksInSelection) {
12009
12019
  for (const [, location] of linksInSelection) {
12010
- plateHeadless.setNodes(editor, values, {
12011
- match: (n) => {
12012
- return !slate.Editor.isEditor(n) && slate.Element.isElement(n) && n.type === plateHeadless.ELEMENT_LINK;
12013
- },
12020
+ plateHeadless.setNodes(editor, formValues, {
12021
+ match: matchLink,
12014
12022
  at: location
12015
12023
  });
12016
12024
  }
12017
12025
  }
12018
- };
12019
- const [link] = getLinks(editor);
12026
+ props.onClose();
12027
+ }, [editor, formValues]);
12028
+ const UpdateLink = React.useCallback(
12029
+ () => /* @__PURE__ */ React.createElement(Button, { variant: "primary", onClick: handleUpdate }, "Update Link"),
12030
+ [handleUpdate]
12031
+ );
12020
12032
  return /* @__PURE__ */ React.createElement(
12021
12033
  NestedForm,
12022
12034
  {
@@ -12024,32 +12036,35 @@ var __publicField = (obj, key, value) => {
12024
12036
  label: "Link",
12025
12037
  fields: [
12026
12038
  { label: "URL", name: "url", component: "text" },
12027
- { label: "Title", name: "title", component: "text" }
12039
+ { label: "Title", name: "title", component: "text" },
12040
+ { component: UpdateLink, name: "update" }
12028
12041
  ],
12029
- initialValues: {
12030
- url: link ? link[0].url : "",
12031
- title: link ? link[0].title : ""
12032
- },
12033
- onChange: handleChange,
12034
- onClose: props.onClose
12042
+ initialValues,
12043
+ onChange: (values) => setFormValues(values),
12044
+ onClose: () => {
12045
+ if (initialValues.title === "" && initialValues.url === "") {
12046
+ unwrapLink(editor, selection);
12047
+ }
12048
+ props.onClose();
12049
+ }
12035
12050
  }
12036
12051
  );
12037
12052
  };
12038
- const isLinkActive = (editor) => {
12039
- const [link] = getLinks(editor);
12040
- return !!link;
12041
- };
12042
12053
  const unwrapLink = (editor, selection) => {
12043
12054
  plateHeadless.unwrapNodes(editor, {
12044
- match: (n) => !slate.Editor.isEditor(n) && slate.Element.isElement(n) && n.type === plateHeadless.ELEMENT_LINK,
12055
+ match: matchLink,
12045
12056
  at: selection || void 0
12046
12057
  });
12047
12058
  };
12048
12059
  const getLinks = (editor) => {
12049
12060
  return plateHeadless.getNodeEntries(editor, {
12050
- match: (n) => !slate.Editor.isEditor(n) && slate.Element.isElement(n) && n.type === plateHeadless.ELEMENT_LINK
12061
+ match: matchLink
12051
12062
  });
12052
12063
  };
12064
+ const isLinkActive = (editor) => {
12065
+ const [link] = getLinks(editor);
12066
+ return !!link;
12067
+ };
12053
12068
  const ToolbarItem = ({
12054
12069
  hidden,
12055
12070
  label,
@@ -26220,7 +26235,7 @@ var __publicField = (obj, key, value) => {
26220
26235
  data["_id"] = `${collection.name}:${relPath}`;
26221
26236
  data["_relativePath"] = relPath;
26222
26237
  }
26223
- for (const f of collection.fields || (field == null ? void 0 : field.fields) || []) {
26238
+ for (const f of (field == null ? void 0 : field.fields) || collection.fields || []) {
26224
26239
  if (!f.searchable) {
26225
26240
  delete data[f.name];
26226
26241
  continue;
@@ -30501,6 +30516,70 @@ This will work when developing locally but NOT when deployed to production.
30501
30516
  return config;
30502
30517
  };
30503
30518
  const defineConfig = defineStaticConfig;
30519
+ const tinaTableTemplate = {
30520
+ name: "table",
30521
+ label: "Table",
30522
+ fields: [
30523
+ {
30524
+ name: "firstRowHeader",
30525
+ label: "First row is a header",
30526
+ type: "boolean"
30527
+ },
30528
+ {
30529
+ name: "tableRows",
30530
+ label: "Rows",
30531
+ type: "object",
30532
+ list: true,
30533
+ ui: {
30534
+ itemProps: (value) => {
30535
+ if (value == null ? void 0 : value.tableCells) {
30536
+ if (Array.isArray(value.tableCells)) {
30537
+ return {
30538
+ label: value.tableCells.map((cellItem) => {
30539
+ var _a;
30540
+ return (_a = stringifyCell(cellItem.tableCell)) == null ? void 0 : _a.trim();
30541
+ }).join(" | ")
30542
+ };
30543
+ }
30544
+ }
30545
+ return { label: "Row" };
30546
+ }
30547
+ },
30548
+ fields: [
30549
+ {
30550
+ name: "tableCells",
30551
+ label: "Table Cells",
30552
+ list: true,
30553
+ type: "object",
30554
+ ui: {
30555
+ itemProps: (value) => {
30556
+ var _a;
30557
+ if (value) {
30558
+ if (value.tableCell) {
30559
+ return {
30560
+ label: (_a = stringifyCell(value.tableCell)) == null ? void 0 : _a.trim()
30561
+ };
30562
+ }
30563
+ }
30564
+ return { label: "Table Cell" };
30565
+ }
30566
+ },
30567
+ fields: [
30568
+ {
30569
+ label: "Table Cell",
30570
+ description: "Note: table cells do not support block-level elements like headers, code blocks, or lists. Any block-level items other than the first paragraph will be ignored.",
30571
+ name: "tableCell",
30572
+ type: "rich-text"
30573
+ }
30574
+ ]
30575
+ }
30576
+ ]
30577
+ }
30578
+ ]
30579
+ };
30580
+ const stringifyCell = (cell) => {
30581
+ return mdx.stringifyMDX(cell, { name: "body", type: "rich-text" }, () => "");
30582
+ };
30504
30583
  Object.defineProperty(exports2, "NAMER", {
30505
30584
  enumerable: true,
30506
30585
  get: () => schemaTools.NAMER
@@ -30713,6 +30792,7 @@ This will work when developing locally but NOT when deployed to production.
30713
30792
  exports2.selectFieldClasses = selectFieldClasses;
30714
30793
  exports2.staticRequest = staticRequest;
30715
30794
  exports2.textFieldClasses = textFieldClasses;
30795
+ exports2.tinaTableTemplate = tinaTableTemplate;
30716
30796
  exports2.useBranchData = useBranchData;
30717
30797
  exports2.useCMS = useCMS$1;
30718
30798
  exports2.useDismissible = useDismissible;
package/dist/index.mjs CHANGED
@@ -23,12 +23,12 @@ import * as Popover$1 from "@radix-ui/react-popover";
23
23
  import * as pkg$1 from "react-color";
24
24
  import * as pkg from "color-string";
25
25
  import * as dropzone from "react-dropzone";
26
- import isHotkey from "is-hotkey";
26
+ import { EditContext, useEditState, setEditing } from "@tinacms/sharedctx";
27
+ import { isHotkey } from "is-hotkey";
27
28
  import { computePosition, flip, shift } from "@floating-ui/dom";
28
29
  import moment from "moment";
29
30
  import { formatDistanceToNow } from "date-fns";
30
31
  import { useWindowWidth } from "@react-hook/window-size";
31
- import { EditContext, useEditState, setEditing } from "@tinacms/sharedctx";
32
32
  import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buildSchema } from "graphql";
33
33
  import gql$1 from "graphql-tag";
34
34
  import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
@@ -36,6 +36,7 @@ import { NAMER, resolveField } from "@tinacms/schema-tools";
36
36
  import * as yup from "yup";
37
37
  import { diff } from "@graphql-inspector/core";
38
38
  import { NavLink, useSearchParams, useNavigate, useLocation, useParams, Link, HashRouter, Routes, Route } from "react-router-dom";
39
+ import { stringifyMDX } from "@tinacms/mdx";
39
40
  function popupWindow(url, title, window2, w, h) {
40
41
  const y = window2.top.outerHeight / 2 + window2.top.screenY - h / 2;
41
42
  const x = window2.top.outerWidth / 2 + window2.top.screenX - w / 2;
@@ -2013,7 +2014,7 @@ class Form {
2013
2014
  }
2014
2015
  getFieldGroup({
2015
2016
  formOrObjectField,
2016
- values,
2017
+ values = {},
2017
2018
  namePathIndex,
2018
2019
  namePath
2019
2020
  }) {
@@ -2143,7 +2144,7 @@ class Form {
2143
2144
  };
2144
2145
  } else {
2145
2146
  const childrenIndex = namePathIndex + 1;
2146
- const propsIndex = namePath.findIndex((value2) => value2 === "props");
2147
+ const propsIndex = namePath.slice(childrenIndex).findIndex((value2) => value2 === "props") + childrenIndex;
2147
2148
  const itemName = namePath.slice(childrenIndex, propsIndex).join(".");
2148
2149
  const item = getIn(value, itemName);
2149
2150
  const props = item.props;
@@ -9379,7 +9380,7 @@ function ListMediaItem({ item, onClick, active }) {
9379
9380
  /* @__PURE__ */ React__default.createElement("div", { className: "w-16 h-16 bg-gray-50 border-r border-gray-150 overflow-hidden flex justify-center flex-shrink-0" }, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement(
9380
9381
  "img",
9381
9382
  {
9382
- className: "object-cover w-full h-full object-center origin-center transition-all duration-150 ease-out group-hover:scale-110",
9383
+ className: "object-contain object-center w-full h-full origin-center transition-all duration-150 ease-out group-hover:scale-110",
9383
9384
  src: thumbnail,
9384
9385
  alt: item.filename
9385
9386
  }
@@ -9417,7 +9418,7 @@ function GridMediaItem({ item, active, onClick }) {
9417
9418
  isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement(
9418
9419
  "img",
9419
9420
  {
9420
- className: "object-cover w-full h-full object-center",
9421
+ className: "object-contain object-center w-full h-full",
9421
9422
  src: thumbnail,
9422
9423
  alt: item.filename
9423
9424
  }
@@ -9907,7 +9908,7 @@ const ActiveItemPreview = ({
9907
9908
  )), isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("div", { className: "w-full max-h-[75%]" }, /* @__PURE__ */ React__default.createElement(
9908
9909
  "img",
9909
9910
  {
9910
- className: "block border border-gray-100 rounded-md overflow-hidden max-w-full max-h-full object-fit h-auto shadow",
9911
+ className: "block border border-gray-100 rounded-md overflow-hidden object-center object-contain max-w-full max-h-full m-auto shadow",
9911
9912
  src: thumbnail,
9912
9913
  alt: activeItem.filename
9913
9914
  }
@@ -11111,7 +11112,7 @@ const PrefixedTextField = ({ prefix = "tina/", ...props }) => {
11111
11112
  };
11112
11113
  const NestedForm = (props) => {
11113
11114
  const FormPortal = useFormPortal();
11114
- const id = React__default.useMemo(() => uuid(), [props.id]);
11115
+ const id = React__default.useMemo(() => uuid(), [props.id, props.initialValues]);
11115
11116
  const form = React__default.useMemo(() => {
11116
11117
  return new Form({
11117
11118
  ...props,
@@ -11122,7 +11123,7 @@ const NestedForm = (props) => {
11122
11123
  onSubmit: () => {
11123
11124
  }
11124
11125
  });
11125
- }, [id]);
11126
+ }, [id, props.onChange]);
11126
11127
  return /* @__PURE__ */ React__default.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__default.createElement(GroupPanel, { isExpanded: true, style: { zIndex: zIndexShift + 1e3 } }, /* @__PURE__ */ React__default.createElement(PanelHeader$1, { onClick: props.onClose }, props.label), /* @__PURE__ */ React__default.createElement(FormBuilder, { form: { tinaForm: form }, hideFooter: true })));
11127
11128
  };
11128
11129
  const handleCloseBase = (editor, element) => {
@@ -12003,26 +12004,38 @@ const wrapOrRewrapLink = (editor) => {
12003
12004
  }
12004
12005
  wrapNodes(editor, baseLink, { split: true });
12005
12006
  };
12007
+ const matchLink = (n) => !Editor.isEditor(n) && Element.isElement(n) && n.type === ELEMENT_LINK;
12006
12008
  const LinkForm = (props) => {
12009
+ const [initialValues, setInitialValues] = React__default.useState({ url: "", title: "" });
12010
+ const [formValues, setFormValues] = React__default.useState({});
12007
12011
  const editor = useEditorState();
12008
12012
  const selection = React__default.useMemo(() => editor.selection, []);
12009
- const handleChange = (values) => {
12013
+ useEffect(() => {
12014
+ const [link] = getLinks(editor);
12015
+ setInitialValues({
12016
+ url: link && link[0].url ? link[0].url : "",
12017
+ title: link && link[0].title ? link[0].title : ""
12018
+ });
12019
+ }, [editor, setInitialValues]);
12020
+ const handleUpdate = React__default.useCallback(() => {
12010
12021
  const linksInSelection = getNodeEntries(editor, {
12011
- match: (n) => !Editor.isEditor(n) && Element.isElement(n) && n.type === ELEMENT_LINK,
12022
+ match: matchLink,
12012
12023
  at: selection
12013
12024
  });
12014
12025
  if (linksInSelection) {
12015
12026
  for (const [, location] of linksInSelection) {
12016
- setNodes(editor, values, {
12017
- match: (n) => {
12018
- return !Editor.isEditor(n) && Element.isElement(n) && n.type === ELEMENT_LINK;
12019
- },
12027
+ setNodes(editor, formValues, {
12028
+ match: matchLink,
12020
12029
  at: location
12021
12030
  });
12022
12031
  }
12023
12032
  }
12024
- };
12025
- const [link] = getLinks(editor);
12033
+ props.onClose();
12034
+ }, [editor, formValues]);
12035
+ const UpdateLink = React__default.useCallback(
12036
+ () => /* @__PURE__ */ React__default.createElement(Button, { variant: "primary", onClick: handleUpdate }, "Update Link"),
12037
+ [handleUpdate]
12038
+ );
12026
12039
  return /* @__PURE__ */ React__default.createElement(
12027
12040
  NestedForm,
12028
12041
  {
@@ -12030,32 +12043,35 @@ const LinkForm = (props) => {
12030
12043
  label: "Link",
12031
12044
  fields: [
12032
12045
  { label: "URL", name: "url", component: "text" },
12033
- { label: "Title", name: "title", component: "text" }
12046
+ { label: "Title", name: "title", component: "text" },
12047
+ { component: UpdateLink, name: "update" }
12034
12048
  ],
12035
- initialValues: {
12036
- url: link ? link[0].url : "",
12037
- title: link ? link[0].title : ""
12038
- },
12039
- onChange: handleChange,
12040
- onClose: props.onClose
12049
+ initialValues,
12050
+ onChange: (values) => setFormValues(values),
12051
+ onClose: () => {
12052
+ if (initialValues.title === "" && initialValues.url === "") {
12053
+ unwrapLink(editor, selection);
12054
+ }
12055
+ props.onClose();
12056
+ }
12041
12057
  }
12042
12058
  );
12043
12059
  };
12044
- const isLinkActive = (editor) => {
12045
- const [link] = getLinks(editor);
12046
- return !!link;
12047
- };
12048
12060
  const unwrapLink = (editor, selection) => {
12049
12061
  unwrapNodes(editor, {
12050
- match: (n) => !Editor.isEditor(n) && Element.isElement(n) && n.type === ELEMENT_LINK,
12062
+ match: matchLink,
12051
12063
  at: selection || void 0
12052
12064
  });
12053
12065
  };
12054
12066
  const getLinks = (editor) => {
12055
12067
  return getNodeEntries(editor, {
12056
- match: (n) => !Editor.isEditor(n) && Element.isElement(n) && n.type === ELEMENT_LINK
12068
+ match: matchLink
12057
12069
  });
12058
12070
  };
12071
+ const isLinkActive = (editor) => {
12072
+ const [link] = getLinks(editor);
12073
+ return !!link;
12074
+ };
12059
12075
  const ToolbarItem = ({
12060
12076
  hidden,
12061
12077
  label,
@@ -26226,7 +26242,7 @@ const processDocumentForIndexing = (data, path, collection, textIndexLength, fie
26226
26242
  data["_id"] = `${collection.name}:${relPath}`;
26227
26243
  data["_relativePath"] = relPath;
26228
26244
  }
26229
- for (const f of collection.fields || (field == null ? void 0 : field.fields) || []) {
26245
+ for (const f of (field == null ? void 0 : field.fields) || collection.fields || []) {
26230
26246
  if (!f.searchable) {
26231
26247
  delete data[f.name];
26232
26248
  continue;
@@ -30507,6 +30523,70 @@ const defineStaticConfig = (config) => {
30507
30523
  return config;
30508
30524
  };
30509
30525
  const defineConfig = defineStaticConfig;
30526
+ const tinaTableTemplate = {
30527
+ name: "table",
30528
+ label: "Table",
30529
+ fields: [
30530
+ {
30531
+ name: "firstRowHeader",
30532
+ label: "First row is a header",
30533
+ type: "boolean"
30534
+ },
30535
+ {
30536
+ name: "tableRows",
30537
+ label: "Rows",
30538
+ type: "object",
30539
+ list: true,
30540
+ ui: {
30541
+ itemProps: (value) => {
30542
+ if (value == null ? void 0 : value.tableCells) {
30543
+ if (Array.isArray(value.tableCells)) {
30544
+ return {
30545
+ label: value.tableCells.map((cellItem) => {
30546
+ var _a;
30547
+ return (_a = stringifyCell(cellItem.tableCell)) == null ? void 0 : _a.trim();
30548
+ }).join(" | ")
30549
+ };
30550
+ }
30551
+ }
30552
+ return { label: "Row" };
30553
+ }
30554
+ },
30555
+ fields: [
30556
+ {
30557
+ name: "tableCells",
30558
+ label: "Table Cells",
30559
+ list: true,
30560
+ type: "object",
30561
+ ui: {
30562
+ itemProps: (value) => {
30563
+ var _a;
30564
+ if (value) {
30565
+ if (value.tableCell) {
30566
+ return {
30567
+ label: (_a = stringifyCell(value.tableCell)) == null ? void 0 : _a.trim()
30568
+ };
30569
+ }
30570
+ }
30571
+ return { label: "Table Cell" };
30572
+ }
30573
+ },
30574
+ fields: [
30575
+ {
30576
+ label: "Table Cell",
30577
+ description: "Note: table cells do not support block-level elements like headers, code blocks, or lists. Any block-level items other than the first paragraph will be ignored.",
30578
+ name: "tableCell",
30579
+ type: "rich-text"
30580
+ }
30581
+ ]
30582
+ }
30583
+ ]
30584
+ }
30585
+ ]
30586
+ };
30587
+ const stringifyCell = (cell) => {
30588
+ return stringifyMDX(cell, { name: "body", type: "rich-text" }, () => "");
30589
+ };
30510
30590
  export {
30511
30591
  ActionButton,
30512
30592
  AddIcon,
@@ -30714,6 +30794,7 @@ export {
30714
30794
  selectFieldClasses,
30715
30795
  staticRequest,
30716
30796
  textFieldClasses,
30797
+ tinaTableTemplate,
30717
30798
  useBranchData,
30718
30799
  useCMS$1 as useCMS,
30719
30800
  useDismissible,
@@ -81,6 +81,18 @@ declare type BaseComponents = {
81
81
  html_inline?: {
82
82
  value: string;
83
83
  };
84
+ th?: {
85
+ children: JSX.Element;
86
+ };
87
+ td?: {
88
+ children: JSX.Element;
89
+ };
90
+ tr?: {
91
+ children: JSX.Element;
92
+ };
93
+ table?: {
94
+ children: JSX.Element;
95
+ };
84
96
  component_missing?: {
85
97
  name: string;
86
98
  };
@@ -72,6 +72,7 @@
72
72
  return MNode;
73
73
  };
74
74
  const Node = ({ components, child }) => {
75
+ var _a, _b, _c, _d, _e;
75
76
  const { children, ...props } = child;
76
77
  switch (child.type) {
77
78
  case "h1":
@@ -147,6 +148,53 @@
147
148
  const props2 = child.props ? child.props : {};
148
149
  return /* @__PURE__ */ React.createElement(Component, { ...props2 });
149
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", { ...props2 }));
158
+ const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { ...props2 }));
159
+ return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
160
+ return /* @__PURE__ */ React.createElement(
161
+ TinaMarkdown,
162
+ {
163
+ key: i,
164
+ components: {
165
+ p: (props2) => {
166
+ if (ThComponent) {
167
+ return /* @__PURE__ */ React.createElement(ThComponent, { ...props2 });
168
+ } else {
169
+ return /* @__PURE__ */ React.createElement("th", { ...props2 });
170
+ }
171
+ }
172
+ },
173
+ content: c.tableCell
174
+ }
175
+ );
176
+ }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
177
+ var _a2;
178
+ return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
179
+ return /* @__PURE__ */ React.createElement(
180
+ TinaMarkdown,
181
+ {
182
+ key: i2,
183
+ components: {
184
+ p: (props2) => {
185
+ if (TdComponent) {
186
+ return /* @__PURE__ */ React.createElement(TdComponent, { ...props2 });
187
+ } else {
188
+ return /* @__PURE__ */ React.createElement("td", { ...props2 });
189
+ }
190
+ }
191
+ },
192
+ content: c.tableCell
193
+ }
194
+ );
195
+ }));
196
+ })));
197
+ }
150
198
  const ComponentMissing = components["component_missing"];
151
199
  if (ComponentMissing) {
152
200
  return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
@@ -69,6 +69,7 @@ const MemoNode = (props) => {
69
69
  return MNode;
70
70
  };
71
71
  const Node = ({ components, child }) => {
72
+ var _a, _b, _c, _d, _e;
72
73
  const { children, ...props } = child;
73
74
  switch (child.type) {
74
75
  case "h1":
@@ -144,6 +145,53 @@ const Node = ({ components, child }) => {
144
145
  const props2 = child.props ? child.props : {};
145
146
  return /* @__PURE__ */ React.createElement(Component, { ...props2 });
146
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", { ...props2 }));
155
+ const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { ...props2 }));
156
+ return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
157
+ return /* @__PURE__ */ React.createElement(
158
+ TinaMarkdown,
159
+ {
160
+ key: i,
161
+ components: {
162
+ p: (props2) => {
163
+ if (ThComponent) {
164
+ return /* @__PURE__ */ React.createElement(ThComponent, { ...props2 });
165
+ } else {
166
+ return /* @__PURE__ */ React.createElement("th", { ...props2 });
167
+ }
168
+ }
169
+ },
170
+ content: c.tableCell
171
+ }
172
+ );
173
+ }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
174
+ var _a2;
175
+ return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
176
+ return /* @__PURE__ */ React.createElement(
177
+ TinaMarkdown,
178
+ {
179
+ key: i2,
180
+ components: {
181
+ p: (props2) => {
182
+ if (TdComponent) {
183
+ return /* @__PURE__ */ React.createElement(TdComponent, { ...props2 });
184
+ } else {
185
+ return /* @__PURE__ */ React.createElement("td", { ...props2 });
186
+ }
187
+ }
188
+ },
189
+ content: c.tableCell
190
+ }
191
+ );
192
+ }));
193
+ })));
194
+ }
147
195
  const ComponentMissing = components["component_missing"];
148
196
  if (ComponentMissing) {
149
197
  return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
@@ -9,6 +9,6 @@ declare type LinkElement = {
9
9
  };
10
10
  export declare const wrapOrRewrapLink: (editor: any) => void;
11
11
  export declare const LinkForm: (props: any) => JSX.Element;
12
- export declare const isLinkActive: (editor: any) => boolean;
13
12
  export declare const unwrapLink: (editor: PlateEditor, selection?: BaseRange) => void;
14
13
  export declare const getLinks: (editor: any) => Generator<import("@udecode/plate-headless").TNodeEntry<LinkElement>, void, undefined>;
14
+ export declare const isLinkActive: (editor: any) => boolean;
@@ -1,12 +1,16 @@
1
+ import type { GraphQLError } from 'graphql';
2
+ import type { Config } from '@tinacms/schema-tools';
1
3
  export declare const TINA_HOST = "content.tinajs.io";
2
4
  export interface TinaClientArgs<GenQueries = Record<string, unknown>> {
3
5
  url: string;
4
6
  token?: string;
5
7
  queries: (client: TinaClient<GenQueries>) => GenQueries;
8
+ errorPolicy?: Config['client']['errorPolicy'];
6
9
  }
7
10
  export declare type TinaClientRequestArgs = {
8
11
  variables?: Record<string, any>;
9
12
  query: string;
13
+ errorPolicy?: 'throw' | 'include';
10
14
  } & Partial<Omit<TinaClientArgs, 'queries'>>;
11
15
  export declare type TinaClientURLParts = {
12
16
  host: string;
@@ -17,13 +21,12 @@ export declare type TinaClientURLParts = {
17
21
  export declare class TinaClient<GenQueries> {
18
22
  apiUrl: string;
19
23
  readonlyToken?: string;
20
- /**
21
- *
22
- */
23
24
  queries: GenQueries;
24
- constructor({ token, url, queries }: TinaClientArgs<GenQueries>);
25
- request<DataType extends Record<string, any> = any>(args: TinaClientRequestArgs): Promise<{
25
+ errorPolicy: Config['client']['errorPolicy'];
26
+ constructor({ token, url, queries, errorPolicy, }: TinaClientArgs<GenQueries>);
27
+ request<DataType extends Record<string, any> = any>({ errorPolicy, ...args }: TinaClientRequestArgs): Promise<{
26
28
  data: DataType;
29
+ errors: GraphQLError[];
27
30
  query: string;
28
31
  }>;
29
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.5.20",
3
+ "version": "1.5.22",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -69,8 +69,9 @@
69
69
  "@react-types/combobox": "^3.2.0",
70
70
  "@react-types/shared": "^3.10.0",
71
71
  "@sambego/storybook-styles": "^1.0.0",
72
- "@tinacms/schema-tools": "1.4.12",
73
- "@tinacms/search": "1.0.10",
72
+ "@tinacms/schema-tools": "1.4.13",
73
+ "@tinacms/search": "1.0.12",
74
+ "@tinacms/mdx": "1.3.20",
74
75
  "@tinacms/sharedctx": "1.0.2",
75
76
  "@udecode/plate-headless": "^21.4.0",
76
77
  "atob": "2.1.2",