tinacms 0.70.0 → 0.70.2
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/hooks/formify/spec/schema.d.ts +2 -2
- package/dist/index.d.ts +41 -10
- package/dist/index.es.js +12 -9
- package/dist/index.js +12 -9
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const schema:
|
|
2
|
-
export declare const tinaConfig: import("@tinacms/schema-tools").
|
|
1
|
+
declare const schema: any;
|
|
2
|
+
export declare const tinaConfig: import("@tinacms/schema-tools/dist/types").Config<(cms: import("@tinacms/toolkit/dist/tina-cms").TinaCMS) => import("@tinacms/toolkit/dist/tina-cms").TinaCMS, import("../../use-graphql-forms").formifyCallback, import("../../use-content-creator").DocumentCreatorArgs, undefined>;
|
|
3
3
|
export default schema;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,15 +27,46 @@ export type { TinaCMSProviderDefaultProps };
|
|
|
27
27
|
export default TinaCMSProvider2;
|
|
28
28
|
import { TinaCMS } from '@tinacms/toolkit';
|
|
29
29
|
import { formifyCallback } from './hooks/use-graphql-forms';
|
|
30
|
-
import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase, TinaTemplate, TinaFieldBase, TinaCMSConfig } from '@tinacms/schema-tools';
|
|
31
30
|
export { NAMER, resolveForm } from '@tinacms/schema-tools';
|
|
32
|
-
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export type
|
|
38
|
-
|
|
31
|
+
import type { Config, SchemaField, Schema, Collection, Template } from '@tinacms/schema-tools/dist/types';
|
|
32
|
+
export type { Config, Schema, Collection, Template, SchemaField };
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use `SchemaField` instead
|
|
35
|
+
*/
|
|
36
|
+
export declare type TinaFieldEnriched = SchemaField;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated use `SchemaField` instead
|
|
39
|
+
*/
|
|
40
|
+
export declare type TinaField = SchemaField;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated use `Template` instead
|
|
43
|
+
*/
|
|
44
|
+
export declare type TinaTemplate = Template;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated use `Template` instead
|
|
47
|
+
*/
|
|
48
|
+
export declare type Templateable = Template;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated use `Template` instead
|
|
51
|
+
*/
|
|
52
|
+
export declare type TinaCloudTemplatebase = Template;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated use `Collection` instead
|
|
55
|
+
*/
|
|
56
|
+
export declare type TinaCloudCollection = Collection;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated use `Collection` instead
|
|
59
|
+
*/
|
|
60
|
+
export declare type TinaCollection = Collection;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated use `Schema` instead
|
|
63
|
+
*/
|
|
64
|
+
export declare type TinaSchema = Schema;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated use `Schema` instead
|
|
67
|
+
*/
|
|
68
|
+
export declare type TinaCloudSchema = Schema;
|
|
69
|
+
export declare const defineSchema: (config: Schema) => Schema;
|
|
39
70
|
export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, 'children'>) => Omit<TinaCMSProviderDefaultProps, "children">;
|
|
40
|
-
export declare const defineStaticConfig: (config:
|
|
41
|
-
export declare const defineConfig: (config:
|
|
71
|
+
export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>;
|
|
72
|
+
export declare const defineConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>;
|
package/dist/index.es.js
CHANGED
|
@@ -5021,13 +5021,15 @@ const CollectionListPage = () => {
|
|
|
5021
5021
|
startCursor: endCursor,
|
|
5022
5022
|
sortKey
|
|
5023
5023
|
}, (collection, _loading, reFetchCollection, collectionExtra) => {
|
|
5024
|
-
var _a, _b, _c;
|
|
5024
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5025
5025
|
const totalCount = collection.documents.totalCount;
|
|
5026
5026
|
const documents = collection.documents.edges;
|
|
5027
5027
|
const admin = cms.api.admin;
|
|
5028
5028
|
const pageInfo = collection.documents.pageInfo;
|
|
5029
5029
|
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
5030
5030
|
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
5031
|
+
const allowCreate = (_d = (_c = (_b = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _b.allowedActions) == null ? void 0 : _c.create) != null ? _d : true;
|
|
5032
|
+
const allowDelete = (_g = (_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.delete) != null ? _g : true;
|
|
5031
5033
|
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
5032
5034
|
filename: vars.relativePath,
|
|
5033
5035
|
deleteFunc: async () => {
|
|
@@ -5043,7 +5045,7 @@ const CollectionListPage = () => {
|
|
|
5043
5045
|
},
|
|
5044
5046
|
close: () => setOpen(false)
|
|
5045
5047
|
}), /* @__PURE__ */ React.createElement(PageHeader, {
|
|
5046
|
-
isLocalMode: (
|
|
5048
|
+
isLocalMode: (_i = (_h = cms == null ? void 0 : cms.api) == null ? void 0 : _h.tina) == null ? void 0 : _i.isLocalMode
|
|
5047
5049
|
}, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
5048
5050
|
className: "flex flex-col gap-4"
|
|
5049
5051
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
@@ -5093,12 +5095,12 @@ const CollectionListPage = () => {
|
|
|
5093
5095
|
setSortOrder(val.order);
|
|
5094
5096
|
}
|
|
5095
5097
|
}
|
|
5096
|
-
}))), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
|
|
5098
|
+
}))), !collection.templates && allowCreate && /* @__PURE__ */ React.createElement(Link, {
|
|
5097
5099
|
to: `new`,
|
|
5098
5100
|
className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
5099
5101
|
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
5100
5102
|
className: "w-5 h-full ml-1 opacity-70"
|
|
5101
|
-
})), collection.templates && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
5103
|
+
})), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
5102
5104
|
templates: collection.templates
|
|
5103
5105
|
}))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
5104
5106
|
className: "w-full mx-auto max-w-screen-xl"
|
|
@@ -5162,7 +5164,7 @@ const CollectionListPage = () => {
|
|
|
5162
5164
|
navigate(`${document.node._sys.breadcrumbs.join("/")}`, { replace: true });
|
|
5163
5165
|
}
|
|
5164
5166
|
},
|
|
5165
|
-
{
|
|
5167
|
+
allowDelete && {
|
|
5166
5168
|
name: "delete",
|
|
5167
5169
|
label: "Delete",
|
|
5168
5170
|
Icon: /* @__PURE__ */ React.createElement(BiTrash, {
|
|
@@ -5177,7 +5179,7 @@ const CollectionListPage = () => {
|
|
|
5177
5179
|
setOpen(true);
|
|
5178
5180
|
}
|
|
5179
5181
|
}
|
|
5180
|
-
]
|
|
5182
|
+
].filter(Boolean)
|
|
5181
5183
|
})));
|
|
5182
5184
|
}))), /* @__PURE__ */ React.createElement("div", {
|
|
5183
5185
|
className: "pt-3"
|
|
@@ -5288,7 +5290,7 @@ const FilenameInput = (props) => {
|
|
|
5288
5290
|
}));
|
|
5289
5291
|
};
|
|
5290
5292
|
const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
5291
|
-
var _a, _b, _c, _d, _e;
|
|
5293
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5292
5294
|
const navigate = useNavigate();
|
|
5293
5295
|
const [formIsPristine, setFormIsPristine] = useState(true);
|
|
5294
5296
|
const schema = cms.api.tina.schema;
|
|
@@ -5313,10 +5315,11 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5313
5315
|
};
|
|
5314
5316
|
}
|
|
5315
5317
|
}
|
|
5318
|
+
const defaultItem = ((_d = template.ui) == null ? void 0 : _d.defaultItem) || (template == null ? void 0 : template.defaultItem);
|
|
5316
5319
|
const form = useMemo(() => {
|
|
5317
5320
|
var _a2, _b2;
|
|
5318
5321
|
return new Form({
|
|
5319
|
-
initialValues: typeof
|
|
5322
|
+
initialValues: typeof defaultItem === "function" ? defaultItem() : defaultItem,
|
|
5320
5323
|
extraSubscribeValues: { active: true, submitting: true, touched: true },
|
|
5321
5324
|
onChange: (values) => {
|
|
5322
5325
|
var _a3;
|
|
@@ -5372,7 +5375,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5372
5375
|
const windowWidth = useWindowWidth();
|
|
5373
5376
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5374
5377
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5375
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((
|
|
5378
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5376
5379
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5377
5380
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
5378
5381
|
className: "max-w-form mx-auto"
|
package/dist/index.js
CHANGED
|
@@ -5037,13 +5037,15 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5037
5037
|
startCursor: endCursor,
|
|
5038
5038
|
sortKey
|
|
5039
5039
|
}, (collection, _loading, reFetchCollection, collectionExtra) => {
|
|
5040
|
-
var _a, _b, _c;
|
|
5040
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5041
5041
|
const totalCount = collection.documents.totalCount;
|
|
5042
5042
|
const documents = collection.documents.edges;
|
|
5043
5043
|
const admin = cms.api.admin;
|
|
5044
5044
|
const pageInfo = collection.documents.pageInfo;
|
|
5045
5045
|
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
5046
5046
|
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
5047
|
+
const allowCreate = (_d = (_c = (_b = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _b.allowedActions) == null ? void 0 : _c.create) != null ? _d : true;
|
|
5048
|
+
const allowDelete = (_g = (_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.delete) != null ? _g : true;
|
|
5047
5049
|
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, open && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
|
|
5048
5050
|
filename: vars.relativePath,
|
|
5049
5051
|
deleteFunc: async () => {
|
|
@@ -5059,7 +5061,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5059
5061
|
},
|
|
5060
5062
|
close: () => setOpen(false)
|
|
5061
5063
|
}), /* @__PURE__ */ React__default["default"].createElement(PageHeader, {
|
|
5062
|
-
isLocalMode: (
|
|
5064
|
+
isLocalMode: (_i = (_h = cms == null ? void 0 : cms.api) == null ? void 0 : _h.tina) == null ? void 0 : _i.isLocalMode
|
|
5063
5065
|
}, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5064
5066
|
className: "flex flex-col gap-4"
|
|
5065
5067
|
}, /* @__PURE__ */ React__default["default"].createElement("h3", {
|
|
@@ -5109,12 +5111,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5109
5111
|
setSortOrder(val.order);
|
|
5110
5112
|
}
|
|
5111
5113
|
}
|
|
5112
|
-
}))), !collection.templates && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
|
|
5114
|
+
}))), !collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
|
|
5113
5115
|
to: `new`,
|
|
5114
5116
|
className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
5115
5117
|
}, "Create New", " ", /* @__PURE__ */ React__default["default"].createElement(BiPlus, {
|
|
5116
5118
|
className: "w-5 h-full ml-1 opacity-70"
|
|
5117
|
-
})), collection.templates && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
|
|
5119
|
+
})), collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
|
|
5118
5120
|
templates: collection.templates
|
|
5119
5121
|
}))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5120
5122
|
className: "w-full mx-auto max-w-screen-xl"
|
|
@@ -5178,7 +5180,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5178
5180
|
navigate(`${document.node._sys.breadcrumbs.join("/")}`, { replace: true });
|
|
5179
5181
|
}
|
|
5180
5182
|
},
|
|
5181
|
-
{
|
|
5183
|
+
allowDelete && {
|
|
5182
5184
|
name: "delete",
|
|
5183
5185
|
label: "Delete",
|
|
5184
5186
|
Icon: /* @__PURE__ */ React__default["default"].createElement(BiTrash, {
|
|
@@ -5193,7 +5195,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5193
5195
|
setOpen(true);
|
|
5194
5196
|
}
|
|
5195
5197
|
}
|
|
5196
|
-
]
|
|
5198
|
+
].filter(Boolean)
|
|
5197
5199
|
})));
|
|
5198
5200
|
}))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5199
5201
|
className: "pt-3"
|
|
@@ -5304,7 +5306,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5304
5306
|
}));
|
|
5305
5307
|
};
|
|
5306
5308
|
const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
5307
|
-
var _a, _b, _c, _d, _e;
|
|
5309
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5308
5310
|
const navigate = reactRouterDom.useNavigate();
|
|
5309
5311
|
const [formIsPristine, setFormIsPristine] = React.useState(true);
|
|
5310
5312
|
const schema = cms.api.tina.schema;
|
|
@@ -5329,10 +5331,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5329
5331
|
};
|
|
5330
5332
|
}
|
|
5331
5333
|
}
|
|
5334
|
+
const defaultItem = ((_d = template.ui) == null ? void 0 : _d.defaultItem) || (template == null ? void 0 : template.defaultItem);
|
|
5332
5335
|
const form = React.useMemo(() => {
|
|
5333
5336
|
var _a2, _b2;
|
|
5334
5337
|
return new toolkit.Form({
|
|
5335
|
-
initialValues: typeof
|
|
5338
|
+
initialValues: typeof defaultItem === "function" ? defaultItem() : defaultItem,
|
|
5336
5339
|
extraSubscribeValues: { active: true, submitting: true, touched: true },
|
|
5337
5340
|
onChange: (values) => {
|
|
5338
5341
|
var _a3;
|
|
@@ -5388,7 +5391,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5388
5391
|
const windowWidth = windowSize.useWindowWidth();
|
|
5389
5392
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5390
5393
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5391
|
-
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((
|
|
5394
|
+
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5392
5395
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5393
5396
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5394
5397
|
className: "max-w-form mx-auto"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@headlessui/react": "^1.5.0",
|
|
56
56
|
"@heroicons/react": "^1.0.4",
|
|
57
57
|
"@react-hook/window-size": "^3.0.7",
|
|
58
|
-
"@tinacms/schema-tools": "0.2.
|
|
58
|
+
"@tinacms/schema-tools": "0.2.2",
|
|
59
59
|
"@tinacms/sharedctx": "0.1.3",
|
|
60
60
|
"@tinacms/toolkit": "0.58.5",
|
|
61
61
|
"crypto-js": "^4.0.0",
|