tinacms 1.5.0 → 1.5.1

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/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export type { TinaCMSProviderDefaultProps };
17
17
  export default TinaCMSProvider2;
18
18
  import { MediaStore, TinaCMS } from '@tinacms/toolkit';
19
19
  import { formifyCallback } from './hooks/use-graphql-forms';
20
- export { NAMER, resolveForm } from '@tinacms/schema-tools';
20
+ export { NAMER, resolveField } from '@tinacms/schema-tools';
21
21
  import { TinaSchema, TinaField, Config, Schema, Collection, Template } from '@tinacms/schema-tools';
22
22
  export type { Config, Schema, Collection, Template, TinaField, TinaSchema };
23
23
  /**
package/dist/index.es.js CHANGED
@@ -5,7 +5,7 @@ export { MdxFieldPluginExtendible } from "@tinacms/toolkit";
5
5
  import { getIntrospectionQuery, buildClientSchema, print, parse, buildSchema } from "graphql";
6
6
  import gql$1 from "graphql-tag";
7
7
  import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
8
- export { NAMER, resolveForm } from "@tinacms/schema-tools";
8
+ export { NAMER, resolveField } from "@tinacms/schema-tools";
9
9
  import React, { useState, useCallback, useEffect, Fragment, useMemo } from "react";
10
10
  import * as yup from "yup";
11
11
  import { setEditing, useEditState } from "@tinacms/sharedctx";
@@ -3172,11 +3172,7 @@ const GetCollection = ({
3172
3172
  const allowDelete = (_f = (_e = (_d = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _d.allowedActions) == null ? void 0 : _e.delete) != null ? _f : true;
3173
3173
  if (!allowCreate && !allowDelete && ((_h = (_g = collection.documents) == null ? void 0 : _g.edges) == null ? void 0 : _h.length) === 1) {
3174
3174
  const doc = collection.documents.edges[0].node;
3175
- const pathToDoc = doc._sys.breadcrumbs;
3176
- if (folder.fullyQualifiedName) {
3177
- pathToDoc.unshift("~");
3178
- }
3179
- navigate(`/${["collections", "edit", collectionName, ...pathToDoc].join("/")}`, { replace: true });
3175
+ handleNavigate(navigate, cms, collection, collectionDefinition, doc);
3180
3176
  }
3181
3177
  }, [(collection == null ? void 0 : collection.name) || "", loading]);
3182
3178
  if (error) {
package/dist/index.js CHANGED
@@ -3187,11 +3187,7 @@ This will work when developing locally but NOT when deployed to production.
3187
3187
  const allowDelete = (_f = (_e = (_d = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _d.allowedActions) == null ? void 0 : _e.delete) != null ? _f : true;
3188
3188
  if (!allowCreate && !allowDelete && ((_h = (_g = collection.documents) == null ? void 0 : _g.edges) == null ? void 0 : _h.length) === 1) {
3189
3189
  const doc = collection.documents.edges[0].node;
3190
- const pathToDoc = doc._sys.breadcrumbs;
3191
- if (folder.fullyQualifiedName) {
3192
- pathToDoc.unshift("~");
3193
- }
3194
- navigate(`/${["collections", "edit", collectionName, ...pathToDoc].join("/")}`, { replace: true });
3190
+ handleNavigate(navigate, cms, collection, collectionDefinition, doc);
3195
3191
  }
3196
3192
  }, [(collection == null ? void 0 : collection.name) || "", loading]);
3197
3193
  if (error) {
@@ -4585,10 +4581,10 @@ This will work when developing locally but NOT when deployed to production.
4585
4581
  return schemaTools.NAMER;
4586
4582
  }
4587
4583
  });
4588
- Object.defineProperty(exports2, "resolveForm", {
4584
+ Object.defineProperty(exports2, "resolveField", {
4589
4585
  enumerable: true,
4590
4586
  get: function() {
4591
- return schemaTools.resolveForm;
4587
+ return schemaTools.resolveField;
4592
4588
  }
4593
4589
  });
4594
4590
  exports2.AuthWallInner = AuthWallInner;
package/dist/react.d.ts CHANGED
@@ -8,6 +8,7 @@ export declare function useTina<T extends object>(props: {
8
8
  data: T;
9
9
  }): {
10
10
  data: T;
11
+ isClient: boolean;
11
12
  };
12
13
  export declare function useEditState(): {
13
14
  edit: boolean;
@@ -18,7 +19,7 @@ export declare function useEditState(): {
18
19
  * is working with.
19
20
  */
20
21
  export declare const tinaField: <T extends object & {
21
- __meta__?: {
22
+ _tina_metadata?: {
22
23
  id: string;
23
24
  name?: string;
24
25
  fields: Record<string, string>;
package/dist/react.es.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  function useTina(props) {
3
3
  const [data, setData] = React.useState(props.data);
4
+ const [isClient, setIsClient] = React.useState(false);
4
5
  const id = JSON.stringify({ query: props.query, variables: props.variables });
5
6
  React.useEffect(() => {
7
+ setIsClient(true);
6
8
  setData(props.data);
7
9
  }, [id]);
8
10
  React.useEffect(() => {
@@ -12,9 +14,11 @@ function useTina(props) {
12
14
  setData(event.data.data);
13
15
  }
14
16
  });
15
- return () => parent.postMessage({ type: "close", id }, window.location.origin);
17
+ return () => {
18
+ parent.postMessage({ type: "close", id }, window.location.origin);
19
+ };
16
20
  }, [id]);
17
- return { data };
21
+ return { data, isClient };
18
22
  }
19
23
  function useEditState() {
20
24
  const [edit, setEdit] = React.useState(false);
@@ -34,11 +38,11 @@ function useEditState() {
34
38
  const tinaField = (obj, field) => {
35
39
  var _a, _b, _c;
36
40
  if (!field) {
37
- return `${(_a = obj.__meta__) == null ? void 0 : _a.id}#${(_b = obj.__meta__) == null ? void 0 : _b.name}`;
41
+ return `${(_a = obj._tina_metadata) == null ? void 0 : _a.id}#${(_b = obj._tina_metadata) == null ? void 0 : _b.name}`;
38
42
  }
39
- if (obj == null ? void 0 : obj.__meta__) {
43
+ if (obj == null ? void 0 : obj._tina_metadata) {
40
44
  if (typeof field === "string") {
41
- return `${(_c = obj.__meta__) == null ? void 0 : _c.id}#${obj.__meta__.fields[field]}`;
45
+ return `${(_c = obj._tina_metadata) == null ? void 0 : _c.id}#${obj._tina_metadata.fields[field]}`;
42
46
  }
43
47
  }
44
48
  return "";
package/dist/react.js CHANGED
@@ -8,8 +8,10 @@
8
8
  var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
9
9
  function useTina(props) {
10
10
  const [data, setData] = React__default["default"].useState(props.data);
11
+ const [isClient, setIsClient] = React__default["default"].useState(false);
11
12
  const id = JSON.stringify({ query: props.query, variables: props.variables });
12
13
  React__default["default"].useEffect(() => {
14
+ setIsClient(true);
13
15
  setData(props.data);
14
16
  }, [id]);
15
17
  React__default["default"].useEffect(() => {
@@ -19,9 +21,11 @@
19
21
  setData(event.data.data);
20
22
  }
21
23
  });
22
- return () => parent.postMessage({ type: "close", id }, window.location.origin);
24
+ return () => {
25
+ parent.postMessage({ type: "close", id }, window.location.origin);
26
+ };
23
27
  }, [id]);
24
- return { data };
28
+ return { data, isClient };
25
29
  }
26
30
  function useEditState() {
27
31
  const [edit, setEdit] = React__default["default"].useState(false);
@@ -41,11 +45,11 @@
41
45
  const tinaField = (obj, field) => {
42
46
  var _a, _b, _c;
43
47
  if (!field) {
44
- return `${(_a = obj.__meta__) == null ? void 0 : _a.id}#${(_b = obj.__meta__) == null ? void 0 : _b.name}`;
48
+ return `${(_a = obj._tina_metadata) == null ? void 0 : _a.id}#${(_b = obj._tina_metadata) == null ? void 0 : _b.name}`;
45
49
  }
46
- if (obj == null ? void 0 : obj.__meta__) {
50
+ if (obj == null ? void 0 : obj._tina_metadata) {
47
51
  if (typeof field === "string") {
48
- return `${(_c = obj.__meta__) == null ? void 0 : _c.id}#${obj.__meta__.fields[field]}`;
52
+ return `${(_c = obj._tina_metadata) == null ? void 0 : _c.id}#${obj._tina_metadata.fields[field]}`;
49
53
  }
50
54
  }
51
55
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -58,7 +58,7 @@
58
58
  "@react-hook/window-size": "^3.0.7",
59
59
  "@tinacms/schema-tools": "1.4.3",
60
60
  "@tinacms/sharedctx": "1.0.1",
61
- "@tinacms/toolkit": "1.7.0",
61
+ "@tinacms/toolkit": "1.7.1",
62
62
  "crypto-js": "^4.0.0",
63
63
  "encoding": "0.1.13",
64
64
  "fetch-ponyfill": "^7.1.0",