tinacms 0.68.11 → 0.68.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/dist/client.js +1 -2
- package/dist/edit-state.es.js +7 -35
- package/dist/edit-state.js +8 -37
- package/dist/hooks/formify/spec/schema.d.ts +3 -0
- package/dist/index.es.js +509 -579
- package/dist/index.js +280 -351
- package/dist/internalClient/index.d.ts +8 -0
- package/dist/rich-text.es.js +74 -73
- package/dist/rich-text.js +75 -75
- package/dist/style.css +54 -3
- package/package.json +36 -13
- package/CHANGELOG.md +0 -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 = () => {
|
|
@@ -2601,7 +2629,7 @@ const AuthWallInner = ({
|
|
|
2601
2629
|
const client = cms.api.tina;
|
|
2602
2630
|
const [activeModal, setActiveModal] = useState(null);
|
|
2603
2631
|
const [showChildren, setShowChildren] = useState(false);
|
|
2604
|
-
|
|
2632
|
+
React.useEffect(() => {
|
|
2605
2633
|
client.isAuthenticated().then((isAuthenticated) => {
|
|
2606
2634
|
if (isAuthenticated) {
|
|
2607
2635
|
setShowChildren(true);
|
|
@@ -2626,7 +2654,7 @@ const AuthWallInner = ({
|
|
|
2626
2654
|
setActiveModal(null);
|
|
2627
2655
|
}
|
|
2628
2656
|
}) : [];
|
|
2629
|
-
return /* @__PURE__ */
|
|
2657
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React.createElement(ModalBuilder, {
|
|
2630
2658
|
title: "Tina Cloud Authorization",
|
|
2631
2659
|
message: "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account.",
|
|
2632
2660
|
close,
|
|
@@ -2655,12 +2683,12 @@ const TinaCloudProvider = (props) => {
|
|
|
2655
2683
|
const baseBranch = props.branch || "main";
|
|
2656
2684
|
const [currentBranch, setCurrentBranch] = useLocalStorage("tinacms-current-branch", baseBranch);
|
|
2657
2685
|
useTinaAuthRedirect();
|
|
2658
|
-
const cms =
|
|
2686
|
+
const cms = React.useMemo(() => props.cms || new TinaCMS({
|
|
2659
2687
|
enabled: true,
|
|
2660
2688
|
sidebar: true
|
|
2661
2689
|
}), [props.cms]);
|
|
2662
2690
|
if (!cms.api.tina) {
|
|
2663
|
-
cms.registerApi("tina", createClient(
|
|
2691
|
+
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
2664
2692
|
} else {
|
|
2665
2693
|
cms.api.tina.setBranch(currentBranch);
|
|
2666
2694
|
}
|
|
@@ -2668,20 +2696,20 @@ const TinaCloudProvider = (props) => {
|
|
|
2668
2696
|
cms.registerApi("admin", new TinaAdminApi(cms));
|
|
2669
2697
|
}
|
|
2670
2698
|
const setupMedia = async () => {
|
|
2671
|
-
var _a, _b, _c;
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2699
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2700
|
+
const hasTinaMedia = Boolean((_b = (_a = props.schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina);
|
|
2701
|
+
if (hasTinaMedia) {
|
|
2702
|
+
cms.media.store = new TinaMediaStore(cms);
|
|
2703
|
+
} else if (((_d = (_c = props.schema.config) == null ? void 0 : _c.media) == null ? void 0 : _d.loadCustomStore) || props.mediaStore) {
|
|
2704
|
+
const mediaStoreFromProps = ((_f = (_e = props.schema.config) == null ? void 0 : _e.media) == null ? void 0 : _f.loadCustomStore) || props.mediaStore;
|
|
2705
|
+
if ((_g = mediaStoreFromProps.prototype) == null ? void 0 : _g.persist) {
|
|
2706
|
+
cms.media.store = new mediaStoreFromProps(cms.api.tina);
|
|
2675
2707
|
} else {
|
|
2676
|
-
const MediaClass = await
|
|
2708
|
+
const MediaClass = await mediaStoreFromProps();
|
|
2677
2709
|
cms.media.store = new MediaClass(cms.api.tina);
|
|
2678
2710
|
}
|
|
2679
2711
|
} else {
|
|
2680
|
-
|
|
2681
|
-
cms.media.store = new TinaMediaStore(cms);
|
|
2682
|
-
} else {
|
|
2683
|
-
cms.media.store = new DummyMediaStore();
|
|
2684
|
-
}
|
|
2712
|
+
cms.media.store = new DummyMediaStore();
|
|
2685
2713
|
}
|
|
2686
2714
|
};
|
|
2687
2715
|
const handleListBranches = async () => {
|
|
@@ -2697,15 +2725,15 @@ const TinaCloudProvider = (props) => {
|
|
|
2697
2725
|
return newBranch;
|
|
2698
2726
|
};
|
|
2699
2727
|
setupMedia();
|
|
2700
|
-
const [branchingEnabled, setBranchingEnabled] =
|
|
2701
|
-
|
|
2728
|
+
const [branchingEnabled, setBranchingEnabled] = React.useState(() => cms.flags.get("branch-switcher"));
|
|
2729
|
+
React.useEffect(() => {
|
|
2702
2730
|
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
2703
2731
|
if (key === "branch-switcher") {
|
|
2704
2732
|
setBranchingEnabled(value);
|
|
2705
2733
|
}
|
|
2706
2734
|
});
|
|
2707
2735
|
}, [cms.events]);
|
|
2708
|
-
|
|
2736
|
+
React.useEffect(() => {
|
|
2709
2737
|
let branchSwitcher;
|
|
2710
2738
|
if (branchingEnabled) {
|
|
2711
2739
|
branchSwitcher = new BranchSwitcherPlugin({
|
|
@@ -2720,24 +2748,25 @@ const TinaCloudProvider = (props) => {
|
|
|
2720
2748
|
}
|
|
2721
2749
|
};
|
|
2722
2750
|
}, [branchingEnabled, props.branch]);
|
|
2723
|
-
|
|
2751
|
+
React.useEffect(() => {
|
|
2724
2752
|
if (props.cmsCallback) {
|
|
2725
2753
|
props.cmsCallback(cms);
|
|
2726
2754
|
}
|
|
2727
2755
|
}, []);
|
|
2728
|
-
return /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ React.createElement(BranchDataProvider, {
|
|
2729
2757
|
currentBranch,
|
|
2730
2758
|
setCurrentBranch: (b) => {
|
|
2731
2759
|
setCurrentBranch(b);
|
|
2732
2760
|
}
|
|
2733
|
-
}, /* @__PURE__ */
|
|
2761
|
+
}, /* @__PURE__ */ React.createElement(TinaProvider, {
|
|
2734
2762
|
cms
|
|
2735
|
-
}, /* @__PURE__ */
|
|
2763
|
+
}, /* @__PURE__ */ React.createElement(AuthWallInner, {
|
|
2764
|
+
...props,
|
|
2736
2765
|
cms
|
|
2737
|
-
})))
|
|
2766
|
+
})));
|
|
2738
2767
|
};
|
|
2739
2768
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2740
|
-
var styles = `.tina-tailwind {
|
|
2769
|
+
var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
2741
2770
|
line-height: 1.5;
|
|
2742
2771
|
-webkit-text-size-adjust: 100%;
|
|
2743
2772
|
-moz-tab-size: 4;
|
|
@@ -2962,6 +2991,54 @@ var styles = `.tina-tailwind {
|
|
|
2962
2991
|
display: none;
|
|
2963
2992
|
}
|
|
2964
2993
|
*, ::before, ::after {
|
|
2994
|
+
--tw-border-spacing-x: 0;
|
|
2995
|
+
--tw-border-spacing-y: 0;
|
|
2996
|
+
--tw-translate-x: 0;
|
|
2997
|
+
--tw-translate-y: 0;
|
|
2998
|
+
--tw-rotate: 0;
|
|
2999
|
+
--tw-skew-x: 0;
|
|
3000
|
+
--tw-skew-y: 0;
|
|
3001
|
+
--tw-scale-x: 1;
|
|
3002
|
+
--tw-scale-y: 1;
|
|
3003
|
+
--tw-pan-x: ;
|
|
3004
|
+
--tw-pan-y: ;
|
|
3005
|
+
--tw-pinch-zoom: ;
|
|
3006
|
+
--tw-scroll-snap-strictness: proximity;
|
|
3007
|
+
--tw-ordinal: ;
|
|
3008
|
+
--tw-slashed-zero: ;
|
|
3009
|
+
--tw-numeric-figure: ;
|
|
3010
|
+
--tw-numeric-spacing: ;
|
|
3011
|
+
--tw-numeric-fraction: ;
|
|
3012
|
+
--tw-ring-inset: ;
|
|
3013
|
+
--tw-ring-offset-width: 0px;
|
|
3014
|
+
--tw-ring-offset-color: #fff;
|
|
3015
|
+
--tw-ring-color: rgb(0 132 255 / 0.5);
|
|
3016
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
3017
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
3018
|
+
--tw-shadow: 0 0 #0000;
|
|
3019
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
3020
|
+
--tw-blur: ;
|
|
3021
|
+
--tw-brightness: ;
|
|
3022
|
+
--tw-contrast: ;
|
|
3023
|
+
--tw-grayscale: ;
|
|
3024
|
+
--tw-hue-rotate: ;
|
|
3025
|
+
--tw-invert: ;
|
|
3026
|
+
--tw-saturate: ;
|
|
3027
|
+
--tw-sepia: ;
|
|
3028
|
+
--tw-drop-shadow: ;
|
|
3029
|
+
--tw-backdrop-blur: ;
|
|
3030
|
+
--tw-backdrop-brightness: ;
|
|
3031
|
+
--tw-backdrop-contrast: ;
|
|
3032
|
+
--tw-backdrop-grayscale: ;
|
|
3033
|
+
--tw-backdrop-hue-rotate: ;
|
|
3034
|
+
--tw-backdrop-invert: ;
|
|
3035
|
+
--tw-backdrop-opacity: ;
|
|
3036
|
+
--tw-backdrop-saturate: ;
|
|
3037
|
+
--tw-backdrop-sepia: ;
|
|
3038
|
+
}
|
|
3039
|
+
::backdrop {
|
|
3040
|
+
--tw-border-spacing-x: 0;
|
|
3041
|
+
--tw-border-spacing-y: 0;
|
|
2965
3042
|
--tw-translate-x: 0;
|
|
2966
3043
|
--tw-translate-y: 0;
|
|
2967
3044
|
--tw-rotate: 0;
|
|
@@ -3306,14 +3383,17 @@ var styles = `.tina-tailwind {
|
|
|
3306
3383
|
}
|
|
3307
3384
|
.tina-tailwind .from-blue-900 {
|
|
3308
3385
|
--tw-gradient-from: #1D2C6C;
|
|
3309
|
-
--tw-gradient-
|
|
3386
|
+
--tw-gradient-to: rgb(29 44 108 / 0);
|
|
3387
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3310
3388
|
}
|
|
3311
3389
|
.tina-tailwind .from-gray-800 {
|
|
3312
3390
|
--tw-gradient-from: #363145;
|
|
3313
|
-
--tw-gradient-
|
|
3391
|
+
--tw-gradient-to: rgb(54 49 69 / 0);
|
|
3392
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3314
3393
|
}
|
|
3315
3394
|
.tina-tailwind .via-gray-900 {
|
|
3316
|
-
--tw-gradient-
|
|
3395
|
+
--tw-gradient-to: rgb(37 35 54 / 0);
|
|
3396
|
+
--tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to);
|
|
3317
3397
|
}
|
|
3318
3398
|
.tina-tailwind .to-gray-900 {
|
|
3319
3399
|
--tw-gradient-to: #252336;
|
|
@@ -3615,7 +3695,7 @@ var styles = `.tina-tailwind {
|
|
|
3615
3695
|
--tw-ring-opacity: 1;
|
|
3616
3696
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3617
3697
|
}
|
|
3618
|
-
|
|
3698
|
+
`)();
|
|
3619
3699
|
class ContentCreatorPlugin {
|
|
3620
3700
|
constructor(options) {
|
|
3621
3701
|
this.__type = "content-creator";
|
|
@@ -3664,9 +3744,9 @@ class ContentCreatorPlugin {
|
|
|
3664
3744
|
}
|
|
3665
3745
|
const useDocumentCreatorPlugin = (args) => {
|
|
3666
3746
|
const cms = useCMS();
|
|
3667
|
-
const [values, setValues] =
|
|
3668
|
-
const [plugin, setPlugin] =
|
|
3669
|
-
|
|
3747
|
+
const [values, setValues] = React.useState({});
|
|
3748
|
+
const [plugin, setPlugin] = React.useState(null);
|
|
3749
|
+
React.useEffect(() => {
|
|
3670
3750
|
const run = async () => {
|
|
3671
3751
|
var _a;
|
|
3672
3752
|
const res = await cms.api.tina.request((gql2) => gql2`
|
|
@@ -3767,7 +3847,7 @@ const useDocumentCreatorPlugin = (args) => {
|
|
|
3767
3847
|
};
|
|
3768
3848
|
run();
|
|
3769
3849
|
}, [cms]);
|
|
3770
|
-
|
|
3850
|
+
React.useEffect(() => {
|
|
3771
3851
|
if (plugin) {
|
|
3772
3852
|
cms.plugins.add(plugin);
|
|
3773
3853
|
}
|
|
@@ -3788,10 +3868,10 @@ function useTina({
|
|
|
3788
3868
|
state,
|
|
3789
3869
|
isDummyContainer,
|
|
3790
3870
|
isLoading: contextLoading
|
|
3791
|
-
} =
|
|
3871
|
+
} = React.useContext(TinaDataContext);
|
|
3792
3872
|
const [waitForContextRerender, setWaitForContextRerender] = useState(!isDummyContainer);
|
|
3793
3873
|
const isLoading = contextLoading || waitForContextRerender;
|
|
3794
|
-
|
|
3874
|
+
React.useEffect(() => {
|
|
3795
3875
|
setRequest({ query, variables });
|
|
3796
3876
|
}, [JSON.stringify(variables), query]);
|
|
3797
3877
|
useEffect(() => {
|
|
@@ -3843,7 +3923,7 @@ const errorButtonStyles = {
|
|
|
3843
3923
|
color: "white",
|
|
3844
3924
|
margin: "1rem 0"
|
|
3845
3925
|
};
|
|
3846
|
-
class ErrorBoundary extends
|
|
3926
|
+
class ErrorBoundary extends React.Component {
|
|
3847
3927
|
constructor(props) {
|
|
3848
3928
|
super(props);
|
|
3849
3929
|
this.state = {
|
|
@@ -3859,7 +3939,7 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3859
3939
|
const branchData = window.localStorage && window.localStorage.getItem("tinacms-current-branch");
|
|
3860
3940
|
const hasBranchData = branchData && branchData.length > 0;
|
|
3861
3941
|
if (this.state.hasError && !this.state.pageRefresh) {
|
|
3862
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3863
3943
|
style: {
|
|
3864
3944
|
background: "#efefef",
|
|
3865
3945
|
height: "100vh",
|
|
@@ -3867,7 +3947,7 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3867
3947
|
alignItems: "center",
|
|
3868
3948
|
justifyContent: "center"
|
|
3869
3949
|
}
|
|
3870
|
-
}, /* @__PURE__ */
|
|
3950
|
+
}, /* @__PURE__ */ React.createElement("style", null, " body { margin: 0; } "), /* @__PURE__ */ React.createElement("div", {
|
|
3871
3951
|
style: {
|
|
3872
3952
|
background: "#fff",
|
|
3873
3953
|
maxWidth: "400px",
|
|
@@ -3876,27 +3956,27 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3876
3956
|
borderRadius: "5px",
|
|
3877
3957
|
boxShadow: "0 6px 24px rgb(0 37 91 / 5%), 0 2px 4px rgb(0 37 91 / 3%)"
|
|
3878
3958
|
}
|
|
3879
|
-
}, /* @__PURE__ */
|
|
3959
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
3880
3960
|
style: { color: "#eb6337" }
|
|
3881
|
-
}, "TinaCMS Render Error"), /* @__PURE__ */
|
|
3961
|
+
}, "TinaCMS Render Error"), /* @__PURE__ */ React.createElement("p", null, "Tina caught an error while updating the page:"), /* @__PURE__ */ React.createElement("pre", {
|
|
3882
3962
|
style: { marginTop: "1rem", overflowX: "auto" }
|
|
3883
|
-
}, this.state.message), /* @__PURE__ */
|
|
3963
|
+
}, this.state.message), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("p", null, `If you've just updated the form, undo your most recent changes and click "refresh". If after a few refreshes, you're still encountering this error. There is a bigger issue with the site. Please reach out to your site admin.`), /* @__PURE__ */ React.createElement("p", null, "See our", " ", /* @__PURE__ */ React.createElement("a", {
|
|
3884
3964
|
className: "text-gray-600",
|
|
3885
3965
|
style: { textDecoration: "underline" },
|
|
3886
3966
|
href: "https://tina.io/docs/errors/faq/",
|
|
3887
3967
|
target: "_blank"
|
|
3888
|
-
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */
|
|
3968
|
+
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */ React.createElement("button", {
|
|
3889
3969
|
style: errorButtonStyles,
|
|
3890
3970
|
onClick: () => {
|
|
3891
3971
|
this.setState({ pageRefresh: true });
|
|
3892
3972
|
setTimeout(() => this.setState({ hasError: false, pageRefresh: false }), 3e3);
|
|
3893
3973
|
}
|
|
3894
|
-
}, "Refresh"), hasBranchData && /* @__PURE__ */
|
|
3974
|
+
}, "Refresh"), hasBranchData && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, `If you're using the branch switcher, you may currently be on a "stale" branch that has been deleted or whose content is not compatible with the latest version of the site's layout. Click the button below to switch back to the default branch for this deployment.`), /* @__PURE__ */ React.createElement("p", null, "See our", " ", /* @__PURE__ */ React.createElement("a", {
|
|
3895
3975
|
className: "text-gray-600",
|
|
3896
3976
|
style: { textDecoration: "underline" },
|
|
3897
3977
|
href: "https://tina.io/docs/errors/faq/",
|
|
3898
3978
|
target: "_blank"
|
|
3899
|
-
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */
|
|
3979
|
+
}, " ", "Error FAQ", " "), " ", "for more information."), /* @__PURE__ */ React.createElement("button", {
|
|
3900
3980
|
style: errorButtonStyles,
|
|
3901
3981
|
onClick: () => {
|
|
3902
3982
|
window.localStorage.removeItem("tinacms-current-branch");
|
|
@@ -3905,23 +3985,18 @@ class ErrorBoundary extends React__default.Component {
|
|
|
3905
3985
|
}, "Switch to default branch"))));
|
|
3906
3986
|
}
|
|
3907
3987
|
if (this.state.pageRefresh) {
|
|
3908
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ React.createElement(Loader, null, "Let's try that again.");
|
|
3909
3989
|
}
|
|
3910
3990
|
return this.props.children;
|
|
3911
3991
|
}
|
|
3912
3992
|
}
|
|
3913
|
-
const TinaCMSProvider2 = (
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
"query",
|
|
3921
|
-
"documentCreatorCallback",
|
|
3922
|
-
"formifyCallback",
|
|
3923
|
-
"schema"
|
|
3924
|
-
]);
|
|
3993
|
+
const TinaCMSProvider2 = ({
|
|
3994
|
+
query,
|
|
3995
|
+
documentCreatorCallback,
|
|
3996
|
+
formifyCallback,
|
|
3997
|
+
schema,
|
|
3998
|
+
...props
|
|
3999
|
+
}) => {
|
|
3925
4000
|
var _a;
|
|
3926
4001
|
const validOldSetup = new Boolean(props == null ? void 0 : props.isLocalClient) || new Boolean(props == null ? void 0 : props.clientId) && new Boolean(props == null ? void 0 : props.branch);
|
|
3927
4002
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
@@ -3936,7 +4011,7 @@ const TinaCMSProvider2 = (_c) => {
|
|
|
3936
4011
|
if (!schema) {
|
|
3937
4012
|
throw new Error("`schema` is required to be passed as a property to `TinaProvider`. You can learn more about this change here: https://github.com/tinacms/tinacms/pull/2823");
|
|
3938
4013
|
}
|
|
3939
|
-
return /* @__PURE__ */
|
|
4014
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TinaCloudProvider, {
|
|
3940
4015
|
branch,
|
|
3941
4016
|
clientId,
|
|
3942
4017
|
tinaioConfig: props.tinaioConfig,
|
|
@@ -3944,17 +4019,18 @@ const TinaCMSProvider2 = (_c) => {
|
|
|
3944
4019
|
cmsCallback: props.cmsCallback,
|
|
3945
4020
|
mediaStore: props.mediaStore,
|
|
3946
4021
|
schema
|
|
3947
|
-
}, /* @__PURE__ */
|
|
4022
|
+
}, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(DocumentCreator, {
|
|
3948
4023
|
documentCreatorCallback
|
|
3949
|
-
}), /* @__PURE__ */
|
|
4024
|
+
}), /* @__PURE__ */ React.createElement(TinaDataProvider, {
|
|
3950
4025
|
formifyCallback
|
|
3951
|
-
}, typeof props.children == "function" ? /* @__PURE__ */
|
|
4026
|
+
}, typeof props.children == "function" ? /* @__PURE__ */ React.createElement(TinaQuery, {
|
|
4027
|
+
...props,
|
|
3952
4028
|
variables: props.variables,
|
|
3953
4029
|
data: props.data,
|
|
3954
4030
|
query,
|
|
3955
4031
|
formifyCallback,
|
|
3956
4032
|
children: props.children
|
|
3957
|
-
})
|
|
4033
|
+
}) : props.children))));
|
|
3958
4034
|
};
|
|
3959
4035
|
const DocumentCreator = ({
|
|
3960
4036
|
documentCreatorCallback
|
|
@@ -3963,35 +4039,35 @@ const DocumentCreator = ({
|
|
|
3963
4039
|
return null;
|
|
3964
4040
|
};
|
|
3965
4041
|
const TinaQuery = (props) => {
|
|
3966
|
-
return /* @__PURE__ */
|
|
3967
|
-
key: `rootQuery-${props.query}
|
|
3968
|
-
|
|
4042
|
+
return /* @__PURE__ */ React.createElement(TinaQueryInner, {
|
|
4043
|
+
key: `rootQuery-${props.query}`,
|
|
4044
|
+
...props
|
|
4045
|
+
});
|
|
3969
4046
|
};
|
|
3970
|
-
const TinaQueryInner = (
|
|
3971
|
-
var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
|
|
4047
|
+
const TinaQueryInner = ({ children, ...props }) => {
|
|
3972
4048
|
const { data: liveData, isLoading } = useTina({
|
|
3973
4049
|
query: props.query,
|
|
3974
4050
|
variables: props.variables,
|
|
3975
4051
|
data: props.data
|
|
3976
4052
|
});
|
|
3977
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(isLoading || !props.query ? props : { ...props, data: liveData }));
|
|
3978
4054
|
};
|
|
3979
4055
|
const TinaDataProvider = ({
|
|
3980
4056
|
children,
|
|
3981
4057
|
formifyCallback
|
|
3982
4058
|
}) => {
|
|
3983
4059
|
const [request, setRequest] = useState();
|
|
3984
|
-
const [state, setState] =
|
|
4060
|
+
const [state, setState] = React.useState({
|
|
3985
4061
|
payload: void 0,
|
|
3986
4062
|
isLoading: true
|
|
3987
4063
|
});
|
|
3988
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ React.createElement(TinaDataContext.Provider, {
|
|
3989
4065
|
value: {
|
|
3990
4066
|
setRequest,
|
|
3991
4067
|
isLoading: state.isLoading,
|
|
3992
4068
|
state: { payload: state.payload }
|
|
3993
4069
|
}
|
|
3994
|
-
}, /* @__PURE__ */
|
|
4070
|
+
}, /* @__PURE__ */ React.createElement(FormRegistrar, {
|
|
3995
4071
|
key: request == null ? void 0 : request.query,
|
|
3996
4072
|
request,
|
|
3997
4073
|
formifyCallback,
|
|
@@ -4015,13 +4091,13 @@ const FormRegistrar = ({
|
|
|
4015
4091
|
}
|
|
4016
4092
|
}
|
|
4017
4093
|
});
|
|
4018
|
-
|
|
4094
|
+
React.useEffect(() => {
|
|
4019
4095
|
onPayloadStateChange({ payload, isLoading });
|
|
4020
4096
|
}, [JSON.stringify(payload), isLoading]);
|
|
4021
|
-
return isLoading ? /* @__PURE__ */
|
|
4097
|
+
return isLoading ? /* @__PURE__ */ React.createElement(Loader, null, /* @__PURE__ */ React.createElement(React.Fragment, null)) : null;
|
|
4022
4098
|
};
|
|
4023
4099
|
const Loader = (props) => {
|
|
4024
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4025
4101
|
style: {
|
|
4026
4102
|
position: "fixed",
|
|
4027
4103
|
background: "rgba(0, 0, 0, 0.5)",
|
|
@@ -4033,7 +4109,7 @@ const Loader = (props) => {
|
|
|
4033
4109
|
justifyContent: "center",
|
|
4034
4110
|
padding: "40px"
|
|
4035
4111
|
}
|
|
4036
|
-
}, /* @__PURE__ */
|
|
4112
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4037
4113
|
style: {
|
|
4038
4114
|
background: "#f6f6f9",
|
|
4039
4115
|
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
@@ -4046,7 +4122,7 @@ const Loader = (props) => {
|
|
|
4046
4122
|
justifyContent: "center",
|
|
4047
4123
|
flexDirection: "column"
|
|
4048
4124
|
}
|
|
4049
|
-
}, /* @__PURE__ */
|
|
4125
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4050
4126
|
style: {
|
|
4051
4127
|
width: "64px",
|
|
4052
4128
|
color: "#2296fe",
|
|
@@ -4062,13 +4138,13 @@ const Loader = (props) => {
|
|
|
4062
4138
|
viewBox: "0 0 100 64",
|
|
4063
4139
|
enableBackground: "new 0 0 0 0",
|
|
4064
4140
|
xmlSpace: "preserve"
|
|
4065
|
-
}, /* @__PURE__ */
|
|
4141
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4066
4142
|
fill: "currentColor",
|
|
4067
4143
|
stroke: "none",
|
|
4068
4144
|
cx: 6,
|
|
4069
4145
|
cy: 32,
|
|
4070
4146
|
r: 6
|
|
4071
|
-
}, /* @__PURE__ */
|
|
4147
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4072
4148
|
attributeName: "transform",
|
|
4073
4149
|
dur: "1s",
|
|
4074
4150
|
type: "translate",
|
|
@@ -4077,13 +4153,13 @@ const Loader = (props) => {
|
|
|
4077
4153
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4078
4154
|
repeatCount: "indefinite",
|
|
4079
4155
|
begin: "0.1"
|
|
4080
|
-
})), /* @__PURE__ */
|
|
4156
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4081
4157
|
fill: "currentColor",
|
|
4082
4158
|
stroke: "none",
|
|
4083
4159
|
cx: 30,
|
|
4084
4160
|
cy: 32,
|
|
4085
4161
|
r: 6
|
|
4086
|
-
}, /* @__PURE__ */
|
|
4162
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4087
4163
|
attributeName: "transform",
|
|
4088
4164
|
dur: "1s",
|
|
4089
4165
|
type: "translate",
|
|
@@ -4092,13 +4168,13 @@ const Loader = (props) => {
|
|
|
4092
4168
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4093
4169
|
repeatCount: "indefinite",
|
|
4094
4170
|
begin: "0.2"
|
|
4095
|
-
})), /* @__PURE__ */
|
|
4171
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4096
4172
|
fill: "currentColor",
|
|
4097
4173
|
stroke: "none",
|
|
4098
4174
|
cx: 54,
|
|
4099
4175
|
cy: 32,
|
|
4100
4176
|
r: 6
|
|
4101
|
-
}, /* @__PURE__ */
|
|
4177
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4102
4178
|
attributeName: "transform",
|
|
4103
4179
|
dur: "1s",
|
|
4104
4180
|
type: "translate",
|
|
@@ -4107,7 +4183,7 @@ const Loader = (props) => {
|
|
|
4107
4183
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4108
4184
|
repeatCount: "indefinite",
|
|
4109
4185
|
begin: "0.3"
|
|
4110
|
-
}))), /* @__PURE__ */
|
|
4186
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
4111
4187
|
style: {
|
|
4112
4188
|
fontSize: "18px",
|
|
4113
4189
|
color: "#252336",
|
|
@@ -4164,7 +4240,7 @@ function gql(strings, ...args) {
|
|
|
4164
4240
|
return str;
|
|
4165
4241
|
}
|
|
4166
4242
|
const Layout = ({ children }) => {
|
|
4167
|
-
return /* @__PURE__ */
|
|
4243
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement("div", {
|
|
4168
4244
|
className: "tina-tailwind",
|
|
4169
4245
|
style: {
|
|
4170
4246
|
position: "fixed",
|
|
@@ -4186,8 +4262,8 @@ var DefaultContext = {
|
|
|
4186
4262
|
style: void 0,
|
|
4187
4263
|
attr: void 0
|
|
4188
4264
|
};
|
|
4189
|
-
var IconContext =
|
|
4190
|
-
var __assign = function() {
|
|
4265
|
+
var IconContext = React.createContext && React.createContext(DefaultContext);
|
|
4266
|
+
var __assign = globalThis && globalThis.__assign || function() {
|
|
4191
4267
|
__assign = Object.assign || function(t) {
|
|
4192
4268
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4193
4269
|
s = arguments[i];
|
|
@@ -4199,7 +4275,7 @@ var __assign = function() {
|
|
|
4199
4275
|
};
|
|
4200
4276
|
return __assign.apply(this, arguments);
|
|
4201
4277
|
};
|
|
4202
|
-
var __rest = function(s, e) {
|
|
4278
|
+
var __rest = globalThis && globalThis.__rest || function(s, e) {
|
|
4203
4279
|
var t = {};
|
|
4204
4280
|
for (var p in s)
|
|
4205
4281
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -4213,14 +4289,14 @@ var __rest = function(s, e) {
|
|
|
4213
4289
|
};
|
|
4214
4290
|
function Tree2Element(tree) {
|
|
4215
4291
|
return tree && tree.map(function(node2, i) {
|
|
4216
|
-
return
|
|
4292
|
+
return React.createElement(node2.tag, __assign({
|
|
4217
4293
|
key: i
|
|
4218
4294
|
}, node2.attr), Tree2Element(node2.child));
|
|
4219
4295
|
});
|
|
4220
4296
|
}
|
|
4221
4297
|
function GenIcon(data) {
|
|
4222
4298
|
return function(props) {
|
|
4223
|
-
return
|
|
4299
|
+
return React.createElement(IconBase, __assign({
|
|
4224
4300
|
attr: __assign({}, data.attr)
|
|
4225
4301
|
}, props), Tree2Element(data.child));
|
|
4226
4302
|
};
|
|
@@ -4234,7 +4310,7 @@ function IconBase(props) {
|
|
|
4234
4310
|
className = conf.className;
|
|
4235
4311
|
if (props.className)
|
|
4236
4312
|
className = (className ? className + " " : "") + props.className;
|
|
4237
|
-
return
|
|
4313
|
+
return React.createElement("svg", __assign({
|
|
4238
4314
|
stroke: "currentColor",
|
|
4239
4315
|
fill: "currentColor",
|
|
4240
4316
|
strokeWidth: "0"
|
|
@@ -4246,9 +4322,9 @@ function IconBase(props) {
|
|
|
4246
4322
|
height: computedSize,
|
|
4247
4323
|
width: computedSize,
|
|
4248
4324
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4249
|
-
}), title &&
|
|
4325
|
+
}), title && React.createElement("title", null, title), props.children);
|
|
4250
4326
|
};
|
|
4251
|
-
return IconContext !== void 0 ?
|
|
4327
|
+
return IconContext !== void 0 ? React.createElement(IconContext.Consumer, null, function(conf) {
|
|
4252
4328
|
return elem(conf);
|
|
4253
4329
|
}) : elem(DefaultContext);
|
|
4254
4330
|
}
|
|
@@ -4286,9 +4362,6 @@ function IoMdClose(props) {
|
|
|
4286
4362
|
function BiEdit(props) {
|
|
4287
4363
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m7 17.013 4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z" } }, { "tag": "path", "attr": { "d": "M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z" } }] })(props);
|
|
4288
4364
|
}
|
|
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
4365
|
function BiLogIn(props) {
|
|
4293
4366
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m13 16 5-4-5-4v3H4v2h9z" } }, { "tag": "path", "attr": { "d": "M20 3h-9c-1.103 0-2 .897-2 2v4h2V5h9v14h-9v-4H9v4c0 1.103.897 2 2 2h9c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2z" } }] })(props);
|
|
4294
4367
|
}
|
|
@@ -4301,9 +4374,6 @@ function BiMenu(props) {
|
|
|
4301
4374
|
function BiPlus(props) {
|
|
4302
4375
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z" } }] })(props);
|
|
4303
4376
|
}
|
|
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
4377
|
function BiTrash(props) {
|
|
4308
4378
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M5 20a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8h2V6h-4V4a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v2H3v2h2zM9 4h6v2H9zM8 8h9v12H7V8z" } }, { "tag": "path", "attr": { "d": "M9 10h2v8H9zm4 0h2v8h-2z" } }] })(props);
|
|
4309
4379
|
}
|
|
@@ -4314,47 +4384,47 @@ const Sidebar = ({ cms }) => {
|
|
|
4314
4384
|
var _a, _b;
|
|
4315
4385
|
const collectionsInfo = useGetCollections(cms);
|
|
4316
4386
|
const screens = cms.plugins.getType("screen").all();
|
|
4317
|
-
const [menuIsOpen, setMenuIsOpen] =
|
|
4387
|
+
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
4318
4388
|
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
4319
4389
|
const navBreakpoint = 1e3;
|
|
4320
4390
|
const windowWidth = useWindowWidth();
|
|
4321
4391
|
const renderDesktopNav = windowWidth > navBreakpoint;
|
|
4322
|
-
return /* @__PURE__ */
|
|
4392
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderDesktopNav && /* @__PURE__ */ React.createElement(Nav, {
|
|
4323
4393
|
sidebarWidth: 360,
|
|
4324
4394
|
showCollections: true,
|
|
4325
4395
|
collectionsInfo,
|
|
4326
4396
|
screens,
|
|
4327
4397
|
contentCreators: [],
|
|
4328
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */
|
|
4398
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4329
4399
|
label: view.name,
|
|
4330
4400
|
to: `screens/${slugify(view.name)}`,
|
|
4331
4401
|
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
4332
4402
|
}),
|
|
4333
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */
|
|
4403
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4334
4404
|
label: collection.label ? collection.label : collection.name,
|
|
4335
4405
|
to: `collections/${collection.name}`,
|
|
4336
4406
|
Icon: ImFilesEmpty
|
|
4337
4407
|
})
|
|
4338
|
-
}), !renderDesktopNav && /* @__PURE__ */
|
|
4408
|
+
}), !renderDesktopNav && /* @__PURE__ */ React.createElement(Transition, {
|
|
4339
4409
|
show: menuIsOpen
|
|
4340
|
-
}, /* @__PURE__ */
|
|
4341
|
-
as:
|
|
4410
|
+
}, /* @__PURE__ */ React.createElement(Transition.Child, {
|
|
4411
|
+
as: React.Fragment,
|
|
4342
4412
|
enter: "transform transition-all ease-out duration-300",
|
|
4343
4413
|
enterFrom: "opacity-0 -translate-x-full",
|
|
4344
4414
|
enterTo: "opacity-100 translate-x-0",
|
|
4345
4415
|
leave: "transform transition-all ease-in duration-200",
|
|
4346
4416
|
leaveFrom: "opacity-100 translate-x-0",
|
|
4347
4417
|
leaveTo: "opacity-0 -translate-x-full"
|
|
4348
|
-
}, /* @__PURE__ */
|
|
4418
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4349
4419
|
className: "fixed left-0 top-0 z-overlay h-full transform"
|
|
4350
|
-
}, /* @__PURE__ */
|
|
4420
|
+
}, /* @__PURE__ */ React.createElement(Nav, {
|
|
4351
4421
|
className: "rounded-r-md",
|
|
4352
4422
|
sidebarWidth: 360,
|
|
4353
4423
|
showCollections: true,
|
|
4354
4424
|
collectionsInfo,
|
|
4355
4425
|
screens,
|
|
4356
4426
|
contentCreators: [],
|
|
4357
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */
|
|
4427
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4358
4428
|
label: view.name,
|
|
4359
4429
|
to: `screens/${slugify(view.name)}`,
|
|
4360
4430
|
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
@@ -4362,7 +4432,7 @@ const Sidebar = ({ cms }) => {
|
|
|
4362
4432
|
setMenuIsOpen(false);
|
|
4363
4433
|
}
|
|
4364
4434
|
}),
|
|
4365
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */
|
|
4435
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
4366
4436
|
label: collection.label ? collection.label : collection.name,
|
|
4367
4437
|
to: `collections/${collection.name}`,
|
|
4368
4438
|
Icon: ImFilesEmpty,
|
|
@@ -4370,19 +4440,19 @@ const Sidebar = ({ cms }) => {
|
|
|
4370
4440
|
setMenuIsOpen(false);
|
|
4371
4441
|
}
|
|
4372
4442
|
})
|
|
4373
|
-
}, /* @__PURE__ */
|
|
4443
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4374
4444
|
className: "absolute top-8 right-0 transform translate-x-full overflow-hidden"
|
|
4375
|
-
}, /* @__PURE__ */
|
|
4445
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4376
4446
|
rounded: "right",
|
|
4377
4447
|
variant: "secondary",
|
|
4378
4448
|
onClick: () => {
|
|
4379
4449
|
setMenuIsOpen(false);
|
|
4380
4450
|
},
|
|
4381
4451
|
className: `transition-opacity duration-150 ease-out`
|
|
4382
|
-
}, /* @__PURE__ */
|
|
4452
|
+
}, /* @__PURE__ */ React.createElement(IoMdClose, {
|
|
4383
4453
|
className: "h-6 w-auto"
|
|
4384
|
-
})))))), /* @__PURE__ */
|
|
4385
|
-
as:
|
|
4454
|
+
})))))), /* @__PURE__ */ React.createElement(Transition.Child, {
|
|
4455
|
+
as: React.Fragment,
|
|
4386
4456
|
enter: "ease-out duration-300",
|
|
4387
4457
|
enterFrom: "opacity-0",
|
|
4388
4458
|
enterTo: "opacity-80",
|
|
@@ -4390,39 +4460,39 @@ const Sidebar = ({ cms }) => {
|
|
|
4390
4460
|
leave: "ease-in duration-200",
|
|
4391
4461
|
leaveFrom: "opacity-80",
|
|
4392
4462
|
leaveTo: "opacity-0"
|
|
4393
|
-
}, /* @__PURE__ */
|
|
4463
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4394
4464
|
onClick: () => {
|
|
4395
4465
|
setMenuIsOpen(false);
|
|
4396
4466
|
},
|
|
4397
4467
|
className: "fixed z-menu inset-0 bg-gradient-to-br from-gray-800 via-gray-900 to-black"
|
|
4398
|
-
}))), !renderDesktopNav && /* @__PURE__ */
|
|
4468
|
+
}))), !renderDesktopNav && /* @__PURE__ */ React.createElement(Button, {
|
|
4399
4469
|
rounded: "right",
|
|
4400
4470
|
variant: "secondary",
|
|
4401
4471
|
onClick: () => {
|
|
4402
4472
|
setMenuIsOpen(true);
|
|
4403
4473
|
},
|
|
4404
4474
|
className: `pointer-events-auto -ml-px absolute left-0 z-50 ${isLocalMode ? `top-10` : `top-4`}`
|
|
4405
|
-
}, /* @__PURE__ */
|
|
4475
|
+
}, /* @__PURE__ */ React.createElement(BiMenu, {
|
|
4406
4476
|
className: "h-7 w-auto"
|
|
4407
4477
|
})));
|
|
4408
4478
|
};
|
|
4409
4479
|
const SidebarLink = (props) => {
|
|
4410
4480
|
const { to, label, Icon } = props;
|
|
4411
|
-
return /* @__PURE__ */
|
|
4481
|
+
return /* @__PURE__ */ React.createElement(NavLink, {
|
|
4412
4482
|
className: ({ isActive }) => {
|
|
4413
4483
|
return `text-base tracking-wide ${isActive ? "text-blue-600" : "text-gray-500"} hover:text-blue-600 flex items-center opacity-90 hover:opacity-100`;
|
|
4414
4484
|
},
|
|
4415
4485
|
onClick: props.onClick ? props.onClick : () => {
|
|
4416
4486
|
},
|
|
4417
4487
|
to
|
|
4418
|
-
}, /* @__PURE__ */
|
|
4488
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
4419
4489
|
className: "mr-2 h-6 opacity-80 w-auto"
|
|
4420
4490
|
}), " ", label);
|
|
4421
4491
|
};
|
|
4422
4492
|
const GetCMS = ({ children }) => {
|
|
4423
4493
|
try {
|
|
4424
4494
|
const cms = useCMS();
|
|
4425
|
-
return /* @__PURE__ */
|
|
4495
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
|
|
4426
4496
|
} catch (e) {
|
|
4427
4497
|
return null;
|
|
4428
4498
|
}
|
|
@@ -4434,52 +4504,52 @@ const AuthTemplate = ({
|
|
|
4434
4504
|
message,
|
|
4435
4505
|
children
|
|
4436
4506
|
}) => {
|
|
4437
|
-
return /* @__PURE__ */
|
|
4507
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4438
4508
|
className: "h-screen w-full bg-gradient-to-b from-blue-900 to-gray-900 flex items-center justify-center px-4 py-6"
|
|
4439
|
-
}, /* @__PURE__ */
|
|
4509
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4440
4510
|
className: "bg-white rounded-lg overflow-hidden shadow-lg w-full max-w-lg"
|
|
4441
|
-
}, /* @__PURE__ */
|
|
4511
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4442
4512
|
className: "px-5 py-4 border-b border-gray-150"
|
|
4443
|
-
}, /* @__PURE__ */
|
|
4513
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
4444
4514
|
className: "text-2xl font-sans tracking-wide text-gray-700 flex items-center gap-0.5"
|
|
4445
|
-
}, /* @__PURE__ */
|
|
4515
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4446
4516
|
viewBox: "0 0 32 32",
|
|
4447
4517
|
fill: "#EC4815",
|
|
4448
4518
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4449
4519
|
className: "w-10 h-auto"
|
|
4450
|
-
}, /* @__PURE__ */
|
|
4520
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
4451
4521
|
d: "M18.6466 14.5553C19.9018 13.5141 20.458 7.36086 21.0014 5.14903C21.5447 2.9372 23.7919 3.04938 23.7919 3.04938C23.7919 3.04938 23.2085 4.06764 23.4464 4.82751C23.6844 5.58738 25.3145 6.26662 25.3145 6.26662L24.9629 7.19622C24.9629 7.19622 24.2288 7.10204 23.7919 7.9785C23.355 8.85496 24.3392 17.4442 24.3392 17.4442C24.3392 17.4442 21.4469 22.7275 21.4469 24.9206C21.4469 27.1136 22.4819 28.9515 22.4819 28.9515H21.0296C21.0296 28.9515 18.899 26.4086 18.462 25.1378C18.0251 23.8669 18.1998 22.596 18.1998 22.596C18.1998 22.596 15.8839 22.4646 13.8303 22.596C11.7767 22.7275 10.4072 24.498 10.16 25.4884C9.91287 26.4787 9.81048 28.9515 9.81048 28.9515H8.66211C7.96315 26.7882 7.40803 26.0129 7.70918 24.9206C8.54334 21.8949 8.37949 20.1788 8.18635 19.4145C7.99321 18.6501 6.68552 17.983 6.68552 17.983C7.32609 16.6741 7.97996 16.0452 10.7926 15.9796C13.6052 15.914 17.3915 15.5965 18.6466 14.5553Z"
|
|
4452
|
-
}), /* @__PURE__ */
|
|
4522
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
4453
4523
|
d: "M11.1268 24.7939C11.1268 24.7939 11.4236 27.5481 13.0001 28.9516H14.3511C13.0001 27.4166 12.8527 23.4155 12.8527 23.4155C12.1656 23.6399 11.3045 24.3846 11.1268 24.7939Z"
|
|
4454
|
-
})), /* @__PURE__ */
|
|
4524
|
+
})), /* @__PURE__ */ React.createElement("span", null, "Tina"))), message && /* @__PURE__ */ React.createElement("div", {
|
|
4455
4525
|
className: "px-5 pt-4"
|
|
4456
|
-
}, /* @__PURE__ */
|
|
4526
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
4457
4527
|
className: "text-base font-sans leading-normal"
|
|
4458
|
-
}, message)), /* @__PURE__ */
|
|
4528
|
+
}, message)), /* @__PURE__ */ React.createElement("div", {
|
|
4459
4529
|
className: "px-5 py-4 flex gap-4 w-full justify-between"
|
|
4460
4530
|
}, children)));
|
|
4461
4531
|
};
|
|
4462
4532
|
const LoginPage = () => {
|
|
4463
4533
|
const { setEdit } = useEditState();
|
|
4464
4534
|
const login = () => setEdit(true);
|
|
4465
|
-
return /* @__PURE__ */
|
|
4535
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
4466
4536
|
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
4467
|
-
}, /* @__PURE__ */
|
|
4537
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4468
4538
|
onClick: () => {
|
|
4469
4539
|
window.location.href = "/";
|
|
4470
4540
|
},
|
|
4471
4541
|
variant: "white",
|
|
4472
4542
|
size: "custom",
|
|
4473
4543
|
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
4474
|
-
}, /* @__PURE__ */
|
|
4544
|
+
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
4475
4545
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4476
|
-
}), " Back To Site"), /* @__PURE__ */
|
|
4546
|
+
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
4477
4547
|
onClick: () => login(),
|
|
4478
4548
|
variant: "primary",
|
|
4479
4549
|
size: "custom",
|
|
4480
4550
|
className: "text-base h-12 px-6 flex-1",
|
|
4481
4551
|
type: "submit"
|
|
4482
|
-
}, /* @__PURE__ */
|
|
4552
|
+
}, /* @__PURE__ */ React.createElement(BiLogIn, {
|
|
4483
4553
|
className: "w-6 h-auto mr-2 opacity-80"
|
|
4484
4554
|
}), " Edit With Tina")));
|
|
4485
4555
|
};
|
|
@@ -4488,67 +4558,67 @@ const logout = () => {
|
|
|
4488
4558
|
window.location.href = "/";
|
|
4489
4559
|
};
|
|
4490
4560
|
const LogoutPage = () => {
|
|
4491
|
-
return /* @__PURE__ */
|
|
4561
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
4492
4562
|
className: "flex w-full flex-1 gap-4 items-center justify-end"
|
|
4493
|
-
}, /* @__PURE__ */
|
|
4563
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
4494
4564
|
onClick: () => {
|
|
4495
4565
|
window.location.href = "/";
|
|
4496
4566
|
},
|
|
4497
4567
|
variant: "white",
|
|
4498
4568
|
size: "custom",
|
|
4499
4569
|
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
4500
|
-
}, /* @__PURE__ */
|
|
4570
|
+
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
4501
4571
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4502
|
-
}), " Back To Site"), /* @__PURE__ */
|
|
4572
|
+
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
4503
4573
|
onClick: () => logout(),
|
|
4504
4574
|
type: "submit",
|
|
4505
4575
|
variant: "primary",
|
|
4506
4576
|
size: "custom",
|
|
4507
4577
|
className: "text-base h-12 px-6 flex-1"
|
|
4508
|
-
}, /* @__PURE__ */
|
|
4578
|
+
}, /* @__PURE__ */ React.createElement(BiLogOut, {
|
|
4509
4579
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
4510
4580
|
}), " Log Out of Tina")));
|
|
4511
4581
|
};
|
|
4512
4582
|
const PageWrapper = ({
|
|
4513
4583
|
children
|
|
4514
4584
|
}) => {
|
|
4515
|
-
return /* @__PURE__ */
|
|
4585
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4516
4586
|
className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
|
|
4517
4587
|
}, children);
|
|
4518
4588
|
};
|
|
4519
4589
|
const PageHeader = ({
|
|
4520
4590
|
isLocalMode,
|
|
4521
4591
|
children
|
|
4522
|
-
}) => /* @__PURE__ */
|
|
4592
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
4523
4593
|
className: "bg-white pb-4 pt-18 border-b border-gray-200 px-12"
|
|
4524
|
-
}, /* @__PURE__ */
|
|
4594
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4525
4595
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4526
|
-
}, /* @__PURE__ */
|
|
4596
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4527
4597
|
className: "w-full flex justify-between items-end"
|
|
4528
4598
|
}, children))));
|
|
4529
4599
|
const PageBody = ({
|
|
4530
4600
|
children
|
|
4531
|
-
}) => /* @__PURE__ */
|
|
4601
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4532
4602
|
className: "py-10 px-12"
|
|
4533
4603
|
}, children);
|
|
4534
4604
|
const PageBodyNarrow = ({
|
|
4535
4605
|
children
|
|
4536
|
-
}) => /* @__PURE__ */
|
|
4606
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4537
4607
|
className: "py-10 px-12"
|
|
4538
|
-
}, /* @__PURE__ */
|
|
4608
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4539
4609
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4540
4610
|
}, children));
|
|
4541
4611
|
const DashboardPage = () => {
|
|
4542
|
-
return /* @__PURE__ */
|
|
4612
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4543
4613
|
var _a, _b;
|
|
4544
|
-
return /* @__PURE__ */
|
|
4614
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, {
|
|
4545
4615
|
isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
4546
|
-
}, /* @__PURE__ */
|
|
4616
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
4547
4617
|
className: "text-2xl font-sans text-gray-700"
|
|
4548
|
-
}, "Welcome to Tina!")), /* @__PURE__ */
|
|
4618
|
+
}, "Welcome to Tina!")), /* @__PURE__ */ React.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
4549
4619
|
});
|
|
4550
4620
|
};
|
|
4551
|
-
const LoadingPage = () => /* @__PURE__ */
|
|
4621
|
+
const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
4552
4622
|
style: {
|
|
4553
4623
|
position: "absolute",
|
|
4554
4624
|
top: 0,
|
|
@@ -4562,7 +4632,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4562
4632
|
justifyContent: "center",
|
|
4563
4633
|
padding: "120px 40px 40px 40px"
|
|
4564
4634
|
}
|
|
4565
|
-
}, /* @__PURE__ */
|
|
4635
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4566
4636
|
style: {
|
|
4567
4637
|
background: "#FFF",
|
|
4568
4638
|
border: "1px solid #EDECF3",
|
|
@@ -4576,7 +4646,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4576
4646
|
justifyContent: "center",
|
|
4577
4647
|
flexDirection: "column"
|
|
4578
4648
|
}
|
|
4579
|
-
}, /* @__PURE__ */
|
|
4649
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
4580
4650
|
style: {
|
|
4581
4651
|
width: "64px",
|
|
4582
4652
|
color: "#2296fe",
|
|
@@ -4592,13 +4662,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4592
4662
|
viewBox: "0 0 100 64",
|
|
4593
4663
|
enableBackground: "new 0 0 0 0",
|
|
4594
4664
|
xmlSpace: "preserve"
|
|
4595
|
-
}, /* @__PURE__ */
|
|
4665
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4596
4666
|
fill: "currentColor",
|
|
4597
4667
|
stroke: "none",
|
|
4598
4668
|
cx: 6,
|
|
4599
4669
|
cy: 32,
|
|
4600
4670
|
r: 6
|
|
4601
|
-
}, /* @__PURE__ */
|
|
4671
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4602
4672
|
attributeName: "transform",
|
|
4603
4673
|
dur: "1s",
|
|
4604
4674
|
type: "translate",
|
|
@@ -4607,13 +4677,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4607
4677
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4608
4678
|
repeatCount: "indefinite",
|
|
4609
4679
|
begin: "0.1"
|
|
4610
|
-
})), /* @__PURE__ */
|
|
4680
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4611
4681
|
fill: "currentColor",
|
|
4612
4682
|
stroke: "none",
|
|
4613
4683
|
cx: 30,
|
|
4614
4684
|
cy: 32,
|
|
4615
4685
|
r: 6
|
|
4616
|
-
}, /* @__PURE__ */
|
|
4686
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4617
4687
|
attributeName: "transform",
|
|
4618
4688
|
dur: "1s",
|
|
4619
4689
|
type: "translate",
|
|
@@ -4622,13 +4692,13 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4622
4692
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4623
4693
|
repeatCount: "indefinite",
|
|
4624
4694
|
begin: "0.2"
|
|
4625
|
-
})), /* @__PURE__ */
|
|
4695
|
+
})), /* @__PURE__ */ React.createElement("circle", {
|
|
4626
4696
|
fill: "currentColor",
|
|
4627
4697
|
stroke: "none",
|
|
4628
4698
|
cx: 54,
|
|
4629
4699
|
cy: 32,
|
|
4630
4700
|
r: 6
|
|
4631
|
-
}, /* @__PURE__ */
|
|
4701
|
+
}, /* @__PURE__ */ React.createElement("animateTransform", {
|
|
4632
4702
|
attributeName: "transform",
|
|
4633
4703
|
dur: "1s",
|
|
4634
4704
|
type: "translate",
|
|
@@ -4637,7 +4707,7 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
4637
4707
|
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4638
4708
|
repeatCount: "indefinite",
|
|
4639
4709
|
begin: "0.3"
|
|
4640
|
-
}))), /* @__PURE__ */
|
|
4710
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
4641
4711
|
style: {
|
|
4642
4712
|
fontSize: "16px",
|
|
4643
4713
|
color: "#716c7f",
|
|
@@ -4686,161 +4756,19 @@ const GetCollection = ({
|
|
|
4686
4756
|
return null;
|
|
4687
4757
|
}
|
|
4688
4758
|
if (loading) {
|
|
4689
|
-
return /* @__PURE__ */
|
|
4759
|
+
return /* @__PURE__ */ React.createElement(LoadingPage, null);
|
|
4690
4760
|
}
|
|
4691
|
-
return /* @__PURE__ */
|
|
4761
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(collection, loading, reFetchCollection));
|
|
4692
4762
|
};
|
|
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;
|
|
4759
|
-
}
|
|
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);
|
|
4811
|
-
};
|
|
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
4763
|
const TemplateMenu = ({ templates }) => {
|
|
4836
|
-
return /* @__PURE__ */
|
|
4764
|
+
return /* @__PURE__ */ React.createElement(Menu, {
|
|
4837
4765
|
as: "div",
|
|
4838
4766
|
className: "relative inline-block text-left"
|
|
4839
|
-
}, () => /* @__PURE__ */
|
|
4767
|
+
}, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Menu.Button, {
|
|
4840
4768
|
className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
4841
|
-
}, "Create New ", /* @__PURE__ */
|
|
4769
|
+
}, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4842
4770
|
className: "w-5 h-full ml-1 opacity-70"
|
|
4843
|
-
}))), /* @__PURE__ */
|
|
4771
|
+
}))), /* @__PURE__ */ React.createElement(Transition, {
|
|
4844
4772
|
as: Fragment,
|
|
4845
4773
|
enter: "transition ease-out duration-100",
|
|
4846
4774
|
enterFrom: "transform opacity-0 scale-95",
|
|
@@ -4848,13 +4776,13 @@ const TemplateMenu = ({ templates }) => {
|
|
|
4848
4776
|
leave: "transition ease-in duration-75",
|
|
4849
4777
|
leaveFrom: "transform opacity-100 scale-100",
|
|
4850
4778
|
leaveTo: "transform opacity-0 scale-95"
|
|
4851
|
-
}, /* @__PURE__ */
|
|
4779
|
+
}, /* @__PURE__ */ React.createElement(Menu.Items, {
|
|
4852
4780
|
className: "origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none"
|
|
4853
|
-
}, /* @__PURE__ */
|
|
4781
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4854
4782
|
className: "py-1"
|
|
4855
|
-
}, templates.map((template) => /* @__PURE__ */
|
|
4783
|
+
}, templates.map((template) => /* @__PURE__ */ React.createElement(Menu.Item, {
|
|
4856
4784
|
key: `${template.label}-${template.name}`
|
|
4857
|
-
}, ({ active }) => /* @__PURE__ */
|
|
4785
|
+
}, ({ active }) => /* @__PURE__ */ React.createElement(Link, {
|
|
4858
4786
|
to: `${template.name}/new`,
|
|
4859
4787
|
className: `w-full text-md px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`
|
|
4860
4788
|
}, template.label))))))));
|
|
@@ -4873,8 +4801,8 @@ const handleNavigate = (navigate, cms, collection, document) => {
|
|
|
4873
4801
|
const CollectionListPage = () => {
|
|
4874
4802
|
const navigate = useNavigate();
|
|
4875
4803
|
const { collectionName } = useParams();
|
|
4876
|
-
const [open, setOpen] =
|
|
4877
|
-
const [vars, setVars] =
|
|
4804
|
+
const [open, setOpen] = React.useState(false);
|
|
4805
|
+
const [vars, setVars] = React.useState({
|
|
4878
4806
|
collection: collectionName,
|
|
4879
4807
|
relativePath: ""
|
|
4880
4808
|
});
|
|
@@ -4885,8 +4813,8 @@ const CollectionListPage = () => {
|
|
|
4885
4813
|
setEndCursor("");
|
|
4886
4814
|
setPrevCursors([]);
|
|
4887
4815
|
}, [loc]);
|
|
4888
|
-
return /* @__PURE__ */
|
|
4889
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4817
|
+
return /* @__PURE__ */ React.createElement(GetCollection, {
|
|
4890
4818
|
cms,
|
|
4891
4819
|
collectionName,
|
|
4892
4820
|
includeDocuments: true,
|
|
@@ -4898,7 +4826,7 @@ const CollectionListPage = () => {
|
|
|
4898
4826
|
const admin = cms.api.admin;
|
|
4899
4827
|
const pageInfo = collection.documents.pageInfo;
|
|
4900
4828
|
const useDataFlag = cms.flags.get("experimentalData");
|
|
4901
|
-
return /* @__PURE__ */
|
|
4829
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
4902
4830
|
filename: vars.relativePath,
|
|
4903
4831
|
deleteFunc: async () => {
|
|
4904
4832
|
try {
|
|
@@ -4912,71 +4840,71 @@ const CollectionListPage = () => {
|
|
|
4912
4840
|
}
|
|
4913
4841
|
},
|
|
4914
4842
|
close: () => setOpen(false)
|
|
4915
|
-
}), /* @__PURE__ */
|
|
4843
|
+
}), /* @__PURE__ */ React.createElement(PageHeader, {
|
|
4916
4844
|
isLocalMode: (_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
4917
|
-
}, /* @__PURE__ */
|
|
4845
|
+
}, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h3", {
|
|
4918
4846
|
className: "font-sans text-2xl text-gray-700"
|
|
4919
|
-
}, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */
|
|
4847
|
+
}, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
|
|
4920
4848
|
to: `new`,
|
|
4921
4849
|
className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
4922
|
-
}, "Create New", " ", /* @__PURE__ */
|
|
4850
|
+
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4923
4851
|
className: "w-5 h-full ml-1 opacity-70"
|
|
4924
|
-
})), collection.templates && /* @__PURE__ */
|
|
4852
|
+
})), collection.templates && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
4925
4853
|
templates: collection.templates
|
|
4926
|
-
}))), /* @__PURE__ */
|
|
4854
|
+
}))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
4927
4855
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4928
|
-
}, totalCount > 0 && /* @__PURE__ */
|
|
4856
|
+
}, totalCount > 0 && /* @__PURE__ */ React.createElement("table", {
|
|
4929
4857
|
className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
4930
|
-
}, /* @__PURE__ */
|
|
4858
|
+
}, /* @__PURE__ */ React.createElement("tbody", {
|
|
4931
4859
|
className: "divide-y divide-gray-150"
|
|
4932
4860
|
}, documents.map((document) => {
|
|
4933
4861
|
var _a2;
|
|
4934
4862
|
const hasTitle = Boolean(document.node._sys.title);
|
|
4935
4863
|
const subfolders = document.node._sys.breadcrumbs.slice(0, -1).join("/");
|
|
4936
|
-
return /* @__PURE__ */
|
|
4864
|
+
return /* @__PURE__ */ React.createElement("tr", {
|
|
4937
4865
|
key: `document-${document.node._sys.relativePath}`,
|
|
4938
4866
|
className: ""
|
|
4939
|
-
}, /* @__PURE__ */
|
|
4867
|
+
}, /* @__PURE__ */ React.createElement("td", {
|
|
4940
4868
|
className: "px-6 py-2 whitespace-nowrap"
|
|
4941
|
-
}, /* @__PURE__ */
|
|
4869
|
+
}, /* @__PURE__ */ React.createElement("a", {
|
|
4942
4870
|
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
4943
4871
|
onClick: () => {
|
|
4944
4872
|
handleNavigate(navigate, cms, collection, document.node);
|
|
4945
4873
|
}
|
|
4946
|
-
}, /* @__PURE__ */
|
|
4874
|
+
}, /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4947
4875
|
className: "inline-block h-6 w-auto opacity-70"
|
|
4948
|
-
}), /* @__PURE__ */
|
|
4876
|
+
}), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", {
|
|
4949
4877
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4950
|
-
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */
|
|
4878
|
+
}, hasTitle ? "Title" : "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
4951
4879
|
className: "h-5 leading-5 block whitespace-nowrap"
|
|
4952
|
-
}, subfolders && /* @__PURE__ */
|
|
4880
|
+
}, subfolders && /* @__PURE__ */ React.createElement("span", {
|
|
4953
4881
|
className: "text-xs text-gray-400"
|
|
4954
|
-
}, `${subfolders}/`), /* @__PURE__ */
|
|
4882
|
+
}, `${subfolders}/`), /* @__PURE__ */ React.createElement("span", null, hasTitle ? (_a2 = document.node._sys) == null ? void 0 : _a2.title : document.node._sys.filename))))), hasTitle && /* @__PURE__ */ React.createElement("td", {
|
|
4955
4883
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4956
|
-
}, /* @__PURE__ */
|
|
4884
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4957
4885
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4958
|
-
}, "Filename"), /* @__PURE__ */
|
|
4886
|
+
}, "Filename"), /* @__PURE__ */ React.createElement("span", {
|
|
4959
4887
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4960
|
-
}, document.node._sys.filename)), /* @__PURE__ */
|
|
4888
|
+
}, document.node._sys.filename)), /* @__PURE__ */ React.createElement("td", {
|
|
4961
4889
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4962
|
-
}, /* @__PURE__ */
|
|
4890
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4963
4891
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4964
|
-
}, "Extension"), /* @__PURE__ */
|
|
4892
|
+
}, "Extension"), /* @__PURE__ */ React.createElement("span", {
|
|
4965
4893
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4966
|
-
}, document.node._sys.extension)), /* @__PURE__ */
|
|
4894
|
+
}, document.node._sys.extension)), /* @__PURE__ */ React.createElement("td", {
|
|
4967
4895
|
className: "px-6 py-4 whitespace-nowrap"
|
|
4968
|
-
}, /* @__PURE__ */
|
|
4896
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4969
4897
|
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4970
|
-
}, "Template"), /* @__PURE__ */
|
|
4898
|
+
}, "Template"), /* @__PURE__ */ React.createElement("span", {
|
|
4971
4899
|
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4972
|
-
}, document.node._sys.template)), /* @__PURE__ */
|
|
4900
|
+
}, document.node._sys.template)), /* @__PURE__ */ React.createElement("td", {
|
|
4973
4901
|
className: "w-0"
|
|
4974
|
-
}, /* @__PURE__ */
|
|
4902
|
+
}, /* @__PURE__ */ React.createElement(OverflowMenu, {
|
|
4975
4903
|
toolbarItems: [
|
|
4976
4904
|
{
|
|
4977
4905
|
name: "edit",
|
|
4978
4906
|
label: "Edit in Admin",
|
|
4979
|
-
Icon: /* @__PURE__ */
|
|
4907
|
+
Icon: /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4980
4908
|
size: "1.3rem"
|
|
4981
4909
|
}),
|
|
4982
4910
|
onMouseDown: () => {
|
|
@@ -4986,7 +4914,7 @@ const CollectionListPage = () => {
|
|
|
4986
4914
|
{
|
|
4987
4915
|
name: "delete",
|
|
4988
4916
|
label: "Delete",
|
|
4989
|
-
Icon: /* @__PURE__ */
|
|
4917
|
+
Icon: /* @__PURE__ */ React.createElement(BiTrash, {
|
|
4990
4918
|
size: "1.3rem",
|
|
4991
4919
|
className: "text-red-500"
|
|
4992
4920
|
}),
|
|
@@ -5000,9 +4928,9 @@ const CollectionListPage = () => {
|
|
|
5000
4928
|
}
|
|
5001
4929
|
]
|
|
5002
4930
|
})));
|
|
5003
|
-
}))), useDataFlag && /* @__PURE__ */
|
|
4931
|
+
}))), useDataFlag && /* @__PURE__ */ React.createElement("div", {
|
|
5004
4932
|
className: "pt-3"
|
|
5005
|
-
}, /* @__PURE__ */
|
|
4933
|
+
}, /* @__PURE__ */ React.createElement(CursorPaginator, {
|
|
5006
4934
|
variant: "white",
|
|
5007
4935
|
hasNext: pageInfo == null ? void 0 : pageInfo.hasNextPage,
|
|
5008
4936
|
navigateNext: () => {
|
|
@@ -5024,14 +4952,14 @@ const CollectionListPage = () => {
|
|
|
5024
4952
|
});
|
|
5025
4953
|
};
|
|
5026
4954
|
const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
|
|
5027
|
-
return /* @__PURE__ */
|
|
4955
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, {
|
|
5028
4956
|
close: close2
|
|
5029
|
-
}, "Delete ", filename), /* @__PURE__ */
|
|
4957
|
+
}, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, {
|
|
5030
4958
|
padded: true
|
|
5031
|
-
}, /* @__PURE__ */
|
|
4959
|
+
}, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button, {
|
|
5032
4960
|
style: { flexGrow: 2 },
|
|
5033
4961
|
onClick: close2
|
|
5034
|
-
}, "Cancel"), /* @__PURE__ */
|
|
4962
|
+
}, "Cancel"), /* @__PURE__ */ React.createElement(Button, {
|
|
5035
4963
|
style: { flexGrow: 3 },
|
|
5036
4964
|
variant: "danger",
|
|
5037
4965
|
onClick: async () => {
|
|
@@ -5045,12 +4973,14 @@ function HiChevronRight(props) {
|
|
|
5045
4973
|
}
|
|
5046
4974
|
const createDocument = async (cms, collection, template, mutationInfo, values) => {
|
|
5047
4975
|
const api = new TinaAdminApi(cms);
|
|
5048
|
-
const
|
|
4976
|
+
const { filename, ...leftover } = values;
|
|
5049
4977
|
const { includeCollection, includeTemplate } = mutationInfo;
|
|
5050
4978
|
const relativePath = `${filename}.${collection.format}`;
|
|
5051
|
-
const params = transformDocumentIntoMutationRequestPayload(
|
|
5052
|
-
_collection: collection.name
|
|
5053
|
-
|
|
4979
|
+
const params = transformDocumentIntoMutationRequestPayload({
|
|
4980
|
+
_collection: collection.name,
|
|
4981
|
+
...template && { _template: template.name },
|
|
4982
|
+
...leftover
|
|
4983
|
+
}, {
|
|
5054
4984
|
includeCollection,
|
|
5055
4985
|
includeTemplate
|
|
5056
4986
|
});
|
|
@@ -5065,7 +4995,7 @@ const createDocument = async (cms, collection, template, mutationInfo, values) =
|
|
|
5065
4995
|
};
|
|
5066
4996
|
const CollectionCreatePage = () => {
|
|
5067
4997
|
const { collectionName, templateName } = useParams();
|
|
5068
|
-
return /* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5069
4999
|
cms,
|
|
5070
5000
|
collectionName,
|
|
5071
5001
|
includeDocuments: false
|
|
@@ -5074,7 +5004,7 @@ const CollectionCreatePage = () => {
|
|
|
5074
5004
|
includeCollection: true,
|
|
5075
5005
|
includeTemplate: !!collection.templates
|
|
5076
5006
|
};
|
|
5077
|
-
return /* @__PURE__ */
|
|
5007
|
+
return /* @__PURE__ */ React.createElement(RenderForm$1, {
|
|
5078
5008
|
cms,
|
|
5079
5009
|
collection,
|
|
5080
5010
|
templateName,
|
|
@@ -5107,7 +5037,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5107
5037
|
name: "filename",
|
|
5108
5038
|
label: "Filename",
|
|
5109
5039
|
component: "text",
|
|
5110
|
-
description: /* @__PURE__ */
|
|
5040
|
+
description: /* @__PURE__ */ React.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React.createElement("br", null), "Examples: ", /* @__PURE__ */ React.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React.createElement("code", null, "sub-folder/My_Document")),
|
|
5111
5041
|
placeholder: `My_Document`,
|
|
5112
5042
|
validate: (value, allValues, meta) => {
|
|
5113
5043
|
if (!value) {
|
|
@@ -5140,24 +5070,24 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5140
5070
|
const windowWidth = useWindowWidth();
|
|
5141
5071
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5142
5072
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5143
|
-
return /* @__PURE__ */
|
|
5073
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5144
5074
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5145
|
-
}, /* @__PURE__ */
|
|
5075
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5146
5076
|
className: "max-w-form mx-auto"
|
|
5147
|
-
}, /* @__PURE__ */
|
|
5077
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5148
5078
|
className: "mb-2"
|
|
5149
|
-
}, /* @__PURE__ */
|
|
5079
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5150
5080
|
className: "block text-sm leading-tight uppercase text-gray-400 mb-1"
|
|
5151
|
-
}, /* @__PURE__ */
|
|
5081
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
5152
5082
|
to: `/collections/${collection.name}`,
|
|
5153
5083
|
className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
|
|
5154
|
-
}, collection.label ? collection.label : collection.name), /* @__PURE__ */
|
|
5084
|
+
}, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
|
|
5155
5085
|
className: "inline-block -mt-0.5 opacity-50"
|
|
5156
|
-
})), /* @__PURE__ */
|
|
5086
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
5157
5087
|
className: "text-xl text-gray-700 font-medium leading-tight"
|
|
5158
|
-
}, "Create New")), /* @__PURE__ */
|
|
5088
|
+
}, "Create New")), /* @__PURE__ */ React.createElement(FormStatus, {
|
|
5159
5089
|
pristine: formIsPristine
|
|
5160
|
-
}))), /* @__PURE__ */
|
|
5090
|
+
}))), /* @__PURE__ */ React.createElement(FormBuilder, {
|
|
5161
5091
|
form,
|
|
5162
5092
|
onPristineChange: setFormIsPristine
|
|
5163
5093
|
})));
|
|
@@ -5198,9 +5128,9 @@ const GetDocument = ({
|
|
|
5198
5128
|
return null;
|
|
5199
5129
|
}
|
|
5200
5130
|
if (loading) {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5131
|
+
return /* @__PURE__ */ React.createElement(LoadingPage, null);
|
|
5202
5132
|
}
|
|
5203
|
-
return /* @__PURE__ */
|
|
5133
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(document, loading));
|
|
5204
5134
|
};
|
|
5205
5135
|
const updateDocument = async (cms, relativePath, collection, mutationInfo, values) => {
|
|
5206
5136
|
const api = new TinaAdminApi(cms);
|
|
@@ -5219,9 +5149,9 @@ const updateDocument = async (cms, relativePath, collection, mutationInfo, value
|
|
|
5219
5149
|
}
|
|
5220
5150
|
};
|
|
5221
5151
|
const CollectionUpdatePage = () => {
|
|
5222
|
-
const
|
|
5152
|
+
const { collectionName, ...rest } = useParams();
|
|
5223
5153
|
const { "*": filename } = rest;
|
|
5224
|
-
return /* @__PURE__ */
|
|
5154
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5225
5155
|
cms,
|
|
5226
5156
|
collectionName,
|
|
5227
5157
|
includeDocuments: false
|
|
@@ -5231,11 +5161,11 @@ const CollectionUpdatePage = () => {
|
|
|
5231
5161
|
includeCollection: true,
|
|
5232
5162
|
includeTemplate: !!collection.templates
|
|
5233
5163
|
};
|
|
5234
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ React.createElement(GetDocument, {
|
|
5235
5165
|
cms,
|
|
5236
5166
|
collectionName: collection.name,
|
|
5237
5167
|
relativePath
|
|
5238
|
-
}, (document) => /* @__PURE__ */
|
|
5168
|
+
}, (document) => /* @__PURE__ */ React.createElement(RenderForm, {
|
|
5239
5169
|
cms,
|
|
5240
5170
|
document,
|
|
5241
5171
|
filename,
|
|
@@ -5288,24 +5218,24 @@ const RenderForm = ({
|
|
|
5288
5218
|
const windowWidth = useWindowWidth();
|
|
5289
5219
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5290
5220
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5291
|
-
return /* @__PURE__ */
|
|
5221
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5292
5222
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5293
|
-
}, /* @__PURE__ */
|
|
5223
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5294
5224
|
className: "max-w-form mx-auto"
|
|
5295
|
-
}, /* @__PURE__ */
|
|
5225
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5296
5226
|
className: "mb-2"
|
|
5297
|
-
}, /* @__PURE__ */
|
|
5227
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
5298
5228
|
className: "block text-sm leading-tight uppercase text-gray-400 mb-1"
|
|
5299
|
-
}, /* @__PURE__ */
|
|
5229
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
5300
5230
|
to: `/collections/${collection.name}`,
|
|
5301
5231
|
className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
|
|
5302
|
-
}, collection.label ? collection.label : collection.name), /* @__PURE__ */
|
|
5232
|
+
}, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
|
|
5303
5233
|
className: "inline-block -mt-0.5 opacity-50"
|
|
5304
|
-
})), /* @__PURE__ */
|
|
5234
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
5305
5235
|
className: "text-xl text-gray-700 font-medium leading-tight"
|
|
5306
|
-
}, "Edit ", `${filename}.${collection.format}`)), /* @__PURE__ */
|
|
5236
|
+
}, "Edit ", `${filename}.${collection.format}`)), /* @__PURE__ */ React.createElement(FormStatus, {
|
|
5307
5237
|
pristine: formIsPristine
|
|
5308
|
-
}))), /* @__PURE__ */
|
|
5238
|
+
}))), /* @__PURE__ */ React.createElement(FormBuilder, {
|
|
5309
5239
|
form,
|
|
5310
5240
|
onPristineChange: setFormIsPristine
|
|
5311
5241
|
})));
|
|
@@ -5315,24 +5245,24 @@ const ScreenPage = () => {
|
|
|
5315
5245
|
const navBreakpoint = 1e3;
|
|
5316
5246
|
const windowWidth = useWindowWidth();
|
|
5317
5247
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5318
|
-
return /* @__PURE__ */
|
|
5248
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5319
5249
|
var _a, _b;
|
|
5320
5250
|
const screens = cms.plugins.getType("screen").all();
|
|
5321
5251
|
const selectedScreen = screens.find(({ name }) => slugify(name) === screenName);
|
|
5322
|
-
return /* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
5323
5253
|
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__ */
|
|
5254
|
+
}, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), renderNavToggle && /* @__PURE__ */ React.createElement("div", {
|
|
5325
5255
|
className: `py-5 border-b border-gray-200 bg-white pl-18`
|
|
5326
|
-
}, selectedScreen.name), /* @__PURE__ */
|
|
5256
|
+
}, selectedScreen.name), /* @__PURE__ */ React.createElement("div", {
|
|
5327
5257
|
className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between"
|
|
5328
|
-
}, /* @__PURE__ */
|
|
5258
|
+
}, /* @__PURE__ */ React.createElement(selectedScreen.Component, {
|
|
5329
5259
|
close: () => {
|
|
5330
5260
|
}
|
|
5331
5261
|
})));
|
|
5332
5262
|
});
|
|
5333
5263
|
};
|
|
5334
5264
|
const Redirect = () => {
|
|
5335
|
-
|
|
5265
|
+
React.useEffect(() => {
|
|
5336
5266
|
if (window) {
|
|
5337
5267
|
window.location.assign("/");
|
|
5338
5268
|
}
|
|
@@ -5346,43 +5276,43 @@ const TinaAdmin = () => {
|
|
|
5346
5276
|
return null;
|
|
5347
5277
|
}
|
|
5348
5278
|
if (!edit) {
|
|
5349
|
-
return /* @__PURE__ */
|
|
5279
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(LoginPage, null));
|
|
5350
5280
|
}
|
|
5351
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5352
5282
|
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
5353
5283
|
if (isTinaAdminEnabled) {
|
|
5354
|
-
return /* @__PURE__ */
|
|
5284
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement("div", {
|
|
5355
5285
|
className: "flex items-stretch h-screen overflow-hidden"
|
|
5356
|
-
}, /* @__PURE__ */
|
|
5286
|
+
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5357
5287
|
cms
|
|
5358
|
-
}), /* @__PURE__ */
|
|
5288
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
5359
5289
|
className: "flex-1 relative"
|
|
5360
|
-
}, /* @__PURE__ */
|
|
5290
|
+
}, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5361
5291
|
path: "collections/:collectionName/new",
|
|
5362
|
-
element: /* @__PURE__ */
|
|
5363
|
-
}), /* @__PURE__ */
|
|
5292
|
+
element: /* @__PURE__ */ React.createElement(CollectionCreatePage, null)
|
|
5293
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5364
5294
|
path: "collections/:collectionName/:templateName/new",
|
|
5365
|
-
element: /* @__PURE__ */
|
|
5366
|
-
}), /* @__PURE__ */
|
|
5295
|
+
element: /* @__PURE__ */ React.createElement(CollectionCreatePage, null)
|
|
5296
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5367
5297
|
path: "collections/:collectionName/*",
|
|
5368
|
-
element: /* @__PURE__ */
|
|
5369
|
-
}), /* @__PURE__ */
|
|
5298
|
+
element: /* @__PURE__ */ React.createElement(CollectionUpdatePage, null)
|
|
5299
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5370
5300
|
path: "collections/:collectionName",
|
|
5371
|
-
element: /* @__PURE__ */
|
|
5372
|
-
}), /* @__PURE__ */
|
|
5301
|
+
element: /* @__PURE__ */ React.createElement(CollectionListPage, null)
|
|
5302
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5373
5303
|
path: "screens/:screenName",
|
|
5374
|
-
element: /* @__PURE__ */
|
|
5375
|
-
}), /* @__PURE__ */
|
|
5304
|
+
element: /* @__PURE__ */ React.createElement(ScreenPage, null)
|
|
5305
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5376
5306
|
path: "/",
|
|
5377
|
-
element: /* @__PURE__ */
|
|
5307
|
+
element: /* @__PURE__ */ React.createElement(DashboardPage, null)
|
|
5378
5308
|
}))))));
|
|
5379
5309
|
} else {
|
|
5380
|
-
return /* @__PURE__ */
|
|
5310
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5381
5311
|
path: "logout",
|
|
5382
|
-
element: /* @__PURE__ */
|
|
5383
|
-
}), /* @__PURE__ */
|
|
5312
|
+
element: /* @__PURE__ */ React.createElement(LogoutPage, null)
|
|
5313
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5384
5314
|
path: "/",
|
|
5385
|
-
element: /* @__PURE__ */
|
|
5315
|
+
element: /* @__PURE__ */ React.createElement(Redirect, null)
|
|
5386
5316
|
}))));
|
|
5387
5317
|
}
|
|
5388
5318
|
});
|