tinacms 2.7.1 → 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.1";
10205
+ const version = "2.7.3";
10197
10206
  const Nav = ({
10198
10207
  isLocalMode,
10199
10208
  className = "",
@@ -10829,7 +10838,7 @@ flowchart TD
10829
10838
  className: "h-5 w-auto -mx-1 text-blue-500",
10830
10839
  stroke: "currentColor",
10831
10840
  fill: "currentColor",
10832
- "stroke-width": "0",
10841
+ strokeWidth: "0",
10833
10842
  viewBox: "0 0 24 24",
10834
10843
  xmlns: "http://www.w3.org/2000/svg"
10835
10844
  },
@@ -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,
@@ -14209,7 +14231,7 @@ flowchart TD
14209
14231
  const CodeBlockToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14210
14232
  const state = useCodeBlockToolbarButtonState();
14211
14233
  const { props } = useCodeBlockToolbarButton(state);
14212
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
14234
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
14213
14235
  });
14214
14236
  const useImageToolbarButtonState = () => {
14215
14237
  const editor = plateCommon.useEditorState();
@@ -14241,36 +14263,54 @@ flowchart TD
14241
14263
  const ImageToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14242
14264
  const state = useImageToolbarButtonState();
14243
14265
  const { props } = useImageToolbarButton(state);
14244
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
14245
- });
14246
- const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
14247
- const editor = plateCommon.useEditorState();
14248
- const state = plate.useListToolbarButtonState({ nodeType });
14249
- const { props } = plate.useListToolbarButton(state);
14250
- return /* @__PURE__ */ React.createElement(
14251
- ToolbarButton,
14252
- {
14253
- ref,
14254
- tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
14255
- ...props,
14256
- onClick: (e) => {
14257
- e.preventDefault();
14258
- e.stopPropagation();
14259
- plate.toggleList(editor, { type: nodeType });
14260
- }
14261
- },
14262
- nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
14263
- );
14266
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
14264
14267
  });
14268
+ const UnorderedListToolbarButton = cn$1.withRef(
14269
+ (props, ref) => {
14270
+ const editor = plateCommon.useEditorState();
14271
+ const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_UL });
14272
+ const { props: buttonProps } = plate.useListToolbarButton(state);
14273
+ return /* @__PURE__ */ React.createElement(
14274
+ ToolbarButton,
14275
+ {
14276
+ ref,
14277
+ tooltip: "Bulleted List",
14278
+ ...buttonProps,
14279
+ onClick: (e) => {
14280
+ e.preventDefault();
14281
+ e.stopPropagation();
14282
+ plate.toggleList(editor, { type: plate.ELEMENT_UL });
14283
+ }
14284
+ },
14285
+ /* @__PURE__ */ React.createElement(Icons.ul, null)
14286
+ );
14287
+ }
14288
+ );
14289
+ const OrderedListToolbarButton = cn$1.withRef(
14290
+ (props, ref) => {
14291
+ const editor = plateCommon.useEditorState();
14292
+ const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_OL });
14293
+ const { props: buttonProps } = plate.useListToolbarButton(state);
14294
+ return /* @__PURE__ */ React.createElement(
14295
+ ToolbarButton,
14296
+ {
14297
+ ref,
14298
+ tooltip: "Numbered List",
14299
+ ...buttonProps,
14300
+ onClick: (e) => {
14301
+ e.preventDefault();
14302
+ e.stopPropagation();
14303
+ plate.toggleList(editor, { type: plate.ELEMENT_OL });
14304
+ }
14305
+ },
14306
+ /* @__PURE__ */ React.createElement(Icons.ol, null)
14307
+ );
14308
+ }
14309
+ );
14265
14310
  const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14266
14311
  const state = plateLink.useLinkToolbarButtonState();
14267
14312
  const { props } = plateLink.useLinkToolbarButton(state);
14268
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
14269
- });
14270
- const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14271
- const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14272
- const { props } = plateCommon.useMarkToolbarButton(state);
14273
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14313
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React.createElement(Icons.link, null));
14274
14314
  });
14275
14315
  const useMermaidToolbarButtonState = () => {
14276
14316
  const editor = plateCommon.useEditorState();
@@ -14351,7 +14391,7 @@ flowchart TD
14351
14391
  const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14352
14392
  const state = useBlockQuoteToolbarButtonState();
14353
14393
  const { props } = useBlockQuoteToolbarButton(state);
14354
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14394
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14355
14395
  });
14356
14396
  const useRawMarkdownToolbarButton = () => {
14357
14397
  const { setRawMode } = useEditorContext();
@@ -14371,7 +14411,7 @@ flowchart TD
14371
14411
  ToolbarButton,
14372
14412
  {
14373
14413
  ref,
14374
- tooltip: "Link",
14414
+ tooltip: "Raw Markdown",
14375
14415
  ...rest,
14376
14416
  ...props,
14377
14417
  "data-testid": "markdown-button"
@@ -14524,6 +14564,15 @@ flowchart TD
14524
14564
  template.label || template.name
14525
14565
  ))));
14526
14566
  };
14567
+ const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14568
+ const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14569
+ const { props } = plateCommon.useMarkToolbarButton(state);
14570
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14571
+ });
14572
+ const BoldToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null));
14573
+ const StrikethroughToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: plate.MARK_STRIKETHROUGH }, /* @__PURE__ */ React.createElement(Icons.strikethrough, null));
14574
+ const ItalicToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null));
14575
+ const CodeToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null));
14527
14576
  const toolbarItems = {
14528
14577
  heading: {
14529
14578
  label: HEADING_LABEL,
@@ -14544,37 +14593,37 @@ flowchart TD
14544
14593
  quote: {
14545
14594
  label: "Quote",
14546
14595
  width: () => STANDARD_ICON_WIDTH,
14547
- Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14596
+ Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, null)
14548
14597
  },
14549
14598
  ul: {
14550
14599
  label: "Unordered List",
14551
14600
  width: () => STANDARD_ICON_WIDTH,
14552
- Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
14601
+ Component: /* @__PURE__ */ React.createElement(UnorderedListToolbarButton, null)
14553
14602
  },
14554
14603
  ol: {
14555
14604
  label: "Ordered List",
14556
14605
  width: () => STANDARD_ICON_WIDTH,
14557
- Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
14606
+ Component: /* @__PURE__ */ React.createElement(OrderedListToolbarButton, null)
14558
14607
  },
14559
14608
  bold: {
14560
14609
  label: "Bold",
14561
14610
  width: () => STANDARD_ICON_WIDTH,
14562
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
14611
+ Component: /* @__PURE__ */ React.createElement(BoldToolbarButton, null)
14563
14612
  },
14564
14613
  strikethrough: {
14565
14614
  label: "Strikethrough",
14566
14615
  width: () => STANDARD_ICON_WIDTH,
14567
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Strikethrough ", nodeType: plate.MARK_STRIKETHROUGH }, /* @__PURE__ */ React.createElement(Icons.strikethrough, null))
14616
+ Component: /* @__PURE__ */ React.createElement(StrikethroughToolbarButton, null)
14568
14617
  },
14569
14618
  italic: {
14570
14619
  label: "Italic",
14571
14620
  width: () => STANDARD_ICON_WIDTH,
14572
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
14621
+ Component: /* @__PURE__ */ React.createElement(ItalicToolbarButton, null)
14573
14622
  },
14574
14623
  code: {
14575
14624
  label: "Code",
14576
14625
  width: () => STANDARD_ICON_WIDTH,
14577
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
14626
+ Component: /* @__PURE__ */ React.createElement(CodeToolbarButton, null)
14578
14627
  },
14579
14628
  codeBlock: {
14580
14629
  label: "Code Block",
@@ -30244,7 +30293,14 @@ flowchart TD
30244
30293
  const AUTH_TOKEN_KEY = "tinacms-auth";
30245
30294
  const authenticate = (clientId, frontendUrl) => {
30246
30295
  return new Promise((resolve) => {
30247
- 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
+ );
30248
30304
  window.addEventListener("message", function(e) {
30249
30305
  if (e.data.source === TINA_LOGIN_EVENT) {
30250
30306
  if (authTab) {
@@ -30257,14 +30313,6 @@ flowchart TD
30257
30313
  });
30258
30314
  }
30259
30315
  });
30260
- const origin = `${window.location.protocol}//${window.location.host}`;
30261
- authTab = popupWindow(
30262
- `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
30263
- "_blank",
30264
- window,
30265
- 1e3,
30266
- 700
30267
- );
30268
30316
  });
30269
30317
  };
30270
30318
  const DefaultSessionProvider = ({
@@ -30970,56 +31018,6 @@ mutation addPendingDocumentMutation(
30970
31018
  !submitting && name
30971
31019
  );
30972
31020
  };
30973
- const TINA_AUTH_CONFIG = "tina_auth_config";
30974
- const useTinaAuthRedirect = () => {
30975
- React.useEffect(() => {
30976
- const urlParams = new URLSearchParams(window.location.search);
30977
- const config = {
30978
- code: urlParams.get("code") || "",
30979
- scope: urlParams.get("scope") || "email",
30980
- state: urlParams.get("state")
30981
- };
30982
- if (!config.code) {
30983
- return;
30984
- }
30985
- localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
30986
- }, []);
30987
- };
30988
- const createClient = ({
30989
- clientId,
30990
- isLocalClient = true,
30991
- branch,
30992
- tinaioConfig,
30993
- schema,
30994
- apiUrl,
30995
- tinaGraphQLVersion
30996
- }) => {
30997
- return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
30998
- clientId: clientId || "",
30999
- branch: branch || "main",
31000
- tokenStorage: "LOCAL_STORAGE",
31001
- tinaioConfig,
31002
- schema,
31003
- tinaGraphQLVersion
31004
- });
31005
- };
31006
- function assertShape(value, yupSchema, errorMessage) {
31007
- const shape = yupSchema(yup__namespace);
31008
- try {
31009
- shape.validateSync(value);
31010
- } catch (e) {
31011
- const message = errorMessage || `Failed to assertShape - ${e.message}`;
31012
- throw new Error(message);
31013
- }
31014
- }
31015
- function safeAssertShape(value, yupSchema) {
31016
- try {
31017
- assertShape(value, yupSchema);
31018
- return true;
31019
- } catch (e) {
31020
- return false;
31021
- }
31022
- }
31023
31021
  class TinaAdminApi {
31024
31022
  constructor(cms) {
31025
31023
  var _a, _b, _c, _d;
@@ -31366,6 +31364,56 @@ mutation addPendingDocumentMutation(
31366
31364
  );
31367
31365
  }
31368
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
+ };
31369
31417
  function sleep(ms) {
31370
31418
  return new Promise((resolve) => setTimeout(resolve, ms));
31371
31419
  }
@@ -31702,6 +31750,9 @@ mutation addPendingDocumentMutation(
31702
31750
  cms.flags.set("branch-switcher", true);
31703
31751
  client.usingEditorialWorkflow = true;
31704
31752
  client.protectedBranches = project.protectedBranches;
31753
+ if (!project.metadata[currentBranch]) {
31754
+ setCurrentBranch(project.defaultBranch || "main");
31755
+ }
31705
31756
  }
31706
31757
  });
31707
31758
  };
@@ -31714,7 +31765,7 @@ mutation addPendingDocumentMutation(
31714
31765
  }
31715
31766
  });
31716
31767
  return unsubscribe;
31717
- }, [isTinaCloud, cms]);
31768
+ }, [currentBranch, isTinaCloud, cms]);
31718
31769
  return /* @__PURE__ */ React.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React.createElement(
31719
31770
  BranchDataProvider,
31720
31771
  {
@@ -33033,7 +33084,9 @@ This will work when developing locally but NOT when deployed to production.
33033
33084
  safeSubmit: async () => {
33034
33085
  try {
33035
33086
  await admin.deleteDocument(vars);
33036
- cms.alerts.info("Document was successfully deleted");
33087
+ cms.alerts.info(
33088
+ "Document was successfully deleted"
33089
+ );
33037
33090
  reFetchCollection();
33038
33091
  } catch (error) {
33039
33092
  cms.alerts.warn(
@@ -33062,7 +33115,9 @@ This will work when developing locally but NOT when deployed to production.
33062
33115
  relativePath: vars.relativePath,
33063
33116
  newRelativePath
33064
33117
  });
33065
- cms.alerts.info("Document was successfully renamed");
33118
+ cms.alerts.info(
33119
+ "Document was successfully renamed"
33120
+ );
33066
33121
  reFetchCollection();
33067
33122
  } catch (error) {
33068
33123
  if (error.message.indexOf("has references")) {
@@ -33162,7 +33217,9 @@ This will work when developing locally but NOT when deployed to production.
33162
33217
  name: "sort",
33163
33218
  value: sortKey,
33164
33219
  onChange: (e) => {
33165
- const val = JSON.parse(e.target.value);
33220
+ const val = JSON.parse(
33221
+ e.target.value
33222
+ );
33166
33223
  setEndCursor("");
33167
33224
  setPrevCursors([]);
33168
33225
  window == null ? void 0 : window.localStorage.setItem(
@@ -33951,7 +34008,10 @@ This will work when developing locally but NOT when deployed to production.
33951
34008
  const fetchDocument = async () => {
33952
34009
  if (api.isAuthenticated()) {
33953
34010
  try {
33954
- const response = await api.fetchDocument(collectionName, relativePath2);
34011
+ const response = await api.fetchDocument(
34012
+ collectionName,
34013
+ relativePath2
34014
+ );
33955
34015
  setDocument(response.document);
33956
34016
  } catch (error2) {
33957
34017
  cms.alerts.error(