tinacms 0.0.0-f401991-20250801014410 → 0.0.0-f471982-20250804064407

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 (3) hide show
  1. package/dist/index.js +162 -116
  2. package/dist/index.mjs +162 -116
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -28048,7 +28048,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28048
28048
  };
28049
28049
  var useFloatingLinkEnter = () => {
28050
28050
  const editor = useEditorRef();
28051
- const open2 = usePluginOption(LinkPlugin, "isOpen", editor.id);
28051
+ const open = usePluginOption(LinkPlugin, "isOpen", editor.id);
28052
28052
  useHotkeys(
28053
28053
  "*",
28054
28054
  (e3) => {
@@ -28059,7 +28059,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28059
28059
  }
28060
28060
  },
28061
28061
  {
28062
- enabled: open2,
28062
+ enabled: open,
28063
28063
  enableOnFormTags: ["INPUT"]
28064
28064
  },
28065
28065
  []
@@ -28067,7 +28067,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28067
28067
  };
28068
28068
  var useFloatingLinkEscape = () => {
28069
28069
  const { api, editor, getOptions: getOptions2 } = useEditorPlugin(LinkPlugin);
28070
- const open2 = usePluginOption(LinkPlugin, "isOpen", editor.id);
28070
+ const open = usePluginOption(LinkPlugin, "isOpen", editor.id);
28071
28071
  useHotkeys(
28072
28072
  "escape",
28073
28073
  (e3) => {
@@ -28086,7 +28086,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28086
28086
  api.floatingLink.hide();
28087
28087
  },
28088
28088
  {
28089
- enabled: open2,
28089
+ enabled: open,
28090
28090
  enableOnContentEditable: true,
28091
28091
  enableOnFormTags: ["INPUT"]
28092
28092
  },
@@ -28099,7 +28099,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28099
28099
  }) => {
28100
28100
  const { setOption } = useEditorPlugin(LinkPlugin);
28101
28101
  return plateFloating.useVirtualFloating({
28102
- onOpenChange: (open2) => setOption("openEditorId", open2 ? editorId : null),
28102
+ onOpenChange: (open) => setOption("openEditorId", open ? editorId : null),
28103
28103
  ...floatingOptions
28104
28104
  });
28105
28105
  };
@@ -28112,7 +28112,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28112
28112
  const isEditing = usePluginOption(LinkPlugin, "isEditing");
28113
28113
  const version2 = useEditorVersion();
28114
28114
  const mode = usePluginOption(LinkPlugin, "mode");
28115
- const open2 = usePluginOption(LinkPlugin, "isOpen", editor.id);
28115
+ const open = usePluginOption(LinkPlugin, "isOpen", editor.id);
28116
28116
  const getBoundingClientRect = React.useCallback(() => {
28117
28117
  const entry = editor.api.above({
28118
28118
  match: { type }
@@ -28126,7 +28126,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
28126
28126
  }
28127
28127
  return plateFloating.getDOMSelectionBoundingClientRect();
28128
28128
  }, [editor, type]);
28129
- const isOpen = open2 && mode === "edit";
28129
+ const isOpen = open && mode === "edit";
28130
28130
  const floating = useVirtualFloatingLink({
28131
28131
  editorId: editor.id,
28132
28132
  getBoundingClientRect,
@@ -33652,7 +33652,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
33652
33652
  onLanguageChange
33653
33653
  }) {
33654
33654
  var _a2;
33655
- const [open2, setOpen] = React.useState(false);
33655
+ const [open, setOpen] = React.useState(false);
33656
33656
  const readOnly = useReadOnly();
33657
33657
  const element = useElement();
33658
33658
  const value = element.lang || "plaintext";
@@ -33665,7 +33665,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
33665
33665
  );
33666
33666
  if (readOnly)
33667
33667
  return null;
33668
- return /* @__PURE__ */ React.createElement(Popover$2, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger$1, { asChild: true, tabIndex: -1 }, /* @__PURE__ */ React.createElement(
33668
+ return /* @__PURE__ */ React.createElement(Popover$2, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger$1, { asChild: true, tabIndex: -1 }, /* @__PURE__ */ React.createElement(
33669
33669
  Button$2,
33670
33670
  {
33671
33671
  tabIndex: -1,
@@ -33673,9 +33673,9 @@ Please wrap them with useCallback or configure the deps array correctly.`
33673
33673
  className: cn$2.cn(
33674
33674
  "h-6 justify-between gap-1 px-2 text-xs text-muted-foreground select-none",
33675
33675
  "hover:bg-[#E2E8F0] bg-[#F1F5F9] text-[#64748B] hover:text-[#0F172A]",
33676
- open2 && "bg-[#E2E8F0] text-[#0F172A]"
33676
+ open && "bg-[#E2E8F0] text-[#0F172A]"
33677
33677
  ),
33678
- "aria-expanded": open2,
33678
+ "aria-expanded": open,
33679
33679
  role: "combobox"
33680
33680
  },
33681
33681
  ((_a2 = languages.find((language) => language.value === value)) == null ? void 0 : _a2.label) ?? "Plain Text",
@@ -36963,16 +36963,16 @@ Please wrap them with useCallback or configure the deps array correctly.`
36963
36963
  "ml-auto text-xs tracking-widest opacity-60"
36964
36964
  );
36965
36965
  const useOpenState = () => {
36966
- const [open2, setOpen] = React.useState(false);
36966
+ const [open, setOpen] = React.useState(false);
36967
36967
  const onOpenChange = React.useCallback(
36968
- (_value = !open2) => {
36968
+ (_value = !open) => {
36969
36969
  setOpen(_value);
36970
36970
  },
36971
- [open2]
36971
+ [open]
36972
36972
  );
36973
36973
  return {
36974
36974
  onOpenChange,
36975
- open: open2
36975
+ open
36976
36976
  };
36977
36977
  };
36978
36978
  const separatorVariants = classVarianceAuthority.cva("shrink-0 bg-border", {
@@ -37348,7 +37348,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
37348
37348
  );
37349
37349
  });
37350
37350
  function ColorDropdownMenu({ children, tooltip }) {
37351
- const [open2, setOpen] = React.useState(false);
37351
+ const [open, setOpen] = React.useState(false);
37352
37352
  const editor = useEditorRef();
37353
37353
  const selectedCells = usePluginOption(TablePlugin, "selectedCells");
37354
37354
  React.useCallback(
@@ -37365,7 +37365,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
37365
37365
  selectedCells: selectedCells ?? []
37366
37366
  });
37367
37367
  }, [selectedCells, editor]);
37368
- return /* @__PURE__ */ React.createElement(DropdownMenu$1, { open: open2, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger$1, { asChild: true }, /* @__PURE__ */ React.createElement(ToolbarButton, { tooltip }, children)), /* @__PURE__ */ React.createElement(DropdownMenuContent$1, { align: "start" }, /* @__PURE__ */ React.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React.createElement(DropdownMenuItem$1, { className: "p-2", onClick: onClearColor }, /* @__PURE__ */ React.createElement(lucideReact.EraserIcon, null), /* @__PURE__ */ React.createElement("span", null, "Clear")))));
37368
+ return /* @__PURE__ */ React.createElement(DropdownMenu$1, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger$1, { asChild: true }, /* @__PURE__ */ React.createElement(ToolbarButton, { tooltip }, children)), /* @__PURE__ */ React.createElement(DropdownMenuContent$1, { align: "start" }, /* @__PURE__ */ React.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React.createElement(DropdownMenuItem$1, { className: "p-2", onClick: onClearColor }, /* @__PURE__ */ React.createElement(lucideReact.EraserIcon, null), /* @__PURE__ */ React.createElement("span", null, "Clear")))));
37369
37369
  }
37370
37370
  const TableRowElement = cn$2.withRef(
37371
37371
  ({ children, className, ...props }, ref) => {
@@ -39215,7 +39215,8 @@ Please wrap them with useCallback or configure the deps array correctly.`
39215
39215
  return classes.filter(Boolean).join(" ");
39216
39216
  }
39217
39217
  const OverflowMenu$1 = ({ toolbarItems: toolbarItems2, className = "w-full" }) => {
39218
- return /* @__PURE__ */ React.createElement(PopoverPrimitive__namespace.Root, null, /* @__PURE__ */ React.createElement(
39218
+ const [open, setOpen] = React.useState(false);
39219
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, toolbarItems2.length > 0 && /* @__PURE__ */ React.createElement(PopoverPrimitive__namespace.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(
39219
39220
  PopoverPrimitive__namespace.Trigger,
39220
39221
  {
39221
39222
  className: `cursor-pointer relative justify-center inline-flex items-center p-3 text-sm font-medium focus:outline-1 focus:outline-blue-200 pointer-events-auto ${open ? `text-blue-400` : `text-gray-300 hover:text-blue-500`} ${className}}`
@@ -39248,6 +39249,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
39248
39249
  onMouseDown: (event) => {
39249
39250
  event.preventDefault();
39250
39251
  toolbarItem.onMouseDown(event);
39252
+ setOpen(false);
39251
39253
  },
39252
39254
  className: classNames(
39253
39255
  toolbarItem.active ? "bg-gray-50 text-blue-500" : "bg-white text-gray-600",
@@ -39258,7 +39260,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
39258
39260
  " ",
39259
39261
  toolbarItem.label
39260
39262
  );
39261
- })))));
39263
+ }))))));
39262
39264
  };
39263
39265
  function BsArrowRightShort(props) {
39264
39266
  return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8" }, "child": [] }] })(props);
@@ -39678,7 +39680,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
39678
39680
  return node2 ? node2._internalSys.filename : null;
39679
39681
  };
39680
39682
  const Combobox = ({ cms, input, field }) => {
39681
- const [open2, setOpen] = React__namespace.useState(false);
39683
+ const [open, setOpen] = React__namespace.useState(false);
39682
39684
  const [value, setValue] = React__namespace.useState(input.value);
39683
39685
  const [displayText, setDisplayText] = React__namespace.useState(null);
39684
39686
  const { optionSets, loading } = useGetOptionSets(
@@ -39703,16 +39705,16 @@ Please wrap them with useCallback or configure the deps array correctly.`
39703
39705
  if (loading === true) {
39704
39706
  return /* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" });
39705
39707
  }
39706
- return /* @__PURE__ */ React__namespace.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
39708
+ return /* @__PURE__ */ React__namespace.createElement(Popover, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
39707
39709
  Button,
39708
39710
  {
39709
39711
  variant: "outline",
39710
39712
  role: "combobox",
39711
- "aria-expanded": open2,
39713
+ "aria-expanded": open,
39712
39714
  className: "w-full justify-between"
39713
39715
  },
39714
39716
  /* @__PURE__ */ React__namespace.createElement("p", { className: "truncate" }, displayText ?? "Choose an option..."),
39715
- open2 ? /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropdown, { size: 20 })
39717
+ open ? /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React__namespace.createElement(IoMdArrowDropdown, { size: 20 })
39716
39718
  )), /* @__PURE__ */ React__namespace.createElement(PopoverContent, { className: "p-0 relative min-w-[var(--radix-popover-trigger-width)]" }, /* @__PURE__ */ React__namespace.createElement(
39717
39719
  Command,
39718
39720
  {
@@ -40188,12 +40190,12 @@ Please wrap them with useCallback or configure the deps array correctly.`
40188
40190
  return template.label ? template.label.toLowerCase().includes(filter2.toLowerCase()) || name.toLowerCase().includes(filter2.toLowerCase()) : name.toLowerCase().includes(filter2.toLowerCase());
40189
40191
  });
40190
40192
  }, [filter2]);
40191
- return /* @__PURE__ */ React__namespace.createElement(react$1.Popover, null, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react$1.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
40193
+ return /* @__PURE__ */ React__namespace.createElement(react$1.Popover, null, ({ open }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(react$1.PopoverButton, { as: "span" }, /* @__PURE__ */ React__namespace.createElement(
40192
40194
  IconButton,
40193
40195
  {
40194
- variant: open2 ? "secondary" : "primary",
40196
+ variant: open ? "secondary" : "primary",
40195
40197
  size: "small",
40196
- className: `${open2 ? `rotate-45 pointer-events-none` : ``}`
40198
+ className: `${open ? `rotate-45 pointer-events-none` : ``}`
40197
40199
  },
40198
40200
  /* @__PURE__ */ React__namespace.createElement(AddIcon, { className: "w-5/6 h-auto" })
40199
40201
  )), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React__namespace.createElement(
@@ -40474,10 +40476,10 @@ Please wrap them with useCallback or configure the deps array correctly.`
40474
40476
  as: "div",
40475
40477
  className: `left-0 right-0 relative`
40476
40478
  },
40477
- ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
40479
+ ({ open }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
40478
40480
  react$1.DisclosureButton,
40479
40481
  {
40480
- className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
40482
+ className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open || templates.length === 0) && `border-b border-gray-100`}`
40481
40483
  },
40482
40484
  /* @__PURE__ */ React__namespace.createElement(
40483
40485
  "span",
@@ -40489,7 +40491,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
40489
40491
  templates.length > 0 && /* @__PURE__ */ React__namespace.createElement(
40490
40492
  MdKeyboardArrowDown,
40491
40493
  {
40492
- className: `absolute top-1/2 right-0 w-6 h-auto -translate-y-1/2 text-gray-300 origin-center group-hover:text-blue-500 transition-all duration-150 ease-out ${open2 ? `` : `-rotate-90 opacity-70 group-hover:opacity-100`}`
40494
+ className: `absolute top-1/2 right-0 w-6 h-auto -translate-y-1/2 text-gray-300 origin-center group-hover:text-blue-500 transition-all duration-150 ease-out ${open ? `` : `-rotate-90 opacity-70 group-hover:opacity-100`}`
40493
40495
  }
40494
40496
  )
40495
40497
  ), /* @__PURE__ */ React__namespace.createElement(
@@ -42847,6 +42849,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
42847
42849
  {
42848
42850
  currentBranch,
42849
42851
  branchList,
42852
+ refreshBranchList,
42850
42853
  createBranch: () => {
42851
42854
  setViewState("create");
42852
42855
  },
@@ -42935,7 +42938,8 @@ Please wrap them with useCallback or configure the deps array correctly.`
42935
42938
  branchList,
42936
42939
  currentBranch,
42937
42940
  onChange,
42938
- createBranch
42941
+ createBranch,
42942
+ refreshBranchList
42939
42943
  }) => {
42940
42944
  var _a2, _b, _c, _d;
42941
42945
  const [search, setSearch] = React__namespace.useState("");
@@ -43000,67 +43004,107 @@ Please wrap them with useCallback or configure the deps array correctly.`
43000
43004
  }
43001
43005
  ]
43002
43006
  }
43003
- ))), filteredBranchList.length === 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "block relative text-gray-300 italic py-1" }, "No branches to display"), filteredBranchList.length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full rounded-lg shadow-inner bg-white border border-gray-200" }, filteredBranchList.map((branch) => {
43004
- var _a3, _b2;
43005
- const isCurrentBranch = branch.name === currentBranch;
43006
- const indexingStatus = (_a3 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a3.status;
43007
- return /* @__PURE__ */ React__namespace.createElement(
43008
- "div",
43007
+ ))), filteredBranchList.length === 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "block relative text-gray-300 italic py-1" }, "No branches to display"), filteredBranchList.length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full rounded-lg shadow-inner bg-white border border-gray-200" }, filteredBranchList.map((branch) => /* @__PURE__ */ React__namespace.createElement(
43008
+ BranchItem,
43009
+ {
43010
+ key: branch.name,
43011
+ branch,
43012
+ currentBranch,
43013
+ onChange,
43014
+ refreshBranchList,
43015
+ previewFunction,
43016
+ cms
43017
+ }
43018
+ ))));
43019
+ };
43020
+ const BranchItem = ({
43021
+ branch,
43022
+ currentBranch,
43023
+ onChange,
43024
+ refreshBranchList,
43025
+ previewFunction,
43026
+ cms
43027
+ }) => {
43028
+ var _a2, _b;
43029
+ const [creatingPR, setCreatingPR] = React__namespace.useState(false);
43030
+ const handleCreatePullRequest = async () => {
43031
+ if (creatingPR)
43032
+ return;
43033
+ setCreatingPR(true);
43034
+ try {
43035
+ const res = await cms.api.tina.createPullRequest({
43036
+ baseBranch: cms.api.tina.branch,
43037
+ branch: branch.name,
43038
+ title: `${branch.name.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
43039
+ });
43040
+ refreshBranchList();
43041
+ cms.alerts.success(
43042
+ `Pull request created successfully! ${res.url ? `View in GitHub: ${res.url}` : ""}`
43043
+ );
43044
+ } catch (error2) {
43045
+ console.error("Failed to create pull request:", error2);
43046
+ cms.alerts.error(error2.message);
43047
+ } finally {
43048
+ setCreatingPR(false);
43049
+ }
43050
+ };
43051
+ const isCurrentBranch = branch.name === currentBranch;
43052
+ const indexingStatus = (_a2 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a2.status;
43053
+ return /* @__PURE__ */ React__namespace.createElement(
43054
+ "div",
43055
+ {
43056
+ className: `relative text-base py-1.5 px-3 flex items-center gap-1.5 border-l-0 border-t-0 border-r-0 border-gray-50 w-full outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "border-blue-500 border-l-5 bg-blue-50 text-blue-800 border-b-0" : "border-b-2"}`
43057
+ },
43058
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "w-1/2" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-0" }, branch.protected && /* @__PURE__ */ React__namespace.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500" })), /* @__PURE__ */ React__namespace.createElement("div", { className: "truncate flex-1" }, branch.name)), indexingStatus !== "complete" && /* @__PURE__ */ React__namespace.createElement("div", { className: "w-fit" }, /* @__PURE__ */ React__namespace.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status }))),
43059
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1" }, creatingPR ? /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs font-bold text-blue-600" }, "Creating PR"), /* @__PURE__ */ React__namespace.createElement("span", { className: "text-sm leading-tight text-blue-500" }, "Please wait...")), /* @__PURE__ */ React__namespace.createElement(FaSpinner, { className: "w-3 h-auto animate-spin text-blue-500" })) : /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs font-bold" }, "Last Updated"), /* @__PURE__ */ React__namespace.createElement("span", { className: "text-sm leading-tight" }, dateFns.formatDistanceToNow(new Date(branch.indexStatus.timestamp), {
43060
+ addSuffix: true
43061
+ })))),
43062
+ /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center" }, indexingStatus === "complete" && !isCurrentBranch && /* @__PURE__ */ React__namespace.createElement(
43063
+ Button$1,
43009
43064
  {
43010
- className: `relative text-base py-1.5 px-3 flex items-center gap-1.5 border-l-0 border-t-0 border-r-0 border-gray-50 w-full outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "border-blue-500 border-l-5 bg-blue-50 text-blue-800 border-b-0" : "border-b-2"}`,
43011
- key: branch.name
43065
+ variant: "white",
43066
+ size: "custom",
43067
+ onClick: () => {
43068
+ onChange(branch.name);
43069
+ },
43070
+ className: "mr-auto cursor-pointer text-sm h-9 px-4 flex items-center gap-1"
43012
43071
  },
43013
- /* @__PURE__ */ React__namespace.createElement("div", { className: "w-1/2" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-0" }, branch.protected && /* @__PURE__ */ React__namespace.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500" })), /* @__PURE__ */ React__namespace.createElement("div", { className: "truncate flex-1" }, branch.name)), indexingStatus !== "complete" && /* @__PURE__ */ React__namespace.createElement("div", { className: "w-fit" }, /* @__PURE__ */ React__namespace.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status }))),
43014
- /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "text-xs font-bold" }, "Last Updated"), /* @__PURE__ */ React__namespace.createElement("span", { className: "text-sm leading-tight" }, dateFns.formatDistanceToNow(
43015
- new Date(branch.indexStatus.timestamp),
43016
- {
43017
- addSuffix: true
43018
- }
43019
- ))),
43020
- /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center" }, indexingStatus === "complete" && !isCurrentBranch && /* @__PURE__ */ React__namespace.createElement(
43021
- Button$1,
43022
- {
43023
- variant: "white",
43024
- size: "custom",
43025
- onClick: () => {
43026
- onChange(branch.name);
43072
+ /* @__PURE__ */ React__namespace.createElement(BiPencil, { className: "h-4 w-auto text-blue-500 opacity-70 -mt-px" }),
43073
+ " ",
43074
+ "Select"
43075
+ ), /* @__PURE__ */ React__namespace.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React__namespace.createElement(
43076
+ OverflowMenu$1,
43077
+ {
43078
+ toolbarItems: [
43079
+ branch.githubPullRequestUrl && {
43080
+ name: "github-pr",
43081
+ label: "View in GitHub",
43082
+ Icon: /* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
43083
+ onMouseDown: () => {
43084
+ window.open(branch.githubPullRequestUrl, "_blank");
43085
+ }
43027
43086
  },
43028
- className: "mr-auto cursor-pointer text-sm h-9 px-4 flex items-center gap-1"
43029
- },
43030
- /* @__PURE__ */ React__namespace.createElement(BiPencil, { className: "h-4 w-auto text-blue-500 opacity-70 -mt-px" }),
43031
- " ",
43032
- "Select"
43033
- ), (branch.githubPullRequestUrl || typeof previewFunction === "function") && /* @__PURE__ */ React__namespace.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React__namespace.createElement(
43034
- OverflowMenu$1,
43035
- {
43036
- toolbarItems: [
43037
- branch.githubPullRequestUrl && {
43038
- name: "github-pr",
43039
- label: "View in GitHub",
43040
- Icon: /* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
43041
- onMouseDown: () => {
43042
- window.open(
43043
- branch.githubPullRequestUrl,
43044
- "_blank"
43045
- );
43046
- }
43047
- },
43048
- typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
43049
- name: "preview",
43050
- label: "Preview",
43051
- onMouseDown: () => {
43052
- var _a4;
43053
- const previewUrl = (_a4 = previewFunction({
43054
- branch: branch.name
43055
- })) == null ? void 0 : _a4.url;
43056
- window.open(previewUrl, "_blank");
43057
- }
43087
+ !branch.githubPullRequestUrl && !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() && {
43088
+ name: "create-pr",
43089
+ label: "Create Pull Request",
43090
+ Icon: /* @__PURE__ */ React__namespace.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500 opacity-70" }),
43091
+ onMouseDown: () => handleCreatePullRequest()
43092
+ },
43093
+ typeof previewFunction === "function" && ((_b = previewFunction({ branch: branch.name })) == null ? void 0 : _b.url) && {
43094
+ name: "preview",
43095
+ label: "Preview",
43096
+ onMouseDown: () => {
43097
+ var _a3;
43098
+ const previewUrl = (_a3 = previewFunction({
43099
+ branch: branch.name
43100
+ })) == null ? void 0 : _a3.url;
43101
+ window.open(previewUrl, "_blank");
43058
43102
  }
43059
- ].filter(Boolean)
43060
- }
43061
- )))
43062
- );
43063
- })));
43103
+ }
43104
+ ].filter(Boolean)
43105
+ }
43106
+ )))
43107
+ );
43064
43108
  };
43065
43109
  const IndexStatus = ({ indexingStatus }) => {
43066
43110
  const styles = {
@@ -46184,7 +46228,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
46184
46228
  }));
46185
46229
  };
46186
46230
  const CreateContentNavItem = ({ plugin }) => {
46187
- const [open2, setOpen] = React__namespace.useState(false);
46231
+ const [open, setOpen] = React__namespace.useState(false);
46188
46232
  return /* @__PURE__ */ React__namespace.createElement("li", { key: plugin.name }, /* @__PURE__ */ React__namespace.createElement(
46189
46233
  "button",
46190
46234
  {
@@ -46196,7 +46240,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
46196
46240
  /* @__PURE__ */ React__namespace.createElement(VscNewFile, { className: "mr-3 h-6 opacity-80 w-auto" }),
46197
46241
  " ",
46198
46242
  plugin.name
46199
- ), open2 && /* @__PURE__ */ React__namespace.createElement(FormModal, { plugin, close: () => setOpen(false) }));
46243
+ ), open && /* @__PURE__ */ React__namespace.createElement(FormModal, { plugin, close: () => setOpen(false) }));
46200
46244
  };
46201
46245
  const Logout = ({
46202
46246
  cms,
@@ -47875,7 +47919,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
47875
47919
  return branchName.replace(/^tina\//, "");
47876
47920
  };
47877
47921
  const BranchButton = () => {
47878
- const [open2, setOpen] = React__namespace.useState(false);
47922
+ const [open, setOpen] = React__namespace.useState(false);
47879
47923
  const { currentBranch } = useBranchData();
47880
47924
  const cms = useCMS();
47881
47925
  const branchingEnabled = cms.flags.get("branch-switcher");
@@ -47907,7 +47951,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
47907
47951
  "aria-hidden": "true"
47908
47952
  }
47909
47953
  )
47910
- ), open2 && /* @__PURE__ */ React__namespace.createElement(BranchModal, { close: () => setOpen(false) }));
47954
+ ), open && /* @__PURE__ */ React__namespace.createElement(BranchModal, { close: () => setOpen(false) }));
47911
47955
  };
47912
47956
  const BranchPreviewButton = (props) => {
47913
47957
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -63404,13 +63448,13 @@ mutation DeleteDocument($collection: String!, $relativePath: String!){
63404
63448
  },
63405
63449
  /* @__PURE__ */ React__namespace.createElement(EllipsisVerticalIcon, null)
63406
63450
  );
63407
- const ActionsOverlay = ({ open: open2, className = "", style = {}, ...props }) => /* @__PURE__ */ React__namespace.createElement(
63451
+ const ActionsOverlay = ({ open, className = "", style = {}, ...props }) => /* @__PURE__ */ React__namespace.createElement(
63408
63452
  "div",
63409
63453
  {
63410
- className: `min-w-[192px] rounded-3xl border border-solid border-[#efefef] block absolute bottom-5 right-5 ${open2 ? "opacity-100" : "opacity-0"} transition-all duration-100 ease-out origin-bottom-right shadow-[0_2px_3px_rgba(0,0,0,0.05)] bg-white overflow-hidden z-10 ${className}`,
63454
+ className: `min-w-[192px] rounded-3xl border border-solid border-[#efefef] block absolute bottom-5 right-5 ${open ? "opacity-100" : "opacity-0"} transition-all duration-100 ease-out origin-bottom-right shadow-[0_2px_3px_rgba(0,0,0,0.05)] bg-white overflow-hidden z-10 ${className}`,
63411
63455
  style: {
63412
- transform: open2 ? "translate3d(0, -28px, 0) scale3d(1, 1, 1)" : "translate3d(0, 0, 0) scale3d(0.5, 0.5, 1)",
63413
- pointerEvents: open2 ? "all" : "none",
63456
+ transform: open ? "translate3d(0, -28px, 0) scale3d(1, 1, 1)" : "translate3d(0, 0, 0) scale3d(0.5, 0.5, 1)",
63457
+ pointerEvents: open ? "all" : "none",
63414
63458
  ...style
63415
63459
  },
63416
63460
  ...props
@@ -63473,7 +63517,7 @@ mutation DeleteDocument($collection: String!, $relativePath: String!){
63473
63517
  children,
63474
63518
  ...props
63475
63519
  }) => {
63476
- const [open2, setOpen] = React__namespace.useState(false);
63520
+ const [open, setOpen] = React__namespace.useState(false);
63477
63521
  return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
63478
63522
  Button$1,
63479
63523
  {
@@ -63484,7 +63528,7 @@ mutation DeleteDocument($collection: String!, $relativePath: String!){
63484
63528
  ...props
63485
63529
  },
63486
63530
  children
63487
- ), open2 && /* @__PURE__ */ React__namespace.createElement(ResetModal, { reset: reset2, close: () => setOpen(false) }));
63531
+ ), open && /* @__PURE__ */ React__namespace.createElement(ResetModal, { reset: reset2, close: () => setOpen(false) }));
63488
63532
  };
63489
63533
  const ResetModal = ({ close: close2, reset: reset2 }) => {
63490
63534
  return /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(ModalPopup, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, "Reset"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__namespace.createElement("p", null, "Are you sure you want to reset all changes?")), /* @__PURE__ */ React__namespace.createElement(ModalActions, null, /* @__PURE__ */ React__namespace.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__namespace.createElement(
@@ -63945,7 +63989,7 @@ mutation DeleteDocument($collection: String!, $relativePath: String!){
63945
63989
  if (isExecuting) {
63946
63990
  return renderProgressIndicator();
63947
63991
  } else {
63948
- return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, errorMessage && /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-1 text-red-700 py-2 px-3 mb-4 bg-red-50 border border-red-200 rounded" }, /* @__PURE__ */ React__namespace.createElement(BiError, { className: "w-5 h-auto text-red-400 flex-shrink-0" }), /* @__PURE__ */ React__namespace.createElement("span", { className: "text-sm" }, /* @__PURE__ */ React__namespace.createElement("b", null, "Error:"), " ", errorMessage)), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-sm text-gray-700 mb-4 max-w-sm" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React__namespace.createElement(
63992
+ return /* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-sm" }, errorMessage && /* @__PURE__ */ React__namespace.createElement("div", { className: "flex items-center gap-1 text-red-700 py-2 px-3 mb-4 bg-red-50 border border-red-200 rounded" }, /* @__PURE__ */ React__namespace.createElement(BiError, { className: "w-5 h-auto text-red-400 flex-shrink-0" }), /* @__PURE__ */ React__namespace.createElement("span", { className: "text-sm" }, /* @__PURE__ */ React__namespace.createElement("b", null, "Error:"), " ", errorMessage)), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "This content is protected 🚧"), /* @__PURE__ */ React__namespace.createElement("p", { className: "text-sm text-gray-700 mb-4 max-w-sm" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React__namespace.createElement(
63949
63993
  PrefixedTextField,
63950
63994
  {
63951
63995
  placeholder: "e.g. {{PAGE-NAME}}-updates",
@@ -65741,7 +65785,7 @@ flowchart TD
65741
65785
  return /* @__PURE__ */ React.createElement(EmbedButton, { templates, editor });
65742
65786
  }
65743
65787
  const EmbedButton = ({ editor, templates }) => {
65744
- const [open2, setOpen] = React.useState(false);
65788
+ const [open, setOpen] = React.useState(false);
65745
65789
  const [filteredTemplates, setFilteredTemplates] = React.useState(templates);
65746
65790
  const filterChange = (e3) => {
65747
65791
  const filterText = e3.target.value.toLowerCase();
@@ -65751,10 +65795,10 @@ flowchart TD
65751
65795
  )
65752
65796
  );
65753
65797
  };
65754
- return /* @__PURE__ */ React.createElement(DropdownMenu$1, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger$1, { className: "inline-flex items-center rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
65798
+ return /* @__PURE__ */ React.createElement(DropdownMenu$1, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger$1, { className: "inline-flex items-center rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
65755
65799
  PlusIcon,
65756
65800
  {
65757
- className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
65801
+ className: `origin-center transition-all ease-out duration-150 ${open ? "rotate-45" : ""}`
65758
65802
  }
65759
65803
  )), /* @__PURE__ */ React.createElement(DropdownMenuContent$1, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React.createElement(
65760
65804
  "input",
@@ -66978,13 +67022,13 @@ flowchart TD
66978
67022
  const selectionText = useEditorSelector(() => editor.api.string(), []);
66979
67023
  const readOnly = useEditorReadOnly();
66980
67024
  const focused = useFocused();
66981
- const [open2, setOpen] = React.useState(false);
67025
+ const [open, setOpen] = React.useState(false);
66982
67026
  const [waitForCollapsedSelection, setWaitForCollapsedSelection] = React.useState(false);
66983
67027
  const [mousedown, setMousedown] = React.useState(false);
66984
67028
  const floating = plateFloating.useVirtualFloating(
66985
67029
  plate.mergeProps(
66986
67030
  {
66987
- open: open2,
67031
+ open,
66988
67032
  getBoundingClientRect: () => plateFloating.getSelectionBoundingClientRect(editor),
66989
67033
  onOpenChange: setOpen
66990
67034
  },
@@ -66998,7 +67042,7 @@ flowchart TD
66998
67042
  focusedEditorId,
66999
67043
  hideToolbar,
67000
67044
  mousedown,
67001
- open: open2,
67045
+ open,
67002
67046
  readOnly,
67003
67047
  selectionExpanded,
67004
67048
  selectionText,
@@ -67015,7 +67059,7 @@ flowchart TD
67015
67059
  focusedEditorId,
67016
67060
  hideToolbar,
67017
67061
  mousedown,
67018
- open: open2,
67062
+ open,
67019
67063
  readOnly,
67020
67064
  selectionExpanded,
67021
67065
  selectionText,
@@ -67049,7 +67093,7 @@ flowchart TD
67049
67093
  };
67050
67094
  }, []);
67051
67095
  React.useEffect(() => {
67052
- if (!selectionExpanded || !selectionText || mousedown && !open2 || hideToolbar || readOnly && !showWhenReadOnly) {
67096
+ if (!selectionExpanded || !selectionText || mousedown && !open || hideToolbar || readOnly && !showWhenReadOnly) {
67053
67097
  setOpen(false);
67054
67098
  } else if (selectionText && selectionExpanded && (!waitForCollapsedSelection || readOnly)) {
67055
67099
  setOpen(true);
@@ -67064,7 +67108,7 @@ flowchart TD
67064
67108
  selectionText,
67065
67109
  mousedown,
67066
67110
  waitForCollapsedSelection,
67067
- open2,
67111
+ open,
67068
67112
  readOnly
67069
67113
  ]);
67070
67114
  const { update } = floating;
@@ -67081,7 +67125,7 @@ flowchart TD
67081
67125
  );
67082
67126
  return {
67083
67127
  clickOutsideRef,
67084
- hidden: !open2,
67128
+ hidden: !open,
67085
67129
  props: {
67086
67130
  style: floating.style
67087
67131
  },
@@ -109809,11 +109853,11 @@ flowchart TD
109809
109853
  /#/
109810
109854
  // valid but infrequent and weird
109811
109855
  ];
109812
- const PAIRED_DOUBLE_RE = (prefix, open2, close2 = "\\1") => {
109813
- const middle = close2 === "\\1" ? close2 : regex.concat(close2, open2);
109856
+ const PAIRED_DOUBLE_RE = (prefix, open, close2 = "\\1") => {
109857
+ const middle = close2 === "\\1" ? close2 : regex.concat(close2, open);
109814
109858
  return regex.concat(
109815
109859
  regex.concat("(?:", prefix, ")"),
109816
- open2,
109860
+ open,
109817
109861
  /(?:\\.|[^\\\/])*?/,
109818
109862
  middle,
109819
109863
  /(?:\\.|[^\\\/])*?/,
@@ -109821,10 +109865,10 @@ flowchart TD
109821
109865
  REGEX_MODIFIERS
109822
109866
  );
109823
109867
  };
109824
- const PAIRED_RE = (prefix, open2, close2) => {
109868
+ const PAIRED_RE = (prefix, open, close2) => {
109825
109869
  return regex.concat(
109826
109870
  regex.concat("(?:", prefix, ")"),
109827
- open2,
109871
+ open,
109828
109872
  /(?:\\.|[^\\\/])*?/,
109829
109873
  close2,
109830
109874
  REGEX_MODIFIERS
@@ -118793,9 +118837,11 @@ mutation addPendingDocumentMutation(
118793
118837
  }
118794
118838
  });
118795
118839
  if (!res.ok) {
118796
- throw new Error(
118797
- `There was an error creating a new branch. ${res.statusText}`
118798
- );
118840
+ let errorMessage = `There was an error creating a new branch. ${res.statusText}`;
118841
+ if (res.status === 422) {
118842
+ errorMessage = `Please make sure you have made changes on ${branch} before creating a pull request.`;
118843
+ }
118844
+ throw new Error(errorMessage);
118799
118845
  }
118800
118846
  const values = await res.json();
118801
118847
  return values;
package/dist/index.mjs CHANGED
@@ -28075,7 +28075,7 @@ var submitFloatingLink = (editor) => {
28075
28075
  };
28076
28076
  var useFloatingLinkEnter = () => {
28077
28077
  const editor = useEditorRef();
28078
- const open2 = usePluginOption(LinkPlugin, "isOpen", editor.id);
28078
+ const open = usePluginOption(LinkPlugin, "isOpen", editor.id);
28079
28079
  useHotkeys(
28080
28080
  "*",
28081
28081
  (e3) => {
@@ -28086,7 +28086,7 @@ var useFloatingLinkEnter = () => {
28086
28086
  }
28087
28087
  },
28088
28088
  {
28089
- enabled: open2,
28089
+ enabled: open,
28090
28090
  enableOnFormTags: ["INPUT"]
28091
28091
  },
28092
28092
  []
@@ -28094,7 +28094,7 @@ var useFloatingLinkEnter = () => {
28094
28094
  };
28095
28095
  var useFloatingLinkEscape = () => {
28096
28096
  const { api, editor, getOptions: getOptions2 } = useEditorPlugin(LinkPlugin);
28097
- const open2 = usePluginOption(LinkPlugin, "isOpen", editor.id);
28097
+ const open = usePluginOption(LinkPlugin, "isOpen", editor.id);
28098
28098
  useHotkeys(
28099
28099
  "escape",
28100
28100
  (e3) => {
@@ -28113,7 +28113,7 @@ var useFloatingLinkEscape = () => {
28113
28113
  api.floatingLink.hide();
28114
28114
  },
28115
28115
  {
28116
- enabled: open2,
28116
+ enabled: open,
28117
28117
  enableOnContentEditable: true,
28118
28118
  enableOnFormTags: ["INPUT"]
28119
28119
  },
@@ -28126,7 +28126,7 @@ var useVirtualFloatingLink = ({
28126
28126
  }) => {
28127
28127
  const { setOption } = useEditorPlugin(LinkPlugin);
28128
28128
  return useVirtualFloating({
28129
- onOpenChange: (open2) => setOption("openEditorId", open2 ? editorId : null),
28129
+ onOpenChange: (open) => setOption("openEditorId", open ? editorId : null),
28130
28130
  ...floatingOptions
28131
28131
  });
28132
28132
  };
@@ -28139,7 +28139,7 @@ var useFloatingLinkEditState = ({
28139
28139
  const isEditing = usePluginOption(LinkPlugin, "isEditing");
28140
28140
  const version2 = useEditorVersion();
28141
28141
  const mode = usePluginOption(LinkPlugin, "mode");
28142
- const open2 = usePluginOption(LinkPlugin, "isOpen", editor.id);
28142
+ const open = usePluginOption(LinkPlugin, "isOpen", editor.id);
28143
28143
  const getBoundingClientRect = React__default.useCallback(() => {
28144
28144
  const entry = editor.api.above({
28145
28145
  match: { type }
@@ -28153,7 +28153,7 @@ var useFloatingLinkEditState = ({
28153
28153
  }
28154
28154
  return getDOMSelectionBoundingClientRect();
28155
28155
  }, [editor, type]);
28156
- const isOpen = open2 && mode === "edit";
28156
+ const isOpen = open && mode === "edit";
28157
28157
  const floating = useVirtualFloatingLink({
28158
28158
  editorId: editor.id,
28159
28159
  getBoundingClientRect,
@@ -33679,7 +33679,7 @@ function CodeBlockCombobox({
33679
33679
  onLanguageChange
33680
33680
  }) {
33681
33681
  var _a2;
33682
- const [open2, setOpen] = useState(false);
33682
+ const [open, setOpen] = useState(false);
33683
33683
  const readOnly = useReadOnly();
33684
33684
  const element = useElement();
33685
33685
  const value = element.lang || "plaintext";
@@ -33692,7 +33692,7 @@ function CodeBlockCombobox({
33692
33692
  );
33693
33693
  if (readOnly)
33694
33694
  return null;
33695
- return /* @__PURE__ */ React__default.createElement(Popover$2, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(PopoverTrigger$1, { asChild: true, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement(
33695
+ return /* @__PURE__ */ React__default.createElement(Popover$2, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(PopoverTrigger$1, { asChild: true, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement(
33696
33696
  Button$2,
33697
33697
  {
33698
33698
  tabIndex: -1,
@@ -33700,9 +33700,9 @@ function CodeBlockCombobox({
33700
33700
  className: cn$2(
33701
33701
  "h-6 justify-between gap-1 px-2 text-xs text-muted-foreground select-none",
33702
33702
  "hover:bg-[#E2E8F0] bg-[#F1F5F9] text-[#64748B] hover:text-[#0F172A]",
33703
- open2 && "bg-[#E2E8F0] text-[#0F172A]"
33703
+ open && "bg-[#E2E8F0] text-[#0F172A]"
33704
33704
  ),
33705
- "aria-expanded": open2,
33705
+ "aria-expanded": open,
33706
33706
  role: "combobox"
33707
33707
  },
33708
33708
  ((_a2 = languages.find((language) => language.value === value)) == null ? void 0 : _a2.label) ?? "Plain Text",
@@ -36990,16 +36990,16 @@ withCn(
36990
36990
  "ml-auto text-xs tracking-widest opacity-60"
36991
36991
  );
36992
36992
  const useOpenState = () => {
36993
- const [open2, setOpen] = useState(false);
36993
+ const [open, setOpen] = useState(false);
36994
36994
  const onOpenChange = useCallback(
36995
- (_value = !open2) => {
36995
+ (_value = !open) => {
36996
36996
  setOpen(_value);
36997
36997
  },
36998
- [open2]
36998
+ [open]
36999
36999
  );
37000
37000
  return {
37001
37001
  onOpenChange,
37002
- open: open2
37002
+ open
37003
37003
  };
37004
37004
  };
37005
37005
  const separatorVariants = cva("shrink-0 bg-border", {
@@ -37375,7 +37375,7 @@ const TableBordersDropdownMenuContent = withRef$1((props, ref) => {
37375
37375
  );
37376
37376
  });
37377
37377
  function ColorDropdownMenu({ children, tooltip }) {
37378
- const [open2, setOpen] = useState(false);
37378
+ const [open, setOpen] = useState(false);
37379
37379
  const editor = useEditorRef();
37380
37380
  const selectedCells = usePluginOption(TablePlugin, "selectedCells");
37381
37381
  useCallback(
@@ -37392,7 +37392,7 @@ function ColorDropdownMenu({ children, tooltip }) {
37392
37392
  selectedCells: selectedCells ?? []
37393
37393
  });
37394
37394
  }, [selectedCells, editor]);
37395
- return /* @__PURE__ */ React__default.createElement(DropdownMenu$1, { open: open2, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger$1, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { tooltip }, children)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent$1, { align: "start" }, /* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(DropdownMenuItem$1, { className: "p-2", onClick: onClearColor }, /* @__PURE__ */ React__default.createElement(EraserIcon, null), /* @__PURE__ */ React__default.createElement("span", null, "Clear")))));
37395
+ return /* @__PURE__ */ React__default.createElement(DropdownMenu$1, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger$1, { asChild: true }, /* @__PURE__ */ React__default.createElement(ToolbarButton, { tooltip }, children)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent$1, { align: "start" }, /* @__PURE__ */ React__default.createElement(DropdownMenuGroup, null, /* @__PURE__ */ React__default.createElement(DropdownMenuItem$1, { className: "p-2", onClick: onClearColor }, /* @__PURE__ */ React__default.createElement(EraserIcon, null), /* @__PURE__ */ React__default.createElement("span", null, "Clear")))));
37396
37396
  }
37397
37397
  const TableRowElement = withRef$1(
37398
37398
  ({ children, className, ...props }, ref) => {
@@ -39242,7 +39242,8 @@ function classNames(...classes) {
39242
39242
  return classes.filter(Boolean).join(" ");
39243
39243
  }
39244
39244
  const OverflowMenu$1 = ({ toolbarItems: toolbarItems2, className = "w-full" }) => {
39245
- return /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Root, null, /* @__PURE__ */ React__default.createElement(
39245
+ const [open, setOpen] = useState(false);
39246
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, toolbarItems2.length > 0 && /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(
39246
39247
  PopoverPrimitive.Trigger,
39247
39248
  {
39248
39249
  className: `cursor-pointer relative justify-center inline-flex items-center p-3 text-sm font-medium focus:outline-1 focus:outline-blue-200 pointer-events-auto ${open ? `text-blue-400` : `text-gray-300 hover:text-blue-500`} ${className}}`
@@ -39275,6 +39276,7 @@ const OverflowMenu$1 = ({ toolbarItems: toolbarItems2, className = "w-full" }) =
39275
39276
  onMouseDown: (event) => {
39276
39277
  event.preventDefault();
39277
39278
  toolbarItem.onMouseDown(event);
39279
+ setOpen(false);
39278
39280
  },
39279
39281
  className: classNames(
39280
39282
  toolbarItem.active ? "bg-gray-50 text-blue-500" : "bg-white text-gray-600",
@@ -39285,7 +39287,7 @@ const OverflowMenu$1 = ({ toolbarItems: toolbarItems2, className = "w-full" }) =
39285
39287
  " ",
39286
39288
  toolbarItem.label
39287
39289
  );
39288
- })))));
39290
+ }))))));
39289
39291
  };
39290
39292
  function BsArrowRightShort(props) {
39291
39293
  return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8" }, "child": [] }] })(props);
@@ -39705,7 +39707,7 @@ const getFilename = (optionSets, value) => {
39705
39707
  return node3 ? node3._internalSys.filename : null;
39706
39708
  };
39707
39709
  const Combobox = ({ cms, input, field }) => {
39708
- const [open2, setOpen] = React.useState(false);
39710
+ const [open, setOpen] = React.useState(false);
39709
39711
  const [value, setValue] = React.useState(input.value);
39710
39712
  const [displayText, setDisplayText] = React.useState(null);
39711
39713
  const { optionSets, loading } = useGetOptionSets(
@@ -39730,16 +39732,16 @@ const Combobox = ({ cms, input, field }) => {
39730
39732
  if (loading === true) {
39731
39733
  return /* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" });
39732
39734
  }
39733
- return /* @__PURE__ */ React.createElement(Popover, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
39735
+ return /* @__PURE__ */ React.createElement(Popover, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
39734
39736
  Button,
39735
39737
  {
39736
39738
  variant: "outline",
39737
39739
  role: "combobox",
39738
- "aria-expanded": open2,
39740
+ "aria-expanded": open,
39739
39741
  className: "w-full justify-between"
39740
39742
  },
39741
39743
  /* @__PURE__ */ React.createElement("p", { className: "truncate" }, displayText ?? "Choose an option..."),
39742
- open2 ? /* @__PURE__ */ React.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React.createElement(IoMdArrowDropdown, { size: 20 })
39744
+ open ? /* @__PURE__ */ React.createElement(IoMdArrowDropup, { size: 20 }) : /* @__PURE__ */ React.createElement(IoMdArrowDropdown, { size: 20 })
39743
39745
  )), /* @__PURE__ */ React.createElement(PopoverContent, { className: "p-0 relative min-w-[var(--radix-popover-trigger-width)]" }, /* @__PURE__ */ React.createElement(
39744
39746
  Command,
39745
39747
  {
@@ -40215,12 +40217,12 @@ const BlockSelector = ({
40215
40217
  return template.label ? template.label.toLowerCase().includes(filter2.toLowerCase()) || name.toLowerCase().includes(filter2.toLowerCase()) : name.toLowerCase().includes(filter2.toLowerCase());
40216
40218
  });
40217
40219
  }, [filter2]);
40218
- return /* @__PURE__ */ React.createElement(Popover$3, null, ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
40220
+ return /* @__PURE__ */ React.createElement(Popover$3, null, ({ open }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverButton, { as: "span" }, /* @__PURE__ */ React.createElement(
40219
40221
  IconButton,
40220
40222
  {
40221
- variant: open2 ? "secondary" : "primary",
40223
+ variant: open ? "secondary" : "primary",
40222
40224
  size: "small",
40223
- className: `${open2 ? `rotate-45 pointer-events-none` : ``}`
40225
+ className: `${open ? `rotate-45 pointer-events-none` : ``}`
40224
40226
  },
40225
40227
  /* @__PURE__ */ React.createElement(AddIcon, { className: "w-5/6 h-auto" })
40226
40228
  )), /* @__PURE__ */ React.createElement("div", { className: "transform translate-y-full absolute -bottom-1 right-0 z-50" }, /* @__PURE__ */ React.createElement(
@@ -40501,10 +40503,10 @@ const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
40501
40503
  as: "div",
40502
40504
  className: `left-0 right-0 relative`
40503
40505
  },
40504
- ({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
40506
+ ({ open }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
40505
40507
  DisclosureButton,
40506
40508
  {
40507
- className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
40509
+ className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open || templates.length === 0) && `border-b border-gray-100`}`
40508
40510
  },
40509
40511
  /* @__PURE__ */ React.createElement(
40510
40512
  "span",
@@ -40516,7 +40518,7 @@ const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
40516
40518
  templates.length > 0 && /* @__PURE__ */ React.createElement(
40517
40519
  MdKeyboardArrowDown,
40518
40520
  {
40519
- className: `absolute top-1/2 right-0 w-6 h-auto -translate-y-1/2 text-gray-300 origin-center group-hover:text-blue-500 transition-all duration-150 ease-out ${open2 ? `` : `-rotate-90 opacity-70 group-hover:opacity-100`}`
40521
+ className: `absolute top-1/2 right-0 w-6 h-auto -translate-y-1/2 text-gray-300 origin-center group-hover:text-blue-500 transition-all duration-150 ease-out ${open ? `` : `-rotate-90 opacity-70 group-hover:opacity-100`}`
40520
40522
  }
40521
40523
  )
40522
40524
  ), /* @__PURE__ */ React.createElement(
@@ -42874,6 +42876,7 @@ const EditoralBranchSwitcher = ({
42874
42876
  {
42875
42877
  currentBranch,
42876
42878
  branchList,
42879
+ refreshBranchList,
42877
42880
  createBranch: () => {
42878
42881
  setViewState("create");
42879
42882
  },
@@ -42962,7 +42965,8 @@ const BranchSelector = ({
42962
42965
  branchList,
42963
42966
  currentBranch,
42964
42967
  onChange,
42965
- createBranch
42968
+ createBranch,
42969
+ refreshBranchList
42966
42970
  }) => {
42967
42971
  var _a2, _b, _c, _d;
42968
42972
  const [search, setSearch] = React.useState("");
@@ -43027,67 +43031,107 @@ const BranchSelector = ({
43027
43031
  }
43028
43032
  ]
43029
43033
  }
43030
- ))), filteredBranchList.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "block relative text-gray-300 italic py-1" }, "No branches to display"), filteredBranchList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full rounded-lg shadow-inner bg-white border border-gray-200" }, filteredBranchList.map((branch) => {
43031
- var _a3, _b2;
43032
- const isCurrentBranch = branch.name === currentBranch;
43033
- const indexingStatus = (_a3 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a3.status;
43034
- return /* @__PURE__ */ React.createElement(
43035
- "div",
43034
+ ))), filteredBranchList.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "block relative text-gray-300 italic py-1" }, "No branches to display"), filteredBranchList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto flex flex-col w-full h-full rounded-lg shadow-inner bg-white border border-gray-200" }, filteredBranchList.map((branch) => /* @__PURE__ */ React.createElement(
43035
+ BranchItem,
43036
+ {
43037
+ key: branch.name,
43038
+ branch,
43039
+ currentBranch,
43040
+ onChange,
43041
+ refreshBranchList,
43042
+ previewFunction,
43043
+ cms
43044
+ }
43045
+ ))));
43046
+ };
43047
+ const BranchItem = ({
43048
+ branch,
43049
+ currentBranch,
43050
+ onChange,
43051
+ refreshBranchList,
43052
+ previewFunction,
43053
+ cms
43054
+ }) => {
43055
+ var _a2, _b;
43056
+ const [creatingPR, setCreatingPR] = React.useState(false);
43057
+ const handleCreatePullRequest = async () => {
43058
+ if (creatingPR)
43059
+ return;
43060
+ setCreatingPR(true);
43061
+ try {
43062
+ const res = await cms.api.tina.createPullRequest({
43063
+ baseBranch: cms.api.tina.branch,
43064
+ branch: branch.name,
43065
+ title: `${branch.name.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
43066
+ });
43067
+ refreshBranchList();
43068
+ cms.alerts.success(
43069
+ `Pull request created successfully! ${res.url ? `View in GitHub: ${res.url}` : ""}`
43070
+ );
43071
+ } catch (error2) {
43072
+ console.error("Failed to create pull request:", error2);
43073
+ cms.alerts.error(error2.message);
43074
+ } finally {
43075
+ setCreatingPR(false);
43076
+ }
43077
+ };
43078
+ const isCurrentBranch = branch.name === currentBranch;
43079
+ const indexingStatus = (_a2 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a2.status;
43080
+ return /* @__PURE__ */ React.createElement(
43081
+ "div",
43082
+ {
43083
+ className: `relative text-base py-1.5 px-3 flex items-center gap-1.5 border-l-0 border-t-0 border-r-0 border-gray-50 w-full outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "border-blue-500 border-l-5 bg-blue-50 text-blue-800 border-b-0" : "border-b-2"}`
43084
+ },
43085
+ /* @__PURE__ */ React.createElement("div", { className: "w-1/2" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React.createElement("div", { className: "flex-0" }, branch.protected && /* @__PURE__ */ React.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500" })), /* @__PURE__ */ React.createElement("div", { className: "truncate flex-1" }, branch.name)), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status }))),
43086
+ /* @__PURE__ */ React.createElement("div", { className: "flex-1" }, creatingPR ? /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold text-blue-600" }, "Creating PR"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight text-blue-500" }, "Please wait...")), /* @__PURE__ */ React.createElement(FaSpinner, { className: "w-3 h-auto animate-spin text-blue-500" })) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold" }, "Last Updated"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight" }, formatDistanceToNow$1(new Date(branch.indexStatus.timestamp), {
43087
+ addSuffix: true
43088
+ })))),
43089
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, indexingStatus === "complete" && !isCurrentBranch && /* @__PURE__ */ React.createElement(
43090
+ Button$1,
43036
43091
  {
43037
- className: `relative text-base py-1.5 px-3 flex items-center gap-1.5 border-l-0 border-t-0 border-r-0 border-gray-50 w-full outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "border-blue-500 border-l-5 bg-blue-50 text-blue-800 border-b-0" : "border-b-2"}`,
43038
- key: branch.name
43092
+ variant: "white",
43093
+ size: "custom",
43094
+ onClick: () => {
43095
+ onChange(branch.name);
43096
+ },
43097
+ className: "mr-auto cursor-pointer text-sm h-9 px-4 flex items-center gap-1"
43039
43098
  },
43040
- /* @__PURE__ */ React.createElement("div", { className: "w-1/2" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React.createElement("div", { className: "flex-0" }, branch.protected && /* @__PURE__ */ React.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500" })), /* @__PURE__ */ React.createElement("div", { className: "truncate flex-1" }, branch.name)), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status }))),
43041
- /* @__PURE__ */ React.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold" }, "Last Updated"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight" }, formatDistanceToNow$1(
43042
- new Date(branch.indexStatus.timestamp),
43043
- {
43044
- addSuffix: true
43045
- }
43046
- ))),
43047
- /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, indexingStatus === "complete" && !isCurrentBranch && /* @__PURE__ */ React.createElement(
43048
- Button$1,
43049
- {
43050
- variant: "white",
43051
- size: "custom",
43052
- onClick: () => {
43053
- onChange(branch.name);
43099
+ /* @__PURE__ */ React.createElement(BiPencil, { className: "h-4 w-auto text-blue-500 opacity-70 -mt-px" }),
43100
+ " ",
43101
+ "Select"
43102
+ ), /* @__PURE__ */ React.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React.createElement(
43103
+ OverflowMenu$1,
43104
+ {
43105
+ toolbarItems: [
43106
+ branch.githubPullRequestUrl && {
43107
+ name: "github-pr",
43108
+ label: "View in GitHub",
43109
+ Icon: /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
43110
+ onMouseDown: () => {
43111
+ window.open(branch.githubPullRequestUrl, "_blank");
43112
+ }
43054
43113
  },
43055
- className: "mr-auto cursor-pointer text-sm h-9 px-4 flex items-center gap-1"
43056
- },
43057
- /* @__PURE__ */ React.createElement(BiPencil, { className: "h-4 w-auto text-blue-500 opacity-70 -mt-px" }),
43058
- " ",
43059
- "Select"
43060
- ), (branch.githubPullRequestUrl || typeof previewFunction === "function") && /* @__PURE__ */ React.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React.createElement(
43061
- OverflowMenu$1,
43062
- {
43063
- toolbarItems: [
43064
- branch.githubPullRequestUrl && {
43065
- name: "github-pr",
43066
- label: "View in GitHub",
43067
- Icon: /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
43068
- onMouseDown: () => {
43069
- window.open(
43070
- branch.githubPullRequestUrl,
43071
- "_blank"
43072
- );
43073
- }
43074
- },
43075
- typeof previewFunction === "function" && ((_b2 = previewFunction({ branch: branch.name })) == null ? void 0 : _b2.url) && {
43076
- name: "preview",
43077
- label: "Preview",
43078
- onMouseDown: () => {
43079
- var _a4;
43080
- const previewUrl = (_a4 = previewFunction({
43081
- branch: branch.name
43082
- })) == null ? void 0 : _a4.url;
43083
- window.open(previewUrl, "_blank");
43084
- }
43114
+ !branch.githubPullRequestUrl && !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() && {
43115
+ name: "create-pr",
43116
+ label: "Create Pull Request",
43117
+ Icon: /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500 opacity-70" }),
43118
+ onMouseDown: () => handleCreatePullRequest()
43119
+ },
43120
+ typeof previewFunction === "function" && ((_b = previewFunction({ branch: branch.name })) == null ? void 0 : _b.url) && {
43121
+ name: "preview",
43122
+ label: "Preview",
43123
+ onMouseDown: () => {
43124
+ var _a3;
43125
+ const previewUrl = (_a3 = previewFunction({
43126
+ branch: branch.name
43127
+ })) == null ? void 0 : _a3.url;
43128
+ window.open(previewUrl, "_blank");
43085
43129
  }
43086
- ].filter(Boolean)
43087
- }
43088
- )))
43089
- );
43090
- })));
43130
+ }
43131
+ ].filter(Boolean)
43132
+ }
43133
+ )))
43134
+ );
43091
43135
  };
43092
43136
  const IndexStatus = ({ indexingStatus }) => {
43093
43137
  const styles = {
@@ -46211,7 +46255,7 @@ const CollectionsList = ({
46211
46255
  }));
46212
46256
  };
46213
46257
  const CreateContentNavItem = ({ plugin }) => {
46214
- const [open2, setOpen] = React.useState(false);
46258
+ const [open, setOpen] = React.useState(false);
46215
46259
  return /* @__PURE__ */ React.createElement("li", { key: plugin.name }, /* @__PURE__ */ React.createElement(
46216
46260
  "button",
46217
46261
  {
@@ -46223,7 +46267,7 @@ const CreateContentNavItem = ({ plugin }) => {
46223
46267
  /* @__PURE__ */ React.createElement(VscNewFile, { className: "mr-3 h-6 opacity-80 w-auto" }),
46224
46268
  " ",
46225
46269
  plugin.name
46226
- ), open2 && /* @__PURE__ */ React.createElement(FormModal, { plugin, close: () => setOpen(false) }));
46270
+ ), open && /* @__PURE__ */ React.createElement(FormModal, { plugin, close: () => setOpen(false) }));
46227
46271
  };
46228
46272
  const Logout = ({
46229
46273
  cms,
@@ -47902,7 +47946,7 @@ const trimPrefix = (branchName) => {
47902
47946
  return branchName.replace(/^tina\//, "");
47903
47947
  };
47904
47948
  const BranchButton = () => {
47905
- const [open2, setOpen] = React.useState(false);
47949
+ const [open, setOpen] = React.useState(false);
47906
47950
  const { currentBranch } = useBranchData();
47907
47951
  const cms = useCMS();
47908
47952
  const branchingEnabled = cms.flags.get("branch-switcher");
@@ -47934,7 +47978,7 @@ const BranchButton = () => {
47934
47978
  "aria-hidden": "true"
47935
47979
  }
47936
47980
  )
47937
- ), open2 && /* @__PURE__ */ React.createElement(BranchModal, { close: () => setOpen(false) }));
47981
+ ), open && /* @__PURE__ */ React.createElement(BranchModal, { close: () => setOpen(false) }));
47938
47982
  };
47939
47983
  const BranchPreviewButton = (props) => {
47940
47984
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -63431,13 +63475,13 @@ const MoreActionsButton = ({ className = "", ...props }) => /* @__PURE__ */ Reac
63431
63475
  },
63432
63476
  /* @__PURE__ */ React.createElement(EllipsisVerticalIcon, null)
63433
63477
  );
63434
- const ActionsOverlay = ({ open: open2, className = "", style = {}, ...props }) => /* @__PURE__ */ React.createElement(
63478
+ const ActionsOverlay = ({ open, className = "", style = {}, ...props }) => /* @__PURE__ */ React.createElement(
63435
63479
  "div",
63436
63480
  {
63437
- className: `min-w-[192px] rounded-3xl border border-solid border-[#efefef] block absolute bottom-5 right-5 ${open2 ? "opacity-100" : "opacity-0"} transition-all duration-100 ease-out origin-bottom-right shadow-[0_2px_3px_rgba(0,0,0,0.05)] bg-white overflow-hidden z-10 ${className}`,
63481
+ className: `min-w-[192px] rounded-3xl border border-solid border-[#efefef] block absolute bottom-5 right-5 ${open ? "opacity-100" : "opacity-0"} transition-all duration-100 ease-out origin-bottom-right shadow-[0_2px_3px_rgba(0,0,0,0.05)] bg-white overflow-hidden z-10 ${className}`,
63438
63482
  style: {
63439
- transform: open2 ? "translate3d(0, -28px, 0) scale3d(1, 1, 1)" : "translate3d(0, 0, 0) scale3d(0.5, 0.5, 1)",
63440
- pointerEvents: open2 ? "all" : "none",
63483
+ transform: open ? "translate3d(0, -28px, 0) scale3d(1, 1, 1)" : "translate3d(0, 0, 0) scale3d(0.5, 0.5, 1)",
63484
+ pointerEvents: open ? "all" : "none",
63441
63485
  ...style
63442
63486
  },
63443
63487
  ...props
@@ -63500,7 +63544,7 @@ const ResetForm = ({
63500
63544
  children,
63501
63545
  ...props
63502
63546
  }) => {
63503
- const [open2, setOpen] = React.useState(false);
63547
+ const [open, setOpen] = React.useState(false);
63504
63548
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
63505
63549
  Button$1,
63506
63550
  {
@@ -63511,7 +63555,7 @@ const ResetForm = ({
63511
63555
  ...props
63512
63556
  },
63513
63557
  children
63514
- ), open2 && /* @__PURE__ */ React.createElement(ResetModal, { reset: reset2, close: () => setOpen(false) }));
63558
+ ), open && /* @__PURE__ */ React.createElement(ResetModal, { reset: reset2, close: () => setOpen(false) }));
63515
63559
  };
63516
63560
  const ResetModal = ({ close: close2, reset: reset2 }) => {
63517
63561
  return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(ModalPopup, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Reset"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, "Are you sure you want to reset all changes?")), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
@@ -63972,7 +64016,7 @@ const CreateBranchModal = ({
63972
64016
  if (isExecuting) {
63973
64017
  return renderProgressIndicator();
63974
64018
  } else {
63975
- return /* @__PURE__ */ React.createElement(React.Fragment, null, errorMessage && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 text-red-700 py-2 px-3 mb-4 bg-red-50 border border-red-200 rounded" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-5 h-auto text-red-400 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm" }, /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage)), /* @__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 max-w-sm" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React.createElement(
64019
+ return /* @__PURE__ */ React.createElement("div", { className: "max-w-sm" }, errorMessage && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 text-red-700 py-2 px-3 mb-4 bg-red-50 border border-red-200 rounded" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-5 h-auto text-red-400 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm" }, /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage)), /* @__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 max-w-sm" }, "To make changes, you need to create a copy then get it approved and merged for it to go live."), /* @__PURE__ */ React.createElement(
63976
64020
  PrefixedTextField,
63977
64021
  {
63978
64022
  placeholder: "e.g. {{PAGE-NAME}}-updates",
@@ -65768,7 +65812,7 @@ function TemplatesToolbarButton() {
65768
65812
  return /* @__PURE__ */ React__default.createElement(EmbedButton, { templates, editor });
65769
65813
  }
65770
65814
  const EmbedButton = ({ editor, templates }) => {
65771
- const [open2, setOpen] = useState(false);
65815
+ const [open, setOpen] = useState(false);
65772
65816
  const [filteredTemplates, setFilteredTemplates] = useState(templates);
65773
65817
  const filterChange = (e3) => {
65774
65818
  const filterText = e3.target.value.toLowerCase();
@@ -65778,10 +65822,10 @@ const EmbedButton = ({ editor, templates }) => {
65778
65822
  )
65779
65823
  );
65780
65824
  };
65781
- return /* @__PURE__ */ React__default.createElement(DropdownMenu$1, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger$1, { className: "inline-flex items-center rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React__default.createElement(
65825
+ return /* @__PURE__ */ React__default.createElement(DropdownMenu$1, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger$1, { className: "inline-flex items-center rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React__default.createElement(
65782
65826
  PlusIcon,
65783
65827
  {
65784
- className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
65828
+ className: `origin-center transition-all ease-out duration-150 ${open ? "rotate-45" : ""}`
65785
65829
  }
65786
65830
  )), /* @__PURE__ */ React__default.createElement(DropdownMenuContent$1, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React__default.createElement(
65787
65831
  "input",
@@ -67005,13 +67049,13 @@ const useCustomFloatingToolbarState = ({
67005
67049
  const selectionText = useEditorSelector(() => editor.api.string(), []);
67006
67050
  const readOnly = useEditorReadOnly();
67007
67051
  const focused = useFocused();
67008
- const [open2, setOpen] = React__default.useState(false);
67052
+ const [open, setOpen] = React__default.useState(false);
67009
67053
  const [waitForCollapsedSelection, setWaitForCollapsedSelection] = React__default.useState(false);
67010
67054
  const [mousedown, setMousedown] = React__default.useState(false);
67011
67055
  const floating = useVirtualFloating(
67012
67056
  mergeProps(
67013
67057
  {
67014
- open: open2,
67058
+ open,
67015
67059
  getBoundingClientRect: () => getSelectionBoundingClientRect(editor),
67016
67060
  onOpenChange: setOpen
67017
67061
  },
@@ -67025,7 +67069,7 @@ const useCustomFloatingToolbarState = ({
67025
67069
  focusedEditorId,
67026
67070
  hideToolbar,
67027
67071
  mousedown,
67028
- open: open2,
67072
+ open,
67029
67073
  readOnly,
67030
67074
  selectionExpanded,
67031
67075
  selectionText,
@@ -67042,7 +67086,7 @@ const useCustomFloatingToolbar = ({
67042
67086
  focusedEditorId,
67043
67087
  hideToolbar,
67044
67088
  mousedown,
67045
- open: open2,
67089
+ open,
67046
67090
  readOnly,
67047
67091
  selectionExpanded,
67048
67092
  selectionText,
@@ -67076,7 +67120,7 @@ const useCustomFloatingToolbar = ({
67076
67120
  };
67077
67121
  }, []);
67078
67122
  React__default.useEffect(() => {
67079
- if (!selectionExpanded || !selectionText || mousedown && !open2 || hideToolbar || readOnly && !showWhenReadOnly) {
67123
+ if (!selectionExpanded || !selectionText || mousedown && !open || hideToolbar || readOnly && !showWhenReadOnly) {
67080
67124
  setOpen(false);
67081
67125
  } else if (selectionText && selectionExpanded && (!waitForCollapsedSelection || readOnly)) {
67082
67126
  setOpen(true);
@@ -67091,7 +67135,7 @@ const useCustomFloatingToolbar = ({
67091
67135
  selectionText,
67092
67136
  mousedown,
67093
67137
  waitForCollapsedSelection,
67094
- open2,
67138
+ open,
67095
67139
  readOnly
67096
67140
  ]);
67097
67141
  const { update } = floating;
@@ -67108,7 +67152,7 @@ const useCustomFloatingToolbar = ({
67108
67152
  );
67109
67153
  return {
67110
67154
  clickOutsideRef,
67111
- hidden: !open2,
67155
+ hidden: !open,
67112
67156
  props: {
67113
67157
  style: floating.style
67114
67158
  },
@@ -109836,11 +109880,11 @@ function perl(hljs) {
109836
109880
  /#/
109837
109881
  // valid but infrequent and weird
109838
109882
  ];
109839
- const PAIRED_DOUBLE_RE = (prefix, open2, close2 = "\\1") => {
109840
- const middle = close2 === "\\1" ? close2 : regex.concat(close2, open2);
109883
+ const PAIRED_DOUBLE_RE = (prefix, open, close2 = "\\1") => {
109884
+ const middle = close2 === "\\1" ? close2 : regex.concat(close2, open);
109841
109885
  return regex.concat(
109842
109886
  regex.concat("(?:", prefix, ")"),
109843
- open2,
109887
+ open,
109844
109888
  /(?:\\.|[^\\\/])*?/,
109845
109889
  middle,
109846
109890
  /(?:\\.|[^\\\/])*?/,
@@ -109848,10 +109892,10 @@ function perl(hljs) {
109848
109892
  REGEX_MODIFIERS
109849
109893
  );
109850
109894
  };
109851
- const PAIRED_RE = (prefix, open2, close2) => {
109895
+ const PAIRED_RE = (prefix, open, close2) => {
109852
109896
  return regex.concat(
109853
109897
  regex.concat("(?:", prefix, ")"),
109854
- open2,
109898
+ open,
109855
109899
  /(?:\\.|[^\\\/])*?/,
109856
109900
  close2,
109857
109901
  REGEX_MODIFIERS
@@ -118820,9 +118864,11 @@ mutation addPendingDocumentMutation(
118820
118864
  }
118821
118865
  });
118822
118866
  if (!res.ok) {
118823
- throw new Error(
118824
- `There was an error creating a new branch. ${res.statusText}`
118825
- );
118867
+ let errorMessage = `There was an error creating a new branch. ${res.statusText}`;
118868
+ if (res.status === 422) {
118869
+ errorMessage = `Please make sure you have made changes on ${branch} before creating a pull request.`;
118870
+ }
118871
+ throw new Error(errorMessage);
118826
118872
  }
118827
118873
  const values = await res.json();
118828
118874
  return values;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.0.0-f401991-20250801014410",
3
+ "version": "0.0.0-f471982-20250804064407",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -141,9 +141,9 @@
141
141
  "webfontloader": "1.6.28",
142
142
  "yup": "^1.6.1",
143
143
  "zod": "^3.24.2",
144
- "@tinacms/mdx": "0.0.0-f401991-20250801014410",
145
- "@tinacms/schema-tools": "0.0.0-f401991-20250801014410",
146
- "@tinacms/search": "0.0.0-f401991-20250801014410"
144
+ "@tinacms/mdx": "0.0.0-f471982-20250804064407",
145
+ "@tinacms/search": "0.0.0-f471982-20250804064407",
146
+ "@tinacms/schema-tools": "0.0.0-f471982-20250804064407"
147
147
  },
148
148
  "devDependencies": {
149
149
  "@graphql-tools/utils": "^10.8.1",