tinacms 0.68.10 → 0.68.13
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/LICENSE +176 -0
- package/dist/client.js +1 -2
- package/dist/edit-state.es.js +7 -35
- package/dist/edit-state.js +8 -37
- package/dist/hooks/formify/spec/schema.d.ts +3 -0
- package/dist/index.es.js +515 -580
- package/dist/index.js +286 -352
- package/dist/internalClient/index.d.ts +8 -0
- package/dist/rich-text.es.js +74 -73
- package/dist/rich-text.js +75 -75
- package/dist/style.css +54 -3
- package/package.json +36 -13
- package/CHANGELOG.md +0 -1586
package/dist/index.es.js
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button as Button$1, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, OverflowMenu, PopupModal, FormStatus, FormBuilder } from "@tinacms/toolkit";
|
|
1
|
+
import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, OverflowMenu, CursorPaginator, PopupModal, FormStatus, FormBuilder } from "@tinacms/toolkit";
|
|
33
2
|
export * from "@tinacms/toolkit";
|
|
34
3
|
import * as G from "graphql";
|
|
35
4
|
import { TypeInfo, visit, visitWithTypeInfo, getNamedType, GraphQLObjectType, isLeafType, GraphQLUnionType, isScalarType as isScalarType$1, getIntrospectionQuery, buildClientSchema, print, parse } from "graphql";
|
|
36
5
|
import set from "lodash.set";
|
|
37
|
-
import
|
|
38
|
-
import React__default, { useState, useCallback, useEffect, Fragment, useMemo } from "react";
|
|
6
|
+
import React, { useState, useCallback, useEffect, Fragment, useMemo } from "react";
|
|
39
7
|
import { getIn, setIn } from "final-form";
|
|
40
8
|
import { resolveForm, TinaSchema, addNamespaceToSchema, validateSchema } from "@tinacms/schema-tools";
|
|
41
9
|
import gql$1 from "graphql-tag";
|
|
42
10
|
import * as yup from "yup";
|
|
43
|
-
import styled
|
|
11
|
+
import styled from "styled-components";
|
|
44
12
|
import { setEditing, TinaDataContext, useEditState } from "@tinacms/sharedctx";
|
|
45
13
|
import UrlPattern from "url-pattern";
|
|
46
14
|
import { NavLink, useNavigate, useParams, useLocation, Link, HashRouter, Routes, Route } from "react-router-dom";
|
|
@@ -433,7 +401,7 @@ function useGraphqlForms({
|
|
|
433
401
|
return [state.data, state.status !== "done"];
|
|
434
402
|
}
|
|
435
403
|
const transformDocumentIntoMutationRequestPayload = (document, instructions) => {
|
|
436
|
-
const
|
|
404
|
+
const { _collection, __typename, _template, ...rest } = document;
|
|
437
405
|
const params = transformParams(rest);
|
|
438
406
|
const paramsWithTemplate = instructions.includeTemplate ? { [_template]: params } : params;
|
|
439
407
|
return instructions.includeCollection ? { [_collection]: paramsWithTemplate } : paramsWithTemplate;
|
|
@@ -447,7 +415,7 @@ const transformParams = (data) => {
|
|
|
447
415
|
}
|
|
448
416
|
try {
|
|
449
417
|
assertShape(data, (yup2) => yup2.object({ _template: yup2.string().required() }));
|
|
450
|
-
const
|
|
418
|
+
const { _template, __typename, ...rest } = data;
|
|
451
419
|
const nested = transformParams(rest);
|
|
452
420
|
return { [_template]: nested };
|
|
453
421
|
} catch (e) {
|
|
@@ -626,10 +594,11 @@ const buildForm = (doc, cms, formify2, showInSidebar = false, onSubmit) => {
|
|
|
626
594
|
schema: enrichedSchema,
|
|
627
595
|
template
|
|
628
596
|
});
|
|
629
|
-
formConfig =
|
|
597
|
+
formConfig = {
|
|
630
598
|
label: formInfo.label,
|
|
631
|
-
fields: formInfo.fields
|
|
632
|
-
|
|
599
|
+
fields: formInfo.fields,
|
|
600
|
+
...formCommon
|
|
601
|
+
};
|
|
633
602
|
if (formify2) {
|
|
634
603
|
form = formify2({
|
|
635
604
|
formConfig,
|
|
@@ -1064,12 +1033,13 @@ const formify = async ({
|
|
|
1064
1033
|
const visitor = {
|
|
1065
1034
|
OperationDefinition: (node2) => {
|
|
1066
1035
|
if (!node2.name) {
|
|
1067
|
-
return
|
|
1036
|
+
return {
|
|
1037
|
+
...node2,
|
|
1068
1038
|
name: {
|
|
1069
1039
|
kind: "Name",
|
|
1070
1040
|
value: `QueryOperation`
|
|
1071
1041
|
}
|
|
1072
|
-
}
|
|
1042
|
+
};
|
|
1073
1043
|
}
|
|
1074
1044
|
return node2;
|
|
1075
1045
|
}
|
|
@@ -1082,7 +1052,8 @@ const formify = async ({
|
|
|
1082
1052
|
selectionNode,
|
|
1083
1053
|
path
|
|
1084
1054
|
}) => {
|
|
1085
|
-
return
|
|
1055
|
+
return {
|
|
1056
|
+
...selectionNode,
|
|
1086
1057
|
selectionSet: {
|
|
1087
1058
|
kind: "SelectionSet",
|
|
1088
1059
|
selections: selectionNode.selectionSet.selections.map((selectionNode2) => {
|
|
@@ -1095,7 +1066,8 @@ const formify = async ({
|
|
|
1095
1066
|
type: edgeField.type,
|
|
1096
1067
|
path
|
|
1097
1068
|
});
|
|
1098
|
-
return
|
|
1069
|
+
return {
|
|
1070
|
+
...selectionNode2,
|
|
1099
1071
|
selectionSet: {
|
|
1100
1072
|
kind: "SelectionSet",
|
|
1101
1073
|
selections: selectionNode2.selectionSet.selections.map((subSelectionNode) => {
|
|
@@ -1121,7 +1093,7 @@ const formify = async ({
|
|
|
1121
1093
|
}
|
|
1122
1094
|
})
|
|
1123
1095
|
}
|
|
1124
|
-
}
|
|
1096
|
+
};
|
|
1125
1097
|
}
|
|
1126
1098
|
return selectionNode2;
|
|
1127
1099
|
default:
|
|
@@ -1129,7 +1101,7 @@ const formify = async ({
|
|
|
1129
1101
|
}
|
|
1130
1102
|
})
|
|
1131
1103
|
}
|
|
1132
|
-
}
|
|
1104
|
+
};
|
|
1133
1105
|
};
|
|
1134
1106
|
function formifyInlineFragmentDocument({
|
|
1135
1107
|
inlineFragmentNode,
|
|
@@ -1182,7 +1154,8 @@ const formify = async ({
|
|
|
1182
1154
|
});
|
|
1183
1155
|
extraFields = metaFields;
|
|
1184
1156
|
}
|
|
1185
|
-
return
|
|
1157
|
+
return {
|
|
1158
|
+
...selection,
|
|
1186
1159
|
selectionSet: {
|
|
1187
1160
|
kind: "SelectionSet",
|
|
1188
1161
|
selections: [
|
|
@@ -1219,7 +1192,7 @@ const formify = async ({
|
|
|
1219
1192
|
...extraFields
|
|
1220
1193
|
]
|
|
1221
1194
|
}
|
|
1222
|
-
}
|
|
1195
|
+
};
|
|
1223
1196
|
}
|
|
1224
1197
|
const formifyFieldNode = ({
|
|
1225
1198
|
fieldNode,
|
|
@@ -1254,7 +1227,8 @@ const formify = async ({
|
|
|
1254
1227
|
if (isScalarType(field.type)) {
|
|
1255
1228
|
return fieldNode;
|
|
1256
1229
|
}
|
|
1257
|
-
return
|
|
1230
|
+
return {
|
|
1231
|
+
...fieldNode,
|
|
1258
1232
|
selectionSet: {
|
|
1259
1233
|
kind: "SelectionSet",
|
|
1260
1234
|
selections: [
|
|
@@ -1280,7 +1254,7 @@ const formify = async ({
|
|
|
1280
1254
|
})
|
|
1281
1255
|
]
|
|
1282
1256
|
}
|
|
1283
|
-
}
|
|
1257
|
+
};
|
|
1284
1258
|
};
|
|
1285
1259
|
const formifyInlineFragmentNode = ({
|
|
1286
1260
|
inlineFragmentNode,
|
|
@@ -1299,7 +1273,8 @@ const formify = async ({
|
|
|
1299
1273
|
showInSidebar: false
|
|
1300
1274
|
});
|
|
1301
1275
|
}
|
|
1302
|
-
return
|
|
1276
|
+
return {
|
|
1277
|
+
...inlineFragmentNode,
|
|
1303
1278
|
selectionSet: {
|
|
1304
1279
|
kind: "SelectionSet",
|
|
1305
1280
|
selections: inlineFragmentNode.selectionSet.selections.map((selectionNode) => {
|
|
@@ -1315,7 +1290,7 @@ const formify = async ({
|
|
|
1315
1290
|
}
|
|
1316
1291
|
})
|
|
1317
1292
|
}
|
|
1318
|
-
}
|
|
1293
|
+
};
|
|
1319
1294
|
};
|
|
1320
1295
|
const formifiedQuery = {
|
|
1321
1296
|
kind: "Document",
|
|
@@ -1323,7 +1298,8 @@ const formify = async ({
|
|
|
1323
1298
|
typeInfo.enter(definition);
|
|
1324
1299
|
ensureOperationDefinition(definition);
|
|
1325
1300
|
const parentType = typeInfo.getType();
|
|
1326
|
-
return
|
|
1301
|
+
return {
|
|
1302
|
+
...definition,
|
|
1327
1303
|
selectionSet: {
|
|
1328
1304
|
kind: "SelectionSet",
|
|
1329
1305
|
selections: definition.selectionSet.selections.map((selectionNode) => {
|
|
@@ -1353,7 +1329,8 @@ const formify = async ({
|
|
|
1353
1329
|
fieldNode: selectionNode,
|
|
1354
1330
|
type: field.type
|
|
1355
1331
|
});
|
|
1356
|
-
return
|
|
1332
|
+
return {
|
|
1333
|
+
...selectionNode,
|
|
1357
1334
|
selectionSet: {
|
|
1358
1335
|
kind: "SelectionSet",
|
|
1359
1336
|
selections: selectionNode.selectionSet.selections.map((subSelectionNode) => {
|
|
@@ -1377,7 +1354,7 @@ const formify = async ({
|
|
|
1377
1354
|
}
|
|
1378
1355
|
})
|
|
1379
1356
|
}
|
|
1380
|
-
}
|
|
1357
|
+
};
|
|
1381
1358
|
}
|
|
1382
1359
|
throw new FormifyError("NOOP");
|
|
1383
1360
|
default:
|
|
@@ -1385,7 +1362,7 @@ const formify = async ({
|
|
|
1385
1362
|
}
|
|
1386
1363
|
})
|
|
1387
1364
|
}
|
|
1388
|
-
}
|
|
1365
|
+
};
|
|
1389
1366
|
})
|
|
1390
1367
|
};
|
|
1391
1368
|
return { formifiedQuery, blueprints };
|
|
@@ -1424,17 +1401,20 @@ function reducer(state, action) {
|
|
|
1424
1401
|
var _a, _b, _c, _d;
|
|
1425
1402
|
switch (action.type) {
|
|
1426
1403
|
case "start":
|
|
1427
|
-
return
|
|
1404
|
+
return {
|
|
1405
|
+
...state,
|
|
1406
|
+
...defaultState,
|
|
1428
1407
|
query: action.value.query ? G.parse(action.value.query) : null,
|
|
1429
1408
|
queryString: action.value.query,
|
|
1430
1409
|
status: "initialized"
|
|
1431
|
-
}
|
|
1410
|
+
};
|
|
1432
1411
|
case "addDocumentBlueprints":
|
|
1433
|
-
return
|
|
1412
|
+
return {
|
|
1413
|
+
...state,
|
|
1434
1414
|
status: "formified",
|
|
1435
1415
|
blueprints: action.value.blueprints,
|
|
1436
1416
|
query: action.value.formifiedQuery
|
|
1437
|
-
}
|
|
1417
|
+
};
|
|
1438
1418
|
case "addOrReplaceDocumentFormNode": {
|
|
1439
1419
|
const existingDocumentForms = state.documentForms.filter((documentForm) => {
|
|
1440
1420
|
var _a2, _b2;
|
|
@@ -1447,10 +1427,11 @@ function reducer(state, action) {
|
|
|
1447
1427
|
if ((_a = action.value) == null ? void 0 : _a.documentForm) {
|
|
1448
1428
|
newDocumentForms.push((_b = action.value) == null ? void 0 : _b.documentForm);
|
|
1449
1429
|
}
|
|
1450
|
-
return
|
|
1430
|
+
return {
|
|
1431
|
+
...state,
|
|
1451
1432
|
formNodes: [...existingDocumentFormNodes, action.value.formNode],
|
|
1452
1433
|
documentForms: [...existingDocumentForms, ...newDocumentForms]
|
|
1453
|
-
}
|
|
1434
|
+
};
|
|
1454
1435
|
}
|
|
1455
1436
|
case "onFieldChange": {
|
|
1456
1437
|
const event = action.value.event;
|
|
@@ -1462,32 +1443,33 @@ function reducer(state, action) {
|
|
|
1462
1443
|
getFormNodesFromEvent(state, event).forEach((formNode) => {
|
|
1463
1444
|
const blueprint = getFormNodeBlueprint(formNode, state);
|
|
1464
1445
|
if (blueprint.hasValuesField) {
|
|
1465
|
-
changeSets.push(
|
|
1466
|
-
path: [formNodePath(formNode), "values"].join(".")
|
|
1467
|
-
|
|
1446
|
+
changeSets.push({
|
|
1447
|
+
path: [formNodePath(formNode), "values"].join("."),
|
|
1448
|
+
...buildChangeSet(event, formNode),
|
|
1468
1449
|
value: form.values,
|
|
1469
1450
|
mutationType: {
|
|
1470
1451
|
type: "global"
|
|
1471
1452
|
}
|
|
1472
|
-
})
|
|
1453
|
+
});
|
|
1473
1454
|
}
|
|
1474
1455
|
if (blueprint.hasDataJSONField) {
|
|
1475
|
-
changeSets.push(
|
|
1476
|
-
path: [formNodePath(formNode), "dataJSON"].join(".")
|
|
1477
|
-
|
|
1456
|
+
changeSets.push({
|
|
1457
|
+
path: [formNodePath(formNode), "dataJSON"].join("."),
|
|
1458
|
+
...buildChangeSet(event, formNode),
|
|
1478
1459
|
value: form.values,
|
|
1479
1460
|
mutationType: {
|
|
1480
1461
|
type: "global"
|
|
1481
1462
|
}
|
|
1482
|
-
})
|
|
1463
|
+
});
|
|
1483
1464
|
}
|
|
1484
1465
|
if (event.mutationType.type === "change") {
|
|
1485
1466
|
if (!action.value.form) {
|
|
1486
1467
|
getBlueprintFieldsForEvent(blueprint, event).forEach((fieldBlueprint) => {
|
|
1487
1468
|
const { pathToChange } = getFormNodesForField(fieldBlueprint, formNode, event, state);
|
|
1488
|
-
changeSets.push(
|
|
1489
|
-
path: pathToChange
|
|
1490
|
-
|
|
1469
|
+
changeSets.push({
|
|
1470
|
+
path: pathToChange,
|
|
1471
|
+
...buildChangeSet(event, formNode)
|
|
1472
|
+
});
|
|
1491
1473
|
});
|
|
1492
1474
|
}
|
|
1493
1475
|
} else if (event.mutationType.type === "referenceChange") {
|
|
@@ -1504,18 +1486,19 @@ function reducer(state, action) {
|
|
|
1504
1486
|
location: eventLocation
|
|
1505
1487
|
};
|
|
1506
1488
|
newFormNodes.push(newFormNode);
|
|
1507
|
-
changeSets.push(
|
|
1508
|
-
path: pathToChange
|
|
1509
|
-
|
|
1489
|
+
changeSets.push({
|
|
1490
|
+
path: pathToChange,
|
|
1491
|
+
...buildChangeSet(event, newFormNode)
|
|
1492
|
+
});
|
|
1510
1493
|
}
|
|
1511
1494
|
subFormNodes.forEach((subFormNode) => {
|
|
1512
1495
|
if (matchLocation(eventLocation, subFormNode)) {
|
|
1513
1496
|
if (!action.value.form) {
|
|
1514
|
-
changeSets.push(
|
|
1515
|
-
path: pathToChange
|
|
1516
|
-
|
|
1497
|
+
changeSets.push({
|
|
1498
|
+
path: pathToChange,
|
|
1499
|
+
...buildChangeSet(event, subFormNode),
|
|
1517
1500
|
value: null
|
|
1518
|
-
})
|
|
1501
|
+
});
|
|
1519
1502
|
}
|
|
1520
1503
|
formNodesToReplace.push(subFormNode);
|
|
1521
1504
|
}
|
|
@@ -1527,15 +1510,17 @@ function reducer(state, action) {
|
|
|
1527
1510
|
if (event.mutationType.type === "insert") {
|
|
1528
1511
|
formNodes.forEach((subFormNode) => {
|
|
1529
1512
|
if (matchLocation(eventLocation, subFormNode)) {
|
|
1530
|
-
newFormNodes.push(
|
|
1513
|
+
newFormNodes.push({
|
|
1514
|
+
...subFormNode,
|
|
1531
1515
|
location: bumpLocation(subFormNode.location)
|
|
1532
|
-
})
|
|
1516
|
+
});
|
|
1533
1517
|
formNodesToReplace.push(subFormNode);
|
|
1534
1518
|
}
|
|
1535
1519
|
});
|
|
1536
|
-
changeSets.push(
|
|
1537
|
-
path: pathToChange
|
|
1538
|
-
|
|
1520
|
+
changeSets.push({
|
|
1521
|
+
path: pathToChange,
|
|
1522
|
+
...buildChangeSet(event, formNode)
|
|
1523
|
+
});
|
|
1539
1524
|
}
|
|
1540
1525
|
if (event.mutationType.type === "remove") {
|
|
1541
1526
|
const { at } = event.mutationType;
|
|
@@ -1544,19 +1529,20 @@ function reducer(state, action) {
|
|
|
1544
1529
|
if (matchesAt(subFormNode.location, at)) {
|
|
1545
1530
|
formNodesToRemove.push(subFormNode);
|
|
1546
1531
|
} else {
|
|
1547
|
-
newFormNodes.push(
|
|
1532
|
+
newFormNodes.push({
|
|
1533
|
+
...subFormNode,
|
|
1548
1534
|
location: maybeLowerLocation(subFormNode.location, at)
|
|
1549
|
-
})
|
|
1535
|
+
});
|
|
1550
1536
|
formNodesToReplace.push(subFormNode);
|
|
1551
1537
|
}
|
|
1552
1538
|
}
|
|
1553
1539
|
});
|
|
1554
1540
|
const next = existing.filter((_, index) => index !== at);
|
|
1555
|
-
changeSets.push(
|
|
1556
|
-
path: pathToChange
|
|
1557
|
-
|
|
1541
|
+
changeSets.push({
|
|
1542
|
+
path: pathToChange,
|
|
1543
|
+
...buildChangeSet(event, formNode),
|
|
1558
1544
|
value: next
|
|
1559
|
-
})
|
|
1545
|
+
});
|
|
1560
1546
|
}
|
|
1561
1547
|
if (event.mutationType.type === "move") {
|
|
1562
1548
|
const next = [];
|
|
@@ -1564,20 +1550,21 @@ function reducer(state, action) {
|
|
|
1564
1550
|
const newOrderObject = getMoveMapping(existing, from, to);
|
|
1565
1551
|
formNodes.forEach((subFormNode) => {
|
|
1566
1552
|
if (matchLocation(eventLocation, subFormNode)) {
|
|
1567
|
-
newFormNodes.push(
|
|
1553
|
+
newFormNodes.push({
|
|
1554
|
+
...subFormNode,
|
|
1568
1555
|
location: swapLocation(subFormNode.location, newOrderObject)
|
|
1569
|
-
})
|
|
1556
|
+
});
|
|
1570
1557
|
formNodesToReplace.push(subFormNode);
|
|
1571
1558
|
}
|
|
1572
1559
|
});
|
|
1573
1560
|
Object.values(newOrderObject).forEach((orderIndex, index) => {
|
|
1574
1561
|
next[orderIndex] = existing[index];
|
|
1575
1562
|
});
|
|
1576
|
-
changeSets.push(
|
|
1577
|
-
path: pathToChange
|
|
1578
|
-
|
|
1563
|
+
changeSets.push({
|
|
1564
|
+
path: pathToChange,
|
|
1565
|
+
...buildChangeSet(event, formNode),
|
|
1579
1566
|
value: next
|
|
1580
|
-
})
|
|
1567
|
+
});
|
|
1581
1568
|
}
|
|
1582
1569
|
});
|
|
1583
1570
|
}
|
|
@@ -1590,14 +1577,15 @@ function reducer(state, action) {
|
|
|
1590
1577
|
if ((_c = action.value) == null ? void 0 : _c.form) {
|
|
1591
1578
|
newDocumentForms.push((_d = action.value) == null ? void 0 : _d.form);
|
|
1592
1579
|
}
|
|
1593
|
-
return
|
|
1580
|
+
return {
|
|
1581
|
+
...state,
|
|
1594
1582
|
changeSets,
|
|
1595
1583
|
formNodes: [
|
|
1596
1584
|
...state.formNodes.filter((formNode) => formNodeNotIn(formNode, formNodesToReplace)).filter((formNode) => formNodeNotIn(formNode, formNodesToRemove)),
|
|
1597
1585
|
...newFormNodes
|
|
1598
1586
|
],
|
|
1599
1587
|
documentForms: [...existingDocumentForms, ...newDocumentForms]
|
|
1600
|
-
}
|
|
1588
|
+
};
|
|
1601
1589
|
}
|
|
1602
1590
|
case "formOnReset": {
|
|
1603
1591
|
const { event } = action.value;
|
|
@@ -1606,22 +1594,24 @@ function reducer(state, action) {
|
|
|
1606
1594
|
state.formNodes.filter((fn) => fn.documentFormId === (form == null ? void 0 : form.id)).forEach((formNode) => {
|
|
1607
1595
|
const blueprint = getFormNodeBlueprint(formNode, state);
|
|
1608
1596
|
if (blueprint.hasValuesField) {
|
|
1609
|
-
changeSets.push(
|
|
1610
|
-
path: [formNodePath(formNode), "_values"].join(".")
|
|
1611
|
-
|
|
1597
|
+
changeSets.push({
|
|
1598
|
+
path: [formNodePath(formNode), "_values"].join("."),
|
|
1599
|
+
...buildChangeSet(event, formNode)
|
|
1600
|
+
});
|
|
1612
1601
|
}
|
|
1613
|
-
changeSets.push(
|
|
1614
|
-
path: [formNodePath(formNode)].join(".")
|
|
1615
|
-
|
|
1602
|
+
changeSets.push({
|
|
1603
|
+
path: [formNodePath(formNode)].join("."),
|
|
1604
|
+
...buildChangeSet(event, formNode)
|
|
1605
|
+
});
|
|
1616
1606
|
});
|
|
1617
|
-
return
|
|
1607
|
+
return { ...state, changeSets };
|
|
1618
1608
|
}
|
|
1619
1609
|
case "ready":
|
|
1620
|
-
return
|
|
1610
|
+
return { ...state, status: "ready" };
|
|
1621
1611
|
case "done":
|
|
1622
|
-
return
|
|
1612
|
+
return { ...state, status: "done" };
|
|
1623
1613
|
case "setData":
|
|
1624
|
-
return
|
|
1614
|
+
return { ...state, data: action.value };
|
|
1625
1615
|
case "setIn": {
|
|
1626
1616
|
let newData;
|
|
1627
1617
|
if (action.value.displaceIndex) {
|
|
@@ -1634,10 +1624,11 @@ function reducer(state, action) {
|
|
|
1634
1624
|
newData = setIn(state.data, action.value.path, action.value.value);
|
|
1635
1625
|
}
|
|
1636
1626
|
const changeSets = state.changeSets.filter((cs) => cs.path !== action.value.path);
|
|
1637
|
-
return
|
|
1627
|
+
return {
|
|
1628
|
+
...state,
|
|
1638
1629
|
data: newData,
|
|
1639
1630
|
changeSets
|
|
1640
|
-
}
|
|
1631
|
+
};
|
|
1641
1632
|
}
|
|
1642
1633
|
default:
|
|
1643
1634
|
return state;
|
|
@@ -1662,8 +1653,8 @@ const useFormify = ({
|
|
|
1662
1653
|
formify: formifyFunc,
|
|
1663
1654
|
eventList
|
|
1664
1655
|
}) => {
|
|
1665
|
-
const formIds =
|
|
1666
|
-
const [state, dispatch] =
|
|
1656
|
+
const formIds = React.useRef([]);
|
|
1657
|
+
const [state, dispatch] = React.useReducer(reducer, {
|
|
1667
1658
|
status: "idle",
|
|
1668
1659
|
schema: void 0,
|
|
1669
1660
|
query: query ? G.parse(query) : null,
|
|
@@ -1675,7 +1666,7 @@ const useFormify = ({
|
|
|
1675
1666
|
formNodes: [],
|
|
1676
1667
|
documentForms: []
|
|
1677
1668
|
});
|
|
1678
|
-
|
|
1669
|
+
React.useEffect(() => {
|
|
1679
1670
|
if (query) {
|
|
1680
1671
|
dispatch({ type: "start", value: { query } });
|
|
1681
1672
|
formIds.current.forEach((formId) => {
|
|
@@ -1686,7 +1677,7 @@ const useFormify = ({
|
|
|
1686
1677
|
});
|
|
1687
1678
|
}
|
|
1688
1679
|
}, [query, JSON.stringify(variables)]);
|
|
1689
|
-
|
|
1680
|
+
React.useEffect(() => {
|
|
1690
1681
|
if (state.status === "initialized") {
|
|
1691
1682
|
cms.api.tina.request(query, { variables }).then((res) => {
|
|
1692
1683
|
delete res.paths;
|
|
@@ -1694,7 +1685,7 @@ const useFormify = ({
|
|
|
1694
1685
|
});
|
|
1695
1686
|
}
|
|
1696
1687
|
}, [state.status]);
|
|
1697
|
-
|
|
1688
|
+
React.useEffect(() => {
|
|
1698
1689
|
const run = async () => {
|
|
1699
1690
|
const schema = await cms.api.tina.getSchema();
|
|
1700
1691
|
const result = await formify({
|
|
@@ -1711,7 +1702,7 @@ const useFormify = ({
|
|
|
1711
1702
|
run();
|
|
1712
1703
|
}
|
|
1713
1704
|
}, [state.status]);
|
|
1714
|
-
|
|
1705
|
+
React.useEffect(() => {
|
|
1715
1706
|
const run = async () => {
|
|
1716
1707
|
const result = await cms.api.tina.request(G.print(state.query), {
|
|
1717
1708
|
variables
|
|
@@ -1763,7 +1754,7 @@ const useFormify = ({
|
|
|
1763
1754
|
run();
|
|
1764
1755
|
}
|
|
1765
1756
|
}, [state.status]);
|
|
1766
|
-
|
|
1757
|
+
React.useEffect(() => {
|
|
1767
1758
|
if (state.status === "ready") {
|
|
1768
1759
|
cms.events.subscribe(`forms:reset`, (event) => {
|
|
1769
1760
|
if (eventList) {
|
|
@@ -1804,9 +1795,10 @@ const useFormify = ({
|
|
|
1804
1795
|
dispatch({
|
|
1805
1796
|
type: "onFieldChange",
|
|
1806
1797
|
value: {
|
|
1807
|
-
event:
|
|
1798
|
+
event: {
|
|
1799
|
+
...event,
|
|
1808
1800
|
mutationType: { type: "referenceChange" }
|
|
1809
|
-
}
|
|
1801
|
+
},
|
|
1810
1802
|
form
|
|
1811
1803
|
}
|
|
1812
1804
|
});
|
|
@@ -1817,7 +1809,7 @@ const useFormify = ({
|
|
|
1817
1809
|
dispatch({ type: "done" });
|
|
1818
1810
|
}
|
|
1819
1811
|
}, [state.status]);
|
|
1820
|
-
|
|
1812
|
+
React.useEffect(() => {
|
|
1821
1813
|
state.changeSets.forEach((changeSet) => {
|
|
1822
1814
|
if (changeSet.mutationType.type === "reset") {
|
|
1823
1815
|
const form = cms.forms.find(changeSet.formId);
|
|
@@ -1854,21 +1846,24 @@ const useFormify = ({
|
|
|
1854
1846
|
}
|
|
1855
1847
|
dispatch({
|
|
1856
1848
|
type: "setIn",
|
|
1857
|
-
value:
|
|
1858
|
-
displaceIndex: true
|
|
1859
|
-
|
|
1860
|
-
value:
|
|
1861
|
-
|
|
1849
|
+
value: {
|
|
1850
|
+
displaceIndex: true,
|
|
1851
|
+
...changeSet,
|
|
1852
|
+
value: {
|
|
1853
|
+
...res,
|
|
1854
|
+
...extra
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1862
1857
|
});
|
|
1863
1858
|
});
|
|
1864
1859
|
} else {
|
|
1865
1860
|
dispatch({
|
|
1866
1861
|
type: "setIn",
|
|
1867
|
-
value:
|
|
1868
|
-
displaceIndex: true
|
|
1869
|
-
|
|
1862
|
+
value: {
|
|
1863
|
+
displaceIndex: true,
|
|
1864
|
+
...changeSet,
|
|
1870
1865
|
value: changeSet.value[0]
|
|
1871
|
-
}
|
|
1866
|
+
}
|
|
1872
1867
|
});
|
|
1873
1868
|
}
|
|
1874
1869
|
} else {
|
|
@@ -1878,9 +1873,10 @@ const useFormify = ({
|
|
|
1878
1873
|
if (!changeSet.value) {
|
|
1879
1874
|
dispatch({
|
|
1880
1875
|
type: "setIn",
|
|
1881
|
-
value:
|
|
1876
|
+
value: {
|
|
1877
|
+
...changeSet,
|
|
1882
1878
|
value: null
|
|
1883
|
-
}
|
|
1879
|
+
}
|
|
1884
1880
|
});
|
|
1885
1881
|
} else {
|
|
1886
1882
|
cms.api.tina.request(`
|
|
@@ -1898,9 +1894,13 @@ const useFormify = ({
|
|
|
1898
1894
|
});
|
|
1899
1895
|
dispatch({
|
|
1900
1896
|
type: "setIn",
|
|
1901
|
-
value:
|
|
1902
|
-
|
|
1903
|
-
|
|
1897
|
+
value: {
|
|
1898
|
+
...changeSet,
|
|
1899
|
+
value: {
|
|
1900
|
+
...res.node,
|
|
1901
|
+
...data
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
1904
|
});
|
|
1905
1905
|
}).catch((e) => {
|
|
1906
1906
|
cms.alerts.error(`Unexpected error fetching reference`);
|
|
@@ -1912,11 +1912,11 @@ const useFormify = ({
|
|
|
1912
1912
|
}
|
|
1913
1913
|
}
|
|
1914
1914
|
});
|
|
1915
|
-
}, [state.changeSets
|
|
1916
|
-
|
|
1915
|
+
}, [JSON.stringify(state.changeSets)]);
|
|
1916
|
+
React.useEffect(() => {
|
|
1917
1917
|
formIds.current = state.documentForms.map((df) => df.id);
|
|
1918
1918
|
}, [state.documentForms.length]);
|
|
1919
|
-
|
|
1919
|
+
React.useEffect(() => {
|
|
1920
1920
|
return () => {
|
|
1921
1921
|
formIds.current.forEach((formId) => {
|
|
1922
1922
|
const form = cms.forms.find(formId);
|
|
@@ -1926,7 +1926,7 @@ const useFormify = ({
|
|
|
1926
1926
|
});
|
|
1927
1927
|
};
|
|
1928
1928
|
}, []);
|
|
1929
|
-
const resolveSubFields =
|
|
1929
|
+
const resolveSubFields = React.useCallback(async (args) => {
|
|
1930
1930
|
const { form, formNode, prefix, loc } = args;
|
|
1931
1931
|
const data = {};
|
|
1932
1932
|
await sequential(form.fields, async (field) => {
|
|
@@ -1955,14 +1955,15 @@ const useFormify = ({
|
|
|
1955
1955
|
}
|
|
1956
1956
|
data[keyName] = await sequential(value, async (item, index) => {
|
|
1957
1957
|
const template = field.templates[item._template];
|
|
1958
|
-
return
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1958
|
+
return {
|
|
1959
|
+
...await resolveSubFields({
|
|
1960
|
+
formNode,
|
|
1961
|
+
form: { fields: template.fields, values: item },
|
|
1962
|
+
prefix: prefix ? [prefix, fieldName].join(".") : fieldName,
|
|
1963
|
+
loc: [...loc, index]
|
|
1964
|
+
}),
|
|
1964
1965
|
__typename: field.typeMap[item._template]
|
|
1965
|
-
}
|
|
1966
|
+
};
|
|
1966
1967
|
});
|
|
1967
1968
|
});
|
|
1968
1969
|
} else {
|
|
@@ -2059,11 +2060,14 @@ const useFormify = ({
|
|
|
2059
2060
|
}
|
|
2060
2061
|
}
|
|
2061
2062
|
`, { variables: { id: value } });
|
|
2062
|
-
data[keyName] =
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2063
|
+
data[keyName] = {
|
|
2064
|
+
...res.node,
|
|
2065
|
+
...await resolveSubFields({
|
|
2066
|
+
formNode: subDocumentFormNode,
|
|
2067
|
+
form: form2,
|
|
2068
|
+
loc: location
|
|
2069
|
+
})
|
|
2070
|
+
};
|
|
2067
2071
|
});
|
|
2068
2072
|
break;
|
|
2069
2073
|
default:
|
|
@@ -2081,9 +2085,10 @@ const useFormify = ({
|
|
|
2081
2085
|
});
|
|
2082
2086
|
return data;
|
|
2083
2087
|
}, [cms, JSON.stringify(state), dispatch]);
|
|
2084
|
-
return
|
|
2088
|
+
return {
|
|
2089
|
+
...state,
|
|
2085
2090
|
queryString: G.print(state.query)
|
|
2086
|
-
}
|
|
2091
|
+
};
|
|
2087
2092
|
};
|
|
2088
2093
|
const buildFormNode = (documentBlueprint, form, location) => {
|
|
2089
2094
|
return {
|
|
@@ -2098,8 +2103,7 @@ const parseRefForBranchName = (ref) => {
|
|
|
2098
2103
|
return matches[1];
|
|
2099
2104
|
};
|
|
2100
2105
|
class Client {
|
|
2101
|
-
constructor(
|
|
2102
|
-
var _b = _a, { tokenStorage = "MEMORY" } = _b, options = __objRest(_b, ["tokenStorage"]);
|
|
2106
|
+
constructor({ tokenStorage = "MEMORY", ...options }) {
|
|
2103
2107
|
this.events = new EventBus();
|
|
2104
2108
|
this.addPendingContent = async (props) => {
|
|
2105
2109
|
const mutation = `#graphql
|
|
@@ -2148,10 +2152,11 @@ mutation addPendingDocumentMutation(
|
|
|
2148
2152
|
return parse(data.getOptimizedQuery);
|
|
2149
2153
|
};
|
|
2150
2154
|
if (options.schema) {
|
|
2151
|
-
const enrichedSchema = new TinaSchema(
|
|
2155
|
+
const enrichedSchema = new TinaSchema({
|
|
2152
2156
|
version: { fullVersion: "", major: "", minor: "", patch: "" },
|
|
2153
|
-
meta: { flags: [] }
|
|
2154
|
-
|
|
2157
|
+
meta: { flags: [] },
|
|
2158
|
+
...addNamespaceToSchema({ ...options.schema }, [])
|
|
2159
|
+
});
|
|
2155
2160
|
this.schema = enrichedSchema;
|
|
2156
2161
|
}
|
|
2157
2162
|
this.options = options;
|
|
@@ -2208,6 +2213,7 @@ mutation addPendingDocumentMutation(
|
|
|
2208
2213
|
setBranch(branchName) {
|
|
2209
2214
|
var _a, _b, _c, _d;
|
|
2210
2215
|
const encodedBranch = encodeURIComponent(branchName);
|
|
2216
|
+
this.branch = encodedBranch;
|
|
2211
2217
|
this.assetsApiUrl = ((_a = this.options.tinaioConfig) == null ? void 0 : _a.assetsApiUrlOverride) || "https://assets.tinajs.io";
|
|
2212
2218
|
this.frontendUrl = ((_b = this.options.tinaioConfig) == null ? void 0 : _b.frontendUrlOverride) || "https://app.tina.io";
|
|
2213
2219
|
this.identityApiUrl = ((_c = this.options.tinaioConfig) == null ? void 0 : _c.identityApiUrlOverride) || "https://identity.tinajs.io";
|
|
@@ -2245,7 +2251,12 @@ mutation addPendingDocumentMutation(
|
|
|
2245
2251
|
})
|
|
2246
2252
|
});
|
|
2247
2253
|
if (res.status !== 200) {
|
|
2248
|
-
|
|
2254
|
+
let errorMessage = `Unable to complete request, ${res.statusText}`;
|
|
2255
|
+
const resBody = await res.json();
|
|
2256
|
+
if (resBody.message) {
|
|
2257
|
+
errorMessage = `${errorMessage}, Response: ${resBody.message}`;
|
|
2258
|
+
}
|
|
2259
|
+
throw new Error(errorMessage);
|
|
2249
2260
|
}
|
|
2250
2261
|
const json = await res.json();
|
|
2251
2262
|
if (json.errors) {
|
|
@@ -2254,6 +2265,24 @@ mutation addPendingDocumentMutation(
|
|
|
2254
2265
|
}
|
|
2255
2266
|
return json.data;
|
|
2256
2267
|
}
|
|
2268
|
+
async syncTinaMedia() {
|
|
2269
|
+
const res = await this.fetchWithToken(`${this.contentApiBase}/assets/${this.clientId}/sync/${this.branch}`, { method: "POST" });
|
|
2270
|
+
const jsonRes = await res.json();
|
|
2271
|
+
return jsonRes;
|
|
2272
|
+
}
|
|
2273
|
+
async checkSyncStatus({
|
|
2274
|
+
assetsSyncing
|
|
2275
|
+
}) {
|
|
2276
|
+
const res = await this.fetchWithToken(`${this.assetsApiUrl}/v1/${this.clientId}/syncStatus`, {
|
|
2277
|
+
method: "POST",
|
|
2278
|
+
headers: {
|
|
2279
|
+
"Content-Type": "application/json"
|
|
2280
|
+
},
|
|
2281
|
+
body: JSON.stringify({ assetsSyncing })
|
|
2282
|
+
});
|
|
2283
|
+
const jsonRes = await res.json();
|
|
2284
|
+
return jsonRes;
|
|
2285
|
+
}
|
|
2257
2286
|
parseJwt(token) {
|
|
2258
2287
|
const base64Url = token.split(".")[1];
|
|
2259
2288
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
@@ -2308,11 +2337,13 @@ mutation addPendingDocumentMutation(
|
|
|
2308
2337
|
}
|
|
2309
2338
|
async fetchWithToken(input, init) {
|
|
2310
2339
|
const headers = (init == null ? void 0 : init.headers) || {};
|
|
2311
|
-
return await fetch(input,
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2340
|
+
return await fetch(input, {
|
|
2341
|
+
...init,
|
|
2342
|
+
headers: new Headers({
|
|
2343
|
+
Authorization: "Bearer " + (await this.getToken()).id_token,
|
|
2344
|
+
...headers
|
|
2345
|
+
})
|
|
2346
|
+
});
|
|
2316
2347
|
}
|
|
2317
2348
|
async getUser() {
|
|
2318
2349
|
if (!this.clientId) {
|
|
@@ -2364,11 +2395,12 @@ mutation addPendingDocumentMutation(
|
|
|
2364
2395
|
const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
|
|
2365
2396
|
class LocalClient extends Client {
|
|
2366
2397
|
constructor(props) {
|
|
2367
|
-
const clientProps =
|
|
2398
|
+
const clientProps = {
|
|
2399
|
+
...props,
|
|
2368
2400
|
clientId: "",
|
|
2369
2401
|
branch: "",
|
|
2370
2402
|
customContentApiUrl: props && props.customContentApiUrl ? props.customContentApiUrl : DEFAULT_LOCAL_TINA_GQL_SERVER_URL
|
|
2371
|
-
}
|
|
2403
|
+
};
|
|
2372
2404
|
super(clientProps);
|
|
2373
2405
|
}
|
|
2374
2406
|
async isAuthorized() {
|
|
@@ -2379,11 +2411,12 @@ class LocalClient extends Client {
|
|
|
2379
2411
|
}
|
|
2380
2412
|
}
|
|
2381
2413
|
function ModalBuilder(modalProps) {
|
|
2382
|
-
return /* @__PURE__ */
|
|
2414
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(ModalPopup, null, /* @__PURE__ */ React.createElement(ModalHeader, null, modalProps.title), /* @__PURE__ */ React.createElement(ModalBody, {
|
|
2383
2415
|
padded: true
|
|
2384
|
-
}, /* @__PURE__ */
|
|
2385
|
-
key: action.name
|
|
2386
|
-
|
|
2416
|
+
}, /* @__PURE__ */ React.createElement("p", null, modalProps.message), modalProps.error && /* @__PURE__ */ React.createElement(ErrorLabel, null, modalProps.error)), /* @__PURE__ */ React.createElement(ModalActions, null, modalProps.actions.map((action) => /* @__PURE__ */ React.createElement(AsyncButton, {
|
|
2417
|
+
key: action.name,
|
|
2418
|
+
...action
|
|
2419
|
+
})))));
|
|
2387
2420
|
}
|
|
2388
2421
|
const ErrorLabel = styled.p`
|
|
2389
2422
|
color: var(--tina-color-error) !important;
|
|
@@ -2400,12 +2433,12 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
2400
2433
|
throw e;
|
|
2401
2434
|
}
|
|
2402
2435
|
}, [action, setSubmitting]);
|
|
2403
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
2404
2437
|
variant: primary ? "primary" : "secondary",
|
|
2405
2438
|
onClick,
|
|
2406
2439
|
busy: submitting,
|
|
2407
2440
|
disabled: submitting
|
|
2408
|
-
}, submitting && /* @__PURE__ */
|
|
2441
|
+
}, submitting && /* @__PURE__ */ React.createElement(LoadingDots, null), !submitting && name);
|
|
2409
2442
|
};
|
|
2410
2443
|
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
2411
2444
|
const useTinaAuthRedirect = () => {
|
|
@@ -2596,7 +2629,7 @@ const AuthWallInner = ({
|
|
|
2596
2629
|
const client = cms.api.tina;
|
|
2597
2630
|
const [activeModal, setActiveModal] = useState(null);
|
|
2598
2631
|
const [showChildren, setShowChildren] = useState(false);
|
|
2599
|
-
|
|
2632
|
+
React.useEffect(() => {
|
|
2600
2633
|
client.isAuthenticated().then((isAuthenticated) => {
|
|
2601
2634
|
if (isAuthenticated) {
|
|
2602
2635
|
setShowChildren(true);
|
|
@@ -2621,7 +2654,7 @@ const AuthWallInner = ({
|
|
|
2621
2654
|
setActiveModal(null);
|
|
2622
2655
|
}
|
|
2623
2656
|
}) : [];
|
|
2624
|
-
return /* @__PURE__ */
|
|
2657
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React.createElement(ModalBuilder, {
|
|
2625
2658
|
title: "Tina Cloud Authorization",
|
|
2626
2659
|
message: "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account.",
|
|
2627
2660
|
close,
|
|
@@ -2650,12 +2683,12 @@ const TinaCloudProvider = (props) => {
|
|
|
2650
2683
|
const baseBranch = props.branch || "main";
|
|
2651
2684
|
const [currentBranch, setCurrentBranch] = useLocalStorage("tinacms-current-branch", baseBranch);
|
|
2652
2685
|
useTinaAuthRedirect();
|
|
2653
|
-
const cms =
|
|
2686
|
+
const cms = React.useMemo(() => props.cms || new TinaCMS({
|
|
2654
2687
|
enabled: true,
|
|
2655
2688
|
sidebar: true
|
|
2656
2689
|
}), [props.cms]);
|
|
2657
2690
|
if (!cms.api.tina) {
|
|
2658
|
-
cms.registerApi("tina", createClient(
|
|
2691
|
+
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
2659
2692
|
} else {
|
|
2660
2693
|
cms.api.tina.setBranch(currentBranch);
|
|
2661
2694
|
}
|
|
@@ -2663,20 +2696,20 @@ const TinaCloudProvider = (props) => {
|
|
|
2663
2696
|
cms.registerApi("admin", new TinaAdminApi(cms));
|
|
2664
2697
|
}
|
|
2665
2698
|
const setupMedia = async () => {
|
|
2666
|
-
var _a, _b, _c;
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2699
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2700
|
+
const hasTinaMedia = Boolean((_b = (_a = props.schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina);
|
|
2701
|
+
if (hasTinaMedia) {
|
|
2702
|
+
cms.media.store = new TinaMediaStore(cms);
|
|
2703
|
+
} else if (((_d = (_c = props.schema.config) == null ? void 0 : _c.media) == null ? void 0 : _d.loadCustomStore) || props.mediaStore) {
|
|
2704
|
+
const mediaStoreFromProps = ((_f = (_e = props.schema.config) == null ? void 0 : _e.media) == null ? void 0 : _f.loadCustomStore) || props.mediaStore;
|
|
2705
|
+
if ((_g = mediaStoreFromProps.prototype) == null ? void 0 : _g.persist) {
|
|
2706
|
+
cms.media.store = new mediaStoreFromProps(cms.api.tina);
|
|
2670
2707
|
} else {
|
|
2671
|
-
const MediaClass = await
|
|
2708
|
+
const MediaClass = await mediaStoreFromProps();
|
|
2672
2709
|
cms.media.store = new MediaClass(cms.api.tina);
|
|
2673
2710
|
}
|
|
2674
2711
|
} else {
|
|
2675
|
-
|
|
2676
|
-
cms.media.store = new TinaMediaStore(cms);
|
|
2677
|
-
} else {
|
|
2678
|
-
cms.media.store = new DummyMediaStore();
|
|
2679
|
-
}
|
|
2712
|
+
cms.media.store = new DummyMediaStore();
|
|
2680
2713
|
}
|
|
2681
2714
|
};
|
|
2682
2715
|
const handleListBranches = async () => {
|
|
@@ -2692,15 +2725,15 @@ const TinaCloudProvider = (props) => {
|
|
|
2692
2725
|
return newBranch;
|
|
2693
2726
|
};
|
|
2694
2727
|
setupMedia();
|
|
2695
|
-
const [branchingEnabled, setBranchingEnabled] =
|
|
2696
|
-
|
|
2728
|
+
const [branchingEnabled, setBranchingEnabled] = React.useState(() => cms.flags.get("branch-switcher"));
|
|
2729
|
+
React.useEffect(() => {
|
|
2697
2730
|
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
2698
2731
|
if (key === "branch-switcher") {
|
|
2699
2732
|
setBranchingEnabled(value);
|
|
2700
2733
|
}
|
|
2701
2734
|
});
|
|
2702
2735
|
}, [cms.events]);
|
|
2703
|
-
|
|
2736
|
+
React.useEffect(() => {
|
|
2704
2737
|
let branchSwitcher;
|
|
2705
2738
|
if (branchingEnabled) {
|
|
2706
2739
|
branchSwitcher = new BranchSwitcherPlugin({
|
|
@@ -2715,24 +2748,25 @@ const TinaCloudProvider = (props) => {
|
|
|
2715
2748
|
}
|
|
2716
2749
|
};
|
|
2717
2750
|
}, [branchingEnabled, props.branch]);
|
|
2718
|
-
|
|
2751
|
+
React.useEffect(() => {
|
|
2719
2752
|
if (props.cmsCallback) {
|
|
2720
2753
|
props.cmsCallback(cms);
|
|
2721
2754
|
}
|
|
2722
2755
|
}, []);
|
|
2723
|
-
return /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ React.createElement(BranchDataProvider, {
|
|
2724
2757
|
currentBranch,
|
|
2725
2758
|
setCurrentBranch: (b) => {
|
|
2726
2759
|
setCurrentBranch(b);
|
|
2727
2760
|
}
|
|
2728
|
-
}, /* @__PURE__ */
|
|
2761
|
+
}, /* @__PURE__ */ React.createElement(TinaProvider, {
|
|
2729
2762
|
cms
|
|
2730
|
-
}, /* @__PURE__ */
|
|
2763
|
+
}, /* @__PURE__ */ React.createElement(AuthWallInner, {
|
|
2764
|
+
...props,
|
|
2731
2765
|
cms
|
|
2732
|
-
})))
|
|
2766
|
+
})));
|
|
2733
2767
|
};
|
|
2734
2768
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2735
|
-
var styles = `.tina-tailwind {
|
|
2769
|
+
var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
2736
2770
|
line-height: 1.5;
|
|
2737
2771
|
-webkit-text-size-adjust: 100%;
|
|
2738
2772
|
-moz-tab-size: 4;
|
|
@@ -2957,6 +2991,54 @@ var styles = `.tina-tailwind {
|
|
|
2957
2991
|
display: none;
|
|
2958
2992
|
}
|
|
2959
2993
|
*, ::before, ::after {
|
|
2994
|
+
--tw-border-spacing-x: 0;
|
|
2995
|
+
--tw-border-spacing-y: 0;
|
|
2996
|
+
--tw-translate-x: 0;
|
|
2997
|
+
--tw-translate-y: 0;
|
|
2998
|
+
--tw-rotate: 0;
|
|
2999
|
+
--tw-skew-x: 0;
|
|
3000
|
+
--tw-skew-y: 0;
|
|
3001
|
+
--tw-scale-x: 1;
|
|
3002
|
+
--tw-scale-y: 1;
|
|
3003
|
+
--tw-pan-x: ;
|
|
3004
|
+
--tw-pan-y: ;
|
|
3005
|
+
--tw-pinch-zoom: ;
|
|
3006
|
+
--tw-scroll-snap-strictness: proximity;
|
|
3007
|
+
--tw-ordinal: ;
|
|
3008
|
+
--tw-slashed-zero: ;
|
|
3009
|
+
--tw-numeric-figure: ;
|
|
3010
|
+
--tw-numeric-spacing: ;
|
|
3011
|
+
--tw-numeric-fraction: ;
|
|
3012
|
+
--tw-ring-inset: ;
|
|
3013
|
+
--tw-ring-offset-width: 0px;
|
|
3014
|
+
--tw-ring-offset-color: #fff;
|
|
3015
|
+
--tw-ring-color: rgb(0 132 255 / 0.5);
|
|
3016
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
3017
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
3018
|
+
--tw-shadow: 0 0 #0000;
|
|
3019
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
3020
|
+
--tw-blur: ;
|
|
3021
|
+
--tw-brightness: ;
|
|
3022
|
+
--tw-contrast: ;
|
|
3023
|
+
--tw-grayscale: ;
|
|
3024
|
+
--tw-hue-rotate: ;
|
|
3025
|
+
--tw-invert: ;
|
|
3026
|
+
--tw-saturate: ;
|
|
3027
|
+
--tw-sepia: ;
|
|
3028
|
+
--tw-drop-shadow: ;
|
|
3029
|
+
--tw-backdrop-blur: ;
|
|
3030
|
+
--tw-backdrop-brightness: ;
|
|
3031
|
+
--tw-backdrop-contrast: ;
|
|
3032
|
+
--tw-backdrop-grayscale: ;
|
|
3033
|
+
--tw-backdrop-hue-rotate: ;
|
|
3034
|
+
--tw-backdrop-invert: ;
|
|
3035
|
+
--tw-backdrop-opacity: ;
|
|
3036
|
+
--tw-backdrop-saturate: ;
|
|
3037
|
+
--tw-backdrop-sepia: ;
|
|
3038
|
+
}
|
|
3039
|
+
::backdrop {
|
|
3040
|
+
--tw-border-spacing-x: 0;
|
|
3041
|
+
--tw-border-spacing-y: 0;
|
|
2960
3042
|
--tw-translate-x: 0;
|
|
2961
3043
|
--tw-translate-y: 0;
|
|
2962
3044
|
--tw-rotate: 0;
|
|
@@ -3301,14 +3383,17 @@ var styles = `.tina-tailwind {
|
|
|
3301
3383
|
}
|
|
3302
3384
|
.tina-tailwind .from-blue-900 {
|
|
3303
3385
|
--tw-gradient-from: #1D2C6C;
|
|
3304
|
-
--tw-gradient-
|
|
3386
|
+
--tw-gradient-to: rgb(29 44 108 / 0);
|
|
3387
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3305
3388
|
}
|
|
3306
3389
|
.tina-tailwind .from-gray-800 {
|
|
3307
3390
|
--tw-gradient-from: #363145;
|
|
3308
|
-
--tw-gradient-
|
|
3391
|
+
--tw-gradient-to: rgb(54 49 69 / 0);
|
|
3392
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3309
3393
|
}
|
|
3310
3394
|
.tina-tailwind .via-gray-900 {
|
|
3311
|
-
--tw-gradient-
|
|
3395
|
+
--tw-gradient-to: rgb(37 35 54 / 0);
|
|
3396
|
+
--tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to);
|
|
3312
3397
|
}
|
|
3313
3398
|
.tina-tailwind .to-gray-900 {
|
|
3314
3399
|
--tw-gradient-to: #252336;
|
|
@@ -3610,7 +3695,7 @@ var styles = `.tina-tailwind {
|
|
|
3610
3695
|
--tw-ring-opacity: 1;
|
|
3611
3696
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3612
3697
|
}
|
|
3613
|
-
|
|
3698
|
+
`)();
|
|
3614
3699
|
class ContentCreatorPlugin {
|
|
3615
3700
|
constructor(options) {
|
|
3616
3701
|
this.__type = "content-creator";
|
|
@@ -3659,9 +3744,9 @@ class ContentCreatorPlugin {
|
|
|
3659
3744
|
}
|
|
3660
3745
|
const useDocumentCreatorPlugin = (args) => {
|
|
3661
3746
|
const cms = useCMS();
|
|
3662
|
-
const [values, setValues] =
|
|
3663
|
-
const [plugin, setPlugin] =
|
|
3664
|
-
|
|
3747
|
+
const [values, setValues] = React.useState({});
|
|
3748
|
+
const [plugin, setPlugin] = React.useState(null);
|
|
3749
|
+
React.useEffect(() => {
|
|
3665
3750
|
const run = async () => {
|
|
3666
3751
|
var _a;
|
|
3667
3752
|
const res = await cms.api.tina.request((gql2) => gql2`
|
|
@@ -3762,7 +3847,7 @@ const useDocumentCreatorPlugin = (args) => {
|
|
|
3762
3847
|
};
|
|
3763
3848
|
run();
|
|
3764
3849
|
}, [cms]);
|
|
3765
|
-
|
|
3850
|
+
React.useEffect(() => {
|
|
3766
3851
|
if (plugin) {
|
|
3767
3852
|
cms.plugins.add(plugin);
|
|
3768
3853
|
}
|
|
@@ -3783,10 +3868,10 @@ function useTina({
|
|
|
3783
3868
|
state,
|
|
3784
3869
|
isDummyContainer,
|
|
3785
3870
|
isLoading: contextLoading
|
|
3786
|
-
} =
|
|
3871
|
+
} = React.useContext(TinaDataContext);
|
|
3787
3872
|
const [waitForContextRerender, setWaitForContextRerender] = useState(!isDummyContainer);
|
|
3788
3873
|
const isLoading = contextLoading || waitForContextRerender;
|
|
3789
|
-
|
|
3874
|
+
React.useEffect(() => {
|
|
3790
3875
|
setRequest({ query, variables });
|
|
3791
3876
|
}, [JSON.stringify(variables), query]);
|
|
3792
3877
|
useEffect(() => {
|
|
@@ -3838,7 +3923,7 @@ const errorButtonStyles = {
|
|
|
3838
3923
|
color: "white",
|
|
3839
3924
|
margin: "1rem 0"
|
|
3840
3925
|
};
|
|
3841
|
-
class ErrorBoundary extends
|
|
3926
|
+
class ErrorBoundary extends React.Component {
|
|
3842
3927
|
constructor(props) {
|
|
3843
3928
|
super(props);
|
|
3844
3929
|
this.state = {
|
|
@@ -3854,7 +3939,7 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3854
3939
|
const branchData = window.localStorage && window.localStorage.getItem("tinacms-current-branch");
|
|
3855
3940
|
const hasBranchData = branchData && branchData.length > 0;
|
|
3856
3941
|
if (this.state.hasError && !this.state.pageRefresh) {
|
|
3857
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3858
3943
|
style: {
|
|
3859
3944
|
background: "#efefef",
|
|
3860
3945
|
height: "100vh",
|
|
@@ -3862,7 +3947,7 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3862
3947
|
alignItems: "center",
|
|
3863
3948
|
justifyContent: "center"
|
|
3864
3949
|
}
|
|
3865
|
-
}, /* @__PURE__ */
|
|
3950
|
+
}, /* @__PURE__ */ React.createElement("style", null, " body { margin: 0; } "), /* @__PURE__ */ React.createElement("div", {
|
|
3866
3951
|
style: {
|
|
3867
3952
|
background: "#fff",
|
|
3868
3953
|
maxWidth: "400px",
|
|
@@ -3871,27 +3956,27 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3871
3956
|
borderRadius: "5px",
|
|
3872
3957
|
boxShadow: "0 6px 24px rgb(0 37 91 / 5%), 0 2px 4px rgb(0 37 91 / 3%)"
|
|
3873
3958
|
}
|
|
3874
|
-
}, /* @__PURE__ */
|
|
3959
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
3875
3960
|
style: { color: "#eb6337" }
|
|
3876
|
-
}, "TinaCMS Render Error"), /* @__PURE__ */
|
|
3961
|
+
}, "TinaCMS Render Error"), /* @__PURE__ */ React.createElement("p", null, "Tina caught an error while updating the page:"), /* @__PURE__ */ React.createElement("pre", {
|
|
3877
3962
|
style: { marginTop: "1rem", overflowX: "auto" }
|
|
3878
|
-
}, this.state.message), /* @__PURE__ */
|
|
3963
|
+
}, this.state.message), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("p", null, `If you've just updated the form, undo your most recent changes and click "refresh". If after a few refreshes, you're still encountering this error. There is a bigger issue with the site. Please reach out to your site admin.`), /* @__PURE__ */ React.createElement("p", null, "See our", " ", /* @__PURE__ */ React.createElement("a", {
|
|
3879
3964
|
className: "text-gray-600",
|
|
3880
3965
|
style: { textDecoration: "underline" },
|
|
3881
3966
|
href: "https://tina.io/docs/errors/faq/",
|
|
3882
3967
|
target: "_blank"
|
|
3883
|
-
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */
|
|
3968
|
+
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */ React.createElement("button", {
|
|
3884
3969
|
style: errorButtonStyles,
|
|
3885
3970
|
onClick: () => {
|
|
3886
3971
|
this.setState({ pageRefresh: true });
|
|
3887
3972
|
setTimeout(() => this.setState({ hasError: false, pageRefresh: false }), 3e3);
|
|
3888
3973
|
}
|
|
3889
|
-
}, "Refresh"), hasBranchData && /* @__PURE__ */
|
|
3974
|
+
}, "Refresh"), hasBranchData && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, `If you're using the branch switcher, you may currently be on a "stale" branch that has been deleted or whose content is not compatible with the latest version of the site's layout. Click the button below to switch back to the default branch for this deployment.`), /* @__PURE__ */ React.createElement("p", null, "See our", " ", /* @__PURE__ */ React.createElement("a", {
|
|
3890
3975
|
className: "text-gray-600",
|
|
3891
3976
|
style: { textDecoration: "underline" },
|
|
3892
3977
|
href: "https://tina.io/docs/errors/faq/",
|
|
3893
3978
|
target: "_blank"
|
|
3894
|
-
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */
|
|
3979
|
+
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */ React.createElement("button", {
|
|
3895
3980
|
style: errorButtonStyles,
|
|
3896
3981
|
onClick: () => {
|
|
3897
3982
|
window.localStorage.removeItem("tinacms-current-branch");
|
|
@@ -3900,23 +3985,18 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3900
3985
|
}, "Switch to default branch"))));
|
|
3901
3986
|
}
|
|
3902
3987
|
if (this.state.pageRefresh) {
|
|
3903
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ React.createElement(Loader, null, "Let's try that again.");
|
|
3904
3989
|
}
|
|
3905
3990
|
return this.props.children;
|
|
3906
3991
|
}
|
|
3907
3992
|
}
|
|
3908
|
-
const TinaCMSProvider2 = (
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
"query",
|
|
3916
|
-
"documentCreatorCallback",
|
|
3917
|
-
"formifyCallback",
|
|
3918
|
-
"schema"
|
|
3919
|
-
]);
|
|
3993
|
+
const TinaCMSProvider2 = ({
|
|
3994
|
+
query,
|
|
3995
|
+
documentCreatorCallback,
|
|
3996
|
+
formifyCallback,
|
|
3997
|
+
schema,
|
|
3998
|
+
...props
|
|
3999
|
+
}) => {
|
|
3920
4000
|
var _a;
|
|
3921
4001
|
const validOldSetup = new Boolean(props == null ? void 0 : props.isLocalClient) || new Boolean(props == null ? void 0 : props.clientId) && new Boolean(props == null ? void 0 : props.branch);
|
|
3922
4002
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
@@ -3931,7 +4011,7 @@ const TinaCMSProvider2 = (_c) => {
|
|
|
3931
4011
|
if (!schema) {
|
|
3932
4012
|
throw new Error("`schema` is required to be passed as a property to `TinaProvider`. You can learn more about this change here: https://github.com/tinacms/tinacms/pull/2823");
|
|
3933
4013
|
}
|
|
3934
|
-
return /* @__PURE__ */
|
|
4014
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TinaCloudProvider, {
|
|
3935
4015
|
branch,
|
|
3936
4016
|
clientId,
|
|
3937
4017
|
tinaioConfig: props.tinaioConfig,
|
|
@@ -3939,17 +4019,18 @@ const TinaCMSProvider2 = (_c) => {
|
|
|
3939
4019
|
cmsCallback: props.cmsCallback,
|
|
3940
4020
|
mediaStore: props.mediaStore,
|
|
3941
4021
|
schema
|
|
3942
|
-
}, /* @__PURE__ */
|
|
4022
|
+
}, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(DocumentCreator, {
|
|
3943
4023
|
documentCreatorCallback
|
|
3944
|
-
}), /* @__PURE__ */
|
|
4024
|
+
}), /* @__PURE__ */ React.createElement(TinaDataProvider, {
|
|
3945
4025
|
formifyCallback
|
|
3946
|
-
}, typeof props.children == "function" ? /* @__PURE__ */
|
|
4026
|
+
}, typeof props.children == "function" ? /* @__PURE__ */ React.createElement(TinaQuery, {
|
|
4027
|
+
...props,
|
|
3947
4028
|
variables: props.variables,
|
|
3948
4029
|
data: props.data,
|
|
3949
4030
|
query,
|
|
3950
4031
|
formifyCallback,
|
|
3951
4032
|
children: props.children
|
|
3952
|
-
})
|
|
4033
|
+
}) : props.children))));
|
|
3953
4034
|
};
|
|
3954
4035
|
const DocumentCreator = ({
|
|
3955
4036
|
documentCreatorCallback
|
|
@@ -3958,35 +4039,35 @@ const DocumentCreator = ({
|
|
|
3958
4039
|
return null;
|
|
3959
4040
|
};
|
|
3960
4041
|
const TinaQuery = (props) => {
|
|
3961
|
-
return /* @__PURE__ */
|
|
3962
|
-
key: `rootQuery-${props.query}
|
|
3963
|
-
|
|
4042
|
+
return /* @__PURE__ */ React.createElement(TinaQueryInner, {
|
|
4043
|
+
key: `rootQuery-${props.query}`,
|
|
4044
|
+
...props
|
|
4045
|
+
});
|
|
3964
4046
|
};
|
|
3965
|
-
const TinaQueryInner = (
|
|
3966
|
-
var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
|
|
4047
|
+
const TinaQueryInner = ({ children, ...props }) => {
|
|
3967
4048
|
const { data: liveData, isLoading } = useTina({
|
|
3968
4049
|
query: props.query,
|
|
3969
4050
|
variables: props.variables,
|
|
3970
4051
|
data: props.data
|
|
3971
4052
|
});
|
|
3972
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(isLoading || !props.query ? props : { ...props, data: liveData }));
|
|
3973
4054
|
};
|
|
3974
4055
|
const TinaDataProvider = ({
|
|
3975
4056
|
children,
|
|
3976
4057
|
formifyCallback
|
|
3977
4058
|
}) => {
|
|
3978
4059
|
const [request, setRequest] = useState();
|
|
3979
|
-
const [state, setState] =
|
|
4060
|
+
const [state, setState] = React.useState({
|
|
3980
4061
|
payload: void 0,
|
|
3981
4062
|
isLoading: true
|
|
3982
4063
|
});
|
|
3983
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ React.createElement(TinaDataContext.Provider, {
|
|
3984
4065
|
value: {
|
|
3985
4066
|
setRequest,
|
|
3986
4067
|
isLoading: state.isLoading,
|
|
3987
4068
|
state: { payload: state.payload }
|
|
3988
4069
|
}
|
|
3989
|
-
}, /* @__PURE__ */
|
|
4070
|
+
}, /* @__PURE__ */ React.createElement(FormRegistrar, {
|
|
3990
4071
|
key: request == null ? void 0 : request.query,
|
|
3991
4072
|
request,
|
|
3992
4073
|
formifyCallback,
|
|
@@ -4010,13 +4091,13 @@ const FormRegistrar = ({
|
|
|
4010
4091
|
}
|
|
4011
4092
|
}
|
|
4012
4093
|
});
|
|
4013
|
-
|
|
4094
|
+
React.useEffect(() => {
|
|
4014
4095
|
onPayloadStateChange({ payload, isLoading });
|
|
4015
4096
|
}, [JSON.stringify(payload), isLoading]);
|
|
4016
|
-
return isLoading ? /* @__PURE__ */
|
|
4097
|
+
return isLoading ? /* @__PURE__ */ React.createElement(Loader, null, /* @__PURE__ */ React.createElement(React.Fragment, null)) : null;
|
|
4017
4098
|
};
|
|
4018
4099
|
const Loader = (props) => {
|
|
4019
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4020
4101
|
style: {
|
|
4021
4102
|
position: "fixed",
|
|
4022
4103
|
background: "rgba(0, 0, 0, 0.5)",
|
|
@@ -4028,7 +4109,7 @@ const Loader = (props) => {
|
|
|
4028
4109
|
justifyContent: "center",
|
|
4029
4110
|
padding: "40px"
|
|
4030
4111
|
}
|
|
4031
|
-
}, /* @__PURE__ */
|
|
4112
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4032
4113
|
style: {
|
|
4033
4114
|
background: "#f6f6f9",
|
|
4034
4115
|
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
@@ -4041,7 +4122,7 @@ const Loader = (props) => {
|
|
|
4041
4122
|
justifyContent: "center",
|
|
4042
4123
|
flexDirection: "column"
|
|
4043
4124
|
}
|
|
4044
|
-
}, /* @__PURE__ */
|
|
4125
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4045
4126
|
style: {
|
|
4046
4127
|
width: "64px",
|
|
4047
4128
|
color: "#2296fe",
|
|
@@ -4057,13 +4138,13 @@ const Loader = (props) => {
|
|
|
4057
4138
|
viewBox: "0 0 100 64",
|
|
4058
4139
|
enableBackground: "new 0 0 0 0",
|
|
4059
4140
|
xmlSpace: "preserve"
|
|
4060
|
-
}, /* @__PURE__ */
|
|
4141
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4061
4142
|
fill: "currentColor",
|
|
4062
4143
|
stroke: "none",
|
|
4063
4144
|
cx: 6,
|
|
4064
4145
|
cy: 32,
|
|
4065
4146
|
r: 6
|
|
4066
|
-
}, /* @__PURE__ */
|
|
4147
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4067
4148
|
attributeName: "transform",
|
|
4068
4149
|
dur: "1s",
|
|
4069
4150
|
type: "translate",
|
|
@@ -4072,13 +4153,13 @@ const Loader = (props) => {
|
|
|
4072
4153
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4073
4154
|
repeatCount: "indefinite",
|
|
4074
4155
|
begin: "0.1"
|
|
4075
|
-
})), /* @__PURE__ */
|
|
4156
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4076
4157
|
fill: "currentColor",
|
|
4077
4158
|
stroke: "none",
|
|
4078
4159
|
cx: 30,
|
|
4079
4160
|
cy: 32,
|
|
4080
4161
|
r: 6
|
|
4081
|
-
}, /* @__PURE__ */
|
|
4162
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4082
4163
|
attributeName: "transform",
|
|
4083
4164
|
dur: "1s",
|
|
4084
4165
|
type: "translate",
|
|
@@ -4087,13 +4168,13 @@ const Loader = (props) => {
|
|
|
4087
4168
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4088
4169
|
repeatCount: "indefinite",
|
|
4089
4170
|
begin: "0.2"
|
|
4090
|
-
})), /* @__PURE__ */
|
|
4171
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4091
4172
|
fill: "currentColor",
|
|
4092
4173
|
stroke: "none",
|
|
4093
4174
|
cx: 54,
|
|
4094
4175
|
cy: 32,
|
|
4095
4176
|
r: 6
|
|
4096
|
-
}, /* @__PURE__ */
|
|
4177
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4097
4178
|
attributeName: "transform",
|
|
4098
4179
|
dur: "1s",
|
|
4099
4180
|
type: "translate",
|
|
@@ -4102,7 +4183,7 @@ const Loader = (props) => {
|
|
|
4102
4183
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4103
4184
|
repeatCount: "indefinite",
|
|
4104
4185
|
begin: "0.3"
|
|
4105
|
-
}))), /* @__PURE__ */
|
|
4186
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
4106
4187
|
style: {
|
|
4107
4188
|
fontSize: "18px",
|
|
4108
4189
|
color: "#252336",
|
|
@@ -4159,7 +4240,7 @@ function gql(strings, ...args) {
|
|
|
4159
4240
|
return str;
|
|
4160
4241
|
}
|
|
4161
4242
|
const Layout = ({ children }) => {
|
|
4162
|
-
return /* @__PURE__ */
|
|
4243
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement("div", {
|
|
4163
4244
|
className: "tina-tailwind",
|
|
4164
4245
|
style: {
|
|
4165
4246
|
position: "fixed",
|
|
@@ -4181,8 +4262,8 @@ var DefaultContext = {
|
|
|
4181
4262
|
style: void 0,
|
|
4182
4263
|
attr: void 0
|
|
4183
4264
|
};
|
|
4184
|
-
var IconContext =
|
|
4185
|
-
var __assign = function() {
|
|
4265
|
+
var IconContext = React.createContext && React.createContext(DefaultContext);
|
|
4266
|
+
var __assign = globalThis && globalThis.__assign || function() {
|
|
4186
4267
|
__assign = Object.assign || function(t) {
|
|
4187
4268
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4188
4269
|
s = arguments[i];
|
|
@@ -4194,7 +4275,7 @@ var __assign = function() {
|
|
|
4194
4275
|
};
|
|
4195
4276
|
return __assign.apply(this, arguments);
|
|
4196
4277
|
};
|
|
4197
|
-
var __rest = function(s, e) {
|
|
4278
|
+
var __rest = globalThis && globalThis.__rest || function(s, e) {
|
|
4198
4279
|
var t = {};
|
|
4199
4280
|
for (var p in s)
|
|
4200
4281
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -4208,14 +4289,14 @@ var __rest = function(s, e) {
|
|
|
4208
4289
|
};
|
|
4209
4290
|
function Tree2Element(tree) {
|
|
4210
4291
|
return tree && tree.map(function(node2, i) {
|
|
4211
|
-
return
|
|
4292
|
+
return React.createElement(node2.tag, __assign({
|
|
4212
4293
|
key: i
|
|
4213
4294
|
}, node2.attr), Tree2Element(node2.child));
|
|
4214
4295
|
});
|
|
4215
4296
|
}
|
|
4216
4297
|
function GenIcon(data) {
|
|
4217
4298
|
return function(props) {
|
|
4218
|
-
return
|
|
4299
|
+
return React.createElement(IconBase, __assign({
|
|
4219
4300
|
attr: __assign({}, data.attr)
|
|
4220
4301
|
}, props), Tree2Element(data.child));
|
|
4221
4302
|
};
|
|
@@ -4229,7 +4310,7 @@ function IconBase(props) {
|
|
|
4229
4310
|
className = conf.className;
|
|
4230
4311
|
if (props.className)
|
|
4231
4312
|
className = (className ? className + " " : "") + props.className;
|
|
4232
|
-
return
|
|
4313
|
+
return React.createElement("svg", __assign({
|
|
4233
4314
|
stroke: "currentColor",
|
|
4234
4315
|
fill: "currentColor",
|
|
4235
4316
|
strokeWidth: "0"
|
|
@@ -4241,9 +4322,9 @@ function IconBase(props) {
|
|
|
4241
4322
|
height: computedSize,
|
|
4242
4323
|
width: computedSize,
|
|
4243
4324
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4244
|
-
}), title &&
|
|
4325
|
+
}), title && React.createElement("title", null, title), props.children);
|
|
4245
4326
|
};
|
|
4246
|
-
return IconContext !== void 0 ?
|
|
4327
|
+
return IconContext !== void 0 ? React.createElement(IconContext.Consumer, null, function(conf) {
|
|
4247
4328
|
return elem(conf);
|
|
4248
4329
|
}) : elem(DefaultContext);
|
|
4249
4330
|
}
|
|
@@ -4281,9 +4362,6 @@ function IoMdClose(props) {
|
|
|
4281
4362
|
function BiEdit(props) {
|
|
4282
4363
|
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);
|
|
4283
4364
|
}
|
|
4284
|
-
function BiLeftArrowAlt(props) {
|
|
4285
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12.707 17.293 8.414 13H18v-2H8.414l4.293-4.293-1.414-1.414L4.586 12l6.707 6.707z" } }] })(props);
|
|
4286
|
-
}
|
|
4287
4365
|
function BiLogIn(props) {
|
|
4288
4366
|
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);
|
|
4289
4367
|
}
|
|
@@ -4296,9 +4374,6 @@ function BiMenu(props) {
|
|
|
4296
4374
|
function BiPlus(props) {
|
|
4297
4375
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z" } }] })(props);
|
|
4298
4376
|
}
|
|
4299
|
-
function BiRightArrowAlt(props) {
|
|
4300
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" } }] })(props);
|
|
4301
|
-
}
|
|
4302
4377
|
function BiTrash(props) {
|
|
4303
4378
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M5 20a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8h2V6h-4V4a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v2H3v2h2zM9 4h6v2H9zM8 8h9v12H7V8z" } }, { "tag": "path", "attr": { "d": "M9 10h2v8H9zm4 0h2v8h-2z" } }] })(props);
|
|
4304
4379
|
}
|
|
@@ -4309,47 +4384,47 @@ const Sidebar = ({ cms }) => {
|
|
|
4309
4384
|
var _a, _b;
|
|
4310
4385
|
const collectionsInfo = useGetCollections(cms);
|
|
4311
4386
|
const screens = cms.plugins.getType("screen").all();
|
|
4312
|
-
const [menuIsOpen, setMenuIsOpen] =
|
|
4387
|
+
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
4313
4388
|
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
4314
4389
|
const navBreakpoint = 1e3;
|
|
4315
4390
|
const windowWidth = useWindowWidth();
|
|
4316
4391
|
const renderDesktopNav = windowWidth > navBreakpoint;
|
|
4317
|
-
return /* @__PURE__ */
|
|
4392
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderDesktopNav && /* @__PURE__ */ React.createElement(Nav, {
|
|
4318
4393
|
sidebarWidth: 360,
|
|
4319
4394
|
showCollections: true,
|
|
4320
4395
|
collectionsInfo,
|
|
4321
4396
|
screens,
|
|
4322
4397
|
contentCreators: [],
|
|
4323
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */
|
|
4398
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4324
4399
|
label: view.name,
|
|
4325
4400
|
to: `screens/${slugify(view.name)}`,
|
|
4326
4401
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4327
4402
|
}),
|
|
4328
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */
|
|
4403
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4329
4404
|
label: collection.label ? collection.label : collection.name,
|
|
4330
4405
|
to: `collections/${collection.name}`,
|
|
4331
4406
|
Icon: ImFilesEmpty
|
|
4332
4407
|
})
|
|
4333
|
-
}), !renderDesktopNav && /* @__PURE__ */
|
|
4408
|
+
}), !renderDesktopNav && /* @__PURE__ */ React.createElement(Transition, {
|
|
4334
4409
|
show: menuIsOpen
|
|
4335
|
-
}, /* @__PURE__ */
|
|
4336
|
-
as:
|
|
4410
|
+
}, /* @__PURE__ */ React.createElement(Transition.Child, {
|
|
4411
|
+
as: React.Fragment,
|
|
4337
4412
|
enter: "transform transition-all ease-out duration-300",
|
|
4338
4413
|
enterFrom: "opacity-0 -translate-x-full",
|
|
4339
4414
|
enterTo: "opacity-100 translate-x-0",
|
|
4340
4415
|
leave: "transform transition-all ease-in duration-200",
|
|
4341
4416
|
leaveFrom: "opacity-100 translate-x-0",
|
|
4342
4417
|
leaveTo: "opacity-0 -translate-x-full"
|
|
4343
|
-
}, /* @__PURE__ */
|
|
4418
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4344
4419
|
className: "fixed left-0 top-0 z-overlay h-full transform"
|
|
4345
|
-
}, /* @__PURE__ */
|
|
4420
|
+
}, /* @__PURE__ */ React.createElement(Nav, {
|
|
4346
4421
|
className: "rounded-r-md",
|
|
4347
4422
|
sidebarWidth: 360,
|
|
4348
4423
|
showCollections: true,
|
|
4349
4424
|
collectionsInfo,
|
|
4350
4425
|
screens,
|
|
4351
4426
|
contentCreators: [],
|
|
4352
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */
|
|
4427
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4353
4428
|
label: view.name,
|
|
4354
4429
|
to: `screens/${slugify(view.name)}`,
|
|
4355
4430
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
@@ -4357,7 +4432,7 @@ const Sidebar = ({ cms }) => {
|
|
|
4357
4432
|
setMenuIsOpen(false);
|
|
4358
4433
|
}
|
|
4359
4434
|
}),
|
|
4360
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */
|
|
4435
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4361
4436
|
label: collection.label ? collection.label : collection.name,
|
|
4362
4437
|
to: `collections/${collection.name}`,
|
|
4363
4438
|
Icon: ImFilesEmpty,
|
|
@@ -4365,19 +4440,19 @@ const Sidebar = ({ cms }) => {
|
|
|
4365
4440
|
setMenuIsOpen(false);
|
|
4366
4441
|
}
|
|
4367
4442
|
})
|
|
4368
|
-
}, /* @__PURE__ */
|
|
4443
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4369
4444
|
className: "absolute top-8 right-0 transform translate-x-full overflow-hidden"
|
|
4370
|
-
}, /* @__PURE__ */
|
|
4445
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4371
4446
|
rounded: "right",
|
|
4372
4447
|
variant: "secondary",
|
|
4373
4448
|
onClick: () => {
|
|
4374
4449
|
setMenuIsOpen(false);
|
|
4375
4450
|
},
|
|
4376
4451
|
className: `transition-opacity duration-150 ease-out`
|
|
4377
|
-
}, /* @__PURE__ */
|
|
4452
|
+
}, /* @__PURE__ */ React.createElement(IoMdClose, {
|
|
4378
4453
|
className: "h-6 w-auto"
|
|
4379
|
-
})))))), /* @__PURE__ */
|
|
4380
|
-
as:
|
|
4454
|
+
})))))), /* @__PURE__ */ React.createElement(Transition.Child, {
|
|
4455
|
+
as: React.Fragment,
|
|
4381
4456
|
enter: "ease-out duration-300",
|
|
4382
4457
|
enterFrom: "opacity-0",
|
|
4383
4458
|
enterTo: "opacity-80",
|
|
@@ -4385,39 +4460,39 @@ const Sidebar = ({ cms }) => {
|
|
|
4385
4460
|
leave: "ease-in duration-200",
|
|
4386
4461
|
leaveFrom: "opacity-80",
|
|
4387
4462
|
leaveTo: "opacity-0"
|
|
4388
|
-
}, /* @__PURE__ */
|
|
4463
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4389
4464
|
onClick: () => {
|
|
4390
4465
|
setMenuIsOpen(false);
|
|
4391
4466
|
},
|
|
4392
4467
|
className: "fixed z-menu inset-0 bg-gradient-to-br from-gray-800 via-gray-900 to-black"
|
|
4393
|
-
}))), !renderDesktopNav && /* @__PURE__ */
|
|
4468
|
+
}))), !renderDesktopNav && /* @__PURE__ */ React.createElement(Button, {
|
|
4394
4469
|
rounded: "right",
|
|
4395
4470
|
variant: "secondary",
|
|
4396
4471
|
onClick: () => {
|
|
4397
4472
|
setMenuIsOpen(true);
|
|
4398
4473
|
},
|
|
4399
4474
|
className: `pointer-events-auto -ml-px absolute left-0 z-50 ${isLocalMode ? `top-10` : `top-4`}`
|
|
4400
|
-
}, /* @__PURE__ */
|
|
4475
|
+
}, /* @__PURE__ */ React.createElement(BiMenu, {
|
|
4401
4476
|
className: "h-7 w-auto"
|
|
4402
4477
|
})));
|
|
4403
4478
|
};
|
|
4404
4479
|
const SidebarLink = (props) => {
|
|
4405
4480
|
const { to, label, Icon } = props;
|
|
4406
|
-
return /* @__PURE__ */
|
|
4481
|
+
return /* @__PURE__ */ React.createElement(NavLink, {
|
|
4407
4482
|
className: ({ isActive }) => {
|
|
4408
4483
|
return `text-base tracking-wide ${isActive ? "text-blue-600" : "text-gray-500"} hover:text-blue-600 flex items-center opacity-90 hover:opacity-100`;
|
|
4409
4484
|
},
|
|
4410
4485
|
onClick: props.onClick ? props.onClick : () => {
|
|
4411
4486
|
},
|
|
4412
4487
|
to
|
|
4413
|
-
}, /* @__PURE__ */
|
|
4488
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4414
4489
|
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4415
4490
|
}), " ", label);
|
|
4416
4491
|
};
|
|
4417
4492
|
const GetCMS = ({ children }) => {
|
|
4418
4493
|
try {
|
|
4419
4494
|
const cms = useCMS();
|
|
4420
|
-
return /* @__PURE__ */
|
|
4495
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
|
|
4421
4496
|
} catch (e) {
|
|
4422
4497
|
return null;
|
|
4423
4498
|
}
|
|
@@ -4429,52 +4504,52 @@ const AuthTemplate = ({
|
|
|
4429
4504
|
message,
|
|
4430
4505
|
children
|
|
4431
4506
|
}) => {
|
|
4432
|
-
return /* @__PURE__ */
|
|
4507
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4433
4508
|
className: "h-screen w-full bg-gradient-to-b from-blue-900 to-gray-900 flex items-center justify-center px-4 py-6"
|
|
4434
|
-
}, /* @__PURE__ */
|
|
4509
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4435
4510
|
className: "bg-white rounded-lg overflow-hidden shadow-lg w-full max-w-lg"
|
|
4436
|
-
}, /* @__PURE__ */
|
|
4511
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4437
4512
|
className: "px-5 py-4 border-b border-gray-150"
|
|
4438
|
-
}, /* @__PURE__ */
|
|
4513
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
4439
4514
|
className: "text-2xl font-sans tracking-wide text-gray-700 flex items-center gap-0.5"
|
|
4440
|
-
}, /* @__PURE__ */
|
|
4515
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4441
4516
|
viewBox: "0 0 32 32",
|
|
4442
4517
|
fill: "#EC4815",
|
|
4443
4518
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4444
4519
|
className: "w-10 h-auto"
|
|
4445
|
-
}, /* @__PURE__ */
|
|
4520
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
4446
4521
|
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"
|
|
4447
|
-
}), /* @__PURE__ */
|
|
4522
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
4448
4523
|
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"
|
|
4449
|
-
})), /* @__PURE__ */
|
|
4524
|
+
})), /* @__PURE__ */ React.createElement("span", null, "Tina"))), message && /* @__PURE__ */ React.createElement("div", {
|
|
4450
4525
|
className: "px-5 pt-4"
|
|
4451
|
-
}, /* @__PURE__ */
|
|
4526
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
4452
4527
|
className: "text-base font-sans leading-normal"
|
|
4453
|
-
}, message)), /* @__PURE__ */
|
|
4528
|
+
}, message)), /* @__PURE__ */ React.createElement("div", {
|
|
4454
4529
|
className: "px-5 py-4 flex gap-4 w-full justify-between"
|
|
4455
4530
|
}, children)));
|
|
4456
4531
|
};
|
|
4457
4532
|
const LoginPage = () => {
|
|
4458
4533
|
const { setEdit } = useEditState();
|
|
4459
4534
|
const login = () => setEdit(true);
|
|
4460
|
-
return /* @__PURE__ */
|
|
4535
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
4461
4536
|
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
4462
|
-
}, /* @__PURE__ */
|
|
4537
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4463
4538
|
onClick: () => {
|
|
4464
4539
|
window.location.href = "/";
|
|
4465
4540
|
},
|
|
4466
4541
|
variant: "white",
|
|
4467
4542
|
size: "custom",
|
|
4468
4543
|
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
4469
|
-
}, /* @__PURE__ */
|
|
4544
|
+
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
4470
4545
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4471
|
-
}), " Back To Site"), /* @__PURE__ */
|
|
4546
|
+
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
4472
4547
|
onClick: () => login(),
|
|
4473
4548
|
variant: "primary",
|
|
4474
4549
|
size: "custom",
|
|
4475
4550
|
className: "text-base h-12 px-6 flex-1",
|
|
4476
4551
|
type: "submit"
|
|
4477
|
-
}, /* @__PURE__ */
|
|
4552
|
+
}, /* @__PURE__ */ React.createElement(BiLogIn, {
|
|
4478
4553
|
className: "w-6 h-auto mr-2 opacity-80"
|
|
4479
4554
|
}), " Edit With Tina")));
|
|
4480
4555
|
};
|
|
@@ -4483,67 +4558,67 @@ const logout = () => {
|
|
|
4483
4558
|
window.location.href = "/";
|
|
4484
4559
|
};
|
|
4485
4560
|
const LogoutPage = () => {
|
|
4486
|
-
return /* @__PURE__ */
|
|
4561
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
4487
4562
|
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
4488
|
-
}, /* @__PURE__ */
|
|
4563
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4489
4564
|
onClick: () => {
|
|
4490
4565
|
window.location.href = "/";
|
|
4491
4566
|
},
|
|
4492
4567
|
variant: "white",
|
|
4493
4568
|
size: "custom",
|
|
4494
4569
|
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
4495
|
-
}, /* @__PURE__ */
|
|
4570
|
+
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
4496
4571
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4497
|
-
}), " Back To Site"), /* @__PURE__ */
|
|
4572
|
+
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
4498
4573
|
onClick: () => logout(),
|
|
4499
4574
|
type: "submit",
|
|
4500
4575
|
variant: "primary",
|
|
4501
4576
|
size: "custom",
|
|
4502
4577
|
className: "text-base h-12 px-6 flex-1"
|
|
4503
|
-
}, /* @__PURE__ */
|
|
4578
|
+
}, /* @__PURE__ */ React.createElement(BiLogOut, {
|
|
4504
4579
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4505
4580
|
}), " Log Out of Tina")));
|
|
4506
4581
|
};
|
|
4507
4582
|
const PageWrapper = ({
|
|
4508
4583
|
children
|
|
4509
4584
|
}) => {
|
|
4510
|
-
return /* @__PURE__ */
|
|
4585
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4511
4586
|
className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
|
|
4512
4587
|
}, children);
|
|
4513
4588
|
};
|
|
4514
4589
|
const PageHeader = ({
|
|
4515
4590
|
isLocalMode,
|
|
4516
4591
|
children
|
|
4517
|
-
}) => /* @__PURE__ */
|
|
4592
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
4518
4593
|
className: "bg-white pb-4 pt-18 border-b border-gray-200 px-12"
|
|
4519
|
-
}, /* @__PURE__ */
|
|
4594
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4520
4595
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4521
|
-
}, /* @__PURE__ */
|
|
4596
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4522
4597
|
className: "w-full flex justify-between items-end"
|
|
4523
4598
|
}, children))));
|
|
4524
4599
|
const PageBody = ({
|
|
4525
4600
|
children
|
|
4526
|
-
}) => /* @__PURE__ */
|
|
4601
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4527
4602
|
className: "py-10 px-12"
|
|
4528
4603
|
}, children);
|
|
4529
4604
|
const PageBodyNarrow = ({
|
|
4530
4605
|
children
|
|
4531
|
-
}) => /* @__PURE__ */
|
|
4606
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4532
4607
|
className: "py-10 px-12"
|
|
4533
|
-
}, /* @__PURE__ */
|
|
4608
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4534
4609
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4535
4610
|
}, children));
|
|
4536
4611
|
const DashboardPage = () => {
|
|
4537
|
-
return /* @__PURE__ */
|
|
4612
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4538
4613
|
var _a, _b;
|
|
4539
|
-
return /* @__PURE__ */
|
|
4614
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, {
|
|
4540
4615
|
isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
4541
|
-
}, /* @__PURE__ */
|
|
4616
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
4542
4617
|
className: "text-2xl font-sans text-gray-700"
|
|
4543
|
-
}, "Welcome to Tina!")), /* @__PURE__ */
|
|
4618
|
+
}, "Welcome to Tina!")), /* @__PURE__ */ React.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
4544
4619
|
});
|
|
4545
4620
|
};
|
|
4546
|
-
const LoadingPage = () => /* @__PURE__ */
|
|
4621
|
+
const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4547
4622
|
style: {
|
|
4548
4623
|
position: "absolute",
|
|
4549
4624
|
top: 0,
|
|
@@ -4557,7 +4632,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4557
4632
|
justifyContent: "center",
|
|
4558
4633
|
padding: "120px 40px 40px 40px"
|
|
4559
4634
|
}
|
|
4560
|
-
}, /* @__PURE__ */
|
|
4635
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4561
4636
|
style: {
|
|
4562
4637
|
background: "#FFF",
|
|
4563
4638
|
border: "1px solid #EDECF3",
|
|
@@ -4571,7 +4646,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4571
4646
|
justifyContent: "center",
|
|
4572
4647
|
flexDirection: "column"
|
|
4573
4648
|
}
|
|
4574
|
-
}, /* @__PURE__ */
|
|
4649
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4575
4650
|
style: {
|
|
4576
4651
|
width: "64px",
|
|
4577
4652
|
color: "#2296fe",
|
|
@@ -4587,13 +4662,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4587
4662
|
viewBox: "0 0 100 64",
|
|
4588
4663
|
enableBackground: "new 0 0 0 0",
|
|
4589
4664
|
xmlSpace: "preserve"
|
|
4590
|
-
}, /* @__PURE__ */
|
|
4665
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4591
4666
|
fill: "currentColor",
|
|
4592
4667
|
stroke: "none",
|
|
4593
4668
|
cx: 6,
|
|
4594
4669
|
cy: 32,
|
|
4595
4670
|
r: 6
|
|
4596
|
-
}, /* @__PURE__ */
|
|
4671
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4597
4672
|
attributeName: "transform",
|
|
4598
4673
|
dur: "1s",
|
|
4599
4674
|
type: "translate",
|
|
@@ -4602,13 +4677,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4602
4677
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4603
4678
|
repeatCount: "indefinite",
|
|
4604
4679
|
begin: "0.1"
|
|
4605
|
-
})), /* @__PURE__ */
|
|
4680
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4606
4681
|
fill: "currentColor",
|
|
4607
4682
|
stroke: "none",
|
|
4608
4683
|
cx: 30,
|
|
4609
4684
|
cy: 32,
|
|
4610
4685
|
r: 6
|
|
4611
|
-
}, /* @__PURE__ */
|
|
4686
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4612
4687
|
attributeName: "transform",
|
|
4613
4688
|
dur: "1s",
|
|
4614
4689
|
type: "translate",
|
|
@@ -4617,13 +4692,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4617
4692
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4618
4693
|
repeatCount: "indefinite",
|
|
4619
4694
|
begin: "0.2"
|
|
4620
|
-
})), /* @__PURE__ */
|
|
4695
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4621
4696
|
fill: "currentColor",
|
|
4622
4697
|
stroke: "none",
|
|
4623
4698
|
cx: 54,
|
|
4624
4699
|
cy: 32,
|
|
4625
4700
|
r: 6
|
|
4626
|
-
}, /* @__PURE__ */
|
|
4701
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4627
4702
|
attributeName: "transform",
|
|
4628
4703
|
dur: "1s",
|
|
4629
4704
|
type: "translate",
|
|
@@ -4632,7 +4707,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4632
4707
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4633
4708
|
repeatCount: "indefinite",
|
|
4634
4709
|
begin: "0.3"
|
|
4635
|
-
}))), /* @__PURE__ */
|
|
4710
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
4636
4711
|
style: {
|
|
4637
4712
|
fontSize: "16px",
|
|
4638
4713
|
color: "#716c7f",
|
|
@@ -4681,161 +4756,19 @@ const GetCollection = ({
|
|
|
4681
4756
|
return null;
|
|
4682
4757
|
}
|
|
4683
4758
|
if (loading) {
|
|
4684
|
-
return /* @__PURE__ */
|
|
4759
|
+
return /* @__PURE__ */ React.createElement(LoadingPage, null);
|
|
4685
4760
|
}
|
|
4686
|
-
return /* @__PURE__ */
|
|
4761
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(collection, loading, reFetchCollection));
|
|
4687
4762
|
};
|
|
4688
|
-
const theme = css`
|
|
4689
|
-
:root {
|
|
4690
|
-
--tina-color-primary-light: #2296fe;
|
|
4691
|
-
--tina-color-primary: #0084ff;
|
|
4692
|
-
--tina-color-primary-dark: #0574e4;
|
|
4693
|
-
--tina-color-error-light: #eb6337;
|
|
4694
|
-
--tina-color-error: #ec4815;
|
|
4695
|
-
--tina-color-error-dark: #dc4419;
|
|
4696
|
-
--tina-color-warning-light: #f5e06e;
|
|
4697
|
-
--tina-color-warning: #e9d050;
|
|
4698
|
-
--tina-color-warning-dark: #d3ba38;
|
|
4699
|
-
--tina-color-success-light: #57c355;
|
|
4700
|
-
--tina-color-success: #3cad3a;
|
|
4701
|
-
--tina-color-success-dark: #249a21;
|
|
4702
|
-
--tina-color-grey-0: #ffffff;
|
|
4703
|
-
--tina-color-grey-1: #f6f6f9;
|
|
4704
|
-
--tina-color-grey-2: #edecf3;
|
|
4705
|
-
--tina-color-grey-3: #e1ddec;
|
|
4706
|
-
--tina-color-grey-4: #b2adbe;
|
|
4707
|
-
--tina-color-grey-5: #918c9e;
|
|
4708
|
-
--tina-color-grey-6: #716c7f;
|
|
4709
|
-
--tina-color-grey-7: #565165;
|
|
4710
|
-
--tina-color-grey-8: #433e52;
|
|
4711
|
-
--tina-color-grey-9: #363145;
|
|
4712
|
-
--tina-color-grey-10: #252336;
|
|
4713
|
-
--tina-color-indicator: var(--tina-color-primary);
|
|
4714
|
-
|
|
4715
|
-
--tina-radius-small: 5px;
|
|
4716
|
-
--tina-radius-big: 24px;
|
|
4717
|
-
|
|
4718
|
-
--tina-padding-small: 12px;
|
|
4719
|
-
--tina-padding-big: 20px;
|
|
4720
|
-
|
|
4721
|
-
--tina-font-size-0: 12px;
|
|
4722
|
-
--tina-font-size-1: 13px;
|
|
4723
|
-
--tina-font-size-2: 15px;
|
|
4724
|
-
--tina-font-size-3: 16px;
|
|
4725
|
-
--tina-font-size-4: 18px;
|
|
4726
|
-
--tina-font-size-5: 20px;
|
|
4727
|
-
--tina-font-size-6: 22px;
|
|
4728
|
-
--tina-font-size-7: 26px;
|
|
4729
|
-
--tina-font-size-8: 32px;
|
|
4730
|
-
|
|
4731
|
-
--tina-font-family: 'Inter', sans-serif;
|
|
4732
|
-
|
|
4733
|
-
--tina-font-weight-regular: 400;
|
|
4734
|
-
--tina-font-weight-bold: 600;
|
|
4735
|
-
|
|
4736
|
-
--tina-shadow-big: 0px 2px 3px rgba(0, 0, 0, 0.05),
|
|
4737
|
-
0 4px 12px rgba(0, 0, 0, 0.1);
|
|
4738
|
-
--tina-shadow-small: 0px 2px 3px rgba(0, 0, 0, 0.12);
|
|
4739
|
-
|
|
4740
|
-
--tina-timing-short: 85ms;
|
|
4741
|
-
--tina-timing-medium: 150ms;
|
|
4742
|
-
--tina-timing-long: 250ms;
|
|
4743
|
-
|
|
4744
|
-
--tina-z-index-0: 0;
|
|
4745
|
-
--tina-z-index-1: 10;
|
|
4746
|
-
--tina-z-index-2: 20;
|
|
4747
|
-
--tina-z-index-3: 30;
|
|
4748
|
-
--tina-z-index-4: 40;
|
|
4749
|
-
--tina-z-index-5: 50;
|
|
4750
|
-
|
|
4751
|
-
--tina-sidebar-width: 340px;
|
|
4752
|
-
--tina-sidebar-header-height: 60px;
|
|
4753
|
-
--tina-toolbar-height: 62px;
|
|
4754
|
-
}
|
|
4755
|
-
`;
|
|
4756
|
-
createGlobalStyle`
|
|
4757
|
-
${theme};
|
|
4758
|
-
`;
|
|
4759
|
-
const Button = (_g) => {
|
|
4760
|
-
var _h = _g, {
|
|
4761
|
-
variant = "secondary",
|
|
4762
|
-
as: Tag = "button",
|
|
4763
|
-
size = "medium",
|
|
4764
|
-
busy,
|
|
4765
|
-
disabled,
|
|
4766
|
-
rounded = "full",
|
|
4767
|
-
children,
|
|
4768
|
-
className
|
|
4769
|
-
} = _h, props = __objRest(_h, [
|
|
4770
|
-
"variant",
|
|
4771
|
-
"as",
|
|
4772
|
-
"size",
|
|
4773
|
-
"busy",
|
|
4774
|
-
"disabled",
|
|
4775
|
-
"rounded",
|
|
4776
|
-
"children",
|
|
4777
|
-
"className"
|
|
4778
|
-
]);
|
|
4779
|
-
const baseClasses = "icon-parent border-0 inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center inline-flex justify-center transition-all duration-150 ease-out ";
|
|
4780
|
-
const variantClasses = {
|
|
4781
|
-
primary: `shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500`,
|
|
4782
|
-
secondary: `shadow text-gray-500 hover:text-blue-500 bg-gray-50 hover:bg-white border border-gray-200`,
|
|
4783
|
-
white: `shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-200`,
|
|
4784
|
-
ghost: `text-gray-500 hover:text-blue-500 hover:shadow border border-transparent hover:border-gray-200 bg-transparent`,
|
|
4785
|
-
danger: `shadow text-white bg-red-500 hover:bg-red-600 focus:ring-red-500`
|
|
4786
|
-
};
|
|
4787
|
-
const state = busy ? `busy` : disabled ? `disabled` : `default`;
|
|
4788
|
-
const stateClasses = {
|
|
4789
|
-
disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
|
|
4790
|
-
busy: `pointer-events-none opacity-70 cursor-wait`,
|
|
4791
|
-
default: ``
|
|
4792
|
-
};
|
|
4793
|
-
const roundedClasses = {
|
|
4794
|
-
full: `rounded-full`,
|
|
4795
|
-
left: `rounded-l-full`,
|
|
4796
|
-
right: `rounded-r-full`
|
|
4797
|
-
};
|
|
4798
|
-
const sizeClasses = {
|
|
4799
|
-
small: `text-xs h-8 px-3`,
|
|
4800
|
-
medium: `text-sm h-10 px-4`,
|
|
4801
|
-
custom: ``
|
|
4802
|
-
};
|
|
4803
|
-
return /* @__PURE__ */ React.createElement(Tag, __spreadValues({
|
|
4804
|
-
className: `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${stateClasses[state]} ${roundedClasses[rounded]} ${className}`
|
|
4805
|
-
}, props), children);
|
|
4806
|
-
};
|
|
4807
|
-
function CursorPaginator({
|
|
4808
|
-
navigateNext,
|
|
4809
|
-
navigatePrev,
|
|
4810
|
-
hasNext,
|
|
4811
|
-
hasPrev,
|
|
4812
|
-
variant = "secondary"
|
|
4813
|
-
}) {
|
|
4814
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4815
|
-
className: "w-full flex flex-shrink-0 justify-end gap-2 items-center"
|
|
4816
|
-
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
4817
|
-
variant,
|
|
4818
|
-
disabled: !hasPrev,
|
|
4819
|
-
onClick: navigatePrev
|
|
4820
|
-
}, /* @__PURE__ */ React__default.createElement(BiLeftArrowAlt, {
|
|
4821
|
-
className: "w-6 h-full mr-2 opacity-70"
|
|
4822
|
-
}), " Previous"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
4823
|
-
variant,
|
|
4824
|
-
disabled: !hasNext,
|
|
4825
|
-
onClick: navigateNext
|
|
4826
|
-
}, "Next ", /* @__PURE__ */ React__default.createElement(BiRightArrowAlt, {
|
|
4827
|
-
className: "w-6 h-full ml-2 opacity-70"
|
|
4828
|
-
})));
|
|
4829
|
-
}
|
|
4830
4763
|
const TemplateMenu = ({ templates }) => {
|
|
4831
|
-
return /* @__PURE__ */
|
|
4764
|
+
return /* @__PURE__ */ React.createElement(Menu, {
|
|
4832
4765
|
as: "div",
|
|
4833
4766
|
className: "relative inline-block text-left"
|
|
4834
|
-
}, () => /* @__PURE__ */
|
|
4767
|
+
}, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Menu.Button, {
|
|
4835
4768
|
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"
|
|
4836
|
-
}, "Create New ", /* @__PURE__ */
|
|
4769
|
+
}, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4837
4770
|
className: "w-5 h-full ml-1 opacity-70"
|
|
4838
|
-
}))), /* @__PURE__ */
|
|
4771
|
+
}))), /* @__PURE__ */ React.createElement(Transition, {
|
|
4839
4772
|
as: Fragment,
|
|
4840
4773
|
enter: "transition ease-out duration-100",
|
|
4841
4774
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -4843,13 +4776,13 @@ const TemplateMenu = ({ templates }) => {
|
|
|
4843
4776
|
leave: "transition ease-in duration-75",
|
|
4844
4777
|
leaveFrom: "transform opacity-100 scale-100",
|
|
4845
4778
|
leaveTo: "transform opacity-0 scale-95"
|
|
4846
|
-
}, /* @__PURE__ */
|
|
4779
|
+
}, /* @__PURE__ */ React.createElement(Menu.Items, {
|
|
4847
4780
|
className: "origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none"
|
|
4848
|
-
}, /* @__PURE__ */
|
|
4781
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4849
4782
|
className: "py-1"
|
|
4850
|
-
}, templates.map((template) => /* @__PURE__ */
|
|
4783
|
+
}, templates.map((template) => /* @__PURE__ */ React.createElement(Menu.Item, {
|
|
4851
4784
|
key: `${template.label}-${template.name}`
|
|
4852
|
-
}, ({ active }) => /* @__PURE__ */
|
|
4785
|
+
}, ({ active }) => /* @__PURE__ */ React.createElement(Link, {
|
|
4853
4786
|
to: `${template.name}/new`,
|
|
4854
4787
|
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"}`
|
|
4855
4788
|
}, template.label))))))));
|
|
@@ -4868,8 +4801,8 @@ const handleNavigate = (navigate, cms, collection, document) => {
|
|
|
4868
4801
|
const CollectionListPage = () => {
|
|
4869
4802
|
const navigate = useNavigate();
|
|
4870
4803
|
const { collectionName } = useParams();
|
|
4871
|
-
const [open, setOpen] =
|
|
4872
|
-
const [vars, setVars] =
|
|
4804
|
+
const [open, setOpen] = React.useState(false);
|
|
4805
|
+
const [vars, setVars] = React.useState({
|
|
4873
4806
|
collection: collectionName,
|
|
4874
4807
|
relativePath: ""
|
|
4875
4808
|
});
|
|
@@ -4880,8 +4813,8 @@ const CollectionListPage = () => {
|
|
|
4880
4813
|
setEndCursor("");
|
|
4881
4814
|
setPrevCursors([]);
|
|
4882
4815
|
}, [loc]);
|
|
4883
|
-
return /* @__PURE__ */
|
|
4884
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4817
|
+
return /* @__PURE__ */ React.createElement(GetCollection, {
|
|
4885
4818
|
cms,
|
|
4886
4819
|
collectionName,
|
|
4887
4820
|
includeDocuments: true,
|
|
@@ -4893,7 +4826,7 @@ const CollectionListPage = () => {
|
|
|
4893
4826
|
const admin = cms.api.admin;
|
|
4894
4827
|
const pageInfo = collection.documents.pageInfo;
|
|
4895
4828
|
const useDataFlag = cms.flags.get("experimentalData");
|
|
4896
|
-
return /* @__PURE__ */
|
|
4829
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
4897
4830
|
filename: vars.relativePath,
|
|
4898
4831
|
deleteFunc: async () => {
|
|
4899
4832
|
try {
|
|
@@ -4907,71 +4840,71 @@ const CollectionListPage = () => {
|
|
|
4907
4840
|
}
|
|
4908
4841
|
},
|
|
4909
4842
|
close: () => setOpen(false)
|
|
4910
|
-
}), /* @__PURE__ */
|
|
4843
|
+
}), /* @__PURE__ */ React.createElement(PageHeader, {
|
|
4911
4844
|
isLocalMode: (_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
4912
|
-
}, /* @__PURE__ */
|
|
4845
|
+
}, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h3", {
|
|
4913
4846
|
className: "font-sans text-2xl text-gray-700"
|
|
4914
|
-
}, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */
|
|
4847
|
+
}, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
|
|
4915
4848
|
to: `new`,
|
|
4916
4849
|
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"
|
|
4917
|
-
}, "Create New", " ", /* @__PURE__ */
|
|
4850
|
+
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4918
4851
|
className: "w-5 h-full ml-1 opacity-70"
|
|
4919
|
-
})), collection.templates && /* @__PURE__ */
|
|
4852
|
+
})), collection.templates && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
4920
4853
|
templates: collection.templates
|
|
4921
|
-
}))), /* @__PURE__ */
|
|
4854
|
+
}))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
4922
4855
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4923
|
-
}, totalCount > 0 && /* @__PURE__ */
|
|
4856
|
+
}, totalCount > 0 && /* @__PURE__ */ React.createElement("table", {
|
|
4924
4857
|
className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
4925
|
-
}, /* @__PURE__ */
|
|
4858
|
+
}, /* @__PURE__ */ React.createElement("tbody", {
|
|
4926
4859
|
className: "divide-y divide-gray-150"
|
|
4927
4860
|
}, documents.map((document) => {
|
|
4928
4861
|
var _a2;
|
|
4929
4862
|
const hasTitle = Boolean(document.node._sys.title);
|
|
4930
4863
|
const subfolders = document.node._sys.breadcrumbs.slice(0, -1).join("/");
|
|
4931
|
-
return /* @__PURE__ */
|
|
4864
|
+
return /* @__PURE__ */ React.createElement("tr", {
|
|
4932
4865
|
key: `document-${document.node._sys.relativePath}`,
|
|
4933
4866
|
className: ""
|
|
4934
|
-
}, /* @__PURE__ */
|
|
4867
|
+
}, /* @__PURE__ */ React.createElement("td", {
|
|
4935
4868
|
className: "px-6 py-2 whitespace-nowrap"
|
|
4936
|
-
}, /* @__PURE__ */
|
|
4869
|
+
}, /* @__PURE__ */ React.createElement("a", {
|
|
4937
4870
|
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
4938
4871
|
onClick: () => {
|
|
4939
4872
|
handleNavigate(navigate, cms, collection, document.node);
|
|
4940
4873
|
}
|
|
4941
|
-
}, /* @__PURE__ */
|
|
4874
|
+
}, /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4942
4875
|
className: "inline-block h-6 w-auto opacity-70"
|
|
4943
|
-
}), /* @__PURE__ */
|
|
4876
|
+
}), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", {
|
|
4944
4877
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4945
|
-
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */
|
|
4878
|
+
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
4946
4879
|
className: "h-5 leading-5 block whitespace-nowrap"
|
|
4947
|
-
}, subfolders && /* @__PURE__ */
|
|
4880
|
+
}, subfolders && /* @__PURE__ */ React.createElement("span", {
|
|
4948
4881
|
className: "text-xs text-gray-400"
|
|
4949
|
-
}, `${subfolders}/`), /* @__PURE__ */
|
|
4882
|
+
}, `${subfolders}/`), /* @__PURE__ */ React.createElement("span", null, hasTitle ? (_a2 = document.node._sys) == null ? void 0 : _a2.title : document.node._sys.filename))))), hasTitle && /* @__PURE__ */ React.createElement("td", {
|
|
4950
4883
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4951
|
-
}, /* @__PURE__ */
|
|
4884
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4952
4885
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4953
|
-
}, "Filename"), /* @__PURE__ */
|
|
4886
|
+
}, "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
4954
4887
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4955
|
-
}, document.node._sys.filename)), /* @__PURE__ */
|
|
4888
|
+
}, document.node._sys.filename)), /* @__PURE__ */ React.createElement("td", {
|
|
4956
4889
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4957
|
-
}, /* @__PURE__ */
|
|
4890
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4958
4891
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4959
|
-
}, "Extension"), /* @__PURE__ */
|
|
4892
|
+
}, "Extension"), /* @__PURE__ */ React.createElement("span", {
|
|
4960
4893
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4961
|
-
}, document.node._sys.extension)), /* @__PURE__ */
|
|
4894
|
+
}, document.node._sys.extension)), /* @__PURE__ */ React.createElement("td", {
|
|
4962
4895
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4963
|
-
}, /* @__PURE__ */
|
|
4896
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4964
4897
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4965
|
-
}, "Template"), /* @__PURE__ */
|
|
4898
|
+
}, "Template"), /* @__PURE__ */ React.createElement("span", {
|
|
4966
4899
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4967
|
-
}, document.node._sys.template)), /* @__PURE__ */
|
|
4900
|
+
}, document.node._sys.template)), /* @__PURE__ */ React.createElement("td", {
|
|
4968
4901
|
className: "w-0"
|
|
4969
|
-
}, /* @__PURE__ */
|
|
4902
|
+
}, /* @__PURE__ */ React.createElement(OverflowMenu, {
|
|
4970
4903
|
toolbarItems: [
|
|
4971
4904
|
{
|
|
4972
4905
|
name: "edit",
|
|
4973
4906
|
label: "Edit in Admin",
|
|
4974
|
-
Icon: /* @__PURE__ */
|
|
4907
|
+
Icon: /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4975
4908
|
size: "1.3rem"
|
|
4976
4909
|
}),
|
|
4977
4910
|
onMouseDown: () => {
|
|
@@ -4981,7 +4914,7 @@ const CollectionListPage = () => {
|
|
|
4981
4914
|
{
|
|
4982
4915
|
name: "delete",
|
|
4983
4916
|
label: "Delete",
|
|
4984
|
-
Icon: /* @__PURE__ */
|
|
4917
|
+
Icon: /* @__PURE__ */ React.createElement(BiTrash, {
|
|
4985
4918
|
size: "1.3rem",
|
|
4986
4919
|
className: "text-red-500"
|
|
4987
4920
|
}),
|
|
@@ -4995,9 +4928,9 @@ const CollectionListPage = () => {
|
|
|
4995
4928
|
}
|
|
4996
4929
|
]
|
|
4997
4930
|
})));
|
|
4998
|
-
}))), useDataFlag && /* @__PURE__ */
|
|
4931
|
+
}))), useDataFlag && /* @__PURE__ */ React.createElement("div", {
|
|
4999
4932
|
className: "pt-3"
|
|
5000
|
-
}, /* @__PURE__ */
|
|
4933
|
+
}, /* @__PURE__ */ React.createElement(CursorPaginator, {
|
|
5001
4934
|
variant: "white",
|
|
5002
4935
|
hasNext: pageInfo == null ? void 0 : pageInfo.hasNextPage,
|
|
5003
4936
|
navigateNext: () => {
|
|
@@ -5019,14 +4952,14 @@ const CollectionListPage = () => {
|
|
|
5019
4952
|
});
|
|
5020
4953
|
};
|
|
5021
4954
|
const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
|
|
5022
|
-
return /* @__PURE__ */
|
|
4955
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, {
|
|
5023
4956
|
close: close2
|
|
5024
|
-
}, "Delete ", filename), /* @__PURE__ */
|
|
4957
|
+
}, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, {
|
|
5025
4958
|
padded: true
|
|
5026
|
-
}, /* @__PURE__ */
|
|
4959
|
+
}, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button, {
|
|
5027
4960
|
style: { flexGrow: 2 },
|
|
5028
4961
|
onClick: close2
|
|
5029
|
-
}, "Cancel"), /* @__PURE__ */
|
|
4962
|
+
}, "Cancel"), /* @__PURE__ */ React.createElement(Button, {
|
|
5030
4963
|
style: { flexGrow: 3 },
|
|
5031
4964
|
variant: "danger",
|
|
5032
4965
|
onClick: async () => {
|
|
@@ -5040,12 +4973,14 @@ function HiChevronRight(props) {
|
|
|
5040
4973
|
}
|
|
5041
4974
|
const createDocument = async (cms, collection, template, mutationInfo, values) => {
|
|
5042
4975
|
const api = new TinaAdminApi(cms);
|
|
5043
|
-
const
|
|
4976
|
+
const { filename, ...leftover } = values;
|
|
5044
4977
|
const { includeCollection, includeTemplate } = mutationInfo;
|
|
5045
4978
|
const relativePath = `${filename}.${collection.format}`;
|
|
5046
|
-
const params = transformDocumentIntoMutationRequestPayload(
|
|
5047
|
-
_collection: collection.name
|
|
5048
|
-
|
|
4979
|
+
const params = transformDocumentIntoMutationRequestPayload({
|
|
4980
|
+
_collection: collection.name,
|
|
4981
|
+
...template && { _template: template.name },
|
|
4982
|
+
...leftover
|
|
4983
|
+
}, {
|
|
5049
4984
|
includeCollection,
|
|
5050
4985
|
includeTemplate
|
|
5051
4986
|
});
|
|
@@ -5060,7 +4995,7 @@ const createDocument = async (cms, collection, template, mutationInfo, values) =
|
|
|
5060
4995
|
};
|
|
5061
4996
|
const CollectionCreatePage = () => {
|
|
5062
4997
|
const { collectionName, templateName } = useParams();
|
|
5063
|
-
return /* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5064
4999
|
cms,
|
|
5065
5000
|
collectionName,
|
|
5066
5001
|
includeDocuments: false
|
|
@@ -5069,7 +5004,7 @@ const CollectionCreatePage = () => {
|
|
|
5069
5004
|
includeCollection: true,
|
|
5070
5005
|
includeTemplate: !!collection.templates
|
|
5071
5006
|
};
|
|
5072
|
-
return /* @__PURE__ */
|
|
5007
|
+
return /* @__PURE__ */ React.createElement(RenderForm$1, {
|
|
5073
5008
|
cms,
|
|
5074
5009
|
collection,
|
|
5075
5010
|
templateName,
|
|
@@ -5102,7 +5037,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5102
5037
|
name: "filename",
|
|
5103
5038
|
label: "Filename",
|
|
5104
5039
|
component: "text",
|
|
5105
|
-
description: /* @__PURE__ */
|
|
5040
|
+
description: /* @__PURE__ */ React.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React.createElement("br", null), "Examples: ", /* @__PURE__ */ React.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React.createElement("code", null, "sub-folder/My_Document")),
|
|
5106
5041
|
placeholder: `My_Document`,
|
|
5107
5042
|
validate: (value, allValues, meta) => {
|
|
5108
5043
|
if (!value) {
|
|
@@ -5135,24 +5070,24 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5135
5070
|
const windowWidth = useWindowWidth();
|
|
5136
5071
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5137
5072
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5138
|
-
return /* @__PURE__ */
|
|
5073
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5139
5074
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5140
|
-
}, /* @__PURE__ */
|
|
5075
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5141
5076
|
className: "max-w-form mx-auto"
|
|
5142
|
-
}, /* @__PURE__ */
|
|
5077
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5143
5078
|
className: "mb-2"
|
|
5144
|
-
}, /* @__PURE__ */
|
|
5079
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5145
5080
|
className: "block text-sm leading-tight uppercase text-gray-400 mb-1"
|
|
5146
|
-
}, /* @__PURE__ */
|
|
5081
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
5147
5082
|
to: `/collections/${collection.name}`,
|
|
5148
5083
|
className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
|
|
5149
|
-
}, collection.label ? collection.label : collection.name), /* @__PURE__ */
|
|
5084
|
+
}, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
|
|
5150
5085
|
className: "inline-block -mt-0.5 opacity-50"
|
|
5151
|
-
})), /* @__PURE__ */
|
|
5086
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
5152
5087
|
className: "text-xl text-gray-700 font-medium leading-tight"
|
|
5153
|
-
}, "Create New")), /* @__PURE__ */
|
|
5088
|
+
}, "Create New")), /* @__PURE__ */ React.createElement(FormStatus, {
|
|
5154
5089
|
pristine: formIsPristine
|
|
5155
|
-
}))), /* @__PURE__ */
|
|
5090
|
+
}))), /* @__PURE__ */ React.createElement(FormBuilder, {
|
|
5156
5091
|
form,
|
|
5157
5092
|
onPristineChange: setFormIsPristine
|
|
5158
5093
|
})));
|
|
@@ -5193,9 +5128,9 @@ const GetDocument = ({
|
|
|
5193
5128
|
return null;
|
|
5194
5129
|
}
|
|
5195
5130
|
if (loading) {
|
|
5196
|
-
return /* @__PURE__ */
|
|
5131
|
+
return /* @__PURE__ */ React.createElement(LoadingPage, null);
|
|
5197
5132
|
}
|
|
5198
|
-
return /* @__PURE__ */
|
|
5133
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(document, loading));
|
|
5199
5134
|
};
|
|
5200
5135
|
const updateDocument = async (cms, relativePath, collection, mutationInfo, values) => {
|
|
5201
5136
|
const api = new TinaAdminApi(cms);
|
|
@@ -5214,9 +5149,9 @@ const updateDocument = async (cms, relativePath, collection, mutationInfo, value
|
|
|
5214
5149
|
}
|
|
5215
5150
|
};
|
|
5216
5151
|
const CollectionUpdatePage = () => {
|
|
5217
|
-
const
|
|
5152
|
+
const { collectionName, ...rest } = useParams();
|
|
5218
5153
|
const { "*": filename } = rest;
|
|
5219
|
-
return /* @__PURE__ */
|
|
5154
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5220
5155
|
cms,
|
|
5221
5156
|
collectionName,
|
|
5222
5157
|
includeDocuments: false
|
|
@@ -5226,11 +5161,11 @@ const CollectionUpdatePage = () => {
|
|
|
5226
5161
|
includeCollection: true,
|
|
5227
5162
|
includeTemplate: !!collection.templates
|
|
5228
5163
|
};
|
|
5229
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ React.createElement(GetDocument, {
|
|
5230
5165
|
cms,
|
|
5231
5166
|
collectionName: collection.name,
|
|
5232
5167
|
relativePath
|
|
5233
|
-
}, (document) => /* @__PURE__ */
|
|
5168
|
+
}, (document) => /* @__PURE__ */ React.createElement(RenderForm, {
|
|
5234
5169
|
cms,
|
|
5235
5170
|
document,
|
|
5236
5171
|
filename,
|
|
@@ -5283,24 +5218,24 @@ const RenderForm = ({
|
|
|
5283
5218
|
const windowWidth = useWindowWidth();
|
|
5284
5219
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5285
5220
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5286
|
-
return /* @__PURE__ */
|
|
5221
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5287
5222
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5288
|
-
}, /* @__PURE__ */
|
|
5223
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5289
5224
|
className: "max-w-form mx-auto"
|
|
5290
|
-
}, /* @__PURE__ */
|
|
5225
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5291
5226
|
className: "mb-2"
|
|
5292
|
-
}, /* @__PURE__ */
|
|
5227
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5293
5228
|
className: "block text-sm leading-tight uppercase text-gray-400 mb-1"
|
|
5294
|
-
}, /* @__PURE__ */
|
|
5229
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
5295
5230
|
to: `/collections/${collection.name}`,
|
|
5296
5231
|
className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
|
|
5297
|
-
}, collection.label ? collection.label : collection.name), /* @__PURE__ */
|
|
5232
|
+
}, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
|
|
5298
5233
|
className: "inline-block -mt-0.5 opacity-50"
|
|
5299
|
-
})), /* @__PURE__ */
|
|
5234
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
5300
5235
|
className: "text-xl text-gray-700 font-medium leading-tight"
|
|
5301
|
-
}, "Edit ", `${filename}.${collection.format}`)), /* @__PURE__ */
|
|
5236
|
+
}, "Edit ", `${filename}.${collection.format}`)), /* @__PURE__ */ React.createElement(FormStatus, {
|
|
5302
5237
|
pristine: formIsPristine
|
|
5303
|
-
}))), /* @__PURE__ */
|
|
5238
|
+
}))), /* @__PURE__ */ React.createElement(FormBuilder, {
|
|
5304
5239
|
form,
|
|
5305
5240
|
onPristineChange: setFormIsPristine
|
|
5306
5241
|
})));
|
|
@@ -5310,24 +5245,24 @@ const ScreenPage = () => {
|
|
|
5310
5245
|
const navBreakpoint = 1e3;
|
|
5311
5246
|
const windowWidth = useWindowWidth();
|
|
5312
5247
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5313
|
-
return /* @__PURE__ */
|
|
5248
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5314
5249
|
var _a, _b;
|
|
5315
5250
|
const screens = cms.plugins.getType("screen").all();
|
|
5316
5251
|
const selectedScreen = screens.find(({ name }) => slugify(name) === screenName);
|
|
5317
|
-
return /* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
5318
5253
|
className: "relative w-full h-full flex flex-col items-stretch justify-between"
|
|
5319
|
-
}, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */
|
|
5254
|
+
}, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), renderNavToggle && /* @__PURE__ */ React.createElement("div", {
|
|
5320
5255
|
className: `py-5 border-b border-gray-200 bg-white pl-18`
|
|
5321
|
-
}, selectedScreen.name), /* @__PURE__ */
|
|
5256
|
+
}, selectedScreen.name), /* @__PURE__ */ React.createElement("div", {
|
|
5322
5257
|
className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between"
|
|
5323
|
-
}, /* @__PURE__ */
|
|
5258
|
+
}, /* @__PURE__ */ React.createElement(selectedScreen.Component, {
|
|
5324
5259
|
close: () => {
|
|
5325
5260
|
}
|
|
5326
5261
|
})));
|
|
5327
5262
|
});
|
|
5328
5263
|
};
|
|
5329
5264
|
const Redirect = () => {
|
|
5330
|
-
|
|
5265
|
+
React.useEffect(() => {
|
|
5331
5266
|
if (window) {
|
|
5332
5267
|
window.location.assign("/");
|
|
5333
5268
|
}
|
|
@@ -5341,43 +5276,43 @@ const TinaAdmin = () => {
|
|
|
5341
5276
|
return null;
|
|
5342
5277
|
}
|
|
5343
5278
|
if (!edit) {
|
|
5344
|
-
return /* @__PURE__ */
|
|
5279
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(LoginPage, null));
|
|
5345
5280
|
}
|
|
5346
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5347
5282
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5348
5283
|
if (isTinaAdminEnabled) {
|
|
5349
|
-
return /* @__PURE__ */
|
|
5284
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement("div", {
|
|
5350
5285
|
className: "flex items-stretch h-screen overflow-hidden"
|
|
5351
|
-
}, /* @__PURE__ */
|
|
5286
|
+
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5352
5287
|
cms
|
|
5353
|
-
}), /* @__PURE__ */
|
|
5288
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
5354
5289
|
className: "flex-1 relative"
|
|
5355
|
-
}, /* @__PURE__ */
|
|
5290
|
+
}, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5356
5291
|
path: "collections/:collectionName/new",
|
|
5357
|
-
element: /* @__PURE__ */
|
|
5358
|
-
}), /* @__PURE__ */
|
|
5292
|
+
element: /* @__PURE__ */ React.createElement(CollectionCreatePage, null)
|
|
5293
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5359
5294
|
path: "collections/:collectionName/:templateName/new",
|
|
5360
|
-
element: /* @__PURE__ */
|
|
5361
|
-
}), /* @__PURE__ */
|
|
5295
|
+
element: /* @__PURE__ */ React.createElement(CollectionCreatePage, null)
|
|
5296
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5362
5297
|
path: "collections/:collectionName/*",
|
|
5363
|
-
element: /* @__PURE__ */
|
|
5364
|
-
}), /* @__PURE__ */
|
|
5298
|
+
element: /* @__PURE__ */ React.createElement(CollectionUpdatePage, null)
|
|
5299
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5365
5300
|
path: "collections/:collectionName",
|
|
5366
|
-
element: /* @__PURE__ */
|
|
5367
|
-
}), /* @__PURE__ */
|
|
5301
|
+
element: /* @__PURE__ */ React.createElement(CollectionListPage, null)
|
|
5302
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5368
5303
|
path: "screens/:screenName",
|
|
5369
|
-
element: /* @__PURE__ */
|
|
5370
|
-
}), /* @__PURE__ */
|
|
5304
|
+
element: /* @__PURE__ */ React.createElement(ScreenPage, null)
|
|
5305
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5371
5306
|
path: "/",
|
|
5372
|
-
element: /* @__PURE__ */
|
|
5307
|
+
element: /* @__PURE__ */ React.createElement(DashboardPage, null)
|
|
5373
5308
|
}))))));
|
|
5374
5309
|
} else {
|
|
5375
|
-
return /* @__PURE__ */
|
|
5310
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5376
5311
|
path: "logout",
|
|
5377
|
-
element: /* @__PURE__ */
|
|
5378
|
-
}), /* @__PURE__ */
|
|
5312
|
+
element: /* @__PURE__ */ React.createElement(LogoutPage, null)
|
|
5313
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5379
5314
|
path: "/",
|
|
5380
|
-
element: /* @__PURE__ */
|
|
5315
|
+
element: /* @__PURE__ */ React.createElement(Redirect, null)
|
|
5381
5316
|
}))));
|
|
5382
5317
|
}
|
|
5383
5318
|
});
|