tinacms 0.0.0-a4e58da-20250221000426 → 0.0.0-a577386-20250401050543
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/admin/components/GetCollection.d.ts +2 -2
- package/dist/auth/TinaCloudProvider.d.ts +1 -1
- package/dist/client.d.ts +1 -4
- package/dist/hooks/create-page-plugin.d.ts +1 -1
- package/dist/index.d.ts +1 -61
- package/dist/index.js +569 -437
- package/dist/index.mjs +570 -438
- package/dist/react.d.ts +1 -34
- package/dist/react.js +3 -0
- package/dist/react.mjs +3 -0
- package/dist/rich-text/index.d.ts +1 -142
- package/dist/rich-text/prism.d.ts +1 -10
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +17 -5
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
- package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +5 -4
- package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
- package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
- package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
- package/dist/toolkit/tina-state.d.ts +4 -0
- package/package.json +7 -7
- package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import React__default, { useState, useCallback, useEffect, useRef, createContext
|
|
|
10
10
|
import { createPortal } from "react-dom";
|
|
11
11
|
import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
|
|
12
12
|
import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createBasicMarksPlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createUnderlinePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
|
|
13
|
-
import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton,
|
|
13
|
+
import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, insertEmptyElement, useMarkToolbarButtonState, useMarkToolbarButton, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
|
|
14
14
|
import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
|
|
15
15
|
import { useSelected, useReadOnly, ReactEditor } from "slate-react";
|
|
16
16
|
import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
|
|
@@ -43,6 +43,7 @@ import { twMerge } from "tailwind-merge";
|
|
|
43
43
|
import { Command as Command$1 } from "cmdk";
|
|
44
44
|
import { isHotkey } from "is-hotkey";
|
|
45
45
|
import { Transforms, Element, Range, Path, Node, Editor as Editor$1 } from "slate";
|
|
46
|
+
import { useWindowWidth } from "@react-hook/window-size";
|
|
46
47
|
import get from "lodash.get";
|
|
47
48
|
import moment from "moment";
|
|
48
49
|
import { formatDistanceToNow } from "date-fns";
|
|
@@ -52,13 +53,12 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
|
52
53
|
import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragraph";
|
|
53
54
|
import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
|
|
54
55
|
import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
|
|
55
|
-
import { useWindowWidth } from "@react-hook/window-size";
|
|
56
56
|
import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buildSchema } from "graphql";
|
|
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);
|
|
@@ -9319,9 +9328,7 @@ class TinaMediaStore {
|
|
|
9319
9328
|
const encodeUrlIfNeeded = (url) => {
|
|
9320
9329
|
if (url) {
|
|
9321
9330
|
try {
|
|
9322
|
-
|
|
9323
|
-
parsed.pathname = parsed.pathname.split("/").filter((part) => part !== "").map(encodeURIComponent).join("/");
|
|
9324
|
-
return parsed.toString();
|
|
9331
|
+
return new URL(url).toString();
|
|
9325
9332
|
} catch (e) {
|
|
9326
9333
|
return url;
|
|
9327
9334
|
}
|
|
@@ -9628,7 +9635,7 @@ let Alerts$1 = class Alerts {
|
|
|
9628
9635
|
return this.add("error", message, timeout);
|
|
9629
9636
|
}
|
|
9630
9637
|
};
|
|
9631
|
-
const
|
|
9638
|
+
const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React.createElement(
|
|
9632
9639
|
"div",
|
|
9633
9640
|
{
|
|
9634
9641
|
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
@@ -9641,25 +9648,8 @@ const NoFormsPlaceholder = () => /* @__PURE__ */ React.createElement(
|
|
|
9641
9648
|
animationDuration: "150ms"
|
|
9642
9649
|
}
|
|
9643
9650
|
},
|
|
9644
|
-
/* @__PURE__ */ React.createElement(
|
|
9645
|
-
/* @__PURE__ */ React.createElement(
|
|
9646
|
-
/* @__PURE__ */ React.createElement("p", { className: "block" }, /* @__PURE__ */ React.createElement(
|
|
9647
|
-
Button$1,
|
|
9648
|
-
{
|
|
9649
|
-
href: "https://tina.io/docs/tinacms-context/",
|
|
9650
|
-
target: "_blank",
|
|
9651
|
-
as: "a"
|
|
9652
|
-
},
|
|
9653
|
-
/* @__PURE__ */ React.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
9654
|
-
" Contextual Editing"
|
|
9655
|
-
))
|
|
9656
|
-
);
|
|
9657
|
-
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
|
|
9658
|
-
"span",
|
|
9659
|
-
{
|
|
9660
|
-
className: `text-[24px] leading-none inline-block ${className}`,
|
|
9661
|
-
...props
|
|
9662
|
-
}
|
|
9651
|
+
/* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, "Please wait while TinaCMS", /* @__PURE__ */ React.createElement("br", null), "loads your content"),
|
|
9652
|
+
/* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
|
|
9663
9653
|
);
|
|
9664
9654
|
class SidebarState {
|
|
9665
9655
|
constructor(events, options = {}) {
|
|
@@ -9674,7 +9664,7 @@ class SidebarState {
|
|
|
9674
9664
|
};
|
|
9675
9665
|
this.position = options.position || "displace";
|
|
9676
9666
|
this.renderNav = options.renderNav || true;
|
|
9677
|
-
this.
|
|
9667
|
+
this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
|
|
9678
9668
|
if ((_a = options.buttons) == null ? void 0 : _a.save) {
|
|
9679
9669
|
this.buttons.save = options.buttons.save;
|
|
9680
9670
|
}
|
|
@@ -9748,238 +9738,6 @@ const ModalLayout = ({ children, name, close: close2, layout }) => {
|
|
|
9748
9738
|
children
|
|
9749
9739
|
)));
|
|
9750
9740
|
};
|
|
9751
|
-
const Item = ({
|
|
9752
|
-
item,
|
|
9753
|
-
depth,
|
|
9754
|
-
setActiveFormId
|
|
9755
|
-
}) => {
|
|
9756
|
-
const cms = useCMS();
|
|
9757
|
-
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
9758
|
-
const form = React.useMemo(
|
|
9759
|
-
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
9760
|
-
[item.formId]
|
|
9761
|
-
);
|
|
9762
|
-
return /* @__PURE__ */ React.createElement(
|
|
9763
|
-
"button",
|
|
9764
|
-
{
|
|
9765
|
-
type: "button",
|
|
9766
|
-
key: item.path,
|
|
9767
|
-
onClick: () => setActiveFormId(item.formId),
|
|
9768
|
-
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`
|
|
9769
|
-
},
|
|
9770
|
-
/* @__PURE__ */ React.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
|
|
9771
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
|
|
9772
|
-
);
|
|
9773
|
-
};
|
|
9774
|
-
const FormListItem = ({
|
|
9775
|
-
item,
|
|
9776
|
-
depth,
|
|
9777
|
-
setActiveFormId
|
|
9778
|
-
}) => {
|
|
9779
|
-
var _a;
|
|
9780
|
-
return /* @__PURE__ */ React.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
|
|
9781
|
-
if (subItem.type === "document") {
|
|
9782
|
-
return /* @__PURE__ */ React.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React.createElement(
|
|
9783
|
-
Item,
|
|
9784
|
-
{
|
|
9785
|
-
setActiveFormId,
|
|
9786
|
-
depth: depth + 1,
|
|
9787
|
-
item: subItem
|
|
9788
|
-
}
|
|
9789
|
-
));
|
|
9790
|
-
}
|
|
9791
|
-
})));
|
|
9792
|
-
};
|
|
9793
|
-
const FormLists = (props) => {
|
|
9794
|
-
const cms = useCMS();
|
|
9795
|
-
return /* @__PURE__ */ React.createElement(
|
|
9796
|
-
Transition,
|
|
9797
|
-
{
|
|
9798
|
-
appear: true,
|
|
9799
|
-
show: true,
|
|
9800
|
-
as: "div",
|
|
9801
|
-
enter: "transition-all ease-out duration-150",
|
|
9802
|
-
enterFrom: "opacity-0 -translate-x-1/2",
|
|
9803
|
-
enterTo: "opacity-100",
|
|
9804
|
-
leave: "transition-all ease-out duration-150",
|
|
9805
|
-
leaveFrom: "opacity-100",
|
|
9806
|
-
leaveTo: "opacity-0 -translate-x-1/2"
|
|
9807
|
-
},
|
|
9808
|
-
cms.state.formLists.map((formList, index) => /* @__PURE__ */ React.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React.createElement(
|
|
9809
|
-
FormList,
|
|
9810
|
-
{
|
|
9811
|
-
isEditing: props.isEditing,
|
|
9812
|
-
setActiveFormId: (id) => {
|
|
9813
|
-
cms.dispatch({ type: "forms:set-active-form-id", value: id });
|
|
9814
|
-
},
|
|
9815
|
-
formList
|
|
9816
|
-
}
|
|
9817
|
-
)))
|
|
9818
|
-
);
|
|
9819
|
-
};
|
|
9820
|
-
const FormList = (props) => {
|
|
9821
|
-
const cms = useCMS();
|
|
9822
|
-
const listItems = React.useMemo(() => {
|
|
9823
|
-
var _a;
|
|
9824
|
-
const orderedListItems = [];
|
|
9825
|
-
const globalItems = [];
|
|
9826
|
-
const topItems = [];
|
|
9827
|
-
props.formList.items.forEach((item) => {
|
|
9828
|
-
if (item.type === "document") {
|
|
9829
|
-
const form = cms.state.forms.find(
|
|
9830
|
-
({ tinaForm }) => tinaForm.id === item.formId
|
|
9831
|
-
);
|
|
9832
|
-
if (form.tinaForm.global) {
|
|
9833
|
-
globalItems.push(item);
|
|
9834
|
-
} else {
|
|
9835
|
-
orderedListItems.push(item);
|
|
9836
|
-
}
|
|
9837
|
-
} else {
|
|
9838
|
-
orderedListItems.push(item);
|
|
9839
|
-
}
|
|
9840
|
-
});
|
|
9841
|
-
if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
|
|
9842
|
-
topItems.push({ type: "list", label: "Documents" });
|
|
9843
|
-
}
|
|
9844
|
-
let extra = [];
|
|
9845
|
-
if (globalItems.length) {
|
|
9846
|
-
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
9847
|
-
}
|
|
9848
|
-
return [...topItems, ...orderedListItems, ...extra];
|
|
9849
|
-
}, [JSON.stringify(props.formList.items)]);
|
|
9850
|
-
return /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
9851
|
-
if (item.type === "list") {
|
|
9852
|
-
return /* @__PURE__ */ React.createElement(
|
|
9853
|
-
"div",
|
|
9854
|
-
{
|
|
9855
|
-
key: item.label,
|
|
9856
|
-
className: `relative group text-left w-full bg-white shadow-sm
|
|
9857
|
-
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"}`
|
|
9858
|
-
},
|
|
9859
|
-
/* @__PURE__ */ React.createElement(
|
|
9860
|
-
"span",
|
|
9861
|
-
{
|
|
9862
|
-
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
9863
|
-
},
|
|
9864
|
-
item.label
|
|
9865
|
-
)
|
|
9866
|
-
);
|
|
9867
|
-
}
|
|
9868
|
-
return /* @__PURE__ */ React.createElement(
|
|
9869
|
-
FormListItem,
|
|
9870
|
-
{
|
|
9871
|
-
setActiveFormId: (id) => props.setActiveFormId(id),
|
|
9872
|
-
key: item.formId,
|
|
9873
|
-
item,
|
|
9874
|
-
depth: 0
|
|
9875
|
-
}
|
|
9876
|
-
);
|
|
9877
|
-
})));
|
|
9878
|
-
};
|
|
9879
|
-
const FormsView = ({
|
|
9880
|
-
children
|
|
9881
|
-
}) => {
|
|
9882
|
-
const cms = useCMS$1();
|
|
9883
|
-
const { setFormIsPristine } = React.useContext(SidebarContext);
|
|
9884
|
-
const isMultiform = cms.state.forms.length > 1;
|
|
9885
|
-
const activeForm = cms.state.forms.find(
|
|
9886
|
-
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
9887
|
-
);
|
|
9888
|
-
const isEditing = !!activeForm;
|
|
9889
|
-
if (!cms.state.formLists.length) {
|
|
9890
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", children, " ");
|
|
9891
|
-
}
|
|
9892
|
-
if (isMultiform && !activeForm) {
|
|
9893
|
-
return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
|
|
9894
|
-
}
|
|
9895
|
-
const formMetas = cms.plugins.all("form:meta");
|
|
9896
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React.createElement(React.Fragment, { key: meta.name }, /* @__PURE__ */ React.createElement(meta.Component, null))), /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
9897
|
-
};
|
|
9898
|
-
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
9899
|
-
return /* @__PURE__ */ React.createElement(
|
|
9900
|
-
"div",
|
|
9901
|
-
{
|
|
9902
|
-
className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
|
|
9903
|
-
style: isEditing ? {
|
|
9904
|
-
transform: "none",
|
|
9905
|
-
animationName: "fly-in-left",
|
|
9906
|
-
animationDuration: "150ms",
|
|
9907
|
-
animationDelay: "0",
|
|
9908
|
-
animationIterationCount: 1,
|
|
9909
|
-
animationTimingFunction: "ease-out"
|
|
9910
|
-
} : {
|
|
9911
|
-
transform: "translate3d(100%, 0, 0)"
|
|
9912
|
-
}
|
|
9913
|
-
},
|
|
9914
|
-
children
|
|
9915
|
-
);
|
|
9916
|
-
};
|
|
9917
|
-
const MultiformFormHeader = ({
|
|
9918
|
-
activeForm
|
|
9919
|
-
}) => {
|
|
9920
|
-
const cms = useCMS$1();
|
|
9921
|
-
const { formIsPristine } = React.useContext(SidebarContext);
|
|
9922
|
-
return /* @__PURE__ */ React.createElement(
|
|
9923
|
-
"div",
|
|
9924
|
-
{
|
|
9925
|
-
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9926
|
-
},
|
|
9927
|
-
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
9928
|
-
"button",
|
|
9929
|
-
{
|
|
9930
|
-
type: "button",
|
|
9931
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9932
|
-
onClick: () => {
|
|
9933
|
-
const state = activeForm.tinaForm.finalForm.getState();
|
|
9934
|
-
if (state.invalid === true) {
|
|
9935
|
-
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
9936
|
-
} else {
|
|
9937
|
-
cms.dispatch({ type: "forms:set-active-form-id", value: null });
|
|
9938
|
-
}
|
|
9939
|
-
}
|
|
9940
|
-
},
|
|
9941
|
-
/* @__PURE__ */ React.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9942
|
-
), /* @__PURE__ */ React.createElement(
|
|
9943
|
-
"button",
|
|
9944
|
-
{
|
|
9945
|
-
type: "button",
|
|
9946
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9947
|
-
onClick: () => {
|
|
9948
|
-
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9949
|
-
cms.state.activeFormId
|
|
9950
|
-
).name;
|
|
9951
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9952
|
-
}
|
|
9953
|
-
},
|
|
9954
|
-
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9955
|
-
), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9956
|
-
);
|
|
9957
|
-
};
|
|
9958
|
-
const FormHeader = ({ activeForm }) => {
|
|
9959
|
-
const { formIsPristine } = React.useContext(SidebarContext);
|
|
9960
|
-
const cms = useCMS$1();
|
|
9961
|
-
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
9962
|
-
return /* @__PURE__ */ React.createElement(
|
|
9963
|
-
"div",
|
|
9964
|
-
{
|
|
9965
|
-
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9966
|
-
},
|
|
9967
|
-
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
9968
|
-
"button",
|
|
9969
|
-
{
|
|
9970
|
-
type: "button",
|
|
9971
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9972
|
-
onClick: () => {
|
|
9973
|
-
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9974
|
-
cms.state.activeFormId
|
|
9975
|
-
).name;
|
|
9976
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9977
|
-
}
|
|
9978
|
-
},
|
|
9979
|
-
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9980
|
-
), shortFormLabel && /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9981
|
-
);
|
|
9982
|
-
};
|
|
9983
9741
|
function ImFilesEmpty(props) {
|
|
9984
9742
|
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);
|
|
9985
9743
|
}
|
|
@@ -10222,7 +9980,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10222
9980
|
"Event Log"
|
|
10223
9981
|
));
|
|
10224
9982
|
};
|
|
10225
|
-
const version = "2.7.
|
|
9983
|
+
const version = "2.7.4";
|
|
10226
9984
|
const Nav = ({
|
|
10227
9985
|
isLocalMode,
|
|
10228
9986
|
className = "",
|
|
@@ -10464,6 +10222,293 @@ const ResizeHandle = () => {
|
|
|
10464
10222
|
/* @__PURE__ */ React.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" })
|
|
10465
10223
|
);
|
|
10466
10224
|
};
|
|
10225
|
+
const Item = ({
|
|
10226
|
+
item,
|
|
10227
|
+
depth,
|
|
10228
|
+
setActiveFormId
|
|
10229
|
+
}) => {
|
|
10230
|
+
const cms = useCMS();
|
|
10231
|
+
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
10232
|
+
const form = React.useMemo(
|
|
10233
|
+
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
10234
|
+
[item.formId]
|
|
10235
|
+
);
|
|
10236
|
+
return /* @__PURE__ */ React.createElement(
|
|
10237
|
+
"button",
|
|
10238
|
+
{
|
|
10239
|
+
type: "button",
|
|
10240
|
+
key: item.path,
|
|
10241
|
+
onClick: () => setActiveFormId(item.formId),
|
|
10242
|
+
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`
|
|
10243
|
+
},
|
|
10244
|
+
/* @__PURE__ */ React.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
|
|
10245
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
|
|
10246
|
+
);
|
|
10247
|
+
};
|
|
10248
|
+
const FormListItem = ({
|
|
10249
|
+
item,
|
|
10250
|
+
depth,
|
|
10251
|
+
setActiveFormId
|
|
10252
|
+
}) => {
|
|
10253
|
+
var _a;
|
|
10254
|
+
return /* @__PURE__ */ React.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
|
|
10255
|
+
if (subItem.type === "document") {
|
|
10256
|
+
return /* @__PURE__ */ React.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React.createElement(
|
|
10257
|
+
Item,
|
|
10258
|
+
{
|
|
10259
|
+
setActiveFormId,
|
|
10260
|
+
depth: depth + 1,
|
|
10261
|
+
item: subItem
|
|
10262
|
+
}
|
|
10263
|
+
));
|
|
10264
|
+
}
|
|
10265
|
+
})));
|
|
10266
|
+
};
|
|
10267
|
+
const FormLists = (props) => {
|
|
10268
|
+
const cms = useCMS();
|
|
10269
|
+
return /* @__PURE__ */ React.createElement(
|
|
10270
|
+
Transition,
|
|
10271
|
+
{
|
|
10272
|
+
appear: true,
|
|
10273
|
+
show: true,
|
|
10274
|
+
as: "div",
|
|
10275
|
+
enter: "transition-all ease-out duration-150",
|
|
10276
|
+
enterFrom: "opacity-0 -translate-x-1/2",
|
|
10277
|
+
enterTo: "opacity-100",
|
|
10278
|
+
leave: "transition-all ease-out duration-150",
|
|
10279
|
+
leaveFrom: "opacity-100",
|
|
10280
|
+
leaveTo: "opacity-0 -translate-x-1/2"
|
|
10281
|
+
},
|
|
10282
|
+
cms.state.formLists.map((formList, index) => /* @__PURE__ */ React.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React.createElement(
|
|
10283
|
+
FormList,
|
|
10284
|
+
{
|
|
10285
|
+
isEditing: props.isEditing,
|
|
10286
|
+
setActiveFormId: (id) => {
|
|
10287
|
+
cms.dispatch({ type: "forms:set-active-form-id", value: id });
|
|
10288
|
+
},
|
|
10289
|
+
formList
|
|
10290
|
+
}
|
|
10291
|
+
)))
|
|
10292
|
+
);
|
|
10293
|
+
};
|
|
10294
|
+
const FormList = (props) => {
|
|
10295
|
+
const cms = useCMS();
|
|
10296
|
+
const listItems = React.useMemo(() => {
|
|
10297
|
+
var _a;
|
|
10298
|
+
const orderedListItems = [];
|
|
10299
|
+
const globalItems = [];
|
|
10300
|
+
const topItems = [];
|
|
10301
|
+
props.formList.items.forEach((item) => {
|
|
10302
|
+
if (item.type === "document") {
|
|
10303
|
+
const form = cms.state.forms.find(
|
|
10304
|
+
({ tinaForm }) => tinaForm.id === item.formId
|
|
10305
|
+
);
|
|
10306
|
+
if (form.tinaForm.global) {
|
|
10307
|
+
globalItems.push(item);
|
|
10308
|
+
} else {
|
|
10309
|
+
orderedListItems.push(item);
|
|
10310
|
+
}
|
|
10311
|
+
} else {
|
|
10312
|
+
orderedListItems.push(item);
|
|
10313
|
+
}
|
|
10314
|
+
});
|
|
10315
|
+
if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
|
|
10316
|
+
topItems.push({ type: "list", label: "Documents" });
|
|
10317
|
+
}
|
|
10318
|
+
let extra = [];
|
|
10319
|
+
if (globalItems.length) {
|
|
10320
|
+
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
10321
|
+
}
|
|
10322
|
+
return [...topItems, ...orderedListItems, ...extra];
|
|
10323
|
+
}, [JSON.stringify(props.formList.items)]);
|
|
10324
|
+
return /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
10325
|
+
if (item.type === "list") {
|
|
10326
|
+
return /* @__PURE__ */ React.createElement(
|
|
10327
|
+
"div",
|
|
10328
|
+
{
|
|
10329
|
+
key: item.label,
|
|
10330
|
+
className: `relative group text-left w-full bg-white shadow-sm
|
|
10331
|
+
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"}`
|
|
10332
|
+
},
|
|
10333
|
+
/* @__PURE__ */ React.createElement(
|
|
10334
|
+
"span",
|
|
10335
|
+
{
|
|
10336
|
+
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
10337
|
+
},
|
|
10338
|
+
item.label
|
|
10339
|
+
)
|
|
10340
|
+
);
|
|
10341
|
+
}
|
|
10342
|
+
return /* @__PURE__ */ React.createElement(
|
|
10343
|
+
FormListItem,
|
|
10344
|
+
{
|
|
10345
|
+
setActiveFormId: (id) => props.setActiveFormId(id),
|
|
10346
|
+
key: item.formId,
|
|
10347
|
+
item,
|
|
10348
|
+
depth: 0
|
|
10349
|
+
}
|
|
10350
|
+
);
|
|
10351
|
+
})));
|
|
10352
|
+
};
|
|
10353
|
+
const SidebarNoFormsPlaceholder = () => /* @__PURE__ */ React.createElement(
|
|
10354
|
+
"div",
|
|
10355
|
+
{
|
|
10356
|
+
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
10357
|
+
style: {
|
|
10358
|
+
animationName: "fade-in",
|
|
10359
|
+
animationDelay: "300ms",
|
|
10360
|
+
animationTimingFunction: "ease-out",
|
|
10361
|
+
animationIterationCount: 1,
|
|
10362
|
+
animationFillMode: "both",
|
|
10363
|
+
animationDuration: "150ms"
|
|
10364
|
+
}
|
|
10365
|
+
},
|
|
10366
|
+
/* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React.createElement("br", null), "this page."),
|
|
10367
|
+
/* @__PURE__ */ React.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React.createElement(
|
|
10368
|
+
Button$1,
|
|
10369
|
+
{
|
|
10370
|
+
href: "https://tina.io/docs/contextual-editing/overview",
|
|
10371
|
+
target: "_blank",
|
|
10372
|
+
as: "a"
|
|
10373
|
+
},
|
|
10374
|
+
/* @__PURE__ */ React.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
10375
|
+
" Contextual Editing Docs"
|
|
10376
|
+
))
|
|
10377
|
+
);
|
|
10378
|
+
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
|
|
10379
|
+
"span",
|
|
10380
|
+
{
|
|
10381
|
+
className: `text-[24px] leading-none inline-block ${className}`,
|
|
10382
|
+
...props
|
|
10383
|
+
}
|
|
10384
|
+
);
|
|
10385
|
+
const minimumTimeToShowLoadingIndicator = 1e3;
|
|
10386
|
+
const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
10387
|
+
const cms = useCMS$1();
|
|
10388
|
+
const { setFormIsPristine } = React.useContext(SidebarContext);
|
|
10389
|
+
const [isShowingLoading, setIsShowingLoading] = React.useState(true);
|
|
10390
|
+
const [initialLoadComplete, setInitialLoadComplete] = React.useState(false);
|
|
10391
|
+
React.useEffect(() => {
|
|
10392
|
+
if (cms.state.isLoadingContent) {
|
|
10393
|
+
setIsShowingLoading(true);
|
|
10394
|
+
const timer = setTimeout(() => {
|
|
10395
|
+
if (!cms.state.isLoadingContent) {
|
|
10396
|
+
setIsShowingLoading(false);
|
|
10397
|
+
setInitialLoadComplete(true);
|
|
10398
|
+
}
|
|
10399
|
+
}, minimumTimeToShowLoadingIndicator);
|
|
10400
|
+
return () => clearTimeout(timer);
|
|
10401
|
+
} else {
|
|
10402
|
+
const timer = setTimeout(() => {
|
|
10403
|
+
setIsShowingLoading(false);
|
|
10404
|
+
setInitialLoadComplete(true);
|
|
10405
|
+
}, minimumTimeToShowLoadingIndicator);
|
|
10406
|
+
return () => clearTimeout(timer);
|
|
10407
|
+
}
|
|
10408
|
+
}, [cms.state.isLoadingContent]);
|
|
10409
|
+
if (isShowingLoading || !initialLoadComplete) {
|
|
10410
|
+
const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
|
|
10411
|
+
return /* @__PURE__ */ React.createElement(LoadingPlaceholder, null);
|
|
10412
|
+
}
|
|
10413
|
+
if (!cms.state.formLists.length) {
|
|
10414
|
+
return /* @__PURE__ */ React.createElement(SidebarNoFormsPlaceholder, null);
|
|
10415
|
+
}
|
|
10416
|
+
const isMultiform = cms.state.forms.length > 1;
|
|
10417
|
+
const activeForm = cms.state.forms.find(
|
|
10418
|
+
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
10419
|
+
);
|
|
10420
|
+
const isEditing = !!activeForm;
|
|
10421
|
+
if (isMultiform && !activeForm) {
|
|
10422
|
+
return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
|
|
10423
|
+
}
|
|
10424
|
+
const formMetas = cms.plugins.all("form:meta");
|
|
10425
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React.createElement(React.Fragment, { key: meta.name }, /* @__PURE__ */ React.createElement(meta.Component, null))), /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
10426
|
+
};
|
|
10427
|
+
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
10428
|
+
return /* @__PURE__ */ React.createElement(
|
|
10429
|
+
"div",
|
|
10430
|
+
{
|
|
10431
|
+
className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
|
|
10432
|
+
style: isEditing ? {
|
|
10433
|
+
transform: "none",
|
|
10434
|
+
animationName: "fly-in-left",
|
|
10435
|
+
animationDuration: "150ms",
|
|
10436
|
+
animationDelay: "0",
|
|
10437
|
+
animationIterationCount: 1,
|
|
10438
|
+
animationTimingFunction: "ease-out"
|
|
10439
|
+
} : {
|
|
10440
|
+
transform: "translate3d(100%, 0, 0)"
|
|
10441
|
+
}
|
|
10442
|
+
},
|
|
10443
|
+
children
|
|
10444
|
+
);
|
|
10445
|
+
};
|
|
10446
|
+
const MultiformFormHeader = ({
|
|
10447
|
+
activeForm
|
|
10448
|
+
}) => {
|
|
10449
|
+
const cms = useCMS$1();
|
|
10450
|
+
const { formIsPristine } = React.useContext(SidebarContext);
|
|
10451
|
+
return /* @__PURE__ */ React.createElement(
|
|
10452
|
+
"div",
|
|
10453
|
+
{
|
|
10454
|
+
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
10455
|
+
},
|
|
10456
|
+
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
10457
|
+
"button",
|
|
10458
|
+
{
|
|
10459
|
+
type: "button",
|
|
10460
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
10461
|
+
onClick: () => {
|
|
10462
|
+
const state = activeForm.tinaForm.finalForm.getState();
|
|
10463
|
+
if (state.invalid === true) {
|
|
10464
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
10465
|
+
} else {
|
|
10466
|
+
cms.dispatch({ type: "forms:set-active-form-id", value: null });
|
|
10467
|
+
}
|
|
10468
|
+
}
|
|
10469
|
+
},
|
|
10470
|
+
/* @__PURE__ */ React.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
10471
|
+
), /* @__PURE__ */ React.createElement(
|
|
10472
|
+
"button",
|
|
10473
|
+
{
|
|
10474
|
+
type: "button",
|
|
10475
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
10476
|
+
onClick: () => {
|
|
10477
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
10478
|
+
cms.state.activeFormId
|
|
10479
|
+
).name;
|
|
10480
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
10481
|
+
}
|
|
10482
|
+
},
|
|
10483
|
+
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
10484
|
+
), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
10485
|
+
);
|
|
10486
|
+
};
|
|
10487
|
+
const FormHeader = ({ activeForm }) => {
|
|
10488
|
+
const { formIsPristine } = React.useContext(SidebarContext);
|
|
10489
|
+
const cms = useCMS$1();
|
|
10490
|
+
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
10491
|
+
return /* @__PURE__ */ React.createElement(
|
|
10492
|
+
"div",
|
|
10493
|
+
{
|
|
10494
|
+
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
10495
|
+
},
|
|
10496
|
+
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
10497
|
+
"button",
|
|
10498
|
+
{
|
|
10499
|
+
type: "button",
|
|
10500
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
10501
|
+
onClick: () => {
|
|
10502
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
10503
|
+
cms.state.activeFormId
|
|
10504
|
+
).name;
|
|
10505
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
10506
|
+
}
|
|
10507
|
+
},
|
|
10508
|
+
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
10509
|
+
), shortFormLabel && /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
10510
|
+
);
|
|
10511
|
+
};
|
|
10467
10512
|
const SidebarContext = React.createContext(null);
|
|
10468
10513
|
const minPreviewWidth = 440;
|
|
10469
10514
|
const minSidebarWidth = 360;
|
|
@@ -10682,7 +10727,7 @@ const Sidebar$1 = ({
|
|
|
10682
10727
|
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
|
|
10683
10728
|
branchingEnabled
|
|
10684
10729
|
}
|
|
10685
|
-
), /* @__PURE__ */ React.createElement(FormsView,
|
|
10730
|
+
), /* @__PURE__ */ React.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React.createElement(
|
|
10686
10731
|
ScreenPluginModal,
|
|
10687
10732
|
{
|
|
10688
10733
|
screen: activeScreen,
|
|
@@ -10858,7 +10903,7 @@ const SidebarHeader = ({
|
|
|
10858
10903
|
className: "h-5 w-auto -mx-1 text-blue-500",
|
|
10859
10904
|
stroke: "currentColor",
|
|
10860
10905
|
fill: "currentColor",
|
|
10861
|
-
|
|
10906
|
+
strokeWidth: "0",
|
|
10862
10907
|
viewBox: "0 0 24 24",
|
|
10863
10908
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10864
10909
|
},
|
|
@@ -11448,7 +11493,10 @@ function MediaPicker({
|
|
|
11448
11493
|
const observer = new IntersectionObserver((entries) => {
|
|
11449
11494
|
const target = entries[0];
|
|
11450
11495
|
if (target.isIntersecting && list.nextOffset) {
|
|
11451
|
-
setOffsetHistory((offsetHistory2) => [
|
|
11496
|
+
setOffsetHistory((offsetHistory2) => [
|
|
11497
|
+
...offsetHistory2,
|
|
11498
|
+
list.nextOffset
|
|
11499
|
+
]);
|
|
11452
11500
|
}
|
|
11453
11501
|
});
|
|
11454
11502
|
if (loaderRef.current) {
|
|
@@ -12043,6 +12091,7 @@ const initialState = (cms) => {
|
|
|
12043
12091
|
forms: [],
|
|
12044
12092
|
formLists: [],
|
|
12045
12093
|
editingMode: "basic",
|
|
12094
|
+
isLoadingContent: false,
|
|
12046
12095
|
quickEditSupported: false,
|
|
12047
12096
|
sidebarDisplayState: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.defaultState) || "open"
|
|
12048
12097
|
};
|
|
@@ -12102,7 +12151,12 @@ function tinaReducer(state, action) {
|
|
|
12102
12151
|
}
|
|
12103
12152
|
});
|
|
12104
12153
|
}
|
|
12105
|
-
return {
|
|
12154
|
+
return {
|
|
12155
|
+
...state,
|
|
12156
|
+
activeFormId,
|
|
12157
|
+
formLists: nextFormLists,
|
|
12158
|
+
isLoadingContent: false
|
|
12159
|
+
};
|
|
12106
12160
|
}
|
|
12107
12161
|
case "form-lists:remove": {
|
|
12108
12162
|
const nextFormLists = state.formLists.filter(
|
|
@@ -12171,6 +12225,9 @@ function tinaReducer(state, action) {
|
|
|
12171
12225
|
}
|
|
12172
12226
|
return { ...state, sidebarDisplayState: action.value };
|
|
12173
12227
|
}
|
|
12228
|
+
case "sidebar:set-loading-state": {
|
|
12229
|
+
return { ...state, isLoadingContent: action.value };
|
|
12230
|
+
}
|
|
12174
12231
|
default:
|
|
12175
12232
|
throw new Error(`Unhandled action ${action.type}`);
|
|
12176
12233
|
}
|
|
@@ -12412,7 +12469,9 @@ const ActiveFieldIndicator = () => {
|
|
|
12412
12469
|
if (activeEle) {
|
|
12413
12470
|
setDisplay(true);
|
|
12414
12471
|
setPosition(activeEle.getBoundingClientRect());
|
|
12415
|
-
const iframe = document.getElementById(
|
|
12472
|
+
const iframe = document.getElementById(
|
|
12473
|
+
"tina-iframe"
|
|
12474
|
+
);
|
|
12416
12475
|
if (iframe) {
|
|
12417
12476
|
setIframePosition(iframe.getBoundingClientRect());
|
|
12418
12477
|
}
|
|
@@ -12854,7 +12913,6 @@ const CreateBranchModel = ({
|
|
|
12854
12913
|
}) => {
|
|
12855
12914
|
const cms = useCMS$1();
|
|
12856
12915
|
const tinaApi = cms.api.tina;
|
|
12857
|
-
tinaApi.branch;
|
|
12858
12916
|
const [disabled, setDisabled] = React.useState(false);
|
|
12859
12917
|
const [newBranchName, setNewBranchName] = React.useState("");
|
|
12860
12918
|
const [error, setError] = React.useState("");
|
|
@@ -12880,10 +12938,10 @@ const CreateBranchModel = ({
|
|
|
12880
12938
|
const newUrl = window.location.href.replace(hash, newHash);
|
|
12881
12939
|
window.location.href = newUrl;
|
|
12882
12940
|
};
|
|
12883
|
-
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", { className: "text-
|
|
12941
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React.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.createElement(
|
|
12884
12942
|
PrefixedTextField,
|
|
12885
12943
|
{
|
|
12886
|
-
placeholder: "
|
|
12944
|
+
placeholder: "e.g. {{PAGE-NAME}}-updates",
|
|
12887
12945
|
value: newBranchName,
|
|
12888
12946
|
onChange: (e) => {
|
|
12889
12947
|
setError("");
|
|
@@ -13030,7 +13088,9 @@ const ImgEmbed = ({
|
|
|
13030
13088
|
const { fieldName } = useTemplates();
|
|
13031
13089
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13032
13090
|
useHotkey("enter", () => {
|
|
13033
|
-
insertNodes(editor, [
|
|
13091
|
+
insertNodes(editor, [
|
|
13092
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13093
|
+
]);
|
|
13034
13094
|
});
|
|
13035
13095
|
return /* @__PURE__ */ React__default.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React__default.createElement(
|
|
13036
13096
|
"div",
|
|
@@ -13173,7 +13233,9 @@ const InlineEmbed = ({
|
|
|
13173
13233
|
const { templates, fieldName } = useTemplates();
|
|
13174
13234
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13175
13235
|
useHotkey("enter", () => {
|
|
13176
|
-
insertNodes(editor, [
|
|
13236
|
+
insertNodes(editor, [
|
|
13237
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13238
|
+
]);
|
|
13177
13239
|
});
|
|
13178
13240
|
useHotkey("space", () => {
|
|
13179
13241
|
insertNodes(editor, [{ text: " " }], {
|
|
@@ -13229,7 +13291,9 @@ const BlockEmbed = ({
|
|
|
13229
13291
|
const { templates, fieldName } = useTemplates();
|
|
13230
13292
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13231
13293
|
useHotkey("enter", () => {
|
|
13232
|
-
insertNodes(editor, [
|
|
13294
|
+
insertNodes(editor, [
|
|
13295
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13296
|
+
]);
|
|
13233
13297
|
});
|
|
13234
13298
|
const activeTemplate = templates.find(
|
|
13235
13299
|
(template) => template.name === element.name
|
|
@@ -14088,7 +14152,9 @@ const EMBED_ICON_WIDTH = 78;
|
|
|
14088
14152
|
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14089
14153
|
const FLOAT_BUTTON_WIDTH = 25;
|
|
14090
14154
|
const HEADING_LABEL = "Headings";
|
|
14091
|
-
const ToolbarContext = createContext(
|
|
14155
|
+
const ToolbarContext = createContext(
|
|
14156
|
+
void 0
|
|
14157
|
+
);
|
|
14092
14158
|
const ToolbarProvider = ({
|
|
14093
14159
|
tinaForm,
|
|
14094
14160
|
templates,
|
|
@@ -14238,7 +14304,7 @@ const useCodeBlockToolbarButton = (state) => {
|
|
|
14238
14304
|
const CodeBlockToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14239
14305
|
const state = useCodeBlockToolbarButtonState();
|
|
14240
14306
|
const { props } = useCodeBlockToolbarButton(state);
|
|
14241
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14307
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.codeBlock, null));
|
|
14242
14308
|
});
|
|
14243
14309
|
const useImageToolbarButtonState = () => {
|
|
14244
14310
|
const editor = useEditorState();
|
|
@@ -14270,36 +14336,54 @@ const useImageToolbarButton = (state) => {
|
|
|
14270
14336
|
const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14271
14337
|
const state = useImageToolbarButtonState();
|
|
14272
14338
|
const { props } = useImageToolbarButton(state);
|
|
14273
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14274
|
-
});
|
|
14275
|
-
const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
|
|
14276
|
-
const editor = useEditorState();
|
|
14277
|
-
const state = useListToolbarButtonState({ nodeType });
|
|
14278
|
-
const { props } = useListToolbarButton(state);
|
|
14279
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14280
|
-
ToolbarButton,
|
|
14281
|
-
{
|
|
14282
|
-
ref,
|
|
14283
|
-
tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14284
|
-
...props,
|
|
14285
|
-
onClick: (e) => {
|
|
14286
|
-
e.preventDefault();
|
|
14287
|
-
e.stopPropagation();
|
|
14288
|
-
toggleList(editor, { type: nodeType });
|
|
14289
|
-
}
|
|
14290
|
-
},
|
|
14291
|
-
nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
14292
|
-
);
|
|
14339
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
|
|
14293
14340
|
});
|
|
14341
|
+
const UnorderedListToolbarButton = withRef(
|
|
14342
|
+
(props, ref) => {
|
|
14343
|
+
const editor = useEditorState();
|
|
14344
|
+
const state = useListToolbarButtonState({ nodeType: ELEMENT_UL });
|
|
14345
|
+
const { props: buttonProps } = useListToolbarButton(state);
|
|
14346
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14347
|
+
ToolbarButton,
|
|
14348
|
+
{
|
|
14349
|
+
ref,
|
|
14350
|
+
tooltip: "Bulleted List",
|
|
14351
|
+
...buttonProps,
|
|
14352
|
+
onClick: (e) => {
|
|
14353
|
+
e.preventDefault();
|
|
14354
|
+
e.stopPropagation();
|
|
14355
|
+
toggleList(editor, { type: ELEMENT_UL });
|
|
14356
|
+
}
|
|
14357
|
+
},
|
|
14358
|
+
/* @__PURE__ */ React__default.createElement(Icons.ul, null)
|
|
14359
|
+
);
|
|
14360
|
+
}
|
|
14361
|
+
);
|
|
14362
|
+
const OrderedListToolbarButton = withRef(
|
|
14363
|
+
(props, ref) => {
|
|
14364
|
+
const editor = useEditorState();
|
|
14365
|
+
const state = useListToolbarButtonState({ nodeType: ELEMENT_OL });
|
|
14366
|
+
const { props: buttonProps } = useListToolbarButton(state);
|
|
14367
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14368
|
+
ToolbarButton,
|
|
14369
|
+
{
|
|
14370
|
+
ref,
|
|
14371
|
+
tooltip: "Numbered List",
|
|
14372
|
+
...buttonProps,
|
|
14373
|
+
onClick: (e) => {
|
|
14374
|
+
e.preventDefault();
|
|
14375
|
+
e.stopPropagation();
|
|
14376
|
+
toggleList(editor, { type: ELEMENT_OL });
|
|
14377
|
+
}
|
|
14378
|
+
},
|
|
14379
|
+
/* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
14380
|
+
);
|
|
14381
|
+
}
|
|
14382
|
+
);
|
|
14294
14383
|
const LinkToolbarButton = withRef((rest, ref) => {
|
|
14295
14384
|
const state = useLinkToolbarButtonState();
|
|
14296
14385
|
const { props } = useLinkToolbarButton(state);
|
|
14297
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link"
|
|
14298
|
-
});
|
|
14299
|
-
const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14300
|
-
const state = useMarkToolbarButtonState({ clear, nodeType });
|
|
14301
|
-
const { props } = useMarkToolbarButton(state);
|
|
14302
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14386
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
|
|
14303
14387
|
});
|
|
14304
14388
|
const useMermaidToolbarButtonState = () => {
|
|
14305
14389
|
const editor = useEditorState();
|
|
@@ -14380,7 +14464,7 @@ const useBlockQuoteToolbarButton = (state) => {
|
|
|
14380
14464
|
const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14381
14465
|
const state = useBlockQuoteToolbarButtonState();
|
|
14382
14466
|
const { props } = useBlockQuoteToolbarButton(state);
|
|
14383
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14467
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
|
|
14384
14468
|
});
|
|
14385
14469
|
const useRawMarkdownToolbarButton = () => {
|
|
14386
14470
|
const { setRawMode } = useEditorContext();
|
|
@@ -14400,7 +14484,7 @@ const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
|
14400
14484
|
ToolbarButton,
|
|
14401
14485
|
{
|
|
14402
14486
|
ref,
|
|
14403
|
-
tooltip: "
|
|
14487
|
+
tooltip: "Raw Markdown",
|
|
14404
14488
|
...rest,
|
|
14405
14489
|
...props,
|
|
14406
14490
|
"data-testid": "markdown-button"
|
|
@@ -14553,6 +14637,15 @@ const EmbedButton = ({ editor, templates }) => {
|
|
|
14553
14637
|
template.label || template.name
|
|
14554
14638
|
))));
|
|
14555
14639
|
};
|
|
14640
|
+
const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14641
|
+
const state = useMarkToolbarButtonState({ clear, nodeType });
|
|
14642
|
+
const { props } = useMarkToolbarButton(state);
|
|
14643
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14644
|
+
});
|
|
14645
|
+
const BoldToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: MARK_BOLD }, /* @__PURE__ */ React__default.createElement(Icons.bold, null));
|
|
14646
|
+
const StrikethroughToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: MARK_STRIKETHROUGH }, /* @__PURE__ */ React__default.createElement(Icons.strikethrough, null));
|
|
14647
|
+
const ItalicToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: MARK_ITALIC }, /* @__PURE__ */ React__default.createElement(Icons.italic, null));
|
|
14648
|
+
const CodeToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: MARK_CODE }, /* @__PURE__ */ React__default.createElement(Icons.code, null));
|
|
14556
14649
|
const toolbarItems = {
|
|
14557
14650
|
heading: {
|
|
14558
14651
|
label: HEADING_LABEL,
|
|
@@ -14573,37 +14666,37 @@ const toolbarItems = {
|
|
|
14573
14666
|
quote: {
|
|
14574
14667
|
label: "Quote",
|
|
14575
14668
|
width: () => STANDARD_ICON_WIDTH,
|
|
14576
|
-
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton,
|
|
14669
|
+
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, null)
|
|
14577
14670
|
},
|
|
14578
14671
|
ul: {
|
|
14579
14672
|
label: "Unordered List",
|
|
14580
14673
|
width: () => STANDARD_ICON_WIDTH,
|
|
14581
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14674
|
+
Component: /* @__PURE__ */ React__default.createElement(UnorderedListToolbarButton, null)
|
|
14582
14675
|
},
|
|
14583
14676
|
ol: {
|
|
14584
14677
|
label: "Ordered List",
|
|
14585
14678
|
width: () => STANDARD_ICON_WIDTH,
|
|
14586
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14679
|
+
Component: /* @__PURE__ */ React__default.createElement(OrderedListToolbarButton, null)
|
|
14587
14680
|
},
|
|
14588
14681
|
bold: {
|
|
14589
14682
|
label: "Bold",
|
|
14590
14683
|
width: () => STANDARD_ICON_WIDTH,
|
|
14591
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14684
|
+
Component: /* @__PURE__ */ React__default.createElement(BoldToolbarButton, null)
|
|
14592
14685
|
},
|
|
14593
14686
|
strikethrough: {
|
|
14594
14687
|
label: "Strikethrough",
|
|
14595
14688
|
width: () => STANDARD_ICON_WIDTH,
|
|
14596
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14689
|
+
Component: /* @__PURE__ */ React__default.createElement(StrikethroughToolbarButton, null)
|
|
14597
14690
|
},
|
|
14598
14691
|
italic: {
|
|
14599
14692
|
label: "Italic",
|
|
14600
14693
|
width: () => STANDARD_ICON_WIDTH,
|
|
14601
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14694
|
+
Component: /* @__PURE__ */ React__default.createElement(ItalicToolbarButton, null)
|
|
14602
14695
|
},
|
|
14603
14696
|
code: {
|
|
14604
14697
|
label: "Code",
|
|
14605
14698
|
width: () => STANDARD_ICON_WIDTH,
|
|
14606
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14699
|
+
Component: /* @__PURE__ */ React__default.createElement(CodeToolbarButton, null)
|
|
14607
14700
|
},
|
|
14608
14701
|
codeBlock: {
|
|
14609
14702
|
label: "Code Block",
|
|
@@ -30273,7 +30366,14 @@ const TINA_LOGIN_EVENT = "tinaCloudLogin";
|
|
|
30273
30366
|
const AUTH_TOKEN_KEY = "tinacms-auth";
|
|
30274
30367
|
const authenticate = (clientId, frontendUrl) => {
|
|
30275
30368
|
return new Promise((resolve) => {
|
|
30276
|
-
|
|
30369
|
+
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30370
|
+
const authTab = popupWindow(
|
|
30371
|
+
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30372
|
+
"_blank",
|
|
30373
|
+
window,
|
|
30374
|
+
1e3,
|
|
30375
|
+
700
|
|
30376
|
+
);
|
|
30277
30377
|
window.addEventListener("message", function(e) {
|
|
30278
30378
|
if (e.data.source === TINA_LOGIN_EVENT) {
|
|
30279
30379
|
if (authTab) {
|
|
@@ -30286,14 +30386,6 @@ const authenticate = (clientId, frontendUrl) => {
|
|
|
30286
30386
|
});
|
|
30287
30387
|
}
|
|
30288
30388
|
});
|
|
30289
|
-
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30290
|
-
authTab = popupWindow(
|
|
30291
|
-
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30292
|
-
"_blank",
|
|
30293
|
-
window,
|
|
30294
|
-
1e3,
|
|
30295
|
-
700
|
|
30296
|
-
);
|
|
30297
30389
|
});
|
|
30298
30390
|
};
|
|
30299
30391
|
const DefaultSessionProvider = ({
|
|
@@ -30999,56 +31091,6 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
30999
31091
|
!submitting && name
|
|
31000
31092
|
);
|
|
31001
31093
|
};
|
|
31002
|
-
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31003
|
-
const useTinaAuthRedirect = () => {
|
|
31004
|
-
useEffect(() => {
|
|
31005
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
31006
|
-
const config = {
|
|
31007
|
-
code: urlParams.get("code") || "",
|
|
31008
|
-
scope: urlParams.get("scope") || "email",
|
|
31009
|
-
state: urlParams.get("state")
|
|
31010
|
-
};
|
|
31011
|
-
if (!config.code) {
|
|
31012
|
-
return;
|
|
31013
|
-
}
|
|
31014
|
-
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31015
|
-
}, []);
|
|
31016
|
-
};
|
|
31017
|
-
const createClient = ({
|
|
31018
|
-
clientId,
|
|
31019
|
-
isLocalClient = true,
|
|
31020
|
-
branch,
|
|
31021
|
-
tinaioConfig,
|
|
31022
|
-
schema,
|
|
31023
|
-
apiUrl,
|
|
31024
|
-
tinaGraphQLVersion
|
|
31025
|
-
}) => {
|
|
31026
|
-
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31027
|
-
clientId: clientId || "",
|
|
31028
|
-
branch: branch || "main",
|
|
31029
|
-
tokenStorage: "LOCAL_STORAGE",
|
|
31030
|
-
tinaioConfig,
|
|
31031
|
-
schema,
|
|
31032
|
-
tinaGraphQLVersion
|
|
31033
|
-
});
|
|
31034
|
-
};
|
|
31035
|
-
function assertShape(value, yupSchema, errorMessage) {
|
|
31036
|
-
const shape = yupSchema(yup);
|
|
31037
|
-
try {
|
|
31038
|
-
shape.validateSync(value);
|
|
31039
|
-
} catch (e) {
|
|
31040
|
-
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31041
|
-
throw new Error(message);
|
|
31042
|
-
}
|
|
31043
|
-
}
|
|
31044
|
-
function safeAssertShape(value, yupSchema) {
|
|
31045
|
-
try {
|
|
31046
|
-
assertShape(value, yupSchema);
|
|
31047
|
-
return true;
|
|
31048
|
-
} catch (e) {
|
|
31049
|
-
return false;
|
|
31050
|
-
}
|
|
31051
|
-
}
|
|
31052
31094
|
class TinaAdminApi {
|
|
31053
31095
|
constructor(cms) {
|
|
31054
31096
|
var _a, _b, _c, _d;
|
|
@@ -31395,6 +31437,56 @@ class TinaAdminApi {
|
|
|
31395
31437
|
);
|
|
31396
31438
|
}
|
|
31397
31439
|
}
|
|
31440
|
+
const createClient = ({
|
|
31441
|
+
clientId,
|
|
31442
|
+
isLocalClient = true,
|
|
31443
|
+
branch,
|
|
31444
|
+
tinaioConfig,
|
|
31445
|
+
schema,
|
|
31446
|
+
apiUrl,
|
|
31447
|
+
tinaGraphQLVersion
|
|
31448
|
+
}) => {
|
|
31449
|
+
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31450
|
+
clientId: clientId || "",
|
|
31451
|
+
branch: branch || "main",
|
|
31452
|
+
tokenStorage: "LOCAL_STORAGE",
|
|
31453
|
+
tinaioConfig,
|
|
31454
|
+
schema,
|
|
31455
|
+
tinaGraphQLVersion
|
|
31456
|
+
});
|
|
31457
|
+
};
|
|
31458
|
+
function assertShape(value, yupSchema, errorMessage) {
|
|
31459
|
+
const shape = yupSchema(yup);
|
|
31460
|
+
try {
|
|
31461
|
+
shape.validateSync(value);
|
|
31462
|
+
} catch (e) {
|
|
31463
|
+
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31464
|
+
throw new Error(message);
|
|
31465
|
+
}
|
|
31466
|
+
}
|
|
31467
|
+
function safeAssertShape(value, yupSchema) {
|
|
31468
|
+
try {
|
|
31469
|
+
assertShape(value, yupSchema);
|
|
31470
|
+
return true;
|
|
31471
|
+
} catch (e) {
|
|
31472
|
+
return false;
|
|
31473
|
+
}
|
|
31474
|
+
}
|
|
31475
|
+
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31476
|
+
const useTinaAuthRedirect = () => {
|
|
31477
|
+
useEffect(() => {
|
|
31478
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
31479
|
+
const config = {
|
|
31480
|
+
code: urlParams.get("code") || "",
|
|
31481
|
+
scope: urlParams.get("scope") || "email",
|
|
31482
|
+
state: urlParams.get("state")
|
|
31483
|
+
};
|
|
31484
|
+
if (!config.code) {
|
|
31485
|
+
return;
|
|
31486
|
+
}
|
|
31487
|
+
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31488
|
+
}, []);
|
|
31489
|
+
};
|
|
31398
31490
|
function sleep(ms) {
|
|
31399
31491
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31400
31492
|
}
|
|
@@ -31731,6 +31823,9 @@ const TinaCloudProvider = (props) => {
|
|
|
31731
31823
|
cms.flags.set("branch-switcher", true);
|
|
31732
31824
|
client.usingEditorialWorkflow = true;
|
|
31733
31825
|
client.protectedBranches = project.protectedBranches;
|
|
31826
|
+
if (!project.metadata[currentBranch]) {
|
|
31827
|
+
setCurrentBranch(project.defaultBranch || "main");
|
|
31828
|
+
}
|
|
31734
31829
|
}
|
|
31735
31830
|
});
|
|
31736
31831
|
};
|
|
@@ -31743,7 +31838,7 @@ const TinaCloudProvider = (props) => {
|
|
|
31743
31838
|
}
|
|
31744
31839
|
});
|
|
31745
31840
|
return unsubscribe;
|
|
31746
|
-
}, [isTinaCloud, cms]);
|
|
31841
|
+
}, [currentBranch, isTinaCloud, cms]);
|
|
31747
31842
|
return /* @__PURE__ */ React__default.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React__default.createElement(
|
|
31748
31843
|
BranchDataProvider,
|
|
31749
31844
|
{
|
|
@@ -32596,6 +32691,35 @@ const FullscreenError = ({
|
|
|
32596
32691
|
}) => {
|
|
32597
32692
|
return /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React__default.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React__default.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React__default.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React__default.createElement(Button$1, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React__default.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
|
|
32598
32693
|
};
|
|
32694
|
+
const isValidSortKey = (sortKey, collection) => {
|
|
32695
|
+
if (collection.fields) {
|
|
32696
|
+
const sortKeys = collection.fields.map((x) => x.name);
|
|
32697
|
+
return sortKeys.includes(sortKey);
|
|
32698
|
+
} else if (collection.templates) {
|
|
32699
|
+
const collectionMap = {};
|
|
32700
|
+
const conflictedFields = /* @__PURE__ */ new Set();
|
|
32701
|
+
for (const template of collection.templates) {
|
|
32702
|
+
for (const field of template.fields) {
|
|
32703
|
+
if (collectionMap[field.name]) {
|
|
32704
|
+
if (collectionMap[field.name].type !== field.type) {
|
|
32705
|
+
conflictedFields.add(field.name);
|
|
32706
|
+
}
|
|
32707
|
+
} else {
|
|
32708
|
+
collectionMap[field.name] = field;
|
|
32709
|
+
}
|
|
32710
|
+
}
|
|
32711
|
+
}
|
|
32712
|
+
for (const key in conflictedFields) {
|
|
32713
|
+
delete collectionMap[key];
|
|
32714
|
+
}
|
|
32715
|
+
for (const key in collectionMap) {
|
|
32716
|
+
if (key === sortKey) {
|
|
32717
|
+
return true;
|
|
32718
|
+
}
|
|
32719
|
+
}
|
|
32720
|
+
return false;
|
|
32721
|
+
}
|
|
32722
|
+
};
|
|
32599
32723
|
const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
|
|
32600
32724
|
const api = new TinaAdminApi(cms);
|
|
32601
32725
|
const schema = cms.api.tina.schema;
|
|
@@ -32607,10 +32731,9 @@ const useGetCollection = (cms, collectionName, includeDocuments = true, folder,
|
|
|
32607
32731
|
useEffect(() => {
|
|
32608
32732
|
let cancelled = false;
|
|
32609
32733
|
const fetchCollection = async () => {
|
|
32610
|
-
var _a;
|
|
32611
32734
|
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
32612
32735
|
const { name, order } = JSON.parse(sortKey || "{}");
|
|
32613
|
-
const validSortKey = (
|
|
32736
|
+
const validSortKey = isValidSortKey(name, collectionExtra) ? name : void 0;
|
|
32614
32737
|
try {
|
|
32615
32738
|
const collection2 = await api.fetchCollection(
|
|
32616
32739
|
collectionName,
|
|
@@ -33062,7 +33185,9 @@ const CollectionListPage = () => {
|
|
|
33062
33185
|
safeSubmit: async () => {
|
|
33063
33186
|
try {
|
|
33064
33187
|
await admin.deleteDocument(vars);
|
|
33065
|
-
cms.alerts.info(
|
|
33188
|
+
cms.alerts.info(
|
|
33189
|
+
"Document was successfully deleted"
|
|
33190
|
+
);
|
|
33066
33191
|
reFetchCollection();
|
|
33067
33192
|
} catch (error) {
|
|
33068
33193
|
cms.alerts.warn(
|
|
@@ -33091,7 +33216,9 @@ const CollectionListPage = () => {
|
|
|
33091
33216
|
relativePath: vars.relativePath,
|
|
33092
33217
|
newRelativePath
|
|
33093
33218
|
});
|
|
33094
|
-
cms.alerts.info(
|
|
33219
|
+
cms.alerts.info(
|
|
33220
|
+
"Document was successfully renamed"
|
|
33221
|
+
);
|
|
33095
33222
|
reFetchCollection();
|
|
33096
33223
|
} catch (error) {
|
|
33097
33224
|
if (error.message.indexOf("has references")) {
|
|
@@ -33191,7 +33318,9 @@ const CollectionListPage = () => {
|
|
|
33191
33318
|
name: "sort",
|
|
33192
33319
|
value: sortKey,
|
|
33193
33320
|
onChange: (e) => {
|
|
33194
|
-
const val = JSON.parse(
|
|
33321
|
+
const val = JSON.parse(
|
|
33322
|
+
e.target.value
|
|
33323
|
+
);
|
|
33195
33324
|
setEndCursor("");
|
|
33196
33325
|
setPrevCursors([]);
|
|
33197
33326
|
window == null ? void 0 : window.localStorage.setItem(
|
|
@@ -33980,7 +34109,10 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
33980
34109
|
const fetchDocument = async () => {
|
|
33981
34110
|
if (api.isAuthenticated()) {
|
|
33982
34111
|
try {
|
|
33983
|
-
const response = await api.fetchDocument(
|
|
34112
|
+
const response = await api.fetchDocument(
|
|
34113
|
+
collectionName,
|
|
34114
|
+
relativePath2
|
|
34115
|
+
);
|
|
33984
34116
|
setDocument(response.document);
|
|
33985
34117
|
} catch (error2) {
|
|
33986
34118
|
cms.alerts.error(
|