tinacms 0.69.19 → 0.69.21

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";
@@ -4522,6 +4523,7 @@ const Sidebar = ({ cms }) => {
4522
4523
  const windowWidth = useWindowWidth();
4523
4524
  const renderDesktopNav = windowWidth > navBreakpoint;
4524
4525
  return /* @__PURE__ */ React.createElement(React.Fragment, null, renderDesktopNav && /* @__PURE__ */ React.createElement(Nav, {
4526
+ isLocalMode,
4525
4527
  sidebarWidth: 360,
4526
4528
  showCollections: true,
4527
4529
  collectionsInfo,
@@ -4554,6 +4556,7 @@ const Sidebar = ({ cms }) => {
4554
4556
  }, /* @__PURE__ */ React.createElement("div", {
4555
4557
  className: "fixed left-0 top-0 z-overlay h-full transform"
4556
4558
  }, /* @__PURE__ */ React.createElement(Nav, {
4559
+ isLocalMode,
4557
4560
  className: "rounded-r-md",
4558
4561
  sidebarWidth: 360,
4559
4562
  showCollections: true,
@@ -4967,7 +4970,7 @@ const handleNavigate = (navigate, cms, collection, collectionDefinition, documen
4967
4970
  if (routeOverride.startsWith("/")) {
4968
4971
  routeOverride = routeOverride.slice(1);
4969
4972
  }
4970
- tinaPreview ? navigate(`/preview/${routeOverride}`) : window.location.href = routeOverride;
4973
+ tinaPreview ? navigate(`/~/${routeOverride}`) : window.location.href = routeOverride;
4971
4974
  return null;
4972
4975
  } else {
4973
4976
  navigate(document._sys.breadcrumbs.join("/"));
@@ -5049,14 +5052,14 @@ const CollectionListPage = () => {
5049
5052
  },
5050
5053
  ...fields.map((x) => [
5051
5054
  {
5052
- label: x.label + " (Ascending)",
5055
+ label: x.label || x.name + " (Ascending)",
5053
5056
  value: JSON.stringify({
5054
5057
  name: x.name,
5055
5058
  order: "asc"
5056
5059
  })
5057
5060
  },
5058
5061
  {
5059
- label: x.label + " (Descending)",
5062
+ label: x.label || x.name + " (Descending)",
5060
5063
  value: JSON.stringify({
5061
5064
  name: x.name,
5062
5065
  order: "desc"
@@ -5555,6 +5558,18 @@ const Redirect = () => {
5555
5558
  }, []);
5556
5559
  return null;
5557
5560
  };
5561
+ const MaybeRedirectToPreview = ({
5562
+ redirect,
5563
+ children
5564
+ }) => {
5565
+ const navigate = useNavigate();
5566
+ React.useEffect(() => {
5567
+ if (redirect) {
5568
+ navigate("/~");
5569
+ }
5570
+ }, [redirect]);
5571
+ return children;
5572
+ };
5558
5573
  const SetPreviewFlag = ({
5559
5574
  preview,
5560
5575
  cms
@@ -5580,7 +5595,7 @@ const PreviewInner = ({ preview, config }) => {
5580
5595
  }, [paramURL]);
5581
5596
  React.useEffect(() => {
5582
5597
  if ((reportedURL !== url || reportedURL !== paramURL) && reportedURL) {
5583
- navigate(`/preview${reportedURL}`);
5598
+ navigate(`/~${reportedURL}`);
5584
5599
  }
5585
5600
  }, [reportedURL]);
5586
5601
  React.useEffect(() => {
@@ -5622,7 +5637,7 @@ const TinaAdmin = ({
5622
5637
  preview,
5623
5638
  cms
5624
5639
  }), /* @__PURE__ */ React.createElement(Routes, null, preview && /* @__PURE__ */ React.createElement(Route, {
5625
- path: "/preview/*",
5640
+ path: "/~/*",
5626
5641
  element: /* @__PURE__ */ React.createElement(PreviewInner, {
5627
5642
  config,
5628
5643
  preview
@@ -5654,9 +5669,11 @@ const TinaAdmin = ({
5654
5669
  }, /* @__PURE__ */ React.createElement(ScreenPage, null))
5655
5670
  }), /* @__PURE__ */ React.createElement(Route, {
5656
5671
  path: "/",
5657
- element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
5672
+ element: /* @__PURE__ */ React.createElement(MaybeRedirectToPreview, {
5673
+ redirect: !!preview
5674
+ }, /* @__PURE__ */ React.createElement(DefaultWrapper, {
5658
5675
  cms
5659
- }, /* @__PURE__ */ React.createElement(DashboardPage, null))
5676
+ }, /* @__PURE__ */ React.createElement(DashboardPage, null)))
5660
5677
  })));
5661
5678
  } else {
5662
5679
  return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
package/dist/index.js CHANGED
@@ -4539,6 +4539,7 @@ This will work when developing locally but NOT when deployed to production.
4539
4539
  const windowWidth = windowSize.useWindowWidth();
4540
4540
  const renderDesktopNav = windowWidth > navBreakpoint;
4541
4541
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, renderDesktopNav && /* @__PURE__ */ React__default["default"].createElement(toolkit.Nav, {
4542
+ isLocalMode,
4542
4543
  sidebarWidth: 360,
4543
4544
  showCollections: true,
4544
4545
  collectionsInfo,
@@ -4571,6 +4572,7 @@ This will work when developing locally but NOT when deployed to production.
4571
4572
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
4572
4573
  className: "fixed left-0 top-0 z-overlay h-full transform"
4573
4574
  }, /* @__PURE__ */ React__default["default"].createElement(toolkit.Nav, {
4575
+ isLocalMode,
4574
4576
  className: "rounded-r-md",
4575
4577
  sidebarWidth: 360,
4576
4578
  showCollections: true,
@@ -4984,7 +4986,7 @@ This will work when developing locally but NOT when deployed to production.
4984
4986
  if (routeOverride.startsWith("/")) {
4985
4987
  routeOverride = routeOverride.slice(1);
4986
4988
  }
4987
- tinaPreview ? navigate(`/preview/${routeOverride}`) : window.location.href = routeOverride;
4989
+ tinaPreview ? navigate(`/~/${routeOverride}`) : window.location.href = routeOverride;
4988
4990
  return null;
4989
4991
  } else {
4990
4992
  navigate(document._sys.breadcrumbs.join("/"));
@@ -5066,14 +5068,14 @@ This will work when developing locally but NOT when deployed to production.
5066
5068
  },
5067
5069
  ...fields.map((x) => [
5068
5070
  {
5069
- label: x.label + " (Ascending)",
5071
+ label: x.label || x.name + " (Ascending)",
5070
5072
  value: JSON.stringify({
5071
5073
  name: x.name,
5072
5074
  order: "asc"
5073
5075
  })
5074
5076
  },
5075
5077
  {
5076
- label: x.label + " (Descending)",
5078
+ label: x.label || x.name + " (Descending)",
5077
5079
  value: JSON.stringify({
5078
5080
  name: x.name,
5079
5081
  order: "desc"
@@ -5572,6 +5574,18 @@ This will work when developing locally but NOT when deployed to production.
5572
5574
  }, []);
5573
5575
  return null;
5574
5576
  };
5577
+ const MaybeRedirectToPreview = ({
5578
+ redirect,
5579
+ children
5580
+ }) => {
5581
+ const navigate = reactRouterDom.useNavigate();
5582
+ React__default["default"].useEffect(() => {
5583
+ if (redirect) {
5584
+ navigate("/~");
5585
+ }
5586
+ }, [redirect]);
5587
+ return children;
5588
+ };
5575
5589
  const SetPreviewFlag = ({
5576
5590
  preview,
5577
5591
  cms
@@ -5597,7 +5611,7 @@ This will work when developing locally but NOT when deployed to production.
5597
5611
  }, [paramURL]);
5598
5612
  React__default["default"].useEffect(() => {
5599
5613
  if ((reportedURL !== url || reportedURL !== paramURL) && reportedURL) {
5600
- navigate(`/preview${reportedURL}`);
5614
+ navigate(`/~${reportedURL}`);
5601
5615
  }
5602
5616
  }, [reportedURL]);
5603
5617
  React__default["default"].useEffect(() => {
@@ -5639,7 +5653,7 @@ This will work when developing locally but NOT when deployed to production.
5639
5653
  preview,
5640
5654
  cms
5641
5655
  }), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, preview && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
5642
- path: "/preview/*",
5656
+ path: "/~/*",
5643
5657
  element: /* @__PURE__ */ React__default["default"].createElement(PreviewInner, {
5644
5658
  config,
5645
5659
  preview
@@ -5671,9 +5685,11 @@ This will work when developing locally but NOT when deployed to production.
5671
5685
  }, /* @__PURE__ */ React__default["default"].createElement(ScreenPage, null))
5672
5686
  }), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
5673
5687
  path: "/",
5674
- element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
5688
+ element: /* @__PURE__ */ React__default["default"].createElement(MaybeRedirectToPreview, {
5689
+ redirect: !!preview
5690
+ }, /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
5675
5691
  cms
5676
- }, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null))
5692
+ }, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null)))
5677
5693
  })));
5678
5694
  } else {
5679
5695
  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, {
@@ -5717,6 +5733,12 @@ This will work when developing locally but NOT when deployed to production.
5717
5733
  schemaTools.validateSchema({ schema: config.schema });
5718
5734
  return config;
5719
5735
  };
5736
+ Object.defineProperty(exports2, "MdxFieldPluginExtendible", {
5737
+ enumerable: true,
5738
+ get: function() {
5739
+ return toolkit.MdxFieldPluginExtendible;
5740
+ }
5741
+ });
5720
5742
  Object.defineProperty(exports2, "NAMER", {
5721
5743
  enumerable: true,
5722
5744
  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.19",
3
+ "version": "0.69.21",
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
  ]
@@ -56,7 +57,7 @@
56
57
  "@react-hook/window-size": "^3.0.7",
57
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.3",
60
61
  "crypto-js": "^4.0.0",
61
62
  "fetch-ponyfill": "^7.1.0",
62
63
  "final-form": "4.20.1",