tinacms 0.69.6 → 0.69.7
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/index.d.ts +5 -2
- package/dist/index.es.js +61 -22
- package/dist/index.js +61 -21
- package/dist/react.d.ts +11 -0
- package/dist/react.es.js +17 -0
- package/dist/react.js +26 -0
- package/dist/tina-cms.d.ts +2 -0
- package/package.json +9 -3
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/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
|
@@ -2795,7 +2795,7 @@ const TinaCloudProvider = (props) => {
|
|
|
2795
2795
|
})));
|
|
2796
2796
|
};
|
|
2797
2797
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2798
|
-
var styles =
|
|
2798
|
+
var styles = `.tina-tailwind {
|
|
2799
2799
|
line-height: 1.5;
|
|
2800
2800
|
-webkit-text-size-adjust: 100%;
|
|
2801
2801
|
-moz-tab-size: 4;
|
|
@@ -3733,7 +3733,7 @@ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
|
3733
3733
|
--tw-ring-opacity: 1;
|
|
3734
3734
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3735
3735
|
}
|
|
3736
|
-
|
|
3736
|
+
`;
|
|
3737
3737
|
class ContentCreatorPlugin {
|
|
3738
3738
|
constructor(options) {
|
|
3739
3739
|
this.__type = "content-creator";
|
|
@@ -4437,12 +4437,12 @@ const Sidebar = ({ cms }) => {
|
|
|
4437
4437
|
contentCreators: [],
|
|
4438
4438
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4439
4439
|
label: view.name,
|
|
4440
|
-
to:
|
|
4440
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4441
4441
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4442
4442
|
}),
|
|
4443
4443
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4444
4444
|
label: collection.label ? collection.label : collection.name,
|
|
4445
|
-
to:
|
|
4445
|
+
to: `/collections/${collection.name}`,
|
|
4446
4446
|
Icon: ImFilesEmpty
|
|
4447
4447
|
})
|
|
4448
4448
|
}), !renderDesktopNav && /* @__PURE__ */ React.createElement(Transition, {
|
|
@@ -4466,7 +4466,7 @@ const Sidebar = ({ cms }) => {
|
|
|
4466
4466
|
contentCreators: [],
|
|
4467
4467
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4468
4468
|
label: view.name,
|
|
4469
|
-
to:
|
|
4469
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4470
4470
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
4471
4471
|
onClick: () => {
|
|
4472
4472
|
setMenuIsOpen(false);
|
|
@@ -4474,7 +4474,7 @@ const Sidebar = ({ cms }) => {
|
|
|
4474
4474
|
}),
|
|
4475
4475
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4476
4476
|
label: collection.label ? collection.label : collection.name,
|
|
4477
|
-
to:
|
|
4477
|
+
to: `/collections/${collection.name}`,
|
|
4478
4478
|
Icon: ImFilesEmpty,
|
|
4479
4479
|
onClick: () => {
|
|
4480
4480
|
setMenuIsOpen(false);
|
|
@@ -4839,12 +4839,13 @@ const handleNavigate = (navigate, cms, collection, collectionDefinition, documen
|
|
|
4839
4839
|
var _a, _b;
|
|
4840
4840
|
const plugins = cms.plugins.all("tina-admin");
|
|
4841
4841
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4842
|
+
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
4842
4843
|
const routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4843
4844
|
document,
|
|
4844
4845
|
collection: collectionDefinition
|
|
4845
4846
|
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4846
4847
|
if (routeOverride) {
|
|
4847
|
-
window.location.href = routeOverride;
|
|
4848
|
+
tinaPreview ? navigate(`/preview?iframe-url=${encodeURIComponent(routeOverride)}`) : window.location.href = routeOverride;
|
|
4848
4849
|
return null;
|
|
4849
4850
|
} else {
|
|
4850
4851
|
navigate(document._sys.breadcrumbs.join("/"));
|
|
@@ -5379,7 +5380,18 @@ const Redirect = () => {
|
|
|
5379
5380
|
}, []);
|
|
5380
5381
|
return null;
|
|
5381
5382
|
};
|
|
5382
|
-
const
|
|
5383
|
+
const SetPreviewFlag = ({
|
|
5384
|
+
preview,
|
|
5385
|
+
cms
|
|
5386
|
+
}) => {
|
|
5387
|
+
React.useEffect(() => {
|
|
5388
|
+
if (preview) {
|
|
5389
|
+
cms.flags.set("tina-iframe", true);
|
|
5390
|
+
}
|
|
5391
|
+
}, [preview]);
|
|
5392
|
+
return null;
|
|
5393
|
+
};
|
|
5394
|
+
const TinaAdmin = ({ preview }) => {
|
|
5383
5395
|
const isSSR2 = typeof window === "undefined";
|
|
5384
5396
|
const { edit } = useEditState();
|
|
5385
5397
|
if (isSSR2) {
|
|
@@ -5391,31 +5403,43 @@ const TinaAdmin = () => {
|
|
|
5391
5403
|
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5392
5404
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5393
5405
|
if (isTinaAdminEnabled) {
|
|
5394
|
-
return /* @__PURE__ */ React.createElement(
|
|
5395
|
-
|
|
5396
|
-
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5406
|
+
return /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(SetPreviewFlag, {
|
|
5407
|
+
preview,
|
|
5397
5408
|
cms
|
|
5398
|
-
}), /* @__PURE__ */ React.createElement(
|
|
5399
|
-
|
|
5400
|
-
|
|
5409
|
+
}), /* @__PURE__ */ React.createElement(Routes, null, preview && /* @__PURE__ */ React.createElement(Route, {
|
|
5410
|
+
path: "preview",
|
|
5411
|
+
element: preview
|
|
5412
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5401
5413
|
path: "collections/:collectionName/new",
|
|
5402
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5414
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5415
|
+
cms
|
|
5416
|
+
}, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5403
5417
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5404
5418
|
path: "collections/:collectionName/:templateName/new",
|
|
5405
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5419
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5420
|
+
cms
|
|
5421
|
+
}, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5406
5422
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5407
5423
|
path: "collections/:collectionName/*",
|
|
5408
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5424
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5425
|
+
cms
|
|
5426
|
+
}, /* @__PURE__ */ React.createElement(CollectionUpdatePage, null))
|
|
5409
5427
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5410
5428
|
path: "collections/:collectionName",
|
|
5411
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5429
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5430
|
+
cms
|
|
5431
|
+
}, /* @__PURE__ */ React.createElement(CollectionListPage, null))
|
|
5412
5432
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5413
5433
|
path: "screens/:screenName",
|
|
5414
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5434
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5435
|
+
cms
|
|
5436
|
+
}, /* @__PURE__ */ React.createElement(ScreenPage, null))
|
|
5415
5437
|
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5416
5438
|
path: "/",
|
|
5417
|
-
element: /* @__PURE__ */ React.createElement(
|
|
5418
|
-
|
|
5439
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, {
|
|
5440
|
+
cms
|
|
5441
|
+
}, /* @__PURE__ */ React.createElement(DashboardPage, null))
|
|
5442
|
+
})));
|
|
5419
5443
|
} else {
|
|
5420
5444
|
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5421
5445
|
path: "logout",
|
|
@@ -5427,6 +5451,18 @@ const TinaAdmin = () => {
|
|
|
5427
5451
|
}
|
|
5428
5452
|
});
|
|
5429
5453
|
};
|
|
5454
|
+
const DefaultWrapper = ({
|
|
5455
|
+
cms,
|
|
5456
|
+
children
|
|
5457
|
+
}) => {
|
|
5458
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement("div", {
|
|
5459
|
+
className: "flex items-stretch h-screen overflow-hidden"
|
|
5460
|
+
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5461
|
+
cms
|
|
5462
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
5463
|
+
className: "flex-1 relative"
|
|
5464
|
+
}, children)));
|
|
5465
|
+
};
|
|
5430
5466
|
class RouteMappingPlugin {
|
|
5431
5467
|
constructor(mapper) {
|
|
5432
5468
|
this.__type = "tina-admin";
|
|
@@ -5441,4 +5477,7 @@ const defineSchema = (config) => {
|
|
|
5441
5477
|
const defineConfig = (config) => {
|
|
5442
5478
|
return config;
|
|
5443
5479
|
};
|
|
5444
|
-
|
|
5480
|
+
const defineStaticConfig = (config) => {
|
|
5481
|
+
return config;
|
|
5482
|
+
};
|
|
5483
|
+
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
|
@@ -2813,7 +2813,7 @@ mutation addPendingDocumentMutation(
|
|
|
2813
2813
|
})));
|
|
2814
2814
|
};
|
|
2815
2815
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2816
|
-
var styles =
|
|
2816
|
+
var styles = `.tina-tailwind {
|
|
2817
2817
|
line-height: 1.5;
|
|
2818
2818
|
-webkit-text-size-adjust: 100%;
|
|
2819
2819
|
-moz-tab-size: 4;
|
|
@@ -3751,7 +3751,7 @@ mutation addPendingDocumentMutation(
|
|
|
3751
3751
|
--tw-ring-opacity: 1;
|
|
3752
3752
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3753
3753
|
}
|
|
3754
|
-
|
|
3754
|
+
`;
|
|
3755
3755
|
class ContentCreatorPlugin {
|
|
3756
3756
|
constructor(options) {
|
|
3757
3757
|
this.__type = "content-creator";
|
|
@@ -4455,12 +4455,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4455
4455
|
contentCreators: [],
|
|
4456
4456
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4457
4457
|
label: view.name,
|
|
4458
|
-
to:
|
|
4458
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4459
4459
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4460
4460
|
}),
|
|
4461
4461
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4462
4462
|
label: collection.label ? collection.label : collection.name,
|
|
4463
|
-
to:
|
|
4463
|
+
to: `/collections/${collection.name}`,
|
|
4464
4464
|
Icon: ImFilesEmpty
|
|
4465
4465
|
})
|
|
4466
4466
|
}), !renderDesktopNav && /* @__PURE__ */ React__default["default"].createElement(react.Transition, {
|
|
@@ -4484,7 +4484,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4484
4484
|
contentCreators: [],
|
|
4485
4485
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4486
4486
|
label: view.name,
|
|
4487
|
-
to:
|
|
4487
|
+
to: `/screens/${slugify(view.name)}`,
|
|
4488
4488
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
4489
4489
|
onClick: () => {
|
|
4490
4490
|
setMenuIsOpen(false);
|
|
@@ -4492,7 +4492,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4492
4492
|
}),
|
|
4493
4493
|
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
4494
4494
|
label: collection.label ? collection.label : collection.name,
|
|
4495
|
-
to:
|
|
4495
|
+
to: `/collections/${collection.name}`,
|
|
4496
4496
|
Icon: ImFilesEmpty,
|
|
4497
4497
|
onClick: () => {
|
|
4498
4498
|
setMenuIsOpen(false);
|
|
@@ -4857,12 +4857,13 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4857
4857
|
var _a, _b;
|
|
4858
4858
|
const plugins = cms.plugins.all("tina-admin");
|
|
4859
4859
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4860
|
+
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
4860
4861
|
const routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4861
4862
|
document,
|
|
4862
4863
|
collection: collectionDefinition
|
|
4863
4864
|
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4864
4865
|
if (routeOverride) {
|
|
4865
|
-
window.location.href = routeOverride;
|
|
4866
|
+
tinaPreview ? navigate(`/preview?iframe-url=${encodeURIComponent(routeOverride)}`) : window.location.href = routeOverride;
|
|
4866
4867
|
return null;
|
|
4867
4868
|
} else {
|
|
4868
4869
|
navigate(document._sys.breadcrumbs.join("/"));
|
|
@@ -5397,7 +5398,18 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5397
5398
|
}, []);
|
|
5398
5399
|
return null;
|
|
5399
5400
|
};
|
|
5400
|
-
const
|
|
5401
|
+
const SetPreviewFlag = ({
|
|
5402
|
+
preview,
|
|
5403
|
+
cms
|
|
5404
|
+
}) => {
|
|
5405
|
+
React__default["default"].useEffect(() => {
|
|
5406
|
+
if (preview) {
|
|
5407
|
+
cms.flags.set("tina-iframe", true);
|
|
5408
|
+
}
|
|
5409
|
+
}, [preview]);
|
|
5410
|
+
return null;
|
|
5411
|
+
};
|
|
5412
|
+
const TinaAdmin = ({ preview }) => {
|
|
5401
5413
|
const isSSR2 = typeof window === "undefined";
|
|
5402
5414
|
const { edit } = sharedctx.useEditState();
|
|
5403
5415
|
if (isSSR2) {
|
|
@@ -5409,31 +5421,43 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5409
5421
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => {
|
|
5410
5422
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5411
5423
|
if (isTinaAdminEnabled) {
|
|
5412
|
-
return /* @__PURE__ */ React__default["default"].createElement(
|
|
5413
|
-
|
|
5414
|
-
}, /* @__PURE__ */ React__default["default"].createElement(Sidebar, {
|
|
5424
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.HashRouter, null, /* @__PURE__ */ React__default["default"].createElement(SetPreviewFlag, {
|
|
5425
|
+
preview,
|
|
5415
5426
|
cms
|
|
5416
|
-
}), /* @__PURE__ */ React__default["default"].createElement("
|
|
5417
|
-
|
|
5418
|
-
|
|
5427
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, preview && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5428
|
+
path: "preview",
|
|
5429
|
+
element: preview
|
|
5430
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5419
5431
|
path: "collections/:collectionName/new",
|
|
5420
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5432
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5433
|
+
cms
|
|
5434
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null))
|
|
5421
5435
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5422
5436
|
path: "collections/:collectionName/:templateName/new",
|
|
5423
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5437
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5438
|
+
cms
|
|
5439
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null))
|
|
5424
5440
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5425
5441
|
path: "collections/:collectionName/*",
|
|
5426
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5442
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5443
|
+
cms
|
|
5444
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionUpdatePage, null))
|
|
5427
5445
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5428
5446
|
path: "collections/:collectionName",
|
|
5429
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5447
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5448
|
+
cms
|
|
5449
|
+
}, /* @__PURE__ */ React__default["default"].createElement(CollectionListPage, null))
|
|
5430
5450
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5431
5451
|
path: "screens/:screenName",
|
|
5432
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5452
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5453
|
+
cms
|
|
5454
|
+
}, /* @__PURE__ */ React__default["default"].createElement(ScreenPage, null))
|
|
5433
5455
|
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
5434
5456
|
path: "/",
|
|
5435
|
-
element: /* @__PURE__ */ React__default["default"].createElement(
|
|
5436
|
-
|
|
5457
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DefaultWrapper, {
|
|
5458
|
+
cms
|
|
5459
|
+
}, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null))
|
|
5460
|
+
})));
|
|
5437
5461
|
} else {
|
|
5438
5462
|
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
5463
|
path: "logout",
|
|
@@ -5445,6 +5469,18 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5445
5469
|
}
|
|
5446
5470
|
});
|
|
5447
5471
|
};
|
|
5472
|
+
const DefaultWrapper = ({
|
|
5473
|
+
cms,
|
|
5474
|
+
children
|
|
5475
|
+
}) => {
|
|
5476
|
+
return /* @__PURE__ */ React__default["default"].createElement(Layout, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5477
|
+
className: "flex items-stretch h-screen overflow-hidden"
|
|
5478
|
+
}, /* @__PURE__ */ React__default["default"].createElement(Sidebar, {
|
|
5479
|
+
cms
|
|
5480
|
+
}), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5481
|
+
className: "flex-1 relative"
|
|
5482
|
+
}, children)));
|
|
5483
|
+
};
|
|
5448
5484
|
class RouteMappingPlugin {
|
|
5449
5485
|
constructor(mapper) {
|
|
5450
5486
|
this.__type = "tina-admin";
|
|
@@ -5459,6 +5495,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5459
5495
|
const defineConfig = (config) => {
|
|
5460
5496
|
return config;
|
|
5461
5497
|
};
|
|
5498
|
+
const defineStaticConfig = (config) => {
|
|
5499
|
+
return config;
|
|
5500
|
+
};
|
|
5462
5501
|
exports2.AuthWallInner = AuthWallInner;
|
|
5463
5502
|
exports2.Client = Client;
|
|
5464
5503
|
exports2.DEFAULT_LOCAL_TINA_GQL_SERVER_URL = DEFAULT_LOCAL_TINA_GQL_SERVER_URL;
|
|
@@ -5475,6 +5514,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5475
5514
|
exports2["default"] = TinaCMSProvider2;
|
|
5476
5515
|
exports2.defineConfig = defineConfig;
|
|
5477
5516
|
exports2.defineSchema = defineSchema;
|
|
5517
|
+
exports2.defineStaticConfig = defineStaticConfig;
|
|
5478
5518
|
exports2.getStaticPropsForTina = getStaticPropsForTina;
|
|
5479
5519
|
exports2.gql = gql;
|
|
5480
5520
|
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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.7",
|
|
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.
|
|
57
|
+
"@tinacms/schema-tools": "0.1.3",
|
|
52
58
|
"@tinacms/sharedctx": "0.1.2",
|
|
53
|
-
"@tinacms/toolkit": "0.57.
|
|
59
|
+
"@tinacms/toolkit": "0.57.4",
|
|
54
60
|
"crypto-js": "^4.0.0",
|
|
55
61
|
"fetch-ponyfill": "^7.1.0",
|
|
56
62
|
"final-form": "4.20.1",
|