tinacms 0.0.0-9358e25-20250226014947 → 0.0.0-95a293c-20250401070633
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/admin/components/GetCollection.d.ts +2 -2
- package/dist/auth/TinaCloudProvider.d.ts +1 -1
- package/dist/hooks/create-page-plugin.d.ts +1 -1
- package/dist/index.js +929 -795
- package/dist/index.mjs +933 -799
- package/dist/internalClient/index.d.ts +3 -3
- package/dist/react.js +3 -0
- package/dist/react.mjs +3 -0
- package/dist/toolkit/components/media/media-manager.d.ts +1 -1
- 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/plugin-branch-switcher/branch-switcher-legacy.d.ts +1 -1
- package/dist/toolkit/plugin-branch-switcher/branch-switcher.d.ts +1 -1
- package/dist/toolkit/react-cloud-config/cloud-config-plugin.d.ts +3 -3
- 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 +5 -5
- 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,14 +53,13 @@ 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
|
-
import gql from "graphql-tag";
|
|
58
57
|
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
|
|
59
58
|
import { NAMER, resolveField } from "@tinacms/schema-tools";
|
|
60
|
-
import
|
|
59
|
+
import gql from "graphql-tag";
|
|
61
60
|
import { diff } from "@graphql-inspector/core";
|
|
62
|
-
import
|
|
61
|
+
import * as yup from "yup";
|
|
62
|
+
import { NavLink, useLocation, useNavigate, useParams, Link, useSearchParams, HashRouter, Routes, Route } from "react-router-dom";
|
|
63
63
|
import { stringifyMDX } from "@tinacms/mdx";
|
|
64
64
|
const ModalProvider = ({ children }) => {
|
|
65
65
|
const [modalRootContainerRef, setModalRootContainerRef] = useState(
|
|
@@ -4430,36 +4430,6 @@ function MdOutlineArrowBackIos(props) {
|
|
|
4430
4430
|
function MdOutlinePerson(props) {
|
|
4431
4431
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2m0-12C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }, "child": [] }] })(props);
|
|
4432
4432
|
}
|
|
4433
|
-
const BranchContext = React.createContext({
|
|
4434
|
-
currentBranch: null,
|
|
4435
|
-
setCurrentBranch: (branch) => {
|
|
4436
|
-
console.warn("BranchContext not initialized");
|
|
4437
|
-
}
|
|
4438
|
-
});
|
|
4439
|
-
const BranchDataProvider = ({
|
|
4440
|
-
currentBranch,
|
|
4441
|
-
setCurrentBranch,
|
|
4442
|
-
children
|
|
4443
|
-
}) => {
|
|
4444
|
-
return /* @__PURE__ */ React.createElement(
|
|
4445
|
-
BranchContext.Provider,
|
|
4446
|
-
{
|
|
4447
|
-
value: {
|
|
4448
|
-
currentBranch,
|
|
4449
|
-
setCurrentBranch
|
|
4450
|
-
}
|
|
4451
|
-
},
|
|
4452
|
-
children
|
|
4453
|
-
);
|
|
4454
|
-
};
|
|
4455
|
-
const useBranchData = () => {
|
|
4456
|
-
const branchData = React.useContext(BranchContext);
|
|
4457
|
-
const { dispatch } = useEvent("branch:change");
|
|
4458
|
-
React.useEffect(() => {
|
|
4459
|
-
dispatch({ branchName: branchData.currentBranch });
|
|
4460
|
-
}, [branchData.currentBranch]);
|
|
4461
|
-
return branchData;
|
|
4462
|
-
};
|
|
4463
4433
|
const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded-md";
|
|
4464
4434
|
const disabledClasses$1 = "opacity-50 pointer-events-none cursor-not-allowed";
|
|
4465
4435
|
const BaseTextField = React.forwardRef(({ className, disabled, ...rest }, ref) => {
|
|
@@ -5332,7 +5302,9 @@ const Combobox = ({ cms, input, field }) => {
|
|
|
5332
5302
|
}, [value, input, optionSets]);
|
|
5333
5303
|
React.useEffect(() => {
|
|
5334
5304
|
if (field.experimental___filter && optionSets.length > 0) {
|
|
5335
|
-
setFilteredOptionsList(
|
|
5305
|
+
setFilteredOptionsList(
|
|
5306
|
+
field.experimental___filter(optionSets, void 0)
|
|
5307
|
+
);
|
|
5336
5308
|
} else {
|
|
5337
5309
|
setFilteredOptionsList(optionSets);
|
|
5338
5310
|
}
|
|
@@ -5702,7 +5674,9 @@ const Item$2 = ({
|
|
|
5702
5674
|
onClick: () => {
|
|
5703
5675
|
const state = tinaForm.finalForm.getState();
|
|
5704
5676
|
if (state.invalid === true) {
|
|
5705
|
-
cms.alerts.error(
|
|
5677
|
+
cms.alerts.error(
|
|
5678
|
+
"Cannot navigate away from an invalid form."
|
|
5679
|
+
);
|
|
5706
5680
|
return;
|
|
5707
5681
|
}
|
|
5708
5682
|
cms.dispatch({
|
|
@@ -6286,7 +6260,9 @@ const BlockListItem = ({
|
|
|
6286
6260
|
onClick: () => {
|
|
6287
6261
|
const state = tinaForm.finalForm.getState();
|
|
6288
6262
|
if (state.invalid === true) {
|
|
6289
|
-
cms.alerts.error(
|
|
6263
|
+
cms.alerts.error(
|
|
6264
|
+
"Cannot navigate away from an invalid form."
|
|
6265
|
+
);
|
|
6290
6266
|
return;
|
|
6291
6267
|
}
|
|
6292
6268
|
cms.dispatch({
|
|
@@ -6768,28 +6744,28 @@ class DaysView extends React__default.Component {
|
|
|
6768
6744
|
}
|
|
6769
6745
|
renderDayHeaders() {
|
|
6770
6746
|
const locale = this.props.viewDate.localeData();
|
|
6771
|
-
|
|
6747
|
+
const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
|
|
6772
6748
|
return /* @__PURE__ */ React__default.createElement("tr", null, dayItems);
|
|
6773
6749
|
}
|
|
6774
6750
|
renderDays() {
|
|
6775
6751
|
const date = this.props.viewDate;
|
|
6776
6752
|
const startOfMonth = date.clone().startOf("month");
|
|
6777
6753
|
const endOfMonth = date.clone().endOf("month");
|
|
6778
|
-
|
|
6779
|
-
|
|
6754
|
+
const rows = [[], [], [], [], [], []];
|
|
6755
|
+
const startDate = date.clone().subtract(1, "months");
|
|
6780
6756
|
startDate.date(startDate.daysInMonth()).startOf("week");
|
|
6781
|
-
|
|
6757
|
+
const endDate = startDate.clone().add(42, "d");
|
|
6782
6758
|
let i = 0;
|
|
6783
6759
|
while (startDate.isBefore(endDate)) {
|
|
6784
|
-
|
|
6760
|
+
const row = getRow$2(rows, i++);
|
|
6785
6761
|
row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
|
|
6786
6762
|
startDate.add(1, "d");
|
|
6787
6763
|
}
|
|
6788
6764
|
return rows.map((r, i2) => /* @__PURE__ */ React__default.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
|
|
6789
6765
|
}
|
|
6790
6766
|
renderDay(date, startOfMonth, endOfMonth) {
|
|
6791
|
-
|
|
6792
|
-
|
|
6767
|
+
const selectedDate = this.props.selectedDate;
|
|
6768
|
+
const dayProps = {
|
|
6793
6769
|
key: date.format("M_D"),
|
|
6794
6770
|
"data-value": date.date(),
|
|
6795
6771
|
"data-month": date.month(),
|
|
@@ -6843,7 +6819,7 @@ function getRow$2(rows, day) {
|
|
|
6843
6819
|
}
|
|
6844
6820
|
function getDaysOfWeek(locale) {
|
|
6845
6821
|
const first = locale.firstDayOfWeek();
|
|
6846
|
-
|
|
6822
|
+
const dow = [];
|
|
6847
6823
|
let i = 0;
|
|
6848
6824
|
locale._weekdaysMin.forEach(function(day) {
|
|
6849
6825
|
dow[(7 + i++ - first) % 7] = day;
|
|
@@ -6861,7 +6837,7 @@ class MonthsView extends React__default.Component {
|
|
|
6861
6837
|
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
6838
|
}
|
|
6863
6839
|
renderNavigation() {
|
|
6864
|
-
|
|
6840
|
+
const year = this.props.viewDate.year();
|
|
6865
6841
|
return /* @__PURE__ */ React__default.createElement(
|
|
6866
6842
|
ViewNavigation,
|
|
6867
6843
|
{
|
|
@@ -6874,9 +6850,9 @@ class MonthsView extends React__default.Component {
|
|
|
6874
6850
|
);
|
|
6875
6851
|
}
|
|
6876
6852
|
renderMonths() {
|
|
6877
|
-
|
|
6853
|
+
const rows = [[], [], []];
|
|
6878
6854
|
for (let month = 0; month < 12; month++) {
|
|
6879
|
-
|
|
6855
|
+
const row = getRow$1(rows, month);
|
|
6880
6856
|
row.push(this.renderMonth(month));
|
|
6881
6857
|
}
|
|
6882
6858
|
return rows.map((months, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, months));
|
|
@@ -6893,7 +6869,7 @@ class MonthsView extends React__default.Component {
|
|
|
6893
6869
|
if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
|
|
6894
6870
|
className += " rdtActive";
|
|
6895
6871
|
}
|
|
6896
|
-
|
|
6872
|
+
const props = { key: month, className, "data-value": month, onClick };
|
|
6897
6873
|
if (this.props.renderMonth) {
|
|
6898
6874
|
return this.props.renderMonth(
|
|
6899
6875
|
props,
|
|
@@ -6905,11 +6881,11 @@ class MonthsView extends React__default.Component {
|
|
|
6905
6881
|
return /* @__PURE__ */ React__default.createElement("td", { ...props }, this.getMonthText(month));
|
|
6906
6882
|
}
|
|
6907
6883
|
isDisabledMonth(month) {
|
|
6908
|
-
|
|
6884
|
+
const isValidDate = this.props.isValidDate;
|
|
6909
6885
|
if (!isValidDate) {
|
|
6910
6886
|
return false;
|
|
6911
6887
|
}
|
|
6912
|
-
|
|
6888
|
+
const date = this.props.viewDate.clone().set({ month });
|
|
6913
6889
|
let day = date.endOf("month").date() + 1;
|
|
6914
6890
|
while (day-- > 1) {
|
|
6915
6891
|
if (isValidDate(date.date(day))) {
|
|
@@ -6961,9 +6937,9 @@ class YearsView extends React__default.Component {
|
|
|
6961
6937
|
}
|
|
6962
6938
|
renderYears() {
|
|
6963
6939
|
const viewYear = this.getViewYear();
|
|
6964
|
-
|
|
6940
|
+
const rows = [[], [], []];
|
|
6965
6941
|
for (let year = viewYear - 1; year < viewYear + 11; year++) {
|
|
6966
|
-
|
|
6942
|
+
const row = getRow(rows, year - viewYear);
|
|
6967
6943
|
row.push(this.renderYear(year));
|
|
6968
6944
|
}
|
|
6969
6945
|
return rows.map((years, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, years));
|
|
@@ -6980,7 +6956,7 @@ class YearsView extends React__default.Component {
|
|
|
6980
6956
|
if (selectedYear === year) {
|
|
6981
6957
|
className += " rdtActive";
|
|
6982
6958
|
}
|
|
6983
|
-
|
|
6959
|
+
const props = { key: year, className, "data-value": year, onClick };
|
|
6984
6960
|
return this.props.renderYear(
|
|
6985
6961
|
props,
|
|
6986
6962
|
year,
|
|
@@ -6994,15 +6970,15 @@ class YearsView extends React__default.Component {
|
|
|
6994
6970
|
return this.props.selectedDate && this.props.selectedDate.year();
|
|
6995
6971
|
}
|
|
6996
6972
|
isDisabledYear(year) {
|
|
6997
|
-
|
|
6973
|
+
const cache = this.disabledYearsCache;
|
|
6998
6974
|
if (cache[year] !== void 0) {
|
|
6999
6975
|
return cache[year];
|
|
7000
6976
|
}
|
|
7001
|
-
|
|
6977
|
+
const isValidDate = this.props.isValidDate;
|
|
7002
6978
|
if (!isValidDate) {
|
|
7003
6979
|
return false;
|
|
7004
6980
|
}
|
|
7005
|
-
|
|
6981
|
+
const date = this.props.viewDate.clone().set({ year });
|
|
7006
6982
|
let day = date.endOf("year").dayOfYear() + 1;
|
|
7007
6983
|
while (day-- > 1) {
|
|
7008
6984
|
if (isValidDate(date.dayOfYear(day))) {
|
|
@@ -7049,7 +7025,7 @@ const timeConstraints = {
|
|
|
7049
7025
|
}
|
|
7050
7026
|
};
|
|
7051
7027
|
function createConstraints(overrideTimeConstraints) {
|
|
7052
|
-
|
|
7028
|
+
const constraints = {};
|
|
7053
7029
|
Object.keys(timeConstraints).forEach((type) => {
|
|
7054
7030
|
constraints[type] = {
|
|
7055
7031
|
...timeConstraints[type],
|
|
@@ -7065,7 +7041,7 @@ class TimeView extends React__default.Component {
|
|
|
7065
7041
|
this.state = this.getTimeParts(props.selectedDate || props.viewDate);
|
|
7066
7042
|
}
|
|
7067
7043
|
render() {
|
|
7068
|
-
|
|
7044
|
+
const items2 = [];
|
|
7069
7045
|
const timeParts = this.state;
|
|
7070
7046
|
this.getCounters().forEach((c, i) => {
|
|
7071
7047
|
if (i && c !== "ampm") {
|
|
@@ -7127,8 +7103,8 @@ class TimeView extends React__default.Component {
|
|
|
7127
7103
|
}
|
|
7128
7104
|
if (type === "ampm")
|
|
7129
7105
|
return this.toggleDayPart();
|
|
7130
|
-
|
|
7131
|
-
|
|
7106
|
+
const update = {};
|
|
7107
|
+
const body = document.body;
|
|
7132
7108
|
update[type] = this[action](type);
|
|
7133
7109
|
this.setState(update);
|
|
7134
7110
|
this.timer = setTimeout(() => {
|
|
@@ -7171,8 +7147,8 @@ class TimeView extends React__default.Component {
|
|
|
7171
7147
|
return pad(type, value);
|
|
7172
7148
|
}
|
|
7173
7149
|
getCounters() {
|
|
7174
|
-
|
|
7175
|
-
|
|
7150
|
+
const counters = [];
|
|
7151
|
+
const format2 = this.props.timeFormat;
|
|
7176
7152
|
if (format2.toLowerCase().indexOf("h") !== -1) {
|
|
7177
7153
|
counters.push("hours");
|
|
7178
7154
|
if (format2.indexOf("m") !== -1) {
|
|
@@ -7304,7 +7280,7 @@ class Datetime extends React__default.Component {
|
|
|
7304
7280
|
__publicField(this, "_renderCalendar", () => {
|
|
7305
7281
|
const props = this.props;
|
|
7306
7282
|
const state = this.state;
|
|
7307
|
-
|
|
7283
|
+
const viewProps = {
|
|
7308
7284
|
viewDate: state.viewDate.clone(),
|
|
7309
7285
|
selectedDate: this.getSelectedDate(),
|
|
7310
7286
|
isValidDate: props.isValidDate,
|
|
@@ -7347,10 +7323,10 @@ class Datetime extends React__default.Component {
|
|
|
7347
7323
|
__publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
|
|
7348
7324
|
__publicField(this, "nextView", { days: "time", months: "days", years: "months" });
|
|
7349
7325
|
__publicField(this, "_updateDate", (e) => {
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7326
|
+
const state = this.state;
|
|
7327
|
+
const currentView = state.currentView;
|
|
7328
|
+
const updateOnView = this.getUpdateOn(this.getFormat("date"));
|
|
7329
|
+
const viewDate = this.state.viewDate.clone();
|
|
7354
7330
|
viewDate[this.viewToMethod[currentView]](
|
|
7355
7331
|
parseInt(e.target.getAttribute("data-value"), 10)
|
|
7356
7332
|
);
|
|
@@ -7358,7 +7334,7 @@ class Datetime extends React__default.Component {
|
|
|
7358
7334
|
viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
|
|
7359
7335
|
viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
|
|
7360
7336
|
}
|
|
7361
|
-
|
|
7337
|
+
const update = { viewDate };
|
|
7362
7338
|
if (currentView === updateOnView) {
|
|
7363
7339
|
update.selectedDate = viewDate.clone();
|
|
7364
7340
|
update.inputValue = viewDate.format(this.getFormat("datetime"));
|
|
@@ -7372,7 +7348,7 @@ class Datetime extends React__default.Component {
|
|
|
7372
7348
|
this.setState(update);
|
|
7373
7349
|
});
|
|
7374
7350
|
__publicField(this, "_viewNavigate", (modifier, unit) => {
|
|
7375
|
-
|
|
7351
|
+
const viewDate = this.state.viewDate.clone();
|
|
7376
7352
|
viewDate.add(modifier, unit);
|
|
7377
7353
|
if (modifier > 0) {
|
|
7378
7354
|
this.props.onNavigateForward(modifier, unit);
|
|
@@ -7382,7 +7358,7 @@ class Datetime extends React__default.Component {
|
|
|
7382
7358
|
this.setState({ viewDate });
|
|
7383
7359
|
});
|
|
7384
7360
|
__publicField(this, "_setTime", (type, value) => {
|
|
7385
|
-
|
|
7361
|
+
const date = (this.getSelectedDate() || this.state.viewDate).clone();
|
|
7386
7362
|
date[type](value);
|
|
7387
7363
|
if (!this.props.value) {
|
|
7388
7364
|
this.setState({
|
|
@@ -7406,7 +7382,7 @@ class Datetime extends React__default.Component {
|
|
|
7406
7382
|
});
|
|
7407
7383
|
});
|
|
7408
7384
|
__publicField(this, "_handleClickOutside", () => {
|
|
7409
|
-
|
|
7385
|
+
const props = this.props;
|
|
7410
7386
|
if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
|
|
7411
7387
|
this._closeCalendar();
|
|
7412
7388
|
}
|
|
@@ -7421,7 +7397,7 @@ class Datetime extends React__default.Component {
|
|
|
7421
7397
|
return;
|
|
7422
7398
|
const value = e.target ? e.target.value : e;
|
|
7423
7399
|
const localMoment = this.localMoment(value, this.getFormat("datetime"));
|
|
7424
|
-
|
|
7400
|
+
const update = { inputValue: value };
|
|
7425
7401
|
if (localMoment.isValid()) {
|
|
7426
7402
|
update.selectedDate = localMoment;
|
|
7427
7403
|
update.viewDate = localMoment.clone().startOf("month");
|
|
@@ -7485,9 +7461,9 @@ class Datetime extends React__default.Component {
|
|
|
7485
7461
|
return this.props.renderView(this.state.currentView, this._renderCalendar);
|
|
7486
7462
|
}
|
|
7487
7463
|
getInitialState() {
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7464
|
+
const props = this.props;
|
|
7465
|
+
const inputFormat = this.getFormat("datetime");
|
|
7466
|
+
const selectedDate = this.parseDate(
|
|
7491
7467
|
props.value || props.initialValue,
|
|
7492
7468
|
inputFormat
|
|
7493
7469
|
);
|
|
@@ -7518,7 +7494,7 @@ class Datetime extends React__default.Component {
|
|
|
7518
7494
|
return this.getInitialDate();
|
|
7519
7495
|
}
|
|
7520
7496
|
getInitialDate() {
|
|
7521
|
-
|
|
7497
|
+
const m = this.localMoment();
|
|
7522
7498
|
m.hour(0).minute(0).second(0).millisecond(0);
|
|
7523
7499
|
return m;
|
|
7524
7500
|
}
|
|
@@ -7538,8 +7514,8 @@ class Datetime extends React__default.Component {
|
|
|
7538
7514
|
}
|
|
7539
7515
|
getClassName() {
|
|
7540
7516
|
let cn2 = "rdt";
|
|
7541
|
-
|
|
7542
|
-
|
|
7517
|
+
const props = this.props;
|
|
7518
|
+
const propCn = props.className;
|
|
7543
7519
|
if (Array.isArray(propCn)) {
|
|
7544
7520
|
cn2 += " " + propCn.join(" ");
|
|
7545
7521
|
} else if (propCn) {
|
|
@@ -7572,14 +7548,14 @@ class Datetime extends React__default.Component {
|
|
|
7572
7548
|
return viewModes.DAYS;
|
|
7573
7549
|
}
|
|
7574
7550
|
getLocaleData() {
|
|
7575
|
-
|
|
7551
|
+
const p = this.props;
|
|
7576
7552
|
return this.localMoment(
|
|
7577
7553
|
p.value || p.defaultValue || /* @__PURE__ */ new Date()
|
|
7578
7554
|
).localeData();
|
|
7579
7555
|
}
|
|
7580
7556
|
getDateFormat() {
|
|
7581
7557
|
const locale = this.getLocaleData();
|
|
7582
|
-
|
|
7558
|
+
const format2 = this.props.dateFormat;
|
|
7583
7559
|
if (format2 === true)
|
|
7584
7560
|
return locale.longDateFormat("L");
|
|
7585
7561
|
if (format2)
|
|
@@ -7588,7 +7564,7 @@ class Datetime extends React__default.Component {
|
|
|
7588
7564
|
}
|
|
7589
7565
|
getTimeFormat() {
|
|
7590
7566
|
const locale = this.getLocaleData();
|
|
7591
|
-
|
|
7567
|
+
const format2 = this.props.timeFormat;
|
|
7592
7568
|
if (format2 === true) {
|
|
7593
7569
|
return locale.longDateFormat("LT");
|
|
7594
7570
|
}
|
|
@@ -7600,12 +7576,12 @@ class Datetime extends React__default.Component {
|
|
|
7600
7576
|
} else if (type === "time") {
|
|
7601
7577
|
return this.getTimeFormat();
|
|
7602
7578
|
}
|
|
7603
|
-
|
|
7604
|
-
|
|
7579
|
+
const dateFormat = this.getDateFormat();
|
|
7580
|
+
const timeFormat = this.getTimeFormat();
|
|
7605
7581
|
return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
|
|
7606
7582
|
}
|
|
7607
7583
|
updateTime(op, amount, type, toSelected) {
|
|
7608
|
-
|
|
7584
|
+
const update = {};
|
|
7609
7585
|
const date = toSelected ? "selectedDate" : "viewDate";
|
|
7610
7586
|
update[date] = this.state[date].clone()[op](amount, type);
|
|
7611
7587
|
this.setState(update);
|
|
@@ -7638,7 +7614,7 @@ class Datetime extends React__default.Component {
|
|
|
7638
7614
|
if (prevProps === this.props)
|
|
7639
7615
|
return;
|
|
7640
7616
|
let needsUpdate = false;
|
|
7641
|
-
|
|
7617
|
+
const thisProps = this.props;
|
|
7642
7618
|
["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
|
|
7643
7619
|
function(p) {
|
|
7644
7620
|
prevProps[p] !== thisProps[p] && (needsUpdate = true);
|
|
@@ -7654,8 +7630,8 @@ class Datetime extends React__default.Component {
|
|
|
7654
7630
|
}
|
|
7655
7631
|
regenerateDates() {
|
|
7656
7632
|
const props = this.props;
|
|
7657
|
-
|
|
7658
|
-
|
|
7633
|
+
const viewDate = this.state.viewDate.clone();
|
|
7634
|
+
const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
|
|
7659
7635
|
if (props.locale) {
|
|
7660
7636
|
viewDate.locale(props.locale);
|
|
7661
7637
|
selectedDate && selectedDate.locale(props.locale);
|
|
@@ -7670,7 +7646,7 @@ class Datetime extends React__default.Component {
|
|
|
7670
7646
|
viewDate.locale();
|
|
7671
7647
|
selectedDate && selectedDate.locale();
|
|
7672
7648
|
}
|
|
7673
|
-
|
|
7649
|
+
const update = { viewDate, selectedDate };
|
|
7674
7650
|
if (selectedDate && selectedDate.isValid()) {
|
|
7675
7651
|
update.inputValue = selectedDate.format(this.getFormat("datetime"));
|
|
7676
7652
|
}
|
|
@@ -7679,7 +7655,7 @@ class Datetime extends React__default.Component {
|
|
|
7679
7655
|
getSelectedDate() {
|
|
7680
7656
|
if (this.props.value === void 0)
|
|
7681
7657
|
return this.state.selectedDate;
|
|
7682
|
-
|
|
7658
|
+
const selectedDate = this.parseDate(
|
|
7683
7659
|
this.props.value,
|
|
7684
7660
|
this.getFormat("datetime")
|
|
7685
7661
|
);
|
|
@@ -7698,7 +7674,7 @@ class Datetime extends React__default.Component {
|
|
|
7698
7674
|
return "";
|
|
7699
7675
|
}
|
|
7700
7676
|
getInputValue() {
|
|
7701
|
-
|
|
7677
|
+
const selectedDate = this.getSelectedDate();
|
|
7702
7678
|
return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
|
|
7703
7679
|
}
|
|
7704
7680
|
/**
|
|
@@ -7708,7 +7684,7 @@ class Datetime extends React__default.Component {
|
|
|
7708
7684
|
* @public
|
|
7709
7685
|
*/
|
|
7710
7686
|
setViewDate(date) {
|
|
7711
|
-
|
|
7687
|
+
const logError = function() {
|
|
7712
7688
|
return log("Invalid date passed to the `setViewDate` method: " + date);
|
|
7713
7689
|
};
|
|
7714
7690
|
if (!date)
|
|
@@ -7804,7 +7780,7 @@ __publicField(Datetime, "defaultProps", {
|
|
|
7804
7780
|
// Make moment accessible through the Datetime class
|
|
7805
7781
|
__publicField(Datetime, "moment", moment);
|
|
7806
7782
|
function log(message, method) {
|
|
7807
|
-
|
|
7783
|
+
const con = typeof window !== "undefined" && window.console;
|
|
7808
7784
|
if (!con)
|
|
7809
7785
|
return;
|
|
7810
7786
|
if (!method) {
|
|
@@ -8057,9 +8033,6 @@ const PasswordFieldPlugin = {
|
|
|
8057
8033
|
},
|
|
8058
8034
|
parse: parse$2
|
|
8059
8035
|
};
|
|
8060
|
-
function GrCircleQuestion(props) {
|
|
8061
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,22 C17.5228475,22 22,17.5228475 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,17.5228475 6.4771525,22 12,22 Z M12,15 L12,14 C12,13 12,12.5 13,12 C14,11.5 15,11 15,9.5 C15,8.5 14,7 12,7 C10,7 9,8.26413718 9,10 M12,16 L12,18" }, "child": [] }] })(props);
|
|
8062
|
-
}
|
|
8063
8036
|
function AiFillWarning(props) {
|
|
8064
8037
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, "child": [] }] })(props);
|
|
8065
8038
|
}
|
|
@@ -8078,6 +8051,39 @@ function FaSpinner(props) {
|
|
|
8078
8051
|
function FaUnlock(props) {
|
|
8079
8052
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z" }, "child": [] }] })(props);
|
|
8080
8053
|
}
|
|
8054
|
+
function GrCircleQuestion(props) {
|
|
8055
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,22 C17.5228475,22 22,17.5228475 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,17.5228475 6.4771525,22 12,22 Z M12,15 L12,14 C12,13 12,12.5 13,12 C14,11.5 15,11 15,9.5 C15,8.5 14,7 12,7 C10,7 9,8.26413718 9,10 M12,16 L12,18" }, "child": [] }] })(props);
|
|
8056
|
+
}
|
|
8057
|
+
const BranchContext = React.createContext({
|
|
8058
|
+
currentBranch: null,
|
|
8059
|
+
setCurrentBranch: (branch) => {
|
|
8060
|
+
console.warn("BranchContext not initialized");
|
|
8061
|
+
}
|
|
8062
|
+
});
|
|
8063
|
+
const BranchDataProvider = ({
|
|
8064
|
+
currentBranch,
|
|
8065
|
+
setCurrentBranch,
|
|
8066
|
+
children
|
|
8067
|
+
}) => {
|
|
8068
|
+
return /* @__PURE__ */ React.createElement(
|
|
8069
|
+
BranchContext.Provider,
|
|
8070
|
+
{
|
|
8071
|
+
value: {
|
|
8072
|
+
currentBranch,
|
|
8073
|
+
setCurrentBranch
|
|
8074
|
+
}
|
|
8075
|
+
},
|
|
8076
|
+
children
|
|
8077
|
+
);
|
|
8078
|
+
};
|
|
8079
|
+
const useBranchData = () => {
|
|
8080
|
+
const branchData = React.useContext(BranchContext);
|
|
8081
|
+
const { dispatch } = useEvent("branch:change");
|
|
8082
|
+
React.useEffect(() => {
|
|
8083
|
+
dispatch({ branchName: branchData.currentBranch });
|
|
8084
|
+
}, [branchData.currentBranch]);
|
|
8085
|
+
return branchData;
|
|
8086
|
+
};
|
|
8081
8087
|
function formatBranchName$1(str) {
|
|
8082
8088
|
const pattern = /[^/\w-]+/g;
|
|
8083
8089
|
const formattedStr = str.replace(pattern, "");
|
|
@@ -8176,7 +8182,7 @@ const BranchSwitcherLegacy = ({
|
|
|
8176
8182
|
className: "transition-all duration-150 ease-out text-blue-600 hover:text-blue-400 hover:underline no-underline",
|
|
8177
8183
|
href: "https://tina.io/docs/tina-cloud/"
|
|
8178
8184
|
},
|
|
8179
|
-
"Learn more about moving to production with
|
|
8185
|
+
"Learn more about moving to production with TinaCloud."
|
|
8180
8186
|
)), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement(
|
|
8181
8187
|
Button$1,
|
|
8182
8188
|
{
|
|
@@ -8412,7 +8418,7 @@ const EditoralBranchSwitcher = ({
|
|
|
8412
8418
|
className: "transition-all duration-150 ease-out text-blue-600 hover:text-blue-400 hover:underline no-underline",
|
|
8413
8419
|
href: "https://tina.io/docs/tina-cloud/"
|
|
8414
8420
|
},
|
|
8415
|
-
"Learn more about moving to production with
|
|
8421
|
+
"Learn more about moving to production with TinaCloud."
|
|
8416
8422
|
)), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement(
|
|
8417
8423
|
Button$1,
|
|
8418
8424
|
{
|
|
@@ -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);
|
|
@@ -9441,7 +9450,7 @@ const E_BAD_ROUTE = new MediaListError({
|
|
|
9441
9450
|
});
|
|
9442
9451
|
new MediaListError({
|
|
9443
9452
|
title: "An Error Occurred",
|
|
9444
|
-
message: "Something went wrong accessing your media from
|
|
9453
|
+
message: "Something went wrong accessing your media from TinaCloud.",
|
|
9445
9454
|
docsLink: ""
|
|
9446
9455
|
// TODO
|
|
9447
9456
|
});
|
|
@@ -9626,7 +9635,7 @@ let Alerts$1 = class Alerts {
|
|
|
9626
9635
|
return this.add("error", message, timeout);
|
|
9627
9636
|
}
|
|
9628
9637
|
};
|
|
9629
|
-
const
|
|
9638
|
+
const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React.createElement(
|
|
9630
9639
|
"div",
|
|
9631
9640
|
{
|
|
9632
9641
|
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
@@ -9639,25 +9648,8 @@ const NoFormsPlaceholder = () => /* @__PURE__ */ React.createElement(
|
|
|
9639
9648
|
animationDuration: "150ms"
|
|
9640
9649
|
}
|
|
9641
9650
|
},
|
|
9642
|
-
/* @__PURE__ */ React.createElement(
|
|
9643
|
-
/* @__PURE__ */ React.createElement(
|
|
9644
|
-
/* @__PURE__ */ React.createElement("p", { className: "block" }, /* @__PURE__ */ React.createElement(
|
|
9645
|
-
Button$1,
|
|
9646
|
-
{
|
|
9647
|
-
href: "https://tina.io/docs/tinacms-context/",
|
|
9648
|
-
target: "_blank",
|
|
9649
|
-
as: "a"
|
|
9650
|
-
},
|
|
9651
|
-
/* @__PURE__ */ React.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
9652
|
-
" Contextual Editing"
|
|
9653
|
-
))
|
|
9654
|
-
);
|
|
9655
|
-
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
|
|
9656
|
-
"span",
|
|
9657
|
-
{
|
|
9658
|
-
className: `text-[24px] leading-none inline-block ${className}`,
|
|
9659
|
-
...props
|
|
9660
|
-
}
|
|
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)" })
|
|
9661
9653
|
);
|
|
9662
9654
|
class SidebarState {
|
|
9663
9655
|
constructor(events, options = {}) {
|
|
@@ -9672,7 +9664,7 @@ class SidebarState {
|
|
|
9672
9664
|
};
|
|
9673
9665
|
this.position = options.position || "displace";
|
|
9674
9666
|
this.renderNav = options.renderNav || true;
|
|
9675
|
-
this.
|
|
9667
|
+
this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
|
|
9676
9668
|
if ((_a = options.buttons) == null ? void 0 : _a.save) {
|
|
9677
9669
|
this.buttons.save = options.buttons.save;
|
|
9678
9670
|
}
|
|
@@ -9746,238 +9738,6 @@ const ModalLayout = ({ children, name, close: close2, layout }) => {
|
|
|
9746
9738
|
children
|
|
9747
9739
|
)));
|
|
9748
9740
|
};
|
|
9749
|
-
const Item = ({
|
|
9750
|
-
item,
|
|
9751
|
-
depth,
|
|
9752
|
-
setActiveFormId
|
|
9753
|
-
}) => {
|
|
9754
|
-
const cms = useCMS();
|
|
9755
|
-
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
9756
|
-
const form = React.useMemo(
|
|
9757
|
-
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
9758
|
-
[item.formId]
|
|
9759
|
-
);
|
|
9760
|
-
return /* @__PURE__ */ React.createElement(
|
|
9761
|
-
"button",
|
|
9762
|
-
{
|
|
9763
|
-
type: "button",
|
|
9764
|
-
key: item.path,
|
|
9765
|
-
onClick: () => setActiveFormId(item.formId),
|
|
9766
|
-
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`
|
|
9767
|
-
},
|
|
9768
|
-
/* @__PURE__ */ React.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
|
|
9769
|
-
/* @__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))
|
|
9770
|
-
);
|
|
9771
|
-
};
|
|
9772
|
-
const FormListItem = ({
|
|
9773
|
-
item,
|
|
9774
|
-
depth,
|
|
9775
|
-
setActiveFormId
|
|
9776
|
-
}) => {
|
|
9777
|
-
var _a;
|
|
9778
|
-
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) => {
|
|
9779
|
-
if (subItem.type === "document") {
|
|
9780
|
-
return /* @__PURE__ */ React.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React.createElement(
|
|
9781
|
-
Item,
|
|
9782
|
-
{
|
|
9783
|
-
setActiveFormId,
|
|
9784
|
-
depth: depth + 1,
|
|
9785
|
-
item: subItem
|
|
9786
|
-
}
|
|
9787
|
-
));
|
|
9788
|
-
}
|
|
9789
|
-
})));
|
|
9790
|
-
};
|
|
9791
|
-
const FormLists = (props) => {
|
|
9792
|
-
const cms = useCMS();
|
|
9793
|
-
return /* @__PURE__ */ React.createElement(
|
|
9794
|
-
Transition,
|
|
9795
|
-
{
|
|
9796
|
-
appear: true,
|
|
9797
|
-
show: true,
|
|
9798
|
-
as: "div",
|
|
9799
|
-
enter: "transition-all ease-out duration-150",
|
|
9800
|
-
enterFrom: "opacity-0 -translate-x-1/2",
|
|
9801
|
-
enterTo: "opacity-100",
|
|
9802
|
-
leave: "transition-all ease-out duration-150",
|
|
9803
|
-
leaveFrom: "opacity-100",
|
|
9804
|
-
leaveTo: "opacity-0 -translate-x-1/2"
|
|
9805
|
-
},
|
|
9806
|
-
cms.state.formLists.map((formList, index) => /* @__PURE__ */ React.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React.createElement(
|
|
9807
|
-
FormList,
|
|
9808
|
-
{
|
|
9809
|
-
isEditing: props.isEditing,
|
|
9810
|
-
setActiveFormId: (id) => {
|
|
9811
|
-
cms.dispatch({ type: "forms:set-active-form-id", value: id });
|
|
9812
|
-
},
|
|
9813
|
-
formList
|
|
9814
|
-
}
|
|
9815
|
-
)))
|
|
9816
|
-
);
|
|
9817
|
-
};
|
|
9818
|
-
const FormList = (props) => {
|
|
9819
|
-
const cms = useCMS();
|
|
9820
|
-
const listItems = React.useMemo(() => {
|
|
9821
|
-
var _a;
|
|
9822
|
-
const orderedListItems = [];
|
|
9823
|
-
const globalItems = [];
|
|
9824
|
-
const topItems = [];
|
|
9825
|
-
props.formList.items.forEach((item) => {
|
|
9826
|
-
if (item.type === "document") {
|
|
9827
|
-
const form = cms.state.forms.find(
|
|
9828
|
-
({ tinaForm }) => tinaForm.id === item.formId
|
|
9829
|
-
);
|
|
9830
|
-
if (form.tinaForm.global) {
|
|
9831
|
-
globalItems.push(item);
|
|
9832
|
-
} else {
|
|
9833
|
-
orderedListItems.push(item);
|
|
9834
|
-
}
|
|
9835
|
-
} else {
|
|
9836
|
-
orderedListItems.push(item);
|
|
9837
|
-
}
|
|
9838
|
-
});
|
|
9839
|
-
if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
|
|
9840
|
-
topItems.push({ type: "list", label: "Documents" });
|
|
9841
|
-
}
|
|
9842
|
-
let extra = [];
|
|
9843
|
-
if (globalItems.length) {
|
|
9844
|
-
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
9845
|
-
}
|
|
9846
|
-
return [...topItems, ...orderedListItems, ...extra];
|
|
9847
|
-
}, [JSON.stringify(props.formList.items)]);
|
|
9848
|
-
return /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
9849
|
-
if (item.type === "list") {
|
|
9850
|
-
return /* @__PURE__ */ React.createElement(
|
|
9851
|
-
"div",
|
|
9852
|
-
{
|
|
9853
|
-
key: item.label,
|
|
9854
|
-
className: `relative group text-left w-full bg-white shadow-sm
|
|
9855
|
-
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"}`
|
|
9856
|
-
},
|
|
9857
|
-
/* @__PURE__ */ React.createElement(
|
|
9858
|
-
"span",
|
|
9859
|
-
{
|
|
9860
|
-
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
9861
|
-
},
|
|
9862
|
-
item.label
|
|
9863
|
-
)
|
|
9864
|
-
);
|
|
9865
|
-
}
|
|
9866
|
-
return /* @__PURE__ */ React.createElement(
|
|
9867
|
-
FormListItem,
|
|
9868
|
-
{
|
|
9869
|
-
setActiveFormId: (id) => props.setActiveFormId(id),
|
|
9870
|
-
key: item.formId,
|
|
9871
|
-
item,
|
|
9872
|
-
depth: 0
|
|
9873
|
-
}
|
|
9874
|
-
);
|
|
9875
|
-
})));
|
|
9876
|
-
};
|
|
9877
|
-
const FormsView = ({
|
|
9878
|
-
children
|
|
9879
|
-
}) => {
|
|
9880
|
-
const cms = useCMS$1();
|
|
9881
|
-
const { setFormIsPristine } = React.useContext(SidebarContext);
|
|
9882
|
-
const isMultiform = cms.state.forms.length > 1;
|
|
9883
|
-
const activeForm = cms.state.forms.find(
|
|
9884
|
-
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
9885
|
-
);
|
|
9886
|
-
const isEditing = !!activeForm;
|
|
9887
|
-
if (!cms.state.formLists.length) {
|
|
9888
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", children, " ");
|
|
9889
|
-
}
|
|
9890
|
-
if (isMultiform && !activeForm) {
|
|
9891
|
-
return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
|
|
9892
|
-
}
|
|
9893
|
-
const formMetas = cms.plugins.all("form:meta");
|
|
9894
|
-
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 })));
|
|
9895
|
-
};
|
|
9896
|
-
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
9897
|
-
return /* @__PURE__ */ React.createElement(
|
|
9898
|
-
"div",
|
|
9899
|
-
{
|
|
9900
|
-
className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
|
|
9901
|
-
style: isEditing ? {
|
|
9902
|
-
transform: "none",
|
|
9903
|
-
animationName: "fly-in-left",
|
|
9904
|
-
animationDuration: "150ms",
|
|
9905
|
-
animationDelay: "0",
|
|
9906
|
-
animationIterationCount: 1,
|
|
9907
|
-
animationTimingFunction: "ease-out"
|
|
9908
|
-
} : {
|
|
9909
|
-
transform: "translate3d(100%, 0, 0)"
|
|
9910
|
-
}
|
|
9911
|
-
},
|
|
9912
|
-
children
|
|
9913
|
-
);
|
|
9914
|
-
};
|
|
9915
|
-
const MultiformFormHeader = ({
|
|
9916
|
-
activeForm
|
|
9917
|
-
}) => {
|
|
9918
|
-
const cms = useCMS$1();
|
|
9919
|
-
const { formIsPristine } = React.useContext(SidebarContext);
|
|
9920
|
-
return /* @__PURE__ */ React.createElement(
|
|
9921
|
-
"div",
|
|
9922
|
-
{
|
|
9923
|
-
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9924
|
-
},
|
|
9925
|
-
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
9926
|
-
"button",
|
|
9927
|
-
{
|
|
9928
|
-
type: "button",
|
|
9929
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9930
|
-
onClick: () => {
|
|
9931
|
-
const state = activeForm.tinaForm.finalForm.getState();
|
|
9932
|
-
if (state.invalid === true) {
|
|
9933
|
-
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
9934
|
-
} else {
|
|
9935
|
-
cms.dispatch({ type: "forms:set-active-form-id", value: null });
|
|
9936
|
-
}
|
|
9937
|
-
}
|
|
9938
|
-
},
|
|
9939
|
-
/* @__PURE__ */ React.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9940
|
-
), /* @__PURE__ */ React.createElement(
|
|
9941
|
-
"button",
|
|
9942
|
-
{
|
|
9943
|
-
type: "button",
|
|
9944
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9945
|
-
onClick: () => {
|
|
9946
|
-
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9947
|
-
cms.state.activeFormId
|
|
9948
|
-
).name;
|
|
9949
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9950
|
-
}
|
|
9951
|
-
},
|
|
9952
|
-
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9953
|
-
), /* @__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 }))
|
|
9954
|
-
);
|
|
9955
|
-
};
|
|
9956
|
-
const FormHeader = ({ activeForm }) => {
|
|
9957
|
-
const { formIsPristine } = React.useContext(SidebarContext);
|
|
9958
|
-
const cms = useCMS$1();
|
|
9959
|
-
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
9960
|
-
return /* @__PURE__ */ React.createElement(
|
|
9961
|
-
"div",
|
|
9962
|
-
{
|
|
9963
|
-
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9964
|
-
},
|
|
9965
|
-
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
9966
|
-
"button",
|
|
9967
|
-
{
|
|
9968
|
-
type: "button",
|
|
9969
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9970
|
-
onClick: () => {
|
|
9971
|
-
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9972
|
-
cms.state.activeFormId
|
|
9973
|
-
).name;
|
|
9974
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9975
|
-
}
|
|
9976
|
-
},
|
|
9977
|
-
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9978
|
-
), shortFormLabel && /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9979
|
-
);
|
|
9980
|
-
};
|
|
9981
9741
|
function ImFilesEmpty(props) {
|
|
9982
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);
|
|
9983
9743
|
}
|
|
@@ -10220,7 +9980,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10220
9980
|
"Event Log"
|
|
10221
9981
|
));
|
|
10222
9982
|
};
|
|
10223
|
-
const version = "2.7.
|
|
9983
|
+
const version = "2.7.4";
|
|
10224
9984
|
const Nav = ({
|
|
10225
9985
|
isLocalMode,
|
|
10226
9986
|
className = "",
|
|
@@ -10462,6 +10222,293 @@ const ResizeHandle = () => {
|
|
|
10462
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" })
|
|
10463
10223
|
);
|
|
10464
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
|
+
};
|
|
10465
10512
|
const SidebarContext = React.createContext(null);
|
|
10466
10513
|
const minPreviewWidth = 440;
|
|
10467
10514
|
const minSidebarWidth = 360;
|
|
@@ -10680,7 +10727,7 @@ const Sidebar$1 = ({
|
|
|
10680
10727
|
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
|
|
10681
10728
|
branchingEnabled
|
|
10682
10729
|
}
|
|
10683
|
-
), /* @__PURE__ */ React.createElement(FormsView,
|
|
10730
|
+
), /* @__PURE__ */ React.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React.createElement(
|
|
10684
10731
|
ScreenPluginModal,
|
|
10685
10732
|
{
|
|
10686
10733
|
screen: activeScreen,
|
|
@@ -10856,7 +10903,7 @@ const SidebarHeader = ({
|
|
|
10856
10903
|
className: "h-5 w-auto -mx-1 text-blue-500",
|
|
10857
10904
|
stroke: "currentColor",
|
|
10858
10905
|
fill: "currentColor",
|
|
10859
|
-
|
|
10906
|
+
strokeWidth: "0",
|
|
10860
10907
|
viewBox: "0 0 24 24",
|
|
10861
10908
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10862
10909
|
},
|
|
@@ -10996,6 +11043,93 @@ function createPlaceholder(name, _pr) {
|
|
|
10996
11043
|
);
|
|
10997
11044
|
};
|
|
10998
11045
|
}
|
|
11046
|
+
function dirname(path) {
|
|
11047
|
+
var _a, _b;
|
|
11048
|
+
const pattern = new RegExp("(?<prevDir>.*)/");
|
|
11049
|
+
return (_b = (_a = path.match(pattern)) == null ? void 0 : _a.groups) == null ? void 0 : _b.prevDir;
|
|
11050
|
+
}
|
|
11051
|
+
const BreadcrumbButton = ({ className = "", ...props }) => /* @__PURE__ */ React__default.createElement(
|
|
11052
|
+
"button",
|
|
11053
|
+
{
|
|
11054
|
+
className: "capitalize transition-colors duration-150 border-0 bg-transparent hover:text-blue-500 " + className,
|
|
11055
|
+
...props
|
|
11056
|
+
}
|
|
11057
|
+
);
|
|
11058
|
+
function Breadcrumb$1({ directory = "", setDirectory }) {
|
|
11059
|
+
directory = directory.replace(/^\/|\/$/g, "");
|
|
11060
|
+
let prevDir = dirname(directory) || "";
|
|
11061
|
+
if (prevDir === ".") {
|
|
11062
|
+
prevDir = "";
|
|
11063
|
+
}
|
|
11064
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "w-full flex items-center text-[16px] text-gray-300" }, directory !== "" && /* @__PURE__ */ React__default.createElement(
|
|
11065
|
+
IconButton,
|
|
11066
|
+
{
|
|
11067
|
+
variant: "ghost",
|
|
11068
|
+
className: "mr-2",
|
|
11069
|
+
onClick: () => setDirectory(prevDir)
|
|
11070
|
+
},
|
|
11071
|
+
/* @__PURE__ */ React__default.createElement(
|
|
11072
|
+
LeftArrowIcon,
|
|
11073
|
+
{
|
|
11074
|
+
className: `w-7 h-auto fill-gray-300 hover:fill-gray-900 transition duration-150 ease-out`
|
|
11075
|
+
}
|
|
11076
|
+
)
|
|
11077
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
11078
|
+
BreadcrumbButton,
|
|
11079
|
+
{
|
|
11080
|
+
onClick: () => setDirectory(""),
|
|
11081
|
+
className: directory === "" ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"
|
|
11082
|
+
},
|
|
11083
|
+
"Media"
|
|
11084
|
+
), directory && directory.split("/").map((part, index, parts) => {
|
|
11085
|
+
const currentDir = parts.slice(0, index + 1).join("/");
|
|
11086
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11087
|
+
BreadcrumbButton,
|
|
11088
|
+
{
|
|
11089
|
+
className: "pl-1.5 " + (index + 1 === parts.length ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"),
|
|
11090
|
+
key: currentDir,
|
|
11091
|
+
onClick: () => {
|
|
11092
|
+
setDirectory(currentDir);
|
|
11093
|
+
}
|
|
11094
|
+
},
|
|
11095
|
+
part
|
|
11096
|
+
);
|
|
11097
|
+
}));
|
|
11098
|
+
}
|
|
11099
|
+
const CopyField = ({ label, description, value }) => {
|
|
11100
|
+
const [copied, setCopied] = React__default.useState(false);
|
|
11101
|
+
const [fadeOut, setFadeOut] = React__default.useState(false);
|
|
11102
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "w-full" }, label && /* @__PURE__ */ React__default.createElement("label", { className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700" }, label), /* @__PURE__ */ React__default.createElement(
|
|
11103
|
+
"span",
|
|
11104
|
+
{
|
|
11105
|
+
onClick: () => {
|
|
11106
|
+
if (copied === true)
|
|
11107
|
+
return;
|
|
11108
|
+
setCopied(true);
|
|
11109
|
+
setTimeout(() => {
|
|
11110
|
+
setFadeOut(true);
|
|
11111
|
+
}, 2500);
|
|
11112
|
+
setTimeout(() => {
|
|
11113
|
+
setCopied(false);
|
|
11114
|
+
setFadeOut(false);
|
|
11115
|
+
}, 3e3);
|
|
11116
|
+
navigator.clipboard.writeText(value);
|
|
11117
|
+
},
|
|
11118
|
+
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
11119
|
+
},
|
|
11120
|
+
/* @__PURE__ */ React__default.createElement(BiCopyAlt, { className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20" }),
|
|
11121
|
+
" ",
|
|
11122
|
+
value,
|
|
11123
|
+
" ",
|
|
11124
|
+
copied && /* @__PURE__ */ React__default.createElement(
|
|
11125
|
+
"span",
|
|
11126
|
+
{
|
|
11127
|
+
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
11128
|
+
},
|
|
11129
|
+
/* @__PURE__ */ React__default.createElement("span", null, "Copied to clipboard!")
|
|
11130
|
+
)
|
|
11131
|
+
), description && /* @__PURE__ */ React__default.createElement("p", { className: "mt-2 text-sm text-gray-500" }, description));
|
|
11132
|
+
};
|
|
10999
11133
|
function ListMediaItem({ item, onClick, active }) {
|
|
11000
11134
|
let FileIcon = BiFile;
|
|
11001
11135
|
if (item.type === "dir") {
|
|
@@ -11071,59 +11205,6 @@ function GridMediaItem({ item, active, onClick }) {
|
|
|
11071
11205
|
)
|
|
11072
11206
|
);
|
|
11073
11207
|
}
|
|
11074
|
-
function dirname(path) {
|
|
11075
|
-
var _a, _b;
|
|
11076
|
-
const pattern = new RegExp("(?<prevDir>.*)/");
|
|
11077
|
-
return (_b = (_a = path.match(pattern)) == null ? void 0 : _a.groups) == null ? void 0 : _b.prevDir;
|
|
11078
|
-
}
|
|
11079
|
-
const BreadcrumbButton = ({ className = "", ...props }) => /* @__PURE__ */ React__default.createElement(
|
|
11080
|
-
"button",
|
|
11081
|
-
{
|
|
11082
|
-
className: "capitalize transition-colors duration-150 border-0 bg-transparent hover:text-blue-500 " + className,
|
|
11083
|
-
...props
|
|
11084
|
-
}
|
|
11085
|
-
);
|
|
11086
|
-
function Breadcrumb$1({ directory = "", setDirectory }) {
|
|
11087
|
-
directory = directory.replace(/^\/|\/$/g, "");
|
|
11088
|
-
let prevDir = dirname(directory) || "";
|
|
11089
|
-
if (prevDir === ".") {
|
|
11090
|
-
prevDir = "";
|
|
11091
|
-
}
|
|
11092
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "w-full flex items-center text-[16px] text-gray-300" }, directory !== "" && /* @__PURE__ */ React__default.createElement(
|
|
11093
|
-
IconButton,
|
|
11094
|
-
{
|
|
11095
|
-
variant: "ghost",
|
|
11096
|
-
className: "mr-2",
|
|
11097
|
-
onClick: () => setDirectory(prevDir)
|
|
11098
|
-
},
|
|
11099
|
-
/* @__PURE__ */ React__default.createElement(
|
|
11100
|
-
LeftArrowIcon,
|
|
11101
|
-
{
|
|
11102
|
-
className: `w-7 h-auto fill-gray-300 hover:fill-gray-900 transition duration-150 ease-out`
|
|
11103
|
-
}
|
|
11104
|
-
)
|
|
11105
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
11106
|
-
BreadcrumbButton,
|
|
11107
|
-
{
|
|
11108
|
-
onClick: () => setDirectory(""),
|
|
11109
|
-
className: directory === "" ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"
|
|
11110
|
-
},
|
|
11111
|
-
"Media"
|
|
11112
|
-
), directory && directory.split("/").map((part, index, parts) => {
|
|
11113
|
-
const currentDir = parts.slice(0, index + 1).join("/");
|
|
11114
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11115
|
-
BreadcrumbButton,
|
|
11116
|
-
{
|
|
11117
|
-
className: "pl-1.5 " + (index + 1 === parts.length ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"),
|
|
11118
|
-
key: currentDir,
|
|
11119
|
-
onClick: () => {
|
|
11120
|
-
setDirectory(currentDir);
|
|
11121
|
-
}
|
|
11122
|
-
},
|
|
11123
|
-
part
|
|
11124
|
-
);
|
|
11125
|
-
}));
|
|
11126
|
-
}
|
|
11127
11208
|
const DeleteModal$1 = ({
|
|
11128
11209
|
close: close2,
|
|
11129
11210
|
deleteFunc,
|
|
@@ -11177,40 +11258,6 @@ const NewFolderModal = ({ onSubmit, close: close2 }) => {
|
|
|
11177
11258
|
"Create New Folder"
|
|
11178
11259
|
))));
|
|
11179
11260
|
};
|
|
11180
|
-
const CopyField = ({ label, description, value }) => {
|
|
11181
|
-
const [copied, setCopied] = React__default.useState(false);
|
|
11182
|
-
const [fadeOut, setFadeOut] = React__default.useState(false);
|
|
11183
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "w-full" }, label && /* @__PURE__ */ React__default.createElement("label", { className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700" }, label), /* @__PURE__ */ React__default.createElement(
|
|
11184
|
-
"span",
|
|
11185
|
-
{
|
|
11186
|
-
onClick: () => {
|
|
11187
|
-
if (copied === true)
|
|
11188
|
-
return;
|
|
11189
|
-
setCopied(true);
|
|
11190
|
-
setTimeout(() => {
|
|
11191
|
-
setFadeOut(true);
|
|
11192
|
-
}, 2500);
|
|
11193
|
-
setTimeout(() => {
|
|
11194
|
-
setCopied(false);
|
|
11195
|
-
setFadeOut(false);
|
|
11196
|
-
}, 3e3);
|
|
11197
|
-
navigator.clipboard.writeText(value);
|
|
11198
|
-
},
|
|
11199
|
-
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
11200
|
-
},
|
|
11201
|
-
/* @__PURE__ */ React__default.createElement(BiCopyAlt, { className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20" }),
|
|
11202
|
-
" ",
|
|
11203
|
-
value,
|
|
11204
|
-
" ",
|
|
11205
|
-
copied && /* @__PURE__ */ React__default.createElement(
|
|
11206
|
-
"span",
|
|
11207
|
-
{
|
|
11208
|
-
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
11209
|
-
},
|
|
11210
|
-
/* @__PURE__ */ React__default.createElement("span", null, "Copied to clipboard!")
|
|
11211
|
-
)
|
|
11212
|
-
), description && /* @__PURE__ */ React__default.createElement("p", { className: "mt-2 text-sm text-gray-500" }, description));
|
|
11213
|
-
};
|
|
11214
11261
|
const { useDropzone } = dropzone;
|
|
11215
11262
|
const join = function(...parts) {
|
|
11216
11263
|
const [first, last, slash] = [0, parts.length - 1, "/"];
|
|
@@ -11446,7 +11493,10 @@ function MediaPicker({
|
|
|
11446
11493
|
const observer = new IntersectionObserver((entries) => {
|
|
11447
11494
|
const target = entries[0];
|
|
11448
11495
|
if (target.isIntersecting && list.nextOffset) {
|
|
11449
|
-
setOffsetHistory((offsetHistory2) => [
|
|
11496
|
+
setOffsetHistory((offsetHistory2) => [
|
|
11497
|
+
...offsetHistory2,
|
|
11498
|
+
list.nextOffset
|
|
11499
|
+
]);
|
|
11450
11500
|
}
|
|
11451
11501
|
});
|
|
11452
11502
|
if (loaderRef.current) {
|
|
@@ -11709,7 +11759,7 @@ const SyncStatusContainer = ({ children }) => {
|
|
|
11709
11759
|
target: "_blank",
|
|
11710
11760
|
href: `${cms.api.tina.appDashboardLink}/media`
|
|
11711
11761
|
},
|
|
11712
|
-
"Sync Your Media In
|
|
11762
|
+
"Sync Your Media In TinaCloud.",
|
|
11713
11763
|
/* @__PURE__ */ React__default.createElement(BiLinkExternal, { className: `w-5 h-auto flex-shrink-0` })
|
|
11714
11764
|
)
|
|
11715
11765
|
)))) : /* @__PURE__ */ React__default.createElement(SyncStatusContext.Provider, { value: { syncStatus } }, children);
|
|
@@ -12041,6 +12091,7 @@ const initialState = (cms) => {
|
|
|
12041
12091
|
forms: [],
|
|
12042
12092
|
formLists: [],
|
|
12043
12093
|
editingMode: "basic",
|
|
12094
|
+
isLoadingContent: false,
|
|
12044
12095
|
quickEditSupported: false,
|
|
12045
12096
|
sidebarDisplayState: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.defaultState) || "open"
|
|
12046
12097
|
};
|
|
@@ -12100,7 +12151,12 @@ function tinaReducer(state, action) {
|
|
|
12100
12151
|
}
|
|
12101
12152
|
});
|
|
12102
12153
|
}
|
|
12103
|
-
return {
|
|
12154
|
+
return {
|
|
12155
|
+
...state,
|
|
12156
|
+
activeFormId,
|
|
12157
|
+
formLists: nextFormLists,
|
|
12158
|
+
isLoadingContent: false
|
|
12159
|
+
};
|
|
12104
12160
|
}
|
|
12105
12161
|
case "form-lists:remove": {
|
|
12106
12162
|
const nextFormLists = state.formLists.filter(
|
|
@@ -12169,6 +12225,9 @@ function tinaReducer(state, action) {
|
|
|
12169
12225
|
}
|
|
12170
12226
|
return { ...state, sidebarDisplayState: action.value };
|
|
12171
12227
|
}
|
|
12228
|
+
case "sidebar:set-loading-state": {
|
|
12229
|
+
return { ...state, isLoadingContent: action.value };
|
|
12230
|
+
}
|
|
12172
12231
|
default:
|
|
12173
12232
|
throw new Error(`Unhandled action ${action.type}`);
|
|
12174
12233
|
}
|
|
@@ -12410,7 +12469,9 @@ const ActiveFieldIndicator = () => {
|
|
|
12410
12469
|
if (activeEle) {
|
|
12411
12470
|
setDisplay(true);
|
|
12412
12471
|
setPosition(activeEle.getBoundingClientRect());
|
|
12413
|
-
const iframe = document.getElementById(
|
|
12472
|
+
const iframe = document.getElementById(
|
|
12473
|
+
"tina-iframe"
|
|
12474
|
+
);
|
|
12414
12475
|
if (iframe) {
|
|
12415
12476
|
setIframePosition(iframe.getBoundingClientRect());
|
|
12416
12477
|
}
|
|
@@ -12852,7 +12913,6 @@ const CreateBranchModel = ({
|
|
|
12852
12913
|
}) => {
|
|
12853
12914
|
const cms = useCMS$1();
|
|
12854
12915
|
const tinaApi = cms.api.tina;
|
|
12855
|
-
tinaApi.branch;
|
|
12856
12916
|
const [disabled, setDisabled] = React.useState(false);
|
|
12857
12917
|
const [newBranchName, setNewBranchName] = React.useState("");
|
|
12858
12918
|
const [error, setError] = React.useState("");
|
|
@@ -12878,10 +12938,10 @@ const CreateBranchModel = ({
|
|
|
12878
12938
|
const newUrl = window.location.href.replace(hash, newHash);
|
|
12879
12939
|
window.location.href = newUrl;
|
|
12880
12940
|
};
|
|
12881
|
-
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(
|
|
12882
12942
|
PrefixedTextField,
|
|
12883
12943
|
{
|
|
12884
|
-
placeholder: "
|
|
12944
|
+
placeholder: "e.g. {{PAGE-NAME}}-updates",
|
|
12885
12945
|
value: newBranchName,
|
|
12886
12946
|
onChange: (e) => {
|
|
12887
12947
|
setError("");
|
|
@@ -13028,7 +13088,9 @@ const ImgEmbed = ({
|
|
|
13028
13088
|
const { fieldName } = useTemplates();
|
|
13029
13089
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13030
13090
|
useHotkey("enter", () => {
|
|
13031
|
-
insertNodes(editor, [
|
|
13091
|
+
insertNodes(editor, [
|
|
13092
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13093
|
+
]);
|
|
13032
13094
|
});
|
|
13033
13095
|
return /* @__PURE__ */ React__default.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React__default.createElement(
|
|
13034
13096
|
"div",
|
|
@@ -13171,7 +13233,9 @@ const InlineEmbed = ({
|
|
|
13171
13233
|
const { templates, fieldName } = useTemplates();
|
|
13172
13234
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13173
13235
|
useHotkey("enter", () => {
|
|
13174
|
-
insertNodes(editor, [
|
|
13236
|
+
insertNodes(editor, [
|
|
13237
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13238
|
+
]);
|
|
13175
13239
|
});
|
|
13176
13240
|
useHotkey("space", () => {
|
|
13177
13241
|
insertNodes(editor, [{ text: " " }], {
|
|
@@ -13227,7 +13291,9 @@ const BlockEmbed = ({
|
|
|
13227
13291
|
const { templates, fieldName } = useTemplates();
|
|
13228
13292
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13229
13293
|
useHotkey("enter", () => {
|
|
13230
|
-
insertNodes(editor, [
|
|
13294
|
+
insertNodes(editor, [
|
|
13295
|
+
{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13296
|
+
]);
|
|
13231
13297
|
});
|
|
13232
13298
|
const activeTemplate = templates.find(
|
|
13233
13299
|
(template) => template.name === element.name
|
|
@@ -14086,7 +14152,9 @@ const EMBED_ICON_WIDTH = 78;
|
|
|
14086
14152
|
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14087
14153
|
const FLOAT_BUTTON_WIDTH = 25;
|
|
14088
14154
|
const HEADING_LABEL = "Headings";
|
|
14089
|
-
const ToolbarContext = createContext(
|
|
14155
|
+
const ToolbarContext = createContext(
|
|
14156
|
+
void 0
|
|
14157
|
+
);
|
|
14090
14158
|
const ToolbarProvider = ({
|
|
14091
14159
|
tinaForm,
|
|
14092
14160
|
templates,
|
|
@@ -14236,7 +14304,7 @@ const useCodeBlockToolbarButton = (state) => {
|
|
|
14236
14304
|
const CodeBlockToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14237
14305
|
const state = useCodeBlockToolbarButtonState();
|
|
14238
14306
|
const { props } = useCodeBlockToolbarButton(state);
|
|
14239
|
-
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));
|
|
14240
14308
|
});
|
|
14241
14309
|
const useImageToolbarButtonState = () => {
|
|
14242
14310
|
const editor = useEditorState();
|
|
@@ -14268,36 +14336,54 @@ const useImageToolbarButton = (state) => {
|
|
|
14268
14336
|
const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14269
14337
|
const state = useImageToolbarButtonState();
|
|
14270
14338
|
const { props } = useImageToolbarButton(state);
|
|
14271
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "
|
|
14272
|
-
});
|
|
14273
|
-
const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
|
|
14274
|
-
const editor = useEditorState();
|
|
14275
|
-
const state = useListToolbarButtonState({ nodeType });
|
|
14276
|
-
const { props } = useListToolbarButton(state);
|
|
14277
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14278
|
-
ToolbarButton,
|
|
14279
|
-
{
|
|
14280
|
-
ref,
|
|
14281
|
-
tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14282
|
-
...props,
|
|
14283
|
-
onClick: (e) => {
|
|
14284
|
-
e.preventDefault();
|
|
14285
|
-
e.stopPropagation();
|
|
14286
|
-
toggleList(editor, { type: nodeType });
|
|
14287
|
-
}
|
|
14288
|
-
},
|
|
14289
|
-
nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
|
|
14290
|
-
);
|
|
14339
|
+
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
|
|
14291
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
|
+
);
|
|
14292
14383
|
const LinkToolbarButton = withRef((rest, ref) => {
|
|
14293
14384
|
const state = useLinkToolbarButtonState();
|
|
14294
14385
|
const { props } = useLinkToolbarButton(state);
|
|
14295
|
-
return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link"
|
|
14296
|
-
});
|
|
14297
|
-
const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14298
|
-
const state = useMarkToolbarButtonState({ clear, nodeType });
|
|
14299
|
-
const { props } = useMarkToolbarButton(state);
|
|
14300
|
-
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));
|
|
14301
14387
|
});
|
|
14302
14388
|
const useMermaidToolbarButtonState = () => {
|
|
14303
14389
|
const editor = useEditorState();
|
|
@@ -14378,7 +14464,7 @@ const useBlockQuoteToolbarButton = (state) => {
|
|
|
14378
14464
|
const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14379
14465
|
const state = useBlockQuoteToolbarButtonState();
|
|
14380
14466
|
const { props } = useBlockQuoteToolbarButton(state);
|
|
14381
|
-
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));
|
|
14382
14468
|
});
|
|
14383
14469
|
const useRawMarkdownToolbarButton = () => {
|
|
14384
14470
|
const { setRawMode } = useEditorContext();
|
|
@@ -14398,7 +14484,7 @@ const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
|
14398
14484
|
ToolbarButton,
|
|
14399
14485
|
{
|
|
14400
14486
|
ref,
|
|
14401
|
-
tooltip: "
|
|
14487
|
+
tooltip: "Raw Markdown",
|
|
14402
14488
|
...rest,
|
|
14403
14489
|
...props,
|
|
14404
14490
|
"data-testid": "markdown-button"
|
|
@@ -14551,6 +14637,15 @@ const EmbedButton = ({ editor, templates }) => {
|
|
|
14551
14637
|
template.label || template.name
|
|
14552
14638
|
))));
|
|
14553
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));
|
|
14554
14649
|
const toolbarItems = {
|
|
14555
14650
|
heading: {
|
|
14556
14651
|
label: HEADING_LABEL,
|
|
@@ -14571,37 +14666,37 @@ const toolbarItems = {
|
|
|
14571
14666
|
quote: {
|
|
14572
14667
|
label: "Quote",
|
|
14573
14668
|
width: () => STANDARD_ICON_WIDTH,
|
|
14574
|
-
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton,
|
|
14669
|
+
Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, null)
|
|
14575
14670
|
},
|
|
14576
14671
|
ul: {
|
|
14577
14672
|
label: "Unordered List",
|
|
14578
14673
|
width: () => STANDARD_ICON_WIDTH,
|
|
14579
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14674
|
+
Component: /* @__PURE__ */ React__default.createElement(UnorderedListToolbarButton, null)
|
|
14580
14675
|
},
|
|
14581
14676
|
ol: {
|
|
14582
14677
|
label: "Ordered List",
|
|
14583
14678
|
width: () => STANDARD_ICON_WIDTH,
|
|
14584
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14679
|
+
Component: /* @__PURE__ */ React__default.createElement(OrderedListToolbarButton, null)
|
|
14585
14680
|
},
|
|
14586
14681
|
bold: {
|
|
14587
14682
|
label: "Bold",
|
|
14588
14683
|
width: () => STANDARD_ICON_WIDTH,
|
|
14589
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14684
|
+
Component: /* @__PURE__ */ React__default.createElement(BoldToolbarButton, null)
|
|
14590
14685
|
},
|
|
14591
14686
|
strikethrough: {
|
|
14592
14687
|
label: "Strikethrough",
|
|
14593
14688
|
width: () => STANDARD_ICON_WIDTH,
|
|
14594
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14689
|
+
Component: /* @__PURE__ */ React__default.createElement(StrikethroughToolbarButton, null)
|
|
14595
14690
|
},
|
|
14596
14691
|
italic: {
|
|
14597
14692
|
label: "Italic",
|
|
14598
14693
|
width: () => STANDARD_ICON_WIDTH,
|
|
14599
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14694
|
+
Component: /* @__PURE__ */ React__default.createElement(ItalicToolbarButton, null)
|
|
14600
14695
|
},
|
|
14601
14696
|
code: {
|
|
14602
14697
|
label: "Code",
|
|
14603
14698
|
width: () => STANDARD_ICON_WIDTH,
|
|
14604
|
-
Component: /* @__PURE__ */ React__default.createElement(
|
|
14699
|
+
Component: /* @__PURE__ */ React__default.createElement(CodeToolbarButton, null)
|
|
14605
14700
|
},
|
|
14606
14701
|
codeBlock: {
|
|
14607
14702
|
label: "Code Block",
|
|
@@ -30271,7 +30366,14 @@ const TINA_LOGIN_EVENT = "tinaCloudLogin";
|
|
|
30271
30366
|
const AUTH_TOKEN_KEY = "tinacms-auth";
|
|
30272
30367
|
const authenticate = (clientId, frontendUrl) => {
|
|
30273
30368
|
return new Promise((resolve) => {
|
|
30274
|
-
|
|
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
|
+
);
|
|
30275
30377
|
window.addEventListener("message", function(e) {
|
|
30276
30378
|
if (e.data.source === TINA_LOGIN_EVENT) {
|
|
30277
30379
|
if (authTab) {
|
|
@@ -30284,14 +30386,6 @@ const authenticate = (clientId, frontendUrl) => {
|
|
|
30284
30386
|
});
|
|
30285
30387
|
}
|
|
30286
30388
|
});
|
|
30287
|
-
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30288
|
-
authTab = popupWindow(
|
|
30289
|
-
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30290
|
-
"_blank",
|
|
30291
|
-
window,
|
|
30292
|
-
1e3,
|
|
30293
|
-
700
|
|
30294
|
-
);
|
|
30295
30389
|
});
|
|
30296
30390
|
};
|
|
30297
30391
|
const DefaultSessionProvider = ({
|
|
@@ -30644,7 +30738,7 @@ mutation addPendingDocumentMutation(
|
|
|
30644
30738
|
branch: ${this.branch}.`;
|
|
30645
30739
|
if (this.branch !== "main") {
|
|
30646
30740
|
errorMessage = `${errorMessage}
|
|
30647
|
-
Note: This error can occur if the branch does not exist on GitHub or on
|
|
30741
|
+
Note: This error can occur if the branch does not exist on GitHub or on TinaCloud`;
|
|
30648
30742
|
}
|
|
30649
30743
|
}
|
|
30650
30744
|
throw new Error(errorMessage);
|
|
@@ -30780,7 +30874,7 @@ mutation addPendingDocumentMutation(
|
|
|
30780
30874
|
unknownCount++;
|
|
30781
30875
|
if (unknownCount > 5) {
|
|
30782
30876
|
throw new Error(
|
|
30783
|
-
"AsyncPoller: status unknown for too long, please check indexing progress the
|
|
30877
|
+
"AsyncPoller: status unknown for too long, please check indexing progress the TinaCloud dashboard"
|
|
30784
30878
|
);
|
|
30785
30879
|
}
|
|
30786
30880
|
}
|
|
@@ -30997,56 +31091,6 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
30997
31091
|
!submitting && name
|
|
30998
31092
|
);
|
|
30999
31093
|
};
|
|
31000
|
-
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31001
|
-
const useTinaAuthRedirect = () => {
|
|
31002
|
-
useEffect(() => {
|
|
31003
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
31004
|
-
const config = {
|
|
31005
|
-
code: urlParams.get("code") || "",
|
|
31006
|
-
scope: urlParams.get("scope") || "email",
|
|
31007
|
-
state: urlParams.get("state")
|
|
31008
|
-
};
|
|
31009
|
-
if (!config.code) {
|
|
31010
|
-
return;
|
|
31011
|
-
}
|
|
31012
|
-
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31013
|
-
}, []);
|
|
31014
|
-
};
|
|
31015
|
-
const createClient = ({
|
|
31016
|
-
clientId,
|
|
31017
|
-
isLocalClient = true,
|
|
31018
|
-
branch,
|
|
31019
|
-
tinaioConfig,
|
|
31020
|
-
schema,
|
|
31021
|
-
apiUrl,
|
|
31022
|
-
tinaGraphQLVersion
|
|
31023
|
-
}) => {
|
|
31024
|
-
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31025
|
-
clientId: clientId || "",
|
|
31026
|
-
branch: branch || "main",
|
|
31027
|
-
tokenStorage: "LOCAL_STORAGE",
|
|
31028
|
-
tinaioConfig,
|
|
31029
|
-
schema,
|
|
31030
|
-
tinaGraphQLVersion
|
|
31031
|
-
});
|
|
31032
|
-
};
|
|
31033
|
-
function assertShape(value, yupSchema, errorMessage) {
|
|
31034
|
-
const shape = yupSchema(yup);
|
|
31035
|
-
try {
|
|
31036
|
-
shape.validateSync(value);
|
|
31037
|
-
} catch (e) {
|
|
31038
|
-
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31039
|
-
throw new Error(message);
|
|
31040
|
-
}
|
|
31041
|
-
}
|
|
31042
|
-
function safeAssertShape(value, yupSchema) {
|
|
31043
|
-
try {
|
|
31044
|
-
assertShape(value, yupSchema);
|
|
31045
|
-
return true;
|
|
31046
|
-
} catch (e) {
|
|
31047
|
-
return false;
|
|
31048
|
-
}
|
|
31049
|
-
}
|
|
31050
31094
|
class TinaAdminApi {
|
|
31051
31095
|
constructor(cms) {
|
|
31052
31096
|
var _a, _b, _c, _d;
|
|
@@ -31393,6 +31437,56 @@ class TinaAdminApi {
|
|
|
31393
31437
|
);
|
|
31394
31438
|
}
|
|
31395
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
|
+
};
|
|
31396
31490
|
function sleep(ms) {
|
|
31397
31491
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31398
31492
|
}
|
|
@@ -31491,7 +31585,7 @@ const AuthWallInner = ({
|
|
|
31491
31585
|
});
|
|
31492
31586
|
}
|
|
31493
31587
|
};
|
|
31494
|
-
let modalTitle = "
|
|
31588
|
+
let modalTitle = "TinaCloud";
|
|
31495
31589
|
if (activeModal === "authenticate" && loginStrategy === "Redirect" && !isTinaCloud) {
|
|
31496
31590
|
modalTitle = "Enter into edit mode";
|
|
31497
31591
|
} else if (activeModal === "authenticate" && loginStrategy === "UsernamePassword") {
|
|
@@ -31507,7 +31601,7 @@ const AuthWallInner = ({
|
|
|
31507
31601
|
ModalBuilder,
|
|
31508
31602
|
{
|
|
31509
31603
|
title: modalTitle,
|
|
31510
|
-
message: isTinaCloud ? "Your site uses
|
|
31604
|
+
message: isTinaCloud ? "Your site uses TinaCloud to track changes. To make edits, you must log in." : "To save edits, enter into edit mode. On save, changes will saved to the local filesystem.",
|
|
31511
31605
|
close,
|
|
31512
31606
|
actions: [
|
|
31513
31607
|
...otherModalActions,
|
|
@@ -31729,6 +31823,9 @@ const TinaCloudProvider = (props) => {
|
|
|
31729
31823
|
cms.flags.set("branch-switcher", true);
|
|
31730
31824
|
client.usingEditorialWorkflow = true;
|
|
31731
31825
|
client.protectedBranches = project.protectedBranches;
|
|
31826
|
+
if (!project.metadata[currentBranch]) {
|
|
31827
|
+
setCurrentBranch(project.defaultBranch || "main");
|
|
31828
|
+
}
|
|
31732
31829
|
}
|
|
31733
31830
|
});
|
|
31734
31831
|
};
|
|
@@ -31741,7 +31838,7 @@ const TinaCloudProvider = (props) => {
|
|
|
31741
31838
|
}
|
|
31742
31839
|
});
|
|
31743
31840
|
return unsubscribe;
|
|
31744
|
-
}, [isTinaCloud, cms]);
|
|
31841
|
+
}, [currentBranch, isTinaCloud, cms]);
|
|
31745
31842
|
return /* @__PURE__ */ React__default.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React__default.createElement(
|
|
31746
31843
|
BranchDataProvider,
|
|
31747
31844
|
{
|
|
@@ -32227,6 +32324,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32227
32324
|
}
|
|
32228
32325
|
return client.request(query, { variables });
|
|
32229
32326
|
};
|
|
32327
|
+
const GetCMS = ({ children }) => {
|
|
32328
|
+
try {
|
|
32329
|
+
const cms = useCMS$1();
|
|
32330
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(cms));
|
|
32331
|
+
} catch (e) {
|
|
32332
|
+
return null;
|
|
32333
|
+
}
|
|
32334
|
+
};
|
|
32230
32335
|
const Layout = ({ children }) => {
|
|
32231
32336
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
32232
32337
|
"div",
|
|
@@ -32438,47 +32543,6 @@ const SidebarCloudLink = ({ config }) => {
|
|
|
32438
32543
|
}
|
|
32439
32544
|
return /* @__PURE__ */ React__default.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React__default.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React__default.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
|
|
32440
32545
|
};
|
|
32441
|
-
const GetCMS = ({ children }) => {
|
|
32442
|
-
try {
|
|
32443
|
-
const cms = useCMS$1();
|
|
32444
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(cms));
|
|
32445
|
-
} catch (e) {
|
|
32446
|
-
return null;
|
|
32447
|
-
}
|
|
32448
|
-
};
|
|
32449
|
-
const PageWrapper = ({ children }) => {
|
|
32450
|
-
var _a, _b;
|
|
32451
|
-
const cms = useCMS$1();
|
|
32452
|
-
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
32453
|
-
const [branchingEnabled, setBranchingEnabled] = React__default.useState(
|
|
32454
|
-
() => cms.flags.get("branch-switcher")
|
|
32455
|
-
);
|
|
32456
|
-
React__default.useEffect(() => {
|
|
32457
|
-
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
32458
|
-
if (key === "branch-switcher") {
|
|
32459
|
-
setBranchingEnabled(value);
|
|
32460
|
-
}
|
|
32461
|
-
});
|
|
32462
|
-
}, [cms.events]);
|
|
32463
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React__default.createElement(BranchBanner, null), children);
|
|
32464
|
-
};
|
|
32465
|
-
const PageHeader = ({
|
|
32466
|
-
isLocalMode,
|
|
32467
|
-
children
|
|
32468
|
-
}) => {
|
|
32469
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isLocalMode && /* @__PURE__ */ React__default.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__default.createElement(BillingWarning, null), /* @__PURE__ */ React__default.createElement("div", { className: "pt-16 xl:pt-12 px-6 xl:px-12" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full flex justify-between items-end" }, children))));
|
|
32470
|
-
};
|
|
32471
|
-
const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
|
|
32472
|
-
const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
|
|
32473
|
-
const DashboardPage = () => {
|
|
32474
|
-
return /* @__PURE__ */ React__default.createElement(GetCMS, null, (cms) => {
|
|
32475
|
-
var _a, _b;
|
|
32476
|
-
return /* @__PURE__ */ React__default.createElement(PageWrapper, null, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(PageHeader, { isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode }, /* @__PURE__ */ React__default.createElement("h3", { className: "text-2xl font-sans text-gray-700" }, "Welcome to Tina!")), /* @__PURE__ */ React__default.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
32477
|
-
});
|
|
32478
|
-
};
|
|
32479
|
-
function RiHome2Line(props) {
|
|
32480
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M19 21H5C4.44772 21 4 20.5523 4 20V11L1 11L11.3273 1.6115C11.7087 1.26475 12.2913 1.26475 12.6727 1.6115L23 11L20 11V20C20 20.5523 19.5523 21 19 21ZM6 19H18V9.15745L12 3.7029L6 9.15745V19Z" }, "child": [] }] })(props);
|
|
32481
|
-
}
|
|
32482
32546
|
const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
32483
32547
|
"div",
|
|
32484
32548
|
{
|
|
@@ -32588,203 +32652,33 @@ const LoadingPage = () => /* @__PURE__ */ React__default.createElement(React__de
|
|
|
32588
32652
|
)
|
|
32589
32653
|
)
|
|
32590
32654
|
));
|
|
32591
|
-
|
|
32592
|
-
|
|
32593
|
-
|
|
32594
|
-
}) => {
|
|
32595
|
-
|
|
32596
|
-
|
|
32597
|
-
const
|
|
32598
|
-
const
|
|
32599
|
-
|
|
32600
|
-
|
|
32601
|
-
|
|
32602
|
-
|
|
32603
|
-
|
|
32604
|
-
|
|
32605
|
-
useEffect(() => {
|
|
32606
|
-
let cancelled = false;
|
|
32607
|
-
const fetchCollection = async () => {
|
|
32608
|
-
var _a;
|
|
32609
|
-
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
32610
|
-
const { name, order } = JSON.parse(sortKey || "{}");
|
|
32611
|
-
const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
|
|
32612
|
-
try {
|
|
32613
|
-
const collection2 = await api.fetchCollection(
|
|
32614
|
-
collectionName,
|
|
32615
|
-
includeDocuments,
|
|
32616
|
-
(filterArgs == null ? void 0 : filterArgs.filterField) ? "" : folder.fullyQualifiedName,
|
|
32617
|
-
after,
|
|
32618
|
-
validSortKey,
|
|
32619
|
-
order,
|
|
32620
|
-
filterArgs
|
|
32621
|
-
);
|
|
32622
|
-
setCollection(collection2);
|
|
32623
|
-
} catch (error2) {
|
|
32624
|
-
cms.alerts.error(
|
|
32625
|
-
`[${error2.name}] GetCollection failed: ${error2.message}`
|
|
32626
|
-
);
|
|
32627
|
-
console.error(error2);
|
|
32628
|
-
setCollection(void 0);
|
|
32629
|
-
setError(error2);
|
|
32630
|
-
}
|
|
32631
|
-
setLoading(false);
|
|
32632
|
-
}
|
|
32633
|
-
};
|
|
32634
|
-
if (cancelled)
|
|
32635
|
-
return;
|
|
32636
|
-
setLoading(true);
|
|
32637
|
-
fetchCollection();
|
|
32638
|
-
return () => {
|
|
32639
|
-
cancelled = true;
|
|
32640
|
-
};
|
|
32641
|
-
}, [
|
|
32642
|
-
cms,
|
|
32643
|
-
collectionName,
|
|
32644
|
-
folder.loading,
|
|
32645
|
-
folder.fullyQualifiedName,
|
|
32646
|
-
resetState,
|
|
32647
|
-
after,
|
|
32648
|
-
sortKey
|
|
32649
|
-
]);
|
|
32650
|
-
const reFetchCollection = () => setResetSate((x) => x + 1);
|
|
32651
|
-
return { collection, loading, error, reFetchCollection, collectionExtra };
|
|
32652
|
-
};
|
|
32653
|
-
const useSearchCollection = (cms, collectionName, includeDocuments = true, folder, after = "", search) => {
|
|
32654
|
-
const api = new TinaAdminApi(cms);
|
|
32655
|
-
const schema = cms.api.tina.schema;
|
|
32656
|
-
const collectionExtra = schema.getCollection(collectionName);
|
|
32657
|
-
const [collection, setCollection] = useState(void 0);
|
|
32658
|
-
const [loading, setLoading] = useState(true);
|
|
32659
|
-
const [error, setError] = useState(void 0);
|
|
32660
|
-
const [resetState, setResetSate] = useState(0);
|
|
32661
|
-
useEffect(() => {
|
|
32662
|
-
let cancelled = false;
|
|
32663
|
-
const searchCollection = async () => {
|
|
32664
|
-
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
32665
|
-
try {
|
|
32666
|
-
const response = await cms.api.search.query(
|
|
32667
|
-
`${search} AND _collection:${collectionName}`,
|
|
32668
|
-
{
|
|
32669
|
-
limit: 15,
|
|
32670
|
-
cursor: after
|
|
32671
|
-
}
|
|
32672
|
-
);
|
|
32673
|
-
const docs = await Promise.allSettled(
|
|
32674
|
-
response.results.map((result) => {
|
|
32675
|
-
const [collection2, relativePath2] = result._id.split(":");
|
|
32676
|
-
return api.fetchDocument(collection2, relativePath2, false);
|
|
32677
|
-
})
|
|
32678
|
-
);
|
|
32679
|
-
const edges = docs.filter((p) => {
|
|
32680
|
-
var _a;
|
|
32681
|
-
return p.status === "fulfilled" && !!((_a = p.value) == null ? void 0 : _a.document);
|
|
32682
|
-
}).map((result) => ({ node: result.value.document }));
|
|
32683
|
-
const c = await api.fetchCollection(collectionName, false, "");
|
|
32684
|
-
setCollection({
|
|
32685
|
-
format: collection.format,
|
|
32686
|
-
label: collection.label,
|
|
32687
|
-
name: collectionName,
|
|
32688
|
-
templates: collection.templates,
|
|
32689
|
-
documents: {
|
|
32690
|
-
pageInfo: {
|
|
32691
|
-
hasNextPage: !!response.nextCursor,
|
|
32692
|
-
hasPreviousPage: !!response.prevCursor,
|
|
32693
|
-
startCursor: "",
|
|
32694
|
-
endCursor: response.nextCursor || ""
|
|
32695
|
-
},
|
|
32696
|
-
edges
|
|
32697
|
-
}
|
|
32698
|
-
});
|
|
32699
|
-
} catch (error2) {
|
|
32700
|
-
cms.alerts.error(
|
|
32701
|
-
`[${error2.name}] GetCollection failed: ${error2.message}`
|
|
32702
|
-
);
|
|
32703
|
-
console.error(error2);
|
|
32704
|
-
setCollection(void 0);
|
|
32705
|
-
setError(error2);
|
|
32706
|
-
}
|
|
32707
|
-
setLoading(false);
|
|
32655
|
+
function RiHome2Line(props) {
|
|
32656
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M19 21H5C4.44772 21 4 20.5523 4 20V11L1 11L11.3273 1.6115C11.7087 1.26475 12.2913 1.26475 12.6727 1.6115L23 11L20 11V20C20 20.5523 19.5523 21 19 21ZM6 19H18V9.15745L12 3.7029L6 9.15745V19Z" }, "child": [] }] })(props);
|
|
32657
|
+
}
|
|
32658
|
+
const PageWrapper = ({ children }) => {
|
|
32659
|
+
var _a, _b;
|
|
32660
|
+
const cms = useCMS$1();
|
|
32661
|
+
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
32662
|
+
const [branchingEnabled, setBranchingEnabled] = React__default.useState(
|
|
32663
|
+
() => cms.flags.get("branch-switcher")
|
|
32664
|
+
);
|
|
32665
|
+
React__default.useEffect(() => {
|
|
32666
|
+
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
32667
|
+
if (key === "branch-switcher") {
|
|
32668
|
+
setBranchingEnabled(value);
|
|
32708
32669
|
}
|
|
32709
|
-
};
|
|
32710
|
-
|
|
32711
|
-
|
|
32712
|
-
setLoading(true);
|
|
32713
|
-
searchCollection();
|
|
32714
|
-
return () => {
|
|
32715
|
-
cancelled = true;
|
|
32716
|
-
};
|
|
32717
|
-
}, [
|
|
32718
|
-
cms,
|
|
32719
|
-
collectionName,
|
|
32720
|
-
folder.loading,
|
|
32721
|
-
folder.fullyQualifiedName,
|
|
32722
|
-
resetState,
|
|
32723
|
-
after,
|
|
32724
|
-
search
|
|
32725
|
-
]);
|
|
32726
|
-
const reFetchCollection = () => setResetSate((x) => x + 1);
|
|
32727
|
-
return { collection, loading, error, reFetchCollection, collectionExtra };
|
|
32670
|
+
});
|
|
32671
|
+
}, [cms.events]);
|
|
32672
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React__default.createElement(BranchBanner, null), children);
|
|
32728
32673
|
};
|
|
32729
|
-
const
|
|
32730
|
-
|
|
32731
|
-
|
|
32732
|
-
folder,
|
|
32733
|
-
includeDocuments = true,
|
|
32734
|
-
startCursor,
|
|
32735
|
-
sortKey,
|
|
32736
|
-
children,
|
|
32737
|
-
filterArgs,
|
|
32738
|
-
search
|
|
32674
|
+
const PageHeader = ({
|
|
32675
|
+
isLocalMode,
|
|
32676
|
+
children
|
|
32739
32677
|
}) => {
|
|
32740
|
-
|
|
32741
|
-
const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
|
|
32742
|
-
cms,
|
|
32743
|
-
collectionName,
|
|
32744
|
-
includeDocuments,
|
|
32745
|
-
folder,
|
|
32746
|
-
startCursor || "",
|
|
32747
|
-
search
|
|
32748
|
-
) : useGetCollection(
|
|
32749
|
-
cms,
|
|
32750
|
-
collectionName,
|
|
32751
|
-
includeDocuments,
|
|
32752
|
-
folder,
|
|
32753
|
-
startCursor || "",
|
|
32754
|
-
sortKey,
|
|
32755
|
-
filterArgs
|
|
32756
|
-
) || {};
|
|
32757
|
-
useEffect(() => {
|
|
32758
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
32759
|
-
if (loading)
|
|
32760
|
-
return;
|
|
32761
|
-
const collectionDefinition = cms.api.tina.schema.getCollection(
|
|
32762
|
-
collection.name
|
|
32763
|
-
);
|
|
32764
|
-
const allowCreate = ((_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) ?? true;
|
|
32765
|
-
const allowDelete = ((_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.delete) ?? true;
|
|
32766
|
-
const collectionResponse = collection;
|
|
32767
|
-
if (!allowCreate && !allowDelete && // Check there is only one document
|
|
32768
|
-
((_f = (_e = collectionResponse.documents) == null ? void 0 : _e.edges) == null ? void 0 : _f.length) === 1 && // Check to make sure the file is not a folder
|
|
32769
|
-
((_i = (_h = (_g = collectionResponse.documents) == null ? void 0 : _g.edges[0]) == null ? void 0 : _h.node) == null ? void 0 : _i.__typename) !== "Folder") {
|
|
32770
|
-
const doc = collectionResponse.documents.edges[0].node;
|
|
32771
|
-
handleNavigate(
|
|
32772
|
-
navigate,
|
|
32773
|
-
cms,
|
|
32774
|
-
collectionResponse,
|
|
32775
|
-
collectionDefinition,
|
|
32776
|
-
doc
|
|
32777
|
-
);
|
|
32778
|
-
}
|
|
32779
|
-
}, [(collection == null ? void 0 : collection.name) || "", loading]);
|
|
32780
|
-
if (error) {
|
|
32781
|
-
return /* @__PURE__ */ React__default.createElement(FullscreenError, null);
|
|
32782
|
-
}
|
|
32783
|
-
if (loading) {
|
|
32784
|
-
return /* @__PURE__ */ React__default.createElement(LoadingPage, null);
|
|
32785
|
-
}
|
|
32786
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(collection, loading, reFetchCollection, collectionExtra));
|
|
32678
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isLocalMode && /* @__PURE__ */ React__default.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__default.createElement(BillingWarning, null), /* @__PURE__ */ React__default.createElement("div", { className: "pt-16 xl:pt-12 px-6 xl:px-12" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full flex justify-between items-end" }, children))));
|
|
32787
32679
|
};
|
|
32680
|
+
const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
|
|
32681
|
+
const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
|
|
32788
32682
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
32789
32683
|
const parentFolder = (folder) => {
|
|
32790
32684
|
return {
|
|
@@ -33060,7 +32954,9 @@ const CollectionListPage = () => {
|
|
|
33060
32954
|
safeSubmit: async () => {
|
|
33061
32955
|
try {
|
|
33062
32956
|
await admin.deleteDocument(vars);
|
|
33063
|
-
cms.alerts.info(
|
|
32957
|
+
cms.alerts.info(
|
|
32958
|
+
"Document was successfully deleted"
|
|
32959
|
+
);
|
|
33064
32960
|
reFetchCollection();
|
|
33065
32961
|
} catch (error) {
|
|
33066
32962
|
cms.alerts.warn(
|
|
@@ -33089,7 +32985,9 @@ const CollectionListPage = () => {
|
|
|
33089
32985
|
relativePath: vars.relativePath,
|
|
33090
32986
|
newRelativePath
|
|
33091
32987
|
});
|
|
33092
|
-
cms.alerts.info(
|
|
32988
|
+
cms.alerts.info(
|
|
32989
|
+
"Document was successfully renamed"
|
|
32990
|
+
);
|
|
33093
32991
|
reFetchCollection();
|
|
33094
32992
|
} catch (error) {
|
|
33095
32993
|
if (error.message.indexOf("has references")) {
|
|
@@ -33189,7 +33087,9 @@ const CollectionListPage = () => {
|
|
|
33189
33087
|
name: "sort",
|
|
33190
33088
|
value: sortKey,
|
|
33191
33089
|
onChange: (e) => {
|
|
33192
|
-
const val = JSON.parse(
|
|
33090
|
+
const val = JSON.parse(
|
|
33091
|
+
e.target.value
|
|
33092
|
+
);
|
|
33193
33093
|
setEndCursor("");
|
|
33194
33094
|
setPrevCursors([]);
|
|
33195
33095
|
window == null ? void 0 : window.localStorage.setItem(
|
|
@@ -33656,6 +33556,231 @@ const RenameModal = ({
|
|
|
33656
33556
|
"Rename"
|
|
33657
33557
|
))));
|
|
33658
33558
|
};
|
|
33559
|
+
const FullscreenError = ({
|
|
33560
|
+
title = "Error",
|
|
33561
|
+
errorMessage = "It looks like something went wrong."
|
|
33562
|
+
}) => {
|
|
33563
|
+
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"));
|
|
33564
|
+
};
|
|
33565
|
+
const isValidSortKey = (sortKey, collection) => {
|
|
33566
|
+
if (collection.fields) {
|
|
33567
|
+
const sortKeys = collection.fields.map((x) => x.name);
|
|
33568
|
+
return sortKeys.includes(sortKey);
|
|
33569
|
+
} else if (collection.templates) {
|
|
33570
|
+
const collectionMap = {};
|
|
33571
|
+
const conflictedFields = /* @__PURE__ */ new Set();
|
|
33572
|
+
for (const template of collection.templates) {
|
|
33573
|
+
for (const field of template.fields) {
|
|
33574
|
+
if (collectionMap[field.name]) {
|
|
33575
|
+
if (collectionMap[field.name].type !== field.type) {
|
|
33576
|
+
conflictedFields.add(field.name);
|
|
33577
|
+
}
|
|
33578
|
+
} else {
|
|
33579
|
+
collectionMap[field.name] = field;
|
|
33580
|
+
}
|
|
33581
|
+
}
|
|
33582
|
+
}
|
|
33583
|
+
for (const key in conflictedFields) {
|
|
33584
|
+
delete collectionMap[key];
|
|
33585
|
+
}
|
|
33586
|
+
for (const key in collectionMap) {
|
|
33587
|
+
if (key === sortKey) {
|
|
33588
|
+
return true;
|
|
33589
|
+
}
|
|
33590
|
+
}
|
|
33591
|
+
return false;
|
|
33592
|
+
}
|
|
33593
|
+
};
|
|
33594
|
+
const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
|
|
33595
|
+
const api = new TinaAdminApi(cms);
|
|
33596
|
+
const schema = cms.api.tina.schema;
|
|
33597
|
+
const collectionExtra = schema.getCollection(collectionName);
|
|
33598
|
+
const [collection, setCollection] = useState(void 0);
|
|
33599
|
+
const [loading, setLoading] = useState(true);
|
|
33600
|
+
const [error, setError] = useState(void 0);
|
|
33601
|
+
const [resetState, setResetSate] = useState(0);
|
|
33602
|
+
useEffect(() => {
|
|
33603
|
+
let cancelled = false;
|
|
33604
|
+
const fetchCollection = async () => {
|
|
33605
|
+
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
33606
|
+
const { name, order } = JSON.parse(sortKey || "{}");
|
|
33607
|
+
const validSortKey = isValidSortKey(name, collectionExtra) ? name : void 0;
|
|
33608
|
+
try {
|
|
33609
|
+
const collection2 = await api.fetchCollection(
|
|
33610
|
+
collectionName,
|
|
33611
|
+
includeDocuments,
|
|
33612
|
+
(filterArgs == null ? void 0 : filterArgs.filterField) ? "" : folder.fullyQualifiedName,
|
|
33613
|
+
after,
|
|
33614
|
+
validSortKey,
|
|
33615
|
+
order,
|
|
33616
|
+
filterArgs
|
|
33617
|
+
);
|
|
33618
|
+
setCollection(collection2);
|
|
33619
|
+
} catch (error2) {
|
|
33620
|
+
cms.alerts.error(
|
|
33621
|
+
`[${error2.name}] GetCollection failed: ${error2.message}`
|
|
33622
|
+
);
|
|
33623
|
+
console.error(error2);
|
|
33624
|
+
setCollection(void 0);
|
|
33625
|
+
setError(error2);
|
|
33626
|
+
}
|
|
33627
|
+
setLoading(false);
|
|
33628
|
+
}
|
|
33629
|
+
};
|
|
33630
|
+
if (cancelled)
|
|
33631
|
+
return;
|
|
33632
|
+
setLoading(true);
|
|
33633
|
+
fetchCollection();
|
|
33634
|
+
return () => {
|
|
33635
|
+
cancelled = true;
|
|
33636
|
+
};
|
|
33637
|
+
}, [
|
|
33638
|
+
cms,
|
|
33639
|
+
collectionName,
|
|
33640
|
+
folder.loading,
|
|
33641
|
+
folder.fullyQualifiedName,
|
|
33642
|
+
resetState,
|
|
33643
|
+
after,
|
|
33644
|
+
sortKey
|
|
33645
|
+
]);
|
|
33646
|
+
const reFetchCollection = () => setResetSate((x) => x + 1);
|
|
33647
|
+
return { collection, loading, error, reFetchCollection, collectionExtra };
|
|
33648
|
+
};
|
|
33649
|
+
const useSearchCollection = (cms, collectionName, includeDocuments = true, folder, after = "", search) => {
|
|
33650
|
+
const api = new TinaAdminApi(cms);
|
|
33651
|
+
const schema = cms.api.tina.schema;
|
|
33652
|
+
const collectionExtra = schema.getCollection(collectionName);
|
|
33653
|
+
const [collection, setCollection] = useState(void 0);
|
|
33654
|
+
const [loading, setLoading] = useState(true);
|
|
33655
|
+
const [error, setError] = useState(void 0);
|
|
33656
|
+
const [resetState, setResetSate] = useState(0);
|
|
33657
|
+
useEffect(() => {
|
|
33658
|
+
let cancelled = false;
|
|
33659
|
+
const searchCollection = async () => {
|
|
33660
|
+
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
33661
|
+
try {
|
|
33662
|
+
const response = await cms.api.search.query(
|
|
33663
|
+
`${search} AND _collection:${collectionName}`,
|
|
33664
|
+
{
|
|
33665
|
+
limit: 15,
|
|
33666
|
+
cursor: after
|
|
33667
|
+
}
|
|
33668
|
+
);
|
|
33669
|
+
const docs = await Promise.allSettled(
|
|
33670
|
+
response.results.map((result) => {
|
|
33671
|
+
const [collection2, relativePath2] = result._id.split(":");
|
|
33672
|
+
return api.fetchDocument(collection2, relativePath2, false);
|
|
33673
|
+
})
|
|
33674
|
+
);
|
|
33675
|
+
const edges = docs.filter((p) => {
|
|
33676
|
+
var _a;
|
|
33677
|
+
return p.status === "fulfilled" && !!((_a = p.value) == null ? void 0 : _a.document);
|
|
33678
|
+
}).map((result) => ({ node: result.value.document }));
|
|
33679
|
+
const c = await api.fetchCollection(collectionName, false, "");
|
|
33680
|
+
setCollection({
|
|
33681
|
+
format: collection.format,
|
|
33682
|
+
label: collection.label,
|
|
33683
|
+
name: collectionName,
|
|
33684
|
+
templates: collection.templates,
|
|
33685
|
+
documents: {
|
|
33686
|
+
pageInfo: {
|
|
33687
|
+
hasNextPage: !!response.nextCursor,
|
|
33688
|
+
hasPreviousPage: !!response.prevCursor,
|
|
33689
|
+
startCursor: "",
|
|
33690
|
+
endCursor: response.nextCursor || ""
|
|
33691
|
+
},
|
|
33692
|
+
edges
|
|
33693
|
+
}
|
|
33694
|
+
});
|
|
33695
|
+
} catch (error2) {
|
|
33696
|
+
cms.alerts.error(
|
|
33697
|
+
`[${error2.name}] GetCollection failed: ${error2.message}`
|
|
33698
|
+
);
|
|
33699
|
+
console.error(error2);
|
|
33700
|
+
setCollection(void 0);
|
|
33701
|
+
setError(error2);
|
|
33702
|
+
}
|
|
33703
|
+
setLoading(false);
|
|
33704
|
+
}
|
|
33705
|
+
};
|
|
33706
|
+
if (cancelled)
|
|
33707
|
+
return;
|
|
33708
|
+
setLoading(true);
|
|
33709
|
+
searchCollection();
|
|
33710
|
+
return () => {
|
|
33711
|
+
cancelled = true;
|
|
33712
|
+
};
|
|
33713
|
+
}, [
|
|
33714
|
+
cms,
|
|
33715
|
+
collectionName,
|
|
33716
|
+
folder.loading,
|
|
33717
|
+
folder.fullyQualifiedName,
|
|
33718
|
+
resetState,
|
|
33719
|
+
after,
|
|
33720
|
+
search
|
|
33721
|
+
]);
|
|
33722
|
+
const reFetchCollection = () => setResetSate((x) => x + 1);
|
|
33723
|
+
return { collection, loading, error, reFetchCollection, collectionExtra };
|
|
33724
|
+
};
|
|
33725
|
+
const GetCollection = ({
|
|
33726
|
+
cms,
|
|
33727
|
+
collectionName,
|
|
33728
|
+
folder,
|
|
33729
|
+
includeDocuments = true,
|
|
33730
|
+
startCursor,
|
|
33731
|
+
sortKey,
|
|
33732
|
+
children,
|
|
33733
|
+
filterArgs,
|
|
33734
|
+
search
|
|
33735
|
+
}) => {
|
|
33736
|
+
const navigate = useNavigate();
|
|
33737
|
+
const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
|
|
33738
|
+
cms,
|
|
33739
|
+
collectionName,
|
|
33740
|
+
includeDocuments,
|
|
33741
|
+
folder,
|
|
33742
|
+
startCursor || "",
|
|
33743
|
+
search
|
|
33744
|
+
) : useGetCollection(
|
|
33745
|
+
cms,
|
|
33746
|
+
collectionName,
|
|
33747
|
+
includeDocuments,
|
|
33748
|
+
folder,
|
|
33749
|
+
startCursor || "",
|
|
33750
|
+
sortKey,
|
|
33751
|
+
filterArgs
|
|
33752
|
+
) || {};
|
|
33753
|
+
useEffect(() => {
|
|
33754
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
33755
|
+
if (loading)
|
|
33756
|
+
return;
|
|
33757
|
+
const collectionDefinition = cms.api.tina.schema.getCollection(
|
|
33758
|
+
collection.name
|
|
33759
|
+
);
|
|
33760
|
+
const allowCreate = ((_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) ?? true;
|
|
33761
|
+
const allowDelete = ((_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.delete) ?? true;
|
|
33762
|
+
const collectionResponse = collection;
|
|
33763
|
+
if (!allowCreate && !allowDelete && // Check there is only one document
|
|
33764
|
+
((_f = (_e = collectionResponse.documents) == null ? void 0 : _e.edges) == null ? void 0 : _f.length) === 1 && // Check to make sure the file is not a folder
|
|
33765
|
+
((_i = (_h = (_g = collectionResponse.documents) == null ? void 0 : _g.edges[0]) == null ? void 0 : _h.node) == null ? void 0 : _i.__typename) !== "Folder") {
|
|
33766
|
+
const doc = collectionResponse.documents.edges[0].node;
|
|
33767
|
+
handleNavigate(
|
|
33768
|
+
navigate,
|
|
33769
|
+
cms,
|
|
33770
|
+
collectionResponse,
|
|
33771
|
+
collectionDefinition,
|
|
33772
|
+
doc
|
|
33773
|
+
);
|
|
33774
|
+
}
|
|
33775
|
+
}, [(collection == null ? void 0 : collection.name) || "", loading]);
|
|
33776
|
+
if (error) {
|
|
33777
|
+
return /* @__PURE__ */ React__default.createElement(FullscreenError, null);
|
|
33778
|
+
}
|
|
33779
|
+
if (loading) {
|
|
33780
|
+
return /* @__PURE__ */ React__default.createElement(LoadingPage, null);
|
|
33781
|
+
}
|
|
33782
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(collection, loading, reFetchCollection, collectionExtra));
|
|
33783
|
+
};
|
|
33659
33784
|
const ErrorDialog = (props) => {
|
|
33660
33785
|
return /* @__PURE__ */ React__default.createElement(
|
|
33661
33786
|
"div",
|
|
@@ -33978,7 +34103,10 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
33978
34103
|
const fetchDocument = async () => {
|
|
33979
34104
|
if (api.isAuthenticated()) {
|
|
33980
34105
|
try {
|
|
33981
|
-
const response = await api.fetchDocument(
|
|
34106
|
+
const response = await api.fetchDocument(
|
|
34107
|
+
collectionName,
|
|
34108
|
+
relativePath2
|
|
34109
|
+
);
|
|
33982
34110
|
setDocument(response.document);
|
|
33983
34111
|
} catch (error2) {
|
|
33984
34112
|
cms.alerts.error(
|
|
@@ -34196,6 +34324,12 @@ const RenderForm = ({
|
|
|
34196
34324
|
), /* @__PURE__ */ React__default.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__default.createElement("span", { className: "flex-1 w-full text-sm leading-tight whitespace-nowrap truncate" }, `${filename}.${collection.format}`), /* @__PURE__ */ React__default.createElement(FormStatus, { pristine: formIsPristine }))
|
|
34197
34325
|
), activeForm && /* @__PURE__ */ React__default.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine }));
|
|
34198
34326
|
};
|
|
34327
|
+
const DashboardPage = () => {
|
|
34328
|
+
return /* @__PURE__ */ React__default.createElement(GetCMS, null, (cms) => {
|
|
34329
|
+
var _a, _b;
|
|
34330
|
+
return /* @__PURE__ */ React__default.createElement(PageWrapper, null, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(PageHeader, { isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode }, /* @__PURE__ */ React__default.createElement("h3", { className: "text-2xl font-sans text-gray-700" }, "Welcome to Tina!")), /* @__PURE__ */ React__default.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
34331
|
+
});
|
|
34332
|
+
};
|
|
34199
34333
|
const ScreenPage = () => {
|
|
34200
34334
|
const { screenName } = useParams();
|
|
34201
34335
|
return /* @__PURE__ */ React__default.createElement(GetCMS, null, (cms) => {
|
|
@@ -34278,7 +34412,7 @@ const IndexingPage = () => {
|
|
|
34278
34412
|
} catch {
|
|
34279
34413
|
cms.alerts.error("Branch indexing failed.");
|
|
34280
34414
|
setErrorMessage(
|
|
34281
|
-
'Branch indexing failed, please check the
|
|
34415
|
+
'Branch indexing failed, please check the TinaCloud dashboard for more information. To try again chick "re-index" on the branch in the dashboard.'
|
|
34282
34416
|
);
|
|
34283
34417
|
setState("error");
|
|
34284
34418
|
}
|
|
@@ -34446,7 +34580,7 @@ const CheckSchema = ({
|
|
|
34446
34580
|
);
|
|
34447
34581
|
}
|
|
34448
34582
|
}).catch((e) => {
|
|
34449
|
-
if (e.message.includes("has not been indexed by
|
|
34583
|
+
if (e.message.includes("has not been indexed by TinaCloud")) {
|
|
34450
34584
|
setSchemaMissingError(true);
|
|
34451
34585
|
} else {
|
|
34452
34586
|
cms.alerts.error(`Unexpected error checking schema: ${e}`);
|