tinacms 0.69.16 → 0.69.18
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/admin/index.d.ts +3 -2
- package/dist/auth/AuthModal.d.ts +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +80 -21
- package/dist/index.js +93 -23
- package/dist/react.es.js +6 -4
- package/dist/react.js +6 -4
- package/dist/style.css +13 -3
- package/package.json +5 -7
package/dist/admin/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ 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
|
-
export declare const TinaAdmin: ({ preview }: {
|
|
14
|
-
preview?: JSX.Element;
|
|
13
|
+
export declare const TinaAdmin: ({ preview, config, }: {
|
|
14
|
+
preview?: (props: object) => JSX.Element;
|
|
15
|
+
config: object;
|
|
15
16
|
}) => JSX.Element;
|
package/dist/auth/AuthModal.d.ts
CHANGED
|
@@ -18,7 +18,10 @@ interface ModalBuilderProps {
|
|
|
18
18
|
close(): void;
|
|
19
19
|
}
|
|
20
20
|
export declare function ModalBuilder(modalProps: ModalBuilderProps): JSX.Element;
|
|
21
|
-
export declare const ErrorLabel:
|
|
21
|
+
export declare const ErrorLabel: ({ style, ...props }: {
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
style?: {};
|
|
24
|
+
}) => JSX.Element;
|
|
22
25
|
interface ButtonProps {
|
|
23
26
|
name: string;
|
|
24
27
|
action(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export default TinaCMSProvider2;
|
|
|
27
27
|
import { TinaCMS } from '@tinacms/toolkit';
|
|
28
28
|
import { formifyCallback } from './hooks/use-graphql-forms';
|
|
29
29
|
import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase, TinaTemplate, TinaFieldBase, TinaCMSConfig } from '@tinacms/schema-tools';
|
|
30
|
+
export { NAMER, resolveForm } from '@tinacms/schema-tools';
|
|
31
|
+
export type { TinaFieldEnriched, TinaSchema, Template, Templateable, } from '@tinacms/schema-tools';
|
|
30
32
|
export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
|
|
31
33
|
export declare type TinaCloudCollection = TinaCloudCollectionBase<false>;
|
|
32
34
|
export declare type TinaCollection = TinaCloudCollectionBase<false>;
|
package/dist/index.es.js
CHANGED
|
@@ -6,9 +6,9 @@ import set from "lodash.set";
|
|
|
6
6
|
import React, { useState, useCallback, useEffect, Fragment, useMemo } from "react";
|
|
7
7
|
import { getIn, setIn } from "final-form";
|
|
8
8
|
import { resolveForm, TinaSchema, addNamespaceToSchema, validateSchema } from "@tinacms/schema-tools";
|
|
9
|
+
export { NAMER, resolveForm } from "@tinacms/schema-tools";
|
|
9
10
|
import gql$1 from "graphql-tag";
|
|
10
11
|
import * as yup from "yup";
|
|
11
|
-
import styled from "styled-components";
|
|
12
12
|
import { setEditing, TinaDataContext, EditContext, useEditState } from "@tinacms/sharedctx";
|
|
13
13
|
import UrlPattern from "url-pattern";
|
|
14
14
|
import { NavLink, useNavigate, useParams, useLocation, Link, HashRouter, Routes, Route } from "react-router-dom";
|
|
@@ -2439,9 +2439,10 @@ function ModalBuilder(modalProps) {
|
|
|
2439
2439
|
...action
|
|
2440
2440
|
})))));
|
|
2441
2441
|
}
|
|
2442
|
-
const ErrorLabel =
|
|
2443
|
-
color: var(--tina-color-error)
|
|
2444
|
-
|
|
2442
|
+
const ErrorLabel = ({ style = {}, ...props }) => /* @__PURE__ */ React.createElement("p", {
|
|
2443
|
+
style: { ...style, color: "var(--tina-color-error)" },
|
|
2444
|
+
...props
|
|
2445
|
+
});
|
|
2445
2446
|
const AsyncButton = ({ name, primary, action }) => {
|
|
2446
2447
|
const [submitting, setSubmitting] = useState(false);
|
|
2447
2448
|
const onClick = useCallback(async () => {
|
|
@@ -3262,6 +3263,9 @@ var styles = `.tina-tailwind {
|
|
|
3262
3263
|
.tina-tailwind .w-56 {
|
|
3263
3264
|
width: 224px;
|
|
3264
3265
|
}
|
|
3266
|
+
.tina-tailwind .w-\\[15\\%\\] {
|
|
3267
|
+
width: 15%;
|
|
3268
|
+
}
|
|
3265
3269
|
.tina-tailwind .w-0 {
|
|
3266
3270
|
width: 0px;
|
|
3267
3271
|
}
|
|
@@ -3280,6 +3284,9 @@ var styles = `.tina-tailwind {
|
|
|
3280
3284
|
.tina-tailwind .max-w-full {
|
|
3281
3285
|
max-width: 100%;
|
|
3282
3286
|
}
|
|
3287
|
+
.tina-tailwind .max-w-0 {
|
|
3288
|
+
max-width: 0rem;
|
|
3289
|
+
}
|
|
3283
3290
|
.tina-tailwind .flex-1 {
|
|
3284
3291
|
flex: 1 1 0%;
|
|
3285
3292
|
}
|
|
@@ -3386,9 +3393,6 @@ var styles = `.tina-tailwind {
|
|
|
3386
3393
|
.tina-tailwind .whitespace-normal {
|
|
3387
3394
|
white-space: normal;
|
|
3388
3395
|
}
|
|
3389
|
-
.tina-tailwind .whitespace-nowrap {
|
|
3390
|
-
white-space: nowrap;
|
|
3391
|
-
}
|
|
3392
3396
|
.tina-tailwind .rounded-lg {
|
|
3393
3397
|
border-radius: 8px;
|
|
3394
3398
|
}
|
|
@@ -3497,6 +3501,10 @@ var styles = `.tina-tailwind {
|
|
|
3497
3501
|
padding-top: 4px;
|
|
3498
3502
|
padding-bottom: 4px;
|
|
3499
3503
|
}
|
|
3504
|
+
.tina-tailwind .px-3 {
|
|
3505
|
+
padding-left: 12px;
|
|
3506
|
+
padding-right: 12px;
|
|
3507
|
+
}
|
|
3500
3508
|
.tina-tailwind .py-5 {
|
|
3501
3509
|
padding-top: 20px;
|
|
3502
3510
|
padding-bottom: 20px;
|
|
@@ -3519,6 +3527,9 @@ var styles = `.tina-tailwind {
|
|
|
3519
3527
|
.tina-tailwind .pl-3 {
|
|
3520
3528
|
padding-left: 12px;
|
|
3521
3529
|
}
|
|
3530
|
+
.tina-tailwind .pl-5 {
|
|
3531
|
+
padding-left: 20px;
|
|
3532
|
+
}
|
|
3522
3533
|
.tina-tailwind .pt-3 {
|
|
3523
3534
|
padding-top: 12px;
|
|
3524
3535
|
}
|
|
@@ -4948,12 +4959,15 @@ const handleNavigate = (navigate, cms, collection, collectionDefinition, documen
|
|
|
4948
4959
|
const plugins = cms.plugins.all("tina-admin");
|
|
4949
4960
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4950
4961
|
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
4951
|
-
|
|
4962
|
+
let routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4952
4963
|
document,
|
|
4953
4964
|
collection: collectionDefinition
|
|
4954
4965
|
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4955
4966
|
if (routeOverride) {
|
|
4956
|
-
|
|
4967
|
+
if (routeOverride.startsWith("/")) {
|
|
4968
|
+
routeOverride = routeOverride.slice(1);
|
|
4969
|
+
}
|
|
4970
|
+
tinaPreview ? navigate(`/preview/${routeOverride}`) : window.location.href = routeOverride;
|
|
4957
4971
|
return null;
|
|
4958
4972
|
} else {
|
|
4959
4973
|
navigate(document._sys.breadcrumbs.join("/"));
|
|
@@ -5084,34 +5098,36 @@ const CollectionListPage = () => {
|
|
|
5084
5098
|
key: `document-${document.node._sys.relativePath}`,
|
|
5085
5099
|
className: ""
|
|
5086
5100
|
}, /* @__PURE__ */ React.createElement("td", {
|
|
5087
|
-
className: "
|
|
5101
|
+
className: "pl-5 pr-3 py-2 truncate max-w-0"
|
|
5088
5102
|
}, /* @__PURE__ */ React.createElement("a", {
|
|
5089
|
-
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
5103
|
+
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer truncate",
|
|
5090
5104
|
onClick: () => {
|
|
5091
5105
|
handleNavigate(navigate, cms, collection, collectionDefinition, document.node);
|
|
5092
5106
|
}
|
|
5093
5107
|
}, /* @__PURE__ */ React.createElement(BiEdit, {
|
|
5094
|
-
className: "inline-block h-6 w-auto opacity-70"
|
|
5095
|
-
}), /* @__PURE__ */ React.createElement("span",
|
|
5108
|
+
className: "inline-block h-6 w-auto flex-shrink-0 opacity-70"
|
|
5109
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
5110
|
+
className: "truncate block"
|
|
5111
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5096
5112
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5097
5113
|
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
5098
|
-
className: "h-5 leading-5 block
|
|
5114
|
+
className: "h-5 leading-5 block truncate"
|
|
5099
5115
|
}, subfolders && /* @__PURE__ */ React.createElement("span", {
|
|
5100
5116
|
className: "text-xs text-gray-400"
|
|
5101
5117
|
}, `${subfolders}/`), /* @__PURE__ */ React.createElement("span", null, hasTitle ? (_a2 = document.node._sys) == null ? void 0 : _a2.title : document.node._sys.filename))))), hasTitle && /* @__PURE__ */ React.createElement("td", {
|
|
5102
|
-
className: "px-
|
|
5118
|
+
className: "px-3 py-4 truncate max-w-0 "
|
|
5103
5119
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
5104
5120
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5105
5121
|
}, "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
5106
|
-
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
5122
|
+
className: "h-5 leading-5 block text-sm font-medium text-gray-900 truncate"
|
|
5107
5123
|
}, document.node._sys.filename)), /* @__PURE__ */ React.createElement("td", {
|
|
5108
|
-
className: "px-
|
|
5124
|
+
className: "px-3 py-4 truncate w-[15%]"
|
|
5109
5125
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
5110
5126
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5111
5127
|
}, "Extension"), /* @__PURE__ */ React.createElement("span", {
|
|
5112
5128
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
5113
5129
|
}, document.node._sys.extension)), /* @__PURE__ */ React.createElement("td", {
|
|
5114
|
-
className: "px-
|
|
5130
|
+
className: "px-3 py-4 truncate w-[15%]"
|
|
5115
5131
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
5116
5132
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5117
5133
|
}, "Template"), /* @__PURE__ */ React.createElement("span", {
|
|
@@ -5550,7 +5566,47 @@ const SetPreviewFlag = ({
|
|
|
5550
5566
|
}, [preview]);
|
|
5551
5567
|
return null;
|
|
5552
5568
|
};
|
|
5553
|
-
const
|
|
5569
|
+
const PreviewInner = ({ preview, config }) => {
|
|
5570
|
+
const params = useParams();
|
|
5571
|
+
const navigate = useNavigate();
|
|
5572
|
+
const [url, setURL] = React.useState(`/${params["*"]}`);
|
|
5573
|
+
const [reportedURL, setReportedURL] = useState(null);
|
|
5574
|
+
const ref = React.useRef(null);
|
|
5575
|
+
const paramURL = `/${params["*"]}`;
|
|
5576
|
+
React.useEffect(() => {
|
|
5577
|
+
if (reportedURL !== paramURL && paramURL) {
|
|
5578
|
+
setURL(paramURL);
|
|
5579
|
+
}
|
|
5580
|
+
}, [paramURL]);
|
|
5581
|
+
React.useEffect(() => {
|
|
5582
|
+
if ((reportedURL !== url || reportedURL !== paramURL) && reportedURL) {
|
|
5583
|
+
navigate(`/preview${reportedURL}`);
|
|
5584
|
+
}
|
|
5585
|
+
}, [reportedURL]);
|
|
5586
|
+
React.useEffect(() => {
|
|
5587
|
+
setInterval(() => {
|
|
5588
|
+
var _a;
|
|
5589
|
+
if (ref.current) {
|
|
5590
|
+
const url2 = new URL(((_a = ref.current.contentWindow) == null ? void 0 : _a.location.href) || "");
|
|
5591
|
+
if (url2.origin === "null") {
|
|
5592
|
+
return;
|
|
5593
|
+
}
|
|
5594
|
+
const href = url2.href.replace(url2.origin, "");
|
|
5595
|
+
setReportedURL(href);
|
|
5596
|
+
}
|
|
5597
|
+
}, 100);
|
|
5598
|
+
}, [ref.current]);
|
|
5599
|
+
const Preview = preview;
|
|
5600
|
+
return /* @__PURE__ */ React.createElement(Preview, {
|
|
5601
|
+
url,
|
|
5602
|
+
iframeRef: ref,
|
|
5603
|
+
...config
|
|
5604
|
+
});
|
|
5605
|
+
};
|
|
5606
|
+
const TinaAdmin = ({
|
|
5607
|
+
preview,
|
|
5608
|
+
config
|
|
5609
|
+
}) => {
|
|
5554
5610
|
const isSSR2 = typeof window === "undefined";
|
|
5555
5611
|
const { edit } = useEditState();
|
|
5556
5612
|
if (isSSR2) {
|
|
@@ -5566,8 +5622,11 @@ const TinaAdmin = ({ preview }) => {
|
|
|
5566
5622
|
preview,
|
|
5567
5623
|
cms
|
|
5568
5624
|
}), /* @__PURE__ */ React.createElement(Routes, null, preview && /* @__PURE__ */ React.createElement(Route, {
|
|
5569
|
-
path: "preview",
|
|
5570
|
-
element:
|
|
5625
|
+
path: "/preview/*",
|
|
5626
|
+
element: /* @__PURE__ */ React.createElement(PreviewInner, {
|
|
5627
|
+
config,
|
|
5628
|
+
preview
|
|
5629
|
+
})
|
|
5571
5630
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5572
5631
|
path: "collections/:collectionName/new",
|
|
5573
5632
|
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("
|
|
3
|
-
})(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("@tinacms/sharedctx"), require("url-pattern"), require("react-router-dom"), require("@headlessui/react"), require("@react-hook/window-size")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/toolkit", "graphql", "lodash.set", "react", "final-form", "@tinacms/schema-tools", "graphql-tag", "yup", "@tinacms/sharedctx", "url-pattern", "react-router-dom", "@headlessui/react", "@react-hook/window-size"], 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));
|
|
3
|
+
})(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup, sharedctx, UrlPattern, reactRouterDom, react, windowSize) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopDefaultLegacy(e) {
|
|
6
6
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
31
31
|
var gql__default = /* @__PURE__ */ _interopDefaultLegacy(gql$1);
|
|
32
32
|
var yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
33
|
-
var styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
|
|
34
33
|
var UrlPattern__default = /* @__PURE__ */ _interopDefaultLegacy(UrlPattern);
|
|
35
34
|
function popupWindow(url, title, window2, w, h) {
|
|
36
35
|
const y = window2.top.outerHeight / 2 + window2.top.screenY - h / 2;
|
|
@@ -2457,9 +2456,10 @@ mutation addPendingDocumentMutation(
|
|
|
2457
2456
|
...action
|
|
2458
2457
|
})))));
|
|
2459
2458
|
}
|
|
2460
|
-
const ErrorLabel =
|
|
2461
|
-
|
|
2462
|
-
|
|
2459
|
+
const ErrorLabel = ({ style = {}, ...props }) => /* @__PURE__ */ React__default["default"].createElement("p", {
|
|
2460
|
+
style: { ...style, color: "var(--tina-color-error)" },
|
|
2461
|
+
...props
|
|
2462
|
+
});
|
|
2463
2463
|
const AsyncButton = ({ name, primary, action }) => {
|
|
2464
2464
|
const [submitting, setSubmitting] = React.useState(false);
|
|
2465
2465
|
const onClick = React.useCallback(async () => {
|
|
@@ -3280,6 +3280,9 @@ mutation addPendingDocumentMutation(
|
|
|
3280
3280
|
.tina-tailwind .w-56 {
|
|
3281
3281
|
width: 224px;
|
|
3282
3282
|
}
|
|
3283
|
+
.tina-tailwind .w-\\[15\\%\\] {
|
|
3284
|
+
width: 15%;
|
|
3285
|
+
}
|
|
3283
3286
|
.tina-tailwind .w-0 {
|
|
3284
3287
|
width: 0px;
|
|
3285
3288
|
}
|
|
@@ -3298,6 +3301,9 @@ mutation addPendingDocumentMutation(
|
|
|
3298
3301
|
.tina-tailwind .max-w-full {
|
|
3299
3302
|
max-width: 100%;
|
|
3300
3303
|
}
|
|
3304
|
+
.tina-tailwind .max-w-0 {
|
|
3305
|
+
max-width: 0rem;
|
|
3306
|
+
}
|
|
3301
3307
|
.tina-tailwind .flex-1 {
|
|
3302
3308
|
flex: 1 1 0%;
|
|
3303
3309
|
}
|
|
@@ -3404,9 +3410,6 @@ mutation addPendingDocumentMutation(
|
|
|
3404
3410
|
.tina-tailwind .whitespace-normal {
|
|
3405
3411
|
white-space: normal;
|
|
3406
3412
|
}
|
|
3407
|
-
.tina-tailwind .whitespace-nowrap {
|
|
3408
|
-
white-space: nowrap;
|
|
3409
|
-
}
|
|
3410
3413
|
.tina-tailwind .rounded-lg {
|
|
3411
3414
|
border-radius: 8px;
|
|
3412
3415
|
}
|
|
@@ -3515,6 +3518,10 @@ mutation addPendingDocumentMutation(
|
|
|
3515
3518
|
padding-top: 4px;
|
|
3516
3519
|
padding-bottom: 4px;
|
|
3517
3520
|
}
|
|
3521
|
+
.tina-tailwind .px-3 {
|
|
3522
|
+
padding-left: 12px;
|
|
3523
|
+
padding-right: 12px;
|
|
3524
|
+
}
|
|
3518
3525
|
.tina-tailwind .py-5 {
|
|
3519
3526
|
padding-top: 20px;
|
|
3520
3527
|
padding-bottom: 20px;
|
|
@@ -3537,6 +3544,9 @@ mutation addPendingDocumentMutation(
|
|
|
3537
3544
|
.tina-tailwind .pl-3 {
|
|
3538
3545
|
padding-left: 12px;
|
|
3539
3546
|
}
|
|
3547
|
+
.tina-tailwind .pl-5 {
|
|
3548
|
+
padding-left: 20px;
|
|
3549
|
+
}
|
|
3540
3550
|
.tina-tailwind .pt-3 {
|
|
3541
3551
|
padding-top: 12px;
|
|
3542
3552
|
}
|
|
@@ -4966,12 +4976,15 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4966
4976
|
const plugins = cms.plugins.all("tina-admin");
|
|
4967
4977
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4968
4978
|
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
4969
|
-
|
|
4979
|
+
let routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4970
4980
|
document,
|
|
4971
4981
|
collection: collectionDefinition
|
|
4972
4982
|
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4973
4983
|
if (routeOverride) {
|
|
4974
|
-
|
|
4984
|
+
if (routeOverride.startsWith("/")) {
|
|
4985
|
+
routeOverride = routeOverride.slice(1);
|
|
4986
|
+
}
|
|
4987
|
+
tinaPreview ? navigate(`/preview/${routeOverride}`) : window.location.href = routeOverride;
|
|
4975
4988
|
return null;
|
|
4976
4989
|
} else {
|
|
4977
4990
|
navigate(document._sys.breadcrumbs.join("/"));
|
|
@@ -5102,34 +5115,36 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5102
5115
|
key: `document-${document.node._sys.relativePath}`,
|
|
5103
5116
|
className: ""
|
|
5104
5117
|
}, /* @__PURE__ */ React__default["default"].createElement("td", {
|
|
5105
|
-
className: "
|
|
5118
|
+
className: "pl-5 pr-3 py-2 truncate max-w-0"
|
|
5106
5119
|
}, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
5107
|
-
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
5120
|
+
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer truncate",
|
|
5108
5121
|
onClick: () => {
|
|
5109
5122
|
handleNavigate(navigate, cms, collection, collectionDefinition, document.node);
|
|
5110
5123
|
}
|
|
5111
5124
|
}, /* @__PURE__ */ React__default["default"].createElement(BiEdit, {
|
|
5112
|
-
className: "inline-block h-6 w-auto opacity-70"
|
|
5113
|
-
}), /* @__PURE__ */ React__default["default"].createElement("span",
|
|
5125
|
+
className: "inline-block h-6 w-auto flex-shrink-0 opacity-70"
|
|
5126
|
+
}), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5127
|
+
className: "truncate block"
|
|
5128
|
+
}, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5114
5129
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5115
5130
|
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5116
|
-
className: "h-5 leading-5 block
|
|
5131
|
+
className: "h-5 leading-5 block truncate"
|
|
5117
5132
|
}, subfolders && /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5118
5133
|
className: "text-xs text-gray-400"
|
|
5119
5134
|
}, `${subfolders}/`), /* @__PURE__ */ React__default["default"].createElement("span", null, hasTitle ? (_a2 = document.node._sys) == null ? void 0 : _a2.title : document.node._sys.filename))))), hasTitle && /* @__PURE__ */ React__default["default"].createElement("td", {
|
|
5120
|
-
className: "px-
|
|
5135
|
+
className: "px-3 py-4 truncate max-w-0 "
|
|
5121
5136
|
}, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5122
5137
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5123
5138
|
}, "Filename"), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5124
|
-
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
5139
|
+
className: "h-5 leading-5 block text-sm font-medium text-gray-900 truncate"
|
|
5125
5140
|
}, document.node._sys.filename)), /* @__PURE__ */ React__default["default"].createElement("td", {
|
|
5126
|
-
className: "px-
|
|
5141
|
+
className: "px-3 py-4 truncate w-[15%]"
|
|
5127
5142
|
}, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5128
5143
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5129
5144
|
}, "Extension"), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5130
5145
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
5131
5146
|
}, document.node._sys.extension)), /* @__PURE__ */ React__default["default"].createElement("td", {
|
|
5132
|
-
className: "px-
|
|
5147
|
+
className: "px-3 py-4 truncate w-[15%]"
|
|
5133
5148
|
}, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
5134
5149
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
5135
5150
|
}, "Template"), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
@@ -5568,7 +5583,47 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5568
5583
|
}, [preview]);
|
|
5569
5584
|
return null;
|
|
5570
5585
|
};
|
|
5571
|
-
const
|
|
5586
|
+
const PreviewInner = ({ preview, config }) => {
|
|
5587
|
+
const params = reactRouterDom.useParams();
|
|
5588
|
+
const navigate = reactRouterDom.useNavigate();
|
|
5589
|
+
const [url, setURL] = React__default["default"].useState(`/${params["*"]}`);
|
|
5590
|
+
const [reportedURL, setReportedURL] = React.useState(null);
|
|
5591
|
+
const ref = React__default["default"].useRef(null);
|
|
5592
|
+
const paramURL = `/${params["*"]}`;
|
|
5593
|
+
React__default["default"].useEffect(() => {
|
|
5594
|
+
if (reportedURL !== paramURL && paramURL) {
|
|
5595
|
+
setURL(paramURL);
|
|
5596
|
+
}
|
|
5597
|
+
}, [paramURL]);
|
|
5598
|
+
React__default["default"].useEffect(() => {
|
|
5599
|
+
if ((reportedURL !== url || reportedURL !== paramURL) && reportedURL) {
|
|
5600
|
+
navigate(`/preview${reportedURL}`);
|
|
5601
|
+
}
|
|
5602
|
+
}, [reportedURL]);
|
|
5603
|
+
React__default["default"].useEffect(() => {
|
|
5604
|
+
setInterval(() => {
|
|
5605
|
+
var _a;
|
|
5606
|
+
if (ref.current) {
|
|
5607
|
+
const url2 = new URL(((_a = ref.current.contentWindow) == null ? void 0 : _a.location.href) || "");
|
|
5608
|
+
if (url2.origin === "null") {
|
|
5609
|
+
return;
|
|
5610
|
+
}
|
|
5611
|
+
const href = url2.href.replace(url2.origin, "");
|
|
5612
|
+
setReportedURL(href);
|
|
5613
|
+
}
|
|
5614
|
+
}, 100);
|
|
5615
|
+
}, [ref.current]);
|
|
5616
|
+
const Preview = preview;
|
|
5617
|
+
return /* @__PURE__ */ React__default["default"].createElement(Preview, {
|
|
5618
|
+
url,
|
|
5619
|
+
iframeRef: ref,
|
|
5620
|
+
...config
|
|
5621
|
+
});
|
|
5622
|
+
};
|
|
5623
|
+
const TinaAdmin = ({
|
|
5624
|
+
preview,
|
|
5625
|
+
config
|
|
5626
|
+
}) => {
|
|
5572
5627
|
const isSSR2 = typeof window === "undefined";
|
|
5573
5628
|
const { edit } = sharedctx.useEditState();
|
|
5574
5629
|
if (isSSR2) {
|
|
@@ -5584,8 +5639,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5584
5639
|
preview,
|
|
5585
5640
|
cms
|
|
5586
5641
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, preview && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5587
|
-
path: "preview",
|
|
5588
|
-
element:
|
|
5642
|
+
path: "/preview/*",
|
|
5643
|
+
element: /* @__PURE__ */ React__default["default"].createElement(PreviewInner, {
|
|
5644
|
+
config,
|
|
5645
|
+
preview
|
|
5646
|
+
})
|
|
5589
5647
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5590
5648
|
path: "collections/:collectionName/new",
|
|
5591
5649
|
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
@@ -5657,6 +5715,18 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5657
5715
|
const defineStaticConfig = (config) => {
|
|
5658
5716
|
return config;
|
|
5659
5717
|
};
|
|
5718
|
+
Object.defineProperty(exports2, "NAMER", {
|
|
5719
|
+
enumerable: true,
|
|
5720
|
+
get: function() {
|
|
5721
|
+
return schemaTools.NAMER;
|
|
5722
|
+
}
|
|
5723
|
+
});
|
|
5724
|
+
Object.defineProperty(exports2, "resolveForm", {
|
|
5725
|
+
enumerable: true,
|
|
5726
|
+
get: function() {
|
|
5727
|
+
return schemaTools.resolveForm;
|
|
5728
|
+
}
|
|
5729
|
+
});
|
|
5660
5730
|
exports2.AuthWallInner = AuthWallInner;
|
|
5661
5731
|
exports2.Client = Client;
|
|
5662
5732
|
exports2.DEFAULT_LOCAL_TINA_GQL_SERVER_URL = DEFAULT_LOCAL_TINA_GQL_SERVER_URL;
|
package/dist/react.es.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
function useTina(props) {
|
|
3
3
|
const [data, setData] = React.useState(props.data);
|
|
4
|
+
const id = JSON.stringify({ query: props.query, variables: props.variables });
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
setData(props.data);
|
|
7
|
+
}, [id]);
|
|
4
8
|
React.useEffect(() => {
|
|
5
|
-
const id = btoa(JSON.stringify({ query: props.query }));
|
|
6
9
|
parent.postMessage({ type: "open", ...props, id }, window.location.origin);
|
|
7
10
|
window.addEventListener("message", (event) => {
|
|
8
|
-
if (event.data.id === id) {
|
|
9
|
-
console.log("child: event received");
|
|
11
|
+
if (event.data.id === id && event.data.type === "updateData") {
|
|
10
12
|
setData(event.data.data);
|
|
11
13
|
}
|
|
12
14
|
});
|
|
13
15
|
return () => parent.postMessage({ type: "close", id }, window.location.origin);
|
|
14
|
-
}, []);
|
|
16
|
+
}, [id]);
|
|
15
17
|
return { data };
|
|
16
18
|
}
|
|
17
19
|
export { useTina };
|
package/dist/react.js
CHANGED
|
@@ -8,17 +8,19 @@
|
|
|
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 id = JSON.stringify({ query: props.query, variables: props.variables });
|
|
12
|
+
React__default["default"].useEffect(() => {
|
|
13
|
+
setData(props.data);
|
|
14
|
+
}, [id]);
|
|
11
15
|
React__default["default"].useEffect(() => {
|
|
12
|
-
const id = btoa(JSON.stringify({ query: props.query }));
|
|
13
16
|
parent.postMessage({ type: "open", ...props, id }, window.location.origin);
|
|
14
17
|
window.addEventListener("message", (event) => {
|
|
15
|
-
if (event.data.id === id) {
|
|
16
|
-
console.log("child: event received");
|
|
18
|
+
if (event.data.id === id && event.data.type === "updateData") {
|
|
17
19
|
setData(event.data.data);
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
return () => parent.postMessage({ type: "close", id }, window.location.origin);
|
|
21
|
-
}, []);
|
|
23
|
+
}, [id]);
|
|
22
24
|
return { data };
|
|
23
25
|
}
|
|
24
26
|
exports2.useTina = useTina;
|
package/dist/style.css
CHANGED
|
@@ -462,6 +462,9 @@
|
|
|
462
462
|
.tina-tailwind .w-56 {
|
|
463
463
|
width: 224px;
|
|
464
464
|
}
|
|
465
|
+
.tina-tailwind .w-\[15\%\] {
|
|
466
|
+
width: 15%;
|
|
467
|
+
}
|
|
465
468
|
.tina-tailwind .w-0 {
|
|
466
469
|
width: 0px;
|
|
467
470
|
}
|
|
@@ -480,6 +483,9 @@
|
|
|
480
483
|
.tina-tailwind .max-w-full {
|
|
481
484
|
max-width: 100%;
|
|
482
485
|
}
|
|
486
|
+
.tina-tailwind .max-w-0 {
|
|
487
|
+
max-width: 0rem;
|
|
488
|
+
}
|
|
483
489
|
.tina-tailwind .flex-1 {
|
|
484
490
|
flex: 1 1 0%;
|
|
485
491
|
}
|
|
@@ -586,9 +592,6 @@
|
|
|
586
592
|
.tina-tailwind .whitespace-normal {
|
|
587
593
|
white-space: normal;
|
|
588
594
|
}
|
|
589
|
-
.tina-tailwind .whitespace-nowrap {
|
|
590
|
-
white-space: nowrap;
|
|
591
|
-
}
|
|
592
595
|
.tina-tailwind .rounded-lg {
|
|
593
596
|
border-radius: 8px;
|
|
594
597
|
}
|
|
@@ -697,6 +700,10 @@
|
|
|
697
700
|
padding-top: 4px;
|
|
698
701
|
padding-bottom: 4px;
|
|
699
702
|
}
|
|
703
|
+
.tina-tailwind .px-3 {
|
|
704
|
+
padding-left: 12px;
|
|
705
|
+
padding-right: 12px;
|
|
706
|
+
}
|
|
700
707
|
.tina-tailwind .py-5 {
|
|
701
708
|
padding-top: 20px;
|
|
702
709
|
padding-bottom: 20px;
|
|
@@ -719,6 +726,9 @@
|
|
|
719
726
|
.tina-tailwind .pl-3 {
|
|
720
727
|
padding-left: 12px;
|
|
721
728
|
}
|
|
729
|
+
.tina-tailwind .pl-5 {
|
|
730
|
+
padding-left: 20px;
|
|
731
|
+
}
|
|
722
732
|
.tina-tailwind .pt-3 {
|
|
723
733
|
padding-top: 12px;
|
|
724
734
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"@react-hook/window-size": "^3.0.7",
|
|
57
57
|
"@tinacms/schema-tools": "0.1.8",
|
|
58
58
|
"@tinacms/sharedctx": "0.1.3",
|
|
59
|
-
"@tinacms/toolkit": "0.
|
|
59
|
+
"@tinacms/toolkit": "0.58.1",
|
|
60
60
|
"crypto-js": "^4.0.0",
|
|
61
61
|
"fetch-ponyfill": "^7.1.0",
|
|
62
62
|
"final-form": "4.20.1",
|
|
63
|
-
"graphql": "
|
|
63
|
+
"graphql": "15.8.0",
|
|
64
64
|
"graphql-tag": "^2.11.0",
|
|
65
65
|
"lodash.set": "^4.3.2",
|
|
66
66
|
"prism-react-renderer": "^1.3.5",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@testing-library/react": "^12.0.0",
|
|
76
76
|
"@testing-library/react-hooks": "^7.0.2",
|
|
77
77
|
"@testing-library/user-event": "^12.7.0",
|
|
78
|
-
"@tinacms/scripts": "0.51.
|
|
78
|
+
"@tinacms/scripts": "0.51.3",
|
|
79
79
|
"@types/jest": "^27.0.1",
|
|
80
80
|
"@types/lodash": "^4.14.169",
|
|
81
81
|
"@types/node": "^14.0.13",
|
|
@@ -89,14 +89,12 @@
|
|
|
89
89
|
"react": "17.0.2",
|
|
90
90
|
"react-dom": "17.0.2",
|
|
91
91
|
"react-is": "^17.0.2",
|
|
92
|
-
"styled-components": "^5.2.0",
|
|
93
92
|
"typescript": "4.3.5"
|
|
94
93
|
},
|
|
95
94
|
"peerDependencies": {
|
|
96
95
|
"react": ">=16.14.0",
|
|
97
96
|
"react-dom": ">=16.14.0",
|
|
98
|
-
"react-is": "^16.13.1 || <18.0.0"
|
|
99
|
-
"styled-components": "*"
|
|
97
|
+
"react-is": "^16.13.1 || <18.0.0"
|
|
100
98
|
},
|
|
101
99
|
"publishConfig": {
|
|
102
100
|
"registry": "https://registry.npmjs.org"
|