tinacms 2.7.9 → 2.7.10

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.mjs CHANGED
@@ -27,7 +27,7 @@ import { PopoverAnchor } from "@radix-ui/react-popover";
27
27
  import * as dropzone from "react-dropzone";
28
28
  import { Slot } from "@radix-ui/react-slot";
29
29
  import { Command as Command$1 } from "cmdk";
30
- import { Search, ChevronRight, MoreHorizontal, EllipsisVertical, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Eye, Moon, SunMedium, Twitter, SquarePen } from "lucide-react";
30
+ import { Search, LoaderCircle, Check, TriangleAlert, ChevronRight, MoreHorizontal, EllipsisVertical, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Eye, Moon, SunMedium, Twitter, SquarePen } from "lucide-react";
31
31
  import { Droppable, Draggable, DragDropContext } from "react-beautiful-dnd";
32
32
  import { Popover as Popover$3, PopoverButton, Transition, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Combobox as Combobox$1, ComboboxInput, ComboboxButton, ComboboxOptions, ComboboxOption, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
33
33
  import { ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
@@ -45,7 +45,7 @@ import { isHotkey } from "is-hotkey";
45
45
  import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
46
46
  import get from "lodash.get";
47
47
  import moment from "moment";
48
- import { formatDistanceToNow } from "date-fns";
48
+ import { formatDistanceToNow as formatDistanceToNow$1 } from "date-fns";
49
49
  import { createSlashPlugin, ELEMENT_SLASH_INPUT } from "@udecode/plate-slash-command";
50
50
  import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
51
51
  import mermaid from "mermaid";
@@ -4604,28 +4604,28 @@ class DaysView extends React__default.Component {
4604
4604
  }
4605
4605
  renderNavigation() {
4606
4606
  const date = this.props.viewDate;
4607
- const locale = date.localeData();
4607
+ const locale2 = date.localeData();
4608
4608
  return /* @__PURE__ */ React__default.createElement(
4609
4609
  ViewNavigation,
4610
4610
  {
4611
4611
  onClickPrev: () => this.props.navigate(-1, "months"),
4612
4612
  onClickSwitch: () => this.props.showView("months"),
4613
4613
  onClickNext: () => this.props.navigate(1, "months"),
4614
- switchContent: locale.months(date) + " " + date.year(),
4614
+ switchContent: locale2.months(date) + " " + date.year(),
4615
4615
  switchColSpan: 5,
4616
4616
  switchProps: { "data-value": this.props.viewDate.month() }
4617
4617
  }
4618
4618
  );
4619
4619
  }
4620
4620
  renderDayHeaders() {
4621
- const locale = this.props.viewDate.localeData();
4622
- const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
4621
+ const locale2 = this.props.viewDate.localeData();
4622
+ const dayItems = getDaysOfWeek(locale2).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
4623
4623
  return /* @__PURE__ */ React__default.createElement("tr", null, dayItems);
4624
4624
  }
4625
4625
  renderDays() {
4626
4626
  const date = this.props.viewDate;
4627
4627
  const startOfMonth = date.clone().startOf("month");
4628
- const endOfMonth = date.clone().endOf("month");
4628
+ const endOfMonth2 = date.clone().endOf("month");
4629
4629
  const rows = [[], [], [], [], [], []];
4630
4630
  const startDate = date.clone().subtract(1, "months");
4631
4631
  startDate.date(startDate.daysInMonth()).startOf("week");
@@ -4633,12 +4633,12 @@ class DaysView extends React__default.Component {
4633
4633
  let i = 0;
4634
4634
  while (startDate.isBefore(endDate)) {
4635
4635
  const row = getRow$2(rows, i++);
4636
- row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
4636
+ row.push(this.renderDay(startDate, startOfMonth, endOfMonth2));
4637
4637
  startDate.add(1, "d");
4638
4638
  }
4639
4639
  return rows.map((r, i2) => /* @__PURE__ */ React__default.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
4640
4640
  }
4641
- renderDay(date, startOfMonth, endOfMonth) {
4641
+ renderDay(date, startOfMonth, endOfMonth2) {
4642
4642
  const selectedDate = this.props.selectedDate;
4643
4643
  const dayProps = {
4644
4644
  key: date.format("M_D"),
@@ -4649,7 +4649,7 @@ class DaysView extends React__default.Component {
4649
4649
  let className = "rdtDay";
4650
4650
  if (date.isBefore(startOfMonth)) {
4651
4651
  className += " rdtOld";
4652
- } else if (date.isAfter(endOfMonth)) {
4652
+ } else if (date.isAfter(endOfMonth2)) {
4653
4653
  className += " rdtNew";
4654
4654
  }
4655
4655
  if (selectedDate && date.isSame(selectedDate, "day")) {
@@ -4692,11 +4692,11 @@ __publicField(DaysView, "defaultProps", {
4692
4692
  function getRow$2(rows, day) {
4693
4693
  return rows[Math.floor(day / 7)];
4694
4694
  }
4695
- function getDaysOfWeek(locale) {
4696
- const first = locale.firstDayOfWeek();
4695
+ function getDaysOfWeek(locale2) {
4696
+ const first = locale2.firstDayOfWeek();
4697
4697
  const dow = [];
4698
4698
  let i = 0;
4699
- locale._weekdaysMin.forEach(function(day) {
4699
+ locale2._weekdaysMin.forEach(function(day) {
4700
4700
  dow[(7 + i++ - first) % 7] = day;
4701
4701
  });
4702
4702
  return dow;
@@ -5429,19 +5429,19 @@ class Datetime extends React__default.Component {
5429
5429
  ).localeData();
5430
5430
  }
5431
5431
  getDateFormat() {
5432
- const locale = this.getLocaleData();
5432
+ const locale2 = this.getLocaleData();
5433
5433
  const format2 = this.props.dateFormat;
5434
5434
  if (format2 === true)
5435
- return locale.longDateFormat("L");
5435
+ return locale2.longDateFormat("L");
5436
5436
  if (format2)
5437
5437
  return format2;
5438
5438
  return "";
5439
5439
  }
5440
5440
  getTimeFormat() {
5441
- const locale = this.getLocaleData();
5441
+ const locale2 = this.getLocaleData();
5442
5442
  const format2 = this.props.timeFormat;
5443
5443
  if (format2 === true) {
5444
- return locale.longDateFormat("LT");
5444
+ return locale2.longDateFormat("LT");
5445
5445
  }
5446
5446
  return format2 || "";
5447
5447
  }
@@ -6483,7 +6483,7 @@ const BranchSelector = ({
6483
6483
  key: branch.name
6484
6484
  },
6485
6485
  /* @__PURE__ */ React.createElement("div", { className: "w-1/2" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React.createElement("div", { className: "flex-0" }, branch.protected && /* @__PURE__ */ React.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500" })), /* @__PURE__ */ React.createElement("div", { className: "truncate flex-1" }, branch.name)), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status }))),
6486
- /* @__PURE__ */ React.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold" }, "Last Updated"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight" }, formatDistanceToNow(
6486
+ /* @__PURE__ */ React.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold" }, "Last Updated"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight" }, formatDistanceToNow$1(
6487
6487
  new Date(branch.indexStatus.timestamp),
6488
6488
  {
6489
6489
  addSuffix: true
@@ -8644,10 +8644,723 @@ function FiInfo(props) {
8644
8644
  function VscNewFile(props) {
8645
8645
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z" }, "child": [] }] })(props);
8646
8646
  }
8647
- const version = "2.7.9";
8648
8647
  function cn(...inputs) {
8649
8648
  return twMerge(clsx(inputs));
8650
8649
  }
8650
+ var defaultOptions = {};
8651
+ function getDefaultOptions() {
8652
+ return defaultOptions;
8653
+ }
8654
+ function _typeof(o) {
8655
+ "@babel/helpers - typeof";
8656
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
8657
+ return typeof o2;
8658
+ } : function(o2) {
8659
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
8660
+ }, _typeof(o);
8661
+ }
8662
+ function requiredArgs(required, args) {
8663
+ if (args.length < required) {
8664
+ throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
8665
+ }
8666
+ }
8667
+ function toDate(argument) {
8668
+ requiredArgs(1, arguments);
8669
+ var argStr = Object.prototype.toString.call(argument);
8670
+ if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") {
8671
+ return new Date(argument.getTime());
8672
+ } else if (typeof argument === "number" || argStr === "[object Number]") {
8673
+ return new Date(argument);
8674
+ } else {
8675
+ if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
8676
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
8677
+ console.warn(new Error().stack);
8678
+ }
8679
+ return /* @__PURE__ */ new Date(NaN);
8680
+ }
8681
+ }
8682
+ function compareAsc(dirtyDateLeft, dirtyDateRight) {
8683
+ requiredArgs(2, arguments);
8684
+ var dateLeft = toDate(dirtyDateLeft);
8685
+ var dateRight = toDate(dirtyDateRight);
8686
+ var diff2 = dateLeft.getTime() - dateRight.getTime();
8687
+ if (diff2 < 0) {
8688
+ return -1;
8689
+ } else if (diff2 > 0) {
8690
+ return 1;
8691
+ } else {
8692
+ return diff2;
8693
+ }
8694
+ }
8695
+ function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
8696
+ requiredArgs(2, arguments);
8697
+ var dateLeft = toDate(dirtyDateLeft);
8698
+ var dateRight = toDate(dirtyDateRight);
8699
+ var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
8700
+ var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
8701
+ return yearDiff * 12 + monthDiff;
8702
+ }
8703
+ function endOfDay(dirtyDate) {
8704
+ requiredArgs(1, arguments);
8705
+ var date = toDate(dirtyDate);
8706
+ date.setHours(23, 59, 59, 999);
8707
+ return date;
8708
+ }
8709
+ function endOfMonth(dirtyDate) {
8710
+ requiredArgs(1, arguments);
8711
+ var date = toDate(dirtyDate);
8712
+ var month = date.getMonth();
8713
+ date.setFullYear(date.getFullYear(), month + 1, 0);
8714
+ date.setHours(23, 59, 59, 999);
8715
+ return date;
8716
+ }
8717
+ function isLastDayOfMonth(dirtyDate) {
8718
+ requiredArgs(1, arguments);
8719
+ var date = toDate(dirtyDate);
8720
+ return endOfDay(date).getTime() === endOfMonth(date).getTime();
8721
+ }
8722
+ function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
8723
+ requiredArgs(2, arguments);
8724
+ var dateLeft = toDate(dirtyDateLeft);
8725
+ var dateRight = toDate(dirtyDateRight);
8726
+ var sign = compareAsc(dateLeft, dateRight);
8727
+ var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));
8728
+ var result;
8729
+ if (difference < 1) {
8730
+ result = 0;
8731
+ } else {
8732
+ if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {
8733
+ dateLeft.setDate(30);
8734
+ }
8735
+ dateLeft.setMonth(dateLeft.getMonth() - sign * difference);
8736
+ var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign;
8737
+ if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {
8738
+ isLastMonthNotFull = false;
8739
+ }
8740
+ result = sign * (difference - Number(isLastMonthNotFull));
8741
+ }
8742
+ return result === 0 ? 0 : result;
8743
+ }
8744
+ function differenceInMilliseconds(dateLeft, dateRight) {
8745
+ requiredArgs(2, arguments);
8746
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
8747
+ }
8748
+ var roundingMap = {
8749
+ ceil: Math.ceil,
8750
+ round: Math.round,
8751
+ floor: Math.floor,
8752
+ trunc: function trunc(value) {
8753
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
8754
+ }
8755
+ // Math.trunc is not supported by IE
8756
+ };
8757
+ var defaultRoundingMethod = "trunc";
8758
+ function getRoundingMethod(method) {
8759
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
8760
+ }
8761
+ function differenceInSeconds(dateLeft, dateRight, options) {
8762
+ requiredArgs(2, arguments);
8763
+ var diff2 = differenceInMilliseconds(dateLeft, dateRight) / 1e3;
8764
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff2);
8765
+ }
8766
+ var formatDistanceLocale = {
8767
+ lessThanXSeconds: {
8768
+ one: "less than a second",
8769
+ other: "less than {{count}} seconds"
8770
+ },
8771
+ xSeconds: {
8772
+ one: "1 second",
8773
+ other: "{{count}} seconds"
8774
+ },
8775
+ halfAMinute: "half a minute",
8776
+ lessThanXMinutes: {
8777
+ one: "less than a minute",
8778
+ other: "less than {{count}} minutes"
8779
+ },
8780
+ xMinutes: {
8781
+ one: "1 minute",
8782
+ other: "{{count}} minutes"
8783
+ },
8784
+ aboutXHours: {
8785
+ one: "about 1 hour",
8786
+ other: "about {{count}} hours"
8787
+ },
8788
+ xHours: {
8789
+ one: "1 hour",
8790
+ other: "{{count}} hours"
8791
+ },
8792
+ xDays: {
8793
+ one: "1 day",
8794
+ other: "{{count}} days"
8795
+ },
8796
+ aboutXWeeks: {
8797
+ one: "about 1 week",
8798
+ other: "about {{count}} weeks"
8799
+ },
8800
+ xWeeks: {
8801
+ one: "1 week",
8802
+ other: "{{count}} weeks"
8803
+ },
8804
+ aboutXMonths: {
8805
+ one: "about 1 month",
8806
+ other: "about {{count}} months"
8807
+ },
8808
+ xMonths: {
8809
+ one: "1 month",
8810
+ other: "{{count}} months"
8811
+ },
8812
+ aboutXYears: {
8813
+ one: "about 1 year",
8814
+ other: "about {{count}} years"
8815
+ },
8816
+ xYears: {
8817
+ one: "1 year",
8818
+ other: "{{count}} years"
8819
+ },
8820
+ overXYears: {
8821
+ one: "over 1 year",
8822
+ other: "over {{count}} years"
8823
+ },
8824
+ almostXYears: {
8825
+ one: "almost 1 year",
8826
+ other: "almost {{count}} years"
8827
+ }
8828
+ };
8829
+ var formatDistance$1 = function formatDistance(token, count, options) {
8830
+ var result;
8831
+ var tokenValue = formatDistanceLocale[token];
8832
+ if (typeof tokenValue === "string") {
8833
+ result = tokenValue;
8834
+ } else if (count === 1) {
8835
+ result = tokenValue.one;
8836
+ } else {
8837
+ result = tokenValue.other.replace("{{count}}", count.toString());
8838
+ }
8839
+ if (options !== null && options !== void 0 && options.addSuffix) {
8840
+ if (options.comparison && options.comparison > 0) {
8841
+ return "in " + result;
8842
+ } else {
8843
+ return result + " ago";
8844
+ }
8845
+ }
8846
+ return result;
8847
+ };
8848
+ const formatDistance$2 = formatDistance$1;
8849
+ function buildFormatLongFn(args) {
8850
+ return function() {
8851
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8852
+ var width = options.width ? String(options.width) : args.defaultWidth;
8853
+ var format2 = args.formats[width] || args.formats[args.defaultWidth];
8854
+ return format2;
8855
+ };
8856
+ }
8857
+ var dateFormats = {
8858
+ full: "EEEE, MMMM do, y",
8859
+ long: "MMMM do, y",
8860
+ medium: "MMM d, y",
8861
+ short: "MM/dd/yyyy"
8862
+ };
8863
+ var timeFormats = {
8864
+ full: "h:mm:ss a zzzz",
8865
+ long: "h:mm:ss a z",
8866
+ medium: "h:mm:ss a",
8867
+ short: "h:mm a"
8868
+ };
8869
+ var dateTimeFormats = {
8870
+ full: "{{date}} 'at' {{time}}",
8871
+ long: "{{date}} 'at' {{time}}",
8872
+ medium: "{{date}}, {{time}}",
8873
+ short: "{{date}}, {{time}}"
8874
+ };
8875
+ var formatLong = {
8876
+ date: buildFormatLongFn({
8877
+ formats: dateFormats,
8878
+ defaultWidth: "full"
8879
+ }),
8880
+ time: buildFormatLongFn({
8881
+ formats: timeFormats,
8882
+ defaultWidth: "full"
8883
+ }),
8884
+ dateTime: buildFormatLongFn({
8885
+ formats: dateTimeFormats,
8886
+ defaultWidth: "full"
8887
+ })
8888
+ };
8889
+ const formatLong$1 = formatLong;
8890
+ var formatRelativeLocale = {
8891
+ lastWeek: "'last' eeee 'at' p",
8892
+ yesterday: "'yesterday at' p",
8893
+ today: "'today at' p",
8894
+ tomorrow: "'tomorrow at' p",
8895
+ nextWeek: "eeee 'at' p",
8896
+ other: "P"
8897
+ };
8898
+ var formatRelative = function formatRelative2(token, _date, _baseDate, _options) {
8899
+ return formatRelativeLocale[token];
8900
+ };
8901
+ const formatRelative$1 = formatRelative;
8902
+ function buildLocalizeFn(args) {
8903
+ return function(dirtyIndex, options) {
8904
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
8905
+ var valuesArray;
8906
+ if (context === "formatting" && args.formattingValues) {
8907
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
8908
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
8909
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
8910
+ } else {
8911
+ var _defaultWidth = args.defaultWidth;
8912
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
8913
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
8914
+ }
8915
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
8916
+ return valuesArray[index];
8917
+ };
8918
+ }
8919
+ var eraValues = {
8920
+ narrow: ["B", "A"],
8921
+ abbreviated: ["BC", "AD"],
8922
+ wide: ["Before Christ", "Anno Domini"]
8923
+ };
8924
+ var quarterValues = {
8925
+ narrow: ["1", "2", "3", "4"],
8926
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
8927
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
8928
+ };
8929
+ var monthValues = {
8930
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
8931
+ abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
8932
+ wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
8933
+ };
8934
+ var dayValues = {
8935
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
8936
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
8937
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
8938
+ wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
8939
+ };
8940
+ var dayPeriodValues = {
8941
+ narrow: {
8942
+ am: "a",
8943
+ pm: "p",
8944
+ midnight: "mi",
8945
+ noon: "n",
8946
+ morning: "morning",
8947
+ afternoon: "afternoon",
8948
+ evening: "evening",
8949
+ night: "night"
8950
+ },
8951
+ abbreviated: {
8952
+ am: "AM",
8953
+ pm: "PM",
8954
+ midnight: "midnight",
8955
+ noon: "noon",
8956
+ morning: "morning",
8957
+ afternoon: "afternoon",
8958
+ evening: "evening",
8959
+ night: "night"
8960
+ },
8961
+ wide: {
8962
+ am: "a.m.",
8963
+ pm: "p.m.",
8964
+ midnight: "midnight",
8965
+ noon: "noon",
8966
+ morning: "morning",
8967
+ afternoon: "afternoon",
8968
+ evening: "evening",
8969
+ night: "night"
8970
+ }
8971
+ };
8972
+ var formattingDayPeriodValues = {
8973
+ narrow: {
8974
+ am: "a",
8975
+ pm: "p",
8976
+ midnight: "mi",
8977
+ noon: "n",
8978
+ morning: "in the morning",
8979
+ afternoon: "in the afternoon",
8980
+ evening: "in the evening",
8981
+ night: "at night"
8982
+ },
8983
+ abbreviated: {
8984
+ am: "AM",
8985
+ pm: "PM",
8986
+ midnight: "midnight",
8987
+ noon: "noon",
8988
+ morning: "in the morning",
8989
+ afternoon: "in the afternoon",
8990
+ evening: "in the evening",
8991
+ night: "at night"
8992
+ },
8993
+ wide: {
8994
+ am: "a.m.",
8995
+ pm: "p.m.",
8996
+ midnight: "midnight",
8997
+ noon: "noon",
8998
+ morning: "in the morning",
8999
+ afternoon: "in the afternoon",
9000
+ evening: "in the evening",
9001
+ night: "at night"
9002
+ }
9003
+ };
9004
+ var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
9005
+ var number = Number(dirtyNumber);
9006
+ var rem100 = number % 100;
9007
+ if (rem100 > 20 || rem100 < 10) {
9008
+ switch (rem100 % 10) {
9009
+ case 1:
9010
+ return number + "st";
9011
+ case 2:
9012
+ return number + "nd";
9013
+ case 3:
9014
+ return number + "rd";
9015
+ }
9016
+ }
9017
+ return number + "th";
9018
+ };
9019
+ var localize = {
9020
+ ordinalNumber,
9021
+ era: buildLocalizeFn({
9022
+ values: eraValues,
9023
+ defaultWidth: "wide"
9024
+ }),
9025
+ quarter: buildLocalizeFn({
9026
+ values: quarterValues,
9027
+ defaultWidth: "wide",
9028
+ argumentCallback: function argumentCallback(quarter) {
9029
+ return quarter - 1;
9030
+ }
9031
+ }),
9032
+ month: buildLocalizeFn({
9033
+ values: monthValues,
9034
+ defaultWidth: "wide"
9035
+ }),
9036
+ day: buildLocalizeFn({
9037
+ values: dayValues,
9038
+ defaultWidth: "wide"
9039
+ }),
9040
+ dayPeriod: buildLocalizeFn({
9041
+ values: dayPeriodValues,
9042
+ defaultWidth: "wide",
9043
+ formattingValues: formattingDayPeriodValues,
9044
+ defaultFormattingWidth: "wide"
9045
+ })
9046
+ };
9047
+ const localize$1 = localize;
9048
+ function buildMatchFn(args) {
9049
+ return function(string) {
9050
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9051
+ var width = options.width;
9052
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
9053
+ var matchResult = string.match(matchPattern);
9054
+ if (!matchResult) {
9055
+ return null;
9056
+ }
9057
+ var matchedString = matchResult[0];
9058
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
9059
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
9060
+ return pattern.test(matchedString);
9061
+ }) : findKey(parsePatterns, function(pattern) {
9062
+ return pattern.test(matchedString);
9063
+ });
9064
+ var value;
9065
+ value = args.valueCallback ? args.valueCallback(key) : key;
9066
+ value = options.valueCallback ? options.valueCallback(value) : value;
9067
+ var rest = string.slice(matchedString.length);
9068
+ return {
9069
+ value,
9070
+ rest
9071
+ };
9072
+ };
9073
+ }
9074
+ function findKey(object, predicate) {
9075
+ for (var key in object) {
9076
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
9077
+ return key;
9078
+ }
9079
+ }
9080
+ return void 0;
9081
+ }
9082
+ function findIndex(array, predicate) {
9083
+ for (var key = 0; key < array.length; key++) {
9084
+ if (predicate(array[key])) {
9085
+ return key;
9086
+ }
9087
+ }
9088
+ return void 0;
9089
+ }
9090
+ function buildMatchPatternFn(args) {
9091
+ return function(string) {
9092
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9093
+ var matchResult = string.match(args.matchPattern);
9094
+ if (!matchResult)
9095
+ return null;
9096
+ var matchedString = matchResult[0];
9097
+ var parseResult = string.match(args.parsePattern);
9098
+ if (!parseResult)
9099
+ return null;
9100
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
9101
+ value = options.valueCallback ? options.valueCallback(value) : value;
9102
+ var rest = string.slice(matchedString.length);
9103
+ return {
9104
+ value,
9105
+ rest
9106
+ };
9107
+ };
9108
+ }
9109
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
9110
+ var parseOrdinalNumberPattern = /\d+/i;
9111
+ var matchEraPatterns = {
9112
+ narrow: /^(b|a)/i,
9113
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
9114
+ wide: /^(before christ|before common era|anno domini|common era)/i
9115
+ };
9116
+ var parseEraPatterns = {
9117
+ any: [/^b/i, /^(a|c)/i]
9118
+ };
9119
+ var matchQuarterPatterns = {
9120
+ narrow: /^[1234]/i,
9121
+ abbreviated: /^q[1234]/i,
9122
+ wide: /^[1234](th|st|nd|rd)? quarter/i
9123
+ };
9124
+ var parseQuarterPatterns = {
9125
+ any: [/1/i, /2/i, /3/i, /4/i]
9126
+ };
9127
+ var matchMonthPatterns = {
9128
+ narrow: /^[jfmasond]/i,
9129
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
9130
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
9131
+ };
9132
+ var parseMonthPatterns = {
9133
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
9134
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
9135
+ };
9136
+ var matchDayPatterns = {
9137
+ narrow: /^[smtwf]/i,
9138
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
9139
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
9140
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
9141
+ };
9142
+ var parseDayPatterns = {
9143
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
9144
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
9145
+ };
9146
+ var matchDayPeriodPatterns = {
9147
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
9148
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
9149
+ };
9150
+ var parseDayPeriodPatterns = {
9151
+ any: {
9152
+ am: /^a/i,
9153
+ pm: /^p/i,
9154
+ midnight: /^mi/i,
9155
+ noon: /^no/i,
9156
+ morning: /morning/i,
9157
+ afternoon: /afternoon/i,
9158
+ evening: /evening/i,
9159
+ night: /night/i
9160
+ }
9161
+ };
9162
+ var match = {
9163
+ ordinalNumber: buildMatchPatternFn({
9164
+ matchPattern: matchOrdinalNumberPattern,
9165
+ parsePattern: parseOrdinalNumberPattern,
9166
+ valueCallback: function valueCallback(value) {
9167
+ return parseInt(value, 10);
9168
+ }
9169
+ }),
9170
+ era: buildMatchFn({
9171
+ matchPatterns: matchEraPatterns,
9172
+ defaultMatchWidth: "wide",
9173
+ parsePatterns: parseEraPatterns,
9174
+ defaultParseWidth: "any"
9175
+ }),
9176
+ quarter: buildMatchFn({
9177
+ matchPatterns: matchQuarterPatterns,
9178
+ defaultMatchWidth: "wide",
9179
+ parsePatterns: parseQuarterPatterns,
9180
+ defaultParseWidth: "any",
9181
+ valueCallback: function valueCallback2(index) {
9182
+ return index + 1;
9183
+ }
9184
+ }),
9185
+ month: buildMatchFn({
9186
+ matchPatterns: matchMonthPatterns,
9187
+ defaultMatchWidth: "wide",
9188
+ parsePatterns: parseMonthPatterns,
9189
+ defaultParseWidth: "any"
9190
+ }),
9191
+ day: buildMatchFn({
9192
+ matchPatterns: matchDayPatterns,
9193
+ defaultMatchWidth: "wide",
9194
+ parsePatterns: parseDayPatterns,
9195
+ defaultParseWidth: "any"
9196
+ }),
9197
+ dayPeriod: buildMatchFn({
9198
+ matchPatterns: matchDayPeriodPatterns,
9199
+ defaultMatchWidth: "any",
9200
+ parsePatterns: parseDayPeriodPatterns,
9201
+ defaultParseWidth: "any"
9202
+ })
9203
+ };
9204
+ const match$1 = match;
9205
+ var locale = {
9206
+ code: "en-US",
9207
+ formatDistance: formatDistance$2,
9208
+ formatLong: formatLong$1,
9209
+ formatRelative: formatRelative$1,
9210
+ localize: localize$1,
9211
+ match: match$1,
9212
+ options: {
9213
+ weekStartsOn: 0,
9214
+ firstWeekContainsDate: 1
9215
+ }
9216
+ };
9217
+ const defaultLocale = locale;
9218
+ function assign(target, object) {
9219
+ if (target == null) {
9220
+ throw new TypeError("assign requires that input parameter not be null or undefined");
9221
+ }
9222
+ for (var property in object) {
9223
+ if (Object.prototype.hasOwnProperty.call(object, property)) {
9224
+ target[property] = object[property];
9225
+ }
9226
+ }
9227
+ return target;
9228
+ }
9229
+ function cloneObject(object) {
9230
+ return assign({}, object);
9231
+ }
9232
+ function getTimezoneOffsetInMilliseconds(date) {
9233
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
9234
+ utcDate.setUTCFullYear(date.getFullYear());
9235
+ return date.getTime() - utcDate.getTime();
9236
+ }
9237
+ var MINUTES_IN_DAY = 1440;
9238
+ var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
9239
+ var MINUTES_IN_MONTH = 43200;
9240
+ var MINUTES_IN_TWO_MONTHS = 86400;
9241
+ function formatDistance2(dirtyDate, dirtyBaseDate, options) {
9242
+ var _ref, _options$locale;
9243
+ requiredArgs(2, arguments);
9244
+ var defaultOptions2 = getDefaultOptions();
9245
+ var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
9246
+ if (!locale2.formatDistance) {
9247
+ throw new RangeError("locale must contain formatDistance property");
9248
+ }
9249
+ var comparison = compareAsc(dirtyDate, dirtyBaseDate);
9250
+ if (isNaN(comparison)) {
9251
+ throw new RangeError("Invalid time value");
9252
+ }
9253
+ var localizeOptions = assign(cloneObject(options), {
9254
+ addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
9255
+ comparison
9256
+ });
9257
+ var dateLeft;
9258
+ var dateRight;
9259
+ if (comparison > 0) {
9260
+ dateLeft = toDate(dirtyBaseDate);
9261
+ dateRight = toDate(dirtyDate);
9262
+ } else {
9263
+ dateLeft = toDate(dirtyDate);
9264
+ dateRight = toDate(dirtyBaseDate);
9265
+ }
9266
+ var seconds = differenceInSeconds(dateRight, dateLeft);
9267
+ var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3;
9268
+ var minutes = Math.round((seconds - offsetInSeconds) / 60);
9269
+ var months;
9270
+ if (minutes < 2) {
9271
+ if (options !== null && options !== void 0 && options.includeSeconds) {
9272
+ if (seconds < 5) {
9273
+ return locale2.formatDistance("lessThanXSeconds", 5, localizeOptions);
9274
+ } else if (seconds < 10) {
9275
+ return locale2.formatDistance("lessThanXSeconds", 10, localizeOptions);
9276
+ } else if (seconds < 20) {
9277
+ return locale2.formatDistance("lessThanXSeconds", 20, localizeOptions);
9278
+ } else if (seconds < 40) {
9279
+ return locale2.formatDistance("halfAMinute", 0, localizeOptions);
9280
+ } else if (seconds < 60) {
9281
+ return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
9282
+ } else {
9283
+ return locale2.formatDistance("xMinutes", 1, localizeOptions);
9284
+ }
9285
+ } else {
9286
+ if (minutes === 0) {
9287
+ return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
9288
+ } else {
9289
+ return locale2.formatDistance("xMinutes", minutes, localizeOptions);
9290
+ }
9291
+ }
9292
+ } else if (minutes < 45) {
9293
+ return locale2.formatDistance("xMinutes", minutes, localizeOptions);
9294
+ } else if (minutes < 90) {
9295
+ return locale2.formatDistance("aboutXHours", 1, localizeOptions);
9296
+ } else if (minutes < MINUTES_IN_DAY) {
9297
+ var hours = Math.round(minutes / 60);
9298
+ return locale2.formatDistance("aboutXHours", hours, localizeOptions);
9299
+ } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
9300
+ return locale2.formatDistance("xDays", 1, localizeOptions);
9301
+ } else if (minutes < MINUTES_IN_MONTH) {
9302
+ var days = Math.round(minutes / MINUTES_IN_DAY);
9303
+ return locale2.formatDistance("xDays", days, localizeOptions);
9304
+ } else if (minutes < MINUTES_IN_TWO_MONTHS) {
9305
+ months = Math.round(minutes / MINUTES_IN_MONTH);
9306
+ return locale2.formatDistance("aboutXMonths", months, localizeOptions);
9307
+ }
9308
+ months = differenceInMonths(dateRight, dateLeft);
9309
+ if (months < 12) {
9310
+ var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
9311
+ return locale2.formatDistance("xMonths", nearestMonth, localizeOptions);
9312
+ } else {
9313
+ var monthsSinceStartOfYear = months % 12;
9314
+ var years = Math.floor(months / 12);
9315
+ if (monthsSinceStartOfYear < 3) {
9316
+ return locale2.formatDistance("aboutXYears", years, localizeOptions);
9317
+ } else if (monthsSinceStartOfYear < 9) {
9318
+ return locale2.formatDistance("overXYears", years, localizeOptions);
9319
+ } else {
9320
+ return locale2.formatDistance("almostXYears", years + 1, localizeOptions);
9321
+ }
9322
+ }
9323
+ }
9324
+ function formatDistanceToNow(dirtyDate, options) {
9325
+ requiredArgs(1, arguments);
9326
+ return formatDistance2(dirtyDate, Date.now(), options);
9327
+ }
9328
+ const currentVersion = "1.0";
9329
+ const VersionInfo = () => {
9330
+ const cms = useCMS();
9331
+ const [isLoading, setIsLoading] = React__default.useState(true);
9332
+ const [latestVersionInfo, setLatestVersionInfo] = React__default.useState(null);
9333
+ React__default.useEffect(() => {
9334
+ const fetchVersionInfo = async () => {
9335
+ try {
9336
+ const latestVersion = await cms.api.tina.getLatestVersion();
9337
+ setLatestVersionInfo(latestVersion);
9338
+ } catch {
9339
+ }
9340
+ setIsLoading(false);
9341
+ };
9342
+ fetchVersionInfo();
9343
+ }, [cms]);
9344
+ return /* @__PURE__ */ React__default.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-4 text-gray-500" }, "TinaCMS v", currentVersion + " ", isLoading ? /* @__PURE__ */ React__default.createElement(LoaderCircle, { className: "animate-spin w-4 h-4 inline-block mb-px" }) : /* @__PURE__ */ React__default.createElement(LatestVersionWarning, { latestVersionInfo }));
9345
+ };
9346
+ const LatestVersionWarning = ({
9347
+ latestVersionInfo
9348
+ }) => {
9349
+ var _a, _b, _c;
9350
+ if (!latestVersionInfo)
9351
+ return null;
9352
+ const latestVersion = (_a = latestVersionInfo["tinacms"]) == null ? void 0 : _a.version;
9353
+ const relativePublishedAt = ((_b = latestVersionInfo.tinacms) == null ? void 0 : _b.publishedAt) ? formatDistanceToNow(new Date((_c = latestVersionInfo.tinacms) == null ? void 0 : _c.publishedAt), {
9354
+ addSuffix: true
9355
+ }) : "";
9356
+ if (!latestVersion) {
9357
+ return null;
9358
+ }
9359
+ if (latestVersion === currentVersion) {
9360
+ return /* @__PURE__ */ React__default.createElement(Check, { className: "w-4 h-4 inline-block mb-px text-green-500" });
9361
+ }
9362
+ return /* @__PURE__ */ React__default.createElement("span", { className: "text-yellow-700" }, /* @__PURE__ */ React__default.createElement(TriangleAlert, { className: "w-4 h-4 inline-block mb-px" }), /* @__PURE__ */ React__default.createElement("br", null), "v", latestVersion, " published ", relativePublishedAt);
9363
+ };
8651
9364
  function TbLogs(props) {
8652
9365
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 12h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 18h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 18h2" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 12h2" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 6h2" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 6h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 12h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 18h6" }, "child": [] }] })(props);
8653
9366
  }
@@ -8896,7 +9609,7 @@ const Nav = ({
8896
9609
  className: "text-lg py-2 first:pt-3 last:pb-3 whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400",
8897
9610
  cms
8898
9611
  }
8899
- ), /* @__PURE__ */ React.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-4 text-gray-500" }, "TinaCMS v", version))
9612
+ ), /* @__PURE__ */ React.createElement(VersionInfo, null))
8900
9613
  ), eventsOpen && /* @__PURE__ */ React.createElement(
8901
9614
  SyncStatusModal,
8902
9615
  {
@@ -31022,6 +31735,22 @@ mutation addPendingDocumentMutation(
31022
31735
  throw error;
31023
31736
  }
31024
31737
  }
31738
+ async getLatestVersion() {
31739
+ const url = "https://content.tinajs.io/latest-version";
31740
+ try {
31741
+ const res = await fetch(url, {
31742
+ method: "GET"
31743
+ });
31744
+ if (!res.ok) {
31745
+ throw new Error(`Failed to fetch latest version: ${res.statusText}`);
31746
+ }
31747
+ const data = await res.json();
31748
+ return data;
31749
+ } catch (error) {
31750
+ console.error("Error fetching latest version:", error);
31751
+ throw error;
31752
+ }
31753
+ }
31025
31754
  }
31026
31755
  const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
31027
31756
  class LocalClient extends Client {
@@ -32705,11 +33434,11 @@ const useCollectionFolder = () => {
32705
33434
  });
32706
33435
  const loc = useLocation();
32707
33436
  useEffect(() => {
32708
- const match = loc.pathname.match(folderRegex);
32709
- const folderName = match ? decodeURIComponent(match[1]) : "";
33437
+ const match2 = loc.pathname.match(folderRegex);
33438
+ const folderName = match2 ? decodeURIComponent(match2[1]) : "";
32710
33439
  const update = {
32711
33440
  name: folderName,
32712
- fullyQualifiedName: match ? folderName ? `~/${folderName}` : "~" : "",
33441
+ fullyQualifiedName: match2 ? folderName ? `~/${folderName}` : "~" : "",
32713
33442
  loading: false,
32714
33443
  parentName: ""
32715
33444
  };
@@ -33964,11 +34693,11 @@ const RenderForm$1 = ({
33964
34693
  }
33965
34694
  if (((_a2 = schemaCollection.match) == null ? void 0 : _a2.exclude) || ((_b2 = schemaCollection.match) == null ? void 0 : _b2.include)) {
33966
34695
  const filePath = `${normalizePath(schemaCollection.path)}/${value}.${schemaCollection.format || "md"}`;
33967
- const match = schema == null ? void 0 : schema.matchFiles({
34696
+ const match2 = schema == null ? void 0 : schema.matchFiles({
33968
34697
  files: [filePath],
33969
34698
  collection: schemaCollection
33970
34699
  });
33971
- if ((match == null ? void 0 : match.length) === 0) {
34700
+ if ((match2 == null ? void 0 : match2.length) === 0) {
33972
34701
  return `The filename "${value}" is not allowed for this collection.`;
33973
34702
  }
33974
34703
  }