tinacms 0.69.6 → 0.69.8
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 -1
- package/dist/client.es.js +0 -3
- package/dist/client.js +0 -3
- package/dist/index.d.ts +5 -2
- package/dist/index.es.js +108 -36
- package/dist/index.js +107 -34
- package/dist/react.d.ts +11 -0
- package/dist/react.es.js +17 -0
- package/dist/react.js +26 -0
- package/dist/style.css +6 -3
- package/dist/tina-cms.d.ts +2 -0
- package/dist/utils/index.d.ts +2 -1
- package/package.json +10 -5
package/dist/admin/index.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ 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: (
|
|
13
|
+
export declare const TinaAdmin: ({ preview }: {
|
|
14
|
+
preview?: JSX.Element;
|
|
15
|
+
}) => JSX.Element;
|
package/dist/client.es.js
CHANGED
|
@@ -24,9 +24,6 @@ class TinaClient {
|
|
|
24
24
|
if (!branch || !clientId) {
|
|
25
25
|
throw new Error(`Invalid URL format provided. Expected: https://${TINA_HOST}/content/<ClientID>/github/<Branch> but but received ${url2}`);
|
|
26
26
|
}
|
|
27
|
-
if (params.host !== TINA_HOST) {
|
|
28
|
-
throw new Error(`The only supported hosts are ${TINA_HOST} or localhost, but received ${params.host}.`);
|
|
29
|
-
}
|
|
30
27
|
return {
|
|
31
28
|
host: params.host,
|
|
32
29
|
clientId,
|
package/dist/client.js
CHANGED
|
@@ -31,9 +31,6 @@
|
|
|
31
31
|
if (!branch || !clientId) {
|
|
32
32
|
throw new Error(`Invalid URL format provided. Expected: https://${TINA_HOST}/content/<ClientID>/github/<Branch> but but received ${url2}`);
|
|
33
33
|
}
|
|
34
|
-
if (params.host !== TINA_HOST) {
|
|
35
|
-
throw new Error(`The only supported hosts are ${TINA_HOST} or localhost, but received ${params.host}.`);
|
|
36
|
-
}
|
|
37
34
|
return {
|
|
38
35
|
host: params.host,
|
|
39
36
|
clientId,
|
package/dist/index.d.ts
CHANGED
|
@@ -20,11 +20,13 @@ 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
|
-
import { TinaCMSProvider2 } from './tina-cms';
|
|
23
|
+
import { TinaCMSProvider2, DocumentCreatorCallback } from './tina-cms';
|
|
24
24
|
import type { TinaCMSProviderDefaultProps } from './types/cms';
|
|
25
25
|
export type { TinaCMSProviderDefaultProps };
|
|
26
26
|
export default TinaCMSProvider2;
|
|
27
|
-
import
|
|
27
|
+
import { TinaCMS } from '@tinacms/toolkit';
|
|
28
|
+
import { formifyCallback } from './hooks/use-graphql-forms';
|
|
29
|
+
import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase as TinaTemplate, TinaFieldBase, TinaCMSConfig } from '@tinacms/schema-tools';
|
|
28
30
|
export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
|
|
29
31
|
export declare type TinaCloudCollection = TinaCloudCollectionBase<false>;
|
|
30
32
|
export declare type TinaCollection = TinaCloudCollectionBase<false>;
|
|
@@ -32,3 +34,4 @@ export declare type TinaField = TinaFieldBase;
|
|
|
32
34
|
export type { TinaTemplate };
|
|
33
35
|
export declare const defineSchema: (config: TinaCloudSchema) => TinaCloudSchema;
|
|
34
36
|
export declare const defineConfig: (config: Omit<TinaCMSProviderDefaultProps, 'children'>) => Omit<TinaCMSProviderDefaultProps, "children">;
|
|
37
|
+
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>;
|
package/dist/index.es.js
CHANGED
|
@@ -9,7 +9,7 @@ import { resolveForm, TinaSchema, addNamespaceToSchema, validateSchema } from "@
|
|
|
9
9
|
import gql$1 from "graphql-tag";
|
|
10
10
|
import * as yup from "yup";
|
|
11
11
|
import styled from "styled-components";
|
|
12
|
-
import { setEditing, TinaDataContext, useEditState } from "@tinacms/sharedctx";
|
|
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";
|
|
15
15
|
import { Transition, Menu } from "@headlessui/react";
|
|
@@ -352,9 +352,10 @@ const createClient = ({
|
|
|
352
352
|
isLocalClient = true,
|
|
353
353
|
branch,
|
|
354
354
|
tinaioConfig,
|
|
355
|
-
schema
|
|
355
|
+
schema,
|
|
356
|
+
apiUrl
|
|
356
357
|
}) => {
|
|
357
|
-
return isLocalClient ? new LocalClient({ schema }) : new Client({
|
|
358
|
+
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
358
359
|
clientId: clientId || "",
|
|
359
360
|
branch: branch || "main",
|
|
360
361
|
tokenStorage: "LOCAL_STORAGE",
|
|
@@ -2544,7 +2545,7 @@ class TinaAdminApi {
|
|
|
2544
2545
|
collection: collectionName,
|
|
2545
2546
|
includeDocuments,
|
|
2546
2547
|
sort,
|
|
2547
|
-
limit:
|
|
2548
|
+
limit: 50,
|
|
2548
2549
|
after
|
|
2549
2550
|
}
|
|
2550
2551
|
}) : await this.api.request(`#graphql
|
|
@@ -2585,7 +2586,7 @@ class TinaAdminApi {
|
|
|
2585
2586
|
collection: collectionName,
|
|
2586
2587
|
includeDocuments,
|
|
2587
2588
|
sort,
|
|
2588
|
-
limit:
|
|
2589
|
+
limit: 50,
|
|
2589
2590
|
after
|
|
2590
2591
|
}
|
|
2591
2592
|
});
|
|
@@ -2714,7 +2715,9 @@ const TinaCloudProvider = (props) => {
|
|
|
2714
2715
|
useTinaAuthRedirect();
|
|
2715
2716
|
const cms = React.useMemo(() => props.cms || new TinaCMS({
|
|
2716
2717
|
enabled: true,
|
|
2717
|
-
sidebar: true
|
|
2718
|
+
sidebar: true,
|
|
2719
|
+
isLocalClient: props.isLocalClient,
|
|
2720
|
+
clientId: props.clientId
|
|
2718
2721
|
}), [props.cms]);
|
|
2719
2722
|
if (!cms.api.tina) {
|
|
2720
2723
|
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
@@ -2795,7 +2798,7 @@ const TinaCloudProvider = (props) => {
|
|
|
2795
2798
|
})));
|
|
2796
2799
|
};
|
|
2797
2800
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2798
|
-
var styles =
|
|
2801
|
+
var styles = `.tina-tailwind {
|
|
2799
2802
|
line-height: 1.5;
|
|
2800
2803
|
-webkit-text-size-adjust: 100%;
|
|
2801
2804
|
-moz-tab-size: 4;
|
|
@@ -3169,6 +3172,9 @@ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
|
3169
3172
|
.tina-tailwind .mr-2 {
|
|
3170
3173
|
margin-right: 8px;
|
|
3171
3174
|
}
|
|
3175
|
+
.tina-tailwind .ml-1 {
|
|
3176
|
+
margin-left: 4px;
|
|
3177
|
+
}
|
|
3172
3178
|
.tina-tailwind .mb-2 {
|
|
3173
3179
|
margin-bottom: 8px;
|
|
3174
3180
|
}
|
|
@@ -3181,9 +3187,6 @@ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
|
3181
3187
|
.tina-tailwind .-mt-0 {
|
|
3182
3188
|
margin-top: -0px;
|
|
3183
3189
|
}
|
|
3184
|
-
.tina-tailwind .ml-1 {
|
|
3185
|
-
margin-left: 4px;
|
|
3186
|
-
}
|
|
3187
3190
|
.tina-tailwind .mt-2 {
|
|
3188
3191
|
margin-top: 8px;
|
|
3189
3192
|
}
|
|
@@ -3708,6 +3711,9 @@ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
|
3708
3711
|
.tina-tailwind .hover\\:opacity-100:hover {
|
|
3709
3712
|
opacity: 1;
|
|
3710
3713
|
}
|
|
3714
|
+
.tina-tailwind .hover\\:opacity-60:hover {
|
|
3715
|
+
opacity: .6;
|
|
3716
|
+
}
|
|
3711
3717
|
.tina-tailwind .focus\\:text-blue-400:focus {
|
|
3712
3718
|
--tw-text-opacity: 1;
|
|
3713
3719
|
color: rgb(34 150 254 / var(--tw-text-opacity));
|
|
@@ -3733,7 +3739,7 @@ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
|
3733
3739
|
--tw-ring-opacity: 1;
|
|
3734
3740
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3735
3741
|
}
|
|
3736
|
-
|
|
3742
|
+
`;
|
|
3737
3743
|
class ContentCreatorPlugin {
|
|
3738
3744
|
constructor(options) {
|
|
3739
3745
|
this.__type = "content-creator";
|
|
@@ -3925,7 +3931,6 @@ function useTina({
|
|
|
3925
3931
|
isLoading
|
|
3926
3932
|
};
|
|
3927
3933
|
}
|
|
3928
|
-
const TINA_HOST = "content.tinajs.io";
|
|
3929
3934
|
const parseURL = (url) => {
|
|
3930
3935
|
if (url.includes("localhost")) {
|
|
3931
3936
|
return { branch: null, isLocalClient: true, clientId: null };
|
|
@@ -3940,9 +3945,6 @@ const parseURL = (url) => {
|
|
|
3940
3945
|
if (!branch || !clientId) {
|
|
3941
3946
|
throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
|
|
3942
3947
|
}
|
|
3943
|
-
if (params.host !== TINA_HOST) {
|
|
3944
|
-
throw new Error(`The only supported hosts are ${TINA_HOST} or localhost, but received ${params.host}.`);
|
|
3945
|
-
}
|
|
3946
3948
|
return {
|
|
3947
3949
|
branch,
|
|
3948
3950
|
clientId,
|
|
@@ -4058,7 +4060,8 @@ const TinaCMSProvider2 = ({
|
|
|
4058
4060
|
isLocalClient,
|
|
4059
4061
|
cmsCallback: props.cmsCallback,
|
|
4060
4062
|
mediaStore: props.mediaStore,
|
|
4061
|
-
|
|
4063
|
+
apiUrl: apiURL,
|
|
4064
|
+
schema: { ...schema, config: { ...schema.config, ...props } }
|
|
4062
4065
|
}, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(DocumentCreator, {
|
|
4063
4066
|
documentCreatorCallback
|
|
4064
4067
|
}), /* @__PURE__ */ React.createElement(TinaDataProvider, {
|
|
@@ -4120,6 +4123,7 @@ const FormRegistrar = ({
|
|
|
4120
4123
|
onPayloadStateChange
|
|
4121
4124
|
}) => {
|
|
4122
4125
|
const cms = useCMS();
|
|
4126
|
+
const { setFormsRegistering } = React.useContext(EditContext);
|
|
4123
4127
|
const [payload, isLoading] = useGraphqlForms({
|
|
4124
4128
|
query: request == null ? void 0 : request.query,
|
|
4125
4129
|
variables: request == null ? void 0 : request.variables,
|
|
@@ -4133,6 +4137,7 @@ const FormRegistrar = ({
|
|
|
4133
4137
|
});
|
|
4134
4138
|
React.useEffect(() => {
|
|
4135
4139
|
onPayloadStateChange({ payload, isLoading });
|
|
4140
|
+
setFormsRegistering && setFormsRegistering(isLoading);
|
|
4136
4141
|
}, [JSON.stringify(payload), isLoading]);
|
|
4137
4142
|
return isLoading ? /* @__PURE__ */ React.createElement(Loader, null, /* @__PURE__ */ React.createElement(React.Fragment, null)) : null;
|
|
4138
4143
|
};
|
|
@@ -4424,6 +4429,7 @@ const Sidebar = ({ cms }) => {
|
|
|
4424
4429
|
var _a, _b;
|
|
4425
4430
|
const collectionsInfo = useGetCollections(cms);
|
|
4426
4431
|
const screens = cms.plugins.getType("screen").all();
|
|
4432
|
+
const cloudConfigs = cms.plugins.getType("cloud-config").all();
|
|
4427
4433
|
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
4428
4434
|
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
4429
4435
|
const navBreakpoint = 1e3;
|
|
@@ -4434,15 +4440,19 @@ const Sidebar = ({ cms }) => {
|
|
|
4434
4440
|
showCollections: true,
|
|
4435
4441
|
collectionsInfo,
|
|
4436
4442
|
screens,
|
|
4443
|
+
cloudConfigs,
|
|
4437
4444
|
contentCreators: [],
|
|
4438
4445
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4439
4446
|
label: view.name,
|
|
4440
|
-
to:
|
|
4447
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4441
4448
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4442
4449
|
}),
|
|
4450
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(SidebarCloudLink, {
|
|
4451
|
+
config
|
|
4452
|
+
}),
|
|
4443
4453
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4444
4454
|
label: collection.label ? collection.label : collection.name,
|
|
4445
|
-
to:
|
|
4455
|
+
to: `/collections/${collection.name}`,
|
|
4446
4456
|
Icon: ImFilesEmpty
|
|
4447
4457
|
})
|
|
4448
4458
|
}), !renderDesktopNav && /* @__PURE__ */ React.createElement(Transition, {
|
|
@@ -4463,18 +4473,22 @@ const Sidebar = ({ cms }) => {
|
|
|
4463
4473
|
showCollections: true,
|
|
4464
4474
|
collectionsInfo,
|
|
4465
4475
|
screens,
|
|
4476
|
+
cloudConfigs,
|
|
4466
4477
|
contentCreators: [],
|
|
4467
4478
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4468
4479
|
label: view.name,
|
|
4469
|
-
to:
|
|
4480
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4470
4481
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
4471
4482
|
onClick: () => {
|
|
4472
4483
|
setMenuIsOpen(false);
|
|
4473
4484
|
}
|
|
4474
4485
|
}),
|
|
4486
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(SidebarCloudLink, {
|
|
4487
|
+
config
|
|
4488
|
+
}),
|
|
4475
4489
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4476
4490
|
label: collection.label ? collection.label : collection.name,
|
|
4477
|
-
to:
|
|
4491
|
+
to: `/collections/${collection.name}`,
|
|
4478
4492
|
Icon: ImFilesEmpty,
|
|
4479
4493
|
onClick: () => {
|
|
4480
4494
|
setMenuIsOpen(false);
|
|
@@ -4529,6 +4543,25 @@ const SidebarLink = (props) => {
|
|
|
4529
4543
|
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4530
4544
|
}), " ", label);
|
|
4531
4545
|
};
|
|
4546
|
+
const SidebarCloudLink = ({ config }) => {
|
|
4547
|
+
if (config.text) {
|
|
4548
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
4549
|
+
className: "text-base tracking-wide text-gray-500 flex items-center opacity-90"
|
|
4550
|
+
}, config.text, " ", /* @__PURE__ */ React.createElement("a", {
|
|
4551
|
+
target: "_blank",
|
|
4552
|
+
className: "ml-1 text-blue-600 hover:opacity-60",
|
|
4553
|
+
href: config.link.href
|
|
4554
|
+
}, config.link.text));
|
|
4555
|
+
}
|
|
4556
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
4557
|
+
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100"
|
|
4558
|
+
}, /* @__PURE__ */ React.createElement(config.Icon, {
|
|
4559
|
+
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4560
|
+
}), /* @__PURE__ */ React.createElement("a", {
|
|
4561
|
+
target: "_blank",
|
|
4562
|
+
href: config.link.href
|
|
4563
|
+
}, config.link.text));
|
|
4564
|
+
};
|
|
4532
4565
|
const GetCMS = ({ children }) => {
|
|
4533
4566
|
try {
|
|
4534
4567
|
const cms = useCMS();
|
|
@@ -4839,12 +4872,13 @@ const handleNavigate = (navigate, cms, collection, collectionDefinition, documen
|
|
|
4839
4872
|
var _a, _b;
|
|
4840
4873
|
const plugins = cms.plugins.all("tina-admin");
|
|
4841
4874
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4875
|
+
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
4842
4876
|
const routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4843
4877
|
document,
|
|
4844
4878
|
collection: collectionDefinition
|
|
4845
4879
|
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4846
4880
|
if (routeOverride) {
|
|
4847
|
-
window.location.href = routeOverride;
|
|
4881
|
+
tinaPreview ? navigate(`/preview?iframe-url=${encodeURIComponent(routeOverride)}`) : window.location.href = routeOverride;
|
|
4848
4882
|
return null;
|
|
4849
4883
|
} else {
|
|
4850
4884
|
navigate(document._sys.breadcrumbs.join("/"));
|
|
@@ -5379,7 +5413,18 @@ const Redirect = () => {
|
|
|
5379
5413
|
}, []);
|
|
5380
5414
|
return null;
|
|
5381
5415
|
};
|
|
5382
|
-
const
|
|
5416
|
+
const SetPreviewFlag = ({
|
|
5417
|
+
preview,
|
|
5418
|
+
cms
|
|
5419
|
+
}) => {
|
|
5420
|
+
React.useEffect(() => {
|
|
5421
|
+
if (preview) {
|
|
5422
|
+
cms.flags.set("tina-iframe", true);
|
|
5423
|
+
}
|
|
5424
|
+
}, [preview]);
|
|
5425
|
+
return null;
|
|
5426
|
+
};
|
|
5427
|
+
const TinaAdmin = ({ preview }) => {
|
|
5383
5428
|
const isSSR2 = typeof window === "undefined";
|
|
5384
5429
|
const { edit } = useEditState();
|
|
5385
5430
|
if (isSSR2) {
|
|
@@ -5391,31 +5436,43 @@ const TinaAdmin = () => {
|
|
|
5391
5436
|
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5392
5437
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5393
5438
|
if (isTinaAdminEnabled) {
|
|
5394
|
-
return /* @__PURE__ */ React.createElement(
|
|
5395
|
-
|
|
5396
|
-
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5439
|
+
return /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(SetPreviewFlag, {
|
|
5440
|
+
preview,
|
|
5397
5441
|
cms
|
|
5398
|
-
}), /* @__PURE__ */ React.createElement(
|
|
5399
|
-
|
|
5400
|
-
|
|
5442
|
+
}), /* @__PURE__ */ React.createElement(Routes, null, preview && /* @__PURE__ */ React.createElement(Route, {
|
|
5443
|
+
path: "preview",
|
|
5444
|
+
element: preview
|
|
5445
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5401
5446
|
path: "collections/:collectionName/new",
|
|
5402
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5447
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5448
|
+
cms
|
|
5449
|
+
}, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5403
5450
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5404
5451
|
path: "collections/:collectionName/:templateName/new",
|
|
5405
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5452
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5453
|
+
cms
|
|
5454
|
+
}, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5406
5455
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5407
5456
|
path: "collections/:collectionName/*",
|
|
5408
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5457
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5458
|
+
cms
|
|
5459
|
+
}, /* @__PURE__ */ React.createElement(CollectionUpdatePage, null))
|
|
5409
5460
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5410
5461
|
path: "collections/:collectionName",
|
|
5411
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5462
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5463
|
+
cms
|
|
5464
|
+
}, /* @__PURE__ */ React.createElement(CollectionListPage, null))
|
|
5412
5465
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5413
5466
|
path: "screens/:screenName",
|
|
5414
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5467
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5468
|
+
cms
|
|
5469
|
+
}, /* @__PURE__ */ React.createElement(ScreenPage, null))
|
|
5415
5470
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5416
5471
|
path: "/",
|
|
5417
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5418
|
-
|
|
5472
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5473
|
+
cms
|
|
5474
|
+
}, /* @__PURE__ */ React.createElement(DashboardPage, null))
|
|
5475
|
+
})));
|
|
5419
5476
|
} else {
|
|
5420
5477
|
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5421
5478
|
path: "logout",
|
|
@@ -5427,6 +5484,18 @@ const TinaAdmin = () => {
|
|
|
5427
5484
|
}
|
|
5428
5485
|
});
|
|
5429
5486
|
};
|
|
5487
|
+
const DefaultWrapper = ({
|
|
5488
|
+
cms,
|
|
5489
|
+
children
|
|
5490
|
+
}) => {
|
|
5491
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement("div", {
|
|
5492
|
+
className: "flex items-stretch h-screen overflow-hidden"
|
|
5493
|
+
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5494
|
+
cms
|
|
5495
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
5496
|
+
className: "flex-1 relative"
|
|
5497
|
+
}, children)));
|
|
5498
|
+
};
|
|
5430
5499
|
class RouteMappingPlugin {
|
|
5431
5500
|
constructor(mapper) {
|
|
5432
5501
|
this.__type = "tina-admin";
|
|
@@ -5441,4 +5510,7 @@ const defineSchema = (config) => {
|
|
|
5441
5510
|
const defineConfig = (config) => {
|
|
5442
5511
|
return config;
|
|
5443
5512
|
};
|
|
5444
|
-
|
|
5513
|
+
const defineStaticConfig = (config) => {
|
|
5514
|
+
return config;
|
|
5515
|
+
};
|
|
5516
|
+
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
|
@@ -370,9 +370,10 @@
|
|
|
370
370
|
isLocalClient = true,
|
|
371
371
|
branch,
|
|
372
372
|
tinaioConfig,
|
|
373
|
-
schema
|
|
373
|
+
schema,
|
|
374
|
+
apiUrl
|
|
374
375
|
}) => {
|
|
375
|
-
return isLocalClient ? new LocalClient({ schema }) : new Client({
|
|
376
|
+
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
376
377
|
clientId: clientId || "",
|
|
377
378
|
branch: branch || "main",
|
|
378
379
|
tokenStorage: "LOCAL_STORAGE",
|
|
@@ -2562,7 +2563,7 @@ mutation addPendingDocumentMutation(
|
|
|
2562
2563
|
collection: collectionName,
|
|
2563
2564
|
includeDocuments,
|
|
2564
2565
|
sort,
|
|
2565
|
-
limit:
|
|
2566
|
+
limit: 50,
|
|
2566
2567
|
after
|
|
2567
2568
|
}
|
|
2568
2569
|
}) : await this.api.request(`#graphql
|
|
@@ -2603,7 +2604,7 @@ mutation addPendingDocumentMutation(
|
|
|
2603
2604
|
collection: collectionName,
|
|
2604
2605
|
includeDocuments,
|
|
2605
2606
|
sort,
|
|
2606
|
-
limit:
|
|
2607
|
+
limit: 50,
|
|
2607
2608
|
after
|
|
2608
2609
|
}
|
|
2609
2610
|
});
|
|
@@ -2732,7 +2733,9 @@ mutation addPendingDocumentMutation(
|
|
|
2732
2733
|
useTinaAuthRedirect();
|
|
2733
2734
|
const cms = React__default["default"].useMemo(() => props.cms || new toolkit.TinaCMS({
|
|
2734
2735
|
enabled: true,
|
|
2735
|
-
sidebar: true
|
|
2736
|
+
sidebar: true,
|
|
2737
|
+
isLocalClient: props.isLocalClient,
|
|
2738
|
+
clientId: props.clientId
|
|
2736
2739
|
}), [props.cms]);
|
|
2737
2740
|
if (!cms.api.tina) {
|
|
2738
2741
|
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
@@ -2813,7 +2816,7 @@ mutation addPendingDocumentMutation(
|
|
|
2813
2816
|
})));
|
|
2814
2817
|
};
|
|
2815
2818
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2816
|
-
var styles =
|
|
2819
|
+
var styles = `.tina-tailwind {
|
|
2817
2820
|
line-height: 1.5;
|
|
2818
2821
|
-webkit-text-size-adjust: 100%;
|
|
2819
2822
|
-moz-tab-size: 4;
|
|
@@ -3187,6 +3190,9 @@ mutation addPendingDocumentMutation(
|
|
|
3187
3190
|
.tina-tailwind .mr-2 {
|
|
3188
3191
|
margin-right: 8px;
|
|
3189
3192
|
}
|
|
3193
|
+
.tina-tailwind .ml-1 {
|
|
3194
|
+
margin-left: 4px;
|
|
3195
|
+
}
|
|
3190
3196
|
.tina-tailwind .mb-2 {
|
|
3191
3197
|
margin-bottom: 8px;
|
|
3192
3198
|
}
|
|
@@ -3199,9 +3205,6 @@ mutation addPendingDocumentMutation(
|
|
|
3199
3205
|
.tina-tailwind .-mt-0 {
|
|
3200
3206
|
margin-top: -0px;
|
|
3201
3207
|
}
|
|
3202
|
-
.tina-tailwind .ml-1 {
|
|
3203
|
-
margin-left: 4px;
|
|
3204
|
-
}
|
|
3205
3208
|
.tina-tailwind .mt-2 {
|
|
3206
3209
|
margin-top: 8px;
|
|
3207
3210
|
}
|
|
@@ -3726,6 +3729,9 @@ mutation addPendingDocumentMutation(
|
|
|
3726
3729
|
.tina-tailwind .hover\\:opacity-100:hover {
|
|
3727
3730
|
opacity: 1;
|
|
3728
3731
|
}
|
|
3732
|
+
.tina-tailwind .hover\\:opacity-60:hover {
|
|
3733
|
+
opacity: .6;
|
|
3734
|
+
}
|
|
3729
3735
|
.tina-tailwind .focus\\:text-blue-400:focus {
|
|
3730
3736
|
--tw-text-opacity: 1;
|
|
3731
3737
|
color: rgb(34 150 254 / var(--tw-text-opacity));
|
|
@@ -3751,7 +3757,7 @@ mutation addPendingDocumentMutation(
|
|
|
3751
3757
|
--tw-ring-opacity: 1;
|
|
3752
3758
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3753
3759
|
}
|
|
3754
|
-
|
|
3760
|
+
`;
|
|
3755
3761
|
class ContentCreatorPlugin {
|
|
3756
3762
|
constructor(options) {
|
|
3757
3763
|
this.__type = "content-creator";
|
|
@@ -3943,7 +3949,6 @@ mutation addPendingDocumentMutation(
|
|
|
3943
3949
|
isLoading
|
|
3944
3950
|
};
|
|
3945
3951
|
}
|
|
3946
|
-
const TINA_HOST = "content.tinajs.io";
|
|
3947
3952
|
const parseURL = (url) => {
|
|
3948
3953
|
if (url.includes("localhost")) {
|
|
3949
3954
|
return { branch: null, isLocalClient: true, clientId: null };
|
|
@@ -3958,9 +3963,6 @@ mutation addPendingDocumentMutation(
|
|
|
3958
3963
|
if (!branch || !clientId) {
|
|
3959
3964
|
throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
|
|
3960
3965
|
}
|
|
3961
|
-
if (params.host !== TINA_HOST) {
|
|
3962
|
-
throw new Error(`The only supported hosts are ${TINA_HOST} or localhost, but received ${params.host}.`);
|
|
3963
|
-
}
|
|
3964
3966
|
return {
|
|
3965
3967
|
branch,
|
|
3966
3968
|
clientId,
|
|
@@ -4076,7 +4078,8 @@ mutation addPendingDocumentMutation(
|
|
|
4076
4078
|
isLocalClient,
|
|
4077
4079
|
cmsCallback: props.cmsCallback,
|
|
4078
4080
|
mediaStore: props.mediaStore,
|
|
4079
|
-
|
|
4081
|
+
apiUrl: apiURL,
|
|
4082
|
+
schema: { ...schema, config: { ...schema.config, ...props } }
|
|
4080
4083
|
}, /* @__PURE__ */ React__default["default"].createElement("style", null, styles), /* @__PURE__ */ React__default["default"].createElement(ErrorBoundary, null, /* @__PURE__ */ React__default["default"].createElement(DocumentCreator, {
|
|
4081
4084
|
documentCreatorCallback
|
|
4082
4085
|
}), /* @__PURE__ */ React__default["default"].createElement(TinaDataProvider, {
|
|
@@ -4138,6 +4141,7 @@ mutation addPendingDocumentMutation(
|
|
|
4138
4141
|
onPayloadStateChange
|
|
4139
4142
|
}) => {
|
|
4140
4143
|
const cms = toolkit.useCMS();
|
|
4144
|
+
const { setFormsRegistering } = React__default["default"].useContext(sharedctx.EditContext);
|
|
4141
4145
|
const [payload, isLoading] = useGraphqlForms({
|
|
4142
4146
|
query: request == null ? void 0 : request.query,
|
|
4143
4147
|
variables: request == null ? void 0 : request.variables,
|
|
@@ -4151,6 +4155,7 @@ mutation addPendingDocumentMutation(
|
|
|
4151
4155
|
});
|
|
4152
4156
|
React__default["default"].useEffect(() => {
|
|
4153
4157
|
onPayloadStateChange({ payload, isLoading });
|
|
4158
|
+
setFormsRegistering && setFormsRegistering(isLoading);
|
|
4154
4159
|
}, [JSON.stringify(payload), isLoading]);
|
|
4155
4160
|
return isLoading ? /* @__PURE__ */ React__default["default"].createElement(Loader, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null)) : null;
|
|
4156
4161
|
};
|
|
@@ -4442,6 +4447,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4442
4447
|
var _a, _b;
|
|
4443
4448
|
const collectionsInfo = useGetCollections(cms);
|
|
4444
4449
|
const screens = cms.plugins.getType("screen").all();
|
|
4450
|
+
const cloudConfigs = cms.plugins.getType("cloud-config").all();
|
|
4445
4451
|
const [menuIsOpen, setMenuIsOpen] = React__default["default"].useState(false);
|
|
4446
4452
|
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
4447
4453
|
const navBreakpoint = 1e3;
|
|
@@ -4452,15 +4458,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4452
4458
|
showCollections: true,
|
|
4453
4459
|
collectionsInfo,
|
|
4454
4460
|
screens,
|
|
4461
|
+
cloudConfigs,
|
|
4455
4462
|
contentCreators: [],
|
|
4456
4463
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4457
4464
|
label: view.name,
|
|
4458
|
-
to:
|
|
4465
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4459
4466
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4460
4467
|
}),
|
|
4468
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React__default["default"].createElement(SidebarCloudLink, {
|
|
4469
|
+
config
|
|
4470
|
+
}),
|
|
4461
4471
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4462
4472
|
label: collection.label ? collection.label : collection.name,
|
|
4463
|
-
to:
|
|
4473
|
+
to: `/collections/${collection.name}`,
|
|
4464
4474
|
Icon: ImFilesEmpty
|
|
4465
4475
|
})
|
|
4466
4476
|
}), !renderDesktopNav && /* @__PURE__ */ React__default["default"].createElement(react.Transition, {
|
|
@@ -4481,18 +4491,22 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4481
4491
|
showCollections: true,
|
|
4482
4492
|
collectionsInfo,
|
|
4483
4493
|
screens,
|
|
4494
|
+
cloudConfigs,
|
|
4484
4495
|
contentCreators: [],
|
|
4485
4496
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4486
4497
|
label: view.name,
|
|
4487
|
-
to:
|
|
4498
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4488
4499
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
4489
4500
|
onClick: () => {
|
|
4490
4501
|
setMenuIsOpen(false);
|
|
4491
4502
|
}
|
|
4492
4503
|
}),
|
|
4504
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React__default["default"].createElement(SidebarCloudLink, {
|
|
4505
|
+
config
|
|
4506
|
+
}),
|
|
4493
4507
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4494
4508
|
label: collection.label ? collection.label : collection.name,
|
|
4495
|
-
to:
|
|
4509
|
+
to: `/collections/${collection.name}`,
|
|
4496
4510
|
Icon: ImFilesEmpty,
|
|
4497
4511
|
onClick: () => {
|
|
4498
4512
|
setMenuIsOpen(false);
|
|
@@ -4547,6 +4561,25 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4547
4561
|
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4548
4562
|
}), " ", label);
|
|
4549
4563
|
};
|
|
4564
|
+
const SidebarCloudLink = ({ config }) => {
|
|
4565
|
+
if (config.text) {
|
|
4566
|
+
return /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
4567
|
+
className: "text-base tracking-wide text-gray-500 flex items-center opacity-90"
|
|
4568
|
+
}, config.text, " ", /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
4569
|
+
target: "_blank",
|
|
4570
|
+
className: "ml-1 text-blue-600 hover:opacity-60",
|
|
4571
|
+
href: config.link.href
|
|
4572
|
+
}, config.link.text));
|
|
4573
|
+
}
|
|
4574
|
+
return /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
4575
|
+
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100"
|
|
4576
|
+
}, /* @__PURE__ */ React__default["default"].createElement(config.Icon, {
|
|
4577
|
+
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4578
|
+
}), /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
4579
|
+
target: "_blank",
|
|
4580
|
+
href: config.link.href
|
|
4581
|
+
}, config.link.text));
|
|
4582
|
+
};
|
|
4550
4583
|
const GetCMS = ({ children }) => {
|
|
4551
4584
|
try {
|
|
4552
4585
|
const cms = toolkit.useCMS();
|
|
@@ -4857,12 +4890,13 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4857
4890
|
var _a, _b;
|
|
4858
4891
|
const plugins = cms.plugins.all("tina-admin");
|
|
4859
4892
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4893
|
+
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
4860
4894
|
const routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4861
4895
|
document,
|
|
4862
4896
|
collection: collectionDefinition
|
|
4863
4897
|
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4864
4898
|
if (routeOverride) {
|
|
4865
|
-
window.location.href = routeOverride;
|
|
4899
|
+
tinaPreview ? navigate(`/preview?iframe-url=${encodeURIComponent(routeOverride)}`) : window.location.href = routeOverride;
|
|
4866
4900
|
return null;
|
|
4867
4901
|
} else {
|
|
4868
4902
|
navigate(document._sys.breadcrumbs.join("/"));
|
|
@@ -5397,7 +5431,18 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5397
5431
|
}, []);
|
|
5398
5432
|
return null;
|
|
5399
5433
|
};
|
|
5400
|
-
const
|
|
5434
|
+
const SetPreviewFlag = ({
|
|
5435
|
+
preview,
|
|
5436
|
+
cms
|
|
5437
|
+
}) => {
|
|
5438
|
+
React__default["default"].useEffect(() => {
|
|
5439
|
+
if (preview) {
|
|
5440
|
+
cms.flags.set("tina-iframe", true);
|
|
5441
|
+
}
|
|
5442
|
+
}, [preview]);
|
|
5443
|
+
return null;
|
|
5444
|
+
};
|
|
5445
|
+
const TinaAdmin = ({ preview }) => {
|
|
5401
5446
|
const isSSR2 = typeof window === "undefined";
|
|
5402
5447
|
const { edit } = sharedctx.useEditState();
|
|
5403
5448
|
if (isSSR2) {
|
|
@@ -5409,31 +5454,43 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5409
5454
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => {
|
|
5410
5455
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5411
5456
|
if (isTinaAdminEnabled) {
|
|
5412
|
-
return /* @__PURE__ */ React__default["default"].createElement(
|
|
5413
|
-
|
|
5414
|
-
}, /* @__PURE__ */ React__default["default"].createElement(Sidebar, {
|
|
5457
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.HashRouter, null, /* @__PURE__ */ React__default["default"].createElement(SetPreviewFlag, {
|
|
5458
|
+
preview,
|
|
5415
5459
|
cms
|
|
5416
|
-
}), /* @__PURE__ */ React__default["default"].createElement("
|
|
5417
|
-
|
|
5418
|
-
|
|
5460
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, preview && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5461
|
+
path: "preview",
|
|
5462
|
+
element: preview
|
|
5463
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5419
5464
|
path: "collections/:collectionName/new",
|
|
5420
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5465
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5466
|
+
cms
|
|
5467
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null))
|
|
5421
5468
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5422
5469
|
path: "collections/:collectionName/:templateName/new",
|
|
5423
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5470
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5471
|
+
cms
|
|
5472
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null))
|
|
5424
5473
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5425
5474
|
path: "collections/:collectionName/*",
|
|
5426
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5475
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5476
|
+
cms
|
|
5477
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionUpdatePage, null))
|
|
5427
5478
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5428
5479
|
path: "collections/:collectionName",
|
|
5429
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5480
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5481
|
+
cms
|
|
5482
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionListPage, null))
|
|
5430
5483
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5431
5484
|
path: "screens/:screenName",
|
|
5432
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5485
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5486
|
+
cms
|
|
5487
|
+
}, /* @__PURE__ */ React__default["default"].createElement(ScreenPage, null))
|
|
5433
5488
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5434
5489
|
path: "/",
|
|
5435
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5436
|
-
|
|
5490
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5491
|
+
cms
|
|
5492
|
+
}, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null))
|
|
5493
|
+
})));
|
|
5437
5494
|
} else {
|
|
5438
5495
|
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, {
|
|
5439
5496
|
path: "logout",
|
|
@@ -5445,6 +5502,18 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5445
5502
|
}
|
|
5446
5503
|
});
|
|
5447
5504
|
};
|
|
5505
|
+
const DefaultWrapper = ({
|
|
5506
|
+
cms,
|
|
5507
|
+
children
|
|
5508
|
+
}) => {
|
|
5509
|
+
return /* @__PURE__ */ React__default["default"].createElement(Layout, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5510
|
+
className: "flex items-stretch h-screen overflow-hidden"
|
|
5511
|
+
}, /* @__PURE__ */ React__default["default"].createElement(Sidebar, {
|
|
5512
|
+
cms
|
|
5513
|
+
}), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5514
|
+
className: "flex-1 relative"
|
|
5515
|
+
}, children)));
|
|
5516
|
+
};
|
|
5448
5517
|
class RouteMappingPlugin {
|
|
5449
5518
|
constructor(mapper) {
|
|
5450
5519
|
this.__type = "tina-admin";
|
|
@@ -5459,6 +5528,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5459
5528
|
const defineConfig = (config) => {
|
|
5460
5529
|
return config;
|
|
5461
5530
|
};
|
|
5531
|
+
const defineStaticConfig = (config) => {
|
|
5532
|
+
return config;
|
|
5533
|
+
};
|
|
5462
5534
|
exports2.AuthWallInner = AuthWallInner;
|
|
5463
5535
|
exports2.Client = Client;
|
|
5464
5536
|
exports2.DEFAULT_LOCAL_TINA_GQL_SERVER_URL = DEFAULT_LOCAL_TINA_GQL_SERVER_URL;
|
|
@@ -5475,6 +5547,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5475
5547
|
exports2["default"] = TinaCMSProvider2;
|
|
5476
5548
|
exports2.defineConfig = defineConfig;
|
|
5477
5549
|
exports2.defineSchema = defineSchema;
|
|
5550
|
+
exports2.defineStaticConfig = defineStaticConfig;
|
|
5478
5551
|
exports2.getStaticPropsForTina = getStaticPropsForTina;
|
|
5479
5552
|
exports2.gql = gql;
|
|
5480
5553
|
exports2.safeAssertShape = safeAssertShape;
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an experimental version of the useTina hook,
|
|
3
|
+
* it is only meant to be used with Tina in "iframe mode".
|
|
4
|
+
*/
|
|
5
|
+
export declare function useTina<T extends object>(props: {
|
|
6
|
+
query: string;
|
|
7
|
+
variables: object;
|
|
8
|
+
data: T;
|
|
9
|
+
}): {
|
|
10
|
+
data: T;
|
|
11
|
+
};
|
package/dist/react.es.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
function useTina(props) {
|
|
3
|
+
const [data, setData] = React.useState(props.data);
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
const id = btoa(JSON.stringify({ query: props.query }));
|
|
6
|
+
parent.postMessage({ type: "open", ...props, id }, window.location.origin);
|
|
7
|
+
window.addEventListener("message", (event) => {
|
|
8
|
+
if (event.data.id === id) {
|
|
9
|
+
console.log("child: event received");
|
|
10
|
+
setData(event.data.data);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return () => parent.postMessage({ type: "close", id }, window.location.origin);
|
|
14
|
+
}, []);
|
|
15
|
+
return { data };
|
|
16
|
+
}
|
|
17
|
+
export { useTina };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react")) : typeof define === "function" && define.amd ? define(["exports", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
|
|
3
|
+
})(this, function(exports2, React) {
|
|
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
|
+
function useTina(props) {
|
|
10
|
+
const [data, setData] = React__default["default"].useState(props.data);
|
|
11
|
+
React__default["default"].useEffect(() => {
|
|
12
|
+
const id = btoa(JSON.stringify({ query: props.query }));
|
|
13
|
+
parent.postMessage({ type: "open", ...props, id }, window.location.origin);
|
|
14
|
+
window.addEventListener("message", (event) => {
|
|
15
|
+
if (event.data.id === id) {
|
|
16
|
+
console.log("child: event received");
|
|
17
|
+
setData(event.data.data);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return () => parent.postMessage({ type: "close", id }, window.location.origin);
|
|
21
|
+
}, []);
|
|
22
|
+
return { data };
|
|
23
|
+
}
|
|
24
|
+
exports2.useTina = useTina;
|
|
25
|
+
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
26
|
+
});
|
package/dist/style.css
CHANGED
|
@@ -372,6 +372,9 @@
|
|
|
372
372
|
.tina-tailwind .mr-2 {
|
|
373
373
|
margin-right: 8px;
|
|
374
374
|
}
|
|
375
|
+
.tina-tailwind .ml-1 {
|
|
376
|
+
margin-left: 4px;
|
|
377
|
+
}
|
|
375
378
|
.tina-tailwind .mb-2 {
|
|
376
379
|
margin-bottom: 8px;
|
|
377
380
|
}
|
|
@@ -384,9 +387,6 @@
|
|
|
384
387
|
.tina-tailwind .-mt-0 {
|
|
385
388
|
margin-top: -0px;
|
|
386
389
|
}
|
|
387
|
-
.tina-tailwind .ml-1 {
|
|
388
|
-
margin-left: 4px;
|
|
389
|
-
}
|
|
390
390
|
.tina-tailwind .mt-2 {
|
|
391
391
|
margin-top: 8px;
|
|
392
392
|
}
|
|
@@ -911,6 +911,9 @@
|
|
|
911
911
|
.tina-tailwind .hover\:opacity-100:hover {
|
|
912
912
|
opacity: 1;
|
|
913
913
|
}
|
|
914
|
+
.tina-tailwind .hover\:opacity-60:hover {
|
|
915
|
+
opacity: .6;
|
|
916
|
+
}
|
|
914
917
|
.tina-tailwind .focus\:text-blue-400:focus {
|
|
915
918
|
--tw-text-opacity: 1;
|
|
916
919
|
color: rgb(34 150 254 / var(--tw-text-opacity));
|
package/dist/tina-cms.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { formifyCallback } from './hooks/use-graphql-forms';
|
|
14
|
+
import { useDocumentCreatorPlugin } from './hooks/use-content-creator';
|
|
14
15
|
import { TinaCMSProviderDefaultProps } from './types/cms';
|
|
15
16
|
export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, schema, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
|
|
17
|
+
export declare type DocumentCreatorCallback = Parameters<typeof useDocumentCreatorPlugin>[0];
|
|
16
18
|
export declare const TinaDataProvider: ({ children, formifyCallback, }: {
|
|
17
19
|
children: any;
|
|
18
20
|
formifyCallback: formifyCallback;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export interface CreateClientProps {
|
|
|
22
22
|
repo?: string;
|
|
23
23
|
branch?: string;
|
|
24
24
|
schema?: TinaCloudSchema<false>;
|
|
25
|
+
apiUrl?: string;
|
|
25
26
|
}
|
|
26
|
-
export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, schema, }: CreateClientProps) => Client;
|
|
27
|
+
export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, schema, apiUrl, }: CreateClientProps) => Client;
|
|
27
28
|
export declare function assertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => yup.AnySchema, errorMessage?: string): asserts value is T;
|
|
28
29
|
export declare function safeAssertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => yup.AnySchema): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"import": "./dist/edit-state.es.js",
|
|
20
20
|
"require": "./dist/edit-state.js"
|
|
21
21
|
},
|
|
22
|
+
"./dist/react": {
|
|
23
|
+
"types": "./dist/react.d.ts",
|
|
24
|
+
"import": "./dist/react.es.js",
|
|
25
|
+
"require": "./dist/react.js"
|
|
26
|
+
},
|
|
22
27
|
"./dist/rich-text": {
|
|
23
28
|
"types": "./dist/rich-text/index.d.ts",
|
|
24
29
|
"import": "./dist/rich-text/index.es.js",
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
"src/index.ts",
|
|
39
44
|
"src/edit-state.tsx",
|
|
40
45
|
"src/rich-text/index.tsx",
|
|
46
|
+
"src/react.tsx",
|
|
41
47
|
"src/client.ts"
|
|
42
48
|
]
|
|
43
49
|
},
|
|
@@ -48,9 +54,9 @@
|
|
|
48
54
|
"@headlessui/react": "^1.5.0",
|
|
49
55
|
"@heroicons/react": "^1.0.4",
|
|
50
56
|
"@react-hook/window-size": "^3.0.7",
|
|
51
|
-
"@tinacms/schema-tools": "0.1.
|
|
52
|
-
"@tinacms/sharedctx": "0.1.
|
|
53
|
-
"@tinacms/toolkit": "0.57.
|
|
57
|
+
"@tinacms/schema-tools": "0.1.4",
|
|
58
|
+
"@tinacms/sharedctx": "0.1.3",
|
|
59
|
+
"@tinacms/toolkit": "0.57.5",
|
|
54
60
|
"crypto-js": "^4.0.0",
|
|
55
61
|
"fetch-ponyfill": "^7.1.0",
|
|
56
62
|
"final-form": "4.20.1",
|
|
@@ -58,7 +64,6 @@
|
|
|
58
64
|
"graphql-tag": "^2.11.0",
|
|
59
65
|
"lodash.set": "^4.3.2",
|
|
60
66
|
"prism-react-renderer": "^1.3.5",
|
|
61
|
-
"prism": "^4.1.2",
|
|
62
67
|
"react-icons": "^4.3.1",
|
|
63
68
|
"react-router-dom": "6",
|
|
64
69
|
"url-pattern": "^1.0.3",
|