tinacms 0.0.0-d08af95-20241024210716 → 0.0.0-d20d4ee-20250329210608

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.
Files changed (31) hide show
  1. package/dist/admin/api.d.ts +1 -0
  2. package/dist/admin/components/GetCollection.d.ts +2 -2
  3. package/dist/admin/types.d.ts +3 -0
  4. package/dist/auth/TinaCloudProvider.d.ts +1 -1
  5. package/dist/client.js +72 -45
  6. package/dist/client.mjs +49 -35
  7. package/dist/hooks/create-page-plugin.d.ts +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +2474 -1194
  10. package/dist/index.mjs +2492 -1212
  11. package/dist/{node-cache-4c336858.mjs → node-cache-5e8db9f0.mjs} +23 -10
  12. package/dist/react.d.ts +1 -0
  13. package/dist/react.js +13 -1
  14. package/dist/react.mjs +13 -1
  15. package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +17 -5
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +6 -11
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +5 -1
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +2 -2
  23. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  24. package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +5 -4
  25. package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
  26. package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
  27. package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
  28. package/dist/toolkit/tina-state.d.ts +4 -0
  29. package/dist/unifiedClient/index.d.ts +8 -1
  30. package/package.json +40 -40
  31. package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("@react-hook/window-size"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("yup"), require("@graphql-inspector/core"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "@react-hook/window-size", "graphql", "graphql-tag", "@tinacms/schema-tools", "yup", "@graphql-inspector/core", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
- })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, windowSize, graphql, gql, schemaTools, yup, core, reactRouterDom, mdx) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("@react-hook/window-size"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("graphql"), require("graphql-tag"), require("@tinacms/schema-tools"), require("@graphql-inspector/core"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "@react-hook/window-size", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "graphql", "graphql-tag", "@tinacms/schema-tools", "@graphql-inspector/core", "yup", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, windowSize, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, graphql, gql, schemaTools, core, yup, reactRouterDom, mdx) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -774,6 +774,22 @@ var __publicField = (obj, key, value) => {
774
774
  );
775
775
  };
776
776
  }
777
+ function wrapFieldWithNoHeader(Field) {
778
+ return (props) => {
779
+ return /* @__PURE__ */ React__namespace.createElement(
780
+ FieldMeta,
781
+ {
782
+ name: props.input.name,
783
+ label: false,
784
+ description: "",
785
+ error: props.meta.error,
786
+ index: props.index,
787
+ tinaForm: props.tinaForm
788
+ },
789
+ /* @__PURE__ */ React__namespace.createElement(Field, { ...props })
790
+ );
791
+ };
792
+ }
777
793
  function wrapFieldWithError(Field) {
778
794
  return (props) => {
779
795
  return /* @__PURE__ */ React__namespace.createElement(
@@ -846,6 +862,16 @@ var __publicField = (obj, key, value) => {
846
862
  className,
847
863
  ...props
848
864
  }) => {
865
+ if (typeof children === "string") {
866
+ return /* @__PURE__ */ React__namespace.createElement(
867
+ "span",
868
+ {
869
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
870
+ ...props,
871
+ dangerouslySetInnerHTML: { __html: children }
872
+ }
873
+ );
874
+ }
849
875
  return /* @__PURE__ */ React__namespace.createElement(
850
876
  "span",
851
877
  {
@@ -2917,7 +2943,7 @@ flowchart TD
2917
2943
  ),
2918
2944
  [plate.MARK_CODE]: CodeLeaf,
2919
2945
  [plate.MARK_UNDERLINE]: cn$1.withProps(plateCommon.PlateLeaf, { as: "u" }),
2920
- [plate.MARK_STRIKETHROUGH]: cn$1.withProps(plateCommon.PlateLeaf, { as: "s" }),
2946
+ [plate.MARK_STRIKETHROUGH]: ({ editor, leaf, text, ...props }) => /* @__PURE__ */ React.createElement("s", { ...props.attributes, ...props }),
2921
2947
  [plate.MARK_ITALIC]: cn$1.withProps(plateCommon.PlateLeaf, { as: "em" }),
2922
2948
  [plate.MARK_BOLD]: ({ editor, leaf, text, ...props }) => /* @__PURE__ */ React.createElement("strong", { ...props.attributes, ...props }),
2923
2949
  [plate.ELEMENT_HR]: ({
@@ -3804,7 +3830,7 @@ flowchart TD
3804
3830
  function _objectWithoutProperties(source, excluded) {
3805
3831
  if (source == null)
3806
3832
  return {};
3807
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3833
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3808
3834
  var key, i;
3809
3835
  if (Object.getOwnPropertySymbols) {
3810
3836
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3819,7 +3845,7 @@ flowchart TD
3819
3845
  }
3820
3846
  return target;
3821
3847
  }
3822
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3848
+ function _objectWithoutPropertiesLoose(source, excluded) {
3823
3849
  if (source == null)
3824
3850
  return {};
3825
3851
  var target = {};
@@ -4909,7 +4935,28 @@ flowchart TD
4909
4935
  onChange,
4910
4936
  value,
4911
4937
  step
4912
- }) => /* @__PURE__ */ React__namespace.createElement(Input, { type: "number", step, value, onChange });
4938
+ }) => /* @__PURE__ */ React__namespace.createElement(
4939
+ Input,
4940
+ {
4941
+ type: "number",
4942
+ step,
4943
+ value,
4944
+ onChange: (event) => {
4945
+ const inputValue = event.target.value;
4946
+ const newValue = inputValue === "" ? void 0 : inputValue;
4947
+ if (onChange) {
4948
+ const syntheticEvent = {
4949
+ ...event,
4950
+ target: {
4951
+ ...event.target,
4952
+ value: newValue
4953
+ }
4954
+ };
4955
+ onChange(syntheticEvent);
4956
+ }
4957
+ }
4958
+ }
4959
+ );
4913
4960
  function useCMS() {
4914
4961
  return useCMS$1();
4915
4962
  }
@@ -5150,7 +5197,7 @@ flowchart TD
5150
5197
  side: "bottom",
5151
5198
  className: cn(
5152
5199
  "rounded-md border bg-white p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
5153
- "max-h-[30vh] max-w-[30vh] overflow-y-auto",
5200
+ "max-h-[30vh] max-w-[30vw] overflow-y-auto",
5154
5201
  className
5155
5202
  ),
5156
5203
  ...props
@@ -5242,11 +5289,7 @@ flowchart TD
5242
5289
  const node = nodes.find((node2) => node2.id === value);
5243
5290
  return node ? node._internalSys.filename : null;
5244
5291
  };
5245
- const ComboboxDemo = ({
5246
- cms,
5247
- input,
5248
- field
5249
- }) => {
5292
+ const Combobox = ({ cms, input, field }) => {
5250
5293
  const [open2, setOpen] = React__namespace.useState(false);
5251
5294
  const [value, setValue] = React__namespace.useState(input.value);
5252
5295
  const [displayText, setDisplayText] = React__namespace.useState(null);
@@ -5262,7 +5305,9 @@ flowchart TD
5262
5305
  }, [value, input, optionSets]);
5263
5306
  React__namespace.useEffect(() => {
5264
5307
  if (field.experimental___filter && optionSets.length > 0) {
5265
- setFilteredOptionsList(field.experimental___filter(optionSets, void 0));
5308
+ setFilteredOptionsList(
5309
+ field.experimental___filter(optionSets, void 0)
5310
+ );
5266
5311
  } else {
5267
5312
  setFilteredOptionsList(optionSets);
5268
5313
  }
@@ -5270,17 +5315,17 @@ flowchart TD
5270
5315
  if (loading === true) {
5271
5316
  return /* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" });
5272
5317
  }
5273
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
5318
+ return /* @__PURE__ */ React__namespace.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
5274
5319
  Button,
5275
5320
  {
5276
5321
  variant: "outline",
5277
5322
  role: "combobox",
5278
5323
  "aria-expanded": open2,
5279
- className: "w-52 justify-between"
5324
+ className: "w-full justify-between"
5280
5325
  },
5281
5326
  /* @__PURE__ */ React__namespace.createElement("p", { className: "truncate" }, displayText ?? "Choose an option..."),
5282
5327
  open2 ? /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropdown, { size: 20 })
5283
- )), /* @__PURE__ */ React__namespace.createElement(PopoverContent, { className: "p-0 relative" }, /* @__PURE__ */ React__namespace.createElement(
5328
+ )), /* @__PURE__ */ React__namespace.createElement(PopoverContent, { className: "p-0 relative min-w-[var(--radix-popover-trigger-width)]" }, /* @__PURE__ */ React__namespace.createElement(
5284
5329
  Command,
5285
5330
  {
5286
5331
  shouldFilter: !field.experimental___filter,
@@ -5304,32 +5349,25 @@ flowchart TD
5304
5349
  }
5305
5350
  ),
5306
5351
  /* @__PURE__ */ React__namespace.createElement(CommandEmpty, null, "No reference found"),
5307
- /* @__PURE__ */ React__namespace.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React__namespace.createElement(
5308
- CommandGroup,
5309
- {
5310
- key: `${collection}-group`,
5311
- heading: collection
5312
- },
5313
- /* @__PURE__ */ React__namespace.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
5314
- const { id, _values } = node;
5315
- return /* @__PURE__ */ React__namespace.createElement(
5316
- OptionComponent,
5317
- {
5318
- id,
5319
- key: id,
5320
- value,
5321
- field,
5322
- _values,
5323
- node,
5324
- onSelect: (currentValue) => {
5325
- setValue(currentValue);
5326
- setOpen(false);
5327
- }
5352
+ /* @__PURE__ */ React__namespace.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React__namespace.createElement(CommandGroup, { key: `${collection}-group`, heading: collection }, /* @__PURE__ */ React__namespace.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
5353
+ const { id, _values } = node;
5354
+ return /* @__PURE__ */ React__namespace.createElement(
5355
+ OptionComponent,
5356
+ {
5357
+ id,
5358
+ key: id,
5359
+ value,
5360
+ field,
5361
+ _values,
5362
+ node,
5363
+ onSelect: (currentValue) => {
5364
+ setValue(currentValue);
5365
+ setOpen(false);
5328
5366
  }
5329
- );
5330
- }))
5331
- ))))
5332
- ))));
5367
+ }
5368
+ );
5369
+ }))))))
5370
+ )));
5333
5371
  };
5334
5372
  const useGetNode = (cms, id) => {
5335
5373
  const [document2, setDocument] = React__namespace.useState(
@@ -5402,7 +5440,7 @@ flowchart TD
5402
5440
  };
5403
5441
  const Reference = ({ input, field }) => {
5404
5442
  const cms = useCMS();
5405
- return /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__namespace.createElement(ComboboxDemo, { cms, input, field })), /* @__PURE__ */ React__namespace.createElement(ReferenceLink, { cms, input }));
5443
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("div", { className: "relative group" }, /* @__PURE__ */ React__namespace.createElement(Combobox, { cms, input, field })), /* @__PURE__ */ React__namespace.createElement(ReferenceLink, { cms, input }));
5406
5444
  };
5407
5445
  const ButtonToggle = ({
5408
5446
  input,
@@ -5639,7 +5677,9 @@ flowchart TD
5639
5677
  onClick: () => {
5640
5678
  const state = tinaForm.finalForm.getState();
5641
5679
  if (state.invalid === true) {
5642
- cms.alerts.error("Cannot navigate away from an invalid form.");
5680
+ cms.alerts.error(
5681
+ "Cannot navigate away from an invalid form."
5682
+ );
5643
5683
  return;
5644
5684
  }
5645
5685
  cms.dispatch({
@@ -5710,10 +5750,11 @@ flowchart TD
5710
5750
  return /* @__PURE__ */ React.createElement(
5711
5751
  "button",
5712
5752
  {
5713
- className: `w-8 px-1 py-2.5 flex items-center justify-center hover:bg-gray-50 text-gray-200 hover:text-red-500 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5753
+ type: "button",
5754
+ className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5714
5755
  onClick
5715
5756
  },
5716
- /* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out duration-100" })
5757
+ /* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
5717
5758
  );
5718
5759
  };
5719
5760
  const DragHandle = ({ isDragging }) => {
@@ -5791,27 +5832,35 @@ flowchart TD
5791
5832
  ))))
5792
5833
  ))));
5793
5834
  };
5794
- const Group = wrapFieldWithError(({ tinaForm, field }) => {
5795
- const cms = useCMS$1();
5796
- React__namespace.useState(false);
5797
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5798
- Header,
5799
- {
5800
- onClick: () => {
5801
- const state = tinaForm.finalForm.getState();
5802
- if (state.invalid === true) {
5803
- cms.alerts.error("Cannot navigate away from an invalid form.");
5804
- return;
5835
+ const Group = wrapFieldWithNoHeader(
5836
+ ({ tinaForm, field }) => {
5837
+ const cms = useCMS$1();
5838
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
5839
+ Header,
5840
+ {
5841
+ onClick: () => {
5842
+ const state = tinaForm.finalForm.getState();
5843
+ if (state.invalid === true) {
5844
+ cms.alerts.error("Cannot navigate away from an invalid form.");
5845
+ return;
5846
+ }
5847
+ cms.dispatch({
5848
+ type: "forms:set-active-field-name",
5849
+ value: { formId: tinaForm.id, fieldName: field.name }
5850
+ });
5805
5851
  }
5806
- cms.dispatch({
5807
- type: "forms:set-active-field-name",
5808
- value: { formId: tinaForm.id, fieldName: field.name }
5809
- });
5810
- }
5811
- },
5812
- field.label || field.name
5813
- ));
5814
- });
5852
+ },
5853
+ field.label || field.name,
5854
+ field.description && /* @__PURE__ */ React__namespace.createElement(
5855
+ "span",
5856
+ {
5857
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
5858
+ dangerouslySetInnerHTML: { __html: field.description }
5859
+ }
5860
+ )
5861
+ ));
5862
+ }
5863
+ );
5815
5864
  const Header = ({ onClick, children }) => {
5816
5865
  return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
5817
5866
  "button",
@@ -6214,7 +6263,9 @@ flowchart TD
6214
6263
  onClick: () => {
6215
6264
  const state = tinaForm.finalForm.getState();
6216
6265
  if (state.invalid === true) {
6217
- cms.alerts.error("Cannot navigate away from an invalid form.");
6266
+ cms.alerts.error(
6267
+ "Cannot navigate away from an invalid form."
6268
+ );
6218
6269
  return;
6219
6270
  }
6220
6271
  cms.dispatch({
@@ -6696,28 +6747,28 @@ flowchart TD
6696
6747
  }
6697
6748
  renderDayHeaders() {
6698
6749
  const locale = this.props.viewDate.localeData();
6699
- let dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
6750
+ const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
6700
6751
  return /* @__PURE__ */ React.createElement("tr", null, dayItems);
6701
6752
  }
6702
6753
  renderDays() {
6703
6754
  const date = this.props.viewDate;
6704
6755
  const startOfMonth = date.clone().startOf("month");
6705
6756
  const endOfMonth = date.clone().endOf("month");
6706
- let rows = [[], [], [], [], [], []];
6707
- let startDate = date.clone().subtract(1, "months");
6757
+ const rows = [[], [], [], [], [], []];
6758
+ const startDate = date.clone().subtract(1, "months");
6708
6759
  startDate.date(startDate.daysInMonth()).startOf("week");
6709
- let endDate = startDate.clone().add(42, "d");
6760
+ const endDate = startDate.clone().add(42, "d");
6710
6761
  let i = 0;
6711
6762
  while (startDate.isBefore(endDate)) {
6712
- let row = getRow$2(rows, i++);
6763
+ const row = getRow$2(rows, i++);
6713
6764
  row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
6714
6765
  startDate.add(1, "d");
6715
6766
  }
6716
6767
  return rows.map((r, i2) => /* @__PURE__ */ React.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
6717
6768
  }
6718
6769
  renderDay(date, startOfMonth, endOfMonth) {
6719
- let selectedDate = this.props.selectedDate;
6720
- let dayProps = {
6770
+ const selectedDate = this.props.selectedDate;
6771
+ const dayProps = {
6721
6772
  key: date.format("M_D"),
6722
6773
  "data-value": date.date(),
6723
6774
  "data-month": date.month(),
@@ -6771,7 +6822,7 @@ flowchart TD
6771
6822
  }
6772
6823
  function getDaysOfWeek(locale) {
6773
6824
  const first = locale.firstDayOfWeek();
6774
- let dow = [];
6825
+ const dow = [];
6775
6826
  let i = 0;
6776
6827
  locale._weekdaysMin.forEach(function(day) {
6777
6828
  dow[(7 + i++ - first) % 7] = day;
@@ -6789,7 +6840,7 @@ flowchart TD
6789
6840
  return /* @__PURE__ */ React.createElement("div", { className: "rdtMonths" }, /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("thead", null, this.renderNavigation())), /* @__PURE__ */ React.createElement("table", null, /* @__PURE__ */ React.createElement("tbody", null, this.renderMonths())));
6790
6841
  }
6791
6842
  renderNavigation() {
6792
- let year = this.props.viewDate.year();
6843
+ const year = this.props.viewDate.year();
6793
6844
  return /* @__PURE__ */ React.createElement(
6794
6845
  ViewNavigation,
6795
6846
  {
@@ -6802,9 +6853,9 @@ flowchart TD
6802
6853
  );
6803
6854
  }
6804
6855
  renderMonths() {
6805
- let rows = [[], [], []];
6856
+ const rows = [[], [], []];
6806
6857
  for (let month = 0; month < 12; month++) {
6807
- let row = getRow$1(rows, month);
6858
+ const row = getRow$1(rows, month);
6808
6859
  row.push(this.renderMonth(month));
6809
6860
  }
6810
6861
  return rows.map((months, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, months));
@@ -6821,7 +6872,7 @@ flowchart TD
6821
6872
  if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
6822
6873
  className += " rdtActive";
6823
6874
  }
6824
- let props = { key: month, className, "data-value": month, onClick };
6875
+ const props = { key: month, className, "data-value": month, onClick };
6825
6876
  if (this.props.renderMonth) {
6826
6877
  return this.props.renderMonth(
6827
6878
  props,
@@ -6833,11 +6884,11 @@ flowchart TD
6833
6884
  return /* @__PURE__ */ React.createElement("td", { ...props }, this.getMonthText(month));
6834
6885
  }
6835
6886
  isDisabledMonth(month) {
6836
- let isValidDate = this.props.isValidDate;
6887
+ const isValidDate = this.props.isValidDate;
6837
6888
  if (!isValidDate) {
6838
6889
  return false;
6839
6890
  }
6840
- let date = this.props.viewDate.clone().set({ month });
6891
+ const date = this.props.viewDate.clone().set({ month });
6841
6892
  let day = date.endOf("month").date() + 1;
6842
6893
  while (day-- > 1) {
6843
6894
  if (isValidDate(date.date(day))) {
@@ -6889,9 +6940,9 @@ flowchart TD
6889
6940
  }
6890
6941
  renderYears() {
6891
6942
  const viewYear = this.getViewYear();
6892
- let rows = [[], [], []];
6943
+ const rows = [[], [], []];
6893
6944
  for (let year = viewYear - 1; year < viewYear + 11; year++) {
6894
- let row = getRow(rows, year - viewYear);
6945
+ const row = getRow(rows, year - viewYear);
6895
6946
  row.push(this.renderYear(year));
6896
6947
  }
6897
6948
  return rows.map((years, i) => /* @__PURE__ */ React.createElement("tr", { key: i }, years));
@@ -6908,7 +6959,7 @@ flowchart TD
6908
6959
  if (selectedYear === year) {
6909
6960
  className += " rdtActive";
6910
6961
  }
6911
- let props = { key: year, className, "data-value": year, onClick };
6962
+ const props = { key: year, className, "data-value": year, onClick };
6912
6963
  return this.props.renderYear(
6913
6964
  props,
6914
6965
  year,
@@ -6922,15 +6973,15 @@ flowchart TD
6922
6973
  return this.props.selectedDate && this.props.selectedDate.year();
6923
6974
  }
6924
6975
  isDisabledYear(year) {
6925
- let cache = this.disabledYearsCache;
6976
+ const cache = this.disabledYearsCache;
6926
6977
  if (cache[year] !== void 0) {
6927
6978
  return cache[year];
6928
6979
  }
6929
- let isValidDate = this.props.isValidDate;
6980
+ const isValidDate = this.props.isValidDate;
6930
6981
  if (!isValidDate) {
6931
6982
  return false;
6932
6983
  }
6933
- let date = this.props.viewDate.clone().set({ year });
6984
+ const date = this.props.viewDate.clone().set({ year });
6934
6985
  let day = date.endOf("year").dayOfYear() + 1;
6935
6986
  while (day-- > 1) {
6936
6987
  if (isValidDate(date.dayOfYear(day))) {
@@ -6977,7 +7028,7 @@ flowchart TD
6977
7028
  }
6978
7029
  };
6979
7030
  function createConstraints(overrideTimeConstraints) {
6980
- let constraints = {};
7031
+ const constraints = {};
6981
7032
  Object.keys(timeConstraints).forEach((type) => {
6982
7033
  constraints[type] = {
6983
7034
  ...timeConstraints[type],
@@ -6993,7 +7044,7 @@ flowchart TD
6993
7044
  this.state = this.getTimeParts(props.selectedDate || props.viewDate);
6994
7045
  }
6995
7046
  render() {
6996
- let items2 = [];
7047
+ const items2 = [];
6997
7048
  const timeParts = this.state;
6998
7049
  this.getCounters().forEach((c, i) => {
6999
7050
  if (i && c !== "ampm") {
@@ -7055,8 +7106,8 @@ flowchart TD
7055
7106
  }
7056
7107
  if (type === "ampm")
7057
7108
  return this.toggleDayPart();
7058
- let update = {};
7059
- let body = document.body;
7109
+ const update = {};
7110
+ const body = document.body;
7060
7111
  update[type] = this[action](type);
7061
7112
  this.setState(update);
7062
7113
  this.timer = setTimeout(() => {
@@ -7099,8 +7150,8 @@ flowchart TD
7099
7150
  return pad(type, value);
7100
7151
  }
7101
7152
  getCounters() {
7102
- let counters = [];
7103
- let format2 = this.props.timeFormat;
7153
+ const counters = [];
7154
+ const format2 = this.props.timeFormat;
7104
7155
  if (format2.toLowerCase().indexOf("h") !== -1) {
7105
7156
  counters.push("hours");
7106
7157
  if (format2.indexOf("m") !== -1) {
@@ -7153,244 +7204,65 @@ flowchart TD
7153
7204
  str = "0" + str;
7154
7205
  return str;
7155
7206
  }
7156
- function _inheritsLoose(subClass, superClass) {
7157
- subClass.prototype = Object.create(superClass.prototype);
7158
- subClass.prototype.constructor = subClass;
7159
- _setPrototypeOf(subClass, superClass);
7160
- }
7161
- function _setPrototypeOf(o, p) {
7162
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7163
- o2.__proto__ = p2;
7164
- return o2;
7165
- };
7166
- return _setPrototypeOf(o, p);
7167
- }
7168
- function _objectWithoutPropertiesLoose(source, excluded) {
7169
- if (source == null)
7170
- return {};
7171
- var target = {};
7172
- var sourceKeys = Object.keys(source);
7173
- var key, i;
7174
- for (i = 0; i < sourceKeys.length; i++) {
7175
- key = sourceKeys[i];
7176
- if (excluded.indexOf(key) >= 0)
7177
- continue;
7178
- target[key] = source[key];
7179
- }
7180
- return target;
7181
- }
7182
- function _assertThisInitialized(self2) {
7183
- if (self2 === void 0) {
7184
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7185
- }
7186
- return self2;
7187
- }
7188
- function isNodeFound(current, componentNode, ignoreClass) {
7189
- if (current === componentNode) {
7190
- return true;
7191
- }
7192
- if (current.correspondingElement) {
7193
- return current.correspondingElement.classList.contains(ignoreClass);
7194
- }
7195
- return current.classList.contains(ignoreClass);
7196
- }
7197
- function findHighest(current, componentNode, ignoreClass) {
7198
- if (current === componentNode) {
7199
- return true;
7207
+ var useClickAway$1 = {};
7208
+ var util = {};
7209
+ Object.defineProperty(util, "__esModule", { value: true });
7210
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7211
+ var noop = function() {
7212
+ };
7213
+ util.noop = noop;
7214
+ function on(obj) {
7215
+ var args = [];
7216
+ for (var _i = 1; _i < arguments.length; _i++) {
7217
+ args[_i - 1] = arguments[_i];
7200
7218
  }
7201
- while (current.parentNode || current.host) {
7202
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7203
- return true;
7204
- }
7205
- current = current.parentNode || current.host;
7219
+ if (obj && obj.addEventListener) {
7220
+ obj.addEventListener.apply(obj, args);
7206
7221
  }
7207
- return current;
7208
- }
7209
- function clickedScrollbar(evt) {
7210
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7211
7222
  }
7212
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7213
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7214
- return;
7223
+ util.on = on;
7224
+ function off(obj) {
7225
+ var args = [];
7226
+ for (var _i = 1; _i < arguments.length; _i++) {
7227
+ args[_i - 1] = arguments[_i];
7215
7228
  }
7216
- var passive = false;
7217
- var options = Object.defineProperty({}, "passive", {
7218
- get: function get2() {
7219
- passive = true;
7220
- }
7221
- });
7222
- var noop = function noop2() {
7223
- };
7224
- window.addEventListener("testPassiveEventSupport", noop, options);
7225
- window.removeEventListener("testPassiveEventSupport", noop, options);
7226
- return passive;
7227
- };
7228
- function autoInc(seed) {
7229
- if (seed === void 0) {
7230
- seed = 0;
7229
+ if (obj && obj.removeEventListener) {
7230
+ obj.removeEventListener.apply(obj, args);
7231
7231
  }
7232
- return function() {
7233
- return ++seed;
7234
- };
7235
- }
7236
- var uid = autoInc();
7237
- var passiveEventSupport;
7238
- var handlersMap = {};
7239
- var enabledInstances = {};
7240
- var touchEvents = ["touchstart", "touchmove"];
7241
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7242
- function getEventHandlerOptions(instance, eventName) {
7243
- var handlerOptions = {};
7244
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7245
- if (isTouchEvent && passiveEventSupport) {
7246
- handlerOptions.passive = !instance.props.preventDefault;
7247
- }
7248
- return handlerOptions;
7249
7232
  }
7250
- function onClickOutsideHOC(WrappedComponent, config) {
7251
- var _class, _temp;
7252
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7253
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7254
- _inheritsLoose(onClickOutside, _Component);
7255
- function onClickOutside(props) {
7256
- var _this;
7257
- _this = _Component.call(this, props) || this;
7258
- _this.__outsideClickHandler = function(event) {
7259
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7260
- _this.__clickOutsideHandlerProp(event);
7261
- return;
7262
- }
7263
- var instance = _this.getInstance();
7264
- if (typeof instance.props.handleClickOutside === "function") {
7265
- instance.props.handleClickOutside(event);
7266
- return;
7267
- }
7268
- if (typeof instance.handleClickOutside === "function") {
7269
- instance.handleClickOutside(event);
7270
- return;
7271
- }
7272
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7273
- };
7274
- _this.__getComponentNode = function() {
7275
- var instance = _this.getInstance();
7276
- if (config && typeof config.setClickOutsideRef === "function") {
7277
- return config.setClickOutsideRef()(instance);
7278
- }
7279
- if (typeof instance.setClickOutsideRef === "function") {
7280
- return instance.setClickOutsideRef();
7281
- }
7282
- return reactDom.findDOMNode(instance);
7283
- };
7284
- _this.enableOnClickOutside = function() {
7285
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7286
- return;
7287
- }
7288
- if (typeof passiveEventSupport === "undefined") {
7289
- passiveEventSupport = testPassiveEventSupport();
7290
- }
7291
- enabledInstances[_this._uid] = true;
7292
- var events = _this.props.eventTypes;
7293
- if (!events.forEach) {
7294
- events = [events];
7295
- }
7296
- handlersMap[_this._uid] = function(event) {
7297
- if (_this.componentNode === null)
7298
- return;
7299
- if (_this.initTimeStamp > event.timeStamp)
7300
- return;
7301
- if (_this.props.preventDefault) {
7302
- event.preventDefault();
7303
- }
7304
- if (_this.props.stopPropagation) {
7305
- event.stopPropagation();
7306
- }
7307
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7308
- return;
7309
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7310
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7311
- return;
7312
- }
7313
- _this.__outsideClickHandler(event);
7314
- };
7315
- events.forEach(function(eventName) {
7316
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7317
- });
7318
- };
7319
- _this.disableOnClickOutside = function() {
7320
- delete enabledInstances[_this._uid];
7321
- var fn = handlersMap[_this._uid];
7322
- if (fn && typeof document !== "undefined") {
7323
- var events = _this.props.eventTypes;
7324
- if (!events.forEach) {
7325
- events = [events];
7326
- }
7327
- events.forEach(function(eventName) {
7328
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7329
- });
7330
- delete handlersMap[_this._uid];
7331
- }
7332
- };
7333
- _this.getRef = function(ref) {
7334
- return _this.instanceRef = ref;
7335
- };
7336
- _this._uid = uid();
7337
- _this.initTimeStamp = performance.now();
7338
- return _this;
7339
- }
7340
- var _proto = onClickOutside.prototype;
7341
- _proto.getInstance = function getInstance() {
7342
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7343
- return this;
7344
- }
7345
- var ref = this.instanceRef;
7346
- return ref.getInstance ? ref.getInstance() : ref;
7233
+ util.off = off;
7234
+ util.isBrowser = typeof window !== "undefined";
7235
+ util.isNavigator = typeof navigator !== "undefined";
7236
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7237
+ var react_1 = React;
7238
+ var util_1 = util;
7239
+ var defaultEvents = ["mousedown", "touchstart"];
7240
+ var useClickAway = function(ref, onClickAway, events) {
7241
+ if (events === void 0) {
7242
+ events = defaultEvents;
7243
+ }
7244
+ var savedCallback = react_1.useRef(onClickAway);
7245
+ react_1.useEffect(function() {
7246
+ savedCallback.current = onClickAway;
7247
+ }, [onClickAway]);
7248
+ react_1.useEffect(function() {
7249
+ var handler = function(event) {
7250
+ var el = ref.current;
7251
+ el && !el.contains(event.target) && savedCallback.current(event);
7347
7252
  };
7348
- _proto.componentDidMount = function componentDidMount() {
7349
- if (typeof document === "undefined" || !document.createElement) {
7350
- return;
7351
- }
7352
- var instance = this.getInstance();
7353
- if (config && typeof config.handleClickOutside === "function") {
7354
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7355
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7356
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7357
- }
7358
- }
7359
- this.componentNode = this.__getComponentNode();
7360
- if (this.props.disableOnClickOutside)
7361
- return;
7362
- this.enableOnClickOutside();
7363
- };
7364
- _proto.componentDidUpdate = function componentDidUpdate() {
7365
- this.componentNode = this.__getComponentNode();
7366
- };
7367
- _proto.componentWillUnmount = function componentWillUnmount() {
7368
- this.disableOnClickOutside();
7369
- };
7370
- _proto.render = function render() {
7371
- var _this$props = this.props;
7372
- _this$props.excludeScrollbar;
7373
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7374
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7375
- props.ref = this.getRef;
7376
- } else {
7377
- props.wrappedRef = this.getRef;
7253
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7254
+ var eventName = events_1[_i];
7255
+ util_1.on(document, eventName, handler);
7256
+ }
7257
+ return function() {
7258
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7259
+ var eventName2 = events_2[_i2];
7260
+ util_1.off(document, eventName2, handler);
7378
7261
  }
7379
- props.disableOnClickOutside = this.disableOnClickOutside;
7380
- props.enableOnClickOutside = this.enableOnClickOutside;
7381
- return React.createElement(WrappedComponent, props);
7382
7262
  };
7383
- return onClickOutside;
7384
- }(React.Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7385
- eventTypes: ["mousedown", "touchstart"],
7386
- excludeScrollbar: config && config.excludeScrollbar || false,
7387
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7388
- preventDefault: false,
7389
- stopPropagation: false
7390
- }, _class.getClass = function() {
7391
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7392
- }, _temp;
7393
- }
7263
+ }, [events, ref]);
7264
+ };
7265
+ var _default = useClickAway$1.default = useClickAway;
7394
7266
  const viewModes = {
7395
7267
  YEARS: "years",
7396
7268
  MONTHS: "months",
@@ -7411,7 +7283,7 @@ flowchart TD
7411
7283
  __publicField(this, "_renderCalendar", () => {
7412
7284
  const props = this.props;
7413
7285
  const state = this.state;
7414
- let viewProps = {
7286
+ const viewProps = {
7415
7287
  viewDate: state.viewDate.clone(),
7416
7288
  selectedDate: this.getSelectedDate(),
7417
7289
  isValidDate: props.isValidDate,
@@ -7454,10 +7326,10 @@ flowchart TD
7454
7326
  __publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
7455
7327
  __publicField(this, "nextView", { days: "time", months: "days", years: "months" });
7456
7328
  __publicField(this, "_updateDate", (e) => {
7457
- let state = this.state;
7458
- let currentView = state.currentView;
7459
- let updateOnView = this.getUpdateOn(this.getFormat("date"));
7460
- let viewDate = this.state.viewDate.clone();
7329
+ const state = this.state;
7330
+ const currentView = state.currentView;
7331
+ const updateOnView = this.getUpdateOn(this.getFormat("date"));
7332
+ const viewDate = this.state.viewDate.clone();
7461
7333
  viewDate[this.viewToMethod[currentView]](
7462
7334
  parseInt(e.target.getAttribute("data-value"), 10)
7463
7335
  );
@@ -7465,7 +7337,7 @@ flowchart TD
7465
7337
  viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
7466
7338
  viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
7467
7339
  }
7468
- let update = { viewDate };
7340
+ const update = { viewDate };
7469
7341
  if (currentView === updateOnView) {
7470
7342
  update.selectedDate = viewDate.clone();
7471
7343
  update.inputValue = viewDate.format(this.getFormat("datetime"));
@@ -7479,7 +7351,7 @@ flowchart TD
7479
7351
  this.setState(update);
7480
7352
  });
7481
7353
  __publicField(this, "_viewNavigate", (modifier, unit) => {
7482
- let viewDate = this.state.viewDate.clone();
7354
+ const viewDate = this.state.viewDate.clone();
7483
7355
  viewDate.add(modifier, unit);
7484
7356
  if (modifier > 0) {
7485
7357
  this.props.onNavigateForward(modifier, unit);
@@ -7489,7 +7361,7 @@ flowchart TD
7489
7361
  this.setState({ viewDate });
7490
7362
  });
7491
7363
  __publicField(this, "_setTime", (type, value) => {
7492
- let date = (this.getSelectedDate() || this.state.viewDate).clone();
7364
+ const date = (this.getSelectedDate() || this.state.viewDate).clone();
7493
7365
  date[type](value);
7494
7366
  if (!this.props.value) {
7495
7367
  this.setState({
@@ -7513,7 +7385,7 @@ flowchart TD
7513
7385
  });
7514
7386
  });
7515
7387
  __publicField(this, "_handleClickOutside", () => {
7516
- let props = this.props;
7388
+ const props = this.props;
7517
7389
  if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
7518
7390
  this._closeCalendar();
7519
7391
  }
@@ -7528,7 +7400,7 @@ flowchart TD
7528
7400
  return;
7529
7401
  const value = e.target ? e.target.value : e;
7530
7402
  const localMoment = this.localMoment(value, this.getFormat("datetime"));
7531
- let update = { inputValue: value };
7403
+ const update = { inputValue: value };
7532
7404
  if (localMoment.isValid()) {
7533
7405
  update.selectedDate = localMoment;
7534
7406
  update.viewDate = localMoment.clone().startOf("month");
@@ -7592,9 +7464,9 @@ flowchart TD
7592
7464
  return this.props.renderView(this.state.currentView, this._renderCalendar);
7593
7465
  }
7594
7466
  getInitialState() {
7595
- let props = this.props;
7596
- let inputFormat = this.getFormat("datetime");
7597
- let selectedDate = this.parseDate(
7467
+ const props = this.props;
7468
+ const inputFormat = this.getFormat("datetime");
7469
+ const selectedDate = this.parseDate(
7598
7470
  props.value || props.initialValue,
7599
7471
  inputFormat
7600
7472
  );
@@ -7625,7 +7497,7 @@ flowchart TD
7625
7497
  return this.getInitialDate();
7626
7498
  }
7627
7499
  getInitialDate() {
7628
- let m = this.localMoment();
7500
+ const m = this.localMoment();
7629
7501
  m.hour(0).minute(0).second(0).millisecond(0);
7630
7502
  return m;
7631
7503
  }
@@ -7645,8 +7517,8 @@ flowchart TD
7645
7517
  }
7646
7518
  getClassName() {
7647
7519
  let cn2 = "rdt";
7648
- let props = this.props;
7649
- let propCn = props.className;
7520
+ const props = this.props;
7521
+ const propCn = props.className;
7650
7522
  if (Array.isArray(propCn)) {
7651
7523
  cn2 += " " + propCn.join(" ");
7652
7524
  } else if (propCn) {
@@ -7679,14 +7551,14 @@ flowchart TD
7679
7551
  return viewModes.DAYS;
7680
7552
  }
7681
7553
  getLocaleData() {
7682
- let p = this.props;
7554
+ const p = this.props;
7683
7555
  return this.localMoment(
7684
7556
  p.value || p.defaultValue || /* @__PURE__ */ new Date()
7685
7557
  ).localeData();
7686
7558
  }
7687
7559
  getDateFormat() {
7688
7560
  const locale = this.getLocaleData();
7689
- let format2 = this.props.dateFormat;
7561
+ const format2 = this.props.dateFormat;
7690
7562
  if (format2 === true)
7691
7563
  return locale.longDateFormat("L");
7692
7564
  if (format2)
@@ -7695,7 +7567,7 @@ flowchart TD
7695
7567
  }
7696
7568
  getTimeFormat() {
7697
7569
  const locale = this.getLocaleData();
7698
- let format2 = this.props.timeFormat;
7570
+ const format2 = this.props.timeFormat;
7699
7571
  if (format2 === true) {
7700
7572
  return locale.longDateFormat("LT");
7701
7573
  }
@@ -7707,12 +7579,12 @@ flowchart TD
7707
7579
  } else if (type === "time") {
7708
7580
  return this.getTimeFormat();
7709
7581
  }
7710
- let dateFormat = this.getDateFormat();
7711
- let timeFormat = this.getTimeFormat();
7582
+ const dateFormat = this.getDateFormat();
7583
+ const timeFormat = this.getTimeFormat();
7712
7584
  return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
7713
7585
  }
7714
7586
  updateTime(op, amount, type, toSelected) {
7715
- let update = {};
7587
+ const update = {};
7716
7588
  const date = toSelected ? "selectedDate" : "viewDate";
7717
7589
  update[date] = this.state[date].clone()[op](amount, type);
7718
7590
  this.setState(update);
@@ -7745,7 +7617,7 @@ flowchart TD
7745
7617
  if (prevProps === this.props)
7746
7618
  return;
7747
7619
  let needsUpdate = false;
7748
- let thisProps = this.props;
7620
+ const thisProps = this.props;
7749
7621
  ["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
7750
7622
  function(p) {
7751
7623
  prevProps[p] !== thisProps[p] && (needsUpdate = true);
@@ -7761,8 +7633,8 @@ flowchart TD
7761
7633
  }
7762
7634
  regenerateDates() {
7763
7635
  const props = this.props;
7764
- let viewDate = this.state.viewDate.clone();
7765
- let selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7636
+ const viewDate = this.state.viewDate.clone();
7637
+ const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7766
7638
  if (props.locale) {
7767
7639
  viewDate.locale(props.locale);
7768
7640
  selectedDate && selectedDate.locale(props.locale);
@@ -7777,7 +7649,7 @@ flowchart TD
7777
7649
  viewDate.locale();
7778
7650
  selectedDate && selectedDate.locale();
7779
7651
  }
7780
- let update = { viewDate, selectedDate };
7652
+ const update = { viewDate, selectedDate };
7781
7653
  if (selectedDate && selectedDate.isValid()) {
7782
7654
  update.inputValue = selectedDate.format(this.getFormat("datetime"));
7783
7655
  }
@@ -7786,7 +7658,7 @@ flowchart TD
7786
7658
  getSelectedDate() {
7787
7659
  if (this.props.value === void 0)
7788
7660
  return this.state.selectedDate;
7789
- let selectedDate = this.parseDate(
7661
+ const selectedDate = this.parseDate(
7790
7662
  this.props.value,
7791
7663
  this.getFormat("datetime")
7792
7664
  );
@@ -7805,7 +7677,7 @@ flowchart TD
7805
7677
  return "";
7806
7678
  }
7807
7679
  getInputValue() {
7808
- let selectedDate = this.getSelectedDate();
7680
+ const selectedDate = this.getSelectedDate();
7809
7681
  return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
7810
7682
  }
7811
7683
  /**
@@ -7815,7 +7687,7 @@ flowchart TD
7815
7687
  * @public
7816
7688
  */
7817
7689
  setViewDate(date) {
7818
- let logError = function() {
7690
+ const logError = function() {
7819
7691
  return log("Invalid date passed to the `setViewDate` method: " + date);
7820
7692
  };
7821
7693
  if (!date)
@@ -7911,7 +7783,7 @@ flowchart TD
7911
7783
  // Make moment accessible through the Datetime class
7912
7784
  __publicField(Datetime, "moment", moment);
7913
7785
  function log(message, method) {
7914
- let con = typeof window !== "undefined" && window.console;
7786
+ const con = typeof window !== "undefined" && window.console;
7915
7787
  if (!con)
7916
7788
  return;
7917
7789
  if (!method) {
@@ -7919,22 +7791,13 @@ flowchart TD
7919
7791
  }
7920
7792
  con[method]("***react-datetime:" + message);
7921
7793
  }
7922
- class ClickOutBase extends React.Component {
7923
- constructor() {
7924
- super(...arguments);
7925
- __publicField(this, "container", React.createRef());
7926
- }
7927
- render() {
7928
- return /* @__PURE__ */ React.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7929
- }
7930
- handleClickOutside(e) {
7931
- this.props.onClickOut(e);
7932
- }
7933
- setClickOutsideRef() {
7934
- return this.container.current;
7935
- }
7794
+ function ClickableWrapper({ className, onClickOut, children }) {
7795
+ const containerRef = React.useRef(null);
7796
+ _default(containerRef, (event) => {
7797
+ onClickOut(event);
7798
+ });
7799
+ return /* @__PURE__ */ React.createElement("div", { className, ref: containerRef }, children);
7936
7800
  }
7937
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7938
7801
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7939
7802
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7940
7803
  const format$1 = (val, _name, field) => {
@@ -7977,7 +7840,10 @@ flowchart TD
7977
7840
  ReactDateTimeWithStyles,
7978
7841
  {
7979
7842
  value: input.value,
7980
- onChange: input.onChange,
7843
+ onChange: (value) => {
7844
+ const newValue = value === "" ? void 0 : value;
7845
+ input.onChange(newValue);
7846
+ },
7981
7847
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
7982
7848
  timeFormat: timeFormat || false,
7983
7849
  inputProps: { className: textFieldClasses },
@@ -8740,7 +8606,10 @@ flowchart TD
8740
8606
  label: "View in GitHub",
8741
8607
  Icon: /* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
8742
8608
  onMouseDown: () => {
8743
- window.open(branch.githubPullRequestUrl, "_blank");
8609
+ window.open(
8610
+ branch.githubPullRequestUrl,
8611
+ "_blank"
8612
+ );
8744
8613
  }
8745
8614
  },
8746
8615
  typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
@@ -9046,7 +8915,9 @@ flowchart TD
9046
8915
  } else {
9047
8916
  events = event;
9048
8917
  }
9049
- const newListeners = events.map((event2) => new Listener(event2, callback));
8918
+ const newListeners = events.map(
8919
+ (event2) => new Listener(event2, callback)
8920
+ );
9050
8921
  newListeners.forEach((newListener) => this.listeners.add(newListener));
9051
8922
  return () => {
9052
8923
  newListeners.forEach((listener) => this.listeners.delete(listener));
@@ -9402,9 +9273,7 @@ flowchart TD
9402
9273
  const deleteStartTime = Date.now();
9403
9274
  while (true) {
9404
9275
  await new Promise((resolve) => setTimeout(resolve, 1e3));
9405
- const { error, message } = await this.api.getRequestStatus(
9406
- requestId
9407
- );
9276
+ const { error, message } = await this.api.getRequestStatus(requestId);
9408
9277
  if (error !== void 0) {
9409
9278
  if (error) {
9410
9279
  throw new Error(message);
@@ -9429,6 +9298,17 @@ flowchart TD
9429
9298
  }
9430
9299
  }
9431
9300
  }
9301
+ const encodeUrlIfNeeded = (url) => {
9302
+ if (url) {
9303
+ try {
9304
+ return new URL(url).toString();
9305
+ } catch (e) {
9306
+ return url;
9307
+ }
9308
+ } else {
9309
+ return url;
9310
+ }
9311
+ };
9432
9312
  let MediaManager$1 = class MediaManager {
9433
9313
  constructor(store, events) {
9434
9314
  this.store = store;
@@ -9501,6 +9381,20 @@ flowchart TD
9501
9381
  try {
9502
9382
  this.events.dispatch({ type: "media:list:start", ...options });
9503
9383
  const media = await this.store.list(options);
9384
+ media.items = media.items.map((item) => {
9385
+ if (item.type === "dir") {
9386
+ return item;
9387
+ }
9388
+ if (item.thumbnails) {
9389
+ for (const [size, src] of Object.entries(item.thumbnails)) {
9390
+ item.thumbnails[size] = encodeUrlIfNeeded(src);
9391
+ }
9392
+ }
9393
+ return {
9394
+ ...item,
9395
+ src: encodeUrlIfNeeded(item.src)
9396
+ };
9397
+ });
9504
9398
  this.events.dispatch({ type: "media:list:success", ...options, media });
9505
9399
  return media;
9506
9400
  } catch (error) {
@@ -9714,7 +9608,7 @@ flowchart TD
9714
9608
  return this.add("error", message, timeout);
9715
9609
  }
9716
9610
  };
9717
- const NoFormsPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
9611
+ const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
9718
9612
  "div",
9719
9613
  {
9720
9614
  className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
@@ -9727,25 +9621,8 @@ flowchart TD
9727
9621
  animationDuration: "150ms"
9728
9622
  }
9729
9623
  },
9730
- /* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "pb-5" }, "🔎"),
9731
- /* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
9732
- /* @__PURE__ */ React__namespace.createElement("p", { className: "block" }, /* @__PURE__ */ React__namespace.createElement(
9733
- Button$1,
9734
- {
9735
- href: "https://tina.io/docs/tinacms-context/",
9736
- target: "_blank",
9737
- as: "a"
9738
- },
9739
- /* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
9740
- " Contextual Editing"
9741
- ))
9742
- );
9743
- const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
9744
- "span",
9745
- {
9746
- className: `text-[24px] leading-none inline-block ${className}`,
9747
- ...props
9748
- }
9624
+ /* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Please wait while TinaCMS", /* @__PURE__ */ React__namespace.createElement("br", null), "loads your content"),
9625
+ /* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
9749
9626
  );
9750
9627
  class SidebarState {
9751
9628
  constructor(events, options = {}) {
@@ -9760,7 +9637,7 @@ flowchart TD
9760
9637
  };
9761
9638
  this.position = options.position || "displace";
9762
9639
  this.renderNav = options.renderNav || true;
9763
- this.placeholder = options.placeholder || NoFormsPlaceholder;
9640
+ this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
9764
9641
  if ((_a = options.buttons) == null ? void 0 : _a.save) {
9765
9642
  this.buttons.save = options.buttons.save;
9766
9643
  }
@@ -9834,238 +9711,6 @@ flowchart TD
9834
9711
  children
9835
9712
  )));
9836
9713
  };
9837
- const Item = ({
9838
- item,
9839
- depth,
9840
- setActiveFormId
9841
- }) => {
9842
- const cms = useCMS();
9843
- const depths = ["pl-6", "pl-10", "pl-14"];
9844
- const form = React__namespace.useMemo(
9845
- () => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
9846
- [item.formId]
9847
- );
9848
- return /* @__PURE__ */ React__namespace.createElement(
9849
- "button",
9850
- {
9851
- type: "button",
9852
- key: item.path,
9853
- onClick: () => setActiveFormId(item.formId),
9854
- className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
9855
- },
9856
- /* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
9857
- /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
9858
- );
9859
- };
9860
- const FormListItem = ({
9861
- item,
9862
- depth,
9863
- setActiveFormId
9864
- }) => {
9865
- var _a;
9866
- return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
9867
- if (subItem.type === "document") {
9868
- return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
9869
- Item,
9870
- {
9871
- setActiveFormId,
9872
- depth: depth + 1,
9873
- item: subItem
9874
- }
9875
- ));
9876
- }
9877
- })));
9878
- };
9879
- const FormLists = (props) => {
9880
- const cms = useCMS();
9881
- return /* @__PURE__ */ React__namespace.createElement(
9882
- react.Transition,
9883
- {
9884
- appear: true,
9885
- show: true,
9886
- as: "div",
9887
- enter: "transition-all ease-out duration-150",
9888
- enterFrom: "opacity-0 -translate-x-1/2",
9889
- enterTo: "opacity-100",
9890
- leave: "transition-all ease-out duration-150",
9891
- leaveFrom: "opacity-100",
9892
- leaveTo: "opacity-0 -translate-x-1/2"
9893
- },
9894
- cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
9895
- FormList,
9896
- {
9897
- isEditing: props.isEditing,
9898
- setActiveFormId: (id) => {
9899
- cms.dispatch({ type: "forms:set-active-form-id", value: id });
9900
- },
9901
- formList
9902
- }
9903
- )))
9904
- );
9905
- };
9906
- const FormList = (props) => {
9907
- const cms = useCMS();
9908
- const listItems = React__namespace.useMemo(() => {
9909
- var _a;
9910
- const orderedListItems = [];
9911
- const globalItems = [];
9912
- const topItems = [];
9913
- props.formList.items.forEach((item) => {
9914
- if (item.type === "document") {
9915
- const form = cms.state.forms.find(
9916
- ({ tinaForm }) => tinaForm.id === item.formId
9917
- );
9918
- if (form.tinaForm.global) {
9919
- globalItems.push(item);
9920
- } else {
9921
- orderedListItems.push(item);
9922
- }
9923
- } else {
9924
- orderedListItems.push(item);
9925
- }
9926
- });
9927
- if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
9928
- topItems.push({ type: "list", label: "Documents" });
9929
- }
9930
- let extra = [];
9931
- if (globalItems.length) {
9932
- extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
9933
- }
9934
- return [...topItems, ...orderedListItems, ...extra];
9935
- }, [JSON.stringify(props.formList.items)]);
9936
- return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
9937
- if (item.type === "list") {
9938
- return /* @__PURE__ */ React__namespace.createElement(
9939
- "div",
9940
- {
9941
- key: item.label,
9942
- className: `relative group text-left w-full bg-white shadow-sm
9943
- border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
9944
- },
9945
- /* @__PURE__ */ React__namespace.createElement(
9946
- "span",
9947
- {
9948
- className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
9949
- },
9950
- item.label
9951
- )
9952
- );
9953
- }
9954
- return /* @__PURE__ */ React__namespace.createElement(
9955
- FormListItem,
9956
- {
9957
- setActiveFormId: (id) => props.setActiveFormId(id),
9958
- key: item.formId,
9959
- item,
9960
- depth: 0
9961
- }
9962
- );
9963
- })));
9964
- };
9965
- const FormsView = ({
9966
- children
9967
- }) => {
9968
- const cms = useCMS$1();
9969
- const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
9970
- const isMultiform = cms.state.forms.length > 1;
9971
- const activeForm = cms.state.forms.find(
9972
- ({ tinaForm }) => tinaForm.id === cms.state.activeFormId
9973
- );
9974
- const isEditing = !!activeForm;
9975
- if (!cms.state.formLists.length) {
9976
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, " ", children, " ");
9977
- }
9978
- if (isMultiform && !activeForm) {
9979
- return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
9980
- }
9981
- const formMetas = cms.plugins.all("form:meta");
9982
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
9983
- };
9984
- const FormWrapper$1 = ({ isEditing, children }) => {
9985
- return /* @__PURE__ */ React__namespace.createElement(
9986
- "div",
9987
- {
9988
- className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
9989
- style: isEditing ? {
9990
- transform: "none",
9991
- animationName: "fly-in-left",
9992
- animationDuration: "150ms",
9993
- animationDelay: "0",
9994
- animationIterationCount: 1,
9995
- animationTimingFunction: "ease-out"
9996
- } : {
9997
- transform: "translate3d(100%, 0, 0)"
9998
- }
9999
- },
10000
- children
10001
- );
10002
- };
10003
- const MultiformFormHeader = ({
10004
- activeForm
10005
- }) => {
10006
- const cms = useCMS$1();
10007
- const { formIsPristine } = React__namespace.useContext(SidebarContext);
10008
- return /* @__PURE__ */ React__namespace.createElement(
10009
- "div",
10010
- {
10011
- className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10012
- },
10013
- /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
10014
- "button",
10015
- {
10016
- type: "button",
10017
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10018
- onClick: () => {
10019
- const state = activeForm.tinaForm.finalForm.getState();
10020
- if (state.invalid === true) {
10021
- cms.alerts.error("Cannot navigate away from an invalid form.");
10022
- } else {
10023
- cms.dispatch({ type: "forms:set-active-form-id", value: null });
10024
- }
10025
- }
10026
- },
10027
- /* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
10028
- ), /* @__PURE__ */ React__namespace.createElement(
10029
- "button",
10030
- {
10031
- type: "button",
10032
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10033
- onClick: () => {
10034
- const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10035
- cms.state.activeFormId
10036
- ).name;
10037
- window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10038
- }
10039
- },
10040
- /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10041
- ), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
10042
- );
10043
- };
10044
- const FormHeader = ({ activeForm }) => {
10045
- const { formIsPristine } = React__namespace.useContext(SidebarContext);
10046
- const cms = useCMS$1();
10047
- const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
10048
- return /* @__PURE__ */ React__namespace.createElement(
10049
- "div",
10050
- {
10051
- className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10052
- },
10053
- /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
10054
- "button",
10055
- {
10056
- type: "button",
10057
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10058
- onClick: () => {
10059
- const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10060
- cms.state.activeFormId
10061
- ).name;
10062
- window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10063
- }
10064
- },
10065
- /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10066
- ), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
10067
- );
10068
- };
10069
9714
  function ImFilesEmpty(props) {
10070
9715
  return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14.341 5.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.689 0.561 1.25 1.25 1.25h9.5c0.689 0 1.25-0.561 1.25-1.25v-7.75c0-0.224-0.068-0.615-0.659-1.421zM12.271 4.729c0.48 0.48 0.856 0.912 1.134 1.271h-2.406v-2.405c0.359 0.278 0.792 0.654 1.271 1.134v0zM14 14.75c0 0.136-0.114 0.25-0.25 0.25h-9.5c-0.136 0-0.25-0.114-0.25-0.25v-11.5c0-0.135 0.114-0.25 0.25-0.25 0 0 5.749-0 5.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5v7.75z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9.421 0.659c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.604 0.43 1.109 1 1.225v-12.725c0-0.135 0.115-0.25 0.25-0.25h7.607c-0.151-0.124-0.297-0.238-0.437-0.341z" }, "child": [] }] })(props);
10071
9716
  }
@@ -10308,7 +9953,7 @@ flowchart TD
10308
9953
  "Event Log"
10309
9954
  ));
10310
9955
  };
10311
- const version = "2.3.0";
9956
+ const version = "2.7.4";
10312
9957
  const Nav = ({
10313
9958
  isLocalMode,
10314
9959
  className = "",
@@ -10550,6 +10195,293 @@ flowchart TD
10550
10195
  /* @__PURE__ */ React__namespace.createElement("span", { className: "absolute top-1/2 left-1/2 h-4/6 w-px bg-gray-200 transform -translate-y-1/2 -translate-x-1/2 opacity-30 transition-opacity duration-150 ease-out group-hover:opacity-100" })
10551
10196
  );
10552
10197
  };
10198
+ const Item = ({
10199
+ item,
10200
+ depth,
10201
+ setActiveFormId
10202
+ }) => {
10203
+ const cms = useCMS();
10204
+ const depths = ["pl-6", "pl-10", "pl-14"];
10205
+ const form = React__namespace.useMemo(
10206
+ () => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
10207
+ [item.formId]
10208
+ );
10209
+ return /* @__PURE__ */ React__namespace.createElement(
10210
+ "button",
10211
+ {
10212
+ type: "button",
10213
+ key: item.path,
10214
+ onClick: () => setActiveFormId(item.formId),
10215
+ className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
10216
+ },
10217
+ /* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
10218
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
10219
+ );
10220
+ };
10221
+ const FormListItem = ({
10222
+ item,
10223
+ depth,
10224
+ setActiveFormId
10225
+ }) => {
10226
+ var _a;
10227
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
10228
+ if (subItem.type === "document") {
10229
+ return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
10230
+ Item,
10231
+ {
10232
+ setActiveFormId,
10233
+ depth: depth + 1,
10234
+ item: subItem
10235
+ }
10236
+ ));
10237
+ }
10238
+ })));
10239
+ };
10240
+ const FormLists = (props) => {
10241
+ const cms = useCMS();
10242
+ return /* @__PURE__ */ React__namespace.createElement(
10243
+ react.Transition,
10244
+ {
10245
+ appear: true,
10246
+ show: true,
10247
+ as: "div",
10248
+ enter: "transition-all ease-out duration-150",
10249
+ enterFrom: "opacity-0 -translate-x-1/2",
10250
+ enterTo: "opacity-100",
10251
+ leave: "transition-all ease-out duration-150",
10252
+ leaveFrom: "opacity-100",
10253
+ leaveTo: "opacity-0 -translate-x-1/2"
10254
+ },
10255
+ cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
10256
+ FormList,
10257
+ {
10258
+ isEditing: props.isEditing,
10259
+ setActiveFormId: (id) => {
10260
+ cms.dispatch({ type: "forms:set-active-form-id", value: id });
10261
+ },
10262
+ formList
10263
+ }
10264
+ )))
10265
+ );
10266
+ };
10267
+ const FormList = (props) => {
10268
+ const cms = useCMS();
10269
+ const listItems = React__namespace.useMemo(() => {
10270
+ var _a;
10271
+ const orderedListItems = [];
10272
+ const globalItems = [];
10273
+ const topItems = [];
10274
+ props.formList.items.forEach((item) => {
10275
+ if (item.type === "document") {
10276
+ const form = cms.state.forms.find(
10277
+ ({ tinaForm }) => tinaForm.id === item.formId
10278
+ );
10279
+ if (form.tinaForm.global) {
10280
+ globalItems.push(item);
10281
+ } else {
10282
+ orderedListItems.push(item);
10283
+ }
10284
+ } else {
10285
+ orderedListItems.push(item);
10286
+ }
10287
+ });
10288
+ if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
10289
+ topItems.push({ type: "list", label: "Documents" });
10290
+ }
10291
+ let extra = [];
10292
+ if (globalItems.length) {
10293
+ extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
10294
+ }
10295
+ return [...topItems, ...orderedListItems, ...extra];
10296
+ }, [JSON.stringify(props.formList.items)]);
10297
+ return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
10298
+ if (item.type === "list") {
10299
+ return /* @__PURE__ */ React__namespace.createElement(
10300
+ "div",
10301
+ {
10302
+ key: item.label,
10303
+ className: `relative group text-left w-full bg-white shadow-sm
10304
+ border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
10305
+ },
10306
+ /* @__PURE__ */ React__namespace.createElement(
10307
+ "span",
10308
+ {
10309
+ className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
10310
+ },
10311
+ item.label
10312
+ )
10313
+ );
10314
+ }
10315
+ return /* @__PURE__ */ React__namespace.createElement(
10316
+ FormListItem,
10317
+ {
10318
+ setActiveFormId: (id) => props.setActiveFormId(id),
10319
+ key: item.formId,
10320
+ item,
10321
+ depth: 0
10322
+ }
10323
+ );
10324
+ })));
10325
+ };
10326
+ const SidebarNoFormsPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
10327
+ "div",
10328
+ {
10329
+ className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
10330
+ style: {
10331
+ animationName: "fade-in",
10332
+ animationDelay: "300ms",
10333
+ animationTimingFunction: "ease-out",
10334
+ animationIterationCount: 1,
10335
+ animationFillMode: "both",
10336
+ animationDuration: "150ms"
10337
+ }
10338
+ },
10339
+ /* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
10340
+ /* @__PURE__ */ React__namespace.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React__namespace.createElement(
10341
+ Button$1,
10342
+ {
10343
+ href: "https://tina.io/docs/contextual-editing/overview",
10344
+ target: "_blank",
10345
+ as: "a"
10346
+ },
10347
+ /* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
10348
+ " Contextual Editing Docs"
10349
+ ))
10350
+ );
10351
+ const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
10352
+ "span",
10353
+ {
10354
+ className: `text-[24px] leading-none inline-block ${className}`,
10355
+ ...props
10356
+ }
10357
+ );
10358
+ const minimumTimeToShowLoadingIndicator = 1e3;
10359
+ const FormsView = ({ loadingPlaceholder } = {}) => {
10360
+ const cms = useCMS$1();
10361
+ const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
10362
+ const [isShowingLoading, setIsShowingLoading] = React__namespace.useState(true);
10363
+ const [initialLoadComplete, setInitialLoadComplete] = React__namespace.useState(false);
10364
+ React__namespace.useEffect(() => {
10365
+ if (cms.state.isLoadingContent) {
10366
+ setIsShowingLoading(true);
10367
+ const timer = setTimeout(() => {
10368
+ if (!cms.state.isLoadingContent) {
10369
+ setIsShowingLoading(false);
10370
+ setInitialLoadComplete(true);
10371
+ }
10372
+ }, minimumTimeToShowLoadingIndicator);
10373
+ return () => clearTimeout(timer);
10374
+ } else {
10375
+ const timer = setTimeout(() => {
10376
+ setIsShowingLoading(false);
10377
+ setInitialLoadComplete(true);
10378
+ }, minimumTimeToShowLoadingIndicator);
10379
+ return () => clearTimeout(timer);
10380
+ }
10381
+ }, [cms.state.isLoadingContent]);
10382
+ if (isShowingLoading || !initialLoadComplete) {
10383
+ const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
10384
+ return /* @__PURE__ */ React__namespace.createElement(LoadingPlaceholder, null);
10385
+ }
10386
+ if (!cms.state.formLists.length) {
10387
+ return /* @__PURE__ */ React__namespace.createElement(SidebarNoFormsPlaceholder, null);
10388
+ }
10389
+ const isMultiform = cms.state.forms.length > 1;
10390
+ const activeForm = cms.state.forms.find(
10391
+ ({ tinaForm }) => tinaForm.id === cms.state.activeFormId
10392
+ );
10393
+ const isEditing = !!activeForm;
10394
+ if (isMultiform && !activeForm) {
10395
+ return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
10396
+ }
10397
+ const formMetas = cms.plugins.all("form:meta");
10398
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
10399
+ };
10400
+ const FormWrapper$1 = ({ isEditing, children }) => {
10401
+ return /* @__PURE__ */ React__namespace.createElement(
10402
+ "div",
10403
+ {
10404
+ className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
10405
+ style: isEditing ? {
10406
+ transform: "none",
10407
+ animationName: "fly-in-left",
10408
+ animationDuration: "150ms",
10409
+ animationDelay: "0",
10410
+ animationIterationCount: 1,
10411
+ animationTimingFunction: "ease-out"
10412
+ } : {
10413
+ transform: "translate3d(100%, 0, 0)"
10414
+ }
10415
+ },
10416
+ children
10417
+ );
10418
+ };
10419
+ const MultiformFormHeader = ({
10420
+ activeForm
10421
+ }) => {
10422
+ const cms = useCMS$1();
10423
+ const { formIsPristine } = React__namespace.useContext(SidebarContext);
10424
+ return /* @__PURE__ */ React__namespace.createElement(
10425
+ "div",
10426
+ {
10427
+ className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10428
+ },
10429
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
10430
+ "button",
10431
+ {
10432
+ type: "button",
10433
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10434
+ onClick: () => {
10435
+ const state = activeForm.tinaForm.finalForm.getState();
10436
+ if (state.invalid === true) {
10437
+ cms.alerts.error("Cannot navigate away from an invalid form.");
10438
+ } else {
10439
+ cms.dispatch({ type: "forms:set-active-form-id", value: null });
10440
+ }
10441
+ }
10442
+ },
10443
+ /* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
10444
+ ), /* @__PURE__ */ React__namespace.createElement(
10445
+ "button",
10446
+ {
10447
+ type: "button",
10448
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10449
+ onClick: () => {
10450
+ const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10451
+ cms.state.activeFormId
10452
+ ).name;
10453
+ window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10454
+ }
10455
+ },
10456
+ /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10457
+ ), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
10458
+ );
10459
+ };
10460
+ const FormHeader = ({ activeForm }) => {
10461
+ const { formIsPristine } = React__namespace.useContext(SidebarContext);
10462
+ const cms = useCMS$1();
10463
+ const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
10464
+ return /* @__PURE__ */ React__namespace.createElement(
10465
+ "div",
10466
+ {
10467
+ className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10468
+ },
10469
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
10470
+ "button",
10471
+ {
10472
+ type: "button",
10473
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10474
+ onClick: () => {
10475
+ const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10476
+ cms.state.activeFormId
10477
+ ).name;
10478
+ window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10479
+ }
10480
+ },
10481
+ /* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10482
+ ), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
10483
+ );
10484
+ };
10553
10485
  const SidebarContext = React__namespace.createContext(null);
10554
10486
  const minPreviewWidth = 440;
10555
10487
  const minSidebarWidth = 360;
@@ -10768,7 +10700,7 @@ flowchart TD
10768
10700
  isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
10769
10701
  branchingEnabled
10770
10702
  }
10771
- ), /* @__PURE__ */ React__namespace.createElement(FormsView, null, /* @__PURE__ */ React__namespace.createElement(sidebar.placeholder, null)), activeScreen && /* @__PURE__ */ React__namespace.createElement(
10703
+ ), /* @__PURE__ */ React__namespace.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React__namespace.createElement(
10772
10704
  ScreenPluginModal,
10773
10705
  {
10774
10706
  screen: activeScreen,
@@ -10944,7 +10876,7 @@ flowchart TD
10944
10876
  className: "h-5 w-auto -mx-1 text-blue-500",
10945
10877
  stroke: "currentColor",
10946
10878
  fill: "currentColor",
10947
- "stroke-width": "0",
10879
+ strokeWidth: "0",
10948
10880
  viewBox: "0 0 24 24",
10949
10881
  xmlns: "http://www.w3.org/2000/svg"
10950
10882
  },
@@ -11534,7 +11466,10 @@ flowchart TD
11534
11466
  const observer = new IntersectionObserver((entries) => {
11535
11467
  const target = entries[0];
11536
11468
  if (target.isIntersecting && list.nextOffset) {
11537
- setOffsetHistory((offsetHistory2) => [...offsetHistory2, list.nextOffset]);
11469
+ setOffsetHistory((offsetHistory2) => [
11470
+ ...offsetHistory2,
11471
+ list.nextOffset
11472
+ ]);
11538
11473
  }
11539
11474
  });
11540
11475
  if (loaderRef.current) {
@@ -12129,6 +12064,7 @@ flowchart TD
12129
12064
  forms: [],
12130
12065
  formLists: [],
12131
12066
  editingMode: "basic",
12067
+ isLoadingContent: false,
12132
12068
  quickEditSupported: false,
12133
12069
  sidebarDisplayState: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.defaultState) || "open"
12134
12070
  };
@@ -12188,7 +12124,12 @@ flowchart TD
12188
12124
  }
12189
12125
  });
12190
12126
  }
12191
- return { ...state, activeFormId, formLists: nextFormLists };
12127
+ return {
12128
+ ...state,
12129
+ activeFormId,
12130
+ formLists: nextFormLists,
12131
+ isLoadingContent: false
12132
+ };
12192
12133
  }
12193
12134
  case "form-lists:remove": {
12194
12135
  const nextFormLists = state.formLists.filter(
@@ -12257,6 +12198,9 @@ flowchart TD
12257
12198
  }
12258
12199
  return { ...state, sidebarDisplayState: action.value };
12259
12200
  }
12201
+ case "sidebar:set-loading-state": {
12202
+ return { ...state, isLoadingContent: action.value };
12203
+ }
12260
12204
  default:
12261
12205
  throw new Error(`Unhandled action ${action.type}`);
12262
12206
  }
@@ -12498,7 +12442,9 @@ flowchart TD
12498
12442
  if (activeEle) {
12499
12443
  setDisplay(true);
12500
12444
  setPosition(activeEle.getBoundingClientRect());
12501
- const iframe = document.getElementById("tina-iframe");
12445
+ const iframe = document.getElementById(
12446
+ "tina-iframe"
12447
+ );
12502
12448
  if (iframe) {
12503
12449
  setIframePosition(iframe.getBoundingClientRect());
12504
12450
  }
@@ -12940,7 +12886,6 @@ flowchart TD
12940
12886
  }) => {
12941
12887
  const cms = useCMS$1();
12942
12888
  const tinaApi = cms.api.tina;
12943
- tinaApi.branch;
12944
12889
  const [disabled, setDisabled] = React__namespace.useState(false);
12945
12890
  const [newBranchName, setNewBranchName] = React__namespace.useState("");
12946
12891
  const [error, setError] = React__namespace.useState("");
@@ -12966,10 +12911,10 @@ flowchart TD
12966
12911
  const newUrl = window.location.href.replace(hash, newHash);
12967
12912
  window.location.href = newUrl;
12968
12913
  };
12969
- return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", { className: "text-base text-gray-700 mb-2" }, "This branch is ", /* @__PURE__ */ React__namespace.createElement("strong", null, "protected"), ". Create a new branch to save your changes."), /* @__PURE__ */ React__namespace.createElement(
12914
+ return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-sm text-gray-700 mb-4" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React__namespace.createElement(
12970
12915
  PrefixedTextField,
12971
12916
  {
12972
- placeholder: "Branch Name",
12917
+ placeholder: "e.g. {{PAGE-NAME}}-updates",
12973
12918
  value: newBranchName,
12974
12919
  onChange: (e) => {
12975
12920
  setError("");
@@ -13116,7 +13061,9 @@ flowchart TD
13116
13061
  const { fieldName } = useTemplates();
13117
13062
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13118
13063
  useHotkey("enter", () => {
13119
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13064
+ plateCommon.insertNodes(editor, [
13065
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13066
+ ]);
13120
13067
  });
13121
13068
  return /* @__PURE__ */ React.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React.createElement(
13122
13069
  "div",
@@ -13259,7 +13206,9 @@ flowchart TD
13259
13206
  const { templates, fieldName } = useTemplates();
13260
13207
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13261
13208
  useHotkey("enter", () => {
13262
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13209
+ plateCommon.insertNodes(editor, [
13210
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13211
+ ]);
13263
13212
  });
13264
13213
  useHotkey("space", () => {
13265
13214
  plateCommon.insertNodes(editor, [{ text: " " }], {
@@ -13315,7 +13264,9 @@ flowchart TD
13315
13264
  const { templates, fieldName } = useTemplates();
13316
13265
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13317
13266
  useHotkey("enter", () => {
13318
- plateCommon.insertNodes(editor, [{ type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13267
+ plateCommon.insertNodes(editor, [
13268
+ { type: plate.ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13269
+ ]);
13319
13270
  });
13320
13271
  const activeTemplate = templates.find(
13321
13272
  (template) => template.name === element.name
@@ -13661,6 +13612,11 @@ flowchart TD
13661
13612
  mode: "mark",
13662
13613
  type: plate.MARK_CODE,
13663
13614
  match: "`"
13615
+ },
13616
+ {
13617
+ mode: "mark",
13618
+ type: plate.MARK_STRIKETHROUGH,
13619
+ match: ["~~", "~"]
13664
13620
  }
13665
13621
  ];
13666
13622
  const autoformatRules = [
@@ -13802,16 +13758,14 @@ flowchart TD
13802
13758
  })
13803
13759
  ];
13804
13760
  const plugins = [
13761
+ plate.createBasicMarksPlugin(),
13805
13762
  plate.createHeadingPlugin(),
13806
13763
  plate.createParagraphPlugin(),
13807
13764
  createCodeBlockPlugin(),
13808
13765
  createHTMLBlockPlugin(),
13809
13766
  createHTMLInlinePlugin(),
13810
13767
  plate.createBlockquotePlugin(),
13811
- plate.createBoldPlugin(),
13812
- plate.createItalicPlugin(),
13813
13768
  plate.createUnderlinePlugin(),
13814
- plate.createCodePlugin(),
13815
13769
  plate.createListPlugin(),
13816
13770
  plate.createIndentListPlugin(),
13817
13771
  plate.createHorizontalRulePlugin(),
@@ -14171,7 +14125,9 @@ flowchart TD
14171
14125
  const CONTAINER_MD_BREAKPOINT = 448;
14172
14126
  const FLOAT_BUTTON_WIDTH = 25;
14173
14127
  const HEADING_LABEL = "Headings";
14174
- const ToolbarContext = React.createContext(void 0);
14128
+ const ToolbarContext = React.createContext(
14129
+ void 0
14130
+ );
14175
14131
  const ToolbarProvider = ({
14176
14132
  tinaForm,
14177
14133
  templates,
@@ -14321,7 +14277,7 @@ flowchart TD
14321
14277
  const CodeBlockToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14322
14278
  const state = useCodeBlockToolbarButtonState();
14323
14279
  const { props } = useCodeBlockToolbarButton(state);
14324
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
14280
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.codeBlock, null));
14325
14281
  });
14326
14282
  const useImageToolbarButtonState = () => {
14327
14283
  const editor = plateCommon.useEditorState();
@@ -14353,36 +14309,54 @@ flowchart TD
14353
14309
  const ImageToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14354
14310
  const state = useImageToolbarButtonState();
14355
14311
  const { props } = useImageToolbarButton(state);
14356
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
14357
- });
14358
- const IndentListToolbarButton = cn$1.withRef(({ nodeType = plate.ELEMENT_UL }, ref) => {
14359
- const editor = plateCommon.useEditorState();
14360
- const state = plate.useListToolbarButtonState({ nodeType });
14361
- const { props } = plate.useListToolbarButton(state);
14362
- return /* @__PURE__ */ React.createElement(
14363
- ToolbarButton,
14364
- {
14365
- ref,
14366
- tooltip: nodeType === plate.ELEMENT_UL ? "Bulleted List" : "Numbered List",
14367
- ...props,
14368
- onClick: (e) => {
14369
- e.preventDefault();
14370
- e.stopPropagation();
14371
- plate.toggleList(editor, { type: nodeType });
14372
- }
14373
- },
14374
- nodeType === plate.ELEMENT_UL ? /* @__PURE__ */ React.createElement(Icons.ul, null) : /* @__PURE__ */ React.createElement(Icons.ol, null)
14375
- );
14312
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.image, null));
14376
14313
  });
14314
+ const UnorderedListToolbarButton = cn$1.withRef(
14315
+ (props, ref) => {
14316
+ const editor = plateCommon.useEditorState();
14317
+ const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_UL });
14318
+ const { props: buttonProps } = plate.useListToolbarButton(state);
14319
+ return /* @__PURE__ */ React.createElement(
14320
+ ToolbarButton,
14321
+ {
14322
+ ref,
14323
+ tooltip: "Bulleted List",
14324
+ ...buttonProps,
14325
+ onClick: (e) => {
14326
+ e.preventDefault();
14327
+ e.stopPropagation();
14328
+ plate.toggleList(editor, { type: plate.ELEMENT_UL });
14329
+ }
14330
+ },
14331
+ /* @__PURE__ */ React.createElement(Icons.ul, null)
14332
+ );
14333
+ }
14334
+ );
14335
+ const OrderedListToolbarButton = cn$1.withRef(
14336
+ (props, ref) => {
14337
+ const editor = plateCommon.useEditorState();
14338
+ const state = plate.useListToolbarButtonState({ nodeType: plate.ELEMENT_OL });
14339
+ const { props: buttonProps } = plate.useListToolbarButton(state);
14340
+ return /* @__PURE__ */ React.createElement(
14341
+ ToolbarButton,
14342
+ {
14343
+ ref,
14344
+ tooltip: "Numbered List",
14345
+ ...buttonProps,
14346
+ onClick: (e) => {
14347
+ e.preventDefault();
14348
+ e.stopPropagation();
14349
+ plate.toggleList(editor, { type: plate.ELEMENT_OL });
14350
+ }
14351
+ },
14352
+ /* @__PURE__ */ React.createElement(Icons.ol, null)
14353
+ );
14354
+ }
14355
+ );
14377
14356
  const LinkToolbarButton = cn$1.withRef((rest, ref) => {
14378
14357
  const state = plateLink.useLinkToolbarButtonState();
14379
14358
  const { props } = plateLink.useLinkToolbarButton(state);
14380
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React.createElement(Icons.link, null));
14381
- });
14382
- const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14383
- const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14384
- const { props } = plateCommon.useMarkToolbarButton(state);
14385
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14359
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React.createElement(Icons.link, null));
14386
14360
  });
14387
14361
  const useMermaidToolbarButtonState = () => {
14388
14362
  const editor = plateCommon.useEditorState();
@@ -14425,6 +14399,7 @@ flowchart TD
14425
14399
  ToolbarButton,
14426
14400
  {
14427
14401
  showArrow: false,
14402
+ "data-testid": "rich-text-editor-overflow-menu-button",
14428
14403
  className: "lg:min-w-[130px]",
14429
14404
  isDropdown: true,
14430
14405
  pressed: openState.open,
@@ -14462,7 +14437,7 @@ flowchart TD
14462
14437
  const QuoteToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14463
14438
  const state = useBlockQuoteToolbarButtonState();
14464
14439
  const { props } = useBlockQuoteToolbarButton(state);
14465
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14440
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.quote, null));
14466
14441
  });
14467
14442
  const useRawMarkdownToolbarButton = () => {
14468
14443
  const { setRawMode } = useEditorContext();
@@ -14478,7 +14453,17 @@ flowchart TD
14478
14453
  };
14479
14454
  const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
14480
14455
  const { props } = useRawMarkdownToolbarButton();
14481
- return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React.createElement(Icons.raw, null));
14456
+ return /* @__PURE__ */ React.createElement(
14457
+ ToolbarButton,
14458
+ {
14459
+ ref,
14460
+ tooltip: "Raw Markdown",
14461
+ ...rest,
14462
+ ...props,
14463
+ "data-testid": "markdown-button"
14464
+ },
14465
+ /* @__PURE__ */ React.createElement(Icons.raw, null)
14466
+ );
14482
14467
  });
14483
14468
  function TableDropdownMenu(props) {
14484
14469
  const tableSelected = plateCommon.useEditorSelector(
@@ -14617,7 +14602,7 @@ flowchart TD
14617
14602
  key: template.name,
14618
14603
  onMouseDown: (e) => {
14619
14604
  e.preventDefault();
14620
- close();
14605
+ setOpen(false);
14621
14606
  insertMDX(editor, template);
14622
14607
  },
14623
14608
  className: ""
@@ -14625,6 +14610,15 @@ flowchart TD
14625
14610
  template.label || template.name
14626
14611
  ))));
14627
14612
  };
14613
+ const MarkToolbarButton = cn$1.withRef(({ clear, nodeType, ...rest }, ref) => {
14614
+ const state = plateCommon.useMarkToolbarButtonState({ clear, nodeType });
14615
+ const { props } = plateCommon.useMarkToolbarButton(state);
14616
+ return /* @__PURE__ */ React.createElement(ToolbarButton, { ref, ...props, ...rest });
14617
+ });
14618
+ const BoldToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null));
14619
+ const StrikethroughToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: plate.MARK_STRIKETHROUGH }, /* @__PURE__ */ React.createElement(Icons.strikethrough, null));
14620
+ const ItalicToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null));
14621
+ const CodeToolbarButton = () => /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null));
14628
14622
  const toolbarItems = {
14629
14623
  heading: {
14630
14624
  label: HEADING_LABEL,
@@ -14645,32 +14639,37 @@ flowchart TD
14645
14639
  quote: {
14646
14640
  label: "Quote",
14647
14641
  width: () => STANDARD_ICON_WIDTH,
14648
- Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14642
+ Component: /* @__PURE__ */ React.createElement(QuoteToolbarButton, null)
14649
14643
  },
14650
14644
  ul: {
14651
14645
  label: "Unordered List",
14652
14646
  width: () => STANDARD_ICON_WIDTH,
14653
- Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_UL })
14647
+ Component: /* @__PURE__ */ React.createElement(UnorderedListToolbarButton, null)
14654
14648
  },
14655
14649
  ol: {
14656
14650
  label: "Ordered List",
14657
14651
  width: () => STANDARD_ICON_WIDTH,
14658
- Component: /* @__PURE__ */ React.createElement(IndentListToolbarButton, { nodeType: plate.ELEMENT_OL })
14652
+ Component: /* @__PURE__ */ React.createElement(OrderedListToolbarButton, null)
14659
14653
  },
14660
14654
  bold: {
14661
14655
  label: "Bold",
14662
14656
  width: () => STANDARD_ICON_WIDTH,
14663
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: plate.MARK_BOLD }, /* @__PURE__ */ React.createElement(Icons.bold, null))
14657
+ Component: /* @__PURE__ */ React.createElement(BoldToolbarButton, null)
14658
+ },
14659
+ strikethrough: {
14660
+ label: "Strikethrough",
14661
+ width: () => STANDARD_ICON_WIDTH,
14662
+ Component: /* @__PURE__ */ React.createElement(StrikethroughToolbarButton, null)
14664
14663
  },
14665
14664
  italic: {
14666
14665
  label: "Italic",
14667
14666
  width: () => STANDARD_ICON_WIDTH,
14668
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: plate.MARK_ITALIC }, /* @__PURE__ */ React.createElement(Icons.italic, null))
14667
+ Component: /* @__PURE__ */ React.createElement(ItalicToolbarButton, null)
14669
14668
  },
14670
14669
  code: {
14671
14670
  label: "Code",
14672
14671
  width: () => STANDARD_ICON_WIDTH,
14673
- Component: /* @__PURE__ */ React.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: plate.MARK_CODE }, /* @__PURE__ */ React.createElement(Icons.code, null))
14672
+ Component: /* @__PURE__ */ React.createElement(CodeToolbarButton, null)
14674
14673
  },
14675
14674
  codeBlock: {
14676
14675
  label: "Code Block",
@@ -14703,7 +14702,12 @@ flowchart TD
14703
14702
  const [itemsShown, setItemsShown] = React.useState(11);
14704
14703
  const { overrides, templates } = useToolbarContext();
14705
14704
  const showEmbedButton = templates.length > 0;
14706
- let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14705
+ let items2 = [];
14706
+ if (Array.isArray(overrides)) {
14707
+ items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14708
+ } else {
14709
+ items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14710
+ }
14707
14711
  if (!showEmbedButton) {
14708
14712
  items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14709
14713
  }
@@ -15031,6 +15035,9 @@ flowchart TD
15031
15035
  if (typeof string !== "string") {
15032
15036
  return false;
15033
15037
  }
15038
+ if (string.startsWith("#")) {
15039
+ return true;
15040
+ }
15034
15041
  const generalMatch = string.match(protocolAndDomainRE);
15035
15042
  const emailLinkMatch = string.match(emailLintRE);
15036
15043
  const localUrlMatch = string.match(localUrlRE);
@@ -15052,12 +15059,12 @@ flowchart TD
15052
15059
  }
15053
15060
  return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15054
15061
  };
15055
- const RichEditor = (props) => {
15062
+ const RichEditor = ({ input, tinaForm, field }) => {
15056
15063
  var _a;
15057
15064
  const initialValue = React.useMemo(
15058
15065
  () => {
15059
15066
  var _a2, _b;
15060
- return ((_b = (_a2 = props.input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? props.input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
15067
+ return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
15061
15068
  },
15062
15069
  []
15063
15070
  );
@@ -15085,7 +15092,7 @@ flowchart TD
15085
15092
  ),
15086
15093
  []
15087
15094
  );
15088
- const tempId = [props.tinaForm.id, props.input.name].join(".");
15095
+ const tempId = [tinaForm.id, input.name].join(".");
15089
15096
  const id = React.useMemo(() => uuid() + tempId, [tempId]);
15090
15097
  const ref = React.useRef(null);
15091
15098
  React.useEffect(() => {
@@ -15095,13 +15102,13 @@ flowchart TD
15095
15102
  const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
15096
15103
  '[role="textbox"]'
15097
15104
  );
15098
- if (props.field.experimental_focusIntent && plateElement) {
15105
+ if (field.experimental_focusIntent && plateElement) {
15099
15106
  if (plateElement)
15100
15107
  plateElement.focus();
15101
15108
  }
15102
15109
  }, 100);
15103
15110
  }
15104
- }, [props.field.experimental_focusIntent, ref]);
15111
+ }, [field.experimental_focusIntent, ref]);
15105
15112
  return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(
15106
15113
  plateCommon.Plate,
15107
15114
  {
@@ -15109,7 +15116,7 @@ flowchart TD
15109
15116
  initialValue,
15110
15117
  plugins: plugins$2,
15111
15118
  onChange: (value) => {
15112
- props.input.onChange({
15119
+ input.onChange({
15113
15120
  type: "root",
15114
15121
  children: value
15115
15122
  });
@@ -15118,12 +15125,12 @@ flowchart TD
15118
15125
  /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
15119
15126
  ToolbarProvider,
15120
15127
  {
15121
- tinaForm: props.tinaForm,
15122
- templates: props.field.templates,
15123
- overrides: (_a = props.field) == null ? void 0 : _a.toolbarOverride
15128
+ tinaForm,
15129
+ templates: field.templates,
15130
+ overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
15124
15131
  },
15125
15132
  /* @__PURE__ */ React.createElement(FixedToolbar, null, /* @__PURE__ */ React.createElement(FixedToolbarButtons, null)),
15126
- /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null))
15133
+ ((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null)) : null
15127
15134
  ), /* @__PURE__ */ React.createElement(Editor, null))
15128
15135
  ));
15129
15136
  };
@@ -16311,132 +16318,1209 @@ flowchart TD
16311
16318
  "হয়"
16312
16319
  ];
16313
16320
  const bre = [
16321
+ "'blam",
16322
+ "'d",
16323
+ "'m",
16324
+ "'r",
16325
+ "'ta",
16326
+ "'vat",
16327
+ "'z",
16328
+ "'zo",
16314
16329
  "a",
16315
- "ainda",
16316
- "alem",
16317
- "ambas",
16318
- "ambos",
16319
- "antes",
16320
- "ao",
16321
- "aonde",
16322
- "aos",
16323
- "apos",
16324
- "aquele",
16325
- "aqueles",
16326
- "as",
16327
- "assim",
16328
- "com",
16329
- "como",
16330
- "contra",
16331
- "contudo",
16332
- "cuja",
16333
- "cujas",
16334
- "cujo",
16335
- "cujos",
16330
+ "a:",
16331
+ "aba",
16332
+ "abalamour",
16333
+ "abaoe",
16334
+ "ac'hane",
16335
+ "ac'hanoc'h",
16336
+ "ac'hanomp",
16337
+ "ac'hanon",
16338
+ "ac'hanout",
16339
+ "adal",
16340
+ "adalek",
16341
+ "adarre",
16342
+ "ae",
16343
+ "aec'h",
16344
+ "aed",
16345
+ "aemp",
16346
+ "aen",
16347
+ "aent",
16348
+ "aes",
16349
+ "afe",
16350
+ "afec'h",
16351
+ "afed",
16352
+ "afemp",
16353
+ "afen",
16354
+ "afent",
16355
+ "afes",
16356
+ "ag",
16357
+ "ah",
16358
+ "aimp",
16359
+ "aint",
16360
+ "aio",
16361
+ "aiou",
16362
+ "aje",
16363
+ "ajec'h",
16364
+ "ajed",
16365
+ "ajemp",
16366
+ "ajen",
16367
+ "ajent",
16368
+ "ajes",
16369
+ "al",
16370
+ "alato",
16371
+ "alies",
16372
+ "aliesañ",
16373
+ "alkent",
16374
+ "all",
16375
+ "allas",
16376
+ "allo",
16377
+ "allô",
16378
+ "am",
16379
+ "amañ",
16380
+ "amzer",
16381
+ "an",
16382
+ "anezhañ",
16383
+ "anezhe",
16384
+ "anezhi",
16385
+ "anezho",
16386
+ "anvet",
16387
+ "aon",
16388
+ "aotren",
16389
+ "ar",
16390
+ "arall",
16391
+ "araok",
16392
+ "araoki",
16393
+ "araozañ",
16394
+ "araozo",
16395
+ "araozoc'h",
16396
+ "araozomp",
16397
+ "araozon",
16398
+ "araozor",
16399
+ "araozout",
16400
+ "arbenn",
16401
+ "arre",
16402
+ "atalek",
16403
+ "atav",
16404
+ "az",
16405
+ "azalek",
16406
+ "azirazañ",
16407
+ "azirazi",
16408
+ "azirazo",
16409
+ "azirazoc'h",
16410
+ "azirazomp",
16411
+ "azirazon",
16412
+ "azirazor",
16413
+ "azirazout",
16414
+ "b:",
16415
+ "ba",
16416
+ "ba'l",
16417
+ "ba'n",
16418
+ "ba'r",
16419
+ "bad",
16420
+ "bah",
16421
+ "bal",
16422
+ "ban",
16423
+ "bar",
16424
+ "bastañ",
16425
+ "befe",
16426
+ "bell",
16427
+ "benaos",
16428
+ "benn",
16429
+ "bennag",
16430
+ "bennak",
16431
+ "bennozh",
16432
+ "bep",
16433
+ "bepred",
16434
+ "berr",
16435
+ "berzh",
16436
+ "bet",
16437
+ "betek",
16438
+ "betra",
16439
+ "bev",
16440
+ "bevet",
16441
+ "bez",
16442
+ "bezañ",
16443
+ "beze",
16444
+ "bezent",
16445
+ "bezet",
16446
+ "bezh",
16447
+ "bezit",
16448
+ "bezomp",
16449
+ "bihan",
16450
+ "bije",
16451
+ "biou",
16452
+ "biskoazh",
16453
+ "blam",
16454
+ "bo",
16455
+ "boa",
16456
+ "bominapl",
16457
+ "boudoudom",
16458
+ "bouez",
16459
+ "boull",
16460
+ "boum",
16461
+ "bout",
16462
+ "bras",
16463
+ "brasañ",
16464
+ "brav",
16465
+ "bravo",
16466
+ "bremañ",
16467
+ "bres",
16468
+ "brokenn",
16469
+ "bronn",
16470
+ "brrr",
16471
+ "brutal",
16472
+ "buhezek",
16473
+ "c'h:",
16474
+ "c'haout",
16475
+ "c'he",
16476
+ "c'hem",
16477
+ "c'herz",
16478
+ "c'heñver",
16479
+ "c'hichen",
16480
+ "c'hiz",
16481
+ "c'hoazh",
16482
+ "c'horre",
16483
+ "c'houde",
16484
+ "c'houst",
16485
+ "c'hreiz",
16486
+ "c'hwec'h",
16487
+ "c'hwec'hvet",
16488
+ "c'hwezek",
16489
+ "c'hwi",
16490
+ "ch:",
16491
+ "chaous",
16492
+ "chik",
16493
+ "chit",
16494
+ "chom",
16495
+ "chut",
16496
+ "d'",
16497
+ "d'al",
16498
+ "d'an",
16499
+ "d'ar",
16500
+ "d'az",
16501
+ "d'e",
16502
+ "d'he",
16503
+ "d'ho",
16504
+ "d'hol",
16505
+ "d'hon",
16506
+ "d'hor",
16507
+ "d'o",
16508
+ "d'ober",
16509
+ "d'ul",
16510
+ "d'un",
16511
+ "d'ur",
16512
+ "d:",
16336
16513
  "da",
16337
- "das",
16338
- "de",
16339
- "dela",
16340
- "dele",
16341
- "deles",
16342
- "demais",
16343
- "depois",
16344
- "desde",
16345
- "desta",
16346
- "deste",
16347
- "dispoe",
16348
- "dispoem",
16349
- "diversa",
16350
- "diversas",
16351
- "diversos",
16514
+ "dak",
16515
+ "daka",
16516
+ "dal",
16517
+ "dalbezh",
16518
+ "dalc'hmat",
16519
+ "dalit",
16520
+ "damdost",
16521
+ "damheñvel",
16522
+ "damm",
16523
+ "dan",
16524
+ "danvez",
16525
+ "dao",
16526
+ "daol",
16527
+ "daonet",
16528
+ "daou",
16529
+ "daoust",
16530
+ "daouzek",
16531
+ "daouzekvet",
16532
+ "darn",
16533
+ "dastrewiñ",
16534
+ "dav",
16535
+ "davedoc'h",
16536
+ "davedomp",
16537
+ "davedon",
16538
+ "davedor",
16539
+ "davedout",
16540
+ "davet",
16541
+ "davetañ",
16542
+ "davete",
16543
+ "daveti",
16544
+ "daveto",
16545
+ "defe",
16546
+ "dehou",
16547
+ "dek",
16548
+ "dekvet",
16549
+ "den",
16550
+ "deoc'h",
16551
+ "deomp",
16552
+ "deor",
16553
+ "derc'hel",
16554
+ "deus",
16555
+ "dez",
16556
+ "deze",
16557
+ "dezhañ",
16558
+ "dezhe",
16559
+ "dezhi",
16560
+ "dezho",
16561
+ "di",
16562
+ "diabarzh",
16563
+ "diagent",
16564
+ "diar",
16565
+ "diaraok",
16566
+ "diavaez",
16567
+ "dibaoe",
16568
+ "dibaot",
16569
+ "dibar",
16570
+ "dic'halañ",
16571
+ "didiac'h",
16572
+ "dienn",
16573
+ "difer",
16574
+ "diganeoc'h",
16575
+ "diganeomp",
16576
+ "diganeor",
16577
+ "diganimp",
16578
+ "diganin",
16579
+ "diganit",
16580
+ "digant",
16581
+ "digantañ",
16582
+ "digante",
16583
+ "diganti",
16584
+ "diganto",
16585
+ "digemmesk",
16586
+ "diget",
16587
+ "digor",
16588
+ "digoret",
16589
+ "dija",
16590
+ "dije",
16591
+ "dimp",
16592
+ "din",
16593
+ "dinaou",
16594
+ "dindan",
16595
+ "dindanañ",
16596
+ "dindani",
16597
+ "dindano",
16598
+ "dindanoc'h",
16599
+ "dindanomp",
16600
+ "dindanon",
16601
+ "dindanor",
16602
+ "dindanout",
16603
+ "dioutañ",
16604
+ "dioute",
16605
+ "diouti",
16606
+ "diouto",
16607
+ "diouzh",
16608
+ "diouzhin",
16609
+ "diouzhit",
16610
+ "diouzhoc'h",
16611
+ "diouzhomp",
16612
+ "diouzhor",
16613
+ "dirak",
16614
+ "dirazañ",
16615
+ "dirazi",
16616
+ "dirazo",
16617
+ "dirazoc'h",
16618
+ "dirazomp",
16619
+ "dirazon",
16620
+ "dirazor",
16621
+ "dirazout",
16622
+ "disheñvel",
16623
+ "dispar",
16624
+ "distank",
16625
+ "dister",
16626
+ "disterañ",
16627
+ "disterig",
16628
+ "distro",
16629
+ "dit",
16630
+ "divaez",
16631
+ "diwar",
16632
+ "diwezhat",
16633
+ "diwezhañ",
16352
16634
  "do",
16353
- "dos",
16354
- "durante",
16635
+ "doa",
16636
+ "doare",
16637
+ "dont",
16638
+ "dost",
16639
+ "doue",
16640
+ "douetus",
16641
+ "douez",
16642
+ "doug",
16643
+ "draou",
16644
+ "draoñ",
16645
+ "dre",
16646
+ "drede",
16647
+ "dreist",
16648
+ "dreistañ",
16649
+ "dreisti",
16650
+ "dreisto",
16651
+ "dreistoc'h",
16652
+ "dreistomp",
16653
+ "dreiston",
16654
+ "dreistor",
16655
+ "dreistout",
16656
+ "drek",
16657
+ "dreñv",
16658
+ "dring",
16659
+ "dro",
16660
+ "du",
16355
16661
  "e",
16356
- "ela",
16357
- "elas",
16358
- "ele",
16359
- "eles",
16662
+ "e:",
16663
+ "eas",
16664
+ "ebet",
16665
+ "ec'h",
16666
+ "edo",
16667
+ "edoc'h",
16668
+ "edod",
16669
+ "edomp",
16670
+ "edon",
16671
+ "edont",
16672
+ "edos",
16673
+ "eer",
16674
+ "eeun",
16675
+ "efed",
16676
+ "egedoc'h",
16677
+ "egedomp",
16678
+ "egedon",
16679
+ "egedor",
16680
+ "egedout",
16681
+ "eget",
16682
+ "egetañ",
16683
+ "egete",
16684
+ "egeti",
16685
+ "egeto",
16686
+ "eh",
16687
+ "eil",
16688
+ "eilvet",
16689
+ "eizh",
16690
+ "eizhvet",
16691
+ "ejoc'h",
16692
+ "ejod",
16693
+ "ejomp",
16694
+ "ejont",
16695
+ "ejout",
16696
+ "el",
16360
16697
  "em",
16361
- "entao",
16362
- "entre",
16363
- "essa",
16364
- "essas",
16365
- "esse",
16366
- "esses",
16367
- "esta",
16368
- "estas",
16369
- "este",
16370
- "estes",
16698
+ "emaint",
16699
+ "emaoc'h",
16700
+ "emaomp",
16701
+ "emaon",
16702
+ "emaout",
16703
+ "emañ",
16704
+ "eme",
16705
+ "emeur",
16706
+ "emezañ",
16707
+ "emezi",
16708
+ "emezo",
16709
+ "emezoc'h",
16710
+ "emezomp",
16711
+ "emezon",
16712
+ "emezout",
16713
+ "emporzhiañ",
16714
+ "en",
16715
+ "end",
16716
+ "endan",
16717
+ "endra",
16718
+ "enep",
16719
+ "ennañ",
16720
+ "enni",
16721
+ "enno",
16722
+ "ennoc'h",
16723
+ "ennomp",
16724
+ "ennon",
16725
+ "ennor",
16726
+ "ennout",
16727
+ "enta",
16728
+ "eo",
16729
+ "eomp",
16730
+ "eont",
16731
+ "eor",
16732
+ "eot",
16733
+ "er",
16734
+ "erbet",
16735
+ "erfin",
16736
+ "esa",
16737
+ "esae",
16738
+ "espar",
16739
+ "estlamm",
16740
+ "estrañj",
16741
+ "eta",
16742
+ "etre",
16743
+ "etreoc'h",
16744
+ "etrezo",
16745
+ "etrezoc'h",
16746
+ "etrezomp",
16747
+ "etrezor",
16748
+ "euh",
16749
+ "eur",
16750
+ "eus",
16751
+ "evel",
16752
+ "evelato",
16753
+ "eveldoc'h",
16754
+ "eveldomp",
16755
+ "eveldon",
16756
+ "eveldor",
16757
+ "eveldout",
16758
+ "evelkent",
16759
+ "eveltañ",
16760
+ "evelte",
16761
+ "evelti",
16762
+ "evelto",
16763
+ "evidoc'h",
16764
+ "evidomp",
16765
+ "evidon",
16766
+ "evidor",
16767
+ "evidout",
16768
+ "evit",
16769
+ "evitañ",
16770
+ "evite",
16771
+ "eviti",
16772
+ "evito",
16773
+ "ez",
16774
+ "eñ",
16775
+ "f:",
16776
+ "fac'h",
16777
+ "fall",
16778
+ "fed",
16779
+ "feiz",
16780
+ "fenn",
16781
+ "fezh",
16782
+ "fin",
16783
+ "finsalvet",
16784
+ "foei",
16785
+ "fouilhezañ",
16786
+ "g:",
16787
+ "gallout",
16788
+ "ganeoc'h",
16789
+ "ganeomp",
16790
+ "ganin",
16791
+ "ganit",
16792
+ "gant",
16793
+ "gantañ",
16794
+ "ganti",
16795
+ "ganto",
16796
+ "gaout",
16797
+ "gast",
16798
+ "gein",
16799
+ "gellout",
16800
+ "genndost",
16801
+ "gentañ",
16802
+ "ger",
16803
+ "gerz",
16804
+ "get",
16805
+ "geñver",
16806
+ "gichen",
16807
+ "gin",
16808
+ "giz",
16809
+ "glan",
16810
+ "gloev",
16811
+ "goll",
16812
+ "gorre",
16813
+ "goude",
16814
+ "gouez",
16815
+ "gouezit",
16816
+ "gouezomp",
16817
+ "goulz",
16818
+ "gounnar",
16819
+ "gour",
16820
+ "goust",
16821
+ "gouze",
16822
+ "gouzout",
16823
+ "gra",
16824
+ "grak",
16825
+ "grec'h",
16826
+ "greiz",
16827
+ "grenn",
16828
+ "greomp",
16829
+ "grit",
16830
+ "groñs",
16831
+ "gutez",
16832
+ "gwall",
16833
+ "gwashoc'h",
16834
+ "gwazh",
16835
+ "gwech",
16836
+ "gwechall",
16837
+ "gwechoù",
16838
+ "gwell",
16839
+ "gwezh",
16840
+ "gwezhall",
16841
+ "gwezharall",
16842
+ "gwezhoù",
16843
+ "gwig",
16844
+ "gwirionez",
16845
+ "gwitibunan",
16846
+ "gêr",
16847
+ "h:",
16371
16848
  "ha",
16372
- "isso",
16373
- "isto",
16374
- "logo",
16375
- "mais",
16376
- "mas",
16377
- "mediante",
16378
- "menos",
16379
- "mesma",
16380
- "mesmas",
16381
- "mesmo",
16382
- "mesmos",
16849
+ "hag",
16850
+ "han",
16851
+ "hanter",
16852
+ "hanterc'hantad",
16853
+ "hanterkantved",
16854
+ "harz",
16855
+ "hañ",
16856
+ "hañval",
16857
+ "he",
16858
+ "hebioù",
16859
+ "hec'h",
16860
+ "hei",
16861
+ "hein",
16862
+ "hem",
16863
+ "hemañ",
16864
+ "hen",
16865
+ "hend",
16866
+ "henhont",
16867
+ "henn",
16868
+ "hennezh",
16869
+ "hent",
16870
+ "hep",
16871
+ "hervez",
16872
+ "hervezañ",
16873
+ "hervezi",
16874
+ "hervezo",
16875
+ "hervezoc'h",
16876
+ "hervezomp",
16877
+ "hervezon",
16878
+ "hervezor",
16879
+ "hervezout",
16880
+ "heul",
16881
+ "heuliañ",
16882
+ "hevelep",
16883
+ "heverk",
16884
+ "heñvel",
16885
+ "heñvelat",
16886
+ "heñvelañ",
16887
+ "heñveliñ",
16888
+ "heñveloc'h",
16889
+ "heñvelout",
16890
+ "hi",
16891
+ "hilh",
16892
+ "hini",
16893
+ "hirie",
16894
+ "hirio",
16895
+ "hiziv",
16896
+ "hiziviken",
16897
+ "ho",
16898
+ "hoaliñ",
16899
+ "hoc'h",
16900
+ "hogen",
16901
+ "hogos",
16902
+ "hogozik",
16903
+ "hol",
16904
+ "holl",
16905
+ "holà",
16906
+ "homañ",
16907
+ "hon",
16908
+ "honhont",
16909
+ "honnezh",
16910
+ "hont",
16911
+ "hop",
16912
+ "hopala",
16913
+ "hor",
16914
+ "hou",
16915
+ "houp",
16916
+ "hudu",
16917
+ "hue",
16918
+ "hui",
16919
+ "hum",
16920
+ "hurrah",
16921
+ "i",
16922
+ "i:",
16923
+ "in",
16924
+ "int",
16925
+ "is",
16926
+ "ispisial",
16927
+ "isurzhiet",
16928
+ "it",
16929
+ "ivez",
16930
+ "izelañ",
16931
+ "j:",
16932
+ "just",
16933
+ "k:",
16934
+ "kae",
16935
+ "kaer",
16936
+ "kalon",
16937
+ "kalz",
16938
+ "kant",
16939
+ "kaout",
16940
+ "kar",
16941
+ "kazi",
16942
+ "keid",
16943
+ "kein",
16944
+ "keit",
16945
+ "kel",
16946
+ "kellies",
16947
+ "keloù",
16948
+ "kement",
16949
+ "ken",
16950
+ "kenkent",
16951
+ "kenkoulz",
16952
+ "kenment",
16953
+ "kent",
16954
+ "kentañ",
16955
+ "kentizh",
16956
+ "kentoc'h",
16957
+ "kentre",
16958
+ "ker",
16959
+ "kerkent",
16960
+ "kerz",
16961
+ "kerzh",
16962
+ "ket",
16963
+ "keta",
16964
+ "keñver",
16965
+ "keñverel",
16966
+ "keñverius",
16967
+ "kichen",
16968
+ "kichenik",
16969
+ "kit",
16970
+ "kiz",
16971
+ "klak",
16972
+ "klek",
16973
+ "klik",
16974
+ "komprenet",
16975
+ "komz",
16976
+ "kont",
16977
+ "korf",
16978
+ "korre",
16979
+ "koulskoude",
16980
+ "koulz",
16981
+ "koust",
16982
+ "krak",
16983
+ "krampouezh",
16984
+ "krec'h",
16985
+ "kreiz",
16986
+ "kuit",
16987
+ "kwir",
16988
+ "l:",
16989
+ "la",
16990
+ "laez",
16991
+ "laoskel",
16992
+ "laouen",
16993
+ "lavar",
16994
+ "lavaret",
16995
+ "lavarout",
16996
+ "lec'h",
16997
+ "lein",
16998
+ "leizh",
16999
+ "lerc'h",
17000
+ "leun",
17001
+ "leuskel",
17002
+ "lew",
17003
+ "lies",
17004
+ "liesañ",
17005
+ "lod",
17006
+ "lusk",
17007
+ "lâr",
17008
+ "lârout",
17009
+ "m:",
17010
+ "ma",
17011
+ "ma'z",
17012
+ "mac'h",
17013
+ "mac'hat",
17014
+ "mac'hañ",
17015
+ "mac'hoc'h",
17016
+ "mad",
17017
+ "maez",
17018
+ "maksimal",
17019
+ "mann",
17020
+ "mar",
17021
+ "mard",
17022
+ "marg",
17023
+ "marzh",
17024
+ "mat",
17025
+ "mañ",
17026
+ "me",
17027
+ "memes",
17028
+ "memestra",
17029
+ "merkapl",
17030
+ "mersi",
17031
+ "mes",
17032
+ "mesk",
17033
+ "met",
17034
+ "meur",
17035
+ "mil",
17036
+ "minimal",
17037
+ "moan",
17038
+ "moaniaat",
17039
+ "mod",
17040
+ "mont",
17041
+ "mout",
17042
+ "mui",
17043
+ "muiañ",
17044
+ "muioc'h",
17045
+ "n",
17046
+ "n'",
17047
+ "n:",
16383
17048
  "na",
16384
- "nao",
16385
- "nas",
16386
- "nem",
16387
- "nesse",
16388
- "neste",
16389
- "nos",
17049
+ "nag",
17050
+ "naontek",
17051
+ "naturel",
17052
+ "nav",
17053
+ "navet",
17054
+ "ne",
17055
+ "nebeudig",
17056
+ "nebeut",
17057
+ "nebeutañ",
17058
+ "nebeutoc'h",
17059
+ "neketa",
17060
+ "nemedoc'h",
17061
+ "nemedomp",
17062
+ "nemedon",
17063
+ "nemedor",
17064
+ "nemedout",
17065
+ "nemet",
17066
+ "nemetañ",
17067
+ "nemete",
17068
+ "nemeti",
17069
+ "nemeto",
17070
+ "nemeur",
17071
+ "neoac'h",
17072
+ "nepell",
17073
+ "nerzh",
17074
+ "nes",
17075
+ "neseser",
17076
+ "netra",
17077
+ "neubeudoù",
17078
+ "neuhe",
17079
+ "neuze",
17080
+ "nevez",
17081
+ "newazh",
17082
+ "nez",
17083
+ "ni",
17084
+ "nikun",
17085
+ "niverus",
17086
+ "nul",
16390
17087
  "o",
16391
- "os",
16392
- "ou",
16393
- "outra",
16394
- "outras",
16395
- "outro",
16396
- "outros",
16397
- "pelas",
16398
- "pelo",
16399
- "pelos",
16400
- "perante",
16401
- "pois",
16402
- "por",
16403
- "porque",
16404
- "portanto",
16405
- "propios",
16406
- "proprio",
16407
- "quais",
16408
- "qual",
16409
- "qualquer",
16410
- "quando",
16411
- "quanto",
16412
- "que",
16413
- "quem",
16414
- "quer",
17088
+ "o:",
17089
+ "oa",
17090
+ "oac'h",
17091
+ "oad",
17092
+ "oamp",
17093
+ "oan",
17094
+ "oant",
17095
+ "oar",
17096
+ "oas",
17097
+ "ober",
17098
+ "oc'h",
17099
+ "oc'ho",
17100
+ "oc'hola",
17101
+ "oc'hpenn",
17102
+ "oh",
17103
+ "ohe",
17104
+ "ollé",
17105
+ "olole",
17106
+ "olé",
17107
+ "omp",
17108
+ "on",
17109
+ "ordin",
17110
+ "ordinal",
17111
+ "ouejoc'h",
17112
+ "ouejod",
17113
+ "ouejomp",
17114
+ "ouejont",
17115
+ "ouejout",
17116
+ "ouek",
17117
+ "ouezas",
17118
+ "ouezi",
17119
+ "ouezimp",
17120
+ "ouezin",
17121
+ "ouezint",
17122
+ "ouezis",
17123
+ "ouezo",
17124
+ "ouezoc'h",
17125
+ "ouezor",
17126
+ "ouf",
17127
+ "oufe",
17128
+ "oufec'h",
17129
+ "oufed",
17130
+ "oufemp",
17131
+ "oufen",
17132
+ "oufent",
17133
+ "oufes",
17134
+ "ouie",
17135
+ "ouiec'h",
17136
+ "ouied",
17137
+ "ouiemp",
17138
+ "ouien",
17139
+ "ouient",
17140
+ "ouies",
17141
+ "ouije",
17142
+ "ouijec'h",
17143
+ "ouijed",
17144
+ "ouijemp",
17145
+ "ouijen",
17146
+ "ouijent",
17147
+ "ouijes",
17148
+ "out",
17149
+ "outañ",
17150
+ "outi",
17151
+ "outo",
17152
+ "ouzer",
17153
+ "ouzh",
17154
+ "ouzhin",
17155
+ "ouzhit",
17156
+ "ouzhoc'h",
17157
+ "ouzhomp",
17158
+ "ouzhor",
17159
+ "ouzhpenn",
17160
+ "ouzhpennik",
17161
+ "ouzoc'h",
17162
+ "ouzomp",
17163
+ "ouzon",
17164
+ "ouzont",
17165
+ "ouzout",
17166
+ "p'",
17167
+ "p:",
17168
+ "pa",
17169
+ "pad",
17170
+ "padal",
17171
+ "paf",
17172
+ "pan",
17173
+ "panevedeoc'h",
17174
+ "panevedo",
17175
+ "panevedomp",
17176
+ "panevedon",
17177
+ "panevedout",
17178
+ "panevet",
17179
+ "panevetañ",
17180
+ "paneveti",
17181
+ "pas",
17182
+ "paseet",
17183
+ "pe",
17184
+ "peadra",
17185
+ "peder",
17186
+ "pedervet",
17187
+ "pedervetvet",
17188
+ "pefe",
17189
+ "pegeit",
17190
+ "pegement",
17191
+ "pegen",
17192
+ "pegiz",
17193
+ "pegoulz",
17194
+ "pehini",
17195
+ "pelec'h",
17196
+ "pell",
17197
+ "pemod",
17198
+ "pemp",
17199
+ "pempved",
17200
+ "pemzek",
17201
+ "penaos",
17202
+ "penn",
17203
+ "peogwir",
17204
+ "peotramant",
17205
+ "pep",
17206
+ "perak",
17207
+ "perc'hennañ",
17208
+ "pergen",
17209
+ "permetiñ",
17210
+ "peseurt",
17211
+ "pet",
17212
+ "petiaoul",
17213
+ "petoare",
17214
+ "petra",
17215
+ "peur",
17216
+ "peurgetket",
17217
+ "peurheñvel",
17218
+ "peurliesañ",
17219
+ "peurvuiañ",
17220
+ "peus",
17221
+ "peustost",
17222
+ "peuz",
17223
+ "pevar",
17224
+ "pevare",
17225
+ "pevarevet",
17226
+ "pevarzek",
17227
+ "pez",
17228
+ "peze",
17229
+ "pezh",
17230
+ "pff",
17231
+ "pfft",
17232
+ "pfut",
17233
+ "picher",
17234
+ "pif",
17235
+ "pife",
17236
+ "pign",
17237
+ "pije",
17238
+ "pikol",
17239
+ "pitiaoul",
17240
+ "piv",
17241
+ "plaouf",
17242
+ "plok",
17243
+ "plouf",
17244
+ "po",
17245
+ "poa",
17246
+ "poelladus",
17247
+ "pof",
17248
+ "pok",
17249
+ "posupl",
17250
+ "pouah",
17251
+ "pourc'henn",
17252
+ "prest",
17253
+ "prestik",
17254
+ "prim",
17255
+ "prin",
17256
+ "provostapl",
17257
+ "pst",
17258
+ "pu",
17259
+ "pur",
17260
+ "r:",
17261
+ "ra",
17262
+ "rae",
17263
+ "raec'h",
17264
+ "raed",
17265
+ "raemp",
17266
+ "raen",
17267
+ "raent",
17268
+ "raes",
17269
+ "rafe",
17270
+ "rafec'h",
17271
+ "rafed",
17272
+ "rafemp",
17273
+ "rafen",
17274
+ "rafent",
17275
+ "rafes",
17276
+ "rag",
17277
+ "raimp",
17278
+ "raint",
17279
+ "raio",
17280
+ "raje",
17281
+ "rajec'h",
17282
+ "rajed",
17283
+ "rajemp",
17284
+ "rajen",
17285
+ "rajent",
17286
+ "rajes",
17287
+ "rak",
17288
+ "ral",
17289
+ "ran",
17290
+ "rankout",
17291
+ "raok",
17292
+ "razh",
17293
+ "re",
17294
+ "reas",
17295
+ "reer",
17296
+ "regennoù",
17297
+ "reiñ",
17298
+ "rejoc'h",
17299
+ "rejod",
17300
+ "rejomp",
17301
+ "rejont",
17302
+ "rejout",
17303
+ "rener",
17304
+ "rentañ",
17305
+ "reoc'h",
17306
+ "reomp",
17307
+ "reont",
17308
+ "reor",
17309
+ "reot",
17310
+ "resis",
17311
+ "ret",
17312
+ "reve",
17313
+ "rez",
17314
+ "ri",
17315
+ "rik",
17316
+ "rin",
17317
+ "ris",
17318
+ "rit",
17319
+ "rouez",
17320
+ "s:",
17321
+ "sac'h",
17322
+ "sant",
17323
+ "sav",
17324
+ "sañset",
16415
17325
  "se",
16416
- "seja",
16417
- "sem",
16418
- "sendo",
16419
- "seu",
16420
- "seus",
16421
- "sob",
16422
- "sobre",
16423
- "sua",
16424
- "suas",
17326
+ "sed",
17327
+ "seitek",
17328
+ "seizh",
17329
+ "seizhvet",
17330
+ "sell",
17331
+ "sellit",
17332
+ "ser",
17333
+ "setu",
17334
+ "seul",
17335
+ "seurt",
17336
+ "siwazh",
17337
+ "skignañ",
17338
+ "skoaz",
17339
+ "skouer",
17340
+ "sort",
17341
+ "souden",
17342
+ "souvitañ",
17343
+ "soñj",
17344
+ "speriañ",
17345
+ "spririñ",
17346
+ "stad",
17347
+ "stlabezañ",
17348
+ "stop",
17349
+ "stranañ",
17350
+ "strewiñ",
17351
+ "strishaat",
17352
+ "stumm",
17353
+ "sujed",
17354
+ "surtoud",
17355
+ "t:",
17356
+ "ta",
17357
+ "taer",
17358
+ "tailh",
17359
+ "tak",
16425
17360
  "tal",
16426
- "tambem",
16427
- "teu",
17361
+ "talvoudegezh",
17362
+ "tamm",
17363
+ "tanav",
17364
+ "taol",
17365
+ "te",
17366
+ "techet",
17367
+ "teir",
17368
+ "teirvet",
17369
+ "telt",
17370
+ "teltenn",
16428
17371
  "teus",
16429
- "toda",
16430
- "todas",
16431
- "todo",
16432
- "todos",
16433
- "tua",
16434
- "tuas",
16435
- "tudo",
16436
- "um",
16437
- "uma",
16438
- "umas",
16439
- "uns"
17372
+ "teut",
17373
+ "teuteu",
17374
+ "ti",
17375
+ "tik",
17376
+ "toa",
17377
+ "tok",
17378
+ "tost",
17379
+ "tostig",
17380
+ "toud",
17381
+ "touesk",
17382
+ "touez",
17383
+ "toull",
17384
+ "tra",
17385
+ "trantenn",
17386
+ "traoñ",
17387
+ "trawalc'h",
17388
+ "tre",
17389
+ "trede",
17390
+ "tregont",
17391
+ "tremenet",
17392
+ "tri",
17393
+ "trivet",
17394
+ "triwec'h",
17395
+ "trizek",
17396
+ "tro",
17397
+ "trugarez",
17398
+ "trumm",
17399
+ "tsoin",
17400
+ "tsouin",
17401
+ "tu",
17402
+ "tud",
17403
+ "u:",
17404
+ "ugent",
17405
+ "uhel",
17406
+ "uhelañ",
17407
+ "ul",
17408
+ "un",
17409
+ "unan",
17410
+ "unanez",
17411
+ "unanig",
17412
+ "unnek",
17413
+ "unnekvet",
17414
+ "ur",
17415
+ "urzh",
17416
+ "us",
17417
+ "v:",
17418
+ "va",
17419
+ "vale",
17420
+ "van",
17421
+ "vare",
17422
+ "vat",
17423
+ "vefe",
17424
+ "vefec'h",
17425
+ "vefed",
17426
+ "vefemp",
17427
+ "vefen",
17428
+ "vefent",
17429
+ "vefes",
17430
+ "vesk",
17431
+ "vete",
17432
+ "vez",
17433
+ "vezan",
17434
+ "vezañ",
17435
+ "veze",
17436
+ "vezec'h",
17437
+ "vezed",
17438
+ "vezemp",
17439
+ "vezen",
17440
+ "vezent",
17441
+ "vezer",
17442
+ "vezes",
17443
+ "vezez",
17444
+ "vezit",
17445
+ "vezomp",
17446
+ "vezont",
17447
+ "vi",
17448
+ "vihan",
17449
+ "vihanañ",
17450
+ "vije",
17451
+ "vijec'h",
17452
+ "vijed",
17453
+ "vijemp",
17454
+ "vijen",
17455
+ "vijent",
17456
+ "vijes",
17457
+ "viken",
17458
+ "vimp",
17459
+ "vin",
17460
+ "vint",
17461
+ "vior",
17462
+ "viot",
17463
+ "virviken",
17464
+ "viskoazh",
17465
+ "vlan",
17466
+ "vlaou",
17467
+ "vo",
17468
+ "vod",
17469
+ "voe",
17470
+ "voec'h",
17471
+ "voed",
17472
+ "voemp",
17473
+ "voen",
17474
+ "voent",
17475
+ "voes",
17476
+ "vont",
17477
+ "vostapl",
17478
+ "vrac'h",
17479
+ "vrasañ",
17480
+ "vremañ",
17481
+ "w:",
17482
+ "walc'h",
17483
+ "war",
17484
+ "warnañ",
17485
+ "warni",
17486
+ "warno",
17487
+ "warnoc'h",
17488
+ "warnomp",
17489
+ "warnon",
17490
+ "warnor",
17491
+ "warnout",
17492
+ "wazh",
17493
+ "wech",
17494
+ "wechoù",
17495
+ "well",
17496
+ "y:",
17497
+ "you",
17498
+ "youadenn",
17499
+ "youc'hadenn",
17500
+ "youc'hou",
17501
+ "z:",
17502
+ "za",
17503
+ "zan",
17504
+ "zaw",
17505
+ "zeu",
17506
+ "zi",
17507
+ "ziar",
17508
+ "zigarez",
17509
+ "ziget",
17510
+ "zindan",
17511
+ "zioc'h",
17512
+ "ziouzh",
17513
+ "zirak",
17514
+ "zivout",
17515
+ "ziwar",
17516
+ "ziwezhañ",
17517
+ "zo",
17518
+ "zoken",
17519
+ "zokenoc'h",
17520
+ "zouesk",
17521
+ "zouez",
17522
+ "zro",
17523
+ "zu"
16440
17524
  ];
16441
17525
  const bul = [
16442
17526
  "а",
@@ -28092,22 +29176,32 @@ flowchart TD
28092
29176
  "şöyle"
28093
29177
  ];
28094
29178
  const ukr = [
29179
+ "а",
29180
+ "або",
28095
29181
  "авжеж",
28096
29182
  "адже",
29183
+ "аж",
28097
29184
  "але",
29185
+ "ані",
28098
29186
  "б",
28099
29187
  "без",
29188
+ "би",
29189
+ "бо",
28100
29190
  "був",
28101
29191
  "була",
28102
29192
  "були",
28103
29193
  "було",
28104
29194
  "бути",
28105
29195
  "більш",
29196
+ "в",
28106
29197
  "вам",
29198
+ "вами",
28107
29199
  "вас",
28108
29200
  "весь",
29201
+ "вже",
28109
29202
  "вздовж",
28110
29203
  "ви",
29204
+ "від",
28111
29205
  "вниз",
28112
29206
  "внизу",
28113
29207
  "вона",
@@ -28116,55 +29210,138 @@ flowchart TD
28116
29210
  "все",
28117
29211
  "всередині",
28118
29212
  "всіх",
29213
+ "вся",
28119
29214
  "від",
28120
29215
  "він",
28121
29216
  "да",
28122
29217
  "давай",
28123
29218
  "давати",
28124
29219
  "де",
29220
+ "десь",
28125
29221
  "дещо",
28126
29222
  "для",
28127
29223
  "до",
29224
+ "є",
29225
+ "ж",
29226
+ "же",
28128
29227
  "з",
29228
+ "за",
28129
29229
  "завжди",
28130
29230
  "замість",
29231
+ "зі",
29232
+ "і",
29233
+ "із",
29234
+ "інших",
29235
+ "її",
29236
+ "їй",
29237
+ "їм",
29238
+ "їх",
28131
29239
  "й",
29240
+ "його",
29241
+ "йому",
28132
29242
  "коли",
28133
29243
  "ледве",
29244
+ "лиш",
28134
29245
  "майже",
29246
+ "мене",
29247
+ "мені",
28135
29248
  "ми",
29249
+ "між",
29250
+ "мій",
29251
+ "мною",
29252
+ "мов",
29253
+ "мого",
29254
+ "моєї",
29255
+ "моє",
29256
+ "може",
29257
+ "мої",
29258
+ "моїх",
29259
+ "моя",
29260
+ "на",
29261
+ "над",
28136
29262
  "навколо",
28137
29263
  "навіть",
28138
29264
  "нам",
29265
+ "нами",
29266
+ "нас",
29267
+ "наче",
29268
+ "наш",
29269
+ "не",
29270
+ "нє",
29271
+ "неї",
29272
+ "нема",
29273
+ "немов",
29274
+ "неначе",
29275
+ "нею",
29276
+ "ним",
29277
+ "ними",
29278
+ "них",
29279
+ "ні",
29280
+ "ніби",
29281
+ "ніщо",
29282
+ "нього",
29283
+ "о",
29284
+ "ось",
28139
29285
  "от",
28140
29286
  "отже",
28141
29287
  "отож",
29288
+ "під",
29289
+ "по",
28142
29290
  "поза",
28143
29291
  "про",
28144
29292
  "під",
29293
+ "сам",
29294
+ "сама",
29295
+ "свій",
29296
+ "свої",
29297
+ "своя",
29298
+ "свою",
29299
+ "себе",
29300
+ "собі",
28145
29301
  "та",
29302
+ "там",
28146
29303
  "так",
29304
+ "така",
28147
29305
  "такий",
28148
29306
  "також",
29307
+ "твій",
29308
+ "твого",
29309
+ "твоєї",
29310
+ "твої",
29311
+ "твоя",
28149
29312
  "те",
29313
+ "тебе",
28150
29314
  "ти",
29315
+ "ті",
29316
+ "тільки",
29317
+ "то",
29318
+ "тобі",
29319
+ "тобою",
28151
29320
  "тобто",
29321
+ "тоді",
28152
29322
  "тож",
29323
+ "той",
28153
29324
  "тощо",
29325
+ "тут",
29326
+ "у",
29327
+ "хіба",
29328
+ "хоч",
28154
29329
  "хоча",
28155
29330
  "це",
28156
29331
  "цей",
29332
+ "ці",
29333
+ "ця",
28157
29334
  "чи",
28158
29335
  "чого",
29336
+ "ще",
28159
29337
  "що",
29338
+ "щоб",
29339
+ "щось",
29340
+ "я",
28160
29341
  "як",
29342
+ "яка",
28161
29343
  "який",
28162
- "якої",
28163
- "є",
28164
- "із",
28165
- "інших",
28166
- "їх",
28167
- "її"
29344
+ "якої"
28168
29345
  ];
28169
29346
  const urd = [
28170
29347
  "آئی",
@@ -29162,7 +30339,14 @@ flowchart TD
29162
30339
  const AUTH_TOKEN_KEY = "tinacms-auth";
29163
30340
  const authenticate = (clientId, frontendUrl) => {
29164
30341
  return new Promise((resolve) => {
29165
- let authTab;
30342
+ const origin = `${window.location.protocol}//${window.location.host}`;
30343
+ const authTab = popupWindow(
30344
+ `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
30345
+ "_blank",
30346
+ window,
30347
+ 1e3,
30348
+ 700
30349
+ );
29166
30350
  window.addEventListener("message", function(e) {
29167
30351
  if (e.data.source === TINA_LOGIN_EVENT) {
29168
30352
  if (authTab) {
@@ -29175,14 +30359,6 @@ flowchart TD
29175
30359
  });
29176
30360
  }
29177
30361
  });
29178
- const origin = `${window.location.protocol}//${window.location.host}`;
29179
- authTab = popupWindow(
29180
- `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
29181
- "_blank",
29182
- window,
29183
- 1e3,
29184
- 700
29185
- );
29186
30362
  });
29187
30363
  };
29188
30364
  const DefaultSessionProvider = ({
@@ -29888,21 +31064,352 @@ mutation addPendingDocumentMutation(
29888
31064
  !submitting && name
29889
31065
  );
29890
31066
  };
29891
- const TINA_AUTH_CONFIG = "tina_auth_config";
29892
- const useTinaAuthRedirect = () => {
29893
- React.useEffect(() => {
29894
- const urlParams = new URLSearchParams(window.location.search);
29895
- const config = {
29896
- code: urlParams.get("code") || "",
29897
- scope: urlParams.get("scope") || "email",
29898
- state: urlParams.get("state")
29899
- };
29900
- if (!config.code) {
29901
- return;
31067
+ class TinaAdminApi {
31068
+ constructor(cms) {
31069
+ var _a, _b, _c, _d;
31070
+ this.maxSearchIndexFieldLength = 100;
31071
+ this.api = cms.api.tina;
31072
+ this.schema = cms.api.tina.schema;
31073
+ if (cms.api.search && ((_a = cms.api.search) == null ? void 0 : _a.supportsClientSideIndexing())) {
31074
+ this.searchClient = cms.api.searchClient;
31075
+ this.maxSearchIndexFieldLength = ((_d = (_c = (_b = this.schema.config) == null ? void 0 : _b.config) == null ? void 0 : _c.search) == null ? void 0 : _d.maxSearchIndexFieldLength) || 100;
29902
31076
  }
29903
- localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
29904
- }, []);
29905
- };
31077
+ }
31078
+ async isAuthenticated() {
31079
+ return await this.api.authProvider.isAuthenticated();
31080
+ }
31081
+ async checkGraphqlSchema({ localSchema }) {
31082
+ const schemaFromCloud = await this.api.getSchema();
31083
+ const schema1 = schemaFromCloud;
31084
+ const schema2 = graphql.buildSchema(graphql.print(localSchema));
31085
+ const diffOutput = await core.diff(schema1, schema2);
31086
+ if (diffOutput.length > 0) {
31087
+ return false;
31088
+ } else {
31089
+ return true;
31090
+ }
31091
+ }
31092
+ fetchCollections() {
31093
+ return this.schema.getCollections();
31094
+ }
31095
+ async renameDocument({ collection, relativePath: relativePath2, newRelativePath }) {
31096
+ await this.api.request(
31097
+ `#graphql
31098
+ mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
31099
+ updateDocument(collection: $collection, relativePath: $relativePath, params: {relativePath: $newRelativePath}){
31100
+ __typename
31101
+ }
31102
+ }
31103
+ `,
31104
+ { variables: { collection, relativePath: relativePath2, newRelativePath } }
31105
+ );
31106
+ if (this.searchClient) {
31107
+ const { document: doc } = await this.fetchDocument(
31108
+ collection.name,
31109
+ newRelativePath
31110
+ );
31111
+ const processed = processDocumentForIndexing(
31112
+ doc["_values"],
31113
+ `${collection.path}/${newRelativePath}`,
31114
+ collection,
31115
+ this.maxSearchIndexFieldLength
31116
+ );
31117
+ await this.searchClient.put([processed]);
31118
+ await this.searchClient.del([`${collection.name}:${relativePath2}`]);
31119
+ }
31120
+ }
31121
+ async deleteDocument({
31122
+ collection,
31123
+ relativePath: relativePath2
31124
+ }) {
31125
+ var _a;
31126
+ await this.api.request(
31127
+ `#graphql
31128
+ mutation DeleteDocument($collection: String!, $relativePath: String! ){
31129
+ deleteDocument(collection: $collection, relativePath: $relativePath){
31130
+ __typename
31131
+ }
31132
+ }`,
31133
+ { variables: { collection, relativePath: relativePath2 } }
31134
+ );
31135
+ await ((_a = this.searchClient) == null ? void 0 : _a.del([`${collection}:${relativePath2}`]));
31136
+ }
31137
+ async fetchCollection(collectionName, includeDocuments, folder = "", after, sortKey, order, filterArgs) {
31138
+ let filter = null;
31139
+ const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
31140
+ if (filterField) {
31141
+ filter = {
31142
+ [collectionName]: {
31143
+ [filterField]: {}
31144
+ }
31145
+ };
31146
+ }
31147
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
31148
+ filter[collectionName][filterField] = {
31149
+ ...filter[collectionName][filterField] || {},
31150
+ startsWith: filterArgs.startsWith
31151
+ };
31152
+ }
31153
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
31154
+ filter[collectionName][filterField] = {
31155
+ ...filter[collectionName][filterField] || {},
31156
+ before: filterArgs.before
31157
+ };
31158
+ }
31159
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
31160
+ filter[collectionName][filterField] = {
31161
+ ...filter[collectionName][filterField] || {},
31162
+ after: filterArgs.after
31163
+ };
31164
+ }
31165
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
31166
+ filter[collectionName][filterField] = {
31167
+ ...filter[collectionName][filterField] || {},
31168
+ eq: filterArgs.booleanEquals
31169
+ };
31170
+ }
31171
+ if (includeDocuments === true) {
31172
+ const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
31173
+ const response = order === "asc" ? await this.api.request(
31174
+ `#graphql
31175
+ query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String){
31176
+ collection(collection: $collection){
31177
+ name
31178
+ label
31179
+ format
31180
+ templates
31181
+ documents(sort: $sort, after: $after, first: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
31182
+ totalCount
31183
+ pageInfo {
31184
+ hasPreviousPage
31185
+ hasNextPage
31186
+ startCursor
31187
+ endCursor
31188
+ }
31189
+ edges {
31190
+ node {
31191
+ __typename
31192
+ ... on Folder {
31193
+ name
31194
+ path
31195
+ }
31196
+ ... on Document {
31197
+ _sys {
31198
+ title
31199
+ template
31200
+ breadcrumbs
31201
+ path
31202
+ basename
31203
+ relativePath
31204
+ filename
31205
+ extension
31206
+ hasReferences
31207
+ }
31208
+ }
31209
+ }
31210
+ }
31211
+ }
31212
+ }
31213
+ }`,
31214
+ {
31215
+ variables: {
31216
+ collection: collectionName,
31217
+ includeDocuments,
31218
+ folder,
31219
+ sort,
31220
+ limit: 50,
31221
+ after,
31222
+ filter
31223
+ }
31224
+ }
31225
+ ) : await this.api.request(
31226
+ `#graphql
31227
+ query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String) {
31228
+ collection(collection: $collection){
31229
+ name
31230
+ label
31231
+ format
31232
+ templates
31233
+ documents(sort: $sort, before: $after, last: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
31234
+ totalCount
31235
+ pageInfo {
31236
+ hasPreviousPage
31237
+ hasNextPage
31238
+ startCursor
31239
+ endCursor
31240
+ }
31241
+ edges {
31242
+ node {
31243
+ __typename
31244
+ ... on Folder {
31245
+ name
31246
+ path
31247
+ }
31248
+ ... on Document {
31249
+ _sys {
31250
+ title
31251
+ template
31252
+ breadcrumbs
31253
+ path
31254
+ basename
31255
+ relativePath
31256
+ filename
31257
+ extension
31258
+ }
31259
+ }
31260
+ }
31261
+ }
31262
+ }
31263
+ }
31264
+ }`,
31265
+ {
31266
+ variables: {
31267
+ collection: collectionName,
31268
+ includeDocuments,
31269
+ folder,
31270
+ sort,
31271
+ limit: 50,
31272
+ after,
31273
+ filter
31274
+ }
31275
+ }
31276
+ );
31277
+ return response.collection;
31278
+ } else {
31279
+ try {
31280
+ const collection = this.schema.getCollection(collectionName);
31281
+ return collection;
31282
+ } catch (e) {
31283
+ console.error(
31284
+ `[TinaAdminAPI] Unable to fetchCollection(): ${e.message}`
31285
+ );
31286
+ return void 0;
31287
+ }
31288
+ }
31289
+ }
31290
+ async fetchDocument(collectionName, relativePath2, values = true) {
31291
+ let query;
31292
+ if (values) {
31293
+ query = `#graphql
31294
+ query($collection: String!, $relativePath: String!) {
31295
+ document(collection:$collection, relativePath:$relativePath) {
31296
+ ... on Document {
31297
+ _values
31298
+ _sys {
31299
+ hasReferences
31300
+ }
31301
+ }
31302
+ }
31303
+ }`;
31304
+ } else {
31305
+ query = `#graphql
31306
+ query($collection: String!, $relativePath: String!) {
31307
+ document(collection:$collection, relativePath:$relativePath) {
31308
+ __typename
31309
+ ... on Document {
31310
+ _sys {
31311
+ title
31312
+ template
31313
+ breadcrumbs
31314
+ path
31315
+ basename
31316
+ relativePath
31317
+ filename
31318
+ extension
31319
+ }
31320
+ }
31321
+ }
31322
+ }`;
31323
+ }
31324
+ const response = await this.api.request(query, {
31325
+ variables: { collection: collectionName, relativePath: relativePath2 }
31326
+ });
31327
+ return response;
31328
+ }
31329
+ async createDocument(collection, relativePath2, params) {
31330
+ const response = await this.api.request(
31331
+ `#graphql
31332
+ mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
31333
+ createDocument(
31334
+ collection: $collection,
31335
+ relativePath: $relativePath,
31336
+ params: $params
31337
+ ){__typename}
31338
+ }`,
31339
+ {
31340
+ variables: {
31341
+ collection: collection.name,
31342
+ relativePath: relativePath2,
31343
+ params
31344
+ }
31345
+ }
31346
+ );
31347
+ if (this.searchClient) {
31348
+ const { document: doc } = await this.fetchDocument(
31349
+ collection.name,
31350
+ relativePath2
31351
+ );
31352
+ const processed = processDocumentForIndexing(
31353
+ doc["_values"],
31354
+ `${collection.path}/${relativePath2}`,
31355
+ collection,
31356
+ this.maxSearchIndexFieldLength
31357
+ );
31358
+ await this.searchClient.put([processed]);
31359
+ }
31360
+ return response;
31361
+ }
31362
+ async updateDocument(collection, relativePath2, params) {
31363
+ const response = await this.api.request(
31364
+ `#graphql
31365
+ mutation($collection: String!, $relativePath: String!, $params: DocumentUpdateMutation!) {
31366
+ updateDocument(
31367
+ collection: $collection,
31368
+ relativePath: $relativePath,
31369
+ params: $params
31370
+ ){__typename}
31371
+ }`,
31372
+ {
31373
+ variables: {
31374
+ collection: collection.name,
31375
+ relativePath: relativePath2,
31376
+ params
31377
+ }
31378
+ }
31379
+ );
31380
+ if (this.searchClient) {
31381
+ const { document: doc } = await this.fetchDocument(
31382
+ collection.name,
31383
+ relativePath2
31384
+ );
31385
+ const processed = processDocumentForIndexing(
31386
+ doc["_values"],
31387
+ `${collection.path}/${relativePath2}`,
31388
+ collection,
31389
+ this.maxSearchIndexFieldLength
31390
+ );
31391
+ await this.searchClient.put([processed]);
31392
+ }
31393
+ return response;
31394
+ }
31395
+ async createFolder(collection, folderName) {
31396
+ return this.api.request(
31397
+ `#graphql
31398
+ mutation($collection: String!, $folderName: String!) {
31399
+ createFolder(
31400
+ collection: $collection,
31401
+ relativePath: $folderName
31402
+ ){__typename}
31403
+ }`,
31404
+ {
31405
+ variables: {
31406
+ collection,
31407
+ folderName
31408
+ }
31409
+ }
31410
+ );
31411
+ }
31412
+ }
29906
31413
  const createClient = ({
29907
31414
  clientId,
29908
31415
  isLocalClient = true,
@@ -29938,348 +31445,21 @@ mutation addPendingDocumentMutation(
29938
31445
  return false;
29939
31446
  }
29940
31447
  }
29941
- class TinaAdminApi {
29942
- constructor(cms) {
29943
- var _a, _b, _c, _d;
29944
- this.maxSearchIndexFieldLength = 100;
29945
- this.api = cms.api.tina;
29946
- this.schema = cms.api.tina.schema;
29947
- if (cms.api.search && ((_a = cms.api.search) == null ? void 0 : _a.supportsClientSideIndexing())) {
29948
- this.searchClient = cms.api.searchClient;
29949
- this.maxSearchIndexFieldLength = ((_d = (_c = (_b = this.schema.config) == null ? void 0 : _b.config) == null ? void 0 : _c.search) == null ? void 0 : _d.maxSearchIndexFieldLength) || 100;
29950
- }
29951
- }
29952
- async isAuthenticated() {
29953
- return await this.api.authProvider.isAuthenticated();
29954
- }
29955
- async checkGraphqlSchema({ localSchema }) {
29956
- const schemaFromCloud = await this.api.getSchema();
29957
- const schema1 = schemaFromCloud;
29958
- const schema2 = graphql.buildSchema(graphql.print(localSchema));
29959
- const diffOutput = await core.diff(schema1, schema2);
29960
- if (diffOutput.length > 0) {
29961
- return false;
29962
- } else {
29963
- return true;
29964
- }
29965
- }
29966
- fetchCollections() {
29967
- return this.schema.getCollections();
29968
- }
29969
- async renameDocument({ collection, relativePath: relativePath2, newRelativePath }) {
29970
- await this.api.request(
29971
- `#graphql
29972
- mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
29973
- updateDocument(collection: $collection, relativePath: $relativePath, params: {relativePath: $newRelativePath}){
29974
- __typename
29975
- }
29976
- }
29977
- `,
29978
- { variables: { collection, relativePath: relativePath2, newRelativePath } }
29979
- );
29980
- if (this.searchClient) {
29981
- const { document: doc } = await this.fetchDocument(
29982
- collection.name,
29983
- newRelativePath
29984
- );
29985
- const processed = processDocumentForIndexing(
29986
- doc["_values"],
29987
- `${collection.path}/${newRelativePath}`,
29988
- collection,
29989
- this.maxSearchIndexFieldLength
29990
- );
29991
- await this.searchClient.put([processed]);
29992
- await this.searchClient.del([`${collection.name}:${relativePath2}`]);
29993
- }
29994
- }
29995
- async deleteDocument({
29996
- collection,
29997
- relativePath: relativePath2
29998
- }) {
29999
- var _a;
30000
- await this.api.request(
30001
- `#graphql
30002
- mutation DeleteDocument($collection: String!, $relativePath: String! ){
30003
- deleteDocument(collection: $collection, relativePath: $relativePath){
30004
- __typename
30005
- }
30006
- }`,
30007
- { variables: { collection, relativePath: relativePath2 } }
30008
- );
30009
- await ((_a = this.searchClient) == null ? void 0 : _a.del([`${collection}:${relativePath2}`]));
30010
- }
30011
- async fetchCollection(collectionName, includeDocuments, folder = "", after, sortKey, order, filterArgs) {
30012
- let filter = null;
30013
- const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
30014
- if (filterField) {
30015
- filter = {
30016
- [collectionName]: {
30017
- [filterField]: {}
30018
- }
30019
- };
30020
- }
30021
- if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
30022
- filter[collectionName][filterField] = {
30023
- ...filter[collectionName][filterField] || {},
30024
- startsWith: filterArgs.startsWith
30025
- };
30026
- }
30027
- if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
30028
- filter[collectionName][filterField] = {
30029
- ...filter[collectionName][filterField] || {},
30030
- before: filterArgs.before
30031
- };
30032
- }
30033
- if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
30034
- filter[collectionName][filterField] = {
30035
- ...filter[collectionName][filterField] || {},
30036
- after: filterArgs.after
30037
- };
30038
- }
30039
- if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
30040
- filter[collectionName][filterField] = {
30041
- ...filter[collectionName][filterField] || {},
30042
- eq: filterArgs.booleanEquals
30043
- };
30044
- }
30045
- if (includeDocuments === true) {
30046
- const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
30047
- const response = order === "asc" ? await this.api.request(
30048
- `#graphql
30049
- query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String){
30050
- collection(collection: $collection){
30051
- name
30052
- label
30053
- format
30054
- templates
30055
- documents(sort: $sort, after: $after, first: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
30056
- totalCount
30057
- pageInfo {
30058
- hasPreviousPage
30059
- hasNextPage
30060
- startCursor
30061
- endCursor
30062
- }
30063
- edges {
30064
- node {
30065
- __typename
30066
- ... on Folder {
30067
- name
30068
- path
30069
- }
30070
- ... on Document {
30071
- _sys {
30072
- title
30073
- template
30074
- breadcrumbs
30075
- path
30076
- basename
30077
- relativePath
30078
- filename
30079
- extension
30080
- }
30081
- }
30082
- }
30083
- }
30084
- }
30085
- }
30086
- }`,
30087
- {
30088
- variables: {
30089
- collection: collectionName,
30090
- includeDocuments,
30091
- folder,
30092
- sort,
30093
- limit: 50,
30094
- after,
30095
- filter
30096
- }
30097
- }
30098
- ) : await this.api.request(
30099
- `#graphql
30100
- query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String) {
30101
- collection(collection: $collection){
30102
- name
30103
- label
30104
- format
30105
- templates
30106
- documents(sort: $sort, before: $after, last: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
30107
- totalCount
30108
- pageInfo {
30109
- hasPreviousPage
30110
- hasNextPage
30111
- startCursor
30112
- endCursor
30113
- }
30114
- edges {
30115
- node {
30116
- __typename
30117
- ... on Folder {
30118
- name
30119
- path
30120
- }
30121
- ... on Document {
30122
- _sys {
30123
- title
30124
- template
30125
- breadcrumbs
30126
- path
30127
- basename
30128
- relativePath
30129
- filename
30130
- extension
30131
- }
30132
- }
30133
- }
30134
- }
30135
- }
30136
- }
30137
- }`,
30138
- {
30139
- variables: {
30140
- collection: collectionName,
30141
- includeDocuments,
30142
- folder,
30143
- sort,
30144
- limit: 50,
30145
- after,
30146
- filter
30147
- }
30148
- }
30149
- );
30150
- return response.collection;
30151
- } else {
30152
- try {
30153
- const collection = this.schema.getCollection(collectionName);
30154
- return collection;
30155
- } catch (e) {
30156
- console.error(
30157
- `[TinaAdminAPI] Unable to fetchCollection(): ${e.message}`
30158
- );
30159
- return void 0;
30160
- }
30161
- }
30162
- }
30163
- async fetchDocument(collectionName, relativePath2, values = true) {
30164
- let query;
30165
- if (values) {
30166
- query = `#graphql
30167
- query($collection: String!, $relativePath: String!) {
30168
- document(collection:$collection, relativePath:$relativePath) {
30169
- ... on Document {
30170
- _values
30171
- }
30172
- }
30173
- }`;
30174
- } else {
30175
- query = `#graphql
30176
- query($collection: String!, $relativePath: String!) {
30177
- document(collection:$collection, relativePath:$relativePath) {
30178
- __typename
30179
- ... on Document {
30180
- _sys {
30181
- title
30182
- template
30183
- breadcrumbs
30184
- path
30185
- basename
30186
- relativePath
30187
- filename
30188
- extension
30189
- }
30190
- }
30191
- }
30192
- }`;
30193
- }
30194
- const response = await this.api.request(query, {
30195
- variables: { collection: collectionName, relativePath: relativePath2 }
30196
- });
30197
- return response;
30198
- }
30199
- async createDocument(collection, relativePath2, params) {
30200
- const response = await this.api.request(
30201
- `#graphql
30202
- mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
30203
- createDocument(
30204
- collection: $collection,
30205
- relativePath: $relativePath,
30206
- params: $params
30207
- ){__typename}
30208
- }`,
30209
- {
30210
- variables: {
30211
- collection: collection.name,
30212
- relativePath: relativePath2,
30213
- params
30214
- }
30215
- }
30216
- );
30217
- if (this.searchClient) {
30218
- const { document: doc } = await this.fetchDocument(
30219
- collection.name,
30220
- relativePath2
30221
- );
30222
- const processed = processDocumentForIndexing(
30223
- doc["_values"],
30224
- `${collection.path}/${relativePath2}`,
30225
- collection,
30226
- this.maxSearchIndexFieldLength
30227
- );
30228
- await this.searchClient.put([processed]);
30229
- }
30230
- return response;
30231
- }
30232
- async updateDocument(collection, relativePath2, params) {
30233
- const response = await this.api.request(
30234
- `#graphql
30235
- mutation($collection: String!, $relativePath: String!, $params: DocumentUpdateMutation!) {
30236
- updateDocument(
30237
- collection: $collection,
30238
- relativePath: $relativePath,
30239
- params: $params
30240
- ){__typename}
30241
- }`,
30242
- {
30243
- variables: {
30244
- collection: collection.name,
30245
- relativePath: relativePath2,
30246
- params
30247
- }
30248
- }
30249
- );
30250
- if (this.searchClient) {
30251
- const { document: doc } = await this.fetchDocument(
30252
- collection.name,
30253
- relativePath2
30254
- );
30255
- const processed = processDocumentForIndexing(
30256
- doc["_values"],
30257
- `${collection.path}/${relativePath2}`,
30258
- collection,
30259
- this.maxSearchIndexFieldLength
30260
- );
30261
- await this.searchClient.put([processed]);
31448
+ const TINA_AUTH_CONFIG = "tina_auth_config";
31449
+ const useTinaAuthRedirect = () => {
31450
+ React.useEffect(() => {
31451
+ const urlParams = new URLSearchParams(window.location.search);
31452
+ const config = {
31453
+ code: urlParams.get("code") || "",
31454
+ scope: urlParams.get("scope") || "email",
31455
+ state: urlParams.get("state")
31456
+ };
31457
+ if (!config.code) {
31458
+ return;
30262
31459
  }
30263
- return response;
30264
- }
30265
- async createFolder(collection, folderName) {
30266
- return this.api.request(
30267
- `#graphql
30268
- mutation($collection: String!, $folderName: String!) {
30269
- createFolder(
30270
- collection: $collection,
30271
- relativePath: $folderName
30272
- ){__typename}
30273
- }`,
30274
- {
30275
- variables: {
30276
- collection,
30277
- folderName
30278
- }
30279
- }
30280
- );
30281
- }
30282
- }
31460
+ localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
31461
+ }, []);
31462
+ };
30283
31463
  function sleep(ms) {
30284
31464
  return new Promise((resolve) => setTimeout(resolve, ms));
30285
31465
  }
@@ -30616,6 +31796,9 @@ mutation addPendingDocumentMutation(
30616
31796
  cms.flags.set("branch-switcher", true);
30617
31797
  client.usingEditorialWorkflow = true;
30618
31798
  client.protectedBranches = project.protectedBranches;
31799
+ if (!project.metadata[currentBranch]) {
31800
+ setCurrentBranch(project.defaultBranch || "main");
31801
+ }
30619
31802
  }
30620
31803
  });
30621
31804
  };
@@ -30628,7 +31811,7 @@ mutation addPendingDocumentMutation(
30628
31811
  }
30629
31812
  });
30630
31813
  return unsubscribe;
30631
- }, [isTinaCloud, cms]);
31814
+ }, [currentBranch, isTinaCloud, cms]);
30632
31815
  return /* @__PURE__ */ React.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React.createElement(
30633
31816
  BranchDataProvider,
30634
31817
  {
@@ -31481,6 +32664,35 @@ This will work when developing locally but NOT when deployed to production.
31481
32664
  }) => {
31482
32665
  return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React.createElement(Button$1, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
31483
32666
  };
32667
+ const isValidSortKey = (sortKey, collection) => {
32668
+ if (collection.fields) {
32669
+ const sortKeys = collection.fields.map((x) => x.name);
32670
+ return sortKeys.includes(sortKey);
32671
+ } else if (collection.templates) {
32672
+ const collectionMap = {};
32673
+ const conflictedFields = /* @__PURE__ */ new Set();
32674
+ for (const template of collection.templates) {
32675
+ for (const field of template.fields) {
32676
+ if (collectionMap[field.name]) {
32677
+ if (collectionMap[field.name].type !== field.type) {
32678
+ conflictedFields.add(field.name);
32679
+ }
32680
+ } else {
32681
+ collectionMap[field.name] = field;
32682
+ }
32683
+ }
32684
+ }
32685
+ for (const key in conflictedFields) {
32686
+ delete collectionMap[key];
32687
+ }
32688
+ for (const key in collectionMap) {
32689
+ if (key === sortKey) {
32690
+ return true;
32691
+ }
32692
+ }
32693
+ return false;
32694
+ }
32695
+ };
31484
32696
  const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
31485
32697
  const api = new TinaAdminApi(cms);
31486
32698
  const schema = cms.api.tina.schema;
@@ -31492,10 +32704,9 @@ This will work when developing locally but NOT when deployed to production.
31492
32704
  React.useEffect(() => {
31493
32705
  let cancelled = false;
31494
32706
  const fetchCollection = async () => {
31495
- var _a;
31496
32707
  if (await api.isAuthenticated() && !folder.loading && !cancelled) {
31497
32708
  const { name, order } = JSON.parse(sortKey || "{}");
31498
- const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
32709
+ const validSortKey = isValidSortKey(name, collectionExtra) ? name : void 0;
31499
32710
  try {
31500
32711
  const collection2 = await api.fetchCollection(
31501
32712
  collectionName,
@@ -31791,6 +33002,7 @@ This will work when developing locally but NOT when deployed to production.
31791
33002
  const [vars, setVars] = React.useState({
31792
33003
  collection: collectionName,
31793
33004
  relativePath: "",
33005
+ relativePathWithoutExtension: "",
31794
33006
  newRelativePath: "",
31795
33007
  filterField: "",
31796
33008
  folderName: "",
@@ -31832,6 +33044,7 @@ This will work when developing locally but NOT when deployed to production.
31832
33044
  ...old,
31833
33045
  collection: collectionName,
31834
33046
  relativePath: "",
33047
+ relativePathWithoutExtension: "",
31835
33048
  newRelativePath: "",
31836
33049
  filterField: "",
31837
33050
  startsWith: "",
@@ -31857,6 +33070,7 @@ This will work when developing locally but NOT when deployed to production.
31857
33070
  collectionName === vars.collection ? vars : {
31858
33071
  collection: collectionName,
31859
33072
  relativePath: "",
33073
+ relativePathWithoutExtension: "",
31860
33074
  newRelativePath: "",
31861
33075
  filterField: "",
31862
33076
  startsWith: "",
@@ -31894,6 +33108,23 @@ This will work when developing locally but NOT when deployed to production.
31894
33108
  DeleteModal,
31895
33109
  {
31896
33110
  filename: vars.relativePath,
33111
+ checkRefsFunc: async () => {
33112
+ var _a2, _b2;
33113
+ try {
33114
+ const doc = await admin.fetchDocument(
33115
+ collection.name,
33116
+ vars.relativePath,
33117
+ true
33118
+ );
33119
+ return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
33120
+ } catch (error) {
33121
+ cms.alerts.error(
33122
+ "Document was not found, ask a developer for help or check the console for an error message"
33123
+ );
33124
+ console.error(error);
33125
+ throw error;
33126
+ }
33127
+ },
31897
33128
  deleteFunc: async () => {
31898
33129
  try {
31899
33130
  await admin.deleteDocument(vars);
@@ -31902,6 +33133,12 @@ This will work when developing locally but NOT when deployed to production.
31902
33133
  );
31903
33134
  reFetchCollection();
31904
33135
  } catch (error) {
33136
+ if (error.message.indexOf("has references")) {
33137
+ cms.alerts.error(
33138
+ error.message.split("\n ").filter(Boolean)[1]
33139
+ );
33140
+ return;
33141
+ }
31905
33142
  cms.alerts.warn(
31906
33143
  "Document was not deleted, ask a developer for help or check the console for an error message"
31907
33144
  );
@@ -31921,7 +33158,9 @@ This will work when developing locally but NOT when deployed to production.
31921
33158
  safeSubmit: async () => {
31922
33159
  try {
31923
33160
  await admin.deleteDocument(vars);
31924
- cms.alerts.info("Document was successfully deleted");
33161
+ cms.alerts.info(
33162
+ "Document was successfully deleted"
33163
+ );
31925
33164
  reFetchCollection();
31926
33165
  } catch (error) {
31927
33166
  cms.alerts.warn(
@@ -31935,7 +33174,7 @@ This will work when developing locally but NOT when deployed to production.
31935
33174
  ), renameModalOpen && /* @__PURE__ */ React.createElement(
31936
33175
  RenameModal,
31937
33176
  {
31938
- filename: vars.relativePath,
33177
+ filename: vars.relativePathWithoutExtension,
31939
33178
  newRelativePath: vars.newRelativePath,
31940
33179
  setNewRelativePath: (newRelativePath) => {
31941
33180
  setVars((vars2) => {
@@ -31950,9 +33189,17 @@ This will work when developing locally but NOT when deployed to production.
31950
33189
  relativePath: vars.relativePath,
31951
33190
  newRelativePath
31952
33191
  });
31953
- cms.alerts.info("Document was successfully renamed");
33192
+ cms.alerts.info(
33193
+ "Document was successfully renamed"
33194
+ );
31954
33195
  reFetchCollection();
31955
33196
  } catch (error) {
33197
+ if (error.message.indexOf("has references")) {
33198
+ cms.alerts.error(
33199
+ error.message.split("\n ").filter(Boolean)[1]
33200
+ );
33201
+ return;
33202
+ }
31956
33203
  cms.alerts.warn(
31957
33204
  "Document was not renamed, ask a developer for help or check the console for an error message"
31958
33205
  );
@@ -32044,7 +33291,9 @@ This will work when developing locally but NOT when deployed to production.
32044
33291
  name: "sort",
32045
33292
  value: sortKey,
32046
33293
  onChange: (e) => {
32047
- const val = JSON.parse(e.target.value);
33294
+ const val = JSON.parse(
33295
+ e.target.value
33296
+ );
32048
33297
  setEndCursor("");
32049
33298
  setPrevCursors([]);
32050
33299
  window == null ? void 0 : window.localStorage.setItem(
@@ -32250,6 +33499,9 @@ This will work when developing locally but NOT when deployed to production.
32250
33499
  setVars((old) => ({
32251
33500
  ...old,
32252
33501
  collection: collectionName,
33502
+ relativePathWithoutExtension: document2.node._sys.breadcrumbs.join(
33503
+ "/"
33504
+ ),
32253
33505
  relativePath: document2.node._sys.breadcrumbs.join(
32254
33506
  "/"
32255
33507
  ) + document2.node._sys.extension,
@@ -32272,6 +33524,9 @@ This will work when developing locally but NOT when deployed to production.
32272
33524
  setVars((old) => ({
32273
33525
  ...old,
32274
33526
  collection: collectionName,
33527
+ relativePathWithoutExtension: document2.node._sys.breadcrumbs.join(
33528
+ "/"
33529
+ ),
32275
33530
  relativePath: document2.node._sys.breadcrumbs.join(
32276
33531
  "/"
32277
33532
  ) + document2.node._sys.extension,
@@ -32426,8 +33681,19 @@ This will work when developing locally but NOT when deployed to production.
32426
33681
  const NoDocumentsPlaceholder = () => {
32427
33682
  return /* @__PURE__ */ React.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
32428
33683
  };
32429
- const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
32430
- return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
33684
+ const DeleteModal = ({
33685
+ close: close2,
33686
+ deleteFunc,
33687
+ checkRefsFunc,
33688
+ filename
33689
+ }) => {
33690
+ const [hasRefs, setHasRefs] = React.useState();
33691
+ React.useEffect(() => {
33692
+ checkRefsFunc().then((result) => {
33693
+ setHasRefs(result);
33694
+ });
33695
+ }, [filename, checkRefsFunc]);
33696
+ return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
32431
33697
  Button$1,
32432
33698
  {
32433
33699
  style: { flexGrow: 3 },
@@ -32473,7 +33739,7 @@ This will work when developing locally but NOT when deployed to production.
32473
33739
  newRelativePath,
32474
33740
  setNewRelativePath
32475
33741
  }) => {
32476
- return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Rename ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: "mb-4" }, "Are you sure you want to rename ", /* @__PURE__ */ React.createElement("strong", null, filename), "? TinaCMS uses the filename as the ID; renaming this file could result in unresolved references."), /* @__PURE__ */ React.createElement(
33742
+ return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Rename ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: "mb-4" }, "Are you sure you want to rename ", /* @__PURE__ */ React.createElement("strong", null, filename), "?"), /* @__PURE__ */ React.createElement(
32477
33743
  BaseTextField,
32478
33744
  {
32479
33745
  placeholder: "Enter a new name for the document's file",
@@ -32488,7 +33754,8 @@ This will work when developing locally but NOT when deployed to production.
32488
33754
  onClick: async () => {
32489
33755
  await renameFunc();
32490
33756
  close2();
32491
- }
33757
+ },
33758
+ disabled: !newRelativePath || newRelativePath === filename
32492
33759
  },
32493
33760
  "Rename"
32494
33761
  ))));
@@ -32815,7 +34082,10 @@ This will work when developing locally but NOT when deployed to production.
32815
34082
  const fetchDocument = async () => {
32816
34083
  if (api.isAuthenticated()) {
32817
34084
  try {
32818
- const response = await api.fetchDocument(collectionName, relativePath2);
34085
+ const response = await api.fetchDocument(
34086
+ collectionName,
34087
+ relativePath2
34088
+ );
32819
34089
  setDocument(response.document);
32820
34090
  } catch (error2) {
32821
34091
  cms.alerts.error(
@@ -33159,15 +34429,24 @@ This will work when developing locally but NOT when deployed to production.
33159
34429
  }
33160
34430
  }
33161
34431
  if (state === "creatingPR") {
33162
- const foo = await tinaApi.createPullRequest({
33163
- baseBranch,
33164
- branch,
33165
- title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
33166
- });
33167
- console.log("PR created", foo);
33168
- cms.alerts.success("Pull request created.");
33169
- localStorage.setItem("tina.createBranchState", "done");
33170
- setState("done");
34432
+ try {
34433
+ const foo = await tinaApi.createPullRequest({
34434
+ baseBranch,
34435
+ branch,
34436
+ title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
34437
+ });
34438
+ console.log("PR created", foo);
34439
+ cms.alerts.success("Pull request created.");
34440
+ localStorage.setItem("tina.createBranchState", "done");
34441
+ setState("done");
34442
+ } catch (e) {
34443
+ console.error(e);
34444
+ cms.alerts.error("Failed to create PR");
34445
+ setErrorMessage(
34446
+ "Failed to create PR, please try again. If the problem persists please contact support."
34447
+ );
34448
+ setState("error");
34449
+ }
33171
34450
  }
33172
34451
  if (state === "done") {
33173
34452
  window.location.href = back;
@@ -33794,6 +35073,7 @@ This will work when developing locally but NOT when deployed to production.
33794
35073
  exports2.useScreenPlugin = useScreenPlugin;
33795
35074
  exports2.useTinaAuthRedirect = useTinaAuthRedirect;
33796
35075
  exports2.wrapFieldWithError = wrapFieldWithError;
35076
+ exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
33797
35077
  exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
33798
35078
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
33799
35079
  });