tinacms 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2015 -2035
- package/dist/react.js +94 -0
- package/dist/toolkit/components/active-field-indicator.d.ts +1 -0
- package/dist/toolkit/fields/components/password-field.d.ts +1 -1
- package/dist/toolkit/fields/components/select.d.ts +1 -1
- package/dist/toolkit/fields/components/text-field.d.ts +1 -1
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +6 -2
- package/dist/toolkit/form-builder/fields-builder.d.ts +2 -1
- package/dist/toolkit/form-builder/form-builder.d.ts +1 -0
- package/dist/toolkit/forms/field.d.ts +3 -2
- package/dist/toolkit/tina-state.d.ts +42 -16
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -9,6 +9,9 @@ import { z } from "zod";
|
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import React__default, { useState, useCallback, useContext, createContext, forwardRef, useRef, useReducer, useMemo, useEffect, useLayoutEffect, Component, memo as memo$1, useDebugValue, useId, startTransition, useImperativeHandle } from "react";
|
|
11
11
|
import ReactDOM, { createPortal } from "react-dom";
|
|
12
|
+
import { createForm, FORM_ERROR, getIn } from "final-form";
|
|
13
|
+
import arrayMutators from "final-form-arrays";
|
|
14
|
+
import setFieldData from "final-form-set-field-data";
|
|
12
15
|
import { withRef as withRef$1, cn as cn$2, withCn, createPrimitiveElement, withVariants, withProps, useComposedRef as useComposedRef$1, PortalBody } from "@udecode/cn";
|
|
13
16
|
import { HEADING_KEYS as HEADING_KEYS$1, HEADING_LEVELS as HEADING_LEVELS$1 } from "@udecode/plate-heading";
|
|
14
17
|
import { isHotkey } from "is-hotkey";
|
|
@@ -22,7 +25,7 @@ import { Command as Command$2 } from "cmdk";
|
|
|
22
25
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
23
26
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
24
27
|
import { PopoverAnchor } from "@radix-ui/react-popover";
|
|
25
|
-
import { createSlatePlugin as createSlatePlugin$1, someHtmlElement, findHtmlParentElement, createTSlatePlugin as createTSlatePlugin$1, RangeApi as RangeApi$1, TextApi as TextApi$1, HtmlPlugin as HtmlPlugin$1, NodeApi as NodeApi$1, ElementApi as ElementApi$1, Hotkeys, isHotkey as isHotkey$1, isUrl as isUrl$1, getEditorPlugin as getEditorPlugin$1, bindFirst as bindFirst$1, sanitizeUrl, PathApi as PathApi$1, isDefined as isDefined$1, PointApi as PointApi$1, BaseParagraphPlugin as BaseParagraphPlugin$1, match as match$
|
|
28
|
+
import { createSlatePlugin as createSlatePlugin$1, someHtmlElement, findHtmlParentElement, createTSlatePlugin as createTSlatePlugin$1, RangeApi as RangeApi$1, TextApi as TextApi$1, HtmlPlugin as HtmlPlugin$1, NodeApi as NodeApi$1, ElementApi as ElementApi$1, Hotkeys, isHotkey as isHotkey$1, isUrl as isUrl$1, getEditorPlugin as getEditorPlugin$1, bindFirst as bindFirst$1, sanitizeUrl, PathApi as PathApi$1, isDefined as isDefined$1, PointApi as PointApi$1, BaseParagraphPlugin as BaseParagraphPlugin$1, match as match$2, deleteMerge, getPluginTypes, queryNode as queryNode$1, isType, getInjectMatch as getInjectMatch$1, traverseHtmlElements, isHtmlBlockElement as isHtmlBlockElement$1, postCleanHtml, mergeProps } from "@udecode/plate";
|
|
26
29
|
import { useComboboxContext, Combobox as Combobox$1, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
|
|
27
30
|
import { withTriggerCombobox, filterWords } from "@udecode/plate-combobox";
|
|
28
31
|
import { BaseResetNodePlugin as BaseResetNodePlugin$1 } from "@udecode/plate-reset-node";
|
|
@@ -34,9 +37,6 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
|
34
37
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
35
38
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
36
39
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
37
|
-
import { createForm, FORM_ERROR, getIn } from "final-form";
|
|
38
|
-
import arrayMutators from "final-form-arrays";
|
|
39
|
-
import setFieldData from "final-form-set-field-data";
|
|
40
40
|
import { Field, Form as Form$1 } from "react-final-form";
|
|
41
41
|
import PropTypes from "prop-types";
|
|
42
42
|
import { twMerge } from "tailwind-merge";
|
|
@@ -61,7 +61,7 @@ import moment from "moment";
|
|
|
61
61
|
import "moment-timezone";
|
|
62
62
|
import { DayPicker } from "react-day-picker";
|
|
63
63
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
64
|
-
import { formatDistanceToNow
|
|
64
|
+
import { formatDistanceToNow } from "date-fns";
|
|
65
65
|
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, canonicalPath, validateSchema } from "@tinacms/schema-tools";
|
|
66
66
|
import { NAMER, resolveField } from "@tinacms/schema-tools";
|
|
67
67
|
import gql from "graphql-tag";
|
|
@@ -869,811 +869,1388 @@ function useEvent(eventType) {
|
|
|
869
869
|
subscribe: (callback) => cms.events.subscribe(eventType, callback)
|
|
870
870
|
};
|
|
871
871
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
);
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
}) => {
|
|
931
|
-
const { dispatch: setHoveredField } = useEvent("field:hover");
|
|
932
|
-
const { dispatch: setFocusedField } = useEvent("field:focus");
|
|
933
|
-
return /* @__PURE__ */ React.createElement(
|
|
934
|
-
FieldWrapper,
|
|
935
|
-
{
|
|
936
|
-
margin,
|
|
937
|
-
onMouseOver: () => setHoveredField({ id: tinaForm.id, fieldName: name }),
|
|
938
|
-
onMouseOut: () => setHoveredField({ id: null, fieldName: null }),
|
|
939
|
-
onClick: () => setFocusedField({ id: tinaForm.id, fieldName: name }),
|
|
940
|
-
style: { zIndex: index ? 1e3 - index : void 0 },
|
|
941
|
-
...props
|
|
942
|
-
},
|
|
943
|
-
(label !== false || description) && /* @__PURE__ */ React.createElement(FieldLabel, { name }, label !== false && /* @__PURE__ */ React.createElement(React.Fragment, null, label || name), description && /* @__PURE__ */ React.createElement(FieldDescription, null, description)),
|
|
944
|
-
children,
|
|
945
|
-
error2 && typeof error2 === "string" && /* @__PURE__ */ React.createElement(FieldError, null, error2)
|
|
946
|
-
);
|
|
947
|
-
};
|
|
948
|
-
const FieldWrapper = ({
|
|
949
|
-
margin,
|
|
950
|
-
children,
|
|
951
|
-
...props
|
|
952
|
-
}) => {
|
|
953
|
-
return /* @__PURE__ */ React.createElement("div", { className: `relative ${margin ? `mb-5 last:mb-0` : ``}`, ...props }, children);
|
|
954
|
-
};
|
|
955
|
-
const FieldLabel = ({
|
|
956
|
-
children,
|
|
957
|
-
className,
|
|
958
|
-
name,
|
|
959
|
-
...props
|
|
960
|
-
}) => {
|
|
961
|
-
return /* @__PURE__ */ React.createElement(
|
|
962
|
-
"label",
|
|
963
|
-
{
|
|
964
|
-
htmlFor: name,
|
|
965
|
-
className: `block font-sans text-xs font-semibold text-gray-700 whitespace-normal mb-2 ${className}`,
|
|
966
|
-
...props
|
|
967
|
-
},
|
|
968
|
-
children
|
|
969
|
-
);
|
|
970
|
-
};
|
|
971
|
-
const FieldDescription = ({
|
|
972
|
-
children,
|
|
973
|
-
className,
|
|
974
|
-
...props
|
|
975
|
-
}) => {
|
|
976
|
-
if (typeof children === "string") {
|
|
977
|
-
return /* @__PURE__ */ React.createElement(
|
|
978
|
-
"span",
|
|
979
|
-
{
|
|
980
|
-
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
981
|
-
...props,
|
|
982
|
-
dangerouslySetInnerHTML: { __html: children }
|
|
872
|
+
class Form {
|
|
873
|
+
constructor({
|
|
874
|
+
id: id2,
|
|
875
|
+
label,
|
|
876
|
+
fields,
|
|
877
|
+
actions,
|
|
878
|
+
buttons,
|
|
879
|
+
global: global2,
|
|
880
|
+
reset: reset2,
|
|
881
|
+
loadInitialValues,
|
|
882
|
+
onChange,
|
|
883
|
+
queries,
|
|
884
|
+
...options
|
|
885
|
+
}) {
|
|
886
|
+
__publicField(this, "__type");
|
|
887
|
+
__publicField(this, "id");
|
|
888
|
+
__publicField(this, "label");
|
|
889
|
+
__publicField(this, "fields");
|
|
890
|
+
__publicField(this, "finalForm");
|
|
891
|
+
__publicField(this, "actions");
|
|
892
|
+
__publicField(this, "buttons");
|
|
893
|
+
__publicField(this, "queries");
|
|
894
|
+
__publicField(this, "global", null);
|
|
895
|
+
__publicField(this, "loading", false);
|
|
896
|
+
/**
|
|
897
|
+
* @deprecated
|
|
898
|
+
* Misleading name as per https://github.com/tinacms/tinacms/issues/5686#issuecomment-2899840518
|
|
899
|
+
* Use path property instead.
|
|
900
|
+
*/
|
|
901
|
+
__publicField(this, "relativePath");
|
|
902
|
+
/**
|
|
903
|
+
* Where to save the form within the content directory on next submission.
|
|
904
|
+
*/
|
|
905
|
+
__publicField(this, "path");
|
|
906
|
+
__publicField(this, "crudType");
|
|
907
|
+
__publicField(this, "beforeSubmit");
|
|
908
|
+
/**
|
|
909
|
+
* Subscribes to changes to the form. The subscriber will only be called when
|
|
910
|
+
* values specified in subscription change. A form can have many subscribers.
|
|
911
|
+
*/
|
|
912
|
+
__publicField(this, "subscribe", (cb, options) => {
|
|
913
|
+
return this.finalForm.subscribe(cb, options);
|
|
914
|
+
});
|
|
915
|
+
__publicField(this, "onSubmit");
|
|
916
|
+
__publicField(this, "handleSubmit", async (values, form, cb) => {
|
|
917
|
+
var _a2;
|
|
918
|
+
try {
|
|
919
|
+
const valOverride = await ((_a2 = this.beforeSubmit) == null ? void 0 : _a2.call(this, values));
|
|
920
|
+
if (valOverride) {
|
|
921
|
+
for (const [key, value] of Object.entries(valOverride)) {
|
|
922
|
+
form.change(key, value);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
const response = await this.onSubmit(valOverride || values, form, cb);
|
|
926
|
+
form.initialize(values);
|
|
927
|
+
return response;
|
|
928
|
+
} catch (error2) {
|
|
929
|
+
return { [FORM_ERROR]: error2 };
|
|
983
930
|
}
|
|
984
|
-
);
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
"
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
function isObject$e(value) {
|
|
1043
|
-
var type = typeof value;
|
|
1044
|
-
return value != null && (type == "object" || type == "function");
|
|
1045
|
-
}
|
|
1046
|
-
var isObject_1 = isObject$e;
|
|
1047
|
-
var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
1048
|
-
var _freeGlobal = freeGlobal$1;
|
|
1049
|
-
var freeGlobal = _freeGlobal;
|
|
1050
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
1051
|
-
var root$9 = freeGlobal || freeSelf || Function("return this")();
|
|
1052
|
-
var _root = root$9;
|
|
1053
|
-
var root$8 = _root;
|
|
1054
|
-
var now$1 = function() {
|
|
1055
|
-
return root$8.Date.now();
|
|
1056
|
-
};
|
|
1057
|
-
var now_1 = now$1;
|
|
1058
|
-
var reWhitespace = /\s/;
|
|
1059
|
-
function trimmedEndIndex$1(string3) {
|
|
1060
|
-
var index = string3.length;
|
|
1061
|
-
while (index-- && reWhitespace.test(string3.charAt(index))) {
|
|
931
|
+
});
|
|
932
|
+
/**
|
|
933
|
+
* Submits the form if there are currently no validation errors. It may
|
|
934
|
+
* return undefined or a Promise depending on the nature of the onSubmit
|
|
935
|
+
* configuration value given to the form when it was created.
|
|
936
|
+
*/
|
|
937
|
+
__publicField(this, "submit", () => {
|
|
938
|
+
return this.finalForm.submit();
|
|
939
|
+
});
|
|
940
|
+
const initialValues = options.initialValues || {};
|
|
941
|
+
this.__type = options.__type || "form";
|
|
942
|
+
this.id = id2;
|
|
943
|
+
this.label = label;
|
|
944
|
+
this.global = global2;
|
|
945
|
+
this.fields = fields || [];
|
|
946
|
+
this.onSubmit = options.onSubmit;
|
|
947
|
+
this.queries = queries || [];
|
|
948
|
+
this.crudType = options.crudType || "update";
|
|
949
|
+
this.relativePath = options.relativePath || id2;
|
|
950
|
+
this.path = options.path || id2;
|
|
951
|
+
this.finalForm = createForm({
|
|
952
|
+
...options,
|
|
953
|
+
initialValues,
|
|
954
|
+
onSubmit: this.handleSubmit,
|
|
955
|
+
mutators: {
|
|
956
|
+
...arrayMutators,
|
|
957
|
+
setFieldData,
|
|
958
|
+
...options.mutators
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
this._reset = reset2;
|
|
962
|
+
this.actions = actions || [];
|
|
963
|
+
this.buttons = buttons || {
|
|
964
|
+
save: "Save",
|
|
965
|
+
reset: "Reset"
|
|
966
|
+
};
|
|
967
|
+
this.updateFields(this.fields);
|
|
968
|
+
if (loadInitialValues) {
|
|
969
|
+
this.loading = true;
|
|
970
|
+
loadInitialValues().then((initialValues2) => {
|
|
971
|
+
this.updateInitialValues(initialValues2);
|
|
972
|
+
}).finally(() => {
|
|
973
|
+
this.loading = false;
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
if (onChange) {
|
|
977
|
+
let firstUpdate = true;
|
|
978
|
+
this.subscribe(
|
|
979
|
+
(formState) => {
|
|
980
|
+
if (firstUpdate) {
|
|
981
|
+
firstUpdate = false;
|
|
982
|
+
} else {
|
|
983
|
+
onChange(formState);
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
{ values: true, ...(options == null ? void 0 : options.extraSubscribeValues) || {} }
|
|
987
|
+
);
|
|
988
|
+
}
|
|
1062
989
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
}
|
|
1071
|
-
var _baseTrim = baseTrim$1;
|
|
1072
|
-
var root$7 = _root;
|
|
1073
|
-
var Symbol$7 = root$7.Symbol;
|
|
1074
|
-
var _Symbol = Symbol$7;
|
|
1075
|
-
var Symbol$6 = _Symbol;
|
|
1076
|
-
var objectProto$f = Object.prototype;
|
|
1077
|
-
var hasOwnProperty$c = objectProto$f.hasOwnProperty;
|
|
1078
|
-
var nativeObjectToString$1 = objectProto$f.toString;
|
|
1079
|
-
var symToStringTag$1 = Symbol$6 ? Symbol$6.toStringTag : void 0;
|
|
1080
|
-
function getRawTag$1(value) {
|
|
1081
|
-
var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
1082
|
-
try {
|
|
1083
|
-
value[symToStringTag$1] = void 0;
|
|
1084
|
-
var unmasked = true;
|
|
1085
|
-
} catch (e3) {
|
|
990
|
+
/**
|
|
991
|
+
* A unique identifier for Forms.
|
|
992
|
+
*
|
|
993
|
+
* @deprecated use id instead
|
|
994
|
+
*/
|
|
995
|
+
get name() {
|
|
996
|
+
return void 0;
|
|
1086
997
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
998
|
+
/**
|
|
999
|
+
* Returns the current values of the form.
|
|
1000
|
+
*
|
|
1001
|
+
* if the form is still loading it returns `undefined`.
|
|
1002
|
+
*/
|
|
1003
|
+
get values() {
|
|
1004
|
+
if (this.loading) {
|
|
1005
|
+
return void 0;
|
|
1093
1006
|
}
|
|
1007
|
+
return this.finalForm.getState().values || this.initialValues;
|
|
1094
1008
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
function objectToString$1(value) {
|
|
1101
|
-
return nativeObjectToString.call(value);
|
|
1102
|
-
}
|
|
1103
|
-
var _objectToString = objectToString$1;
|
|
1104
|
-
var Symbol$5 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
|
|
1105
|
-
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
1106
|
-
var symToStringTag = Symbol$5 ? Symbol$5.toStringTag : void 0;
|
|
1107
|
-
function baseGetTag$6(value) {
|
|
1108
|
-
if (value == null) {
|
|
1109
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
1110
|
-
}
|
|
1111
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
1112
|
-
}
|
|
1113
|
-
var _baseGetTag = baseGetTag$6;
|
|
1114
|
-
function isObjectLike$9(value) {
|
|
1115
|
-
return value != null && typeof value == "object";
|
|
1116
|
-
}
|
|
1117
|
-
var isObjectLike_1 = isObjectLike$9;
|
|
1118
|
-
var baseGetTag$5 = _baseGetTag, isObjectLike$8 = isObjectLike_1;
|
|
1119
|
-
var symbolTag$3 = "[object Symbol]";
|
|
1120
|
-
function isSymbol$4(value) {
|
|
1121
|
-
return typeof value == "symbol" || isObjectLike$8(value) && baseGetTag$5(value) == symbolTag$3;
|
|
1122
|
-
}
|
|
1123
|
-
var isSymbol_1 = isSymbol$4;
|
|
1124
|
-
var baseTrim = _baseTrim, isObject$d = isObject_1, isSymbol$3 = isSymbol_1;
|
|
1125
|
-
var NAN = 0 / 0;
|
|
1126
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
1127
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
1128
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
1129
|
-
var freeParseInt = parseInt;
|
|
1130
|
-
function toNumber$1(value) {
|
|
1131
|
-
if (typeof value == "number") {
|
|
1132
|
-
return value;
|
|
1009
|
+
/**
|
|
1010
|
+
* The values the form was initialized with.
|
|
1011
|
+
*/
|
|
1012
|
+
get initialValues() {
|
|
1013
|
+
return this.finalForm.getState().initialValues;
|
|
1133
1014
|
}
|
|
1134
|
-
|
|
1135
|
-
return
|
|
1015
|
+
get pristine() {
|
|
1016
|
+
return this.finalForm.getState().pristine;
|
|
1136
1017
|
}
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
value = isObject$d(other) ? other + "" : other;
|
|
1018
|
+
get dirty() {
|
|
1019
|
+
return this.finalForm.getState().dirty;
|
|
1140
1020
|
}
|
|
1141
|
-
|
|
1142
|
-
return
|
|
1021
|
+
get submitting() {
|
|
1022
|
+
return this.finalForm.getState().submitting;
|
|
1143
1023
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
1147
|
-
}
|
|
1148
|
-
var toNumber_1 = toNumber$1;
|
|
1149
|
-
var isObject$c = isObject_1, now = now_1, toNumber = toNumber_1;
|
|
1150
|
-
var FUNC_ERROR_TEXT$3 = "Expected a function";
|
|
1151
|
-
var nativeMax$1 = Math.max, nativeMin = Math.min;
|
|
1152
|
-
function debounce$1(func, wait, options) {
|
|
1153
|
-
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
1154
|
-
if (typeof func != "function") {
|
|
1155
|
-
throw new TypeError(FUNC_ERROR_TEXT$3);
|
|
1024
|
+
get valid() {
|
|
1025
|
+
return this.finalForm.getState().valid;
|
|
1156
1026
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1027
|
+
/**
|
|
1028
|
+
* Resets the values back to the initial values the form was initialized with.
|
|
1029
|
+
* Or empties all the values if the form was not initialized.
|
|
1030
|
+
*/
|
|
1031
|
+
async reset() {
|
|
1032
|
+
if (this._reset) {
|
|
1033
|
+
await this._reset();
|
|
1034
|
+
}
|
|
1035
|
+
this.finalForm.reset();
|
|
1163
1036
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
return result;
|
|
1037
|
+
/**
|
|
1038
|
+
* @deprecated Unnecessary indirection
|
|
1039
|
+
*/
|
|
1040
|
+
updateFields(fields) {
|
|
1041
|
+
this.fields = fields;
|
|
1170
1042
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1043
|
+
/**
|
|
1044
|
+
* Changes the value of the given field.
|
|
1045
|
+
*
|
|
1046
|
+
* @param name
|
|
1047
|
+
* @param value
|
|
1048
|
+
*/
|
|
1049
|
+
change(name, value) {
|
|
1050
|
+
return this.finalForm.change(name, value);
|
|
1175
1051
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
1052
|
+
get mutators() {
|
|
1053
|
+
return this.finalForm.mutators;
|
|
1179
1054
|
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
1055
|
+
addQuery(queryId) {
|
|
1056
|
+
this.queries = [...this.queries.filter((id2) => id2 !== queryId), queryId];
|
|
1183
1057
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
if (shouldInvoke(time2)) {
|
|
1187
|
-
return trailingEdge(time2);
|
|
1188
|
-
}
|
|
1189
|
-
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
1058
|
+
removeQuery(queryId) {
|
|
1059
|
+
this.queries = this.queries.filter((id2) => id2 !== queryId);
|
|
1190
1060
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1061
|
+
/**
|
|
1062
|
+
* Updates multiple fields in the form.
|
|
1063
|
+
*
|
|
1064
|
+
* The updates are batched so that it only triggers one `onChange` event.
|
|
1065
|
+
*
|
|
1066
|
+
* In order to prevent disruptions to the user's editing experience this
|
|
1067
|
+
* function will _not_ update the value of any field that is currently
|
|
1068
|
+
* being edited.
|
|
1069
|
+
*
|
|
1070
|
+
* @param values
|
|
1071
|
+
*/
|
|
1072
|
+
updateValues(values) {
|
|
1073
|
+
this.finalForm.batch(() => {
|
|
1074
|
+
const activePath = this.finalForm.getState().active;
|
|
1075
|
+
if (!activePath) {
|
|
1076
|
+
updateEverything(this.finalForm, values);
|
|
1077
|
+
} else {
|
|
1078
|
+
updateSelectively(this.finalForm, values);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1198
1081
|
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
if (timerId === void 0) {
|
|
1216
|
-
return leadingEdge(lastCallTime);
|
|
1217
|
-
}
|
|
1218
|
-
if (maxing) {
|
|
1219
|
-
clearTimeout(timerId);
|
|
1220
|
-
timerId = setTimeout(timerExpired, wait);
|
|
1221
|
-
return invokeFunc(lastCallTime);
|
|
1082
|
+
/**
|
|
1083
|
+
* Replaces the initialValues of the form without deleting the current values.
|
|
1084
|
+
*
|
|
1085
|
+
* This function is helpful when the initialValues are loaded asynchronously.
|
|
1086
|
+
*
|
|
1087
|
+
* @param initialValues
|
|
1088
|
+
*/
|
|
1089
|
+
updateInitialValues(initialValues) {
|
|
1090
|
+
this.finalForm.batch(() => {
|
|
1091
|
+
const values = this.values || {};
|
|
1092
|
+
this.finalForm.initialize(initialValues);
|
|
1093
|
+
const activePath = this.finalForm.getState().active;
|
|
1094
|
+
if (!activePath) {
|
|
1095
|
+
updateEverything(this.finalForm, values);
|
|
1096
|
+
} else {
|
|
1097
|
+
updateSelectively(this.finalForm, values);
|
|
1222
1098
|
}
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Based on field's name this function will
|
|
1103
|
+
* return an array of fields for the give form along
|
|
1104
|
+
* with the path that it was found at top nearest
|
|
1105
|
+
* object-like group
|
|
1106
|
+
*
|
|
1107
|
+
* So if you have a field named blocks.3.title
|
|
1108
|
+
* It will return the fields from the 3rd "block"
|
|
1109
|
+
* along with the path it was found at
|
|
1110
|
+
* fields: [{type: 'string', name: 'title'}, ... other fields]
|
|
1111
|
+
* activePath: ['blocks', '3']
|
|
1112
|
+
*/
|
|
1113
|
+
getActiveField(fieldName) {
|
|
1114
|
+
if (!fieldName) {
|
|
1115
|
+
return this;
|
|
1223
1116
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1117
|
+
const result = this.getFieldGroup({
|
|
1118
|
+
formOrObjectField: this,
|
|
1119
|
+
values: this.finalForm.getState().values,
|
|
1120
|
+
namePathIndex: 0,
|
|
1121
|
+
namePath: fieldName.split(".")
|
|
1122
|
+
});
|
|
1227
1123
|
return result;
|
|
1228
1124
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1125
|
+
getFieldGroup({
|
|
1126
|
+
formOrObjectField,
|
|
1127
|
+
values = {},
|
|
1128
|
+
namePathIndex,
|
|
1129
|
+
namePath
|
|
1130
|
+
}) {
|
|
1131
|
+
const name = namePath[namePathIndex];
|
|
1132
|
+
const field = formOrObjectField.fields.find((field2) => field2.name === name);
|
|
1133
|
+
const value = values[name];
|
|
1134
|
+
const isLastItem = namePathIndex === namePath.length - 1;
|
|
1135
|
+
if (!field) {
|
|
1136
|
+
return {
|
|
1137
|
+
...formOrObjectField,
|
|
1138
|
+
fields: formOrObjectField.fields.map((field2) => {
|
|
1139
|
+
return {
|
|
1140
|
+
...field2,
|
|
1141
|
+
name: [...namePath, field2.name].join(".")
|
|
1142
|
+
};
|
|
1143
|
+
})
|
|
1144
|
+
};
|
|
1145
|
+
} else {
|
|
1146
|
+
if (field.type === "object") {
|
|
1147
|
+
if (field.templates) {
|
|
1148
|
+
if (field.list) {
|
|
1149
|
+
if (isLastItem) {
|
|
1150
|
+
return formOrObjectField;
|
|
1151
|
+
} else {
|
|
1152
|
+
const namePathIndexForListItem = namePathIndex + 1;
|
|
1153
|
+
const index = namePath[namePathIndexForListItem];
|
|
1154
|
+
const listItemValue = value[index];
|
|
1155
|
+
const template = field.templates[listItemValue._template];
|
|
1156
|
+
const templateName = [
|
|
1157
|
+
...namePath.slice(0, namePathIndexForListItem),
|
|
1158
|
+
index
|
|
1159
|
+
].join(".");
|
|
1160
|
+
const isLastItem2 = namePathIndexForListItem === namePath.length - 1;
|
|
1161
|
+
if (!isLastItem2) {
|
|
1162
|
+
return this.getFieldGroup({
|
|
1163
|
+
formOrObjectField: template,
|
|
1164
|
+
values: listItemValue,
|
|
1165
|
+
namePath,
|
|
1166
|
+
namePathIndex: namePathIndex + 2
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
if (!template) {
|
|
1170
|
+
console.error({ field, value });
|
|
1171
|
+
throw new Error(
|
|
1172
|
+
`Expected template value for field ${field.name}`
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
return {
|
|
1176
|
+
...template,
|
|
1177
|
+
name: templateName,
|
|
1178
|
+
fields: template.fields.map((field2) => {
|
|
1179
|
+
return {
|
|
1180
|
+
...field2,
|
|
1181
|
+
name: [templateName, field2.name].join(".")
|
|
1182
|
+
};
|
|
1183
|
+
})
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
} else {
|
|
1188
|
+
if (field.list) {
|
|
1189
|
+
const namePathIndexForListItem = namePathIndex + 1;
|
|
1190
|
+
const index = namePath[namePathIndexForListItem];
|
|
1191
|
+
const listItemValue = value[index];
|
|
1192
|
+
const fieldName = [
|
|
1193
|
+
...namePath.slice(0, namePathIndexForListItem),
|
|
1194
|
+
index
|
|
1195
|
+
].join(".");
|
|
1196
|
+
const isLastItem2 = namePathIndexForListItem === namePath.length - 1;
|
|
1197
|
+
if (!isLastItem2) {
|
|
1198
|
+
if (field.fields) {
|
|
1199
|
+
return this.getFieldGroup({
|
|
1200
|
+
formOrObjectField: field,
|
|
1201
|
+
values: listItemValue,
|
|
1202
|
+
namePath,
|
|
1203
|
+
namePathIndex: namePathIndex + 2
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
return {
|
|
1208
|
+
...field,
|
|
1209
|
+
name: fieldName,
|
|
1210
|
+
fields: field.fields.map((field2) => {
|
|
1211
|
+
return {
|
|
1212
|
+
...field2,
|
|
1213
|
+
name: [fieldName, field2.name].join(".")
|
|
1214
|
+
};
|
|
1215
|
+
})
|
|
1216
|
+
};
|
|
1217
|
+
} else {
|
|
1218
|
+
const fieldName = [...namePath.slice(0, namePathIndex + 1)].join(
|
|
1219
|
+
"."
|
|
1220
|
+
);
|
|
1221
|
+
const isLastItem2 = namePathIndex === namePath.length - 1;
|
|
1222
|
+
if (!isLastItem2) {
|
|
1223
|
+
return this.getFieldGroup({
|
|
1224
|
+
formOrObjectField: field,
|
|
1225
|
+
values: value,
|
|
1226
|
+
namePath,
|
|
1227
|
+
namePathIndex: namePathIndex + 1
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
return {
|
|
1231
|
+
...field,
|
|
1232
|
+
name: fieldName,
|
|
1233
|
+
fields: field.fields.map((field2) => {
|
|
1234
|
+
return {
|
|
1235
|
+
...field2,
|
|
1236
|
+
name: [fieldName, field2.name].join(".")
|
|
1237
|
+
};
|
|
1238
|
+
})
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1265
1241
|
}
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1242
|
+
} else if (field.type === "rich-text") {
|
|
1243
|
+
if (isLastItem) {
|
|
1244
|
+
return {
|
|
1245
|
+
...formOrObjectField,
|
|
1246
|
+
fields: formOrObjectField.fields.map((field2) => {
|
|
1247
|
+
return {
|
|
1248
|
+
...field2,
|
|
1249
|
+
name: [...namePath.slice(0, namePathIndex), field2.name].join(
|
|
1250
|
+
"."
|
|
1251
|
+
)
|
|
1252
|
+
};
|
|
1253
|
+
})
|
|
1254
|
+
};
|
|
1255
|
+
} else {
|
|
1256
|
+
const childrenIndex = namePath.findIndex(
|
|
1257
|
+
(value2) => value2 === "children"
|
|
1258
|
+
);
|
|
1259
|
+
const propsIndex = namePath.slice(childrenIndex).findIndex((value2) => value2 === "props") + childrenIndex;
|
|
1260
|
+
const itemName = namePath.slice(childrenIndex, propsIndex).join(".");
|
|
1261
|
+
const item = getIn(value, itemName);
|
|
1262
|
+
const props = item.props;
|
|
1263
|
+
const templateString = item.name;
|
|
1264
|
+
const currentPathIndex = namePathIndex + Math.max(propsIndex, 3);
|
|
1265
|
+
const isLastItem2 = currentPathIndex + 1 === namePath.length;
|
|
1266
|
+
const template = field.templates.find(
|
|
1267
|
+
(t2) => t2.name === templateString
|
|
1268
|
+
);
|
|
1269
|
+
const templateName = namePath.slice(0, currentPathIndex + 2).join(".");
|
|
1270
|
+
if ((item == null ? void 0 : item.type) === "img") {
|
|
1271
|
+
const imageName = namePath.slice(0, currentPathIndex + 2).join(".");
|
|
1272
|
+
return {
|
|
1273
|
+
...formOrObjectField,
|
|
1274
|
+
// name: [formOrObjectField.name, 'img'].join('.'),
|
|
1275
|
+
name: [imageName].join("."),
|
|
1276
|
+
fields: [
|
|
1277
|
+
{
|
|
1278
|
+
type: "image",
|
|
1279
|
+
// label: 'URL',
|
|
1280
|
+
name: [templateName, "url"].join("."),
|
|
1281
|
+
component: "image"
|
|
1282
|
+
},
|
|
1283
|
+
{
|
|
1284
|
+
type: "string",
|
|
1285
|
+
label: "Alt",
|
|
1286
|
+
name: [templateName.replace(/\.props$/, ""), "alt"].join("."),
|
|
1287
|
+
component: "text"
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
type: "string",
|
|
1291
|
+
label: "Caption",
|
|
1292
|
+
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
1293
|
+
"."
|
|
1294
|
+
),
|
|
1295
|
+
component: "text"
|
|
1296
|
+
}
|
|
1297
|
+
]
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
if (!isLastItem2) {
|
|
1301
|
+
return this.getFieldGroup({
|
|
1302
|
+
formOrObjectField: template,
|
|
1303
|
+
values: props,
|
|
1304
|
+
namePath,
|
|
1305
|
+
namePathIndex: namePathIndex + Math.max(4, childrenIndex + propsIndex)
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
if (!template) {
|
|
1309
|
+
throw new Error(`Expected template value for field ${item.name}`);
|
|
1310
|
+
}
|
|
1311
|
+
return {
|
|
1312
|
+
...template,
|
|
1313
|
+
name: templateName,
|
|
1314
|
+
fields: template.fields.map((field2) => {
|
|
1315
|
+
return {
|
|
1316
|
+
...field2,
|
|
1317
|
+
name: [templateName, field2.name].join(".")
|
|
1318
|
+
};
|
|
1319
|
+
})
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
} else {
|
|
1323
|
+
const fieldName = [...namePath.slice(0, namePathIndex)].join(".");
|
|
1324
|
+
if (!fieldName) {
|
|
1325
|
+
return formOrObjectField;
|
|
1326
|
+
}
|
|
1327
|
+
return {
|
|
1328
|
+
...formOrObjectField,
|
|
1329
|
+
name: fieldName,
|
|
1330
|
+
fields: formOrObjectField.fields.map((field2) => {
|
|
1331
|
+
return {
|
|
1332
|
+
...field2,
|
|
1333
|
+
name: [fieldName, field2.name].join(".")
|
|
1334
|
+
};
|
|
1335
|
+
})
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1322
1338
|
}
|
|
1323
|
-
return false;
|
|
1324
|
-
})(e3))
|
|
1325
|
-
return;
|
|
1326
|
-
const n2 = ((t2) => {
|
|
1327
|
-
const o3 = window.getComputedStyle(t2);
|
|
1328
|
-
return { top: parseFloat(o3.scrollMarginTop) || 0, right: parseFloat(o3.scrollMarginRight) || 0, bottom: parseFloat(o3.scrollMarginBottom) || 0, left: parseFloat(o3.scrollMarginLeft) || 0 };
|
|
1329
|
-
})(e3);
|
|
1330
|
-
if (((t2) => "object" == typeof t2 && "function" == typeof t2.behavior)(r2))
|
|
1331
|
-
return r2.behavior(r$3(e3, r2));
|
|
1332
|
-
const l2 = "boolean" == typeof r2 || null == r2 ? void 0 : r2.behavior;
|
|
1333
|
-
for (const { el: a2, top: i2, left: s2 } of r$3(e3, o$2(r2))) {
|
|
1334
|
-
const t2 = i2 - n2.top + n2.bottom, o3 = s2 - n2.left + n2.right;
|
|
1335
|
-
a2.scroll({ top: t2, left: o3, behavior: l2 });
|
|
1336
1339
|
}
|
|
1337
1340
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
* Released under the MIT License.
|
|
1343
|
-
*/
|
|
1344
|
-
function isObject$a(o3) {
|
|
1345
|
-
return Object.prototype.toString.call(o3) === "[object Object]";
|
|
1341
|
+
function updateEverything(form, values) {
|
|
1342
|
+
Object.entries(values).forEach(([path3, value]) => {
|
|
1343
|
+
form.change(path3, value);
|
|
1344
|
+
});
|
|
1346
1345
|
}
|
|
1347
|
-
function
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1346
|
+
function updateSelectively(form, values, prefix) {
|
|
1347
|
+
const activePath = form.getState().active;
|
|
1348
|
+
Object.entries(values).forEach(([name, value]) => {
|
|
1349
|
+
const path3 = prefix ? `${prefix}.${name}` : name;
|
|
1350
|
+
if (typeof value === "object") {
|
|
1351
|
+
if (typeof activePath === "string" && activePath.startsWith(path3)) {
|
|
1352
|
+
updateSelectively(form, value, path3);
|
|
1353
|
+
} else {
|
|
1354
|
+
form.change(path3, value);
|
|
1355
|
+
}
|
|
1356
|
+
} else if (path3 !== activePath) {
|
|
1357
|
+
form.change(path3, value);
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1361
1360
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
},
|
|
1370
|
-
function(thing) {
|
|
1371
|
-
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;
|
|
1372
|
-
},
|
|
1373
|
-
"This object has been frozen and should not be mutated",
|
|
1374
|
-
function(data) {
|
|
1375
|
-
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
1376
|
-
},
|
|
1377
|
-
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
1378
|
-
"Immer forbids circular references",
|
|
1379
|
-
"The first or second argument to `produce` must be a function",
|
|
1380
|
-
"The third argument to `produce` must be a function or undefined",
|
|
1381
|
-
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
1382
|
-
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
1383
|
-
function(thing) {
|
|
1384
|
-
return `'current' expects a draft, got: ${thing}`;
|
|
1385
|
-
},
|
|
1386
|
-
"Object.defineProperty() cannot be used on an Immer draft",
|
|
1387
|
-
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
1388
|
-
"Immer only supports deleting array indices",
|
|
1389
|
-
"Immer only supports setting array indices and the 'length' property",
|
|
1390
|
-
function(thing) {
|
|
1391
|
-
return `'original' expects a draft, got: ${thing}`;
|
|
1392
|
-
}
|
|
1393
|
-
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
1394
|
-
// See Patches.ts for additional errors
|
|
1395
|
-
] : [];
|
|
1396
|
-
function die(error2, ...args) {
|
|
1397
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1398
|
-
const e3 = errors[error2];
|
|
1399
|
-
const msg2 = typeof e3 === "function" ? e3.apply(null, args) : e3;
|
|
1400
|
-
throw new Error(`[Immer] ${msg2}`);
|
|
1361
|
+
function usePlugins(plugins2) {
|
|
1362
|
+
const cms = useCMS$1();
|
|
1363
|
+
let pluginArray;
|
|
1364
|
+
if (Array.isArray(plugins2)) {
|
|
1365
|
+
pluginArray = plugins2;
|
|
1366
|
+
} else {
|
|
1367
|
+
pluginArray = [plugins2];
|
|
1401
1368
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1369
|
+
React.useEffect(() => {
|
|
1370
|
+
pluginArray.forEach((plugin) => {
|
|
1371
|
+
if (plugin) {
|
|
1372
|
+
cms.plugins.add(plugin);
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
return () => {
|
|
1376
|
+
pluginArray.forEach((plugin) => {
|
|
1377
|
+
if (plugin) {
|
|
1378
|
+
cms.plugins.remove(plugin);
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
};
|
|
1382
|
+
}, [cms.plugins, ...pluginArray]);
|
|
1405
1383
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1384
|
+
function useSubscribable(subscribable, cb) {
|
|
1385
|
+
const [, s2] = React.useState(0);
|
|
1386
|
+
React.useEffect(() => {
|
|
1387
|
+
return subscribable.subscribe(() => {
|
|
1388
|
+
s2((x) => x + 1);
|
|
1389
|
+
if (cb)
|
|
1390
|
+
cb();
|
|
1391
|
+
});
|
|
1392
|
+
});
|
|
1409
1393
|
}
|
|
1410
|
-
function
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1394
|
+
function wrapFieldsWithMeta(Field2) {
|
|
1395
|
+
return (props) => {
|
|
1396
|
+
return /* @__PURE__ */ React.createElement(
|
|
1397
|
+
FieldMeta,
|
|
1398
|
+
{
|
|
1399
|
+
name: props.input.name,
|
|
1400
|
+
label: props.field.label,
|
|
1401
|
+
description: props.field.description,
|
|
1402
|
+
error: props.meta.error,
|
|
1403
|
+
index: props.index,
|
|
1404
|
+
tinaForm: props.tinaForm,
|
|
1405
|
+
focusIntent: props.field.focusIntent,
|
|
1406
|
+
hoverIntent: props.field.hoverIntent
|
|
1407
|
+
},
|
|
1408
|
+
/* @__PURE__ */ React.createElement(Field2, { ...props })
|
|
1409
|
+
);
|
|
1410
|
+
};
|
|
1415
1411
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1412
|
+
function wrapFieldWithNoHeader(Field2) {
|
|
1413
|
+
return (props) => {
|
|
1414
|
+
return /* @__PURE__ */ React.createElement(
|
|
1415
|
+
FieldMeta,
|
|
1416
|
+
{
|
|
1417
|
+
name: props.input.name,
|
|
1418
|
+
label: false,
|
|
1419
|
+
description: "",
|
|
1420
|
+
error: props.meta.error,
|
|
1421
|
+
index: props.index,
|
|
1422
|
+
tinaForm: props.tinaForm,
|
|
1423
|
+
focusIntent: props.field.focusIntent,
|
|
1424
|
+
hoverIntent: props.field.hoverIntent
|
|
1425
|
+
},
|
|
1426
|
+
/* @__PURE__ */ React.createElement(Field2, { ...props })
|
|
1427
|
+
);
|
|
1428
|
+
};
|
|
1428
1429
|
}
|
|
1429
|
-
function
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1430
|
+
function wrapFieldWithError(Field2) {
|
|
1431
|
+
return (props) => {
|
|
1432
|
+
return /* @__PURE__ */ React.createElement(
|
|
1433
|
+
FieldMeta,
|
|
1434
|
+
{
|
|
1435
|
+
name: props.input.name,
|
|
1436
|
+
label: false,
|
|
1437
|
+
description: props.field.description,
|
|
1438
|
+
error: props.meta.error,
|
|
1439
|
+
index: props.index,
|
|
1440
|
+
tinaForm: props.tinaForm,
|
|
1441
|
+
focusIntent: props.field.focusIntent,
|
|
1442
|
+
hoverIntent: props.field.hoverIntent
|
|
1443
|
+
},
|
|
1444
|
+
/* @__PURE__ */ React.createElement(Field2, { ...props })
|
|
1445
|
+
);
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
const FieldMeta = ({
|
|
1449
|
+
name,
|
|
1450
|
+
label,
|
|
1451
|
+
description,
|
|
1452
|
+
error: error2,
|
|
1453
|
+
margin = true,
|
|
1454
|
+
children,
|
|
1455
|
+
index,
|
|
1456
|
+
tinaForm,
|
|
1457
|
+
focusIntent,
|
|
1458
|
+
hoverIntent,
|
|
1459
|
+
...props
|
|
1460
|
+
}) => {
|
|
1461
|
+
const cms = useCMS$1();
|
|
1462
|
+
const { dispatch: setHoveredField } = useEvent("field:hover");
|
|
1463
|
+
const { dispatch: setFocusedField } = useEvent("field:focus");
|
|
1464
|
+
const isActive = !!focusIntent;
|
|
1465
|
+
const isHovering = !!hoverIntent;
|
|
1466
|
+
const handleClick = () => {
|
|
1467
|
+
const existingForm = cms.state.forms.find(
|
|
1468
|
+
(form) => form.tinaForm.id === tinaForm.id
|
|
1469
|
+
);
|
|
1470
|
+
const isAlreadyActive = (existingForm == null ? void 0 : existingForm.activeFieldName) === name;
|
|
1471
|
+
if (isAlreadyActive) {
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1474
|
+
setFocusedField({ id: tinaForm.id, fieldName: name });
|
|
1475
|
+
cms.dispatch({
|
|
1476
|
+
type: "forms:set-active-field-name",
|
|
1477
|
+
value: { formId: tinaForm.id, fieldName: name }
|
|
1433
1478
|
});
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1479
|
+
};
|
|
1480
|
+
return /* @__PURE__ */ React.createElement(
|
|
1481
|
+
FieldWrapper,
|
|
1482
|
+
{
|
|
1483
|
+
margin,
|
|
1484
|
+
onMouseOver: () => setHoveredField({ id: tinaForm.id, fieldName: name }),
|
|
1485
|
+
onMouseOut: () => setHoveredField({ id: null, fieldName: null }),
|
|
1486
|
+
onClick: handleClick,
|
|
1487
|
+
style: { zIndex: index ? 1e3 - index : void 0 },
|
|
1488
|
+
"data-tina-field-active": isActive ? "true" : void 0,
|
|
1489
|
+
"data-tina-field-hovering": isHovering ? "true" : void 0,
|
|
1490
|
+
...props
|
|
1491
|
+
},
|
|
1492
|
+
(label !== false || description) && /* @__PURE__ */ React.createElement(FieldLabel, { name }, label !== false && /* @__PURE__ */ React.createElement(React.Fragment, null, label || name), description && /* @__PURE__ */ React.createElement(FieldDescription, null, description)),
|
|
1493
|
+
children,
|
|
1494
|
+
error2 && typeof error2 === "string" && /* @__PURE__ */ React.createElement(FieldError, null, error2)
|
|
1495
|
+
);
|
|
1496
|
+
};
|
|
1497
|
+
const FieldWrapper = ({
|
|
1498
|
+
margin,
|
|
1499
|
+
children,
|
|
1500
|
+
"data-tina-field-active": dataActive,
|
|
1501
|
+
"data-tina-field-hovering": dataHovering,
|
|
1502
|
+
...restProps
|
|
1503
|
+
}) => {
|
|
1504
|
+
const isActive = dataActive === "true";
|
|
1505
|
+
const isHovering = dataHovering === "true";
|
|
1506
|
+
const getFieldStateClasses = () => {
|
|
1507
|
+
const elements = ["input", "textarea", "select", ".ProseMirror"];
|
|
1508
|
+
const buildClasses = (color) => {
|
|
1509
|
+
return elements.map(
|
|
1510
|
+
(el) => `[&_${el}]:!border-${color} [&_${el}]:!ring-2 [&_${el}]:!ring-${color}/20`
|
|
1511
|
+
).join(" ");
|
|
1512
|
+
};
|
|
1513
|
+
if (isActive) {
|
|
1514
|
+
return buildClasses("tina-orange-dark");
|
|
1515
|
+
}
|
|
1516
|
+
if (isHovering) {
|
|
1517
|
+
return buildClasses("blue-500");
|
|
1518
|
+
}
|
|
1519
|
+
return "";
|
|
1520
|
+
};
|
|
1521
|
+
return /* @__PURE__ */ React.createElement(
|
|
1522
|
+
"div",
|
|
1523
|
+
{
|
|
1524
|
+
className: `relative ${margin ? `mb-5 last:mb-0` : ``} ${getFieldStateClasses()}`,
|
|
1525
|
+
"data-tina-field-active": dataActive,
|
|
1526
|
+
"data-tina-field-hovering": dataHovering,
|
|
1527
|
+
...restProps
|
|
1528
|
+
},
|
|
1529
|
+
children
|
|
1530
|
+
);
|
|
1531
|
+
};
|
|
1532
|
+
const FieldLabel = ({
|
|
1533
|
+
children,
|
|
1534
|
+
className,
|
|
1535
|
+
name,
|
|
1536
|
+
...props
|
|
1537
|
+
}) => {
|
|
1538
|
+
return /* @__PURE__ */ React.createElement(
|
|
1539
|
+
"label",
|
|
1540
|
+
{
|
|
1541
|
+
htmlFor: name,
|
|
1542
|
+
className: `block font-sans text-xs font-semibold text-gray-700 whitespace-normal mb-2 ${className}`,
|
|
1543
|
+
...props
|
|
1544
|
+
},
|
|
1545
|
+
children
|
|
1546
|
+
);
|
|
1547
|
+
};
|
|
1548
|
+
const FieldDescription = ({
|
|
1549
|
+
children,
|
|
1550
|
+
className,
|
|
1551
|
+
...props
|
|
1552
|
+
}) => {
|
|
1553
|
+
if (typeof children === "string") {
|
|
1554
|
+
return /* @__PURE__ */ React.createElement(
|
|
1555
|
+
"span",
|
|
1556
|
+
{
|
|
1557
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
1558
|
+
...props,
|
|
1559
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
1560
|
+
}
|
|
1561
|
+
);
|
|
1436
1562
|
}
|
|
1563
|
+
return /* @__PURE__ */ React.createElement(
|
|
1564
|
+
"span",
|
|
1565
|
+
{
|
|
1566
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
1567
|
+
...props
|
|
1568
|
+
},
|
|
1569
|
+
children
|
|
1570
|
+
);
|
|
1571
|
+
};
|
|
1572
|
+
const FieldError = ({
|
|
1573
|
+
children,
|
|
1574
|
+
className,
|
|
1575
|
+
...props
|
|
1576
|
+
}) => {
|
|
1577
|
+
return /* @__PURE__ */ React.createElement(
|
|
1578
|
+
"span",
|
|
1579
|
+
{
|
|
1580
|
+
className: `block font-sans text-xs font-normal text-red-500 pt-3 animate-slide-in whitespace-normal m-0 ${className}`,
|
|
1581
|
+
...props
|
|
1582
|
+
},
|
|
1583
|
+
children
|
|
1584
|
+
);
|
|
1585
|
+
};
|
|
1586
|
+
const EditorContext$1 = React__default.createContext({
|
|
1587
|
+
fieldName: "",
|
|
1588
|
+
rawMode: false,
|
|
1589
|
+
setRawMode: () => {
|
|
1590
|
+
},
|
|
1591
|
+
templates: []
|
|
1592
|
+
});
|
|
1593
|
+
const useEditorContext = () => {
|
|
1594
|
+
return React__default.useContext(EditorContext$1);
|
|
1595
|
+
};
|
|
1596
|
+
const useTemplates = () => {
|
|
1597
|
+
return React__default.useContext(EditorContext$1);
|
|
1598
|
+
};
|
|
1599
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1600
|
+
function getDefaultExportFromCjs(x) {
|
|
1601
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1437
1602
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
thing.add(value);
|
|
1451
|
-
} else
|
|
1452
|
-
thing[propOrOldValue] = value;
|
|
1453
|
-
}
|
|
1454
|
-
function is(x, y) {
|
|
1455
|
-
if (x === y) {
|
|
1456
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
1457
|
-
} else {
|
|
1458
|
-
return x !== x && y !== y;
|
|
1603
|
+
var direction_1 = direction;
|
|
1604
|
+
var RTL = "֑-߿יִ-﷽ﹰ-ﻼ";
|
|
1605
|
+
var LTR = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--";
|
|
1606
|
+
var rtl = new RegExp("^[^" + LTR + "]*[" + RTL + "]");
|
|
1607
|
+
var ltr = new RegExp("^[^" + RTL + "]*[" + LTR + "]");
|
|
1608
|
+
function direction(value) {
|
|
1609
|
+
value = String(value || "");
|
|
1610
|
+
if (rtl.test(value)) {
|
|
1611
|
+
return "rtl";
|
|
1612
|
+
}
|
|
1613
|
+
if (ltr.test(value)) {
|
|
1614
|
+
return "ltr";
|
|
1459
1615
|
}
|
|
1616
|
+
return "neutral";
|
|
1460
1617
|
}
|
|
1461
|
-
|
|
1462
|
-
|
|
1618
|
+
const getDirection = /* @__PURE__ */ getDefaultExportFromCjs(direction_1);
|
|
1619
|
+
function isObject$e(value) {
|
|
1620
|
+
var type = typeof value;
|
|
1621
|
+
return value != null && (type == "object" || type == "function");
|
|
1463
1622
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1623
|
+
var isObject_1 = isObject$e;
|
|
1624
|
+
var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
1625
|
+
var _freeGlobal = freeGlobal$1;
|
|
1626
|
+
var freeGlobal = _freeGlobal;
|
|
1627
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
1628
|
+
var root$9 = freeGlobal || freeSelf || Function("return this")();
|
|
1629
|
+
var _root = root$9;
|
|
1630
|
+
var root$8 = _root;
|
|
1631
|
+
var now$1 = function() {
|
|
1632
|
+
return root$8.Date.now();
|
|
1633
|
+
};
|
|
1634
|
+
var now_1 = now$1;
|
|
1635
|
+
var reWhitespace = /\s/;
|
|
1636
|
+
function trimmedEndIndex$1(string3) {
|
|
1637
|
+
var index = string3.length;
|
|
1638
|
+
while (index-- && reWhitespace.test(string3.charAt(index))) {
|
|
1639
|
+
}
|
|
1640
|
+
return index;
|
|
1466
1641
|
}
|
|
1467
|
-
|
|
1468
|
-
|
|
1642
|
+
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
1643
|
+
var trimmedEndIndex = _trimmedEndIndex;
|
|
1644
|
+
var reTrimStart = /^\s+/;
|
|
1645
|
+
function baseTrim$1(string3) {
|
|
1646
|
+
return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
|
|
1469
1647
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1648
|
+
var _baseTrim = baseTrim$1;
|
|
1649
|
+
var root$7 = _root;
|
|
1650
|
+
var Symbol$7 = root$7.Symbol;
|
|
1651
|
+
var _Symbol = Symbol$7;
|
|
1652
|
+
var Symbol$6 = _Symbol;
|
|
1653
|
+
var objectProto$f = Object.prototype;
|
|
1654
|
+
var hasOwnProperty$c = objectProto$f.hasOwnProperty;
|
|
1655
|
+
var nativeObjectToString$1 = objectProto$f.toString;
|
|
1656
|
+
var symToStringTag$1 = Symbol$6 ? Symbol$6.toStringTag : void 0;
|
|
1657
|
+
function getRawTag$1(value) {
|
|
1658
|
+
var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
1659
|
+
try {
|
|
1660
|
+
value[symToStringTag$1] = void 0;
|
|
1661
|
+
var unmasked = true;
|
|
1662
|
+
} catch (e3) {
|
|
1476
1663
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
let keys2 = Reflect.ownKeys(descriptors);
|
|
1484
|
-
for (let i2 = 0; i2 < keys2.length; i2++) {
|
|
1485
|
-
const key = keys2[i2];
|
|
1486
|
-
const desc = descriptors[key];
|
|
1487
|
-
if (desc.writable === false) {
|
|
1488
|
-
desc.writable = true;
|
|
1489
|
-
desc.configurable = true;
|
|
1490
|
-
}
|
|
1491
|
-
if (desc.get || desc.set)
|
|
1492
|
-
descriptors[key] = {
|
|
1493
|
-
configurable: true,
|
|
1494
|
-
writable: true,
|
|
1495
|
-
// could live with !!desc.set as well here...
|
|
1496
|
-
enumerable: desc.enumerable,
|
|
1497
|
-
value: base[key]
|
|
1498
|
-
};
|
|
1499
|
-
}
|
|
1500
|
-
return Object.create(getPrototypeOf(base), descriptors);
|
|
1501
|
-
} else {
|
|
1502
|
-
const proto = getPrototypeOf(base);
|
|
1503
|
-
if (proto !== null && isPlain) {
|
|
1504
|
-
return { ...base };
|
|
1664
|
+
var result = nativeObjectToString$1.call(value);
|
|
1665
|
+
if (unmasked) {
|
|
1666
|
+
if (isOwn) {
|
|
1667
|
+
value[symToStringTag$1] = tag;
|
|
1668
|
+
} else {
|
|
1669
|
+
delete value[symToStringTag$1];
|
|
1505
1670
|
}
|
|
1506
|
-
const obj = Object.create(proto);
|
|
1507
|
-
return Object.assign(obj, base);
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
function freeze$1(obj, deep = false) {
|
|
1511
|
-
if (isFrozen(obj) || isDraft$1(obj) || !isDraftable$1(obj))
|
|
1512
|
-
return obj;
|
|
1513
|
-
if (getArchtype(obj) > 1) {
|
|
1514
|
-
obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
|
|
1515
1671
|
}
|
|
1516
|
-
|
|
1517
|
-
if (deep)
|
|
1518
|
-
Object.entries(obj).forEach(([key, value]) => freeze$1(value, true));
|
|
1519
|
-
return obj;
|
|
1520
|
-
}
|
|
1521
|
-
function dontMutateFrozenCollections() {
|
|
1522
|
-
die(2);
|
|
1672
|
+
return result;
|
|
1523
1673
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1674
|
+
var _getRawTag = getRawTag$1;
|
|
1675
|
+
var objectProto$e = Object.prototype;
|
|
1676
|
+
var nativeObjectToString = objectProto$e.toString;
|
|
1677
|
+
function objectToString$1(value) {
|
|
1678
|
+
return nativeObjectToString.call(value);
|
|
1526
1679
|
}
|
|
1527
|
-
var
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1680
|
+
var _objectToString = objectToString$1;
|
|
1681
|
+
var Symbol$5 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
|
|
1682
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
1683
|
+
var symToStringTag = Symbol$5 ? Symbol$5.toStringTag : void 0;
|
|
1684
|
+
function baseGetTag$6(value) {
|
|
1685
|
+
if (value == null) {
|
|
1686
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
1532
1687
|
}
|
|
1533
|
-
return
|
|
1688
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
1534
1689
|
}
|
|
1535
|
-
var
|
|
1536
|
-
function
|
|
1537
|
-
return
|
|
1690
|
+
var _baseGetTag = baseGetTag$6;
|
|
1691
|
+
function isObjectLike$9(value) {
|
|
1692
|
+
return value != null && typeof value == "object";
|
|
1538
1693
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
// Whenever the modified draft contains a draft from another scope, we
|
|
1545
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
1546
|
-
canAutoFreeze_: true,
|
|
1547
|
-
unfinalizedDrafts_: 0
|
|
1548
|
-
};
|
|
1694
|
+
var isObjectLike_1 = isObjectLike$9;
|
|
1695
|
+
var baseGetTag$5 = _baseGetTag, isObjectLike$8 = isObjectLike_1;
|
|
1696
|
+
var symbolTag$3 = "[object Symbol]";
|
|
1697
|
+
function isSymbol$4(value) {
|
|
1698
|
+
return typeof value == "symbol" || isObjectLike$8(value) && baseGetTag$5(value) == symbolTag$3;
|
|
1549
1699
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1700
|
+
var isSymbol_1 = isSymbol$4;
|
|
1701
|
+
var baseTrim = _baseTrim, isObject$d = isObject_1, isSymbol$3 = isSymbol_1;
|
|
1702
|
+
var NAN = 0 / 0;
|
|
1703
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
1704
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
1705
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
1706
|
+
var freeParseInt = parseInt;
|
|
1707
|
+
function toNumber$1(value) {
|
|
1708
|
+
if (typeof value == "number") {
|
|
1709
|
+
return value;
|
|
1556
1710
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
leaveScope(scope);
|
|
1560
|
-
scope.drafts_.forEach(revokeDraft);
|
|
1561
|
-
scope.drafts_ = null;
|
|
1562
|
-
}
|
|
1563
|
-
function leaveScope(scope) {
|
|
1564
|
-
if (scope === currentScope) {
|
|
1565
|
-
currentScope = scope.parent_;
|
|
1711
|
+
if (isSymbol$3(value)) {
|
|
1712
|
+
return NAN;
|
|
1566
1713
|
}
|
|
1567
|
-
|
|
1568
|
-
function
|
|
1569
|
-
|
|
1570
|
-
}
|
|
1571
|
-
function revokeDraft(draft) {
|
|
1572
|
-
const state = draft[DRAFT_STATE];
|
|
1573
|
-
if (state.type_ === 0 || state.type_ === 1)
|
|
1574
|
-
state.revoke_();
|
|
1575
|
-
else
|
|
1576
|
-
state.revoked_ = true;
|
|
1577
|
-
}
|
|
1578
|
-
function processResult(result, scope) {
|
|
1579
|
-
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
1580
|
-
const baseDraft = scope.drafts_[0];
|
|
1581
|
-
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
1582
|
-
if (isReplaced) {
|
|
1583
|
-
if (baseDraft[DRAFT_STATE].modified_) {
|
|
1584
|
-
revokeScope(scope);
|
|
1585
|
-
die(4);
|
|
1586
|
-
}
|
|
1587
|
-
if (isDraftable$1(result)) {
|
|
1588
|
-
result = finalize(scope, result);
|
|
1589
|
-
if (!scope.parent_)
|
|
1590
|
-
maybeFreeze(scope, result);
|
|
1591
|
-
}
|
|
1592
|
-
if (scope.patches_) {
|
|
1593
|
-
getPlugin("Patches").generateReplacementPatches_(
|
|
1594
|
-
baseDraft[DRAFT_STATE].base_,
|
|
1595
|
-
result,
|
|
1596
|
-
scope.patches_,
|
|
1597
|
-
scope.inversePatches_
|
|
1598
|
-
);
|
|
1599
|
-
}
|
|
1600
|
-
} else {
|
|
1601
|
-
result = finalize(scope, baseDraft, []);
|
|
1714
|
+
if (isObject$d(value)) {
|
|
1715
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
1716
|
+
value = isObject$d(other) ? other + "" : other;
|
|
1602
1717
|
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
1718
|
+
if (typeof value != "string") {
|
|
1719
|
+
return value === 0 ? value : +value;
|
|
1606
1720
|
}
|
|
1607
|
-
|
|
1721
|
+
value = baseTrim(value);
|
|
1722
|
+
var isBinary = reIsBinary.test(value);
|
|
1723
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
1608
1724
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
);
|
|
1618
|
-
return value;
|
|
1725
|
+
var toNumber_1 = toNumber$1;
|
|
1726
|
+
var isObject$c = isObject_1, now = now_1, toNumber = toNumber_1;
|
|
1727
|
+
var FUNC_ERROR_TEXT$3 = "Expected a function";
|
|
1728
|
+
var nativeMax$1 = Math.max, nativeMin = Math.min;
|
|
1729
|
+
function debounce$1(func, wait, options) {
|
|
1730
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
1731
|
+
if (typeof func != "function") {
|
|
1732
|
+
throw new TypeError(FUNC_ERROR_TEXT$3);
|
|
1619
1733
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1734
|
+
wait = toNumber(wait) || 0;
|
|
1735
|
+
if (isObject$c(options)) {
|
|
1736
|
+
leading = !!options.leading;
|
|
1737
|
+
maxing = "maxWait" in options;
|
|
1738
|
+
maxWait = maxing ? nativeMax$1(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
1739
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
1625
1740
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
if (state.type_ === 3) {
|
|
1633
|
-
resultEach = new Set(result);
|
|
1634
|
-
result.clear();
|
|
1635
|
-
isSet2 = true;
|
|
1636
|
-
}
|
|
1637
|
-
each(
|
|
1638
|
-
resultEach,
|
|
1639
|
-
(key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path3, isSet2)
|
|
1640
|
-
);
|
|
1641
|
-
maybeFreeze(rootScope, result, false);
|
|
1642
|
-
if (path3 && rootScope.patches_) {
|
|
1643
|
-
getPlugin("Patches").generatePatches_(
|
|
1644
|
-
state,
|
|
1645
|
-
path3,
|
|
1646
|
-
rootScope.patches_,
|
|
1647
|
-
rootScope.inversePatches_
|
|
1648
|
-
);
|
|
1649
|
-
}
|
|
1741
|
+
function invokeFunc(time2) {
|
|
1742
|
+
var args = lastArgs, thisArg = lastThis;
|
|
1743
|
+
lastArgs = lastThis = void 0;
|
|
1744
|
+
lastInvokeTime = time2;
|
|
1745
|
+
result = func.apply(thisArg, args);
|
|
1746
|
+
return result;
|
|
1650
1747
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
die(5);
|
|
1656
|
-
if (isDraft$1(childValue)) {
|
|
1657
|
-
const path3 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
1658
|
-
!has$2(parentState.assigned_, prop2) ? rootPath.concat(prop2) : void 0;
|
|
1659
|
-
const res = finalize(rootScope, childValue, path3);
|
|
1660
|
-
set$3(targetObject, prop2, res);
|
|
1661
|
-
if (isDraft$1(res)) {
|
|
1662
|
-
rootScope.canAutoFreeze_ = false;
|
|
1663
|
-
} else
|
|
1664
|
-
return;
|
|
1665
|
-
} else if (targetIsSet) {
|
|
1666
|
-
targetObject.add(childValue);
|
|
1748
|
+
function leadingEdge(time2) {
|
|
1749
|
+
lastInvokeTime = time2;
|
|
1750
|
+
timerId = setTimeout(timerExpired, wait);
|
|
1751
|
+
return leading ? invokeFunc(time2) : result;
|
|
1667
1752
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
finalize(rootScope, childValue);
|
|
1673
|
-
if ((!parentState || !parentState.scope_.parent_) && typeof prop2 !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop2))
|
|
1674
|
-
maybeFreeze(rootScope, childValue);
|
|
1753
|
+
function remainingWait(time2) {
|
|
1754
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
1755
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
1675
1756
|
}
|
|
1676
|
-
|
|
1757
|
+
function shouldInvoke(time2) {
|
|
1758
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
1759
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
1760
|
+
}
|
|
1761
|
+
function timerExpired() {
|
|
1762
|
+
var time2 = now();
|
|
1763
|
+
if (shouldInvoke(time2)) {
|
|
1764
|
+
return trailingEdge(time2);
|
|
1765
|
+
}
|
|
1766
|
+
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
1767
|
+
}
|
|
1768
|
+
function trailingEdge(time2) {
|
|
1769
|
+
timerId = void 0;
|
|
1770
|
+
if (trailing && lastArgs) {
|
|
1771
|
+
return invokeFunc(time2);
|
|
1772
|
+
}
|
|
1773
|
+
lastArgs = lastThis = void 0;
|
|
1774
|
+
return result;
|
|
1775
|
+
}
|
|
1776
|
+
function cancel() {
|
|
1777
|
+
if (timerId !== void 0) {
|
|
1778
|
+
clearTimeout(timerId);
|
|
1779
|
+
}
|
|
1780
|
+
lastInvokeTime = 0;
|
|
1781
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
1782
|
+
}
|
|
1783
|
+
function flush() {
|
|
1784
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
1785
|
+
}
|
|
1786
|
+
function debounced() {
|
|
1787
|
+
var time2 = now(), isInvoking = shouldInvoke(time2);
|
|
1788
|
+
lastArgs = arguments;
|
|
1789
|
+
lastThis = this;
|
|
1790
|
+
lastCallTime = time2;
|
|
1791
|
+
if (isInvoking) {
|
|
1792
|
+
if (timerId === void 0) {
|
|
1793
|
+
return leadingEdge(lastCallTime);
|
|
1794
|
+
}
|
|
1795
|
+
if (maxing) {
|
|
1796
|
+
clearTimeout(timerId);
|
|
1797
|
+
timerId = setTimeout(timerExpired, wait);
|
|
1798
|
+
return invokeFunc(lastCallTime);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
if (timerId === void 0) {
|
|
1802
|
+
timerId = setTimeout(timerExpired, wait);
|
|
1803
|
+
}
|
|
1804
|
+
return result;
|
|
1805
|
+
}
|
|
1806
|
+
debounced.cancel = cancel;
|
|
1807
|
+
debounced.flush = flush;
|
|
1808
|
+
return debounced;
|
|
1809
|
+
}
|
|
1810
|
+
var debounce_1 = debounce$1;
|
|
1811
|
+
const debounce$2 = /* @__PURE__ */ getDefaultExportFromCjs(debounce_1);
|
|
1812
|
+
var debounce = debounce_1, isObject$b = isObject_1;
|
|
1813
|
+
var FUNC_ERROR_TEXT$2 = "Expected a function";
|
|
1814
|
+
function throttle(func, wait, options) {
|
|
1815
|
+
var leading = true, trailing = true;
|
|
1816
|
+
if (typeof func != "function") {
|
|
1817
|
+
throw new TypeError(FUNC_ERROR_TEXT$2);
|
|
1818
|
+
}
|
|
1819
|
+
if (isObject$b(options)) {
|
|
1820
|
+
leading = "leading" in options ? !!options.leading : leading;
|
|
1821
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
1822
|
+
}
|
|
1823
|
+
return debounce(func, wait, {
|
|
1824
|
+
"leading": leading,
|
|
1825
|
+
"maxWait": wait,
|
|
1826
|
+
"trailing": trailing
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
var throttle_1 = throttle;
|
|
1830
|
+
const throttle$1 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
|
|
1831
|
+
const t$2 = (t2) => "object" == typeof t2 && null != t2 && 1 === t2.nodeType, e$3 = (t2, e3) => (!e3 || "hidden" !== t2) && ("visible" !== t2 && "clip" !== t2), n$3 = (t2, n2) => {
|
|
1832
|
+
if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {
|
|
1833
|
+
const o3 = getComputedStyle(t2, null);
|
|
1834
|
+
return e$3(o3.overflowY, n2) || e$3(o3.overflowX, n2) || ((t3) => {
|
|
1835
|
+
const e3 = ((t4) => {
|
|
1836
|
+
if (!t4.ownerDocument || !t4.ownerDocument.defaultView)
|
|
1837
|
+
return null;
|
|
1838
|
+
try {
|
|
1839
|
+
return t4.ownerDocument.defaultView.frameElement;
|
|
1840
|
+
} catch (t5) {
|
|
1841
|
+
return null;
|
|
1842
|
+
}
|
|
1843
|
+
})(t3);
|
|
1844
|
+
return !!e3 && (e3.clientHeight < t3.scrollHeight || e3.clientWidth < t3.scrollWidth);
|
|
1845
|
+
})(t2);
|
|
1846
|
+
}
|
|
1847
|
+
return false;
|
|
1848
|
+
}, o$3 = (t2, e3, n2, o3, l2, r2, i2, s2) => r2 < t2 && i2 > e3 || r2 > t2 && i2 < e3 ? 0 : r2 <= t2 && s2 <= n2 || i2 >= e3 && s2 >= n2 ? r2 - t2 - o3 : i2 > e3 && s2 < n2 || r2 < t2 && s2 > n2 ? i2 - e3 + l2 : 0, l$2 = (t2) => {
|
|
1849
|
+
const e3 = t2.parentElement;
|
|
1850
|
+
return null == e3 ? t2.getRootNode().host || null : e3;
|
|
1851
|
+
}, r$3 = (e3, r2) => {
|
|
1852
|
+
var i2, s2, d2, h;
|
|
1853
|
+
if ("undefined" == typeof document)
|
|
1854
|
+
return [];
|
|
1855
|
+
const { scrollMode: c2, block: f2, inline: u2, boundary: a2, skipOverflowHiddenElements: g } = r2, p2 = "function" == typeof a2 ? a2 : (t2) => t2 !== a2;
|
|
1856
|
+
if (!t$2(e3))
|
|
1857
|
+
throw new TypeError("Invalid target");
|
|
1858
|
+
const m = document.scrollingElement || document.documentElement, w2 = [];
|
|
1859
|
+
let W = e3;
|
|
1860
|
+
for (; t$2(W) && p2(W); ) {
|
|
1861
|
+
if (W = l$2(W), W === m) {
|
|
1862
|
+
w2.push(W);
|
|
1863
|
+
break;
|
|
1864
|
+
}
|
|
1865
|
+
null != W && W === document.body && n$3(W) && !n$3(document.documentElement) || null != W && n$3(W, g) && w2.push(W);
|
|
1866
|
+
}
|
|
1867
|
+
const b = null != (s2 = null == (i2 = window.visualViewport) ? void 0 : i2.width) ? s2 : innerWidth, H = null != (h = null == (d2 = window.visualViewport) ? void 0 : d2.height) ? h : innerHeight, { scrollX: y, scrollY: M } = window, { height: v, width: E, top: x, right: C, bottom: I, left: R } = e3.getBoundingClientRect(), { top: T, right: B, bottom: F, left: V } = ((t2) => {
|
|
1868
|
+
const e4 = window.getComputedStyle(t2);
|
|
1869
|
+
return { top: parseFloat(e4.scrollMarginTop) || 0, right: parseFloat(e4.scrollMarginRight) || 0, bottom: parseFloat(e4.scrollMarginBottom) || 0, left: parseFloat(e4.scrollMarginLeft) || 0 };
|
|
1870
|
+
})(e3);
|
|
1871
|
+
let k = "start" === f2 || "nearest" === f2 ? x - T : "end" === f2 ? I + F : x + v / 2 - T + F, D = "center" === u2 ? R + E / 2 - V + B : "end" === u2 ? C + B : R - V;
|
|
1872
|
+
const L = [];
|
|
1873
|
+
for (let t2 = 0; t2 < w2.length; t2++) {
|
|
1874
|
+
const e4 = w2[t2], { height: l2, width: r3, top: i3, right: s3, bottom: d3, left: h2 } = e4.getBoundingClientRect();
|
|
1875
|
+
if ("if-needed" === c2 && x >= 0 && R >= 0 && I <= H && C <= b && (e4 === m && !n$3(e4) || x >= i3 && I <= d3 && R >= h2 && C <= s3))
|
|
1876
|
+
return L;
|
|
1877
|
+
const a3 = getComputedStyle(e4), g2 = parseInt(a3.borderLeftWidth, 10), p3 = parseInt(a3.borderTopWidth, 10), W2 = parseInt(a3.borderRightWidth, 10), T2 = parseInt(a3.borderBottomWidth, 10);
|
|
1878
|
+
let B2 = 0, F2 = 0;
|
|
1879
|
+
const V2 = "offsetWidth" in e4 ? e4.offsetWidth - e4.clientWidth - g2 - W2 : 0, S = "offsetHeight" in e4 ? e4.offsetHeight - e4.clientHeight - p3 - T2 : 0, X2 = "offsetWidth" in e4 ? 0 === e4.offsetWidth ? 0 : r3 / e4.offsetWidth : 0, Y = "offsetHeight" in e4 ? 0 === e4.offsetHeight ? 0 : l2 / e4.offsetHeight : 0;
|
|
1880
|
+
if (m === e4)
|
|
1881
|
+
B2 = "start" === f2 ? k : "end" === f2 ? k - H : "nearest" === f2 ? o$3(M, M + H, H, p3, T2, M + k, M + k + v, v) : k - H / 2, F2 = "start" === u2 ? D : "center" === u2 ? D - b / 2 : "end" === u2 ? D - b : o$3(y, y + b, b, g2, W2, y + D, y + D + E, E), B2 = Math.max(0, B2 + M), F2 = Math.max(0, F2 + y);
|
|
1882
|
+
else {
|
|
1883
|
+
B2 = "start" === f2 ? k - i3 - p3 : "end" === f2 ? k - d3 + T2 + S : "nearest" === f2 ? o$3(i3, d3, l2, p3, T2 + S, k, k + v, v) : k - (i3 + l2 / 2) + S / 2, F2 = "start" === u2 ? D - h2 - g2 : "center" === u2 ? D - (h2 + r3 / 2) + V2 / 2 : "end" === u2 ? D - s3 + W2 + V2 : o$3(h2, s3, r3, g2, W2 + V2, D, D + E, E);
|
|
1884
|
+
const { scrollLeft: t3, scrollTop: n2 } = e4;
|
|
1885
|
+
B2 = 0 === Y ? 0 : Math.max(0, Math.min(n2 + B2 / Y, e4.scrollHeight - l2 / Y + S)), F2 = 0 === X2 ? 0 : Math.max(0, Math.min(t3 + F2 / X2, e4.scrollWidth - r3 / X2 + V2)), k += n2 - B2, D += t3 - F2;
|
|
1886
|
+
}
|
|
1887
|
+
L.push({ el: e4, top: B2, left: F2 });
|
|
1888
|
+
}
|
|
1889
|
+
return L;
|
|
1890
|
+
};
|
|
1891
|
+
const o$2 = (t2) => false === t2 ? { block: "end", inline: "nearest" } : ((t3) => t3 === Object(t3) && 0 !== Object.keys(t3).length)(t2) ? t2 : { block: "start", inline: "nearest" };
|
|
1892
|
+
function e$2(e3, r2) {
|
|
1893
|
+
if (!e3.isConnected || !((t2) => {
|
|
1894
|
+
let o3 = t2;
|
|
1895
|
+
for (; o3 && o3.parentNode; ) {
|
|
1896
|
+
if (o3.parentNode === document)
|
|
1897
|
+
return true;
|
|
1898
|
+
o3 = o3.parentNode instanceof ShadowRoot ? o3.parentNode.host : o3.parentNode;
|
|
1899
|
+
}
|
|
1900
|
+
return false;
|
|
1901
|
+
})(e3))
|
|
1902
|
+
return;
|
|
1903
|
+
const n2 = ((t2) => {
|
|
1904
|
+
const o3 = window.getComputedStyle(t2);
|
|
1905
|
+
return { top: parseFloat(o3.scrollMarginTop) || 0, right: parseFloat(o3.scrollMarginRight) || 0, bottom: parseFloat(o3.scrollMarginBottom) || 0, left: parseFloat(o3.scrollMarginLeft) || 0 };
|
|
1906
|
+
})(e3);
|
|
1907
|
+
if (((t2) => "object" == typeof t2 && "function" == typeof t2.behavior)(r2))
|
|
1908
|
+
return r2.behavior(r$3(e3, r2));
|
|
1909
|
+
const l2 = "boolean" == typeof r2 || null == r2 ? void 0 : r2.behavior;
|
|
1910
|
+
for (const { el: a2, top: i2, left: s2 } of r$3(e3, o$2(r2))) {
|
|
1911
|
+
const t2 = i2 - n2.top + n2.bottom, o3 = s2 - n2.left + n2.right;
|
|
1912
|
+
a2.scroll({ top: t2, left: o3, behavior: l2 });
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
/*!
|
|
1916
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
1917
|
+
*
|
|
1918
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
1919
|
+
* Released under the MIT License.
|
|
1920
|
+
*/
|
|
1921
|
+
function isObject$a(o3) {
|
|
1922
|
+
return Object.prototype.toString.call(o3) === "[object Object]";
|
|
1923
|
+
}
|
|
1924
|
+
function isPlainObject$5(o3) {
|
|
1925
|
+
var ctor, prot;
|
|
1926
|
+
if (isObject$a(o3) === false)
|
|
1927
|
+
return false;
|
|
1928
|
+
ctor = o3.constructor;
|
|
1929
|
+
if (ctor === void 0)
|
|
1930
|
+
return true;
|
|
1931
|
+
prot = ctor.prototype;
|
|
1932
|
+
if (isObject$a(prot) === false)
|
|
1933
|
+
return false;
|
|
1934
|
+
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
1935
|
+
return false;
|
|
1936
|
+
}
|
|
1937
|
+
return true;
|
|
1938
|
+
}
|
|
1939
|
+
var NOTHING = Symbol.for("immer-nothing");
|
|
1940
|
+
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
1941
|
+
var DRAFT_STATE = Symbol.for("immer-state");
|
|
1942
|
+
var errors = process.env.NODE_ENV !== "production" ? [
|
|
1943
|
+
// All error codes, starting by 0:
|
|
1944
|
+
function(plugin) {
|
|
1945
|
+
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
1946
|
+
},
|
|
1947
|
+
function(thing) {
|
|
1948
|
+
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;
|
|
1949
|
+
},
|
|
1950
|
+
"This object has been frozen and should not be mutated",
|
|
1951
|
+
function(data) {
|
|
1952
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
1953
|
+
},
|
|
1954
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
1955
|
+
"Immer forbids circular references",
|
|
1956
|
+
"The first or second argument to `produce` must be a function",
|
|
1957
|
+
"The third argument to `produce` must be a function or undefined",
|
|
1958
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
1959
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
1960
|
+
function(thing) {
|
|
1961
|
+
return `'current' expects a draft, got: ${thing}`;
|
|
1962
|
+
},
|
|
1963
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
1964
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
1965
|
+
"Immer only supports deleting array indices",
|
|
1966
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
1967
|
+
function(thing) {
|
|
1968
|
+
return `'original' expects a draft, got: ${thing}`;
|
|
1969
|
+
}
|
|
1970
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
1971
|
+
// See Patches.ts for additional errors
|
|
1972
|
+
] : [];
|
|
1973
|
+
function die(error2, ...args) {
|
|
1974
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1975
|
+
const e3 = errors[error2];
|
|
1976
|
+
const msg2 = typeof e3 === "function" ? e3.apply(null, args) : e3;
|
|
1977
|
+
throw new Error(`[Immer] ${msg2}`);
|
|
1978
|
+
}
|
|
1979
|
+
throw new Error(
|
|
1980
|
+
`[Immer] minified error nr: ${error2}. Full error at: https://bit.ly/3cXEKWf`
|
|
1981
|
+
);
|
|
1982
|
+
}
|
|
1983
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
1984
|
+
function isDraft$1(value) {
|
|
1985
|
+
return !!value && !!value[DRAFT_STATE];
|
|
1986
|
+
}
|
|
1987
|
+
function isDraftable$1(value) {
|
|
1988
|
+
var _a2;
|
|
1989
|
+
if (!value)
|
|
1990
|
+
return false;
|
|
1991
|
+
return isPlainObject$4(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a2 = value.constructor) == null ? void 0 : _a2[DRAFTABLE]) || isMap$2(value) || isSet$2(value);
|
|
1992
|
+
}
|
|
1993
|
+
var objectCtorString$1 = Object.prototype.constructor.toString();
|
|
1994
|
+
function isPlainObject$4(value) {
|
|
1995
|
+
if (!value || typeof value !== "object")
|
|
1996
|
+
return false;
|
|
1997
|
+
const proto = getPrototypeOf(value);
|
|
1998
|
+
if (proto === null) {
|
|
1999
|
+
return true;
|
|
2000
|
+
}
|
|
2001
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
2002
|
+
if (Ctor === Object)
|
|
2003
|
+
return true;
|
|
2004
|
+
return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString$1;
|
|
2005
|
+
}
|
|
2006
|
+
function each(obj, iter) {
|
|
2007
|
+
if (getArchtype(obj) === 0) {
|
|
2008
|
+
Reflect.ownKeys(obj).forEach((key) => {
|
|
2009
|
+
iter(key, obj[key], obj);
|
|
2010
|
+
});
|
|
2011
|
+
} else {
|
|
2012
|
+
obj.forEach((entry, index) => iter(index, entry, obj));
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
function getArchtype(thing) {
|
|
2016
|
+
const state = thing[DRAFT_STATE];
|
|
2017
|
+
return state ? state.type_ : Array.isArray(thing) ? 1 : isMap$2(thing) ? 2 : isSet$2(thing) ? 3 : 0;
|
|
2018
|
+
}
|
|
2019
|
+
function has$2(thing, prop2) {
|
|
2020
|
+
return getArchtype(thing) === 2 ? thing.has(prop2) : Object.prototype.hasOwnProperty.call(thing, prop2);
|
|
2021
|
+
}
|
|
2022
|
+
function set$3(thing, propOrOldValue, value) {
|
|
2023
|
+
const t2 = getArchtype(thing);
|
|
2024
|
+
if (t2 === 2)
|
|
2025
|
+
thing.set(propOrOldValue, value);
|
|
2026
|
+
else if (t2 === 3) {
|
|
2027
|
+
thing.add(value);
|
|
2028
|
+
} else
|
|
2029
|
+
thing[propOrOldValue] = value;
|
|
2030
|
+
}
|
|
2031
|
+
function is(x, y) {
|
|
2032
|
+
if (x === y) {
|
|
2033
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
2034
|
+
} else {
|
|
2035
|
+
return x !== x && y !== y;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
function isMap$2(target) {
|
|
2039
|
+
return target instanceof Map;
|
|
2040
|
+
}
|
|
2041
|
+
function isSet$2(target) {
|
|
2042
|
+
return target instanceof Set;
|
|
2043
|
+
}
|
|
2044
|
+
function latest$1(state) {
|
|
2045
|
+
return state.copy_ || state.base_;
|
|
2046
|
+
}
|
|
2047
|
+
function shallowCopy$1(base, strict) {
|
|
2048
|
+
if (isMap$2(base)) {
|
|
2049
|
+
return new Map(base);
|
|
2050
|
+
}
|
|
2051
|
+
if (isSet$2(base)) {
|
|
2052
|
+
return new Set(base);
|
|
2053
|
+
}
|
|
2054
|
+
if (Array.isArray(base))
|
|
2055
|
+
return Array.prototype.slice.call(base);
|
|
2056
|
+
const isPlain = isPlainObject$4(base);
|
|
2057
|
+
if (strict === true || strict === "class_only" && !isPlain) {
|
|
2058
|
+
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
2059
|
+
delete descriptors[DRAFT_STATE];
|
|
2060
|
+
let keys2 = Reflect.ownKeys(descriptors);
|
|
2061
|
+
for (let i2 = 0; i2 < keys2.length; i2++) {
|
|
2062
|
+
const key = keys2[i2];
|
|
2063
|
+
const desc = descriptors[key];
|
|
2064
|
+
if (desc.writable === false) {
|
|
2065
|
+
desc.writable = true;
|
|
2066
|
+
desc.configurable = true;
|
|
2067
|
+
}
|
|
2068
|
+
if (desc.get || desc.set)
|
|
2069
|
+
descriptors[key] = {
|
|
2070
|
+
configurable: true,
|
|
2071
|
+
writable: true,
|
|
2072
|
+
// could live with !!desc.set as well here...
|
|
2073
|
+
enumerable: desc.enumerable,
|
|
2074
|
+
value: base[key]
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
return Object.create(getPrototypeOf(base), descriptors);
|
|
2078
|
+
} else {
|
|
2079
|
+
const proto = getPrototypeOf(base);
|
|
2080
|
+
if (proto !== null && isPlain) {
|
|
2081
|
+
return { ...base };
|
|
2082
|
+
}
|
|
2083
|
+
const obj = Object.create(proto);
|
|
2084
|
+
return Object.assign(obj, base);
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
function freeze$1(obj, deep = false) {
|
|
2088
|
+
if (isFrozen(obj) || isDraft$1(obj) || !isDraftable$1(obj))
|
|
2089
|
+
return obj;
|
|
2090
|
+
if (getArchtype(obj) > 1) {
|
|
2091
|
+
obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
|
|
2092
|
+
}
|
|
2093
|
+
Object.freeze(obj);
|
|
2094
|
+
if (deep)
|
|
2095
|
+
Object.entries(obj).forEach(([key, value]) => freeze$1(value, true));
|
|
2096
|
+
return obj;
|
|
2097
|
+
}
|
|
2098
|
+
function dontMutateFrozenCollections() {
|
|
2099
|
+
die(2);
|
|
2100
|
+
}
|
|
2101
|
+
function isFrozen(obj) {
|
|
2102
|
+
return Object.isFrozen(obj);
|
|
2103
|
+
}
|
|
2104
|
+
var plugins = {};
|
|
2105
|
+
function getPlugin(pluginKey) {
|
|
2106
|
+
const plugin = plugins[pluginKey];
|
|
2107
|
+
if (!plugin) {
|
|
2108
|
+
die(0, pluginKey);
|
|
2109
|
+
}
|
|
2110
|
+
return plugin;
|
|
2111
|
+
}
|
|
2112
|
+
var currentScope;
|
|
2113
|
+
function getCurrentScope() {
|
|
2114
|
+
return currentScope;
|
|
2115
|
+
}
|
|
2116
|
+
function createScope(parent_, immer_) {
|
|
2117
|
+
return {
|
|
2118
|
+
drafts_: [],
|
|
2119
|
+
parent_,
|
|
2120
|
+
immer_,
|
|
2121
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
2122
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
2123
|
+
canAutoFreeze_: true,
|
|
2124
|
+
unfinalizedDrafts_: 0
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
function usePatchesInScope(scope, patchListener) {
|
|
2128
|
+
if (patchListener) {
|
|
2129
|
+
getPlugin("Patches");
|
|
2130
|
+
scope.patches_ = [];
|
|
2131
|
+
scope.inversePatches_ = [];
|
|
2132
|
+
scope.patchListener_ = patchListener;
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
function revokeScope(scope) {
|
|
2136
|
+
leaveScope(scope);
|
|
2137
|
+
scope.drafts_.forEach(revokeDraft);
|
|
2138
|
+
scope.drafts_ = null;
|
|
2139
|
+
}
|
|
2140
|
+
function leaveScope(scope) {
|
|
2141
|
+
if (scope === currentScope) {
|
|
2142
|
+
currentScope = scope.parent_;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
function enterScope(immer2) {
|
|
2146
|
+
return currentScope = createScope(currentScope, immer2);
|
|
2147
|
+
}
|
|
2148
|
+
function revokeDraft(draft) {
|
|
2149
|
+
const state = draft[DRAFT_STATE];
|
|
2150
|
+
if (state.type_ === 0 || state.type_ === 1)
|
|
2151
|
+
state.revoke_();
|
|
2152
|
+
else
|
|
2153
|
+
state.revoked_ = true;
|
|
2154
|
+
}
|
|
2155
|
+
function processResult(result, scope) {
|
|
2156
|
+
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
2157
|
+
const baseDraft = scope.drafts_[0];
|
|
2158
|
+
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
2159
|
+
if (isReplaced) {
|
|
2160
|
+
if (baseDraft[DRAFT_STATE].modified_) {
|
|
2161
|
+
revokeScope(scope);
|
|
2162
|
+
die(4);
|
|
2163
|
+
}
|
|
2164
|
+
if (isDraftable$1(result)) {
|
|
2165
|
+
result = finalize(scope, result);
|
|
2166
|
+
if (!scope.parent_)
|
|
2167
|
+
maybeFreeze(scope, result);
|
|
2168
|
+
}
|
|
2169
|
+
if (scope.patches_) {
|
|
2170
|
+
getPlugin("Patches").generateReplacementPatches_(
|
|
2171
|
+
baseDraft[DRAFT_STATE].base_,
|
|
2172
|
+
result,
|
|
2173
|
+
scope.patches_,
|
|
2174
|
+
scope.inversePatches_
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
} else {
|
|
2178
|
+
result = finalize(scope, baseDraft, []);
|
|
2179
|
+
}
|
|
2180
|
+
revokeScope(scope);
|
|
2181
|
+
if (scope.patches_) {
|
|
2182
|
+
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
2183
|
+
}
|
|
2184
|
+
return result !== NOTHING ? result : void 0;
|
|
2185
|
+
}
|
|
2186
|
+
function finalize(rootScope, value, path3) {
|
|
2187
|
+
if (isFrozen(value))
|
|
2188
|
+
return value;
|
|
2189
|
+
const state = value[DRAFT_STATE];
|
|
2190
|
+
if (!state) {
|
|
2191
|
+
each(
|
|
2192
|
+
value,
|
|
2193
|
+
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path3)
|
|
2194
|
+
);
|
|
2195
|
+
return value;
|
|
2196
|
+
}
|
|
2197
|
+
if (state.scope_ !== rootScope)
|
|
2198
|
+
return value;
|
|
2199
|
+
if (!state.modified_) {
|
|
2200
|
+
maybeFreeze(rootScope, state.base_, true);
|
|
2201
|
+
return state.base_;
|
|
2202
|
+
}
|
|
2203
|
+
if (!state.finalized_) {
|
|
2204
|
+
state.finalized_ = true;
|
|
2205
|
+
state.scope_.unfinalizedDrafts_--;
|
|
2206
|
+
const result = state.copy_;
|
|
2207
|
+
let resultEach = result;
|
|
2208
|
+
let isSet2 = false;
|
|
2209
|
+
if (state.type_ === 3) {
|
|
2210
|
+
resultEach = new Set(result);
|
|
2211
|
+
result.clear();
|
|
2212
|
+
isSet2 = true;
|
|
2213
|
+
}
|
|
2214
|
+
each(
|
|
2215
|
+
resultEach,
|
|
2216
|
+
(key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path3, isSet2)
|
|
2217
|
+
);
|
|
2218
|
+
maybeFreeze(rootScope, result, false);
|
|
2219
|
+
if (path3 && rootScope.patches_) {
|
|
2220
|
+
getPlugin("Patches").generatePatches_(
|
|
2221
|
+
state,
|
|
2222
|
+
path3,
|
|
2223
|
+
rootScope.patches_,
|
|
2224
|
+
rootScope.inversePatches_
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
return state.copy_;
|
|
2229
|
+
}
|
|
2230
|
+
function finalizeProperty(rootScope, parentState, targetObject, prop2, childValue, rootPath, targetIsSet) {
|
|
2231
|
+
if (process.env.NODE_ENV !== "production" && childValue === targetObject)
|
|
2232
|
+
die(5);
|
|
2233
|
+
if (isDraft$1(childValue)) {
|
|
2234
|
+
const path3 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
2235
|
+
!has$2(parentState.assigned_, prop2) ? rootPath.concat(prop2) : void 0;
|
|
2236
|
+
const res = finalize(rootScope, childValue, path3);
|
|
2237
|
+
set$3(targetObject, prop2, res);
|
|
2238
|
+
if (isDraft$1(res)) {
|
|
2239
|
+
rootScope.canAutoFreeze_ = false;
|
|
2240
|
+
} else
|
|
2241
|
+
return;
|
|
2242
|
+
} else if (targetIsSet) {
|
|
2243
|
+
targetObject.add(childValue);
|
|
2244
|
+
}
|
|
2245
|
+
if (isDraftable$1(childValue) && !isFrozen(childValue)) {
|
|
2246
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
finalize(rootScope, childValue);
|
|
2250
|
+
if ((!parentState || !parentState.scope_.parent_) && typeof prop2 !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop2))
|
|
2251
|
+
maybeFreeze(rootScope, childValue);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
1677
2254
|
function maybeFreeze(scope, value, deep = false) {
|
|
1678
2255
|
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
1679
2256
|
freeze$1(value, deep);
|
|
@@ -2345,21 +2922,21 @@ var Path = {
|
|
|
2345
2922
|
return p2;
|
|
2346
2923
|
}
|
|
2347
2924
|
};
|
|
2348
|
-
function _typeof$
|
|
2925
|
+
function _typeof$3(o3) {
|
|
2349
2926
|
"@babel/helpers - typeof";
|
|
2350
|
-
return _typeof$
|
|
2927
|
+
return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o4) {
|
|
2351
2928
|
return typeof o4;
|
|
2352
2929
|
} : function(o4) {
|
|
2353
2930
|
return o4 && "function" == typeof Symbol && o4.constructor === Symbol && o4 !== Symbol.prototype ? "symbol" : typeof o4;
|
|
2354
|
-
}, _typeof$
|
|
2931
|
+
}, _typeof$3(o3);
|
|
2355
2932
|
}
|
|
2356
2933
|
function _toPrimitive$4(input, hint) {
|
|
2357
|
-
if (_typeof$
|
|
2934
|
+
if (_typeof$3(input) !== "object" || input === null)
|
|
2358
2935
|
return input;
|
|
2359
2936
|
var prim = input[Symbol.toPrimitive];
|
|
2360
2937
|
if (prim !== void 0) {
|
|
2361
2938
|
var res = prim.call(input, hint || "default");
|
|
2362
|
-
if (_typeof$
|
|
2939
|
+
if (_typeof$3(res) !== "object")
|
|
2363
2940
|
return res;
|
|
2364
2941
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2365
2942
|
}
|
|
@@ -2367,7 +2944,7 @@ function _toPrimitive$4(input, hint) {
|
|
|
2367
2944
|
}
|
|
2368
2945
|
function _toPropertyKey$4(arg) {
|
|
2369
2946
|
var key = _toPrimitive$4(arg, "string");
|
|
2370
|
-
return _typeof$
|
|
2947
|
+
return _typeof$3(key) === "symbol" ? key : String(key);
|
|
2371
2948
|
}
|
|
2372
2949
|
function _defineProperty$5(obj, key, value) {
|
|
2373
2950
|
key = _toPropertyKey$4(key);
|
|
@@ -7697,21 +8274,21 @@ typeof navigator !== "undefined" && /Safari/.test(navigator.userAgent) && /Versi
|
|
|
7697
8274
|
var HAS_BEFORE_INPUT_SUPPORT = (!IS_CHROME_LEGACY || !IS_ANDROID_CHROME_LEGACY) && !IS_EDGE_LEGACY && // globalThis is undefined in older browsers
|
|
7698
8275
|
typeof globalThis !== "undefined" && globalThis.InputEvent && // @ts-ignore The `getTargetRanges` property isn't recognized.
|
|
7699
8276
|
typeof globalThis.InputEvent.prototype.getTargetRanges === "function";
|
|
7700
|
-
function _typeof$
|
|
8277
|
+
function _typeof$2(o3) {
|
|
7701
8278
|
"@babel/helpers - typeof";
|
|
7702
|
-
return _typeof$
|
|
8279
|
+
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o4) {
|
|
7703
8280
|
return typeof o4;
|
|
7704
8281
|
} : function(o4) {
|
|
7705
8282
|
return o4 && "function" == typeof Symbol && o4.constructor === Symbol && o4 !== Symbol.prototype ? "symbol" : typeof o4;
|
|
7706
|
-
}, _typeof$
|
|
8283
|
+
}, _typeof$2(o3);
|
|
7707
8284
|
}
|
|
7708
8285
|
function _toPrimitive$3(input, hint) {
|
|
7709
|
-
if (_typeof$
|
|
8286
|
+
if (_typeof$2(input) !== "object" || input === null)
|
|
7710
8287
|
return input;
|
|
7711
8288
|
var prim = input[Symbol.toPrimitive];
|
|
7712
8289
|
if (prim !== void 0) {
|
|
7713
8290
|
var res = prim.call(input, hint || "default");
|
|
7714
|
-
if (_typeof$
|
|
8291
|
+
if (_typeof$2(res) !== "object")
|
|
7715
8292
|
return res;
|
|
7716
8293
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7717
8294
|
}
|
|
@@ -7719,7 +8296,7 @@ function _toPrimitive$3(input, hint) {
|
|
|
7719
8296
|
}
|
|
7720
8297
|
function _toPropertyKey$3(arg) {
|
|
7721
8298
|
var key = _toPrimitive$3(arg, "string");
|
|
7722
|
-
return _typeof$
|
|
8299
|
+
return _typeof$2(key) === "symbol" ? key : String(key);
|
|
7723
8300
|
}
|
|
7724
8301
|
function _defineProperty$4(obj, key, value) {
|
|
7725
8302
|
key = _toPropertyKey$3(key);
|
|
@@ -9640,21 +10217,21 @@ function _objectWithoutProperties$1(source2, excluded) {
|
|
|
9640
10217
|
}
|
|
9641
10218
|
return target;
|
|
9642
10219
|
}
|
|
9643
|
-
function _typeof$
|
|
10220
|
+
function _typeof$1(o3) {
|
|
9644
10221
|
"@babel/helpers - typeof";
|
|
9645
|
-
return _typeof$
|
|
10222
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o4) {
|
|
9646
10223
|
return typeof o4;
|
|
9647
10224
|
} : function(o4) {
|
|
9648
10225
|
return o4 && "function" == typeof Symbol && o4.constructor === Symbol && o4 !== Symbol.prototype ? "symbol" : typeof o4;
|
|
9649
|
-
}, _typeof$
|
|
10226
|
+
}, _typeof$1(o3);
|
|
9650
10227
|
}
|
|
9651
10228
|
function _toPrimitive$2(input, hint) {
|
|
9652
|
-
if (_typeof$
|
|
10229
|
+
if (_typeof$1(input) !== "object" || input === null)
|
|
9653
10230
|
return input;
|
|
9654
10231
|
var prim = input[Symbol.toPrimitive];
|
|
9655
10232
|
if (prim !== void 0) {
|
|
9656
10233
|
var res = prim.call(input, hint || "default");
|
|
9657
|
-
if (_typeof$
|
|
10234
|
+
if (_typeof$1(res) !== "object")
|
|
9658
10235
|
return res;
|
|
9659
10236
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
9660
10237
|
}
|
|
@@ -9662,7 +10239,7 @@ function _toPrimitive$2(input, hint) {
|
|
|
9662
10239
|
}
|
|
9663
10240
|
function _toPropertyKey$2(arg) {
|
|
9664
10241
|
var key = _toPrimitive$2(arg, "string");
|
|
9665
|
-
return _typeof$
|
|
10242
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
9666
10243
|
}
|
|
9667
10244
|
function _defineProperty$3(obj, key, value) {
|
|
9668
10245
|
key = _toPropertyKey$2(key);
|
|
@@ -19131,7 +19708,7 @@ var isBlock = (editor, value) => ElementApi.isElement(value) && isBlock$1(editor
|
|
|
19131
19708
|
function castArray2(value) {
|
|
19132
19709
|
return Array.isArray(value) ? value : [value];
|
|
19133
19710
|
}
|
|
19134
|
-
var match$
|
|
19711
|
+
var match$1 = (obj, path22, predicate) => {
|
|
19135
19712
|
if (!predicate)
|
|
19136
19713
|
return true;
|
|
19137
19714
|
if (typeof predicate === "object") {
|
|
@@ -19167,7 +19744,7 @@ var getMatch = (editor, { id: id2, block: block2, empty, match: matchObjOrFn, te
|
|
|
19167
19744
|
}
|
|
19168
19745
|
if (typeof matchObjOrFn === "object") {
|
|
19169
19746
|
hasMatch = true;
|
|
19170
|
-
matchFn = combineMatch(matchFn, (n2, p2) => match$
|
|
19747
|
+
matchFn = combineMatch(matchFn, (n2, p2) => match$1(n2, p2, matchObjOrFn));
|
|
19171
19748
|
} else if (typeof matchObjOrFn === "function") {
|
|
19172
19749
|
hasMatch = true;
|
|
19173
19750
|
matchFn = combineMatch(matchFn, matchObjOrFn);
|
|
@@ -19384,7 +19961,7 @@ var descendant = (editor, options) => {
|
|
|
19384
19961
|
pass: ([n2]) => voids ? false : editor.api.isVoid(n2)
|
|
19385
19962
|
});
|
|
19386
19963
|
for (const [node22, path22] of nodeEntries) {
|
|
19387
|
-
if (match$
|
|
19964
|
+
if (match$1(node22, path22, _match)) {
|
|
19388
19965
|
return [node22, at2.concat(path22)];
|
|
19389
19966
|
}
|
|
19390
19967
|
}
|
|
@@ -19623,10 +20200,10 @@ function e2(e3, r2) {
|
|
|
19623
20200
|
a2.scroll({ top: t2, left: o3, behavior: l2 });
|
|
19624
20201
|
}
|
|
19625
20202
|
}
|
|
19626
|
-
var defaultOptions
|
|
20203
|
+
var defaultOptions = {
|
|
19627
20204
|
scrollMode: "if-needed"
|
|
19628
20205
|
};
|
|
19629
|
-
function scrollIntoView(editor, target, options = defaultOptions
|
|
20206
|
+
function scrollIntoView(editor, target, options = defaultOptions) {
|
|
19630
20207
|
requestAnimationFrame(() => {
|
|
19631
20208
|
let domRange;
|
|
19632
20209
|
if (PointApi.isPoint(target)) {
|
|
@@ -21686,21 +22263,21 @@ function omitBy(object, predicate) {
|
|
|
21686
22263
|
}
|
|
21687
22264
|
var omitBy_1 = omitBy;
|
|
21688
22265
|
const omitBy$1 = /* @__PURE__ */ getDefaultExportFromCjs(omitBy_1);
|
|
21689
|
-
function _typeof
|
|
22266
|
+
function _typeof(o3) {
|
|
21690
22267
|
"@babel/helpers - typeof";
|
|
21691
|
-
return _typeof
|
|
22268
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o4) {
|
|
21692
22269
|
return typeof o4;
|
|
21693
22270
|
} : function(o4) {
|
|
21694
22271
|
return o4 && "function" == typeof Symbol && o4.constructor === Symbol && o4 !== Symbol.prototype ? "symbol" : typeof o4;
|
|
21695
|
-
}, _typeof
|
|
22272
|
+
}, _typeof(o3);
|
|
21696
22273
|
}
|
|
21697
22274
|
function _toPrimitive$1(input, hint) {
|
|
21698
|
-
if (_typeof
|
|
22275
|
+
if (_typeof(input) !== "object" || input === null)
|
|
21699
22276
|
return input;
|
|
21700
22277
|
var prim = input[Symbol.toPrimitive];
|
|
21701
22278
|
if (prim !== void 0) {
|
|
21702
22279
|
var res = prim.call(input, hint || "default");
|
|
21703
|
-
if (_typeof
|
|
22280
|
+
if (_typeof(res) !== "object")
|
|
21704
22281
|
return res;
|
|
21705
22282
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
21706
22283
|
}
|
|
@@ -21708,7 +22285,7 @@ function _toPrimitive$1(input, hint) {
|
|
|
21708
22285
|
}
|
|
21709
22286
|
function _toPropertyKey$1(arg) {
|
|
21710
22287
|
var key = _toPrimitive$1(arg, "string");
|
|
21711
|
-
return _typeof
|
|
22288
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
21712
22289
|
}
|
|
21713
22290
|
function _defineProperty$1(obj, key, value) {
|
|
21714
22291
|
key = _toPropertyKey$1(key);
|
|
@@ -28659,7 +29236,7 @@ var getTodoListItemEntry = (editor, { at: at2 = editor.selection } = {}) => {
|
|
|
28659
29236
|
}
|
|
28660
29237
|
}
|
|
28661
29238
|
};
|
|
28662
|
-
var hasListChild = (editor, node3) => node3.children.some((n2) => match$
|
|
29239
|
+
var hasListChild = (editor, node3) => node3.children.some((n2) => match$2(n2, [], { type: getListTypes(editor) }));
|
|
28663
29240
|
var isAcrossListItems = (editor, at2 = editor.selection) => {
|
|
28664
29241
|
if (!at2 || RangeApi$1.isCollapsed(at2)) {
|
|
28665
29242
|
return false;
|
|
@@ -28685,7 +29262,7 @@ var moveListItemDown = (editor, { list, listItem }) => {
|
|
|
28685
29262
|
if (previousSiblingItem) {
|
|
28686
29263
|
const [previousNode, previousPath] = previousSiblingItem;
|
|
28687
29264
|
const sublist = previousNode.children.find(
|
|
28688
|
-
(n2) => match$
|
|
29265
|
+
(n2) => match$2(n2, [], { type: getListTypes(editor) })
|
|
28689
29266
|
);
|
|
28690
29267
|
const newPath = previousPath.concat(
|
|
28691
29268
|
sublist ? [1, sublist.children.length] : [1]
|
|
@@ -29764,10 +30341,10 @@ var normalizeListItem = (editor, {
|
|
|
29764
30341
|
);
|
|
29765
30342
|
return true;
|
|
29766
30343
|
}
|
|
29767
|
-
if (editor.api.isBlock(firstLiChildNode) && !match$
|
|
30344
|
+
if (editor.api.isBlock(firstLiChildNode) && !match$2(firstLiChildNode, [], {
|
|
29768
30345
|
type: editor.getType(BaseListItemContentPlugin)
|
|
29769
30346
|
})) {
|
|
29770
|
-
if (match$
|
|
30347
|
+
if (match$2(firstLiChildNode, [], {
|
|
29771
30348
|
type: getListTypes(editor)
|
|
29772
30349
|
})) {
|
|
29773
30350
|
const parent3 = editor.api.parent(listItem[1]);
|
|
@@ -29843,7 +30420,7 @@ var normalizeListItem = (editor, {
|
|
|
29843
30420
|
var normalizeNestedList = (editor, { nestedListItem }) => {
|
|
29844
30421
|
const [, path3] = nestedListItem;
|
|
29845
30422
|
const parentNode = editor.api.parent(path3);
|
|
29846
|
-
const hasParentList = parentNode && match$
|
|
30423
|
+
const hasParentList = parentNode && match$2(parentNode[0], [], { type: getListTypes(editor) });
|
|
29847
30424
|
if (!hasParentList) {
|
|
29848
30425
|
return false;
|
|
29849
30426
|
}
|
|
@@ -29887,7 +30464,7 @@ var withNormalizeList = ({
|
|
|
29887
30464
|
);
|
|
29888
30465
|
}
|
|
29889
30466
|
}
|
|
29890
|
-
if (match$
|
|
30467
|
+
if (match$2(node3, [], { type: getListTypes(editor) })) {
|
|
29891
30468
|
if (node3.children.length === 0 || !node3.children.some((item) => item.type === liType)) {
|
|
29892
30469
|
return editor.tf.removeNodes({ at: path3 });
|
|
29893
30470
|
}
|
|
@@ -37354,831 +37931,310 @@ const TableFloatingToolbar = withRef$1(
|
|
|
37354
37931
|
/* @__PURE__ */ React__default.createElement(ArrowRight, null)
|
|
37355
37932
|
), /* @__PURE__ */ React__default.createElement(
|
|
37356
37933
|
ToolbarButton,
|
|
37357
|
-
{
|
|
37358
|
-
onClick: () => {
|
|
37359
|
-
tf.remove.tableColumn();
|
|
37360
|
-
},
|
|
37361
|
-
onMouseDown: (e3) => e3.preventDefault(),
|
|
37362
|
-
tooltip: "Delete column"
|
|
37363
|
-
},
|
|
37364
|
-
/* @__PURE__ */ React__default.createElement(XIcon, null)
|
|
37365
|
-
))
|
|
37366
|
-
)
|
|
37367
|
-
));
|
|
37368
|
-
}
|
|
37369
|
-
);
|
|
37370
|
-
const TableBordersDropdownMenuContent = withRef$1((props, ref) => {
|
|
37371
|
-
const editor = useEditorRef();
|
|
37372
|
-
const {
|
|
37373
|
-
getOnSelectTableBorder,
|
|
37374
|
-
hasBottomBorder,
|
|
37375
|
-
hasLeftBorder,
|
|
37376
|
-
hasNoBorders,
|
|
37377
|
-
hasOuterBorders,
|
|
37378
|
-
hasRightBorder,
|
|
37379
|
-
hasTopBorder
|
|
37380
|
-
} = useTableBordersDropdownMenuContentState();
|
|
37381
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
37382
|
-
DropdownMenuContent$1,
|
|
37383
|
-
{
|
|
37384
|
-
ref,
|
|
37385
|
-
className: cn$2("min-w-[220px]"),
|
|
37386
|
-
onCloseAutoFocus: (e3) => {
|
|
37387
|
-
e3.preventDefault();
|
|
37388
|
-
editor.tf.focus();
|
|
37389
|
-
},
|
|
37390
|
-
align: "start",
|
|
37391
|
-
side: "right",
|
|
37392
|
-
sideOffset: 0,
|
|
37393
|
-
...props
|
|
37394
|
-
},
|
|
37395
|
-
/* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(
|
|
37396
|
-
DropdownMenuCheckboxItem,
|
|
37397
|
-
{
|
|
37398
|
-
checked: hasTopBorder,
|
|
37399
|
-
onCheckedChange: getOnSelectTableBorder("top")
|
|
37400
|
-
},
|
|
37401
|
-
/* @__PURE__ */ React__default.createElement("div", null, "Top Border")
|
|
37402
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
37403
|
-
DropdownMenuCheckboxItem,
|
|
37404
|
-
{
|
|
37405
|
-
checked: hasRightBorder,
|
|
37406
|
-
onCheckedChange: getOnSelectTableBorder("right")
|
|
37407
|
-
},
|
|
37408
|
-
/* @__PURE__ */ React__default.createElement("div", null, "Right Border")
|
|
37409
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
37410
|
-
DropdownMenuCheckboxItem,
|
|
37411
|
-
{
|
|
37412
|
-
checked: hasBottomBorder,
|
|
37413
|
-
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
37414
|
-
},
|
|
37415
|
-
/* @__PURE__ */ React__default.createElement("div", null, "Bottom Border")
|
|
37416
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
37417
|
-
DropdownMenuCheckboxItem,
|
|
37418
|
-
{
|
|
37419
|
-
checked: hasLeftBorder,
|
|
37420
|
-
onCheckedChange: getOnSelectTableBorder("left")
|
|
37421
|
-
},
|
|
37422
|
-
/* @__PURE__ */ React__default.createElement("div", null, "Left Border")
|
|
37423
|
-
)),
|
|
37424
|
-
/* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(
|
|
37425
|
-
DropdownMenuCheckboxItem,
|
|
37426
|
-
{
|
|
37427
|
-
checked: hasNoBorders,
|
|
37428
|
-
onCheckedChange: getOnSelectTableBorder("none")
|
|
37429
|
-
},
|
|
37430
|
-
/* @__PURE__ */ React__default.createElement("div", null, "No Border")
|
|
37431
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
37432
|
-
DropdownMenuCheckboxItem,
|
|
37433
|
-
{
|
|
37434
|
-
checked: hasOuterBorders,
|
|
37435
|
-
onCheckedChange: getOnSelectTableBorder("outer")
|
|
37436
|
-
},
|
|
37437
|
-
/* @__PURE__ */ React__default.createElement("div", null, "Outside Borders")
|
|
37438
|
-
))
|
|
37439
|
-
);
|
|
37440
|
-
});
|
|
37441
|
-
function ColorDropdownMenu({ children, tooltip }) {
|
|
37442
|
-
const [open, setOpen] = useState(false);
|
|
37443
|
-
const editor = useEditorRef();
|
|
37444
|
-
const selectedCells = usePluginOption(TablePlugin, "selectedCells");
|
|
37445
|
-
useCallback(
|
|
37446
|
-
(color) => {
|
|
37447
|
-
setOpen(false);
|
|
37448
|
-
setCellBackground(editor, { color, selectedCells: selectedCells ?? [] });
|
|
37449
|
-
},
|
|
37450
|
-
[selectedCells, editor]
|
|
37451
|
-
);
|
|
37452
|
-
const onClearColor = useCallback(() => {
|
|
37453
|
-
setOpen(false);
|
|
37454
|
-
setCellBackground(editor, {
|
|
37455
|
-
color: null,
|
|
37456
|
-
selectedCells: selectedCells ?? []
|
|
37457
|
-
});
|
|
37458
|
-
}, [selectedCells, editor]);
|
|
37459
|
-
return /* @__PURE__ */ React__default.createElement(DropdownMenu$1, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger$1, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { tooltip }, children)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent$1, { align: "start" }, /* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(DropdownMenuItem$1, { className: "p-2", onClick: onClearColor }, /* @__PURE__ */ React__default.createElement(EraserIcon, null), /* @__PURE__ */ React__default.createElement("span", null, "Clear")))));
|
|
37460
|
-
}
|
|
37461
|
-
const TableRowElement = withRef$1(
|
|
37462
|
-
({ children, className, ...props }, ref) => {
|
|
37463
|
-
const selected = useSelected();
|
|
37464
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
37465
|
-
PlateElement,
|
|
37466
|
-
{
|
|
37467
|
-
as: "tr",
|
|
37468
|
-
className: cn$2(className, "group/row"),
|
|
37469
|
-
"data-selected": selected ? "true" : void 0,
|
|
37470
|
-
...props
|
|
37471
|
-
},
|
|
37472
|
-
children
|
|
37473
|
-
);
|
|
37474
|
-
}
|
|
37475
|
-
);
|
|
37476
|
-
function classNames$1(...classes) {
|
|
37477
|
-
return classes.filter(Boolean).join(" ");
|
|
37478
|
-
}
|
|
37479
|
-
const uuid = () => {
|
|
37480
|
-
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(
|
|
37481
|
-
/[018]/g,
|
|
37482
|
-
(c2) => (c2 ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c2 / 4).toString(16)
|
|
37483
|
-
);
|
|
37484
|
-
};
|
|
37485
|
-
const blockClasses = "mt-0.5";
|
|
37486
|
-
const headerClasses = "font-normal";
|
|
37487
|
-
const Components = () => {
|
|
37488
|
-
return {
|
|
37489
|
-
[SlashInputPlugin.key]: SlashInputElement,
|
|
37490
|
-
[HEADING_KEYS$1.h1]: ({
|
|
37491
|
-
attributes,
|
|
37492
|
-
editor,
|
|
37493
|
-
element,
|
|
37494
|
-
className,
|
|
37495
|
-
...props
|
|
37496
|
-
}) => /* @__PURE__ */ React__default.createElement(
|
|
37497
|
-
"h1",
|
|
37498
|
-
{
|
|
37499
|
-
...attributes,
|
|
37500
|
-
...props,
|
|
37501
|
-
className: classNames$1(
|
|
37502
|
-
headerClasses,
|
|
37503
|
-
blockClasses,
|
|
37504
|
-
className,
|
|
37505
|
-
"text-4xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
37506
|
-
)
|
|
37507
|
-
}
|
|
37508
|
-
),
|
|
37509
|
-
[HEADING_KEYS$1.h2]: ({
|
|
37510
|
-
attributes,
|
|
37511
|
-
editor,
|
|
37512
|
-
element,
|
|
37513
|
-
className,
|
|
37514
|
-
...props
|
|
37515
|
-
}) => /* @__PURE__ */ React__default.createElement(
|
|
37516
|
-
"h2",
|
|
37517
|
-
{
|
|
37518
|
-
...attributes,
|
|
37519
|
-
...props,
|
|
37520
|
-
className: classNames$1(
|
|
37521
|
-
headerClasses,
|
|
37522
|
-
blockClasses,
|
|
37523
|
-
className,
|
|
37524
|
-
"text-3xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
37525
|
-
)
|
|
37526
|
-
}
|
|
37527
|
-
),
|
|
37528
|
-
[HEADING_KEYS$1.h3]: ({
|
|
37529
|
-
attributes,
|
|
37530
|
-
editor,
|
|
37531
|
-
element,
|
|
37532
|
-
className,
|
|
37533
|
-
...props
|
|
37534
|
-
}) => /* @__PURE__ */ React__default.createElement(
|
|
37535
|
-
"h3",
|
|
37536
|
-
{
|
|
37537
|
-
...attributes,
|
|
37538
|
-
...props,
|
|
37539
|
-
className: classNames$1(
|
|
37540
|
-
headerClasses,
|
|
37541
|
-
blockClasses,
|
|
37542
|
-
className,
|
|
37543
|
-
"text-2xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
37544
|
-
)
|
|
37545
|
-
}
|
|
37546
|
-
),
|
|
37547
|
-
[HEADING_KEYS$1.h4]: ({
|
|
37548
|
-
attributes,
|
|
37549
|
-
editor,
|
|
37550
|
-
element,
|
|
37551
|
-
className,
|
|
37552
|
-
...props
|
|
37553
|
-
}) => /* @__PURE__ */ React__default.createElement(
|
|
37554
|
-
"h4",
|
|
37555
|
-
{
|
|
37556
|
-
...attributes,
|
|
37557
|
-
...props,
|
|
37558
|
-
className: classNames$1(
|
|
37559
|
-
headerClasses,
|
|
37560
|
-
blockClasses,
|
|
37561
|
-
className,
|
|
37562
|
-
"text-xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
37563
|
-
)
|
|
37564
|
-
}
|
|
37565
|
-
),
|
|
37566
|
-
/** Tailwind prose doesn't style h5 and h6 elements */
|
|
37567
|
-
[HEADING_KEYS$1.h5]: ({
|
|
37568
|
-
attributes,
|
|
37569
|
-
editor,
|
|
37570
|
-
element,
|
|
37571
|
-
className,
|
|
37572
|
-
...props
|
|
37573
|
-
}) => /* @__PURE__ */ React__default.createElement(
|
|
37574
|
-
"h5",
|
|
37575
|
-
{
|
|
37576
|
-
...attributes,
|
|
37577
|
-
...props,
|
|
37578
|
-
className: classNames$1(
|
|
37579
|
-
headerClasses,
|
|
37580
|
-
blockClasses,
|
|
37581
|
-
className,
|
|
37582
|
-
"text-lg mb-4 last:mb-0 mt-6 first:mt-0"
|
|
37583
|
-
),
|
|
37584
|
-
style: { fontFamily: "'Libre Baskerville', serif", fontWeight: "400" }
|
|
37585
|
-
}
|
|
37586
|
-
),
|
|
37587
|
-
[HEADING_KEYS$1.h6]: ({
|
|
37588
|
-
attributes,
|
|
37589
|
-
editor,
|
|
37590
|
-
element,
|
|
37591
|
-
className,
|
|
37592
|
-
...props
|
|
37593
|
-
}) => /* @__PURE__ */ React__default.createElement(
|
|
37594
|
-
"h6",
|
|
37595
|
-
{
|
|
37596
|
-
...attributes,
|
|
37597
|
-
...props,
|
|
37598
|
-
className: classNames$1(
|
|
37599
|
-
headerClasses,
|
|
37600
|
-
blockClasses,
|
|
37601
|
-
className,
|
|
37602
|
-
"text-base mb-4 last:mb-0 mt-6 first:mt-0"
|
|
37603
|
-
),
|
|
37604
|
-
style: { fontFamily: "'Libre Baskerville', serif", fontWeight: "400" }
|
|
37605
|
-
}
|
|
37606
|
-
),
|
|
37607
|
-
[ParagraphPlugin.key]: ParagraphElement,
|
|
37608
|
-
[BlockquotePlugin.key]: BlockquoteElement,
|
|
37609
|
-
[CodeBlockPlugin.key]: CodeBlockElement,
|
|
37610
|
-
[CodeLinePlugin.key]: CodeLineElement,
|
|
37611
|
-
[CodeSyntaxPlugin.key]: CodeSyntaxLeaf,
|
|
37612
|
-
html: ({ attributes, editor, element, children, className }) => {
|
|
37613
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
37614
|
-
"div",
|
|
37615
|
-
{
|
|
37616
|
-
...attributes,
|
|
37617
|
-
className: classNames$1(
|
|
37618
|
-
"font-mono text-sm bg-green-100 cursor-not-allowed mb-4",
|
|
37619
|
-
className
|
|
37620
|
-
)
|
|
37621
|
-
},
|
|
37622
|
-
children,
|
|
37623
|
-
element.value
|
|
37624
|
-
);
|
|
37625
|
-
},
|
|
37626
|
-
html_inline: ({ attributes, editor, element, children, className }) => {
|
|
37627
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
37628
|
-
"span",
|
|
37629
|
-
{
|
|
37630
|
-
...attributes,
|
|
37631
|
-
className: classNames$1(
|
|
37632
|
-
"font-mono bg-green-100 cursor-not-allowed",
|
|
37633
|
-
className
|
|
37634
|
-
)
|
|
37635
|
-
},
|
|
37636
|
-
children,
|
|
37637
|
-
element.value
|
|
37638
|
-
);
|
|
37639
|
-
},
|
|
37640
|
-
[BulletedListPlugin.key]: withProps(ListElement, { variant: "ul" }),
|
|
37641
|
-
[NumberedListPlugin.key]: withProps(ListElement, { variant: "ol" }),
|
|
37642
|
-
[ListItemPlugin.key]: withProps(PlateElement, { as: "li" }),
|
|
37643
|
-
[LinkPlugin.key]: LinkElement,
|
|
37644
|
-
[CodePlugin.key]: CodeLeaf,
|
|
37645
|
-
[UnderlinePlugin.key]: withProps(PlateLeaf, { as: "u" }),
|
|
37646
|
-
[StrikethroughPlugin.key]: withProps(PlateLeaf, { as: "s" }),
|
|
37647
|
-
[ItalicPlugin.key]: withProps(PlateLeaf, { as: "em" }),
|
|
37648
|
-
[BoldPlugin.key]: withProps(PlateLeaf, { as: "strong" }),
|
|
37649
|
-
[HorizontalRulePlugin.key]: HrElement,
|
|
37650
|
-
[TableCellHeaderPlugin.key]: TableCellHeaderElement,
|
|
37651
|
-
[TableCellPlugin.key]: TableCellElement,
|
|
37652
|
-
[TablePlugin.key]: TableElement,
|
|
37653
|
-
[TableRowPlugin.key]: TableRowElement
|
|
37654
|
-
};
|
|
37655
|
-
};
|
|
37656
|
-
class Form {
|
|
37657
|
-
constructor({
|
|
37658
|
-
id: id2,
|
|
37659
|
-
label,
|
|
37660
|
-
fields,
|
|
37661
|
-
actions,
|
|
37662
|
-
buttons,
|
|
37663
|
-
global: global2,
|
|
37664
|
-
reset: reset2,
|
|
37665
|
-
loadInitialValues,
|
|
37666
|
-
onChange,
|
|
37667
|
-
queries,
|
|
37668
|
-
...options
|
|
37669
|
-
}) {
|
|
37670
|
-
__publicField(this, "__type");
|
|
37671
|
-
__publicField(this, "id");
|
|
37672
|
-
__publicField(this, "label");
|
|
37673
|
-
__publicField(this, "fields");
|
|
37674
|
-
__publicField(this, "finalForm");
|
|
37675
|
-
__publicField(this, "actions");
|
|
37676
|
-
__publicField(this, "buttons");
|
|
37677
|
-
__publicField(this, "queries");
|
|
37678
|
-
__publicField(this, "global", null);
|
|
37679
|
-
__publicField(this, "loading", false);
|
|
37680
|
-
/**
|
|
37681
|
-
* @deprecated
|
|
37682
|
-
* Misleading name as per https://github.com/tinacms/tinacms/issues/5686#issuecomment-2899840518
|
|
37683
|
-
* Use path property instead.
|
|
37684
|
-
*/
|
|
37685
|
-
__publicField(this, "relativePath");
|
|
37686
|
-
/**
|
|
37687
|
-
* Where to save the form within the content directory on next submission.
|
|
37688
|
-
*/
|
|
37689
|
-
__publicField(this, "path");
|
|
37690
|
-
__publicField(this, "crudType");
|
|
37691
|
-
__publicField(this, "beforeSubmit");
|
|
37692
|
-
/**
|
|
37693
|
-
* Subscribes to changes to the form. The subscriber will only be called when
|
|
37694
|
-
* values specified in subscription change. A form can have many subscribers.
|
|
37695
|
-
*/
|
|
37696
|
-
__publicField(this, "subscribe", (cb, options) => {
|
|
37697
|
-
return this.finalForm.subscribe(cb, options);
|
|
37698
|
-
});
|
|
37699
|
-
__publicField(this, "onSubmit");
|
|
37700
|
-
__publicField(this, "handleSubmit", async (values, form, cb) => {
|
|
37701
|
-
var _a2;
|
|
37702
|
-
try {
|
|
37703
|
-
const valOverride = await ((_a2 = this.beforeSubmit) == null ? void 0 : _a2.call(this, values));
|
|
37704
|
-
if (valOverride) {
|
|
37705
|
-
for (const [key, value] of Object.entries(valOverride)) {
|
|
37706
|
-
form.change(key, value);
|
|
37707
|
-
}
|
|
37708
|
-
}
|
|
37709
|
-
const response = await this.onSubmit(valOverride || values, form, cb);
|
|
37710
|
-
form.initialize(values);
|
|
37711
|
-
return response;
|
|
37712
|
-
} catch (error2) {
|
|
37713
|
-
return { [FORM_ERROR]: error2 };
|
|
37714
|
-
}
|
|
37715
|
-
});
|
|
37716
|
-
/**
|
|
37717
|
-
* Submits the form if there are currently no validation errors. It may
|
|
37718
|
-
* return undefined or a Promise depending on the nature of the onSubmit
|
|
37719
|
-
* configuration value given to the form when it was created.
|
|
37720
|
-
*/
|
|
37721
|
-
__publicField(this, "submit", () => {
|
|
37722
|
-
return this.finalForm.submit();
|
|
37723
|
-
});
|
|
37724
|
-
const initialValues = options.initialValues || {};
|
|
37725
|
-
this.__type = options.__type || "form";
|
|
37726
|
-
this.id = id2;
|
|
37727
|
-
this.label = label;
|
|
37728
|
-
this.global = global2;
|
|
37729
|
-
this.fields = fields || [];
|
|
37730
|
-
this.onSubmit = options.onSubmit;
|
|
37731
|
-
this.queries = queries || [];
|
|
37732
|
-
this.crudType = options.crudType || "update";
|
|
37733
|
-
this.relativePath = options.relativePath || id2;
|
|
37734
|
-
this.path = options.path || id2;
|
|
37735
|
-
this.finalForm = createForm({
|
|
37736
|
-
...options,
|
|
37737
|
-
initialValues,
|
|
37738
|
-
onSubmit: this.handleSubmit,
|
|
37739
|
-
mutators: {
|
|
37740
|
-
...arrayMutators,
|
|
37741
|
-
setFieldData,
|
|
37742
|
-
...options.mutators
|
|
37743
|
-
}
|
|
37744
|
-
});
|
|
37745
|
-
this._reset = reset2;
|
|
37746
|
-
this.actions = actions || [];
|
|
37747
|
-
this.buttons = buttons || {
|
|
37748
|
-
save: "Save",
|
|
37749
|
-
reset: "Reset"
|
|
37750
|
-
};
|
|
37751
|
-
this.updateFields(this.fields);
|
|
37752
|
-
if (loadInitialValues) {
|
|
37753
|
-
this.loading = true;
|
|
37754
|
-
loadInitialValues().then((initialValues2) => {
|
|
37755
|
-
this.updateInitialValues(initialValues2);
|
|
37756
|
-
}).finally(() => {
|
|
37757
|
-
this.loading = false;
|
|
37758
|
-
});
|
|
37759
|
-
}
|
|
37760
|
-
if (onChange) {
|
|
37761
|
-
let firstUpdate = true;
|
|
37762
|
-
this.subscribe(
|
|
37763
|
-
(formState) => {
|
|
37764
|
-
if (firstUpdate) {
|
|
37765
|
-
firstUpdate = false;
|
|
37766
|
-
} else {
|
|
37767
|
-
onChange(formState);
|
|
37768
|
-
}
|
|
37769
|
-
},
|
|
37770
|
-
{ values: true, ...(options == null ? void 0 : options.extraSubscribeValues) || {} }
|
|
37771
|
-
);
|
|
37772
|
-
}
|
|
37773
|
-
}
|
|
37774
|
-
/**
|
|
37775
|
-
* A unique identifier for Forms.
|
|
37776
|
-
*
|
|
37777
|
-
* @deprecated use id instead
|
|
37778
|
-
*/
|
|
37779
|
-
get name() {
|
|
37780
|
-
return void 0;
|
|
37781
|
-
}
|
|
37782
|
-
/**
|
|
37783
|
-
* Returns the current values of the form.
|
|
37784
|
-
*
|
|
37785
|
-
* if the form is still loading it returns `undefined`.
|
|
37786
|
-
*/
|
|
37787
|
-
get values() {
|
|
37788
|
-
if (this.loading) {
|
|
37789
|
-
return void 0;
|
|
37790
|
-
}
|
|
37791
|
-
return this.finalForm.getState().values || this.initialValues;
|
|
37792
|
-
}
|
|
37793
|
-
/**
|
|
37794
|
-
* The values the form was initialized with.
|
|
37795
|
-
*/
|
|
37796
|
-
get initialValues() {
|
|
37797
|
-
return this.finalForm.getState().initialValues;
|
|
37798
|
-
}
|
|
37799
|
-
get pristine() {
|
|
37800
|
-
return this.finalForm.getState().pristine;
|
|
37801
|
-
}
|
|
37802
|
-
get dirty() {
|
|
37803
|
-
return this.finalForm.getState().dirty;
|
|
37804
|
-
}
|
|
37805
|
-
get submitting() {
|
|
37806
|
-
return this.finalForm.getState().submitting;
|
|
37807
|
-
}
|
|
37808
|
-
get valid() {
|
|
37809
|
-
return this.finalForm.getState().valid;
|
|
37810
|
-
}
|
|
37811
|
-
/**
|
|
37812
|
-
* Resets the values back to the initial values the form was initialized with.
|
|
37813
|
-
* Or empties all the values if the form was not initialized.
|
|
37814
|
-
*/
|
|
37815
|
-
async reset() {
|
|
37816
|
-
if (this._reset) {
|
|
37817
|
-
await this._reset();
|
|
37818
|
-
}
|
|
37819
|
-
this.finalForm.reset();
|
|
37820
|
-
}
|
|
37821
|
-
/**
|
|
37822
|
-
* @deprecated Unnecessary indirection
|
|
37823
|
-
*/
|
|
37824
|
-
updateFields(fields) {
|
|
37825
|
-
this.fields = fields;
|
|
37826
|
-
}
|
|
37827
|
-
/**
|
|
37828
|
-
* Changes the value of the given field.
|
|
37829
|
-
*
|
|
37830
|
-
* @param name
|
|
37831
|
-
* @param value
|
|
37832
|
-
*/
|
|
37833
|
-
change(name, value) {
|
|
37834
|
-
return this.finalForm.change(name, value);
|
|
37835
|
-
}
|
|
37836
|
-
get mutators() {
|
|
37837
|
-
return this.finalForm.mutators;
|
|
37838
|
-
}
|
|
37839
|
-
addQuery(queryId) {
|
|
37840
|
-
this.queries = [...this.queries.filter((id2) => id2 !== queryId), queryId];
|
|
37841
|
-
}
|
|
37842
|
-
removeQuery(queryId) {
|
|
37843
|
-
this.queries = this.queries.filter((id2) => id2 !== queryId);
|
|
37844
|
-
}
|
|
37845
|
-
/**
|
|
37846
|
-
* Updates multiple fields in the form.
|
|
37847
|
-
*
|
|
37848
|
-
* The updates are batched so that it only triggers one `onChange` event.
|
|
37849
|
-
*
|
|
37850
|
-
* In order to prevent disruptions to the user's editing experience this
|
|
37851
|
-
* function will _not_ update the value of any field that is currently
|
|
37852
|
-
* being edited.
|
|
37853
|
-
*
|
|
37854
|
-
* @param values
|
|
37855
|
-
*/
|
|
37856
|
-
updateValues(values) {
|
|
37857
|
-
this.finalForm.batch(() => {
|
|
37858
|
-
const activePath = this.finalForm.getState().active;
|
|
37859
|
-
if (!activePath) {
|
|
37860
|
-
updateEverything(this.finalForm, values);
|
|
37861
|
-
} else {
|
|
37862
|
-
updateSelectively(this.finalForm, values);
|
|
37863
|
-
}
|
|
37864
|
-
});
|
|
37865
|
-
}
|
|
37866
|
-
/**
|
|
37867
|
-
* Replaces the initialValues of the form without deleting the current values.
|
|
37868
|
-
*
|
|
37869
|
-
* This function is helpful when the initialValues are loaded asynchronously.
|
|
37870
|
-
*
|
|
37871
|
-
* @param initialValues
|
|
37872
|
-
*/
|
|
37873
|
-
updateInitialValues(initialValues) {
|
|
37874
|
-
this.finalForm.batch(() => {
|
|
37875
|
-
const values = this.values || {};
|
|
37876
|
-
this.finalForm.initialize(initialValues);
|
|
37877
|
-
const activePath = this.finalForm.getState().active;
|
|
37878
|
-
if (!activePath) {
|
|
37879
|
-
updateEverything(this.finalForm, values);
|
|
37880
|
-
} else {
|
|
37881
|
-
updateSelectively(this.finalForm, values);
|
|
37882
|
-
}
|
|
37883
|
-
});
|
|
37884
|
-
}
|
|
37885
|
-
/**
|
|
37886
|
-
* Based on field's name this function will
|
|
37887
|
-
* return an array of fields for the give form along
|
|
37888
|
-
* with the path that it was found at top nearest
|
|
37889
|
-
* object-like group
|
|
37890
|
-
*
|
|
37891
|
-
* So if you have a field named blocks.3.title
|
|
37892
|
-
* It will return the fields from the 3rd "block"
|
|
37893
|
-
* along with the path it was found at
|
|
37894
|
-
* fields: [{type: 'string', name: 'title'}, ... other fields]
|
|
37895
|
-
* activePath: ['blocks', '3']
|
|
37896
|
-
*/
|
|
37897
|
-
getActiveField(fieldName) {
|
|
37898
|
-
if (!fieldName) {
|
|
37899
|
-
return this;
|
|
37900
|
-
}
|
|
37901
|
-
const result = this.getFieldGroup({
|
|
37902
|
-
formOrObjectField: this,
|
|
37903
|
-
values: this.finalForm.getState().values,
|
|
37904
|
-
namePathIndex: 0,
|
|
37905
|
-
namePath: fieldName.split(".")
|
|
37906
|
-
});
|
|
37907
|
-
return result;
|
|
37908
|
-
}
|
|
37909
|
-
getFieldGroup({
|
|
37910
|
-
formOrObjectField,
|
|
37911
|
-
values = {},
|
|
37912
|
-
namePathIndex,
|
|
37913
|
-
namePath
|
|
37914
|
-
}) {
|
|
37915
|
-
const name = namePath[namePathIndex];
|
|
37916
|
-
const field = formOrObjectField.fields.find((field2) => field2.name === name);
|
|
37917
|
-
const value = values[name];
|
|
37918
|
-
const isLastItem = namePathIndex === namePath.length - 1;
|
|
37919
|
-
if (!field) {
|
|
37920
|
-
return {
|
|
37921
|
-
...formOrObjectField,
|
|
37922
|
-
fields: formOrObjectField.fields.map((field2) => {
|
|
37923
|
-
return {
|
|
37924
|
-
...field2,
|
|
37925
|
-
name: [...namePath, field2.name].join(".")
|
|
37926
|
-
};
|
|
37927
|
-
})
|
|
37928
|
-
};
|
|
37929
|
-
} else {
|
|
37930
|
-
if (field.type === "object") {
|
|
37931
|
-
if (field.templates) {
|
|
37932
|
-
if (field.list) {
|
|
37933
|
-
if (isLastItem) {
|
|
37934
|
-
return formOrObjectField;
|
|
37935
|
-
} else {
|
|
37936
|
-
const namePathIndexForListItem = namePathIndex + 1;
|
|
37937
|
-
const index = namePath[namePathIndexForListItem];
|
|
37938
|
-
const listItemValue = value[index];
|
|
37939
|
-
const template = field.templates[listItemValue._template];
|
|
37940
|
-
const templateName = [
|
|
37941
|
-
...namePath.slice(0, namePathIndexForListItem),
|
|
37942
|
-
index
|
|
37943
|
-
].join(".");
|
|
37944
|
-
const isLastItem2 = namePathIndexForListItem === namePath.length - 1;
|
|
37945
|
-
if (!isLastItem2) {
|
|
37946
|
-
return this.getFieldGroup({
|
|
37947
|
-
formOrObjectField: template,
|
|
37948
|
-
values: listItemValue,
|
|
37949
|
-
namePath,
|
|
37950
|
-
namePathIndex: namePathIndex + 2
|
|
37951
|
-
});
|
|
37952
|
-
}
|
|
37953
|
-
if (!template) {
|
|
37954
|
-
console.error({ field, value });
|
|
37955
|
-
throw new Error(
|
|
37956
|
-
`Expected template value for field ${field.name}`
|
|
37957
|
-
);
|
|
37958
|
-
}
|
|
37959
|
-
return {
|
|
37960
|
-
...template,
|
|
37961
|
-
name: templateName,
|
|
37962
|
-
fields: template.fields.map((field2) => {
|
|
37963
|
-
return {
|
|
37964
|
-
...field2,
|
|
37965
|
-
name: [templateName, field2.name].join(".")
|
|
37966
|
-
};
|
|
37967
|
-
})
|
|
37968
|
-
};
|
|
37969
|
-
}
|
|
37970
|
-
}
|
|
37971
|
-
} else {
|
|
37972
|
-
if (field.list) {
|
|
37973
|
-
const namePathIndexForListItem = namePathIndex + 1;
|
|
37974
|
-
const index = namePath[namePathIndexForListItem];
|
|
37975
|
-
const listItemValue = value[index];
|
|
37976
|
-
const fieldName = [
|
|
37977
|
-
...namePath.slice(0, namePathIndexForListItem),
|
|
37978
|
-
index
|
|
37979
|
-
].join(".");
|
|
37980
|
-
const isLastItem2 = namePathIndexForListItem === namePath.length - 1;
|
|
37981
|
-
if (!isLastItem2) {
|
|
37982
|
-
if (field.fields) {
|
|
37983
|
-
return this.getFieldGroup({
|
|
37984
|
-
formOrObjectField: field,
|
|
37985
|
-
values: listItemValue,
|
|
37986
|
-
namePath,
|
|
37987
|
-
namePathIndex: namePathIndex + 2
|
|
37988
|
-
});
|
|
37989
|
-
}
|
|
37990
|
-
}
|
|
37991
|
-
return {
|
|
37992
|
-
...field,
|
|
37993
|
-
name: fieldName,
|
|
37994
|
-
fields: field.fields.map((field2) => {
|
|
37995
|
-
return {
|
|
37996
|
-
...field2,
|
|
37997
|
-
name: [fieldName, field2.name].join(".")
|
|
37998
|
-
};
|
|
37999
|
-
})
|
|
38000
|
-
};
|
|
38001
|
-
} else {
|
|
38002
|
-
const fieldName = [...namePath.slice(0, namePathIndex + 1)].join(
|
|
38003
|
-
"."
|
|
38004
|
-
);
|
|
38005
|
-
const isLastItem2 = namePathIndex === namePath.length - 1;
|
|
38006
|
-
if (!isLastItem2) {
|
|
38007
|
-
return this.getFieldGroup({
|
|
38008
|
-
formOrObjectField: field,
|
|
38009
|
-
values: value,
|
|
38010
|
-
namePath,
|
|
38011
|
-
namePathIndex: namePathIndex + 1
|
|
38012
|
-
});
|
|
38013
|
-
}
|
|
38014
|
-
return {
|
|
38015
|
-
...field,
|
|
38016
|
-
name: fieldName,
|
|
38017
|
-
fields: field.fields.map((field2) => {
|
|
38018
|
-
return {
|
|
38019
|
-
...field2,
|
|
38020
|
-
name: [fieldName, field2.name].join(".")
|
|
38021
|
-
};
|
|
38022
|
-
})
|
|
38023
|
-
};
|
|
38024
|
-
}
|
|
38025
|
-
}
|
|
38026
|
-
} else if (field.type === "rich-text") {
|
|
38027
|
-
if (isLastItem) {
|
|
38028
|
-
return {
|
|
38029
|
-
...formOrObjectField,
|
|
38030
|
-
fields: formOrObjectField.fields.map((field2) => {
|
|
38031
|
-
return {
|
|
38032
|
-
...field2,
|
|
38033
|
-
name: [...namePath.slice(0, namePathIndex), field2.name].join(
|
|
38034
|
-
"."
|
|
38035
|
-
)
|
|
38036
|
-
};
|
|
38037
|
-
})
|
|
38038
|
-
};
|
|
38039
|
-
} else {
|
|
38040
|
-
const childrenIndex = namePath.findIndex(
|
|
38041
|
-
(value2) => value2 === "children"
|
|
38042
|
-
);
|
|
38043
|
-
const propsIndex = namePath.slice(childrenIndex).findIndex((value2) => value2 === "props") + childrenIndex;
|
|
38044
|
-
const itemName = namePath.slice(childrenIndex, propsIndex).join(".");
|
|
38045
|
-
const item = getIn(value, itemName);
|
|
38046
|
-
const props = item.props;
|
|
38047
|
-
const templateString = item.name;
|
|
38048
|
-
const currentPathIndex = namePathIndex + Math.max(propsIndex, 3);
|
|
38049
|
-
const isLastItem2 = currentPathIndex + 1 === namePath.length;
|
|
38050
|
-
const template = field.templates.find(
|
|
38051
|
-
(t2) => t2.name === templateString
|
|
38052
|
-
);
|
|
38053
|
-
const templateName = namePath.slice(0, currentPathIndex + 2).join(".");
|
|
38054
|
-
if ((item == null ? void 0 : item.type) === "img") {
|
|
38055
|
-
const imageName = namePath.slice(0, currentPathIndex + 2).join(".");
|
|
38056
|
-
return {
|
|
38057
|
-
...formOrObjectField,
|
|
38058
|
-
// name: [formOrObjectField.name, 'img'].join('.'),
|
|
38059
|
-
name: [imageName].join("."),
|
|
38060
|
-
fields: [
|
|
38061
|
-
{
|
|
38062
|
-
type: "image",
|
|
38063
|
-
// label: 'URL',
|
|
38064
|
-
name: [templateName, "url"].join("."),
|
|
38065
|
-
component: "image"
|
|
38066
|
-
},
|
|
38067
|
-
{
|
|
38068
|
-
type: "string",
|
|
38069
|
-
label: "Alt",
|
|
38070
|
-
name: [templateName.replace(/\.props$/, ""), "alt"].join("."),
|
|
38071
|
-
component: "text"
|
|
38072
|
-
},
|
|
38073
|
-
{
|
|
38074
|
-
type: "string",
|
|
38075
|
-
label: "Caption",
|
|
38076
|
-
name: [templateName.replace(/\.props$/, ""), "caption"].join(
|
|
38077
|
-
"."
|
|
38078
|
-
),
|
|
38079
|
-
component: "text"
|
|
38080
|
-
}
|
|
38081
|
-
]
|
|
38082
|
-
};
|
|
38083
|
-
}
|
|
38084
|
-
if (!isLastItem2) {
|
|
38085
|
-
return this.getFieldGroup({
|
|
38086
|
-
formOrObjectField: template,
|
|
38087
|
-
values: props,
|
|
38088
|
-
namePath,
|
|
38089
|
-
namePathIndex: namePathIndex + Math.max(4, childrenIndex + propsIndex)
|
|
38090
|
-
});
|
|
38091
|
-
}
|
|
38092
|
-
if (!template) {
|
|
38093
|
-
throw new Error(`Expected template value for field ${item.name}`);
|
|
38094
|
-
}
|
|
38095
|
-
return {
|
|
38096
|
-
...template,
|
|
38097
|
-
name: templateName,
|
|
38098
|
-
fields: template.fields.map((field2) => {
|
|
38099
|
-
return {
|
|
38100
|
-
...field2,
|
|
38101
|
-
name: [templateName, field2.name].join(".")
|
|
38102
|
-
};
|
|
38103
|
-
})
|
|
38104
|
-
};
|
|
38105
|
-
}
|
|
38106
|
-
} else {
|
|
38107
|
-
const fieldName = [...namePath.slice(0, namePathIndex)].join(".");
|
|
38108
|
-
if (!fieldName) {
|
|
38109
|
-
return formOrObjectField;
|
|
38110
|
-
}
|
|
38111
|
-
return {
|
|
38112
|
-
...formOrObjectField,
|
|
38113
|
-
name: fieldName,
|
|
38114
|
-
fields: formOrObjectField.fields.map((field2) => {
|
|
38115
|
-
return {
|
|
38116
|
-
...field2,
|
|
38117
|
-
name: [fieldName, field2.name].join(".")
|
|
38118
|
-
};
|
|
38119
|
-
})
|
|
38120
|
-
};
|
|
38121
|
-
}
|
|
38122
|
-
}
|
|
37934
|
+
{
|
|
37935
|
+
onClick: () => {
|
|
37936
|
+
tf.remove.tableColumn();
|
|
37937
|
+
},
|
|
37938
|
+
onMouseDown: (e3) => e3.preventDefault(),
|
|
37939
|
+
tooltip: "Delete column"
|
|
37940
|
+
},
|
|
37941
|
+
/* @__PURE__ */ React__default.createElement(XIcon, null)
|
|
37942
|
+
))
|
|
37943
|
+
)
|
|
37944
|
+
));
|
|
38123
37945
|
}
|
|
37946
|
+
);
|
|
37947
|
+
const TableBordersDropdownMenuContent = withRef$1((props, ref) => {
|
|
37948
|
+
const editor = useEditorRef();
|
|
37949
|
+
const {
|
|
37950
|
+
getOnSelectTableBorder,
|
|
37951
|
+
hasBottomBorder,
|
|
37952
|
+
hasLeftBorder,
|
|
37953
|
+
hasNoBorders,
|
|
37954
|
+
hasOuterBorders,
|
|
37955
|
+
hasRightBorder,
|
|
37956
|
+
hasTopBorder
|
|
37957
|
+
} = useTableBordersDropdownMenuContentState();
|
|
37958
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
37959
|
+
DropdownMenuContent$1,
|
|
37960
|
+
{
|
|
37961
|
+
ref,
|
|
37962
|
+
className: cn$2("min-w-[220px]"),
|
|
37963
|
+
onCloseAutoFocus: (e3) => {
|
|
37964
|
+
e3.preventDefault();
|
|
37965
|
+
editor.tf.focus();
|
|
37966
|
+
},
|
|
37967
|
+
align: "start",
|
|
37968
|
+
side: "right",
|
|
37969
|
+
sideOffset: 0,
|
|
37970
|
+
...props
|
|
37971
|
+
},
|
|
37972
|
+
/* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(
|
|
37973
|
+
DropdownMenuCheckboxItem,
|
|
37974
|
+
{
|
|
37975
|
+
checked: hasTopBorder,
|
|
37976
|
+
onCheckedChange: getOnSelectTableBorder("top")
|
|
37977
|
+
},
|
|
37978
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Top Border")
|
|
37979
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
37980
|
+
DropdownMenuCheckboxItem,
|
|
37981
|
+
{
|
|
37982
|
+
checked: hasRightBorder,
|
|
37983
|
+
onCheckedChange: getOnSelectTableBorder("right")
|
|
37984
|
+
},
|
|
37985
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Right Border")
|
|
37986
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
37987
|
+
DropdownMenuCheckboxItem,
|
|
37988
|
+
{
|
|
37989
|
+
checked: hasBottomBorder,
|
|
37990
|
+
onCheckedChange: getOnSelectTableBorder("bottom")
|
|
37991
|
+
},
|
|
37992
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Bottom Border")
|
|
37993
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
37994
|
+
DropdownMenuCheckboxItem,
|
|
37995
|
+
{
|
|
37996
|
+
checked: hasLeftBorder,
|
|
37997
|
+
onCheckedChange: getOnSelectTableBorder("left")
|
|
37998
|
+
},
|
|
37999
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Left Border")
|
|
38000
|
+
)),
|
|
38001
|
+
/* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(
|
|
38002
|
+
DropdownMenuCheckboxItem,
|
|
38003
|
+
{
|
|
38004
|
+
checked: hasNoBorders,
|
|
38005
|
+
onCheckedChange: getOnSelectTableBorder("none")
|
|
38006
|
+
},
|
|
38007
|
+
/* @__PURE__ */ React__default.createElement("div", null, "No Border")
|
|
38008
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
38009
|
+
DropdownMenuCheckboxItem,
|
|
38010
|
+
{
|
|
38011
|
+
checked: hasOuterBorders,
|
|
38012
|
+
onCheckedChange: getOnSelectTableBorder("outer")
|
|
38013
|
+
},
|
|
38014
|
+
/* @__PURE__ */ React__default.createElement("div", null, "Outside Borders")
|
|
38015
|
+
))
|
|
38016
|
+
);
|
|
38017
|
+
});
|
|
38018
|
+
function ColorDropdownMenu({ children, tooltip }) {
|
|
38019
|
+
const [open, setOpen] = useState(false);
|
|
38020
|
+
const editor = useEditorRef();
|
|
38021
|
+
const selectedCells = usePluginOption(TablePlugin, "selectedCells");
|
|
38022
|
+
useCallback(
|
|
38023
|
+
(color) => {
|
|
38024
|
+
setOpen(false);
|
|
38025
|
+
setCellBackground(editor, { color, selectedCells: selectedCells ?? [] });
|
|
38026
|
+
},
|
|
38027
|
+
[selectedCells, editor]
|
|
38028
|
+
);
|
|
38029
|
+
const onClearColor = useCallback(() => {
|
|
38030
|
+
setOpen(false);
|
|
38031
|
+
setCellBackground(editor, {
|
|
38032
|
+
color: null,
|
|
38033
|
+
selectedCells: selectedCells ?? []
|
|
38034
|
+
});
|
|
38035
|
+
}, [selectedCells, editor]);
|
|
38036
|
+
return /* @__PURE__ */ React__default.createElement(DropdownMenu$1, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger$1, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { tooltip }, children)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent$1, { align: "start" }, /* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(DropdownMenuItem$1, { className: "p-2", onClick: onClearColor }, /* @__PURE__ */ React__default.createElement(EraserIcon, null), /* @__PURE__ */ React__default.createElement("span", null, "Clear")))));
|
|
38124
38037
|
}
|
|
38125
|
-
|
|
38126
|
-
|
|
38127
|
-
|
|
38128
|
-
|
|
38038
|
+
const TableRowElement = withRef$1(
|
|
38039
|
+
({ children, className, ...props }, ref) => {
|
|
38040
|
+
const selected = useSelected();
|
|
38041
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
38042
|
+
PlateElement,
|
|
38043
|
+
{
|
|
38044
|
+
as: "tr",
|
|
38045
|
+
className: cn$2(className, "group/row"),
|
|
38046
|
+
"data-selected": selected ? "true" : void 0,
|
|
38047
|
+
...props
|
|
38048
|
+
},
|
|
38049
|
+
children
|
|
38050
|
+
);
|
|
38051
|
+
}
|
|
38052
|
+
);
|
|
38053
|
+
function classNames$1(...classes) {
|
|
38054
|
+
return classes.filter(Boolean).join(" ");
|
|
38129
38055
|
}
|
|
38130
|
-
|
|
38131
|
-
|
|
38132
|
-
|
|
38133
|
-
|
|
38134
|
-
|
|
38135
|
-
|
|
38136
|
-
|
|
38137
|
-
|
|
38138
|
-
|
|
38056
|
+
const uuid = () => {
|
|
38057
|
+
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(
|
|
38058
|
+
/[018]/g,
|
|
38059
|
+
(c2) => (c2 ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c2 / 4).toString(16)
|
|
38060
|
+
);
|
|
38061
|
+
};
|
|
38062
|
+
const blockClasses = "mt-0.5";
|
|
38063
|
+
const headerClasses = "font-normal";
|
|
38064
|
+
const Components = () => {
|
|
38065
|
+
return {
|
|
38066
|
+
[SlashInputPlugin.key]: SlashInputElement,
|
|
38067
|
+
[HEADING_KEYS$1.h1]: ({
|
|
38068
|
+
attributes,
|
|
38069
|
+
editor,
|
|
38070
|
+
element,
|
|
38071
|
+
className,
|
|
38072
|
+
...props
|
|
38073
|
+
}) => /* @__PURE__ */ React__default.createElement(
|
|
38074
|
+
"h1",
|
|
38075
|
+
{
|
|
38076
|
+
...attributes,
|
|
38077
|
+
...props,
|
|
38078
|
+
className: classNames$1(
|
|
38079
|
+
headerClasses,
|
|
38080
|
+
blockClasses,
|
|
38081
|
+
className,
|
|
38082
|
+
"text-4xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
38083
|
+
)
|
|
38139
38084
|
}
|
|
38140
|
-
|
|
38141
|
-
|
|
38142
|
-
|
|
38143
|
-
|
|
38144
|
-
|
|
38145
|
-
|
|
38146
|
-
|
|
38147
|
-
|
|
38148
|
-
|
|
38149
|
-
|
|
38150
|
-
|
|
38151
|
-
|
|
38152
|
-
|
|
38153
|
-
|
|
38154
|
-
|
|
38155
|
-
|
|
38156
|
-
|
|
38085
|
+
),
|
|
38086
|
+
[HEADING_KEYS$1.h2]: ({
|
|
38087
|
+
attributes,
|
|
38088
|
+
editor,
|
|
38089
|
+
element,
|
|
38090
|
+
className,
|
|
38091
|
+
...props
|
|
38092
|
+
}) => /* @__PURE__ */ React__default.createElement(
|
|
38093
|
+
"h2",
|
|
38094
|
+
{
|
|
38095
|
+
...attributes,
|
|
38096
|
+
...props,
|
|
38097
|
+
className: classNames$1(
|
|
38098
|
+
headerClasses,
|
|
38099
|
+
blockClasses,
|
|
38100
|
+
className,
|
|
38101
|
+
"text-3xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
38102
|
+
)
|
|
38157
38103
|
}
|
|
38158
|
-
|
|
38159
|
-
|
|
38160
|
-
|
|
38161
|
-
|
|
38162
|
-
|
|
38163
|
-
|
|
38164
|
-
|
|
38165
|
-
}
|
|
38166
|
-
|
|
38167
|
-
|
|
38168
|
-
|
|
38169
|
-
|
|
38170
|
-
|
|
38171
|
-
|
|
38172
|
-
|
|
38173
|
-
|
|
38174
|
-
|
|
38175
|
-
|
|
38176
|
-
|
|
38177
|
-
|
|
38104
|
+
),
|
|
38105
|
+
[HEADING_KEYS$1.h3]: ({
|
|
38106
|
+
attributes,
|
|
38107
|
+
editor,
|
|
38108
|
+
element,
|
|
38109
|
+
className,
|
|
38110
|
+
...props
|
|
38111
|
+
}) => /* @__PURE__ */ React__default.createElement(
|
|
38112
|
+
"h3",
|
|
38113
|
+
{
|
|
38114
|
+
...attributes,
|
|
38115
|
+
...props,
|
|
38116
|
+
className: classNames$1(
|
|
38117
|
+
headerClasses,
|
|
38118
|
+
blockClasses,
|
|
38119
|
+
className,
|
|
38120
|
+
"text-2xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
38121
|
+
)
|
|
38122
|
+
}
|
|
38123
|
+
),
|
|
38124
|
+
[HEADING_KEYS$1.h4]: ({
|
|
38125
|
+
attributes,
|
|
38126
|
+
editor,
|
|
38127
|
+
element,
|
|
38128
|
+
className,
|
|
38129
|
+
...props
|
|
38130
|
+
}) => /* @__PURE__ */ React__default.createElement(
|
|
38131
|
+
"h4",
|
|
38132
|
+
{
|
|
38133
|
+
...attributes,
|
|
38134
|
+
...props,
|
|
38135
|
+
className: classNames$1(
|
|
38136
|
+
headerClasses,
|
|
38137
|
+
blockClasses,
|
|
38138
|
+
className,
|
|
38139
|
+
"text-xl mb-4 last:mb-0 mt-6 first:mt-0 font-libre-baskerville"
|
|
38140
|
+
)
|
|
38141
|
+
}
|
|
38142
|
+
),
|
|
38143
|
+
/** Tailwind prose doesn't style h5 and h6 elements */
|
|
38144
|
+
[HEADING_KEYS$1.h5]: ({
|
|
38145
|
+
attributes,
|
|
38146
|
+
editor,
|
|
38147
|
+
element,
|
|
38148
|
+
className,
|
|
38149
|
+
...props
|
|
38150
|
+
}) => /* @__PURE__ */ React__default.createElement(
|
|
38151
|
+
"h5",
|
|
38152
|
+
{
|
|
38153
|
+
...attributes,
|
|
38154
|
+
...props,
|
|
38155
|
+
className: classNames$1(
|
|
38156
|
+
headerClasses,
|
|
38157
|
+
blockClasses,
|
|
38158
|
+
className,
|
|
38159
|
+
"text-lg mb-4 last:mb-0 mt-6 first:mt-0"
|
|
38160
|
+
),
|
|
38161
|
+
style: { fontFamily: "'Libre Baskerville', serif", fontWeight: "400" }
|
|
38162
|
+
}
|
|
38163
|
+
),
|
|
38164
|
+
[HEADING_KEYS$1.h6]: ({
|
|
38165
|
+
attributes,
|
|
38166
|
+
editor,
|
|
38167
|
+
element,
|
|
38168
|
+
className,
|
|
38169
|
+
...props
|
|
38170
|
+
}) => /* @__PURE__ */ React__default.createElement(
|
|
38171
|
+
"h6",
|
|
38172
|
+
{
|
|
38173
|
+
...attributes,
|
|
38174
|
+
...props,
|
|
38175
|
+
className: classNames$1(
|
|
38176
|
+
headerClasses,
|
|
38177
|
+
blockClasses,
|
|
38178
|
+
className,
|
|
38179
|
+
"text-base mb-4 last:mb-0 mt-6 first:mt-0"
|
|
38180
|
+
),
|
|
38181
|
+
style: { fontFamily: "'Libre Baskerville', serif", fontWeight: "400" }
|
|
38182
|
+
}
|
|
38183
|
+
),
|
|
38184
|
+
[ParagraphPlugin.key]: ParagraphElement,
|
|
38185
|
+
[BlockquotePlugin.key]: BlockquoteElement,
|
|
38186
|
+
[CodeBlockPlugin.key]: CodeBlockElement,
|
|
38187
|
+
[CodeLinePlugin.key]: CodeLineElement,
|
|
38188
|
+
[CodeSyntaxPlugin.key]: CodeSyntaxLeaf,
|
|
38189
|
+
html: ({ attributes, editor, element, children, className }) => {
|
|
38190
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
38191
|
+
"div",
|
|
38192
|
+
{
|
|
38193
|
+
...attributes,
|
|
38194
|
+
className: classNames$1(
|
|
38195
|
+
"font-mono text-sm bg-green-100 cursor-not-allowed mb-4",
|
|
38196
|
+
className
|
|
38197
|
+
)
|
|
38198
|
+
},
|
|
38199
|
+
children,
|
|
38200
|
+
element.value
|
|
38201
|
+
);
|
|
38202
|
+
},
|
|
38203
|
+
html_inline: ({ attributes, editor, element, children, className }) => {
|
|
38204
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
38205
|
+
"span",
|
|
38206
|
+
{
|
|
38207
|
+
...attributes,
|
|
38208
|
+
className: classNames$1(
|
|
38209
|
+
"font-mono bg-green-100 cursor-not-allowed",
|
|
38210
|
+
className
|
|
38211
|
+
)
|
|
38212
|
+
},
|
|
38213
|
+
children,
|
|
38214
|
+
element.value
|
|
38215
|
+
);
|
|
38216
|
+
},
|
|
38217
|
+
[BulletedListPlugin.key]: withProps(ListElement, { variant: "ul" }),
|
|
38218
|
+
[NumberedListPlugin.key]: withProps(ListElement, { variant: "ol" }),
|
|
38219
|
+
[ListItemPlugin.key]: withProps(PlateElement, { as: "li" }),
|
|
38220
|
+
[LinkPlugin.key]: LinkElement,
|
|
38221
|
+
[CodePlugin.key]: CodeLeaf,
|
|
38222
|
+
[UnderlinePlugin.key]: withProps(PlateLeaf, { as: "u" }),
|
|
38223
|
+
[StrikethroughPlugin.key]: withProps(PlateLeaf, { as: "s" }),
|
|
38224
|
+
[ItalicPlugin.key]: withProps(PlateLeaf, { as: "em" }),
|
|
38225
|
+
[BoldPlugin.key]: withProps(PlateLeaf, { as: "strong" }),
|
|
38226
|
+
[HorizontalRulePlugin.key]: HrElement,
|
|
38227
|
+
[TableCellHeaderPlugin.key]: TableCellHeaderElement,
|
|
38228
|
+
[TableCellPlugin.key]: TableCellElement,
|
|
38229
|
+
[TablePlugin.key]: TableElement,
|
|
38230
|
+
[TableRowPlugin.key]: TableRowElement
|
|
38231
|
+
};
|
|
38232
|
+
};
|
|
38178
38233
|
function FieldsBuilder({
|
|
38179
38234
|
form,
|
|
38180
38235
|
fields,
|
|
38181
38236
|
activeFieldName,
|
|
38237
|
+
hoveringFieldName,
|
|
38182
38238
|
padding = false
|
|
38183
38239
|
}) {
|
|
38184
38240
|
const cms = useCMS$1();
|
|
@@ -38196,6 +38252,7 @@ function FieldsBuilder({
|
|
|
38196
38252
|
key: field.name,
|
|
38197
38253
|
field,
|
|
38198
38254
|
activeFieldName,
|
|
38255
|
+
hoveringFieldName,
|
|
38199
38256
|
form,
|
|
38200
38257
|
fieldPlugins,
|
|
38201
38258
|
index
|
|
@@ -38208,7 +38265,8 @@ const InnerField = ({
|
|
|
38208
38265
|
form,
|
|
38209
38266
|
fieldPlugins,
|
|
38210
38267
|
index,
|
|
38211
|
-
activeFieldName
|
|
38268
|
+
activeFieldName,
|
|
38269
|
+
hoveringFieldName
|
|
38212
38270
|
}) => {
|
|
38213
38271
|
React.useEffect(() => {
|
|
38214
38272
|
form.mutators.setFieldData(field.name, {
|
|
@@ -38231,6 +38289,9 @@ const InnerField = ({
|
|
|
38231
38289
|
format2 = plugin.format;
|
|
38232
38290
|
}
|
|
38233
38291
|
let isActiveField = field.name === activeFieldName;
|
|
38292
|
+
const isHoveringField = field.name === hoveringFieldName;
|
|
38293
|
+
const focusIntent = isActiveField;
|
|
38294
|
+
const hoverIntent = isHoveringField;
|
|
38234
38295
|
if (field.list && field.type === "string") {
|
|
38235
38296
|
if (activeFieldName) {
|
|
38236
38297
|
const activeFieldNameArray = activeFieldName.split(".");
|
|
@@ -38263,7 +38324,11 @@ const InnerField = ({
|
|
|
38263
38324
|
...fieldProps,
|
|
38264
38325
|
form: form.finalForm,
|
|
38265
38326
|
tinaForm: form,
|
|
38266
|
-
field: {
|
|
38327
|
+
field: {
|
|
38328
|
+
...field,
|
|
38329
|
+
focusIntent,
|
|
38330
|
+
hoverIntent
|
|
38331
|
+
}
|
|
38267
38332
|
}
|
|
38268
38333
|
);
|
|
38269
38334
|
}
|
|
@@ -38272,10 +38337,14 @@ const InnerField = ({
|
|
|
38272
38337
|
plugin.Component,
|
|
38273
38338
|
{
|
|
38274
38339
|
...fieldProps,
|
|
38275
|
-
|
|
38340
|
+
focusIntent,
|
|
38276
38341
|
form: form.finalForm,
|
|
38277
38342
|
tinaForm: form,
|
|
38278
|
-
field: {
|
|
38343
|
+
field: {
|
|
38344
|
+
...field,
|
|
38345
|
+
focusIntent,
|
|
38346
|
+
hoverIntent
|
|
38347
|
+
},
|
|
38279
38348
|
index
|
|
38280
38349
|
}
|
|
38281
38350
|
);
|
|
@@ -39341,7 +39410,7 @@ function AiFillWarning(props) {
|
|
|
39341
39410
|
function AiOutlineLoading(props) {
|
|
39342
39411
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" }, "child": [] }] })(props);
|
|
39343
39412
|
}
|
|
39344
|
-
const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-
|
|
39413
|
+
const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-tina-orange-dark focus-visible:ring-0 focus:outline-none focus:ring-2 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";
|
|
39345
39414
|
const disabledClasses$1 = "opacity-50 pointer-events-none cursor-not-allowed";
|
|
39346
39415
|
const BaseTextField = React.forwardRef(({ className, disabled, ...rest }, ref) => {
|
|
39347
39416
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -39359,7 +39428,7 @@ const TextArea = React.forwardRef(({ ...props }, ref) => {
|
|
|
39359
39428
|
"textarea",
|
|
39360
39429
|
{
|
|
39361
39430
|
...props,
|
|
39362
|
-
className: "shadow-inner text-base px-3 py-2 text-gray-600 resize-y focus:shadow-outline focus:border-
|
|
39431
|
+
className: "shadow-inner text-base px-3 py-2 text-gray-600 resize-y focus:shadow-outline focus:outline-none focus:border-tina-orange-dark block w-full border border-gray-200 focus:text-gray-900 rounded",
|
|
39363
39432
|
ref,
|
|
39364
39433
|
style: { minHeight: "160px" }
|
|
39365
39434
|
}
|
|
@@ -39818,7 +39887,7 @@ const Toggle = ({
|
|
|
39818
39887
|
/* @__PURE__ */ React.createElement("div", { className: "relative w-[48px] h-7 rounded-3xl bg-white shadow-inner border border-gray-200 pointer-events-none -ml-0.5" }, /* @__PURE__ */ React.createElement(
|
|
39819
39888
|
"span",
|
|
39820
39889
|
{
|
|
39821
|
-
className: `absolute rounded-3xl left-0.5 top-1/2 w-[22px] h-[22px] shadow border transition-all ease-out duration-150 ${checked ? "bg-
|
|
39890
|
+
className: `absolute rounded-3xl left-0.5 top-1/2 w-[22px] h-[22px] shadow border transition-all ease-out duration-150 ${checked ? "bg-tina-orange border-tina-orange-dark" : "bg-gray-250 border-gray-300"}`,
|
|
39822
39891
|
style: {
|
|
39823
39892
|
transform: `translate3d(${checked ? "20px" : "0"}, -50%, 0)`
|
|
39824
39893
|
}
|
|
@@ -39892,7 +39961,7 @@ function MdOutlinePhotoLibrary(props) {
|
|
|
39892
39961
|
function MdOutlinePerson(props) {
|
|
39893
39962
|
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);
|
|
39894
39963
|
}
|
|
39895
|
-
const selectFieldClasses = "shadow appearance-none h-full bg-white block pl-3 pr-8 py-2 truncate w-full text-base cursor-pointer border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-
|
|
39964
|
+
const selectFieldClasses = "shadow appearance-none h-full bg-white block pl-3 pr-8 py-2 truncate w-full text-base cursor-pointer border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-tina-orange-dark focus:border-tina-orange-dark sm:text-sm rounded";
|
|
39896
39965
|
const Select$1 = ({
|
|
39897
39966
|
input,
|
|
39898
39967
|
field,
|
|
@@ -39902,10 +39971,12 @@ const Select$1 = ({
|
|
|
39902
39971
|
const selectOptions = options || field.options;
|
|
39903
39972
|
const ref = React.useRef(null);
|
|
39904
39973
|
React.useEffect(() => {
|
|
39905
|
-
|
|
39974
|
+
const focusIntent = field == null ? void 0 : field.focusIntent;
|
|
39975
|
+
const shouldFocus = !!focusIntent;
|
|
39976
|
+
if (ref.current && shouldFocus) {
|
|
39906
39977
|
ref.current.focus();
|
|
39907
39978
|
}
|
|
39908
|
-
}, [field == null ? void 0 : field.
|
|
39979
|
+
}, [field == null ? void 0 : field.focusIntent, ref]);
|
|
39909
39980
|
return /* @__PURE__ */ React.createElement("div", { className: "relative group w-full h-full md:w-auto" }, /* @__PURE__ */ React.createElement(
|
|
39910
39981
|
"select",
|
|
39911
39982
|
{
|
|
@@ -39987,7 +40058,7 @@ const RadioOption = ({ checked, htmlFor, children, ...props }) => /* @__PURE__ *
|
|
|
39987
40058
|
/* @__PURE__ */ React.createElement(
|
|
39988
40059
|
"span",
|
|
39989
40060
|
{
|
|
39990
|
-
className: `relative h-[19px] w-[19px] rounded border text-indigo-600 focus:ring-indigo-500 transition ease-out duration-150 ${checked ? "border-
|
|
40061
|
+
className: `relative h-[19px] w-[19px] rounded border text-indigo-600 focus:ring-indigo-500 transition ease-out duration-150 ${checked ? "border-tina-orange-dark bg-tina-orange shadow-sm group-hover:bg-tina-orange group-hover:border-tina-orange-dark" : "border-gray-200 bg-white shadow-inner group-hover:bg-gray-100"}`
|
|
39991
40062
|
},
|
|
39992
40063
|
/* @__PURE__ */ React.createElement(
|
|
39993
40064
|
BiCheck,
|
|
@@ -40048,7 +40119,7 @@ const CheckboxGroup = ({
|
|
|
40048
40119
|
/* @__PURE__ */ React.createElement(
|
|
40049
40120
|
"span",
|
|
40050
40121
|
{
|
|
40051
|
-
className: `relative h-[18px] w-[18px] rounded border text-indigo-600 focus:ring-indigo-500 transition ease-out duration-150 ${checked ? "border-
|
|
40122
|
+
className: `relative h-[18px] w-[18px] rounded border text-indigo-600 focus:ring-indigo-500 transition ease-out duration-150 ${checked ? "border-tina-orange-dark bg-tina-orange shadow-sm group-hover:bg-tina-orange group-hover:border-tina-orange-dark" : "border-gray-200 bg-white shadow-inner group-hover:bg-gray-100"}`
|
|
40052
40123
|
},
|
|
40053
40124
|
/* @__PURE__ */ React.createElement(
|
|
40054
40125
|
BiCheck,
|
|
@@ -40179,7 +40250,7 @@ const ImageUpload = React.forwardRef(({ onDrop, onClear, onClick, value, src, lo
|
|
|
40179
40250
|
/* @__PURE__ */ React.createElement(
|
|
40180
40251
|
"button",
|
|
40181
40252
|
{
|
|
40182
|
-
className: "flex-shrink min-w-0 focus-within:shadow-outline focus-within:border-
|
|
40253
|
+
className: "flex-shrink min-w-0 focus-within:shadow-outline focus-within:border-tina-orange-dark rounded outline-none overflow-visible cursor-pointer border-none hover:opacity-60 transition ease-out duration-100",
|
|
40183
40254
|
onClick,
|
|
40184
40255
|
ref
|
|
40185
40256
|
},
|
|
@@ -40680,7 +40751,7 @@ function toProps(option) {
|
|
|
40680
40751
|
return option;
|
|
40681
40752
|
return { value: option, label: option };
|
|
40682
40753
|
}
|
|
40683
|
-
const passwordFieldClasses = "shadow-inner focus:shadow-outline focus:border-
|
|
40754
|
+
const passwordFieldClasses = "shadow-inner focus:shadow-outline focus:border-tina-orange-dark 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";
|
|
40684
40755
|
const disabledClasses = "opacity-50 pointer-events-none cursor-not-allowed";
|
|
40685
40756
|
const errorClasses = "border-red-500 focus:border-red-500 focus:shadow-outline-red";
|
|
40686
40757
|
const BasePasswordField = React.forwardRef(({ className, disabled, error: error2, ...rest }, ref) => {
|
|
@@ -41053,7 +41124,7 @@ const Header = ({ onClick, children }) => {
|
|
|
41053
41124
|
"button",
|
|
41054
41125
|
{
|
|
41055
41126
|
onClick,
|
|
41056
|
-
className: "group px-4 py-3 bg-white hover:bg-gray-50 shadow focus:shadow-outline focus:border-
|
|
41127
|
+
className: "group px-4 py-3 bg-white hover:bg-gray-50 shadow focus:shadow-outline focus:border-tina-orange-dark w-full border border-gray-100 hover:border-gray-200 text-gray-500 hover:text-tina-orange-dark focus:text-tina-orange-dark rounded flex justify-between items-center gap-2"
|
|
41057
41128
|
},
|
|
41058
41129
|
/* @__PURE__ */ React.createElement("span", { className: "text-left text-base font-medium overflow-hidden text-ellipsis whitespace-nowrap flex-1" }, children),
|
|
41059
41130
|
" ",
|
|
@@ -41205,7 +41276,7 @@ const BlockSelectorBig = ({
|
|
|
41205
41276
|
"input",
|
|
41206
41277
|
{
|
|
41207
41278
|
type: "text",
|
|
41208
|
-
className: "shadow-inner focus:shadow-outline focus:border-
|
|
41279
|
+
className: "shadow-inner focus:shadow-outline focus:border-tina-orange-dark focus:outline-none block text-sm pl-2.5 pr-8 py-1.5 text-gray-600 w-full bg-white border border-gray-200 focus:text-gray-900 rounded placeholder-gray-400 hover:placeholder-gray-600 transition-all ease-out duration-150",
|
|
41209
41280
|
onClick: (event) => {
|
|
41210
41281
|
event.stopPropagation();
|
|
41211
41282
|
event.preventDefault();
|
|
@@ -41658,10 +41729,12 @@ const ImageField = wrapFieldsWithMeta(
|
|
|
41658
41729
|
onClear = () => props.input.onChange("");
|
|
41659
41730
|
}
|
|
41660
41731
|
React.useEffect(() => {
|
|
41661
|
-
|
|
41732
|
+
const focusIntent = props.field.focusIntent;
|
|
41733
|
+
const shouldFocus = !!focusIntent;
|
|
41734
|
+
if (ref.current && shouldFocus) {
|
|
41662
41735
|
ref.current.focus();
|
|
41663
41736
|
}
|
|
41664
|
-
}, [props.field.
|
|
41737
|
+
}, [props.field.focusIntent, ref]);
|
|
41665
41738
|
async function onChange(media) {
|
|
41666
41739
|
var _a2, _b;
|
|
41667
41740
|
if (media) {
|
|
@@ -41787,12 +41860,14 @@ const RadioGroupFieldPlugin = {
|
|
|
41787
41860
|
const TextareaField = wrapFieldsWithMeta((props) => {
|
|
41788
41861
|
const ref = React.useRef(null);
|
|
41789
41862
|
React.useEffect(() => {
|
|
41790
|
-
|
|
41863
|
+
const focusIntent = props.field.focusIntent;
|
|
41864
|
+
const shouldFocus = !!focusIntent;
|
|
41865
|
+
if (ref.current && shouldFocus) {
|
|
41791
41866
|
const el = ref.current;
|
|
41792
41867
|
el.focus();
|
|
41793
41868
|
el.setSelectionRange(el.value.length, el.value.length);
|
|
41794
41869
|
}
|
|
41795
|
-
}, [props.field.
|
|
41870
|
+
}, [props.field.focusIntent, ref]);
|
|
41796
41871
|
return /* @__PURE__ */ React.createElement(TextArea, { ref, ...props.input });
|
|
41797
41872
|
});
|
|
41798
41873
|
const TextareaFieldPlugin = {
|
|
@@ -41853,10 +41928,12 @@ const TextField = wrapFieldsWithMeta(
|
|
|
41853
41928
|
var _a2;
|
|
41854
41929
|
const ref = React.useRef(null);
|
|
41855
41930
|
React.useEffect(() => {
|
|
41856
|
-
|
|
41931
|
+
const focusIntent = props.field.focusIntent;
|
|
41932
|
+
const shouldFocus = !!focusIntent;
|
|
41933
|
+
if (ref.current && shouldFocus) {
|
|
41857
41934
|
ref.current.focus();
|
|
41858
41935
|
}
|
|
41859
|
-
}, [props.field.
|
|
41936
|
+
}, [props.field.focusIntent, ref]);
|
|
41860
41937
|
return /* @__PURE__ */ React.createElement(
|
|
41861
41938
|
BaseTextField,
|
|
41862
41939
|
{
|
|
@@ -41916,10 +41993,12 @@ const TagsField = wrapFieldsWithMeta(({ input, field, form, tinaForm }) => {
|
|
|
41916
41993
|
const items2 = input.value || [];
|
|
41917
41994
|
const ref = React.useRef(null);
|
|
41918
41995
|
React.useEffect(() => {
|
|
41919
|
-
|
|
41996
|
+
const focusIntent = field.focusIntent;
|
|
41997
|
+
const shouldFocus = !!focusIntent;
|
|
41998
|
+
if (ref.current && shouldFocus) {
|
|
41920
41999
|
ref.current.focus();
|
|
41921
42000
|
}
|
|
41922
|
-
}, [field.
|
|
42001
|
+
}, [field.focusIntent, ref]);
|
|
41923
42002
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React.createElement(
|
|
41924
42003
|
BaseTextField,
|
|
41925
42004
|
{
|
|
@@ -42070,66 +42149,63 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
|
|
|
42070
42149
|
)));
|
|
42071
42150
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
42072
42151
|
function buildFormatLongFn(args) {
|
|
42073
|
-
return
|
|
42074
|
-
|
|
42075
|
-
|
|
42076
|
-
var format2 = args.formats[width] || args.formats[args.defaultWidth];
|
|
42152
|
+
return (options = {}) => {
|
|
42153
|
+
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
42154
|
+
const format2 = args.formats[width] || args.formats[args.defaultWidth];
|
|
42077
42155
|
return format2;
|
|
42078
42156
|
};
|
|
42079
42157
|
}
|
|
42080
42158
|
function buildLocalizeFn(args) {
|
|
42081
|
-
return
|
|
42082
|
-
|
|
42083
|
-
|
|
42159
|
+
return (value, options) => {
|
|
42160
|
+
const context = (options == null ? void 0 : options.context) ? String(options.context) : "standalone";
|
|
42161
|
+
let valuesArray;
|
|
42084
42162
|
if (context === "formatting" && args.formattingValues) {
|
|
42085
|
-
|
|
42086
|
-
|
|
42163
|
+
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
42164
|
+
const width = (options == null ? void 0 : options.width) ? String(options.width) : defaultWidth;
|
|
42087
42165
|
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
42088
42166
|
} else {
|
|
42089
|
-
|
|
42090
|
-
|
|
42091
|
-
valuesArray = args.values[
|
|
42167
|
+
const defaultWidth = args.defaultWidth;
|
|
42168
|
+
const width = (options == null ? void 0 : options.width) ? String(options.width) : args.defaultWidth;
|
|
42169
|
+
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
42092
42170
|
}
|
|
42093
|
-
|
|
42171
|
+
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
42094
42172
|
return valuesArray[index];
|
|
42095
42173
|
};
|
|
42096
42174
|
}
|
|
42097
42175
|
function buildMatchFn(args) {
|
|
42098
|
-
return
|
|
42099
|
-
|
|
42100
|
-
|
|
42101
|
-
|
|
42102
|
-
var matchResult = string3.match(matchPattern);
|
|
42176
|
+
return (string3, options = {}) => {
|
|
42177
|
+
const width = options.width;
|
|
42178
|
+
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
42179
|
+
const matchResult = string3.match(matchPattern);
|
|
42103
42180
|
if (!matchResult) {
|
|
42104
42181
|
return null;
|
|
42105
42182
|
}
|
|
42106
|
-
|
|
42107
|
-
|
|
42108
|
-
|
|
42109
|
-
|
|
42110
|
-
|
|
42111
|
-
|
|
42112
|
-
|
|
42113
|
-
var value;
|
|
42183
|
+
const matchedString = matchResult[0];
|
|
42184
|
+
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
42185
|
+
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
|
|
42186
|
+
// [TODO] -- I challenge you to fix the type
|
|
42187
|
+
findKey(parsePatterns, (pattern) => pattern.test(matchedString))
|
|
42188
|
+
);
|
|
42189
|
+
let value;
|
|
42114
42190
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
42115
|
-
value = options.valueCallback ?
|
|
42116
|
-
|
|
42117
|
-
|
|
42118
|
-
|
|
42119
|
-
|
|
42120
|
-
};
|
|
42191
|
+
value = options.valueCallback ? (
|
|
42192
|
+
// [TODO] -- I challenge you to fix the type
|
|
42193
|
+
options.valueCallback(value)
|
|
42194
|
+
) : value;
|
|
42195
|
+
const rest = string3.slice(matchedString.length);
|
|
42196
|
+
return { value, rest };
|
|
42121
42197
|
};
|
|
42122
42198
|
}
|
|
42123
42199
|
function findKey(object, predicate) {
|
|
42124
|
-
for (
|
|
42125
|
-
if (
|
|
42200
|
+
for (const key in object) {
|
|
42201
|
+
if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
|
|
42126
42202
|
return key;
|
|
42127
42203
|
}
|
|
42128
42204
|
}
|
|
42129
42205
|
return void 0;
|
|
42130
42206
|
}
|
|
42131
42207
|
function findIndex(array, predicate) {
|
|
42132
|
-
for (
|
|
42208
|
+
for (let key = 0; key < array.length; key++) {
|
|
42133
42209
|
if (predicate(array[key])) {
|
|
42134
42210
|
return key;
|
|
42135
42211
|
}
|
|
@@ -42137,146 +42213,21 @@ function findIndex(array, predicate) {
|
|
|
42137
42213
|
return void 0;
|
|
42138
42214
|
}
|
|
42139
42215
|
function buildMatchPatternFn(args) {
|
|
42140
|
-
return
|
|
42141
|
-
|
|
42142
|
-
var matchResult = string3.match(args.matchPattern);
|
|
42216
|
+
return (string3, options = {}) => {
|
|
42217
|
+
const matchResult = string3.match(args.matchPattern);
|
|
42143
42218
|
if (!matchResult)
|
|
42144
42219
|
return null;
|
|
42145
|
-
|
|
42146
|
-
|
|
42220
|
+
const matchedString = matchResult[0];
|
|
42221
|
+
const parseResult = string3.match(args.parsePattern);
|
|
42147
42222
|
if (!parseResult)
|
|
42148
42223
|
return null;
|
|
42149
|
-
|
|
42224
|
+
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
42150
42225
|
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
42151
|
-
|
|
42152
|
-
return {
|
|
42153
|
-
value,
|
|
42154
|
-
rest
|
|
42155
|
-
};
|
|
42226
|
+
const rest = string3.slice(matchedString.length);
|
|
42227
|
+
return { value, rest };
|
|
42156
42228
|
};
|
|
42157
42229
|
}
|
|
42158
|
-
|
|
42159
|
-
"@babel/helpers - typeof";
|
|
42160
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o4) {
|
|
42161
|
-
return typeof o4;
|
|
42162
|
-
} : function(o4) {
|
|
42163
|
-
return o4 && "function" == typeof Symbol && o4.constructor === Symbol && o4 !== Symbol.prototype ? "symbol" : typeof o4;
|
|
42164
|
-
}, _typeof(o3);
|
|
42165
|
-
}
|
|
42166
|
-
function requiredArgs(required, args) {
|
|
42167
|
-
if (args.length < required) {
|
|
42168
|
-
throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
|
|
42169
|
-
}
|
|
42170
|
-
}
|
|
42171
|
-
function toDate(argument) {
|
|
42172
|
-
requiredArgs(1, arguments);
|
|
42173
|
-
var argStr = Object.prototype.toString.call(argument);
|
|
42174
|
-
if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") {
|
|
42175
|
-
return new Date(argument.getTime());
|
|
42176
|
-
} else if (typeof argument === "number" || argStr === "[object Number]") {
|
|
42177
|
-
return new Date(argument);
|
|
42178
|
-
} else {
|
|
42179
|
-
if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
|
|
42180
|
-
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
|
|
42181
|
-
console.warn(new Error().stack);
|
|
42182
|
-
}
|
|
42183
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
42184
|
-
}
|
|
42185
|
-
}
|
|
42186
|
-
var defaultOptions = {};
|
|
42187
|
-
function getDefaultOptions() {
|
|
42188
|
-
return defaultOptions;
|
|
42189
|
-
}
|
|
42190
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
42191
|
-
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
42192
|
-
utcDate.setUTCFullYear(date.getFullYear());
|
|
42193
|
-
return date.getTime() - utcDate.getTime();
|
|
42194
|
-
}
|
|
42195
|
-
function compareAsc(dirtyDateLeft, dirtyDateRight) {
|
|
42196
|
-
requiredArgs(2, arguments);
|
|
42197
|
-
var dateLeft = toDate(dirtyDateLeft);
|
|
42198
|
-
var dateRight = toDate(dirtyDateRight);
|
|
42199
|
-
var diff2 = dateLeft.getTime() - dateRight.getTime();
|
|
42200
|
-
if (diff2 < 0) {
|
|
42201
|
-
return -1;
|
|
42202
|
-
} else if (diff2 > 0) {
|
|
42203
|
-
return 1;
|
|
42204
|
-
} else {
|
|
42205
|
-
return diff2;
|
|
42206
|
-
}
|
|
42207
|
-
}
|
|
42208
|
-
function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
|
|
42209
|
-
requiredArgs(2, arguments);
|
|
42210
|
-
var dateLeft = toDate(dirtyDateLeft);
|
|
42211
|
-
var dateRight = toDate(dirtyDateRight);
|
|
42212
|
-
var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
|
|
42213
|
-
var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
|
|
42214
|
-
return yearDiff * 12 + monthDiff;
|
|
42215
|
-
}
|
|
42216
|
-
function differenceInMilliseconds(dateLeft, dateRight) {
|
|
42217
|
-
requiredArgs(2, arguments);
|
|
42218
|
-
return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
|
|
42219
|
-
}
|
|
42220
|
-
var roundingMap = {
|
|
42221
|
-
ceil: Math.ceil,
|
|
42222
|
-
round: Math.round,
|
|
42223
|
-
floor: Math.floor,
|
|
42224
|
-
trunc: function trunc(value) {
|
|
42225
|
-
return value < 0 ? Math.ceil(value) : Math.floor(value);
|
|
42226
|
-
}
|
|
42227
|
-
// Math.trunc is not supported by IE
|
|
42228
|
-
};
|
|
42229
|
-
var defaultRoundingMethod = "trunc";
|
|
42230
|
-
function getRoundingMethod(method) {
|
|
42231
|
-
return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
|
|
42232
|
-
}
|
|
42233
|
-
function endOfDay(dirtyDate) {
|
|
42234
|
-
requiredArgs(1, arguments);
|
|
42235
|
-
var date = toDate(dirtyDate);
|
|
42236
|
-
date.setHours(23, 59, 59, 999);
|
|
42237
|
-
return date;
|
|
42238
|
-
}
|
|
42239
|
-
function endOfMonth(dirtyDate) {
|
|
42240
|
-
requiredArgs(1, arguments);
|
|
42241
|
-
var date = toDate(dirtyDate);
|
|
42242
|
-
var month = date.getMonth();
|
|
42243
|
-
date.setFullYear(date.getFullYear(), month + 1, 0);
|
|
42244
|
-
date.setHours(23, 59, 59, 999);
|
|
42245
|
-
return date;
|
|
42246
|
-
}
|
|
42247
|
-
function isLastDayOfMonth(dirtyDate) {
|
|
42248
|
-
requiredArgs(1, arguments);
|
|
42249
|
-
var date = toDate(dirtyDate);
|
|
42250
|
-
return endOfDay(date).getTime() === endOfMonth(date).getTime();
|
|
42251
|
-
}
|
|
42252
|
-
function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
|
|
42253
|
-
requiredArgs(2, arguments);
|
|
42254
|
-
var dateLeft = toDate(dirtyDateLeft);
|
|
42255
|
-
var dateRight = toDate(dirtyDateRight);
|
|
42256
|
-
var sign = compareAsc(dateLeft, dateRight);
|
|
42257
|
-
var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));
|
|
42258
|
-
var result;
|
|
42259
|
-
if (difference < 1) {
|
|
42260
|
-
result = 0;
|
|
42261
|
-
} else {
|
|
42262
|
-
if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {
|
|
42263
|
-
dateLeft.setDate(30);
|
|
42264
|
-
}
|
|
42265
|
-
dateLeft.setMonth(dateLeft.getMonth() - sign * difference);
|
|
42266
|
-
var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign;
|
|
42267
|
-
if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {
|
|
42268
|
-
isLastMonthNotFull = false;
|
|
42269
|
-
}
|
|
42270
|
-
result = sign * (difference - Number(isLastMonthNotFull));
|
|
42271
|
-
}
|
|
42272
|
-
return result === 0 ? 0 : result;
|
|
42273
|
-
}
|
|
42274
|
-
function differenceInSeconds(dateLeft, dateRight, options) {
|
|
42275
|
-
requiredArgs(2, arguments);
|
|
42276
|
-
var diff2 = differenceInMilliseconds(dateLeft, dateRight) / 1e3;
|
|
42277
|
-
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff2);
|
|
42278
|
-
}
|
|
42279
|
-
var formatDistanceLocale = {
|
|
42230
|
+
const formatDistanceLocale = {
|
|
42280
42231
|
lessThanXSeconds: {
|
|
42281
42232
|
one: "less than a second",
|
|
42282
42233
|
other: "less than {{count}} seconds"
|
|
@@ -42339,9 +42290,9 @@ var formatDistanceLocale = {
|
|
|
42339
42290
|
other: "almost {{count}} years"
|
|
42340
42291
|
}
|
|
42341
42292
|
};
|
|
42342
|
-
|
|
42343
|
-
|
|
42344
|
-
|
|
42293
|
+
const formatDistance = (token, count, options) => {
|
|
42294
|
+
let result;
|
|
42295
|
+
const tokenValue = formatDistanceLocale[token];
|
|
42345
42296
|
if (typeof tokenValue === "string") {
|
|
42346
42297
|
result = tokenValue;
|
|
42347
42298
|
} else if (count === 1) {
|
|
@@ -42349,7 +42300,7 @@ var formatDistance$1 = function formatDistance(token, count, options) {
|
|
|
42349
42300
|
} else {
|
|
42350
42301
|
result = tokenValue.other.replace("{{count}}", count.toString());
|
|
42351
42302
|
}
|
|
42352
|
-
if (options
|
|
42303
|
+
if (options == null ? void 0 : options.addSuffix) {
|
|
42353
42304
|
if (options.comparison && options.comparison > 0) {
|
|
42354
42305
|
return "in " + result;
|
|
42355
42306
|
} else {
|
|
@@ -42358,41 +42309,7 @@ var formatDistance$1 = function formatDistance(token, count, options) {
|
|
|
42358
42309
|
}
|
|
42359
42310
|
return result;
|
|
42360
42311
|
};
|
|
42361
|
-
const
|
|
42362
|
-
var dateFormats = {
|
|
42363
|
-
full: "EEEE, MMMM do, y",
|
|
42364
|
-
long: "MMMM do, y",
|
|
42365
|
-
medium: "MMM d, y",
|
|
42366
|
-
short: "MM/dd/yyyy"
|
|
42367
|
-
};
|
|
42368
|
-
var timeFormats = {
|
|
42369
|
-
full: "h:mm:ss a zzzz",
|
|
42370
|
-
long: "h:mm:ss a z",
|
|
42371
|
-
medium: "h:mm:ss a",
|
|
42372
|
-
short: "h:mm a"
|
|
42373
|
-
};
|
|
42374
|
-
var dateTimeFormats = {
|
|
42375
|
-
full: "{{date}} 'at' {{time}}",
|
|
42376
|
-
long: "{{date}} 'at' {{time}}",
|
|
42377
|
-
medium: "{{date}}, {{time}}",
|
|
42378
|
-
short: "{{date}}, {{time}}"
|
|
42379
|
-
};
|
|
42380
|
-
var formatLong = {
|
|
42381
|
-
date: buildFormatLongFn({
|
|
42382
|
-
formats: dateFormats,
|
|
42383
|
-
defaultWidth: "full"
|
|
42384
|
-
}),
|
|
42385
|
-
time: buildFormatLongFn({
|
|
42386
|
-
formats: timeFormats,
|
|
42387
|
-
defaultWidth: "full"
|
|
42388
|
-
}),
|
|
42389
|
-
dateTime: buildFormatLongFn({
|
|
42390
|
-
formats: dateTimeFormats,
|
|
42391
|
-
defaultWidth: "full"
|
|
42392
|
-
})
|
|
42393
|
-
};
|
|
42394
|
-
const formatLong$1 = formatLong;
|
|
42395
|
-
var formatRelativeLocale = {
|
|
42312
|
+
const formatRelativeLocale = {
|
|
42396
42313
|
lastWeek: "'last' eeee 'at' p",
|
|
42397
42314
|
yesterday: "'yesterday at' p",
|
|
42398
42315
|
today: "'today at' p",
|
|
@@ -42400,32 +42317,63 @@ var formatRelativeLocale = {
|
|
|
42400
42317
|
nextWeek: "eeee 'at' p",
|
|
42401
42318
|
other: "P"
|
|
42402
42319
|
};
|
|
42403
|
-
|
|
42404
|
-
|
|
42405
|
-
};
|
|
42406
|
-
const formatRelative$1 = formatRelative;
|
|
42407
|
-
var eraValues = {
|
|
42320
|
+
const formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
42321
|
+
const eraValues = {
|
|
42408
42322
|
narrow: ["B", "A"],
|
|
42409
42323
|
abbreviated: ["BC", "AD"],
|
|
42410
42324
|
wide: ["Before Christ", "Anno Domini"]
|
|
42411
42325
|
};
|
|
42412
|
-
|
|
42326
|
+
const quarterValues = {
|
|
42413
42327
|
narrow: ["1", "2", "3", "4"],
|
|
42414
42328
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
42415
42329
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
42416
42330
|
};
|
|
42417
|
-
|
|
42331
|
+
const monthValues = {
|
|
42418
42332
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
42419
|
-
abbreviated: [
|
|
42420
|
-
|
|
42333
|
+
abbreviated: [
|
|
42334
|
+
"Jan",
|
|
42335
|
+
"Feb",
|
|
42336
|
+
"Mar",
|
|
42337
|
+
"Apr",
|
|
42338
|
+
"May",
|
|
42339
|
+
"Jun",
|
|
42340
|
+
"Jul",
|
|
42341
|
+
"Aug",
|
|
42342
|
+
"Sep",
|
|
42343
|
+
"Oct",
|
|
42344
|
+
"Nov",
|
|
42345
|
+
"Dec"
|
|
42346
|
+
],
|
|
42347
|
+
wide: [
|
|
42348
|
+
"January",
|
|
42349
|
+
"February",
|
|
42350
|
+
"March",
|
|
42351
|
+
"April",
|
|
42352
|
+
"May",
|
|
42353
|
+
"June",
|
|
42354
|
+
"July",
|
|
42355
|
+
"August",
|
|
42356
|
+
"September",
|
|
42357
|
+
"October",
|
|
42358
|
+
"November",
|
|
42359
|
+
"December"
|
|
42360
|
+
]
|
|
42421
42361
|
};
|
|
42422
|
-
|
|
42362
|
+
const dayValues = {
|
|
42423
42363
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
42424
42364
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
42425
42365
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
42426
|
-
wide: [
|
|
42366
|
+
wide: [
|
|
42367
|
+
"Sunday",
|
|
42368
|
+
"Monday",
|
|
42369
|
+
"Tuesday",
|
|
42370
|
+
"Wednesday",
|
|
42371
|
+
"Thursday",
|
|
42372
|
+
"Friday",
|
|
42373
|
+
"Saturday"
|
|
42374
|
+
]
|
|
42427
42375
|
};
|
|
42428
|
-
|
|
42376
|
+
const dayPeriodValues = {
|
|
42429
42377
|
narrow: {
|
|
42430
42378
|
am: "a",
|
|
42431
42379
|
pm: "p",
|
|
@@ -42457,7 +42405,7 @@ var dayPeriodValues = {
|
|
|
42457
42405
|
night: "night"
|
|
42458
42406
|
}
|
|
42459
42407
|
};
|
|
42460
|
-
|
|
42408
|
+
const formattingDayPeriodValues = {
|
|
42461
42409
|
narrow: {
|
|
42462
42410
|
am: "a",
|
|
42463
42411
|
pm: "p",
|
|
@@ -42489,9 +42437,9 @@ var formattingDayPeriodValues = {
|
|
|
42489
42437
|
night: "at night"
|
|
42490
42438
|
}
|
|
42491
42439
|
};
|
|
42492
|
-
|
|
42493
|
-
|
|
42494
|
-
|
|
42440
|
+
const ordinalNumber = (dirtyNumber, _options) => {
|
|
42441
|
+
const number = Number(dirtyNumber);
|
|
42442
|
+
const rem100 = number % 100;
|
|
42495
42443
|
if (rem100 > 20 || rem100 < 10) {
|
|
42496
42444
|
switch (rem100 % 10) {
|
|
42497
42445
|
case 1:
|
|
@@ -42504,7 +42452,7 @@ var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
|
|
|
42504
42452
|
}
|
|
42505
42453
|
return number + "th";
|
|
42506
42454
|
};
|
|
42507
|
-
|
|
42455
|
+
const localize = {
|
|
42508
42456
|
ordinalNumber,
|
|
42509
42457
|
era: buildLocalizeFn({
|
|
42510
42458
|
values: eraValues,
|
|
@@ -42513,9 +42461,7 @@ var localize = {
|
|
|
42513
42461
|
quarter: buildLocalizeFn({
|
|
42514
42462
|
values: quarterValues,
|
|
42515
42463
|
defaultWidth: "wide",
|
|
42516
|
-
argumentCallback:
|
|
42517
|
-
return quarter - 1;
|
|
42518
|
-
}
|
|
42464
|
+
argumentCallback: (quarter) => quarter - 1
|
|
42519
42465
|
}),
|
|
42520
42466
|
month: buildLocalizeFn({
|
|
42521
42467
|
values: monthValues,
|
|
@@ -42532,49 +42478,74 @@ var localize = {
|
|
|
42532
42478
|
defaultFormattingWidth: "wide"
|
|
42533
42479
|
})
|
|
42534
42480
|
};
|
|
42535
|
-
const
|
|
42536
|
-
|
|
42537
|
-
|
|
42538
|
-
var matchEraPatterns = {
|
|
42481
|
+
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
42482
|
+
const parseOrdinalNumberPattern = /\d+/i;
|
|
42483
|
+
const matchEraPatterns = {
|
|
42539
42484
|
narrow: /^(b|a)/i,
|
|
42540
42485
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
42541
42486
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
42542
42487
|
};
|
|
42543
|
-
|
|
42488
|
+
const parseEraPatterns = {
|
|
42544
42489
|
any: [/^b/i, /^(a|c)/i]
|
|
42545
42490
|
};
|
|
42546
|
-
|
|
42491
|
+
const matchQuarterPatterns = {
|
|
42547
42492
|
narrow: /^[1234]/i,
|
|
42548
42493
|
abbreviated: /^q[1234]/i,
|
|
42549
42494
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
42550
42495
|
};
|
|
42551
|
-
|
|
42496
|
+
const parseQuarterPatterns = {
|
|
42552
42497
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
42553
42498
|
};
|
|
42554
|
-
|
|
42499
|
+
const matchMonthPatterns = {
|
|
42555
42500
|
narrow: /^[jfmasond]/i,
|
|
42556
42501
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
42557
42502
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
42558
42503
|
};
|
|
42559
|
-
|
|
42560
|
-
narrow: [
|
|
42561
|
-
|
|
42504
|
+
const parseMonthPatterns = {
|
|
42505
|
+
narrow: [
|
|
42506
|
+
/^j/i,
|
|
42507
|
+
/^f/i,
|
|
42508
|
+
/^m/i,
|
|
42509
|
+
/^a/i,
|
|
42510
|
+
/^m/i,
|
|
42511
|
+
/^j/i,
|
|
42512
|
+
/^j/i,
|
|
42513
|
+
/^a/i,
|
|
42514
|
+
/^s/i,
|
|
42515
|
+
/^o/i,
|
|
42516
|
+
/^n/i,
|
|
42517
|
+
/^d/i
|
|
42518
|
+
],
|
|
42519
|
+
any: [
|
|
42520
|
+
/^ja/i,
|
|
42521
|
+
/^f/i,
|
|
42522
|
+
/^mar/i,
|
|
42523
|
+
/^ap/i,
|
|
42524
|
+
/^may/i,
|
|
42525
|
+
/^jun/i,
|
|
42526
|
+
/^jul/i,
|
|
42527
|
+
/^au/i,
|
|
42528
|
+
/^s/i,
|
|
42529
|
+
/^o/i,
|
|
42530
|
+
/^n/i,
|
|
42531
|
+
/^d/i
|
|
42532
|
+
]
|
|
42562
42533
|
};
|
|
42563
|
-
|
|
42534
|
+
const matchDayPatterns = {
|
|
42564
42535
|
narrow: /^[smtwf]/i,
|
|
42565
42536
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
42566
42537
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
42567
42538
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
42568
42539
|
};
|
|
42569
|
-
|
|
42540
|
+
const parseDayPatterns = {
|
|
42570
42541
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
42571
42542
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
42572
42543
|
};
|
|
42573
|
-
|
|
42544
|
+
const matchDayPeriodPatterns = {
|
|
42574
42545
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
42575
42546
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
42576
42547
|
};
|
|
42577
|
-
|
|
42548
|
+
const parseDayPeriodPatterns = {
|
|
42578
42549
|
any: {
|
|
42579
42550
|
am: /^a/i,
|
|
42580
42551
|
pm: /^p/i,
|
|
@@ -42586,13 +42557,11 @@ var parseDayPeriodPatterns = {
|
|
|
42586
42557
|
night: /night/i
|
|
42587
42558
|
}
|
|
42588
42559
|
};
|
|
42589
|
-
|
|
42560
|
+
const match = {
|
|
42590
42561
|
ordinalNumber: buildMatchPatternFn({
|
|
42591
42562
|
matchPattern: matchOrdinalNumberPattern,
|
|
42592
42563
|
parsePattern: parseOrdinalNumberPattern,
|
|
42593
|
-
valueCallback:
|
|
42594
|
-
return parseInt(value, 10);
|
|
42595
|
-
}
|
|
42564
|
+
valueCallback: (value) => parseInt(value, 10)
|
|
42596
42565
|
}),
|
|
42597
42566
|
era: buildMatchFn({
|
|
42598
42567
|
matchPatterns: matchEraPatterns,
|
|
@@ -42605,9 +42574,7 @@ var match = {
|
|
|
42605
42574
|
defaultMatchWidth: "wide",
|
|
42606
42575
|
parsePatterns: parseQuarterPatterns,
|
|
42607
42576
|
defaultParseWidth: "any",
|
|
42608
|
-
valueCallback:
|
|
42609
|
-
return index + 1;
|
|
42610
|
-
}
|
|
42577
|
+
valueCallback: (index) => index + 1
|
|
42611
42578
|
}),
|
|
42612
42579
|
month: buildMatchFn({
|
|
42613
42580
|
matchPatterns: matchMonthPatterns,
|
|
@@ -42628,125 +42595,50 @@ var match = {
|
|
|
42628
42595
|
defaultParseWidth: "any"
|
|
42629
42596
|
})
|
|
42630
42597
|
};
|
|
42631
|
-
const
|
|
42632
|
-
|
|
42598
|
+
const dateFormats = {
|
|
42599
|
+
full: "EEEE, MMMM do, y",
|
|
42600
|
+
long: "MMMM do, y",
|
|
42601
|
+
medium: "MMM d, y",
|
|
42602
|
+
short: "MM/dd/yyyy"
|
|
42603
|
+
};
|
|
42604
|
+
const timeFormats = {
|
|
42605
|
+
full: "h:mm:ss a zzzz",
|
|
42606
|
+
long: "h:mm:ss a z",
|
|
42607
|
+
medium: "h:mm:ss a",
|
|
42608
|
+
short: "h:mm a"
|
|
42609
|
+
};
|
|
42610
|
+
const dateTimeFormats = {
|
|
42611
|
+
full: "{{date}} 'at' {{time}}",
|
|
42612
|
+
long: "{{date}} 'at' {{time}}",
|
|
42613
|
+
medium: "{{date}}, {{time}}",
|
|
42614
|
+
short: "{{date}}, {{time}}"
|
|
42615
|
+
};
|
|
42616
|
+
const formatLong = {
|
|
42617
|
+
date: buildFormatLongFn({
|
|
42618
|
+
formats: dateFormats,
|
|
42619
|
+
defaultWidth: "full"
|
|
42620
|
+
}),
|
|
42621
|
+
time: buildFormatLongFn({
|
|
42622
|
+
formats: timeFormats,
|
|
42623
|
+
defaultWidth: "full"
|
|
42624
|
+
}),
|
|
42625
|
+
dateTime: buildFormatLongFn({
|
|
42626
|
+
formats: dateTimeFormats,
|
|
42627
|
+
defaultWidth: "full"
|
|
42628
|
+
})
|
|
42629
|
+
};
|
|
42630
|
+
const enUS = {
|
|
42633
42631
|
code: "en-US",
|
|
42634
|
-
formatDistance
|
|
42635
|
-
formatLong
|
|
42636
|
-
formatRelative
|
|
42637
|
-
localize
|
|
42638
|
-
match
|
|
42632
|
+
formatDistance,
|
|
42633
|
+
formatLong,
|
|
42634
|
+
formatRelative,
|
|
42635
|
+
localize,
|
|
42636
|
+
match,
|
|
42639
42637
|
options: {
|
|
42640
42638
|
weekStartsOn: 0,
|
|
42641
42639
|
firstWeekContainsDate: 1
|
|
42642
42640
|
}
|
|
42643
42641
|
};
|
|
42644
|
-
const enUS = locale;
|
|
42645
|
-
function assign(target, object) {
|
|
42646
|
-
if (target == null) {
|
|
42647
|
-
throw new TypeError("assign requires that input parameter not be null or undefined");
|
|
42648
|
-
}
|
|
42649
|
-
for (var property2 in object) {
|
|
42650
|
-
if (Object.prototype.hasOwnProperty.call(object, property2)) {
|
|
42651
|
-
target[property2] = object[property2];
|
|
42652
|
-
}
|
|
42653
|
-
}
|
|
42654
|
-
return target;
|
|
42655
|
-
}
|
|
42656
|
-
function cloneObject(object) {
|
|
42657
|
-
return assign({}, object);
|
|
42658
|
-
}
|
|
42659
|
-
var MINUTES_IN_DAY = 1440;
|
|
42660
|
-
var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
|
|
42661
|
-
var MINUTES_IN_MONTH = 43200;
|
|
42662
|
-
var MINUTES_IN_TWO_MONTHS = 86400;
|
|
42663
|
-
function formatDistance2(dirtyDate, dirtyBaseDate, options) {
|
|
42664
|
-
var _ref, _options$locale;
|
|
42665
|
-
requiredArgs(2, arguments);
|
|
42666
|
-
var defaultOptions2 = getDefaultOptions();
|
|
42667
|
-
var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : enUS;
|
|
42668
|
-
if (!locale2.formatDistance) {
|
|
42669
|
-
throw new RangeError("locale must contain formatDistance property");
|
|
42670
|
-
}
|
|
42671
|
-
var comparison = compareAsc(dirtyDate, dirtyBaseDate);
|
|
42672
|
-
if (isNaN(comparison)) {
|
|
42673
|
-
throw new RangeError("Invalid time value");
|
|
42674
|
-
}
|
|
42675
|
-
var localizeOptions = assign(cloneObject(options), {
|
|
42676
|
-
addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
|
|
42677
|
-
comparison
|
|
42678
|
-
});
|
|
42679
|
-
var dateLeft;
|
|
42680
|
-
var dateRight;
|
|
42681
|
-
if (comparison > 0) {
|
|
42682
|
-
dateLeft = toDate(dirtyBaseDate);
|
|
42683
|
-
dateRight = toDate(dirtyDate);
|
|
42684
|
-
} else {
|
|
42685
|
-
dateLeft = toDate(dirtyDate);
|
|
42686
|
-
dateRight = toDate(dirtyBaseDate);
|
|
42687
|
-
}
|
|
42688
|
-
var seconds = differenceInSeconds(dateRight, dateLeft);
|
|
42689
|
-
var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3;
|
|
42690
|
-
var minutes = Math.round((seconds - offsetInSeconds) / 60);
|
|
42691
|
-
var months;
|
|
42692
|
-
if (minutes < 2) {
|
|
42693
|
-
if (options !== null && options !== void 0 && options.includeSeconds) {
|
|
42694
|
-
if (seconds < 5) {
|
|
42695
|
-
return locale2.formatDistance("lessThanXSeconds", 5, localizeOptions);
|
|
42696
|
-
} else if (seconds < 10) {
|
|
42697
|
-
return locale2.formatDistance("lessThanXSeconds", 10, localizeOptions);
|
|
42698
|
-
} else if (seconds < 20) {
|
|
42699
|
-
return locale2.formatDistance("lessThanXSeconds", 20, localizeOptions);
|
|
42700
|
-
} else if (seconds < 40) {
|
|
42701
|
-
return locale2.formatDistance("halfAMinute", 0, localizeOptions);
|
|
42702
|
-
} else if (seconds < 60) {
|
|
42703
|
-
return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
|
|
42704
|
-
} else {
|
|
42705
|
-
return locale2.formatDistance("xMinutes", 1, localizeOptions);
|
|
42706
|
-
}
|
|
42707
|
-
} else {
|
|
42708
|
-
if (minutes === 0) {
|
|
42709
|
-
return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
|
|
42710
|
-
} else {
|
|
42711
|
-
return locale2.formatDistance("xMinutes", minutes, localizeOptions);
|
|
42712
|
-
}
|
|
42713
|
-
}
|
|
42714
|
-
} else if (minutes < 45) {
|
|
42715
|
-
return locale2.formatDistance("xMinutes", minutes, localizeOptions);
|
|
42716
|
-
} else if (minutes < 90) {
|
|
42717
|
-
return locale2.formatDistance("aboutXHours", 1, localizeOptions);
|
|
42718
|
-
} else if (minutes < MINUTES_IN_DAY) {
|
|
42719
|
-
var hours = Math.round(minutes / 60);
|
|
42720
|
-
return locale2.formatDistance("aboutXHours", hours, localizeOptions);
|
|
42721
|
-
} else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
|
|
42722
|
-
return locale2.formatDistance("xDays", 1, localizeOptions);
|
|
42723
|
-
} else if (minutes < MINUTES_IN_MONTH) {
|
|
42724
|
-
var days = Math.round(minutes / MINUTES_IN_DAY);
|
|
42725
|
-
return locale2.formatDistance("xDays", days, localizeOptions);
|
|
42726
|
-
} else if (minutes < MINUTES_IN_TWO_MONTHS) {
|
|
42727
|
-
months = Math.round(minutes / MINUTES_IN_MONTH);
|
|
42728
|
-
return locale2.formatDistance("aboutXMonths", months, localizeOptions);
|
|
42729
|
-
}
|
|
42730
|
-
months = differenceInMonths(dateRight, dateLeft);
|
|
42731
|
-
if (months < 12) {
|
|
42732
|
-
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
|
|
42733
|
-
return locale2.formatDistance("xMonths", nearestMonth, localizeOptions);
|
|
42734
|
-
} else {
|
|
42735
|
-
var monthsSinceStartOfYear = months % 12;
|
|
42736
|
-
var years = Math.floor(months / 12);
|
|
42737
|
-
if (monthsSinceStartOfYear < 3) {
|
|
42738
|
-
return locale2.formatDistance("aboutXYears", years, localizeOptions);
|
|
42739
|
-
} else if (monthsSinceStartOfYear < 9) {
|
|
42740
|
-
return locale2.formatDistance("overXYears", years, localizeOptions);
|
|
42741
|
-
} else {
|
|
42742
|
-
return locale2.formatDistance("almostXYears", years + 1, localizeOptions);
|
|
42743
|
-
}
|
|
42744
|
-
}
|
|
42745
|
-
}
|
|
42746
|
-
function formatDistanceToNow(dirtyDate, options) {
|
|
42747
|
-
requiredArgs(1, arguments);
|
|
42748
|
-
return formatDistance2(dirtyDate, Date.now(), options);
|
|
42749
|
-
}
|
|
42750
42642
|
const Select = SelectPrimitive.Root;
|
|
42751
42643
|
const SelectValue = SelectPrimitive.Value;
|
|
42752
42644
|
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
@@ -43382,7 +43274,7 @@ const TimePicker = React.forwardRef(
|
|
|
43382
43274
|
TimePicker.displayName = "TimePicker";
|
|
43383
43275
|
const DateTimePicker = React.forwardRef(
|
|
43384
43276
|
({
|
|
43385
|
-
locale
|
|
43277
|
+
locale = enUS,
|
|
43386
43278
|
defaultPopupValue = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)),
|
|
43387
43279
|
value,
|
|
43388
43280
|
onChange,
|
|
@@ -43427,7 +43319,7 @@ const DateTimePicker = React.forwardRef(
|
|
|
43427
43319
|
}),
|
|
43428
43320
|
[displayDate]
|
|
43429
43321
|
);
|
|
43430
|
-
const { options, localize: localize2, formatLong: formatLong2 } =
|
|
43322
|
+
const { options, localize: localize2, formatLong: formatLong2 } = locale;
|
|
43431
43323
|
if (options && localize2 && formatLong2) {
|
|
43432
43324
|
({
|
|
43433
43325
|
...enUS,
|
|
@@ -43473,7 +43365,7 @@ const DateTimePicker = React.forwardRef(
|
|
|
43473
43365
|
onSelect: handleDaySelect,
|
|
43474
43366
|
initialMonth: value ?? defaultPopupValue,
|
|
43475
43367
|
yearRange,
|
|
43476
|
-
locale
|
|
43368
|
+
locale,
|
|
43477
43369
|
...props
|
|
43478
43370
|
}
|
|
43479
43371
|
), granularity !== "day" && /* @__PURE__ */ React.createElement("div", { className: "border-border border-t p-3" }, /* @__PURE__ */ React.createElement(
|
|
@@ -43501,11 +43393,11 @@ const DateField = wrapFieldsWithMeta(
|
|
|
43501
43393
|
const granularity = timeFormat ? "minute" : "day";
|
|
43502
43394
|
const inputRef = React__default.useRef(null);
|
|
43503
43395
|
React__default.useEffect(() => {
|
|
43504
|
-
if (inputRef.current && rest.
|
|
43396
|
+
if (inputRef.current && rest.focusIntent) {
|
|
43505
43397
|
inputRef.current.focus();
|
|
43506
43398
|
inputRef.current.open();
|
|
43507
43399
|
}
|
|
43508
|
-
}, [rest.
|
|
43400
|
+
}, [rest.focusIntent]);
|
|
43509
43401
|
const getTimeFormat = useCallback(() => {
|
|
43510
43402
|
if (timeFormat === false) {
|
|
43511
43403
|
return;
|
|
@@ -43521,10 +43413,11 @@ const DateField = wrapFieldsWithMeta(
|
|
|
43521
43413
|
}
|
|
43522
43414
|
return dateFormat;
|
|
43523
43415
|
}, [dateFormat]);
|
|
43524
|
-
const date = input.value ? new Date(input.value) :
|
|
43416
|
+
const date = input.value ? new Date(input.value) : /* @__PURE__ */ new Date();
|
|
43525
43417
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
43526
43418
|
DateTimePicker,
|
|
43527
43419
|
{
|
|
43420
|
+
...rest,
|
|
43528
43421
|
ref: inputRef,
|
|
43529
43422
|
granularity,
|
|
43530
43423
|
onChange: (value) => input.onChange(value ? value.toISOString() : value),
|
|
@@ -43532,7 +43425,7 @@ const DateField = wrapFieldsWithMeta(
|
|
|
43532
43425
|
hourCycle: 12,
|
|
43533
43426
|
dateFormat: getDateFormat(),
|
|
43534
43427
|
value: date,
|
|
43535
|
-
|
|
43428
|
+
locale: rest.locale ? { code: rest.locale } : void 0
|
|
43536
43429
|
}
|
|
43537
43430
|
));
|
|
43538
43431
|
}
|
|
@@ -44369,7 +44262,7 @@ const BranchItem = ({
|
|
|
44369
44262
|
"Currently editing"
|
|
44370
44263
|
)), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status })))
|
|
44371
44264
|
),
|
|
44372
|
-
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 min-w-0" }, creatingPR ? /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold text-blue-600" }, "Creating PR"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight text-blue-500" }, "Please wait...")), /* @__PURE__ */ React.createElement(FaSpinner, { className: "w-3 h-auto animate-spin text-blue-500" })) : /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight whitespace-nowrap" }, formatDistanceToNow
|
|
44265
|
+
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 min-w-0" }, creatingPR ? /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold text-blue-600" }, "Creating PR"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight text-blue-500" }, "Please wait...")), /* @__PURE__ */ React.createElement(FaSpinner, { className: "w-3 h-auto animate-spin text-blue-500" })) : /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight whitespace-nowrap" }, formatDistanceToNow(new Date(branch.indexStatus.timestamp), {
|
|
44373
44266
|
addSuffix: true
|
|
44374
44267
|
}))),
|
|
44375
44268
|
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 flex", onClick: (e3) => e3.stopPropagation() }, branch.githubPullRequestUrl ? /* @__PURE__ */ React.createElement(
|
|
@@ -46634,7 +46527,7 @@ const NavProvider = ({
|
|
|
46634
46527
|
};
|
|
46635
46528
|
return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
|
|
46636
46529
|
};
|
|
46637
|
-
const version$1 = "3.1.
|
|
46530
|
+
const version$1 = "3.1.3";
|
|
46638
46531
|
const VersionInfo = () => {
|
|
46639
46532
|
var _a2, _b, _c, _d, _e, _f;
|
|
46640
46533
|
const cms = useCMS();
|
|
@@ -48094,6 +47987,25 @@ class TinaCMS extends CMS {
|
|
|
48094
47987
|
});
|
|
48095
47988
|
}
|
|
48096
47989
|
}
|
|
47990
|
+
const ACTION_TYPES = {
|
|
47991
|
+
FORMS_ADD: "forms:add",
|
|
47992
|
+
FORMS_REMOVE: "forms:remove",
|
|
47993
|
+
FORMS_CLEAR: "forms:clear",
|
|
47994
|
+
FORMS_SET_ACTIVE_FORM_ID: "forms:set-active-form-id",
|
|
47995
|
+
FORMS_SET_ACTIVE_FIELD_NAME: "forms:set-active-field-name",
|
|
47996
|
+
FORMS_SET_HOVERED_FIELD_NAME: "forms:set-hovered-field-name",
|
|
47997
|
+
FORM_LISTS_ADD: "form-lists:add",
|
|
47998
|
+
FORM_LISTS_REMOVE: "form-lists:remove",
|
|
47999
|
+
FORM_LISTS_CLEAR: "form-lists:clear",
|
|
48000
|
+
SET_EDIT_MODE: "set-edit-mode",
|
|
48001
|
+
INCREMENT_OPERATION_INDEX: "increment-operation-index",
|
|
48002
|
+
SET_QUICK_EDITING_SUPPORTED: "set-quick-editing-supported",
|
|
48003
|
+
SET_QUICK_EDITING_ENABLED: "set-quick-editing-enabled",
|
|
48004
|
+
TOGGLE_QUICK_EDITING_ENABLED: "toggle-quick-editing-enabled",
|
|
48005
|
+
TOGGLE_EDIT_STATE: "toggle-edit-state",
|
|
48006
|
+
SIDEBAR_SET_DISPLAY_STATE: "sidebar:set-display-state",
|
|
48007
|
+
SIDEBAR_SET_LOADING_STATE: "sidebar:set-loading-state"
|
|
48008
|
+
};
|
|
48097
48009
|
const initialState = (cms) => {
|
|
48098
48010
|
var _a2;
|
|
48099
48011
|
return {
|
|
@@ -48109,24 +48021,24 @@ const initialState = (cms) => {
|
|
|
48109
48021
|
};
|
|
48110
48022
|
function tinaReducer(state, action) {
|
|
48111
48023
|
switch (action.type) {
|
|
48112
|
-
case
|
|
48024
|
+
case ACTION_TYPES.SET_QUICK_EDITING_SUPPORTED:
|
|
48113
48025
|
return {
|
|
48114
48026
|
...state,
|
|
48115
48027
|
quickEditSupported: action.value
|
|
48116
48028
|
};
|
|
48117
|
-
case
|
|
48029
|
+
case ACTION_TYPES.SET_EDIT_MODE:
|
|
48118
48030
|
return { ...state, editingMode: action.value };
|
|
48119
|
-
case
|
|
48031
|
+
case ACTION_TYPES.FORMS_ADD:
|
|
48120
48032
|
if (state.forms.find((f2) => f2.tinaForm.id === action.value.id)) {
|
|
48121
48033
|
return state;
|
|
48122
48034
|
}
|
|
48123
48035
|
return { ...state, forms: [...state.forms, { tinaForm: action.value }] };
|
|
48124
|
-
case
|
|
48036
|
+
case ACTION_TYPES.FORMS_REMOVE:
|
|
48125
48037
|
return {
|
|
48126
48038
|
...state,
|
|
48127
48039
|
forms: state.forms.filter((form) => form.tinaForm.id !== action.value)
|
|
48128
48040
|
};
|
|
48129
|
-
case
|
|
48041
|
+
case ACTION_TYPES.FORM_LISTS_CLEAR: {
|
|
48130
48042
|
return {
|
|
48131
48043
|
...state,
|
|
48132
48044
|
quickEditSupported: false,
|
|
@@ -48136,7 +48048,7 @@ function tinaReducer(state, action) {
|
|
|
48136
48048
|
forms: []
|
|
48137
48049
|
};
|
|
48138
48050
|
}
|
|
48139
|
-
case
|
|
48051
|
+
case ACTION_TYPES.FORM_LISTS_ADD: {
|
|
48140
48052
|
let formListItemExists = false;
|
|
48141
48053
|
const nextFormLists = state.formLists.map((formList) => {
|
|
48142
48054
|
if (formList.id === action.value.id) {
|
|
@@ -48175,7 +48087,7 @@ function tinaReducer(state, action) {
|
|
|
48175
48087
|
isLoadingContent: false
|
|
48176
48088
|
};
|
|
48177
48089
|
}
|
|
48178
|
-
case
|
|
48090
|
+
case ACTION_TYPES.FORM_LISTS_REMOVE: {
|
|
48179
48091
|
const nextFormLists = state.formLists.filter(
|
|
48180
48092
|
({ id: id2 }) => id2 !== action.value
|
|
48181
48093
|
);
|
|
@@ -48199,7 +48111,7 @@ function tinaReducer(state, action) {
|
|
|
48199
48111
|
formLists: nextFormLists
|
|
48200
48112
|
};
|
|
48201
48113
|
}
|
|
48202
|
-
case
|
|
48114
|
+
case ACTION_TYPES.FORMS_SET_ACTIVE_FORM_ID:
|
|
48203
48115
|
if (action.value !== state.activeFormId) {
|
|
48204
48116
|
const newActiveForm = state.forms.find(
|
|
48205
48117
|
(form) => form.tinaForm.id === action.value
|
|
@@ -48216,7 +48128,7 @@ function tinaReducer(state, action) {
|
|
|
48216
48128
|
};
|
|
48217
48129
|
}
|
|
48218
48130
|
return state;
|
|
48219
|
-
case
|
|
48131
|
+
case ACTION_TYPES.FORMS_SET_ACTIVE_FIELD_NAME:
|
|
48220
48132
|
if (state.activeFormId === action.value.formId) {
|
|
48221
48133
|
const existingForm = state.forms.find(
|
|
48222
48134
|
(form) => form.tinaForm.id === action.value.formId
|
|
@@ -48229,7 +48141,8 @@ function tinaReducer(state, action) {
|
|
|
48229
48141
|
if (form.tinaForm.id === action.value.formId) {
|
|
48230
48142
|
return {
|
|
48231
48143
|
tinaForm: form.tinaForm,
|
|
48232
|
-
activeFieldName: action.value.fieldName
|
|
48144
|
+
activeFieldName: action.value.fieldName,
|
|
48145
|
+
hoveringFieldName: null
|
|
48233
48146
|
};
|
|
48234
48147
|
}
|
|
48235
48148
|
return form;
|
|
@@ -48245,13 +48158,49 @@ function tinaReducer(state, action) {
|
|
|
48245
48158
|
forms,
|
|
48246
48159
|
activeFormId: action.value.formId
|
|
48247
48160
|
};
|
|
48248
|
-
case
|
|
48161
|
+
case ACTION_TYPES.FORMS_SET_HOVERED_FIELD_NAME:
|
|
48162
|
+
const hoveredForms = state.forms.map((form) => {
|
|
48163
|
+
if (form.tinaForm.id === action.value.formId) {
|
|
48164
|
+
const activeFieldName = form.activeFieldName;
|
|
48165
|
+
const hoveredFieldName = action.value.fieldName;
|
|
48166
|
+
if (activeFieldName && hoveredFieldName) {
|
|
48167
|
+
if (activeFieldName === hoveredFieldName) {
|
|
48168
|
+
return {
|
|
48169
|
+
...form,
|
|
48170
|
+
hoveringFieldName: null
|
|
48171
|
+
};
|
|
48172
|
+
}
|
|
48173
|
+
const isChildOfActive = hoveredFieldName.startsWith(
|
|
48174
|
+
activeFieldName + "."
|
|
48175
|
+
);
|
|
48176
|
+
const activePathParts = activeFieldName.split(".");
|
|
48177
|
+
const hoveredPathParts = hoveredFieldName.split(".");
|
|
48178
|
+
const isSibling = activePathParts.length === hoveredPathParts.length && activePathParts.slice(0, -1).join(".") === hoveredPathParts.slice(0, -1).join(".");
|
|
48179
|
+
if (!isChildOfActive && !isSibling) {
|
|
48180
|
+
return {
|
|
48181
|
+
...form,
|
|
48182
|
+
hoveringFieldName: null
|
|
48183
|
+
};
|
|
48184
|
+
}
|
|
48185
|
+
}
|
|
48186
|
+
return {
|
|
48187
|
+
...form,
|
|
48188
|
+
hoveringFieldName: hoveredFieldName
|
|
48189
|
+
};
|
|
48190
|
+
}
|
|
48191
|
+
return form;
|
|
48192
|
+
});
|
|
48193
|
+
return {
|
|
48194
|
+
...state,
|
|
48195
|
+
forms: hoveredForms
|
|
48196
|
+
};
|
|
48197
|
+
case ACTION_TYPES.TOGGLE_EDIT_STATE: {
|
|
48249
48198
|
return state.sidebarDisplayState === "closed" ? { ...state, sidebarDisplayState: "open" } : {
|
|
48250
48199
|
...state,
|
|
48251
48200
|
sidebarDisplayState: "closed"
|
|
48252
48201
|
};
|
|
48253
48202
|
}
|
|
48254
|
-
case
|
|
48203
|
+
case ACTION_TYPES.SIDEBAR_SET_DISPLAY_STATE: {
|
|
48255
48204
|
if (action.value === "openOrFull") {
|
|
48256
48205
|
if (state.sidebarDisplayState === "closed") {
|
|
48257
48206
|
return {
|
|
@@ -48269,7 +48218,7 @@ function tinaReducer(state, action) {
|
|
|
48269
48218
|
}
|
|
48270
48219
|
return { ...state, sidebarDisplayState: action.value };
|
|
48271
48220
|
}
|
|
48272
|
-
case
|
|
48221
|
+
case ACTION_TYPES.SIDEBAR_SET_LOADING_STATE: {
|
|
48273
48222
|
return { ...state, isLoadingContent: action.value };
|
|
48274
48223
|
}
|
|
48275
48224
|
default:
|
|
@@ -48538,10 +48487,12 @@ const AboveViewportIndicator = () => {
|
|
|
48538
48487
|
const BelowViewportIndicator = () => {
|
|
48539
48488
|
return /* @__PURE__ */ React.createElement(IndicatorWrap, { position: "bottom" }, /* @__PURE__ */ React.createElement(ArrowWrap, null, /* @__PURE__ */ React.createElement(ChevronDownIcon, { className: "w-8 h-auto" })));
|
|
48540
48489
|
};
|
|
48541
|
-
const useScrollToFocusedField = () => {
|
|
48490
|
+
const useScrollToFocusedField = (enabled) => {
|
|
48542
48491
|
const { subscribe } = useEvent("field:focus");
|
|
48543
|
-
React.useEffect(
|
|
48544
|
-
|
|
48492
|
+
React.useEffect(() => {
|
|
48493
|
+
if (!enabled)
|
|
48494
|
+
return;
|
|
48495
|
+
return subscribe(({ fieldName }) => {
|
|
48545
48496
|
const ele = document.querySelector(
|
|
48546
48497
|
`[data-tinafield="${fieldName}"]`
|
|
48547
48498
|
);
|
|
@@ -48577,17 +48528,41 @@ const useScrollToFocusedField = () => {
|
|
|
48577
48528
|
});
|
|
48578
48529
|
}
|
|
48579
48530
|
}
|
|
48580
|
-
})
|
|
48581
|
-
);
|
|
48531
|
+
});
|
|
48532
|
+
}, [enabled, subscribe]);
|
|
48582
48533
|
};
|
|
48583
|
-
const
|
|
48584
|
-
|
|
48585
|
-
|
|
48586
|
-
|
|
48534
|
+
const FieldIndicator = ({
|
|
48535
|
+
eventType,
|
|
48536
|
+
checkFocusedAttribute = false,
|
|
48537
|
+
scrollToField = false
|
|
48538
|
+
}) => {
|
|
48539
|
+
const [fieldName, setFieldName] = React.useState(null);
|
|
48587
48540
|
const [display, setDisplay] = React.useState(false);
|
|
48588
48541
|
const [position, setPosition] = React.useState(false);
|
|
48589
48542
|
const [iframePosition, setIframePosition] = React.useState({ left: 0 });
|
|
48590
|
-
const
|
|
48543
|
+
const [isFocused2, setIsFocused] = React.useState(false);
|
|
48544
|
+
const activeEle = useFieldReference(fieldName);
|
|
48545
|
+
const { subscribe: subscribeFocus } = useEvent("field:focus");
|
|
48546
|
+
const { subscribe: subscribeHover } = useEvent("field:hover");
|
|
48547
|
+
React.useEffect(() => {
|
|
48548
|
+
const subscribe = eventType === "field:focus" ? subscribeFocus : subscribeHover;
|
|
48549
|
+
return subscribe(({ fieldName: eventFieldName, id: id2 }) => {
|
|
48550
|
+
setFieldName(`${id2}#${eventFieldName}`);
|
|
48551
|
+
if (eventType === "field:focus" && checkFocusedAttribute) {
|
|
48552
|
+
setIsFocused(true);
|
|
48553
|
+
}
|
|
48554
|
+
});
|
|
48555
|
+
}, [eventType, subscribeFocus, subscribeHover, checkFocusedAttribute]);
|
|
48556
|
+
React.useEffect(() => {
|
|
48557
|
+
if (!checkFocusedAttribute)
|
|
48558
|
+
return;
|
|
48559
|
+
if (activeEle) {
|
|
48560
|
+
const hasFocusedAttr = activeEle.hasAttribute("data-tina-field-focused");
|
|
48561
|
+
setIsFocused(hasFocusedAttr);
|
|
48562
|
+
} else {
|
|
48563
|
+
setIsFocused(false);
|
|
48564
|
+
}
|
|
48565
|
+
}, [activeEle, fieldName, checkFocusedAttribute]);
|
|
48591
48566
|
React.useEffect(() => {
|
|
48592
48567
|
let displayTimeout;
|
|
48593
48568
|
if (activeEle) {
|
|
@@ -48616,13 +48591,7 @@ const ActiveFieldIndicator = () => {
|
|
|
48616
48591
|
window.removeEventListener("scroll", rerender);
|
|
48617
48592
|
};
|
|
48618
48593
|
}, []);
|
|
48619
|
-
|
|
48620
|
-
React.useEffect(
|
|
48621
|
-
() => subscribe(({ fieldName, id: id2 }) => {
|
|
48622
|
-
setActiveFieldName(`${id2}#${fieldName}`);
|
|
48623
|
-
})
|
|
48624
|
-
);
|
|
48625
|
-
useScrollToFocusedField();
|
|
48594
|
+
useScrollToFocusedField(scrollToField);
|
|
48626
48595
|
if (!display)
|
|
48627
48596
|
return null;
|
|
48628
48597
|
const eleTopY = position.top + window.scrollY;
|
|
@@ -48635,6 +48604,7 @@ const ActiveFieldIndicator = () => {
|
|
|
48635
48604
|
if (eleBottomY < viewportTopY) {
|
|
48636
48605
|
return /* @__PURE__ */ React.createElement(AboveViewportIndicator, null);
|
|
48637
48606
|
}
|
|
48607
|
+
const outlineColor = checkFocusedAttribute && isFocused2 ? "2px dashed #C2410C" : "2px dashed var(--tina-color-indicator)";
|
|
48638
48608
|
return /* @__PURE__ */ React.createElement(
|
|
48639
48609
|
"div",
|
|
48640
48610
|
{
|
|
@@ -48645,7 +48615,7 @@ const ActiveFieldIndicator = () => {
|
|
|
48645
48615
|
left: position.left + window.scrollX + iframePosition.left,
|
|
48646
48616
|
width: position.width,
|
|
48647
48617
|
height: position.height,
|
|
48648
|
-
outline:
|
|
48618
|
+
outline: outlineColor,
|
|
48649
48619
|
borderRadius: "var(--tina-radius-small)",
|
|
48650
48620
|
transition: display ? activeEle ? `opacity 300ms ease-out` : `opacity 150ms ease-in` : `none`,
|
|
48651
48621
|
opacity: activeEle && display ? 0.8 : 0
|
|
@@ -48653,6 +48623,15 @@ const ActiveFieldIndicator = () => {
|
|
|
48653
48623
|
}
|
|
48654
48624
|
);
|
|
48655
48625
|
};
|
|
48626
|
+
const ActiveFieldIndicator = () => /* @__PURE__ */ React.createElement(
|
|
48627
|
+
FieldIndicator,
|
|
48628
|
+
{
|
|
48629
|
+
eventType: "field:focus",
|
|
48630
|
+
checkFocusedAttribute: true,
|
|
48631
|
+
scrollToField: true
|
|
48632
|
+
}
|
|
48633
|
+
);
|
|
48634
|
+
const HoveredFieldIndicator = () => /* @__PURE__ */ React.createElement(FieldIndicator, { eventType: "field:hover" });
|
|
48656
48635
|
const TinaUI = ({ children, position }) => {
|
|
48657
48636
|
const cms = useCMS();
|
|
48658
48637
|
const [resizingSidebar, setResizingSidebar] = React.useState(false);
|
|
@@ -48664,7 +48643,7 @@ const TinaUI = ({ children, position }) => {
|
|
|
48664
48643
|
position,
|
|
48665
48644
|
sidebar: cms.sidebar
|
|
48666
48645
|
}
|
|
48667
|
-
), /* @__PURE__ */ React.createElement(ActiveFieldIndicator, null), /* @__PURE__ */ React.createElement("div", { className: `${resizingSidebar ? "pointer-events-none" : ""}` }, children)));
|
|
48646
|
+
), /* @__PURE__ */ React.createElement(ActiveFieldIndicator, null), /* @__PURE__ */ React.createElement(HoveredFieldIndicator, null), /* @__PURE__ */ React.createElement("div", { className: `${resizingSidebar ? "pointer-events-none" : ""}` }, children)));
|
|
48668
48647
|
};
|
|
48669
48648
|
const TinaProvider = ({
|
|
48670
48649
|
cms,
|
|
@@ -64633,6 +64612,7 @@ const FormBuilder = ({
|
|
|
64633
64612
|
{
|
|
64634
64613
|
form: tinaForm,
|
|
64635
64614
|
activeFieldName: form.activeFieldName,
|
|
64615
|
+
hoveringFieldName: form.hoveringFieldName,
|
|
64636
64616
|
fields: fieldGroup.fields
|
|
64637
64617
|
}
|
|
64638
64618
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null))), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-6 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
|
|
@@ -64805,7 +64785,7 @@ const ImgEmbed = ({
|
|
|
64805
64785
|
"button",
|
|
64806
64786
|
{
|
|
64807
64787
|
type: "button",
|
|
64808
|
-
className: `flex-shrink min-w-0 focus-within:shadow-outline focus-within:border-
|
|
64788
|
+
className: `flex-shrink min-w-0 focus-within:shadow-outline focus-within:border-tina-orange-dark rounded outline-none overflow-visible cursor-pointer border-none hover:opacity-60 transition ease-out duration-100 ${selected ? "shadow-outline border-tina-orange-dark" : ""}`,
|
|
64809
64789
|
onClick: handleSelect
|
|
64810
64790
|
},
|
|
64811
64791
|
isImage(element.url) ? /* @__PURE__ */ React__default.createElement(StyledImage, { src: element.url }) : /* @__PURE__ */ React__default.createElement(StyledFile, { src: element.url })
|
|
@@ -65061,7 +65041,7 @@ const DotMenu = ({ onOpen, onRemove }) => {
|
|
|
65061
65041
|
PopoverButton,
|
|
65062
65042
|
{
|
|
65063
65043
|
as: "span",
|
|
65064
|
-
className: "cursor-pointer h-full relative inline-flex items-center px-1 py-0.5 rounded-r border border-gray-200 bg-white text-gray-500 hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-
|
|
65044
|
+
className: "cursor-pointer h-full relative inline-flex items-center px-1 py-0.5 rounded-r border border-gray-200 bg-white text-gray-500 hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-tina-orange-dark focus:border-tina-orange-dark"
|
|
65065
65045
|
},
|
|
65066
65046
|
/* @__PURE__ */ React__default.createElement(EllipsisIcon, { title: "Open options" })
|
|
65067
65047
|
), /* @__PURE__ */ React__default.createElement(
|
|
@@ -66039,7 +66019,7 @@ const editorVariants = cva(
|
|
|
66039
66019
|
ai: "w-full px-0 text-base md:text-sm",
|
|
66040
66020
|
aiChat: "max-h-[min(70vh,320px)] w-full max-w-[700px] overflow-y-auto px-3 py-2 text-base md:text-sm",
|
|
66041
66021
|
comment: cn$2("rounded-none border-none bg-transparent text-sm"),
|
|
66042
|
-
default: "size-full px-2 sm:px-4 pt-2 text-base",
|
|
66022
|
+
default: "size-full px-2 sm:px-4 pt-2 text-base min-h-[100px]",
|
|
66043
66023
|
demo: "size-full px-2 sm:px-4 pt-2 text-base h-[650px]",
|
|
66044
66024
|
fullWidth: "size-full px-2 sm:px-4 pt-4 pb-72 text-base",
|
|
66045
66025
|
none: "",
|
|
@@ -118983,13 +118963,13 @@ const RichEditor = ({ input, tinaForm, field }) => {
|
|
|
118983
118963
|
const plateElement = (_a3 = ref.current) == null ? void 0 : _a3.querySelector(
|
|
118984
118964
|
'[role="textbox"]'
|
|
118985
118965
|
);
|
|
118986
|
-
if (field.
|
|
118966
|
+
if (field.focusIntent && plateElement) {
|
|
118987
118967
|
if (plateElement)
|
|
118988
118968
|
plateElement.focus();
|
|
118989
118969
|
}
|
|
118990
118970
|
}, 100);
|
|
118991
118971
|
}
|
|
118992
|
-
}, [field.
|
|
118972
|
+
}, [field.focusIntent, ref]);
|
|
118993
118973
|
return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
|
|
118994
118974
|
Plate,
|
|
118995
118975
|
{
|
|
@@ -119080,7 +119060,7 @@ const MdxFieldPluginExtendible = {
|
|
|
119080
119060
|
/* @__PURE__ */ React__default.createElement(
|
|
119081
119061
|
"div",
|
|
119082
119062
|
{
|
|
119083
|
-
className: "min-h-[100px] max-w-full tina-prose relative shadow-inner focus-within:shadow-outline focus-within:border-
|
|
119063
|
+
className: "min-h-[100px] max-w-full tina-prose relative shadow-inner focus-within:shadow-outline focus-within:border-tina-orange-dark block w-full bg-white border border-gray-200 text-gray-600 focus-within:text-gray-900 rounded pt-0 py-2"
|
|
119084
119064
|
},
|
|
119085
119065
|
props.rawMode ? props.rawEditor : /* @__PURE__ */ React__default.createElement(RichEditor, { ...props })
|
|
119086
119066
|
)
|