tinacms 0.0.0-9358e25-20250226014947 → 0.0.0-95a293c-20250401070633

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("@react-hook/window-size"), 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("graphql"), require("@tinacms/schema-tools"), require("graphql-tag"), 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", "@react-hook/window-size", "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", "graphql", "@tinacms/schema-tools", "graphql-tag", "@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, windowSize, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, graphql, schemaTools, gql, 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) => {
@@ -4403,36 +4403,6 @@ flowchart TD
4403
4403
  function MdOutlinePerson(props) {
4404
4404
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2m0-12C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }, "child": [] }] })(props);
4405
4405
  }
4406
- const BranchContext = React__namespace.createContext({
4407
- currentBranch: null,
4408
- setCurrentBranch: (branch) => {
4409
- console.warn("BranchContext not initialized");
4410
- }
4411
- });
4412
- const BranchDataProvider = ({
4413
- currentBranch,
4414
- setCurrentBranch,
4415
- children
4416
- }) => {
4417
- return /* @__PURE__ */ React__namespace.createElement(
4418
- BranchContext.Provider,
4419
- {
4420
- value: {
4421
- currentBranch,
4422
- setCurrentBranch
4423
- }
4424
- },
4425
- children
4426
- );
4427
- };
4428
- const useBranchData = () => {
4429
- const branchData = React__namespace.useContext(BranchContext);
4430
- const { dispatch } = useEvent("branch:change");
4431
- React__namespace.useEffect(() => {
4432
- dispatch({ branchName: branchData.currentBranch });
4433
- }, [branchData.currentBranch]);
4434
- return branchData;
4435
- };
4436
4406
  const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded-md";
4437
4407
  const disabledClasses$1 = "opacity-50 pointer-events-none cursor-not-allowed";
4438
4408
  const BaseTextField = React__namespace.forwardRef(({ className, disabled, ...rest }, ref) => {
@@ -5305,7 +5275,9 @@ flowchart TD
5305
5275
  }, [value, input, optionSets]);
5306
5276
  React__namespace.useEffect(() => {
5307
5277
  if (field.experimental___filter && optionSets.length > 0) {
5308
- setFilteredOptionsList(field.experimental___filter(optionSets, void 0));
5278
+ setFilteredOptionsList(
5279
+ field.experimental___filter(optionSets, void 0)
5280
+ );
5309
5281
  } else {
5310
5282
  setFilteredOptionsList(optionSets);
5311
5283
  }
@@ -5675,7 +5647,9 @@ flowchart TD
5675
5647
  onClick: () => {
5676
5648
  const state = tinaForm.finalForm.getState();
5677
5649
  if (state.invalid === true) {
5678
- cms.alerts.error("Cannot navigate away from an invalid form.");
5650
+ cms.alerts.error(
5651
+ "Cannot navigate away from an invalid form."
5652
+ );
5679
5653
  return;
5680
5654
  }
5681
5655
  cms.dispatch({
@@ -6259,7 +6233,9 @@ flowchart TD
6259
6233
  onClick: () => {
6260
6234
  const state = tinaForm.finalForm.getState();
6261
6235
  if (state.invalid === true) {
6262
- cms.alerts.error("Cannot navigate away from an invalid form.");
6236
+ cms.alerts.error(
6237
+ "Cannot navigate away from an invalid form."
6238
+ );
6263
6239
  return;
6264
6240
  }
6265
6241
  cms.dispatch({
@@ -6741,28 +6717,28 @@ flowchart TD
6741
6717
  }
6742
6718
  renderDayHeaders() {
6743
6719
  const locale = this.props.viewDate.localeData();
6744
- let dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
6720
+ const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
6745
6721
  return /* @__PURE__ */ React.createElement("tr", null, dayItems);
6746
6722
  }
6747
6723
  renderDays() {
6748
6724
  const date = this.props.viewDate;
6749
6725
  const startOfMonth = date.clone().startOf("month");
6750
6726
  const endOfMonth = date.clone().endOf("month");
6751
- let rows = [[], [], [], [], [], []];
6752
- let startDate = date.clone().subtract(1, "months");
6727
+ const rows = [[], [], [], [], [], []];
6728
+ const startDate = date.clone().subtract(1, "months");
6753
6729
  startDate.date(startDate.daysInMonth()).startOf("week");
6754
- let endDate = startDate.clone().add(42, "d");
6730
+ const endDate = startDate.clone().add(42, "d");
6755
6731
  let i = 0;
6756
6732
  while (startDate.isBefore(endDate)) {
6757
- let row = getRow$2(rows, i++);
6733
+ const row = getRow$2(rows, i++);
6758
6734
  row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
6759
6735
  startDate.add(1, "d");
6760
6736
  }
6761
6737
  return rows.map((r, i2) => /* @__PURE__ */ React.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
6762
6738
  }
6763
6739
  renderDay(date, startOfMonth, endOfMonth) {
6764
- let selectedDate = this.props.selectedDate;
6765
- let dayProps = {
6740
+ const selectedDate = this.props.selectedDate;
6741
+ const dayProps = {
6766
6742
  key: date.format("M_D"),
6767
6743
  "data-value": date.date(),
6768
6744
  "data-month": date.month(),
@@ -6816,7 +6792,7 @@ flowchart TD
6816
6792
  }
6817
6793
  function getDaysOfWeek(locale) {
6818
6794
  const first = locale.firstDayOfWeek();
6819
- let dow = [];
6795
+ const dow = [];
6820
6796
  let i = 0;
6821
6797
  locale._weekdaysMin.forEach(function(day) {
6822
6798
  dow[(7 + i++ - first) % 7] = day;
@@ -6834,7 +6810,7 @@ flowchart TD
6834
6810
  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
6811
  }
6836
6812
  renderNavigation() {
6837
- let year = this.props.viewDate.year();
6813
+ const year = this.props.viewDate.year();
6838
6814
  return /* @__PURE__ */ React.createElement(
6839
6815
  ViewNavigation,
6840
6816
  {
@@ -6847,9 +6823,9 @@ flowchart TD
6847
6823
  );
6848
6824
  }
6849
6825
  renderMonths() {
6850
- let rows = [[], [], []];
6826
+ const rows = [[], [], []];
6851
6827
  for (let month = 0; month < 12; month++) {
6852
- let row = getRow$1(rows, month);
6828
+ const row = getRow$1(rows, month);
6853
6829
  row.push(this.renderMonth(month));
6854
6830
  }
6855
6831
  return rows.map((months, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, months));
@@ -6866,7 +6842,7 @@ flowchart TD
6866
6842
  if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
6867
6843
  className += " rdtActive";
6868
6844
  }
6869
- let props = { key: month, className, "data-value": month, onClick };
6845
+ const props = { key: month, className, "data-value": month, onClick };
6870
6846
  if (this.props.renderMonth) {
6871
6847
  return this.props.renderMonth(
6872
6848
  props,
@@ -6878,11 +6854,11 @@ flowchart TD
6878
6854
  return /* @__PURE__ */ React.createElement("td", { ...props }, this.getMonthText(month));
6879
6855
  }
6880
6856
  isDisabledMonth(month) {
6881
- let isValidDate = this.props.isValidDate;
6857
+ const isValidDate = this.props.isValidDate;
6882
6858
  if (!isValidDate) {
6883
6859
  return false;
6884
6860
  }
6885
- let date = this.props.viewDate.clone().set({ month });
6861
+ const date = this.props.viewDate.clone().set({ month });
6886
6862
  let day = date.endOf("month").date() + 1;
6887
6863
  while (day-- > 1) {
6888
6864
  if (isValidDate(date.date(day))) {
@@ -6934,9 +6910,9 @@ flowchart TD
6934
6910
  }
6935
6911
  renderYears() {
6936
6912
  const viewYear = this.getViewYear();
6937
- let rows = [[], [], []];
6913
+ const rows = [[], [], []];
6938
6914
  for (let year = viewYear - 1; year < viewYear + 11; year++) {
6939
- let row = getRow(rows, year - viewYear);
6915
+ const row = getRow(rows, year - viewYear);
6940
6916
  row.push(this.renderYear(year));
6941
6917
  }
6942
6918
  return rows.map((years, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, years));
@@ -6953,7 +6929,7 @@ flowchart TD
6953
6929
  if (selectedYear === year) {
6954
6930
  className += " rdtActive";
6955
6931
  }
6956
- let props = { key: year, className, "data-value": year, onClick };
6932
+ const props = { key: year, className, "data-value": year, onClick };
6957
6933
  return this.props.renderYear(
6958
6934
  props,
6959
6935
  year,
@@ -6967,15 +6943,15 @@ flowchart TD
6967
6943
  return this.props.selectedDate && this.props.selectedDate.year();
6968
6944
  }
6969
6945
  isDisabledYear(year) {
6970
- let cache = this.disabledYearsCache;
6946
+ const cache = this.disabledYearsCache;
6971
6947
  if (cache[year] !== void 0) {
6972
6948
  return cache[year];
6973
6949
  }
6974
- let isValidDate = this.props.isValidDate;
6950
+ const isValidDate = this.props.isValidDate;
6975
6951
  if (!isValidDate) {
6976
6952
  return false;
6977
6953
  }
6978
- let date = this.props.viewDate.clone().set({ year });
6954
+ const date = this.props.viewDate.clone().set({ year });
6979
6955
  let day = date.endOf("year").dayOfYear() + 1;
6980
6956
  while (day-- > 1) {
6981
6957
  if (isValidDate(date.dayOfYear(day))) {
@@ -7022,7 +6998,7 @@ flowchart TD
7022
6998
  }
7023
6999
  };
7024
7000
  function createConstraints(overrideTimeConstraints) {
7025
- let constraints = {};
7001
+ const constraints = {};
7026
7002
  Object.keys(timeConstraints).forEach((type) => {
7027
7003
  constraints[type] = {
7028
7004
  ...timeConstraints[type],
@@ -7038,7 +7014,7 @@ flowchart TD
7038
7014
  this.state = this.getTimeParts(props.selectedDate || props.viewDate);
7039
7015
  }
7040
7016
  render() {
7041
- let items2 = [];
7017
+ const items2 = [];
7042
7018
  const timeParts = this.state;
7043
7019
  this.getCounters().forEach((c, i) => {
7044
7020
  if (i && c !== "ampm") {
@@ -7100,8 +7076,8 @@ flowchart TD
7100
7076
  }
7101
7077
  if (type === "ampm")
7102
7078
  return this.toggleDayPart();
7103
- let update = {};
7104
- let body = document.body;
7079
+ const update = {};
7080
+ const body = document.body;
7105
7081
  update[type] = this[action](type);
7106
7082
  this.setState(update);
7107
7083
  this.timer = setTimeout(() => {
@@ -7144,8 +7120,8 @@ flowchart TD
7144
7120
  return pad(type, value);
7145
7121
  }
7146
7122
  getCounters() {
7147
- let counters = [];
7148
- let format2 = this.props.timeFormat;
7123
+ const counters = [];
7124
+ const format2 = this.props.timeFormat;
7149
7125
  if (format2.toLowerCase().indexOf("h") !== -1) {
7150
7126
  counters.push("hours");
7151
7127
  if (format2.indexOf("m") !== -1) {
@@ -7277,7 +7253,7 @@ flowchart TD
7277
7253
  __publicField(this, "_renderCalendar", () => {
7278
7254
  const props = this.props;
7279
7255
  const state = this.state;
7280
- let viewProps = {
7256
+ const viewProps = {
7281
7257
  viewDate: state.viewDate.clone(),
7282
7258
  selectedDate: this.getSelectedDate(),
7283
7259
  isValidDate: props.isValidDate,
@@ -7320,10 +7296,10 @@ flowchart TD
7320
7296
  __publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
7321
7297
  __publicField(this, "nextView", { days: "time", months: "days", years: "months" });
7322
7298
  __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();
7299
+ const state = this.state;
7300
+ const currentView = state.currentView;
7301
+ const updateOnView = this.getUpdateOn(this.getFormat("date"));
7302
+ const viewDate = this.state.viewDate.clone();
7327
7303
  viewDate[this.viewToMethod[currentView]](
7328
7304
  parseInt(e.target.getAttribute("data-value"), 10)
7329
7305
  );
@@ -7331,7 +7307,7 @@ flowchart TD
7331
7307
  viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
7332
7308
  viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
7333
7309
  }
7334
- let update = { viewDate };
7310
+ const update = { viewDate };
7335
7311
  if (currentView === updateOnView) {
7336
7312
  update.selectedDate = viewDate.clone();
7337
7313
  update.inputValue = viewDate.format(this.getFormat("datetime"));
@@ -7345,7 +7321,7 @@ flowchart TD
7345
7321
  this.setState(update);
7346
7322
  });
7347
7323
  __publicField(this, "_viewNavigate", (modifier, unit) => {
7348
- let viewDate = this.state.viewDate.clone();
7324
+ const viewDate = this.state.viewDate.clone();
7349
7325
  viewDate.add(modifier, unit);
7350
7326
  if (modifier > 0) {
7351
7327
  this.props.onNavigateForward(modifier, unit);
@@ -7355,7 +7331,7 @@ flowchart TD
7355
7331
  this.setState({ viewDate });
7356
7332
  });
7357
7333
  __publicField(this, "_setTime", (type, value) => {
7358
- let date = (this.getSelectedDate() || this.state.viewDate).clone();
7334
+ const date = (this.getSelectedDate() || this.state.viewDate).clone();
7359
7335
  date[type](value);
7360
7336
  if (!this.props.value) {
7361
7337
  this.setState({
@@ -7379,7 +7355,7 @@ flowchart TD
7379
7355
  });
7380
7356
  });
7381
7357
  __publicField(this, "_handleClickOutside", () => {
7382
- let props = this.props;
7358
+ const props = this.props;
7383
7359
  if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
7384
7360
  this._closeCalendar();
7385
7361
  }
@@ -7394,7 +7370,7 @@ flowchart TD
7394
7370
  return;
7395
7371
  const value = e.target ? e.target.value : e;
7396
7372
  const localMoment = this.localMoment(value, this.getFormat("datetime"));
7397
- let update = { inputValue: value };
7373
+ const update = { inputValue: value };
7398
7374
  if (localMoment.isValid()) {
7399
7375
  update.selectedDate = localMoment;
7400
7376
  update.viewDate = localMoment.clone().startOf("month");
@@ -7458,9 +7434,9 @@ flowchart TD
7458
7434
  return this.props.renderView(this.state.currentView, this._renderCalendar);
7459
7435
  }
7460
7436
  getInitialState() {
7461
- let props = this.props;
7462
- let inputFormat = this.getFormat("datetime");
7463
- let selectedDate = this.parseDate(
7437
+ const props = this.props;
7438
+ const inputFormat = this.getFormat("datetime");
7439
+ const selectedDate = this.parseDate(
7464
7440
  props.value || props.initialValue,
7465
7441
  inputFormat
7466
7442
  );
@@ -7491,7 +7467,7 @@ flowchart TD
7491
7467
  return this.getInitialDate();
7492
7468
  }
7493
7469
  getInitialDate() {
7494
- let m = this.localMoment();
7470
+ const m = this.localMoment();
7495
7471
  m.hour(0).minute(0).second(0).millisecond(0);
7496
7472
  return m;
7497
7473
  }
@@ -7511,8 +7487,8 @@ flowchart TD
7511
7487
  }
7512
7488
  getClassName() {
7513
7489
  let cn2 = "rdt";
7514
- let props = this.props;
7515
- let propCn = props.className;
7490
+ const props = this.props;
7491
+ const propCn = props.className;
7516
7492
  if (Array.isArray(propCn)) {
7517
7493
  cn2 += " " + propCn.join(" ");
7518
7494
  } else if (propCn) {
@@ -7545,14 +7521,14 @@ flowchart TD
7545
7521
  return viewModes.DAYS;
7546
7522
  }
7547
7523
  getLocaleData() {
7548
- let p = this.props;
7524
+ const p = this.props;
7549
7525
  return this.localMoment(
7550
7526
  p.value || p.defaultValue || /* @__PURE__ */ new Date()
7551
7527
  ).localeData();
7552
7528
  }
7553
7529
  getDateFormat() {
7554
7530
  const locale = this.getLocaleData();
7555
- let format2 = this.props.dateFormat;
7531
+ const format2 = this.props.dateFormat;
7556
7532
  if (format2 === true)
7557
7533
  return locale.longDateFormat("L");
7558
7534
  if (format2)
@@ -7561,7 +7537,7 @@ flowchart TD
7561
7537
  }
7562
7538
  getTimeFormat() {
7563
7539
  const locale = this.getLocaleData();
7564
- let format2 = this.props.timeFormat;
7540
+ const format2 = this.props.timeFormat;
7565
7541
  if (format2 === true) {
7566
7542
  return locale.longDateFormat("LT");
7567
7543
  }
@@ -7573,12 +7549,12 @@ flowchart TD
7573
7549
  } else if (type === "time") {
7574
7550
  return this.getTimeFormat();
7575
7551
  }
7576
- let dateFormat = this.getDateFormat();
7577
- let timeFormat = this.getTimeFormat();
7552
+ const dateFormat = this.getDateFormat();
7553
+ const timeFormat = this.getTimeFormat();
7578
7554
  return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
7579
7555
  }
7580
7556
  updateTime(op, amount, type, toSelected) {
7581
- let update = {};
7557
+ const update = {};
7582
7558
  const date = toSelected ? "selectedDate" : "viewDate";
7583
7559
  update[date] = this.state[date].clone()[op](amount, type);
7584
7560
  this.setState(update);
@@ -7611,7 +7587,7 @@ flowchart TD
7611
7587
  if (prevProps === this.props)
7612
7588
  return;
7613
7589
  let needsUpdate = false;
7614
- let thisProps = this.props;
7590
+ const thisProps = this.props;
7615
7591
  ["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
7616
7592
  function(p) {
7617
7593
  prevProps[p] !== thisProps[p] && (needsUpdate = true);
@@ -7627,8 +7603,8 @@ flowchart TD
7627
7603
  }
7628
7604
  regenerateDates() {
7629
7605
  const props = this.props;
7630
- let viewDate = this.state.viewDate.clone();
7631
- let selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7606
+ const viewDate = this.state.viewDate.clone();
7607
+ const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7632
7608
  if (props.locale) {
7633
7609
  viewDate.locale(props.locale);
7634
7610
  selectedDate && selectedDate.locale(props.locale);
@@ -7643,7 +7619,7 @@ flowchart TD
7643
7619
  viewDate.locale();
7644
7620
  selectedDate && selectedDate.locale();
7645
7621
  }
7646
- let update = { viewDate, selectedDate };
7622
+ const update = { viewDate, selectedDate };
7647
7623
  if (selectedDate && selectedDate.isValid()) {
7648
7624
  update.inputValue = selectedDate.format(this.getFormat("datetime"));
7649
7625
  }
@@ -7652,7 +7628,7 @@ flowchart TD
7652
7628
  getSelectedDate() {
7653
7629
  if (this.props.value === void 0)
7654
7630
  return this.state.selectedDate;
7655
- let selectedDate = this.parseDate(
7631
+ const selectedDate = this.parseDate(
7656
7632
  this.props.value,
7657
7633
  this.getFormat("datetime")
7658
7634
  );
@@ -7671,7 +7647,7 @@ flowchart TD
7671
7647
  return "";
7672
7648
  }
7673
7649
  getInputValue() {
7674
- let selectedDate = this.getSelectedDate();
7650
+ const selectedDate = this.getSelectedDate();
7675
7651
  return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
7676
7652
  }
7677
7653
  /**
@@ -7681,7 +7657,7 @@ flowchart TD
7681
7657
  * @public
7682
7658
  */
7683
7659
  setViewDate(date) {
7684
- let logError = function() {
7660
+ const logError = function() {
7685
7661
  return log("Invalid date passed to the `setViewDate` method: " + date);
7686
7662
  };
7687
7663
  if (!date)
@@ -7777,7 +7753,7 @@ flowchart TD
7777
7753
  // Make moment accessible through the Datetime class
7778
7754
  __publicField(Datetime, "moment", moment);
7779
7755
  function log(message, method) {
7780
- let con = typeof window !== "undefined" && window.console;
7756
+ const con = typeof window !== "undefined" && window.console;
7781
7757
  if (!con)
7782
7758
  return;
7783
7759
  if (!method) {
@@ -8030,9 +8006,6 @@ flowchart TD
8030
8006
  },
8031
8007
  parse: parse$2
8032
8008
  };
8033
- function GrCircleQuestion(props) {
8034
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,22 C17.5228475,22 22,17.5228475 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,17.5228475 6.4771525,22 12,22 Z M12,15 L12,14 C12,13 12,12.5 13,12 C14,11.5 15,11 15,9.5 C15,8.5 14,7 12,7 C10,7 9,8.26413718 9,10 M12,16 L12,18" }, "child": [] }] })(props);
8035
- }
8036
8009
  function AiFillWarning(props) {
8037
8010
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, "child": [] }] })(props);
8038
8011
  }
@@ -8051,6 +8024,39 @@ flowchart TD
8051
8024
  function FaUnlock(props) {
8052
8025
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z" }, "child": [] }] })(props);
8053
8026
  }
8027
+ function GrCircleQuestion(props) {
8028
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,22 C17.5228475,22 22,17.5228475 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,17.5228475 6.4771525,22 12,22 Z M12,15 L12,14 C12,13 12,12.5 13,12 C14,11.5 15,11 15,9.5 C15,8.5 14,7 12,7 C10,7 9,8.26413718 9,10 M12,16 L12,18" }, "child": [] }] })(props);
8029
+ }
8030
+ const BranchContext = React__namespace.createContext({
8031
+ currentBranch: null,
8032
+ setCurrentBranch: (branch) => {
8033
+ console.warn("BranchContext not initialized");
8034
+ }
8035
+ });
8036
+ const BranchDataProvider = ({
8037
+ currentBranch,
8038
+ setCurrentBranch,
8039
+ children
8040
+ }) => {
8041
+ return /* @__PURE__ */ React__namespace.createElement(
8042
+ BranchContext.Provider,
8043
+ {
8044
+ value: {
8045
+ currentBranch,
8046
+ setCurrentBranch
8047
+ }
8048
+ },
8049
+ children
8050
+ );
8051
+ };
8052
+ const useBranchData = () => {
8053
+ const branchData = React__namespace.useContext(BranchContext);
8054
+ const { dispatch } = useEvent("branch:change");
8055
+ React__namespace.useEffect(() => {
8056
+ dispatch({ branchName: branchData.currentBranch });
8057
+ }, [branchData.currentBranch]);
8058
+ return branchData;
8059
+ };
8054
8060
  function formatBranchName$1(str) {
8055
8061
  const pattern = /[^/\w-]+/g;
8056
8062
  const formattedStr = str.replace(pattern, "");
@@ -8149,7 +8155,7 @@ flowchart TD
8149
8155
  className: "transition-all duration-150 ease-out text-blue-600 hover:text-blue-400 hover:underline no-underline",
8150
8156
  href: "https://tina.io/docs/tina-cloud/"
8151
8157
  },
8152
- "Learn more about moving to production with Tina Cloud."
8158
+ "Learn more about moving to production with TinaCloud."
8153
8159
  )), /* @__PURE__ */ React__namespace.createElement("p", null, /* @__PURE__ */ React__namespace.createElement(
8154
8160
  Button$1,
8155
8161
  {
@@ -8385,7 +8391,7 @@ flowchart TD
8385
8391
  className: "transition-all duration-150 ease-out text-blue-600 hover:text-blue-400 hover:underline no-underline",
8386
8392
  href: "https://tina.io/docs/tina-cloud/"
8387
8393
  },
8388
- "Learn more about moving to production with Tina Cloud."
8394
+ "Learn more about moving to production with TinaCloud."
8389
8395
  )), /* @__PURE__ */ React__namespace.createElement("p", null, /* @__PURE__ */ React__namespace.createElement(
8390
8396
  Button$1,
8391
8397
  {
@@ -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);
@@ -9414,7 +9423,7 @@ flowchart TD
9414
9423
  });
9415
9424
  new MediaListError({
9416
9425
  title: "An Error Occurred",
9417
- message: "Something went wrong accessing your media from Tina Cloud.",
9426
+ message: "Something went wrong accessing your media from TinaCloud.",
9418
9427
  docsLink: ""
9419
9428
  // TODO
9420
9429
  });
@@ -9599,7 +9608,7 @@ flowchart TD
9599
9608
  return this.add("error", message, timeout);
9600
9609
  }
9601
9610
  };
9602
- const NoFormsPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
9611
+ const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
9603
9612
  "div",
9604
9613
  {
9605
9614
  className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
@@ -9612,25 +9621,8 @@ flowchart TD
9612
9621
  animationDuration: "150ms"
9613
9622
  }
9614
9623
  },
9615
- /* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "pb-5" }, "🔎"),
9616
- /* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
9617
- /* @__PURE__ */ React__namespace.createElement("p", { className: "block" }, /* @__PURE__ */ React__namespace.createElement(
9618
- Button$1,
9619
- {
9620
- href: "https://tina.io/docs/tinacms-context/",
9621
- target: "_blank",
9622
- as: "a"
9623
- },
9624
- /* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
9625
- " Contextual Editing"
9626
- ))
9627
- );
9628
- const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
9629
- "span",
9630
- {
9631
- className: `text-[24px] leading-none inline-block ${className}`,
9632
- ...props
9633
- }
9624
+ /* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Please wait while TinaCMS", /* @__PURE__ */ React__namespace.createElement("br", null), "loads your content"),
9625
+ /* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
9634
9626
  );
9635
9627
  class SidebarState {
9636
9628
  constructor(events, options = {}) {
@@ -9645,7 +9637,7 @@ flowchart TD
9645
9637
  };
9646
9638
  this.position = options.position || "displace";
9647
9639
  this.renderNav = options.renderNav || true;
9648
- this.placeholder = options.placeholder || NoFormsPlaceholder;
9640
+ this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
9649
9641
  if ((_a = options.buttons) == null ? void 0 : _a.save) {
9650
9642
  this.buttons.save = options.buttons.save;
9651
9643
  }
@@ -9719,238 +9711,6 @@ flowchart TD
9719
9711
  children
9720
9712
  )));
9721
9713
  };
9722
- const Item = ({
9723
- item,
9724
- depth,
9725
- setActiveFormId
9726
- }) => {
9727
- const cms = useCMS();
9728
- const depths = ["pl-6", "pl-10", "pl-14"];
9729
- const form = React__namespace.useMemo(
9730
- () => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
9731
- [item.formId]
9732
- );
9733
- return /* @__PURE__ */ React__namespace.createElement(
9734
- "button",
9735
- {
9736
- type: "button",
9737
- key: item.path,
9738
- onClick: () => setActiveFormId(item.formId),
9739
- className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
9740
- },
9741
- /* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
9742
- /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
9743
- );
9744
- };
9745
- const FormListItem = ({
9746
- item,
9747
- depth,
9748
- setActiveFormId
9749
- }) => {
9750
- var _a;
9751
- return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
9752
- if (subItem.type === "document") {
9753
- return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
9754
- Item,
9755
- {
9756
- setActiveFormId,
9757
- depth: depth + 1,
9758
- item: subItem
9759
- }
9760
- ));
9761
- }
9762
- })));
9763
- };
9764
- const FormLists = (props) => {
9765
- const cms = useCMS();
9766
- return /* @__PURE__ */ React__namespace.createElement(
9767
- react.Transition,
9768
- {
9769
- appear: true,
9770
- show: true,
9771
- as: "div",
9772
- enter: "transition-all ease-out duration-150",
9773
- enterFrom: "opacity-0 -translate-x-1/2",
9774
- enterTo: "opacity-100",
9775
- leave: "transition-all ease-out duration-150",
9776
- leaveFrom: "opacity-100",
9777
- leaveTo: "opacity-0 -translate-x-1/2"
9778
- },
9779
- cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
9780
- FormList,
9781
- {
9782
- isEditing: props.isEditing,
9783
- setActiveFormId: (id) => {
9784
- cms.dispatch({ type: "forms:set-active-form-id", value: id });
9785
- },
9786
- formList
9787
- }
9788
- )))
9789
- );
9790
- };
9791
- const FormList = (props) => {
9792
- const cms = useCMS();
9793
- const listItems = React__namespace.useMemo(() => {
9794
- var _a;
9795
- const orderedListItems = [];
9796
- const globalItems = [];
9797
- const topItems = [];
9798
- props.formList.items.forEach((item) => {
9799
- if (item.type === "document") {
9800
- const form = cms.state.forms.find(
9801
- ({ tinaForm }) => tinaForm.id === item.formId
9802
- );
9803
- if (form.tinaForm.global) {
9804
- globalItems.push(item);
9805
- } else {
9806
- orderedListItems.push(item);
9807
- }
9808
- } else {
9809
- orderedListItems.push(item);
9810
- }
9811
- });
9812
- if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
9813
- topItems.push({ type: "list", label: "Documents" });
9814
- }
9815
- let extra = [];
9816
- if (globalItems.length) {
9817
- extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
9818
- }
9819
- return [...topItems, ...orderedListItems, ...extra];
9820
- }, [JSON.stringify(props.formList.items)]);
9821
- return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
9822
- if (item.type === "list") {
9823
- return /* @__PURE__ */ React__namespace.createElement(
9824
- "div",
9825
- {
9826
- key: item.label,
9827
- className: `relative group text-left w-full bg-white shadow-sm
9828
- border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
9829
- },
9830
- /* @__PURE__ */ React__namespace.createElement(
9831
- "span",
9832
- {
9833
- className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
9834
- },
9835
- item.label
9836
- )
9837
- );
9838
- }
9839
- return /* @__PURE__ */ React__namespace.createElement(
9840
- FormListItem,
9841
- {
9842
- setActiveFormId: (id) => props.setActiveFormId(id),
9843
- key: item.formId,
9844
- item,
9845
- depth: 0
9846
- }
9847
- );
9848
- })));
9849
- };
9850
- const FormsView = ({
9851
- children
9852
- }) => {
9853
- const cms = useCMS$1();
9854
- const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
9855
- const isMultiform = cms.state.forms.length > 1;
9856
- const activeForm = cms.state.forms.find(
9857
- ({ tinaForm }) => tinaForm.id === cms.state.activeFormId
9858
- );
9859
- const isEditing = !!activeForm;
9860
- if (!cms.state.formLists.length) {
9861
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " ", children, " ");
9862
- }
9863
- if (isMultiform && !activeForm) {
9864
- return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
9865
- }
9866
- const formMetas = cms.plugins.all("form:meta");
9867
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
9868
- };
9869
- const FormWrapper$1 = ({ isEditing, children }) => {
9870
- return /* @__PURE__ */ React__namespace.createElement(
9871
- "div",
9872
- {
9873
- className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
9874
- style: isEditing ? {
9875
- transform: "none",
9876
- animationName: "fly-in-left",
9877
- animationDuration: "150ms",
9878
- animationDelay: "0",
9879
- animationIterationCount: 1,
9880
- animationTimingFunction: "ease-out"
9881
- } : {
9882
- transform: "translate3d(100%, 0, 0)"
9883
- }
9884
- },
9885
- children
9886
- );
9887
- };
9888
- const MultiformFormHeader = ({
9889
- activeForm
9890
- }) => {
9891
- const cms = useCMS$1();
9892
- const { formIsPristine } = React__namespace.useContext(SidebarContext);
9893
- return /* @__PURE__ */ React__namespace.createElement(
9894
- "div",
9895
- {
9896
- className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
9897
- },
9898
- /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
9899
- "button",
9900
- {
9901
- type: "button",
9902
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
9903
- onClick: () => {
9904
- const state = activeForm.tinaForm.finalForm.getState();
9905
- if (state.invalid === true) {
9906
- cms.alerts.error("Cannot navigate away from an invalid form.");
9907
- } else {
9908
- cms.dispatch({ type: "forms:set-active-form-id", value: null });
9909
- }
9910
- }
9911
- },
9912
- /* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
9913
- ), /* @__PURE__ */ React__namespace.createElement(
9914
- "button",
9915
- {
9916
- type: "button",
9917
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
9918
- onClick: () => {
9919
- const collectionName = cms.api.tina.schema.getCollectionByFullPath(
9920
- cms.state.activeFormId
9921
- ).name;
9922
- window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
9923
- }
9924
- },
9925
- /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
9926
- ), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
9927
- );
9928
- };
9929
- const FormHeader = ({ activeForm }) => {
9930
- const { formIsPristine } = React__namespace.useContext(SidebarContext);
9931
- const cms = useCMS$1();
9932
- const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
9933
- return /* @__PURE__ */ React__namespace.createElement(
9934
- "div",
9935
- {
9936
- className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
9937
- },
9938
- /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
9939
- "button",
9940
- {
9941
- type: "button",
9942
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
9943
- onClick: () => {
9944
- const collectionName = cms.api.tina.schema.getCollectionByFullPath(
9945
- cms.state.activeFormId
9946
- ).name;
9947
- window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
9948
- }
9949
- },
9950
- /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
9951
- ), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
9952
- );
9953
- };
9954
9714
  function ImFilesEmpty(props) {
9955
9715
  return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14.341 5.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.689 0.561 1.25 1.25 1.25h9.5c0.689 0 1.25-0.561 1.25-1.25v-7.75c0-0.224-0.068-0.615-0.659-1.421zM12.271 4.729c0.48 0.48 0.856 0.912 1.134 1.271h-2.406v-2.405c0.359 0.278 0.792 0.654 1.271 1.134v0zM14 14.75c0 0.136-0.114 0.25-0.25 0.25h-9.5c-0.136 0-0.25-0.114-0.25-0.25v-11.5c0-0.135 0.114-0.25 0.25-0.25 0 0 5.749-0 5.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5v7.75z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9.421 0.659c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.604 0.43 1.109 1 1.225v-12.725c0-0.135 0.115-0.25 0.25-0.25h7.607c-0.151-0.124-0.297-0.238-0.437-0.341z" }, "child": [] }] })(props);
9956
9716
  }
@@ -10193,7 +9953,7 @@ flowchart TD
10193
9953
  "Event Log"
10194
9954
  ));
10195
9955
  };
10196
- const version = "2.7.0";
9956
+ const version = "2.7.4";
10197
9957
  const Nav = ({
10198
9958
  isLocalMode,
10199
9959
  className = "",
@@ -10435,6 +10195,293 @@ flowchart TD
10435
10195
  /* @__PURE__ */ React__namespace.createElement("span", { className: "absolute top-1/2 left-1/2 h-4/6 w-px bg-gray-200 transform -translate-y-1/2 -translate-x-1/2 opacity-30 transition-opacity duration-150 ease-out group-hover:opacity-100" })
10436
10196
  );
10437
10197
  };
10198
+ const Item = ({
10199
+ item,
10200
+ depth,
10201
+ setActiveFormId
10202
+ }) => {
10203
+ const cms = useCMS();
10204
+ const depths = ["pl-6", "pl-10", "pl-14"];
10205
+ const form = React__namespace.useMemo(
10206
+ () => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
10207
+ [item.formId]
10208
+ );
10209
+ return /* @__PURE__ */ React__namespace.createElement(
10210
+ "button",
10211
+ {
10212
+ type: "button",
10213
+ key: item.path,
10214
+ onClick: () => setActiveFormId(item.formId),
10215
+ className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
10216
+ },
10217
+ /* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
10218
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
10219
+ );
10220
+ };
10221
+ const FormListItem = ({
10222
+ item,
10223
+ depth,
10224
+ setActiveFormId
10225
+ }) => {
10226
+ var _a;
10227
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
10228
+ if (subItem.type === "document") {
10229
+ return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
10230
+ Item,
10231
+ {
10232
+ setActiveFormId,
10233
+ depth: depth + 1,
10234
+ item: subItem
10235
+ }
10236
+ ));
10237
+ }
10238
+ })));
10239
+ };
10240
+ const FormLists = (props) => {
10241
+ const cms = useCMS();
10242
+ return /* @__PURE__ */ React__namespace.createElement(
10243
+ react.Transition,
10244
+ {
10245
+ appear: true,
10246
+ show: true,
10247
+ as: "div",
10248
+ enter: "transition-all ease-out duration-150",
10249
+ enterFrom: "opacity-0 -translate-x-1/2",
10250
+ enterTo: "opacity-100",
10251
+ leave: "transition-all ease-out duration-150",
10252
+ leaveFrom: "opacity-100",
10253
+ leaveTo: "opacity-0 -translate-x-1/2"
10254
+ },
10255
+ cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
10256
+ FormList,
10257
+ {
10258
+ isEditing: props.isEditing,
10259
+ setActiveFormId: (id) => {
10260
+ cms.dispatch({ type: "forms:set-active-form-id", value: id });
10261
+ },
10262
+ formList
10263
+ }
10264
+ )))
10265
+ );
10266
+ };
10267
+ const FormList = (props) => {
10268
+ const cms = useCMS();
10269
+ const listItems = React__namespace.useMemo(() => {
10270
+ var _a;
10271
+ const orderedListItems = [];
10272
+ const globalItems = [];
10273
+ const topItems = [];
10274
+ props.formList.items.forEach((item) => {
10275
+ if (item.type === "document") {
10276
+ const form = cms.state.forms.find(
10277
+ ({ tinaForm }) => tinaForm.id === item.formId
10278
+ );
10279
+ if (form.tinaForm.global) {
10280
+ globalItems.push(item);
10281
+ } else {
10282
+ orderedListItems.push(item);
10283
+ }
10284
+ } else {
10285
+ orderedListItems.push(item);
10286
+ }
10287
+ });
10288
+ if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
10289
+ topItems.push({ type: "list", label: "Documents" });
10290
+ }
10291
+ let extra = [];
10292
+ if (globalItems.length) {
10293
+ extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
10294
+ }
10295
+ return [...topItems, ...orderedListItems, ...extra];
10296
+ }, [JSON.stringify(props.formList.items)]);
10297
+ return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
10298
+ if (item.type === "list") {
10299
+ return /* @__PURE__ */ React__namespace.createElement(
10300
+ "div",
10301
+ {
10302
+ key: item.label,
10303
+ className: `relative group text-left w-full bg-white shadow-sm
10304
+ border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
10305
+ },
10306
+ /* @__PURE__ */ React__namespace.createElement(
10307
+ "span",
10308
+ {
10309
+ className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
10310
+ },
10311
+ item.label
10312
+ )
10313
+ );
10314
+ }
10315
+ return /* @__PURE__ */ React__namespace.createElement(
10316
+ FormListItem,
10317
+ {
10318
+ setActiveFormId: (id) => props.setActiveFormId(id),
10319
+ key: item.formId,
10320
+ item,
10321
+ depth: 0
10322
+ }
10323
+ );
10324
+ })));
10325
+ };
10326
+ const SidebarNoFormsPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
10327
+ "div",
10328
+ {
10329
+ className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
10330
+ style: {
10331
+ animationName: "fade-in",
10332
+ animationDelay: "300ms",
10333
+ animationTimingFunction: "ease-out",
10334
+ animationIterationCount: 1,
10335
+ animationFillMode: "both",
10336
+ animationDuration: "150ms"
10337
+ }
10338
+ },
10339
+ /* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
10340
+ /* @__PURE__ */ React__namespace.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React__namespace.createElement(
10341
+ Button$1,
10342
+ {
10343
+ href: "https://tina.io/docs/contextual-editing/overview",
10344
+ target: "_blank",
10345
+ as: "a"
10346
+ },
10347
+ /* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
10348
+ " Contextual Editing Docs"
10349
+ ))
10350
+ );
10351
+ const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
10352
+ "span",
10353
+ {
10354
+ className: `text-[24px] leading-none inline-block ${className}`,
10355
+ ...props
10356
+ }
10357
+ );
10358
+ const minimumTimeToShowLoadingIndicator = 1e3;
10359
+ const FormsView = ({ loadingPlaceholder } = {}) => {
10360
+ const cms = useCMS$1();
10361
+ const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
10362
+ const [isShowingLoading, setIsShowingLoading] = React__namespace.useState(true);
10363
+ const [initialLoadComplete, setInitialLoadComplete] = React__namespace.useState(false);
10364
+ React__namespace.useEffect(() => {
10365
+ if (cms.state.isLoadingContent) {
10366
+ setIsShowingLoading(true);
10367
+ const timer = setTimeout(() => {
10368
+ if (!cms.state.isLoadingContent) {
10369
+ setIsShowingLoading(false);
10370
+ setInitialLoadComplete(true);
10371
+ }
10372
+ }, minimumTimeToShowLoadingIndicator);
10373
+ return () => clearTimeout(timer);
10374
+ } else {
10375
+ const timer = setTimeout(() => {
10376
+ setIsShowingLoading(false);
10377
+ setInitialLoadComplete(true);
10378
+ }, minimumTimeToShowLoadingIndicator);
10379
+ return () => clearTimeout(timer);
10380
+ }
10381
+ }, [cms.state.isLoadingContent]);
10382
+ if (isShowingLoading || !initialLoadComplete) {
10383
+ const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
10384
+ return /* @__PURE__ */ React__namespace.createElement(LoadingPlaceholder, null);
10385
+ }
10386
+ if (!cms.state.formLists.length) {
10387
+ return /* @__PURE__ */ React__namespace.createElement(SidebarNoFormsPlaceholder, null);
10388
+ }
10389
+ const isMultiform = cms.state.forms.length > 1;
10390
+ const activeForm = cms.state.forms.find(
10391
+ ({ tinaForm }) => tinaForm.id === cms.state.activeFormId
10392
+ );
10393
+ const isEditing = !!activeForm;
10394
+ if (isMultiform && !activeForm) {
10395
+ return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
10396
+ }
10397
+ const formMetas = cms.plugins.all("form:meta");
10398
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
10399
+ };
10400
+ const FormWrapper$1 = ({ isEditing, children }) => {
10401
+ return /* @__PURE__ */ React__namespace.createElement(
10402
+ "div",
10403
+ {
10404
+ className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
10405
+ style: isEditing ? {
10406
+ transform: "none",
10407
+ animationName: "fly-in-left",
10408
+ animationDuration: "150ms",
10409
+ animationDelay: "0",
10410
+ animationIterationCount: 1,
10411
+ animationTimingFunction: "ease-out"
10412
+ } : {
10413
+ transform: "translate3d(100%, 0, 0)"
10414
+ }
10415
+ },
10416
+ children
10417
+ );
10418
+ };
10419
+ const MultiformFormHeader = ({
10420
+ activeForm
10421
+ }) => {
10422
+ const cms = useCMS$1();
10423
+ const { formIsPristine } = React__namespace.useContext(SidebarContext);
10424
+ return /* @__PURE__ */ React__namespace.createElement(
10425
+ "div",
10426
+ {
10427
+ className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10428
+ },
10429
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
10430
+ "button",
10431
+ {
10432
+ type: "button",
10433
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10434
+ onClick: () => {
10435
+ const state = activeForm.tinaForm.finalForm.getState();
10436
+ if (state.invalid === true) {
10437
+ cms.alerts.error("Cannot navigate away from an invalid form.");
10438
+ } else {
10439
+ cms.dispatch({ type: "forms:set-active-form-id", value: null });
10440
+ }
10441
+ }
10442
+ },
10443
+ /* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
10444
+ ), /* @__PURE__ */ React__namespace.createElement(
10445
+ "button",
10446
+ {
10447
+ type: "button",
10448
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10449
+ onClick: () => {
10450
+ const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10451
+ cms.state.activeFormId
10452
+ ).name;
10453
+ window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10454
+ }
10455
+ },
10456
+ /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10457
+ ), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
10458
+ );
10459
+ };
10460
+ const FormHeader = ({ activeForm }) => {
10461
+ const { formIsPristine } = React__namespace.useContext(SidebarContext);
10462
+ const cms = useCMS$1();
10463
+ const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
10464
+ return /* @__PURE__ */ React__namespace.createElement(
10465
+ "div",
10466
+ {
10467
+ className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10468
+ },
10469
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
10470
+ "button",
10471
+ {
10472
+ type: "button",
10473
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10474
+ onClick: () => {
10475
+ const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10476
+ cms.state.activeFormId
10477
+ ).name;
10478
+ window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10479
+ }
10480
+ },
10481
+ /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10482
+ ), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
10483
+ );
10484
+ };
10438
10485
  const SidebarContext = React__namespace.createContext(null);
10439
10486
  const minPreviewWidth = 440;
10440
10487
  const minSidebarWidth = 360;
@@ -10653,7 +10700,7 @@ flowchart TD
10653
10700
  isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
10654
10701
  branchingEnabled
10655
10702
  }
10656
- ), /* @__PURE__ */ React__namespace.createElement(FormsView, null, /* @__PURE__ */ React__namespace.createElement(sidebar.placeholder, null)), activeScreen && /* @__PURE__ */ React__namespace.createElement(
10703
+ ), /* @__PURE__ */ React__namespace.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React__namespace.createElement(
10657
10704
  ScreenPluginModal,
10658
10705
  {
10659
10706
  screen: activeScreen,
@@ -10829,7 +10876,7 @@ flowchart TD
10829
10876
  className: "h-5 w-auto -mx-1 text-blue-500",
10830
10877
  stroke: "currentColor",
10831
10878
  fill: "currentColor",
10832
- "stroke-width": "0",
10879
+ strokeWidth: "0",
10833
10880
  viewBox: "0 0 24 24",
10834
10881
  xmlns: "http://www.w3.org/2000/svg"
10835
10882
  },
@@ -10969,6 +11016,93 @@ flowchart TD
10969
11016
  );
10970
11017
  };
10971
11018
  }
11019
+ function dirname(path) {
11020
+ var _a, _b;
11021
+ const pattern = new RegExp("(?<prevDir>.*)/");
11022
+ return (_b = (_a = path.match(pattern)) == null ? void 0 : _a.groups) == null ? void 0 : _b.prevDir;
11023
+ }
11024
+ const BreadcrumbButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
11025
+ "button",
11026
+ {
11027
+ className: "capitalize transition-colors duration-150 border-0 bg-transparent hover:text-blue-500 " + className,
11028
+ ...props
11029
+ }
11030
+ );
11031
+ function Breadcrumb$1({ directory = "", setDirectory }) {
11032
+ directory = directory.replace(/^\/|\/$/g, "");
11033
+ let prevDir = dirname(directory) || "";
11034
+ if (prevDir === ".") {
11035
+ prevDir = "";
11036
+ }
11037
+ return /* @__PURE__ */ React.createElement("div", { className: "w-full flex items-center text-[16px] text-gray-300" }, directory !== "" && /* @__PURE__ */ React.createElement(
11038
+ IconButton,
11039
+ {
11040
+ variant: "ghost",
11041
+ className: "mr-2",
11042
+ onClick: () => setDirectory(prevDir)
11043
+ },
11044
+ /* @__PURE__ */ React.createElement(
11045
+ LeftArrowIcon,
11046
+ {
11047
+ className: `w-7 h-auto fill-gray-300 hover:fill-gray-900 transition duration-150 ease-out`
11048
+ }
11049
+ )
11050
+ ), /* @__PURE__ */ React.createElement(
11051
+ BreadcrumbButton,
11052
+ {
11053
+ onClick: () => setDirectory(""),
11054
+ className: directory === "" ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"
11055
+ },
11056
+ "Media"
11057
+ ), directory && directory.split("/").map((part, index, parts) => {
11058
+ const currentDir = parts.slice(0, index + 1).join("/");
11059
+ return /* @__PURE__ */ React.createElement(
11060
+ BreadcrumbButton,
11061
+ {
11062
+ className: "pl-1.5 " + (index + 1 === parts.length ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"),
11063
+ key: currentDir,
11064
+ onClick: () => {
11065
+ setDirectory(currentDir);
11066
+ }
11067
+ },
11068
+ part
11069
+ );
11070
+ }));
11071
+ }
11072
+ const CopyField = ({ label, description, value }) => {
11073
+ const [copied, setCopied] = React.useState(false);
11074
+ const [fadeOut, setFadeOut] = React.useState(false);
11075
+ return /* @__PURE__ */ React.createElement("div", { className: "w-full" }, label && /* @__PURE__ */ React.createElement("label", { className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700" }, label), /* @__PURE__ */ React.createElement(
11076
+ "span",
11077
+ {
11078
+ onClick: () => {
11079
+ if (copied === true)
11080
+ return;
11081
+ setCopied(true);
11082
+ setTimeout(() => {
11083
+ setFadeOut(true);
11084
+ }, 2500);
11085
+ setTimeout(() => {
11086
+ setCopied(false);
11087
+ setFadeOut(false);
11088
+ }, 3e3);
11089
+ navigator.clipboard.writeText(value);
11090
+ },
11091
+ className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
11092
+ },
11093
+ /* @__PURE__ */ React.createElement(BiCopyAlt, { className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20" }),
11094
+ " ",
11095
+ value,
11096
+ " ",
11097
+ copied && /* @__PURE__ */ React.createElement(
11098
+ "span",
11099
+ {
11100
+ className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
11101
+ },
11102
+ /* @__PURE__ */ React.createElement("span", null, "Copied to clipboard!")
11103
+ )
11104
+ ), description && /* @__PURE__ */ React.createElement("p", { className: "mt-2 text-sm text-gray-500" }, description));
11105
+ };
10972
11106
  function ListMediaItem({ item, onClick, active }) {
10973
11107
  let FileIcon = BiFile;
10974
11108
  if (item.type === "dir") {
@@ -11044,59 +11178,6 @@ flowchart TD
11044
11178
  )
11045
11179
  );
11046
11180
  }
11047
- function dirname(path) {
11048
- var _a, _b;
11049
- const pattern = new RegExp("(?<prevDir>.*)/");
11050
- return (_b = (_a = path.match(pattern)) == null ? void 0 : _a.groups) == null ? void 0 : _b.prevDir;
11051
- }
11052
- const BreadcrumbButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
11053
- "button",
11054
- {
11055
- className: "capitalize transition-colors duration-150 border-0 bg-transparent hover:text-blue-500 " + className,
11056
- ...props
11057
- }
11058
- );
11059
- function Breadcrumb$1({ directory = "", setDirectory }) {
11060
- directory = directory.replace(/^\/|\/$/g, "");
11061
- let prevDir = dirname(directory) || "";
11062
- if (prevDir === ".") {
11063
- prevDir = "";
11064
- }
11065
- return /* @__PURE__ */ React.createElement("div", { className: "w-full flex items-center text-[16px] text-gray-300" }, directory !== "" && /* @__PURE__ */ React.createElement(
11066
- IconButton,
11067
- {
11068
- variant: "ghost",
11069
- className: "mr-2",
11070
- onClick: () => setDirectory(prevDir)
11071
- },
11072
- /* @__PURE__ */ React.createElement(
11073
- LeftArrowIcon,
11074
- {
11075
- className: `w-7 h-auto fill-gray-300 hover:fill-gray-900 transition duration-150 ease-out`
11076
- }
11077
- )
11078
- ), /* @__PURE__ */ React.createElement(
11079
- BreadcrumbButton,
11080
- {
11081
- onClick: () => setDirectory(""),
11082
- className: directory === "" ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"
11083
- },
11084
- "Media"
11085
- ), directory && directory.split("/").map((part, index, parts) => {
11086
- const currentDir = parts.slice(0, index + 1).join("/");
11087
- return /* @__PURE__ */ React.createElement(
11088
- BreadcrumbButton,
11089
- {
11090
- className: "pl-1.5 " + (index + 1 === parts.length ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"),
11091
- key: currentDir,
11092
- onClick: () => {
11093
- setDirectory(currentDir);
11094
- }
11095
- },
11096
- part
11097
- );
11098
- }));
11099
- }
11100
11181
  const DeleteModal$1 = ({
11101
11182
  close: close2,
11102
11183
  deleteFunc,
@@ -11150,40 +11231,6 @@ flowchart TD
11150
11231
  "Create New Folder"
11151
11232
  ))));
11152
11233
  };
11153
- const CopyField = ({ label, description, value }) => {
11154
- const [copied, setCopied] = React.useState(false);
11155
- const [fadeOut, setFadeOut] = React.useState(false);
11156
- return /* @__PURE__ */ React.createElement("div", { className: "w-full" }, label && /* @__PURE__ */ React.createElement("label", { className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700" }, label), /* @__PURE__ */ React.createElement(
11157
- "span",
11158
- {
11159
- onClick: () => {
11160
- if (copied === true)
11161
- return;
11162
- setCopied(true);
11163
- setTimeout(() => {
11164
- setFadeOut(true);
11165
- }, 2500);
11166
- setTimeout(() => {
11167
- setCopied(false);
11168
- setFadeOut(false);
11169
- }, 3e3);
11170
- navigator.clipboard.writeText(value);
11171
- },
11172
- className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
11173
- },
11174
- /* @__PURE__ */ React.createElement(BiCopyAlt, { className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20" }),
11175
- " ",
11176
- value,
11177
- " ",
11178
- copied && /* @__PURE__ */ React.createElement(
11179
- "span",
11180
- {
11181
- className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
11182
- },
11183
- /* @__PURE__ */ React.createElement("span", null, "Copied to clipboard!")
11184
- )
11185
- ), description && /* @__PURE__ */ React.createElement("p", { className: "mt-2 text-sm text-gray-500" }, description));
11186
- };
11187
11234
  const { useDropzone } = dropzone__namespace;
11188
11235
  const join = function(...parts) {
11189
11236
  const [first, last, slash] = [0, parts.length - 1, "/"];
@@ -11419,7 +11466,10 @@ flowchart TD
11419
11466
  const observer = new IntersectionObserver((entries) => {
11420
11467
  const target = entries[0];
11421
11468
  if (target.isIntersecting && list.nextOffset) {
11422
- setOffsetHistory((offsetHistory2) => [...offsetHistory2, list.nextOffset]);
11469
+ setOffsetHistory((offsetHistory2) => [
11470
+ ...offsetHistory2,
11471
+ list.nextOffset
11472
+ ]);
11423
11473
  }
11424
11474
  });
11425
11475
  if (loaderRef.current) {
@@ -11682,7 +11732,7 @@ flowchart TD
11682
11732
  target: "_blank",
11683
11733
  href: `${cms.api.tina.appDashboardLink}/media`
11684
11734
  },
11685
- "Sync Your Media In Tina Cloud.",
11735
+ "Sync Your Media In TinaCloud.",
11686
11736
  /* @__PURE__ */ React.createElement(BiLinkExternal, { className: `w-5 h-auto flex-shrink-0` })
11687
11737
  )
11688
11738
  )))) : /* @__PURE__ */ React.createElement(SyncStatusContext.Provider, { value: { syncStatus } }, children);
@@ -12014,6 +12064,7 @@ flowchart TD
12014
12064
  forms: [],
12015
12065
  formLists: [],
12016
12066
  editingMode: "basic",
12067
+ isLoadingContent: false,
12017
12068
  quickEditSupported: false,
12018
12069
  sidebarDisplayState: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.defaultState) || "open"
12019
12070
  };
@@ -12073,7 +12124,12 @@ flowchart TD
12073
12124
  }
12074
12125
  });
12075
12126
  }
12076
- return { ...state, activeFormId, formLists: nextFormLists };
12127
+ return {
12128
+ ...state,
12129
+ activeFormId,
12130
+ formLists: nextFormLists,
12131
+ isLoadingContent: false
12132
+ };
12077
12133
  }
12078
12134
  case "form-lists:remove": {
12079
12135
  const nextFormLists = state.formLists.filter(
@@ -12142,6 +12198,9 @@ flowchart TD
12142
12198
  }
12143
12199
  return { ...state, sidebarDisplayState: action.value };
12144
12200
  }
12201
+ case "sidebar:set-loading-state": {
12202
+ return { ...state, isLoadingContent: action.value };
12203
+ }
12145
12204
  default:
12146
12205
  throw new Error(`Unhandled action ${action.type}`);
12147
12206
  }
@@ -12383,7 +12442,9 @@ flowchart TD
12383
12442
  if (activeEle) {
12384
12443
  setDisplay(true);
12385
12444
  setPosition(activeEle.getBoundingClientRect());
12386
- const iframe = document.getElementById("tina-iframe");
12445
+ const iframe = document.getElementById(
12446
+ "tina-iframe"
12447
+ );
12387
12448
  if (iframe) {
12388
12449
  setIframePosition(iframe.getBoundingClientRect());
12389
12450
  }
@@ -12825,7 +12886,6 @@ flowchart TD
12825
12886
  }) => {
12826
12887
  const cms = useCMS$1();
12827
12888
  const tinaApi = cms.api.tina;
12828
- tinaApi.branch;
12829
12889
  const [disabled, setDisabled] = React__namespace.useState(false);
12830
12890
  const [newBranchName, setNewBranchName] = React__namespace.useState("");
12831
12891
  const [error, setError] = React__namespace.useState("");
@@ -12851,10 +12911,10 @@ flowchart TD
12851
12911
  const newUrl = window.location.href.replace(hash, newHash);
12852
12912
  window.location.href = newUrl;
12853
12913
  };
12854
- return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", { className: "text-base text-gray-700 mb-2" }, "This branch is ", /* @__PURE__ */ React__namespace.createElement("strong", null, "protected"), ". Create a new branch to save your changes."), /* @__PURE__ */ React__namespace.createElement(
12914
+ return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-sm text-gray-700 mb-4" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React__namespace.createElement(
12855
12915
  PrefixedTextField,
12856
12916
  {
12857
- placeholder: "Branch Name",
12917
+ placeholder: "e.g. {{PAGE-NAME}}-updates",
12858
12918
  value: newBranchName,
12859
12919
  onChange: (e) => {
12860
12920
  setError("");
@@ -13001,7 +13061,9 @@ flowchart TD
13001
13061
  const { fieldName } = useTemplates();
13002
13062
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13003
13063
  useHotkey("enter", () => {
13004
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13064
+ plateCommon.insertNodes(editor, [
13065
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13066
+ ]);
13005
13067
  });
13006
13068
  return /* @__PURE__ */ React.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React.createElement(
13007
13069
  "div",
@@ -13144,7 +13206,9 @@ flowchart TD
13144
13206
  const { templates, fieldName } = useTemplates();
13145
13207
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13146
13208
  useHotkey("enter", () => {
13147
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13209
+ plateCommon.insertNodes(editor, [
13210
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13211
+ ]);
13148
13212
  });
13149
13213
  useHotkey("space", () => {
13150
13214
  plateCommon.insertNodes(editor, [{ text: " " }], {
@@ -13200,7 +13264,9 @@ flowchart TD
13200
13264
  const { templates, fieldName } = useTemplates();
13201
13265
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13202
13266
  useHotkey("enter", () => {
13203
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13267
+ plateCommon.insertNodes(editor, [
13268
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13269
+ ]);
13204
13270
  });
13205
13271
  const activeTemplate = templates.find(
13206
13272
  (template) => template.name === element.name
@@ -14059,7 +14125,9 @@ flowchart TD
14059
14125
  const CONTAINER_MD_BREAKPOINT = 448;
14060
14126
  const FLOAT_BUTTON_WIDTH = 25;
14061
14127
  const HEADING_LABEL = "Headings";
14062
- const ToolbarContext = React.createContext(void 0);
14128
+ const ToolbarContext = React.createContext(
14129
+ void 0
14130
+ );
14063
14131
  const ToolbarProvider = ({
14064
14132
  tinaForm,
14065
14133
  templates,
@@ -14209,7 +14277,7 @@ flowchart TD
14209
14277
  const CodeBlockToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14210
14278
  const state = useCodeBlockToolbarButtonState();
14211
14279
  const { props } = useCodeBlockToolbarButton(state);
14212
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
14280
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
14213
14281
  });
14214
14282
  const useImageToolbarButtonState = () => {
14215
14283
  const editor = plateCommon.useEditorState();
@@ -14241,36 +14309,54 @@ flowchart TD
14241
14309
  const ImageToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14242
14310
  const state = useImageToolbarButtonState();
14243
14311
  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
- );
14312
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
14264
14313
  });
14314
+ const UnorderedListToolbarButton = cn$1.withRef(
14315
+ (props, ref) => {
14316
+ const editor = plateCommon.useEditorState();
14317
+ const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_UL });
14318
+ const { props: buttonProps } = plate.useListToolbarButton(state);
14319
+ return /* @__PURE__ */ React.createElement(
14320
+ ToolbarButton,
14321
+ {
14322
+ ref,
14323
+ tooltip: "Bulleted List",
14324
+ ...buttonProps,
14325
+ onClick: (e) => {
14326
+ e.preventDefault();
14327
+ e.stopPropagation();
14328
+ plate.toggleList(editor, { type: plate.ELEMENT_UL });
14329
+ }
14330
+ },
14331
+ /* @__PURE__ */ React.createElement(Icons.ul, null)
14332
+ );
14333
+ }
14334
+ );
14335
+ const OrderedListToolbarButton = cn$1.withRef(
14336
+ (props, ref) => {
14337
+ const editor = plateCommon.useEditorState();
14338
+ const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_OL });
14339
+ const { props: buttonProps } = plate.useListToolbarButton(state);
14340
+ return /* @__PURE__ */ React.createElement(
14341
+ ToolbarButton,
14342
+ {
14343
+ ref,
14344
+ tooltip: "Numbered List",
14345
+ ...buttonProps,
14346
+ onClick: (e) => {
14347
+ e.preventDefault();
14348
+ e.stopPropagation();
14349
+ plate.toggleList(editor, { type: plate.ELEMENT_OL });
14350
+ }
14351
+ },
14352
+ /* @__PURE__ */ React.createElement(Icons.ol, null)
14353
+ );
14354
+ }
14355
+ );
14265
14356
  const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14266
14357
  const state = plateLink.useLinkToolbarButtonState();
14267
14358
  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 });
14359
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React.createElement(Icons.link, null));
14274
14360
  });
14275
14361
  const useMermaidToolbarButtonState = () => {
14276
14362
  const editor = plateCommon.useEditorState();
@@ -14351,7 +14437,7 @@ flowchart TD
14351
14437
  const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14352
14438
  const state = useBlockQuoteToolbarButtonState();
14353
14439
  const { props } = useBlockQuoteToolbarButton(state);
14354
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14440
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14355
14441
  });
14356
14442
  const useRawMarkdownToolbarButton = () => {
14357
14443
  const { setRawMode } = useEditorContext();
@@ -14371,7 +14457,7 @@ flowchart TD
14371
14457
  ToolbarButton,
14372
14458
  {
14373
14459
  ref,
14374
- tooltip: "Link",
14460
+ tooltip: "Raw Markdown",
14375
14461
  ...rest,
14376
14462
  ...props,
14377
14463
  "data-testid": "markdown-button"
@@ -14524,6 +14610,15 @@ flowchart TD
14524
14610
  template.label || template.name
14525
14611
  ))));
14526
14612
  };
14613
+ const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14614
+ const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14615
+ const { props } = plateCommon.useMarkToolbarButton(state);
14616
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14617
+ });
14618
+ const BoldToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null));
14619
+ const StrikethroughToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: plate.MARK_STRIKETHROUGH }, /* @__PURE__ */ React.createElement(Icons.strikethrough, null));
14620
+ const ItalicToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null));
14621
+ const CodeToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null));
14527
14622
  const toolbarItems = {
14528
14623
  heading: {
14529
14624
  label: HEADING_LABEL,
@@ -14544,37 +14639,37 @@ flowchart TD
14544
14639
  quote: {
14545
14640
  label: "Quote",
14546
14641
  width: () => STANDARD_ICON_WIDTH,
14547
- Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14642
+ Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, null)
14548
14643
  },
14549
14644
  ul: {
14550
14645
  label: "Unordered List",
14551
14646
  width: () => STANDARD_ICON_WIDTH,
14552
- Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
14647
+ Component: /* @__PURE__ */ React.createElement(UnorderedListToolbarButton, null)
14553
14648
  },
14554
14649
  ol: {
14555
14650
  label: "Ordered List",
14556
14651
  width: () => STANDARD_ICON_WIDTH,
14557
- Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
14652
+ Component: /* @__PURE__ */ React.createElement(OrderedListToolbarButton, null)
14558
14653
  },
14559
14654
  bold: {
14560
14655
  label: "Bold",
14561
14656
  width: () => STANDARD_ICON_WIDTH,
14562
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
14657
+ Component: /* @__PURE__ */ React.createElement(BoldToolbarButton, null)
14563
14658
  },
14564
14659
  strikethrough: {
14565
14660
  label: "Strikethrough",
14566
14661
  width: () => STANDARD_ICON_WIDTH,
14567
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Strikethrough ", nodeType: plate.MARK_STRIKETHROUGH }, /* @__PURE__ */ React.createElement(Icons.strikethrough, null))
14662
+ Component: /* @__PURE__ */ React.createElement(StrikethroughToolbarButton, null)
14568
14663
  },
14569
14664
  italic: {
14570
14665
  label: "Italic",
14571
14666
  width: () => STANDARD_ICON_WIDTH,
14572
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
14667
+ Component: /* @__PURE__ */ React.createElement(ItalicToolbarButton, null)
14573
14668
  },
14574
14669
  code: {
14575
14670
  label: "Code",
14576
14671
  width: () => STANDARD_ICON_WIDTH,
14577
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
14672
+ Component: /* @__PURE__ */ React.createElement(CodeToolbarButton, null)
14578
14673
  },
14579
14674
  codeBlock: {
14580
14675
  label: "Code Block",
@@ -30244,7 +30339,14 @@ flowchart TD
30244
30339
  const AUTH_TOKEN_KEY = "tinacms-auth";
30245
30340
  const authenticate = (clientId, frontendUrl) => {
30246
30341
  return new Promise((resolve) => {
30247
- let authTab;
30342
+ const origin = `${window.location.protocol}//${window.location.host}`;
30343
+ const authTab = popupWindow(
30344
+ `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
30345
+ "_blank",
30346
+ window,
30347
+ 1e3,
30348
+ 700
30349
+ );
30248
30350
  window.addEventListener("message", function(e) {
30249
30351
  if (e.data.source === TINA_LOGIN_EVENT) {
30250
30352
  if (authTab) {
@@ -30257,14 +30359,6 @@ flowchart TD
30257
30359
  });
30258
30360
  }
30259
30361
  });
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
30362
  });
30269
30363
  };
30270
30364
  const DefaultSessionProvider = ({
@@ -30617,7 +30711,7 @@ mutation addPendingDocumentMutation(
30617
30711
  branch: ${this.branch}.`;
30618
30712
  if (this.branch !== "main") {
30619
30713
  errorMessage = `${errorMessage}
30620
- Note: This error can occur if the branch does not exist on GitHub or on Tina Cloud`;
30714
+ Note: This error can occur if the branch does not exist on GitHub or on TinaCloud`;
30621
30715
  }
30622
30716
  }
30623
30717
  throw new Error(errorMessage);
@@ -30753,7 +30847,7 @@ mutation addPendingDocumentMutation(
30753
30847
  unknownCount++;
30754
30848
  if (unknownCount > 5) {
30755
30849
  throw new Error(
30756
- "AsyncPoller: status unknown for too long, please check indexing progress the Tina Cloud dashboard"
30850
+ "AsyncPoller: status unknown for too long, please check indexing progress the TinaCloud dashboard"
30757
30851
  );
30758
30852
  }
30759
30853
  }
@@ -30970,56 +31064,6 @@ mutation addPendingDocumentMutation(
30970
31064
  !submitting && name
30971
31065
  );
30972
31066
  };
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
31067
  class TinaAdminApi {
31024
31068
  constructor(cms) {
31025
31069
  var _a, _b, _c, _d;
@@ -31366,6 +31410,56 @@ mutation addPendingDocumentMutation(
31366
31410
  );
31367
31411
  }
31368
31412
  }
31413
+ const createClient = ({
31414
+ clientId,
31415
+ isLocalClient = true,
31416
+ branch,
31417
+ tinaioConfig,
31418
+ schema,
31419
+ apiUrl,
31420
+ tinaGraphQLVersion
31421
+ }) => {
31422
+ return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
31423
+ clientId: clientId || "",
31424
+ branch: branch || "main",
31425
+ tokenStorage: "LOCAL_STORAGE",
31426
+ tinaioConfig,
31427
+ schema,
31428
+ tinaGraphQLVersion
31429
+ });
31430
+ };
31431
+ function assertShape(value, yupSchema, errorMessage) {
31432
+ const shape = yupSchema(yup__namespace);
31433
+ try {
31434
+ shape.validateSync(value);
31435
+ } catch (e) {
31436
+ const message = errorMessage || `Failed to assertShape - ${e.message}`;
31437
+ throw new Error(message);
31438
+ }
31439
+ }
31440
+ function safeAssertShape(value, yupSchema) {
31441
+ try {
31442
+ assertShape(value, yupSchema);
31443
+ return true;
31444
+ } catch (e) {
31445
+ return false;
31446
+ }
31447
+ }
31448
+ const TINA_AUTH_CONFIG = "tina_auth_config";
31449
+ const useTinaAuthRedirect = () => {
31450
+ React.useEffect(() => {
31451
+ const urlParams = new URLSearchParams(window.location.search);
31452
+ const config = {
31453
+ code: urlParams.get("code") || "",
31454
+ scope: urlParams.get("scope") || "email",
31455
+ state: urlParams.get("state")
31456
+ };
31457
+ if (!config.code) {
31458
+ return;
31459
+ }
31460
+ localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
31461
+ }, []);
31462
+ };
31369
31463
  function sleep(ms) {
31370
31464
  return new Promise((resolve) => setTimeout(resolve, ms));
31371
31465
  }
@@ -31464,7 +31558,7 @@ mutation addPendingDocumentMutation(
31464
31558
  });
31465
31559
  }
31466
31560
  };
31467
- let modalTitle = "Tina Cloud";
31561
+ let modalTitle = "TinaCloud";
31468
31562
  if (activeModal === "authenticate" && loginStrategy === "Redirect" && !isTinaCloud) {
31469
31563
  modalTitle = "Enter into edit mode";
31470
31564
  } else if (activeModal === "authenticate" && loginStrategy === "UsernamePassword") {
@@ -31480,7 +31574,7 @@ mutation addPendingDocumentMutation(
31480
31574
  ModalBuilder,
31481
31575
  {
31482
31576
  title: modalTitle,
31483
- message: isTinaCloud ? "Your site uses Tina Cloud to track changes. To make edits, you must log in." : "To save edits, enter into edit mode. On save, changes will saved to the local filesystem.",
31577
+ message: isTinaCloud ? "Your site uses TinaCloud to track changes. To make edits, you must log in." : "To save edits, enter into edit mode. On save, changes will saved to the local filesystem.",
31484
31578
  close,
31485
31579
  actions: [
31486
31580
  ...otherModalActions,
@@ -31702,6 +31796,9 @@ mutation addPendingDocumentMutation(
31702
31796
  cms.flags.set("branch-switcher", true);
31703
31797
  client.usingEditorialWorkflow = true;
31704
31798
  client.protectedBranches = project.protectedBranches;
31799
+ if (!project.metadata[currentBranch]) {
31800
+ setCurrentBranch(project.defaultBranch || "main");
31801
+ }
31705
31802
  }
31706
31803
  });
31707
31804
  };
@@ -31714,7 +31811,7 @@ mutation addPendingDocumentMutation(
31714
31811
  }
31715
31812
  });
31716
31813
  return unsubscribe;
31717
- }, [isTinaCloud, cms]);
31814
+ }, [currentBranch, isTinaCloud, cms]);
31718
31815
  return /* @__PURE__ */ React.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React.createElement(
31719
31816
  BranchDataProvider,
31720
31817
  {
@@ -32200,6 +32297,14 @@ This will work when developing locally but NOT when deployed to production.
32200
32297
  }
32201
32298
  return client.request(query, { variables });
32202
32299
  };
32300
+ const GetCMS = ({ children }) => {
32301
+ try {
32302
+ const cms = useCMS$1();
32303
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
32304
+ } catch (e) {
32305
+ return null;
32306
+ }
32307
+ };
32203
32308
  const Layout = ({ children }) => {
32204
32309
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
32205
32310
  "div",
@@ -32411,47 +32516,6 @@ This will work when developing locally but NOT when deployed to production.
32411
32516
  }
32412
32517
  return /* @__PURE__ */ React.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
32413
32518
  };
32414
- const GetCMS = ({ children }) => {
32415
- try {
32416
- const cms = useCMS$1();
32417
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
32418
- } catch (e) {
32419
- return null;
32420
- }
32421
- };
32422
- const PageWrapper = ({ children }) => {
32423
- var _a, _b;
32424
- const cms = useCMS$1();
32425
- const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
32426
- const [branchingEnabled, setBranchingEnabled] = React.useState(
32427
- () => cms.flags.get("branch-switcher")
32428
- );
32429
- React.useEffect(() => {
32430
- cms.events.subscribe("flag:set", ({ key, value }) => {
32431
- if (key === "branch-switcher") {
32432
- setBranchingEnabled(value);
32433
- }
32434
- });
32435
- }, [cms.events]);
32436
- return /* @__PURE__ */ React.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React.createElement(BranchBanner, null), children);
32437
- };
32438
- const PageHeader = ({
32439
- isLocalMode,
32440
- children
32441
- }) => {
32442
- return /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", { className: "pt-16 xl:pt-12 px-6 xl:px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, /* @__PURE__ */ React.createElement("div", { className: "w-full flex justify-between items-end" }, children))));
32443
- };
32444
- const PageBody = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
32445
- const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
32446
- const DashboardPage = () => {
32447
- return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
32448
- var _a, _b;
32449
- return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, { isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode }, /* @__PURE__ */ React.createElement("h3", { className: "text-2xl font-sans text-gray-700" }, "Welcome to Tina!")), /* @__PURE__ */ React.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
32450
- });
32451
- };
32452
- function RiHome2Line(props) {
32453
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M19 21H5C4.44772 21 4 20.5523 4 20V11L1 11L11.3273 1.6115C11.7087 1.26475 12.2913 1.26475 12.6727 1.6115L23 11L20 11V20C20 20.5523 19.5523 21 19 21ZM6 19H18V9.15745L12 3.7029L6 9.15745V19Z" }, "child": [] }] })(props);
32454
- }
32455
32519
  const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
32456
32520
  "div",
32457
32521
  {
@@ -32561,203 +32625,33 @@ This will work when developing locally but NOT when deployed to production.
32561
32625
  )
32562
32626
  )
32563
32627
  ));
32564
- const FullscreenError = ({
32565
- title = "Error",
32566
- errorMessage = "It looks like something went wrong."
32567
- }) => {
32568
- return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React.createElement(Button$1, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
32569
- };
32570
- const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
32571
- const api = new TinaAdminApi(cms);
32572
- const schema = cms.api.tina.schema;
32573
- const collectionExtra = schema.getCollection(collectionName);
32574
- const [collection, setCollection] = React.useState(void 0);
32575
- const [loading, setLoading] = React.useState(true);
32576
- const [error, setError] = React.useState(void 0);
32577
- const [resetState, setResetSate] = React.useState(0);
32578
- React.useEffect(() => {
32579
- let cancelled = false;
32580
- const fetchCollection = async () => {
32581
- var _a;
32582
- if (await api.isAuthenticated() && !folder.loading && !cancelled) {
32583
- const { name, order } = JSON.parse(sortKey || "{}");
32584
- const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
32585
- try {
32586
- const collection2 = await api.fetchCollection(
32587
- collectionName,
32588
- includeDocuments,
32589
- (filterArgs == null ? void 0 : filterArgs.filterField) ? "" : folder.fullyQualifiedName,
32590
- after,
32591
- validSortKey,
32592
- order,
32593
- filterArgs
32594
- );
32595
- setCollection(collection2);
32596
- } catch (error2) {
32597
- cms.alerts.error(
32598
- `[${error2.name}] GetCollection failed: ${error2.message}`
32599
- );
32600
- console.error(error2);
32601
- setCollection(void 0);
32602
- setError(error2);
32603
- }
32604
- setLoading(false);
32605
- }
32606
- };
32607
- if (cancelled)
32608
- return;
32609
- setLoading(true);
32610
- fetchCollection();
32611
- return () => {
32612
- cancelled = true;
32613
- };
32614
- }, [
32615
- cms,
32616
- collectionName,
32617
- folder.loading,
32618
- folder.fullyQualifiedName,
32619
- resetState,
32620
- after,
32621
- sortKey
32622
- ]);
32623
- const reFetchCollection = () => setResetSate((x) => x + 1);
32624
- return { collection, loading, error, reFetchCollection, collectionExtra };
32625
- };
32626
- const useSearchCollection = (cms, collectionName, includeDocuments = true, folder, after = "", search) => {
32627
- const api = new TinaAdminApi(cms);
32628
- const schema = cms.api.tina.schema;
32629
- const collectionExtra = schema.getCollection(collectionName);
32630
- const [collection, setCollection] = React.useState(void 0);
32631
- const [loading, setLoading] = React.useState(true);
32632
- const [error, setError] = React.useState(void 0);
32633
- const [resetState, setResetSate] = React.useState(0);
32628
+ function RiHome2Line(props) {
32629
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M19 21H5C4.44772 21 4 20.5523 4 20V11L1 11L11.3273 1.6115C11.7087 1.26475 12.2913 1.26475 12.6727 1.6115L23 11L20 11V20C20 20.5523 19.5523 21 19 21ZM6 19H18V9.15745L12 3.7029L6 9.15745V19Z" }, "child": [] }] })(props);
32630
+ }
32631
+ const PageWrapper = ({ children }) => {
32632
+ var _a, _b;
32633
+ const cms = useCMS$1();
32634
+ const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
32635
+ const [branchingEnabled, setBranchingEnabled] = React.useState(
32636
+ () => cms.flags.get("branch-switcher")
32637
+ );
32634
32638
  React.useEffect(() => {
32635
- let cancelled = false;
32636
- const searchCollection = async () => {
32637
- if (await api.isAuthenticated() && !folder.loading && !cancelled) {
32638
- try {
32639
- const response = await cms.api.search.query(
32640
- `${search} AND _collection:${collectionName}`,
32641
- {
32642
- limit: 15,
32643
- cursor: after
32644
- }
32645
- );
32646
- const docs = await Promise.allSettled(
32647
- response.results.map((result) => {
32648
- const [collection2, relativePath2] = result._id.split(":");
32649
- return api.fetchDocument(collection2, relativePath2, false);
32650
- })
32651
- );
32652
- const edges = docs.filter((p) => {
32653
- var _a;
32654
- return p.status === "fulfilled" && !!((_a = p.value) == null ? void 0 : _a.document);
32655
- }).map((result) => ({ node: result.value.document }));
32656
- const c = await api.fetchCollection(collectionName, false, "");
32657
- setCollection({
32658
- format: collection.format,
32659
- label: collection.label,
32660
- name: collectionName,
32661
- templates: collection.templates,
32662
- documents: {
32663
- pageInfo: {
32664
- hasNextPage: !!response.nextCursor,
32665
- hasPreviousPage: !!response.prevCursor,
32666
- startCursor: "",
32667
- endCursor: response.nextCursor || ""
32668
- },
32669
- edges
32670
- }
32671
- });
32672
- } catch (error2) {
32673
- cms.alerts.error(
32674
- `[${error2.name}] GetCollection failed: ${error2.message}`
32675
- );
32676
- console.error(error2);
32677
- setCollection(void 0);
32678
- setError(error2);
32679
- }
32680
- setLoading(false);
32639
+ cms.events.subscribe("flag:set", ({ key, value }) => {
32640
+ if (key === "branch-switcher") {
32641
+ setBranchingEnabled(value);
32681
32642
  }
32682
- };
32683
- if (cancelled)
32684
- return;
32685
- setLoading(true);
32686
- searchCollection();
32687
- return () => {
32688
- cancelled = true;
32689
- };
32690
- }, [
32691
- cms,
32692
- collectionName,
32693
- folder.loading,
32694
- folder.fullyQualifiedName,
32695
- resetState,
32696
- after,
32697
- search
32698
- ]);
32699
- const reFetchCollection = () => setResetSate((x) => x + 1);
32700
- return { collection, loading, error, reFetchCollection, collectionExtra };
32643
+ });
32644
+ }, [cms.events]);
32645
+ return /* @__PURE__ */ React.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React.createElement(BranchBanner, null), children);
32701
32646
  };
32702
- const GetCollection = ({
32703
- cms,
32704
- collectionName,
32705
- folder,
32706
- includeDocuments = true,
32707
- startCursor,
32708
- sortKey,
32709
- children,
32710
- filterArgs,
32711
- search
32647
+ const PageHeader = ({
32648
+ isLocalMode,
32649
+ children
32712
32650
  }) => {
32713
- const navigate = reactRouterDom.useNavigate();
32714
- const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
32715
- cms,
32716
- collectionName,
32717
- includeDocuments,
32718
- folder,
32719
- startCursor || "",
32720
- search
32721
- ) : useGetCollection(
32722
- cms,
32723
- collectionName,
32724
- includeDocuments,
32725
- folder,
32726
- startCursor || "",
32727
- sortKey,
32728
- filterArgs
32729
- ) || {};
32730
- React.useEffect(() => {
32731
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
32732
- if (loading)
32733
- return;
32734
- const collectionDefinition = cms.api.tina.schema.getCollection(
32735
- collection.name
32736
- );
32737
- const allowCreate = ((_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) ?? true;
32738
- const allowDelete = ((_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.delete) ?? true;
32739
- const collectionResponse = collection;
32740
- if (!allowCreate && !allowDelete && // Check there is only one document
32741
- ((_f = (_e = collectionResponse.documents) == null ? void 0 : _e.edges) == null ? void 0 : _f.length) === 1 && // Check to make sure the file is not a folder
32742
- ((_i = (_h = (_g = collectionResponse.documents) == null ? void 0 : _g.edges[0]) == null ? void 0 : _h.node) == null ? void 0 : _i.__typename) !== "Folder") {
32743
- const doc = collectionResponse.documents.edges[0].node;
32744
- handleNavigate(
32745
- navigate,
32746
- cms,
32747
- collectionResponse,
32748
- collectionDefinition,
32749
- doc
32750
- );
32751
- }
32752
- }, [(collection == null ? void 0 : collection.name) || "", loading]);
32753
- if (error) {
32754
- return /* @__PURE__ */ React.createElement(FullscreenError, null);
32755
- }
32756
- if (loading) {
32757
- return /* @__PURE__ */ React.createElement(LoadingPage, null);
32758
- }
32759
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children(collection, loading, reFetchCollection, collectionExtra));
32651
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", { className: "pt-16 xl:pt-12 px-6 xl:px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, /* @__PURE__ */ React.createElement("div", { className: "w-full flex justify-between items-end" }, children))));
32760
32652
  };
32653
+ const PageBody = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
32654
+ const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
32761
32655
  const folderRegex = /^.*\/~\/*(.*)$/;
32762
32656
  const parentFolder = (folder) => {
32763
32657
  return {
@@ -33033,7 +32927,9 @@ This will work when developing locally but NOT when deployed to production.
33033
32927
  safeSubmit: async () => {
33034
32928
  try {
33035
32929
  await admin.deleteDocument(vars);
33036
- cms.alerts.info("Document was successfully deleted");
32930
+ cms.alerts.info(
32931
+ "Document was successfully deleted"
32932
+ );
33037
32933
  reFetchCollection();
33038
32934
  } catch (error) {
33039
32935
  cms.alerts.warn(
@@ -33062,7 +32958,9 @@ This will work when developing locally but NOT when deployed to production.
33062
32958
  relativePath: vars.relativePath,
33063
32959
  newRelativePath
33064
32960
  });
33065
- cms.alerts.info("Document was successfully renamed");
32961
+ cms.alerts.info(
32962
+ "Document was successfully renamed"
32963
+ );
33066
32964
  reFetchCollection();
33067
32965
  } catch (error) {
33068
32966
  if (error.message.indexOf("has references")) {
@@ -33162,7 +33060,9 @@ This will work when developing locally but NOT when deployed to production.
33162
33060
  name: "sort",
33163
33061
  value: sortKey,
33164
33062
  onChange: (e) => {
33165
- const val = JSON.parse(e.target.value);
33063
+ const val = JSON.parse(
33064
+ e.target.value
33065
+ );
33166
33066
  setEndCursor("");
33167
33067
  setPrevCursors([]);
33168
33068
  window == null ? void 0 : window.localStorage.setItem(
@@ -33629,6 +33529,231 @@ This will work when developing locally but NOT when deployed to production.
33629
33529
  "Rename"
33630
33530
  ))));
33631
33531
  };
33532
+ const FullscreenError = ({
33533
+ title = "Error",
33534
+ errorMessage = "It looks like something went wrong."
33535
+ }) => {
33536
+ return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React.createElement(Button$1, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
33537
+ };
33538
+ const isValidSortKey = (sortKey, collection) => {
33539
+ if (collection.fields) {
33540
+ const sortKeys = collection.fields.map((x) => x.name);
33541
+ return sortKeys.includes(sortKey);
33542
+ } else if (collection.templates) {
33543
+ const collectionMap = {};
33544
+ const conflictedFields = /* @__PURE__ */ new Set();
33545
+ for (const template of collection.templates) {
33546
+ for (const field of template.fields) {
33547
+ if (collectionMap[field.name]) {
33548
+ if (collectionMap[field.name].type !== field.type) {
33549
+ conflictedFields.add(field.name);
33550
+ }
33551
+ } else {
33552
+ collectionMap[field.name] = field;
33553
+ }
33554
+ }
33555
+ }
33556
+ for (const key in conflictedFields) {
33557
+ delete collectionMap[key];
33558
+ }
33559
+ for (const key in collectionMap) {
33560
+ if (key === sortKey) {
33561
+ return true;
33562
+ }
33563
+ }
33564
+ return false;
33565
+ }
33566
+ };
33567
+ const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
33568
+ const api = new TinaAdminApi(cms);
33569
+ const schema = cms.api.tina.schema;
33570
+ const collectionExtra = schema.getCollection(collectionName);
33571
+ const [collection, setCollection] = React.useState(void 0);
33572
+ const [loading, setLoading] = React.useState(true);
33573
+ const [error, setError] = React.useState(void 0);
33574
+ const [resetState, setResetSate] = React.useState(0);
33575
+ React.useEffect(() => {
33576
+ let cancelled = false;
33577
+ const fetchCollection = async () => {
33578
+ if (await api.isAuthenticated() && !folder.loading && !cancelled) {
33579
+ const { name, order } = JSON.parse(sortKey || "{}");
33580
+ const validSortKey = isValidSortKey(name, collectionExtra) ? name : void 0;
33581
+ try {
33582
+ const collection2 = await api.fetchCollection(
33583
+ collectionName,
33584
+ includeDocuments,
33585
+ (filterArgs == null ? void 0 : filterArgs.filterField) ? "" : folder.fullyQualifiedName,
33586
+ after,
33587
+ validSortKey,
33588
+ order,
33589
+ filterArgs
33590
+ );
33591
+ setCollection(collection2);
33592
+ } catch (error2) {
33593
+ cms.alerts.error(
33594
+ `[${error2.name}] GetCollection failed: ${error2.message}`
33595
+ );
33596
+ console.error(error2);
33597
+ setCollection(void 0);
33598
+ setError(error2);
33599
+ }
33600
+ setLoading(false);
33601
+ }
33602
+ };
33603
+ if (cancelled)
33604
+ return;
33605
+ setLoading(true);
33606
+ fetchCollection();
33607
+ return () => {
33608
+ cancelled = true;
33609
+ };
33610
+ }, [
33611
+ cms,
33612
+ collectionName,
33613
+ folder.loading,
33614
+ folder.fullyQualifiedName,
33615
+ resetState,
33616
+ after,
33617
+ sortKey
33618
+ ]);
33619
+ const reFetchCollection = () => setResetSate((x) => x + 1);
33620
+ return { collection, loading, error, reFetchCollection, collectionExtra };
33621
+ };
33622
+ const useSearchCollection = (cms, collectionName, includeDocuments = true, folder, after = "", search) => {
33623
+ const api = new TinaAdminApi(cms);
33624
+ const schema = cms.api.tina.schema;
33625
+ const collectionExtra = schema.getCollection(collectionName);
33626
+ const [collection, setCollection] = React.useState(void 0);
33627
+ const [loading, setLoading] = React.useState(true);
33628
+ const [error, setError] = React.useState(void 0);
33629
+ const [resetState, setResetSate] = React.useState(0);
33630
+ React.useEffect(() => {
33631
+ let cancelled = false;
33632
+ const searchCollection = async () => {
33633
+ if (await api.isAuthenticated() && !folder.loading && !cancelled) {
33634
+ try {
33635
+ const response = await cms.api.search.query(
33636
+ `${search} AND _collection:${collectionName}`,
33637
+ {
33638
+ limit: 15,
33639
+ cursor: after
33640
+ }
33641
+ );
33642
+ const docs = await Promise.allSettled(
33643
+ response.results.map((result) => {
33644
+ const [collection2, relativePath2] = result._id.split(":");
33645
+ return api.fetchDocument(collection2, relativePath2, false);
33646
+ })
33647
+ );
33648
+ const edges = docs.filter((p) => {
33649
+ var _a;
33650
+ return p.status === "fulfilled" && !!((_a = p.value) == null ? void 0 : _a.document);
33651
+ }).map((result) => ({ node: result.value.document }));
33652
+ const c = await api.fetchCollection(collectionName, false, "");
33653
+ setCollection({
33654
+ format: collection.format,
33655
+ label: collection.label,
33656
+ name: collectionName,
33657
+ templates: collection.templates,
33658
+ documents: {
33659
+ pageInfo: {
33660
+ hasNextPage: !!response.nextCursor,
33661
+ hasPreviousPage: !!response.prevCursor,
33662
+ startCursor: "",
33663
+ endCursor: response.nextCursor || ""
33664
+ },
33665
+ edges
33666
+ }
33667
+ });
33668
+ } catch (error2) {
33669
+ cms.alerts.error(
33670
+ `[${error2.name}] GetCollection failed: ${error2.message}`
33671
+ );
33672
+ console.error(error2);
33673
+ setCollection(void 0);
33674
+ setError(error2);
33675
+ }
33676
+ setLoading(false);
33677
+ }
33678
+ };
33679
+ if (cancelled)
33680
+ return;
33681
+ setLoading(true);
33682
+ searchCollection();
33683
+ return () => {
33684
+ cancelled = true;
33685
+ };
33686
+ }, [
33687
+ cms,
33688
+ collectionName,
33689
+ folder.loading,
33690
+ folder.fullyQualifiedName,
33691
+ resetState,
33692
+ after,
33693
+ search
33694
+ ]);
33695
+ const reFetchCollection = () => setResetSate((x) => x + 1);
33696
+ return { collection, loading, error, reFetchCollection, collectionExtra };
33697
+ };
33698
+ const GetCollection = ({
33699
+ cms,
33700
+ collectionName,
33701
+ folder,
33702
+ includeDocuments = true,
33703
+ startCursor,
33704
+ sortKey,
33705
+ children,
33706
+ filterArgs,
33707
+ search
33708
+ }) => {
33709
+ const navigate = reactRouterDom.useNavigate();
33710
+ const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
33711
+ cms,
33712
+ collectionName,
33713
+ includeDocuments,
33714
+ folder,
33715
+ startCursor || "",
33716
+ search
33717
+ ) : useGetCollection(
33718
+ cms,
33719
+ collectionName,
33720
+ includeDocuments,
33721
+ folder,
33722
+ startCursor || "",
33723
+ sortKey,
33724
+ filterArgs
33725
+ ) || {};
33726
+ React.useEffect(() => {
33727
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33728
+ if (loading)
33729
+ return;
33730
+ const collectionDefinition = cms.api.tina.schema.getCollection(
33731
+ collection.name
33732
+ );
33733
+ const allowCreate = ((_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) ?? true;
33734
+ const allowDelete = ((_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.delete) ?? true;
33735
+ const collectionResponse = collection;
33736
+ if (!allowCreate && !allowDelete && // Check there is only one document
33737
+ ((_f = (_e = collectionResponse.documents) == null ? void 0 : _e.edges) == null ? void 0 : _f.length) === 1 && // Check to make sure the file is not a folder
33738
+ ((_i = (_h = (_g = collectionResponse.documents) == null ? void 0 : _g.edges[0]) == null ? void 0 : _h.node) == null ? void 0 : _i.__typename) !== "Folder") {
33739
+ const doc = collectionResponse.documents.edges[0].node;
33740
+ handleNavigate(
33741
+ navigate,
33742
+ cms,
33743
+ collectionResponse,
33744
+ collectionDefinition,
33745
+ doc
33746
+ );
33747
+ }
33748
+ }, [(collection == null ? void 0 : collection.name) || "", loading]);
33749
+ if (error) {
33750
+ return /* @__PURE__ */ React.createElement(FullscreenError, null);
33751
+ }
33752
+ if (loading) {
33753
+ return /* @__PURE__ */ React.createElement(LoadingPage, null);
33754
+ }
33755
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children(collection, loading, reFetchCollection, collectionExtra));
33756
+ };
33632
33757
  const ErrorDialog = (props) => {
33633
33758
  return /* @__PURE__ */ React.createElement(
33634
33759
  "div",
@@ -33951,7 +34076,10 @@ This will work when developing locally but NOT when deployed to production.
33951
34076
  const fetchDocument = async () => {
33952
34077
  if (api.isAuthenticated()) {
33953
34078
  try {
33954
- const response = await api.fetchDocument(collectionName, relativePath2);
34079
+ const response = await api.fetchDocument(
34080
+ collectionName,
34081
+ relativePath2
34082
+ );
33955
34083
  setDocument(response.document);
33956
34084
  } catch (error2) {
33957
34085
  cms.alerts.error(
@@ -34169,6 +34297,12 @@ This will work when developing locally but NOT when deployed to production.
34169
34297
  ), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "flex-1 w-full text-sm leading-tight whitespace-nowrap truncate" }, `${filename}.${collection.format}`), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
34170
34298
  ), activeForm && /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine }));
34171
34299
  };
34300
+ const DashboardPage = () => {
34301
+ return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
34302
+ var _a, _b;
34303
+ return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, { isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode }, /* @__PURE__ */ React.createElement("h3", { className: "text-2xl font-sans text-gray-700" }, "Welcome to Tina!")), /* @__PURE__ */ React.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
34304
+ });
34305
+ };
34172
34306
  const ScreenPage = () => {
34173
34307
  const { screenName } = reactRouterDom.useParams();
34174
34308
  return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
@@ -34251,7 +34385,7 @@ This will work when developing locally but NOT when deployed to production.
34251
34385
  } catch {
34252
34386
  cms.alerts.error("Branch indexing failed.");
34253
34387
  setErrorMessage(
34254
- 'Branch indexing failed, please check the Tina Cloud dashboard for more information. To try again chick "re-index" on the branch in the dashboard.'
34388
+ 'Branch indexing failed, please check the TinaCloud dashboard for more information. To try again chick "re-index" on the branch in the dashboard.'
34255
34389
  );
34256
34390
  setState("error");
34257
34391
  }
@@ -34419,7 +34553,7 @@ This will work when developing locally but NOT when deployed to production.
34419
34553
  );
34420
34554
  }
34421
34555
  }).catch((e) => {
34422
- if (e.message.includes("has not been indexed by Tina Cloud")) {
34556
+ if (e.message.includes("has not been indexed by TinaCloud")) {
34423
34557
  setSchemaMissingError(true);
34424
34558
  } else {
34425
34559
  cms.alerts.error(`Unexpected error checking schema: ${e}`);