tinacms 2.7.2 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/TinaCloudProvider.d.ts +1 -1
- package/dist/hooks/create-page-plugin.d.ts +1 -1
- package/dist/index.js +170 -137
- package/dist/index.mjs +169 -136
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -57,8 +57,8 @@ import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buil
|
|
|
57
57
|
import gql from "graphql-tag";
|
|
58
58
|
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
|
|
59
59
|
import { NAMER, resolveField } from "@tinacms/schema-tools";
|
|
60
|
-
import * as yup from "yup";
|
|
61
60
|
import { diff } from "@graphql-inspector/core";
|
|
61
|
+
import * as yup from "yup";
|
|
62
62
|
import { NavLink, useNavigate, useLocation, useParams, Link, useSearchParams, HashRouter, Routes, Route } from "react-router-dom";
|
|
63
63
|
import { stringifyMDX } from "@tinacms/mdx";
|
|
64
64
|
const ModalProvider = ({ children }) => {
|
|
@@ -5332,7 +5332,9 @@ const Combobox = ({ cms, input, field }) => {
|
|
|
5332
5332
|
}, [value, input, optionSets]);
|
|
5333
5333
|
React.useEffect(() => {
|
|
5334
5334
|
if (field.experimental___filter && optionSets.length > 0) {
|
|
5335
|
-
setFilteredOptionsList(
|
|
5335
|
+
setFilteredOptionsList(
|
|
5336
|
+
field.experimental___filter(optionSets, void 0)
|
|
5337
|
+
);
|
|
5336
5338
|
} else {
|
|
5337
5339
|
setFilteredOptionsList(optionSets);
|
|
5338
5340
|
}
|
|
@@ -5702,7 +5704,9 @@ const Item$2 = ({
|
|
|
5702
5704
|
onClick: () => {
|
|
5703
5705
|
const state = tinaForm.finalForm.getState();
|
|
5704
5706
|
if (state.invalid === true) {
|
|
5705
|
-
cms.alerts.error(
|
|
5707
|
+
cms.alerts.error(
|
|
5708
|
+
"Cannot navigate away from an invalid form."
|
|
5709
|
+
);
|
|
5706
5710
|
return;
|
|
5707
5711
|
}
|
|
5708
5712
|
cms.dispatch({
|
|
@@ -6286,7 +6290,9 @@ const BlockListItem = ({
|
|
|
6286
6290
|
onClick: () => {
|
|
6287
6291
|
const state = tinaForm.finalForm.getState();
|
|
6288
6292
|
if (state.invalid === true) {
|
|
6289
|
-
cms.alerts.error(
|
|
6293
|
+
cms.alerts.error(
|
|
6294
|
+
"Cannot navigate away from an invalid form."
|
|
6295
|
+
);
|
|
6290
6296
|
return;
|
|
6291
6297
|
}
|
|
6292
6298
|
cms.dispatch({
|
|
@@ -6768,28 +6774,28 @@ class DaysView extends React__default.Component {
|
|
|
6768
6774
|
}
|
|
6769
6775
|
renderDayHeaders() {
|
|
6770
6776
|
const locale = this.props.viewDate.localeData();
|
|
6771
|
-
|
|
6777
|
+
const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
|
|
6772
6778
|
return /* @__PURE__ */ React__default.createElement("tr", null, dayItems);
|
|
6773
6779
|
}
|
|
6774
6780
|
renderDays() {
|
|
6775
6781
|
const date = this.props.viewDate;
|
|
6776
6782
|
const startOfMonth = date.clone().startOf("month");
|
|
6777
6783
|
const endOfMonth = date.clone().endOf("month");
|
|
6778
|
-
|
|
6779
|
-
|
|
6784
|
+
const rows = [[], [], [], [], [], []];
|
|
6785
|
+
const startDate = date.clone().subtract(1, "months");
|
|
6780
6786
|
startDate.date(startDate.daysInMonth()).startOf("week");
|
|
6781
|
-
|
|
6787
|
+
const endDate = startDate.clone().add(42, "d");
|
|
6782
6788
|
let i = 0;
|
|
6783
6789
|
while (startDate.isBefore(endDate)) {
|
|
6784
|
-
|
|
6790
|
+
const row = getRow$2(rows, i++);
|
|
6785
6791
|
row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
|
|
6786
6792
|
startDate.add(1, "d");
|
|
6787
6793
|
}
|
|
6788
6794
|
return rows.map((r, i2) => /* @__PURE__ */ React__default.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
|
|
6789
6795
|
}
|
|
6790
6796
|
renderDay(date, startOfMonth, endOfMonth) {
|
|
6791
|
-
|
|
6792
|
-
|
|
6797
|
+
const selectedDate = this.props.selectedDate;
|
|
6798
|
+
const dayProps = {
|
|
6793
6799
|
key: date.format("M_D"),
|
|
6794
6800
|
"data-value": date.date(),
|
|
6795
6801
|
"data-month": date.month(),
|
|
@@ -6843,7 +6849,7 @@ function getRow$2(rows, day) {
|
|
|
6843
6849
|
}
|
|
6844
6850
|
function getDaysOfWeek(locale) {
|
|
6845
6851
|
const first = locale.firstDayOfWeek();
|
|
6846
|
-
|
|
6852
|
+
const dow = [];
|
|
6847
6853
|
let i = 0;
|
|
6848
6854
|
locale._weekdaysMin.forEach(function(day) {
|
|
6849
6855
|
dow[(7 + i++ - first) % 7] = day;
|
|
@@ -6861,7 +6867,7 @@ class MonthsView extends React__default.Component {
|
|
|
6861
6867
|
return /* @__PURE__ */ React__default.createElement("div", { className: "rdtMonths" }, /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("thead", null, this.renderNavigation())), /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("tbody", null, this.renderMonths())));
|
|
6862
6868
|
}
|
|
6863
6869
|
renderNavigation() {
|
|
6864
|
-
|
|
6870
|
+
const year = this.props.viewDate.year();
|
|
6865
6871
|
return /* @__PURE__ */ React__default.createElement(
|
|
6866
6872
|
ViewNavigation,
|
|
6867
6873
|
{
|
|
@@ -6874,9 +6880,9 @@ class MonthsView extends React__default.Component {
|
|
|
6874
6880
|
);
|
|
6875
6881
|
}
|
|
6876
6882
|
renderMonths() {
|
|
6877
|
-
|
|
6883
|
+
const rows = [[], [], []];
|
|
6878
6884
|
for (let month = 0; month < 12; month++) {
|
|
6879
|
-
|
|
6885
|
+
const row = getRow$1(rows, month);
|
|
6880
6886
|
row.push(this.renderMonth(month));
|
|
6881
6887
|
}
|
|
6882
6888
|
return rows.map((months, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, months));
|
|
@@ -6893,7 +6899,7 @@ class MonthsView extends React__default.Component {
|
|
|
6893
6899
|
if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
|
|
6894
6900
|
className += " rdtActive";
|
|
6895
6901
|
}
|
|
6896
|
-
|
|
6902
|
+
const props = { key: month, className, "data-value": month, onClick };
|
|
6897
6903
|
if (this.props.renderMonth) {
|
|
6898
6904
|
return this.props.renderMonth(
|
|
6899
6905
|
props,
|
|
@@ -6905,11 +6911,11 @@ class MonthsView extends React__default.Component {
|
|
|
6905
6911
|
return /* @__PURE__ */ React__default.createElement("td", { ...props }, this.getMonthText(month));
|
|
6906
6912
|
}
|
|
6907
6913
|
isDisabledMonth(month) {
|
|
6908
|
-
|
|
6914
|
+
const isValidDate = this.props.isValidDate;
|
|
6909
6915
|
if (!isValidDate) {
|
|
6910
6916
|
return false;
|
|
6911
6917
|
}
|
|
6912
|
-
|
|
6918
|
+
const date = this.props.viewDate.clone().set({ month });
|
|
6913
6919
|
let day = date.endOf("month").date() + 1;
|
|
6914
6920
|
while (day-- > 1) {
|
|
6915
6921
|
if (isValidDate(date.date(day))) {
|
|
@@ -6961,9 +6967,9 @@ class YearsView extends React__default.Component {
|
|
|
6961
6967
|
}
|
|
6962
6968
|
renderYears() {
|
|
6963
6969
|
const viewYear = this.getViewYear();
|
|
6964
|
-
|
|
6970
|
+
const rows = [[], [], []];
|
|
6965
6971
|
for (let year = viewYear - 1; year < viewYear + 11; year++) {
|
|
6966
|
-
|
|
6972
|
+
const row = getRow(rows, year - viewYear);
|
|
6967
6973
|
row.push(this.renderYear(year));
|
|
6968
6974
|
}
|
|
6969
6975
|
return rows.map((years, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, years));
|
|
@@ -6980,7 +6986,7 @@ class YearsView extends React__default.Component {
|
|
|
6980
6986
|
if (selectedYear === year) {
|
|
6981
6987
|
className += " rdtActive";
|
|
6982
6988
|
}
|
|
6983
|
-
|
|
6989
|
+
const props = { key: year, className, "data-value": year, onClick };
|
|
6984
6990
|
return this.props.renderYear(
|
|
6985
6991
|
props,
|
|
6986
6992
|
year,
|
|
@@ -6994,15 +7000,15 @@ class YearsView extends React__default.Component {
|
|
|
6994
7000
|
return this.props.selectedDate && this.props.selectedDate.year();
|
|
6995
7001
|
}
|
|
6996
7002
|
isDisabledYear(year) {
|
|
6997
|
-
|
|
7003
|
+
const cache = this.disabledYearsCache;
|
|
6998
7004
|
if (cache[year] !== void 0) {
|
|
6999
7005
|
return cache[year];
|
|
7000
7006
|
}
|
|
7001
|
-
|
|
7007
|
+
const isValidDate = this.props.isValidDate;
|
|
7002
7008
|
if (!isValidDate) {
|
|
7003
7009
|
return false;
|
|
7004
7010
|
}
|
|
7005
|
-
|
|
7011
|
+
const date = this.props.viewDate.clone().set({ year });
|
|
7006
7012
|
let day = date.endOf("year").dayOfYear() + 1;
|
|
7007
7013
|
while (day-- > 1) {
|
|
7008
7014
|
if (isValidDate(date.dayOfYear(day))) {
|
|
@@ -7049,7 +7055,7 @@ const timeConstraints = {
|
|
|
7049
7055
|
}
|
|
7050
7056
|
};
|
|
7051
7057
|
function createConstraints(overrideTimeConstraints) {
|
|
7052
|
-
|
|
7058
|
+
const constraints = {};
|
|
7053
7059
|
Object.keys(timeConstraints).forEach((type) => {
|
|
7054
7060
|
constraints[type] = {
|
|
7055
7061
|
...timeConstraints[type],
|
|
@@ -7065,7 +7071,7 @@ class TimeView extends React__default.Component {
|
|
|
7065
7071
|
this.state = this.getTimeParts(props.selectedDate || props.viewDate);
|
|
7066
7072
|
}
|
|
7067
7073
|
render() {
|
|
7068
|
-
|
|
7074
|
+
const items2 = [];
|
|
7069
7075
|
const timeParts = this.state;
|
|
7070
7076
|
this.getCounters().forEach((c, i) => {
|
|
7071
7077
|
if (i && c !== "ampm") {
|
|
@@ -7127,8 +7133,8 @@ class TimeView extends React__default.Component {
|
|
|
7127
7133
|
}
|
|
7128
7134
|
if (type === "ampm")
|
|
7129
7135
|
return this.toggleDayPart();
|
|
7130
|
-
|
|
7131
|
-
|
|
7136
|
+
const update = {};
|
|
7137
|
+
const body = document.body;
|
|
7132
7138
|
update[type] = this[action](type);
|
|
7133
7139
|
this.setState(update);
|
|
7134
7140
|
this.timer = setTimeout(() => {
|
|
@@ -7171,8 +7177,8 @@ class TimeView extends React__default.Component {
|
|
|
7171
7177
|
return pad(type, value);
|
|
7172
7178
|
}
|
|
7173
7179
|
getCounters() {
|
|
7174
|
-
|
|
7175
|
-
|
|
7180
|
+
const counters = [];
|
|
7181
|
+
const format2 = this.props.timeFormat;
|
|
7176
7182
|
if (format2.toLowerCase().indexOf("h") !== -1) {
|
|
7177
7183
|
counters.push("hours");
|
|
7178
7184
|
if (format2.indexOf("m") !== -1) {
|
|
@@ -7304,7 +7310,7 @@ class Datetime extends React__default.Component {
|
|
|
7304
7310
|
__publicField(this, "_renderCalendar", () => {
|
|
7305
7311
|
const props = this.props;
|
|
7306
7312
|
const state = this.state;
|
|
7307
|
-
|
|
7313
|
+
const viewProps = {
|
|
7308
7314
|
viewDate: state.viewDate.clone(),
|
|
7309
7315
|
selectedDate: this.getSelectedDate(),
|
|
7310
7316
|
isValidDate: props.isValidDate,
|
|
@@ -7347,10 +7353,10 @@ class Datetime extends React__default.Component {
|
|
|
7347
7353
|
__publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
|
|
7348
7354
|
__publicField(this, "nextView", { days: "time", months: "days", years: "months" });
|
|
7349
7355
|
__publicField(this, "_updateDate", (e) => {
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7356
|
+
const state = this.state;
|
|
7357
|
+
const currentView = state.currentView;
|
|
7358
|
+
const updateOnView = this.getUpdateOn(this.getFormat("date"));
|
|
7359
|
+
const viewDate = this.state.viewDate.clone();
|
|
7354
7360
|
viewDate[this.viewToMethod[currentView]](
|
|
7355
7361
|
parseInt(e.target.getAttribute("data-value"), 10)
|
|
7356
7362
|
);
|
|
@@ -7358,7 +7364,7 @@ class Datetime extends React__default.Component {
|
|
|
7358
7364
|
viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
|
|
7359
7365
|
viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
|
|
7360
7366
|
}
|
|
7361
|
-
|
|
7367
|
+
const update = { viewDate };
|
|
7362
7368
|
if (currentView === updateOnView) {
|
|
7363
7369
|
update.selectedDate = viewDate.clone();
|
|
7364
7370
|
update.inputValue = viewDate.format(this.getFormat("datetime"));
|
|
@@ -7372,7 +7378,7 @@ class Datetime extends React__default.Component {
|
|
|
7372
7378
|
this.setState(update);
|
|
7373
7379
|
});
|
|
7374
7380
|
__publicField(this, "_viewNavigate", (modifier, unit) => {
|
|
7375
|
-
|
|
7381
|
+
const viewDate = this.state.viewDate.clone();
|
|
7376
7382
|
viewDate.add(modifier, unit);
|
|
7377
7383
|
if (modifier > 0) {
|
|
7378
7384
|
this.props.onNavigateForward(modifier, unit);
|
|
@@ -7382,7 +7388,7 @@ class Datetime extends React__default.Component {
|
|
|
7382
7388
|
this.setState({ viewDate });
|
|
7383
7389
|
});
|
|
7384
7390
|
__publicField(this, "_setTime", (type, value) => {
|
|
7385
|
-
|
|
7391
|
+
const date = (this.getSelectedDate() || this.state.viewDate).clone();
|
|
7386
7392
|
date[type](value);
|
|
7387
7393
|
if (!this.props.value) {
|
|
7388
7394
|
this.setState({
|
|
@@ -7406,7 +7412,7 @@ class Datetime extends React__default.Component {
|
|
|
7406
7412
|
});
|
|
7407
7413
|
});
|
|
7408
7414
|
__publicField(this, "_handleClickOutside", () => {
|
|
7409
|
-
|
|
7415
|
+
const props = this.props;
|
|
7410
7416
|
if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
|
|
7411
7417
|
this._closeCalendar();
|
|
7412
7418
|
}
|
|
@@ -7421,7 +7427,7 @@ class Datetime extends React__default.Component {
|
|
|
7421
7427
|
return;
|
|
7422
7428
|
const value = e.target ? e.target.value : e;
|
|
7423
7429
|
const localMoment = this.localMoment(value, this.getFormat("datetime"));
|
|
7424
|
-
|
|
7430
|
+
const update = { inputValue: value };
|
|
7425
7431
|
if (localMoment.isValid()) {
|
|
7426
7432
|
update.selectedDate = localMoment;
|
|
7427
7433
|
update.viewDate = localMoment.clone().startOf("month");
|
|
@@ -7485,9 +7491,9 @@ class Datetime extends React__default.Component {
|
|
|
7485
7491
|
return this.props.renderView(this.state.currentView, this._renderCalendar);
|
|
7486
7492
|
}
|
|
7487
7493
|
getInitialState() {
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7494
|
+
const props = this.props;
|
|
7495
|
+
const inputFormat = this.getFormat("datetime");
|
|
7496
|
+
const selectedDate = this.parseDate(
|
|
7491
7497
|
props.value || props.initialValue,
|
|
7492
7498
|
inputFormat
|
|
7493
7499
|
);
|
|
@@ -7518,7 +7524,7 @@ class Datetime extends React__default.Component {
|
|
|
7518
7524
|
return this.getInitialDate();
|
|
7519
7525
|
}
|
|
7520
7526
|
getInitialDate() {
|
|
7521
|
-
|
|
7527
|
+
const m = this.localMoment();
|
|
7522
7528
|
m.hour(0).minute(0).second(0).millisecond(0);
|
|
7523
7529
|
return m;
|
|
7524
7530
|
}
|
|
@@ -7538,8 +7544,8 @@ class Datetime extends React__default.Component {
|
|
|
7538
7544
|
}
|
|
7539
7545
|
getClassName() {
|
|
7540
7546
|
let cn2 = "rdt";
|
|
7541
|
-
|
|
7542
|
-
|
|
7547
|
+
const props = this.props;
|
|
7548
|
+
const propCn = props.className;
|
|
7543
7549
|
if (Array.isArray(propCn)) {
|
|
7544
7550
|
cn2 += " " + propCn.join(" ");
|
|
7545
7551
|
} else if (propCn) {
|
|
@@ -7572,14 +7578,14 @@ class Datetime extends React__default.Component {
|
|
|
7572
7578
|
return viewModes.DAYS;
|
|
7573
7579
|
}
|
|
7574
7580
|
getLocaleData() {
|
|
7575
|
-
|
|
7581
|
+
const p = this.props;
|
|
7576
7582
|
return this.localMoment(
|
|
7577
7583
|
p.value || p.defaultValue || /* @__PURE__ */ new Date()
|
|
7578
7584
|
).localeData();
|
|
7579
7585
|
}
|
|
7580
7586
|
getDateFormat() {
|
|
7581
7587
|
const locale = this.getLocaleData();
|
|
7582
|
-
|
|
7588
|
+
const format2 = this.props.dateFormat;
|
|
7583
7589
|
if (format2 === true)
|
|
7584
7590
|
return locale.longDateFormat("L");
|
|
7585
7591
|
if (format2)
|
|
@@ -7588,7 +7594,7 @@ class Datetime extends React__default.Component {
|
|
|
7588
7594
|
}
|
|
7589
7595
|
getTimeFormat() {
|
|
7590
7596
|
const locale = this.getLocaleData();
|
|
7591
|
-
|
|
7597
|
+
const format2 = this.props.timeFormat;
|
|
7592
7598
|
if (format2 === true) {
|
|
7593
7599
|
return locale.longDateFormat("LT");
|
|
7594
7600
|
}
|
|
@@ -7600,12 +7606,12 @@ class Datetime extends React__default.Component {
|
|
|
7600
7606
|
} else if (type === "time") {
|
|
7601
7607
|
return this.getTimeFormat();
|
|
7602
7608
|
}
|
|
7603
|
-
|
|
7604
|
-
|
|
7609
|
+
const dateFormat = this.getDateFormat();
|
|
7610
|
+
const timeFormat = this.getTimeFormat();
|
|
7605
7611
|
return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
|
|
7606
7612
|
}
|
|
7607
7613
|
updateTime(op, amount, type, toSelected) {
|
|
7608
|
-
|
|
7614
|
+
const update = {};
|
|
7609
7615
|
const date = toSelected ? "selectedDate" : "viewDate";
|
|
7610
7616
|
update[date] = this.state[date].clone()[op](amount, type);
|
|
7611
7617
|
this.setState(update);
|
|
@@ -7638,7 +7644,7 @@ class Datetime extends React__default.Component {
|
|
|
7638
7644
|
if (prevProps === this.props)
|
|
7639
7645
|
return;
|
|
7640
7646
|
let needsUpdate = false;
|
|
7641
|
-
|
|
7647
|
+
const thisProps = this.props;
|
|
7642
7648
|
["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
|
|
7643
7649
|
function(p) {
|
|
7644
7650
|
prevProps[p] !== thisProps[p] && (needsUpdate = true);
|
|
@@ -7654,8 +7660,8 @@ class Datetime extends React__default.Component {
|
|
|
7654
7660
|
}
|
|
7655
7661
|
regenerateDates() {
|
|
7656
7662
|
const props = this.props;
|
|
7657
|
-
|
|
7658
|
-
|
|
7663
|
+
const viewDate = this.state.viewDate.clone();
|
|
7664
|
+
const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
|
|
7659
7665
|
if (props.locale) {
|
|
7660
7666
|
viewDate.locale(props.locale);
|
|
7661
7667
|
selectedDate && selectedDate.locale(props.locale);
|
|
@@ -7670,7 +7676,7 @@ class Datetime extends React__default.Component {
|
|
|
7670
7676
|
viewDate.locale();
|
|
7671
7677
|
selectedDate && selectedDate.locale();
|
|
7672
7678
|
}
|
|
7673
|
-
|
|
7679
|
+
const update = { viewDate, selectedDate };
|
|
7674
7680
|
if (selectedDate && selectedDate.isValid()) {
|
|
7675
7681
|
update.inputValue = selectedDate.format(this.getFormat("datetime"));
|
|
7676
7682
|
}
|
|
@@ -7679,7 +7685,7 @@ class Datetime extends React__default.Component {
|
|
|
7679
7685
|
getSelectedDate() {
|
|
7680
7686
|
if (this.props.value === void 0)
|
|
7681
7687
|
return this.state.selectedDate;
|
|
7682
|
-
|
|
7688
|
+
const selectedDate = this.parseDate(
|
|
7683
7689
|
this.props.value,
|
|
7684
7690
|
this.getFormat("datetime")
|
|
7685
7691
|
);
|
|
@@ -7698,7 +7704,7 @@ class Datetime extends React__default.Component {
|
|
|
7698
7704
|
return "";
|
|
7699
7705
|
}
|
|
7700
7706
|
getInputValue() {
|
|
7701
|
-
|
|
7707
|
+
const selectedDate = this.getSelectedDate();
|
|
7702
7708
|
return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
|
|
7703
7709
|
}
|
|
7704
7710
|
/**
|
|
@@ -7708,7 +7714,7 @@ class Datetime extends React__default.Component {
|
|
|
7708
7714
|
* @public
|
|
7709
7715
|
*/
|
|
7710
7716
|
setViewDate(date) {
|
|
7711
|
-
|
|
7717
|
+
const logError = function() {
|
|
7712
7718
|
return log("Invalid date passed to the `setViewDate` method: " + date);
|
|
7713
7719
|
};
|
|
7714
7720
|
if (!date)
|
|
@@ -7804,7 +7810,7 @@ __publicField(Datetime, "defaultProps", {
|
|
|
7804
7810
|
// Make moment accessible through the Datetime class
|
|
7805
7811
|
__publicField(Datetime, "moment", moment);
|
|
7806
7812
|
function log(message, method) {
|
|
7807
|
-
|
|
7813
|
+
const con = typeof window !== "undefined" && window.console;
|
|
7808
7814
|
if (!con)
|
|
7809
7815
|
return;
|
|
7810
7816
|
if (!method) {
|
|
@@ -8627,7 +8633,10 @@ const BranchSelector = ({
|
|
|
8627
8633
|
label: "View in GitHub",
|
|
8628
8634
|
Icon: /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
|
|
8629
8635
|
onMouseDown: () => {
|
|
8630
|
-
window.open(
|
|
8636
|
+
window.open(
|
|
8637
|
+
branch.githubPullRequestUrl,
|
|
8638
|
+
"_blank"
|
|
8639
|
+
);
|
|
8631
8640
|
}
|
|
8632
8641
|
},
|
|
8633
8642
|
typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
|
|
@@ -8933,7 +8942,9 @@ class EventBus {
|
|
|
8933
8942
|
} else {
|
|
8934
8943
|
events = event;
|
|
8935
8944
|
}
|
|
8936
|
-
const newListeners = events.map(
|
|
8945
|
+
const newListeners = events.map(
|
|
8946
|
+
(event2) => new Listener(event2, callback)
|
|
8947
|
+
);
|
|
8937
8948
|
newListeners.forEach((newListener) => this.listeners.add(newListener));
|
|
8938
8949
|
return () => {
|
|
8939
8950
|
newListeners.forEach((listener) => this.listeners.delete(listener));
|
|
@@ -9289,9 +9300,7 @@ class TinaMediaStore {
|
|
|
9289
9300
|
const deleteStartTime = Date.now();
|
|
9290
9301
|
while (true) {
|
|
9291
9302
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
9292
|
-
const { error, message } = await this.api.getRequestStatus(
|
|
9293
|
-
requestId
|
|
9294
|
-
);
|
|
9303
|
+
const { error, message } = await this.api.getRequestStatus(requestId);
|
|
9295
9304
|
if (error !== void 0) {
|
|
9296
9305
|
if (error) {
|
|
9297
9306
|
throw new Error(message);
|
|
@@ -10220,7 +10229,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10220
10229
|
"Event Log"
|
|
10221
10230
|
));
|
|
10222
10231
|
};
|
|
10223
|
-
const version = "2.7.
|
|
10232
|
+
const version = "2.7.3";
|
|
10224
10233
|
const Nav = ({
|
|
10225
10234
|
isLocalMode,
|
|
10226
10235
|
className = "",
|
|
@@ -11446,7 +11455,10 @@ function MediaPicker({
|
|
|
11446
11455
|
const observer = new IntersectionObserver((entries) => {
|
|
11447
11456
|
const target = entries[0];
|
|
11448
11457
|
if (target.isIntersecting && list.nextOffset) {
|
|
11449
|
-
setOffsetHistory((offsetHistory2) => [
|
|
11458
|
+
setOffsetHistory((offsetHistory2) => [
|
|
11459
|
+
...offsetHistory2,
|
|
11460
|
+
list.nextOffset
|
|
11461
|
+
]);
|
|
11450
11462
|
}
|
|
11451
11463
|
});
|
|
11452
11464
|
if (loaderRef.current) {
|
|
@@ -12410,7 +12422,9 @@ const ActiveFieldIndicator = () => {
|
|
|
12410
12422
|
if (activeEle) {
|
|
12411
12423
|
setDisplay(true);
|
|
12412
12424
|
setPosition(activeEle.getBoundingClientRect());
|
|
12413
|
-
const iframe = document.getElementById(
|
|
12425
|
+
const iframe = document.getElementById(
|
|
12426
|
+
"tina-iframe"
|
|
12427
|
+
);
|
|
12414
12428
|
if (iframe) {
|
|
12415
12429
|
setIframePosition(iframe.getBoundingClientRect());
|
|
12416
12430
|
}
|
|
@@ -13028,7 +13042,9 @@ const ImgEmbed = ({
|
|
|
13028
13042
|
const { fieldName } = useTemplates();
|
|
13029
13043
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13030
13044
|
useHotkey("enter", () => {
|
|
13031
|
-
insertNodes(editor, [
|
|
13045
|
+
insertNodes(editor, [
|
|
13046
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13047
|
+
]);
|
|
13032
13048
|
});
|
|
13033
13049
|
return /* @__PURE__ */ React__default.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React__default.createElement(
|
|
13034
13050
|
"div",
|
|
@@ -13171,7 +13187,9 @@ const InlineEmbed = ({
|
|
|
13171
13187
|
const { templates, fieldName } = useTemplates();
|
|
13172
13188
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13173
13189
|
useHotkey("enter", () => {
|
|
13174
|
-
insertNodes(editor, [
|
|
13190
|
+
insertNodes(editor, [
|
|
13191
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13192
|
+
]);
|
|
13175
13193
|
});
|
|
13176
13194
|
useHotkey("space", () => {
|
|
13177
13195
|
insertNodes(editor, [{ text: " " }], {
|
|
@@ -13227,7 +13245,9 @@ const BlockEmbed = ({
|
|
|
13227
13245
|
const { templates, fieldName } = useTemplates();
|
|
13228
13246
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13229
13247
|
useHotkey("enter", () => {
|
|
13230
|
-
insertNodes(editor, [
|
|
13248
|
+
insertNodes(editor, [
|
|
13249
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13250
|
+
]);
|
|
13231
13251
|
});
|
|
13232
13252
|
const activeTemplate = templates.find(
|
|
13233
13253
|
(template) => template.name === element.name
|
|
@@ -14086,7 +14106,9 @@ const EMBED_ICON_WIDTH = 78;
|
|
|
14086
14106
|
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14087
14107
|
const FLOAT_BUTTON_WIDTH = 25;
|
|
14088
14108
|
const HEADING_LABEL = "Headings";
|
|
14089
|
-
const ToolbarContext = createContext(
|
|
14109
|
+
const ToolbarContext = createContext(
|
|
14110
|
+
void 0
|
|
14111
|
+
);
|
|
14090
14112
|
const ToolbarProvider = ({
|
|
14091
14113
|
tinaForm,
|
|
14092
14114
|
templates,
|
|
@@ -30298,7 +30320,14 @@ const TINA_LOGIN_EVENT = "tinaCloudLogin";
|
|
|
30298
30320
|
const AUTH_TOKEN_KEY = "tinacms-auth";
|
|
30299
30321
|
const authenticate = (clientId, frontendUrl) => {
|
|
30300
30322
|
return new Promise((resolve) => {
|
|
30301
|
-
|
|
30323
|
+
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30324
|
+
const authTab = popupWindow(
|
|
30325
|
+
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30326
|
+
"_blank",
|
|
30327
|
+
window,
|
|
30328
|
+
1e3,
|
|
30329
|
+
700
|
|
30330
|
+
);
|
|
30302
30331
|
window.addEventListener("message", function(e) {
|
|
30303
30332
|
if (e.data.source === TINA_LOGIN_EVENT) {
|
|
30304
30333
|
if (authTab) {
|
|
@@ -30311,14 +30340,6 @@ const authenticate = (clientId, frontendUrl) => {
|
|
|
30311
30340
|
});
|
|
30312
30341
|
}
|
|
30313
30342
|
});
|
|
30314
|
-
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30315
|
-
authTab = popupWindow(
|
|
30316
|
-
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30317
|
-
"_blank",
|
|
30318
|
-
window,
|
|
30319
|
-
1e3,
|
|
30320
|
-
700
|
|
30321
|
-
);
|
|
30322
30343
|
});
|
|
30323
30344
|
};
|
|
30324
30345
|
const DefaultSessionProvider = ({
|
|
@@ -31024,56 +31045,6 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
31024
31045
|
!submitting && name
|
|
31025
31046
|
);
|
|
31026
31047
|
};
|
|
31027
|
-
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31028
|
-
const useTinaAuthRedirect = () => {
|
|
31029
|
-
useEffect(() => {
|
|
31030
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
31031
|
-
const config = {
|
|
31032
|
-
code: urlParams.get("code") || "",
|
|
31033
|
-
scope: urlParams.get("scope") || "email",
|
|
31034
|
-
state: urlParams.get("state")
|
|
31035
|
-
};
|
|
31036
|
-
if (!config.code) {
|
|
31037
|
-
return;
|
|
31038
|
-
}
|
|
31039
|
-
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31040
|
-
}, []);
|
|
31041
|
-
};
|
|
31042
|
-
const createClient = ({
|
|
31043
|
-
clientId,
|
|
31044
|
-
isLocalClient = true,
|
|
31045
|
-
branch,
|
|
31046
|
-
tinaioConfig,
|
|
31047
|
-
schema,
|
|
31048
|
-
apiUrl,
|
|
31049
|
-
tinaGraphQLVersion
|
|
31050
|
-
}) => {
|
|
31051
|
-
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31052
|
-
clientId: clientId || "",
|
|
31053
|
-
branch: branch || "main",
|
|
31054
|
-
tokenStorage: "LOCAL_STORAGE",
|
|
31055
|
-
tinaioConfig,
|
|
31056
|
-
schema,
|
|
31057
|
-
tinaGraphQLVersion
|
|
31058
|
-
});
|
|
31059
|
-
};
|
|
31060
|
-
function assertShape(value, yupSchema, errorMessage) {
|
|
31061
|
-
const shape = yupSchema(yup);
|
|
31062
|
-
try {
|
|
31063
|
-
shape.validateSync(value);
|
|
31064
|
-
} catch (e) {
|
|
31065
|
-
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31066
|
-
throw new Error(message);
|
|
31067
|
-
}
|
|
31068
|
-
}
|
|
31069
|
-
function safeAssertShape(value, yupSchema) {
|
|
31070
|
-
try {
|
|
31071
|
-
assertShape(value, yupSchema);
|
|
31072
|
-
return true;
|
|
31073
|
-
} catch (e) {
|
|
31074
|
-
return false;
|
|
31075
|
-
}
|
|
31076
|
-
}
|
|
31077
31048
|
class TinaAdminApi {
|
|
31078
31049
|
constructor(cms) {
|
|
31079
31050
|
var _a, _b, _c, _d;
|
|
@@ -31420,6 +31391,56 @@ class TinaAdminApi {
|
|
|
31420
31391
|
);
|
|
31421
31392
|
}
|
|
31422
31393
|
}
|
|
31394
|
+
const createClient = ({
|
|
31395
|
+
clientId,
|
|
31396
|
+
isLocalClient = true,
|
|
31397
|
+
branch,
|
|
31398
|
+
tinaioConfig,
|
|
31399
|
+
schema,
|
|
31400
|
+
apiUrl,
|
|
31401
|
+
tinaGraphQLVersion
|
|
31402
|
+
}) => {
|
|
31403
|
+
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31404
|
+
clientId: clientId || "",
|
|
31405
|
+
branch: branch || "main",
|
|
31406
|
+
tokenStorage: "LOCAL_STORAGE",
|
|
31407
|
+
tinaioConfig,
|
|
31408
|
+
schema,
|
|
31409
|
+
tinaGraphQLVersion
|
|
31410
|
+
});
|
|
31411
|
+
};
|
|
31412
|
+
function assertShape(value, yupSchema, errorMessage) {
|
|
31413
|
+
const shape = yupSchema(yup);
|
|
31414
|
+
try {
|
|
31415
|
+
shape.validateSync(value);
|
|
31416
|
+
} catch (e) {
|
|
31417
|
+
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31418
|
+
throw new Error(message);
|
|
31419
|
+
}
|
|
31420
|
+
}
|
|
31421
|
+
function safeAssertShape(value, yupSchema) {
|
|
31422
|
+
try {
|
|
31423
|
+
assertShape(value, yupSchema);
|
|
31424
|
+
return true;
|
|
31425
|
+
} catch (e) {
|
|
31426
|
+
return false;
|
|
31427
|
+
}
|
|
31428
|
+
}
|
|
31429
|
+
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31430
|
+
const useTinaAuthRedirect = () => {
|
|
31431
|
+
useEffect(() => {
|
|
31432
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
31433
|
+
const config = {
|
|
31434
|
+
code: urlParams.get("code") || "",
|
|
31435
|
+
scope: urlParams.get("scope") || "email",
|
|
31436
|
+
state: urlParams.get("state")
|
|
31437
|
+
};
|
|
31438
|
+
if (!config.code) {
|
|
31439
|
+
return;
|
|
31440
|
+
}
|
|
31441
|
+
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31442
|
+
}, []);
|
|
31443
|
+
};
|
|
31423
31444
|
function sleep(ms) {
|
|
31424
31445
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31425
31446
|
}
|
|
@@ -31756,6 +31777,9 @@ const TinaCloudProvider = (props) => {
|
|
|
31756
31777
|
cms.flags.set("branch-switcher", true);
|
|
31757
31778
|
client.usingEditorialWorkflow = true;
|
|
31758
31779
|
client.protectedBranches = project.protectedBranches;
|
|
31780
|
+
if (!project.metadata[currentBranch]) {
|
|
31781
|
+
setCurrentBranch(project.defaultBranch || "main");
|
|
31782
|
+
}
|
|
31759
31783
|
}
|
|
31760
31784
|
});
|
|
31761
31785
|
};
|
|
@@ -31768,7 +31792,7 @@ const TinaCloudProvider = (props) => {
|
|
|
31768
31792
|
}
|
|
31769
31793
|
});
|
|
31770
31794
|
return unsubscribe;
|
|
31771
|
-
}, [isTinaCloud, cms]);
|
|
31795
|
+
}, [currentBranch, isTinaCloud, cms]);
|
|
31772
31796
|
return /* @__PURE__ */ React__default.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React__default.createElement(
|
|
31773
31797
|
BranchDataProvider,
|
|
31774
31798
|
{
|
|
@@ -33087,7 +33111,9 @@ const CollectionListPage = () => {
|
|
|
33087
33111
|
safeSubmit: async () => {
|
|
33088
33112
|
try {
|
|
33089
33113
|
await admin.deleteDocument(vars);
|
|
33090
|
-
cms.alerts.info(
|
|
33114
|
+
cms.alerts.info(
|
|
33115
|
+
"Document was successfully deleted"
|
|
33116
|
+
);
|
|
33091
33117
|
reFetchCollection();
|
|
33092
33118
|
} catch (error) {
|
|
33093
33119
|
cms.alerts.warn(
|
|
@@ -33116,7 +33142,9 @@ const CollectionListPage = () => {
|
|
|
33116
33142
|
relativePath: vars.relativePath,
|
|
33117
33143
|
newRelativePath
|
|
33118
33144
|
});
|
|
33119
|
-
cms.alerts.info(
|
|
33145
|
+
cms.alerts.info(
|
|
33146
|
+
"Document was successfully renamed"
|
|
33147
|
+
);
|
|
33120
33148
|
reFetchCollection();
|
|
33121
33149
|
} catch (error) {
|
|
33122
33150
|
if (error.message.indexOf("has references")) {
|
|
@@ -33216,7 +33244,9 @@ const CollectionListPage = () => {
|
|
|
33216
33244
|
name: "sort",
|
|
33217
33245
|
value: sortKey,
|
|
33218
33246
|
onChange: (e) => {
|
|
33219
|
-
const val = JSON.parse(
|
|
33247
|
+
const val = JSON.parse(
|
|
33248
|
+
e.target.value
|
|
33249
|
+
);
|
|
33220
33250
|
setEndCursor("");
|
|
33221
33251
|
setPrevCursors([]);
|
|
33222
33252
|
window == null ? void 0 : window.localStorage.setItem(
|
|
@@ -34005,7 +34035,10 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
34005
34035
|
const fetchDocument = async () => {
|
|
34006
34036
|
if (api.isAuthenticated()) {
|
|
34007
34037
|
try {
|
|
34008
|
-
const response = await api.fetchDocument(
|
|
34038
|
+
const response = await api.fetchDocument(
|
|
34039
|
+
collectionName,
|
|
34040
|
+
relativePath2
|
|
34041
|
+
);
|
|
34009
34042
|
setDocument(response.document);
|
|
34010
34043
|
} catch (error2) {
|
|
34011
34044
|
cms.alerts.error(
|