tinacms 0.68.11 → 0.68.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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;
@@ -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, __spreadProps(__spreadValues({}, init), {
2335
- headers: new Headers(__spreadValues({
2336
- Authorization: "Bearer " + (await this.getToken()).id_token
2337
- }, headers))
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 = __spreadProps(__spreadValues({}, props), {
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, __spreadValues({
2408
- key: action.name
2409
- }, 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
+ })))));
2410
2438
  }
2411
2439
  const ErrorLabel = styled__default["default"].p`
2412
2440
  color: var(--tina-color-error) !important;
@@ -2449,7 +2477,6 @@ mutation addPendingDocumentMutation(
2449
2477
  constructor(cms) {
2450
2478
  this.api = cms.api.tina;
2451
2479
  this.schema = cms.api.tina.schema;
2452
- this.useDataLayer = cms.flags.get("experimentalData");
2453
2480
  }
2454
2481
  async isAuthenticated() {
2455
2482
  return await this.api.isAuthenticated();
@@ -2476,9 +2503,8 @@ mutation addPendingDocumentMutation(
2476
2503
  }
2477
2504
  async fetchCollection(collectionName, includeDocuments, after) {
2478
2505
  if (includeDocuments === true) {
2479
- if (this.useDataLayer) {
2480
- const sort = this.schema.getIsTitleFieldName(collectionName);
2481
- const response = await this.api.request(`#graphql
2506
+ const sort = this.schema.getIsTitleFieldName(collectionName);
2507
+ const response = await this.api.request(`#graphql
2482
2508
  query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
2483
2509
  collection(collection: $collection){
2484
2510
  name
@@ -2512,45 +2538,15 @@ mutation addPendingDocumentMutation(
2512
2538
  }
2513
2539
  }
2514
2540
  }`, {
2515
- variables: {
2516
- collection: collectionName,
2517
- includeDocuments,
2518
- sort,
2519
- limit: 10,
2520
- after
2521
- }
2522
- });
2523
- return response.collection;
2524
- } else {
2525
- const response = await this.api.request(`#graphql
2526
- query($collection: String!, $includeDocuments: Boolean!){
2527
- collection(collection: $collection){
2528
- name
2529
- label
2530
- format
2531
- templates
2532
- documents @include(if: $includeDocuments) {
2533
- totalCount
2534
- edges {
2535
- node {
2536
- ... on Document {
2537
- _sys {
2538
- template
2539
- breadcrumbs
2540
- path
2541
- basename
2542
- relativePath
2543
- filename
2544
- extension
2545
- }
2546
- }
2547
- }
2541
+ variables: {
2542
+ collection: collectionName,
2543
+ includeDocuments,
2544
+ sort,
2545
+ limit: 10,
2546
+ after
2548
2547
  }
2549
- }
2550
- }
2551
- }`, { variables: { collection: collectionName, includeDocuments } });
2552
- return response.collection;
2553
- }
2548
+ });
2549
+ return response.collection;
2554
2550
  } else {
2555
2551
  try {
2556
2552
  const collection = this.schema.getCollection(collectionName);
@@ -2678,7 +2674,7 @@ mutation addPendingDocumentMutation(
2678
2674
  sidebar: true
2679
2675
  }), [props.cms]);
2680
2676
  if (!cms.api.tina) {
2681
- cms.registerApi("tina", createClient(__spreadProps(__spreadValues({}, props), { branch: currentBranch })));
2677
+ cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
2682
2678
  } else {
2683
2679
  cms.api.tina.setBranch(currentBranch);
2684
2680
  }
@@ -2686,20 +2682,20 @@ mutation addPendingDocumentMutation(
2686
2682
  cms.registerApi("admin", new TinaAdminApi(cms));
2687
2683
  }
2688
2684
  const setupMedia = async () => {
2689
- var _a, _b, _c;
2690
- if (props.mediaStore) {
2691
- if ((_a = props.mediaStore.prototype) == null ? void 0 : _a.persist) {
2692
- cms.media.store = new props.mediaStore(cms.api.tina);
2685
+ var _a, _b, _c, _d, _e, _f, _g;
2686
+ const hasTinaMedia = Boolean((_b = (_a = props.schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina);
2687
+ if (hasTinaMedia) {
2688
+ cms.media.store = new toolkit.TinaMediaStore(cms);
2689
+ } else if (((_d = (_c = props.schema.config) == null ? void 0 : _c.media) == null ? void 0 : _d.loadCustomStore) || props.mediaStore) {
2690
+ const mediaStoreFromProps = ((_f = (_e = props.schema.config) == null ? void 0 : _e.media) == null ? void 0 : _f.loadCustomStore) || props.mediaStore;
2691
+ if ((_g = mediaStoreFromProps.prototype) == null ? void 0 : _g.persist) {
2692
+ cms.media.store = new mediaStoreFromProps(cms.api.tina);
2693
2693
  } else {
2694
- const MediaClass = await props.mediaStore();
2694
+ const MediaClass = await mediaStoreFromProps();
2695
2695
  cms.media.store = new MediaClass(cms.api.tina);
2696
2696
  }
2697
2697
  } else {
2698
- if ((_c = (_b = props.schema.config) == null ? void 0 : _b.media) == null ? void 0 : _c.tina) {
2699
- cms.media.store = new toolkit.TinaMediaStore(cms);
2700
- } else {
2701
- cms.media.store = new toolkit.DummyMediaStore();
2702
- }
2698
+ cms.media.store = new toolkit.DummyMediaStore();
2703
2699
  }
2704
2700
  };
2705
2701
  const handleListBranches = async () => {
@@ -2750,12 +2746,13 @@ mutation addPendingDocumentMutation(
2750
2746
  }
2751
2747
  }, /* @__PURE__ */ React__default["default"].createElement(toolkit.TinaProvider, {
2752
2748
  cms
2753
- }, /* @__PURE__ */ React__default["default"].createElement(AuthWallInner, __spreadProps(__spreadValues({}, props), {
2749
+ }, /* @__PURE__ */ React__default["default"].createElement(AuthWallInner, {
2750
+ ...props,
2754
2751
  cms
2755
- }))));
2752
+ })));
2756
2753
  };
2757
2754
  const TinaCloudAuthWall = TinaCloudProvider;
2758
- var styles = `.tina-tailwind {
2755
+ var styles = /* @__PURE__ */ (() => `.tina-tailwind {
2759
2756
  line-height: 1.5;
2760
2757
  -webkit-text-size-adjust: 100%;
2761
2758
  -moz-tab-size: 4;
@@ -2980,6 +2977,54 @@ mutation addPendingDocumentMutation(
2980
2977
  display: none;
2981
2978
  }
2982
2979
  *, ::before, ::after {
2980
+ --tw-border-spacing-x: 0;
2981
+ --tw-border-spacing-y: 0;
2982
+ --tw-translate-x: 0;
2983
+ --tw-translate-y: 0;
2984
+ --tw-rotate: 0;
2985
+ --tw-skew-x: 0;
2986
+ --tw-skew-y: 0;
2987
+ --tw-scale-x: 1;
2988
+ --tw-scale-y: 1;
2989
+ --tw-pan-x: ;
2990
+ --tw-pan-y: ;
2991
+ --tw-pinch-zoom: ;
2992
+ --tw-scroll-snap-strictness: proximity;
2993
+ --tw-ordinal: ;
2994
+ --tw-slashed-zero: ;
2995
+ --tw-numeric-figure: ;
2996
+ --tw-numeric-spacing: ;
2997
+ --tw-numeric-fraction: ;
2998
+ --tw-ring-inset: ;
2999
+ --tw-ring-offset-width: 0px;
3000
+ --tw-ring-offset-color: #fff;
3001
+ --tw-ring-color: rgb(0 132 255 / 0.5);
3002
+ --tw-ring-offset-shadow: 0 0 #0000;
3003
+ --tw-ring-shadow: 0 0 #0000;
3004
+ --tw-shadow: 0 0 #0000;
3005
+ --tw-shadow-colored: 0 0 #0000;
3006
+ --tw-blur: ;
3007
+ --tw-brightness: ;
3008
+ --tw-contrast: ;
3009
+ --tw-grayscale: ;
3010
+ --tw-hue-rotate: ;
3011
+ --tw-invert: ;
3012
+ --tw-saturate: ;
3013
+ --tw-sepia: ;
3014
+ --tw-drop-shadow: ;
3015
+ --tw-backdrop-blur: ;
3016
+ --tw-backdrop-brightness: ;
3017
+ --tw-backdrop-contrast: ;
3018
+ --tw-backdrop-grayscale: ;
3019
+ --tw-backdrop-hue-rotate: ;
3020
+ --tw-backdrop-invert: ;
3021
+ --tw-backdrop-opacity: ;
3022
+ --tw-backdrop-saturate: ;
3023
+ --tw-backdrop-sepia: ;
3024
+ }
3025
+ ::backdrop {
3026
+ --tw-border-spacing-x: 0;
3027
+ --tw-border-spacing-y: 0;
2983
3028
  --tw-translate-x: 0;
2984
3029
  --tw-translate-y: 0;
2985
3030
  --tw-rotate: 0;
@@ -3324,14 +3369,17 @@ mutation addPendingDocumentMutation(
3324
3369
  }
3325
3370
  .tina-tailwind .from-blue-900 {
3326
3371
  --tw-gradient-from: #1D2C6C;
3327
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(29 44 108 / 0));
3372
+ --tw-gradient-to: rgb(29 44 108 / 0);
3373
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
3328
3374
  }
3329
3375
  .tina-tailwind .from-gray-800 {
3330
3376
  --tw-gradient-from: #363145;
3331
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(54 49 69 / 0));
3377
+ --tw-gradient-to: rgb(54 49 69 / 0);
3378
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
3332
3379
  }
3333
3380
  .tina-tailwind .via-gray-900 {
3334
- --tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to, rgb(37 35 54 / 0));
3381
+ --tw-gradient-to: rgb(37 35 54 / 0);
3382
+ --tw-gradient-stops: var(--tw-gradient-from), #252336, var(--tw-gradient-to);
3335
3383
  }
3336
3384
  .tina-tailwind .to-gray-900 {
3337
3385
  --tw-gradient-to: #252336;
@@ -3633,7 +3681,7 @@ mutation addPendingDocumentMutation(
3633
3681
  --tw-ring-opacity: 1;
3634
3682
  --tw-ring-color: rgb(0 132 255 / var(--tw-ring-opacity));
3635
3683
  }
3636
- `;
3684
+ `)();
3637
3685
  class ContentCreatorPlugin {
3638
3686
  constructor(options) {
3639
3687
  this.__type = "content-creator";
@@ -3928,18 +3976,13 @@ mutation addPendingDocumentMutation(
3928
3976
  return this.props.children;
3929
3977
  }
3930
3978
  }
3931
- const TinaCMSProvider2 = (_c) => {
3932
- var _d = _c, {
3933
- query,
3934
- documentCreatorCallback,
3935
- formifyCallback,
3936
- schema
3937
- } = _d, props = __objRest(_d, [
3938
- "query",
3939
- "documentCreatorCallback",
3940
- "formifyCallback",
3941
- "schema"
3942
- ]);
3979
+ const TinaCMSProvider2 = ({
3980
+ query,
3981
+ documentCreatorCallback,
3982
+ formifyCallback,
3983
+ schema,
3984
+ ...props
3985
+ }) => {
3943
3986
  var _a;
3944
3987
  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
3988
  const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
@@ -3966,13 +4009,14 @@ mutation addPendingDocumentMutation(
3966
4009
  documentCreatorCallback
3967
4010
  }), /* @__PURE__ */ React__default["default"].createElement(TinaDataProvider, {
3968
4011
  formifyCallback
3969
- }, typeof props.children == "function" ? /* @__PURE__ */ React__default["default"].createElement(TinaQuery, __spreadProps(__spreadValues({}, props), {
4012
+ }, typeof props.children == "function" ? /* @__PURE__ */ React__default["default"].createElement(TinaQuery, {
4013
+ ...props,
3970
4014
  variables: props.variables,
3971
4015
  data: props.data,
3972
4016
  query,
3973
4017
  formifyCallback,
3974
4018
  children: props.children
3975
- })) : props.children))));
4019
+ }) : props.children))));
3976
4020
  };
3977
4021
  const DocumentCreator = ({
3978
4022
  documentCreatorCallback
@@ -3981,18 +4025,18 @@ mutation addPendingDocumentMutation(
3981
4025
  return null;
3982
4026
  };
3983
4027
  const TinaQuery = (props) => {
3984
- return /* @__PURE__ */ React__default["default"].createElement(TinaQueryInner, __spreadValues({
3985
- key: `rootQuery-${props.query}`
3986
- }, props));
4028
+ return /* @__PURE__ */ React__default["default"].createElement(TinaQueryInner, {
4029
+ key: `rootQuery-${props.query}`,
4030
+ ...props
4031
+ });
3987
4032
  };
3988
- const TinaQueryInner = (_e) => {
3989
- var _f = _e, { children } = _f, props = __objRest(_f, ["children"]);
4033
+ const TinaQueryInner = ({ children, ...props }) => {
3990
4034
  const { data: liveData, isLoading } = useTina({
3991
4035
  query: props.query,
3992
4036
  variables: props.variables,
3993
4037
  data: props.data
3994
4038
  });
3995
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(isLoading || !props.query ? props : __spreadProps(__spreadValues({}, props), { data: liveData })));
4039
+ return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(isLoading || !props.query ? props : { ...props, data: liveData }));
3996
4040
  };
3997
4041
  const TinaDataProvider = ({
3998
4042
  children,
@@ -4205,7 +4249,7 @@ This will work when developing locally but NOT when deployed to production.
4205
4249
  attr: void 0
4206
4250
  };
4207
4251
  var IconContext = React__default["default"].createContext && React__default["default"].createContext(DefaultContext);
4208
- var __assign = function() {
4252
+ var __assign = globalThis && globalThis.__assign || function() {
4209
4253
  __assign = Object.assign || function(t) {
4210
4254
  for (var s, i = 1, n = arguments.length; i < n; i++) {
4211
4255
  s = arguments[i];
@@ -4217,7 +4261,7 @@ This will work when developing locally but NOT when deployed to production.
4217
4261
  };
4218
4262
  return __assign.apply(this, arguments);
4219
4263
  };
4220
- var __rest = function(s, e) {
4264
+ var __rest = globalThis && globalThis.__rest || function(s, e) {
4221
4265
  var t = {};
4222
4266
  for (var p in s)
4223
4267
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -4304,9 +4348,6 @@ This will work when developing locally but NOT when deployed to production.
4304
4348
  function BiEdit(props) {
4305
4349
  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
4350
  }
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
4351
  function BiLogIn(props) {
4311
4352
  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
4353
  }
@@ -4319,9 +4360,6 @@ This will work when developing locally but NOT when deployed to production.
4319
4360
  function BiPlus(props) {
4320
4361
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z" } }] })(props);
4321
4362
  }
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
4363
  function BiTrash(props) {
4326
4364
  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
4365
  }
@@ -4708,148 +4746,6 @@ This will work when developing locally but NOT when deployed to production.
4708
4746
  }
4709
4747
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collection, loading, reFetchCollection));
4710
4748
  };
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
4749
  const TemplateMenu = ({ templates }) => {
4854
4750
  return /* @__PURE__ */ React__default["default"].createElement(react.Menu, {
4855
4751
  as: "div",
@@ -4915,7 +4811,6 @@ This will work when developing locally but NOT when deployed to production.
4915
4811
  const documents = collection.documents.edges;
4916
4812
  const admin = cms.api.admin;
4917
4813
  const pageInfo = collection.documents.pageInfo;
4918
- const useDataFlag = cms.flags.get("experimentalData");
4919
4814
  return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, open && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
4920
4815
  filename: vars.relativePath,
4921
4816
  deleteFunc: async () => {
@@ -5018,9 +4913,9 @@ This will work when developing locally but NOT when deployed to production.
5018
4913
  }
5019
4914
  ]
5020
4915
  })));
5021
- }))), useDataFlag && /* @__PURE__ */ React__default["default"].createElement("div", {
4916
+ }))), /* @__PURE__ */ React__default["default"].createElement("div", {
5022
4917
  className: "pt-3"
5023
- }, /* @__PURE__ */ React__default["default"].createElement(CursorPaginator, {
4918
+ }, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
5024
4919
  variant: "white",
5025
4920
  hasNext: pageInfo == null ? void 0 : pageInfo.hasNextPage,
5026
4921
  navigateNext: () => {
@@ -5063,12 +4958,14 @@ This will work when developing locally but NOT when deployed to production.
5063
4958
  }
5064
4959
  const createDocument = async (cms, collection, template, mutationInfo, values) => {
5065
4960
  const api = new TinaAdminApi(cms);
5066
- const _a = values, { filename } = _a, leftover = __objRest(_a, ["filename"]);
4961
+ const { filename, ...leftover } = values;
5067
4962
  const { includeCollection, includeTemplate } = mutationInfo;
5068
4963
  const relativePath = `${filename}.${collection.format}`;
5069
- const params = transformDocumentIntoMutationRequestPayload(__spreadValues(__spreadValues({
5070
- _collection: collection.name
5071
- }, template && { _template: template.name }), leftover), {
4964
+ const params = transformDocumentIntoMutationRequestPayload({
4965
+ _collection: collection.name,
4966
+ ...template && { _template: template.name },
4967
+ ...leftover
4968
+ }, {
5072
4969
  includeCollection,
5073
4970
  includeTemplate
5074
4971
  });
@@ -5237,7 +5134,7 @@ This will work when developing locally but NOT when deployed to production.
5237
5134
  }
5238
5135
  };
5239
5136
  const CollectionUpdatePage = () => {
5240
- const _a = reactRouterDom.useParams(), { collectionName } = _a, rest = __objRest(_a, ["collectionName"]);
5137
+ const { collectionName, ...rest } = reactRouterDom.useParams();
5241
5138
  const { "*": filename } = rest;
5242
5139
  return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => /* @__PURE__ */ React__default["default"].createElement(GetCollection, {
5243
5140
  cms,
@@ -5451,6 +5348,5 @@ This will work when developing locally but NOT when deployed to production.
5451
5348
  }
5452
5349
  });
5453
5350
  });
5454
- Object.defineProperty(exports2, "__esModule", { value: true });
5455
- exports2[Symbol.toStringTag] = "Module";
5351
+ Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
5456
5352
  });