tinacms 0.68.9 → 0.68.12
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 +522 -580
- package/dist/index.js +294 -353
- package/dist/internalClient/index.d.ts +10 -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 +37 -14
- package/CHANGELOG.md +0 -1568
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, Nav, LocalWarning, OverflowMenu, 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;
|
|
@@ -2206,11 +2211,13 @@ mutation addPendingDocumentMutation(
|
|
|
2206
2211
|
return this.contentApiUrl.includes("localhost");
|
|
2207
2212
|
}
|
|
2208
2213
|
setBranch(branchName) {
|
|
2209
|
-
var _a, _b, _c;
|
|
2214
|
+
var _a, _b, _c, _d;
|
|
2210
2215
|
const encodedBranch = encodeURIComponent(branchName);
|
|
2211
|
-
this.
|
|
2212
|
-
this.
|
|
2213
|
-
this.
|
|
2216
|
+
this.branch = encodedBranch;
|
|
2217
|
+
this.assetsApiUrl = ((_a = this.options.tinaioConfig) == null ? void 0 : _a.assetsApiUrlOverride) || "https://assets.tinajs.io";
|
|
2218
|
+
this.frontendUrl = ((_b = this.options.tinaioConfig) == null ? void 0 : _b.frontendUrlOverride) || "https://app.tina.io";
|
|
2219
|
+
this.identityApiUrl = ((_c = this.options.tinaioConfig) == null ? void 0 : _c.identityApiUrlOverride) || "https://identity.tinajs.io";
|
|
2220
|
+
this.contentApiBase = ((_d = this.options.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://content.tinajs.io`;
|
|
2214
2221
|
this.contentApiUrl = this.options.customContentApiUrl || `${this.contentApiBase}/content/${this.options.clientId}/github/${encodedBranch}`;
|
|
2215
2222
|
}
|
|
2216
2223
|
async requestWithForm(query, {
|
|
@@ -2244,7 +2251,12 @@ mutation addPendingDocumentMutation(
|
|
|
2244
2251
|
})
|
|
2245
2252
|
});
|
|
2246
2253
|
if (res.status !== 200) {
|
|
2247
|
-
|
|
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);
|
|
2248
2260
|
}
|
|
2249
2261
|
const json = await res.json();
|
|
2250
2262
|
if (json.errors) {
|
|
@@ -2253,6 +2265,24 @@ mutation addPendingDocumentMutation(
|
|
|
2253
2265
|
}
|
|
2254
2266
|
return json.data;
|
|
2255
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
|
+
}
|
|
2256
2286
|
parseJwt(token) {
|
|
2257
2287
|
const base64Url = token.split(".")[1];
|
|
2258
2288
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
@@ -2307,11 +2337,13 @@ mutation addPendingDocumentMutation(
|
|
|
2307
2337
|
}
|
|
2308
2338
|
async fetchWithToken(input, init) {
|
|
2309
2339
|
const headers = (init == null ? void 0 : init.headers) || {};
|
|
2310
|
-
return await fetch(input,
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2340
|
+
return await fetch(input, {
|
|
2341
|
+
...init,
|
|
2342
|
+
headers: new Headers({
|
|
2343
|
+
Authorization: "Bearer " + (await this.getToken()).id_token,
|
|
2344
|
+
...headers
|
|
2345
|
+
})
|
|
2346
|
+
});
|
|
2315
2347
|
}
|
|
2316
2348
|
async getUser() {
|
|
2317
2349
|
if (!this.clientId) {
|
|
@@ -2363,11 +2395,12 @@ mutation addPendingDocumentMutation(
|
|
|
2363
2395
|
const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
|
|
2364
2396
|
class LocalClient extends Client {
|
|
2365
2397
|
constructor(props) {
|
|
2366
|
-
const clientProps =
|
|
2398
|
+
const clientProps = {
|
|
2399
|
+
...props,
|
|
2367
2400
|
clientId: "",
|
|
2368
2401
|
branch: "",
|
|
2369
2402
|
customContentApiUrl: props && props.customContentApiUrl ? props.customContentApiUrl : DEFAULT_LOCAL_TINA_GQL_SERVER_URL
|
|
2370
|
-
}
|
|
2403
|
+
};
|
|
2371
2404
|
super(clientProps);
|
|
2372
2405
|
}
|
|
2373
2406
|
async isAuthorized() {
|
|
@@ -2378,11 +2411,12 @@ class LocalClient extends Client {
|
|
|
2378
2411
|
}
|
|
2379
2412
|
}
|
|
2380
2413
|
function ModalBuilder(modalProps) {
|
|
2381
|
-
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, {
|
|
2382
2415
|
padded: true
|
|
2383
|
-
}, /* @__PURE__ */
|
|
2384
|
-
key: action.name
|
|
2385
|
-
|
|
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
|
+
})))));
|
|
2386
2420
|
}
|
|
2387
2421
|
const ErrorLabel = styled.p`
|
|
2388
2422
|
color: var(--tina-color-error) !important;
|
|
@@ -2399,12 +2433,12 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
2399
2433
|
throw e;
|
|
2400
2434
|
}
|
|
2401
2435
|
}, [action, setSubmitting]);
|
|
2402
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
2403
2437
|
variant: primary ? "primary" : "secondary",
|
|
2404
2438
|
onClick,
|
|
2405
2439
|
busy: submitting,
|
|
2406
2440
|
disabled: submitting
|
|
2407
|
-
}, submitting && /* @__PURE__ */
|
|
2441
|
+
}, submitting && /* @__PURE__ */ React.createElement(LoadingDots, null), !submitting && name);
|
|
2408
2442
|
};
|
|
2409
2443
|
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
2410
2444
|
const useTinaAuthRedirect = () => {
|
|
@@ -2595,7 +2629,7 @@ const AuthWallInner = ({
|
|
|
2595
2629
|
const client = cms.api.tina;
|
|
2596
2630
|
const [activeModal, setActiveModal] = useState(null);
|
|
2597
2631
|
const [showChildren, setShowChildren] = useState(false);
|
|
2598
|
-
|
|
2632
|
+
React.useEffect(() => {
|
|
2599
2633
|
client.isAuthenticated().then((isAuthenticated) => {
|
|
2600
2634
|
if (isAuthenticated) {
|
|
2601
2635
|
setShowChildren(true);
|
|
@@ -2620,7 +2654,7 @@ const AuthWallInner = ({
|
|
|
2620
2654
|
setActiveModal(null);
|
|
2621
2655
|
}
|
|
2622
2656
|
}) : [];
|
|
2623
|
-
return /* @__PURE__ */
|
|
2657
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React.createElement(ModalBuilder, {
|
|
2624
2658
|
title: "Tina Cloud Authorization",
|
|
2625
2659
|
message: "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account.",
|
|
2626
2660
|
close,
|
|
@@ -2649,12 +2683,12 @@ const TinaCloudProvider = (props) => {
|
|
|
2649
2683
|
const baseBranch = props.branch || "main";
|
|
2650
2684
|
const [currentBranch, setCurrentBranch] = useLocalStorage("tinacms-current-branch", baseBranch);
|
|
2651
2685
|
useTinaAuthRedirect();
|
|
2652
|
-
const cms =
|
|
2686
|
+
const cms = React.useMemo(() => props.cms || new TinaCMS({
|
|
2653
2687
|
enabled: true,
|
|
2654
2688
|
sidebar: true
|
|
2655
2689
|
}), [props.cms]);
|
|
2656
2690
|
if (!cms.api.tina) {
|
|
2657
|
-
cms.registerApi("tina", createClient(
|
|
2691
|
+
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
2658
2692
|
} else {
|
|
2659
2693
|
cms.api.tina.setBranch(currentBranch);
|
|
2660
2694
|
}
|
|
@@ -2662,14 +2696,20 @@ const TinaCloudProvider = (props) => {
|
|
|
2662
2696
|
cms.registerApi("admin", new TinaAdminApi(cms));
|
|
2663
2697
|
}
|
|
2664
2698
|
const setupMedia = async () => {
|
|
2665
|
-
var _a;
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
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);
|
|
2669
2707
|
} else {
|
|
2670
|
-
const MediaClass = await
|
|
2708
|
+
const MediaClass = await mediaStoreFromProps();
|
|
2671
2709
|
cms.media.store = new MediaClass(cms.api.tina);
|
|
2672
2710
|
}
|
|
2711
|
+
} else {
|
|
2712
|
+
cms.media.store = new DummyMediaStore();
|
|
2673
2713
|
}
|
|
2674
2714
|
};
|
|
2675
2715
|
const handleListBranches = async () => {
|
|
@@ -2685,15 +2725,15 @@ const TinaCloudProvider = (props) => {
|
|
|
2685
2725
|
return newBranch;
|
|
2686
2726
|
};
|
|
2687
2727
|
setupMedia();
|
|
2688
|
-
const [branchingEnabled, setBranchingEnabled] =
|
|
2689
|
-
|
|
2728
|
+
const [branchingEnabled, setBranchingEnabled] = React.useState(() => cms.flags.get("branch-switcher"));
|
|
2729
|
+
React.useEffect(() => {
|
|
2690
2730
|
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
2691
2731
|
if (key === "branch-switcher") {
|
|
2692
2732
|
setBranchingEnabled(value);
|
|
2693
2733
|
}
|
|
2694
2734
|
});
|
|
2695
2735
|
}, [cms.events]);
|
|
2696
|
-
|
|
2736
|
+
React.useEffect(() => {
|
|
2697
2737
|
let branchSwitcher;
|
|
2698
2738
|
if (branchingEnabled) {
|
|
2699
2739
|
branchSwitcher = new BranchSwitcherPlugin({
|
|
@@ -2708,24 +2748,25 @@ const TinaCloudProvider = (props) => {
|
|
|
2708
2748
|
}
|
|
2709
2749
|
};
|
|
2710
2750
|
}, [branchingEnabled, props.branch]);
|
|
2711
|
-
|
|
2751
|
+
React.useEffect(() => {
|
|
2712
2752
|
if (props.cmsCallback) {
|
|
2713
2753
|
props.cmsCallback(cms);
|
|
2714
2754
|
}
|
|
2715
2755
|
}, []);
|
|
2716
|
-
return /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ React.createElement(BranchDataProvider, {
|
|
2717
2757
|
currentBranch,
|
|
2718
2758
|
setCurrentBranch: (b) => {
|
|
2719
2759
|
setCurrentBranch(b);
|
|
2720
2760
|
}
|
|
2721
|
-
}, /* @__PURE__ */
|
|
2761
|
+
}, /* @__PURE__ */ React.createElement(TinaProvider, {
|
|
2722
2762
|
cms
|
|
2723
|
-
}, /* @__PURE__ */
|
|
2763
|
+
}, /* @__PURE__ */ React.createElement(AuthWallInner, {
|
|
2764
|
+
...props,
|
|
2724
2765
|
cms
|
|
2725
|
-
})))
|
|
2766
|
+
})));
|
|
2726
2767
|
};
|
|
2727
2768
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2728
|
-
var styles = `.tina-tailwind {
|
|
2769
|
+
var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
2729
2770
|
line-height: 1.5;
|
|
2730
2771
|
-webkit-text-size-adjust: 100%;
|
|
2731
2772
|
-moz-tab-size: 4;
|
|
@@ -2950,6 +2991,54 @@ var styles = `.tina-tailwind {
|
|
|
2950
2991
|
display: none;
|
|
2951
2992
|
}
|
|
2952
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;
|
|
2953
3042
|
--tw-translate-x: 0;
|
|
2954
3043
|
--tw-translate-y: 0;
|
|
2955
3044
|
--tw-rotate: 0;
|
|
@@ -3294,14 +3383,17 @@ var styles = `.tina-tailwind {
|
|
|
3294
3383
|
}
|
|
3295
3384
|
.tina-tailwind .from-blue-900 {
|
|
3296
3385
|
--tw-gradient-from: #1D2C6C;
|
|
3297
|
-
--tw-gradient-
|
|
3386
|
+
--tw-gradient-to: rgb(29 44 108 / 0);
|
|
3387
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3298
3388
|
}
|
|
3299
3389
|
.tina-tailwind .from-gray-800 {
|
|
3300
3390
|
--tw-gradient-from: #363145;
|
|
3301
|
-
--tw-gradient-
|
|
3391
|
+
--tw-gradient-to: rgb(54 49 69 / 0);
|
|
3392
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3302
3393
|
}
|
|
3303
3394
|
.tina-tailwind .via-gray-900 {
|
|
3304
|
-
--tw-gradient-
|
|
3395
|
+
--tw-gradient-to: rgb(37 35 54 / 0);
|
|
3396
|
+
--tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to);
|
|
3305
3397
|
}
|
|
3306
3398
|
.tina-tailwind .to-gray-900 {
|
|
3307
3399
|
--tw-gradient-to: #252336;
|
|
@@ -3603,7 +3695,7 @@ var styles = `.tina-tailwind {
|
|
|
3603
3695
|
--tw-ring-opacity: 1;
|
|
3604
3696
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3605
3697
|
}
|
|
3606
|
-
|
|
3698
|
+
`)();
|
|
3607
3699
|
class ContentCreatorPlugin {
|
|
3608
3700
|
constructor(options) {
|
|
3609
3701
|
this.__type = "content-creator";
|
|
@@ -3652,9 +3744,9 @@ class ContentCreatorPlugin {
|
|
|
3652
3744
|
}
|
|
3653
3745
|
const useDocumentCreatorPlugin = (args) => {
|
|
3654
3746
|
const cms = useCMS();
|
|
3655
|
-
const [values, setValues] =
|
|
3656
|
-
const [plugin, setPlugin] =
|
|
3657
|
-
|
|
3747
|
+
const [values, setValues] = React.useState({});
|
|
3748
|
+
const [plugin, setPlugin] = React.useState(null);
|
|
3749
|
+
React.useEffect(() => {
|
|
3658
3750
|
const run = async () => {
|
|
3659
3751
|
var _a;
|
|
3660
3752
|
const res = await cms.api.tina.request((gql2) => gql2`
|
|
@@ -3755,7 +3847,7 @@ const useDocumentCreatorPlugin = (args) => {
|
|
|
3755
3847
|
};
|
|
3756
3848
|
run();
|
|
3757
3849
|
}, [cms]);
|
|
3758
|
-
|
|
3850
|
+
React.useEffect(() => {
|
|
3759
3851
|
if (plugin) {
|
|
3760
3852
|
cms.plugins.add(plugin);
|
|
3761
3853
|
}
|
|
@@ -3776,10 +3868,10 @@ function useTina({
|
|
|
3776
3868
|
state,
|
|
3777
3869
|
isDummyContainer,
|
|
3778
3870
|
isLoading: contextLoading
|
|
3779
|
-
} =
|
|
3871
|
+
} = React.useContext(TinaDataContext);
|
|
3780
3872
|
const [waitForContextRerender, setWaitForContextRerender] = useState(!isDummyContainer);
|
|
3781
3873
|
const isLoading = contextLoading || waitForContextRerender;
|
|
3782
|
-
|
|
3874
|
+
React.useEffect(() => {
|
|
3783
3875
|
setRequest({ query, variables });
|
|
3784
3876
|
}, [JSON.stringify(variables), query]);
|
|
3785
3877
|
useEffect(() => {
|
|
@@ -3831,7 +3923,7 @@ const errorButtonStyles = {
|
|
|
3831
3923
|
color: "white",
|
|
3832
3924
|
margin: "1rem 0"
|
|
3833
3925
|
};
|
|
3834
|
-
class ErrorBoundary extends
|
|
3926
|
+
class ErrorBoundary extends React.Component {
|
|
3835
3927
|
constructor(props) {
|
|
3836
3928
|
super(props);
|
|
3837
3929
|
this.state = {
|
|
@@ -3847,7 +3939,7 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3847
3939
|
const branchData = window.localStorage && window.localStorage.getItem("tinacms-current-branch");
|
|
3848
3940
|
const hasBranchData = branchData && branchData.length > 0;
|
|
3849
3941
|
if (this.state.hasError && !this.state.pageRefresh) {
|
|
3850
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3851
3943
|
style: {
|
|
3852
3944
|
background: "#efefef",
|
|
3853
3945
|
height: "100vh",
|
|
@@ -3855,7 +3947,7 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3855
3947
|
alignItems: "center",
|
|
3856
3948
|
justifyContent: "center"
|
|
3857
3949
|
}
|
|
3858
|
-
}, /* @__PURE__ */
|
|
3950
|
+
}, /* @__PURE__ */ React.createElement("style", null, " body { margin: 0; } "), /* @__PURE__ */ React.createElement("div", {
|
|
3859
3951
|
style: {
|
|
3860
3952
|
background: "#fff",
|
|
3861
3953
|
maxWidth: "400px",
|
|
@@ -3864,27 +3956,27 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3864
3956
|
borderRadius: "5px",
|
|
3865
3957
|
boxShadow: "0 6px 24px rgb(0 37 91 / 5%), 0 2px 4px rgb(0 37 91 / 3%)"
|
|
3866
3958
|
}
|
|
3867
|
-
}, /* @__PURE__ */
|
|
3959
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
3868
3960
|
style: { color: "#eb6337" }
|
|
3869
|
-
}, "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", {
|
|
3870
3962
|
style: { marginTop: "1rem", overflowX: "auto" }
|
|
3871
|
-
}, 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", {
|
|
3872
3964
|
className: "text-gray-600",
|
|
3873
3965
|
style: { textDecoration: "underline" },
|
|
3874
3966
|
href: "https://tina.io/docs/errors/faq/",
|
|
3875
3967
|
target: "_blank"
|
|
3876
|
-
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */
|
|
3968
|
+
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */ React.createElement("button", {
|
|
3877
3969
|
style: errorButtonStyles,
|
|
3878
3970
|
onClick: () => {
|
|
3879
3971
|
this.setState({ pageRefresh: true });
|
|
3880
3972
|
setTimeout(() => this.setState({ hasError: false, pageRefresh: false }), 3e3);
|
|
3881
3973
|
}
|
|
3882
|
-
}, "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", {
|
|
3883
3975
|
className: "text-gray-600",
|
|
3884
3976
|
style: { textDecoration: "underline" },
|
|
3885
3977
|
href: "https://tina.io/docs/errors/faq/",
|
|
3886
3978
|
target: "_blank"
|
|
3887
|
-
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */
|
|
3979
|
+
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */ React.createElement("button", {
|
|
3888
3980
|
style: errorButtonStyles,
|
|
3889
3981
|
onClick: () => {
|
|
3890
3982
|
window.localStorage.removeItem("tinacms-current-branch");
|
|
@@ -3893,23 +3985,18 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3893
3985
|
}, "Switch to default branch"))));
|
|
3894
3986
|
}
|
|
3895
3987
|
if (this.state.pageRefresh) {
|
|
3896
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ React.createElement(Loader, null, "Let's try that again.");
|
|
3897
3989
|
}
|
|
3898
3990
|
return this.props.children;
|
|
3899
3991
|
}
|
|
3900
3992
|
}
|
|
3901
|
-
const TinaCMSProvider2 = (
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
"query",
|
|
3909
|
-
"documentCreatorCallback",
|
|
3910
|
-
"formifyCallback",
|
|
3911
|
-
"schema"
|
|
3912
|
-
]);
|
|
3993
|
+
const TinaCMSProvider2 = ({
|
|
3994
|
+
query,
|
|
3995
|
+
documentCreatorCallback,
|
|
3996
|
+
formifyCallback,
|
|
3997
|
+
schema,
|
|
3998
|
+
...props
|
|
3999
|
+
}) => {
|
|
3913
4000
|
var _a;
|
|
3914
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);
|
|
3915
4002
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
@@ -3924,7 +4011,7 @@ const TinaCMSProvider2 = (_c) => {
|
|
|
3924
4011
|
if (!schema) {
|
|
3925
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");
|
|
3926
4013
|
}
|
|
3927
|
-
return /* @__PURE__ */
|
|
4014
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TinaCloudProvider, {
|
|
3928
4015
|
branch,
|
|
3929
4016
|
clientId,
|
|
3930
4017
|
tinaioConfig: props.tinaioConfig,
|
|
@@ -3932,17 +4019,18 @@ const TinaCMSProvider2 = (_c) => {
|
|
|
3932
4019
|
cmsCallback: props.cmsCallback,
|
|
3933
4020
|
mediaStore: props.mediaStore,
|
|
3934
4021
|
schema
|
|
3935
|
-
}, /* @__PURE__ */
|
|
4022
|
+
}, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(DocumentCreator, {
|
|
3936
4023
|
documentCreatorCallback
|
|
3937
|
-
}), /* @__PURE__ */
|
|
4024
|
+
}), /* @__PURE__ */ React.createElement(TinaDataProvider, {
|
|
3938
4025
|
formifyCallback
|
|
3939
|
-
}, typeof props.children == "function" ? /* @__PURE__ */
|
|
4026
|
+
}, typeof props.children == "function" ? /* @__PURE__ */ React.createElement(TinaQuery, {
|
|
4027
|
+
...props,
|
|
3940
4028
|
variables: props.variables,
|
|
3941
4029
|
data: props.data,
|
|
3942
4030
|
query,
|
|
3943
4031
|
formifyCallback,
|
|
3944
4032
|
children: props.children
|
|
3945
|
-
})
|
|
4033
|
+
}) : props.children))));
|
|
3946
4034
|
};
|
|
3947
4035
|
const DocumentCreator = ({
|
|
3948
4036
|
documentCreatorCallback
|
|
@@ -3951,35 +4039,35 @@ const DocumentCreator = ({
|
|
|
3951
4039
|
return null;
|
|
3952
4040
|
};
|
|
3953
4041
|
const TinaQuery = (props) => {
|
|
3954
|
-
return /* @__PURE__ */
|
|
3955
|
-
key: `rootQuery-${props.query}
|
|
3956
|
-
|
|
4042
|
+
return /* @__PURE__ */ React.createElement(TinaQueryInner, {
|
|
4043
|
+
key: `rootQuery-${props.query}`,
|
|
4044
|
+
...props
|
|
4045
|
+
});
|
|
3957
4046
|
};
|
|
3958
|
-
const TinaQueryInner = (
|
|
3959
|
-
var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
|
|
4047
|
+
const TinaQueryInner = ({ children, ...props }) => {
|
|
3960
4048
|
const { data: liveData, isLoading } = useTina({
|
|
3961
4049
|
query: props.query,
|
|
3962
4050
|
variables: props.variables,
|
|
3963
4051
|
data: props.data
|
|
3964
4052
|
});
|
|
3965
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(isLoading || !props.query ? props : { ...props, data: liveData }));
|
|
3966
4054
|
};
|
|
3967
4055
|
const TinaDataProvider = ({
|
|
3968
4056
|
children,
|
|
3969
4057
|
formifyCallback
|
|
3970
4058
|
}) => {
|
|
3971
4059
|
const [request, setRequest] = useState();
|
|
3972
|
-
const [state, setState] =
|
|
4060
|
+
const [state, setState] = React.useState({
|
|
3973
4061
|
payload: void 0,
|
|
3974
4062
|
isLoading: true
|
|
3975
4063
|
});
|
|
3976
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ React.createElement(TinaDataContext.Provider, {
|
|
3977
4065
|
value: {
|
|
3978
4066
|
setRequest,
|
|
3979
4067
|
isLoading: state.isLoading,
|
|
3980
4068
|
state: { payload: state.payload }
|
|
3981
4069
|
}
|
|
3982
|
-
}, /* @__PURE__ */
|
|
4070
|
+
}, /* @__PURE__ */ React.createElement(FormRegistrar, {
|
|
3983
4071
|
key: request == null ? void 0 : request.query,
|
|
3984
4072
|
request,
|
|
3985
4073
|
formifyCallback,
|
|
@@ -4003,13 +4091,13 @@ const FormRegistrar = ({
|
|
|
4003
4091
|
}
|
|
4004
4092
|
}
|
|
4005
4093
|
});
|
|
4006
|
-
|
|
4094
|
+
React.useEffect(() => {
|
|
4007
4095
|
onPayloadStateChange({ payload, isLoading });
|
|
4008
4096
|
}, [JSON.stringify(payload), isLoading]);
|
|
4009
|
-
return isLoading ? /* @__PURE__ */
|
|
4097
|
+
return isLoading ? /* @__PURE__ */ React.createElement(Loader, null, /* @__PURE__ */ React.createElement(React.Fragment, null)) : null;
|
|
4010
4098
|
};
|
|
4011
4099
|
const Loader = (props) => {
|
|
4012
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4013
4101
|
style: {
|
|
4014
4102
|
position: "fixed",
|
|
4015
4103
|
background: "rgba(0, 0, 0, 0.5)",
|
|
@@ -4021,7 +4109,7 @@ const Loader = (props) => {
|
|
|
4021
4109
|
justifyContent: "center",
|
|
4022
4110
|
padding: "40px"
|
|
4023
4111
|
}
|
|
4024
|
-
}, /* @__PURE__ */
|
|
4112
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4025
4113
|
style: {
|
|
4026
4114
|
background: "#f6f6f9",
|
|
4027
4115
|
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
@@ -4034,7 +4122,7 @@ const Loader = (props) => {
|
|
|
4034
4122
|
justifyContent: "center",
|
|
4035
4123
|
flexDirection: "column"
|
|
4036
4124
|
}
|
|
4037
|
-
}, /* @__PURE__ */
|
|
4125
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4038
4126
|
style: {
|
|
4039
4127
|
width: "64px",
|
|
4040
4128
|
color: "#2296fe",
|
|
@@ -4050,13 +4138,13 @@ const Loader = (props) => {
|
|
|
4050
4138
|
viewBox: "0 0 100 64",
|
|
4051
4139
|
enableBackground: "new 0 0 0 0",
|
|
4052
4140
|
xmlSpace: "preserve"
|
|
4053
|
-
}, /* @__PURE__ */
|
|
4141
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4054
4142
|
fill: "currentColor",
|
|
4055
4143
|
stroke: "none",
|
|
4056
4144
|
cx: 6,
|
|
4057
4145
|
cy: 32,
|
|
4058
4146
|
r: 6
|
|
4059
|
-
}, /* @__PURE__ */
|
|
4147
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4060
4148
|
attributeName: "transform",
|
|
4061
4149
|
dur: "1s",
|
|
4062
4150
|
type: "translate",
|
|
@@ -4065,13 +4153,13 @@ const Loader = (props) => {
|
|
|
4065
4153
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4066
4154
|
repeatCount: "indefinite",
|
|
4067
4155
|
begin: "0.1"
|
|
4068
|
-
})), /* @__PURE__ */
|
|
4156
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4069
4157
|
fill: "currentColor",
|
|
4070
4158
|
stroke: "none",
|
|
4071
4159
|
cx: 30,
|
|
4072
4160
|
cy: 32,
|
|
4073
4161
|
r: 6
|
|
4074
|
-
}, /* @__PURE__ */
|
|
4162
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4075
4163
|
attributeName: "transform",
|
|
4076
4164
|
dur: "1s",
|
|
4077
4165
|
type: "translate",
|
|
@@ -4080,13 +4168,13 @@ const Loader = (props) => {
|
|
|
4080
4168
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4081
4169
|
repeatCount: "indefinite",
|
|
4082
4170
|
begin: "0.2"
|
|
4083
|
-
})), /* @__PURE__ */
|
|
4171
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4084
4172
|
fill: "currentColor",
|
|
4085
4173
|
stroke: "none",
|
|
4086
4174
|
cx: 54,
|
|
4087
4175
|
cy: 32,
|
|
4088
4176
|
r: 6
|
|
4089
|
-
}, /* @__PURE__ */
|
|
4177
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4090
4178
|
attributeName: "transform",
|
|
4091
4179
|
dur: "1s",
|
|
4092
4180
|
type: "translate",
|
|
@@ -4095,7 +4183,7 @@ const Loader = (props) => {
|
|
|
4095
4183
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4096
4184
|
repeatCount: "indefinite",
|
|
4097
4185
|
begin: "0.3"
|
|
4098
|
-
}))), /* @__PURE__ */
|
|
4186
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
4099
4187
|
style: {
|
|
4100
4188
|
fontSize: "18px",
|
|
4101
4189
|
color: "#252336",
|
|
@@ -4152,7 +4240,7 @@ function gql(strings, ...args) {
|
|
|
4152
4240
|
return str;
|
|
4153
4241
|
}
|
|
4154
4242
|
const Layout = ({ children }) => {
|
|
4155
|
-
return /* @__PURE__ */
|
|
4243
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement("div", {
|
|
4156
4244
|
className: "tina-tailwind",
|
|
4157
4245
|
style: {
|
|
4158
4246
|
position: "fixed",
|
|
@@ -4174,8 +4262,8 @@ var DefaultContext = {
|
|
|
4174
4262
|
style: void 0,
|
|
4175
4263
|
attr: void 0
|
|
4176
4264
|
};
|
|
4177
|
-
var IconContext =
|
|
4178
|
-
var __assign = function() {
|
|
4265
|
+
var IconContext = React.createContext && React.createContext(DefaultContext);
|
|
4266
|
+
var __assign = globalThis && globalThis.__assign || function() {
|
|
4179
4267
|
__assign = Object.assign || function(t) {
|
|
4180
4268
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4181
4269
|
s = arguments[i];
|
|
@@ -4187,7 +4275,7 @@ var __assign = function() {
|
|
|
4187
4275
|
};
|
|
4188
4276
|
return __assign.apply(this, arguments);
|
|
4189
4277
|
};
|
|
4190
|
-
var __rest = function(s, e) {
|
|
4278
|
+
var __rest = globalThis && globalThis.__rest || function(s, e) {
|
|
4191
4279
|
var t = {};
|
|
4192
4280
|
for (var p in s)
|
|
4193
4281
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -4201,14 +4289,14 @@ var __rest = function(s, e) {
|
|
|
4201
4289
|
};
|
|
4202
4290
|
function Tree2Element(tree) {
|
|
4203
4291
|
return tree && tree.map(function(node2, i) {
|
|
4204
|
-
return
|
|
4292
|
+
return React.createElement(node2.tag, __assign({
|
|
4205
4293
|
key: i
|
|
4206
4294
|
}, node2.attr), Tree2Element(node2.child));
|
|
4207
4295
|
});
|
|
4208
4296
|
}
|
|
4209
4297
|
function GenIcon(data) {
|
|
4210
4298
|
return function(props) {
|
|
4211
|
-
return
|
|
4299
|
+
return React.createElement(IconBase, __assign({
|
|
4212
4300
|
attr: __assign({}, data.attr)
|
|
4213
4301
|
}, props), Tree2Element(data.child));
|
|
4214
4302
|
};
|
|
@@ -4222,7 +4310,7 @@ function IconBase(props) {
|
|
|
4222
4310
|
className = conf.className;
|
|
4223
4311
|
if (props.className)
|
|
4224
4312
|
className = (className ? className + " " : "") + props.className;
|
|
4225
|
-
return
|
|
4313
|
+
return React.createElement("svg", __assign({
|
|
4226
4314
|
stroke: "currentColor",
|
|
4227
4315
|
fill: "currentColor",
|
|
4228
4316
|
strokeWidth: "0"
|
|
@@ -4234,9 +4322,9 @@ function IconBase(props) {
|
|
|
4234
4322
|
height: computedSize,
|
|
4235
4323
|
width: computedSize,
|
|
4236
4324
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4237
|
-
}), title &&
|
|
4325
|
+
}), title && React.createElement("title", null, title), props.children);
|
|
4238
4326
|
};
|
|
4239
|
-
return IconContext !== void 0 ?
|
|
4327
|
+
return IconContext !== void 0 ? React.createElement(IconContext.Consumer, null, function(conf) {
|
|
4240
4328
|
return elem(conf);
|
|
4241
4329
|
}) : elem(DefaultContext);
|
|
4242
4330
|
}
|
|
@@ -4274,9 +4362,6 @@ function IoMdClose(props) {
|
|
|
4274
4362
|
function BiEdit(props) {
|
|
4275
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);
|
|
4276
4364
|
}
|
|
4277
|
-
function BiLeftArrowAlt(props) {
|
|
4278
|
-
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);
|
|
4279
|
-
}
|
|
4280
4365
|
function BiLogIn(props) {
|
|
4281
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);
|
|
4282
4367
|
}
|
|
@@ -4289,9 +4374,6 @@ function BiMenu(props) {
|
|
|
4289
4374
|
function BiPlus(props) {
|
|
4290
4375
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z" } }] })(props);
|
|
4291
4376
|
}
|
|
4292
|
-
function BiRightArrowAlt(props) {
|
|
4293
|
-
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);
|
|
4294
|
-
}
|
|
4295
4377
|
function BiTrash(props) {
|
|
4296
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);
|
|
4297
4379
|
}
|
|
@@ -4302,47 +4384,47 @@ const Sidebar = ({ cms }) => {
|
|
|
4302
4384
|
var _a, _b;
|
|
4303
4385
|
const collectionsInfo = useGetCollections(cms);
|
|
4304
4386
|
const screens = cms.plugins.getType("screen").all();
|
|
4305
|
-
const [menuIsOpen, setMenuIsOpen] =
|
|
4387
|
+
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
4306
4388
|
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
4307
4389
|
const navBreakpoint = 1e3;
|
|
4308
4390
|
const windowWidth = useWindowWidth();
|
|
4309
4391
|
const renderDesktopNav = windowWidth > navBreakpoint;
|
|
4310
|
-
return /* @__PURE__ */
|
|
4392
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderDesktopNav && /* @__PURE__ */ React.createElement(Nav, {
|
|
4311
4393
|
sidebarWidth: 360,
|
|
4312
4394
|
showCollections: true,
|
|
4313
4395
|
collectionsInfo,
|
|
4314
4396
|
screens,
|
|
4315
4397
|
contentCreators: [],
|
|
4316
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */
|
|
4398
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4317
4399
|
label: view.name,
|
|
4318
4400
|
to: `screens/${slugify(view.name)}`,
|
|
4319
4401
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4320
4402
|
}),
|
|
4321
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */
|
|
4403
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4322
4404
|
label: collection.label ? collection.label : collection.name,
|
|
4323
4405
|
to: `collections/${collection.name}`,
|
|
4324
4406
|
Icon: ImFilesEmpty
|
|
4325
4407
|
})
|
|
4326
|
-
}), !renderDesktopNav && /* @__PURE__ */
|
|
4408
|
+
}), !renderDesktopNav && /* @__PURE__ */ React.createElement(Transition, {
|
|
4327
4409
|
show: menuIsOpen
|
|
4328
|
-
}, /* @__PURE__ */
|
|
4329
|
-
as:
|
|
4410
|
+
}, /* @__PURE__ */ React.createElement(Transition.Child, {
|
|
4411
|
+
as: React.Fragment,
|
|
4330
4412
|
enter: "transform transition-all ease-out duration-300",
|
|
4331
4413
|
enterFrom: "opacity-0 -translate-x-full",
|
|
4332
4414
|
enterTo: "opacity-100 translate-x-0",
|
|
4333
4415
|
leave: "transform transition-all ease-in duration-200",
|
|
4334
4416
|
leaveFrom: "opacity-100 translate-x-0",
|
|
4335
4417
|
leaveTo: "opacity-0 -translate-x-full"
|
|
4336
|
-
}, /* @__PURE__ */
|
|
4418
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4337
4419
|
className: "fixed left-0 top-0 z-overlay h-full transform"
|
|
4338
|
-
}, /* @__PURE__ */
|
|
4420
|
+
}, /* @__PURE__ */ React.createElement(Nav, {
|
|
4339
4421
|
className: "rounded-r-md",
|
|
4340
4422
|
sidebarWidth: 360,
|
|
4341
4423
|
showCollections: true,
|
|
4342
4424
|
collectionsInfo,
|
|
4343
4425
|
screens,
|
|
4344
4426
|
contentCreators: [],
|
|
4345
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */
|
|
4427
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4346
4428
|
label: view.name,
|
|
4347
4429
|
to: `screens/${slugify(view.name)}`,
|
|
4348
4430
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
@@ -4350,7 +4432,7 @@ const Sidebar = ({ cms }) => {
|
|
|
4350
4432
|
setMenuIsOpen(false);
|
|
4351
4433
|
}
|
|
4352
4434
|
}),
|
|
4353
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */
|
|
4435
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4354
4436
|
label: collection.label ? collection.label : collection.name,
|
|
4355
4437
|
to: `collections/${collection.name}`,
|
|
4356
4438
|
Icon: ImFilesEmpty,
|
|
@@ -4358,19 +4440,19 @@ const Sidebar = ({ cms }) => {
|
|
|
4358
4440
|
setMenuIsOpen(false);
|
|
4359
4441
|
}
|
|
4360
4442
|
})
|
|
4361
|
-
}, /* @__PURE__ */
|
|
4443
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4362
4444
|
className: "absolute top-8 right-0 transform translate-x-full overflow-hidden"
|
|
4363
|
-
}, /* @__PURE__ */
|
|
4445
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4364
4446
|
rounded: "right",
|
|
4365
4447
|
variant: "secondary",
|
|
4366
4448
|
onClick: () => {
|
|
4367
4449
|
setMenuIsOpen(false);
|
|
4368
4450
|
},
|
|
4369
4451
|
className: `transition-opacity duration-150 ease-out`
|
|
4370
|
-
}, /* @__PURE__ */
|
|
4452
|
+
}, /* @__PURE__ */ React.createElement(IoMdClose, {
|
|
4371
4453
|
className: "h-6 w-auto"
|
|
4372
|
-
})))))), /* @__PURE__ */
|
|
4373
|
-
as:
|
|
4454
|
+
})))))), /* @__PURE__ */ React.createElement(Transition.Child, {
|
|
4455
|
+
as: React.Fragment,
|
|
4374
4456
|
enter: "ease-out duration-300",
|
|
4375
4457
|
enterFrom: "opacity-0",
|
|
4376
4458
|
enterTo: "opacity-80",
|
|
@@ -4378,39 +4460,39 @@ const Sidebar = ({ cms }) => {
|
|
|
4378
4460
|
leave: "ease-in duration-200",
|
|
4379
4461
|
leaveFrom: "opacity-80",
|
|
4380
4462
|
leaveTo: "opacity-0"
|
|
4381
|
-
}, /* @__PURE__ */
|
|
4463
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4382
4464
|
onClick: () => {
|
|
4383
4465
|
setMenuIsOpen(false);
|
|
4384
4466
|
},
|
|
4385
4467
|
className: "fixed z-menu inset-0 bg-gradient-to-br from-gray-800 via-gray-900 to-black"
|
|
4386
|
-
}))), !renderDesktopNav && /* @__PURE__ */
|
|
4468
|
+
}))), !renderDesktopNav && /* @__PURE__ */ React.createElement(Button, {
|
|
4387
4469
|
rounded: "right",
|
|
4388
4470
|
variant: "secondary",
|
|
4389
4471
|
onClick: () => {
|
|
4390
4472
|
setMenuIsOpen(true);
|
|
4391
4473
|
},
|
|
4392
4474
|
className: `pointer-events-auto -ml-px absolute left-0 z-50 ${isLocalMode ? `top-10` : `top-4`}`
|
|
4393
|
-
}, /* @__PURE__ */
|
|
4475
|
+
}, /* @__PURE__ */ React.createElement(BiMenu, {
|
|
4394
4476
|
className: "h-7 w-auto"
|
|
4395
4477
|
})));
|
|
4396
4478
|
};
|
|
4397
4479
|
const SidebarLink = (props) => {
|
|
4398
4480
|
const { to, label, Icon } = props;
|
|
4399
|
-
return /* @__PURE__ */
|
|
4481
|
+
return /* @__PURE__ */ React.createElement(NavLink, {
|
|
4400
4482
|
className: ({ isActive }) => {
|
|
4401
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`;
|
|
4402
4484
|
},
|
|
4403
4485
|
onClick: props.onClick ? props.onClick : () => {
|
|
4404
4486
|
},
|
|
4405
4487
|
to
|
|
4406
|
-
}, /* @__PURE__ */
|
|
4488
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4407
4489
|
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4408
4490
|
}), " ", label);
|
|
4409
4491
|
};
|
|
4410
4492
|
const GetCMS = ({ children }) => {
|
|
4411
4493
|
try {
|
|
4412
4494
|
const cms = useCMS();
|
|
4413
|
-
return /* @__PURE__ */
|
|
4495
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
|
|
4414
4496
|
} catch (e) {
|
|
4415
4497
|
return null;
|
|
4416
4498
|
}
|
|
@@ -4422,52 +4504,52 @@ const AuthTemplate = ({
|
|
|
4422
4504
|
message,
|
|
4423
4505
|
children
|
|
4424
4506
|
}) => {
|
|
4425
|
-
return /* @__PURE__ */
|
|
4507
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4426
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"
|
|
4427
|
-
}, /* @__PURE__ */
|
|
4509
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4428
4510
|
className: "bg-white rounded-lg overflow-hidden shadow-lg w-full max-w-lg"
|
|
4429
|
-
}, /* @__PURE__ */
|
|
4511
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4430
4512
|
className: "px-5 py-4 border-b border-gray-150"
|
|
4431
|
-
}, /* @__PURE__ */
|
|
4513
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
4432
4514
|
className: "text-2xl font-sans tracking-wide text-gray-700 flex items-center gap-0.5"
|
|
4433
|
-
}, /* @__PURE__ */
|
|
4515
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4434
4516
|
viewBox: "0 0 32 32",
|
|
4435
4517
|
fill: "#EC4815",
|
|
4436
4518
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4437
4519
|
className: "w-10 h-auto"
|
|
4438
|
-
}, /* @__PURE__ */
|
|
4520
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
4439
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"
|
|
4440
|
-
}), /* @__PURE__ */
|
|
4522
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
4441
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"
|
|
4442
|
-
})), /* @__PURE__ */
|
|
4524
|
+
})), /* @__PURE__ */ React.createElement("span", null, "Tina"))), message && /* @__PURE__ */ React.createElement("div", {
|
|
4443
4525
|
className: "px-5 pt-4"
|
|
4444
|
-
}, /* @__PURE__ */
|
|
4526
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
4445
4527
|
className: "text-base font-sans leading-normal"
|
|
4446
|
-
}, message)), /* @__PURE__ */
|
|
4528
|
+
}, message)), /* @__PURE__ */ React.createElement("div", {
|
|
4447
4529
|
className: "px-5 py-4 flex gap-4 w-full justify-between"
|
|
4448
4530
|
}, children)));
|
|
4449
4531
|
};
|
|
4450
4532
|
const LoginPage = () => {
|
|
4451
4533
|
const { setEdit } = useEditState();
|
|
4452
4534
|
const login = () => setEdit(true);
|
|
4453
|
-
return /* @__PURE__ */
|
|
4535
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
4454
4536
|
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
4455
|
-
}, /* @__PURE__ */
|
|
4537
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4456
4538
|
onClick: () => {
|
|
4457
4539
|
window.location.href = "/";
|
|
4458
4540
|
},
|
|
4459
4541
|
variant: "white",
|
|
4460
4542
|
size: "custom",
|
|
4461
4543
|
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
4462
|
-
}, /* @__PURE__ */
|
|
4544
|
+
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
4463
4545
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4464
|
-
}), " Back To Site"), /* @__PURE__ */
|
|
4546
|
+
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
4465
4547
|
onClick: () => login(),
|
|
4466
4548
|
variant: "primary",
|
|
4467
4549
|
size: "custom",
|
|
4468
4550
|
className: "text-base h-12 px-6 flex-1",
|
|
4469
4551
|
type: "submit"
|
|
4470
|
-
}, /* @__PURE__ */
|
|
4552
|
+
}, /* @__PURE__ */ React.createElement(BiLogIn, {
|
|
4471
4553
|
className: "w-6 h-auto mr-2 opacity-80"
|
|
4472
4554
|
}), " Edit With Tina")));
|
|
4473
4555
|
};
|
|
@@ -4476,67 +4558,67 @@ const logout = () => {
|
|
|
4476
4558
|
window.location.href = "/";
|
|
4477
4559
|
};
|
|
4478
4560
|
const LogoutPage = () => {
|
|
4479
|
-
return /* @__PURE__ */
|
|
4561
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
4480
4562
|
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
4481
|
-
}, /* @__PURE__ */
|
|
4563
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4482
4564
|
onClick: () => {
|
|
4483
4565
|
window.location.href = "/";
|
|
4484
4566
|
},
|
|
4485
4567
|
variant: "white",
|
|
4486
4568
|
size: "custom",
|
|
4487
4569
|
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
4488
|
-
}, /* @__PURE__ */
|
|
4570
|
+
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
4489
4571
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4490
|
-
}), " Back To Site"), /* @__PURE__ */
|
|
4572
|
+
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
4491
4573
|
onClick: () => logout(),
|
|
4492
4574
|
type: "submit",
|
|
4493
4575
|
variant: "primary",
|
|
4494
4576
|
size: "custom",
|
|
4495
4577
|
className: "text-base h-12 px-6 flex-1"
|
|
4496
|
-
}, /* @__PURE__ */
|
|
4578
|
+
}, /* @__PURE__ */ React.createElement(BiLogOut, {
|
|
4497
4579
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4498
4580
|
}), " Log Out of Tina")));
|
|
4499
4581
|
};
|
|
4500
4582
|
const PageWrapper = ({
|
|
4501
4583
|
children
|
|
4502
4584
|
}) => {
|
|
4503
|
-
return /* @__PURE__ */
|
|
4585
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4504
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"
|
|
4505
4587
|
}, children);
|
|
4506
4588
|
};
|
|
4507
4589
|
const PageHeader = ({
|
|
4508
4590
|
isLocalMode,
|
|
4509
4591
|
children
|
|
4510
|
-
}) => /* @__PURE__ */
|
|
4592
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
4511
4593
|
className: "bg-white pb-4 pt-18 border-b border-gray-200 px-12"
|
|
4512
|
-
}, /* @__PURE__ */
|
|
4594
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4513
4595
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4514
|
-
}, /* @__PURE__ */
|
|
4596
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4515
4597
|
className: "w-full flex justify-between items-end"
|
|
4516
4598
|
}, children))));
|
|
4517
4599
|
const PageBody = ({
|
|
4518
4600
|
children
|
|
4519
|
-
}) => /* @__PURE__ */
|
|
4601
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4520
4602
|
className: "py-10 px-12"
|
|
4521
4603
|
}, children);
|
|
4522
4604
|
const PageBodyNarrow = ({
|
|
4523
4605
|
children
|
|
4524
|
-
}) => /* @__PURE__ */
|
|
4606
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4525
4607
|
className: "py-10 px-12"
|
|
4526
|
-
}, /* @__PURE__ */
|
|
4608
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4527
4609
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4528
4610
|
}, children));
|
|
4529
4611
|
const DashboardPage = () => {
|
|
4530
|
-
return /* @__PURE__ */
|
|
4612
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4531
4613
|
var _a, _b;
|
|
4532
|
-
return /* @__PURE__ */
|
|
4614
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, {
|
|
4533
4615
|
isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
4534
|
-
}, /* @__PURE__ */
|
|
4616
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
4535
4617
|
className: "text-2xl font-sans text-gray-700"
|
|
4536
|
-
}, "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.")));
|
|
4537
4619
|
});
|
|
4538
4620
|
};
|
|
4539
|
-
const LoadingPage = () => /* @__PURE__ */
|
|
4621
|
+
const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4540
4622
|
style: {
|
|
4541
4623
|
position: "absolute",
|
|
4542
4624
|
top: 0,
|
|
@@ -4550,7 +4632,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4550
4632
|
justifyContent: "center",
|
|
4551
4633
|
padding: "120px 40px 40px 40px"
|
|
4552
4634
|
}
|
|
4553
|
-
}, /* @__PURE__ */
|
|
4635
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4554
4636
|
style: {
|
|
4555
4637
|
background: "#FFF",
|
|
4556
4638
|
border: "1px solid #EDECF3",
|
|
@@ -4564,7 +4646,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4564
4646
|
justifyContent: "center",
|
|
4565
4647
|
flexDirection: "column"
|
|
4566
4648
|
}
|
|
4567
|
-
}, /* @__PURE__ */
|
|
4649
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4568
4650
|
style: {
|
|
4569
4651
|
width: "64px",
|
|
4570
4652
|
color: "#2296fe",
|
|
@@ -4580,13 +4662,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4580
4662
|
viewBox: "0 0 100 64",
|
|
4581
4663
|
enableBackground: "new 0 0 0 0",
|
|
4582
4664
|
xmlSpace: "preserve"
|
|
4583
|
-
}, /* @__PURE__ */
|
|
4665
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4584
4666
|
fill: "currentColor",
|
|
4585
4667
|
stroke: "none",
|
|
4586
4668
|
cx: 6,
|
|
4587
4669
|
cy: 32,
|
|
4588
4670
|
r: 6
|
|
4589
|
-
}, /* @__PURE__ */
|
|
4671
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4590
4672
|
attributeName: "transform",
|
|
4591
4673
|
dur: "1s",
|
|
4592
4674
|
type: "translate",
|
|
@@ -4595,13 +4677,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4595
4677
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4596
4678
|
repeatCount: "indefinite",
|
|
4597
4679
|
begin: "0.1"
|
|
4598
|
-
})), /* @__PURE__ */
|
|
4680
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4599
4681
|
fill: "currentColor",
|
|
4600
4682
|
stroke: "none",
|
|
4601
4683
|
cx: 30,
|
|
4602
4684
|
cy: 32,
|
|
4603
4685
|
r: 6
|
|
4604
|
-
}, /* @__PURE__ */
|
|
4686
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4605
4687
|
attributeName: "transform",
|
|
4606
4688
|
dur: "1s",
|
|
4607
4689
|
type: "translate",
|
|
@@ -4610,13 +4692,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4610
4692
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4611
4693
|
repeatCount: "indefinite",
|
|
4612
4694
|
begin: "0.2"
|
|
4613
|
-
})), /* @__PURE__ */
|
|
4695
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4614
4696
|
fill: "currentColor",
|
|
4615
4697
|
stroke: "none",
|
|
4616
4698
|
cx: 54,
|
|
4617
4699
|
cy: 32,
|
|
4618
4700
|
r: 6
|
|
4619
|
-
}, /* @__PURE__ */
|
|
4701
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4620
4702
|
attributeName: "transform",
|
|
4621
4703
|
dur: "1s",
|
|
4622
4704
|
type: "translate",
|
|
@@ -4625,7 +4707,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4625
4707
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4626
4708
|
repeatCount: "indefinite",
|
|
4627
4709
|
begin: "0.3"
|
|
4628
|
-
}))), /* @__PURE__ */
|
|
4710
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
4629
4711
|
style: {
|
|
4630
4712
|
fontSize: "16px",
|
|
4631
4713
|
color: "#716c7f",
|
|
@@ -4674,161 +4756,19 @@ const GetCollection = ({
|
|
|
4674
4756
|
return null;
|
|
4675
4757
|
}
|
|
4676
4758
|
if (loading) {
|
|
4677
|
-
return /* @__PURE__ */
|
|
4759
|
+
return /* @__PURE__ */ React.createElement(LoadingPage, null);
|
|
4678
4760
|
}
|
|
4679
|
-
return /* @__PURE__ */
|
|
4761
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(collection, loading, reFetchCollection));
|
|
4680
4762
|
};
|
|
4681
|
-
const theme = css`
|
|
4682
|
-
:root {
|
|
4683
|
-
--tina-color-primary-light: #2296fe;
|
|
4684
|
-
--tina-color-primary: #0084ff;
|
|
4685
|
-
--tina-color-primary-dark: #0574e4;
|
|
4686
|
-
--tina-color-error-light: #eb6337;
|
|
4687
|
-
--tina-color-error: #ec4815;
|
|
4688
|
-
--tina-color-error-dark: #dc4419;
|
|
4689
|
-
--tina-color-warning-light: #f5e06e;
|
|
4690
|
-
--tina-color-warning: #e9d050;
|
|
4691
|
-
--tina-color-warning-dark: #d3ba38;
|
|
4692
|
-
--tina-color-success-light: #57c355;
|
|
4693
|
-
--tina-color-success: #3cad3a;
|
|
4694
|
-
--tina-color-success-dark: #249a21;
|
|
4695
|
-
--tina-color-grey-0: #ffffff;
|
|
4696
|
-
--tina-color-grey-1: #f6f6f9;
|
|
4697
|
-
--tina-color-grey-2: #edecf3;
|
|
4698
|
-
--tina-color-grey-3: #e1ddec;
|
|
4699
|
-
--tina-color-grey-4: #b2adbe;
|
|
4700
|
-
--tina-color-grey-5: #918c9e;
|
|
4701
|
-
--tina-color-grey-6: #716c7f;
|
|
4702
|
-
--tina-color-grey-7: #565165;
|
|
4703
|
-
--tina-color-grey-8: #433e52;
|
|
4704
|
-
--tina-color-grey-9: #363145;
|
|
4705
|
-
--tina-color-grey-10: #252336;
|
|
4706
|
-
--tina-color-indicator: var(--tina-color-primary);
|
|
4707
|
-
|
|
4708
|
-
--tina-radius-small: 5px;
|
|
4709
|
-
--tina-radius-big: 24px;
|
|
4710
|
-
|
|
4711
|
-
--tina-padding-small: 12px;
|
|
4712
|
-
--tina-padding-big: 20px;
|
|
4713
|
-
|
|
4714
|
-
--tina-font-size-0: 12px;
|
|
4715
|
-
--tina-font-size-1: 13px;
|
|
4716
|
-
--tina-font-size-2: 15px;
|
|
4717
|
-
--tina-font-size-3: 16px;
|
|
4718
|
-
--tina-font-size-4: 18px;
|
|
4719
|
-
--tina-font-size-5: 20px;
|
|
4720
|
-
--tina-font-size-6: 22px;
|
|
4721
|
-
--tina-font-size-7: 26px;
|
|
4722
|
-
--tina-font-size-8: 32px;
|
|
4723
|
-
|
|
4724
|
-
--tina-font-family: 'Inter', sans-serif;
|
|
4725
|
-
|
|
4726
|
-
--tina-font-weight-regular: 400;
|
|
4727
|
-
--tina-font-weight-bold: 600;
|
|
4728
|
-
|
|
4729
|
-
--tina-shadow-big: 0px 2px 3px rgba(0, 0, 0, 0.05),
|
|
4730
|
-
0 4px 12px rgba(0, 0, 0, 0.1);
|
|
4731
|
-
--tina-shadow-small: 0px 2px 3px rgba(0, 0, 0, 0.12);
|
|
4732
|
-
|
|
4733
|
-
--tina-timing-short: 85ms;
|
|
4734
|
-
--tina-timing-medium: 150ms;
|
|
4735
|
-
--tina-timing-long: 250ms;
|
|
4736
|
-
|
|
4737
|
-
--tina-z-index-0: 0;
|
|
4738
|
-
--tina-z-index-1: 10;
|
|
4739
|
-
--tina-z-index-2: 20;
|
|
4740
|
-
--tina-z-index-3: 30;
|
|
4741
|
-
--tina-z-index-4: 40;
|
|
4742
|
-
--tina-z-index-5: 50;
|
|
4743
|
-
|
|
4744
|
-
--tina-sidebar-width: 340px;
|
|
4745
|
-
--tina-sidebar-header-height: 60px;
|
|
4746
|
-
--tina-toolbar-height: 62px;
|
|
4747
|
-
}
|
|
4748
|
-
`;
|
|
4749
|
-
createGlobalStyle`
|
|
4750
|
-
${theme};
|
|
4751
|
-
`;
|
|
4752
|
-
const Button = (_g) => {
|
|
4753
|
-
var _h = _g, {
|
|
4754
|
-
variant = "secondary",
|
|
4755
|
-
as: Tag = "button",
|
|
4756
|
-
size = "medium",
|
|
4757
|
-
busy,
|
|
4758
|
-
disabled,
|
|
4759
|
-
rounded = "full",
|
|
4760
|
-
children,
|
|
4761
|
-
className
|
|
4762
|
-
} = _h, props = __objRest(_h, [
|
|
4763
|
-
"variant",
|
|
4764
|
-
"as",
|
|
4765
|
-
"size",
|
|
4766
|
-
"busy",
|
|
4767
|
-
"disabled",
|
|
4768
|
-
"rounded",
|
|
4769
|
-
"children",
|
|
4770
|
-
"className"
|
|
4771
|
-
]);
|
|
4772
|
-
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 ";
|
|
4773
|
-
const variantClasses = {
|
|
4774
|
-
primary: `shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500`,
|
|
4775
|
-
secondary: `shadow text-gray-500 hover:text-blue-500 bg-gray-50 hover:bg-white border border-gray-200`,
|
|
4776
|
-
white: `shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-200`,
|
|
4777
|
-
ghost: `text-gray-500 hover:text-blue-500 hover:shadow border border-transparent hover:border-gray-200 bg-transparent`,
|
|
4778
|
-
danger: `shadow text-white bg-red-500 hover:bg-red-600 focus:ring-red-500`
|
|
4779
|
-
};
|
|
4780
|
-
const state = busy ? `busy` : disabled ? `disabled` : `default`;
|
|
4781
|
-
const stateClasses = {
|
|
4782
|
-
disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
|
|
4783
|
-
busy: `pointer-events-none opacity-70 cursor-wait`,
|
|
4784
|
-
default: ``
|
|
4785
|
-
};
|
|
4786
|
-
const roundedClasses = {
|
|
4787
|
-
full: `rounded-full`,
|
|
4788
|
-
left: `rounded-l-full`,
|
|
4789
|
-
right: `rounded-r-full`
|
|
4790
|
-
};
|
|
4791
|
-
const sizeClasses = {
|
|
4792
|
-
small: `text-xs h-8 px-3`,
|
|
4793
|
-
medium: `text-sm h-10 px-4`,
|
|
4794
|
-
custom: ``
|
|
4795
|
-
};
|
|
4796
|
-
return /* @__PURE__ */ React.createElement(Tag, __spreadValues({
|
|
4797
|
-
className: `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${stateClasses[state]} ${roundedClasses[rounded]} ${className}`
|
|
4798
|
-
}, props), children);
|
|
4799
|
-
};
|
|
4800
|
-
function CursorPaginator({
|
|
4801
|
-
navigateNext,
|
|
4802
|
-
navigatePrev,
|
|
4803
|
-
hasNext,
|
|
4804
|
-
hasPrev,
|
|
4805
|
-
variant = "secondary"
|
|
4806
|
-
}) {
|
|
4807
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4808
|
-
className: "w-full flex flex-shrink-0 justify-end gap-2 items-center"
|
|
4809
|
-
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
4810
|
-
variant,
|
|
4811
|
-
disabled: !hasPrev,
|
|
4812
|
-
onClick: navigatePrev
|
|
4813
|
-
}, /* @__PURE__ */ React__default.createElement(BiLeftArrowAlt, {
|
|
4814
|
-
className: "w-6 h-full mr-2 opacity-70"
|
|
4815
|
-
}), " Previous"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
4816
|
-
variant,
|
|
4817
|
-
disabled: !hasNext,
|
|
4818
|
-
onClick: navigateNext
|
|
4819
|
-
}, "Next ", /* @__PURE__ */ React__default.createElement(BiRightArrowAlt, {
|
|
4820
|
-
className: "w-6 h-full ml-2 opacity-70"
|
|
4821
|
-
})));
|
|
4822
|
-
}
|
|
4823
4763
|
const TemplateMenu = ({ templates }) => {
|
|
4824
|
-
return /* @__PURE__ */
|
|
4764
|
+
return /* @__PURE__ */ React.createElement(Menu, {
|
|
4825
4765
|
as: "div",
|
|
4826
4766
|
className: "relative inline-block text-left"
|
|
4827
|
-
}, () => /* @__PURE__ */
|
|
4767
|
+
}, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Menu.Button, {
|
|
4828
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"
|
|
4829
|
-
}, "Create New ", /* @__PURE__ */
|
|
4769
|
+
}, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4830
4770
|
className: "w-5 h-full ml-1 opacity-70"
|
|
4831
|
-
}))), /* @__PURE__ */
|
|
4771
|
+
}))), /* @__PURE__ */ React.createElement(Transition, {
|
|
4832
4772
|
as: Fragment,
|
|
4833
4773
|
enter: "transition ease-out duration-100",
|
|
4834
4774
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -4836,13 +4776,13 @@ const TemplateMenu = ({ templates }) => {
|
|
|
4836
4776
|
leave: "transition ease-in duration-75",
|
|
4837
4777
|
leaveFrom: "transform opacity-100 scale-100",
|
|
4838
4778
|
leaveTo: "transform opacity-0 scale-95"
|
|
4839
|
-
}, /* @__PURE__ */
|
|
4779
|
+
}, /* @__PURE__ */ React.createElement(Menu.Items, {
|
|
4840
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"
|
|
4841
|
-
}, /* @__PURE__ */
|
|
4781
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4842
4782
|
className: "py-1"
|
|
4843
|
-
}, templates.map((template) => /* @__PURE__ */
|
|
4783
|
+
}, templates.map((template) => /* @__PURE__ */ React.createElement(Menu.Item, {
|
|
4844
4784
|
key: `${template.label}-${template.name}`
|
|
4845
|
-
}, ({ active }) => /* @__PURE__ */
|
|
4785
|
+
}, ({ active }) => /* @__PURE__ */ React.createElement(Link, {
|
|
4846
4786
|
to: `${template.name}/new`,
|
|
4847
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"}`
|
|
4848
4788
|
}, template.label))))))));
|
|
@@ -4861,8 +4801,8 @@ const handleNavigate = (navigate, cms, collection, document) => {
|
|
|
4861
4801
|
const CollectionListPage = () => {
|
|
4862
4802
|
const navigate = useNavigate();
|
|
4863
4803
|
const { collectionName } = useParams();
|
|
4864
|
-
const [open, setOpen] =
|
|
4865
|
-
const [vars, setVars] =
|
|
4804
|
+
const [open, setOpen] = React.useState(false);
|
|
4805
|
+
const [vars, setVars] = React.useState({
|
|
4866
4806
|
collection: collectionName,
|
|
4867
4807
|
relativePath: ""
|
|
4868
4808
|
});
|
|
@@ -4873,8 +4813,8 @@ const CollectionListPage = () => {
|
|
|
4873
4813
|
setEndCursor("");
|
|
4874
4814
|
setPrevCursors([]);
|
|
4875
4815
|
}, [loc]);
|
|
4876
|
-
return /* @__PURE__ */
|
|
4877
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4817
|
+
return /* @__PURE__ */ React.createElement(GetCollection, {
|
|
4878
4818
|
cms,
|
|
4879
4819
|
collectionName,
|
|
4880
4820
|
includeDocuments: true,
|
|
@@ -4886,7 +4826,7 @@ const CollectionListPage = () => {
|
|
|
4886
4826
|
const admin = cms.api.admin;
|
|
4887
4827
|
const pageInfo = collection.documents.pageInfo;
|
|
4888
4828
|
const useDataFlag = cms.flags.get("experimentalData");
|
|
4889
|
-
return /* @__PURE__ */
|
|
4829
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
4890
4830
|
filename: vars.relativePath,
|
|
4891
4831
|
deleteFunc: async () => {
|
|
4892
4832
|
try {
|
|
@@ -4900,71 +4840,71 @@ const CollectionListPage = () => {
|
|
|
4900
4840
|
}
|
|
4901
4841
|
},
|
|
4902
4842
|
close: () => setOpen(false)
|
|
4903
|
-
}), /* @__PURE__ */
|
|
4843
|
+
}), /* @__PURE__ */ React.createElement(PageHeader, {
|
|
4904
4844
|
isLocalMode: (_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
4905
|
-
}, /* @__PURE__ */
|
|
4845
|
+
}, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h3", {
|
|
4906
4846
|
className: "font-sans text-2xl text-gray-700"
|
|
4907
|
-
}, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */
|
|
4847
|
+
}, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
|
|
4908
4848
|
to: `new`,
|
|
4909
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"
|
|
4910
|
-
}, "Create New", " ", /* @__PURE__ */
|
|
4850
|
+
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4911
4851
|
className: "w-5 h-full ml-1 opacity-70"
|
|
4912
|
-
})), collection.templates && /* @__PURE__ */
|
|
4852
|
+
})), collection.templates && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
4913
4853
|
templates: collection.templates
|
|
4914
|
-
}))), /* @__PURE__ */
|
|
4854
|
+
}))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
4915
4855
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4916
|
-
}, totalCount > 0 && /* @__PURE__ */
|
|
4856
|
+
}, totalCount > 0 && /* @__PURE__ */ React.createElement("table", {
|
|
4917
4857
|
className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
4918
|
-
}, /* @__PURE__ */
|
|
4858
|
+
}, /* @__PURE__ */ React.createElement("tbody", {
|
|
4919
4859
|
className: "divide-y divide-gray-150"
|
|
4920
4860
|
}, documents.map((document) => {
|
|
4921
4861
|
var _a2;
|
|
4922
4862
|
const hasTitle = Boolean(document.node._sys.title);
|
|
4923
4863
|
const subfolders = document.node._sys.breadcrumbs.slice(0, -1).join("/");
|
|
4924
|
-
return /* @__PURE__ */
|
|
4864
|
+
return /* @__PURE__ */ React.createElement("tr", {
|
|
4925
4865
|
key: `document-${document.node._sys.relativePath}`,
|
|
4926
4866
|
className: ""
|
|
4927
|
-
}, /* @__PURE__ */
|
|
4867
|
+
}, /* @__PURE__ */ React.createElement("td", {
|
|
4928
4868
|
className: "px-6 py-2 whitespace-nowrap"
|
|
4929
|
-
}, /* @__PURE__ */
|
|
4869
|
+
}, /* @__PURE__ */ React.createElement("a", {
|
|
4930
4870
|
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
4931
4871
|
onClick: () => {
|
|
4932
4872
|
handleNavigate(navigate, cms, collection, document.node);
|
|
4933
4873
|
}
|
|
4934
|
-
}, /* @__PURE__ */
|
|
4874
|
+
}, /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4935
4875
|
className: "inline-block h-6 w-auto opacity-70"
|
|
4936
|
-
}), /* @__PURE__ */
|
|
4876
|
+
}), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", {
|
|
4937
4877
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4938
|
-
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */
|
|
4878
|
+
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
4939
4879
|
className: "h-5 leading-5 block whitespace-nowrap"
|
|
4940
|
-
}, subfolders && /* @__PURE__ */
|
|
4880
|
+
}, subfolders && /* @__PURE__ */ React.createElement("span", {
|
|
4941
4881
|
className: "text-xs text-gray-400"
|
|
4942
|
-
}, `${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", {
|
|
4943
4883
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4944
|
-
}, /* @__PURE__ */
|
|
4884
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4945
4885
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4946
|
-
}, "Filename"), /* @__PURE__ */
|
|
4886
|
+
}, "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
4947
4887
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4948
|
-
}, document.node._sys.filename)), /* @__PURE__ */
|
|
4888
|
+
}, document.node._sys.filename)), /* @__PURE__ */ React.createElement("td", {
|
|
4949
4889
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4950
|
-
}, /* @__PURE__ */
|
|
4890
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4951
4891
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4952
|
-
}, "Extension"), /* @__PURE__ */
|
|
4892
|
+
}, "Extension"), /* @__PURE__ */ React.createElement("span", {
|
|
4953
4893
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4954
|
-
}, document.node._sys.extension)), /* @__PURE__ */
|
|
4894
|
+
}, document.node._sys.extension)), /* @__PURE__ */ React.createElement("td", {
|
|
4955
4895
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4956
|
-
}, /* @__PURE__ */
|
|
4896
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4957
4897
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4958
|
-
}, "Template"), /* @__PURE__ */
|
|
4898
|
+
}, "Template"), /* @__PURE__ */ React.createElement("span", {
|
|
4959
4899
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4960
|
-
}, document.node._sys.template)), /* @__PURE__ */
|
|
4900
|
+
}, document.node._sys.template)), /* @__PURE__ */ React.createElement("td", {
|
|
4961
4901
|
className: "w-0"
|
|
4962
|
-
}, /* @__PURE__ */
|
|
4902
|
+
}, /* @__PURE__ */ React.createElement(OverflowMenu, {
|
|
4963
4903
|
toolbarItems: [
|
|
4964
4904
|
{
|
|
4965
4905
|
name: "edit",
|
|
4966
4906
|
label: "Edit in Admin",
|
|
4967
|
-
Icon: /* @__PURE__ */
|
|
4907
|
+
Icon: /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4968
4908
|
size: "1.3rem"
|
|
4969
4909
|
}),
|
|
4970
4910
|
onMouseDown: () => {
|
|
@@ -4974,7 +4914,7 @@ const CollectionListPage = () => {
|
|
|
4974
4914
|
{
|
|
4975
4915
|
name: "delete",
|
|
4976
4916
|
label: "Delete",
|
|
4977
|
-
Icon: /* @__PURE__ */
|
|
4917
|
+
Icon: /* @__PURE__ */ React.createElement(BiTrash, {
|
|
4978
4918
|
size: "1.3rem",
|
|
4979
4919
|
className: "text-red-500"
|
|
4980
4920
|
}),
|
|
@@ -4988,9 +4928,9 @@ const CollectionListPage = () => {
|
|
|
4988
4928
|
}
|
|
4989
4929
|
]
|
|
4990
4930
|
})));
|
|
4991
|
-
}))), useDataFlag && /* @__PURE__ */
|
|
4931
|
+
}))), useDataFlag && /* @__PURE__ */ React.createElement("div", {
|
|
4992
4932
|
className: "pt-3"
|
|
4993
|
-
}, /* @__PURE__ */
|
|
4933
|
+
}, /* @__PURE__ */ React.createElement(CursorPaginator, {
|
|
4994
4934
|
variant: "white",
|
|
4995
4935
|
hasNext: pageInfo == null ? void 0 : pageInfo.hasNextPage,
|
|
4996
4936
|
navigateNext: () => {
|
|
@@ -5012,33 +4952,35 @@ const CollectionListPage = () => {
|
|
|
5012
4952
|
});
|
|
5013
4953
|
};
|
|
5014
4954
|
const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
|
|
5015
|
-
return /* @__PURE__ */
|
|
4955
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, {
|
|
5016
4956
|
close: close2
|
|
5017
|
-
}, "Delete ", filename), /* @__PURE__ */
|
|
4957
|
+
}, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, {
|
|
5018
4958
|
padded: true
|
|
5019
|
-
}, /* @__PURE__ */
|
|
4959
|
+
}, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button, {
|
|
5020
4960
|
style: { flexGrow: 2 },
|
|
5021
4961
|
onClick: close2
|
|
5022
|
-
}, "Cancel"), /* @__PURE__ */
|
|
4962
|
+
}, "Cancel"), /* @__PURE__ */ React.createElement(Button, {
|
|
5023
4963
|
style: { flexGrow: 3 },
|
|
5024
4964
|
variant: "danger",
|
|
5025
4965
|
onClick: async () => {
|
|
5026
4966
|
await deleteFunc();
|
|
5027
4967
|
close2();
|
|
5028
4968
|
}
|
|
5029
|
-
}, "Delete")));
|
|
4969
|
+
}, "Delete"))));
|
|
5030
4970
|
};
|
|
5031
4971
|
function HiChevronRight(props) {
|
|
5032
4972
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "clipRule": "evenodd" } }] })(props);
|
|
5033
4973
|
}
|
|
5034
4974
|
const createDocument = async (cms, collection, template, mutationInfo, values) => {
|
|
5035
4975
|
const api = new TinaAdminApi(cms);
|
|
5036
|
-
const
|
|
4976
|
+
const { filename, ...leftover } = values;
|
|
5037
4977
|
const { includeCollection, includeTemplate } = mutationInfo;
|
|
5038
4978
|
const relativePath = `${filename}.${collection.format}`;
|
|
5039
|
-
const params = transformDocumentIntoMutationRequestPayload(
|
|
5040
|
-
_collection: collection.name
|
|
5041
|
-
|
|
4979
|
+
const params = transformDocumentIntoMutationRequestPayload({
|
|
4980
|
+
_collection: collection.name,
|
|
4981
|
+
...template && { _template: template.name },
|
|
4982
|
+
...leftover
|
|
4983
|
+
}, {
|
|
5042
4984
|
includeCollection,
|
|
5043
4985
|
includeTemplate
|
|
5044
4986
|
});
|
|
@@ -5053,7 +4995,7 @@ const createDocument = async (cms, collection, template, mutationInfo, values) =
|
|
|
5053
4995
|
};
|
|
5054
4996
|
const CollectionCreatePage = () => {
|
|
5055
4997
|
const { collectionName, templateName } = useParams();
|
|
5056
|
-
return /* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5057
4999
|
cms,
|
|
5058
5000
|
collectionName,
|
|
5059
5001
|
includeDocuments: false
|
|
@@ -5062,7 +5004,7 @@ const CollectionCreatePage = () => {
|
|
|
5062
5004
|
includeCollection: true,
|
|
5063
5005
|
includeTemplate: !!collection.templates
|
|
5064
5006
|
};
|
|
5065
|
-
return /* @__PURE__ */
|
|
5007
|
+
return /* @__PURE__ */ React.createElement(RenderForm$1, {
|
|
5066
5008
|
cms,
|
|
5067
5009
|
collection,
|
|
5068
5010
|
templateName,
|
|
@@ -5095,7 +5037,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5095
5037
|
name: "filename",
|
|
5096
5038
|
label: "Filename",
|
|
5097
5039
|
component: "text",
|
|
5098
|
-
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")),
|
|
5099
5041
|
placeholder: `My_Document`,
|
|
5100
5042
|
validate: (value, allValues, meta) => {
|
|
5101
5043
|
if (!value) {
|
|
@@ -5128,24 +5070,24 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5128
5070
|
const windowWidth = useWindowWidth();
|
|
5129
5071
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5130
5072
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5131
|
-
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", {
|
|
5132
5074
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5133
|
-
}, /* @__PURE__ */
|
|
5075
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5134
5076
|
className: "max-w-form mx-auto"
|
|
5135
|
-
}, /* @__PURE__ */
|
|
5077
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5136
5078
|
className: "mb-2"
|
|
5137
|
-
}, /* @__PURE__ */
|
|
5079
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5138
5080
|
className: "block text-sm leading-tight uppercase text-gray-400 mb-1"
|
|
5139
|
-
}, /* @__PURE__ */
|
|
5081
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
5140
5082
|
to: `/collections/${collection.name}`,
|
|
5141
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"
|
|
5142
|
-
}, collection.label ? collection.label : collection.name), /* @__PURE__ */
|
|
5084
|
+
}, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
|
|
5143
5085
|
className: "inline-block -mt-0.5 opacity-50"
|
|
5144
|
-
})), /* @__PURE__ */
|
|
5086
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
5145
5087
|
className: "text-xl text-gray-700 font-medium leading-tight"
|
|
5146
|
-
}, "Create New")), /* @__PURE__ */
|
|
5088
|
+
}, "Create New")), /* @__PURE__ */ React.createElement(FormStatus, {
|
|
5147
5089
|
pristine: formIsPristine
|
|
5148
|
-
}))), /* @__PURE__ */
|
|
5090
|
+
}))), /* @__PURE__ */ React.createElement(FormBuilder, {
|
|
5149
5091
|
form,
|
|
5150
5092
|
onPristineChange: setFormIsPristine
|
|
5151
5093
|
})));
|
|
@@ -5186,9 +5128,9 @@ const GetDocument = ({
|
|
|
5186
5128
|
return null;
|
|
5187
5129
|
}
|
|
5188
5130
|
if (loading) {
|
|
5189
|
-
return /* @__PURE__ */
|
|
5131
|
+
return /* @__PURE__ */ React.createElement(LoadingPage, null);
|
|
5190
5132
|
}
|
|
5191
|
-
return /* @__PURE__ */
|
|
5133
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(document, loading));
|
|
5192
5134
|
};
|
|
5193
5135
|
const updateDocument = async (cms, relativePath, collection, mutationInfo, values) => {
|
|
5194
5136
|
const api = new TinaAdminApi(cms);
|
|
@@ -5207,9 +5149,9 @@ const updateDocument = async (cms, relativePath, collection, mutationInfo, value
|
|
|
5207
5149
|
}
|
|
5208
5150
|
};
|
|
5209
5151
|
const CollectionUpdatePage = () => {
|
|
5210
|
-
const
|
|
5152
|
+
const { collectionName, ...rest } = useParams();
|
|
5211
5153
|
const { "*": filename } = rest;
|
|
5212
|
-
return /* @__PURE__ */
|
|
5154
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5213
5155
|
cms,
|
|
5214
5156
|
collectionName,
|
|
5215
5157
|
includeDocuments: false
|
|
@@ -5219,11 +5161,11 @@ const CollectionUpdatePage = () => {
|
|
|
5219
5161
|
includeCollection: true,
|
|
5220
5162
|
includeTemplate: !!collection.templates
|
|
5221
5163
|
};
|
|
5222
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ React.createElement(GetDocument, {
|
|
5223
5165
|
cms,
|
|
5224
5166
|
collectionName: collection.name,
|
|
5225
5167
|
relativePath
|
|
5226
|
-
}, (document) => /* @__PURE__ */
|
|
5168
|
+
}, (document) => /* @__PURE__ */ React.createElement(RenderForm, {
|
|
5227
5169
|
cms,
|
|
5228
5170
|
document,
|
|
5229
5171
|
filename,
|
|
@@ -5276,24 +5218,24 @@ const RenderForm = ({
|
|
|
5276
5218
|
const windowWidth = useWindowWidth();
|
|
5277
5219
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5278
5220
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5279
|
-
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", {
|
|
5280
5222
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5281
|
-
}, /* @__PURE__ */
|
|
5223
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5282
5224
|
className: "max-w-form mx-auto"
|
|
5283
|
-
}, /* @__PURE__ */
|
|
5225
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5284
5226
|
className: "mb-2"
|
|
5285
|
-
}, /* @__PURE__ */
|
|
5227
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5286
5228
|
className: "block text-sm leading-tight uppercase text-gray-400 mb-1"
|
|
5287
|
-
}, /* @__PURE__ */
|
|
5229
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
5288
5230
|
to: `/collections/${collection.name}`,
|
|
5289
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"
|
|
5290
|
-
}, collection.label ? collection.label : collection.name), /* @__PURE__ */
|
|
5232
|
+
}, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
|
|
5291
5233
|
className: "inline-block -mt-0.5 opacity-50"
|
|
5292
|
-
})), /* @__PURE__ */
|
|
5234
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
5293
5235
|
className: "text-xl text-gray-700 font-medium leading-tight"
|
|
5294
|
-
}, "Edit ", `${filename}.${collection.format}`)), /* @__PURE__ */
|
|
5236
|
+
}, "Edit ", `${filename}.${collection.format}`)), /* @__PURE__ */ React.createElement(FormStatus, {
|
|
5295
5237
|
pristine: formIsPristine
|
|
5296
|
-
}))), /* @__PURE__ */
|
|
5238
|
+
}))), /* @__PURE__ */ React.createElement(FormBuilder, {
|
|
5297
5239
|
form,
|
|
5298
5240
|
onPristineChange: setFormIsPristine
|
|
5299
5241
|
})));
|
|
@@ -5303,24 +5245,24 @@ const ScreenPage = () => {
|
|
|
5303
5245
|
const navBreakpoint = 1e3;
|
|
5304
5246
|
const windowWidth = useWindowWidth();
|
|
5305
5247
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5306
|
-
return /* @__PURE__ */
|
|
5248
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5307
5249
|
var _a, _b;
|
|
5308
5250
|
const screens = cms.plugins.getType("screen").all();
|
|
5309
5251
|
const selectedScreen = screens.find(({ name }) => slugify(name) === screenName);
|
|
5310
|
-
return /* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
5311
5253
|
className: "relative w-full h-full flex flex-col items-stretch justify-between"
|
|
5312
|
-
}, ((_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", {
|
|
5313
5255
|
className: `py-5 border-b border-gray-200 bg-white pl-18`
|
|
5314
|
-
}, selectedScreen.name), /* @__PURE__ */
|
|
5256
|
+
}, selectedScreen.name), /* @__PURE__ */ React.createElement("div", {
|
|
5315
5257
|
className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between"
|
|
5316
|
-
}, /* @__PURE__ */
|
|
5258
|
+
}, /* @__PURE__ */ React.createElement(selectedScreen.Component, {
|
|
5317
5259
|
close: () => {
|
|
5318
5260
|
}
|
|
5319
5261
|
})));
|
|
5320
5262
|
});
|
|
5321
5263
|
};
|
|
5322
5264
|
const Redirect = () => {
|
|
5323
|
-
|
|
5265
|
+
React.useEffect(() => {
|
|
5324
5266
|
if (window) {
|
|
5325
5267
|
window.location.assign("/");
|
|
5326
5268
|
}
|
|
@@ -5334,43 +5276,43 @@ const TinaAdmin = () => {
|
|
|
5334
5276
|
return null;
|
|
5335
5277
|
}
|
|
5336
5278
|
if (!edit) {
|
|
5337
|
-
return /* @__PURE__ */
|
|
5279
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(LoginPage, null));
|
|
5338
5280
|
}
|
|
5339
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5340
5282
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5341
5283
|
if (isTinaAdminEnabled) {
|
|
5342
|
-
return /* @__PURE__ */
|
|
5284
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement("div", {
|
|
5343
5285
|
className: "flex items-stretch h-screen overflow-hidden"
|
|
5344
|
-
}, /* @__PURE__ */
|
|
5286
|
+
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5345
5287
|
cms
|
|
5346
|
-
}), /* @__PURE__ */
|
|
5288
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
5347
5289
|
className: "flex-1 relative"
|
|
5348
|
-
}, /* @__PURE__ */
|
|
5290
|
+
}, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5349
5291
|
path: "collections/:collectionName/new",
|
|
5350
|
-
element: /* @__PURE__ */
|
|
5351
|
-
}), /* @__PURE__ */
|
|
5292
|
+
element: /* @__PURE__ */ React.createElement(CollectionCreatePage, null)
|
|
5293
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5352
5294
|
path: "collections/:collectionName/:templateName/new",
|
|
5353
|
-
element: /* @__PURE__ */
|
|
5354
|
-
}), /* @__PURE__ */
|
|
5295
|
+
element: /* @__PURE__ */ React.createElement(CollectionCreatePage, null)
|
|
5296
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5355
5297
|
path: "collections/:collectionName/*",
|
|
5356
|
-
element: /* @__PURE__ */
|
|
5357
|
-
}), /* @__PURE__ */
|
|
5298
|
+
element: /* @__PURE__ */ React.createElement(CollectionUpdatePage, null)
|
|
5299
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5358
5300
|
path: "collections/:collectionName",
|
|
5359
|
-
element: /* @__PURE__ */
|
|
5360
|
-
}), /* @__PURE__ */
|
|
5301
|
+
element: /* @__PURE__ */ React.createElement(CollectionListPage, null)
|
|
5302
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5361
5303
|
path: "screens/:screenName",
|
|
5362
|
-
element: /* @__PURE__ */
|
|
5363
|
-
}), /* @__PURE__ */
|
|
5304
|
+
element: /* @__PURE__ */ React.createElement(ScreenPage, null)
|
|
5305
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5364
5306
|
path: "/",
|
|
5365
|
-
element: /* @__PURE__ */
|
|
5307
|
+
element: /* @__PURE__ */ React.createElement(DashboardPage, null)
|
|
5366
5308
|
}))))));
|
|
5367
5309
|
} else {
|
|
5368
|
-
return /* @__PURE__ */
|
|
5310
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5369
5311
|
path: "logout",
|
|
5370
|
-
element: /* @__PURE__ */
|
|
5371
|
-
}), /* @__PURE__ */
|
|
5312
|
+
element: /* @__PURE__ */ React.createElement(LogoutPage, null)
|
|
5313
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5372
5314
|
path: "/",
|
|
5373
|
-
element: /* @__PURE__ */
|
|
5315
|
+
element: /* @__PURE__ */ React.createElement(Redirect, null)
|
|
5374
5316
|
}))));
|
|
5375
5317
|
}
|
|
5376
5318
|
});
|