tinacms 2.7.2 → 2.7.3

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,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], 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, 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, 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, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
- })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("@graphql-inspector/core"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "@graphql-inspector/core", "yup", "react-router-dom", "@tinacms/mdx"], 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, 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, 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, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, core, yup, reactRouterDom, mdx) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -5305,7 +5305,9 @@ flowchart TD
5305
5305
  }, [value, input, optionSets]);
5306
5306
  React__namespace.useEffect(() => {
5307
5307
  if (field.experimental___filter && optionSets.length > 0) {
5308
- setFilteredOptionsList(field.experimental___filter(optionSets, void 0));
5308
+ setFilteredOptionsList(
5309
+ field.experimental___filter(optionSets, void 0)
5310
+ );
5309
5311
  } else {
5310
5312
  setFilteredOptionsList(optionSets);
5311
5313
  }
@@ -5675,7 +5677,9 @@ flowchart TD
5675
5677
  onClick: () => {
5676
5678
  const state = tinaForm.finalForm.getState();
5677
5679
  if (state.invalid === true) {
5678
- cms.alerts.error("Cannot navigate away from an invalid form.");
5680
+ cms.alerts.error(
5681
+ "Cannot navigate away from an invalid form."
5682
+ );
5679
5683
  return;
5680
5684
  }
5681
5685
  cms.dispatch({
@@ -6259,7 +6263,9 @@ flowchart TD
6259
6263
  onClick: () => {
6260
6264
  const state = tinaForm.finalForm.getState();
6261
6265
  if (state.invalid === true) {
6262
- cms.alerts.error("Cannot navigate away from an invalid form.");
6266
+ cms.alerts.error(
6267
+ "Cannot navigate away from an invalid form."
6268
+ );
6263
6269
  return;
6264
6270
  }
6265
6271
  cms.dispatch({
@@ -6741,28 +6747,28 @@ flowchart TD
6741
6747
  }
6742
6748
  renderDayHeaders() {
6743
6749
  const locale = this.props.viewDate.localeData();
6744
- let dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
6750
+ const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
6745
6751
  return /* @__PURE__ */ React.createElement("tr", null, dayItems);
6746
6752
  }
6747
6753
  renderDays() {
6748
6754
  const date = this.props.viewDate;
6749
6755
  const startOfMonth = date.clone().startOf("month");
6750
6756
  const endOfMonth = date.clone().endOf("month");
6751
- let rows = [[], [], [], [], [], []];
6752
- let startDate = date.clone().subtract(1, "months");
6757
+ const rows = [[], [], [], [], [], []];
6758
+ const startDate = date.clone().subtract(1, "months");
6753
6759
  startDate.date(startDate.daysInMonth()).startOf("week");
6754
- let endDate = startDate.clone().add(42, "d");
6760
+ const endDate = startDate.clone().add(42, "d");
6755
6761
  let i = 0;
6756
6762
  while (startDate.isBefore(endDate)) {
6757
- let row = getRow$2(rows, i++);
6763
+ const row = getRow$2(rows, i++);
6758
6764
  row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
6759
6765
  startDate.add(1, "d");
6760
6766
  }
6761
6767
  return rows.map((r, i2) => /* @__PURE__ */ React.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
6762
6768
  }
6763
6769
  renderDay(date, startOfMonth, endOfMonth) {
6764
- let selectedDate = this.props.selectedDate;
6765
- let dayProps = {
6770
+ const selectedDate = this.props.selectedDate;
6771
+ const dayProps = {
6766
6772
  key: date.format("M_D"),
6767
6773
  "data-value": date.date(),
6768
6774
  "data-month": date.month(),
@@ -6816,7 +6822,7 @@ flowchart TD
6816
6822
  }
6817
6823
  function getDaysOfWeek(locale) {
6818
6824
  const first = locale.firstDayOfWeek();
6819
- let dow = [];
6825
+ const dow = [];
6820
6826
  let i = 0;
6821
6827
  locale._weekdaysMin.forEach(function(day) {
6822
6828
  dow[(7 + i++ - first) % 7] = day;
@@ -6834,7 +6840,7 @@ flowchart TD
6834
6840
  return /* @__PURE__ */ React.createElement("div", { className: "rdtMonths" }, /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("thead", null, this.renderNavigation())), /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("tbody", null, this.renderMonths())));
6835
6841
  }
6836
6842
  renderNavigation() {
6837
- let year = this.props.viewDate.year();
6843
+ const year = this.props.viewDate.year();
6838
6844
  return /* @__PURE__ */ React.createElement(
6839
6845
  ViewNavigation,
6840
6846
  {
@@ -6847,9 +6853,9 @@ flowchart TD
6847
6853
  );
6848
6854
  }
6849
6855
  renderMonths() {
6850
- let rows = [[], [], []];
6856
+ const rows = [[], [], []];
6851
6857
  for (let month = 0; month < 12; month++) {
6852
- let row = getRow$1(rows, month);
6858
+ const row = getRow$1(rows, month);
6853
6859
  row.push(this.renderMonth(month));
6854
6860
  }
6855
6861
  return rows.map((months, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, months));
@@ -6866,7 +6872,7 @@ flowchart TD
6866
6872
  if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
6867
6873
  className += " rdtActive";
6868
6874
  }
6869
- let props = { key: month, className, "data-value": month, onClick };
6875
+ const props = { key: month, className, "data-value": month, onClick };
6870
6876
  if (this.props.renderMonth) {
6871
6877
  return this.props.renderMonth(
6872
6878
  props,
@@ -6878,11 +6884,11 @@ flowchart TD
6878
6884
  return /* @__PURE__ */ React.createElement("td", { ...props }, this.getMonthText(month));
6879
6885
  }
6880
6886
  isDisabledMonth(month) {
6881
- let isValidDate = this.props.isValidDate;
6887
+ const isValidDate = this.props.isValidDate;
6882
6888
  if (!isValidDate) {
6883
6889
  return false;
6884
6890
  }
6885
- let date = this.props.viewDate.clone().set({ month });
6891
+ const date = this.props.viewDate.clone().set({ month });
6886
6892
  let day = date.endOf("month").date() + 1;
6887
6893
  while (day-- > 1) {
6888
6894
  if (isValidDate(date.date(day))) {
@@ -6934,9 +6940,9 @@ flowchart TD
6934
6940
  }
6935
6941
  renderYears() {
6936
6942
  const viewYear = this.getViewYear();
6937
- let rows = [[], [], []];
6943
+ const rows = [[], [], []];
6938
6944
  for (let year = viewYear - 1; year < viewYear + 11; year++) {
6939
- let row = getRow(rows, year - viewYear);
6945
+ const row = getRow(rows, year - viewYear);
6940
6946
  row.push(this.renderYear(year));
6941
6947
  }
6942
6948
  return rows.map((years, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, years));
@@ -6953,7 +6959,7 @@ flowchart TD
6953
6959
  if (selectedYear === year) {
6954
6960
  className += " rdtActive";
6955
6961
  }
6956
- let props = { key: year, className, "data-value": year, onClick };
6962
+ const props = { key: year, className, "data-value": year, onClick };
6957
6963
  return this.props.renderYear(
6958
6964
  props,
6959
6965
  year,
@@ -6967,15 +6973,15 @@ flowchart TD
6967
6973
  return this.props.selectedDate && this.props.selectedDate.year();
6968
6974
  }
6969
6975
  isDisabledYear(year) {
6970
- let cache = this.disabledYearsCache;
6976
+ const cache = this.disabledYearsCache;
6971
6977
  if (cache[year] !== void 0) {
6972
6978
  return cache[year];
6973
6979
  }
6974
- let isValidDate = this.props.isValidDate;
6980
+ const isValidDate = this.props.isValidDate;
6975
6981
  if (!isValidDate) {
6976
6982
  return false;
6977
6983
  }
6978
- let date = this.props.viewDate.clone().set({ year });
6984
+ const date = this.props.viewDate.clone().set({ year });
6979
6985
  let day = date.endOf("year").dayOfYear() + 1;
6980
6986
  while (day-- > 1) {
6981
6987
  if (isValidDate(date.dayOfYear(day))) {
@@ -7022,7 +7028,7 @@ flowchart TD
7022
7028
  }
7023
7029
  };
7024
7030
  function createConstraints(overrideTimeConstraints) {
7025
- let constraints = {};
7031
+ const constraints = {};
7026
7032
  Object.keys(timeConstraints).forEach((type) => {
7027
7033
  constraints[type] = {
7028
7034
  ...timeConstraints[type],
@@ -7038,7 +7044,7 @@ flowchart TD
7038
7044
  this.state = this.getTimeParts(props.selectedDate || props.viewDate);
7039
7045
  }
7040
7046
  render() {
7041
- let items2 = [];
7047
+ const items2 = [];
7042
7048
  const timeParts = this.state;
7043
7049
  this.getCounters().forEach((c, i) => {
7044
7050
  if (i && c !== "ampm") {
@@ -7100,8 +7106,8 @@ flowchart TD
7100
7106
  }
7101
7107
  if (type === "ampm")
7102
7108
  return this.toggleDayPart();
7103
- let update = {};
7104
- let body = document.body;
7109
+ const update = {};
7110
+ const body = document.body;
7105
7111
  update[type] = this[action](type);
7106
7112
  this.setState(update);
7107
7113
  this.timer = setTimeout(() => {
@@ -7144,8 +7150,8 @@ flowchart TD
7144
7150
  return pad(type, value);
7145
7151
  }
7146
7152
  getCounters() {
7147
- let counters = [];
7148
- let format2 = this.props.timeFormat;
7153
+ const counters = [];
7154
+ const format2 = this.props.timeFormat;
7149
7155
  if (format2.toLowerCase().indexOf("h") !== -1) {
7150
7156
  counters.push("hours");
7151
7157
  if (format2.indexOf("m") !== -1) {
@@ -7277,7 +7283,7 @@ flowchart TD
7277
7283
  __publicField(this, "_renderCalendar", () => {
7278
7284
  const props = this.props;
7279
7285
  const state = this.state;
7280
- let viewProps = {
7286
+ const viewProps = {
7281
7287
  viewDate: state.viewDate.clone(),
7282
7288
  selectedDate: this.getSelectedDate(),
7283
7289
  isValidDate: props.isValidDate,
@@ -7320,10 +7326,10 @@ flowchart TD
7320
7326
  __publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
7321
7327
  __publicField(this, "nextView", { days: "time", months: "days", years: "months" });
7322
7328
  __publicField(this, "_updateDate", (e) => {
7323
- let state = this.state;
7324
- let currentView = state.currentView;
7325
- let updateOnView = this.getUpdateOn(this.getFormat("date"));
7326
- let viewDate = this.state.viewDate.clone();
7329
+ const state = this.state;
7330
+ const currentView = state.currentView;
7331
+ const updateOnView = this.getUpdateOn(this.getFormat("date"));
7332
+ const viewDate = this.state.viewDate.clone();
7327
7333
  viewDate[this.viewToMethod[currentView]](
7328
7334
  parseInt(e.target.getAttribute("data-value"), 10)
7329
7335
  );
@@ -7331,7 +7337,7 @@ flowchart TD
7331
7337
  viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
7332
7338
  viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
7333
7339
  }
7334
- let update = { viewDate };
7340
+ const update = { viewDate };
7335
7341
  if (currentView === updateOnView) {
7336
7342
  update.selectedDate = viewDate.clone();
7337
7343
  update.inputValue = viewDate.format(this.getFormat("datetime"));
@@ -7345,7 +7351,7 @@ flowchart TD
7345
7351
  this.setState(update);
7346
7352
  });
7347
7353
  __publicField(this, "_viewNavigate", (modifier, unit) => {
7348
- let viewDate = this.state.viewDate.clone();
7354
+ const viewDate = this.state.viewDate.clone();
7349
7355
  viewDate.add(modifier, unit);
7350
7356
  if (modifier > 0) {
7351
7357
  this.props.onNavigateForward(modifier, unit);
@@ -7355,7 +7361,7 @@ flowchart TD
7355
7361
  this.setState({ viewDate });
7356
7362
  });
7357
7363
  __publicField(this, "_setTime", (type, value) => {
7358
- let date = (this.getSelectedDate() || this.state.viewDate).clone();
7364
+ const date = (this.getSelectedDate() || this.state.viewDate).clone();
7359
7365
  date[type](value);
7360
7366
  if (!this.props.value) {
7361
7367
  this.setState({
@@ -7379,7 +7385,7 @@ flowchart TD
7379
7385
  });
7380
7386
  });
7381
7387
  __publicField(this, "_handleClickOutside", () => {
7382
- let props = this.props;
7388
+ const props = this.props;
7383
7389
  if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
7384
7390
  this._closeCalendar();
7385
7391
  }
@@ -7394,7 +7400,7 @@ flowchart TD
7394
7400
  return;
7395
7401
  const value = e.target ? e.target.value : e;
7396
7402
  const localMoment = this.localMoment(value, this.getFormat("datetime"));
7397
- let update = { inputValue: value };
7403
+ const update = { inputValue: value };
7398
7404
  if (localMoment.isValid()) {
7399
7405
  update.selectedDate = localMoment;
7400
7406
  update.viewDate = localMoment.clone().startOf("month");
@@ -7458,9 +7464,9 @@ flowchart TD
7458
7464
  return this.props.renderView(this.state.currentView, this._renderCalendar);
7459
7465
  }
7460
7466
  getInitialState() {
7461
- let props = this.props;
7462
- let inputFormat = this.getFormat("datetime");
7463
- let selectedDate = this.parseDate(
7467
+ const props = this.props;
7468
+ const inputFormat = this.getFormat("datetime");
7469
+ const selectedDate = this.parseDate(
7464
7470
  props.value || props.initialValue,
7465
7471
  inputFormat
7466
7472
  );
@@ -7491,7 +7497,7 @@ flowchart TD
7491
7497
  return this.getInitialDate();
7492
7498
  }
7493
7499
  getInitialDate() {
7494
- let m = this.localMoment();
7500
+ const m = this.localMoment();
7495
7501
  m.hour(0).minute(0).second(0).millisecond(0);
7496
7502
  return m;
7497
7503
  }
@@ -7511,8 +7517,8 @@ flowchart TD
7511
7517
  }
7512
7518
  getClassName() {
7513
7519
  let cn2 = "rdt";
7514
- let props = this.props;
7515
- let propCn = props.className;
7520
+ const props = this.props;
7521
+ const propCn = props.className;
7516
7522
  if (Array.isArray(propCn)) {
7517
7523
  cn2 += " " + propCn.join(" ");
7518
7524
  } else if (propCn) {
@@ -7545,14 +7551,14 @@ flowchart TD
7545
7551
  return viewModes.DAYS;
7546
7552
  }
7547
7553
  getLocaleData() {
7548
- let p = this.props;
7554
+ const p = this.props;
7549
7555
  return this.localMoment(
7550
7556
  p.value || p.defaultValue || /* @__PURE__ */ new Date()
7551
7557
  ).localeData();
7552
7558
  }
7553
7559
  getDateFormat() {
7554
7560
  const locale = this.getLocaleData();
7555
- let format2 = this.props.dateFormat;
7561
+ const format2 = this.props.dateFormat;
7556
7562
  if (format2 === true)
7557
7563
  return locale.longDateFormat("L");
7558
7564
  if (format2)
@@ -7561,7 +7567,7 @@ flowchart TD
7561
7567
  }
7562
7568
  getTimeFormat() {
7563
7569
  const locale = this.getLocaleData();
7564
- let format2 = this.props.timeFormat;
7570
+ const format2 = this.props.timeFormat;
7565
7571
  if (format2 === true) {
7566
7572
  return locale.longDateFormat("LT");
7567
7573
  }
@@ -7573,12 +7579,12 @@ flowchart TD
7573
7579
  } else if (type === "time") {
7574
7580
  return this.getTimeFormat();
7575
7581
  }
7576
- let dateFormat = this.getDateFormat();
7577
- let timeFormat = this.getTimeFormat();
7582
+ const dateFormat = this.getDateFormat();
7583
+ const timeFormat = this.getTimeFormat();
7578
7584
  return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
7579
7585
  }
7580
7586
  updateTime(op, amount, type, toSelected) {
7581
- let update = {};
7587
+ const update = {};
7582
7588
  const date = toSelected ? "selectedDate" : "viewDate";
7583
7589
  update[date] = this.state[date].clone()[op](amount, type);
7584
7590
  this.setState(update);
@@ -7611,7 +7617,7 @@ flowchart TD
7611
7617
  if (prevProps === this.props)
7612
7618
  return;
7613
7619
  let needsUpdate = false;
7614
- let thisProps = this.props;
7620
+ const thisProps = this.props;
7615
7621
  ["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
7616
7622
  function(p) {
7617
7623
  prevProps[p] !== thisProps[p] && (needsUpdate = true);
@@ -7627,8 +7633,8 @@ flowchart TD
7627
7633
  }
7628
7634
  regenerateDates() {
7629
7635
  const props = this.props;
7630
- let viewDate = this.state.viewDate.clone();
7631
- let selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7636
+ const viewDate = this.state.viewDate.clone();
7637
+ const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7632
7638
  if (props.locale) {
7633
7639
  viewDate.locale(props.locale);
7634
7640
  selectedDate && selectedDate.locale(props.locale);
@@ -7643,7 +7649,7 @@ flowchart TD
7643
7649
  viewDate.locale();
7644
7650
  selectedDate && selectedDate.locale();
7645
7651
  }
7646
- let update = { viewDate, selectedDate };
7652
+ const update = { viewDate, selectedDate };
7647
7653
  if (selectedDate && selectedDate.isValid()) {
7648
7654
  update.inputValue = selectedDate.format(this.getFormat("datetime"));
7649
7655
  }
@@ -7652,7 +7658,7 @@ flowchart TD
7652
7658
  getSelectedDate() {
7653
7659
  if (this.props.value === void 0)
7654
7660
  return this.state.selectedDate;
7655
- let selectedDate = this.parseDate(
7661
+ const selectedDate = this.parseDate(
7656
7662
  this.props.value,
7657
7663
  this.getFormat("datetime")
7658
7664
  );
@@ -7671,7 +7677,7 @@ flowchart TD
7671
7677
  return "";
7672
7678
  }
7673
7679
  getInputValue() {
7674
- let selectedDate = this.getSelectedDate();
7680
+ const selectedDate = this.getSelectedDate();
7675
7681
  return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
7676
7682
  }
7677
7683
  /**
@@ -7681,7 +7687,7 @@ flowchart TD
7681
7687
  * @public
7682
7688
  */
7683
7689
  setViewDate(date) {
7684
- let logError = function() {
7690
+ const logError = function() {
7685
7691
  return log("Invalid date passed to the `setViewDate` method: " + date);
7686
7692
  };
7687
7693
  if (!date)
@@ -7777,7 +7783,7 @@ flowchart TD
7777
7783
  // Make moment accessible through the Datetime class
7778
7784
  __publicField(Datetime, "moment", moment);
7779
7785
  function log(message, method) {
7780
- let con = typeof window !== "undefined" && window.console;
7786
+ const con = typeof window !== "undefined" && window.console;
7781
7787
  if (!con)
7782
7788
  return;
7783
7789
  if (!method) {
@@ -8600,7 +8606,10 @@ flowchart TD
8600
8606
  label: "View in GitHub",
8601
8607
  Icon: /* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
8602
8608
  onMouseDown: () => {
8603
- window.open(branch.githubPullRequestUrl, "_blank");
8609
+ window.open(
8610
+ branch.githubPullRequestUrl,
8611
+ "_blank"
8612
+ );
8604
8613
  }
8605
8614
  },
8606
8615
  typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
@@ -8906,7 +8915,9 @@ flowchart TD
8906
8915
  } else {
8907
8916
  events = event;
8908
8917
  }
8909
- const newListeners = events.map((event2) => new Listener(event2, callback));
8918
+ const newListeners = events.map(
8919
+ (event2) => new Listener(event2, callback)
8920
+ );
8910
8921
  newListeners.forEach((newListener) => this.listeners.add(newListener));
8911
8922
  return () => {
8912
8923
  newListeners.forEach((listener) => this.listeners.delete(listener));
@@ -9262,9 +9273,7 @@ flowchart TD
9262
9273
  const deleteStartTime = Date.now();
9263
9274
  while (true) {
9264
9275
  await new Promise((resolve) => setTimeout(resolve, 1e3));
9265
- const { error, message } = await this.api.getRequestStatus(
9266
- requestId
9267
- );
9276
+ const { error, message } = await this.api.getRequestStatus(requestId);
9268
9277
  if (error !== void 0) {
9269
9278
  if (error) {
9270
9279
  throw new Error(message);
@@ -10193,7 +10202,7 @@ flowchart TD
10193
10202
  "Event Log"
10194
10203
  ));
10195
10204
  };
10196
- const version = "2.7.2";
10205
+ const version = "2.7.3";
10197
10206
  const Nav = ({
10198
10207
  isLocalMode,
10199
10208
  className = "",
@@ -11419,7 +11428,10 @@ flowchart TD
11419
11428
  const observer = new IntersectionObserver((entries) => {
11420
11429
  const target = entries[0];
11421
11430
  if (target.isIntersecting && list.nextOffset) {
11422
- setOffsetHistory((offsetHistory2) => [...offsetHistory2, list.nextOffset]);
11431
+ setOffsetHistory((offsetHistory2) => [
11432
+ ...offsetHistory2,
11433
+ list.nextOffset
11434
+ ]);
11423
11435
  }
11424
11436
  });
11425
11437
  if (loaderRef.current) {
@@ -12383,7 +12395,9 @@ flowchart TD
12383
12395
  if (activeEle) {
12384
12396
  setDisplay(true);
12385
12397
  setPosition(activeEle.getBoundingClientRect());
12386
- const iframe = document.getElementById("tina-iframe");
12398
+ const iframe = document.getElementById(
12399
+ "tina-iframe"
12400
+ );
12387
12401
  if (iframe) {
12388
12402
  setIframePosition(iframe.getBoundingClientRect());
12389
12403
  }
@@ -13001,7 +13015,9 @@ flowchart TD
13001
13015
  const { fieldName } = useTemplates();
13002
13016
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13003
13017
  useHotkey("enter", () => {
13004
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13018
+ plateCommon.insertNodes(editor, [
13019
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13020
+ ]);
13005
13021
  });
13006
13022
  return /* @__PURE__ */ React.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React.createElement(
13007
13023
  "div",
@@ -13144,7 +13160,9 @@ flowchart TD
13144
13160
  const { templates, fieldName } = useTemplates();
13145
13161
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13146
13162
  useHotkey("enter", () => {
13147
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13163
+ plateCommon.insertNodes(editor, [
13164
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13165
+ ]);
13148
13166
  });
13149
13167
  useHotkey("space", () => {
13150
13168
  plateCommon.insertNodes(editor, [{ text: " " }], {
@@ -13200,7 +13218,9 @@ flowchart TD
13200
13218
  const { templates, fieldName } = useTemplates();
13201
13219
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13202
13220
  useHotkey("enter", () => {
13203
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13221
+ plateCommon.insertNodes(editor, [
13222
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13223
+ ]);
13204
13224
  });
13205
13225
  const activeTemplate = templates.find(
13206
13226
  (template) => template.name === element.name
@@ -14059,7 +14079,9 @@ flowchart TD
14059
14079
  const CONTAINER_MD_BREAKPOINT = 448;
14060
14080
  const FLOAT_BUTTON_WIDTH = 25;
14061
14081
  const HEADING_LABEL = "Headings";
14062
- const ToolbarContext = React.createContext(void 0);
14082
+ const ToolbarContext = React.createContext(
14083
+ void 0
14084
+ );
14063
14085
  const ToolbarProvider = ({
14064
14086
  tinaForm,
14065
14087
  templates,
@@ -30271,7 +30293,14 @@ flowchart TD
30271
30293
  const AUTH_TOKEN_KEY = "tinacms-auth";
30272
30294
  const authenticate = (clientId, frontendUrl) => {
30273
30295
  return new Promise((resolve) => {
30274
- let authTab;
30296
+ const origin = `${window.location.protocol}//${window.location.host}`;
30297
+ const authTab = popupWindow(
30298
+ `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
30299
+ "_blank",
30300
+ window,
30301
+ 1e3,
30302
+ 700
30303
+ );
30275
30304
  window.addEventListener("message", function(e) {
30276
30305
  if (e.data.source === TINA_LOGIN_EVENT) {
30277
30306
  if (authTab) {
@@ -30284,14 +30313,6 @@ flowchart TD
30284
30313
  });
30285
30314
  }
30286
30315
  });
30287
- const origin = `${window.location.protocol}//${window.location.host}`;
30288
- authTab = popupWindow(
30289
- `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
30290
- "_blank",
30291
- window,
30292
- 1e3,
30293
- 700
30294
- );
30295
30316
  });
30296
30317
  };
30297
30318
  const DefaultSessionProvider = ({
@@ -30997,56 +31018,6 @@ mutation addPendingDocumentMutation(
30997
31018
  !submitting && name
30998
31019
  );
30999
31020
  };
31000
- const TINA_AUTH_CONFIG = "tina_auth_config";
31001
- const useTinaAuthRedirect = () => {
31002
- React.useEffect(() => {
31003
- const urlParams = new URLSearchParams(window.location.search);
31004
- const config = {
31005
- code: urlParams.get("code") || "",
31006
- scope: urlParams.get("scope") || "email",
31007
- state: urlParams.get("state")
31008
- };
31009
- if (!config.code) {
31010
- return;
31011
- }
31012
- localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
31013
- }, []);
31014
- };
31015
- const createClient = ({
31016
- clientId,
31017
- isLocalClient = true,
31018
- branch,
31019
- tinaioConfig,
31020
- schema,
31021
- apiUrl,
31022
- tinaGraphQLVersion
31023
- }) => {
31024
- return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
31025
- clientId: clientId || "",
31026
- branch: branch || "main",
31027
- tokenStorage: "LOCAL_STORAGE",
31028
- tinaioConfig,
31029
- schema,
31030
- tinaGraphQLVersion
31031
- });
31032
- };
31033
- function assertShape(value, yupSchema, errorMessage) {
31034
- const shape = yupSchema(yup__namespace);
31035
- try {
31036
- shape.validateSync(value);
31037
- } catch (e) {
31038
- const message = errorMessage || `Failed to assertShape - ${e.message}`;
31039
- throw new Error(message);
31040
- }
31041
- }
31042
- function safeAssertShape(value, yupSchema) {
31043
- try {
31044
- assertShape(value, yupSchema);
31045
- return true;
31046
- } catch (e) {
31047
- return false;
31048
- }
31049
- }
31050
31021
  class TinaAdminApi {
31051
31022
  constructor(cms) {
31052
31023
  var _a, _b, _c, _d;
@@ -31393,6 +31364,56 @@ mutation addPendingDocumentMutation(
31393
31364
  );
31394
31365
  }
31395
31366
  }
31367
+ const createClient = ({
31368
+ clientId,
31369
+ isLocalClient = true,
31370
+ branch,
31371
+ tinaioConfig,
31372
+ schema,
31373
+ apiUrl,
31374
+ tinaGraphQLVersion
31375
+ }) => {
31376
+ return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
31377
+ clientId: clientId || "",
31378
+ branch: branch || "main",
31379
+ tokenStorage: "LOCAL_STORAGE",
31380
+ tinaioConfig,
31381
+ schema,
31382
+ tinaGraphQLVersion
31383
+ });
31384
+ };
31385
+ function assertShape(value, yupSchema, errorMessage) {
31386
+ const shape = yupSchema(yup__namespace);
31387
+ try {
31388
+ shape.validateSync(value);
31389
+ } catch (e) {
31390
+ const message = errorMessage || `Failed to assertShape - ${e.message}`;
31391
+ throw new Error(message);
31392
+ }
31393
+ }
31394
+ function safeAssertShape(value, yupSchema) {
31395
+ try {
31396
+ assertShape(value, yupSchema);
31397
+ return true;
31398
+ } catch (e) {
31399
+ return false;
31400
+ }
31401
+ }
31402
+ const TINA_AUTH_CONFIG = "tina_auth_config";
31403
+ const useTinaAuthRedirect = () => {
31404
+ React.useEffect(() => {
31405
+ const urlParams = new URLSearchParams(window.location.search);
31406
+ const config = {
31407
+ code: urlParams.get("code") || "",
31408
+ scope: urlParams.get("scope") || "email",
31409
+ state: urlParams.get("state")
31410
+ };
31411
+ if (!config.code) {
31412
+ return;
31413
+ }
31414
+ localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
31415
+ }, []);
31416
+ };
31396
31417
  function sleep(ms) {
31397
31418
  return new Promise((resolve) => setTimeout(resolve, ms));
31398
31419
  }
@@ -31729,6 +31750,9 @@ mutation addPendingDocumentMutation(
31729
31750
  cms.flags.set("branch-switcher", true);
31730
31751
  client.usingEditorialWorkflow = true;
31731
31752
  client.protectedBranches = project.protectedBranches;
31753
+ if (!project.metadata[currentBranch]) {
31754
+ setCurrentBranch(project.defaultBranch || "main");
31755
+ }
31732
31756
  }
31733
31757
  });
31734
31758
  };
@@ -31741,7 +31765,7 @@ mutation addPendingDocumentMutation(
31741
31765
  }
31742
31766
  });
31743
31767
  return unsubscribe;
31744
- }, [isTinaCloud, cms]);
31768
+ }, [currentBranch, isTinaCloud, cms]);
31745
31769
  return /* @__PURE__ */ React.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React.createElement(
31746
31770
  BranchDataProvider,
31747
31771
  {
@@ -33060,7 +33084,9 @@ This will work when developing locally but NOT when deployed to production.
33060
33084
  safeSubmit: async () => {
33061
33085
  try {
33062
33086
  await admin.deleteDocument(vars);
33063
- cms.alerts.info("Document was successfully deleted");
33087
+ cms.alerts.info(
33088
+ "Document was successfully deleted"
33089
+ );
33064
33090
  reFetchCollection();
33065
33091
  } catch (error) {
33066
33092
  cms.alerts.warn(
@@ -33089,7 +33115,9 @@ This will work when developing locally but NOT when deployed to production.
33089
33115
  relativePath: vars.relativePath,
33090
33116
  newRelativePath
33091
33117
  });
33092
- cms.alerts.info("Document was successfully renamed");
33118
+ cms.alerts.info(
33119
+ "Document was successfully renamed"
33120
+ );
33093
33121
  reFetchCollection();
33094
33122
  } catch (error) {
33095
33123
  if (error.message.indexOf("has references")) {
@@ -33189,7 +33217,9 @@ This will work when developing locally but NOT when deployed to production.
33189
33217
  name: "sort",
33190
33218
  value: sortKey,
33191
33219
  onChange: (e) => {
33192
- const val = JSON.parse(e.target.value);
33220
+ const val = JSON.parse(
33221
+ e.target.value
33222
+ );
33193
33223
  setEndCursor("");
33194
33224
  setPrevCursors([]);
33195
33225
  window == null ? void 0 : window.localStorage.setItem(
@@ -33978,7 +34008,10 @@ This will work when developing locally but NOT when deployed to production.
33978
34008
  const fetchDocument = async () => {
33979
34009
  if (api.isAuthenticated()) {
33980
34010
  try {
33981
- const response = await api.fetchDocument(collectionName, relativePath2);
34011
+ const response = await api.fetchDocument(
34012
+ collectionName,
34013
+ relativePath2
34014
+ );
33982
34015
  setDocument(response.document);
33983
34016
  } catch (error2) {
33984
34017
  cms.alerts.error(