tinacms 0.0.0-e48ff80-20251203000400 → 0.0.0-e52f289-20251216060413

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { isHotkey } from "is-hotkey";
15
15
  import clsx$1, { clsx } from "clsx";
16
16
  import { Slot } from "@radix-ui/react-slot";
17
17
  import { isLangSupported, formatCodeBlock, insertEmptyCodeBlock, unwrapCodeBlock, isCodeBlockEmpty, isSelectionAtCodeBlockStart } from "@udecode/plate-code-block";
18
- import { X, Search, ChevronDown, Check, AlertTriangle, BracesIcon, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, PaintBucket, Quote, ChevronRight, ChevronsUpDown, 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, Settings, Strikethrough, Subscript, Superscript, Table, Text as Text$2, Underline, Link2Off, Eye, SeparatorHorizontal, Moon, SunMedium, Twitter, PaintBucketIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, Trash2Icon, ArrowUp, ArrowDown, XIcon, ArrowLeft, ArrowRight, EraserIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUp, Clock, CalendarCheck, Calendar as Calendar$1, CalendarDays, RotateCw, ChevronLeft, LoaderCircle, TriangleAlert, EllipsisVertical, GitBranchIcon, List as List$1, ListOrdered, Grid3x3Icon, Link, Unlink } from "lucide-react";
18
+ import { X, Search, ChevronDown, Check, AlertTriangle, BracesIcon, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, PaintBucket, Quote, ChevronRight, ChevronsUpDown, 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, Settings, Strikethrough, Subscript, Superscript, Table, Text as Text$2, Underline, Link2Off, Eye, SeparatorHorizontal, Moon, SunMedium, Twitter, PaintBucketIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, Trash2Icon, ArrowUp, ArrowDown, XIcon, ArrowLeft, ArrowRight, EraserIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUp, Clock, CalendarCheck, Calendar as Calendar$1, CalendarDays, RotateCw, ChevronLeft, LoaderCircle, TriangleAlert, History, EllipsisVertical, GitBranchIcon, List as List$1, ListOrdered, Grid3x3Icon, CircleX, Link, Unlink } from "lucide-react";
19
19
  import mermaid from "mermaid";
20
20
  import { cva } from "class-variance-authority";
21
21
  import { Command as Command$2 } from "cmdk";
@@ -43,10 +43,10 @@ import { twMerge } from "tailwind-merge";
43
43
  import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
44
44
  import { sortableKeyboardCoordinates, useSortable, SortableContext, verticalListSortingStrategy, defaultAnimateLayoutChanges } from "@dnd-kit/sortable";
45
45
  import { CSS } from "@dnd-kit/utilities";
46
- import * as pkg$1 from "react-color";
47
- import * as pkg from "color-string";
48
46
  import { buildSchema, print, getIntrospectionQuery, buildClientSchema, parse as parse$4 } from "graphql";
49
47
  import { diff as diff$1 } from "@graphql-inspector/core";
48
+ import { get as get$6, to as to$1 } from "color-string";
49
+ import { HexColorPicker } from "react-colorful";
50
50
  import * as dropzone from "react-dropzone";
51
51
  import { Command as Command$3 } from "@udecode/cmdk";
52
52
  import { Popover as Popover$4, PopoverButton, Transition, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
@@ -33524,7 +33524,8 @@ const buttonVariants$2 = cva(
33524
33524
  inlineLink: "text-base text-primary underline underline-offset-4",
33525
33525
  link: "text-primary underline-offset-4 hover:underline",
33526
33526
  outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
33527
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
33527
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
33528
+ tinaPrimary: "bg-tina-orange-dark text-white hover:bg-tina-orange-dark/90 disabled:bg-tina-orange-dark/50"
33528
33529
  }
33529
33530
  }
33530
33531
  }
@@ -38720,9 +38721,6 @@ function BiListUl(props) {
38720
38721
  function BiLockAlt(props) {
38721
38722
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 2C9.243 2 7 4.243 7 7v3H6c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2v-8c0-1.103-.897-2-2-2h-1V7c0-2.757-2.243-5-5-5zm6 10 .002 8H6v-8h12zm-9-2V7c0-1.654 1.346-3 3-3s3 1.346 3 3v3H9z" }, "child": [] }] })(props);
38722
38723
  }
38723
- function BiLock(props) {
38724
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 2C9.243 2 7 4.243 7 7v2H6c-1.103 0-2 .897-2 2v9c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2v-9c0-1.103-.897-2-2-2h-1V7c0-2.757-2.243-5-5-5zM9 7c0-1.654 1.346-3 3-3s3 1.346 3 3v2H9V7zm9.002 13H13v-2.278c.595-.347 1-.985 1-1.722 0-1.103-.897-2-2-2s-2 .897-2 2c0 .736.405 1.375 1 1.722V20H6v-9h12l.002 9z" }, "child": [] }] })(props);
38725
- }
38726
38724
  function BiMenu(props) {
38727
38725
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z" }, "child": [] }] })(props);
38728
38726
  }
@@ -39367,20 +39365,183 @@ const TextArea = React.forwardRef(({ ...props }, ref) => {
39367
39365
  }
39368
39366
  );
39369
39367
  });
39370
- const { get: getColor, to: toColor } = pkg;
39368
+ const TRANSPARENT = "transparent";
39369
+ const isValidHex = (value) => /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(value);
39370
+ const expandHex = (hex) => {
39371
+ const h = hex.replace("#", "");
39372
+ if (h.length === 3) {
39373
+ return `#${h[0]}${h[0]}${h[1]}${h[1]}${h[2]}${h[2]}`.toUpperCase();
39374
+ }
39375
+ return `#${h.toUpperCase()}`;
39376
+ };
39377
+ const hexToRgb = (hex) => {
39378
+ if (!hex || !isValidHex(hex))
39379
+ return null;
39380
+ const expanded = expandHex(hex).replace("#", "");
39381
+ return {
39382
+ r: parseInt(expanded.substring(0, 2), 16),
39383
+ g: parseInt(expanded.substring(2, 4), 16),
39384
+ b: parseInt(expanded.substring(4, 6), 16)
39385
+ };
39386
+ };
39387
+ const rgbToHex = (r2, g, b) => `#${((1 << 24) + (r2 << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
39388
+ const checkerboardStyle$1 = (size2 = 8) => ({
39389
+ backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
39390
+ backgroundSize: `${size2}px ${size2}px`,
39391
+ backgroundPosition: `0 0, 0 ${size2 / 2}px, ${size2 / 2}px -${size2 / 2}px, -${size2 / 2}px 0px`
39392
+ });
39393
+ const normalizeColorValue = (value) => {
39394
+ if (isValidHex(value)) {
39395
+ return expandHex(value);
39396
+ }
39397
+ const parsed = get$6(value.toLowerCase());
39398
+ if (parsed)
39399
+ return rgbToHex(parsed.value[0], parsed.value[1], parsed.value[2]);
39400
+ return null;
39401
+ };
39402
+ const useHexInput = (color, onChange) => {
39403
+ const [inputValue, setInputValue] = React.useState(color);
39404
+ const [isFocused2, setIsFocused] = React.useState(false);
39405
+ React.useEffect(() => {
39406
+ if (!isFocused2) {
39407
+ setInputValue(color);
39408
+ }
39409
+ }, [color, isFocused2]);
39410
+ const handleChange = (e3) => {
39411
+ const value = e3.target.value;
39412
+ setInputValue(value);
39413
+ const normalized = normalizeColorValue(value);
39414
+ if (normalized)
39415
+ onChange(normalized);
39416
+ };
39417
+ const handleFocus = () => {
39418
+ setIsFocused(true);
39419
+ };
39420
+ const handleBlur = () => {
39421
+ setIsFocused(false);
39422
+ const normalized = normalizeColorValue(inputValue);
39423
+ if (normalized) {
39424
+ setInputValue(normalized);
39425
+ onChange(normalized);
39426
+ } else {
39427
+ setInputValue(color);
39428
+ }
39429
+ };
39430
+ const handleSwatchClick = React.useCallback(
39431
+ (c2) => {
39432
+ if (c2 === TRANSPARENT) {
39433
+ onChange(null);
39434
+ } else {
39435
+ const normalized = normalizeColorValue(c2);
39436
+ onChange(normalized || c2);
39437
+ }
39438
+ },
39439
+ [onChange]
39440
+ );
39441
+ return {
39442
+ inputValue,
39443
+ handleChange,
39444
+ handleFocus,
39445
+ handleBlur,
39446
+ handleSwatchClick
39447
+ };
39448
+ };
39449
+ const SwatchButton = ({ color, isSelected: isSelected2, onClick }) => /* @__PURE__ */ React.createElement("div", { className: "relative w-full pb-[100%]" }, /* @__PURE__ */ React.createElement(
39450
+ "button",
39451
+ {
39452
+ type: "button",
39453
+ onClick,
39454
+ className: `absolute inset-0 rounded-sm border cursor-pointer transition-all ${isSelected2 ? "border-blue-500 border-2 scale-110" : "border-gray-200 hover:scale-105"}`,
39455
+ style: {
39456
+ backgroundColor: color === TRANSPARENT ? "#FFF" : color,
39457
+ ...color === TRANSPARENT ? checkerboardStyle$1() : {}
39458
+ },
39459
+ "aria-label": color === TRANSPARENT ? "Clear color" : `Select color ${color}`
39460
+ }
39461
+ ));
39462
+ const ColorPreview = ({
39463
+ color,
39464
+ size: size2 = "sm"
39465
+ }) => /* @__PURE__ */ React.createElement(
39466
+ "div",
39467
+ {
39468
+ className: size2 === "lg" ? "h-16 w-full rounded border border-gray-200 mb-2" : "w-8 h-8 rounded border border-gray-200 flex-shrink-0",
39469
+ style: {
39470
+ backgroundColor: color || TRANSPARENT,
39471
+ ...!color ? checkerboardStyle$1(size2 === "lg" ? 16 : 8) : {}
39472
+ },
39473
+ "aria-label": "Current color preview"
39474
+ }
39475
+ );
39476
+ const HexInput = ({ value, onChange, onFocus, onBlur, fullWidth }) => /* @__PURE__ */ React.createElement(
39477
+ "input",
39478
+ {
39479
+ type: "text",
39480
+ value: value || "",
39481
+ onChange,
39482
+ onFocus,
39483
+ onBlur,
39484
+ placeholder: "#000000 or color name",
39485
+ className: `shadow-inner px-2 py-1 text-sm border border-gray-200 rounded focus:shadow-outline focus:border-blue-500 focus:outline-none ${fullWidth ? "w-full" : "flex-1 min-w-0"}`
39486
+ }
39487
+ );
39488
+ const SwatchGrid = ({ colors, selectedColor, onSelect }) => /* @__PURE__ */ React.createElement("div", { className: "mt-2 grid grid-cols-8 gap-1.5" }, colors.map((c2) => /* @__PURE__ */ React.createElement(
39489
+ SwatchButton,
39490
+ {
39491
+ key: c2,
39492
+ color: c2,
39493
+ isSelected: (selectedColor == null ? void 0 : selectedColor.toLowerCase()) === c2.toLowerCase(),
39494
+ onClick: () => onSelect(c2)
39495
+ }
39496
+ )));
39497
+ const BlockWidget = ({
39498
+ presetColors: presetColors2,
39499
+ color,
39500
+ onChange,
39501
+ width
39502
+ }) => {
39503
+ const {
39504
+ inputValue,
39505
+ handleChange,
39506
+ handleFocus,
39507
+ handleBlur,
39508
+ handleSwatchClick
39509
+ } = useHexInput(color, onChange);
39510
+ return /* @__PURE__ */ React.createElement(
39511
+ "div",
39512
+ {
39513
+ className: "bg-white rounded-lg shadow-lg overflow-hidden",
39514
+ style: { width }
39515
+ },
39516
+ /* @__PURE__ */ React.createElement("div", { className: "p-3" }, /* @__PURE__ */ React.createElement(ColorPreview, { color, size: "lg" }), /* @__PURE__ */ React.createElement(
39517
+ HexInput,
39518
+ {
39519
+ value: inputValue,
39520
+ onChange: handleChange,
39521
+ onFocus: handleFocus,
39522
+ onBlur: handleBlur,
39523
+ fullWidth: true
39524
+ }
39525
+ ), /* @__PURE__ */ React.createElement(
39526
+ SwatchGrid,
39527
+ {
39528
+ colors: presetColors2,
39529
+ selectedColor: color,
39530
+ onSelect: handleSwatchClick
39531
+ }
39532
+ ))
39533
+ );
39534
+ };
39371
39535
  var ColorFormat = /* @__PURE__ */ ((ColorFormat2) => {
39372
39536
  ColorFormat2["Hex"] = "hex";
39373
39537
  ColorFormat2["RGB"] = "rgb";
39374
39538
  return ColorFormat2;
39375
39539
  })(ColorFormat || {});
39376
- const rgbToHex = function(color) {
39377
- return "#" + ((1 << 24) + (color.r << 16) + (color.g << 8) + color.b).toString(16).slice(1);
39378
- };
39379
39540
  function ParseColorStr(color) {
39380
39541
  if (!color) {
39381
39542
  return null;
39382
39543
  }
39383
- const colorDescriptor = getColor(color);
39544
+ const colorDescriptor = get$6(color);
39384
39545
  if (!colorDescriptor)
39385
39546
  return null;
39386
39547
  const colorVals = colorDescriptor.value;
@@ -39396,7 +39557,7 @@ const ColorFormatter = {
39396
39557
  },
39397
39558
  getValue(color) {
39398
39559
  const colorVals = [color.r, color.g, color.b, color.a];
39399
- return toColor.rgb(colorVals);
39560
+ return to$1.rgb(colorVals);
39400
39561
  },
39401
39562
  parse: ParseColorStr
39402
39563
  },
@@ -39405,37 +39566,88 @@ const ColorFormatter = {
39405
39566
  /* Hex */
39406
39567
  ]: {
39407
39568
  getLabel(color) {
39408
- return rgbToHex(color);
39569
+ return rgbToHex(color.r, color.g, color.b);
39409
39570
  },
39410
39571
  getValue(color) {
39411
39572
  const colorVals = [color.r, color.g, color.b, color.a];
39412
- return toColor.hex(colorVals);
39573
+ return to$1.hex(colorVals).toUpperCase();
39413
39574
  },
39414
39575
  parse: ParseColorStr
39415
39576
  }
39416
39577
  };
39417
- const { SketchPicker, BlockPicker } = pkg$1;
39418
- const GetTextColorForBackground = function(backgroundColor) {
39419
- return !backgroundColor || backgroundColor.r * 0.299 + backgroundColor.g * 0.587 + backgroundColor.b * 0.114 > 186 ? "#000000" : "#ffffff";
39578
+ const SketchWidget = ({
39579
+ presetColors: presetColors2,
39580
+ color,
39581
+ onChange,
39582
+ width
39583
+ }) => {
39584
+ const {
39585
+ inputValue,
39586
+ handleChange,
39587
+ handleFocus,
39588
+ handleBlur,
39589
+ handleSwatchClick
39590
+ } = useHexInput(color, onChange);
39591
+ const currentRgb = hexToRgb(color) || { r: 0, g: 0, b: 0 };
39592
+ const handleRgbChange = (channel, value) => {
39593
+ const num = Math.max(0, Math.min(255, parseInt(value, 10) || 0));
39594
+ const updated = { ...currentRgb, [channel]: num };
39595
+ onChange(rgbToHex(updated.r, updated.g, updated.b));
39596
+ };
39597
+ return /* @__PURE__ */ React.createElement("div", { className: "bg-white rounded-lg shadow-lg p-3", style: { width } }, /* @__PURE__ */ React.createElement(
39598
+ HexColorPicker,
39599
+ {
39600
+ color: color || "#000000",
39601
+ onChange,
39602
+ className: "!w-full !h-[150px]"
39603
+ }
39604
+ ), /* @__PURE__ */ React.createElement("div", { className: "mt-2 flex gap-2 items-center" }, /* @__PURE__ */ React.createElement(ColorPreview, { color }), /* @__PURE__ */ React.createElement(
39605
+ HexInput,
39606
+ {
39607
+ value: inputValue,
39608
+ onChange: handleChange,
39609
+ onFocus: handleFocus,
39610
+ onBlur: handleBlur
39611
+ }
39612
+ )), /* @__PURE__ */ React.createElement("div", { className: "mt-2 flex gap-2" }, ["r", "g", "b"].map((channel) => /* @__PURE__ */ React.createElement("div", { key: channel, className: "flex-1" }, /* @__PURE__ */ React.createElement("label", { className: "block text-xs text-gray-500 mb-0.5" }, channel.toUpperCase()), /* @__PURE__ */ React.createElement(
39613
+ "input",
39614
+ {
39615
+ type: "number",
39616
+ min: 0,
39617
+ max: 255,
39618
+ value: currentRgb[channel],
39619
+ onChange: (e3) => handleRgbChange(channel, e3.target.value),
39620
+ className: "shadow-inner w-full px-2 py-1 text-sm border border-gray-200 rounded focus:shadow-outline focus:border-blue-500 focus:outline-none"
39621
+ }
39622
+ )))), /* @__PURE__ */ React.createElement(
39623
+ SwatchGrid,
39624
+ {
39625
+ colors: presetColors2,
39626
+ selectedColor: color,
39627
+ onSelect: handleSwatchClick
39628
+ }
39629
+ ));
39630
+ };
39631
+ const isLightBackground = function(backgroundColor) {
39632
+ return !backgroundColor || backgroundColor.r * 0.299 + backgroundColor.g * 0.587 + backgroundColor.b * 0.114 > 186;
39420
39633
  };
39421
- const Swatch = ({
39422
- colorRGBA,
39423
- colorFormat,
39424
- unselectable,
39425
- ...props
39426
- }) => /* @__PURE__ */ React.createElement(
39634
+ const getTextColorForBackground = function(backgroundColor) {
39635
+ return isLightBackground(backgroundColor) ? "#000000" : "#FFFFFF";
39636
+ };
39637
+ const Swatch = ({ colorRGBA, colorFormat, width, ...props }) => /* @__PURE__ */ React.createElement(
39427
39638
  "div",
39428
39639
  {
39429
- className: "bg-gray-100 rounded-3xl shadow-[0_2px_3px_rgba(0,0,0,0.12)] cursor-pointer w-full m-0",
39640
+ className: "bg-gray-100 rounded shadow-[0_2px_3px_rgba(0,0,0,0.12)] cursor-pointer m-0",
39641
+ style: { width },
39430
39642
  ...props
39431
39643
  },
39432
39644
  /* @__PURE__ */ React.createElement(
39433
39645
  "div",
39434
39646
  {
39435
- className: "swatch-inner flex items-center justify-center text-[13px] font-bold w-full h-10 rounded-3xl hover:opacity-[.6]",
39647
+ className: "swatch-inner flex items-center justify-center text-[13px] font-bold w-full h-10 rounded hover:opacity-[.6]",
39436
39648
  style: {
39437
39649
  background: colorRGBA ? `rgba(${colorRGBA.r}, ${colorRGBA.g}, ${colorRGBA.b}, ${colorRGBA.a})` : `#fff`,
39438
- color: GetTextColorForBackground(colorRGBA),
39650
+ color: getTextColorForBackground(colorRGBA),
39439
39651
  transition: "all var(--tina-timing-short) ease-out"
39440
39652
  }
39441
39653
  },
@@ -39451,7 +39663,7 @@ const Popover$2 = ({
39451
39663
  }) => /* @__PURE__ */ React.createElement(
39452
39664
  "div",
39453
39665
  {
39454
- className: `fixed z-50 before:content-[""] before:absolute before:left-1/2 before:-translate-x-1/2 before:w-[18px] before:h-[14px] before:bg-gray-200 before:z-10 after:content-[""] after:absolute after:left-1/2 after:-translate-x-1/2 after:w-4 after:h-[13px] after:bg-white after:z-20 ${openTop ? "before:bottom-0 before:mt-[1px] before:translate-y-full color-picker-on-top-clip-path after:bottom-0 after:mb-0.5 after:translate-y-full" : "before:top-0 before:mb-[1px] before:-translate-y-full color-picker-clip-path after:top-0 after:mt-0.5 after:-translate-y-full"} ${className}`,
39666
+ className: `fixed z-50 before:content-[""] before:absolute before:left-1/2 before:-translate-x-1/2 before:w-[18px] before:h-[14px] before:bg-white before:z-10 after:content-[""] after:absolute after:left-1/2 after:-translate-x-1/2 after:w-4 after:h-[13px] after:bg-white after:z-20 ${openTop ? "before:bottom-0 before:mt-[1px] before:translate-y-full color-picker-on-top-clip-path after:bottom-0 after:mb-0.5 after:translate-y-full" : "before:top-0 before:mb-[1px] before:-translate-y-full color-picker-clip-path after:top-0 after:mt-0.5 after:-translate-y-full"} ${className}`,
39455
39667
  style: {
39456
39668
  top: triggerBoundingBox ? openTop ? triggerBoundingBox.top : triggerBoundingBox.bottom : 0,
39457
39669
  left: triggerBoundingBox ? triggerBoundingBox.left + triggerBoundingBox.width / 2 : 0,
@@ -39463,7 +39675,6 @@ const Popover$2 = ({
39463
39675
  ...props
39464
39676
  }
39465
39677
  );
39466
- const nullColor = "transparent";
39467
39678
  const presetColors = [
39468
39679
  "#D0021B",
39469
39680
  "#F5A623",
@@ -39481,93 +39692,69 @@ const presetColors = [
39481
39692
  "#9B9B9B",
39482
39693
  "#FFFFFF"
39483
39694
  ];
39484
- const SketchWidget = (props) => /* @__PURE__ */ React.createElement(
39485
- SketchPicker,
39486
- {
39487
- presetColors: props.presetColors,
39488
- color: props.color,
39489
- onChange: props.onChange,
39490
- disableAlpha: props.disableAlpha,
39491
- width: props.width
39492
- }
39493
- );
39494
- const BlockWidget = (props) => /* @__PURE__ */ React.createElement(
39495
- BlockPicker,
39496
- {
39497
- colors: props.presetColors,
39498
- color: props.color,
39499
- onChange: props.onChange,
39500
- width: props.width
39501
- }
39502
- );
39503
39695
  const WIDGETS = { sketch: SketchWidget, block: BlockWidget };
39504
39696
  const ColorPicker = ({
39505
39697
  colorFormat,
39506
39698
  userColors = presetColors,
39507
39699
  widget = "sketch",
39700
+ width,
39508
39701
  input
39509
39702
  }) => {
39510
39703
  const FormPortal = useFormPortal();
39511
39704
  const triggerRef = React.useRef(null);
39512
39705
  const [triggerBoundingBox, setTriggerBoundingBox] = useState(null);
39513
- const [openTop, setOpenTop] = useState(false);
39706
+ const [displayColorPicker, setDisplayColorPicker] = useState(false);
39514
39707
  const updateTriggerBoundingBox = () => {
39515
- if (triggerRef.current) {
39708
+ if (triggerRef.current)
39516
39709
  setTriggerBoundingBox(triggerRef.current.getBoundingClientRect());
39517
- }
39518
39710
  };
39519
- React.useEffect(() => {
39520
- if (triggerBoundingBox) {
39521
- const triggerOffsetTop = triggerBoundingBox.top + triggerBoundingBox.height / 2;
39522
- const windowHeight = window.innerHeight;
39523
- if (triggerOffsetTop > windowHeight / 2) {
39524
- setOpenTop(true);
39525
- } else {
39526
- setOpenTop(false);
39527
- }
39528
- }
39529
- }, [triggerBoundingBox]);
39711
+ const openTop = triggerBoundingBox ? triggerBoundingBox.top + triggerBoundingBox.height / 2 > window.innerHeight / 2 : false;
39530
39712
  React.useEffect(() => {
39531
39713
  const delay = 100;
39532
- let timeout = false;
39533
- setTimeout(() => {
39534
- updateTriggerBoundingBox();
39535
- }, delay);
39714
+ let timeout = null;
39715
+ timeout = setTimeout(updateTriggerBoundingBox, delay);
39536
39716
  const handleResize = () => {
39537
- clearTimeout(timeout);
39717
+ if (timeout)
39718
+ clearTimeout(timeout);
39538
39719
  timeout = setTimeout(updateTriggerBoundingBox, delay);
39539
39720
  };
39540
39721
  window.addEventListener("resize", handleResize);
39541
- return () => {
39542
- window.removeEventListener("resize", handleResize);
39543
- };
39544
- }, [triggerRef.current]);
39545
- const Widget = WIDGETS[widget];
39546
- if (!Widget)
39547
- throw new Error("You must specify a widget type.");
39548
- const [displayColorPicker, setDisplayColorPicker] = useState(false);
39722
+ return () => window.removeEventListener("resize", handleResize);
39723
+ }, []);
39549
39724
  const getColorFormat = (colorFormat || ColorFormat.Hex).toLowerCase();
39550
39725
  const getColorRGBA = input.value ? ColorFormatter[getColorFormat].parse(input.value) : null;
39551
- const handleChange = (pickerColor) => {
39552
- const color = pickerColor.hex === nullColor ? null : { ...pickerColor.rgb, a: 1 };
39553
- input.onChange(
39554
- color ? ColorFormatter[getColorFormat].getValue(color) : null
39555
- );
39556
- };
39726
+ const currentHexColor = getColorRGBA ? rgbToHex(getColorRGBA.r, getColorRGBA.g, getColorRGBA.b) : "";
39727
+ const handleChange = useCallback(
39728
+ (hexColor) => {
39729
+ if (!hexColor) {
39730
+ input.onChange(null);
39731
+ return;
39732
+ }
39733
+ const rgb = hexToRgb(hexColor);
39734
+ if (rgb)
39735
+ input.onChange(
39736
+ ColorFormatter[getColorFormat].getValue({ ...rgb, a: 1 })
39737
+ );
39738
+ },
39739
+ [getColorFormat, input]
39740
+ );
39557
39741
  const toggleColorPicker = (event) => {
39558
39742
  event.stopPropagation();
39559
39743
  const display = !displayColorPicker;
39560
39744
  setDisplayColorPicker(display);
39561
- if (display) {
39745
+ if (display)
39562
39746
  updateTriggerBoundingBox();
39563
- }
39564
39747
  };
39565
- return /* @__PURE__ */ React.createElement("div", { className: "relative", ref: triggerRef }, /* @__PURE__ */ React.createElement(
39748
+ const Widget = WIDGETS[widget];
39749
+ if (!Widget)
39750
+ throw new Error("You must specify a widget type.");
39751
+ return /* @__PURE__ */ React.createElement("div", { className: "relative", ref: triggerRef, style: { width } }, /* @__PURE__ */ React.createElement(
39566
39752
  Swatch,
39567
39753
  {
39568
39754
  onClick: toggleColorPicker,
39569
39755
  colorRGBA: getColorRGBA,
39570
- colorFormat: getColorFormat
39756
+ colorFormat: getColorFormat,
39757
+ width
39571
39758
  }
39572
39759
  ), displayColorPicker && /* @__PURE__ */ React.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React.createElement(
39573
39760
  Popover$2,
@@ -39587,11 +39774,10 @@ const ColorPicker = ({
39587
39774
  /* @__PURE__ */ React.createElement(
39588
39775
  Widget,
39589
39776
  {
39590
- presetColors: [...userColors, nullColor],
39591
- color: getColorRGBA || { r: 0, g: 0, b: 0, a: 0 },
39777
+ presetColors: [...userColors, TRANSPARENT],
39778
+ color: currentHexColor,
39592
39779
  onChange: handleChange,
39593
- disableAlpha: true,
39594
- width: "240px"
39780
+ width: width || "240px"
39595
39781
  }
39596
39782
  )
39597
39783
  )
@@ -41338,6 +41524,7 @@ const ColorField = wrapFieldsWithMeta(
41338
41524
  colorFormat: field.colorFormat,
41339
41525
  userColors: field.colors,
41340
41526
  widget: field.widget,
41527
+ width: field.width,
41341
41528
  input
41342
41529
  }
41343
41530
  );
@@ -43781,7 +43968,7 @@ const Badge = ({
43781
43968
  children
43782
43969
  );
43783
43970
  };
43784
- const tableHeadingStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider sticky top-0 bg-gray-100 z-20 border-b-2 border-gray-200";
43971
+ const tableHeadingStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider sticky top-0 bg-gray-100 z-20 border-b-2 border-gray-200 ";
43785
43972
  function formatBranchName(str) {
43786
43973
  const pattern = /[^/\w-]+/g;
43787
43974
  const formattedStr = str.replace(pattern, "-");
@@ -44017,6 +44204,9 @@ const BranchSelector = ({
44017
44204
  const [search, setSearch] = React.useState("");
44018
44205
  const [filter2, setFilter] = React.useState("content");
44019
44206
  const [sortValue, setSortValue] = React.useState("default");
44207
+ const [selectedBranch, setSelectedBranch] = React.useState(
44208
+ null
44209
+ );
44020
44210
  const cms = useCMS$1();
44021
44211
  const filteredBranchList = getFilteredBranchList(
44022
44212
  branchList,
@@ -44076,7 +44266,19 @@ const BranchSelector = ({
44076
44266
  }
44077
44267
  ]
44078
44268
  }
44079
- ))), 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(TooltipProvider$1, null, /* @__PURE__ */ React.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto w-full h-full rounded-lg shadow-inner bg-white border border-gray-200" }, /* @__PURE__ */ React.createElement("table", { className: "w-full table-fixed" }, /* @__PURE__ */ React.createElement("thead", { className: "sticky top-0 z-20 bg-gray-100 border-b-2 border-gray-200" }, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", { className: `${tableHeadingStyle} max-w-[30%]` }, "Branch Name"), /* @__PURE__ */ React.createElement("th", { className: tableHeadingStyle }, "Last Updated"), /* @__PURE__ */ React.createElement("th", { className: tableHeadingStyle }), /* @__PURE__ */ React.createElement("th", { className: tableHeadingStyle }))), /* @__PURE__ */ React.createElement("tbody", null, filteredBranchList.map((branch) => /* @__PURE__ */ React.createElement(
44269
+ ))), 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(TooltipProvider$1, null, /* @__PURE__ */ React.createElement("div", { className: "rounded-lg border border-gray-200 overflow-hidden" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto w-full h-full shadow-inner bg-white" }, /* @__PURE__ */ React.createElement("table", { className: "w-full table-auto max-h-[24rem]" }, /* @__PURE__ */ React.createElement("thead", { className: "sticky top-0 z-20 bg-gray-100 border-b-2 border-gray-200" }, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", { className: `${tableHeadingStyle} w-auto` }, "Branch Name"), /* @__PURE__ */ React.createElement(
44270
+ "th",
44271
+ {
44272
+ className: `${tableHeadingStyle} w-0 whitespace-nowrap text-left`
44273
+ },
44274
+ "Last Updated"
44275
+ ), /* @__PURE__ */ React.createElement(
44276
+ "th",
44277
+ {
44278
+ className: `${tableHeadingStyle} w-0 whitespace-nowrap text-left`
44279
+ },
44280
+ "Pull Request"
44281
+ ))), /* @__PURE__ */ React.createElement("tbody", null, filteredBranchList.map((branch) => /* @__PURE__ */ React.createElement(
44080
44282
  BranchItem,
44081
44283
  {
44082
44284
  key: branch.name,
@@ -44085,9 +44287,24 @@ const BranchSelector = ({
44085
44287
  onChange,
44086
44288
  refreshBranchList,
44087
44289
  previewFunction,
44088
- cms
44290
+ cms,
44291
+ selectedBranch,
44292
+ onSelectBranch: setSelectedBranch
44089
44293
  }
44090
- )))))));
44294
+ ))))))), /* @__PURE__ */ React.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ React.createElement(
44295
+ Button$2,
44296
+ {
44297
+ variant: "primary",
44298
+ onClick: () => {
44299
+ onChange(selectedBranch);
44300
+ },
44301
+ disabled: !selectedBranch || selectedBranch === currentBranch
44302
+ },
44303
+ "Open branch in editor"
44304
+ )));
44305
+ };
44306
+ const extractPullRequestId = (url) => {
44307
+ return url.split("/").pop() || "";
44091
44308
  };
44092
44309
  const BranchItem = ({
44093
44310
  branch,
@@ -44095,9 +44312,11 @@ const BranchItem = ({
44095
44312
  onChange,
44096
44313
  refreshBranchList,
44097
44314
  previewFunction,
44098
- cms
44315
+ cms,
44316
+ selectedBranch,
44317
+ onSelectBranch
44099
44318
  }) => {
44100
- var _a2, _b;
44319
+ var _a2;
44101
44320
  const [creatingPR, setCreatingPR] = React.useState(false);
44102
44321
  const handleCreatePullRequest = async () => {
44103
44322
  if (creatingPR)
@@ -44121,62 +44340,63 @@ const BranchItem = ({
44121
44340
  }
44122
44341
  };
44123
44342
  const isCurrentBranch = branch.name === currentBranch;
44343
+ const isSelected2 = selectedBranch === branch.name;
44124
44344
  const indexingStatus = (_a2 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a2.status;
44345
+ const handleRowClick = () => {
44346
+ if (indexingStatus === "complete" && !isCurrentBranch) {
44347
+ onSelectBranch(isSelected2 ? null : branch.name);
44348
+ }
44349
+ };
44125
44350
  return /* @__PURE__ */ React.createElement(
44126
44351
  "tr",
44127
44352
  {
44128
- className: `text-base border-l-0 border-t-0 border-r-0 outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "bg-blue-50 text-blue-800 border-b-0" : "border-b-2 border-gray-50"}`
44353
+ onClick: handleRowClick,
44354
+ className: `text-base border-l-0 transition-colors border-t-0 border-r-0 outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "border-b-2 border-gray-50" : isSelected2 ? "bg-blue-100 text-blue-900 border-b-2 border-blue-50 cursor-pointer" : "border-b-2 border-gray-50 hover:bg-gray-50/50 cursor-pointer"}`
44129
44355
  },
44130
- /* @__PURE__ */ React.createElement("td", { className: "pl-3 pr-3 py-1.5" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 min-w-0" }, branch.protected && /* @__PURE__ */ React.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500 flex-shrink-0" }), /* @__PURE__ */ React.createElement(Tooltip$1, { delayDuration: 300 }, /* @__PURE__ */ React.createElement(TooltipTrigger$1, { asChild: true }, /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight truncate block min-w-0 cursor-default" }, branch.name)), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent$1, { side: "top" }, branch.name)))), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status })))),
44356
+ /* @__PURE__ */ React.createElement(
44357
+ "td",
44358
+ {
44359
+ className: `pl-3 pr-3 max-w-xs ${isCurrentBranch ? "py-2.5" : "py-1.5"}`
44360
+ },
44361
+ /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 min-w-0" }, branch.protected ? /* @__PURE__ */ React.createElement(BiLockAlt, { className: "w-4 h-auto opacity-70 text-blue-500 flex-shrink-0" }) : /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-4 h-auto opacity-70 text-gray-600 flex-shrink-0" }), /* @__PURE__ */ React.createElement(Tooltip$1, { delayDuration: 300 }, /* @__PURE__ */ React.createElement(TooltipTrigger$1, { asChild: true }, /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight truncate block min-w-0 cursor-default" }, branch.name)), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent$1, { side: "top" }, branch.name)))), isCurrentBranch && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(
44362
+ Badge,
44363
+ {
44364
+ calloutStyle: "info",
44365
+ className: "w-fit flex-shrink-0",
44366
+ displayIcon: false
44367
+ },
44368
+ /* @__PURE__ */ React.createElement(BiPencil, { className: "w-3 h-auto inline-block mr-1" }),
44369
+ "Currently editing"
44370
+ )), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status })))
44371
+ ),
44131
44372
  /* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 min-w-0" }, creatingPR ? /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold text-blue-600" }, "Creating PR"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight text-blue-500" }, "Please wait...")), /* @__PURE__ */ React.createElement(FaSpinner, { className: "w-3 h-auto animate-spin text-blue-500" })) : /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight whitespace-nowrap" }, formatDistanceToNow$1(new Date(branch.indexStatus.timestamp), {
44132
44373
  addSuffix: true
44133
44374
  }))),
44134
- /* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 text-left" }, indexingStatus === "complete" && !isCurrentBranch && /* @__PURE__ */ React.createElement(
44375
+ /* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 flex", onClick: (e3) => e3.stopPropagation() }, branch.githubPullRequestUrl ? /* @__PURE__ */ React.createElement(
44135
44376
  Button$2,
44136
44377
  {
44137
44378
  variant: "white",
44138
44379
  size: "custom",
44139
44380
  onClick: () => {
44140
- onChange(branch.name);
44381
+ window.open(branch.githubPullRequestUrl, "_blank");
44141
44382
  },
44142
- className: "cursor-pointer text-sm h-9 px-4 flex items-center gap-1"
44383
+ className: "cursor-pointer h-9 px-2 flex items-center gap-1",
44384
+ title: "Open Git Pull Request"
44143
44385
  },
44144
- /* @__PURE__ */ React.createElement(BiPencil, { className: "h-4 w-auto text-blue-500 opacity-70 -mt-px" }),
44145
- " ",
44146
- "Select"
44147
- ), indexingStatus === "complete" && isCurrentBranch && /* @__PURE__ */ React.createElement(Badge, { calloutStyle: "info", className: "w-fit", displayIcon: false }, /* @__PURE__ */ React.createElement("span", null, "Selected"))),
44148
- /* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 text-right" }, /* @__PURE__ */ React.createElement(
44149
- OverflowMenu$1,
44150
- {
44151
- toolbarItems: [
44152
- branch.githubPullRequestUrl && {
44153
- name: "github-pr",
44154
- label: "View in GitHub",
44155
- Icon: /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "w-5 h-auto text-blue-500 opacity-70" }),
44156
- onMouseDown: () => {
44157
- window.open(branch.githubPullRequestUrl, "_blank");
44158
- }
44159
- },
44160
- !branch.githubPullRequestUrl && !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() && {
44161
- name: "create-pr",
44162
- label: "Create Pull Request",
44163
- Icon: /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500 opacity-70" }),
44164
- onMouseDown: () => handleCreatePullRequest()
44165
- },
44166
- typeof previewFunction === "function" && ((_b = previewFunction({ branch: branch.name })) == null ? void 0 : _b.url) && {
44167
- name: "preview",
44168
- label: "Preview",
44169
- onMouseDown: () => {
44170
- var _a3;
44171
- const previewUrl = (_a3 = previewFunction({
44172
- branch: branch.name
44173
- })) == null ? void 0 : _a3.url;
44174
- window.open(previewUrl, "_blank");
44175
- }
44176
- }
44177
- ].filter(Boolean)
44178
- }
44179
- ))
44386
+ /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "h-3.5 w-auto text-gray-700 flex-shrink-0" }),
44387
+ /* @__PURE__ */ React.createElement("span", { className: "text-sm truncate max-w-[120px]" }, "PR: ", extractPullRequestId(branch.githubPullRequestUrl))
44388
+ ) : !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() ? /* @__PURE__ */ React.createElement(
44389
+ Button$2,
44390
+ {
44391
+ variant: "white",
44392
+ size: "custom",
44393
+ onClick: handleCreatePullRequest,
44394
+ className: "cursor-pointer h-9 px-2 flex items-center gap-1",
44395
+ title: "Create Pull Request"
44396
+ },
44397
+ /* @__PURE__ */ React.createElement(BiGitBranch, { className: "h-3.5 w-auto text-gray-700 flex-shrink-0" }),
44398
+ /* @__PURE__ */ React.createElement("span", { className: "text-sm whitespace-nowrap" }, "Create PR")
44399
+ ) : null)
44180
44400
  );
44181
44401
  };
44182
44402
  const IndexStatus = ({ indexingStatus }) => {
@@ -45485,7 +45705,7 @@ function GridMediaItem({ item, active, onClick }) {
45485
45705
  src: thumbnail,
45486
45706
  alt: item.filename
45487
45707
  }
45488
- )) : /* @__PURE__ */ React__default.createElement("div", { className: "p-4 w-full flex flex-col gap-4 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(FileIcon, { className: "w-[30%] h-auto fill-gray-300" }), /* @__PURE__ */ React__default.createElement("span", { className: "block text-base text-gray-600 w-full break-words truncate" }, item.filename)))
45708
+ )) : /* @__PURE__ */ React__default.createElement("div", { className: "p-4 w-full flex flex-col gap-4 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(FileIcon, { className: "w-[40%] h-auto fill-gray-300", size: 40 })))
45489
45709
  ));
45490
45710
  }
45491
45711
  const DeleteModal$1 = ({
@@ -46296,12 +46516,12 @@ const Callout = ({
46296
46516
  className = "",
46297
46517
  ...props
46298
46518
  }) => {
46299
- const commonAlertStyles = "text-sm px-4 py-3 rounded-md border";
46519
+ const commonAlertStyles = "text-sm px-4 py-3 rounded-md border-2 font bg-white text-gray-700 font-medium";
46300
46520
  const styles = {
46301
- warning: `text-amber-700 bg-amber-100 border-amber-700/20`,
46302
- info: `text-blue-600 bg-blue-100/50 border-blue-600/20`,
46303
- success: `text-green-600 bg-green-100/50 border-green-600/20`,
46304
- error: `text-red-600 bg-red-100/50 border-red-600/20`
46521
+ warning: `border-amber-700/20`,
46522
+ info: `border-blue-600/20`,
46523
+ success: `border-green-600/20`,
46524
+ error: `border-red-600/20`
46305
46525
  };
46306
46526
  const icon = {
46307
46527
  warning: /* @__PURE__ */ React.createElement(MdWarning, { className: "w-5 h-auto inline-block mr-1 opacity-70 text-amber-600" }),
@@ -46414,7 +46634,7 @@ const NavProvider = ({
46414
46634
  };
46415
46635
  return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
46416
46636
  };
46417
- const version$1 = "3.0.0";
46637
+ const version$1 = "3.1.0";
46418
46638
  const VersionInfo = () => {
46419
46639
  var _a2, _b, _c, _d, _e, _f;
46420
46640
  const cms = useCMS();
@@ -47100,8 +47320,25 @@ const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createEl
47100
47320
  ...props
47101
47321
  }
47102
47322
  );
47323
+ const TooltipProvider = TooltipPrimitive.Provider;
47324
+ const Tooltip = TooltipPrimitive.Root;
47325
+ const TooltipTrigger = TooltipPrimitive.Trigger;
47326
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
47327
+ TooltipPrimitive.Content,
47328
+ {
47329
+ ref,
47330
+ sideOffset,
47331
+ className: cn$1(
47332
+ "z-[10000] overflow-hidden rounded bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",
47333
+ className
47334
+ ),
47335
+ ...props
47336
+ }
47337
+ )));
47338
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
47103
47339
  const minimumTimeToShowLoadingIndicator = 1e3;
47104
47340
  const FormsView = ({ loadingPlaceholder } = {}) => {
47341
+ var _a2, _b;
47105
47342
  const cms = useCMS$1();
47106
47343
  const { setFormIsPristine } = React.useContext(SidebarContext);
47107
47344
  const [isShowingLoading, setIsShowingLoading] = React.useState(true);
@@ -47140,7 +47377,15 @@ const FormsView = ({ loadingPlaceholder } = {}) => {
47140
47377
  return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
47141
47378
  }
47142
47379
  const formMetas = cms.plugins.all("form:meta");
47143
- return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, 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 })));
47380
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, /* @__PURE__ */ React.createElement(
47381
+ FormHeader,
47382
+ {
47383
+ activeForm,
47384
+ branch: cms.api.admin.api.branch,
47385
+ repoProvider: cms.api.admin.api.schema.config.config.repoProvider,
47386
+ isLocalMode: (_b = (_a2 = cms.api) == null ? void 0 : _a2.tina) == null ? void 0 : _b.isLocalMode
47387
+ }
47388
+ ), 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 })));
47144
47389
  };
47145
47390
  const FormWrapper$1 = ({ isEditing, children }) => {
47146
47391
  return /* @__PURE__ */ React.createElement(
@@ -47161,9 +47406,54 @@ const FormWrapper$1 = ({ isEditing, children }) => {
47161
47406
  children
47162
47407
  );
47163
47408
  };
47164
- const FormHeader = ({ activeForm }) => {
47409
+ const FormHeader = ({
47410
+ activeForm,
47411
+ repoProvider,
47412
+ branch,
47413
+ isLocalMode
47414
+ }) => {
47165
47415
  const { formIsPristine } = React.useContext(SidebarContext);
47166
- return /* @__PURE__ */ React.createElement("div", { className: "px-4 pt-2 pb-4 flex flex-row flex-nowrap justify-between items-center gap-2 bg-gradient-to-t from-white to-gray-50" }, /* @__PURE__ */ React.createElement(MultiformSelector, { activeForm }), /* @__PURE__ */ React.createElement(FormBreadcrumbs, { className: "w-[calc(100%-3rem)]" }), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }));
47416
+ return /* @__PURE__ */ React.createElement("div", { className: "px-4 pt-2 pb-4 flex flex-row flex-nowrap justify-between items-center gap-2 bg-gradient-to-t from-white to-gray-50" }, /* @__PURE__ */ React.createElement(MultiformSelector, { activeForm }), /* @__PURE__ */ React.createElement(FormBreadcrumbs, { className: "w-[calc(100%-3rem)]" }), /* @__PURE__ */ React.createElement(
47417
+ FileHistoryProvider,
47418
+ {
47419
+ defaultBranchName: repoProvider == null ? void 0 : repoProvider.defaultBranchName,
47420
+ historyUrl: repoProvider == null ? void 0 : repoProvider.historyUrl,
47421
+ contentRelativePath: activeForm.tinaForm.path,
47422
+ tinaBranch: branch,
47423
+ isLocalMode
47424
+ }
47425
+ ), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }));
47426
+ };
47427
+ const FileHistoryProvider = ({
47428
+ contentRelativePath,
47429
+ tinaBranch,
47430
+ defaultBranchName,
47431
+ historyUrl,
47432
+ isLocalMode
47433
+ }) => {
47434
+ if (!historyUrl) {
47435
+ return null;
47436
+ }
47437
+ const branch = isLocalMode ? defaultBranchName || tinaBranch : tinaBranch;
47438
+ if (!branch) {
47439
+ return null;
47440
+ }
47441
+ const { url } = historyUrl({
47442
+ relativePath: contentRelativePath,
47443
+ branch
47444
+ });
47445
+ if (!url) {
47446
+ return null;
47447
+ }
47448
+ return /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(Tooltip, null, /* @__PURE__ */ React.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React.createElement("button", { type: "button" }, /* @__PURE__ */ React.createElement(
47449
+ "a",
47450
+ {
47451
+ href: url,
47452
+ target: "_blank",
47453
+ className: "flex items-center gap-1 border-[0.5px] hover:bg-gray-300/10 transition-all duration-300 border-gray-300 rounded-md p-2"
47454
+ },
47455
+ /* @__PURE__ */ React.createElement(History, { className: "size-4 text-gray-700" })
47456
+ ))), /* @__PURE__ */ React.createElement(TooltipContent, { side: "top", className: "shadow-md" }, "View file history")));
47167
47457
  };
47168
47458
  const FormBreadcrumbs = ({
47169
47459
  rootBreadcrumbName,
@@ -48082,10 +48372,10 @@ function Alerts2({ alerts }) {
48082
48372
  if (!alerts.all.length) {
48083
48373
  return null;
48084
48374
  }
48085
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed top-0 left-0 p-6 flex flex-col items-center z-[999999]" }, alerts.all.filter((alert) => {
48375
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed top-6 left-6 flex flex-col items-center z-[999999]" }, alerts.all.filter((alert) => {
48086
48376
  return alert.level !== "error";
48087
48377
  }).map((alert) => {
48088
- return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto opacity-70" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto opacity-70" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto opacity-70" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
48378
+ return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto text-blue-500" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto text-green-500" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto text-yellow-500" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
48089
48379
  CloseAlert,
48090
48380
  {
48091
48381
  onClick: () => {
@@ -48126,21 +48416,21 @@ const Alert = ({
48126
48416
  ...props
48127
48417
  }) => {
48128
48418
  const colorClasses = {
48129
- info: "bg-white border-blue-500 text-blue-600 fill-blue-500",
48130
- success: "bg-white border-green-500 text-green-600 fill-green-500",
48131
- warn: "bg-white border-yellow-500 text-yellow-600 fill-yellow-500",
48132
- error: "bg-white border-red-500 text-red-600 fill-red-500"
48419
+ info: "bg-white",
48420
+ success: "bg-white",
48421
+ warn: "bg-white",
48422
+ error: "bg-white"
48133
48423
  };
48134
48424
  const borderClasses = {
48135
- info: "border-blue-200",
48136
- success: "border-green-200",
48137
- warn: "border-yellow-200",
48138
- error: "border-red-200"
48425
+ info: "border-blue-500",
48426
+ success: "border-green-500",
48427
+ warn: "border-amber-500",
48428
+ error: "border-red-500"
48139
48429
  };
48140
48430
  return /* @__PURE__ */ React__default.createElement(
48141
48431
  "div",
48142
48432
  {
48143
- className: `rounded shadow-lg font-normal cursor-pointer pointer-events-all text-sm transition-all duration-100 ease-out mb-4 max-w-full ${colorClasses[level]}}`,
48433
+ className: `rounded-md shadow-lg font-medium cursor-pointer pointer-events-all text-sm transition-all duration-100 ease-out mb-4 max-w-full text-gray-700 ${colorClasses[level]}`,
48144
48434
  style: {
48145
48435
  animationName: "fly-in-up, fade-in",
48146
48436
  animationTimingFunction: "ease-out",
@@ -48152,7 +48442,7 @@ const Alert = ({
48152
48442
  /* @__PURE__ */ React__default.createElement(
48153
48443
  "div",
48154
48444
  {
48155
- className: `flex items-center gap-1.5 w-[350px] rounded-md border p-2 ${borderClasses[level]}`,
48445
+ className: `flex items-center gap-2 w-[350px] rounded-md border px-4 py-3 ${borderClasses[level]}`,
48156
48446
  ...props
48157
48447
  }
48158
48448
  )
@@ -48416,7 +48706,7 @@ const BranchButton = ({ className = "" }) => {
48416
48706
  variant: "secondary",
48417
48707
  size: "custom",
48418
48708
  className: cn(
48419
- "pointer-events-auto px-3 py-3 flex shrink gap-1 items-center justify-between",
48709
+ "pointer-events-auto px-3 py-3 flex shrink gap-1 items-center justify-between max-w-sm",
48420
48710
  className
48421
48711
  ),
48422
48712
  onClick: () => setOpen(true),
@@ -67191,6 +67481,23 @@ function LinkFloatingToolbar({
67191
67481
  }) {
67192
67482
  const activeCommentId = usePluginOption({ key: "comment" }, "activeId");
67193
67483
  const activeSuggestionId = usePluginOption({ key: "suggestion" }, "activeId");
67484
+ const { api, editor } = useEditorPlugin(LinkPlugin);
67485
+ const isUrlValidator = usePluginOption(LinkPlugin, "isUrl");
67486
+ const [currentUrl, setCurrentUrl] = React.useState("");
67487
+ const [isValidUrl, setIsValidUrl] = React.useState(true);
67488
+ const handleUrlInput = React.useCallback(
67489
+ (e3) => {
67490
+ const value = e3.currentTarget.value;
67491
+ setCurrentUrl(value);
67492
+ if (value && isUrlValidator) {
67493
+ const valid = isUrlValidator(value);
67494
+ setIsValidUrl(valid);
67495
+ } else {
67496
+ setIsValidUrl(true);
67497
+ }
67498
+ },
67499
+ [isUrlValidator]
67500
+ );
67194
67501
  const floatingOptions = React.useMemo(() => {
67195
67502
  return {
67196
67503
  middleware: [
@@ -67234,22 +67541,70 @@ function LinkFloatingToolbar({
67234
67541
  });
67235
67542
  if (hidden)
67236
67543
  return null;
67237
- const input = /* @__PURE__ */ React.createElement("div", { className: "z-[999999] flex w-[330px] flex-col", ...inputProps }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Link, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67238
- FloatingLinkUrlInput,
67239
- {
67240
- className: inputVariants(),
67241
- placeholder: "Paste link",
67242
- "data-plate-focus": true
67243
- }
67244
- )), /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Text$2, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67245
- "input",
67544
+ const input = /* @__PURE__ */ React.createElement(
67545
+ "div",
67246
67546
  {
67247
- className: inputVariants(),
67248
- placeholder: "Text to display",
67249
- "data-plate-focus": true,
67250
- ...textInputProps
67251
- }
67252
- )));
67547
+ className: "z-[999999] flex w-[330px] flex-col relative",
67548
+ ...inputProps
67549
+ },
67550
+ !isValidUrl && currentUrl && /* @__PURE__ */ React.createElement("div", { className: "absolute -top-16 left-0 right-0 z-[1000000] mb-2" }, /* @__PURE__ */ React.createElement(
67551
+ "div",
67552
+ {
67553
+ className: "bg-red-50 border border-red-200 rounded-md p-2 shadow-lg",
67554
+ role: "alert",
67555
+ "aria-live": "polite"
67556
+ },
67557
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement(CircleX, { className: "size-4 text-red-500 mr-2 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm text-red-700 text-wrap" }, "Invalid URL. Please prefix link with https:// or use a relative path like /about")),
67558
+ /* @__PURE__ */ React.createElement("div", { className: "absolute -bottom-1 left-4 w-2 h-2 bg-red-50 border-r border-b border-red-200 transform rotate-45" })
67559
+ )),
67560
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Link, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67561
+ FloatingLinkUrlInput,
67562
+ {
67563
+ className: inputVariants(),
67564
+ placeholder: "Paste link",
67565
+ "data-plate-focus": true,
67566
+ onInput: handleUrlInput
67567
+ }
67568
+ )),
67569
+ /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
67570
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Text$2, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67571
+ "input",
67572
+ {
67573
+ className: inputVariants(),
67574
+ placeholder: "Text to display",
67575
+ "data-plate-focus": true,
67576
+ ...textInputProps
67577
+ }
67578
+ )),
67579
+ /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
67580
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-end gap-2 px-2 py-1" }, /* @__PURE__ */ React.createElement(
67581
+ "button",
67582
+ {
67583
+ type: "button",
67584
+ className: buttonVariants$2({ size: "sm", variant: "ghost" }),
67585
+ onClick: () => {
67586
+ api.floatingLink.hide();
67587
+ }
67588
+ },
67589
+ "Cancel"
67590
+ ), /* @__PURE__ */ React.createElement(
67591
+ "button",
67592
+ {
67593
+ type: "button",
67594
+ className: buttonVariants$2({
67595
+ size: "sm",
67596
+ variant: "tinaPrimary"
67597
+ }),
67598
+ onClick: () => {
67599
+ if (isValidUrl && currentUrl) {
67600
+ submitFloatingLink(editor);
67601
+ }
67602
+ },
67603
+ disabled: !isValidUrl && !!currentUrl
67604
+ },
67605
+ "OK"
67606
+ ))
67607
+ );
67253
67608
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex items-center" }, /* @__PURE__ */ React.createElement(
67254
67609
  "button",
67255
67610
  {
@@ -67270,7 +67625,25 @@ function LinkFloatingToolbar({
67270
67625
  },
67271
67626
  /* @__PURE__ */ React.createElement(Unlink, { width: 18 })
67272
67627
  ));
67273
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: insertRef, className: popoverVariants(), ...insertProps }, input), /* @__PURE__ */ React.createElement("div", { ref: editRef, className: popoverVariants(), ...editProps }, editContent));
67628
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
67629
+ "div",
67630
+ {
67631
+ ref: insertRef,
67632
+ className: popoverVariants(),
67633
+ ...insertProps,
67634
+ style: insertProps.style
67635
+ },
67636
+ input
67637
+ ), /* @__PURE__ */ React.createElement(
67638
+ "div",
67639
+ {
67640
+ ref: editRef,
67641
+ className: popoverVariants(),
67642
+ ...editProps,
67643
+ style: editProps.style
67644
+ },
67645
+ editContent
67646
+ ));
67274
67647
  }
67275
67648
  function LinkOpenButton() {
67276
67649
  const editor = useEditorRef();
@@ -120794,22 +121167,6 @@ const PageHeader = ({
120794
121167
  return /* @__PURE__ */ React__default.createElement("div", { className: "pt-4 pb-2 px-6" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full flex justify-between items-end" }, children));
120795
121168
  };
120796
121169
  const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-4 px-6" }, children);
120797
- const TooltipProvider = TooltipPrimitive.Provider;
120798
- const Tooltip = TooltipPrimitive.Root;
120799
- const TooltipTrigger = TooltipPrimitive.Trigger;
120800
- const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
120801
- TooltipPrimitive.Content,
120802
- {
120803
- ref,
120804
- sideOffset,
120805
- className: cn$1(
120806
- "z-[10000] overflow-hidden rounded bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",
120807
- className
120808
- ),
120809
- ...props
120810
- }
120811
- )));
120812
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
120813
121170
  const folderRegex = /^.*\/~\/*(.*)$/;
120814
121171
  const parentFolder = (folder) => {
120815
121172
  return {
@@ -122435,6 +122792,7 @@ const RenderForm = ({
122435
122792
  collection,
122436
122793
  mutationInfo
122437
122794
  }) => {
122795
+ var _a2, _b, _c, _d;
122438
122796
  const [formIsPristine, setFormIsPristine] = useState(true);
122439
122797
  const schema = cms.api.tina.schema;
122440
122798
  const schemaCollection = schema.getCollection(collection.name);
@@ -122506,6 +122864,15 @@ const RenderForm = ({
122506
122864
  className: "w-[calc(100%-3rem)]",
122507
122865
  rootBreadcrumbName: `${filename}.${collection.format}`
122508
122866
  }
122867
+ ), /* @__PURE__ */ React__default.createElement(
122868
+ FileHistoryProvider,
122869
+ {
122870
+ defaultBranchName: (_a2 = cms.api.admin.api.schema.config.config.repoProvider) == null ? void 0 : _a2.defaultBranchName,
122871
+ historyUrl: (_b = cms.api.admin.api.schema.config.config.repoProvider) == null ? void 0 : _b.historyUrl,
122872
+ contentRelativePath: relativePath2,
122873
+ tinaBranch: cms.api.admin.api.branch,
122874
+ isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode
122875
+ }
122509
122876
  ), /* @__PURE__ */ React__default.createElement(FormStatus, { pristine: formIsPristine }))
122510
122877
  ), activeForm && /* @__PURE__ */ React__default.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine }));
122511
122878
  };