tinacms 0.68.9 → 0.68.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 = { __proto__: null, [Symbol.toStringTag]: "Module" };
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 _a = document, { _collection, __typename, _template } = _a, rest = __objRest(_a, ["_collection", "__typename", "_template"]);
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 _a = data, { _template, __typename } = _a, rest = __objRest(_a, ["_template", "__typename"]);
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 = __spreadValues({
615
+ formConfig = {
648
616
  label: formInfo.label,
649
- fields: formInfo.fields
650
- }, formCommon);
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 __spreadProps(__spreadValues({}, node2), {
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 __spreadProps(__spreadValues({}, selectionNode), {
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 __spreadProps(__spreadValues({}, selectionNode2), {
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 __spreadProps(__spreadValues({}, selection), {
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 __spreadProps(__spreadValues({}, fieldNode), {
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 __spreadProps(__spreadValues({}, inlineFragmentNode), {
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 __spreadProps(__spreadValues({}, definition), {
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 __spreadProps(__spreadValues({}, selectionNode), {
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 __spreadProps(__spreadValues(__spreadValues({}, state), defaultState), {
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 __spreadProps(__spreadValues({}, state), {
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 __spreadProps(__spreadValues({}, state), {
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(__spreadProps(__spreadValues({
1484
- path: [formNodePath(formNode), "values"].join(".")
1485
- }, buildChangeSet(event, formNode)), {
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(__spreadProps(__spreadValues({
1494
- path: [formNodePath(formNode), "dataJSON"].join(".")
1495
- }, buildChangeSet(event, formNode)), {
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(__spreadValues({
1507
- path: pathToChange
1508
- }, buildChangeSet(event, formNode)));
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(__spreadValues({
1526
- path: pathToChange
1527
- }, buildChangeSet(event, newFormNode)));
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(__spreadProps(__spreadValues({
1533
- path: pathToChange
1534
- }, buildChangeSet(event, subFormNode)), {
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(__spreadProps(__spreadValues({}, subFormNode), {
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(__spreadValues({
1555
- path: pathToChange
1556
- }, buildChangeSet(event, formNode)));
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(__spreadProps(__spreadValues({}, subFormNode), {
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(__spreadProps(__spreadValues({
1574
- path: pathToChange
1575
- }, buildChangeSet(event, formNode)), {
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(__spreadProps(__spreadValues({}, subFormNode), {
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(__spreadProps(__spreadValues({
1595
- path: pathToChange
1596
- }, buildChangeSet(event, formNode)), {
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 __spreadProps(__spreadValues({}, state), {
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(__spreadValues({
1628
- path: [formNodePath(formNode), "_values"].join(".")
1629
- }, buildChangeSet(event, formNode)));
1615
+ changeSets.push({
1616
+ path: [formNodePath(formNode), "_values"].join("."),
1617
+ ...buildChangeSet(event, formNode)
1618
+ });
1630
1619
  }
1631
- changeSets.push(__spreadValues({
1632
- path: [formNodePath(formNode)].join(".")
1633
- }, buildChangeSet(event, formNode)));
1620
+ changeSets.push({
1621
+ path: [formNodePath(formNode)].join("."),
1622
+ ...buildChangeSet(event, formNode)
1623
+ });
1634
1624
  });
1635
- return __spreadProps(__spreadValues({}, state), { changeSets });
1625
+ return { ...state, changeSets };
1636
1626
  }
1637
1627
  case "ready":
1638
- return __spreadProps(__spreadValues({}, state), { status: "ready" });
1628
+ return { ...state, status: "ready" };
1639
1629
  case "done":
1640
- return __spreadProps(__spreadValues({}, state), { status: "done" });
1630
+ return { ...state, status: "done" };
1641
1631
  case "setData":
1642
- return __spreadProps(__spreadValues({}, state), { data: action.value });
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 __spreadProps(__spreadValues({}, state), {
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: __spreadProps(__spreadValues({}, 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: __spreadProps(__spreadValues({
1876
- displaceIndex: true
1877
- }, changeSet), {
1878
- value: __spreadValues(__spreadValues({}, res), extra)
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: __spreadProps(__spreadValues({
1886
- displaceIndex: true
1887
- }, changeSet), {
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: __spreadProps(__spreadValues({}, changeSet), {
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: __spreadProps(__spreadValues({}, changeSet), {
1920
- value: __spreadValues(__spreadValues({}, res.node), data)
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.length]);
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 __spreadProps(__spreadValues({}, await resolveSubFields({
1977
- formNode,
1978
- form: { fields: template.fields, values: item },
1979
- prefix: prefix ? [prefix, fieldName].join(".") : fieldName,
1980
- loc: [...loc, index]
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] = __spreadValues(__spreadValues({}, res.node), await resolveSubFields({
2081
- formNode: subDocumentFormNode,
2082
- form: form2,
2083
- loc: location
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 __spreadProps(__spreadValues({}, state), {
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(_a) {
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(__spreadValues({
2173
+ const enrichedSchema = new schemaTools.TinaSchema({
2170
2174
  version: { fullVersion: "", major: "", minor: "", patch: "" },
2171
- meta: { flags: [] }
2172
- }, schemaTools.addNamespaceToSchema(options.schema, [])));
2175
+ meta: { flags: [] },
2176
+ ...schemaTools.addNamespaceToSchema(options.schema, [])
2177
+ });
2173
2178
  this.schema = enrichedSchema;
2174
2179
  }
2175
2180
  this.options = options;
@@ -2224,11 +2229,13 @@ mutation addPendingDocumentMutation(
2224
2229
  return this.contentApiUrl.includes("localhost");
2225
2230
  }
2226
2231
  setBranch(branchName) {
2227
- var _a, _b, _c;
2232
+ var _a, _b, _c, _d;
2228
2233
  const encodedBranch = encodeURIComponent(branchName);
2229
- this.frontendUrl = ((_a = this.options.tinaioConfig) == null ? void 0 : _a.frontendUrlOverride) || "https://app.tina.io";
2230
- this.identityApiUrl = ((_b = this.options.tinaioConfig) == null ? void 0 : _b.identityApiUrlOverride) || "https://identity.tinajs.io";
2231
- this.contentApiBase = ((_c = this.options.tinaioConfig) == null ? void 0 : _c.contentApiUrlOverride) || `https://content.tinajs.io`;
2234
+ this.branch = encodedBranch;
2235
+ this.assetsApiUrl = ((_a = this.options.tinaioConfig) == null ? void 0 : _a.assetsApiUrlOverride) || "https://assets.tinajs.io";
2236
+ this.frontendUrl = ((_b = this.options.tinaioConfig) == null ? void 0 : _b.frontendUrlOverride) || "https://app.tina.io";
2237
+ this.identityApiUrl = ((_c = this.options.tinaioConfig) == null ? void 0 : _c.identityApiUrlOverride) || "https://identity.tinajs.io";
2238
+ this.contentApiBase = ((_d = this.options.tinaioConfig) == null ? void 0 : _d.contentApiUrlOverride) || `https://content.tinajs.io`;
2232
2239
  this.contentApiUrl = this.options.customContentApiUrl || `${this.contentApiBase}/content/${this.options.clientId}/github/${encodedBranch}`;
2233
2240
  }
2234
2241
  async requestWithForm(query, {
@@ -2262,7 +2269,12 @@ mutation addPendingDocumentMutation(
2262
2269
  })
2263
2270
  });
2264
2271
  if (res.status !== 200) {
2265
- throw new Error(`Unable to complete request, ${res.statusText}`);
2272
+ let errorMessage = `Unable to complete request, ${res.statusText}`;
2273
+ const resBody = await res.json();
2274
+ if (resBody.message) {
2275
+ errorMessage = `${errorMessage}, Response: ${resBody.message}`;
2276
+ }
2277
+ throw new Error(errorMessage);
2266
2278
  }
2267
2279
  const json = await res.json();
2268
2280
  if (json.errors) {
@@ -2271,6 +2283,24 @@ mutation addPendingDocumentMutation(
2271
2283
  }
2272
2284
  return json.data;
2273
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
+ }
2274
2304
  parseJwt(token) {
2275
2305
  const base64Url = token.split(".")[1];
2276
2306
  const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
@@ -2325,11 +2355,13 @@ mutation addPendingDocumentMutation(
2325
2355
  }
2326
2356
  async fetchWithToken(input, init) {
2327
2357
  const headers = (init == null ? void 0 : init.headers) || {};
2328
- return await fetch(input, __spreadProps(__spreadValues({}, init), {
2329
- headers: new Headers(__spreadValues({
2330
- Authorization: "Bearer " + (await this.getToken()).id_token
2331
- }, headers))
2332
- }));
2358
+ return await fetch(input, {
2359
+ ...init,
2360
+ headers: new Headers({
2361
+ Authorization: "Bearer " + (await this.getToken()).id_token,
2362
+ ...headers
2363
+ })
2364
+ });
2333
2365
  }
2334
2366
  async getUser() {
2335
2367
  if (!this.clientId) {
@@ -2381,11 +2413,12 @@ mutation addPendingDocumentMutation(
2381
2413
  const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
2382
2414
  class LocalClient extends Client {
2383
2415
  constructor(props) {
2384
- const clientProps = __spreadProps(__spreadValues({}, props), {
2416
+ const clientProps = {
2417
+ ...props,
2385
2418
  clientId: "",
2386
2419
  branch: "",
2387
2420
  customContentApiUrl: props && props.customContentApiUrl ? props.customContentApiUrl : DEFAULT_LOCAL_TINA_GQL_SERVER_URL
2388
- });
2421
+ };
2389
2422
  super(clientProps);
2390
2423
  }
2391
2424
  async isAuthorized() {
@@ -2398,9 +2431,10 @@ mutation addPendingDocumentMutation(
2398
2431
  function ModalBuilder(modalProps) {
2399
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, {
2400
2433
  padded: true
2401
- }, /* @__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, __spreadValues({
2402
- key: action.name
2403
- }, action))))));
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
+ })))));
2404
2438
  }
2405
2439
  const ErrorLabel = styled__default["default"].p`
2406
2440
  color: var(--tina-color-error) !important;
@@ -2672,7 +2706,7 @@ mutation addPendingDocumentMutation(
2672
2706
  sidebar: true
2673
2707
  }), [props.cms]);
2674
2708
  if (!cms.api.tina) {
2675
- cms.registerApi("tina", createClient(__spreadProps(__spreadValues({}, props), { branch: currentBranch })));
2709
+ cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
2676
2710
  } else {
2677
2711
  cms.api.tina.setBranch(currentBranch);
2678
2712
  }
@@ -2680,14 +2714,20 @@ mutation addPendingDocumentMutation(
2680
2714
  cms.registerApi("admin", new TinaAdminApi(cms));
2681
2715
  }
2682
2716
  const setupMedia = async () => {
2683
- var _a;
2684
- if (props.mediaStore) {
2685
- if ((_a = props.mediaStore.prototype) == null ? void 0 : _a.persist) {
2686
- cms.media.store = new props.mediaStore(cms.api.tina);
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);
2687
2725
  } else {
2688
- const MediaClass = await props.mediaStore();
2726
+ const MediaClass = await mediaStoreFromProps();
2689
2727
  cms.media.store = new MediaClass(cms.api.tina);
2690
2728
  }
2729
+ } else {
2730
+ cms.media.store = new toolkit.DummyMediaStore();
2691
2731
  }
2692
2732
  };
2693
2733
  const handleListBranches = async () => {
@@ -2738,12 +2778,13 @@ mutation addPendingDocumentMutation(
2738
2778
  }
2739
2779
  }, /* @__PURE__ */ React__default["default"].createElement(toolkit.TinaProvider, {
2740
2780
  cms
2741
- }, /* @__PURE__ */ React__default["default"].createElement(AuthWallInner, __spreadProps(__spreadValues({}, props), {
2781
+ }, /* @__PURE__ */ React__default["default"].createElement(AuthWallInner, {
2782
+ ...props,
2742
2783
  cms
2743
- }))));
2784
+ })));
2744
2785
  };
2745
2786
  const TinaCloudAuthWall = TinaCloudProvider;
2746
- var styles = `.tina-tailwind {
2787
+ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
2747
2788
  line-height: 1.5;
2748
2789
  -webkit-text-size-adjust: 100%;
2749
2790
  -moz-tab-size: 4;
@@ -2968,6 +3009,54 @@ mutation addPendingDocumentMutation(
2968
3009
  display: none;
2969
3010
  }
2970
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;
2971
3060
  --tw-translate-x: 0;
2972
3061
  --tw-translate-y: 0;
2973
3062
  --tw-rotate: 0;
@@ -3312,14 +3401,17 @@ mutation addPendingDocumentMutation(
3312
3401
  }
3313
3402
  .tina-tailwind .from-blue-900 {
3314
3403
  --tw-gradient-from: #1D2C6C;
3315
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(29 44 108 / 0));
3404
+ --tw-gradient-to: rgb(29 44 108 / 0);
3405
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
3316
3406
  }
3317
3407
  .tina-tailwind .from-gray-800 {
3318
3408
  --tw-gradient-from: #363145;
3319
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(54 49 69 / 0));
3409
+ --tw-gradient-to: rgb(54 49 69 / 0);
3410
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
3320
3411
  }
3321
3412
  .tina-tailwind .via-gray-900 {
3322
- --tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to, rgb(37 35 54 / 0));
3413
+ --tw-gradient-to: rgb(37 35 54 / 0);
3414
+ --tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to);
3323
3415
  }
3324
3416
  .tina-tailwind .to-gray-900 {
3325
3417
  --tw-gradient-to: #252336;
@@ -3621,7 +3713,7 @@ mutation addPendingDocumentMutation(
3621
3713
  --tw-ring-opacity: 1;
3622
3714
  --tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
3623
3715
  }
3624
- `;
3716
+ `)();
3625
3717
  class ContentCreatorPlugin {
3626
3718
  constructor(options) {
3627
3719
  this.__type = "content-creator";
@@ -3916,18 +4008,13 @@ mutation addPendingDocumentMutation(
3916
4008
  return this.props.children;
3917
4009
  }
3918
4010
  }
3919
- const TinaCMSProvider2 = (_c) => {
3920
- var _d = _c, {
3921
- query,
3922
- documentCreatorCallback,
3923
- formifyCallback,
3924
- schema
3925
- } = _d, props = __objRest(_d, [
3926
- "query",
3927
- "documentCreatorCallback",
3928
- "formifyCallback",
3929
- "schema"
3930
- ]);
4011
+ const TinaCMSProvider2 = ({
4012
+ query,
4013
+ documentCreatorCallback,
4014
+ formifyCallback,
4015
+ schema,
4016
+ ...props
4017
+ }) => {
3931
4018
  var _a;
3932
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);
3933
4020
  const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
@@ -3954,13 +4041,14 @@ mutation addPendingDocumentMutation(
3954
4041
  documentCreatorCallback
3955
4042
  }), /* @__PURE__ */ React__default["default"].createElement(TinaDataProvider, {
3956
4043
  formifyCallback
3957
- }, typeof props.children == "function" ? /* @__PURE__ */ React__default["default"].createElement(TinaQuery, __spreadProps(__spreadValues({}, props), {
4044
+ }, typeof props.children == "function" ? /* @__PURE__ */ React__default["default"].createElement(TinaQuery, {
4045
+ ...props,
3958
4046
  variables: props.variables,
3959
4047
  data: props.data,
3960
4048
  query,
3961
4049
  formifyCallback,
3962
4050
  children: props.children
3963
- })) : props.children))));
4051
+ }) : props.children))));
3964
4052
  };
3965
4053
  const DocumentCreator = ({
3966
4054
  documentCreatorCallback
@@ -3969,18 +4057,18 @@ mutation addPendingDocumentMutation(
3969
4057
  return null;
3970
4058
  };
3971
4059
  const TinaQuery = (props) => {
3972
- return /* @__PURE__ */ React__default["default"].createElement(TinaQueryInner, __spreadValues({
3973
- key: `rootQuery-${props.query}`
3974
- }, props));
4060
+ return /* @__PURE__ */ React__default["default"].createElement(TinaQueryInner, {
4061
+ key: `rootQuery-${props.query}`,
4062
+ ...props
4063
+ });
3975
4064
  };
3976
- const TinaQueryInner = (_e) => {
3977
- var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
4065
+ const TinaQueryInner = ({ children, ...props }) => {
3978
4066
  const { data: liveData, isLoading } = useTina({
3979
4067
  query: props.query,
3980
4068
  variables: props.variables,
3981
4069
  data: props.data
3982
4070
  });
3983
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(isLoading || !props.query ? props : __spreadProps(__spreadValues({}, props), { data: liveData })));
4071
+ return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(isLoading || !props.query ? props : { ...props, data: liveData }));
3984
4072
  };
3985
4073
  const TinaDataProvider = ({
3986
4074
  children,
@@ -4193,7 +4281,7 @@ This will work when developing locally but NOT when deployed to production.
4193
4281
  attr: void 0
4194
4282
  };
4195
4283
  var IconContext = React__default["default"].createContext && React__default["default"].createContext(DefaultContext);
4196
- var __assign = function() {
4284
+ var __assign = globalThis && globalThis.__assign || function() {
4197
4285
  __assign = Object.assign || function(t) {
4198
4286
  for (var s, i = 1, n = arguments.length; i < n; i++) {
4199
4287
  s = arguments[i];
@@ -4205,7 +4293,7 @@ This will work when developing locally but NOT when deployed to production.
4205
4293
  };
4206
4294
  return __assign.apply(this, arguments);
4207
4295
  };
4208
- var __rest = function(s, e) {
4296
+ var __rest = globalThis && globalThis.__rest || function(s, e) {
4209
4297
  var t = {};
4210
4298
  for (var p in s)
4211
4299
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -4292,9 +4380,6 @@ This will work when developing locally but NOT when deployed to production.
4292
4380
  function BiEdit(props) {
4293
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);
4294
4382
  }
4295
- function BiLeftArrowAlt(props) {
4296
- 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);
4297
- }
4298
4383
  function BiLogIn(props) {
4299
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);
4300
4385
  }
@@ -4307,9 +4392,6 @@ This will work when developing locally but NOT when deployed to production.
4307
4392
  function BiPlus(props) {
4308
4393
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z" } }] })(props);
4309
4394
  }
4310
- function BiRightArrowAlt(props) {
4311
- 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);
4312
- }
4313
4395
  function BiTrash(props) {
4314
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);
4315
4397
  }
@@ -4696,148 +4778,6 @@ This will work when developing locally but NOT when deployed to production.
4696
4778
  }
4697
4779
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collection, loading, reFetchCollection));
4698
4780
  };
4699
- const theme = styled.css`
4700
- :root {
4701
- --tina-color-primary-light: #2296fe;
4702
- --tina-color-primary: #0084ff;
4703
- --tina-color-primary-dark: #0574e4;
4704
- --tina-color-error-light: #eb6337;
4705
- --tina-color-error: #ec4815;
4706
- --tina-color-error-dark: #dc4419;
4707
- --tina-color-warning-light: #f5e06e;
4708
- --tina-color-warning: #e9d050;
4709
- --tina-color-warning-dark: #d3ba38;
4710
- --tina-color-success-light: #57c355;
4711
- --tina-color-success: #3cad3a;
4712
- --tina-color-success-dark: #249a21;
4713
- --tina-color-grey-0: #ffffff;
4714
- --tina-color-grey-1: #f6f6f9;
4715
- --tina-color-grey-2: #edecf3;
4716
- --tina-color-grey-3: #e1ddec;
4717
- --tina-color-grey-4: #b2adbe;
4718
- --tina-color-grey-5: #918c9e;
4719
- --tina-color-grey-6: #716c7f;
4720
- --tina-color-grey-7: #565165;
4721
- --tina-color-grey-8: #433e52;
4722
- --tina-color-grey-9: #363145;
4723
- --tina-color-grey-10: #252336;
4724
- --tina-color-indicator: var(--tina-color-primary);
4725
-
4726
- --tina-radius-small: 5px;
4727
- --tina-radius-big: 24px;
4728
-
4729
- --tina-padding-small: 12px;
4730
- --tina-padding-big: 20px;
4731
-
4732
- --tina-font-size-0: 12px;
4733
- --tina-font-size-1: 13px;
4734
- --tina-font-size-2: 15px;
4735
- --tina-font-size-3: 16px;
4736
- --tina-font-size-4: 18px;
4737
- --tina-font-size-5: 20px;
4738
- --tina-font-size-6: 22px;
4739
- --tina-font-size-7: 26px;
4740
- --tina-font-size-8: 32px;
4741
-
4742
- --tina-font-family: 'Inter', sans-serif;
4743
-
4744
- --tina-font-weight-regular: 400;
4745
- --tina-font-weight-bold: 600;
4746
-
4747
- --tina-shadow-big: 0px 2px 3px rgba(0, 0, 0, 0.05),
4748
- 0 4px 12px rgba(0, 0, 0, 0.1);
4749
- --tina-shadow-small: 0px 2px 3px rgba(0, 0, 0, 0.12);
4750
-
4751
- --tina-timing-short: 85ms;
4752
- --tina-timing-medium: 150ms;
4753
- --tina-timing-long: 250ms;
4754
-
4755
- --tina-z-index-0: 0;
4756
- --tina-z-index-1: 10;
4757
- --tina-z-index-2: 20;
4758
- --tina-z-index-3: 30;
4759
- --tina-z-index-4: 40;
4760
- --tina-z-index-5: 50;
4761
-
4762
- --tina-sidebar-width: 340px;
4763
- --tina-sidebar-header-height: 60px;
4764
- --tina-toolbar-height: 62px;
4765
- }
4766
- `;
4767
- styled.createGlobalStyle`
4768
- ${theme};
4769
- `;
4770
- const Button = (_g) => {
4771
- var _h = _g, {
4772
- variant = "secondary",
4773
- as: Tag = "button",
4774
- size = "medium",
4775
- busy,
4776
- disabled,
4777
- rounded = "full",
4778
- children,
4779
- className
4780
- } = _h, props = __objRest(_h, [
4781
- "variant",
4782
- "as",
4783
- "size",
4784
- "busy",
4785
- "disabled",
4786
- "rounded",
4787
- "children",
4788
- "className"
4789
- ]);
4790
- 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 ";
4791
- const variantClasses = {
4792
- primary: `shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500`,
4793
- secondary: `shadow text-gray-500 hover:text-blue-500 bg-gray-50 hover:bg-white border border-gray-200`,
4794
- white: `shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-200`,
4795
- ghost: `text-gray-500 hover:text-blue-500 hover:shadow border border-transparent hover:border-gray-200 bg-transparent`,
4796
- danger: `shadow text-white bg-red-500 hover:bg-red-600 focus:ring-red-500`
4797
- };
4798
- const state = busy ? `busy` : disabled ? `disabled` : `default`;
4799
- const stateClasses = {
4800
- disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
4801
- busy: `pointer-events-none opacity-70 cursor-wait`,
4802
- default: ``
4803
- };
4804
- const roundedClasses = {
4805
- full: `rounded-full`,
4806
- left: `rounded-l-full`,
4807
- right: `rounded-r-full`
4808
- };
4809
- const sizeClasses = {
4810
- small: `text-xs h-8 px-3`,
4811
- medium: `text-sm h-10 px-4`,
4812
- custom: ``
4813
- };
4814
- return /* @__PURE__ */ React__namespace.createElement(Tag, __spreadValues({
4815
- className: `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${stateClasses[state]} ${roundedClasses[rounded]} ${className}`
4816
- }, props), children);
4817
- };
4818
- function CursorPaginator({
4819
- navigateNext,
4820
- navigatePrev,
4821
- hasNext,
4822
- hasPrev,
4823
- variant = "secondary"
4824
- }) {
4825
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4826
- className: "w-full flex flex-shrink-0 justify-end gap-2 items-center"
4827
- }, /* @__PURE__ */ React__default["default"].createElement(Button, {
4828
- variant,
4829
- disabled: !hasPrev,
4830
- onClick: navigatePrev
4831
- }, /* @__PURE__ */ React__default["default"].createElement(BiLeftArrowAlt, {
4832
- className: "w-6 h-full mr-2 opacity-70"
4833
- }), " Previous"), /* @__PURE__ */ React__default["default"].createElement(Button, {
4834
- variant,
4835
- disabled: !hasNext,
4836
- onClick: navigateNext
4837
- }, "Next ", /* @__PURE__ */ React__default["default"].createElement(BiRightArrowAlt, {
4838
- className: "w-6 h-full ml-2 opacity-70"
4839
- })));
4840
- }
4841
4781
  const TemplateMenu = ({ templates }) => {
4842
4782
  return /* @__PURE__ */ React__default["default"].createElement(react.Menu, {
4843
4783
  as: "div",
@@ -5008,7 +4948,7 @@ This will work when developing locally but NOT when deployed to production.
5008
4948
  })));
5009
4949
  }))), useDataFlag && /* @__PURE__ */ React__default["default"].createElement("div", {
5010
4950
  className: "pt-3"
5011
- }, /* @__PURE__ */ React__default["default"].createElement(CursorPaginator, {
4951
+ }, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
5012
4952
  variant: "white",
5013
4953
  hasNext: pageInfo == null ? void 0 : pageInfo.hasNextPage,
5014
4954
  navigateNext: () => {
@@ -5030,7 +4970,7 @@ This will work when developing locally but NOT when deployed to production.
5030
4970
  });
5031
4971
  };
5032
4972
  const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
5033
- return /* @__PURE__ */ React__default["default"].createElement(toolkit.Modal, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalHeader, {
4973
+ return /* @__PURE__ */ React__default["default"].createElement(toolkit.Modal, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.PopupModal, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalHeader, {
5034
4974
  close: close2
5035
4975
  }, "Delete ", filename), /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalBody, {
5036
4976
  padded: true
@@ -5044,19 +4984,21 @@ This will work when developing locally but NOT when deployed to production.
5044
4984
  await deleteFunc();
5045
4985
  close2();
5046
4986
  }
5047
- }, "Delete")));
4987
+ }, "Delete"))));
5048
4988
  };
5049
4989
  function HiChevronRight(props) {
5050
4990
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "clipRule": "evenodd" } }] })(props);
5051
4991
  }
5052
4992
  const createDocument = async (cms, collection, template, mutationInfo, values) => {
5053
4993
  const api = new TinaAdminApi(cms);
5054
- const _a = values, { filename } = _a, leftover = __objRest(_a, ["filename"]);
4994
+ const { filename, ...leftover } = values;
5055
4995
  const { includeCollection, includeTemplate } = mutationInfo;
5056
4996
  const relativePath = `${filename}.${collection.format}`;
5057
- const params = transformDocumentIntoMutationRequestPayload(__spreadValues(__spreadValues({
5058
- _collection: collection.name
5059
- }, template && { _template: template.name }), leftover), {
4997
+ const params = transformDocumentIntoMutationRequestPayload({
4998
+ _collection: collection.name,
4999
+ ...template && { _template: template.name },
5000
+ ...leftover
5001
+ }, {
5060
5002
  includeCollection,
5061
5003
  includeTemplate
5062
5004
  });
@@ -5225,7 +5167,7 @@ This will work when developing locally but NOT when deployed to production.
5225
5167
  }
5226
5168
  };
5227
5169
  const CollectionUpdatePage = () => {
5228
- const _a = reactRouterDom.useParams(), { collectionName } = _a, rest = __objRest(_a, ["collectionName"]);
5170
+ const { collectionName, ...rest } = reactRouterDom.useParams();
5229
5171
  const { "*": filename } = rest;
5230
5172
  return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => /* @__PURE__ */ React__default["default"].createElement(GetCollection, {
5231
5173
  cms,
@@ -5439,6 +5381,5 @@ This will work when developing locally but NOT when deployed to production.
5439
5381
  }
5440
5382
  });
5441
5383
  });
5442
- Object.defineProperty(exports2, "__esModule", { value: true });
5443
- exports2[Symbol.toStringTag] = "Module";
5384
+ Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
5444
5385
  });