tinacms 0.0.0-a4e58da-20250221000426 → 0.0.0-a577386-20250401050543
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/GetCollection.d.ts +2 -2
- package/dist/auth/TinaCloudProvider.d.ts +1 -1
- package/dist/client.d.ts +1 -4
- package/dist/hooks/create-page-plugin.d.ts +1 -1
- package/dist/index.d.ts +1 -61
- package/dist/index.js +569 -437
- package/dist/index.mjs +570 -438
- package/dist/react.d.ts +1 -34
- package/dist/react.js +3 -0
- package/dist/react.mjs +3 -0
- package/dist/rich-text/index.d.ts +1 -142
- package/dist/rich-text/prism.d.ts +1 -10
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +17 -5
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
- package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +5 -4
- package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
- package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
- package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
- package/dist/toolkit/tina-state.d.ts +4 -0
- package/package.json +7 -7
- package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("
|
|
3
|
-
})(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("@react-hook/window-size"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("@graphql-inspector/core"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "@react-hook/window-size", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "graphql", "graphql-tag", "@tinacms/schema-tools", "@graphql-inspector/core", "yup", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
3
|
+
})(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, windowSize, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, graphql, gql, schemaTools, core, yup, reactRouterDom, mdx) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -5305,7 +5305,9 @@ flowchart TD
|
|
|
5305
5305
|
}, [value, input, optionSets]);
|
|
5306
5306
|
React__namespace.useEffect(() => {
|
|
5307
5307
|
if (field.experimental___filter && optionSets.length > 0) {
|
|
5308
|
-
setFilteredOptionsList(
|
|
5308
|
+
setFilteredOptionsList(
|
|
5309
|
+
field.experimental___filter(optionSets, void 0)
|
|
5310
|
+
);
|
|
5309
5311
|
} else {
|
|
5310
5312
|
setFilteredOptionsList(optionSets);
|
|
5311
5313
|
}
|
|
@@ -5675,7 +5677,9 @@ flowchart TD
|
|
|
5675
5677
|
onClick: () => {
|
|
5676
5678
|
const state = tinaForm.finalForm.getState();
|
|
5677
5679
|
if (state.invalid === true) {
|
|
5678
|
-
cms.alerts.error(
|
|
5680
|
+
cms.alerts.error(
|
|
5681
|
+
"Cannot navigate away from an invalid form."
|
|
5682
|
+
);
|
|
5679
5683
|
return;
|
|
5680
5684
|
}
|
|
5681
5685
|
cms.dispatch({
|
|
@@ -6259,7 +6263,9 @@ flowchart TD
|
|
|
6259
6263
|
onClick: () => {
|
|
6260
6264
|
const state = tinaForm.finalForm.getState();
|
|
6261
6265
|
if (state.invalid === true) {
|
|
6262
|
-
cms.alerts.error(
|
|
6266
|
+
cms.alerts.error(
|
|
6267
|
+
"Cannot navigate away from an invalid form."
|
|
6268
|
+
);
|
|
6263
6269
|
return;
|
|
6264
6270
|
}
|
|
6265
6271
|
cms.dispatch({
|
|
@@ -6741,28 +6747,28 @@ flowchart TD
|
|
|
6741
6747
|
}
|
|
6742
6748
|
renderDayHeaders() {
|
|
6743
6749
|
const locale = this.props.viewDate.localeData();
|
|
6744
|
-
|
|
6750
|
+
const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
|
|
6745
6751
|
return /* @__PURE__ */ React.createElement("tr", null, dayItems);
|
|
6746
6752
|
}
|
|
6747
6753
|
renderDays() {
|
|
6748
6754
|
const date = this.props.viewDate;
|
|
6749
6755
|
const startOfMonth = date.clone().startOf("month");
|
|
6750
6756
|
const endOfMonth = date.clone().endOf("month");
|
|
6751
|
-
|
|
6752
|
-
|
|
6757
|
+
const rows = [[], [], [], [], [], []];
|
|
6758
|
+
const startDate = date.clone().subtract(1, "months");
|
|
6753
6759
|
startDate.date(startDate.daysInMonth()).startOf("week");
|
|
6754
|
-
|
|
6760
|
+
const endDate = startDate.clone().add(42, "d");
|
|
6755
6761
|
let i = 0;
|
|
6756
6762
|
while (startDate.isBefore(endDate)) {
|
|
6757
|
-
|
|
6763
|
+
const row = getRow$2(rows, i++);
|
|
6758
6764
|
row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
|
|
6759
6765
|
startDate.add(1, "d");
|
|
6760
6766
|
}
|
|
6761
6767
|
return rows.map((r, i2) => /* @__PURE__ */ React.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
|
|
6762
6768
|
}
|
|
6763
6769
|
renderDay(date, startOfMonth, endOfMonth) {
|
|
6764
|
-
|
|
6765
|
-
|
|
6770
|
+
const selectedDate = this.props.selectedDate;
|
|
6771
|
+
const dayProps = {
|
|
6766
6772
|
key: date.format("M_D"),
|
|
6767
6773
|
"data-value": date.date(),
|
|
6768
6774
|
"data-month": date.month(),
|
|
@@ -6816,7 +6822,7 @@ flowchart TD
|
|
|
6816
6822
|
}
|
|
6817
6823
|
function getDaysOfWeek(locale) {
|
|
6818
6824
|
const first = locale.firstDayOfWeek();
|
|
6819
|
-
|
|
6825
|
+
const dow = [];
|
|
6820
6826
|
let i = 0;
|
|
6821
6827
|
locale._weekdaysMin.forEach(function(day) {
|
|
6822
6828
|
dow[(7 + i++ - first) % 7] = day;
|
|
@@ -6834,7 +6840,7 @@ flowchart TD
|
|
|
6834
6840
|
return /* @__PURE__ */ React.createElement("div", { className: "rdtMonths" }, /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("thead", null, this.renderNavigation())), /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("tbody", null, this.renderMonths())));
|
|
6835
6841
|
}
|
|
6836
6842
|
renderNavigation() {
|
|
6837
|
-
|
|
6843
|
+
const year = this.props.viewDate.year();
|
|
6838
6844
|
return /* @__PURE__ */ React.createElement(
|
|
6839
6845
|
ViewNavigation,
|
|
6840
6846
|
{
|
|
@@ -6847,9 +6853,9 @@ flowchart TD
|
|
|
6847
6853
|
);
|
|
6848
6854
|
}
|
|
6849
6855
|
renderMonths() {
|
|
6850
|
-
|
|
6856
|
+
const rows = [[], [], []];
|
|
6851
6857
|
for (let month = 0; month < 12; month++) {
|
|
6852
|
-
|
|
6858
|
+
const row = getRow$1(rows, month);
|
|
6853
6859
|
row.push(this.renderMonth(month));
|
|
6854
6860
|
}
|
|
6855
6861
|
return rows.map((months, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, months));
|
|
@@ -6866,7 +6872,7 @@ flowchart TD
|
|
|
6866
6872
|
if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
|
|
6867
6873
|
className += " rdtActive";
|
|
6868
6874
|
}
|
|
6869
|
-
|
|
6875
|
+
const props = { key: month, className, "data-value": month, onClick };
|
|
6870
6876
|
if (this.props.renderMonth) {
|
|
6871
6877
|
return this.props.renderMonth(
|
|
6872
6878
|
props,
|
|
@@ -6878,11 +6884,11 @@ flowchart TD
|
|
|
6878
6884
|
return /* @__PURE__ */ React.createElement("td", { ...props }, this.getMonthText(month));
|
|
6879
6885
|
}
|
|
6880
6886
|
isDisabledMonth(month) {
|
|
6881
|
-
|
|
6887
|
+
const isValidDate = this.props.isValidDate;
|
|
6882
6888
|
if (!isValidDate) {
|
|
6883
6889
|
return false;
|
|
6884
6890
|
}
|
|
6885
|
-
|
|
6891
|
+
const date = this.props.viewDate.clone().set({ month });
|
|
6886
6892
|
let day = date.endOf("month").date() + 1;
|
|
6887
6893
|
while (day-- > 1) {
|
|
6888
6894
|
if (isValidDate(date.date(day))) {
|
|
@@ -6934,9 +6940,9 @@ flowchart TD
|
|
|
6934
6940
|
}
|
|
6935
6941
|
renderYears() {
|
|
6936
6942
|
const viewYear = this.getViewYear();
|
|
6937
|
-
|
|
6943
|
+
const rows = [[], [], []];
|
|
6938
6944
|
for (let year = viewYear - 1; year < viewYear + 11; year++) {
|
|
6939
|
-
|
|
6945
|
+
const row = getRow(rows, year - viewYear);
|
|
6940
6946
|
row.push(this.renderYear(year));
|
|
6941
6947
|
}
|
|
6942
6948
|
return rows.map((years, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, years));
|
|
@@ -6953,7 +6959,7 @@ flowchart TD
|
|
|
6953
6959
|
if (selectedYear === year) {
|
|
6954
6960
|
className += " rdtActive";
|
|
6955
6961
|
}
|
|
6956
|
-
|
|
6962
|
+
const props = { key: year, className, "data-value": year, onClick };
|
|
6957
6963
|
return this.props.renderYear(
|
|
6958
6964
|
props,
|
|
6959
6965
|
year,
|
|
@@ -6967,15 +6973,15 @@ flowchart TD
|
|
|
6967
6973
|
return this.props.selectedDate && this.props.selectedDate.year();
|
|
6968
6974
|
}
|
|
6969
6975
|
isDisabledYear(year) {
|
|
6970
|
-
|
|
6976
|
+
const cache = this.disabledYearsCache;
|
|
6971
6977
|
if (cache[year] !== void 0) {
|
|
6972
6978
|
return cache[year];
|
|
6973
6979
|
}
|
|
6974
|
-
|
|
6980
|
+
const isValidDate = this.props.isValidDate;
|
|
6975
6981
|
if (!isValidDate) {
|
|
6976
6982
|
return false;
|
|
6977
6983
|
}
|
|
6978
|
-
|
|
6984
|
+
const date = this.props.viewDate.clone().set({ year });
|
|
6979
6985
|
let day = date.endOf("year").dayOfYear() + 1;
|
|
6980
6986
|
while (day-- > 1) {
|
|
6981
6987
|
if (isValidDate(date.dayOfYear(day))) {
|
|
@@ -7022,7 +7028,7 @@ flowchart TD
|
|
|
7022
7028
|
}
|
|
7023
7029
|
};
|
|
7024
7030
|
function createConstraints(overrideTimeConstraints) {
|
|
7025
|
-
|
|
7031
|
+
const constraints = {};
|
|
7026
7032
|
Object.keys(timeConstraints).forEach((type) => {
|
|
7027
7033
|
constraints[type] = {
|
|
7028
7034
|
...timeConstraints[type],
|
|
@@ -7038,7 +7044,7 @@ flowchart TD
|
|
|
7038
7044
|
this.state = this.getTimeParts(props.selectedDate || props.viewDate);
|
|
7039
7045
|
}
|
|
7040
7046
|
render() {
|
|
7041
|
-
|
|
7047
|
+
const items2 = [];
|
|
7042
7048
|
const timeParts = this.state;
|
|
7043
7049
|
this.getCounters().forEach((c, i) => {
|
|
7044
7050
|
if (i && c !== "ampm") {
|
|
@@ -7100,8 +7106,8 @@ flowchart TD
|
|
|
7100
7106
|
}
|
|
7101
7107
|
if (type === "ampm")
|
|
7102
7108
|
return this.toggleDayPart();
|
|
7103
|
-
|
|
7104
|
-
|
|
7109
|
+
const update = {};
|
|
7110
|
+
const body = document.body;
|
|
7105
7111
|
update[type] = this[action](type);
|
|
7106
7112
|
this.setState(update);
|
|
7107
7113
|
this.timer = setTimeout(() => {
|
|
@@ -7144,8 +7150,8 @@ flowchart TD
|
|
|
7144
7150
|
return pad(type, value);
|
|
7145
7151
|
}
|
|
7146
7152
|
getCounters() {
|
|
7147
|
-
|
|
7148
|
-
|
|
7153
|
+
const counters = [];
|
|
7154
|
+
const format2 = this.props.timeFormat;
|
|
7149
7155
|
if (format2.toLowerCase().indexOf("h") !== -1) {
|
|
7150
7156
|
counters.push("hours");
|
|
7151
7157
|
if (format2.indexOf("m") !== -1) {
|
|
@@ -7277,7 +7283,7 @@ flowchart TD
|
|
|
7277
7283
|
__publicField(this, "_renderCalendar", () => {
|
|
7278
7284
|
const props = this.props;
|
|
7279
7285
|
const state = this.state;
|
|
7280
|
-
|
|
7286
|
+
const viewProps = {
|
|
7281
7287
|
viewDate: state.viewDate.clone(),
|
|
7282
7288
|
selectedDate: this.getSelectedDate(),
|
|
7283
7289
|
isValidDate: props.isValidDate,
|
|
@@ -7320,10 +7326,10 @@ flowchart TD
|
|
|
7320
7326
|
__publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
|
|
7321
7327
|
__publicField(this, "nextView", { days: "time", months: "days", years: "months" });
|
|
7322
7328
|
__publicField(this, "_updateDate", (e) => {
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7329
|
+
const state = this.state;
|
|
7330
|
+
const currentView = state.currentView;
|
|
7331
|
+
const updateOnView = this.getUpdateOn(this.getFormat("date"));
|
|
7332
|
+
const viewDate = this.state.viewDate.clone();
|
|
7327
7333
|
viewDate[this.viewToMethod[currentView]](
|
|
7328
7334
|
parseInt(e.target.getAttribute("data-value"), 10)
|
|
7329
7335
|
);
|
|
@@ -7331,7 +7337,7 @@ flowchart TD
|
|
|
7331
7337
|
viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
|
|
7332
7338
|
viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
|
|
7333
7339
|
}
|
|
7334
|
-
|
|
7340
|
+
const update = { viewDate };
|
|
7335
7341
|
if (currentView === updateOnView) {
|
|
7336
7342
|
update.selectedDate = viewDate.clone();
|
|
7337
7343
|
update.inputValue = viewDate.format(this.getFormat("datetime"));
|
|
@@ -7345,7 +7351,7 @@ flowchart TD
|
|
|
7345
7351
|
this.setState(update);
|
|
7346
7352
|
});
|
|
7347
7353
|
__publicField(this, "_viewNavigate", (modifier, unit) => {
|
|
7348
|
-
|
|
7354
|
+
const viewDate = this.state.viewDate.clone();
|
|
7349
7355
|
viewDate.add(modifier, unit);
|
|
7350
7356
|
if (modifier > 0) {
|
|
7351
7357
|
this.props.onNavigateForward(modifier, unit);
|
|
@@ -7355,7 +7361,7 @@ flowchart TD
|
|
|
7355
7361
|
this.setState({ viewDate });
|
|
7356
7362
|
});
|
|
7357
7363
|
__publicField(this, "_setTime", (type, value) => {
|
|
7358
|
-
|
|
7364
|
+
const date = (this.getSelectedDate() || this.state.viewDate).clone();
|
|
7359
7365
|
date[type](value);
|
|
7360
7366
|
if (!this.props.value) {
|
|
7361
7367
|
this.setState({
|
|
@@ -7379,7 +7385,7 @@ flowchart TD
|
|
|
7379
7385
|
});
|
|
7380
7386
|
});
|
|
7381
7387
|
__publicField(this, "_handleClickOutside", () => {
|
|
7382
|
-
|
|
7388
|
+
const props = this.props;
|
|
7383
7389
|
if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
|
|
7384
7390
|
this._closeCalendar();
|
|
7385
7391
|
}
|
|
@@ -7394,7 +7400,7 @@ flowchart TD
|
|
|
7394
7400
|
return;
|
|
7395
7401
|
const value = e.target ? e.target.value : e;
|
|
7396
7402
|
const localMoment = this.localMoment(value, this.getFormat("datetime"));
|
|
7397
|
-
|
|
7403
|
+
const update = { inputValue: value };
|
|
7398
7404
|
if (localMoment.isValid()) {
|
|
7399
7405
|
update.selectedDate = localMoment;
|
|
7400
7406
|
update.viewDate = localMoment.clone().startOf("month");
|
|
@@ -7458,9 +7464,9 @@ flowchart TD
|
|
|
7458
7464
|
return this.props.renderView(this.state.currentView, this._renderCalendar);
|
|
7459
7465
|
}
|
|
7460
7466
|
getInitialState() {
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7467
|
+
const props = this.props;
|
|
7468
|
+
const inputFormat = this.getFormat("datetime");
|
|
7469
|
+
const selectedDate = this.parseDate(
|
|
7464
7470
|
props.value || props.initialValue,
|
|
7465
7471
|
inputFormat
|
|
7466
7472
|
);
|
|
@@ -7491,7 +7497,7 @@ flowchart TD
|
|
|
7491
7497
|
return this.getInitialDate();
|
|
7492
7498
|
}
|
|
7493
7499
|
getInitialDate() {
|
|
7494
|
-
|
|
7500
|
+
const m = this.localMoment();
|
|
7495
7501
|
m.hour(0).minute(0).second(0).millisecond(0);
|
|
7496
7502
|
return m;
|
|
7497
7503
|
}
|
|
@@ -7511,8 +7517,8 @@ flowchart TD
|
|
|
7511
7517
|
}
|
|
7512
7518
|
getClassName() {
|
|
7513
7519
|
let cn2 = "rdt";
|
|
7514
|
-
|
|
7515
|
-
|
|
7520
|
+
const props = this.props;
|
|
7521
|
+
const propCn = props.className;
|
|
7516
7522
|
if (Array.isArray(propCn)) {
|
|
7517
7523
|
cn2 += " " + propCn.join(" ");
|
|
7518
7524
|
} else if (propCn) {
|
|
@@ -7545,14 +7551,14 @@ flowchart TD
|
|
|
7545
7551
|
return viewModes.DAYS;
|
|
7546
7552
|
}
|
|
7547
7553
|
getLocaleData() {
|
|
7548
|
-
|
|
7554
|
+
const p = this.props;
|
|
7549
7555
|
return this.localMoment(
|
|
7550
7556
|
p.value || p.defaultValue || /* @__PURE__ */ new Date()
|
|
7551
7557
|
).localeData();
|
|
7552
7558
|
}
|
|
7553
7559
|
getDateFormat() {
|
|
7554
7560
|
const locale = this.getLocaleData();
|
|
7555
|
-
|
|
7561
|
+
const format2 = this.props.dateFormat;
|
|
7556
7562
|
if (format2 === true)
|
|
7557
7563
|
return locale.longDateFormat("L");
|
|
7558
7564
|
if (format2)
|
|
@@ -7561,7 +7567,7 @@ flowchart TD
|
|
|
7561
7567
|
}
|
|
7562
7568
|
getTimeFormat() {
|
|
7563
7569
|
const locale = this.getLocaleData();
|
|
7564
|
-
|
|
7570
|
+
const format2 = this.props.timeFormat;
|
|
7565
7571
|
if (format2 === true) {
|
|
7566
7572
|
return locale.longDateFormat("LT");
|
|
7567
7573
|
}
|
|
@@ -7573,12 +7579,12 @@ flowchart TD
|
|
|
7573
7579
|
} else if (type === "time") {
|
|
7574
7580
|
return this.getTimeFormat();
|
|
7575
7581
|
}
|
|
7576
|
-
|
|
7577
|
-
|
|
7582
|
+
const dateFormat = this.getDateFormat();
|
|
7583
|
+
const timeFormat = this.getTimeFormat();
|
|
7578
7584
|
return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
|
|
7579
7585
|
}
|
|
7580
7586
|
updateTime(op, amount, type, toSelected) {
|
|
7581
|
-
|
|
7587
|
+
const update = {};
|
|
7582
7588
|
const date = toSelected ? "selectedDate" : "viewDate";
|
|
7583
7589
|
update[date] = this.state[date].clone()[op](amount, type);
|
|
7584
7590
|
this.setState(update);
|
|
@@ -7611,7 +7617,7 @@ flowchart TD
|
|
|
7611
7617
|
if (prevProps === this.props)
|
|
7612
7618
|
return;
|
|
7613
7619
|
let needsUpdate = false;
|
|
7614
|
-
|
|
7620
|
+
const thisProps = this.props;
|
|
7615
7621
|
["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
|
|
7616
7622
|
function(p) {
|
|
7617
7623
|
prevProps[p] !== thisProps[p] && (needsUpdate = true);
|
|
@@ -7627,8 +7633,8 @@ flowchart TD
|
|
|
7627
7633
|
}
|
|
7628
7634
|
regenerateDates() {
|
|
7629
7635
|
const props = this.props;
|
|
7630
|
-
|
|
7631
|
-
|
|
7636
|
+
const viewDate = this.state.viewDate.clone();
|
|
7637
|
+
const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
|
|
7632
7638
|
if (props.locale) {
|
|
7633
7639
|
viewDate.locale(props.locale);
|
|
7634
7640
|
selectedDate && selectedDate.locale(props.locale);
|
|
@@ -7643,7 +7649,7 @@ flowchart TD
|
|
|
7643
7649
|
viewDate.locale();
|
|
7644
7650
|
selectedDate && selectedDate.locale();
|
|
7645
7651
|
}
|
|
7646
|
-
|
|
7652
|
+
const update = { viewDate, selectedDate };
|
|
7647
7653
|
if (selectedDate && selectedDate.isValid()) {
|
|
7648
7654
|
update.inputValue = selectedDate.format(this.getFormat("datetime"));
|
|
7649
7655
|
}
|
|
@@ -7652,7 +7658,7 @@ flowchart TD
|
|
|
7652
7658
|
getSelectedDate() {
|
|
7653
7659
|
if (this.props.value === void 0)
|
|
7654
7660
|
return this.state.selectedDate;
|
|
7655
|
-
|
|
7661
|
+
const selectedDate = this.parseDate(
|
|
7656
7662
|
this.props.value,
|
|
7657
7663
|
this.getFormat("datetime")
|
|
7658
7664
|
);
|
|
@@ -7671,7 +7677,7 @@ flowchart TD
|
|
|
7671
7677
|
return "";
|
|
7672
7678
|
}
|
|
7673
7679
|
getInputValue() {
|
|
7674
|
-
|
|
7680
|
+
const selectedDate = this.getSelectedDate();
|
|
7675
7681
|
return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
|
|
7676
7682
|
}
|
|
7677
7683
|
/**
|
|
@@ -7681,7 +7687,7 @@ flowchart TD
|
|
|
7681
7687
|
* @public
|
|
7682
7688
|
*/
|
|
7683
7689
|
setViewDate(date) {
|
|
7684
|
-
|
|
7690
|
+
const logError = function() {
|
|
7685
7691
|
return log("Invalid date passed to the `setViewDate` method: " + date);
|
|
7686
7692
|
};
|
|
7687
7693
|
if (!date)
|
|
@@ -7777,7 +7783,7 @@ flowchart TD
|
|
|
7777
7783
|
// Make moment accessible through the Datetime class
|
|
7778
7784
|
__publicField(Datetime, "moment", moment);
|
|
7779
7785
|
function log(message, method) {
|
|
7780
|
-
|
|
7786
|
+
const con = typeof window !== "undefined" && window.console;
|
|
7781
7787
|
if (!con)
|
|
7782
7788
|
return;
|
|
7783
7789
|
if (!method) {
|
|
@@ -8600,7 +8606,10 @@ flowchart TD
|
|
|
8600
8606
|
label: "View in GitHub",
|
|
8601
8607
|
Icon: /* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
|
|
8602
8608
|
onMouseDown: () => {
|
|
8603
|
-
window.open(
|
|
8609
|
+
window.open(
|
|
8610
|
+
branch.githubPullRequestUrl,
|
|
8611
|
+
"_blank"
|
|
8612
|
+
);
|
|
8604
8613
|
}
|
|
8605
8614
|
},
|
|
8606
8615
|
typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
|
|
@@ -8906,7 +8915,9 @@ flowchart TD
|
|
|
8906
8915
|
} else {
|
|
8907
8916
|
events = event;
|
|
8908
8917
|
}
|
|
8909
|
-
const newListeners = events.map(
|
|
8918
|
+
const newListeners = events.map(
|
|
8919
|
+
(event2) => new Listener(event2, callback)
|
|
8920
|
+
);
|
|
8910
8921
|
newListeners.forEach((newListener) => this.listeners.add(newListener));
|
|
8911
8922
|
return () => {
|
|
8912
8923
|
newListeners.forEach((listener) => this.listeners.delete(listener));
|
|
@@ -9262,9 +9273,7 @@ flowchart TD
|
|
|
9262
9273
|
const deleteStartTime = Date.now();
|
|
9263
9274
|
while (true) {
|
|
9264
9275
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
9265
|
-
const { error, message } = await this.api.getRequestStatus(
|
|
9266
|
-
requestId
|
|
9267
|
-
);
|
|
9276
|
+
const { error, message } = await this.api.getRequestStatus(requestId);
|
|
9268
9277
|
if (error !== void 0) {
|
|
9269
9278
|
if (error) {
|
|
9270
9279
|
throw new Error(message);
|
|
@@ -9292,9 +9301,7 @@ flowchart TD
|
|
|
9292
9301
|
const encodeUrlIfNeeded = (url) => {
|
|
9293
9302
|
if (url) {
|
|
9294
9303
|
try {
|
|
9295
|
-
|
|
9296
|
-
parsed.pathname = parsed.pathname.split("/").filter((part) => part !== "").map(encodeURIComponent).join("/");
|
|
9297
|
-
return parsed.toString();
|
|
9304
|
+
return new URL(url).toString();
|
|
9298
9305
|
} catch (e) {
|
|
9299
9306
|
return url;
|
|
9300
9307
|
}
|
|
@@ -9601,7 +9608,7 @@ flowchart TD
|
|
|
9601
9608
|
return this.add("error", message, timeout);
|
|
9602
9609
|
}
|
|
9603
9610
|
};
|
|
9604
|
-
const
|
|
9611
|
+
const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
|
|
9605
9612
|
"div",
|
|
9606
9613
|
{
|
|
9607
9614
|
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
@@ -9614,25 +9621,8 @@ flowchart TD
|
|
|
9614
9621
|
animationDuration: "150ms"
|
|
9615
9622
|
}
|
|
9616
9623
|
},
|
|
9617
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
9618
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
9619
|
-
/* @__PURE__ */ React__namespace.createElement("p", { className: "block" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9620
|
-
Button$1,
|
|
9621
|
-
{
|
|
9622
|
-
href: "https://tina.io/docs/tinacms-context/",
|
|
9623
|
-
target: "_blank",
|
|
9624
|
-
as: "a"
|
|
9625
|
-
},
|
|
9626
|
-
/* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
9627
|
-
" Contextual Editing"
|
|
9628
|
-
))
|
|
9629
|
-
);
|
|
9630
|
-
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
|
|
9631
|
-
"span",
|
|
9632
|
-
{
|
|
9633
|
-
className: `text-[24px] leading-none inline-block ${className}`,
|
|
9634
|
-
...props
|
|
9635
|
-
}
|
|
9624
|
+
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Please wait while TinaCMS", /* @__PURE__ */ React__namespace.createElement("br", null), "loads your content"),
|
|
9625
|
+
/* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
|
|
9636
9626
|
);
|
|
9637
9627
|
class SidebarState {
|
|
9638
9628
|
constructor(events, options = {}) {
|
|
@@ -9647,7 +9637,7 @@ flowchart TD
|
|
|
9647
9637
|
};
|
|
9648
9638
|
this.position = options.position || "displace";
|
|
9649
9639
|
this.renderNav = options.renderNav || true;
|
|
9650
|
-
this.
|
|
9640
|
+
this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
|
|
9651
9641
|
if ((_a = options.buttons) == null ? void 0 : _a.save) {
|
|
9652
9642
|
this.buttons.save = options.buttons.save;
|
|
9653
9643
|
}
|
|
@@ -9721,238 +9711,6 @@ flowchart TD
|
|
|
9721
9711
|
children
|
|
9722
9712
|
)));
|
|
9723
9713
|
};
|
|
9724
|
-
const Item = ({
|
|
9725
|
-
item,
|
|
9726
|
-
depth,
|
|
9727
|
-
setActiveFormId
|
|
9728
|
-
}) => {
|
|
9729
|
-
const cms = useCMS();
|
|
9730
|
-
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
9731
|
-
const form = React__namespace.useMemo(
|
|
9732
|
-
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
9733
|
-
[item.formId]
|
|
9734
|
-
);
|
|
9735
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9736
|
-
"button",
|
|
9737
|
-
{
|
|
9738
|
-
type: "button",
|
|
9739
|
-
key: item.path,
|
|
9740
|
-
onClick: () => setActiveFormId(item.formId),
|
|
9741
|
-
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`
|
|
9742
|
-
},
|
|
9743
|
-
/* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
|
|
9744
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
|
|
9745
|
-
);
|
|
9746
|
-
};
|
|
9747
|
-
const FormListItem = ({
|
|
9748
|
-
item,
|
|
9749
|
-
depth,
|
|
9750
|
-
setActiveFormId
|
|
9751
|
-
}) => {
|
|
9752
|
-
var _a;
|
|
9753
|
-
return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
|
|
9754
|
-
if (subItem.type === "document") {
|
|
9755
|
-
return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
|
|
9756
|
-
Item,
|
|
9757
|
-
{
|
|
9758
|
-
setActiveFormId,
|
|
9759
|
-
depth: depth + 1,
|
|
9760
|
-
item: subItem
|
|
9761
|
-
}
|
|
9762
|
-
));
|
|
9763
|
-
}
|
|
9764
|
-
})));
|
|
9765
|
-
};
|
|
9766
|
-
const FormLists = (props) => {
|
|
9767
|
-
const cms = useCMS();
|
|
9768
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9769
|
-
react.Transition,
|
|
9770
|
-
{
|
|
9771
|
-
appear: true,
|
|
9772
|
-
show: true,
|
|
9773
|
-
as: "div",
|
|
9774
|
-
enter: "transition-all ease-out duration-150",
|
|
9775
|
-
enterFrom: "opacity-0 -translate-x-1/2",
|
|
9776
|
-
enterTo: "opacity-100",
|
|
9777
|
-
leave: "transition-all ease-out duration-150",
|
|
9778
|
-
leaveFrom: "opacity-100",
|
|
9779
|
-
leaveTo: "opacity-0 -translate-x-1/2"
|
|
9780
|
-
},
|
|
9781
|
-
cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9782
|
-
FormList,
|
|
9783
|
-
{
|
|
9784
|
-
isEditing: props.isEditing,
|
|
9785
|
-
setActiveFormId: (id) => {
|
|
9786
|
-
cms.dispatch({ type: "forms:set-active-form-id", value: id });
|
|
9787
|
-
},
|
|
9788
|
-
formList
|
|
9789
|
-
}
|
|
9790
|
-
)))
|
|
9791
|
-
);
|
|
9792
|
-
};
|
|
9793
|
-
const FormList = (props) => {
|
|
9794
|
-
const cms = useCMS();
|
|
9795
|
-
const listItems = React__namespace.useMemo(() => {
|
|
9796
|
-
var _a;
|
|
9797
|
-
const orderedListItems = [];
|
|
9798
|
-
const globalItems = [];
|
|
9799
|
-
const topItems = [];
|
|
9800
|
-
props.formList.items.forEach((item) => {
|
|
9801
|
-
if (item.type === "document") {
|
|
9802
|
-
const form = cms.state.forms.find(
|
|
9803
|
-
({ tinaForm }) => tinaForm.id === item.formId
|
|
9804
|
-
);
|
|
9805
|
-
if (form.tinaForm.global) {
|
|
9806
|
-
globalItems.push(item);
|
|
9807
|
-
} else {
|
|
9808
|
-
orderedListItems.push(item);
|
|
9809
|
-
}
|
|
9810
|
-
} else {
|
|
9811
|
-
orderedListItems.push(item);
|
|
9812
|
-
}
|
|
9813
|
-
});
|
|
9814
|
-
if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
|
|
9815
|
-
topItems.push({ type: "list", label: "Documents" });
|
|
9816
|
-
}
|
|
9817
|
-
let extra = [];
|
|
9818
|
-
if (globalItems.length) {
|
|
9819
|
-
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
9820
|
-
}
|
|
9821
|
-
return [...topItems, ...orderedListItems, ...extra];
|
|
9822
|
-
}, [JSON.stringify(props.formList.items)]);
|
|
9823
|
-
return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
9824
|
-
if (item.type === "list") {
|
|
9825
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9826
|
-
"div",
|
|
9827
|
-
{
|
|
9828
|
-
key: item.label,
|
|
9829
|
-
className: `relative group text-left w-full bg-white shadow-sm
|
|
9830
|
-
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"}`
|
|
9831
|
-
},
|
|
9832
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
9833
|
-
"span",
|
|
9834
|
-
{
|
|
9835
|
-
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
9836
|
-
},
|
|
9837
|
-
item.label
|
|
9838
|
-
)
|
|
9839
|
-
);
|
|
9840
|
-
}
|
|
9841
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9842
|
-
FormListItem,
|
|
9843
|
-
{
|
|
9844
|
-
setActiveFormId: (id) => props.setActiveFormId(id),
|
|
9845
|
-
key: item.formId,
|
|
9846
|
-
item,
|
|
9847
|
-
depth: 0
|
|
9848
|
-
}
|
|
9849
|
-
);
|
|
9850
|
-
})));
|
|
9851
|
-
};
|
|
9852
|
-
const FormsView = ({
|
|
9853
|
-
children
|
|
9854
|
-
}) => {
|
|
9855
|
-
const cms = useCMS$1();
|
|
9856
|
-
const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
|
|
9857
|
-
const isMultiform = cms.state.forms.length > 1;
|
|
9858
|
-
const activeForm = cms.state.forms.find(
|
|
9859
|
-
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
9860
|
-
);
|
|
9861
|
-
const isEditing = !!activeForm;
|
|
9862
|
-
if (!cms.state.formLists.length) {
|
|
9863
|
-
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " ", children, " ");
|
|
9864
|
-
}
|
|
9865
|
-
if (isMultiform && !activeForm) {
|
|
9866
|
-
return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
|
|
9867
|
-
}
|
|
9868
|
-
const formMetas = cms.plugins.all("form:meta");
|
|
9869
|
-
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
9870
|
-
};
|
|
9871
|
-
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
9872
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9873
|
-
"div",
|
|
9874
|
-
{
|
|
9875
|
-
className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
|
|
9876
|
-
style: isEditing ? {
|
|
9877
|
-
transform: "none",
|
|
9878
|
-
animationName: "fly-in-left",
|
|
9879
|
-
animationDuration: "150ms",
|
|
9880
|
-
animationDelay: "0",
|
|
9881
|
-
animationIterationCount: 1,
|
|
9882
|
-
animationTimingFunction: "ease-out"
|
|
9883
|
-
} : {
|
|
9884
|
-
transform: "translate3d(100%, 0, 0)"
|
|
9885
|
-
}
|
|
9886
|
-
},
|
|
9887
|
-
children
|
|
9888
|
-
);
|
|
9889
|
-
};
|
|
9890
|
-
const MultiformFormHeader = ({
|
|
9891
|
-
activeForm
|
|
9892
|
-
}) => {
|
|
9893
|
-
const cms = useCMS$1();
|
|
9894
|
-
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
9895
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9896
|
-
"div",
|
|
9897
|
-
{
|
|
9898
|
-
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9899
|
-
},
|
|
9900
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9901
|
-
"button",
|
|
9902
|
-
{
|
|
9903
|
-
type: "button",
|
|
9904
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9905
|
-
onClick: () => {
|
|
9906
|
-
const state = activeForm.tinaForm.finalForm.getState();
|
|
9907
|
-
if (state.invalid === true) {
|
|
9908
|
-
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
9909
|
-
} else {
|
|
9910
|
-
cms.dispatch({ type: "forms:set-active-form-id", value: null });
|
|
9911
|
-
}
|
|
9912
|
-
}
|
|
9913
|
-
},
|
|
9914
|
-
/* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9915
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
9916
|
-
"button",
|
|
9917
|
-
{
|
|
9918
|
-
type: "button",
|
|
9919
|
-
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9920
|
-
onClick: () => {
|
|
9921
|
-
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9922
|
-
cms.state.activeFormId
|
|
9923
|
-
).name;
|
|
9924
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9925
|
-
}
|
|
9926
|
-
},
|
|
9927
|
-
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9928
|
-
), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9929
|
-
);
|
|
9930
|
-
};
|
|
9931
|
-
const FormHeader = ({ activeForm }) => {
|
|
9932
|
-
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
9933
|
-
const cms = useCMS$1();
|
|
9934
|
-
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
9935
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9936
|
-
"div",
|
|
9937
|
-
{
|
|
9938
|
-
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9939
|
-
},
|
|
9940
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.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__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9953
|
-
), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9954
|
-
);
|
|
9955
|
-
};
|
|
9956
9714
|
function ImFilesEmpty(props) {
|
|
9957
9715
|
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14.341 5.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.689 0.561 1.25 1.25 1.25h9.5c0.689 0 1.25-0.561 1.25-1.25v-7.75c0-0.224-0.068-0.615-0.659-1.421zM12.271 4.729c0.48 0.48 0.856 0.912 1.134 1.271h-2.406v-2.405c0.359 0.278 0.792 0.654 1.271 1.134v0zM14 14.75c0 0.136-0.114 0.25-0.25 0.25h-9.5c-0.136 0-0.25-0.114-0.25-0.25v-11.5c0-0.135 0.114-0.25 0.25-0.25 0 0 5.749-0 5.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5v7.75z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9.421 0.659c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.604 0.43 1.109 1 1.225v-12.725c0-0.135 0.115-0.25 0.25-0.25h7.607c-0.151-0.124-0.297-0.238-0.437-0.341z" }, "child": [] }] })(props);
|
|
9958
9716
|
}
|
|
@@ -10195,7 +9953,7 @@ flowchart TD
|
|
|
10195
9953
|
"Event Log"
|
|
10196
9954
|
));
|
|
10197
9955
|
};
|
|
10198
|
-
const version = "2.7.
|
|
9956
|
+
const version = "2.7.4";
|
|
10199
9957
|
const Nav = ({
|
|
10200
9958
|
isLocalMode,
|
|
10201
9959
|
className = "",
|
|
@@ -10437,6 +10195,293 @@ flowchart TD
|
|
|
10437
10195
|
/* @__PURE__ */ React__namespace.createElement("span", { className: "absolute top-1/2 left-1/2 h-4/6 w-px bg-gray-200 transform -translate-y-1/2 -translate-x-1/2 opacity-30 transition-opacity duration-150 ease-out group-hover:opacity-100" })
|
|
10438
10196
|
);
|
|
10439
10197
|
};
|
|
10198
|
+
const Item = ({
|
|
10199
|
+
item,
|
|
10200
|
+
depth,
|
|
10201
|
+
setActiveFormId
|
|
10202
|
+
}) => {
|
|
10203
|
+
const cms = useCMS();
|
|
10204
|
+
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
10205
|
+
const form = React__namespace.useMemo(
|
|
10206
|
+
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
10207
|
+
[item.formId]
|
|
10208
|
+
);
|
|
10209
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10210
|
+
"button",
|
|
10211
|
+
{
|
|
10212
|
+
type: "button",
|
|
10213
|
+
key: item.path,
|
|
10214
|
+
onClick: () => setActiveFormId(item.formId),
|
|
10215
|
+
className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
|
|
10216
|
+
},
|
|
10217
|
+
/* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
|
|
10218
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
|
|
10219
|
+
);
|
|
10220
|
+
};
|
|
10221
|
+
const FormListItem = ({
|
|
10222
|
+
item,
|
|
10223
|
+
depth,
|
|
10224
|
+
setActiveFormId
|
|
10225
|
+
}) => {
|
|
10226
|
+
var _a;
|
|
10227
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
|
|
10228
|
+
if (subItem.type === "document") {
|
|
10229
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
|
|
10230
|
+
Item,
|
|
10231
|
+
{
|
|
10232
|
+
setActiveFormId,
|
|
10233
|
+
depth: depth + 1,
|
|
10234
|
+
item: subItem
|
|
10235
|
+
}
|
|
10236
|
+
));
|
|
10237
|
+
}
|
|
10238
|
+
})));
|
|
10239
|
+
};
|
|
10240
|
+
const FormLists = (props) => {
|
|
10241
|
+
const cms = useCMS();
|
|
10242
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10243
|
+
react.Transition,
|
|
10244
|
+
{
|
|
10245
|
+
appear: true,
|
|
10246
|
+
show: true,
|
|
10247
|
+
as: "div",
|
|
10248
|
+
enter: "transition-all ease-out duration-150",
|
|
10249
|
+
enterFrom: "opacity-0 -translate-x-1/2",
|
|
10250
|
+
enterTo: "opacity-100",
|
|
10251
|
+
leave: "transition-all ease-out duration-150",
|
|
10252
|
+
leaveFrom: "opacity-100",
|
|
10253
|
+
leaveTo: "opacity-0 -translate-x-1/2"
|
|
10254
|
+
},
|
|
10255
|
+
cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10256
|
+
FormList,
|
|
10257
|
+
{
|
|
10258
|
+
isEditing: props.isEditing,
|
|
10259
|
+
setActiveFormId: (id) => {
|
|
10260
|
+
cms.dispatch({ type: "forms:set-active-form-id", value: id });
|
|
10261
|
+
},
|
|
10262
|
+
formList
|
|
10263
|
+
}
|
|
10264
|
+
)))
|
|
10265
|
+
);
|
|
10266
|
+
};
|
|
10267
|
+
const FormList = (props) => {
|
|
10268
|
+
const cms = useCMS();
|
|
10269
|
+
const listItems = React__namespace.useMemo(() => {
|
|
10270
|
+
var _a;
|
|
10271
|
+
const orderedListItems = [];
|
|
10272
|
+
const globalItems = [];
|
|
10273
|
+
const topItems = [];
|
|
10274
|
+
props.formList.items.forEach((item) => {
|
|
10275
|
+
if (item.type === "document") {
|
|
10276
|
+
const form = cms.state.forms.find(
|
|
10277
|
+
({ tinaForm }) => tinaForm.id === item.formId
|
|
10278
|
+
);
|
|
10279
|
+
if (form.tinaForm.global) {
|
|
10280
|
+
globalItems.push(item);
|
|
10281
|
+
} else {
|
|
10282
|
+
orderedListItems.push(item);
|
|
10283
|
+
}
|
|
10284
|
+
} else {
|
|
10285
|
+
orderedListItems.push(item);
|
|
10286
|
+
}
|
|
10287
|
+
});
|
|
10288
|
+
if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
|
|
10289
|
+
topItems.push({ type: "list", label: "Documents" });
|
|
10290
|
+
}
|
|
10291
|
+
let extra = [];
|
|
10292
|
+
if (globalItems.length) {
|
|
10293
|
+
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
10294
|
+
}
|
|
10295
|
+
return [...topItems, ...orderedListItems, ...extra];
|
|
10296
|
+
}, [JSON.stringify(props.formList.items)]);
|
|
10297
|
+
return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
10298
|
+
if (item.type === "list") {
|
|
10299
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10300
|
+
"div",
|
|
10301
|
+
{
|
|
10302
|
+
key: item.label,
|
|
10303
|
+
className: `relative group text-left w-full bg-white shadow-sm
|
|
10304
|
+
border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
|
|
10305
|
+
},
|
|
10306
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
10307
|
+
"span",
|
|
10308
|
+
{
|
|
10309
|
+
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
10310
|
+
},
|
|
10311
|
+
item.label
|
|
10312
|
+
)
|
|
10313
|
+
);
|
|
10314
|
+
}
|
|
10315
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10316
|
+
FormListItem,
|
|
10317
|
+
{
|
|
10318
|
+
setActiveFormId: (id) => props.setActiveFormId(id),
|
|
10319
|
+
key: item.formId,
|
|
10320
|
+
item,
|
|
10321
|
+
depth: 0
|
|
10322
|
+
}
|
|
10323
|
+
);
|
|
10324
|
+
})));
|
|
10325
|
+
};
|
|
10326
|
+
const SidebarNoFormsPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
|
|
10327
|
+
"div",
|
|
10328
|
+
{
|
|
10329
|
+
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
10330
|
+
style: {
|
|
10331
|
+
animationName: "fade-in",
|
|
10332
|
+
animationDelay: "300ms",
|
|
10333
|
+
animationTimingFunction: "ease-out",
|
|
10334
|
+
animationIterationCount: 1,
|
|
10335
|
+
animationFillMode: "both",
|
|
10336
|
+
animationDuration: "150ms"
|
|
10337
|
+
}
|
|
10338
|
+
},
|
|
10339
|
+
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
|
|
10340
|
+
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10341
|
+
Button$1,
|
|
10342
|
+
{
|
|
10343
|
+
href: "https://tina.io/docs/contextual-editing/overview",
|
|
10344
|
+
target: "_blank",
|
|
10345
|
+
as: "a"
|
|
10346
|
+
},
|
|
10347
|
+
/* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
10348
|
+
" Contextual Editing Docs"
|
|
10349
|
+
))
|
|
10350
|
+
);
|
|
10351
|
+
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10352
|
+
"span",
|
|
10353
|
+
{
|
|
10354
|
+
className: `text-[24px] leading-none inline-block ${className}`,
|
|
10355
|
+
...props
|
|
10356
|
+
}
|
|
10357
|
+
);
|
|
10358
|
+
const minimumTimeToShowLoadingIndicator = 1e3;
|
|
10359
|
+
const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
10360
|
+
const cms = useCMS$1();
|
|
10361
|
+
const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
|
|
10362
|
+
const [isShowingLoading, setIsShowingLoading] = React__namespace.useState(true);
|
|
10363
|
+
const [initialLoadComplete, setInitialLoadComplete] = React__namespace.useState(false);
|
|
10364
|
+
React__namespace.useEffect(() => {
|
|
10365
|
+
if (cms.state.isLoadingContent) {
|
|
10366
|
+
setIsShowingLoading(true);
|
|
10367
|
+
const timer = setTimeout(() => {
|
|
10368
|
+
if (!cms.state.isLoadingContent) {
|
|
10369
|
+
setIsShowingLoading(false);
|
|
10370
|
+
setInitialLoadComplete(true);
|
|
10371
|
+
}
|
|
10372
|
+
}, minimumTimeToShowLoadingIndicator);
|
|
10373
|
+
return () => clearTimeout(timer);
|
|
10374
|
+
} else {
|
|
10375
|
+
const timer = setTimeout(() => {
|
|
10376
|
+
setIsShowingLoading(false);
|
|
10377
|
+
setInitialLoadComplete(true);
|
|
10378
|
+
}, minimumTimeToShowLoadingIndicator);
|
|
10379
|
+
return () => clearTimeout(timer);
|
|
10380
|
+
}
|
|
10381
|
+
}, [cms.state.isLoadingContent]);
|
|
10382
|
+
if (isShowingLoading || !initialLoadComplete) {
|
|
10383
|
+
const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
|
|
10384
|
+
return /* @__PURE__ */ React__namespace.createElement(LoadingPlaceholder, null);
|
|
10385
|
+
}
|
|
10386
|
+
if (!cms.state.formLists.length) {
|
|
10387
|
+
return /* @__PURE__ */ React__namespace.createElement(SidebarNoFormsPlaceholder, null);
|
|
10388
|
+
}
|
|
10389
|
+
const isMultiform = cms.state.forms.length > 1;
|
|
10390
|
+
const activeForm = cms.state.forms.find(
|
|
10391
|
+
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
10392
|
+
);
|
|
10393
|
+
const isEditing = !!activeForm;
|
|
10394
|
+
if (isMultiform && !activeForm) {
|
|
10395
|
+
return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
|
|
10396
|
+
}
|
|
10397
|
+
const formMetas = cms.plugins.all("form:meta");
|
|
10398
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
10399
|
+
};
|
|
10400
|
+
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
10401
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10402
|
+
"div",
|
|
10403
|
+
{
|
|
10404
|
+
className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
|
|
10405
|
+
style: isEditing ? {
|
|
10406
|
+
transform: "none",
|
|
10407
|
+
animationName: "fly-in-left",
|
|
10408
|
+
animationDuration: "150ms",
|
|
10409
|
+
animationDelay: "0",
|
|
10410
|
+
animationIterationCount: 1,
|
|
10411
|
+
animationTimingFunction: "ease-out"
|
|
10412
|
+
} : {
|
|
10413
|
+
transform: "translate3d(100%, 0, 0)"
|
|
10414
|
+
}
|
|
10415
|
+
},
|
|
10416
|
+
children
|
|
10417
|
+
);
|
|
10418
|
+
};
|
|
10419
|
+
const MultiformFormHeader = ({
|
|
10420
|
+
activeForm
|
|
10421
|
+
}) => {
|
|
10422
|
+
const cms = useCMS$1();
|
|
10423
|
+
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
10424
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10425
|
+
"div",
|
|
10426
|
+
{
|
|
10427
|
+
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
10428
|
+
},
|
|
10429
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10430
|
+
"button",
|
|
10431
|
+
{
|
|
10432
|
+
type: "button",
|
|
10433
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
10434
|
+
onClick: () => {
|
|
10435
|
+
const state = activeForm.tinaForm.finalForm.getState();
|
|
10436
|
+
if (state.invalid === true) {
|
|
10437
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
10438
|
+
} else {
|
|
10439
|
+
cms.dispatch({ type: "forms:set-active-form-id", value: null });
|
|
10440
|
+
}
|
|
10441
|
+
}
|
|
10442
|
+
},
|
|
10443
|
+
/* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
10444
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
10445
|
+
"button",
|
|
10446
|
+
{
|
|
10447
|
+
type: "button",
|
|
10448
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
10449
|
+
onClick: () => {
|
|
10450
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
10451
|
+
cms.state.activeFormId
|
|
10452
|
+
).name;
|
|
10453
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
10454
|
+
}
|
|
10455
|
+
},
|
|
10456
|
+
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
10457
|
+
), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
10458
|
+
);
|
|
10459
|
+
};
|
|
10460
|
+
const FormHeader = ({ activeForm }) => {
|
|
10461
|
+
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
10462
|
+
const cms = useCMS$1();
|
|
10463
|
+
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
10464
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10465
|
+
"div",
|
|
10466
|
+
{
|
|
10467
|
+
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
10468
|
+
},
|
|
10469
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10470
|
+
"button",
|
|
10471
|
+
{
|
|
10472
|
+
type: "button",
|
|
10473
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
10474
|
+
onClick: () => {
|
|
10475
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
10476
|
+
cms.state.activeFormId
|
|
10477
|
+
).name;
|
|
10478
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
10479
|
+
}
|
|
10480
|
+
},
|
|
10481
|
+
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
10482
|
+
), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
10483
|
+
);
|
|
10484
|
+
};
|
|
10440
10485
|
const SidebarContext = React__namespace.createContext(null);
|
|
10441
10486
|
const minPreviewWidth = 440;
|
|
10442
10487
|
const minSidebarWidth = 360;
|
|
@@ -10655,7 +10700,7 @@ flowchart TD
|
|
|
10655
10700
|
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
|
|
10656
10701
|
branchingEnabled
|
|
10657
10702
|
}
|
|
10658
|
-
), /* @__PURE__ */ React__namespace.createElement(FormsView,
|
|
10703
|
+
), /* @__PURE__ */ React__namespace.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React__namespace.createElement(
|
|
10659
10704
|
ScreenPluginModal,
|
|
10660
10705
|
{
|
|
10661
10706
|
screen: activeScreen,
|
|
@@ -10831,7 +10876,7 @@ flowchart TD
|
|
|
10831
10876
|
className: "h-5 w-auto -mx-1 text-blue-500",
|
|
10832
10877
|
stroke: "currentColor",
|
|
10833
10878
|
fill: "currentColor",
|
|
10834
|
-
|
|
10879
|
+
strokeWidth: "0",
|
|
10835
10880
|
viewBox: "0 0 24 24",
|
|
10836
10881
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10837
10882
|
},
|
|
@@ -11421,7 +11466,10 @@ flowchart TD
|
|
|
11421
11466
|
const observer = new IntersectionObserver((entries) => {
|
|
11422
11467
|
const target = entries[0];
|
|
11423
11468
|
if (target.isIntersecting && list.nextOffset) {
|
|
11424
|
-
setOffsetHistory((offsetHistory2) => [
|
|
11469
|
+
setOffsetHistory((offsetHistory2) => [
|
|
11470
|
+
...offsetHistory2,
|
|
11471
|
+
list.nextOffset
|
|
11472
|
+
]);
|
|
11425
11473
|
}
|
|
11426
11474
|
});
|
|
11427
11475
|
if (loaderRef.current) {
|
|
@@ -12016,6 +12064,7 @@ flowchart TD
|
|
|
12016
12064
|
forms: [],
|
|
12017
12065
|
formLists: [],
|
|
12018
12066
|
editingMode: "basic",
|
|
12067
|
+
isLoadingContent: false,
|
|
12019
12068
|
quickEditSupported: false,
|
|
12020
12069
|
sidebarDisplayState: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.defaultState) || "open"
|
|
12021
12070
|
};
|
|
@@ -12075,7 +12124,12 @@ flowchart TD
|
|
|
12075
12124
|
}
|
|
12076
12125
|
});
|
|
12077
12126
|
}
|
|
12078
|
-
return {
|
|
12127
|
+
return {
|
|
12128
|
+
...state,
|
|
12129
|
+
activeFormId,
|
|
12130
|
+
formLists: nextFormLists,
|
|
12131
|
+
isLoadingContent: false
|
|
12132
|
+
};
|
|
12079
12133
|
}
|
|
12080
12134
|
case "form-lists:remove": {
|
|
12081
12135
|
const nextFormLists = state.formLists.filter(
|
|
@@ -12144,6 +12198,9 @@ flowchart TD
|
|
|
12144
12198
|
}
|
|
12145
12199
|
return { ...state, sidebarDisplayState: action.value };
|
|
12146
12200
|
}
|
|
12201
|
+
case "sidebar:set-loading-state": {
|
|
12202
|
+
return { ...state, isLoadingContent: action.value };
|
|
12203
|
+
}
|
|
12147
12204
|
default:
|
|
12148
12205
|
throw new Error(`Unhandled action ${action.type}`);
|
|
12149
12206
|
}
|
|
@@ -12385,7 +12442,9 @@ flowchart TD
|
|
|
12385
12442
|
if (activeEle) {
|
|
12386
12443
|
setDisplay(true);
|
|
12387
12444
|
setPosition(activeEle.getBoundingClientRect());
|
|
12388
|
-
const iframe = document.getElementById(
|
|
12445
|
+
const iframe = document.getElementById(
|
|
12446
|
+
"tina-iframe"
|
|
12447
|
+
);
|
|
12389
12448
|
if (iframe) {
|
|
12390
12449
|
setIframePosition(iframe.getBoundingClientRect());
|
|
12391
12450
|
}
|
|
@@ -12827,7 +12886,6 @@ flowchart TD
|
|
|
12827
12886
|
}) => {
|
|
12828
12887
|
const cms = useCMS$1();
|
|
12829
12888
|
const tinaApi = cms.api.tina;
|
|
12830
|
-
tinaApi.branch;
|
|
12831
12889
|
const [disabled, setDisabled] = React__namespace.useState(false);
|
|
12832
12890
|
const [newBranchName, setNewBranchName] = React__namespace.useState("");
|
|
12833
12891
|
const [error, setError] = React__namespace.useState("");
|
|
@@ -12853,10 +12911,10 @@ flowchart TD
|
|
|
12853
12911
|
const newUrl = window.location.href.replace(hash, newHash);
|
|
12854
12912
|
window.location.href = newUrl;
|
|
12855
12913
|
};
|
|
12856
|
-
return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", { className: "text-
|
|
12914
|
+
return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-sm text-gray-700 mb-4" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React__namespace.createElement(
|
|
12857
12915
|
PrefixedTextField,
|
|
12858
12916
|
{
|
|
12859
|
-
placeholder: "
|
|
12917
|
+
placeholder: "e.g. {{PAGE-NAME}}-updates",
|
|
12860
12918
|
value: newBranchName,
|
|
12861
12919
|
onChange: (e) => {
|
|
12862
12920
|
setError("");
|
|
@@ -13003,7 +13061,9 @@ flowchart TD
|
|
|
13003
13061
|
const { fieldName } = useTemplates();
|
|
13004
13062
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13005
13063
|
useHotkey("enter", () => {
|
|
13006
|
-
plateCommon.insertNodes(editor, [
|
|
13064
|
+
plateCommon.insertNodes(editor, [
|
|
13065
|
+
{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13066
|
+
]);
|
|
13007
13067
|
});
|
|
13008
13068
|
return /* @__PURE__ */ React.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React.createElement(
|
|
13009
13069
|
"div",
|
|
@@ -13146,7 +13206,9 @@ flowchart TD
|
|
|
13146
13206
|
const { templates, fieldName } = useTemplates();
|
|
13147
13207
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13148
13208
|
useHotkey("enter", () => {
|
|
13149
|
-
plateCommon.insertNodes(editor, [
|
|
13209
|
+
plateCommon.insertNodes(editor, [
|
|
13210
|
+
{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13211
|
+
]);
|
|
13150
13212
|
});
|
|
13151
13213
|
useHotkey("space", () => {
|
|
13152
13214
|
plateCommon.insertNodes(editor, [{ text: " " }], {
|
|
@@ -13202,7 +13264,9 @@ flowchart TD
|
|
|
13202
13264
|
const { templates, fieldName } = useTemplates();
|
|
13203
13265
|
const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
|
|
13204
13266
|
useHotkey("enter", () => {
|
|
13205
|
-
plateCommon.insertNodes(editor, [
|
|
13267
|
+
plateCommon.insertNodes(editor, [
|
|
13268
|
+
{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
|
|
13269
|
+
]);
|
|
13206
13270
|
});
|
|
13207
13271
|
const activeTemplate = templates.find(
|
|
13208
13272
|
(template) => template.name === element.name
|
|
@@ -14061,7 +14125,9 @@ flowchart TD
|
|
|
14061
14125
|
const CONTAINER_MD_BREAKPOINT = 448;
|
|
14062
14126
|
const FLOAT_BUTTON_WIDTH = 25;
|
|
14063
14127
|
const HEADING_LABEL = "Headings";
|
|
14064
|
-
const ToolbarContext = React.createContext(
|
|
14128
|
+
const ToolbarContext = React.createContext(
|
|
14129
|
+
void 0
|
|
14130
|
+
);
|
|
14065
14131
|
const ToolbarProvider = ({
|
|
14066
14132
|
tinaForm,
|
|
14067
14133
|
templates,
|
|
@@ -14211,7 +14277,7 @@ flowchart TD
|
|
|
14211
14277
|
const CodeBlockToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14212
14278
|
const state = useCodeBlockToolbarButtonState();
|
|
14213
14279
|
const { props } = useCodeBlockToolbarButton(state);
|
|
14214
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "
|
|
14280
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
|
|
14215
14281
|
});
|
|
14216
14282
|
const useImageToolbarButtonState = () => {
|
|
14217
14283
|
const editor = plateCommon.useEditorState();
|
|
@@ -14243,36 +14309,54 @@ flowchart TD
|
|
|
14243
14309
|
const ImageToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14244
14310
|
const state = useImageToolbarButtonState();
|
|
14245
14311
|
const { props } = useImageToolbarButton(state);
|
|
14246
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "
|
|
14247
|
-
});
|
|
14248
|
-
const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
|
|
14249
|
-
const editor = plateCommon.useEditorState();
|
|
14250
|
-
const state = plate.useListToolbarButtonState({ nodeType });
|
|
14251
|
-
const { props } = plate.useListToolbarButton(state);
|
|
14252
|
-
return /* @__PURE__ */ React.createElement(
|
|
14253
|
-
ToolbarButton,
|
|
14254
|
-
{
|
|
14255
|
-
ref,
|
|
14256
|
-
tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
|
|
14257
|
-
...props,
|
|
14258
|
-
onClick: (e) => {
|
|
14259
|
-
e.preventDefault();
|
|
14260
|
-
e.stopPropagation();
|
|
14261
|
-
plate.toggleList(editor, { type: nodeType });
|
|
14262
|
-
}
|
|
14263
|
-
},
|
|
14264
|
-
nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14265
|
-
);
|
|
14312
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
|
|
14266
14313
|
});
|
|
14314
|
+
const UnorderedListToolbarButton = cn$1.withRef(
|
|
14315
|
+
(props, ref) => {
|
|
14316
|
+
const editor = plateCommon.useEditorState();
|
|
14317
|
+
const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_UL });
|
|
14318
|
+
const { props: buttonProps } = plate.useListToolbarButton(state);
|
|
14319
|
+
return /* @__PURE__ */ React.createElement(
|
|
14320
|
+
ToolbarButton,
|
|
14321
|
+
{
|
|
14322
|
+
ref,
|
|
14323
|
+
tooltip: "Bulleted List",
|
|
14324
|
+
...buttonProps,
|
|
14325
|
+
onClick: (e) => {
|
|
14326
|
+
e.preventDefault();
|
|
14327
|
+
e.stopPropagation();
|
|
14328
|
+
plate.toggleList(editor, { type: plate.ELEMENT_UL });
|
|
14329
|
+
}
|
|
14330
|
+
},
|
|
14331
|
+
/* @__PURE__ */ React.createElement(Icons.ul, null)
|
|
14332
|
+
);
|
|
14333
|
+
}
|
|
14334
|
+
);
|
|
14335
|
+
const OrderedListToolbarButton = cn$1.withRef(
|
|
14336
|
+
(props, ref) => {
|
|
14337
|
+
const editor = plateCommon.useEditorState();
|
|
14338
|
+
const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_OL });
|
|
14339
|
+
const { props: buttonProps } = plate.useListToolbarButton(state);
|
|
14340
|
+
return /* @__PURE__ */ React.createElement(
|
|
14341
|
+
ToolbarButton,
|
|
14342
|
+
{
|
|
14343
|
+
ref,
|
|
14344
|
+
tooltip: "Numbered List",
|
|
14345
|
+
...buttonProps,
|
|
14346
|
+
onClick: (e) => {
|
|
14347
|
+
e.preventDefault();
|
|
14348
|
+
e.stopPropagation();
|
|
14349
|
+
plate.toggleList(editor, { type: plate.ELEMENT_OL });
|
|
14350
|
+
}
|
|
14351
|
+
},
|
|
14352
|
+
/* @__PURE__ */ React.createElement(Icons.ol, null)
|
|
14353
|
+
);
|
|
14354
|
+
}
|
|
14355
|
+
);
|
|
14267
14356
|
const LinkToolbarButton = cn$1.withRef((rest, ref) => {
|
|
14268
14357
|
const state = plateLink.useLinkToolbarButtonState();
|
|
14269
14358
|
const { props } = plateLink.useLinkToolbarButton(state);
|
|
14270
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link"
|
|
14271
|
-
});
|
|
14272
|
-
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14273
|
-
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14274
|
-
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14275
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14359
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React.createElement(Icons.link, null));
|
|
14276
14360
|
});
|
|
14277
14361
|
const useMermaidToolbarButtonState = () => {
|
|
14278
14362
|
const editor = plateCommon.useEditorState();
|
|
@@ -14353,7 +14437,7 @@ flowchart TD
|
|
|
14353
14437
|
const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14354
14438
|
const state = useBlockQuoteToolbarButtonState();
|
|
14355
14439
|
const { props } = useBlockQuoteToolbarButton(state);
|
|
14356
|
-
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "
|
|
14440
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
|
|
14357
14441
|
});
|
|
14358
14442
|
const useRawMarkdownToolbarButton = () => {
|
|
14359
14443
|
const { setRawMode } = useEditorContext();
|
|
@@ -14373,7 +14457,7 @@ flowchart TD
|
|
|
14373
14457
|
ToolbarButton,
|
|
14374
14458
|
{
|
|
14375
14459
|
ref,
|
|
14376
|
-
tooltip: "
|
|
14460
|
+
tooltip: "Raw Markdown",
|
|
14377
14461
|
...rest,
|
|
14378
14462
|
...props,
|
|
14379
14463
|
"data-testid": "markdown-button"
|
|
@@ -14526,6 +14610,15 @@ flowchart TD
|
|
|
14526
14610
|
template.label || template.name
|
|
14527
14611
|
))));
|
|
14528
14612
|
};
|
|
14613
|
+
const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
|
|
14614
|
+
const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
|
|
14615
|
+
const { props } = plateCommon.useMarkToolbarButton(state);
|
|
14616
|
+
return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
|
|
14617
|
+
});
|
|
14618
|
+
const BoldToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null));
|
|
14619
|
+
const StrikethroughToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: plate.MARK_STRIKETHROUGH }, /* @__PURE__ */ React.createElement(Icons.strikethrough, null));
|
|
14620
|
+
const ItalicToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null));
|
|
14621
|
+
const CodeToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null));
|
|
14529
14622
|
const toolbarItems = {
|
|
14530
14623
|
heading: {
|
|
14531
14624
|
label: HEADING_LABEL,
|
|
@@ -14546,37 +14639,37 @@ flowchart TD
|
|
|
14546
14639
|
quote: {
|
|
14547
14640
|
label: "Quote",
|
|
14548
14641
|
width: () => STANDARD_ICON_WIDTH,
|
|
14549
|
-
Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton,
|
|
14642
|
+
Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, null)
|
|
14550
14643
|
},
|
|
14551
14644
|
ul: {
|
|
14552
14645
|
label: "Unordered List",
|
|
14553
14646
|
width: () => STANDARD_ICON_WIDTH,
|
|
14554
|
-
Component: /* @__PURE__ */ React.createElement(
|
|
14647
|
+
Component: /* @__PURE__ */ React.createElement(UnorderedListToolbarButton, null)
|
|
14555
14648
|
},
|
|
14556
14649
|
ol: {
|
|
14557
14650
|
label: "Ordered List",
|
|
14558
14651
|
width: () => STANDARD_ICON_WIDTH,
|
|
14559
|
-
Component: /* @__PURE__ */ React.createElement(
|
|
14652
|
+
Component: /* @__PURE__ */ React.createElement(OrderedListToolbarButton, null)
|
|
14560
14653
|
},
|
|
14561
14654
|
bold: {
|
|
14562
14655
|
label: "Bold",
|
|
14563
14656
|
width: () => STANDARD_ICON_WIDTH,
|
|
14564
|
-
Component: /* @__PURE__ */ React.createElement(
|
|
14657
|
+
Component: /* @__PURE__ */ React.createElement(BoldToolbarButton, null)
|
|
14565
14658
|
},
|
|
14566
14659
|
strikethrough: {
|
|
14567
14660
|
label: "Strikethrough",
|
|
14568
14661
|
width: () => STANDARD_ICON_WIDTH,
|
|
14569
|
-
Component: /* @__PURE__ */ React.createElement(
|
|
14662
|
+
Component: /* @__PURE__ */ React.createElement(StrikethroughToolbarButton, null)
|
|
14570
14663
|
},
|
|
14571
14664
|
italic: {
|
|
14572
14665
|
label: "Italic",
|
|
14573
14666
|
width: () => STANDARD_ICON_WIDTH,
|
|
14574
|
-
Component: /* @__PURE__ */ React.createElement(
|
|
14667
|
+
Component: /* @__PURE__ */ React.createElement(ItalicToolbarButton, null)
|
|
14575
14668
|
},
|
|
14576
14669
|
code: {
|
|
14577
14670
|
label: "Code",
|
|
14578
14671
|
width: () => STANDARD_ICON_WIDTH,
|
|
14579
|
-
Component: /* @__PURE__ */ React.createElement(
|
|
14672
|
+
Component: /* @__PURE__ */ React.createElement(CodeToolbarButton, null)
|
|
14580
14673
|
},
|
|
14581
14674
|
codeBlock: {
|
|
14582
14675
|
label: "Code Block",
|
|
@@ -30246,7 +30339,14 @@ flowchart TD
|
|
|
30246
30339
|
const AUTH_TOKEN_KEY = "tinacms-auth";
|
|
30247
30340
|
const authenticate = (clientId, frontendUrl) => {
|
|
30248
30341
|
return new Promise((resolve) => {
|
|
30249
|
-
|
|
30342
|
+
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30343
|
+
const authTab = popupWindow(
|
|
30344
|
+
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30345
|
+
"_blank",
|
|
30346
|
+
window,
|
|
30347
|
+
1e3,
|
|
30348
|
+
700
|
|
30349
|
+
);
|
|
30250
30350
|
window.addEventListener("message", function(e) {
|
|
30251
30351
|
if (e.data.source === TINA_LOGIN_EVENT) {
|
|
30252
30352
|
if (authTab) {
|
|
@@ -30259,14 +30359,6 @@ flowchart TD
|
|
|
30259
30359
|
});
|
|
30260
30360
|
}
|
|
30261
30361
|
});
|
|
30262
|
-
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
30263
|
-
authTab = popupWindow(
|
|
30264
|
-
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
30265
|
-
"_blank",
|
|
30266
|
-
window,
|
|
30267
|
-
1e3,
|
|
30268
|
-
700
|
|
30269
|
-
);
|
|
30270
30362
|
});
|
|
30271
30363
|
};
|
|
30272
30364
|
const DefaultSessionProvider = ({
|
|
@@ -30972,56 +31064,6 @@ mutation addPendingDocumentMutation(
|
|
|
30972
31064
|
!submitting && name
|
|
30973
31065
|
);
|
|
30974
31066
|
};
|
|
30975
|
-
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
30976
|
-
const useTinaAuthRedirect = () => {
|
|
30977
|
-
React.useEffect(() => {
|
|
30978
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
30979
|
-
const config = {
|
|
30980
|
-
code: urlParams.get("code") || "",
|
|
30981
|
-
scope: urlParams.get("scope") || "email",
|
|
30982
|
-
state: urlParams.get("state")
|
|
30983
|
-
};
|
|
30984
|
-
if (!config.code) {
|
|
30985
|
-
return;
|
|
30986
|
-
}
|
|
30987
|
-
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
30988
|
-
}, []);
|
|
30989
|
-
};
|
|
30990
|
-
const createClient = ({
|
|
30991
|
-
clientId,
|
|
30992
|
-
isLocalClient = true,
|
|
30993
|
-
branch,
|
|
30994
|
-
tinaioConfig,
|
|
30995
|
-
schema,
|
|
30996
|
-
apiUrl,
|
|
30997
|
-
tinaGraphQLVersion
|
|
30998
|
-
}) => {
|
|
30999
|
-
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31000
|
-
clientId: clientId || "",
|
|
31001
|
-
branch: branch || "main",
|
|
31002
|
-
tokenStorage: "LOCAL_STORAGE",
|
|
31003
|
-
tinaioConfig,
|
|
31004
|
-
schema,
|
|
31005
|
-
tinaGraphQLVersion
|
|
31006
|
-
});
|
|
31007
|
-
};
|
|
31008
|
-
function assertShape(value, yupSchema, errorMessage) {
|
|
31009
|
-
const shape = yupSchema(yup__namespace);
|
|
31010
|
-
try {
|
|
31011
|
-
shape.validateSync(value);
|
|
31012
|
-
} catch (e) {
|
|
31013
|
-
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31014
|
-
throw new Error(message);
|
|
31015
|
-
}
|
|
31016
|
-
}
|
|
31017
|
-
function safeAssertShape(value, yupSchema) {
|
|
31018
|
-
try {
|
|
31019
|
-
assertShape(value, yupSchema);
|
|
31020
|
-
return true;
|
|
31021
|
-
} catch (e) {
|
|
31022
|
-
return false;
|
|
31023
|
-
}
|
|
31024
|
-
}
|
|
31025
31067
|
class TinaAdminApi {
|
|
31026
31068
|
constructor(cms) {
|
|
31027
31069
|
var _a, _b, _c, _d;
|
|
@@ -31368,6 +31410,56 @@ mutation addPendingDocumentMutation(
|
|
|
31368
31410
|
);
|
|
31369
31411
|
}
|
|
31370
31412
|
}
|
|
31413
|
+
const createClient = ({
|
|
31414
|
+
clientId,
|
|
31415
|
+
isLocalClient = true,
|
|
31416
|
+
branch,
|
|
31417
|
+
tinaioConfig,
|
|
31418
|
+
schema,
|
|
31419
|
+
apiUrl,
|
|
31420
|
+
tinaGraphQLVersion
|
|
31421
|
+
}) => {
|
|
31422
|
+
return isLocalClient ? new LocalClient({ customContentApiUrl: apiUrl, schema }) : new Client({
|
|
31423
|
+
clientId: clientId || "",
|
|
31424
|
+
branch: branch || "main",
|
|
31425
|
+
tokenStorage: "LOCAL_STORAGE",
|
|
31426
|
+
tinaioConfig,
|
|
31427
|
+
schema,
|
|
31428
|
+
tinaGraphQLVersion
|
|
31429
|
+
});
|
|
31430
|
+
};
|
|
31431
|
+
function assertShape(value, yupSchema, errorMessage) {
|
|
31432
|
+
const shape = yupSchema(yup__namespace);
|
|
31433
|
+
try {
|
|
31434
|
+
shape.validateSync(value);
|
|
31435
|
+
} catch (e) {
|
|
31436
|
+
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
31437
|
+
throw new Error(message);
|
|
31438
|
+
}
|
|
31439
|
+
}
|
|
31440
|
+
function safeAssertShape(value, yupSchema) {
|
|
31441
|
+
try {
|
|
31442
|
+
assertShape(value, yupSchema);
|
|
31443
|
+
return true;
|
|
31444
|
+
} catch (e) {
|
|
31445
|
+
return false;
|
|
31446
|
+
}
|
|
31447
|
+
}
|
|
31448
|
+
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
31449
|
+
const useTinaAuthRedirect = () => {
|
|
31450
|
+
React.useEffect(() => {
|
|
31451
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
31452
|
+
const config = {
|
|
31453
|
+
code: urlParams.get("code") || "",
|
|
31454
|
+
scope: urlParams.get("scope") || "email",
|
|
31455
|
+
state: urlParams.get("state")
|
|
31456
|
+
};
|
|
31457
|
+
if (!config.code) {
|
|
31458
|
+
return;
|
|
31459
|
+
}
|
|
31460
|
+
localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
|
|
31461
|
+
}, []);
|
|
31462
|
+
};
|
|
31371
31463
|
function sleep(ms) {
|
|
31372
31464
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31373
31465
|
}
|
|
@@ -31704,6 +31796,9 @@ mutation addPendingDocumentMutation(
|
|
|
31704
31796
|
cms.flags.set("branch-switcher", true);
|
|
31705
31797
|
client.usingEditorialWorkflow = true;
|
|
31706
31798
|
client.protectedBranches = project.protectedBranches;
|
|
31799
|
+
if (!project.metadata[currentBranch]) {
|
|
31800
|
+
setCurrentBranch(project.defaultBranch || "main");
|
|
31801
|
+
}
|
|
31707
31802
|
}
|
|
31708
31803
|
});
|
|
31709
31804
|
};
|
|
@@ -31716,7 +31811,7 @@ mutation addPendingDocumentMutation(
|
|
|
31716
31811
|
}
|
|
31717
31812
|
});
|
|
31718
31813
|
return unsubscribe;
|
|
31719
|
-
}, [isTinaCloud, cms]);
|
|
31814
|
+
}, [currentBranch, isTinaCloud, cms]);
|
|
31720
31815
|
return /* @__PURE__ */ React.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React.createElement(
|
|
31721
31816
|
BranchDataProvider,
|
|
31722
31817
|
{
|
|
@@ -32569,6 +32664,35 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32569
32664
|
}) => {
|
|
32570
32665
|
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React.createElement(Button$1, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
|
|
32571
32666
|
};
|
|
32667
|
+
const isValidSortKey = (sortKey, collection) => {
|
|
32668
|
+
if (collection.fields) {
|
|
32669
|
+
const sortKeys = collection.fields.map((x) => x.name);
|
|
32670
|
+
return sortKeys.includes(sortKey);
|
|
32671
|
+
} else if (collection.templates) {
|
|
32672
|
+
const collectionMap = {};
|
|
32673
|
+
const conflictedFields = /* @__PURE__ */ new Set();
|
|
32674
|
+
for (const template of collection.templates) {
|
|
32675
|
+
for (const field of template.fields) {
|
|
32676
|
+
if (collectionMap[field.name]) {
|
|
32677
|
+
if (collectionMap[field.name].type !== field.type) {
|
|
32678
|
+
conflictedFields.add(field.name);
|
|
32679
|
+
}
|
|
32680
|
+
} else {
|
|
32681
|
+
collectionMap[field.name] = field;
|
|
32682
|
+
}
|
|
32683
|
+
}
|
|
32684
|
+
}
|
|
32685
|
+
for (const key in conflictedFields) {
|
|
32686
|
+
delete collectionMap[key];
|
|
32687
|
+
}
|
|
32688
|
+
for (const key in collectionMap) {
|
|
32689
|
+
if (key === sortKey) {
|
|
32690
|
+
return true;
|
|
32691
|
+
}
|
|
32692
|
+
}
|
|
32693
|
+
return false;
|
|
32694
|
+
}
|
|
32695
|
+
};
|
|
32572
32696
|
const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
|
|
32573
32697
|
const api = new TinaAdminApi(cms);
|
|
32574
32698
|
const schema = cms.api.tina.schema;
|
|
@@ -32580,10 +32704,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32580
32704
|
React.useEffect(() => {
|
|
32581
32705
|
let cancelled = false;
|
|
32582
32706
|
const fetchCollection = async () => {
|
|
32583
|
-
var _a;
|
|
32584
32707
|
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
32585
32708
|
const { name, order } = JSON.parse(sortKey || "{}");
|
|
32586
|
-
const validSortKey = (
|
|
32709
|
+
const validSortKey = isValidSortKey(name, collectionExtra) ? name : void 0;
|
|
32587
32710
|
try {
|
|
32588
32711
|
const collection2 = await api.fetchCollection(
|
|
32589
32712
|
collectionName,
|
|
@@ -33035,7 +33158,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33035
33158
|
safeSubmit: async () => {
|
|
33036
33159
|
try {
|
|
33037
33160
|
await admin.deleteDocument(vars);
|
|
33038
|
-
cms.alerts.info(
|
|
33161
|
+
cms.alerts.info(
|
|
33162
|
+
"Document was successfully deleted"
|
|
33163
|
+
);
|
|
33039
33164
|
reFetchCollection();
|
|
33040
33165
|
} catch (error) {
|
|
33041
33166
|
cms.alerts.warn(
|
|
@@ -33064,7 +33189,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33064
33189
|
relativePath: vars.relativePath,
|
|
33065
33190
|
newRelativePath
|
|
33066
33191
|
});
|
|
33067
|
-
cms.alerts.info(
|
|
33192
|
+
cms.alerts.info(
|
|
33193
|
+
"Document was successfully renamed"
|
|
33194
|
+
);
|
|
33068
33195
|
reFetchCollection();
|
|
33069
33196
|
} catch (error) {
|
|
33070
33197
|
if (error.message.indexOf("has references")) {
|
|
@@ -33164,7 +33291,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33164
33291
|
name: "sort",
|
|
33165
33292
|
value: sortKey,
|
|
33166
33293
|
onChange: (e) => {
|
|
33167
|
-
const val = JSON.parse(
|
|
33294
|
+
const val = JSON.parse(
|
|
33295
|
+
e.target.value
|
|
33296
|
+
);
|
|
33168
33297
|
setEndCursor("");
|
|
33169
33298
|
setPrevCursors([]);
|
|
33170
33299
|
window == null ? void 0 : window.localStorage.setItem(
|
|
@@ -33953,7 +34082,10 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33953
34082
|
const fetchDocument = async () => {
|
|
33954
34083
|
if (api.isAuthenticated()) {
|
|
33955
34084
|
try {
|
|
33956
|
-
const response = await api.fetchDocument(
|
|
34085
|
+
const response = await api.fetchDocument(
|
|
34086
|
+
collectionName,
|
|
34087
|
+
relativePath2
|
|
34088
|
+
);
|
|
33957
34089
|
setDocument(response.document);
|
|
33958
34090
|
} catch (error2) {
|
|
33959
34091
|
cms.alerts.error(
|