tinacms 0.66.2 → 0.66.5
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/CHANGELOG.md +28 -0
- package/dist/admin/components/GetCollection.d.ts +4 -1
- package/dist/admin/components/GetCollections.d.ts +0 -1
- package/dist/admin/components/GetDocument.d.ts +4 -1
- package/dist/admin/components/GetDocumentFields.d.ts +10 -1
- package/dist/admin/components/LoadingPage.d.ts +14 -0
- package/dist/index.es.js +212 -160
- package/dist/index.js +211 -159
- package/dist/rich-text.es.js +0 -1
- package/dist/rich-text.js +0 -1
- package/dist/style.css +22 -29
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -539,7 +539,7 @@ mutation addPendingDocumentMutation(
|
|
|
539
539
|
async getRefreshedToken(tokens) {
|
|
540
540
|
const { access_token, id_token, refresh_token } = JSON.parse(tokens);
|
|
541
541
|
const { exp, iss, client_id } = this.parseJwt(access_token);
|
|
542
|
-
if (Date.now() / 1e3 >= exp) {
|
|
542
|
+
if (Date.now() / 1e3 >= exp - 120) {
|
|
543
543
|
const refreshResponse = await fetch(iss, {
|
|
544
544
|
method: "POST",
|
|
545
545
|
headers: {
|
|
@@ -897,6 +897,9 @@ mutation addPendingDocumentMutation(
|
|
|
897
897
|
if (!cms.api.tina) {
|
|
898
898
|
cms.registerApi("tina", createClient(props));
|
|
899
899
|
}
|
|
900
|
+
if (!cms.api.admin) {
|
|
901
|
+
cms.registerApi("admin", new TinaAdminApi(cms));
|
|
902
|
+
}
|
|
900
903
|
const setupMedia = async () => {
|
|
901
904
|
var _a;
|
|
902
905
|
if (props.mediaStore) {
|
|
@@ -921,11 +924,6 @@ mutation addPendingDocumentMutation(
|
|
|
921
924
|
return newBranch;
|
|
922
925
|
};
|
|
923
926
|
setupMedia();
|
|
924
|
-
React__default["default"].useMemo(() => {
|
|
925
|
-
if (cms.flags.get("tina-admin") === true) {
|
|
926
|
-
cms.registerApi("admin", new TinaAdminApi(cms));
|
|
927
|
-
}
|
|
928
|
-
}, [cms, cms.flags.get("tina-admin")]);
|
|
929
927
|
const [branchingEnabled, setBranchingEnabled] = React__default["default"].useState(() => cms.flags.get("branch-switcher"));
|
|
930
928
|
React__default["default"].useEffect(() => {
|
|
931
929
|
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
@@ -2132,6 +2130,10 @@ Document
|
|
|
2132
2130
|
height: 20px !important;
|
|
2133
2131
|
}
|
|
2134
2132
|
|
|
2133
|
+
.tina-tailwind .h-12 {
|
|
2134
|
+
height: 48px !important;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2135
2137
|
.tina-tailwind .w-full {
|
|
2136
2138
|
width: 100% !important;
|
|
2137
2139
|
}
|
|
@@ -2152,10 +2154,6 @@ Document
|
|
|
2152
2154
|
width: 224px !important;
|
|
2153
2155
|
}
|
|
2154
2156
|
|
|
2155
|
-
.tina-tailwind .w-0 {
|
|
2156
|
-
width: 0px !important;
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
2157
|
.tina-tailwind .w-6 {
|
|
2160
2158
|
width: 24px !important;
|
|
2161
2159
|
}
|
|
@@ -2180,6 +2178,14 @@ Document
|
|
|
2180
2178
|
flex: 1 1 0% !important;
|
|
2181
2179
|
}
|
|
2182
2180
|
|
|
2181
|
+
.tina-tailwind .flex-shrink-0 {
|
|
2182
|
+
flex-shrink: 0 !important;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
.tina-tailwind .flex-grow-0 {
|
|
2186
|
+
flex-grow: 0 !important;
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2183
2189
|
.tina-tailwind .table-auto {
|
|
2184
2190
|
table-layout: auto !important;
|
|
2185
2191
|
}
|
|
@@ -2219,6 +2225,10 @@ Document
|
|
|
2219
2225
|
transform: var(--tw-transform) !important;
|
|
2220
2226
|
}
|
|
2221
2227
|
|
|
2228
|
+
.tina-tailwind .cursor-pointer {
|
|
2229
|
+
cursor: pointer !important;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2222
2232
|
.tina-tailwind .flex-col {
|
|
2223
2233
|
flex-direction: column !important;
|
|
2224
2234
|
}
|
|
@@ -2235,6 +2245,10 @@ Document
|
|
|
2235
2245
|
align-items: stretch !important;
|
|
2236
2246
|
}
|
|
2237
2247
|
|
|
2248
|
+
.tina-tailwind .justify-end {
|
|
2249
|
+
justify-content: flex-end !important;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2238
2252
|
.tina-tailwind .justify-center {
|
|
2239
2253
|
justify-content: center !important;
|
|
2240
2254
|
}
|
|
@@ -2302,10 +2316,6 @@ Document
|
|
|
2302
2316
|
border-color: rgba(225, 221, 236, var(--tw-border-opacity)) !important;
|
|
2303
2317
|
}
|
|
2304
2318
|
|
|
2305
|
-
.tina-tailwind .border-transparent {
|
|
2306
|
-
border-color: transparent !important;
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
2319
|
.tina-tailwind .bg-white {
|
|
2310
2320
|
--tw-bg-opacity: 1 !important;
|
|
2311
2321
|
background-color: rgba(255, 255, 255, var(--tw-bg-opacity)) !important;
|
|
@@ -2389,9 +2399,8 @@ Document
|
|
|
2389
2399
|
padding-bottom: 12px !important;
|
|
2390
2400
|
}
|
|
2391
2401
|
|
|
2392
|
-
.tina-tailwind .
|
|
2393
|
-
padding-
|
|
2394
|
-
padding-right: 32px !important;
|
|
2402
|
+
.tina-tailwind .pt-4 {
|
|
2403
|
+
padding-top: 16px !important;
|
|
2395
2404
|
}
|
|
2396
2405
|
|
|
2397
2406
|
.tina-tailwind .pb-4 {
|
|
@@ -2468,10 +2477,6 @@ Document
|
|
|
2468
2477
|
line-height: 20px !important;
|
|
2469
2478
|
}
|
|
2470
2479
|
|
|
2471
|
-
.tina-tailwind .leading-4 {
|
|
2472
|
-
line-height: 16px !important;
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
2480
|
.tina-tailwind .tracking-wide {
|
|
2476
2481
|
letter-spacing: 0.025em !important;
|
|
2477
2482
|
}
|
|
@@ -2573,11 +2578,6 @@ Document
|
|
|
2573
2578
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;
|
|
2574
2579
|
}
|
|
2575
2580
|
|
|
2576
|
-
.tina-tailwind .shadow-sm {
|
|
2577
|
-
--tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
|
|
2578
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
2581
|
.tina-tailwind .ring-1 {
|
|
2582
2582
|
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;
|
|
2583
2583
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;
|
|
@@ -2672,11 +2672,6 @@ Document
|
|
|
2672
2672
|
background-color: rgba(5, 116, 228, var(--tw-bg-opacity)) !important;
|
|
2673
2673
|
}
|
|
2674
2674
|
|
|
2675
|
-
.hover\\:bg-gray-50:hover {
|
|
2676
|
-
--tw-bg-opacity: 1 !important;
|
|
2677
|
-
background-color: rgba(246, 246, 249, var(--tw-bg-opacity)) !important;
|
|
2678
|
-
}
|
|
2679
|
-
|
|
2680
2675
|
.hover\\:text-blue-600:hover {
|
|
2681
2676
|
--tw-text-opacity: 1 !important;
|
|
2682
2677
|
color: rgba(5, 116, 228, var(--tw-text-opacity)) !important;
|
|
@@ -2691,10 +2686,6 @@ Document
|
|
|
2691
2686
|
opacity: 1 !important;
|
|
2692
2687
|
}
|
|
2693
2688
|
|
|
2694
|
-
.hover\\:opacity-80:hover {
|
|
2695
|
-
opacity: .8 !important;
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
2689
|
.focus\\:text-blue-400:focus {
|
|
2699
2690
|
--tw-text-opacity: 1 !important;
|
|
2700
2691
|
color: rgba(34, 150, 254, var(--tw-text-opacity)) !important;
|
|
@@ -3181,41 +3172,29 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3181
3172
|
}
|
|
3182
3173
|
const useGetCollections = (cms) => {
|
|
3183
3174
|
const api = new TinaAdminApi(cms);
|
|
3184
|
-
const [
|
|
3175
|
+
const [collections, setCollections] = React.useState([]);
|
|
3176
|
+
const [loading, setLoading] = React.useState(true);
|
|
3185
3177
|
React.useEffect(() => {
|
|
3186
3178
|
const fetchCollections = async () => {
|
|
3187
3179
|
const response = await api.fetchCollections();
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
loading: false,
|
|
3191
|
-
error: false
|
|
3192
|
-
});
|
|
3180
|
+
setCollections(response.getCollections);
|
|
3181
|
+
setLoading(false);
|
|
3193
3182
|
};
|
|
3183
|
+
setLoading(true);
|
|
3194
3184
|
fetchCollections();
|
|
3195
3185
|
}, [cms]);
|
|
3196
|
-
return
|
|
3197
|
-
};
|
|
3198
|
-
const GetCollections = ({ cms, children }) => {
|
|
3199
|
-
const { collections, loading, error } = useGetCollections(cms);
|
|
3200
|
-
if (!collections)
|
|
3201
|
-
return null;
|
|
3202
|
-
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collections, loading, error));
|
|
3186
|
+
return { collections, loading };
|
|
3203
3187
|
};
|
|
3204
3188
|
const slugify = (text) => {
|
|
3205
3189
|
return text.toString().toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "_").replace(/^-+|-+$/g, "");
|
|
3206
3190
|
};
|
|
3207
3191
|
const Sidebar = ({ cms }) => {
|
|
3192
|
+
const collectionsInfo = useGetCollections(cms);
|
|
3208
3193
|
const screens = cms.plugins.getType("screen").all();
|
|
3209
|
-
return /* @__PURE__ */ React__default["default"].createElement(
|
|
3210
|
-
cms
|
|
3211
|
-
}, (collections, loading, error) => /* @__PURE__ */ React__default["default"].createElement(toolkit.Nav, {
|
|
3194
|
+
return /* @__PURE__ */ React__default["default"].createElement(toolkit.Nav, {
|
|
3212
3195
|
sidebarWidth: 360,
|
|
3213
3196
|
showCollections: true,
|
|
3214
|
-
collectionsInfo
|
|
3215
|
-
collections,
|
|
3216
|
-
loading,
|
|
3217
|
-
error
|
|
3218
|
-
},
|
|
3197
|
+
collectionsInfo,
|
|
3219
3198
|
screens,
|
|
3220
3199
|
contentCreators: [],
|
|
3221
3200
|
RenderNavSite: ({ view }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
|
|
@@ -3228,7 +3207,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3228
3207
|
to: `collections/${collection.name}`,
|
|
3229
3208
|
Icon: ImFilesEmpty
|
|
3230
3209
|
})
|
|
3231
|
-
})
|
|
3210
|
+
});
|
|
3232
3211
|
};
|
|
3233
3212
|
const SidebarLink = (props) => {
|
|
3234
3213
|
const { to, label, Icon } = props;
|
|
@@ -3252,9 +3231,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3252
3231
|
function BiEdit(props) {
|
|
3253
3232
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m7 17.013 4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z" } }, { "tag": "path", "attr": { "d": "M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z" } }] })(props);
|
|
3254
3233
|
}
|
|
3255
|
-
function BiExit(props) {
|
|
3256
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.002 3h-14c-1.103 0-2 .897-2 2v4h2V5h14v14h-14v-4h-2v4c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.898-2-2-2z" } }, { "tag": "path", "attr": { "d": "m11 16 5-4-5-4v3.001H3v2h8z" } }] })(props);
|
|
3257
|
-
}
|
|
3258
3234
|
function BiLogIn(props) {
|
|
3259
3235
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m13 16 5-4-5-4v3H4v2h9z" } }, { "tag": "path", "attr": { "d": "M20 3h-9c-1.103 0-2 .897-2 2v4h2V5h9v14h-9v-4H9v4c0 1.103.897 2 2 2h9c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2z" } }] })(props);
|
|
3260
3236
|
}
|
|
@@ -3288,8 +3264,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3288
3264
|
d: "M18.6466 14.5553C19.9018 13.5141 20.458 7.36086 21.0014 5.14903C21.5447 2.9372 23.7919 3.04938 23.7919 3.04938C23.7919 3.04938 23.2085 4.06764 23.4464 4.82751C23.6844 5.58738 25.3145 6.26662 25.3145 6.26662L24.9629 7.19622C24.9629 7.19622 24.2288 7.10204 23.7919 7.9785C23.355 8.85496 24.3392 17.4442 24.3392 17.4442C24.3392 17.4442 21.4469 22.7275 21.4469 24.9206C21.4469 27.1136 22.4819 28.9515 22.4819 28.9515H21.0296C21.0296 28.9515 18.899 26.4086 18.462 25.1378C18.0251 23.8669 18.1998 22.596 18.1998 22.596C18.1998 22.596 15.8839 22.4646 13.8303 22.596C11.7767 22.7275 10.4072 24.498 10.16 25.4884C9.91287 26.4787 9.81048 28.9515 9.81048 28.9515H8.66211C7.96315 26.7882 7.40803 26.0129 7.70918 24.9206C8.54334 21.8949 8.37949 20.1788 8.18635 19.4145C7.99321 18.6501 6.68552 17.983 6.68552 17.983C7.32609 16.6741 7.97996 16.0452 10.7926 15.9796C13.6052 15.914 17.3915 15.5965 18.6466 14.5553Z"
|
|
3289
3265
|
}), /* @__PURE__ */ React__default["default"].createElement("path", {
|
|
3290
3266
|
d: "M11.1268 24.7939C11.1268 24.7939 11.4236 27.5481 13.0001 28.9516H14.3511C13.0001 27.4166 12.8527 23.4155 12.8527 23.4155C12.1656 23.6399 11.3045 24.3846 11.1268 24.7939Z"
|
|
3291
|
-
})), /* @__PURE__ */ React__default["default"].createElement("span", null, "Tina
|
|
3292
|
-
className: "px-5
|
|
3267
|
+
})), /* @__PURE__ */ React__default["default"].createElement("span", null, "Tina"))), message && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3268
|
+
className: "px-5 pt-4"
|
|
3293
3269
|
}, /* @__PURE__ */ React__default["default"].createElement("p", {
|
|
3294
3270
|
className: "text-base font-sans leading-normal"
|
|
3295
3271
|
}, message)), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
@@ -3299,38 +3275,52 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3299
3275
|
const LoginPage = () => {
|
|
3300
3276
|
const { setEdit } = sharedctx.useEditState();
|
|
3301
3277
|
const login = () => setEdit(true);
|
|
3302
|
-
return /* @__PURE__ */ React__default["default"].createElement(AuthTemplate, null, /* @__PURE__ */ React__default["default"].createElement("
|
|
3303
|
-
|
|
3304
|
-
|
|
3278
|
+
return /* @__PURE__ */ React__default["default"].createElement(AuthTemplate, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3279
|
+
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
3280
|
+
}, /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
|
|
3281
|
+
onClick: () => {
|
|
3282
|
+
window.location.href = "/";
|
|
3283
|
+
},
|
|
3284
|
+
variant: "white",
|
|
3285
|
+
size: "custom",
|
|
3286
|
+
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
3305
3287
|
}, /* @__PURE__ */ React__default["default"].createElement(MdOutlineArrowBack, {
|
|
3306
3288
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
3307
|
-
}), " Back
|
|
3308
|
-
type: "submit",
|
|
3289
|
+
}), " Back To Site"), /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
|
|
3309
3290
|
onClick: () => login(),
|
|
3310
|
-
|
|
3311
|
-
|
|
3291
|
+
variant: "primary",
|
|
3292
|
+
size: "custom",
|
|
3293
|
+
className: "text-base h-12 px-6 flex-1",
|
|
3294
|
+
type: "submit"
|
|
3312
3295
|
}, /* @__PURE__ */ React__default["default"].createElement(BiLogIn, {
|
|
3313
|
-
className: "w-6 h-auto mr-
|
|
3314
|
-
}), "
|
|
3296
|
+
className: "w-6 h-auto mr-2 opacity-80"
|
|
3297
|
+
}), " Edit With Tina")));
|
|
3315
3298
|
};
|
|
3316
3299
|
const logout = () => {
|
|
3317
3300
|
sharedctx.setEditing(false);
|
|
3318
3301
|
window.location.href = "/";
|
|
3319
3302
|
};
|
|
3320
3303
|
const LogoutPage = () => {
|
|
3321
|
-
return /* @__PURE__ */ React__default["default"].createElement(AuthTemplate, null, /* @__PURE__ */ React__default["default"].createElement("
|
|
3322
|
-
|
|
3323
|
-
|
|
3304
|
+
return /* @__PURE__ */ React__default["default"].createElement(AuthTemplate, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3305
|
+
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
3306
|
+
}, /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
|
|
3307
|
+
onClick: () => {
|
|
3308
|
+
window.location.href = "/";
|
|
3309
|
+
},
|
|
3310
|
+
variant: "white",
|
|
3311
|
+
size: "custom",
|
|
3312
|
+
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
3324
3313
|
}, /* @__PURE__ */ React__default["default"].createElement(MdOutlineArrowBack, {
|
|
3325
3314
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
3326
|
-
}), " Back
|
|
3327
|
-
type: "submit",
|
|
3315
|
+
}), " Back To Site"), /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
|
|
3328
3316
|
onClick: () => logout(),
|
|
3329
|
-
|
|
3330
|
-
|
|
3317
|
+
type: "submit",
|
|
3318
|
+
variant: "primary",
|
|
3319
|
+
size: "custom",
|
|
3320
|
+
className: "text-base h-12 px-6 flex-1"
|
|
3331
3321
|
}, /* @__PURE__ */ React__default["default"].createElement(BiLogOut, {
|
|
3332
3322
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
3333
|
-
}), " Log
|
|
3323
|
+
}), " Log Out of Tina")));
|
|
3334
3324
|
};
|
|
3335
3325
|
const PageWrapper = ({
|
|
3336
3326
|
children
|
|
@@ -3371,20 +3361,119 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3371
3361
|
}, "Welcome to Tina!")), /* @__PURE__ */ React__default["default"].createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
3372
3362
|
});
|
|
3373
3363
|
};
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3364
|
+
const LoadingPage = () => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3365
|
+
style: {
|
|
3366
|
+
position: "absolute",
|
|
3367
|
+
top: 0,
|
|
3368
|
+
left: 0,
|
|
3369
|
+
width: "100%",
|
|
3370
|
+
height: "100%",
|
|
3371
|
+
zIndex: 200,
|
|
3372
|
+
opacity: "0.8",
|
|
3373
|
+
display: "flex",
|
|
3374
|
+
alignItems: "start",
|
|
3375
|
+
justifyContent: "center",
|
|
3376
|
+
padding: "120px 40px 40px 40px"
|
|
3377
|
+
}
|
|
3378
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3379
|
+
style: {
|
|
3380
|
+
background: "#FFF",
|
|
3381
|
+
border: "1px solid #EDECF3",
|
|
3382
|
+
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
3383
|
+
borderRadius: "8px",
|
|
3384
|
+
padding: "32px 24px",
|
|
3385
|
+
width: "460px",
|
|
3386
|
+
maxWidth: "90%",
|
|
3387
|
+
display: "flex",
|
|
3388
|
+
alignItems: "center",
|
|
3389
|
+
justifyContent: "center",
|
|
3390
|
+
flexDirection: "column"
|
|
3391
|
+
}
|
|
3392
|
+
}, /* @__PURE__ */ React__default["default"].createElement("svg", {
|
|
3393
|
+
style: {
|
|
3394
|
+
width: "64px",
|
|
3395
|
+
color: "#2296fe",
|
|
3396
|
+
marginTop: "-8px",
|
|
3397
|
+
marginBottom: "16px"
|
|
3398
|
+
},
|
|
3399
|
+
version: "1.1",
|
|
3400
|
+
id: "L5",
|
|
3401
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3402
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3403
|
+
x: "0px",
|
|
3404
|
+
y: "0px",
|
|
3405
|
+
viewBox: "0 0 100 64",
|
|
3406
|
+
enableBackground: "new 0 0 0 0",
|
|
3407
|
+
xmlSpace: "preserve"
|
|
3408
|
+
}, /* @__PURE__ */ React__default["default"].createElement("circle", {
|
|
3409
|
+
fill: "currentColor",
|
|
3410
|
+
stroke: "none",
|
|
3411
|
+
cx: 6,
|
|
3412
|
+
cy: 32,
|
|
3413
|
+
r: 6
|
|
3414
|
+
}, /* @__PURE__ */ React__default["default"].createElement("animateTransform", {
|
|
3415
|
+
attributeName: "transform",
|
|
3416
|
+
dur: "1s",
|
|
3417
|
+
type: "translate",
|
|
3418
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
3419
|
+
calcMode: "spline",
|
|
3420
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
3421
|
+
repeatCount: "indefinite",
|
|
3422
|
+
begin: "0.1"
|
|
3423
|
+
})), /* @__PURE__ */ React__default["default"].createElement("circle", {
|
|
3424
|
+
fill: "currentColor",
|
|
3425
|
+
stroke: "none",
|
|
3426
|
+
cx: 30,
|
|
3427
|
+
cy: 32,
|
|
3428
|
+
r: 6
|
|
3429
|
+
}, /* @__PURE__ */ React__default["default"].createElement("animateTransform", {
|
|
3430
|
+
attributeName: "transform",
|
|
3431
|
+
dur: "1s",
|
|
3432
|
+
type: "translate",
|
|
3433
|
+
values: "0 15 ; 0 -10; 0 15",
|
|
3434
|
+
calcMode: "spline",
|
|
3435
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
3436
|
+
repeatCount: "indefinite",
|
|
3437
|
+
begin: "0.2"
|
|
3438
|
+
})), /* @__PURE__ */ React__default["default"].createElement("circle", {
|
|
3439
|
+
fill: "currentColor",
|
|
3440
|
+
stroke: "none",
|
|
3441
|
+
cx: 54,
|
|
3442
|
+
cy: 32,
|
|
3443
|
+
r: 6
|
|
3444
|
+
}, /* @__PURE__ */ React__default["default"].createElement("animateTransform", {
|
|
3445
|
+
attributeName: "transform",
|
|
3446
|
+
dur: "1s",
|
|
3447
|
+
type: "translate",
|
|
3448
|
+
values: "0 15 ; 0 -5; 0 15",
|
|
3449
|
+
calcMode: "spline",
|
|
3450
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
3451
|
+
repeatCount: "indefinite",
|
|
3452
|
+
begin: "0.3"
|
|
3453
|
+
}))), /* @__PURE__ */ React__default["default"].createElement("p", {
|
|
3454
|
+
style: {
|
|
3455
|
+
fontSize: "16px",
|
|
3456
|
+
color: "#716c7f",
|
|
3457
|
+
textAlign: "center",
|
|
3458
|
+
lineHeight: "1.3",
|
|
3459
|
+
fontFamily: "'Inter', sans-serif",
|
|
3460
|
+
fontWeight: "normal"
|
|
3461
|
+
}
|
|
3462
|
+
}, "Please wait, Tina is loading data..."))));
|
|
3377
3463
|
const useGetCollection = (cms, collectionName, includeDocuments = true) => {
|
|
3378
3464
|
const api = new TinaAdminApi(cms);
|
|
3379
3465
|
const [collection, setCollection] = React.useState(void 0);
|
|
3466
|
+
const [loading, setLoading] = React.useState(true);
|
|
3380
3467
|
React.useEffect(() => {
|
|
3381
3468
|
const fetchCollection = async () => {
|
|
3382
3469
|
const response = await api.fetchCollection(collectionName, includeDocuments);
|
|
3383
3470
|
setCollection(response.getCollection);
|
|
3471
|
+
setLoading(false);
|
|
3384
3472
|
};
|
|
3473
|
+
setLoading(true);
|
|
3385
3474
|
fetchCollection();
|
|
3386
3475
|
}, [cms, collectionName]);
|
|
3387
|
-
return collection;
|
|
3476
|
+
return { collection, loading };
|
|
3388
3477
|
};
|
|
3389
3478
|
const GetCollection = ({
|
|
3390
3479
|
cms,
|
|
@@ -3392,11 +3481,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3392
3481
|
includeDocuments = true,
|
|
3393
3482
|
children
|
|
3394
3483
|
}) => {
|
|
3395
|
-
const collection = useGetCollection(cms, collectionName, includeDocuments);
|
|
3396
|
-
if (!collection) {
|
|
3397
|
-
return null;
|
|
3484
|
+
const { collection, loading } = useGetCollection(cms, collectionName, includeDocuments);
|
|
3485
|
+
if (!collection || loading === true) {
|
|
3486
|
+
return /* @__PURE__ */ React__default["default"].createElement(LoadingPage, null);
|
|
3398
3487
|
}
|
|
3399
|
-
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collection));
|
|
3488
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collection, loading));
|
|
3400
3489
|
};
|
|
3401
3490
|
const TemplateMenu = ({ templates }) => {
|
|
3402
3491
|
return /* @__PURE__ */ React__default["default"].createElement(react.Menu, {
|
|
@@ -3425,12 +3514,21 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3425
3514
|
className: `w-full text-md px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`
|
|
3426
3515
|
}, template.label))))))));
|
|
3427
3516
|
};
|
|
3517
|
+
const handleNavigate = (navigate, cms, collection, document) => {
|
|
3518
|
+
const plugins = cms.plugins.all("tina-admin");
|
|
3519
|
+
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
3520
|
+
const routeOverride = routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
3521
|
+
if (routeOverride) {
|
|
3522
|
+
window.location.href = routeOverride;
|
|
3523
|
+
return null;
|
|
3524
|
+
} else {
|
|
3525
|
+
navigate(document.sys.filename);
|
|
3526
|
+
}
|
|
3527
|
+
};
|
|
3428
3528
|
const CollectionListPage = () => {
|
|
3429
|
-
const { collectionName } = reactRouterDom.useParams();
|
|
3430
3529
|
const navigate = reactRouterDom.useNavigate();
|
|
3530
|
+
const { collectionName } = reactRouterDom.useParams();
|
|
3431
3531
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => {
|
|
3432
|
-
const plugins = cms.plugins.all("tina-admin");
|
|
3433
|
-
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
3434
3532
|
return /* @__PURE__ */ React__default["default"].createElement(GetCollection, {
|
|
3435
3533
|
cms,
|
|
3436
3534
|
collectionName,
|
|
@@ -3457,24 +3555,16 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3457
3555
|
}, /* @__PURE__ */ React__default["default"].createElement("tbody", {
|
|
3458
3556
|
className: "divide-y divide-gray-150"
|
|
3459
3557
|
}, documents.map((document) => {
|
|
3460
|
-
const overrideRoute = routeMapping ? routeMapping.mapper(collection, document.node) : void 0;
|
|
3461
3558
|
return /* @__PURE__ */ React__default["default"].createElement("tr", {
|
|
3462
3559
|
key: `document-${document.node.sys.filename}`,
|
|
3463
3560
|
className: ""
|
|
3464
3561
|
}, /* @__PURE__ */ React__default["default"].createElement("td", {
|
|
3465
3562
|
className: "px-6 py-2 whitespace-nowrap"
|
|
3466
|
-
},
|
|
3467
|
-
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3",
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
}), /* @__PURE__ */ React__default["default"].createElement("span", null, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
3472
|
-
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
3473
|
-
}, "Filename"), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
3474
|
-
className: "h-5 leading-5 block whitespace-nowrap"
|
|
3475
|
-
}, document.node.sys.filename))), !overrideRoute && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
|
|
3476
|
-
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3",
|
|
3477
|
-
to: `${document.node.sys.filename}`
|
|
3563
|
+
}, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
3564
|
+
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
3565
|
+
onClick: () => {
|
|
3566
|
+
handleNavigate(navigate, cms, collection, document.node);
|
|
3567
|
+
}
|
|
3478
3568
|
}, /* @__PURE__ */ React__default["default"].createElement(BiEdit, {
|
|
3479
3569
|
className: "inline-block h-6 w-auto opacity-70"
|
|
3480
3570
|
}), /* @__PURE__ */ React__default["default"].createElement("span", null, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
@@ -3493,55 +3583,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3493
3583
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
3494
3584
|
}, "Template"), /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
3495
3585
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
3496
|
-
}, document.node.sys.template))
|
|
3497
|
-
className: "w-0"
|
|
3498
|
-
}, /* @__PURE__ */ React__default["default"].createElement(OverflowMenu, {
|
|
3499
|
-
items: [
|
|
3500
|
-
{
|
|
3501
|
-
label: "Edit in Admin",
|
|
3502
|
-
icon: BiEdit,
|
|
3503
|
-
onClick: () => {
|
|
3504
|
-
navigate(`${document.node.sys.filename}`, { replace: true });
|
|
3505
|
-
}
|
|
3506
|
-
}
|
|
3507
|
-
]
|
|
3508
|
-
})));
|
|
3586
|
+
}, document.node.sys.template)));
|
|
3509
3587
|
})))))));
|
|
3510
3588
|
});
|
|
3511
3589
|
});
|
|
3512
3590
|
};
|
|
3513
|
-
const OverflowMenu = ({ items = [] }) => {
|
|
3514
|
-
if (items.length === 0)
|
|
3515
|
-
return null;
|
|
3516
|
-
return /* @__PURE__ */ React__default["default"].createElement(react.Menu, null, ({ open }) => /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3517
|
-
className: "relative"
|
|
3518
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Button, {
|
|
3519
|
-
className: `flex-1 group px-5 py-3 flex justify-between items-center transition-all duration-300 ease-in-out transform`
|
|
3520
|
-
}, /* @__PURE__ */ React__default["default"].createElement(FiMoreVertical, {
|
|
3521
|
-
className: `flex-0 w-6 h-full inline-block text-gray-400 transition-all duration-300 ease-in-out transform ${open ? `opacity-100 text-blue-500` : `opacity-70 group-hover:opacity-100`}`
|
|
3522
|
-
})), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3523
|
-
className: "transform translate-y-full absolute bottom-2 right-5 z-50"
|
|
3524
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Transition, {
|
|
3525
|
-
enter: "transition duration-150 ease-out",
|
|
3526
|
-
enterFrom: "transform opacity-0 -translate-y-2",
|
|
3527
|
-
enterTo: "transform opacity-100 translate-y-0",
|
|
3528
|
-
leave: "transition duration-75 ease-in",
|
|
3529
|
-
leaveFrom: "transform opacity-100 translate-y-0",
|
|
3530
|
-
leaveTo: "transform opacity-0 -translate-y-2"
|
|
3531
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Items, {
|
|
3532
|
-
className: "bg-white border border-gray-150 rounded-lg shadow-lg"
|
|
3533
|
-
}, items.map((item) => {
|
|
3534
|
-
const Icon = item.icon ? item.icon : BiExit;
|
|
3535
|
-
return /* @__PURE__ */ React__default["default"].createElement(react.Menu.Item, {
|
|
3536
|
-
key: `menu-item-${item.label}`
|
|
3537
|
-
}, ({ active }) => /* @__PURE__ */ React__default["default"].createElement("button", {
|
|
3538
|
-
className: `w-full text-base px-4 py-2 first:pt-3 last:pb-3 tracking-wide whitespace-nowrap flex items-center opacity-80 text-gray-600 ${active && "text-blue-400 bg-gray-50 opacity-100"}`,
|
|
3539
|
-
onClick: item.onClick
|
|
3540
|
-
}, /* @__PURE__ */ React__default["default"].createElement(Icon, {
|
|
3541
|
-
className: "w-6 h-auto mr-2 text-blue-400"
|
|
3542
|
-
}), " ", item.label));
|
|
3543
|
-
}))))));
|
|
3544
|
-
};
|
|
3545
3591
|
function HiChevronRight(props) {
|
|
3546
3592
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "clipRule": "evenodd" } }] })(props);
|
|
3547
3593
|
}
|
|
@@ -3553,6 +3599,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3553
3599
|
fields: void 0,
|
|
3554
3600
|
mutationInfo: void 0
|
|
3555
3601
|
});
|
|
3602
|
+
const [loading, setLoading] = React.useState(true);
|
|
3556
3603
|
React.useEffect(() => {
|
|
3557
3604
|
const fetchDocumentFields = async () => {
|
|
3558
3605
|
const response = await api.fetchDocumentFields();
|
|
@@ -3573,10 +3620,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3573
3620
|
fields,
|
|
3574
3621
|
mutationInfo
|
|
3575
3622
|
});
|
|
3623
|
+
setLoading(false);
|
|
3576
3624
|
};
|
|
3625
|
+
setLoading(true);
|
|
3577
3626
|
fetchDocumentFields();
|
|
3578
3627
|
}, [cms, collectionName]);
|
|
3579
|
-
return info;
|
|
3628
|
+
return __spreadProps(__spreadValues({}, info), { loading });
|
|
3580
3629
|
};
|
|
3581
3630
|
const GetDocumentFields = ({
|
|
3582
3631
|
cms,
|
|
@@ -3584,11 +3633,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3584
3633
|
templateName,
|
|
3585
3634
|
children
|
|
3586
3635
|
}) => {
|
|
3587
|
-
const { collection, template, fields, mutationInfo } = useGetDocumentFields(cms, collectionName, templateName);
|
|
3588
|
-
if (!collection) {
|
|
3589
|
-
return null;
|
|
3636
|
+
const { collection, template, fields, mutationInfo, loading } = useGetDocumentFields(cms, collectionName, templateName);
|
|
3637
|
+
if (!collection || loading) {
|
|
3638
|
+
return /* @__PURE__ */ React__default["default"].createElement(LoadingPage, null);
|
|
3590
3639
|
}
|
|
3591
|
-
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children({ collection, template, fields, mutationInfo }));
|
|
3640
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children({ collection, template, fields, mutationInfo, loading }));
|
|
3592
3641
|
};
|
|
3593
3642
|
const createDocument = async (cms, collection, template, mutationInfo, values) => {
|
|
3594
3643
|
const api = new TinaAdminApi(cms);
|
|
@@ -3678,14 +3727,17 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3678
3727
|
const useGetDocument = (cms, collectionName, relativePath) => {
|
|
3679
3728
|
const api = new TinaAdminApi(cms);
|
|
3680
3729
|
const [document, setDocument] = React.useState(void 0);
|
|
3730
|
+
const [loading, setLoading] = React.useState(true);
|
|
3681
3731
|
React.useEffect(() => {
|
|
3682
3732
|
const fetchDocument = async () => {
|
|
3683
3733
|
const response = await api.fetchDocument(collectionName, relativePath);
|
|
3684
3734
|
setDocument(response.getDocument);
|
|
3735
|
+
setLoading(false);
|
|
3685
3736
|
};
|
|
3737
|
+
setLoading(true);
|
|
3686
3738
|
fetchDocument();
|
|
3687
3739
|
}, [cms, collectionName, relativePath]);
|
|
3688
|
-
return document;
|
|
3740
|
+
return { document, loading };
|
|
3689
3741
|
};
|
|
3690
3742
|
const GetDocument = ({
|
|
3691
3743
|
cms,
|
|
@@ -3693,11 +3745,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3693
3745
|
relativePath,
|
|
3694
3746
|
children
|
|
3695
3747
|
}) => {
|
|
3696
|
-
const document = useGetDocument(cms, collectionName, relativePath);
|
|
3697
|
-
if (!document) {
|
|
3698
|
-
return null;
|
|
3748
|
+
const { document, loading } = useGetDocument(cms, collectionName, relativePath);
|
|
3749
|
+
if (!document || loading) {
|
|
3750
|
+
return /* @__PURE__ */ React__default["default"].createElement(LoadingPage, null);
|
|
3699
3751
|
}
|
|
3700
|
-
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(document));
|
|
3752
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(document, loading));
|
|
3701
3753
|
};
|
|
3702
3754
|
const updateDocument = async (cms, relativePath, collection, mutationInfo, values) => {
|
|
3703
3755
|
const api = new TinaAdminApi(cms);
|
|
@@ -3817,7 +3869,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3817
3869
|
}, /* @__PURE__ */ React__default["default"].createElement(Sidebar, {
|
|
3818
3870
|
cms
|
|
3819
3871
|
}), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3820
|
-
className: "flex-1"
|
|
3872
|
+
className: "flex-1 relative"
|
|
3821
3873
|
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
3822
3874
|
path: "collections/:collectionName/new",
|
|
3823
3875
|
element: /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null)
|
package/dist/rich-text.es.js
CHANGED
|
@@ -39,7 +39,6 @@ const TinaMarkdown = ({
|
|
|
39
39
|
}
|
|
40
40
|
const nodes = Array.isArray(content) ? content : content.children;
|
|
41
41
|
if (!nodes) {
|
|
42
|
-
console.log(`Expected to find structured content for TinaMarkdown`);
|
|
43
42
|
return null;
|
|
44
43
|
}
|
|
45
44
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
|
package/dist/rich-text.js
CHANGED
|
@@ -46,7 +46,6 @@ var __objRest = (source, exclude) => {
|
|
|
46
46
|
}
|
|
47
47
|
const nodes = Array.isArray(content) ? content : content.children;
|
|
48
48
|
if (!nodes) {
|
|
49
|
-
console.log(`Expected to find structured content for TinaMarkdown`);
|
|
50
49
|
return null;
|
|
51
50
|
}
|
|
52
51
|
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, nodes.map((child, index) => {
|