tinacms 0.69.18 → 0.69.20

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
@@ -20,6 +20,7 @@ export * from '@tinacms/toolkit';
20
20
  export { TinaAdmin } from './admin';
21
21
  export { RouteMappingPlugin } from './admin/plugins/route-mapping';
22
22
  export { TinaAdminApi } from './admin/api';
23
+ export { MdxFieldPluginExtendible } from '@tinacms/toolkit';
23
24
  import { TinaCMSProvider2, DocumentCreatorCallback } from './tina-cms';
24
25
  import type { TinaCMSProviderDefaultProps } from './types/cms';
25
26
  export type { TinaCMSProviderDefaultProps };
package/dist/index.es.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, Select, OverflowMenu, CursorPaginator, PopupModal, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
2
2
  export * from "@tinacms/toolkit";
3
+ export { MdxFieldPluginExtendible } from "@tinacms/toolkit";
3
4
  import * as G from "graphql";
4
5
  import { TypeInfo, visit, visitWithTypeInfo, getNamedType, GraphQLObjectType, isLeafType, GraphQLUnionType, isScalarType as isScalarType$1, getIntrospectionQuery, buildClientSchema, print, parse } from "graphql";
5
6
  import set from "lodash.set";
@@ -4967,7 +4968,7 @@ const handleNavigate = (navigate, cms, collection, collectionDefinition, documen
4967
4968
  if (routeOverride.startsWith("/")) {
4968
4969
  routeOverride = routeOverride.slice(1);
4969
4970
  }
4970
- tinaPreview ? navigate(`/preview/${routeOverride}`) : window.location.href = routeOverride;
4971
+ tinaPreview ? navigate(`/~/${routeOverride}`) : window.location.href = routeOverride;
4971
4972
  return null;
4972
4973
  } else {
4973
4974
  navigate(document._sys.breadcrumbs.join("/"));
@@ -5049,14 +5050,14 @@ const CollectionListPage = () => {
5049
5050
  },
5050
5051
  ...fields.map((x) => [
5051
5052
  {
5052
- label: x.label + " (Ascending)",
5053
+ label: x.label || x.name + " (Ascending)",
5053
5054
  value: JSON.stringify({
5054
5055
  name: x.name,
5055
5056
  order: "asc"
5056
5057
  })
5057
5058
  },
5058
5059
  {
5059
- label: x.label + " (Descending)",
5060
+ label: x.label || x.name + " (Descending)",
5060
5061
  value: JSON.stringify({
5061
5062
  name: x.name,
5062
5063
  order: "desc"
@@ -5555,6 +5556,18 @@ const Redirect = () => {
5555
5556
  }, []);
5556
5557
  return null;
5557
5558
  };
5559
+ const MaybeRedirectToPreview = ({
5560
+ redirect,
5561
+ children
5562
+ }) => {
5563
+ const navigate = useNavigate();
5564
+ React.useEffect(() => {
5565
+ if (redirect) {
5566
+ navigate("/~");
5567
+ }
5568
+ }, [redirect]);
5569
+ return children;
5570
+ };
5558
5571
  const SetPreviewFlag = ({
5559
5572
  preview,
5560
5573
  cms
@@ -5580,7 +5593,7 @@ const PreviewInner = ({ preview, config }) => {
5580
5593
  }, [paramURL]);
5581
5594
  React.useEffect(() => {
5582
5595
  if ((reportedURL !== url || reportedURL !== paramURL) && reportedURL) {
5583
- navigate(`/preview${reportedURL}`);
5596
+ navigate(`/~${reportedURL}`);
5584
5597
  }
5585
5598
  }, [reportedURL]);
5586
5599
  React.useEffect(() => {
@@ -5622,7 +5635,7 @@ const TinaAdmin = ({
5622
5635
  preview,
5623
5636
  cms
5624
5637
  }), /* @__PURE__ */ React.createElement(Routes, null, preview && /* @__PURE__ */ React.createElement(Route, {
5625
- path: "/preview/*",
5638
+ path: "/~/*",
5626
5639
  element: /* @__PURE__ */ React.createElement(PreviewInner, {
5627
5640
  config,
5628
5641
  preview
@@ -5654,9 +5667,11 @@ const TinaAdmin = ({
5654
5667
  }, /* @__PURE__ */ React.createElement(ScreenPage, null))
5655
5668
  }), /* @__PURE__ */ React.createElement(Route, {
5656
5669
  path: "/",
5657
- element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
5670
+ element: /* @__PURE__ */ React.createElement(MaybeRedirectToPreview, {
5671
+ redirect: !!preview
5672
+ }, /* @__PURE__ */ React.createElement(DefaultWrapper, {
5658
5673
  cms
5659
- }, /* @__PURE__ */ React.createElement(DashboardPage, null))
5674
+ }, /* @__PURE__ */ React.createElement(DashboardPage, null)))
5660
5675
  })));
5661
5676
  } else {
5662
5677
  return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
@@ -5689,13 +5704,15 @@ class RouteMappingPlugin {
5689
5704
  }
5690
5705
  }
5691
5706
  const defineSchema = (config) => {
5692
- validateSchema({ config });
5707
+ validateSchema({ schema: config });
5693
5708
  return config;
5694
5709
  };
5695
5710
  const defineConfig = (config) => {
5711
+ validateSchema({ schema: config.schema });
5696
5712
  return config;
5697
5713
  };
5698
5714
  const defineStaticConfig = (config) => {
5715
+ validateSchema({ schema: config.schema });
5699
5716
  return config;
5700
5717
  };
5701
5718
  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 };
package/dist/index.js CHANGED
@@ -4984,7 +4984,7 @@ This will work when developing locally but NOT when deployed to production.
4984
4984
  if (routeOverride.startsWith("/")) {
4985
4985
  routeOverride = routeOverride.slice(1);
4986
4986
  }
4987
- tinaPreview ? navigate(`/preview/${routeOverride}`) : window.location.href = routeOverride;
4987
+ tinaPreview ? navigate(`/~/${routeOverride}`) : window.location.href = routeOverride;
4988
4988
  return null;
4989
4989
  } else {
4990
4990
  navigate(document._sys.breadcrumbs.join("/"));
@@ -5066,14 +5066,14 @@ This will work when developing locally but NOT when deployed to production.
5066
5066
  },
5067
5067
  ...fields.map((x) => [
5068
5068
  {
5069
- label: x.label + " (Ascending)",
5069
+ label: x.label || x.name + " (Ascending)",
5070
5070
  value: JSON.stringify({
5071
5071
  name: x.name,
5072
5072
  order: "asc"
5073
5073
  })
5074
5074
  },
5075
5075
  {
5076
- label: x.label + " (Descending)",
5076
+ label: x.label || x.name + " (Descending)",
5077
5077
  value: JSON.stringify({
5078
5078
  name: x.name,
5079
5079
  order: "desc"
@@ -5572,6 +5572,18 @@ This will work when developing locally but NOT when deployed to production.
5572
5572
  }, []);
5573
5573
  return null;
5574
5574
  };
5575
+ const MaybeRedirectToPreview = ({
5576
+ redirect,
5577
+ children
5578
+ }) => {
5579
+ const navigate = reactRouterDom.useNavigate();
5580
+ React__default["default"].useEffect(() => {
5581
+ if (redirect) {
5582
+ navigate("/~");
5583
+ }
5584
+ }, [redirect]);
5585
+ return children;
5586
+ };
5575
5587
  const SetPreviewFlag = ({
5576
5588
  preview,
5577
5589
  cms
@@ -5597,7 +5609,7 @@ This will work when developing locally but NOT when deployed to production.
5597
5609
  }, [paramURL]);
5598
5610
  React__default["default"].useEffect(() => {
5599
5611
  if ((reportedURL !== url || reportedURL !== paramURL) && reportedURL) {
5600
- navigate(`/preview${reportedURL}`);
5612
+ navigate(`/~${reportedURL}`);
5601
5613
  }
5602
5614
  }, [reportedURL]);
5603
5615
  React__default["default"].useEffect(() => {
@@ -5639,7 +5651,7 @@ This will work when developing locally but NOT when deployed to production.
5639
5651
  preview,
5640
5652
  cms
5641
5653
  }), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, preview && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
5642
- path: "/preview/*",
5654
+ path: "/~/*",
5643
5655
  element: /* @__PURE__ */ React__default["default"].createElement(PreviewInner, {
5644
5656
  config,
5645
5657
  preview
@@ -5671,9 +5683,11 @@ This will work when developing locally but NOT when deployed to production.
5671
5683
  }, /* @__PURE__ */ React__default["default"].createElement(ScreenPage, null))
5672
5684
  }), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
5673
5685
  path: "/",
5674
- element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
5686
+ element: /* @__PURE__ */ React__default["default"].createElement(MaybeRedirectToPreview, {
5687
+ redirect: !!preview
5688
+ }, /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
5675
5689
  cms
5676
- }, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null))
5690
+ }, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null)))
5677
5691
  })));
5678
5692
  } else {
5679
5693
  return /* @__PURE__ */ React__default["default"].createElement(Layout, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.HashRouter, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
@@ -5706,15 +5720,23 @@ This will work when developing locally but NOT when deployed to production.
5706
5720
  }
5707
5721
  }
5708
5722
  const defineSchema = (config) => {
5709
- schemaTools.validateSchema({ config });
5723
+ schemaTools.validateSchema({ schema: config });
5710
5724
  return config;
5711
5725
  };
5712
5726
  const defineConfig = (config) => {
5727
+ schemaTools.validateSchema({ schema: config.schema });
5713
5728
  return config;
5714
5729
  };
5715
5730
  const defineStaticConfig = (config) => {
5731
+ schemaTools.validateSchema({ schema: config.schema });
5716
5732
  return config;
5717
5733
  };
5734
+ Object.defineProperty(exports2, "MdxFieldPluginExtendible", {
5735
+ enumerable: true,
5736
+ get: function() {
5737
+ return toolkit.MdxFieldPluginExtendible;
5738
+ }
5739
+ });
5718
5740
  Object.defineProperty(exports2, "NAMER", {
5719
5741
  enumerable: true,
5720
5742
  get: function() {
@@ -62,7 +62,7 @@ declare type BaseComponents = {
62
62
  };
63
63
  code_block?: {
64
64
  lang?: string;
65
- children: JSX.Element;
65
+ value: string;
66
66
  };
67
67
  img?: {
68
68
  url: string;
@@ -154,7 +154,7 @@ const Node = ({ components, child }) => {
154
154
  const Component2 = components[child.type];
155
155
  return /* @__PURE__ */ React.createElement(Component2, {
156
156
  ...props
157
- }, value);
157
+ });
158
158
  }
159
159
  return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
160
160
  case "hr":
@@ -161,7 +161,7 @@
161
161
  const Component2 = components[child.type];
162
162
  return /* @__PURE__ */ React__default["default"].createElement(Component2, {
163
163
  ...props
164
- }, value);
164
+ });
165
165
  }
166
166
  return /* @__PURE__ */ React__default["default"].createElement("pre", null, /* @__PURE__ */ React__default["default"].createElement("code", null, value));
167
167
  case "hr":
@@ -0,0 +1,16 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export declare const Prism: (props: {
14
+ value: string;
15
+ lang?: string;
16
+ }) => JSX.Element;
@@ -0,0 +1,72 @@
1
+ import React from "react";
2
+ import Highlight, { defaultProps } from "prism-react-renderer";
3
+ var theme = {
4
+ plain: {
5
+ color: "#393A34",
6
+ backgroundColor: "#f6f8fa"
7
+ },
8
+ styles: [{
9
+ types: ["comment", "prolog", "doctype", "cdata"],
10
+ style: {
11
+ color: "#999988",
12
+ fontStyle: "italic"
13
+ }
14
+ }, {
15
+ types: ["namespace"],
16
+ style: {
17
+ opacity: 0.7
18
+ }
19
+ }, {
20
+ types: ["string", "attr-value"],
21
+ style: {
22
+ color: "#e3116c"
23
+ }
24
+ }, {
25
+ types: ["punctuation", "operator"],
26
+ style: {
27
+ color: "#393A34"
28
+ }
29
+ }, {
30
+ types: ["entity", "url", "symbol", "number", "boolean", "variable", "constant", "property", "regex", "inserted"],
31
+ style: {
32
+ color: "#36acaa"
33
+ }
34
+ }, {
35
+ types: ["atrule", "keyword", "attr-name", "selector"],
36
+ style: {
37
+ color: "#00a4db"
38
+ }
39
+ }, {
40
+ types: ["function", "deleted", "tag"],
41
+ style: {
42
+ color: "#d73a49"
43
+ }
44
+ }, {
45
+ types: ["function-variable"],
46
+ style: {
47
+ color: "#6f42c1"
48
+ }
49
+ }, {
50
+ types: ["tag", "selector", "keyword"],
51
+ style: {
52
+ color: "#00009f"
53
+ }
54
+ }]
55
+ };
56
+ var theme$1 = theme;
57
+ const Prism = (props) => {
58
+ return /* @__PURE__ */ React.createElement(Highlight, {
59
+ ...defaultProps,
60
+ theme: theme$1,
61
+ code: props.value,
62
+ language: props.lang
63
+ }, ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React.createElement("pre", {
64
+ className,
65
+ style
66
+ }, tokens.map((line, i) => /* @__PURE__ */ React.createElement("div", {
67
+ ...getLineProps({ line, key: i })
68
+ }, line.map((token, key) => /* @__PURE__ */ React.createElement("span", {
69
+ ...getTokenProps({ token, key })
70
+ }))))));
71
+ };
72
+ export { Prism };
@@ -0,0 +1,81 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("prism-react-renderer")) : typeof define === "function" && define.amd ? define(["exports", "react", "prism-react-renderer"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, React, Highlight) {
4
+ "use strict";
5
+ function _interopDefaultLegacy(e) {
6
+ return e && typeof e === "object" && "default" in e ? e : { "default": e };
7
+ }
8
+ var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
9
+ var Highlight__default = /* @__PURE__ */ _interopDefaultLegacy(Highlight);
10
+ var theme = {
11
+ plain: {
12
+ color: "#393A34",
13
+ backgroundColor: "#f6f8fa"
14
+ },
15
+ styles: [{
16
+ types: ["comment", "prolog", "doctype", "cdata"],
17
+ style: {
18
+ color: "#999988",
19
+ fontStyle: "italic"
20
+ }
21
+ }, {
22
+ types: ["namespace"],
23
+ style: {
24
+ opacity: 0.7
25
+ }
26
+ }, {
27
+ types: ["string", "attr-value"],
28
+ style: {
29
+ color: "#e3116c"
30
+ }
31
+ }, {
32
+ types: ["punctuation", "operator"],
33
+ style: {
34
+ color: "#393A34"
35
+ }
36
+ }, {
37
+ types: ["entity", "url", "symbol", "number", "boolean", "variable", "constant", "property", "regex", "inserted"],
38
+ style: {
39
+ color: "#36acaa"
40
+ }
41
+ }, {
42
+ types: ["atrule", "keyword", "attr-name", "selector"],
43
+ style: {
44
+ color: "#00a4db"
45
+ }
46
+ }, {
47
+ types: ["function", "deleted", "tag"],
48
+ style: {
49
+ color: "#d73a49"
50
+ }
51
+ }, {
52
+ types: ["function-variable"],
53
+ style: {
54
+ color: "#6f42c1"
55
+ }
56
+ }, {
57
+ types: ["tag", "selector", "keyword"],
58
+ style: {
59
+ color: "#00009f"
60
+ }
61
+ }]
62
+ };
63
+ var theme$1 = theme;
64
+ const Prism = (props) => {
65
+ return /* @__PURE__ */ React__default["default"].createElement(Highlight__default["default"], {
66
+ ...Highlight.defaultProps,
67
+ theme: theme$1,
68
+ code: props.value,
69
+ language: props.lang
70
+ }, ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React__default["default"].createElement("pre", {
71
+ className,
72
+ style
73
+ }, tokens.map((line, i) => /* @__PURE__ */ React__default["default"].createElement("div", {
74
+ ...getLineProps({ line, key: i })
75
+ }, line.map((token, key) => /* @__PURE__ */ React__default["default"].createElement("span", {
76
+ ...getTokenProps({ token, key })
77
+ }))))));
78
+ };
79
+ exports2.Prism = Prism;
80
+ Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
81
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.69.18",
3
+ "version": "0.69.20",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -43,6 +43,7 @@
43
43
  "src/index.ts",
44
44
  "src/edit-state.tsx",
45
45
  "src/rich-text/index.tsx",
46
+ "src/rich-text/prism.tsx",
46
47
  "src/react.tsx",
47
48
  "src/client.ts"
48
49
  ]
@@ -54,9 +55,9 @@
54
55
  "@headlessui/react": "^1.5.0",
55
56
  "@heroicons/react": "^1.0.4",
56
57
  "@react-hook/window-size": "^3.0.7",
57
- "@tinacms/schema-tools": "0.1.8",
58
+ "@tinacms/schema-tools": "0.1.9",
58
59
  "@tinacms/sharedctx": "0.1.3",
59
- "@tinacms/toolkit": "0.58.1",
60
+ "@tinacms/toolkit": "0.58.2",
60
61
  "crypto-js": "^4.0.0",
61
62
  "fetch-ponyfill": "^7.1.0",
62
63
  "final-form": "4.20.1",