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.js
CHANGED
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
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
1
|
(function(global, factory) {
|
|
33
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("styled-components"), require("@tinacms/sharedctx"), require("url-pattern"), require("react-router-dom"), require("@headlessui/react"), require("@react-hook/window-size")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/toolkit", "graphql", "lodash.set", "react", "final-form", "@tinacms/schema-tools", "graphql-tag", "yup", "styled-components", "@tinacms/sharedctx", "url-pattern", "react-router-dom", "@headlessui/react", "@react-hook/window-size"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
34
3
|
})(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup, styled, sharedctx, UrlPattern, reactRouterDom, react, windowSize) {
|
|
@@ -39,7 +8,7 @@ var __objRest = (source, exclude) => {
|
|
|
39
8
|
function _interopNamespace(e) {
|
|
40
9
|
if (e && e.__esModule)
|
|
41
10
|
return e;
|
|
42
|
-
var n =
|
|
11
|
+
var n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
43
12
|
if (e) {
|
|
44
13
|
Object.keys(e).forEach(function(k) {
|
|
45
14
|
if (k !== "default") {
|
|
@@ -59,7 +28,6 @@ var __objRest = (source, exclude) => {
|
|
|
59
28
|
var G__namespace = /* @__PURE__ */ _interopNamespace(G);
|
|
60
29
|
var set__default = /* @__PURE__ */ _interopDefaultLegacy(set);
|
|
61
30
|
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
62
|
-
var React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
63
31
|
var gql__default = /* @__PURE__ */ _interopDefaultLegacy(gql$1);
|
|
64
32
|
var yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
65
33
|
var styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
|
|
@@ -451,7 +419,7 @@ var __objRest = (source, exclude) => {
|
|
|
451
419
|
return [state.data, state.status !== "done"];
|
|
452
420
|
}
|
|
453
421
|
const transformDocumentIntoMutationRequestPayload = (document, instructions) => {
|
|
454
|
-
const
|
|
422
|
+
const { _collection, __typename, _template, ...rest } = document;
|
|
455
423
|
const params = transformParams(rest);
|
|
456
424
|
const paramsWithTemplate = instructions.includeTemplate ? { [_template]: params } : params;
|
|
457
425
|
return instructions.includeCollection ? { [_collection]: paramsWithTemplate } : paramsWithTemplate;
|
|
@@ -465,7 +433,7 @@ var __objRest = (source, exclude) => {
|
|
|
465
433
|
}
|
|
466
434
|
try {
|
|
467
435
|
assertShape(data, (yup2) => yup2.object({ _template: yup2.string().required() }));
|
|
468
|
-
const
|
|
436
|
+
const { _template, __typename, ...rest } = data;
|
|
469
437
|
const nested = transformParams(rest);
|
|
470
438
|
return { [_template]: nested };
|
|
471
439
|
} catch (e) {
|
|
@@ -644,10 +612,11 @@ var __objRest = (source, exclude) => {
|
|
|
644
612
|
schema: enrichedSchema,
|
|
645
613
|
template
|
|
646
614
|
});
|
|
647
|
-
formConfig =
|
|
615
|
+
formConfig = {
|
|
648
616
|
label: formInfo.label,
|
|
649
|
-
fields: formInfo.fields
|
|
650
|
-
|
|
617
|
+
fields: formInfo.fields,
|
|
618
|
+
...formCommon
|
|
619
|
+
};
|
|
651
620
|
if (formify2) {
|
|
652
621
|
form = formify2({
|
|
653
622
|
formConfig,
|
|
@@ -1082,12 +1051,13 @@ var __objRest = (source, exclude) => {
|
|
|
1082
1051
|
const visitor = {
|
|
1083
1052
|
OperationDefinition: (node2) => {
|
|
1084
1053
|
if (!node2.name) {
|
|
1085
|
-
return
|
|
1054
|
+
return {
|
|
1055
|
+
...node2,
|
|
1086
1056
|
name: {
|
|
1087
1057
|
kind: "Name",
|
|
1088
1058
|
value: `QueryOperation`
|
|
1089
1059
|
}
|
|
1090
|
-
}
|
|
1060
|
+
};
|
|
1091
1061
|
}
|
|
1092
1062
|
return node2;
|
|
1093
1063
|
}
|
|
@@ -1100,7 +1070,8 @@ var __objRest = (source, exclude) => {
|
|
|
1100
1070
|
selectionNode,
|
|
1101
1071
|
path
|
|
1102
1072
|
}) => {
|
|
1103
|
-
return
|
|
1073
|
+
return {
|
|
1074
|
+
...selectionNode,
|
|
1104
1075
|
selectionSet: {
|
|
1105
1076
|
kind: "SelectionSet",
|
|
1106
1077
|
selections: selectionNode.selectionSet.selections.map((selectionNode2) => {
|
|
@@ -1113,7 +1084,8 @@ var __objRest = (source, exclude) => {
|
|
|
1113
1084
|
type: edgeField.type,
|
|
1114
1085
|
path
|
|
1115
1086
|
});
|
|
1116
|
-
return
|
|
1087
|
+
return {
|
|
1088
|
+
...selectionNode2,
|
|
1117
1089
|
selectionSet: {
|
|
1118
1090
|
kind: "SelectionSet",
|
|
1119
1091
|
selections: selectionNode2.selectionSet.selections.map((subSelectionNode) => {
|
|
@@ -1139,7 +1111,7 @@ var __objRest = (source, exclude) => {
|
|
|
1139
1111
|
}
|
|
1140
1112
|
})
|
|
1141
1113
|
}
|
|
1142
|
-
}
|
|
1114
|
+
};
|
|
1143
1115
|
}
|
|
1144
1116
|
return selectionNode2;
|
|
1145
1117
|
default:
|
|
@@ -1147,7 +1119,7 @@ var __objRest = (source, exclude) => {
|
|
|
1147
1119
|
}
|
|
1148
1120
|
})
|
|
1149
1121
|
}
|
|
1150
|
-
}
|
|
1122
|
+
};
|
|
1151
1123
|
};
|
|
1152
1124
|
function formifyInlineFragmentDocument({
|
|
1153
1125
|
inlineFragmentNode,
|
|
@@ -1200,7 +1172,8 @@ var __objRest = (source, exclude) => {
|
|
|
1200
1172
|
});
|
|
1201
1173
|
extraFields = metaFields;
|
|
1202
1174
|
}
|
|
1203
|
-
return
|
|
1175
|
+
return {
|
|
1176
|
+
...selection,
|
|
1204
1177
|
selectionSet: {
|
|
1205
1178
|
kind: "SelectionSet",
|
|
1206
1179
|
selections: [
|
|
@@ -1237,7 +1210,7 @@ var __objRest = (source, exclude) => {
|
|
|
1237
1210
|
...extraFields
|
|
1238
1211
|
]
|
|
1239
1212
|
}
|
|
1240
|
-
}
|
|
1213
|
+
};
|
|
1241
1214
|
}
|
|
1242
1215
|
const formifyFieldNode = ({
|
|
1243
1216
|
fieldNode,
|
|
@@ -1272,7 +1245,8 @@ var __objRest = (source, exclude) => {
|
|
|
1272
1245
|
if (isScalarType(field.type)) {
|
|
1273
1246
|
return fieldNode;
|
|
1274
1247
|
}
|
|
1275
|
-
return
|
|
1248
|
+
return {
|
|
1249
|
+
...fieldNode,
|
|
1276
1250
|
selectionSet: {
|
|
1277
1251
|
kind: "SelectionSet",
|
|
1278
1252
|
selections: [
|
|
@@ -1298,7 +1272,7 @@ var __objRest = (source, exclude) => {
|
|
|
1298
1272
|
})
|
|
1299
1273
|
]
|
|
1300
1274
|
}
|
|
1301
|
-
}
|
|
1275
|
+
};
|
|
1302
1276
|
};
|
|
1303
1277
|
const formifyInlineFragmentNode = ({
|
|
1304
1278
|
inlineFragmentNode,
|
|
@@ -1317,7 +1291,8 @@ var __objRest = (source, exclude) => {
|
|
|
1317
1291
|
showInSidebar: false
|
|
1318
1292
|
});
|
|
1319
1293
|
}
|
|
1320
|
-
return
|
|
1294
|
+
return {
|
|
1295
|
+
...inlineFragmentNode,
|
|
1321
1296
|
selectionSet: {
|
|
1322
1297
|
kind: "SelectionSet",
|
|
1323
1298
|
selections: inlineFragmentNode.selectionSet.selections.map((selectionNode) => {
|
|
@@ -1333,7 +1308,7 @@ var __objRest = (source, exclude) => {
|
|
|
1333
1308
|
}
|
|
1334
1309
|
})
|
|
1335
1310
|
}
|
|
1336
|
-
}
|
|
1311
|
+
};
|
|
1337
1312
|
};
|
|
1338
1313
|
const formifiedQuery = {
|
|
1339
1314
|
kind: "Document",
|
|
@@ -1341,7 +1316,8 @@ var __objRest = (source, exclude) => {
|
|
|
1341
1316
|
typeInfo.enter(definition);
|
|
1342
1317
|
ensureOperationDefinition(definition);
|
|
1343
1318
|
const parentType = typeInfo.getType();
|
|
1344
|
-
return
|
|
1319
|
+
return {
|
|
1320
|
+
...definition,
|
|
1345
1321
|
selectionSet: {
|
|
1346
1322
|
kind: "SelectionSet",
|
|
1347
1323
|
selections: definition.selectionSet.selections.map((selectionNode) => {
|
|
@@ -1371,7 +1347,8 @@ var __objRest = (source, exclude) => {
|
|
|
1371
1347
|
fieldNode: selectionNode,
|
|
1372
1348
|
type: field.type
|
|
1373
1349
|
});
|
|
1374
|
-
return
|
|
1350
|
+
return {
|
|
1351
|
+
...selectionNode,
|
|
1375
1352
|
selectionSet: {
|
|
1376
1353
|
kind: "SelectionSet",
|
|
1377
1354
|
selections: selectionNode.selectionSet.selections.map((subSelectionNode) => {
|
|
@@ -1395,7 +1372,7 @@ var __objRest = (source, exclude) => {
|
|
|
1395
1372
|
}
|
|
1396
1373
|
})
|
|
1397
1374
|
}
|
|
1398
|
-
}
|
|
1375
|
+
};
|
|
1399
1376
|
}
|
|
1400
1377
|
throw new FormifyError("NOOP");
|
|
1401
1378
|
default:
|
|
@@ -1403,7 +1380,7 @@ var __objRest = (source, exclude) => {
|
|
|
1403
1380
|
}
|
|
1404
1381
|
})
|
|
1405
1382
|
}
|
|
1406
|
-
}
|
|
1383
|
+
};
|
|
1407
1384
|
})
|
|
1408
1385
|
};
|
|
1409
1386
|
return { formifiedQuery, blueprints };
|
|
@@ -1442,17 +1419,20 @@ var __objRest = (source, exclude) => {
|
|
|
1442
1419
|
var _a, _b, _c, _d;
|
|
1443
1420
|
switch (action.type) {
|
|
1444
1421
|
case "start":
|
|
1445
|
-
return
|
|
1422
|
+
return {
|
|
1423
|
+
...state,
|
|
1424
|
+
...defaultState,
|
|
1446
1425
|
query: action.value.query ? G__namespace.parse(action.value.query) : null,
|
|
1447
1426
|
queryString: action.value.query,
|
|
1448
1427
|
status: "initialized"
|
|
1449
|
-
}
|
|
1428
|
+
};
|
|
1450
1429
|
case "addDocumentBlueprints":
|
|
1451
|
-
return
|
|
1430
|
+
return {
|
|
1431
|
+
...state,
|
|
1452
1432
|
status: "formified",
|
|
1453
1433
|
blueprints: action.value.blueprints,
|
|
1454
1434
|
query: action.value.formifiedQuery
|
|
1455
|
-
}
|
|
1435
|
+
};
|
|
1456
1436
|
case "addOrReplaceDocumentFormNode": {
|
|
1457
1437
|
const existingDocumentForms = state.documentForms.filter((documentForm) => {
|
|
1458
1438
|
var _a2, _b2;
|
|
@@ -1465,10 +1445,11 @@ var __objRest = (source, exclude) => {
|
|
|
1465
1445
|
if ((_a = action.value) == null ? void 0 : _a.documentForm) {
|
|
1466
1446
|
newDocumentForms.push((_b = action.value) == null ? void 0 : _b.documentForm);
|
|
1467
1447
|
}
|
|
1468
|
-
return
|
|
1448
|
+
return {
|
|
1449
|
+
...state,
|
|
1469
1450
|
formNodes: [...existingDocumentFormNodes, action.value.formNode],
|
|
1470
1451
|
documentForms: [...existingDocumentForms, ...newDocumentForms]
|
|
1471
|
-
}
|
|
1452
|
+
};
|
|
1472
1453
|
}
|
|
1473
1454
|
case "onFieldChange": {
|
|
1474
1455
|
const event = action.value.event;
|
|
@@ -1480,32 +1461,33 @@ var __objRest = (source, exclude) => {
|
|
|
1480
1461
|
getFormNodesFromEvent(state, event).forEach((formNode) => {
|
|
1481
1462
|
const blueprint = getFormNodeBlueprint(formNode, state);
|
|
1482
1463
|
if (blueprint.hasValuesField) {
|
|
1483
|
-
changeSets.push(
|
|
1484
|
-
path: [formNodePath(formNode), "values"].join(".")
|
|
1485
|
-
|
|
1464
|
+
changeSets.push({
|
|
1465
|
+
path: [formNodePath(formNode), "values"].join("."),
|
|
1466
|
+
...buildChangeSet(event, formNode),
|
|
1486
1467
|
value: form.values,
|
|
1487
1468
|
mutationType: {
|
|
1488
1469
|
type: "global"
|
|
1489
1470
|
}
|
|
1490
|
-
})
|
|
1471
|
+
});
|
|
1491
1472
|
}
|
|
1492
1473
|
if (blueprint.hasDataJSONField) {
|
|
1493
|
-
changeSets.push(
|
|
1494
|
-
path: [formNodePath(formNode), "dataJSON"].join(".")
|
|
1495
|
-
|
|
1474
|
+
changeSets.push({
|
|
1475
|
+
path: [formNodePath(formNode), "dataJSON"].join("."),
|
|
1476
|
+
...buildChangeSet(event, formNode),
|
|
1496
1477
|
value: form.values,
|
|
1497
1478
|
mutationType: {
|
|
1498
1479
|
type: "global"
|
|
1499
1480
|
}
|
|
1500
|
-
})
|
|
1481
|
+
});
|
|
1501
1482
|
}
|
|
1502
1483
|
if (event.mutationType.type === "change") {
|
|
1503
1484
|
if (!action.value.form) {
|
|
1504
1485
|
getBlueprintFieldsForEvent(blueprint, event).forEach((fieldBlueprint) => {
|
|
1505
1486
|
const { pathToChange } = getFormNodesForField(fieldBlueprint, formNode, event, state);
|
|
1506
|
-
changeSets.push(
|
|
1507
|
-
path: pathToChange
|
|
1508
|
-
|
|
1487
|
+
changeSets.push({
|
|
1488
|
+
path: pathToChange,
|
|
1489
|
+
...buildChangeSet(event, formNode)
|
|
1490
|
+
});
|
|
1509
1491
|
});
|
|
1510
1492
|
}
|
|
1511
1493
|
} else if (event.mutationType.type === "referenceChange") {
|
|
@@ -1522,18 +1504,19 @@ var __objRest = (source, exclude) => {
|
|
|
1522
1504
|
location: eventLocation
|
|
1523
1505
|
};
|
|
1524
1506
|
newFormNodes.push(newFormNode);
|
|
1525
|
-
changeSets.push(
|
|
1526
|
-
path: pathToChange
|
|
1527
|
-
|
|
1507
|
+
changeSets.push({
|
|
1508
|
+
path: pathToChange,
|
|
1509
|
+
...buildChangeSet(event, newFormNode)
|
|
1510
|
+
});
|
|
1528
1511
|
}
|
|
1529
1512
|
subFormNodes.forEach((subFormNode) => {
|
|
1530
1513
|
if (matchLocation(eventLocation, subFormNode)) {
|
|
1531
1514
|
if (!action.value.form) {
|
|
1532
|
-
changeSets.push(
|
|
1533
|
-
path: pathToChange
|
|
1534
|
-
|
|
1515
|
+
changeSets.push({
|
|
1516
|
+
path: pathToChange,
|
|
1517
|
+
...buildChangeSet(event, subFormNode),
|
|
1535
1518
|
value: null
|
|
1536
|
-
})
|
|
1519
|
+
});
|
|
1537
1520
|
}
|
|
1538
1521
|
formNodesToReplace.push(subFormNode);
|
|
1539
1522
|
}
|
|
@@ -1545,15 +1528,17 @@ var __objRest = (source, exclude) => {
|
|
|
1545
1528
|
if (event.mutationType.type === "insert") {
|
|
1546
1529
|
formNodes.forEach((subFormNode) => {
|
|
1547
1530
|
if (matchLocation(eventLocation, subFormNode)) {
|
|
1548
|
-
newFormNodes.push(
|
|
1531
|
+
newFormNodes.push({
|
|
1532
|
+
...subFormNode,
|
|
1549
1533
|
location: bumpLocation(subFormNode.location)
|
|
1550
|
-
})
|
|
1534
|
+
});
|
|
1551
1535
|
formNodesToReplace.push(subFormNode);
|
|
1552
1536
|
}
|
|
1553
1537
|
});
|
|
1554
|
-
changeSets.push(
|
|
1555
|
-
path: pathToChange
|
|
1556
|
-
|
|
1538
|
+
changeSets.push({
|
|
1539
|
+
path: pathToChange,
|
|
1540
|
+
...buildChangeSet(event, formNode)
|
|
1541
|
+
});
|
|
1557
1542
|
}
|
|
1558
1543
|
if (event.mutationType.type === "remove") {
|
|
1559
1544
|
const { at } = event.mutationType;
|
|
@@ -1562,19 +1547,20 @@ var __objRest = (source, exclude) => {
|
|
|
1562
1547
|
if (matchesAt(subFormNode.location, at)) {
|
|
1563
1548
|
formNodesToRemove.push(subFormNode);
|
|
1564
1549
|
} else {
|
|
1565
|
-
newFormNodes.push(
|
|
1550
|
+
newFormNodes.push({
|
|
1551
|
+
...subFormNode,
|
|
1566
1552
|
location: maybeLowerLocation(subFormNode.location, at)
|
|
1567
|
-
})
|
|
1553
|
+
});
|
|
1568
1554
|
formNodesToReplace.push(subFormNode);
|
|
1569
1555
|
}
|
|
1570
1556
|
}
|
|
1571
1557
|
});
|
|
1572
1558
|
const next = existing.filter((_, index) => index !== at);
|
|
1573
|
-
changeSets.push(
|
|
1574
|
-
path: pathToChange
|
|
1575
|
-
|
|
1559
|
+
changeSets.push({
|
|
1560
|
+
path: pathToChange,
|
|
1561
|
+
...buildChangeSet(event, formNode),
|
|
1576
1562
|
value: next
|
|
1577
|
-
})
|
|
1563
|
+
});
|
|
1578
1564
|
}
|
|
1579
1565
|
if (event.mutationType.type === "move") {
|
|
1580
1566
|
const next = [];
|
|
@@ -1582,20 +1568,21 @@ var __objRest = (source, exclude) => {
|
|
|
1582
1568
|
const newOrderObject = getMoveMapping(existing, from, to);
|
|
1583
1569
|
formNodes.forEach((subFormNode) => {
|
|
1584
1570
|
if (matchLocation(eventLocation, subFormNode)) {
|
|
1585
|
-
newFormNodes.push(
|
|
1571
|
+
newFormNodes.push({
|
|
1572
|
+
...subFormNode,
|
|
1586
1573
|
location: swapLocation(subFormNode.location, newOrderObject)
|
|
1587
|
-
})
|
|
1574
|
+
});
|
|
1588
1575
|
formNodesToReplace.push(subFormNode);
|
|
1589
1576
|
}
|
|
1590
1577
|
});
|
|
1591
1578
|
Object.values(newOrderObject).forEach((orderIndex, index) => {
|
|
1592
1579
|
next[orderIndex] = existing[index];
|
|
1593
1580
|
});
|
|
1594
|
-
changeSets.push(
|
|
1595
|
-
path: pathToChange
|
|
1596
|
-
|
|
1581
|
+
changeSets.push({
|
|
1582
|
+
path: pathToChange,
|
|
1583
|
+
...buildChangeSet(event, formNode),
|
|
1597
1584
|
value: next
|
|
1598
|
-
})
|
|
1585
|
+
});
|
|
1599
1586
|
}
|
|
1600
1587
|
});
|
|
1601
1588
|
}
|
|
@@ -1608,14 +1595,15 @@ var __objRest = (source, exclude) => {
|
|
|
1608
1595
|
if ((_c = action.value) == null ? void 0 : _c.form) {
|
|
1609
1596
|
newDocumentForms.push((_d = action.value) == null ? void 0 : _d.form);
|
|
1610
1597
|
}
|
|
1611
|
-
return
|
|
1598
|
+
return {
|
|
1599
|
+
...state,
|
|
1612
1600
|
changeSets,
|
|
1613
1601
|
formNodes: [
|
|
1614
1602
|
...state.formNodes.filter((formNode) => formNodeNotIn(formNode, formNodesToReplace)).filter((formNode) => formNodeNotIn(formNode, formNodesToRemove)),
|
|
1615
1603
|
...newFormNodes
|
|
1616
1604
|
],
|
|
1617
1605
|
documentForms: [...existingDocumentForms, ...newDocumentForms]
|
|
1618
|
-
}
|
|
1606
|
+
};
|
|
1619
1607
|
}
|
|
1620
1608
|
case "formOnReset": {
|
|
1621
1609
|
const { event } = action.value;
|
|
@@ -1624,22 +1612,24 @@ var __objRest = (source, exclude) => {
|
|
|
1624
1612
|
state.formNodes.filter((fn) => fn.documentFormId === (form == null ? void 0 : form.id)).forEach((formNode) => {
|
|
1625
1613
|
const blueprint = getFormNodeBlueprint(formNode, state);
|
|
1626
1614
|
if (blueprint.hasValuesField) {
|
|
1627
|
-
changeSets.push(
|
|
1628
|
-
path: [formNodePath(formNode), "_values"].join(".")
|
|
1629
|
-
|
|
1615
|
+
changeSets.push({
|
|
1616
|
+
path: [formNodePath(formNode), "_values"].join("."),
|
|
1617
|
+
...buildChangeSet(event, formNode)
|
|
1618
|
+
});
|
|
1630
1619
|
}
|
|
1631
|
-
changeSets.push(
|
|
1632
|
-
path: [formNodePath(formNode)].join(".")
|
|
1633
|
-
|
|
1620
|
+
changeSets.push({
|
|
1621
|
+
path: [formNodePath(formNode)].join("."),
|
|
1622
|
+
...buildChangeSet(event, formNode)
|
|
1623
|
+
});
|
|
1634
1624
|
});
|
|
1635
|
-
return
|
|
1625
|
+
return { ...state, changeSets };
|
|
1636
1626
|
}
|
|
1637
1627
|
case "ready":
|
|
1638
|
-
return
|
|
1628
|
+
return { ...state, status: "ready" };
|
|
1639
1629
|
case "done":
|
|
1640
|
-
return
|
|
1630
|
+
return { ...state, status: "done" };
|
|
1641
1631
|
case "setData":
|
|
1642
|
-
return
|
|
1632
|
+
return { ...state, data: action.value };
|
|
1643
1633
|
case "setIn": {
|
|
1644
1634
|
let newData;
|
|
1645
1635
|
if (action.value.displaceIndex) {
|
|
@@ -1652,10 +1642,11 @@ var __objRest = (source, exclude) => {
|
|
|
1652
1642
|
newData = finalForm.setIn(state.data, action.value.path, action.value.value);
|
|
1653
1643
|
}
|
|
1654
1644
|
const changeSets = state.changeSets.filter((cs) => cs.path !== action.value.path);
|
|
1655
|
-
return
|
|
1645
|
+
return {
|
|
1646
|
+
...state,
|
|
1656
1647
|
data: newData,
|
|
1657
1648
|
changeSets
|
|
1658
|
-
}
|
|
1649
|
+
};
|
|
1659
1650
|
}
|
|
1660
1651
|
default:
|
|
1661
1652
|
return state;
|
|
@@ -1822,9 +1813,10 @@ var __objRest = (source, exclude) => {
|
|
|
1822
1813
|
dispatch({
|
|
1823
1814
|
type: "onFieldChange",
|
|
1824
1815
|
value: {
|
|
1825
|
-
event:
|
|
1816
|
+
event: {
|
|
1817
|
+
...event,
|
|
1826
1818
|
mutationType: { type: "referenceChange" }
|
|
1827
|
-
}
|
|
1819
|
+
},
|
|
1828
1820
|
form
|
|
1829
1821
|
}
|
|
1830
1822
|
});
|
|
@@ -1872,21 +1864,24 @@ var __objRest = (source, exclude) => {
|
|
|
1872
1864
|
}
|
|
1873
1865
|
dispatch({
|
|
1874
1866
|
type: "setIn",
|
|
1875
|
-
value:
|
|
1876
|
-
displaceIndex: true
|
|
1877
|
-
|
|
1878
|
-
value:
|
|
1879
|
-
|
|
1867
|
+
value: {
|
|
1868
|
+
displaceIndex: true,
|
|
1869
|
+
...changeSet,
|
|
1870
|
+
value: {
|
|
1871
|
+
...res,
|
|
1872
|
+
...extra
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1880
1875
|
});
|
|
1881
1876
|
});
|
|
1882
1877
|
} else {
|
|
1883
1878
|
dispatch({
|
|
1884
1879
|
type: "setIn",
|
|
1885
|
-
value:
|
|
1886
|
-
displaceIndex: true
|
|
1887
|
-
|
|
1880
|
+
value: {
|
|
1881
|
+
displaceIndex: true,
|
|
1882
|
+
...changeSet,
|
|
1888
1883
|
value: changeSet.value[0]
|
|
1889
|
-
}
|
|
1884
|
+
}
|
|
1890
1885
|
});
|
|
1891
1886
|
}
|
|
1892
1887
|
} else {
|
|
@@ -1896,9 +1891,10 @@ var __objRest = (source, exclude) => {
|
|
|
1896
1891
|
if (!changeSet.value) {
|
|
1897
1892
|
dispatch({
|
|
1898
1893
|
type: "setIn",
|
|
1899
|
-
value:
|
|
1894
|
+
value: {
|
|
1895
|
+
...changeSet,
|
|
1900
1896
|
value: null
|
|
1901
|
-
}
|
|
1897
|
+
}
|
|
1902
1898
|
});
|
|
1903
1899
|
} else {
|
|
1904
1900
|
cms.api.tina.request(`
|
|
@@ -1916,9 +1912,13 @@ var __objRest = (source, exclude) => {
|
|
|
1916
1912
|
});
|
|
1917
1913
|
dispatch({
|
|
1918
1914
|
type: "setIn",
|
|
1919
|
-
value:
|
|
1920
|
-
|
|
1921
|
-
|
|
1915
|
+
value: {
|
|
1916
|
+
...changeSet,
|
|
1917
|
+
value: {
|
|
1918
|
+
...res.node,
|
|
1919
|
+
...data
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
1922
|
});
|
|
1923
1923
|
}).catch((e) => {
|
|
1924
1924
|
cms.alerts.error(`Unexpected error fetching reference`);
|
|
@@ -1930,7 +1930,7 @@ var __objRest = (source, exclude) => {
|
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
1932
|
});
|
|
1933
|
-
}, [state.changeSets
|
|
1933
|
+
}, [JSON.stringify(state.changeSets)]);
|
|
1934
1934
|
React__default["default"].useEffect(() => {
|
|
1935
1935
|
formIds.current = state.documentForms.map((df) => df.id);
|
|
1936
1936
|
}, [state.documentForms.length]);
|
|
@@ -1973,14 +1973,15 @@ var __objRest = (source, exclude) => {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
data[keyName] = await sequential(value, async (item, index) => {
|
|
1975
1975
|
const template = field.templates[item._template];
|
|
1976
|
-
return
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1976
|
+
return {
|
|
1977
|
+
...await resolveSubFields({
|
|
1978
|
+
formNode,
|
|
1979
|
+
form: { fields: template.fields, values: item },
|
|
1980
|
+
prefix: prefix ? [prefix, fieldName].join(".") : fieldName,
|
|
1981
|
+
loc: [...loc, index]
|
|
1982
|
+
}),
|
|
1982
1983
|
__typename: field.typeMap[item._template]
|
|
1983
|
-
}
|
|
1984
|
+
};
|
|
1984
1985
|
});
|
|
1985
1986
|
});
|
|
1986
1987
|
} else {
|
|
@@ -2077,11 +2078,14 @@ var __objRest = (source, exclude) => {
|
|
|
2077
2078
|
}
|
|
2078
2079
|
}
|
|
2079
2080
|
`, { variables: { id: value } });
|
|
2080
|
-
data[keyName] =
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2081
|
+
data[keyName] = {
|
|
2082
|
+
...res.node,
|
|
2083
|
+
...await resolveSubFields({
|
|
2084
|
+
formNode: subDocumentFormNode,
|
|
2085
|
+
form: form2,
|
|
2086
|
+
loc: location
|
|
2087
|
+
})
|
|
2088
|
+
};
|
|
2085
2089
|
});
|
|
2086
2090
|
break;
|
|
2087
2091
|
default:
|
|
@@ -2099,9 +2103,10 @@ var __objRest = (source, exclude) => {
|
|
|
2099
2103
|
});
|
|
2100
2104
|
return data;
|
|
2101
2105
|
}, [cms, JSON.stringify(state), dispatch]);
|
|
2102
|
-
return
|
|
2106
|
+
return {
|
|
2107
|
+
...state,
|
|
2103
2108
|
queryString: G__namespace.print(state.query)
|
|
2104
|
-
}
|
|
2109
|
+
};
|
|
2105
2110
|
};
|
|
2106
2111
|
const buildFormNode = (documentBlueprint, form, location) => {
|
|
2107
2112
|
return {
|
|
@@ -2116,8 +2121,7 @@ var __objRest = (source, exclude) => {
|
|
|
2116
2121
|
return matches[1];
|
|
2117
2122
|
};
|
|
2118
2123
|
class Client {
|
|
2119
|
-
constructor(
|
|
2120
|
-
var _b = _a, { tokenStorage = "MEMORY" } = _b, options = __objRest(_b, ["tokenStorage"]);
|
|
2124
|
+
constructor({ tokenStorage = "MEMORY", ...options }) {
|
|
2121
2125
|
this.events = new toolkit.EventBus();
|
|
2122
2126
|
this.addPendingContent = async (props) => {
|
|
2123
2127
|
const mutation = `#graphql
|
|
@@ -2166,10 +2170,11 @@ mutation addPendingDocumentMutation(
|
|
|
2166
2170
|
return G.parse(data.getOptimizedQuery);
|
|
2167
2171
|
};
|
|
2168
2172
|
if (options.schema) {
|
|
2169
|
-
const enrichedSchema = new schemaTools.TinaSchema(
|
|
2173
|
+
const enrichedSchema = new schemaTools.TinaSchema({
|
|
2170
2174
|
version: { fullVersion: "", major: "", minor: "", patch: "" },
|
|
2171
|
-
meta: { flags: [] }
|
|
2172
|
-
|
|
2175
|
+
meta: { flags: [] },
|
|
2176
|
+
...schemaTools.addNamespaceToSchema(options.schema, [])
|
|
2177
|
+
});
|
|
2173
2178
|
this.schema = enrichedSchema;
|
|
2174
2179
|
}
|
|
2175
2180
|
this.options = options;
|
|
@@ -2226,6 +2231,7 @@ mutation addPendingDocumentMutation(
|
|
|
2226
2231
|
setBranch(branchName) {
|
|
2227
2232
|
var _a, _b, _c, _d;
|
|
2228
2233
|
const encodedBranch = encodeURIComponent(branchName);
|
|
2234
|
+
this.branch = encodedBranch;
|
|
2229
2235
|
this.assetsApiUrl = ((_a = this.options.tinaioConfig) == null ? void 0 : _a.assetsApiUrlOverride) || "https://assets.tinajs.io";
|
|
2230
2236
|
this.frontendUrl = ((_b = this.options.tinaioConfig) == null ? void 0 : _b.frontendUrlOverride) || "https://app.tina.io";
|
|
2231
2237
|
this.identityApiUrl = ((_c = this.options.tinaioConfig) == null ? void 0 : _c.identityApiUrlOverride) || "https://identity.tinajs.io";
|
|
@@ -2277,6 +2283,24 @@ mutation addPendingDocumentMutation(
|
|
|
2277
2283
|
}
|
|
2278
2284
|
return json.data;
|
|
2279
2285
|
}
|
|
2286
|
+
async syncTinaMedia() {
|
|
2287
|
+
const res = await this.fetchWithToken(`${this.contentApiBase}/assets/${this.clientId}/sync/${this.branch}`, { method: "POST" });
|
|
2288
|
+
const jsonRes = await res.json();
|
|
2289
|
+
return jsonRes;
|
|
2290
|
+
}
|
|
2291
|
+
async checkSyncStatus({
|
|
2292
|
+
assetsSyncing
|
|
2293
|
+
}) {
|
|
2294
|
+
const res = await this.fetchWithToken(`${this.assetsApiUrl}/v1/${this.clientId}/syncStatus`, {
|
|
2295
|
+
method: "POST",
|
|
2296
|
+
headers: {
|
|
2297
|
+
"Content-Type": "application/json"
|
|
2298
|
+
},
|
|
2299
|
+
body: JSON.stringify({ assetsSyncing })
|
|
2300
|
+
});
|
|
2301
|
+
const jsonRes = await res.json();
|
|
2302
|
+
return jsonRes;
|
|
2303
|
+
}
|
|
2280
2304
|
parseJwt(token) {
|
|
2281
2305
|
const base64Url = token.split(".")[1];
|
|
2282
2306
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
@@ -2331,11 +2355,13 @@ mutation addPendingDocumentMutation(
|
|
|
2331
2355
|
}
|
|
2332
2356
|
async fetchWithToken(input, init) {
|
|
2333
2357
|
const headers = (init == null ? void 0 : init.headers) || {};
|
|
2334
|
-
return await fetch(input,
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2358
|
+
return await fetch(input, {
|
|
2359
|
+
...init,
|
|
2360
|
+
headers: new Headers({
|
|
2361
|
+
Authorization: "Bearer " + (await this.getToken()).id_token,
|
|
2362
|
+
...headers
|
|
2363
|
+
})
|
|
2364
|
+
});
|
|
2339
2365
|
}
|
|
2340
2366
|
async getUser() {
|
|
2341
2367
|
if (!this.clientId) {
|
|
@@ -2387,11 +2413,12 @@ mutation addPendingDocumentMutation(
|
|
|
2387
2413
|
const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
|
|
2388
2414
|
class LocalClient extends Client {
|
|
2389
2415
|
constructor(props) {
|
|
2390
|
-
const clientProps =
|
|
2416
|
+
const clientProps = {
|
|
2417
|
+
...props,
|
|
2391
2418
|
clientId: "",
|
|
2392
2419
|
branch: "",
|
|
2393
2420
|
customContentApiUrl: props && props.customContentApiUrl ? props.customContentApiUrl : DEFAULT_LOCAL_TINA_GQL_SERVER_URL
|
|
2394
|
-
}
|
|
2421
|
+
};
|
|
2395
2422
|
super(clientProps);
|
|
2396
2423
|
}
|
|
2397
2424
|
async isAuthorized() {
|
|
@@ -2404,9 +2431,10 @@ mutation addPendingDocumentMutation(
|
|
|
2404
2431
|
function ModalBuilder(modalProps) {
|
|
2405
2432
|
return /* @__PURE__ */ React__default["default"].createElement(toolkit.Modal, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalPopup, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalHeader, null, modalProps.title), /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalBody, {
|
|
2406
2433
|
padded: true
|
|
2407
|
-
}, /* @__PURE__ */ React__default["default"].createElement("p", null, modalProps.message), modalProps.error && /* @__PURE__ */ React__default["default"].createElement(ErrorLabel, null, modalProps.error)), /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalActions, null, modalProps.actions.map((action) => /* @__PURE__ */ React__default["default"].createElement(AsyncButton,
|
|
2408
|
-
key: action.name
|
|
2409
|
-
|
|
2434
|
+
}, /* @__PURE__ */ React__default["default"].createElement("p", null, modalProps.message), modalProps.error && /* @__PURE__ */ React__default["default"].createElement(ErrorLabel, null, modalProps.error)), /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalActions, null, modalProps.actions.map((action) => /* @__PURE__ */ React__default["default"].createElement(AsyncButton, {
|
|
2435
|
+
key: action.name,
|
|
2436
|
+
...action
|
|
2437
|
+
})))));
|
|
2410
2438
|
}
|
|
2411
2439
|
const ErrorLabel = styled__default["default"].p`
|
|
2412
2440
|
color: var(--tina-color-error) !important;
|
|
@@ -2678,7 +2706,7 @@ mutation addPendingDocumentMutation(
|
|
|
2678
2706
|
sidebar: true
|
|
2679
2707
|
}), [props.cms]);
|
|
2680
2708
|
if (!cms.api.tina) {
|
|
2681
|
-
cms.registerApi("tina", createClient(
|
|
2709
|
+
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
2682
2710
|
} else {
|
|
2683
2711
|
cms.api.tina.setBranch(currentBranch);
|
|
2684
2712
|
}
|
|
@@ -2686,20 +2714,20 @@ mutation addPendingDocumentMutation(
|
|
|
2686
2714
|
cms.registerApi("admin", new TinaAdminApi(cms));
|
|
2687
2715
|
}
|
|
2688
2716
|
const setupMedia = async () => {
|
|
2689
|
-
var _a, _b, _c;
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2717
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2718
|
+
const hasTinaMedia = Boolean((_b = (_a = props.schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina);
|
|
2719
|
+
if (hasTinaMedia) {
|
|
2720
|
+
cms.media.store = new toolkit.TinaMediaStore(cms);
|
|
2721
|
+
} else if (((_d = (_c = props.schema.config) == null ? void 0 : _c.media) == null ? void 0 : _d.loadCustomStore) || props.mediaStore) {
|
|
2722
|
+
const mediaStoreFromProps = ((_f = (_e = props.schema.config) == null ? void 0 : _e.media) == null ? void 0 : _f.loadCustomStore) || props.mediaStore;
|
|
2723
|
+
if ((_g = mediaStoreFromProps.prototype) == null ? void 0 : _g.persist) {
|
|
2724
|
+
cms.media.store = new mediaStoreFromProps(cms.api.tina);
|
|
2693
2725
|
} else {
|
|
2694
|
-
const MediaClass = await
|
|
2726
|
+
const MediaClass = await mediaStoreFromProps();
|
|
2695
2727
|
cms.media.store = new MediaClass(cms.api.tina);
|
|
2696
2728
|
}
|
|
2697
2729
|
} else {
|
|
2698
|
-
|
|
2699
|
-
cms.media.store = new toolkit.TinaMediaStore(cms);
|
|
2700
|
-
} else {
|
|
2701
|
-
cms.media.store = new toolkit.DummyMediaStore();
|
|
2702
|
-
}
|
|
2730
|
+
cms.media.store = new toolkit.DummyMediaStore();
|
|
2703
2731
|
}
|
|
2704
2732
|
};
|
|
2705
2733
|
const handleListBranches = async () => {
|
|
@@ -2750,12 +2778,13 @@ mutation addPendingDocumentMutation(
|
|
|
2750
2778
|
}
|
|
2751
2779
|
}, /* @__PURE__ */ React__default["default"].createElement(toolkit.TinaProvider, {
|
|
2752
2780
|
cms
|
|
2753
|
-
}, /* @__PURE__ */ React__default["default"].createElement(AuthWallInner,
|
|
2781
|
+
}, /* @__PURE__ */ React__default["default"].createElement(AuthWallInner, {
|
|
2782
|
+
...props,
|
|
2754
2783
|
cms
|
|
2755
|
-
})))
|
|
2784
|
+
})));
|
|
2756
2785
|
};
|
|
2757
2786
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
2758
|
-
var styles = `.tina-tailwind {
|
|
2787
|
+
var styles = /* @__PURE__ */ (() => `.tina-tailwind {
|
|
2759
2788
|
line-height: 1.5;
|
|
2760
2789
|
-webkit-text-size-adjust: 100%;
|
|
2761
2790
|
-moz-tab-size: 4;
|
|
@@ -2980,6 +3009,54 @@ mutation addPendingDocumentMutation(
|
|
|
2980
3009
|
display: none;
|
|
2981
3010
|
}
|
|
2982
3011
|
*, ::before, ::after {
|
|
3012
|
+
--tw-border-spacing-x: 0;
|
|
3013
|
+
--tw-border-spacing-y: 0;
|
|
3014
|
+
--tw-translate-x: 0;
|
|
3015
|
+
--tw-translate-y: 0;
|
|
3016
|
+
--tw-rotate: 0;
|
|
3017
|
+
--tw-skew-x: 0;
|
|
3018
|
+
--tw-skew-y: 0;
|
|
3019
|
+
--tw-scale-x: 1;
|
|
3020
|
+
--tw-scale-y: 1;
|
|
3021
|
+
--tw-pan-x: ;
|
|
3022
|
+
--tw-pan-y: ;
|
|
3023
|
+
--tw-pinch-zoom: ;
|
|
3024
|
+
--tw-scroll-snap-strictness: proximity;
|
|
3025
|
+
--tw-ordinal: ;
|
|
3026
|
+
--tw-slashed-zero: ;
|
|
3027
|
+
--tw-numeric-figure: ;
|
|
3028
|
+
--tw-numeric-spacing: ;
|
|
3029
|
+
--tw-numeric-fraction: ;
|
|
3030
|
+
--tw-ring-inset: ;
|
|
3031
|
+
--tw-ring-offset-width: 0px;
|
|
3032
|
+
--tw-ring-offset-color: #fff;
|
|
3033
|
+
--tw-ring-color: rgb(0 132 255 / 0.5);
|
|
3034
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
3035
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
3036
|
+
--tw-shadow: 0 0 #0000;
|
|
3037
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
3038
|
+
--tw-blur: ;
|
|
3039
|
+
--tw-brightness: ;
|
|
3040
|
+
--tw-contrast: ;
|
|
3041
|
+
--tw-grayscale: ;
|
|
3042
|
+
--tw-hue-rotate: ;
|
|
3043
|
+
--tw-invert: ;
|
|
3044
|
+
--tw-saturate: ;
|
|
3045
|
+
--tw-sepia: ;
|
|
3046
|
+
--tw-drop-shadow: ;
|
|
3047
|
+
--tw-backdrop-blur: ;
|
|
3048
|
+
--tw-backdrop-brightness: ;
|
|
3049
|
+
--tw-backdrop-contrast: ;
|
|
3050
|
+
--tw-backdrop-grayscale: ;
|
|
3051
|
+
--tw-backdrop-hue-rotate: ;
|
|
3052
|
+
--tw-backdrop-invert: ;
|
|
3053
|
+
--tw-backdrop-opacity: ;
|
|
3054
|
+
--tw-backdrop-saturate: ;
|
|
3055
|
+
--tw-backdrop-sepia: ;
|
|
3056
|
+
}
|
|
3057
|
+
::backdrop {
|
|
3058
|
+
--tw-border-spacing-x: 0;
|
|
3059
|
+
--tw-border-spacing-y: 0;
|
|
2983
3060
|
--tw-translate-x: 0;
|
|
2984
3061
|
--tw-translate-y: 0;
|
|
2985
3062
|
--tw-rotate: 0;
|
|
@@ -3324,14 +3401,17 @@ mutation addPendingDocumentMutation(
|
|
|
3324
3401
|
}
|
|
3325
3402
|
.tina-tailwind .from-blue-900 {
|
|
3326
3403
|
--tw-gradient-from: #1D2C6C;
|
|
3327
|
-
--tw-gradient-
|
|
3404
|
+
--tw-gradient-to: rgb(29 44 108 / 0);
|
|
3405
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3328
3406
|
}
|
|
3329
3407
|
.tina-tailwind .from-gray-800 {
|
|
3330
3408
|
--tw-gradient-from: #363145;
|
|
3331
|
-
--tw-gradient-
|
|
3409
|
+
--tw-gradient-to: rgb(54 49 69 / 0);
|
|
3410
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3332
3411
|
}
|
|
3333
3412
|
.tina-tailwind .via-gray-900 {
|
|
3334
|
-
--tw-gradient-
|
|
3413
|
+
--tw-gradient-to: rgb(37 35 54 / 0);
|
|
3414
|
+
--tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to);
|
|
3335
3415
|
}
|
|
3336
3416
|
.tina-tailwind .to-gray-900 {
|
|
3337
3417
|
--tw-gradient-to: #252336;
|
|
@@ -3633,7 +3713,7 @@ mutation addPendingDocumentMutation(
|
|
|
3633
3713
|
--tw-ring-opacity: 1;
|
|
3634
3714
|
--tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
|
|
3635
3715
|
}
|
|
3636
|
-
|
|
3716
|
+
`)();
|
|
3637
3717
|
class ContentCreatorPlugin {
|
|
3638
3718
|
constructor(options) {
|
|
3639
3719
|
this.__type = "content-creator";
|
|
@@ -3928,18 +4008,13 @@ mutation addPendingDocumentMutation(
|
|
|
3928
4008
|
return this.props.children;
|
|
3929
4009
|
}
|
|
3930
4010
|
}
|
|
3931
|
-
const TinaCMSProvider2 = (
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
"query",
|
|
3939
|
-
"documentCreatorCallback",
|
|
3940
|
-
"formifyCallback",
|
|
3941
|
-
"schema"
|
|
3942
|
-
]);
|
|
4011
|
+
const TinaCMSProvider2 = ({
|
|
4012
|
+
query,
|
|
4013
|
+
documentCreatorCallback,
|
|
4014
|
+
formifyCallback,
|
|
4015
|
+
schema,
|
|
4016
|
+
...props
|
|
4017
|
+
}) => {
|
|
3943
4018
|
var _a;
|
|
3944
4019
|
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);
|
|
3945
4020
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
@@ -3966,13 +4041,14 @@ mutation addPendingDocumentMutation(
|
|
|
3966
4041
|
documentCreatorCallback
|
|
3967
4042
|
}), /* @__PURE__ */ React__default["default"].createElement(TinaDataProvider, {
|
|
3968
4043
|
formifyCallback
|
|
3969
|
-
}, typeof props.children == "function" ? /* @__PURE__ */ React__default["default"].createElement(TinaQuery,
|
|
4044
|
+
}, typeof props.children == "function" ? /* @__PURE__ */ React__default["default"].createElement(TinaQuery, {
|
|
4045
|
+
...props,
|
|
3970
4046
|
variables: props.variables,
|
|
3971
4047
|
data: props.data,
|
|
3972
4048
|
query,
|
|
3973
4049
|
formifyCallback,
|
|
3974
4050
|
children: props.children
|
|
3975
|
-
})
|
|
4051
|
+
}) : props.children))));
|
|
3976
4052
|
};
|
|
3977
4053
|
const DocumentCreator = ({
|
|
3978
4054
|
documentCreatorCallback
|
|
@@ -3981,18 +4057,18 @@ mutation addPendingDocumentMutation(
|
|
|
3981
4057
|
return null;
|
|
3982
4058
|
};
|
|
3983
4059
|
const TinaQuery = (props) => {
|
|
3984
|
-
return /* @__PURE__ */ React__default["default"].createElement(TinaQueryInner,
|
|
3985
|
-
key: `rootQuery-${props.query}
|
|
3986
|
-
|
|
4060
|
+
return /* @__PURE__ */ React__default["default"].createElement(TinaQueryInner, {
|
|
4061
|
+
key: `rootQuery-${props.query}`,
|
|
4062
|
+
...props
|
|
4063
|
+
});
|
|
3987
4064
|
};
|
|
3988
|
-
const TinaQueryInner = (
|
|
3989
|
-
var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
|
|
4065
|
+
const TinaQueryInner = ({ children, ...props }) => {
|
|
3990
4066
|
const { data: liveData, isLoading } = useTina({
|
|
3991
4067
|
query: props.query,
|
|
3992
4068
|
variables: props.variables,
|
|
3993
4069
|
data: props.data
|
|
3994
4070
|
});
|
|
3995
|
-
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(isLoading || !props.query ? props :
|
|
4071
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(isLoading || !props.query ? props : { ...props, data: liveData }));
|
|
3996
4072
|
};
|
|
3997
4073
|
const TinaDataProvider = ({
|
|
3998
4074
|
children,
|
|
@@ -4205,7 +4281,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4205
4281
|
attr: void 0
|
|
4206
4282
|
};
|
|
4207
4283
|
var IconContext = React__default["default"].createContext && React__default["default"].createContext(DefaultContext);
|
|
4208
|
-
var __assign = function() {
|
|
4284
|
+
var __assign = globalThis && globalThis.__assign || function() {
|
|
4209
4285
|
__assign = Object.assign || function(t) {
|
|
4210
4286
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4211
4287
|
s = arguments[i];
|
|
@@ -4217,7 +4293,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4217
4293
|
};
|
|
4218
4294
|
return __assign.apply(this, arguments);
|
|
4219
4295
|
};
|
|
4220
|
-
var __rest = function(s, e) {
|
|
4296
|
+
var __rest = globalThis && globalThis.__rest || function(s, e) {
|
|
4221
4297
|
var t = {};
|
|
4222
4298
|
for (var p in s)
|
|
4223
4299
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -4304,9 +4380,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4304
4380
|
function BiEdit(props) {
|
|
4305
4381
|
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);
|
|
4306
4382
|
}
|
|
4307
|
-
function BiLeftArrowAlt(props) {
|
|
4308
|
-
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);
|
|
4309
|
-
}
|
|
4310
4383
|
function BiLogIn(props) {
|
|
4311
4384
|
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);
|
|
4312
4385
|
}
|
|
@@ -4319,9 +4392,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4319
4392
|
function BiPlus(props) {
|
|
4320
4393
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z" } }] })(props);
|
|
4321
4394
|
}
|
|
4322
|
-
function BiRightArrowAlt(props) {
|
|
4323
|
-
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);
|
|
4324
|
-
}
|
|
4325
4395
|
function BiTrash(props) {
|
|
4326
4396
|
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);
|
|
4327
4397
|
}
|
|
@@ -4708,148 +4778,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4708
4778
|
}
|
|
4709
4779
|
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collection, loading, reFetchCollection));
|
|
4710
4780
|
};
|
|
4711
|
-
const theme = styled.css`
|
|
4712
|
-
:root {
|
|
4713
|
-
--tina-color-primary-light: #2296fe;
|
|
4714
|
-
--tina-color-primary: #0084ff;
|
|
4715
|
-
--tina-color-primary-dark: #0574e4;
|
|
4716
|
-
--tina-color-error-light: #eb6337;
|
|
4717
|
-
--tina-color-error: #ec4815;
|
|
4718
|
-
--tina-color-error-dark: #dc4419;
|
|
4719
|
-
--tina-color-warning-light: #f5e06e;
|
|
4720
|
-
--tina-color-warning: #e9d050;
|
|
4721
|
-
--tina-color-warning-dark: #d3ba38;
|
|
4722
|
-
--tina-color-success-light: #57c355;
|
|
4723
|
-
--tina-color-success: #3cad3a;
|
|
4724
|
-
--tina-color-success-dark: #249a21;
|
|
4725
|
-
--tina-color-grey-0: #ffffff;
|
|
4726
|
-
--tina-color-grey-1: #f6f6f9;
|
|
4727
|
-
--tina-color-grey-2: #edecf3;
|
|
4728
|
-
--tina-color-grey-3: #e1ddec;
|
|
4729
|
-
--tina-color-grey-4: #b2adbe;
|
|
4730
|
-
--tina-color-grey-5: #918c9e;
|
|
4731
|
-
--tina-color-grey-6: #716c7f;
|
|
4732
|
-
--tina-color-grey-7: #565165;
|
|
4733
|
-
--tina-color-grey-8: #433e52;
|
|
4734
|
-
--tina-color-grey-9: #363145;
|
|
4735
|
-
--tina-color-grey-10: #252336;
|
|
4736
|
-
--tina-color-indicator: var(--tina-color-primary);
|
|
4737
|
-
|
|
4738
|
-
--tina-radius-small: 5px;
|
|
4739
|
-
--tina-radius-big: 24px;
|
|
4740
|
-
|
|
4741
|
-
--tina-padding-small: 12px;
|
|
4742
|
-
--tina-padding-big: 20px;
|
|
4743
|
-
|
|
4744
|
-
--tina-font-size-0: 12px;
|
|
4745
|
-
--tina-font-size-1: 13px;
|
|
4746
|
-
--tina-font-size-2: 15px;
|
|
4747
|
-
--tina-font-size-3: 16px;
|
|
4748
|
-
--tina-font-size-4: 18px;
|
|
4749
|
-
--tina-font-size-5: 20px;
|
|
4750
|
-
--tina-font-size-6: 22px;
|
|
4751
|
-
--tina-font-size-7: 26px;
|
|
4752
|
-
--tina-font-size-8: 32px;
|
|
4753
|
-
|
|
4754
|
-
--tina-font-family: 'Inter', sans-serif;
|
|
4755
|
-
|
|
4756
|
-
--tina-font-weight-regular: 400;
|
|
4757
|
-
--tina-font-weight-bold: 600;
|
|
4758
|
-
|
|
4759
|
-
--tina-shadow-big: 0px 2px 3px rgba(0, 0, 0, 0.05),
|
|
4760
|
-
0 4px 12px rgba(0, 0, 0, 0.1);
|
|
4761
|
-
--tina-shadow-small: 0px 2px 3px rgba(0, 0, 0, 0.12);
|
|
4762
|
-
|
|
4763
|
-
--tina-timing-short: 85ms;
|
|
4764
|
-
--tina-timing-medium: 150ms;
|
|
4765
|
-
--tina-timing-long: 250ms;
|
|
4766
|
-
|
|
4767
|
-
--tina-z-index-0: 0;
|
|
4768
|
-
--tina-z-index-1: 10;
|
|
4769
|
-
--tina-z-index-2: 20;
|
|
4770
|
-
--tina-z-index-3: 30;
|
|
4771
|
-
--tina-z-index-4: 40;
|
|
4772
|
-
--tina-z-index-5: 50;
|
|
4773
|
-
|
|
4774
|
-
--tina-sidebar-width: 340px;
|
|
4775
|
-
--tina-sidebar-header-height: 60px;
|
|
4776
|
-
--tina-toolbar-height: 62px;
|
|
4777
|
-
}
|
|
4778
|
-
`;
|
|
4779
|
-
styled.createGlobalStyle`
|
|
4780
|
-
${theme};
|
|
4781
|
-
`;
|
|
4782
|
-
const Button = (_g) => {
|
|
4783
|
-
var _h = _g, {
|
|
4784
|
-
variant = "secondary",
|
|
4785
|
-
as: Tag = "button",
|
|
4786
|
-
size = "medium",
|
|
4787
|
-
busy,
|
|
4788
|
-
disabled,
|
|
4789
|
-
rounded = "full",
|
|
4790
|
-
children,
|
|
4791
|
-
className
|
|
4792
|
-
} = _h, props = __objRest(_h, [
|
|
4793
|
-
"variant",
|
|
4794
|
-
"as",
|
|
4795
|
-
"size",
|
|
4796
|
-
"busy",
|
|
4797
|
-
"disabled",
|
|
4798
|
-
"rounded",
|
|
4799
|
-
"children",
|
|
4800
|
-
"className"
|
|
4801
|
-
]);
|
|
4802
|
-
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 ";
|
|
4803
|
-
const variantClasses = {
|
|
4804
|
-
primary: `shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500`,
|
|
4805
|
-
secondary: `shadow text-gray-500 hover:text-blue-500 bg-gray-50 hover:bg-white border border-gray-200`,
|
|
4806
|
-
white: `shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-200`,
|
|
4807
|
-
ghost: `text-gray-500 hover:text-blue-500 hover:shadow border border-transparent hover:border-gray-200 bg-transparent`,
|
|
4808
|
-
danger: `shadow text-white bg-red-500 hover:bg-red-600 focus:ring-red-500`
|
|
4809
|
-
};
|
|
4810
|
-
const state = busy ? `busy` : disabled ? `disabled` : `default`;
|
|
4811
|
-
const stateClasses = {
|
|
4812
|
-
disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
|
|
4813
|
-
busy: `pointer-events-none opacity-70 cursor-wait`,
|
|
4814
|
-
default: ``
|
|
4815
|
-
};
|
|
4816
|
-
const roundedClasses = {
|
|
4817
|
-
full: `rounded-full`,
|
|
4818
|
-
left: `rounded-l-full`,
|
|
4819
|
-
right: `rounded-r-full`
|
|
4820
|
-
};
|
|
4821
|
-
const sizeClasses = {
|
|
4822
|
-
small: `text-xs h-8 px-3`,
|
|
4823
|
-
medium: `text-sm h-10 px-4`,
|
|
4824
|
-
custom: ``
|
|
4825
|
-
};
|
|
4826
|
-
return /* @__PURE__ */ React__namespace.createElement(Tag, __spreadValues({
|
|
4827
|
-
className: `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${stateClasses[state]} ${roundedClasses[rounded]} ${className}`
|
|
4828
|
-
}, props), children);
|
|
4829
|
-
};
|
|
4830
|
-
function CursorPaginator({
|
|
4831
|
-
navigateNext,
|
|
4832
|
-
navigatePrev,
|
|
4833
|
-
hasNext,
|
|
4834
|
-
hasPrev,
|
|
4835
|
-
variant = "secondary"
|
|
4836
|
-
}) {
|
|
4837
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4838
|
-
className: "w-full flex flex-shrink-0 justify-end gap-2 items-center"
|
|
4839
|
-
}, /* @__PURE__ */ React__default["default"].createElement(Button, {
|
|
4840
|
-
variant,
|
|
4841
|
-
disabled: !hasPrev,
|
|
4842
|
-
onClick: navigatePrev
|
|
4843
|
-
}, /* @__PURE__ */ React__default["default"].createElement(BiLeftArrowAlt, {
|
|
4844
|
-
className: "w-6 h-full mr-2 opacity-70"
|
|
4845
|
-
}), " Previous"), /* @__PURE__ */ React__default["default"].createElement(Button, {
|
|
4846
|
-
variant,
|
|
4847
|
-
disabled: !hasNext,
|
|
4848
|
-
onClick: navigateNext
|
|
4849
|
-
}, "Next ", /* @__PURE__ */ React__default["default"].createElement(BiRightArrowAlt, {
|
|
4850
|
-
className: "w-6 h-full ml-2 opacity-70"
|
|
4851
|
-
})));
|
|
4852
|
-
}
|
|
4853
4781
|
const TemplateMenu = ({ templates }) => {
|
|
4854
4782
|
return /* @__PURE__ */ React__default["default"].createElement(react.Menu, {
|
|
4855
4783
|
as: "div",
|
|
@@ -5020,7 +4948,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5020
4948
|
})));
|
|
5021
4949
|
}))), useDataFlag && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5022
4950
|
className: "pt-3"
|
|
5023
|
-
}, /* @__PURE__ */ React__default["default"].createElement(CursorPaginator, {
|
|
4951
|
+
}, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
|
|
5024
4952
|
variant: "white",
|
|
5025
4953
|
hasNext: pageInfo == null ? void 0 : pageInfo.hasNextPage,
|
|
5026
4954
|
navigateNext: () => {
|
|
@@ -5063,12 +4991,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5063
4991
|
}
|
|
5064
4992
|
const createDocument = async (cms, collection, template, mutationInfo, values) => {
|
|
5065
4993
|
const api = new TinaAdminApi(cms);
|
|
5066
|
-
const
|
|
4994
|
+
const { filename, ...leftover } = values;
|
|
5067
4995
|
const { includeCollection, includeTemplate } = mutationInfo;
|
|
5068
4996
|
const relativePath = `${filename}.${collection.format}`;
|
|
5069
|
-
const params = transformDocumentIntoMutationRequestPayload(
|
|
5070
|
-
_collection: collection.name
|
|
5071
|
-
|
|
4997
|
+
const params = transformDocumentIntoMutationRequestPayload({
|
|
4998
|
+
_collection: collection.name,
|
|
4999
|
+
...template && { _template: template.name },
|
|
5000
|
+
...leftover
|
|
5001
|
+
}, {
|
|
5072
5002
|
includeCollection,
|
|
5073
5003
|
includeTemplate
|
|
5074
5004
|
});
|
|
@@ -5237,7 +5167,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5237
5167
|
}
|
|
5238
5168
|
};
|
|
5239
5169
|
const CollectionUpdatePage = () => {
|
|
5240
|
-
const
|
|
5170
|
+
const { collectionName, ...rest } = reactRouterDom.useParams();
|
|
5241
5171
|
const { "*": filename } = rest;
|
|
5242
5172
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => /* @__PURE__ */ React__default["default"].createElement(GetCollection, {
|
|
5243
5173
|
cms,
|
|
@@ -5451,6 +5381,5 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5451
5381
|
}
|
|
5452
5382
|
});
|
|
5453
5383
|
});
|
|
5454
|
-
Object.
|
|
5455
|
-
exports2[Symbol.toStringTag] = "Module";
|
|
5384
|
+
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
5456
5385
|
});
|