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