tinacms 0.0.0-f03fd62-20241023052950 → 0.0.0-f322e12-20250327003611

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 (34) 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/cache/node-cache.d.ts +1 -0
  6. package/dist/client.js +83 -63
  7. package/dist/client.mjs +49 -35
  8. package/dist/hooks/create-page-plugin.d.ts +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +2478 -1200
  11. package/dist/index.mjs +2496 -1218
  12. package/dist/node-cache-5e8db9f0.mjs +63 -0
  13. package/dist/react.d.ts +1 -0
  14. package/dist/react.js +13 -1
  15. package/dist/react.mjs +13 -1
  16. package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +17 -5
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +6 -11
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +5 -1
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +2 -2
  24. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  25. package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +5 -4
  26. package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
  27. package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
  28. package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
  29. package/dist/toolkit/tina-state.d.ts +4 -0
  30. package/dist/unifiedClient/index.d.ts +8 -1
  31. package/package.json +40 -40
  32. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
  33. package/dist/node-cache-065e42a2.mjs +0 -52
  34. package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
package/dist/index.mjs CHANGED
@@ -6,21 +6,21 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { z } from "zod";
8
8
  import * as React from "react";
9
- import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition, createElement, Component } from "react";
10
- import { createPortal, findDOMNode } from "react-dom";
9
+ import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
10
+ import { createPortal } from "react-dom";
11
11
  import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
12
- import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
13
- import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
12
+ import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createBasicMarksPlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createUnderlinePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
13
+ import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, insertEmptyElement, useMarkToolbarButtonState, useMarkToolbarButton, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
14
14
  import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
15
15
  import { useSelected, useReadOnly, ReactEditor } from "slate-react";
16
16
  import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
17
17
  import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
18
- import { Combobox, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
18
+ import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
19
19
  import { cva } from "class-variance-authority";
20
20
  import { Eye, SquarePen, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Moon, SunMedium, Twitter } from "lucide-react";
21
21
  import mermaid from "mermaid";
22
22
  import { ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4 as ELEMENT_H4$1, ELEMENT_H5 as ELEMENT_H5$1, ELEMENT_H6 as ELEMENT_H6$1 } from "@udecode/plate-heading";
23
- import { useComboboxContext, Combobox as Combobox$1, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
23
+ import { useComboboxContext, Combobox as Combobox$2, useComboboxStore, ComboboxProvider, Portal, ComboboxPopover, ComboboxItem } from "@ariakit/react";
24
24
  import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
25
25
  import { useTableCellElementState, useTableCellElement, useTableCellElementResizableState, useTableCellElementResizable, useTableBordersDropdownMenuContentState, useTableMergeState, TableProvider, useTableElementState, useTableElement, mergeTableCells, unmergeTableCells, ELEMENT_TABLE as ELEMENT_TABLE$1, getTableColumnCount, insertTable, deleteTable, insertTableColumn, deleteColumn, insertTableRow, deleteRow } from "@udecode/plate-table";
26
26
  import { ResizeHandle as ResizeHandle$1 } from "@udecode/plate-resizable";
@@ -43,6 +43,7 @@ import { twMerge } from "tailwind-merge";
43
43
  import { Command as Command$1 } from "cmdk";
44
44
  import { isHotkey } from "is-hotkey";
45
45
  import { Transforms, Element, Range, Path, Node, Editor as Editor$1 } from "slate";
46
+ import { useWindowWidth } from "@react-hook/window-size";
46
47
  import get from "lodash.get";
47
48
  import moment from "moment";
48
49
  import { formatDistanceToNow } from "date-fns";
@@ -52,13 +53,12 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
52
53
  import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragraph";
53
54
  import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
54
55
  import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
55
- import { useWindowWidth } from "@react-hook/window-size";
56
56
  import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buildSchema } from "graphql";
57
57
  import gql from "graphql-tag";
58
58
  import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
59
59
  import { NAMER, resolveField } from "@tinacms/schema-tools";
60
- import * as yup from "yup";
61
60
  import { diff } from "@graphql-inspector/core";
61
+ import * as yup from "yup";
62
62
  import { NavLink, useNavigate, useLocation, useParams, Link, useSearchParams, HashRouter, Routes, Route } from "react-router-dom";
63
63
  import { stringifyMDX } from "@tinacms/mdx";
64
64
  const ModalProvider = ({ children }) => {
@@ -801,6 +801,22 @@ function wrapFieldsWithMeta(Field2) {
801
801
  );
802
802
  };
803
803
  }
804
+ function wrapFieldWithNoHeader(Field2) {
805
+ return (props) => {
806
+ return /* @__PURE__ */ React.createElement(
807
+ FieldMeta,
808
+ {
809
+ name: props.input.name,
810
+ label: false,
811
+ description: "",
812
+ error: props.meta.error,
813
+ index: props.index,
814
+ tinaForm: props.tinaForm
815
+ },
816
+ /* @__PURE__ */ React.createElement(Field2, { ...props })
817
+ );
818
+ };
819
+ }
804
820
  function wrapFieldWithError(Field2) {
805
821
  return (props) => {
806
822
  return /* @__PURE__ */ React.createElement(
@@ -873,6 +889,16 @@ const FieldDescription = ({
873
889
  className,
874
890
  ...props
875
891
  }) => {
892
+ if (typeof children === "string") {
893
+ return /* @__PURE__ */ React.createElement(
894
+ "span",
895
+ {
896
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
897
+ ...props,
898
+ dangerouslySetInnerHTML: { __html: children }
899
+ }
900
+ );
901
+ }
876
902
  return /* @__PURE__ */ React.createElement(
877
903
  "span",
878
904
  {
@@ -966,7 +992,7 @@ const Autocomplete = ({
966
992
  }
967
993
  }, [items2, query]);
968
994
  return /* @__PURE__ */ React__default.createElement(
969
- Combobox,
995
+ Combobox$1,
970
996
  {
971
997
  value,
972
998
  onChange,
@@ -1332,8 +1358,8 @@ const ListElementVariants = withVariants(PlateElement, listVariants, [
1332
1358
  ]);
1333
1359
  const ListElement = withRef(
1334
1360
  ({ children, variant = "ul", ...props }, ref) => {
1335
- const Component2 = variant;
1336
- return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component2, null, children));
1361
+ const Component = variant;
1362
+ return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
1337
1363
  }
1338
1364
  );
1339
1365
  const ELEMENT_MERMAID = "mermaid";
@@ -2147,7 +2173,7 @@ const InlineComboboxInput = forwardRef(({ className, ...props }, propRef) => {
2147
2173
  },
2148
2174
  value || "​"
2149
2175
  ), /* @__PURE__ */ React__default.createElement(
2150
- Combobox$1,
2176
+ Combobox$2,
2151
2177
  {
2152
2178
  autoSelect: true,
2153
2179
  className: cn$1(
@@ -2944,7 +2970,7 @@ const Components = () => {
2944
2970
  ),
2945
2971
  [MARK_CODE]: CodeLeaf,
2946
2972
  [MARK_UNDERLINE]: withProps(PlateLeaf, { as: "u" }),
2947
- [MARK_STRIKETHROUGH]: withProps(PlateLeaf, { as: "s" }),
2973
+ [MARK_STRIKETHROUGH]: ({ editor, leaf, text, ...props }) => /* @__PURE__ */ React__default.createElement("s", { ...props.attributes, ...props }),
2948
2974
  [MARK_ITALIC]: withProps(PlateLeaf, { as: "em" }),
2949
2975
  [MARK_BOLD]: ({ editor, leaf, text, ...props }) => /* @__PURE__ */ React__default.createElement("strong", { ...props.attributes, ...props }),
2950
2976
  [ELEMENT_HR]: ({
@@ -3653,7 +3679,7 @@ function TinaForm({ form, children }) {
3653
3679
  }));
3654
3680
  }
3655
3681
  function TinaField({
3656
- Component: Component2,
3682
+ Component,
3657
3683
  children,
3658
3684
  ...fieldProps
3659
3685
  }) {
@@ -3661,7 +3687,7 @@ function TinaField({
3661
3687
  if (!isEditing)
3662
3688
  return children || null;
3663
3689
  return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
3664
- return /* @__PURE__ */ React.createElement(Component2, { input, meta, ...fieldProps });
3690
+ return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
3665
3691
  });
3666
3692
  }
3667
3693
  TinaField.propTypes = {
@@ -3703,7 +3729,7 @@ const Button$1 = ({
3703
3729
  };
3704
3730
  const sizeClasses = {
3705
3731
  small: `text-xs h-8 px-3`,
3706
- medium: `text-sm h-10 px-4`,
3732
+ medium: `text-sm h-10 px-8`,
3707
3733
  custom: ``
3708
3734
  };
3709
3735
  return /* @__PURE__ */ React.createElement(
@@ -3831,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
3831
3857
  function _objectWithoutProperties(source, excluded) {
3832
3858
  if (source == null)
3833
3859
  return {};
3834
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3860
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3835
3861
  var key, i;
3836
3862
  if (Object.getOwnPropertySymbols) {
3837
3863
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3846,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
3846
3872
  }
3847
3873
  return target;
3848
3874
  }
3849
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3875
+ function _objectWithoutPropertiesLoose(source, excluded) {
3850
3876
  if (source == null)
3851
3877
  return {};
3852
3878
  var target = {};
@@ -4936,7 +4962,28 @@ const NumberInput = ({
4936
4962
  onChange,
4937
4963
  value,
4938
4964
  step
4939
- }) => /* @__PURE__ */ React.createElement(Input, { type: "number", step, value, onChange });
4965
+ }) => /* @__PURE__ */ React.createElement(
4966
+ Input,
4967
+ {
4968
+ type: "number",
4969
+ step,
4970
+ value,
4971
+ onChange: (event) => {
4972
+ const inputValue = event.target.value;
4973
+ const newValue = inputValue === "" ? void 0 : inputValue;
4974
+ if (onChange) {
4975
+ const syntheticEvent = {
4976
+ ...event,
4977
+ target: {
4978
+ ...event.target,
4979
+ value: newValue
4980
+ }
4981
+ };
4982
+ onChange(syntheticEvent);
4983
+ }
4984
+ }
4985
+ }
4986
+ );
4940
4987
  function useCMS() {
4941
4988
  return useCMS$1();
4942
4989
  }
@@ -5177,7 +5224,7 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
5177
5224
  side: "bottom",
5178
5225
  className: cn(
5179
5226
  "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",
5180
- "max-h-[30vh] max-w-[30vh] overflow-y-auto",
5227
+ "max-h-[30vh] max-w-[30vw] overflow-y-auto",
5181
5228
  className
5182
5229
  ),
5183
5230
  ...props
@@ -5269,11 +5316,7 @@ const getFilename = (optionSets, value) => {
5269
5316
  const node = nodes.find((node2) => node2.id === value);
5270
5317
  return node ? node._internalSys.filename : null;
5271
5318
  };
5272
- const ComboboxDemo = ({
5273
- cms,
5274
- input,
5275
- field
5276
- }) => {
5319
+ const Combobox = ({ cms, input, field }) => {
5277
5320
  const [open2, setOpen] = React.useState(false);
5278
5321
  const [value, setValue] = React.useState(input.value);
5279
5322
  const [displayText, setDisplayText] = React.useState(null);
@@ -5289,7 +5332,9 @@ const ComboboxDemo = ({
5289
5332
  }, [value, input, optionSets]);
5290
5333
  React.useEffect(() => {
5291
5334
  if (field.experimental___filter && optionSets.length > 0) {
5292
- setFilteredOptionsList(field.experimental___filter(optionSets, void 0));
5335
+ setFilteredOptionsList(
5336
+ field.experimental___filter(optionSets, void 0)
5337
+ );
5293
5338
  } else {
5294
5339
  setFilteredOptionsList(optionSets);
5295
5340
  }
@@ -5297,17 +5342,17 @@ const ComboboxDemo = ({
5297
5342
  if (loading === true) {
5298
5343
  return /* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" });
5299
5344
  }
5300
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
5345
+ return /* @__PURE__ */ React.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
5301
5346
  Button,
5302
5347
  {
5303
5348
  variant: "outline",
5304
5349
  role: "combobox",
5305
5350
  "aria-expanded": open2,
5306
- className: "w-52 justify-between"
5351
+ className: "w-full justify-between"
5307
5352
  },
5308
5353
  /* @__PURE__ */ React.createElement("p", { className: "truncate" }, displayText ?? "Choose an option..."),
5309
5354
  open2 ? /* @__PURE__ */ React.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React.createElement(IoMdArrowDropdown, { size: 20 })
5310
- )), /* @__PURE__ */ React.createElement(PopoverContent, { className: "p-0 relative" }, /* @__PURE__ */ React.createElement(
5355
+ )), /* @__PURE__ */ React.createElement(PopoverContent, { className: "p-0 relative min-w-[var(--radix-popover-trigger-width)]" }, /* @__PURE__ */ React.createElement(
5311
5356
  Command,
5312
5357
  {
5313
5358
  shouldFilter: !field.experimental___filter,
@@ -5331,32 +5376,25 @@ const ComboboxDemo = ({
5331
5376
  }
5332
5377
  ),
5333
5378
  /* @__PURE__ */ React.createElement(CommandEmpty, null, "No reference found"),
5334
- /* @__PURE__ */ React.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React.createElement(
5335
- CommandGroup,
5336
- {
5337
- key: `${collection}-group`,
5338
- heading: collection
5339
- },
5340
- /* @__PURE__ */ React.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
5341
- const { id, _values } = node;
5342
- return /* @__PURE__ */ React.createElement(
5343
- OptionComponent,
5344
- {
5345
- id,
5346
- key: id,
5347
- value,
5348
- field,
5349
- _values,
5350
- node,
5351
- onSelect: (currentValue) => {
5352
- setValue(currentValue);
5353
- setOpen(false);
5354
- }
5379
+ /* @__PURE__ */ React.createElement(CommandList, null, filteredOptionsList.length > 0 && (filteredOptionsList == null ? void 0 : filteredOptionsList.map(({ collection, edges }) => /* @__PURE__ */ React.createElement(CommandGroup, { key: `${collection}-group`, heading: collection }, /* @__PURE__ */ React.createElement(CommandList, null, edges == null ? void 0 : edges.map(({ node }) => {
5380
+ const { id, _values } = node;
5381
+ return /* @__PURE__ */ React.createElement(
5382
+ OptionComponent,
5383
+ {
5384
+ id,
5385
+ key: id,
5386
+ value,
5387
+ field,
5388
+ _values,
5389
+ node,
5390
+ onSelect: (currentValue) => {
5391
+ setValue(currentValue);
5392
+ setOpen(false);
5355
5393
  }
5356
- );
5357
- }))
5358
- ))))
5359
- ))));
5394
+ }
5395
+ );
5396
+ }))))))
5397
+ )));
5360
5398
  };
5361
5399
  const useGetNode = (cms, id) => {
5362
5400
  const [document2, setDocument] = React.useState(
@@ -5429,7 +5467,7 @@ const ReferenceLink = ({ cms, input }) => {
5429
5467
  };
5430
5468
  const Reference = ({ input, field }) => {
5431
5469
  const cms = useCMS();
5432
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "relative group" }, /* @__PURE__ */ React.createElement(ComboboxDemo, { cms, input, field })), /* @__PURE__ */ React.createElement(ReferenceLink, { cms, input }));
5470
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "relative group" }, /* @__PURE__ */ React.createElement(Combobox, { cms, input, field })), /* @__PURE__ */ React.createElement(ReferenceLink, { cms, input }));
5433
5471
  };
5434
5472
  const ButtonToggle = ({
5435
5473
  input,
@@ -5666,7 +5704,9 @@ const Item$2 = ({
5666
5704
  onClick: () => {
5667
5705
  const state = tinaForm.finalForm.getState();
5668
5706
  if (state.invalid === true) {
5669
- cms.alerts.error("Cannot navigate away from an invalid form.");
5707
+ cms.alerts.error(
5708
+ "Cannot navigate away from an invalid form."
5709
+ );
5670
5710
  return;
5671
5711
  }
5672
5712
  cms.dispatch({
@@ -5737,10 +5777,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
5737
5777
  return /* @__PURE__ */ React__default.createElement(
5738
5778
  "button",
5739
5779
  {
5740
- 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"}`,
5780
+ type: "button",
5781
+ 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"}`,
5741
5782
  onClick
5742
5783
  },
5743
- /* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out duration-100" })
5784
+ /* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
5744
5785
  );
5745
5786
  };
5746
5787
  const DragHandle = ({ isDragging }) => {
@@ -5818,27 +5859,35 @@ const BlockSelector = ({
5818
5859
  ))))
5819
5860
  ))));
5820
5861
  };
5821
- const Group = wrapFieldWithError(({ tinaForm, field }) => {
5822
- const cms = useCMS$1();
5823
- React.useState(false);
5824
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
5825
- Header,
5826
- {
5827
- onClick: () => {
5828
- const state = tinaForm.finalForm.getState();
5829
- if (state.invalid === true) {
5830
- cms.alerts.error("Cannot navigate away from an invalid form.");
5831
- return;
5862
+ const Group = wrapFieldWithNoHeader(
5863
+ ({ tinaForm, field }) => {
5864
+ const cms = useCMS$1();
5865
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
5866
+ Header,
5867
+ {
5868
+ onClick: () => {
5869
+ const state = tinaForm.finalForm.getState();
5870
+ if (state.invalid === true) {
5871
+ cms.alerts.error("Cannot navigate away from an invalid form.");
5872
+ return;
5873
+ }
5874
+ cms.dispatch({
5875
+ type: "forms:set-active-field-name",
5876
+ value: { formId: tinaForm.id, fieldName: field.name }
5877
+ });
5832
5878
  }
5833
- cms.dispatch({
5834
- type: "forms:set-active-field-name",
5835
- value: { formId: tinaForm.id, fieldName: field.name }
5836
- });
5837
- }
5838
- },
5839
- field.label || field.name
5840
- ));
5841
- });
5879
+ },
5880
+ field.label || field.name,
5881
+ field.description && /* @__PURE__ */ React.createElement(
5882
+ "span",
5883
+ {
5884
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
5885
+ dangerouslySetInnerHTML: { __html: field.description }
5886
+ }
5887
+ )
5888
+ ));
5889
+ }
5890
+ );
5842
5891
  const Header = ({ onClick, children }) => {
5843
5892
  return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
5844
5893
  "button",
@@ -6241,7 +6290,9 @@ const BlockListItem = ({
6241
6290
  onClick: () => {
6242
6291
  const state = tinaForm.finalForm.getState();
6243
6292
  if (state.invalid === true) {
6244
- cms.alerts.error("Cannot navigate away from an invalid form.");
6293
+ cms.alerts.error(
6294
+ "Cannot navigate away from an invalid form."
6295
+ );
6245
6296
  return;
6246
6297
  }
6247
6298
  cms.dispatch({
@@ -6723,28 +6774,28 @@ class DaysView extends React__default.Component {
6723
6774
  }
6724
6775
  renderDayHeaders() {
6725
6776
  const locale = this.props.viewDate.localeData();
6726
- let dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
6777
+ const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React__default.createElement("th", { key: day + index, className: "dow" }, day));
6727
6778
  return /* @__PURE__ */ React__default.createElement("tr", null, dayItems);
6728
6779
  }
6729
6780
  renderDays() {
6730
6781
  const date = this.props.viewDate;
6731
6782
  const startOfMonth = date.clone().startOf("month");
6732
6783
  const endOfMonth = date.clone().endOf("month");
6733
- let rows = [[], [], [], [], [], []];
6734
- let startDate = date.clone().subtract(1, "months");
6784
+ const rows = [[], [], [], [], [], []];
6785
+ const startDate = date.clone().subtract(1, "months");
6735
6786
  startDate.date(startDate.daysInMonth()).startOf("week");
6736
- let endDate = startDate.clone().add(42, "d");
6787
+ const endDate = startDate.clone().add(42, "d");
6737
6788
  let i = 0;
6738
6789
  while (startDate.isBefore(endDate)) {
6739
- let row = getRow$2(rows, i++);
6790
+ const row = getRow$2(rows, i++);
6740
6791
  row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
6741
6792
  startDate.add(1, "d");
6742
6793
  }
6743
6794
  return rows.map((r, i2) => /* @__PURE__ */ React__default.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
6744
6795
  }
6745
6796
  renderDay(date, startOfMonth, endOfMonth) {
6746
- let selectedDate = this.props.selectedDate;
6747
- let dayProps = {
6797
+ const selectedDate = this.props.selectedDate;
6798
+ const dayProps = {
6748
6799
  key: date.format("M_D"),
6749
6800
  "data-value": date.date(),
6750
6801
  "data-month": date.month(),
@@ -6798,7 +6849,7 @@ function getRow$2(rows, day) {
6798
6849
  }
6799
6850
  function getDaysOfWeek(locale) {
6800
6851
  const first = locale.firstDayOfWeek();
6801
- let dow = [];
6852
+ const dow = [];
6802
6853
  let i = 0;
6803
6854
  locale._weekdaysMin.forEach(function(day) {
6804
6855
  dow[(7 + i++ - first) % 7] = day;
@@ -6816,7 +6867,7 @@ class MonthsView extends React__default.Component {
6816
6867
  return /* @__PURE__ */ React__default.createElement("div", { className: "rdtMonths" }, /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("thead", null, this.renderNavigation())), /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("tbody", null, this.renderMonths())));
6817
6868
  }
6818
6869
  renderNavigation() {
6819
- let year = this.props.viewDate.year();
6870
+ const year = this.props.viewDate.year();
6820
6871
  return /* @__PURE__ */ React__default.createElement(
6821
6872
  ViewNavigation,
6822
6873
  {
@@ -6829,9 +6880,9 @@ class MonthsView extends React__default.Component {
6829
6880
  );
6830
6881
  }
6831
6882
  renderMonths() {
6832
- let rows = [[], [], []];
6883
+ const rows = [[], [], []];
6833
6884
  for (let month = 0; month < 12; month++) {
6834
- let row = getRow$1(rows, month);
6885
+ const row = getRow$1(rows, month);
6835
6886
  row.push(this.renderMonth(month));
6836
6887
  }
6837
6888
  return rows.map((months, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, months));
@@ -6848,7 +6899,7 @@ class MonthsView extends React__default.Component {
6848
6899
  if (selectedDate && selectedDate.year() === this.props.viewDate.year() && selectedDate.month() === month) {
6849
6900
  className += " rdtActive";
6850
6901
  }
6851
- let props = { key: month, className, "data-value": month, onClick };
6902
+ const props = { key: month, className, "data-value": month, onClick };
6852
6903
  if (this.props.renderMonth) {
6853
6904
  return this.props.renderMonth(
6854
6905
  props,
@@ -6860,11 +6911,11 @@ class MonthsView extends React__default.Component {
6860
6911
  return /* @__PURE__ */ React__default.createElement("td", { ...props }, this.getMonthText(month));
6861
6912
  }
6862
6913
  isDisabledMonth(month) {
6863
- let isValidDate = this.props.isValidDate;
6914
+ const isValidDate = this.props.isValidDate;
6864
6915
  if (!isValidDate) {
6865
6916
  return false;
6866
6917
  }
6867
- let date = this.props.viewDate.clone().set({ month });
6918
+ const date = this.props.viewDate.clone().set({ month });
6868
6919
  let day = date.endOf("month").date() + 1;
6869
6920
  while (day-- > 1) {
6870
6921
  if (isValidDate(date.date(day))) {
@@ -6916,9 +6967,9 @@ class YearsView extends React__default.Component {
6916
6967
  }
6917
6968
  renderYears() {
6918
6969
  const viewYear = this.getViewYear();
6919
- let rows = [[], [], []];
6970
+ const rows = [[], [], []];
6920
6971
  for (let year = viewYear - 1; year < viewYear + 11; year++) {
6921
- let row = getRow(rows, year - viewYear);
6972
+ const row = getRow(rows, year - viewYear);
6922
6973
  row.push(this.renderYear(year));
6923
6974
  }
6924
6975
  return rows.map((years, i) => /* @__PURE__ */ React__default.createElement("tr", { key: i }, years));
@@ -6935,7 +6986,7 @@ class YearsView extends React__default.Component {
6935
6986
  if (selectedYear === year) {
6936
6987
  className += " rdtActive";
6937
6988
  }
6938
- let props = { key: year, className, "data-value": year, onClick };
6989
+ const props = { key: year, className, "data-value": year, onClick };
6939
6990
  return this.props.renderYear(
6940
6991
  props,
6941
6992
  year,
@@ -6949,15 +7000,15 @@ class YearsView extends React__default.Component {
6949
7000
  return this.props.selectedDate && this.props.selectedDate.year();
6950
7001
  }
6951
7002
  isDisabledYear(year) {
6952
- let cache = this.disabledYearsCache;
7003
+ const cache = this.disabledYearsCache;
6953
7004
  if (cache[year] !== void 0) {
6954
7005
  return cache[year];
6955
7006
  }
6956
- let isValidDate = this.props.isValidDate;
7007
+ const isValidDate = this.props.isValidDate;
6957
7008
  if (!isValidDate) {
6958
7009
  return false;
6959
7010
  }
6960
- let date = this.props.viewDate.clone().set({ year });
7011
+ const date = this.props.viewDate.clone().set({ year });
6961
7012
  let day = date.endOf("year").dayOfYear() + 1;
6962
7013
  while (day-- > 1) {
6963
7014
  if (isValidDate(date.dayOfYear(day))) {
@@ -7004,7 +7055,7 @@ const timeConstraints = {
7004
7055
  }
7005
7056
  };
7006
7057
  function createConstraints(overrideTimeConstraints) {
7007
- let constraints = {};
7058
+ const constraints = {};
7008
7059
  Object.keys(timeConstraints).forEach((type) => {
7009
7060
  constraints[type] = {
7010
7061
  ...timeConstraints[type],
@@ -7020,7 +7071,7 @@ class TimeView extends React__default.Component {
7020
7071
  this.state = this.getTimeParts(props.selectedDate || props.viewDate);
7021
7072
  }
7022
7073
  render() {
7023
- let items2 = [];
7074
+ const items2 = [];
7024
7075
  const timeParts = this.state;
7025
7076
  this.getCounters().forEach((c, i) => {
7026
7077
  if (i && c !== "ampm") {
@@ -7082,8 +7133,8 @@ class TimeView extends React__default.Component {
7082
7133
  }
7083
7134
  if (type === "ampm")
7084
7135
  return this.toggleDayPart();
7085
- let update = {};
7086
- let body = document.body;
7136
+ const update = {};
7137
+ const body = document.body;
7087
7138
  update[type] = this[action](type);
7088
7139
  this.setState(update);
7089
7140
  this.timer = setTimeout(() => {
@@ -7126,8 +7177,8 @@ class TimeView extends React__default.Component {
7126
7177
  return pad(type, value);
7127
7178
  }
7128
7179
  getCounters() {
7129
- let counters = [];
7130
- let format2 = this.props.timeFormat;
7180
+ const counters = [];
7181
+ const format2 = this.props.timeFormat;
7131
7182
  if (format2.toLowerCase().indexOf("h") !== -1) {
7132
7183
  counters.push("hours");
7133
7184
  if (format2.indexOf("m") !== -1) {
@@ -7180,244 +7231,65 @@ function pad(type, value) {
7180
7231
  str = "0" + str;
7181
7232
  return str;
7182
7233
  }
7183
- function _inheritsLoose(subClass, superClass) {
7184
- subClass.prototype = Object.create(superClass.prototype);
7185
- subClass.prototype.constructor = subClass;
7186
- _setPrototypeOf(subClass, superClass);
7187
- }
7188
- function _setPrototypeOf(o, p) {
7189
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7190
- o2.__proto__ = p2;
7191
- return o2;
7192
- };
7193
- return _setPrototypeOf(o, p);
7194
- }
7195
- function _objectWithoutPropertiesLoose(source, excluded) {
7196
- if (source == null)
7197
- return {};
7198
- var target = {};
7199
- var sourceKeys = Object.keys(source);
7200
- var key, i;
7201
- for (i = 0; i < sourceKeys.length; i++) {
7202
- key = sourceKeys[i];
7203
- if (excluded.indexOf(key) >= 0)
7204
- continue;
7205
- target[key] = source[key];
7206
- }
7207
- return target;
7208
- }
7209
- function _assertThisInitialized(self) {
7210
- if (self === void 0) {
7211
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7212
- }
7213
- return self;
7214
- }
7215
- function isNodeFound(current, componentNode, ignoreClass) {
7216
- if (current === componentNode) {
7217
- return true;
7218
- }
7219
- if (current.correspondingElement) {
7220
- return current.correspondingElement.classList.contains(ignoreClass);
7221
- }
7222
- return current.classList.contains(ignoreClass);
7223
- }
7224
- function findHighest(current, componentNode, ignoreClass) {
7225
- if (current === componentNode) {
7226
- return true;
7234
+ var useClickAway$1 = {};
7235
+ var util = {};
7236
+ Object.defineProperty(util, "__esModule", { value: true });
7237
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7238
+ var noop = function() {
7239
+ };
7240
+ util.noop = noop;
7241
+ function on(obj) {
7242
+ var args = [];
7243
+ for (var _i = 1; _i < arguments.length; _i++) {
7244
+ args[_i - 1] = arguments[_i];
7227
7245
  }
7228
- while (current.parentNode || current.host) {
7229
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7230
- return true;
7231
- }
7232
- current = current.parentNode || current.host;
7246
+ if (obj && obj.addEventListener) {
7247
+ obj.addEventListener.apply(obj, args);
7233
7248
  }
7234
- return current;
7235
- }
7236
- function clickedScrollbar(evt) {
7237
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7238
7249
  }
7239
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7240
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7241
- return;
7250
+ util.on = on;
7251
+ function off(obj) {
7252
+ var args = [];
7253
+ for (var _i = 1; _i < arguments.length; _i++) {
7254
+ args[_i - 1] = arguments[_i];
7242
7255
  }
7243
- var passive = false;
7244
- var options = Object.defineProperty({}, "passive", {
7245
- get: function get2() {
7246
- passive = true;
7247
- }
7248
- });
7249
- var noop = function noop2() {
7250
- };
7251
- window.addEventListener("testPassiveEventSupport", noop, options);
7252
- window.removeEventListener("testPassiveEventSupport", noop, options);
7253
- return passive;
7254
- };
7255
- function autoInc(seed) {
7256
- if (seed === void 0) {
7257
- seed = 0;
7256
+ if (obj && obj.removeEventListener) {
7257
+ obj.removeEventListener.apply(obj, args);
7258
7258
  }
7259
- return function() {
7260
- return ++seed;
7261
- };
7262
- }
7263
- var uid = autoInc();
7264
- var passiveEventSupport;
7265
- var handlersMap = {};
7266
- var enabledInstances = {};
7267
- var touchEvents = ["touchstart", "touchmove"];
7268
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7269
- function getEventHandlerOptions(instance, eventName) {
7270
- var handlerOptions = {};
7271
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7272
- if (isTouchEvent && passiveEventSupport) {
7273
- handlerOptions.passive = !instance.props.preventDefault;
7274
- }
7275
- return handlerOptions;
7276
7259
  }
7277
- function onClickOutsideHOC(WrappedComponent, config) {
7278
- var _class, _temp;
7279
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7280
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7281
- _inheritsLoose(onClickOutside, _Component);
7282
- function onClickOutside(props) {
7283
- var _this;
7284
- _this = _Component.call(this, props) || this;
7285
- _this.__outsideClickHandler = function(event) {
7286
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7287
- _this.__clickOutsideHandlerProp(event);
7288
- return;
7289
- }
7290
- var instance = _this.getInstance();
7291
- if (typeof instance.props.handleClickOutside === "function") {
7292
- instance.props.handleClickOutside(event);
7293
- return;
7294
- }
7295
- if (typeof instance.handleClickOutside === "function") {
7296
- instance.handleClickOutside(event);
7297
- return;
7298
- }
7299
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7300
- };
7301
- _this.__getComponentNode = function() {
7302
- var instance = _this.getInstance();
7303
- if (config && typeof config.setClickOutsideRef === "function") {
7304
- return config.setClickOutsideRef()(instance);
7305
- }
7306
- if (typeof instance.setClickOutsideRef === "function") {
7307
- return instance.setClickOutsideRef();
7308
- }
7309
- return findDOMNode(instance);
7310
- };
7311
- _this.enableOnClickOutside = function() {
7312
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7313
- return;
7314
- }
7315
- if (typeof passiveEventSupport === "undefined") {
7316
- passiveEventSupport = testPassiveEventSupport();
7317
- }
7318
- enabledInstances[_this._uid] = true;
7319
- var events = _this.props.eventTypes;
7320
- if (!events.forEach) {
7321
- events = [events];
7322
- }
7323
- handlersMap[_this._uid] = function(event) {
7324
- if (_this.componentNode === null)
7325
- return;
7326
- if (_this.initTimeStamp > event.timeStamp)
7327
- return;
7328
- if (_this.props.preventDefault) {
7329
- event.preventDefault();
7330
- }
7331
- if (_this.props.stopPropagation) {
7332
- event.stopPropagation();
7333
- }
7334
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7335
- return;
7336
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7337
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7338
- return;
7339
- }
7340
- _this.__outsideClickHandler(event);
7341
- };
7342
- events.forEach(function(eventName) {
7343
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7344
- });
7345
- };
7346
- _this.disableOnClickOutside = function() {
7347
- delete enabledInstances[_this._uid];
7348
- var fn = handlersMap[_this._uid];
7349
- if (fn && typeof document !== "undefined") {
7350
- var events = _this.props.eventTypes;
7351
- if (!events.forEach) {
7352
- events = [events];
7353
- }
7354
- events.forEach(function(eventName) {
7355
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7356
- });
7357
- delete handlersMap[_this._uid];
7358
- }
7359
- };
7360
- _this.getRef = function(ref) {
7361
- return _this.instanceRef = ref;
7362
- };
7363
- _this._uid = uid();
7364
- _this.initTimeStamp = performance.now();
7365
- return _this;
7366
- }
7367
- var _proto = onClickOutside.prototype;
7368
- _proto.getInstance = function getInstance() {
7369
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7370
- return this;
7371
- }
7372
- var ref = this.instanceRef;
7373
- return ref.getInstance ? ref.getInstance() : ref;
7374
- };
7375
- _proto.componentDidMount = function componentDidMount() {
7376
- if (typeof document === "undefined" || !document.createElement) {
7377
- return;
7378
- }
7379
- var instance = this.getInstance();
7380
- if (config && typeof config.handleClickOutside === "function") {
7381
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7382
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7383
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7384
- }
7385
- }
7386
- this.componentNode = this.__getComponentNode();
7387
- if (this.props.disableOnClickOutside)
7388
- return;
7389
- this.enableOnClickOutside();
7390
- };
7391
- _proto.componentDidUpdate = function componentDidUpdate() {
7392
- this.componentNode = this.__getComponentNode();
7260
+ util.off = off;
7261
+ util.isBrowser = typeof window !== "undefined";
7262
+ util.isNavigator = typeof navigator !== "undefined";
7263
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7264
+ var react_1 = React__default;
7265
+ var util_1 = util;
7266
+ var defaultEvents = ["mousedown", "touchstart"];
7267
+ var useClickAway = function(ref, onClickAway, events) {
7268
+ if (events === void 0) {
7269
+ events = defaultEvents;
7270
+ }
7271
+ var savedCallback = react_1.useRef(onClickAway);
7272
+ react_1.useEffect(function() {
7273
+ savedCallback.current = onClickAway;
7274
+ }, [onClickAway]);
7275
+ react_1.useEffect(function() {
7276
+ var handler = function(event) {
7277
+ var el = ref.current;
7278
+ el && !el.contains(event.target) && savedCallback.current(event);
7393
7279
  };
7394
- _proto.componentWillUnmount = function componentWillUnmount() {
7395
- this.disableOnClickOutside();
7396
- };
7397
- _proto.render = function render() {
7398
- var _this$props = this.props;
7399
- _this$props.excludeScrollbar;
7400
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7401
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7402
- props.ref = this.getRef;
7403
- } else {
7404
- props.wrappedRef = this.getRef;
7280
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7281
+ var eventName = events_1[_i];
7282
+ util_1.on(document, eventName, handler);
7283
+ }
7284
+ return function() {
7285
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7286
+ var eventName2 = events_2[_i2];
7287
+ util_1.off(document, eventName2, handler);
7405
7288
  }
7406
- props.disableOnClickOutside = this.disableOnClickOutside;
7407
- props.enableOnClickOutside = this.enableOnClickOutside;
7408
- return createElement(WrappedComponent, props);
7409
7289
  };
7410
- return onClickOutside;
7411
- }(Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7412
- eventTypes: ["mousedown", "touchstart"],
7413
- excludeScrollbar: config && config.excludeScrollbar || false,
7414
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7415
- preventDefault: false,
7416
- stopPropagation: false
7417
- }, _class.getClass = function() {
7418
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7419
- }, _temp;
7420
- }
7290
+ }, [events, ref]);
7291
+ };
7292
+ var _default = useClickAway$1.default = useClickAway;
7421
7293
  const viewModes = {
7422
7294
  YEARS: "years",
7423
7295
  MONTHS: "months",
@@ -7438,7 +7310,7 @@ class Datetime extends React__default.Component {
7438
7310
  __publicField(this, "_renderCalendar", () => {
7439
7311
  const props = this.props;
7440
7312
  const state = this.state;
7441
- let viewProps = {
7313
+ const viewProps = {
7442
7314
  viewDate: state.viewDate.clone(),
7443
7315
  selectedDate: this.getSelectedDate(),
7444
7316
  isValidDate: props.isValidDate,
@@ -7481,10 +7353,10 @@ class Datetime extends React__default.Component {
7481
7353
  __publicField(this, "viewToMethod", { days: "date", months: "month", years: "year" });
7482
7354
  __publicField(this, "nextView", { days: "time", months: "days", years: "months" });
7483
7355
  __publicField(this, "_updateDate", (e) => {
7484
- let state = this.state;
7485
- let currentView = state.currentView;
7486
- let updateOnView = this.getUpdateOn(this.getFormat("date"));
7487
- let viewDate = this.state.viewDate.clone();
7356
+ const state = this.state;
7357
+ const currentView = state.currentView;
7358
+ const updateOnView = this.getUpdateOn(this.getFormat("date"));
7359
+ const viewDate = this.state.viewDate.clone();
7488
7360
  viewDate[this.viewToMethod[currentView]](
7489
7361
  parseInt(e.target.getAttribute("data-value"), 10)
7490
7362
  );
@@ -7492,7 +7364,7 @@ class Datetime extends React__default.Component {
7492
7364
  viewDate.month(parseInt(e.target.getAttribute("data-month"), 10));
7493
7365
  viewDate.year(parseInt(e.target.getAttribute("data-year"), 10));
7494
7366
  }
7495
- let update = { viewDate };
7367
+ const update = { viewDate };
7496
7368
  if (currentView === updateOnView) {
7497
7369
  update.selectedDate = viewDate.clone();
7498
7370
  update.inputValue = viewDate.format(this.getFormat("datetime"));
@@ -7506,7 +7378,7 @@ class Datetime extends React__default.Component {
7506
7378
  this.setState(update);
7507
7379
  });
7508
7380
  __publicField(this, "_viewNavigate", (modifier, unit) => {
7509
- let viewDate = this.state.viewDate.clone();
7381
+ const viewDate = this.state.viewDate.clone();
7510
7382
  viewDate.add(modifier, unit);
7511
7383
  if (modifier > 0) {
7512
7384
  this.props.onNavigateForward(modifier, unit);
@@ -7516,7 +7388,7 @@ class Datetime extends React__default.Component {
7516
7388
  this.setState({ viewDate });
7517
7389
  });
7518
7390
  __publicField(this, "_setTime", (type, value) => {
7519
- let date = (this.getSelectedDate() || this.state.viewDate).clone();
7391
+ const date = (this.getSelectedDate() || this.state.viewDate).clone();
7520
7392
  date[type](value);
7521
7393
  if (!this.props.value) {
7522
7394
  this.setState({
@@ -7540,7 +7412,7 @@ class Datetime extends React__default.Component {
7540
7412
  });
7541
7413
  });
7542
7414
  __publicField(this, "_handleClickOutside", () => {
7543
- let props = this.props;
7415
+ const props = this.props;
7544
7416
  if (props.input && this.state.open && props.open === void 0 && props.closeOnClickOutside) {
7545
7417
  this._closeCalendar();
7546
7418
  }
@@ -7555,7 +7427,7 @@ class Datetime extends React__default.Component {
7555
7427
  return;
7556
7428
  const value = e.target ? e.target.value : e;
7557
7429
  const localMoment = this.localMoment(value, this.getFormat("datetime"));
7558
- let update = { inputValue: value };
7430
+ const update = { inputValue: value };
7559
7431
  if (localMoment.isValid()) {
7560
7432
  update.selectedDate = localMoment;
7561
7433
  update.viewDate = localMoment.clone().startOf("month");
@@ -7619,9 +7491,9 @@ class Datetime extends React__default.Component {
7619
7491
  return this.props.renderView(this.state.currentView, this._renderCalendar);
7620
7492
  }
7621
7493
  getInitialState() {
7622
- let props = this.props;
7623
- let inputFormat = this.getFormat("datetime");
7624
- let selectedDate = this.parseDate(
7494
+ const props = this.props;
7495
+ const inputFormat = this.getFormat("datetime");
7496
+ const selectedDate = this.parseDate(
7625
7497
  props.value || props.initialValue,
7626
7498
  inputFormat
7627
7499
  );
@@ -7652,7 +7524,7 @@ class Datetime extends React__default.Component {
7652
7524
  return this.getInitialDate();
7653
7525
  }
7654
7526
  getInitialDate() {
7655
- let m = this.localMoment();
7527
+ const m = this.localMoment();
7656
7528
  m.hour(0).minute(0).second(0).millisecond(0);
7657
7529
  return m;
7658
7530
  }
@@ -7672,8 +7544,8 @@ class Datetime extends React__default.Component {
7672
7544
  }
7673
7545
  getClassName() {
7674
7546
  let cn2 = "rdt";
7675
- let props = this.props;
7676
- let propCn = props.className;
7547
+ const props = this.props;
7548
+ const propCn = props.className;
7677
7549
  if (Array.isArray(propCn)) {
7678
7550
  cn2 += " " + propCn.join(" ");
7679
7551
  } else if (propCn) {
@@ -7706,14 +7578,14 @@ class Datetime extends React__default.Component {
7706
7578
  return viewModes.DAYS;
7707
7579
  }
7708
7580
  getLocaleData() {
7709
- let p = this.props;
7581
+ const p = this.props;
7710
7582
  return this.localMoment(
7711
7583
  p.value || p.defaultValue || /* @__PURE__ */ new Date()
7712
7584
  ).localeData();
7713
7585
  }
7714
7586
  getDateFormat() {
7715
7587
  const locale = this.getLocaleData();
7716
- let format2 = this.props.dateFormat;
7588
+ const format2 = this.props.dateFormat;
7717
7589
  if (format2 === true)
7718
7590
  return locale.longDateFormat("L");
7719
7591
  if (format2)
@@ -7722,7 +7594,7 @@ class Datetime extends React__default.Component {
7722
7594
  }
7723
7595
  getTimeFormat() {
7724
7596
  const locale = this.getLocaleData();
7725
- let format2 = this.props.timeFormat;
7597
+ const format2 = this.props.timeFormat;
7726
7598
  if (format2 === true) {
7727
7599
  return locale.longDateFormat("LT");
7728
7600
  }
@@ -7734,12 +7606,12 @@ class Datetime extends React__default.Component {
7734
7606
  } else if (type === "time") {
7735
7607
  return this.getTimeFormat();
7736
7608
  }
7737
- let dateFormat = this.getDateFormat();
7738
- let timeFormat = this.getTimeFormat();
7609
+ const dateFormat = this.getDateFormat();
7610
+ const timeFormat = this.getTimeFormat();
7739
7611
  return dateFormat && timeFormat ? dateFormat + " " + timeFormat : dateFormat || timeFormat;
7740
7612
  }
7741
7613
  updateTime(op, amount, type, toSelected) {
7742
- let update = {};
7614
+ const update = {};
7743
7615
  const date = toSelected ? "selectedDate" : "viewDate";
7744
7616
  update[date] = this.state[date].clone()[op](amount, type);
7745
7617
  this.setState(update);
@@ -7772,7 +7644,7 @@ class Datetime extends React__default.Component {
7772
7644
  if (prevProps === this.props)
7773
7645
  return;
7774
7646
  let needsUpdate = false;
7775
- let thisProps = this.props;
7647
+ const thisProps = this.props;
7776
7648
  ["locale", "utc", "displayZone", "dateFormat", "timeFormat"].forEach(
7777
7649
  function(p) {
7778
7650
  prevProps[p] !== thisProps[p] && (needsUpdate = true);
@@ -7788,8 +7660,8 @@ class Datetime extends React__default.Component {
7788
7660
  }
7789
7661
  regenerateDates() {
7790
7662
  const props = this.props;
7791
- let viewDate = this.state.viewDate.clone();
7792
- let selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7663
+ const viewDate = this.state.viewDate.clone();
7664
+ const selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
7793
7665
  if (props.locale) {
7794
7666
  viewDate.locale(props.locale);
7795
7667
  selectedDate && selectedDate.locale(props.locale);
@@ -7804,7 +7676,7 @@ class Datetime extends React__default.Component {
7804
7676
  viewDate.locale();
7805
7677
  selectedDate && selectedDate.locale();
7806
7678
  }
7807
- let update = { viewDate, selectedDate };
7679
+ const update = { viewDate, selectedDate };
7808
7680
  if (selectedDate && selectedDate.isValid()) {
7809
7681
  update.inputValue = selectedDate.format(this.getFormat("datetime"));
7810
7682
  }
@@ -7813,7 +7685,7 @@ class Datetime extends React__default.Component {
7813
7685
  getSelectedDate() {
7814
7686
  if (this.props.value === void 0)
7815
7687
  return this.state.selectedDate;
7816
- let selectedDate = this.parseDate(
7688
+ const selectedDate = this.parseDate(
7817
7689
  this.props.value,
7818
7690
  this.getFormat("datetime")
7819
7691
  );
@@ -7832,7 +7704,7 @@ class Datetime extends React__default.Component {
7832
7704
  return "";
7833
7705
  }
7834
7706
  getInputValue() {
7835
- let selectedDate = this.getSelectedDate();
7707
+ const selectedDate = this.getSelectedDate();
7836
7708
  return selectedDate ? selectedDate.format(this.getFormat("datetime")) : this.state.inputValue;
7837
7709
  }
7838
7710
  /**
@@ -7842,7 +7714,7 @@ class Datetime extends React__default.Component {
7842
7714
  * @public
7843
7715
  */
7844
7716
  setViewDate(date) {
7845
- let logError = function() {
7717
+ const logError = function() {
7846
7718
  return log("Invalid date passed to the `setViewDate` method: " + date);
7847
7719
  };
7848
7720
  if (!date)
@@ -7938,7 +7810,7 @@ __publicField(Datetime, "defaultProps", {
7938
7810
  // Make moment accessible through the Datetime class
7939
7811
  __publicField(Datetime, "moment", moment);
7940
7812
  function log(message, method) {
7941
- let con = typeof window !== "undefined" && window.console;
7813
+ const con = typeof window !== "undefined" && window.console;
7942
7814
  if (!con)
7943
7815
  return;
7944
7816
  if (!method) {
@@ -7946,22 +7818,13 @@ function log(message, method) {
7946
7818
  }
7947
7819
  con[method]("***react-datetime:" + message);
7948
7820
  }
7949
- class ClickOutBase extends React__default.Component {
7950
- constructor() {
7951
- super(...arguments);
7952
- __publicField(this, "container", React__default.createRef());
7953
- }
7954
- render() {
7955
- return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7956
- }
7957
- handleClickOutside(e) {
7958
- this.props.onClickOut(e);
7959
- }
7960
- setClickOutsideRef() {
7961
- return this.container.current;
7962
- }
7821
+ function ClickableWrapper({ className, onClickOut, children }) {
7822
+ const containerRef = useRef(null);
7823
+ _default(containerRef, (event) => {
7824
+ onClickOut(event);
7825
+ });
7826
+ return /* @__PURE__ */ React__default.createElement("div", { className, ref: containerRef }, children);
7963
7827
  }
7964
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7965
7828
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7966
7829
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7967
7830
  const format$1 = (val, _name, field) => {
@@ -8004,7 +7867,10 @@ const DateField = wrapFieldsWithMeta(
8004
7867
  ReactDateTimeWithStyles,
8005
7868
  {
8006
7869
  value: input.value,
8007
- onChange: input.onChange,
7870
+ onChange: (value) => {
7871
+ const newValue = value === "" ? void 0 : value;
7872
+ input.onChange(newValue);
7873
+ },
8008
7874
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
8009
7875
  timeFormat: timeFormat || false,
8010
7876
  inputProps: { className: textFieldClasses },
@@ -8767,7 +8633,10 @@ const BranchSelector = ({
8767
8633
  label: "View in GitHub",
8768
8634
  Icon: /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
8769
8635
  onMouseDown: () => {
8770
- window.open(branch.githubPullRequestUrl, "_blank");
8636
+ window.open(
8637
+ branch.githubPullRequestUrl,
8638
+ "_blank"
8639
+ );
8771
8640
  }
8772
8641
  },
8773
8642
  typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
@@ -9073,7 +8942,9 @@ class EventBus {
9073
8942
  } else {
9074
8943
  events = event;
9075
8944
  }
9076
- const newListeners = events.map((event2) => new Listener(event2, callback));
8945
+ const newListeners = events.map(
8946
+ (event2) => new Listener(event2, callback)
8947
+ );
9077
8948
  newListeners.forEach((newListener) => this.listeners.add(newListener));
9078
8949
  return () => {
9079
8950
  newListeners.forEach((listener) => this.listeners.delete(listener));
@@ -9429,9 +9300,7 @@ class TinaMediaStore {
9429
9300
  const deleteStartTime = Date.now();
9430
9301
  while (true) {
9431
9302
  await new Promise((resolve) => setTimeout(resolve, 1e3));
9432
- const { error, message } = await this.api.getRequestStatus(
9433
- requestId
9434
- );
9303
+ const { error, message } = await this.api.getRequestStatus(requestId);
9435
9304
  if (error !== void 0) {
9436
9305
  if (error) {
9437
9306
  throw new Error(message);
@@ -9456,6 +9325,17 @@ class TinaMediaStore {
9456
9325
  }
9457
9326
  }
9458
9327
  }
9328
+ const encodeUrlIfNeeded = (url) => {
9329
+ if (url) {
9330
+ try {
9331
+ return new URL(url).toString();
9332
+ } catch (e) {
9333
+ return url;
9334
+ }
9335
+ } else {
9336
+ return url;
9337
+ }
9338
+ };
9459
9339
  let MediaManager$1 = class MediaManager {
9460
9340
  constructor(store, events) {
9461
9341
  this.store = store;
@@ -9528,6 +9408,20 @@ let MediaManager$1 = class MediaManager {
9528
9408
  try {
9529
9409
  this.events.dispatch({ type: "media:list:start", ...options });
9530
9410
  const media = await this.store.list(options);
9411
+ media.items = media.items.map((item) => {
9412
+ if (item.type === "dir") {
9413
+ return item;
9414
+ }
9415
+ if (item.thumbnails) {
9416
+ for (const [size, src] of Object.entries(item.thumbnails)) {
9417
+ item.thumbnails[size] = encodeUrlIfNeeded(src);
9418
+ }
9419
+ }
9420
+ return {
9421
+ ...item,
9422
+ src: encodeUrlIfNeeded(item.src)
9423
+ };
9424
+ });
9531
9425
  this.events.dispatch({ type: "media:list:success", ...options, media });
9532
9426
  return media;
9533
9427
  } catch (error) {
@@ -9741,7 +9635,7 @@ let Alerts$1 = class Alerts {
9741
9635
  return this.add("error", message, timeout);
9742
9636
  }
9743
9637
  };
9744
- const NoFormsPlaceholder = () => /* @__PURE__ */ React.createElement(
9638
+ const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React.createElement(
9745
9639
  "div",
9746
9640
  {
9747
9641
  className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
@@ -9754,25 +9648,8 @@ const NoFormsPlaceholder = () => /* @__PURE__ */ React.createElement(
9754
9648
  animationDuration: "150ms"
9755
9649
  }
9756
9650
  },
9757
- /* @__PURE__ */ React.createElement(Emoji$1, { className: "pb-5" }, "🔎"),
9758
- /* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React.createElement("br", null), "this page."),
9759
- /* @__PURE__ */ React.createElement("p", { className: "block" }, /* @__PURE__ */ React.createElement(
9760
- Button$1,
9761
- {
9762
- href: "https://tina.io/docs/tinacms-context/",
9763
- target: "_blank",
9764
- as: "a"
9765
- },
9766
- /* @__PURE__ */ React.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
9767
- " Contextual Editing"
9768
- ))
9769
- );
9770
- const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
9771
- "span",
9772
- {
9773
- className: `text-[24px] leading-none inline-block ${className}`,
9774
- ...props
9775
- }
9651
+ /* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, "Please wait while TinaCMS", /* @__PURE__ */ React.createElement("br", null), "loads your content"),
9652
+ /* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
9776
9653
  );
9777
9654
  class SidebarState {
9778
9655
  constructor(events, options = {}) {
@@ -9787,7 +9664,7 @@ class SidebarState {
9787
9664
  };
9788
9665
  this.position = options.position || "displace";
9789
9666
  this.renderNav = options.renderNav || true;
9790
- this.placeholder = options.placeholder || NoFormsPlaceholder;
9667
+ this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
9791
9668
  if ((_a = options.buttons) == null ? void 0 : _a.save) {
9792
9669
  this.buttons.save = options.buttons.save;
9793
9670
  }
@@ -9815,7 +9692,7 @@ class SidebarState {
9815
9692
  }
9816
9693
  }
9817
9694
  function createScreen({
9818
- Component: Component2,
9695
+ Component,
9819
9696
  props,
9820
9697
  ...options
9821
9698
  }) {
@@ -9824,7 +9701,7 @@ function createScreen({
9824
9701
  layout: "popup",
9825
9702
  ...options,
9826
9703
  Component(screenProps) {
9827
- return /* @__PURE__ */ React__default.createElement(Component2, { ...screenProps, ...props });
9704
+ return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
9828
9705
  }
9829
9706
  };
9830
9707
  }
@@ -9861,238 +9738,6 @@ const ModalLayout = ({ children, name, close: close2, layout }) => {
9861
9738
  children
9862
9739
  )));
9863
9740
  };
9864
- const Item = ({
9865
- item,
9866
- depth,
9867
- setActiveFormId
9868
- }) => {
9869
- const cms = useCMS();
9870
- const depths = ["pl-6", "pl-10", "pl-14"];
9871
- const form = React.useMemo(
9872
- () => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
9873
- [item.formId]
9874
- );
9875
- return /* @__PURE__ */ React.createElement(
9876
- "button",
9877
- {
9878
- type: "button",
9879
- key: item.path,
9880
- onClick: () => setActiveFormId(item.formId),
9881
- 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`
9882
- },
9883
- /* @__PURE__ */ React.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
9884
- /* @__PURE__ */ React.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
9885
- );
9886
- };
9887
- const FormListItem = ({
9888
- item,
9889
- depth,
9890
- setActiveFormId
9891
- }) => {
9892
- var _a;
9893
- return /* @__PURE__ */ React.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
9894
- if (subItem.type === "document") {
9895
- return /* @__PURE__ */ React.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React.createElement(
9896
- Item,
9897
- {
9898
- setActiveFormId,
9899
- depth: depth + 1,
9900
- item: subItem
9901
- }
9902
- ));
9903
- }
9904
- })));
9905
- };
9906
- const FormLists = (props) => {
9907
- const cms = useCMS();
9908
- return /* @__PURE__ */ React.createElement(
9909
- Transition,
9910
- {
9911
- appear: true,
9912
- show: true,
9913
- as: "div",
9914
- enter: "transition-all ease-out duration-150",
9915
- enterFrom: "opacity-0 -translate-x-1/2",
9916
- enterTo: "opacity-100",
9917
- leave: "transition-all ease-out duration-150",
9918
- leaveFrom: "opacity-100",
9919
- leaveTo: "opacity-0 -translate-x-1/2"
9920
- },
9921
- cms.state.formLists.map((formList, index) => /* @__PURE__ */ React.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React.createElement(
9922
- FormList,
9923
- {
9924
- isEditing: props.isEditing,
9925
- setActiveFormId: (id) => {
9926
- cms.dispatch({ type: "forms:set-active-form-id", value: id });
9927
- },
9928
- formList
9929
- }
9930
- )))
9931
- );
9932
- };
9933
- const FormList = (props) => {
9934
- const cms = useCMS();
9935
- const listItems = React.useMemo(() => {
9936
- var _a;
9937
- const orderedListItems = [];
9938
- const globalItems = [];
9939
- const topItems = [];
9940
- props.formList.items.forEach((item) => {
9941
- if (item.type === "document") {
9942
- const form = cms.state.forms.find(
9943
- ({ tinaForm }) => tinaForm.id === item.formId
9944
- );
9945
- if (form.tinaForm.global) {
9946
- globalItems.push(item);
9947
- } else {
9948
- orderedListItems.push(item);
9949
- }
9950
- } else {
9951
- orderedListItems.push(item);
9952
- }
9953
- });
9954
- if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
9955
- topItems.push({ type: "list", label: "Documents" });
9956
- }
9957
- let extra = [];
9958
- if (globalItems.length) {
9959
- extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
9960
- }
9961
- return [...topItems, ...orderedListItems, ...extra];
9962
- }, [JSON.stringify(props.formList.items)]);
9963
- return /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
9964
- if (item.type === "list") {
9965
- return /* @__PURE__ */ React.createElement(
9966
- "div",
9967
- {
9968
- key: item.label,
9969
- className: `relative group text-left w-full bg-white shadow-sm
9970
- 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"}`
9971
- },
9972
- /* @__PURE__ */ React.createElement(
9973
- "span",
9974
- {
9975
- className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
9976
- },
9977
- item.label
9978
- )
9979
- );
9980
- }
9981
- return /* @__PURE__ */ React.createElement(
9982
- FormListItem,
9983
- {
9984
- setActiveFormId: (id) => props.setActiveFormId(id),
9985
- key: item.formId,
9986
- item,
9987
- depth: 0
9988
- }
9989
- );
9990
- })));
9991
- };
9992
- const FormsView = ({
9993
- children
9994
- }) => {
9995
- const cms = useCMS$1();
9996
- const { setFormIsPristine } = React.useContext(SidebarContext);
9997
- const isMultiform = cms.state.forms.length > 1;
9998
- const activeForm = cms.state.forms.find(
9999
- ({ tinaForm }) => tinaForm.id === cms.state.activeFormId
10000
- );
10001
- const isEditing = !!activeForm;
10002
- if (!cms.state.formLists.length) {
10003
- return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", children, " ");
10004
- }
10005
- if (isMultiform && !activeForm) {
10006
- return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
10007
- }
10008
- const formMetas = cms.plugins.all("form:meta");
10009
- return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React.createElement(React.Fragment, { key: meta.name }, /* @__PURE__ */ React.createElement(meta.Component, null))), /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
10010
- };
10011
- const FormWrapper$1 = ({ isEditing, children }) => {
10012
- return /* @__PURE__ */ React.createElement(
10013
- "div",
10014
- {
10015
- className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
10016
- style: isEditing ? {
10017
- transform: "none",
10018
- animationName: "fly-in-left",
10019
- animationDuration: "150ms",
10020
- animationDelay: "0",
10021
- animationIterationCount: 1,
10022
- animationTimingFunction: "ease-out"
10023
- } : {
10024
- transform: "translate3d(100%, 0, 0)"
10025
- }
10026
- },
10027
- children
10028
- );
10029
- };
10030
- const MultiformFormHeader = ({
10031
- activeForm
10032
- }) => {
10033
- const cms = useCMS$1();
10034
- const { formIsPristine } = React.useContext(SidebarContext);
10035
- return /* @__PURE__ */ React.createElement(
10036
- "div",
10037
- {
10038
- className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10039
- },
10040
- /* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
10041
- "button",
10042
- {
10043
- type: "button",
10044
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10045
- onClick: () => {
10046
- const state = activeForm.tinaForm.finalForm.getState();
10047
- if (state.invalid === true) {
10048
- cms.alerts.error("Cannot navigate away from an invalid form.");
10049
- } else {
10050
- cms.dispatch({ type: "forms:set-active-form-id", value: null });
10051
- }
10052
- }
10053
- },
10054
- /* @__PURE__ */ React.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
10055
- ), /* @__PURE__ */ React.createElement(
10056
- "button",
10057
- {
10058
- type: "button",
10059
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10060
- onClick: () => {
10061
- const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10062
- cms.state.activeFormId
10063
- ).name;
10064
- window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10065
- }
10066
- },
10067
- /* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10068
- ), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
10069
- );
10070
- };
10071
- const FormHeader = ({ activeForm }) => {
10072
- const { formIsPristine } = React.useContext(SidebarContext);
10073
- const cms = useCMS$1();
10074
- const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
10075
- return /* @__PURE__ */ React.createElement(
10076
- "div",
10077
- {
10078
- className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10079
- },
10080
- /* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
10081
- "button",
10082
- {
10083
- type: "button",
10084
- className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10085
- onClick: () => {
10086
- const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10087
- cms.state.activeFormId
10088
- ).name;
10089
- window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10090
- }
10091
- },
10092
- /* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10093
- ), shortFormLabel && /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
10094
- );
10095
- };
10096
9741
  function ImFilesEmpty(props) {
10097
9742
  return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14.341 5.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.689 0.561 1.25 1.25 1.25h9.5c0.689 0 1.25-0.561 1.25-1.25v-7.75c0-0.224-0.068-0.615-0.659-1.421zM12.271 4.729c0.48 0.48 0.856 0.912 1.134 1.271h-2.406v-2.405c0.359 0.278 0.792 0.654 1.271 1.134v0zM14 14.75c0 0.136-0.114 0.25-0.25 0.25h-9.5c-0.136 0-0.25-0.114-0.25-0.25v-11.5c0-0.135 0.114-0.25 0.25-0.25 0 0 5.749-0 5.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5v7.75z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9.421 0.659c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.604 0.43 1.109 1 1.225v-12.725c0-0.135 0.115-0.25 0.25-0.25h7.607c-0.151-0.124-0.297-0.238-0.437-0.341z" }, "child": [] }] })(props);
10098
9743
  }
@@ -10335,7 +9980,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
10335
9980
  "Event Log"
10336
9981
  ));
10337
9982
  };
10338
- const version = "2.3.0";
9983
+ const version = "2.7.4";
10339
9984
  const Nav = ({
10340
9985
  isLocalMode,
10341
9986
  className = "",
@@ -10577,6 +10222,293 @@ const ResizeHandle = () => {
10577
10222
  /* @__PURE__ */ React.createElement("span", { className: "absolute top-1/2 left-1/2 h-4/6 w-px bg-gray-200 transform -translate-y-1/2 -translate-x-1/2 opacity-30 transition-opacity duration-150 ease-out group-hover:opacity-100" })
10578
10223
  );
10579
10224
  };
10225
+ const Item = ({
10226
+ item,
10227
+ depth,
10228
+ setActiveFormId
10229
+ }) => {
10230
+ const cms = useCMS();
10231
+ const depths = ["pl-6", "pl-10", "pl-14"];
10232
+ const form = React.useMemo(
10233
+ () => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
10234
+ [item.formId]
10235
+ );
10236
+ return /* @__PURE__ */ React.createElement(
10237
+ "button",
10238
+ {
10239
+ type: "button",
10240
+ key: item.path,
10241
+ onClick: () => setActiveFormId(item.formId),
10242
+ className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
10243
+ },
10244
+ /* @__PURE__ */ React.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
10245
+ /* @__PURE__ */ React.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
10246
+ );
10247
+ };
10248
+ const FormListItem = ({
10249
+ item,
10250
+ depth,
10251
+ setActiveFormId
10252
+ }) => {
10253
+ var _a;
10254
+ return /* @__PURE__ */ React.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
10255
+ if (subItem.type === "document") {
10256
+ return /* @__PURE__ */ React.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React.createElement(
10257
+ Item,
10258
+ {
10259
+ setActiveFormId,
10260
+ depth: depth + 1,
10261
+ item: subItem
10262
+ }
10263
+ ));
10264
+ }
10265
+ })));
10266
+ };
10267
+ const FormLists = (props) => {
10268
+ const cms = useCMS();
10269
+ return /* @__PURE__ */ React.createElement(
10270
+ Transition,
10271
+ {
10272
+ appear: true,
10273
+ show: true,
10274
+ as: "div",
10275
+ enter: "transition-all ease-out duration-150",
10276
+ enterFrom: "opacity-0 -translate-x-1/2",
10277
+ enterTo: "opacity-100",
10278
+ leave: "transition-all ease-out duration-150",
10279
+ leaveFrom: "opacity-100",
10280
+ leaveTo: "opacity-0 -translate-x-1/2"
10281
+ },
10282
+ cms.state.formLists.map((formList, index) => /* @__PURE__ */ React.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React.createElement(
10283
+ FormList,
10284
+ {
10285
+ isEditing: props.isEditing,
10286
+ setActiveFormId: (id) => {
10287
+ cms.dispatch({ type: "forms:set-active-form-id", value: id });
10288
+ },
10289
+ formList
10290
+ }
10291
+ )))
10292
+ );
10293
+ };
10294
+ const FormList = (props) => {
10295
+ const cms = useCMS();
10296
+ const listItems = React.useMemo(() => {
10297
+ var _a;
10298
+ const orderedListItems = [];
10299
+ const globalItems = [];
10300
+ const topItems = [];
10301
+ props.formList.items.forEach((item) => {
10302
+ if (item.type === "document") {
10303
+ const form = cms.state.forms.find(
10304
+ ({ tinaForm }) => tinaForm.id === item.formId
10305
+ );
10306
+ if (form.tinaForm.global) {
10307
+ globalItems.push(item);
10308
+ } else {
10309
+ orderedListItems.push(item);
10310
+ }
10311
+ } else {
10312
+ orderedListItems.push(item);
10313
+ }
10314
+ });
10315
+ if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
10316
+ topItems.push({ type: "list", label: "Documents" });
10317
+ }
10318
+ let extra = [];
10319
+ if (globalItems.length) {
10320
+ extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
10321
+ }
10322
+ return [...topItems, ...orderedListItems, ...extra];
10323
+ }, [JSON.stringify(props.formList.items)]);
10324
+ return /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
10325
+ if (item.type === "list") {
10326
+ return /* @__PURE__ */ React.createElement(
10327
+ "div",
10328
+ {
10329
+ key: item.label,
10330
+ className: `relative group text-left w-full bg-white shadow-sm
10331
+ border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
10332
+ },
10333
+ /* @__PURE__ */ React.createElement(
10334
+ "span",
10335
+ {
10336
+ className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
10337
+ },
10338
+ item.label
10339
+ )
10340
+ );
10341
+ }
10342
+ return /* @__PURE__ */ React.createElement(
10343
+ FormListItem,
10344
+ {
10345
+ setActiveFormId: (id) => props.setActiveFormId(id),
10346
+ key: item.formId,
10347
+ item,
10348
+ depth: 0
10349
+ }
10350
+ );
10351
+ })));
10352
+ };
10353
+ const SidebarNoFormsPlaceholder = () => /* @__PURE__ */ React.createElement(
10354
+ "div",
10355
+ {
10356
+ className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
10357
+ style: {
10358
+ animationName: "fade-in",
10359
+ animationDelay: "300ms",
10360
+ animationTimingFunction: "ease-out",
10361
+ animationIterationCount: 1,
10362
+ animationFillMode: "both",
10363
+ animationDuration: "150ms"
10364
+ }
10365
+ },
10366
+ /* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React.createElement("br", null), "this page."),
10367
+ /* @__PURE__ */ React.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React.createElement(
10368
+ Button$1,
10369
+ {
10370
+ href: "https://tina.io/docs/contextual-editing/overview",
10371
+ target: "_blank",
10372
+ as: "a"
10373
+ },
10374
+ /* @__PURE__ */ React.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
10375
+ " Contextual Editing Docs"
10376
+ ))
10377
+ );
10378
+ const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
10379
+ "span",
10380
+ {
10381
+ className: `text-[24px] leading-none inline-block ${className}`,
10382
+ ...props
10383
+ }
10384
+ );
10385
+ const minimumTimeToShowLoadingIndicator = 1e3;
10386
+ const FormsView = ({ loadingPlaceholder } = {}) => {
10387
+ const cms = useCMS$1();
10388
+ const { setFormIsPristine } = React.useContext(SidebarContext);
10389
+ const [isShowingLoading, setIsShowingLoading] = React.useState(true);
10390
+ const [initialLoadComplete, setInitialLoadComplete] = React.useState(false);
10391
+ React.useEffect(() => {
10392
+ if (cms.state.isLoadingContent) {
10393
+ setIsShowingLoading(true);
10394
+ const timer = setTimeout(() => {
10395
+ if (!cms.state.isLoadingContent) {
10396
+ setIsShowingLoading(false);
10397
+ setInitialLoadComplete(true);
10398
+ }
10399
+ }, minimumTimeToShowLoadingIndicator);
10400
+ return () => clearTimeout(timer);
10401
+ } else {
10402
+ const timer = setTimeout(() => {
10403
+ setIsShowingLoading(false);
10404
+ setInitialLoadComplete(true);
10405
+ }, minimumTimeToShowLoadingIndicator);
10406
+ return () => clearTimeout(timer);
10407
+ }
10408
+ }, [cms.state.isLoadingContent]);
10409
+ if (isShowingLoading || !initialLoadComplete) {
10410
+ const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
10411
+ return /* @__PURE__ */ React.createElement(LoadingPlaceholder, null);
10412
+ }
10413
+ if (!cms.state.formLists.length) {
10414
+ return /* @__PURE__ */ React.createElement(SidebarNoFormsPlaceholder, null);
10415
+ }
10416
+ const isMultiform = cms.state.forms.length > 1;
10417
+ const activeForm = cms.state.forms.find(
10418
+ ({ tinaForm }) => tinaForm.id === cms.state.activeFormId
10419
+ );
10420
+ const isEditing = !!activeForm;
10421
+ if (isMultiform && !activeForm) {
10422
+ return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
10423
+ }
10424
+ const formMetas = cms.plugins.all("form:meta");
10425
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React.createElement(React.Fragment, { key: meta.name }, /* @__PURE__ */ React.createElement(meta.Component, null))), /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
10426
+ };
10427
+ const FormWrapper$1 = ({ isEditing, children }) => {
10428
+ return /* @__PURE__ */ React.createElement(
10429
+ "div",
10430
+ {
10431
+ className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
10432
+ style: isEditing ? {
10433
+ transform: "none",
10434
+ animationName: "fly-in-left",
10435
+ animationDuration: "150ms",
10436
+ animationDelay: "0",
10437
+ animationIterationCount: 1,
10438
+ animationTimingFunction: "ease-out"
10439
+ } : {
10440
+ transform: "translate3d(100%, 0, 0)"
10441
+ }
10442
+ },
10443
+ children
10444
+ );
10445
+ };
10446
+ const MultiformFormHeader = ({
10447
+ activeForm
10448
+ }) => {
10449
+ const cms = useCMS$1();
10450
+ const { formIsPristine } = React.useContext(SidebarContext);
10451
+ return /* @__PURE__ */ React.createElement(
10452
+ "div",
10453
+ {
10454
+ className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10455
+ },
10456
+ /* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
10457
+ "button",
10458
+ {
10459
+ type: "button",
10460
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10461
+ onClick: () => {
10462
+ const state = activeForm.tinaForm.finalForm.getState();
10463
+ if (state.invalid === true) {
10464
+ cms.alerts.error("Cannot navigate away from an invalid form.");
10465
+ } else {
10466
+ cms.dispatch({ type: "forms:set-active-form-id", value: null });
10467
+ }
10468
+ }
10469
+ },
10470
+ /* @__PURE__ */ React.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
10471
+ ), /* @__PURE__ */ React.createElement(
10472
+ "button",
10473
+ {
10474
+ type: "button",
10475
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10476
+ onClick: () => {
10477
+ const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10478
+ cms.state.activeFormId
10479
+ ).name;
10480
+ window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10481
+ }
10482
+ },
10483
+ /* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10484
+ ), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
10485
+ );
10486
+ };
10487
+ const FormHeader = ({ activeForm }) => {
10488
+ const { formIsPristine } = React.useContext(SidebarContext);
10489
+ const cms = useCMS$1();
10490
+ const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
10491
+ return /* @__PURE__ */ React.createElement(
10492
+ "div",
10493
+ {
10494
+ className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
10495
+ },
10496
+ /* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
10497
+ "button",
10498
+ {
10499
+ type: "button",
10500
+ className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
10501
+ onClick: () => {
10502
+ const collectionName = cms.api.tina.schema.getCollectionByFullPath(
10503
+ cms.state.activeFormId
10504
+ ).name;
10505
+ window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
10506
+ }
10507
+ },
10508
+ /* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
10509
+ ), shortFormLabel && /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
10510
+ );
10511
+ };
10580
10512
  const SidebarContext = React.createContext(null);
10581
10513
  const minPreviewWidth = 440;
10582
10514
  const minSidebarWidth = 360;
@@ -10795,7 +10727,7 @@ const Sidebar$1 = ({
10795
10727
  isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
10796
10728
  branchingEnabled
10797
10729
  }
10798
- ), /* @__PURE__ */ React.createElement(FormsView, null, /* @__PURE__ */ React.createElement(sidebar.placeholder, null)), activeScreen && /* @__PURE__ */ React.createElement(
10730
+ ), /* @__PURE__ */ React.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React.createElement(
10799
10731
  ScreenPluginModal,
10800
10732
  {
10801
10733
  screen: activeScreen,
@@ -10971,7 +10903,7 @@ const SidebarHeader = ({
10971
10903
  className: "h-5 w-auto -mx-1 text-blue-500",
10972
10904
  stroke: "currentColor",
10973
10905
  fill: "currentColor",
10974
- "stroke-width": "0",
10906
+ strokeWidth: "0",
10975
10907
  viewBox: "0 0 24 24",
10976
10908
  xmlns: "http://www.w3.org/2000/svg"
10977
10909
  },
@@ -11561,7 +11493,10 @@ function MediaPicker({
11561
11493
  const observer = new IntersectionObserver((entries) => {
11562
11494
  const target = entries[0];
11563
11495
  if (target.isIntersecting && list.nextOffset) {
11564
- setOffsetHistory((offsetHistory2) => [...offsetHistory2, list.nextOffset]);
11496
+ setOffsetHistory((offsetHistory2) => [
11497
+ ...offsetHistory2,
11498
+ list.nextOffset
11499
+ ]);
11565
11500
  }
11566
11501
  });
11567
11502
  if (loaderRef.current) {
@@ -12156,6 +12091,7 @@ const initialState = (cms) => {
12156
12091
  forms: [],
12157
12092
  formLists: [],
12158
12093
  editingMode: "basic",
12094
+ isLoadingContent: false,
12159
12095
  quickEditSupported: false,
12160
12096
  sidebarDisplayState: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.defaultState) || "open"
12161
12097
  };
@@ -12215,7 +12151,12 @@ function tinaReducer(state, action) {
12215
12151
  }
12216
12152
  });
12217
12153
  }
12218
- return { ...state, activeFormId, formLists: nextFormLists };
12154
+ return {
12155
+ ...state,
12156
+ activeFormId,
12157
+ formLists: nextFormLists,
12158
+ isLoadingContent: false
12159
+ };
12219
12160
  }
12220
12161
  case "form-lists:remove": {
12221
12162
  const nextFormLists = state.formLists.filter(
@@ -12284,6 +12225,9 @@ function tinaReducer(state, action) {
12284
12225
  }
12285
12226
  return { ...state, sidebarDisplayState: action.value };
12286
12227
  }
12228
+ case "sidebar:set-loading-state": {
12229
+ return { ...state, isLoadingContent: action.value };
12230
+ }
12287
12231
  default:
12288
12232
  throw new Error(`Unhandled action ${action.type}`);
12289
12233
  }
@@ -12525,7 +12469,9 @@ const ActiveFieldIndicator = () => {
12525
12469
  if (activeEle) {
12526
12470
  setDisplay(true);
12527
12471
  setPosition(activeEle.getBoundingClientRect());
12528
- const iframe = document.getElementById("tina-iframe");
12472
+ const iframe = document.getElementById(
12473
+ "tina-iframe"
12474
+ );
12529
12475
  if (iframe) {
12530
12476
  setIframePosition(iframe.getBoundingClientRect());
12531
12477
  }
@@ -12866,15 +12812,14 @@ const FormBuilder = ({
12866
12812
  fields: fieldGroup.fields
12867
12813
  }
12868
12814
  ) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
12869
- )), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-6 bg-white border-t border-gray-100 flex items-center justify-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full flex justify-between gap-4 items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
12815
+ )), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
12870
12816
  ResetForm,
12871
12817
  {
12872
12818
  pristine,
12873
12819
  reset: async () => {
12874
12820
  finalForm.reset();
12875
12821
  await tinaForm.reset();
12876
- },
12877
- style: { flexGrow: 1 }
12822
+ }
12878
12823
  },
12879
12824
  tinaForm.buttons.reset
12880
12825
  ), /* @__PURE__ */ React.createElement(
@@ -12883,8 +12828,7 @@ const FormBuilder = ({
12883
12828
  onClick: safeHandleSubmit,
12884
12829
  disabled: !canSubmit,
12885
12830
  busy: submitting,
12886
- variant: "primary",
12887
- style: { flexGrow: 3 }
12831
+ variant: "primary"
12888
12832
  },
12889
12833
  submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
12890
12834
  !submitting && tinaForm.buttons.save
@@ -12969,7 +12913,6 @@ const CreateBranchModel = ({
12969
12913
  }) => {
12970
12914
  const cms = useCMS$1();
12971
12915
  const tinaApi = cms.api.tina;
12972
- tinaApi.branch;
12973
12916
  const [disabled, setDisabled] = React.useState(false);
12974
12917
  const [newBranchName, setNewBranchName] = React.useState("");
12975
12918
  const [error, setError] = React.useState("");
@@ -12995,10 +12938,10 @@ const CreateBranchModel = ({
12995
12938
  const newUrl = window.location.href.replace(hash, newHash);
12996
12939
  window.location.href = newUrl;
12997
12940
  };
12998
- return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", { className: "text-base text-gray-700 mb-2" }, "This branch is ", /* @__PURE__ */ React.createElement("strong", null, "protected"), ". Create a new branch to save your changes."), /* @__PURE__ */ React.createElement(
12941
+ return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-6 h-auto mr-1 text-blue-500 opacity-70" }), " ", "Create Branch"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-700 mb-4" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React.createElement(
12999
12942
  PrefixedTextField,
13000
12943
  {
13001
- placeholder: "Branch Name",
12944
+ placeholder: "e.g. {{PAGE-NAME}}-updates",
13002
12945
  value: newBranchName,
13003
12946
  onChange: (e) => {
13004
12947
  setError("");
@@ -13145,7 +13088,9 @@ const ImgEmbed = ({
13145
13088
  const { fieldName } = useTemplates();
13146
13089
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13147
13090
  useHotkey("enter", () => {
13148
- insertNodes(editor, [{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13091
+ insertNodes(editor, [
13092
+ { type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13093
+ ]);
13149
13094
  });
13150
13095
  return /* @__PURE__ */ React__default.createElement("span", { ...attributes, className: "" }, children, element.url ? /* @__PURE__ */ React__default.createElement(
13151
13096
  "div",
@@ -13266,9 +13211,9 @@ const EllipsisIcon = ({ title }) => {
13266
13211
  ));
13267
13212
  };
13268
13213
  const Wrapper$1 = ({ inline, children }) => {
13269
- const Component2 = inline ? "span" : "div";
13214
+ const Component = inline ? "span" : "div";
13270
13215
  return /* @__PURE__ */ React__default.createElement(
13271
- Component2,
13216
+ Component,
13272
13217
  {
13273
13218
  contentEditable: false,
13274
13219
  style: { userSelect: "none" },
@@ -13288,7 +13233,9 @@ const InlineEmbed = ({
13288
13233
  const { templates, fieldName } = useTemplates();
13289
13234
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13290
13235
  useHotkey("enter", () => {
13291
- insertNodes(editor, [{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13236
+ insertNodes(editor, [
13237
+ { type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13238
+ ]);
13292
13239
  });
13293
13240
  useHotkey("space", () => {
13294
13241
  insertNodes(editor, [{ text: " " }], {
@@ -13344,7 +13291,9 @@ const BlockEmbed = ({
13344
13291
  const { templates, fieldName } = useTemplates();
13345
13292
  const { handleClose, handleRemove, handleSelect, isExpanded } = useEmbedHandles(editor, element, fieldName);
13346
13293
  useHotkey("enter", () => {
13347
- insertNodes(editor, [{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }]);
13294
+ insertNodes(editor, [
13295
+ { type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }
13296
+ ]);
13348
13297
  });
13349
13298
  const activeTemplate = templates.find(
13350
13299
  (template) => template.name === element.name
@@ -13690,6 +13639,11 @@ const autoformatMarks = [
13690
13639
  mode: "mark",
13691
13640
  type: MARK_CODE,
13692
13641
  match: "`"
13642
+ },
13643
+ {
13644
+ mode: "mark",
13645
+ type: MARK_STRIKETHROUGH,
13646
+ match: ["~~", "~"]
13693
13647
  }
13694
13648
  ];
13695
13649
  const autoformatRules = [
@@ -13831,16 +13785,14 @@ const plugins$1 = [
13831
13785
  })
13832
13786
  ];
13833
13787
  const plugins = [
13788
+ createBasicMarksPlugin(),
13834
13789
  createHeadingPlugin(),
13835
13790
  createParagraphPlugin(),
13836
13791
  createCodeBlockPlugin(),
13837
13792
  createHTMLBlockPlugin(),
13838
13793
  createHTMLInlinePlugin(),
13839
13794
  createBlockquotePlugin(),
13840
- createBoldPlugin(),
13841
- createItalicPlugin(),
13842
13795
  createUnderlinePlugin(),
13843
- createCodePlugin(),
13844
13796
  createListPlugin(),
13845
13797
  createIndentListPlugin(),
13846
13798
  createHorizontalRulePlugin(),
@@ -14056,13 +14008,13 @@ const TooltipContent = withCn(
14056
14008
  }),
14057
14009
  "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14058
14010
  );
14059
- function withTooltip(Component2) {
14011
+ function withTooltip(Component) {
14060
14012
  return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
14061
14013
  const [mounted, setMounted] = React__default.useState(false);
14062
14014
  React__default.useEffect(() => {
14063
14015
  setMounted(true);
14064
14016
  }, []);
14065
- const component = /* @__PURE__ */ React__default.createElement(Component2, { ref, ...props });
14017
+ const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
14066
14018
  if (tooltip && mounted) {
14067
14019
  return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
14068
14020
  }
@@ -14200,7 +14152,9 @@ const EMBED_ICON_WIDTH = 78;
14200
14152
  const CONTAINER_MD_BREAKPOINT = 448;
14201
14153
  const FLOAT_BUTTON_WIDTH = 25;
14202
14154
  const HEADING_LABEL = "Headings";
14203
- const ToolbarContext = createContext(void 0);
14155
+ const ToolbarContext = createContext(
14156
+ void 0
14157
+ );
14204
14158
  const ToolbarProvider = ({
14205
14159
  tinaForm,
14206
14160
  templates,
@@ -14350,7 +14304,7 @@ const useCodeBlockToolbarButton = (state) => {
14350
14304
  const CodeBlockToolbarButton = withRef(({ clear, ...rest }, ref) => {
14351
14305
  const state = useCodeBlockToolbarButtonState();
14352
14306
  const { props } = useCodeBlockToolbarButton(state);
14353
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.codeBlock, null));
14307
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Code Block", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.codeBlock, null));
14354
14308
  });
14355
14309
  const useImageToolbarButtonState = () => {
14356
14310
  const editor = useEditorState();
@@ -14382,36 +14336,54 @@ const useImageToolbarButton = (state) => {
14382
14336
  const ImageToolbarButton = withRef(({ clear, ...rest }, ref) => {
14383
14337
  const state = useImageToolbarButtonState();
14384
14338
  const { props } = useImageToolbarButton(state);
14385
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
14386
- });
14387
- const IndentListToolbarButton = withRef(({ nodeType = ELEMENT_UL }, ref) => {
14388
- const editor = useEditorState();
14389
- const state = useListToolbarButtonState({ nodeType });
14390
- const { props } = useListToolbarButton(state);
14391
- return /* @__PURE__ */ React__default.createElement(
14392
- ToolbarButton,
14393
- {
14394
- ref,
14395
- tooltip: nodeType === ELEMENT_UL ? "Bulleted List" : "Numbered List",
14396
- ...props,
14397
- onClick: (e) => {
14398
- e.preventDefault();
14399
- e.stopPropagation();
14400
- toggleList(editor, { type: nodeType });
14401
- }
14402
- },
14403
- nodeType === ELEMENT_UL ? /* @__PURE__ */ React__default.createElement(Icons.ul, null) : /* @__PURE__ */ React__default.createElement(Icons.ol, null)
14404
- );
14339
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Image", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.image, null));
14405
14340
  });
14341
+ const UnorderedListToolbarButton = withRef(
14342
+ (props, ref) => {
14343
+ const editor = useEditorState();
14344
+ const state = useListToolbarButtonState({ nodeType: ELEMENT_UL });
14345
+ const { props: buttonProps } = useListToolbarButton(state);
14346
+ return /* @__PURE__ */ React__default.createElement(
14347
+ ToolbarButton,
14348
+ {
14349
+ ref,
14350
+ tooltip: "Bulleted List",
14351
+ ...buttonProps,
14352
+ onClick: (e) => {
14353
+ e.preventDefault();
14354
+ e.stopPropagation();
14355
+ toggleList(editor, { type: ELEMENT_UL });
14356
+ }
14357
+ },
14358
+ /* @__PURE__ */ React__default.createElement(Icons.ul, null)
14359
+ );
14360
+ }
14361
+ );
14362
+ const OrderedListToolbarButton = withRef(
14363
+ (props, ref) => {
14364
+ const editor = useEditorState();
14365
+ const state = useListToolbarButtonState({ nodeType: ELEMENT_OL });
14366
+ const { props: buttonProps } = useListToolbarButton(state);
14367
+ return /* @__PURE__ */ React__default.createElement(
14368
+ ToolbarButton,
14369
+ {
14370
+ ref,
14371
+ tooltip: "Numbered List",
14372
+ ...buttonProps,
14373
+ onClick: (e) => {
14374
+ e.preventDefault();
14375
+ e.stopPropagation();
14376
+ toggleList(editor, { type: ELEMENT_OL });
14377
+ }
14378
+ },
14379
+ /* @__PURE__ */ React__default.createElement(Icons.ol, null)
14380
+ );
14381
+ }
14382
+ );
14406
14383
  const LinkToolbarButton = withRef((rest, ref) => {
14407
14384
  const state = useLinkToolbarButtonState();
14408
14385
  const { props } = useLinkToolbarButton(state);
14409
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...props, ...rest }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
14410
- });
14411
- const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
14412
- const state = useMarkToolbarButtonState({ clear, nodeType });
14413
- const { props } = useMarkToolbarButton(state);
14414
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
14386
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest, tooltip: "Link" }, /* @__PURE__ */ React__default.createElement(Icons.link, null));
14415
14387
  });
14416
14388
  const useMermaidToolbarButtonState = () => {
14417
14389
  const editor = useEditorState();
@@ -14454,6 +14426,7 @@ function OverflowMenu({
14454
14426
  ToolbarButton,
14455
14427
  {
14456
14428
  showArrow: false,
14429
+ "data-testid": "rich-text-editor-overflow-menu-button",
14457
14430
  className: "lg:min-w-[130px]",
14458
14431
  isDropdown: true,
14459
14432
  pressed: openState.open,
@@ -14491,7 +14464,7 @@ const useBlockQuoteToolbarButton = (state) => {
14491
14464
  const QuoteToolbarButton = withRef(({ clear, ...rest }, ref) => {
14492
14465
  const state = useBlockQuoteToolbarButtonState();
14493
14466
  const { props } = useBlockQuoteToolbarButton(state);
14494
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
14467
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Quote (⌘+⇧+.)", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.quote, null));
14495
14468
  });
14496
14469
  const useRawMarkdownToolbarButton = () => {
14497
14470
  const { setRawMode } = useEditorContext();
@@ -14507,7 +14480,17 @@ const useRawMarkdownToolbarButton = () => {
14507
14480
  };
14508
14481
  const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
14509
14482
  const { props } = useRawMarkdownToolbarButton();
14510
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, tooltip: "Link", ...rest, ...props }, /* @__PURE__ */ React__default.createElement(Icons.raw, null));
14483
+ return /* @__PURE__ */ React__default.createElement(
14484
+ ToolbarButton,
14485
+ {
14486
+ ref,
14487
+ tooltip: "Raw Markdown",
14488
+ ...rest,
14489
+ ...props,
14490
+ "data-testid": "markdown-button"
14491
+ },
14492
+ /* @__PURE__ */ React__default.createElement(Icons.raw, null)
14493
+ );
14511
14494
  });
14512
14495
  function TableDropdownMenu(props) {
14513
14496
  const tableSelected = useEditorSelector(
@@ -14646,7 +14629,7 @@ const EmbedButton = ({ editor, templates }) => {
14646
14629
  key: template.name,
14647
14630
  onMouseDown: (e) => {
14648
14631
  e.preventDefault();
14649
- close();
14632
+ setOpen(false);
14650
14633
  insertMDX(editor, template);
14651
14634
  },
14652
14635
  className: ""
@@ -14654,6 +14637,15 @@ const EmbedButton = ({ editor, templates }) => {
14654
14637
  template.label || template.name
14655
14638
  ))));
14656
14639
  };
14640
+ const MarkToolbarButton = withRef(({ clear, nodeType, ...rest }, ref) => {
14641
+ const state = useMarkToolbarButtonState({ clear, nodeType });
14642
+ const { props } = useMarkToolbarButton(state);
14643
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { ref, ...props, ...rest });
14644
+ });
14645
+ const BoldToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: MARK_BOLD }, /* @__PURE__ */ React__default.createElement(Icons.bold, null));
14646
+ const StrikethroughToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Strikethrough", nodeType: MARK_STRIKETHROUGH }, /* @__PURE__ */ React__default.createElement(Icons.strikethrough, null));
14647
+ const ItalicToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: MARK_ITALIC }, /* @__PURE__ */ React__default.createElement(Icons.italic, null));
14648
+ const CodeToolbarButton = () => /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: MARK_CODE }, /* @__PURE__ */ React__default.createElement(Icons.code, null));
14657
14649
  const toolbarItems = {
14658
14650
  heading: {
14659
14651
  label: HEADING_LABEL,
@@ -14674,32 +14666,37 @@ const toolbarItems = {
14674
14666
  quote: {
14675
14667
  label: "Quote",
14676
14668
  width: () => STANDARD_ICON_WIDTH,
14677
- Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, { tooltip: "Quote Quote (⌘+⇧+.)" })
14669
+ Component: /* @__PURE__ */ React__default.createElement(QuoteToolbarButton, null)
14678
14670
  },
14679
14671
  ul: {
14680
14672
  label: "Unordered List",
14681
14673
  width: () => STANDARD_ICON_WIDTH,
14682
- Component: /* @__PURE__ */ React__default.createElement(IndentListToolbarButton, { nodeType: ELEMENT_UL })
14674
+ Component: /* @__PURE__ */ React__default.createElement(UnorderedListToolbarButton, null)
14683
14675
  },
14684
14676
  ol: {
14685
14677
  label: "Ordered List",
14686
14678
  width: () => STANDARD_ICON_WIDTH,
14687
- Component: /* @__PURE__ */ React__default.createElement(IndentListToolbarButton, { nodeType: ELEMENT_OL })
14679
+ Component: /* @__PURE__ */ React__default.createElement(OrderedListToolbarButton, null)
14688
14680
  },
14689
14681
  bold: {
14690
14682
  label: "Bold",
14691
14683
  width: () => STANDARD_ICON_WIDTH,
14692
- Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Bold (⌘+B)", nodeType: MARK_BOLD }, /* @__PURE__ */ React__default.createElement(Icons.bold, null))
14684
+ Component: /* @__PURE__ */ React__default.createElement(BoldToolbarButton, null)
14685
+ },
14686
+ strikethrough: {
14687
+ label: "Strikethrough",
14688
+ width: () => STANDARD_ICON_WIDTH,
14689
+ Component: /* @__PURE__ */ React__default.createElement(StrikethroughToolbarButton, null)
14693
14690
  },
14694
14691
  italic: {
14695
14692
  label: "Italic",
14696
14693
  width: () => STANDARD_ICON_WIDTH,
14697
- Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Italic (⌘+I)", nodeType: MARK_ITALIC }, /* @__PURE__ */ React__default.createElement(Icons.italic, null))
14694
+ Component: /* @__PURE__ */ React__default.createElement(ItalicToolbarButton, null)
14698
14695
  },
14699
14696
  code: {
14700
14697
  label: "Code",
14701
14698
  width: () => STANDARD_ICON_WIDTH,
14702
- Component: /* @__PURE__ */ React__default.createElement(MarkToolbarButton, { tooltip: "Code (⌘+E)", nodeType: MARK_CODE }, /* @__PURE__ */ React__default.createElement(Icons.code, null))
14699
+ Component: /* @__PURE__ */ React__default.createElement(CodeToolbarButton, null)
14703
14700
  },
14704
14701
  codeBlock: {
14705
14702
  label: "Code Block",
@@ -14732,7 +14729,12 @@ function FixedToolbarButtons() {
14732
14729
  const [itemsShown, setItemsShown] = React__default.useState(11);
14733
14730
  const { overrides, templates } = useToolbarContext();
14734
14731
  const showEmbedButton = templates.length > 0;
14735
- let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14732
+ let items2 = [];
14733
+ if (Array.isArray(overrides)) {
14734
+ items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14735
+ } else {
14736
+ items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14737
+ }
14736
14738
  if (!showEmbedButton) {
14737
14739
  items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14738
14740
  }
@@ -15060,6 +15062,9 @@ const isUrl = (string) => {
15060
15062
  if (typeof string !== "string") {
15061
15063
  return false;
15062
15064
  }
15065
+ if (string.startsWith("#")) {
15066
+ return true;
15067
+ }
15063
15068
  const generalMatch = string.match(protocolAndDomainRE);
15064
15069
  const emailLinkMatch = string.match(emailLintRE);
15065
15070
  const localUrlMatch = string.match(localUrlRE);
@@ -15081,12 +15086,12 @@ const isUrl = (string) => {
15081
15086
  }
15082
15087
  return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15083
15088
  };
15084
- const RichEditor = (props) => {
15089
+ const RichEditor = ({ input, tinaForm, field }) => {
15085
15090
  var _a;
15086
15091
  const initialValue = React__default.useMemo(
15087
15092
  () => {
15088
15093
  var _a2, _b;
15089
- 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: "" }] }];
15094
+ 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: "" }] }];
15090
15095
  },
15091
15096
  []
15092
15097
  );
@@ -15114,7 +15119,7 @@ const RichEditor = (props) => {
15114
15119
  ),
15115
15120
  []
15116
15121
  );
15117
- const tempId = [props.tinaForm.id, props.input.name].join(".");
15122
+ const tempId = [tinaForm.id, input.name].join(".");
15118
15123
  const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
15119
15124
  const ref = React__default.useRef(null);
15120
15125
  React__default.useEffect(() => {
@@ -15124,13 +15129,13 @@ const RichEditor = (props) => {
15124
15129
  const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
15125
15130
  '[role="textbox"]'
15126
15131
  );
15127
- if (props.field.experimental_focusIntent && plateElement) {
15132
+ if (field.experimental_focusIntent && plateElement) {
15128
15133
  if (plateElement)
15129
15134
  plateElement.focus();
15130
15135
  }
15131
15136
  }, 100);
15132
15137
  }
15133
- }, [props.field.experimental_focusIntent, ref]);
15138
+ }, [field.experimental_focusIntent, ref]);
15134
15139
  return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
15135
15140
  Plate,
15136
15141
  {
@@ -15138,7 +15143,7 @@ const RichEditor = (props) => {
15138
15143
  initialValue,
15139
15144
  plugins: plugins$2,
15140
15145
  onChange: (value) => {
15141
- props.input.onChange({
15146
+ input.onChange({
15142
15147
  type: "root",
15143
15148
  children: value
15144
15149
  });
@@ -15147,12 +15152,12 @@ const RichEditor = (props) => {
15147
15152
  /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
15148
15153
  ToolbarProvider,
15149
15154
  {
15150
- tinaForm: props.tinaForm,
15151
- templates: props.field.templates,
15152
- overrides: (_a = props.field) == null ? void 0 : _a.toolbarOverride
15155
+ tinaForm,
15156
+ templates: field.templates,
15157
+ overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
15153
15158
  },
15154
15159
  /* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
15155
- /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
15160
+ ((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null)) : null
15156
15161
  ), /* @__PURE__ */ React__default.createElement(Editor, null))
15157
15162
  ));
15158
15163
  };
@@ -16340,132 +16345,1209 @@ const ben = [
16340
16345
  "হয়"
16341
16346
  ];
16342
16347
  const bre = [
16348
+ "'blam",
16349
+ "'d",
16350
+ "'m",
16351
+ "'r",
16352
+ "'ta",
16353
+ "'vat",
16354
+ "'z",
16355
+ "'zo",
16343
16356
  "a",
16344
- "ainda",
16345
- "alem",
16346
- "ambas",
16347
- "ambos",
16348
- "antes",
16349
- "ao",
16350
- "aonde",
16351
- "aos",
16352
- "apos",
16353
- "aquele",
16354
- "aqueles",
16355
- "as",
16356
- "assim",
16357
- "com",
16358
- "como",
16359
- "contra",
16360
- "contudo",
16361
- "cuja",
16362
- "cujas",
16363
- "cujo",
16364
- "cujos",
16357
+ "a:",
16358
+ "aba",
16359
+ "abalamour",
16360
+ "abaoe",
16361
+ "ac'hane",
16362
+ "ac'hanoc'h",
16363
+ "ac'hanomp",
16364
+ "ac'hanon",
16365
+ "ac'hanout",
16366
+ "adal",
16367
+ "adalek",
16368
+ "adarre",
16369
+ "ae",
16370
+ "aec'h",
16371
+ "aed",
16372
+ "aemp",
16373
+ "aen",
16374
+ "aent",
16375
+ "aes",
16376
+ "afe",
16377
+ "afec'h",
16378
+ "afed",
16379
+ "afemp",
16380
+ "afen",
16381
+ "afent",
16382
+ "afes",
16383
+ "ag",
16384
+ "ah",
16385
+ "aimp",
16386
+ "aint",
16387
+ "aio",
16388
+ "aiou",
16389
+ "aje",
16390
+ "ajec'h",
16391
+ "ajed",
16392
+ "ajemp",
16393
+ "ajen",
16394
+ "ajent",
16395
+ "ajes",
16396
+ "al",
16397
+ "alato",
16398
+ "alies",
16399
+ "aliesañ",
16400
+ "alkent",
16401
+ "all",
16402
+ "allas",
16403
+ "allo",
16404
+ "allô",
16405
+ "am",
16406
+ "amañ",
16407
+ "amzer",
16408
+ "an",
16409
+ "anezhañ",
16410
+ "anezhe",
16411
+ "anezhi",
16412
+ "anezho",
16413
+ "anvet",
16414
+ "aon",
16415
+ "aotren",
16416
+ "ar",
16417
+ "arall",
16418
+ "araok",
16419
+ "araoki",
16420
+ "araozañ",
16421
+ "araozo",
16422
+ "araozoc'h",
16423
+ "araozomp",
16424
+ "araozon",
16425
+ "araozor",
16426
+ "araozout",
16427
+ "arbenn",
16428
+ "arre",
16429
+ "atalek",
16430
+ "atav",
16431
+ "az",
16432
+ "azalek",
16433
+ "azirazañ",
16434
+ "azirazi",
16435
+ "azirazo",
16436
+ "azirazoc'h",
16437
+ "azirazomp",
16438
+ "azirazon",
16439
+ "azirazor",
16440
+ "azirazout",
16441
+ "b:",
16442
+ "ba",
16443
+ "ba'l",
16444
+ "ba'n",
16445
+ "ba'r",
16446
+ "bad",
16447
+ "bah",
16448
+ "bal",
16449
+ "ban",
16450
+ "bar",
16451
+ "bastañ",
16452
+ "befe",
16453
+ "bell",
16454
+ "benaos",
16455
+ "benn",
16456
+ "bennag",
16457
+ "bennak",
16458
+ "bennozh",
16459
+ "bep",
16460
+ "bepred",
16461
+ "berr",
16462
+ "berzh",
16463
+ "bet",
16464
+ "betek",
16465
+ "betra",
16466
+ "bev",
16467
+ "bevet",
16468
+ "bez",
16469
+ "bezañ",
16470
+ "beze",
16471
+ "bezent",
16472
+ "bezet",
16473
+ "bezh",
16474
+ "bezit",
16475
+ "bezomp",
16476
+ "bihan",
16477
+ "bije",
16478
+ "biou",
16479
+ "biskoazh",
16480
+ "blam",
16481
+ "bo",
16482
+ "boa",
16483
+ "bominapl",
16484
+ "boudoudom",
16485
+ "bouez",
16486
+ "boull",
16487
+ "boum",
16488
+ "bout",
16489
+ "bras",
16490
+ "brasañ",
16491
+ "brav",
16492
+ "bravo",
16493
+ "bremañ",
16494
+ "bres",
16495
+ "brokenn",
16496
+ "bronn",
16497
+ "brrr",
16498
+ "brutal",
16499
+ "buhezek",
16500
+ "c'h:",
16501
+ "c'haout",
16502
+ "c'he",
16503
+ "c'hem",
16504
+ "c'herz",
16505
+ "c'heñver",
16506
+ "c'hichen",
16507
+ "c'hiz",
16508
+ "c'hoazh",
16509
+ "c'horre",
16510
+ "c'houde",
16511
+ "c'houst",
16512
+ "c'hreiz",
16513
+ "c'hwec'h",
16514
+ "c'hwec'hvet",
16515
+ "c'hwezek",
16516
+ "c'hwi",
16517
+ "ch:",
16518
+ "chaous",
16519
+ "chik",
16520
+ "chit",
16521
+ "chom",
16522
+ "chut",
16523
+ "d'",
16524
+ "d'al",
16525
+ "d'an",
16526
+ "d'ar",
16527
+ "d'az",
16528
+ "d'e",
16529
+ "d'he",
16530
+ "d'ho",
16531
+ "d'hol",
16532
+ "d'hon",
16533
+ "d'hor",
16534
+ "d'o",
16535
+ "d'ober",
16536
+ "d'ul",
16537
+ "d'un",
16538
+ "d'ur",
16539
+ "d:",
16365
16540
  "da",
16366
- "das",
16367
- "de",
16368
- "dela",
16369
- "dele",
16370
- "deles",
16371
- "demais",
16372
- "depois",
16373
- "desde",
16374
- "desta",
16375
- "deste",
16376
- "dispoe",
16377
- "dispoem",
16378
- "diversa",
16379
- "diversas",
16380
- "diversos",
16541
+ "dak",
16542
+ "daka",
16543
+ "dal",
16544
+ "dalbezh",
16545
+ "dalc'hmat",
16546
+ "dalit",
16547
+ "damdost",
16548
+ "damheñvel",
16549
+ "damm",
16550
+ "dan",
16551
+ "danvez",
16552
+ "dao",
16553
+ "daol",
16554
+ "daonet",
16555
+ "daou",
16556
+ "daoust",
16557
+ "daouzek",
16558
+ "daouzekvet",
16559
+ "darn",
16560
+ "dastrewiñ",
16561
+ "dav",
16562
+ "davedoc'h",
16563
+ "davedomp",
16564
+ "davedon",
16565
+ "davedor",
16566
+ "davedout",
16567
+ "davet",
16568
+ "davetañ",
16569
+ "davete",
16570
+ "daveti",
16571
+ "daveto",
16572
+ "defe",
16573
+ "dehou",
16574
+ "dek",
16575
+ "dekvet",
16576
+ "den",
16577
+ "deoc'h",
16578
+ "deomp",
16579
+ "deor",
16580
+ "derc'hel",
16581
+ "deus",
16582
+ "dez",
16583
+ "deze",
16584
+ "dezhañ",
16585
+ "dezhe",
16586
+ "dezhi",
16587
+ "dezho",
16588
+ "di",
16589
+ "diabarzh",
16590
+ "diagent",
16591
+ "diar",
16592
+ "diaraok",
16593
+ "diavaez",
16594
+ "dibaoe",
16595
+ "dibaot",
16596
+ "dibar",
16597
+ "dic'halañ",
16598
+ "didiac'h",
16599
+ "dienn",
16600
+ "difer",
16601
+ "diganeoc'h",
16602
+ "diganeomp",
16603
+ "diganeor",
16604
+ "diganimp",
16605
+ "diganin",
16606
+ "diganit",
16607
+ "digant",
16608
+ "digantañ",
16609
+ "digante",
16610
+ "diganti",
16611
+ "diganto",
16612
+ "digemmesk",
16613
+ "diget",
16614
+ "digor",
16615
+ "digoret",
16616
+ "dija",
16617
+ "dije",
16618
+ "dimp",
16619
+ "din",
16620
+ "dinaou",
16621
+ "dindan",
16622
+ "dindanañ",
16623
+ "dindani",
16624
+ "dindano",
16625
+ "dindanoc'h",
16626
+ "dindanomp",
16627
+ "dindanon",
16628
+ "dindanor",
16629
+ "dindanout",
16630
+ "dioutañ",
16631
+ "dioute",
16632
+ "diouti",
16633
+ "diouto",
16634
+ "diouzh",
16635
+ "diouzhin",
16636
+ "diouzhit",
16637
+ "diouzhoc'h",
16638
+ "diouzhomp",
16639
+ "diouzhor",
16640
+ "dirak",
16641
+ "dirazañ",
16642
+ "dirazi",
16643
+ "dirazo",
16644
+ "dirazoc'h",
16645
+ "dirazomp",
16646
+ "dirazon",
16647
+ "dirazor",
16648
+ "dirazout",
16649
+ "disheñvel",
16650
+ "dispar",
16651
+ "distank",
16652
+ "dister",
16653
+ "disterañ",
16654
+ "disterig",
16655
+ "distro",
16656
+ "dit",
16657
+ "divaez",
16658
+ "diwar",
16659
+ "diwezhat",
16660
+ "diwezhañ",
16381
16661
  "do",
16382
- "dos",
16383
- "durante",
16662
+ "doa",
16663
+ "doare",
16664
+ "dont",
16665
+ "dost",
16666
+ "doue",
16667
+ "douetus",
16668
+ "douez",
16669
+ "doug",
16670
+ "draou",
16671
+ "draoñ",
16672
+ "dre",
16673
+ "drede",
16674
+ "dreist",
16675
+ "dreistañ",
16676
+ "dreisti",
16677
+ "dreisto",
16678
+ "dreistoc'h",
16679
+ "dreistomp",
16680
+ "dreiston",
16681
+ "dreistor",
16682
+ "dreistout",
16683
+ "drek",
16684
+ "dreñv",
16685
+ "dring",
16686
+ "dro",
16687
+ "du",
16384
16688
  "e",
16385
- "ela",
16386
- "elas",
16387
- "ele",
16388
- "eles",
16689
+ "e:",
16690
+ "eas",
16691
+ "ebet",
16692
+ "ec'h",
16693
+ "edo",
16694
+ "edoc'h",
16695
+ "edod",
16696
+ "edomp",
16697
+ "edon",
16698
+ "edont",
16699
+ "edos",
16700
+ "eer",
16701
+ "eeun",
16702
+ "efed",
16703
+ "egedoc'h",
16704
+ "egedomp",
16705
+ "egedon",
16706
+ "egedor",
16707
+ "egedout",
16708
+ "eget",
16709
+ "egetañ",
16710
+ "egete",
16711
+ "egeti",
16712
+ "egeto",
16713
+ "eh",
16714
+ "eil",
16715
+ "eilvet",
16716
+ "eizh",
16717
+ "eizhvet",
16718
+ "ejoc'h",
16719
+ "ejod",
16720
+ "ejomp",
16721
+ "ejont",
16722
+ "ejout",
16723
+ "el",
16389
16724
  "em",
16390
- "entao",
16391
- "entre",
16392
- "essa",
16393
- "essas",
16394
- "esse",
16395
- "esses",
16396
- "esta",
16397
- "estas",
16398
- "este",
16399
- "estes",
16725
+ "emaint",
16726
+ "emaoc'h",
16727
+ "emaomp",
16728
+ "emaon",
16729
+ "emaout",
16730
+ "emañ",
16731
+ "eme",
16732
+ "emeur",
16733
+ "emezañ",
16734
+ "emezi",
16735
+ "emezo",
16736
+ "emezoc'h",
16737
+ "emezomp",
16738
+ "emezon",
16739
+ "emezout",
16740
+ "emporzhiañ",
16741
+ "en",
16742
+ "end",
16743
+ "endan",
16744
+ "endra",
16745
+ "enep",
16746
+ "ennañ",
16747
+ "enni",
16748
+ "enno",
16749
+ "ennoc'h",
16750
+ "ennomp",
16751
+ "ennon",
16752
+ "ennor",
16753
+ "ennout",
16754
+ "enta",
16755
+ "eo",
16756
+ "eomp",
16757
+ "eont",
16758
+ "eor",
16759
+ "eot",
16760
+ "er",
16761
+ "erbet",
16762
+ "erfin",
16763
+ "esa",
16764
+ "esae",
16765
+ "espar",
16766
+ "estlamm",
16767
+ "estrañj",
16768
+ "eta",
16769
+ "etre",
16770
+ "etreoc'h",
16771
+ "etrezo",
16772
+ "etrezoc'h",
16773
+ "etrezomp",
16774
+ "etrezor",
16775
+ "euh",
16776
+ "eur",
16777
+ "eus",
16778
+ "evel",
16779
+ "evelato",
16780
+ "eveldoc'h",
16781
+ "eveldomp",
16782
+ "eveldon",
16783
+ "eveldor",
16784
+ "eveldout",
16785
+ "evelkent",
16786
+ "eveltañ",
16787
+ "evelte",
16788
+ "evelti",
16789
+ "evelto",
16790
+ "evidoc'h",
16791
+ "evidomp",
16792
+ "evidon",
16793
+ "evidor",
16794
+ "evidout",
16795
+ "evit",
16796
+ "evitañ",
16797
+ "evite",
16798
+ "eviti",
16799
+ "evito",
16800
+ "ez",
16801
+ "eñ",
16802
+ "f:",
16803
+ "fac'h",
16804
+ "fall",
16805
+ "fed",
16806
+ "feiz",
16807
+ "fenn",
16808
+ "fezh",
16809
+ "fin",
16810
+ "finsalvet",
16811
+ "foei",
16812
+ "fouilhezañ",
16813
+ "g:",
16814
+ "gallout",
16815
+ "ganeoc'h",
16816
+ "ganeomp",
16817
+ "ganin",
16818
+ "ganit",
16819
+ "gant",
16820
+ "gantañ",
16821
+ "ganti",
16822
+ "ganto",
16823
+ "gaout",
16824
+ "gast",
16825
+ "gein",
16826
+ "gellout",
16827
+ "genndost",
16828
+ "gentañ",
16829
+ "ger",
16830
+ "gerz",
16831
+ "get",
16832
+ "geñver",
16833
+ "gichen",
16834
+ "gin",
16835
+ "giz",
16836
+ "glan",
16837
+ "gloev",
16838
+ "goll",
16839
+ "gorre",
16840
+ "goude",
16841
+ "gouez",
16842
+ "gouezit",
16843
+ "gouezomp",
16844
+ "goulz",
16845
+ "gounnar",
16846
+ "gour",
16847
+ "goust",
16848
+ "gouze",
16849
+ "gouzout",
16850
+ "gra",
16851
+ "grak",
16852
+ "grec'h",
16853
+ "greiz",
16854
+ "grenn",
16855
+ "greomp",
16856
+ "grit",
16857
+ "groñs",
16858
+ "gutez",
16859
+ "gwall",
16860
+ "gwashoc'h",
16861
+ "gwazh",
16862
+ "gwech",
16863
+ "gwechall",
16864
+ "gwechoù",
16865
+ "gwell",
16866
+ "gwezh",
16867
+ "gwezhall",
16868
+ "gwezharall",
16869
+ "gwezhoù",
16870
+ "gwig",
16871
+ "gwirionez",
16872
+ "gwitibunan",
16873
+ "gêr",
16874
+ "h:",
16400
16875
  "ha",
16401
- "isso",
16402
- "isto",
16403
- "logo",
16404
- "mais",
16405
- "mas",
16406
- "mediante",
16407
- "menos",
16408
- "mesma",
16409
- "mesmas",
16410
- "mesmo",
16411
- "mesmos",
16876
+ "hag",
16877
+ "han",
16878
+ "hanter",
16879
+ "hanterc'hantad",
16880
+ "hanterkantved",
16881
+ "harz",
16882
+ "hañ",
16883
+ "hañval",
16884
+ "he",
16885
+ "hebioù",
16886
+ "hec'h",
16887
+ "hei",
16888
+ "hein",
16889
+ "hem",
16890
+ "hemañ",
16891
+ "hen",
16892
+ "hend",
16893
+ "henhont",
16894
+ "henn",
16895
+ "hennezh",
16896
+ "hent",
16897
+ "hep",
16898
+ "hervez",
16899
+ "hervezañ",
16900
+ "hervezi",
16901
+ "hervezo",
16902
+ "hervezoc'h",
16903
+ "hervezomp",
16904
+ "hervezon",
16905
+ "hervezor",
16906
+ "hervezout",
16907
+ "heul",
16908
+ "heuliañ",
16909
+ "hevelep",
16910
+ "heverk",
16911
+ "heñvel",
16912
+ "heñvelat",
16913
+ "heñvelañ",
16914
+ "heñveliñ",
16915
+ "heñveloc'h",
16916
+ "heñvelout",
16917
+ "hi",
16918
+ "hilh",
16919
+ "hini",
16920
+ "hirie",
16921
+ "hirio",
16922
+ "hiziv",
16923
+ "hiziviken",
16924
+ "ho",
16925
+ "hoaliñ",
16926
+ "hoc'h",
16927
+ "hogen",
16928
+ "hogos",
16929
+ "hogozik",
16930
+ "hol",
16931
+ "holl",
16932
+ "holà",
16933
+ "homañ",
16934
+ "hon",
16935
+ "honhont",
16936
+ "honnezh",
16937
+ "hont",
16938
+ "hop",
16939
+ "hopala",
16940
+ "hor",
16941
+ "hou",
16942
+ "houp",
16943
+ "hudu",
16944
+ "hue",
16945
+ "hui",
16946
+ "hum",
16947
+ "hurrah",
16948
+ "i",
16949
+ "i:",
16950
+ "in",
16951
+ "int",
16952
+ "is",
16953
+ "ispisial",
16954
+ "isurzhiet",
16955
+ "it",
16956
+ "ivez",
16957
+ "izelañ",
16958
+ "j:",
16959
+ "just",
16960
+ "k:",
16961
+ "kae",
16962
+ "kaer",
16963
+ "kalon",
16964
+ "kalz",
16965
+ "kant",
16966
+ "kaout",
16967
+ "kar",
16968
+ "kazi",
16969
+ "keid",
16970
+ "kein",
16971
+ "keit",
16972
+ "kel",
16973
+ "kellies",
16974
+ "keloù",
16975
+ "kement",
16976
+ "ken",
16977
+ "kenkent",
16978
+ "kenkoulz",
16979
+ "kenment",
16980
+ "kent",
16981
+ "kentañ",
16982
+ "kentizh",
16983
+ "kentoc'h",
16984
+ "kentre",
16985
+ "ker",
16986
+ "kerkent",
16987
+ "kerz",
16988
+ "kerzh",
16989
+ "ket",
16990
+ "keta",
16991
+ "keñver",
16992
+ "keñverel",
16993
+ "keñverius",
16994
+ "kichen",
16995
+ "kichenik",
16996
+ "kit",
16997
+ "kiz",
16998
+ "klak",
16999
+ "klek",
17000
+ "klik",
17001
+ "komprenet",
17002
+ "komz",
17003
+ "kont",
17004
+ "korf",
17005
+ "korre",
17006
+ "koulskoude",
17007
+ "koulz",
17008
+ "koust",
17009
+ "krak",
17010
+ "krampouezh",
17011
+ "krec'h",
17012
+ "kreiz",
17013
+ "kuit",
17014
+ "kwir",
17015
+ "l:",
17016
+ "la",
17017
+ "laez",
17018
+ "laoskel",
17019
+ "laouen",
17020
+ "lavar",
17021
+ "lavaret",
17022
+ "lavarout",
17023
+ "lec'h",
17024
+ "lein",
17025
+ "leizh",
17026
+ "lerc'h",
17027
+ "leun",
17028
+ "leuskel",
17029
+ "lew",
17030
+ "lies",
17031
+ "liesañ",
17032
+ "lod",
17033
+ "lusk",
17034
+ "lâr",
17035
+ "lârout",
17036
+ "m:",
17037
+ "ma",
17038
+ "ma'z",
17039
+ "mac'h",
17040
+ "mac'hat",
17041
+ "mac'hañ",
17042
+ "mac'hoc'h",
17043
+ "mad",
17044
+ "maez",
17045
+ "maksimal",
17046
+ "mann",
17047
+ "mar",
17048
+ "mard",
17049
+ "marg",
17050
+ "marzh",
17051
+ "mat",
17052
+ "mañ",
17053
+ "me",
17054
+ "memes",
17055
+ "memestra",
17056
+ "merkapl",
17057
+ "mersi",
17058
+ "mes",
17059
+ "mesk",
17060
+ "met",
17061
+ "meur",
17062
+ "mil",
17063
+ "minimal",
17064
+ "moan",
17065
+ "moaniaat",
17066
+ "mod",
17067
+ "mont",
17068
+ "mout",
17069
+ "mui",
17070
+ "muiañ",
17071
+ "muioc'h",
17072
+ "n",
17073
+ "n'",
17074
+ "n:",
16412
17075
  "na",
16413
- "nao",
16414
- "nas",
16415
- "nem",
16416
- "nesse",
16417
- "neste",
16418
- "nos",
17076
+ "nag",
17077
+ "naontek",
17078
+ "naturel",
17079
+ "nav",
17080
+ "navet",
17081
+ "ne",
17082
+ "nebeudig",
17083
+ "nebeut",
17084
+ "nebeutañ",
17085
+ "nebeutoc'h",
17086
+ "neketa",
17087
+ "nemedoc'h",
17088
+ "nemedomp",
17089
+ "nemedon",
17090
+ "nemedor",
17091
+ "nemedout",
17092
+ "nemet",
17093
+ "nemetañ",
17094
+ "nemete",
17095
+ "nemeti",
17096
+ "nemeto",
17097
+ "nemeur",
17098
+ "neoac'h",
17099
+ "nepell",
17100
+ "nerzh",
17101
+ "nes",
17102
+ "neseser",
17103
+ "netra",
17104
+ "neubeudoù",
17105
+ "neuhe",
17106
+ "neuze",
17107
+ "nevez",
17108
+ "newazh",
17109
+ "nez",
17110
+ "ni",
17111
+ "nikun",
17112
+ "niverus",
17113
+ "nul",
16419
17114
  "o",
16420
- "os",
16421
- "ou",
16422
- "outra",
16423
- "outras",
16424
- "outro",
16425
- "outros",
16426
- "pelas",
16427
- "pelo",
16428
- "pelos",
16429
- "perante",
16430
- "pois",
16431
- "por",
16432
- "porque",
16433
- "portanto",
16434
- "propios",
16435
- "proprio",
16436
- "quais",
16437
- "qual",
16438
- "qualquer",
16439
- "quando",
16440
- "quanto",
16441
- "que",
16442
- "quem",
16443
- "quer",
17115
+ "o:",
17116
+ "oa",
17117
+ "oac'h",
17118
+ "oad",
17119
+ "oamp",
17120
+ "oan",
17121
+ "oant",
17122
+ "oar",
17123
+ "oas",
17124
+ "ober",
17125
+ "oc'h",
17126
+ "oc'ho",
17127
+ "oc'hola",
17128
+ "oc'hpenn",
17129
+ "oh",
17130
+ "ohe",
17131
+ "ollé",
17132
+ "olole",
17133
+ "olé",
17134
+ "omp",
17135
+ "on",
17136
+ "ordin",
17137
+ "ordinal",
17138
+ "ouejoc'h",
17139
+ "ouejod",
17140
+ "ouejomp",
17141
+ "ouejont",
17142
+ "ouejout",
17143
+ "ouek",
17144
+ "ouezas",
17145
+ "ouezi",
17146
+ "ouezimp",
17147
+ "ouezin",
17148
+ "ouezint",
17149
+ "ouezis",
17150
+ "ouezo",
17151
+ "ouezoc'h",
17152
+ "ouezor",
17153
+ "ouf",
17154
+ "oufe",
17155
+ "oufec'h",
17156
+ "oufed",
17157
+ "oufemp",
17158
+ "oufen",
17159
+ "oufent",
17160
+ "oufes",
17161
+ "ouie",
17162
+ "ouiec'h",
17163
+ "ouied",
17164
+ "ouiemp",
17165
+ "ouien",
17166
+ "ouient",
17167
+ "ouies",
17168
+ "ouije",
17169
+ "ouijec'h",
17170
+ "ouijed",
17171
+ "ouijemp",
17172
+ "ouijen",
17173
+ "ouijent",
17174
+ "ouijes",
17175
+ "out",
17176
+ "outañ",
17177
+ "outi",
17178
+ "outo",
17179
+ "ouzer",
17180
+ "ouzh",
17181
+ "ouzhin",
17182
+ "ouzhit",
17183
+ "ouzhoc'h",
17184
+ "ouzhomp",
17185
+ "ouzhor",
17186
+ "ouzhpenn",
17187
+ "ouzhpennik",
17188
+ "ouzoc'h",
17189
+ "ouzomp",
17190
+ "ouzon",
17191
+ "ouzont",
17192
+ "ouzout",
17193
+ "p'",
17194
+ "p:",
17195
+ "pa",
17196
+ "pad",
17197
+ "padal",
17198
+ "paf",
17199
+ "pan",
17200
+ "panevedeoc'h",
17201
+ "panevedo",
17202
+ "panevedomp",
17203
+ "panevedon",
17204
+ "panevedout",
17205
+ "panevet",
17206
+ "panevetañ",
17207
+ "paneveti",
17208
+ "pas",
17209
+ "paseet",
17210
+ "pe",
17211
+ "peadra",
17212
+ "peder",
17213
+ "pedervet",
17214
+ "pedervetvet",
17215
+ "pefe",
17216
+ "pegeit",
17217
+ "pegement",
17218
+ "pegen",
17219
+ "pegiz",
17220
+ "pegoulz",
17221
+ "pehini",
17222
+ "pelec'h",
17223
+ "pell",
17224
+ "pemod",
17225
+ "pemp",
17226
+ "pempved",
17227
+ "pemzek",
17228
+ "penaos",
17229
+ "penn",
17230
+ "peogwir",
17231
+ "peotramant",
17232
+ "pep",
17233
+ "perak",
17234
+ "perc'hennañ",
17235
+ "pergen",
17236
+ "permetiñ",
17237
+ "peseurt",
17238
+ "pet",
17239
+ "petiaoul",
17240
+ "petoare",
17241
+ "petra",
17242
+ "peur",
17243
+ "peurgetket",
17244
+ "peurheñvel",
17245
+ "peurliesañ",
17246
+ "peurvuiañ",
17247
+ "peus",
17248
+ "peustost",
17249
+ "peuz",
17250
+ "pevar",
17251
+ "pevare",
17252
+ "pevarevet",
17253
+ "pevarzek",
17254
+ "pez",
17255
+ "peze",
17256
+ "pezh",
17257
+ "pff",
17258
+ "pfft",
17259
+ "pfut",
17260
+ "picher",
17261
+ "pif",
17262
+ "pife",
17263
+ "pign",
17264
+ "pije",
17265
+ "pikol",
17266
+ "pitiaoul",
17267
+ "piv",
17268
+ "plaouf",
17269
+ "plok",
17270
+ "plouf",
17271
+ "po",
17272
+ "poa",
17273
+ "poelladus",
17274
+ "pof",
17275
+ "pok",
17276
+ "posupl",
17277
+ "pouah",
17278
+ "pourc'henn",
17279
+ "prest",
17280
+ "prestik",
17281
+ "prim",
17282
+ "prin",
17283
+ "provostapl",
17284
+ "pst",
17285
+ "pu",
17286
+ "pur",
17287
+ "r:",
17288
+ "ra",
17289
+ "rae",
17290
+ "raec'h",
17291
+ "raed",
17292
+ "raemp",
17293
+ "raen",
17294
+ "raent",
17295
+ "raes",
17296
+ "rafe",
17297
+ "rafec'h",
17298
+ "rafed",
17299
+ "rafemp",
17300
+ "rafen",
17301
+ "rafent",
17302
+ "rafes",
17303
+ "rag",
17304
+ "raimp",
17305
+ "raint",
17306
+ "raio",
17307
+ "raje",
17308
+ "rajec'h",
17309
+ "rajed",
17310
+ "rajemp",
17311
+ "rajen",
17312
+ "rajent",
17313
+ "rajes",
17314
+ "rak",
17315
+ "ral",
17316
+ "ran",
17317
+ "rankout",
17318
+ "raok",
17319
+ "razh",
17320
+ "re",
17321
+ "reas",
17322
+ "reer",
17323
+ "regennoù",
17324
+ "reiñ",
17325
+ "rejoc'h",
17326
+ "rejod",
17327
+ "rejomp",
17328
+ "rejont",
17329
+ "rejout",
17330
+ "rener",
17331
+ "rentañ",
17332
+ "reoc'h",
17333
+ "reomp",
17334
+ "reont",
17335
+ "reor",
17336
+ "reot",
17337
+ "resis",
17338
+ "ret",
17339
+ "reve",
17340
+ "rez",
17341
+ "ri",
17342
+ "rik",
17343
+ "rin",
17344
+ "ris",
17345
+ "rit",
17346
+ "rouez",
17347
+ "s:",
17348
+ "sac'h",
17349
+ "sant",
17350
+ "sav",
17351
+ "sañset",
16444
17352
  "se",
16445
- "seja",
16446
- "sem",
16447
- "sendo",
16448
- "seu",
16449
- "seus",
16450
- "sob",
16451
- "sobre",
16452
- "sua",
16453
- "suas",
17353
+ "sed",
17354
+ "seitek",
17355
+ "seizh",
17356
+ "seizhvet",
17357
+ "sell",
17358
+ "sellit",
17359
+ "ser",
17360
+ "setu",
17361
+ "seul",
17362
+ "seurt",
17363
+ "siwazh",
17364
+ "skignañ",
17365
+ "skoaz",
17366
+ "skouer",
17367
+ "sort",
17368
+ "souden",
17369
+ "souvitañ",
17370
+ "soñj",
17371
+ "speriañ",
17372
+ "spririñ",
17373
+ "stad",
17374
+ "stlabezañ",
17375
+ "stop",
17376
+ "stranañ",
17377
+ "strewiñ",
17378
+ "strishaat",
17379
+ "stumm",
17380
+ "sujed",
17381
+ "surtoud",
17382
+ "t:",
17383
+ "ta",
17384
+ "taer",
17385
+ "tailh",
17386
+ "tak",
16454
17387
  "tal",
16455
- "tambem",
16456
- "teu",
17388
+ "talvoudegezh",
17389
+ "tamm",
17390
+ "tanav",
17391
+ "taol",
17392
+ "te",
17393
+ "techet",
17394
+ "teir",
17395
+ "teirvet",
17396
+ "telt",
17397
+ "teltenn",
16457
17398
  "teus",
16458
- "toda",
16459
- "todas",
16460
- "todo",
16461
- "todos",
16462
- "tua",
16463
- "tuas",
16464
- "tudo",
16465
- "um",
16466
- "uma",
16467
- "umas",
16468
- "uns"
17399
+ "teut",
17400
+ "teuteu",
17401
+ "ti",
17402
+ "tik",
17403
+ "toa",
17404
+ "tok",
17405
+ "tost",
17406
+ "tostig",
17407
+ "toud",
17408
+ "touesk",
17409
+ "touez",
17410
+ "toull",
17411
+ "tra",
17412
+ "trantenn",
17413
+ "traoñ",
17414
+ "trawalc'h",
17415
+ "tre",
17416
+ "trede",
17417
+ "tregont",
17418
+ "tremenet",
17419
+ "tri",
17420
+ "trivet",
17421
+ "triwec'h",
17422
+ "trizek",
17423
+ "tro",
17424
+ "trugarez",
17425
+ "trumm",
17426
+ "tsoin",
17427
+ "tsouin",
17428
+ "tu",
17429
+ "tud",
17430
+ "u:",
17431
+ "ugent",
17432
+ "uhel",
17433
+ "uhelañ",
17434
+ "ul",
17435
+ "un",
17436
+ "unan",
17437
+ "unanez",
17438
+ "unanig",
17439
+ "unnek",
17440
+ "unnekvet",
17441
+ "ur",
17442
+ "urzh",
17443
+ "us",
17444
+ "v:",
17445
+ "va",
17446
+ "vale",
17447
+ "van",
17448
+ "vare",
17449
+ "vat",
17450
+ "vefe",
17451
+ "vefec'h",
17452
+ "vefed",
17453
+ "vefemp",
17454
+ "vefen",
17455
+ "vefent",
17456
+ "vefes",
17457
+ "vesk",
17458
+ "vete",
17459
+ "vez",
17460
+ "vezan",
17461
+ "vezañ",
17462
+ "veze",
17463
+ "vezec'h",
17464
+ "vezed",
17465
+ "vezemp",
17466
+ "vezen",
17467
+ "vezent",
17468
+ "vezer",
17469
+ "vezes",
17470
+ "vezez",
17471
+ "vezit",
17472
+ "vezomp",
17473
+ "vezont",
17474
+ "vi",
17475
+ "vihan",
17476
+ "vihanañ",
17477
+ "vije",
17478
+ "vijec'h",
17479
+ "vijed",
17480
+ "vijemp",
17481
+ "vijen",
17482
+ "vijent",
17483
+ "vijes",
17484
+ "viken",
17485
+ "vimp",
17486
+ "vin",
17487
+ "vint",
17488
+ "vior",
17489
+ "viot",
17490
+ "virviken",
17491
+ "viskoazh",
17492
+ "vlan",
17493
+ "vlaou",
17494
+ "vo",
17495
+ "vod",
17496
+ "voe",
17497
+ "voec'h",
17498
+ "voed",
17499
+ "voemp",
17500
+ "voen",
17501
+ "voent",
17502
+ "voes",
17503
+ "vont",
17504
+ "vostapl",
17505
+ "vrac'h",
17506
+ "vrasañ",
17507
+ "vremañ",
17508
+ "w:",
17509
+ "walc'h",
17510
+ "war",
17511
+ "warnañ",
17512
+ "warni",
17513
+ "warno",
17514
+ "warnoc'h",
17515
+ "warnomp",
17516
+ "warnon",
17517
+ "warnor",
17518
+ "warnout",
17519
+ "wazh",
17520
+ "wech",
17521
+ "wechoù",
17522
+ "well",
17523
+ "y:",
17524
+ "you",
17525
+ "youadenn",
17526
+ "youc'hadenn",
17527
+ "youc'hou",
17528
+ "z:",
17529
+ "za",
17530
+ "zan",
17531
+ "zaw",
17532
+ "zeu",
17533
+ "zi",
17534
+ "ziar",
17535
+ "zigarez",
17536
+ "ziget",
17537
+ "zindan",
17538
+ "zioc'h",
17539
+ "ziouzh",
17540
+ "zirak",
17541
+ "zivout",
17542
+ "ziwar",
17543
+ "ziwezhañ",
17544
+ "zo",
17545
+ "zoken",
17546
+ "zokenoc'h",
17547
+ "zouesk",
17548
+ "zouez",
17549
+ "zro",
17550
+ "zu"
16469
17551
  ];
16470
17552
  const bul = [
16471
17553
  "а",
@@ -28121,22 +29203,32 @@ const tur = [
28121
29203
  "şöyle"
28122
29204
  ];
28123
29205
  const ukr = [
29206
+ "а",
29207
+ "або",
28124
29208
  "авжеж",
28125
29209
  "адже",
29210
+ "аж",
28126
29211
  "але",
29212
+ "ані",
28127
29213
  "б",
28128
29214
  "без",
29215
+ "би",
29216
+ "бо",
28129
29217
  "був",
28130
29218
  "була",
28131
29219
  "були",
28132
29220
  "було",
28133
29221
  "бути",
28134
29222
  "більш",
29223
+ "в",
28135
29224
  "вам",
29225
+ "вами",
28136
29226
  "вас",
28137
29227
  "весь",
29228
+ "вже",
28138
29229
  "вздовж",
28139
29230
  "ви",
29231
+ "від",
28140
29232
  "вниз",
28141
29233
  "внизу",
28142
29234
  "вона",
@@ -28145,55 +29237,138 @@ const ukr = [
28145
29237
  "все",
28146
29238
  "всередині",
28147
29239
  "всіх",
29240
+ "вся",
28148
29241
  "від",
28149
29242
  "він",
28150
29243
  "да",
28151
29244
  "давай",
28152
29245
  "давати",
28153
29246
  "де",
29247
+ "десь",
28154
29248
  "дещо",
28155
29249
  "для",
28156
29250
  "до",
29251
+ "є",
29252
+ "ж",
29253
+ "же",
28157
29254
  "з",
29255
+ "за",
28158
29256
  "завжди",
28159
29257
  "замість",
29258
+ "зі",
29259
+ "і",
29260
+ "із",
29261
+ "інших",
29262
+ "її",
29263
+ "їй",
29264
+ "їм",
29265
+ "їх",
28160
29266
  "й",
29267
+ "його",
29268
+ "йому",
28161
29269
  "коли",
28162
29270
  "ледве",
29271
+ "лиш",
28163
29272
  "майже",
29273
+ "мене",
29274
+ "мені",
28164
29275
  "ми",
29276
+ "між",
29277
+ "мій",
29278
+ "мною",
29279
+ "мов",
29280
+ "мого",
29281
+ "моєї",
29282
+ "моє",
29283
+ "може",
29284
+ "мої",
29285
+ "моїх",
29286
+ "моя",
29287
+ "на",
29288
+ "над",
28165
29289
  "навколо",
28166
29290
  "навіть",
28167
29291
  "нам",
29292
+ "нами",
29293
+ "нас",
29294
+ "наче",
29295
+ "наш",
29296
+ "не",
29297
+ "нє",
29298
+ "неї",
29299
+ "нема",
29300
+ "немов",
29301
+ "неначе",
29302
+ "нею",
29303
+ "ним",
29304
+ "ними",
29305
+ "них",
29306
+ "ні",
29307
+ "ніби",
29308
+ "ніщо",
29309
+ "нього",
29310
+ "о",
29311
+ "ось",
28168
29312
  "от",
28169
29313
  "отже",
28170
29314
  "отож",
29315
+ "під",
29316
+ "по",
28171
29317
  "поза",
28172
29318
  "про",
28173
29319
  "під",
29320
+ "сам",
29321
+ "сама",
29322
+ "свій",
29323
+ "свої",
29324
+ "своя",
29325
+ "свою",
29326
+ "себе",
29327
+ "собі",
28174
29328
  "та",
29329
+ "там",
28175
29330
  "так",
29331
+ "така",
28176
29332
  "такий",
28177
29333
  "також",
29334
+ "твій",
29335
+ "твого",
29336
+ "твоєї",
29337
+ "твої",
29338
+ "твоя",
28178
29339
  "те",
29340
+ "тебе",
28179
29341
  "ти",
29342
+ "ті",
29343
+ "тільки",
29344
+ "то",
29345
+ "тобі",
29346
+ "тобою",
28180
29347
  "тобто",
29348
+ "тоді",
28181
29349
  "тож",
29350
+ "той",
28182
29351
  "тощо",
29352
+ "тут",
29353
+ "у",
29354
+ "хіба",
29355
+ "хоч",
28183
29356
  "хоча",
28184
29357
  "це",
28185
29358
  "цей",
29359
+ "ці",
29360
+ "ця",
28186
29361
  "чи",
28187
29362
  "чого",
29363
+ "ще",
28188
29364
  "що",
29365
+ "щоб",
29366
+ "щось",
29367
+ "я",
28189
29368
  "як",
29369
+ "яка",
28190
29370
  "який",
28191
- "якої",
28192
- "є",
28193
- "із",
28194
- "інших",
28195
- "їх",
28196
- "її"
29371
+ "якої"
28197
29372
  ];
28198
29373
  const urd = [
28199
29374
  "آئی",
@@ -29191,7 +30366,14 @@ const TINA_LOGIN_EVENT = "tinaCloudLogin";
29191
30366
  const AUTH_TOKEN_KEY = "tinacms-auth";
29192
30367
  const authenticate = (clientId, frontendUrl) => {
29193
30368
  return new Promise((resolve) => {
29194
- let authTab;
30369
+ const origin = `${window.location.protocol}//${window.location.host}`;
30370
+ const authTab = popupWindow(
30371
+ `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
30372
+ "_blank",
30373
+ window,
30374
+ 1e3,
30375
+ 700
30376
+ );
29195
30377
  window.addEventListener("message", function(e) {
29196
30378
  if (e.data.source === TINA_LOGIN_EVENT) {
29197
30379
  if (authTab) {
@@ -29204,14 +30386,6 @@ const authenticate = (clientId, frontendUrl) => {
29204
30386
  });
29205
30387
  }
29206
30388
  });
29207
- const origin = `${window.location.protocol}//${window.location.host}`;
29208
- authTab = popupWindow(
29209
- `${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
29210
- "_blank",
29211
- window,
29212
- 1e3,
29213
- 700
29214
- );
29215
30389
  });
29216
30390
  };
29217
30391
  const DefaultSessionProvider = ({
@@ -29917,21 +31091,352 @@ const AsyncButton = ({ name, primary, action }) => {
29917
31091
  !submitting && name
29918
31092
  );
29919
31093
  };
29920
- const TINA_AUTH_CONFIG = "tina_auth_config";
29921
- const useTinaAuthRedirect = () => {
29922
- useEffect(() => {
29923
- const urlParams = new URLSearchParams(window.location.search);
29924
- const config = {
29925
- code: urlParams.get("code") || "",
29926
- scope: urlParams.get("scope") || "email",
29927
- state: urlParams.get("state")
29928
- };
29929
- if (!config.code) {
29930
- return;
31094
+ class TinaAdminApi {
31095
+ constructor(cms) {
31096
+ var _a, _b, _c, _d;
31097
+ this.maxSearchIndexFieldLength = 100;
31098
+ this.api = cms.api.tina;
31099
+ this.schema = cms.api.tina.schema;
31100
+ if (cms.api.search && ((_a = cms.api.search) == null ? void 0 : _a.supportsClientSideIndexing())) {
31101
+ this.searchClient = cms.api.searchClient;
31102
+ this.maxSearchIndexFieldLength = ((_d = (_c = (_b = this.schema.config) == null ? void 0 : _b.config) == null ? void 0 : _c.search) == null ? void 0 : _d.maxSearchIndexFieldLength) || 100;
29931
31103
  }
29932
- localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
29933
- }, []);
29934
- };
31104
+ }
31105
+ async isAuthenticated() {
31106
+ return await this.api.authProvider.isAuthenticated();
31107
+ }
31108
+ async checkGraphqlSchema({ localSchema }) {
31109
+ const schemaFromCloud = await this.api.getSchema();
31110
+ const schema1 = schemaFromCloud;
31111
+ const schema2 = buildSchema(print(localSchema));
31112
+ const diffOutput = await diff(schema1, schema2);
31113
+ if (diffOutput.length > 0) {
31114
+ return false;
31115
+ } else {
31116
+ return true;
31117
+ }
31118
+ }
31119
+ fetchCollections() {
31120
+ return this.schema.getCollections();
31121
+ }
31122
+ async renameDocument({ collection, relativePath: relativePath2, newRelativePath }) {
31123
+ await this.api.request(
31124
+ `#graphql
31125
+ mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
31126
+ updateDocument(collection: $collection, relativePath: $relativePath, params: {relativePath: $newRelativePath}){
31127
+ __typename
31128
+ }
31129
+ }
31130
+ `,
31131
+ { variables: { collection, relativePath: relativePath2, newRelativePath } }
31132
+ );
31133
+ if (this.searchClient) {
31134
+ const { document: doc } = await this.fetchDocument(
31135
+ collection.name,
31136
+ newRelativePath
31137
+ );
31138
+ const processed = processDocumentForIndexing(
31139
+ doc["_values"],
31140
+ `${collection.path}/${newRelativePath}`,
31141
+ collection,
31142
+ this.maxSearchIndexFieldLength
31143
+ );
31144
+ await this.searchClient.put([processed]);
31145
+ await this.searchClient.del([`${collection.name}:${relativePath2}`]);
31146
+ }
31147
+ }
31148
+ async deleteDocument({
31149
+ collection,
31150
+ relativePath: relativePath2
31151
+ }) {
31152
+ var _a;
31153
+ await this.api.request(
31154
+ `#graphql
31155
+ mutation DeleteDocument($collection: String!, $relativePath: String! ){
31156
+ deleteDocument(collection: $collection, relativePath: $relativePath){
31157
+ __typename
31158
+ }
31159
+ }`,
31160
+ { variables: { collection, relativePath: relativePath2 } }
31161
+ );
31162
+ await ((_a = this.searchClient) == null ? void 0 : _a.del([`${collection}:${relativePath2}`]));
31163
+ }
31164
+ async fetchCollection(collectionName, includeDocuments, folder = "", after, sortKey, order, filterArgs) {
31165
+ let filter = null;
31166
+ const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
31167
+ if (filterField) {
31168
+ filter = {
31169
+ [collectionName]: {
31170
+ [filterField]: {}
31171
+ }
31172
+ };
31173
+ }
31174
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
31175
+ filter[collectionName][filterField] = {
31176
+ ...filter[collectionName][filterField] || {},
31177
+ startsWith: filterArgs.startsWith
31178
+ };
31179
+ }
31180
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
31181
+ filter[collectionName][filterField] = {
31182
+ ...filter[collectionName][filterField] || {},
31183
+ before: filterArgs.before
31184
+ };
31185
+ }
31186
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
31187
+ filter[collectionName][filterField] = {
31188
+ ...filter[collectionName][filterField] || {},
31189
+ after: filterArgs.after
31190
+ };
31191
+ }
31192
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
31193
+ filter[collectionName][filterField] = {
31194
+ ...filter[collectionName][filterField] || {},
31195
+ eq: filterArgs.booleanEquals
31196
+ };
31197
+ }
31198
+ if (includeDocuments === true) {
31199
+ const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
31200
+ const response = order === "asc" ? await this.api.request(
31201
+ `#graphql
31202
+ query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String){
31203
+ collection(collection: $collection){
31204
+ name
31205
+ label
31206
+ format
31207
+ templates
31208
+ documents(sort: $sort, after: $after, first: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
31209
+ totalCount
31210
+ pageInfo {
31211
+ hasPreviousPage
31212
+ hasNextPage
31213
+ startCursor
31214
+ endCursor
31215
+ }
31216
+ edges {
31217
+ node {
31218
+ __typename
31219
+ ... on Folder {
31220
+ name
31221
+ path
31222
+ }
31223
+ ... on Document {
31224
+ _sys {
31225
+ title
31226
+ template
31227
+ breadcrumbs
31228
+ path
31229
+ basename
31230
+ relativePath
31231
+ filename
31232
+ extension
31233
+ hasReferences
31234
+ }
31235
+ }
31236
+ }
31237
+ }
31238
+ }
31239
+ }
31240
+ }`,
31241
+ {
31242
+ variables: {
31243
+ collection: collectionName,
31244
+ includeDocuments,
31245
+ folder,
31246
+ sort,
31247
+ limit: 50,
31248
+ after,
31249
+ filter
31250
+ }
31251
+ }
31252
+ ) : await this.api.request(
31253
+ `#graphql
31254
+ query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String) {
31255
+ collection(collection: $collection){
31256
+ name
31257
+ label
31258
+ format
31259
+ templates
31260
+ documents(sort: $sort, before: $after, last: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
31261
+ totalCount
31262
+ pageInfo {
31263
+ hasPreviousPage
31264
+ hasNextPage
31265
+ startCursor
31266
+ endCursor
31267
+ }
31268
+ edges {
31269
+ node {
31270
+ __typename
31271
+ ... on Folder {
31272
+ name
31273
+ path
31274
+ }
31275
+ ... on Document {
31276
+ _sys {
31277
+ title
31278
+ template
31279
+ breadcrumbs
31280
+ path
31281
+ basename
31282
+ relativePath
31283
+ filename
31284
+ extension
31285
+ }
31286
+ }
31287
+ }
31288
+ }
31289
+ }
31290
+ }
31291
+ }`,
31292
+ {
31293
+ variables: {
31294
+ collection: collectionName,
31295
+ includeDocuments,
31296
+ folder,
31297
+ sort,
31298
+ limit: 50,
31299
+ after,
31300
+ filter
31301
+ }
31302
+ }
31303
+ );
31304
+ return response.collection;
31305
+ } else {
31306
+ try {
31307
+ const collection = this.schema.getCollection(collectionName);
31308
+ return collection;
31309
+ } catch (e) {
31310
+ console.error(
31311
+ `[TinaAdminAPI] Unable to fetchCollection(): ${e.message}`
31312
+ );
31313
+ return void 0;
31314
+ }
31315
+ }
31316
+ }
31317
+ async fetchDocument(collectionName, relativePath2, values = true) {
31318
+ let query;
31319
+ if (values) {
31320
+ query = `#graphql
31321
+ query($collection: String!, $relativePath: String!) {
31322
+ document(collection:$collection, relativePath:$relativePath) {
31323
+ ... on Document {
31324
+ _values
31325
+ _sys {
31326
+ hasReferences
31327
+ }
31328
+ }
31329
+ }
31330
+ }`;
31331
+ } else {
31332
+ query = `#graphql
31333
+ query($collection: String!, $relativePath: String!) {
31334
+ document(collection:$collection, relativePath:$relativePath) {
31335
+ __typename
31336
+ ... on Document {
31337
+ _sys {
31338
+ title
31339
+ template
31340
+ breadcrumbs
31341
+ path
31342
+ basename
31343
+ relativePath
31344
+ filename
31345
+ extension
31346
+ }
31347
+ }
31348
+ }
31349
+ }`;
31350
+ }
31351
+ const response = await this.api.request(query, {
31352
+ variables: { collection: collectionName, relativePath: relativePath2 }
31353
+ });
31354
+ return response;
31355
+ }
31356
+ async createDocument(collection, relativePath2, params) {
31357
+ const response = await this.api.request(
31358
+ `#graphql
31359
+ mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
31360
+ createDocument(
31361
+ collection: $collection,
31362
+ relativePath: $relativePath,
31363
+ params: $params
31364
+ ){__typename}
31365
+ }`,
31366
+ {
31367
+ variables: {
31368
+ collection: collection.name,
31369
+ relativePath: relativePath2,
31370
+ params
31371
+ }
31372
+ }
31373
+ );
31374
+ if (this.searchClient) {
31375
+ const { document: doc } = await this.fetchDocument(
31376
+ collection.name,
31377
+ relativePath2
31378
+ );
31379
+ const processed = processDocumentForIndexing(
31380
+ doc["_values"],
31381
+ `${collection.path}/${relativePath2}`,
31382
+ collection,
31383
+ this.maxSearchIndexFieldLength
31384
+ );
31385
+ await this.searchClient.put([processed]);
31386
+ }
31387
+ return response;
31388
+ }
31389
+ async updateDocument(collection, relativePath2, params) {
31390
+ const response = await this.api.request(
31391
+ `#graphql
31392
+ mutation($collection: String!, $relativePath: String!, $params: DocumentUpdateMutation!) {
31393
+ updateDocument(
31394
+ collection: $collection,
31395
+ relativePath: $relativePath,
31396
+ params: $params
31397
+ ){__typename}
31398
+ }`,
31399
+ {
31400
+ variables: {
31401
+ collection: collection.name,
31402
+ relativePath: relativePath2,
31403
+ params
31404
+ }
31405
+ }
31406
+ );
31407
+ if (this.searchClient) {
31408
+ const { document: doc } = await this.fetchDocument(
31409
+ collection.name,
31410
+ relativePath2
31411
+ );
31412
+ const processed = processDocumentForIndexing(
31413
+ doc["_values"],
31414
+ `${collection.path}/${relativePath2}`,
31415
+ collection,
31416
+ this.maxSearchIndexFieldLength
31417
+ );
31418
+ await this.searchClient.put([processed]);
31419
+ }
31420
+ return response;
31421
+ }
31422
+ async createFolder(collection, folderName) {
31423
+ return this.api.request(
31424
+ `#graphql
31425
+ mutation($collection: String!, $folderName: String!) {
31426
+ createFolder(
31427
+ collection: $collection,
31428
+ relativePath: $folderName
31429
+ ){__typename}
31430
+ }`,
31431
+ {
31432
+ variables: {
31433
+ collection,
31434
+ folderName
31435
+ }
31436
+ }
31437
+ );
31438
+ }
31439
+ }
29935
31440
  const createClient = ({
29936
31441
  clientId,
29937
31442
  isLocalClient = true,
@@ -29967,348 +31472,21 @@ function safeAssertShape(value, yupSchema) {
29967
31472
  return false;
29968
31473
  }
29969
31474
  }
29970
- class TinaAdminApi {
29971
- constructor(cms) {
29972
- var _a, _b, _c, _d;
29973
- this.maxSearchIndexFieldLength = 100;
29974
- this.api = cms.api.tina;
29975
- this.schema = cms.api.tina.schema;
29976
- if (cms.api.search && ((_a = cms.api.search) == null ? void 0 : _a.supportsClientSideIndexing())) {
29977
- this.searchClient = cms.api.searchClient;
29978
- this.maxSearchIndexFieldLength = ((_d = (_c = (_b = this.schema.config) == null ? void 0 : _b.config) == null ? void 0 : _c.search) == null ? void 0 : _d.maxSearchIndexFieldLength) || 100;
29979
- }
29980
- }
29981
- async isAuthenticated() {
29982
- return await this.api.authProvider.isAuthenticated();
29983
- }
29984
- async checkGraphqlSchema({ localSchema }) {
29985
- const schemaFromCloud = await this.api.getSchema();
29986
- const schema1 = schemaFromCloud;
29987
- const schema2 = buildSchema(print(localSchema));
29988
- const diffOutput = await diff(schema1, schema2);
29989
- if (diffOutput.length > 0) {
29990
- return false;
29991
- } else {
29992
- return true;
29993
- }
29994
- }
29995
- fetchCollections() {
29996
- return this.schema.getCollections();
29997
- }
29998
- async renameDocument({ collection, relativePath: relativePath2, newRelativePath }) {
29999
- await this.api.request(
30000
- `#graphql
30001
- mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
30002
- updateDocument(collection: $collection, relativePath: $relativePath, params: {relativePath: $newRelativePath}){
30003
- __typename
30004
- }
30005
- }
30006
- `,
30007
- { variables: { collection, relativePath: relativePath2, newRelativePath } }
30008
- );
30009
- if (this.searchClient) {
30010
- const { document: doc } = await this.fetchDocument(
30011
- collection.name,
30012
- newRelativePath
30013
- );
30014
- const processed = processDocumentForIndexing(
30015
- doc["_values"],
30016
- `${collection.path}/${newRelativePath}`,
30017
- collection,
30018
- this.maxSearchIndexFieldLength
30019
- );
30020
- await this.searchClient.put([processed]);
30021
- await this.searchClient.del([`${collection.name}:${relativePath2}`]);
30022
- }
30023
- }
30024
- async deleteDocument({
30025
- collection,
30026
- relativePath: relativePath2
30027
- }) {
30028
- var _a;
30029
- await this.api.request(
30030
- `#graphql
30031
- mutation DeleteDocument($collection: String!, $relativePath: String! ){
30032
- deleteDocument(collection: $collection, relativePath: $relativePath){
30033
- __typename
30034
- }
30035
- }`,
30036
- { variables: { collection, relativePath: relativePath2 } }
30037
- );
30038
- await ((_a = this.searchClient) == null ? void 0 : _a.del([`${collection}:${relativePath2}`]));
30039
- }
30040
- async fetchCollection(collectionName, includeDocuments, folder = "", after, sortKey, order, filterArgs) {
30041
- let filter = null;
30042
- const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
30043
- if (filterField) {
30044
- filter = {
30045
- [collectionName]: {
30046
- [filterField]: {}
30047
- }
30048
- };
30049
- }
30050
- if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
30051
- filter[collectionName][filterField] = {
30052
- ...filter[collectionName][filterField] || {},
30053
- startsWith: filterArgs.startsWith
30054
- };
30055
- }
30056
- if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
30057
- filter[collectionName][filterField] = {
30058
- ...filter[collectionName][filterField] || {},
30059
- before: filterArgs.before
30060
- };
30061
- }
30062
- if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
30063
- filter[collectionName][filterField] = {
30064
- ...filter[collectionName][filterField] || {},
30065
- after: filterArgs.after
30066
- };
30067
- }
30068
- if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
30069
- filter[collectionName][filterField] = {
30070
- ...filter[collectionName][filterField] || {},
30071
- eq: filterArgs.booleanEquals
30072
- };
30073
- }
30074
- if (includeDocuments === true) {
30075
- const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
30076
- const response = order === "asc" ? await this.api.request(
30077
- `#graphql
30078
- query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String){
30079
- collection(collection: $collection){
30080
- name
30081
- label
30082
- format
30083
- templates
30084
- documents(sort: $sort, after: $after, first: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
30085
- totalCount
30086
- pageInfo {
30087
- hasPreviousPage
30088
- hasNextPage
30089
- startCursor
30090
- endCursor
30091
- }
30092
- edges {
30093
- node {
30094
- __typename
30095
- ... on Folder {
30096
- name
30097
- path
30098
- }
30099
- ... on Document {
30100
- _sys {
30101
- title
30102
- template
30103
- breadcrumbs
30104
- path
30105
- basename
30106
- relativePath
30107
- filename
30108
- extension
30109
- }
30110
- }
30111
- }
30112
- }
30113
- }
30114
- }
30115
- }`,
30116
- {
30117
- variables: {
30118
- collection: collectionName,
30119
- includeDocuments,
30120
- folder,
30121
- sort,
30122
- limit: 50,
30123
- after,
30124
- filter
30125
- }
30126
- }
30127
- ) : await this.api.request(
30128
- `#graphql
30129
- query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String) {
30130
- collection(collection: $collection){
30131
- name
30132
- label
30133
- format
30134
- templates
30135
- documents(sort: $sort, before: $after, last: $limit, filter: $filter, folder: $folder) @include(if: $includeDocuments) {
30136
- totalCount
30137
- pageInfo {
30138
- hasPreviousPage
30139
- hasNextPage
30140
- startCursor
30141
- endCursor
30142
- }
30143
- edges {
30144
- node {
30145
- __typename
30146
- ... on Folder {
30147
- name
30148
- path
30149
- }
30150
- ... on Document {
30151
- _sys {
30152
- title
30153
- template
30154
- breadcrumbs
30155
- path
30156
- basename
30157
- relativePath
30158
- filename
30159
- extension
30160
- }
30161
- }
30162
- }
30163
- }
30164
- }
30165
- }
30166
- }`,
30167
- {
30168
- variables: {
30169
- collection: collectionName,
30170
- includeDocuments,
30171
- folder,
30172
- sort,
30173
- limit: 50,
30174
- after,
30175
- filter
30176
- }
30177
- }
30178
- );
30179
- return response.collection;
30180
- } else {
30181
- try {
30182
- const collection = this.schema.getCollection(collectionName);
30183
- return collection;
30184
- } catch (e) {
30185
- console.error(
30186
- `[TinaAdminAPI] Unable to fetchCollection(): ${e.message}`
30187
- );
30188
- return void 0;
30189
- }
30190
- }
30191
- }
30192
- async fetchDocument(collectionName, relativePath2, values = true) {
30193
- let query;
30194
- if (values) {
30195
- query = `#graphql
30196
- query($collection: String!, $relativePath: String!) {
30197
- document(collection:$collection, relativePath:$relativePath) {
30198
- ... on Document {
30199
- _values
30200
- }
30201
- }
30202
- }`;
30203
- } else {
30204
- query = `#graphql
30205
- query($collection: String!, $relativePath: String!) {
30206
- document(collection:$collection, relativePath:$relativePath) {
30207
- __typename
30208
- ... on Document {
30209
- _sys {
30210
- title
30211
- template
30212
- breadcrumbs
30213
- path
30214
- basename
30215
- relativePath
30216
- filename
30217
- extension
30218
- }
30219
- }
30220
- }
30221
- }`;
30222
- }
30223
- const response = await this.api.request(query, {
30224
- variables: { collection: collectionName, relativePath: relativePath2 }
30225
- });
30226
- return response;
30227
- }
30228
- async createDocument(collection, relativePath2, params) {
30229
- const response = await this.api.request(
30230
- `#graphql
30231
- mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
30232
- createDocument(
30233
- collection: $collection,
30234
- relativePath: $relativePath,
30235
- params: $params
30236
- ){__typename}
30237
- }`,
30238
- {
30239
- variables: {
30240
- collection: collection.name,
30241
- relativePath: relativePath2,
30242
- params
30243
- }
30244
- }
30245
- );
30246
- if (this.searchClient) {
30247
- const { document: doc } = await this.fetchDocument(
30248
- collection.name,
30249
- relativePath2
30250
- );
30251
- const processed = processDocumentForIndexing(
30252
- doc["_values"],
30253
- `${collection.path}/${relativePath2}`,
30254
- collection,
30255
- this.maxSearchIndexFieldLength
30256
- );
30257
- await this.searchClient.put([processed]);
30258
- }
30259
- return response;
30260
- }
30261
- async updateDocument(collection, relativePath2, params) {
30262
- const response = await this.api.request(
30263
- `#graphql
30264
- mutation($collection: String!, $relativePath: String!, $params: DocumentUpdateMutation!) {
30265
- updateDocument(
30266
- collection: $collection,
30267
- relativePath: $relativePath,
30268
- params: $params
30269
- ){__typename}
30270
- }`,
30271
- {
30272
- variables: {
30273
- collection: collection.name,
30274
- relativePath: relativePath2,
30275
- params
30276
- }
30277
- }
30278
- );
30279
- if (this.searchClient) {
30280
- const { document: doc } = await this.fetchDocument(
30281
- collection.name,
30282
- relativePath2
30283
- );
30284
- const processed = processDocumentForIndexing(
30285
- doc["_values"],
30286
- `${collection.path}/${relativePath2}`,
30287
- collection,
30288
- this.maxSearchIndexFieldLength
30289
- );
30290
- await this.searchClient.put([processed]);
31475
+ const TINA_AUTH_CONFIG = "tina_auth_config";
31476
+ const useTinaAuthRedirect = () => {
31477
+ useEffect(() => {
31478
+ const urlParams = new URLSearchParams(window.location.search);
31479
+ const config = {
31480
+ code: urlParams.get("code") || "",
31481
+ scope: urlParams.get("scope") || "email",
31482
+ state: urlParams.get("state")
31483
+ };
31484
+ if (!config.code) {
31485
+ return;
30291
31486
  }
30292
- return response;
30293
- }
30294
- async createFolder(collection, folderName) {
30295
- return this.api.request(
30296
- `#graphql
30297
- mutation($collection: String!, $folderName: String!) {
30298
- createFolder(
30299
- collection: $collection,
30300
- relativePath: $folderName
30301
- ){__typename}
30302
- }`,
30303
- {
30304
- variables: {
30305
- collection,
30306
- folderName
30307
- }
30308
- }
30309
- );
30310
- }
30311
- }
31487
+ localStorage[TINA_AUTH_CONFIG] = JSON.stringify(config);
31488
+ }, []);
31489
+ };
30312
31490
  function sleep(ms) {
30313
31491
  return new Promise((resolve) => setTimeout(resolve, ms));
30314
31492
  }
@@ -30645,6 +31823,9 @@ const TinaCloudProvider = (props) => {
30645
31823
  cms.flags.set("branch-switcher", true);
30646
31824
  client.usingEditorialWorkflow = true;
30647
31825
  client.protectedBranches = project.protectedBranches;
31826
+ if (!project.metadata[currentBranch]) {
31827
+ setCurrentBranch(project.defaultBranch || "main");
31828
+ }
30648
31829
  }
30649
31830
  });
30650
31831
  };
@@ -30657,7 +31838,7 @@ const TinaCloudProvider = (props) => {
30657
31838
  }
30658
31839
  });
30659
31840
  return unsubscribe;
30660
- }, [isTinaCloud, cms]);
31841
+ }, [currentBranch, isTinaCloud, cms]);
30661
31842
  return /* @__PURE__ */ React__default.createElement(SessionProvider, { basePath: "/api/tina/auth" }, /* @__PURE__ */ React__default.createElement(
30662
31843
  BranchDataProvider,
30663
31844
  {
@@ -31510,6 +32691,35 @@ const FullscreenError = ({
31510
32691
  }) => {
31511
32692
  return /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React__default.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React__default.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React__default.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React__default.createElement(Button$1, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React__default.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
31512
32693
  };
32694
+ const isValidSortKey = (sortKey, collection) => {
32695
+ if (collection.fields) {
32696
+ const sortKeys = collection.fields.map((x) => x.name);
32697
+ return sortKeys.includes(sortKey);
32698
+ } else if (collection.templates) {
32699
+ const collectionMap = {};
32700
+ const conflictedFields = /* @__PURE__ */ new Set();
32701
+ for (const template of collection.templates) {
32702
+ for (const field of template.fields) {
32703
+ if (collectionMap[field.name]) {
32704
+ if (collectionMap[field.name].type !== field.type) {
32705
+ conflictedFields.add(field.name);
32706
+ }
32707
+ } else {
32708
+ collectionMap[field.name] = field;
32709
+ }
32710
+ }
32711
+ }
32712
+ for (const key in conflictedFields) {
32713
+ delete collectionMap[key];
32714
+ }
32715
+ for (const key in collectionMap) {
32716
+ if (key === sortKey) {
32717
+ return true;
32718
+ }
32719
+ }
32720
+ return false;
32721
+ }
32722
+ };
31513
32723
  const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
31514
32724
  const api = new TinaAdminApi(cms);
31515
32725
  const schema = cms.api.tina.schema;
@@ -31521,10 +32731,9 @@ const useGetCollection = (cms, collectionName, includeDocuments = true, folder,
31521
32731
  useEffect(() => {
31522
32732
  let cancelled = false;
31523
32733
  const fetchCollection = async () => {
31524
- var _a;
31525
32734
  if (await api.isAuthenticated() && !folder.loading && !cancelled) {
31526
32735
  const { name, order } = JSON.parse(sortKey || "{}");
31527
- const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
32736
+ const validSortKey = isValidSortKey(name, collectionExtra) ? name : void 0;
31528
32737
  try {
31529
32738
  const collection2 = await api.fetchCollection(
31530
32739
  collectionName,
@@ -31820,6 +33029,7 @@ const CollectionListPage = () => {
31820
33029
  const [vars, setVars] = React__default.useState({
31821
33030
  collection: collectionName,
31822
33031
  relativePath: "",
33032
+ relativePathWithoutExtension: "",
31823
33033
  newRelativePath: "",
31824
33034
  filterField: "",
31825
33035
  folderName: "",
@@ -31861,6 +33071,7 @@ const CollectionListPage = () => {
31861
33071
  ...old,
31862
33072
  collection: collectionName,
31863
33073
  relativePath: "",
33074
+ relativePathWithoutExtension: "",
31864
33075
  newRelativePath: "",
31865
33076
  filterField: "",
31866
33077
  startsWith: "",
@@ -31886,6 +33097,7 @@ const CollectionListPage = () => {
31886
33097
  collectionName === vars.collection ? vars : {
31887
33098
  collection: collectionName,
31888
33099
  relativePath: "",
33100
+ relativePathWithoutExtension: "",
31889
33101
  newRelativePath: "",
31890
33102
  filterField: "",
31891
33103
  startsWith: "",
@@ -31923,6 +33135,23 @@ const CollectionListPage = () => {
31923
33135
  DeleteModal,
31924
33136
  {
31925
33137
  filename: vars.relativePath,
33138
+ checkRefsFunc: async () => {
33139
+ var _a2, _b2;
33140
+ try {
33141
+ const doc = await admin.fetchDocument(
33142
+ collection.name,
33143
+ vars.relativePath,
33144
+ true
33145
+ );
33146
+ return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
33147
+ } catch (error) {
33148
+ cms.alerts.error(
33149
+ "Document was not found, ask a developer for help or check the console for an error message"
33150
+ );
33151
+ console.error(error);
33152
+ throw error;
33153
+ }
33154
+ },
31926
33155
  deleteFunc: async () => {
31927
33156
  try {
31928
33157
  await admin.deleteDocument(vars);
@@ -31931,6 +33160,12 @@ const CollectionListPage = () => {
31931
33160
  );
31932
33161
  reFetchCollection();
31933
33162
  } catch (error) {
33163
+ if (error.message.indexOf("has references")) {
33164
+ cms.alerts.error(
33165
+ error.message.split("\n ").filter(Boolean)[1]
33166
+ );
33167
+ return;
33168
+ }
31934
33169
  cms.alerts.warn(
31935
33170
  "Document was not deleted, ask a developer for help or check the console for an error message"
31936
33171
  );
@@ -31950,7 +33185,9 @@ const CollectionListPage = () => {
31950
33185
  safeSubmit: async () => {
31951
33186
  try {
31952
33187
  await admin.deleteDocument(vars);
31953
- cms.alerts.info("Document was successfully deleted");
33188
+ cms.alerts.info(
33189
+ "Document was successfully deleted"
33190
+ );
31954
33191
  reFetchCollection();
31955
33192
  } catch (error) {
31956
33193
  cms.alerts.warn(
@@ -31964,7 +33201,7 @@ const CollectionListPage = () => {
31964
33201
  ), renameModalOpen && /* @__PURE__ */ React__default.createElement(
31965
33202
  RenameModal,
31966
33203
  {
31967
- filename: vars.relativePath,
33204
+ filename: vars.relativePathWithoutExtension,
31968
33205
  newRelativePath: vars.newRelativePath,
31969
33206
  setNewRelativePath: (newRelativePath) => {
31970
33207
  setVars((vars2) => {
@@ -31979,9 +33216,17 @@ const CollectionListPage = () => {
31979
33216
  relativePath: vars.relativePath,
31980
33217
  newRelativePath
31981
33218
  });
31982
- cms.alerts.info("Document was successfully renamed");
33219
+ cms.alerts.info(
33220
+ "Document was successfully renamed"
33221
+ );
31983
33222
  reFetchCollection();
31984
33223
  } catch (error) {
33224
+ if (error.message.indexOf("has references")) {
33225
+ cms.alerts.error(
33226
+ error.message.split("\n ").filter(Boolean)[1]
33227
+ );
33228
+ return;
33229
+ }
31985
33230
  cms.alerts.warn(
31986
33231
  "Document was not renamed, ask a developer for help or check the console for an error message"
31987
33232
  );
@@ -32073,7 +33318,9 @@ const CollectionListPage = () => {
32073
33318
  name: "sort",
32074
33319
  value: sortKey,
32075
33320
  onChange: (e) => {
32076
- const val = JSON.parse(e.target.value);
33321
+ const val = JSON.parse(
33322
+ e.target.value
33323
+ );
32077
33324
  setEndCursor("");
32078
33325
  setPrevCursors([]);
32079
33326
  window == null ? void 0 : window.localStorage.setItem(
@@ -32279,6 +33526,9 @@ const CollectionListPage = () => {
32279
33526
  setVars((old) => ({
32280
33527
  ...old,
32281
33528
  collection: collectionName,
33529
+ relativePathWithoutExtension: document2.node._sys.breadcrumbs.join(
33530
+ "/"
33531
+ ),
32282
33532
  relativePath: document2.node._sys.breadcrumbs.join(
32283
33533
  "/"
32284
33534
  ) + document2.node._sys.extension,
@@ -32301,6 +33551,9 @@ const CollectionListPage = () => {
32301
33551
  setVars((old) => ({
32302
33552
  ...old,
32303
33553
  collection: collectionName,
33554
+ relativePathWithoutExtension: document2.node._sys.breadcrumbs.join(
33555
+ "/"
33556
+ ),
32304
33557
  relativePath: document2.node._sys.breadcrumbs.join(
32305
33558
  "/"
32306
33559
  ) + document2.node._sys.extension,
@@ -32455,8 +33708,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
32455
33708
  const NoDocumentsPlaceholder = () => {
32456
33709
  return /* @__PURE__ */ React__default.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__default.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
32457
33710
  };
32458
- const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
32459
- return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
33711
+ const DeleteModal = ({
33712
+ close: close2,
33713
+ deleteFunc,
33714
+ checkRefsFunc,
33715
+ filename
33716
+ }) => {
33717
+ const [hasRefs, setHasRefs] = React__default.useState();
33718
+ useEffect(() => {
33719
+ checkRefsFunc().then((result) => {
33720
+ setHasRefs(result);
33721
+ });
33722
+ }, [filename, checkRefsFunc]);
33723
+ return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
32460
33724
  Button$1,
32461
33725
  {
32462
33726
  style: { flexGrow: 3 },
@@ -32502,7 +33766,7 @@ const RenameModal = ({
32502
33766
  newRelativePath,
32503
33767
  setNewRelativePath
32504
33768
  }) => {
32505
- return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Rename ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("p", { className: "mb-4" }, "Are you sure you want to rename ", /* @__PURE__ */ React__default.createElement("strong", null, filename), "? TinaCMS uses the filename as the ID; renaming this file could result in unresolved references."), /* @__PURE__ */ React__default.createElement(
33769
+ return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Rename ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("p", { className: "mb-4" }, "Are you sure you want to rename ", /* @__PURE__ */ React__default.createElement("strong", null, filename), "?"), /* @__PURE__ */ React__default.createElement(
32506
33770
  BaseTextField,
32507
33771
  {
32508
33772
  placeholder: "Enter a new name for the document's file",
@@ -32517,7 +33781,8 @@ const RenameModal = ({
32517
33781
  onClick: async () => {
32518
33782
  await renameFunc();
32519
33783
  close2();
32520
- }
33784
+ },
33785
+ disabled: !newRelativePath || newRelativePath === filename
32521
33786
  },
32522
33787
  "Rename"
32523
33788
  ))));
@@ -32844,7 +34109,10 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
32844
34109
  const fetchDocument = async () => {
32845
34110
  if (api.isAuthenticated()) {
32846
34111
  try {
32847
- const response = await api.fetchDocument(collectionName, relativePath2);
34112
+ const response = await api.fetchDocument(
34113
+ collectionName,
34114
+ relativePath2
34115
+ );
32848
34116
  setDocument(response.document);
32849
34117
  } catch (error2) {
32850
34118
  cms.alerts.error(
@@ -33188,15 +34456,24 @@ const IndexingPage = () => {
33188
34456
  }
33189
34457
  }
33190
34458
  if (state === "creatingPR") {
33191
- const foo = await tinaApi.createPullRequest({
33192
- baseBranch,
33193
- branch,
33194
- title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
33195
- });
33196
- console.log("PR created", foo);
33197
- cms.alerts.success("Pull request created.");
33198
- localStorage.setItem("tina.createBranchState", "done");
33199
- setState("done");
34459
+ try {
34460
+ const foo = await tinaApi.createPullRequest({
34461
+ baseBranch,
34462
+ branch,
34463
+ title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
34464
+ });
34465
+ console.log("PR created", foo);
34466
+ cms.alerts.success("Pull request created.");
34467
+ localStorage.setItem("tina.createBranchState", "done");
34468
+ setState("done");
34469
+ } catch (e) {
34470
+ console.error(e);
34471
+ cms.alerts.error("Failed to create PR");
34472
+ setErrorMessage(
34473
+ "Failed to create PR, please try again. If the problem persists please contact support."
34474
+ );
34475
+ setState("error");
34476
+ }
33200
34477
  }
33201
34478
  if (state === "done") {
33202
34479
  window.location.href = back;
@@ -33818,5 +35095,6 @@ export {
33818
35095
  useScreenPlugin,
33819
35096
  useTinaAuthRedirect,
33820
35097
  wrapFieldWithError,
35098
+ wrapFieldWithNoHeader,
33821
35099
  wrapFieldsWithMeta
33822
35100
  };