tinacms 0.69.21 → 0.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,14 +10,33 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
10
  See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
- import { isEditing, setEditing, useEditState } from '@tinacms/sharedctx';
13
+ import { isEditing, setEditing } from '@tinacms/sharedctx';
14
14
  import React from 'react';
15
+ /**
16
+ * @deprecated since version 1.0.
17
+ * Use "import { useEditState } from 'tinacms/dist/react'" instead.
18
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
19
+ */
20
+ declare const useEditState: () => {
21
+ edit: any;
22
+ setEdit: any;
23
+ };
15
24
  export { isEditing, setEditing, useEditState };
25
+ /**
26
+ * @deprecated since version 1.0.
27
+ * Tina no longer requires wrapping your site in the TinaProvider
28
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
29
+ */
16
30
  export declare const TinaEditProvider: ({ showEditButton, ...props }: {
17
31
  showEditButton?: boolean;
18
32
  children: React.ReactNode;
19
33
  editMode: React.ReactNode;
20
34
  }) => JSX.Element;
35
+ /**
36
+ * @deprecated since version 1.0.
37
+ * Use "import { useTina } from 'tinacms/dist/react'" instead.
38
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
39
+ */
21
40
  export declare function useTina<T extends object>({ query, variables, data, }: {
22
41
  query: string;
23
42
  variables: object;
@@ -1,6 +1,7 @@
1
- import { EditProvider, TinaDataContext, useEditState } from "@tinacms/sharedctx";
2
- export { isEditing, setEditing, useEditState } from "@tinacms/sharedctx";
1
+ import { useEditState as useEditState$1, EditProvider, TinaDataContext } from "@tinacms/sharedctx";
2
+ export { isEditing, setEditing } from "@tinacms/sharedctx";
3
3
  import React, { useState, useEffect } from "react";
4
+ const useEditState = useEditState$1;
4
5
  const TinaEditProvider = ({
5
6
  showEditButton,
6
7
  ...props
@@ -14,6 +15,13 @@ function useTina({
14
15
  variables,
15
16
  data
16
17
  }) {
18
+ React.useEffect(() => {
19
+ console.warn(`
20
+ "useTina" from 'tinacms/dist/edit-state' is now deprecated
21
+ * Use "import { useTina } from 'tinacms/dist/react" instead.
22
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
23
+ `);
24
+ }, []);
17
25
  const {
18
26
  setRequest,
19
27
  state,
@@ -78,4 +86,4 @@ const TinaEditProviderInner = ({ children, editMode }) => {
78
86
  }
79
87
  return children;
80
88
  };
81
- export { TinaEditProvider, useTina };
89
+ export { TinaEditProvider, useEditState, useTina };
@@ -6,6 +6,7 @@
6
6
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
7
7
  }
8
8
  var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
9
+ const useEditState = sharedctx.useEditState;
9
10
  const TinaEditProvider = ({
10
11
  showEditButton,
11
12
  ...props
@@ -19,6 +20,13 @@
19
20
  variables,
20
21
  data
21
22
  }) {
23
+ React__default["default"].useEffect(() => {
24
+ console.warn(`
25
+ "useTina" from 'tinacms/dist/edit-state' is now deprecated
26
+ * Use "import { useTina } from 'tinacms/dist/react" instead.
27
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
28
+ `);
29
+ }, []);
22
30
  const {
23
31
  setRequest,
24
32
  state,
@@ -44,7 +52,7 @@
44
52
  };
45
53
  }
46
54
  const ToggleButton = () => {
47
- const { edit } = sharedctx.useEditState();
55
+ const { edit } = useEditState();
48
56
  const [isOnAdmin, setIsOnAdmin] = React__default["default"].useState(false);
49
57
  React__default["default"].useEffect(() => {
50
58
  var _a;
@@ -73,7 +81,7 @@
73
81
  }, "Edit with Tina"));
74
82
  };
75
83
  const TinaEditProviderInner = ({ children, editMode }) => {
76
- const { edit } = sharedctx.useEditState();
84
+ const { edit } = useEditState();
77
85
  const [isBrowser, setIsBrowser] = React__default["default"].useState(false);
78
86
  React__default["default"].useEffect(() => {
79
87
  setIsBrowser(true);
@@ -95,13 +103,8 @@
95
103
  return sharedctx.setEditing;
96
104
  }
97
105
  });
98
- Object.defineProperty(exports2, "useEditState", {
99
- enumerable: true,
100
- get: function() {
101
- return sharedctx.useEditState;
102
- }
103
- });
104
106
  exports2.TinaEditProvider = TinaEditProvider;
107
+ exports2.useEditState = useEditState;
105
108
  exports2.useTina = useTina;
106
109
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
107
110
  });
@@ -1,3 +1,3 @@
1
1
  declare const schema: import("../../..").TinaCloudSchema;
2
- export declare const tinaConfig: Omit<import("../../..").TinaCMSProviderDefaultProps, "children">;
2
+ export declare const tinaConfig: import("@tinacms/schema-tools").TinaCMSConfig<(cms: import("@tinacms/toolkit/dist/tina-cms").TinaCMS) => import("@tinacms/toolkit/dist/tina-cms").TinaCMS, import("../../use-graphql-forms").formifyCallback, import("../../use-content-creator").DocumentCreatorArgs, undefined>;
3
3
  export default schema;
package/dist/index.d.ts CHANGED
@@ -36,5 +36,6 @@ export declare type TinaCollection = TinaCloudCollectionBase<false>;
36
36
  export declare type TinaField = TinaFieldBase;
37
37
  export type { TinaTemplate, TinaCloudTemplateBase };
38
38
  export declare const defineSchema: (config: TinaCloudSchema) => TinaCloudSchema;
39
- export declare const defineConfig: (config: Omit<TinaCMSProviderDefaultProps, 'children'>) => Omit<TinaCMSProviderDefaultProps, "children">;
39
+ export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, 'children'>) => Omit<TinaCMSProviderDefaultProps, "children">;
40
40
  export declare const defineStaticConfig: (config: TinaCMSConfig<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>) => TinaCMSConfig<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>;
41
+ export declare const defineConfig: (config: TinaCMSConfig<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>) => TinaCMSConfig<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>;
package/dist/index.es.js CHANGED
@@ -3994,6 +3994,13 @@ function useTina({
3994
3994
  variables,
3995
3995
  data
3996
3996
  }) {
3997
+ React.useEffect(() => {
3998
+ console.warn(`
3999
+ "useTina" from 'tinacms/dist/edit-state' is now deprecated
4000
+ * Use "import { useTina } from 'tinacms/dist/react" instead.
4001
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
4002
+ `);
4003
+ }, []);
3997
4004
  const {
3998
4005
  setRequest,
3999
4006
  state,
@@ -4125,6 +4132,12 @@ const TinaCMSProvider2 = ({
4125
4132
  ...props
4126
4133
  }) => {
4127
4134
  var _a;
4135
+ React.useEffect(() => {
4136
+ console.warn(`
4137
+ * Tina no longer requires wrapping your site in the TinaProvider
4138
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
4139
+ `);
4140
+ }, []);
4128
4141
  if (props == null ? void 0 : props.apiURL) {
4129
4142
  console.warn("The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API");
4130
4143
  }
@@ -5052,14 +5065,14 @@ const CollectionListPage = () => {
5052
5065
  },
5053
5066
  ...fields.map((x) => [
5054
5067
  {
5055
- label: x.label || x.name + " (Ascending)",
5068
+ label: (x.label || x.name) + " (Ascending)",
5056
5069
  value: JSON.stringify({
5057
5070
  name: x.name,
5058
5071
  order: "asc"
5059
5072
  })
5060
5073
  },
5061
5074
  {
5062
- label: x.label || x.name + " (Descending)",
5075
+ label: (x.label || x.name) + " (Descending)",
5063
5076
  value: JSON.stringify({
5064
5077
  name: x.name,
5065
5078
  order: "desc"
@@ -5709,12 +5722,16 @@ const defineSchema = (config) => {
5709
5722
  validateSchema({ schema: config });
5710
5723
  return config;
5711
5724
  };
5712
- const defineConfig = (config) => {
5725
+ const defineLegacyConfig = (config) => {
5713
5726
  validateSchema({ schema: config.schema });
5714
5727
  return config;
5715
5728
  };
5716
5729
  const defineStaticConfig = (config) => {
5730
+ if (!config.schema) {
5731
+ throw new Error("Static config must have a schema");
5732
+ }
5717
5733
  validateSchema({ schema: config.schema });
5718
5734
  return config;
5719
5735
  };
5720
- export { AuthWallInner, Client, DEFAULT_LOCAL_TINA_GQL_SERVER_URL, LocalClient, RouteMappingPlugin, TinaAdmin, TinaAdminApi, TinaCMSProvider2, TinaCloudAuthWall, TinaCloudProvider, TinaDataProvider, assertShape, createClient, TinaCMSProvider2 as default, defineConfig, defineSchema, defineStaticConfig, getStaticPropsForTina, gql, safeAssertShape, staticRequest, useDocumentCreatorPlugin, useGraphqlForms, useTinaAuthRedirect };
5736
+ const defineConfig = defineStaticConfig;
5737
+ export { AuthWallInner, Client, DEFAULT_LOCAL_TINA_GQL_SERVER_URL, LocalClient, RouteMappingPlugin, TinaAdmin, TinaAdminApi, TinaCMSProvider2, TinaCloudAuthWall, TinaCloudProvider, TinaDataProvider, assertShape, createClient, TinaCMSProvider2 as default, defineConfig, defineLegacyConfig, defineSchema, defineStaticConfig, getStaticPropsForTina, gql, safeAssertShape, staticRequest, useDocumentCreatorPlugin, useGraphqlForms, useTinaAuthRedirect };
package/dist/index.js CHANGED
@@ -4010,6 +4010,13 @@ mutation addPendingDocumentMutation(
4010
4010
  variables,
4011
4011
  data
4012
4012
  }) {
4013
+ React__default["default"].useEffect(() => {
4014
+ console.warn(`
4015
+ "useTina" from 'tinacms/dist/edit-state' is now deprecated
4016
+ * Use "import { useTina } from 'tinacms/dist/react" instead.
4017
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
4018
+ `);
4019
+ }, []);
4013
4020
  const {
4014
4021
  setRequest,
4015
4022
  state,
@@ -4141,6 +4148,12 @@ mutation addPendingDocumentMutation(
4141
4148
  ...props
4142
4149
  }) => {
4143
4150
  var _a;
4151
+ React__default["default"].useEffect(() => {
4152
+ console.warn(`
4153
+ * Tina no longer requires wrapping your site in the TinaProvider
4154
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
4155
+ `);
4156
+ }, []);
4144
4157
  if (props == null ? void 0 : props.apiURL) {
4145
4158
  console.warn("The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API");
4146
4159
  }
@@ -5068,14 +5081,14 @@ This will work when developing locally but NOT when deployed to production.
5068
5081
  },
5069
5082
  ...fields.map((x) => [
5070
5083
  {
5071
- label: x.label || x.name + " (Ascending)",
5084
+ label: (x.label || x.name) + " (Ascending)",
5072
5085
  value: JSON.stringify({
5073
5086
  name: x.name,
5074
5087
  order: "asc"
5075
5088
  })
5076
5089
  },
5077
5090
  {
5078
- label: x.label || x.name + " (Descending)",
5091
+ label: (x.label || x.name) + " (Descending)",
5079
5092
  value: JSON.stringify({
5080
5093
  name: x.name,
5081
5094
  order: "desc"
@@ -5725,14 +5738,18 @@ This will work when developing locally but NOT when deployed to production.
5725
5738
  schemaTools.validateSchema({ schema: config });
5726
5739
  return config;
5727
5740
  };
5728
- const defineConfig = (config) => {
5741
+ const defineLegacyConfig = (config) => {
5729
5742
  schemaTools.validateSchema({ schema: config.schema });
5730
5743
  return config;
5731
5744
  };
5732
5745
  const defineStaticConfig = (config) => {
5746
+ if (!config.schema) {
5747
+ throw new Error("Static config must have a schema");
5748
+ }
5733
5749
  schemaTools.validateSchema({ schema: config.schema });
5734
5750
  return config;
5735
5751
  };
5752
+ const defineConfig = defineStaticConfig;
5736
5753
  Object.defineProperty(exports2, "MdxFieldPluginExtendible", {
5737
5754
  enumerable: true,
5738
5755
  get: function() {
@@ -5766,6 +5783,7 @@ This will work when developing locally but NOT when deployed to production.
5766
5783
  exports2.createClient = createClient;
5767
5784
  exports2["default"] = TinaCMSProvider2;
5768
5785
  exports2.defineConfig = defineConfig;
5786
+ exports2.defineLegacyConfig = defineLegacyConfig;
5769
5787
  exports2.defineSchema = defineSchema;
5770
5788
  exports2.defineStaticConfig = defineStaticConfig;
5771
5789
  exports2.getStaticPropsForTina = getStaticPropsForTina;
package/dist/react.d.ts CHANGED
@@ -9,3 +9,6 @@ export declare function useTina<T extends object>(props: {
9
9
  }): {
10
10
  data: T;
11
11
  };
12
+ export declare function useEditState(): {
13
+ edit: boolean;
14
+ };
package/dist/react.es.js CHANGED
@@ -16,4 +16,19 @@ function useTina(props) {
16
16
  }, [id]);
17
17
  return { data };
18
18
  }
19
- export { useTina };
19
+ function useEditState() {
20
+ const [edit, setEdit] = React.useState(false);
21
+ React.useEffect(() => {
22
+ if (typeof window !== "undefined") {
23
+ parent.postMessage({ type: "isEditMode" }, window.location.origin);
24
+ window.addEventListener("message", (event) => {
25
+ var _a;
26
+ if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
27
+ setEdit(true);
28
+ }
29
+ });
30
+ }
31
+ }, []);
32
+ return { edit };
33
+ }
34
+ export { useEditState, useTina };
package/dist/react.js CHANGED
@@ -23,6 +23,22 @@
23
23
  }, [id]);
24
24
  return { data };
25
25
  }
26
+ function useEditState() {
27
+ const [edit, setEdit] = React__default["default"].useState(false);
28
+ React__default["default"].useEffect(() => {
29
+ if (typeof window !== "undefined") {
30
+ parent.postMessage({ type: "isEditMode" }, window.location.origin);
31
+ window.addEventListener("message", (event) => {
32
+ var _a;
33
+ if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
34
+ setEdit(true);
35
+ }
36
+ });
37
+ }
38
+ }, []);
39
+ return { edit };
40
+ }
41
+ exports2.useEditState = useEditState;
26
42
  exports2.useTina = useTina;
27
43
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
28
44
  });
@@ -57,6 +57,9 @@ declare type BaseComponents = {
57
57
  ol?: {
58
58
  children: JSX.Element;
59
59
  };
60
+ li?: {
61
+ children: JSX.Element;
62
+ };
60
63
  block_quote?: {
61
64
  children: JSX.Element;
62
65
  };
@@ -121,8 +124,10 @@ export declare type TinaMarkdownContent = {
121
124
  type: string;
122
125
  children: TinaMarkdownContent[];
123
126
  };
124
- export declare const TinaMarkdown: ({ content, components, }: {
127
+ export declare const TinaMarkdown: <CustomComponents extends {
128
+ [key: string]: object;
129
+ } = any>({ content, components, }: {
125
130
  content: TinaMarkdownContent | TinaMarkdownContent[];
126
- components?: Components<{}>;
131
+ components?: Components<{}> | Components<{ [BK in keyof CustomComponents]: (props: CustomComponents[BK]) => JSX.Element; }>;
127
132
  }) => JSX.Element;
128
133
  export {};
@@ -13,6 +13,11 @@ limitations under the License.
13
13
  import type { formifyCallback } from './hooks/use-graphql-forms';
14
14
  import { useDocumentCreatorPlugin } from './hooks/use-content-creator';
15
15
  import { TinaCMSProviderDefaultProps } from './types/cms';
16
+ /**
17
+ * @deprecated since version 1.0.
18
+ * Tina no longer requires wrapping your site in the TinaProvider
19
+ * See https://tina.io/blog/upgrading-to-iframe/ for full migration details
20
+ */
16
21
  export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, schema, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
17
22
  export declare type DocumentCreatorCallback = Parameters<typeof useDocumentCreatorPlugin>[0];
18
23
  export declare const TinaDataProvider: ({ children, formifyCallback, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.69.21",
3
+ "version": "0.70.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -55,10 +55,11 @@
55
55
  "@headlessui/react": "^1.5.0",
56
56
  "@heroicons/react": "^1.0.4",
57
57
  "@react-hook/window-size": "^3.0.7",
58
- "@tinacms/schema-tools": "0.1.9",
58
+ "@tinacms/schema-tools": "0.2.0",
59
59
  "@tinacms/sharedctx": "0.1.3",
60
- "@tinacms/toolkit": "0.58.3",
60
+ "@tinacms/toolkit": "0.58.5",
61
61
  "crypto-js": "^4.0.0",
62
+ "encoding": "0.1.13",
62
63
  "fetch-ponyfill": "^7.1.0",
63
64
  "final-form": "4.20.1",
64
65
  "graphql": "15.8.0",