tinacms 0.0.0-f99bbbc-20251203005753 → 0.0.0-fbc6afb-20251208042646

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, 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
  }
@@ -39367,20 +39368,183 @@ const TextArea = React.forwardRef(({ ...props }, ref) => {
39367
39368
  }
39368
39369
  );
39369
39370
  });
39370
- const { get: getColor, to: toColor } = pkg;
39371
+ const TRANSPARENT = "transparent";
39372
+ const isValidHex = (value) => /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(value);
39373
+ const expandHex = (hex) => {
39374
+ const h = hex.replace("#", "");
39375
+ if (h.length === 3) {
39376
+ return `#${h[0]}${h[0]}${h[1]}${h[1]}${h[2]}${h[2]}`.toUpperCase();
39377
+ }
39378
+ return `#${h.toUpperCase()}`;
39379
+ };
39380
+ const hexToRgb = (hex) => {
39381
+ if (!hex || !isValidHex(hex))
39382
+ return null;
39383
+ const expanded = expandHex(hex).replace("#", "");
39384
+ return {
39385
+ r: parseInt(expanded.substring(0, 2), 16),
39386
+ g: parseInt(expanded.substring(2, 4), 16),
39387
+ b: parseInt(expanded.substring(4, 6), 16)
39388
+ };
39389
+ };
39390
+ const rgbToHex = (r2, g, b) => `#${((1 << 24) + (r2 << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
39391
+ const checkerboardStyle$1 = (size2 = 8) => ({
39392
+ 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%)",
39393
+ backgroundSize: `${size2}px ${size2}px`,
39394
+ backgroundPosition: `0 0, 0 ${size2 / 2}px, ${size2 / 2}px -${size2 / 2}px, -${size2 / 2}px 0px`
39395
+ });
39396
+ const normalizeColorValue = (value) => {
39397
+ if (isValidHex(value)) {
39398
+ return expandHex(value);
39399
+ }
39400
+ const parsed = get$6(value.toLowerCase());
39401
+ if (parsed)
39402
+ return rgbToHex(parsed.value[0], parsed.value[1], parsed.value[2]);
39403
+ return null;
39404
+ };
39405
+ const useHexInput = (color, onChange) => {
39406
+ const [inputValue, setInputValue] = React.useState(color);
39407
+ const [isFocused2, setIsFocused] = React.useState(false);
39408
+ React.useEffect(() => {
39409
+ if (!isFocused2) {
39410
+ setInputValue(color);
39411
+ }
39412
+ }, [color, isFocused2]);
39413
+ const handleChange = (e3) => {
39414
+ const value = e3.target.value;
39415
+ setInputValue(value);
39416
+ const normalized = normalizeColorValue(value);
39417
+ if (normalized)
39418
+ onChange(normalized);
39419
+ };
39420
+ const handleFocus = () => {
39421
+ setIsFocused(true);
39422
+ };
39423
+ const handleBlur = () => {
39424
+ setIsFocused(false);
39425
+ const normalized = normalizeColorValue(inputValue);
39426
+ if (normalized) {
39427
+ setInputValue(normalized);
39428
+ onChange(normalized);
39429
+ } else {
39430
+ setInputValue(color);
39431
+ }
39432
+ };
39433
+ const handleSwatchClick = React.useCallback(
39434
+ (c2) => {
39435
+ if (c2 === TRANSPARENT) {
39436
+ onChange(null);
39437
+ } else {
39438
+ const normalized = normalizeColorValue(c2);
39439
+ onChange(normalized || c2);
39440
+ }
39441
+ },
39442
+ [onChange]
39443
+ );
39444
+ return {
39445
+ inputValue,
39446
+ handleChange,
39447
+ handleFocus,
39448
+ handleBlur,
39449
+ handleSwatchClick
39450
+ };
39451
+ };
39452
+ const SwatchButton = ({ color, isSelected: isSelected2, onClick }) => /* @__PURE__ */ React.createElement("div", { className: "relative w-full pb-[100%]" }, /* @__PURE__ */ React.createElement(
39453
+ "button",
39454
+ {
39455
+ type: "button",
39456
+ onClick,
39457
+ 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"}`,
39458
+ style: {
39459
+ backgroundColor: color === TRANSPARENT ? "#FFF" : color,
39460
+ ...color === TRANSPARENT ? checkerboardStyle$1() : {}
39461
+ },
39462
+ "aria-label": color === TRANSPARENT ? "Clear color" : `Select color ${color}`
39463
+ }
39464
+ ));
39465
+ const ColorPreview = ({
39466
+ color,
39467
+ size: size2 = "sm"
39468
+ }) => /* @__PURE__ */ React.createElement(
39469
+ "div",
39470
+ {
39471
+ 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",
39472
+ style: {
39473
+ backgroundColor: color || TRANSPARENT,
39474
+ ...!color ? checkerboardStyle$1(size2 === "lg" ? 16 : 8) : {}
39475
+ },
39476
+ "aria-label": "Current color preview"
39477
+ }
39478
+ );
39479
+ const HexInput = ({ value, onChange, onFocus, onBlur, fullWidth }) => /* @__PURE__ */ React.createElement(
39480
+ "input",
39481
+ {
39482
+ type: "text",
39483
+ value: value || "",
39484
+ onChange,
39485
+ onFocus,
39486
+ onBlur,
39487
+ placeholder: "#000000 or color name",
39488
+ 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"}`
39489
+ }
39490
+ );
39491
+ 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(
39492
+ SwatchButton,
39493
+ {
39494
+ key: c2,
39495
+ color: c2,
39496
+ isSelected: (selectedColor == null ? void 0 : selectedColor.toLowerCase()) === c2.toLowerCase(),
39497
+ onClick: () => onSelect(c2)
39498
+ }
39499
+ )));
39500
+ const BlockWidget = ({
39501
+ presetColors: presetColors2,
39502
+ color,
39503
+ onChange,
39504
+ width
39505
+ }) => {
39506
+ const {
39507
+ inputValue,
39508
+ handleChange,
39509
+ handleFocus,
39510
+ handleBlur,
39511
+ handleSwatchClick
39512
+ } = useHexInput(color, onChange);
39513
+ return /* @__PURE__ */ React.createElement(
39514
+ "div",
39515
+ {
39516
+ className: "bg-white rounded-lg shadow-lg overflow-hidden",
39517
+ style: { width }
39518
+ },
39519
+ /* @__PURE__ */ React.createElement("div", { className: "p-3" }, /* @__PURE__ */ React.createElement(ColorPreview, { color, size: "lg" }), /* @__PURE__ */ React.createElement(
39520
+ HexInput,
39521
+ {
39522
+ value: inputValue,
39523
+ onChange: handleChange,
39524
+ onFocus: handleFocus,
39525
+ onBlur: handleBlur,
39526
+ fullWidth: true
39527
+ }
39528
+ ), /* @__PURE__ */ React.createElement(
39529
+ SwatchGrid,
39530
+ {
39531
+ colors: presetColors2,
39532
+ selectedColor: color,
39533
+ onSelect: handleSwatchClick
39534
+ }
39535
+ ))
39536
+ );
39537
+ };
39371
39538
  var ColorFormat = /* @__PURE__ */ ((ColorFormat2) => {
39372
39539
  ColorFormat2["Hex"] = "hex";
39373
39540
  ColorFormat2["RGB"] = "rgb";
39374
39541
  return ColorFormat2;
39375
39542
  })(ColorFormat || {});
39376
- const rgbToHex = function(color) {
39377
- return "#" + ((1 << 24) + (color.r << 16) + (color.g << 8) + color.b).toString(16).slice(1);
39378
- };
39379
39543
  function ParseColorStr(color) {
39380
39544
  if (!color) {
39381
39545
  return null;
39382
39546
  }
39383
- const colorDescriptor = getColor(color);
39547
+ const colorDescriptor = get$6(color);
39384
39548
  if (!colorDescriptor)
39385
39549
  return null;
39386
39550
  const colorVals = colorDescriptor.value;
@@ -39396,7 +39560,7 @@ const ColorFormatter = {
39396
39560
  },
39397
39561
  getValue(color) {
39398
39562
  const colorVals = [color.r, color.g, color.b, color.a];
39399
- return toColor.rgb(colorVals);
39563
+ return to$1.rgb(colorVals);
39400
39564
  },
39401
39565
  parse: ParseColorStr
39402
39566
  },
@@ -39405,37 +39569,88 @@ const ColorFormatter = {
39405
39569
  /* Hex */
39406
39570
  ]: {
39407
39571
  getLabel(color) {
39408
- return rgbToHex(color);
39572
+ return rgbToHex(color.r, color.g, color.b);
39409
39573
  },
39410
39574
  getValue(color) {
39411
39575
  const colorVals = [color.r, color.g, color.b, color.a];
39412
- return toColor.hex(colorVals);
39576
+ return to$1.hex(colorVals).toUpperCase();
39413
39577
  },
39414
39578
  parse: ParseColorStr
39415
39579
  }
39416
39580
  };
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";
39581
+ const SketchWidget = ({
39582
+ presetColors: presetColors2,
39583
+ color,
39584
+ onChange,
39585
+ width
39586
+ }) => {
39587
+ const {
39588
+ inputValue,
39589
+ handleChange,
39590
+ handleFocus,
39591
+ handleBlur,
39592
+ handleSwatchClick
39593
+ } = useHexInput(color, onChange);
39594
+ const currentRgb = hexToRgb(color) || { r: 0, g: 0, b: 0 };
39595
+ const handleRgbChange = (channel, value) => {
39596
+ const num = Math.max(0, Math.min(255, parseInt(value, 10) || 0));
39597
+ const updated = { ...currentRgb, [channel]: num };
39598
+ onChange(rgbToHex(updated.r, updated.g, updated.b));
39599
+ };
39600
+ return /* @__PURE__ */ React.createElement("div", { className: "bg-white rounded-lg shadow-lg p-3", style: { width } }, /* @__PURE__ */ React.createElement(
39601
+ HexColorPicker,
39602
+ {
39603
+ color: color || "#000000",
39604
+ onChange,
39605
+ className: "!w-full !h-[150px]"
39606
+ }
39607
+ ), /* @__PURE__ */ React.createElement("div", { className: "mt-2 flex gap-2 items-center" }, /* @__PURE__ */ React.createElement(ColorPreview, { color }), /* @__PURE__ */ React.createElement(
39608
+ HexInput,
39609
+ {
39610
+ value: inputValue,
39611
+ onChange: handleChange,
39612
+ onFocus: handleFocus,
39613
+ onBlur: handleBlur
39614
+ }
39615
+ )), /* @__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(
39616
+ "input",
39617
+ {
39618
+ type: "number",
39619
+ min: 0,
39620
+ max: 255,
39621
+ value: currentRgb[channel],
39622
+ onChange: (e3) => handleRgbChange(channel, e3.target.value),
39623
+ 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"
39624
+ }
39625
+ )))), /* @__PURE__ */ React.createElement(
39626
+ SwatchGrid,
39627
+ {
39628
+ colors: presetColors2,
39629
+ selectedColor: color,
39630
+ onSelect: handleSwatchClick
39631
+ }
39632
+ ));
39633
+ };
39634
+ const isLightBackground = function(backgroundColor) {
39635
+ return !backgroundColor || backgroundColor.r * 0.299 + backgroundColor.g * 0.587 + backgroundColor.b * 0.114 > 186;
39420
39636
  };
39421
- const Swatch = ({
39422
- colorRGBA,
39423
- colorFormat,
39424
- unselectable,
39425
- ...props
39426
- }) => /* @__PURE__ */ React.createElement(
39637
+ const getTextColorForBackground = function(backgroundColor) {
39638
+ return isLightBackground(backgroundColor) ? "#000000" : "#FFFFFF";
39639
+ };
39640
+ const Swatch = ({ colorRGBA, colorFormat, width, ...props }) => /* @__PURE__ */ React.createElement(
39427
39641
  "div",
39428
39642
  {
39429
- className: "bg-gray-100 rounded-3xl shadow-[0_2px_3px_rgba(0,0,0,0.12)] cursor-pointer w-full m-0",
39643
+ className: "bg-gray-100 rounded shadow-[0_2px_3px_rgba(0,0,0,0.12)] cursor-pointer m-0",
39644
+ style: { width },
39430
39645
  ...props
39431
39646
  },
39432
39647
  /* @__PURE__ */ React.createElement(
39433
39648
  "div",
39434
39649
  {
39435
- className: "swatch-inner flex items-center justify-center text-[13px] font-bold w-full h-10 rounded-3xl hover:opacity-[.6]",
39650
+ className: "swatch-inner flex items-center justify-center text-[13px] font-bold w-full h-10 rounded hover:opacity-[.6]",
39436
39651
  style: {
39437
39652
  background: colorRGBA ? `rgba(${colorRGBA.r}, ${colorRGBA.g}, ${colorRGBA.b}, ${colorRGBA.a})` : `#fff`,
39438
- color: GetTextColorForBackground(colorRGBA),
39653
+ color: getTextColorForBackground(colorRGBA),
39439
39654
  transition: "all var(--tina-timing-short) ease-out"
39440
39655
  }
39441
39656
  },
@@ -39451,7 +39666,7 @@ const Popover$2 = ({
39451
39666
  }) => /* @__PURE__ */ React.createElement(
39452
39667
  "div",
39453
39668
  {
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}`,
39669
+ 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
39670
  style: {
39456
39671
  top: triggerBoundingBox ? openTop ? triggerBoundingBox.top : triggerBoundingBox.bottom : 0,
39457
39672
  left: triggerBoundingBox ? triggerBoundingBox.left + triggerBoundingBox.width / 2 : 0,
@@ -39463,7 +39678,6 @@ const Popover$2 = ({
39463
39678
  ...props
39464
39679
  }
39465
39680
  );
39466
- const nullColor = "transparent";
39467
39681
  const presetColors = [
39468
39682
  "#D0021B",
39469
39683
  "#F5A623",
@@ -39481,93 +39695,69 @@ const presetColors = [
39481
39695
  "#9B9B9B",
39482
39696
  "#FFFFFF"
39483
39697
  ];
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
39698
  const WIDGETS = { sketch: SketchWidget, block: BlockWidget };
39504
39699
  const ColorPicker = ({
39505
39700
  colorFormat,
39506
39701
  userColors = presetColors,
39507
39702
  widget = "sketch",
39703
+ width,
39508
39704
  input
39509
39705
  }) => {
39510
39706
  const FormPortal = useFormPortal();
39511
39707
  const triggerRef = React.useRef(null);
39512
39708
  const [triggerBoundingBox, setTriggerBoundingBox] = useState(null);
39513
- const [openTop, setOpenTop] = useState(false);
39709
+ const [displayColorPicker, setDisplayColorPicker] = useState(false);
39514
39710
  const updateTriggerBoundingBox = () => {
39515
- if (triggerRef.current) {
39711
+ if (triggerRef.current)
39516
39712
  setTriggerBoundingBox(triggerRef.current.getBoundingClientRect());
39517
- }
39518
39713
  };
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]);
39714
+ const openTop = triggerBoundingBox ? triggerBoundingBox.top + triggerBoundingBox.height / 2 > window.innerHeight / 2 : false;
39530
39715
  React.useEffect(() => {
39531
39716
  const delay = 100;
39532
- let timeout = false;
39533
- setTimeout(() => {
39534
- updateTriggerBoundingBox();
39535
- }, delay);
39717
+ let timeout = null;
39718
+ timeout = setTimeout(updateTriggerBoundingBox, delay);
39536
39719
  const handleResize = () => {
39537
- clearTimeout(timeout);
39720
+ if (timeout)
39721
+ clearTimeout(timeout);
39538
39722
  timeout = setTimeout(updateTriggerBoundingBox, delay);
39539
39723
  };
39540
39724
  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);
39725
+ return () => window.removeEventListener("resize", handleResize);
39726
+ }, []);
39549
39727
  const getColorFormat = (colorFormat || ColorFormat.Hex).toLowerCase();
39550
39728
  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
- };
39729
+ const currentHexColor = getColorRGBA ? rgbToHex(getColorRGBA.r, getColorRGBA.g, getColorRGBA.b) : "";
39730
+ const handleChange = useCallback(
39731
+ (hexColor) => {
39732
+ if (!hexColor) {
39733
+ input.onChange(null);
39734
+ return;
39735
+ }
39736
+ const rgb = hexToRgb(hexColor);
39737
+ if (rgb)
39738
+ input.onChange(
39739
+ ColorFormatter[getColorFormat].getValue({ ...rgb, a: 1 })
39740
+ );
39741
+ },
39742
+ [getColorFormat, input]
39743
+ );
39557
39744
  const toggleColorPicker = (event) => {
39558
39745
  event.stopPropagation();
39559
39746
  const display = !displayColorPicker;
39560
39747
  setDisplayColorPicker(display);
39561
- if (display) {
39748
+ if (display)
39562
39749
  updateTriggerBoundingBox();
39563
- }
39564
39750
  };
39565
- return /* @__PURE__ */ React.createElement("div", { className: "relative", ref: triggerRef }, /* @__PURE__ */ React.createElement(
39751
+ const Widget = WIDGETS[widget];
39752
+ if (!Widget)
39753
+ throw new Error("You must specify a widget type.");
39754
+ return /* @__PURE__ */ React.createElement("div", { className: "relative", ref: triggerRef, style: { width } }, /* @__PURE__ */ React.createElement(
39566
39755
  Swatch,
39567
39756
  {
39568
39757
  onClick: toggleColorPicker,
39569
39758
  colorRGBA: getColorRGBA,
39570
- colorFormat: getColorFormat
39759
+ colorFormat: getColorFormat,
39760
+ width
39571
39761
  }
39572
39762
  ), displayColorPicker && /* @__PURE__ */ React.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React.createElement(
39573
39763
  Popover$2,
@@ -39587,11 +39777,10 @@ const ColorPicker = ({
39587
39777
  /* @__PURE__ */ React.createElement(
39588
39778
  Widget,
39589
39779
  {
39590
- presetColors: [...userColors, nullColor],
39591
- color: getColorRGBA || { r: 0, g: 0, b: 0, a: 0 },
39780
+ presetColors: [...userColors, TRANSPARENT],
39781
+ color: currentHexColor,
39592
39782
  onChange: handleChange,
39593
- disableAlpha: true,
39594
- width: "240px"
39783
+ width: width || "240px"
39595
39784
  }
39596
39785
  )
39597
39786
  )
@@ -41338,6 +41527,7 @@ const ColorField = wrapFieldsWithMeta(
41338
41527
  colorFormat: field.colorFormat,
41339
41528
  userColors: field.colors,
41340
41529
  widget: field.widget,
41530
+ width: field.width,
41341
41531
  input
41342
41532
  }
41343
41533
  );
@@ -43781,7 +43971,7 @@ const Badge = ({
43781
43971
  children
43782
43972
  );
43783
43973
  };
43784
- const tableHeadingStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider";
43974
+ 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
43975
  function formatBranchName(str) {
43786
43976
  const pattern = /[^/\w-]+/g;
43787
43977
  const formattedStr = str.replace(pattern, "-");
@@ -44017,6 +44207,9 @@ const BranchSelector = ({
44017
44207
  const [search, setSearch] = React.useState("");
44018
44208
  const [filter2, setFilter] = React.useState("content");
44019
44209
  const [sortValue, setSortValue] = React.useState("default");
44210
+ const [selectedBranch, setSelectedBranch] = React.useState(
44211
+ null
44212
+ );
44020
44213
  const cms = useCMS$1();
44021
44214
  const filteredBranchList = getFilteredBranchList(
44022
44215
  branchList,
@@ -44076,7 +44269,19 @@ const BranchSelector = ({
44076
44269
  }
44077
44270
  ]
44078
44271
  }
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("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" }, /* @__PURE__ */ React.createElement("thead", { className: "bg-gray-100 border-b-2 border-gray-200" }, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", { className: tableHeadingStyle }, "Branch Name"), /* @__PURE__ */ React.createElement("th", { className: tableHeadingStyle }, "Last Updated"), /* @__PURE__ */ React.createElement("th", null), /* @__PURE__ */ React.createElement("th", null))), /* @__PURE__ */ React.createElement("tbody", null, filteredBranchList.map((branch) => /* @__PURE__ */ React.createElement(
44272
+ ))), 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-auto" }, /* @__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(
44273
+ "th",
44274
+ {
44275
+ className: `${tableHeadingStyle} w-0 whitespace-nowrap text-left`
44276
+ },
44277
+ "Last Updated"
44278
+ ), /* @__PURE__ */ React.createElement(
44279
+ "th",
44280
+ {
44281
+ className: `${tableHeadingStyle} w-0 whitespace-nowrap text-left`
44282
+ },
44283
+ "Pull Request"
44284
+ ))), /* @__PURE__ */ React.createElement("tbody", null, filteredBranchList.map((branch) => /* @__PURE__ */ React.createElement(
44080
44285
  BranchItem,
44081
44286
  {
44082
44287
  key: branch.name,
@@ -44085,9 +44290,24 @@ const BranchSelector = ({
44085
44290
  onChange,
44086
44291
  refreshBranchList,
44087
44292
  previewFunction,
44088
- cms
44293
+ cms,
44294
+ selectedBranch,
44295
+ onSelectBranch: setSelectedBranch
44089
44296
  }
44090
- ))))));
44297
+ )))))), /* @__PURE__ */ React.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ React.createElement(
44298
+ Button$2,
44299
+ {
44300
+ variant: "primary",
44301
+ onClick: () => {
44302
+ onChange(selectedBranch);
44303
+ },
44304
+ disabled: !selectedBranch || selectedBranch === currentBranch
44305
+ },
44306
+ "Open branch in editor"
44307
+ )));
44308
+ };
44309
+ const extractPullRequestId = (url) => {
44310
+ return url.split("/").pop() || "";
44091
44311
  };
44092
44312
  const BranchItem = ({
44093
44313
  branch,
@@ -44095,7 +44315,9 @@ const BranchItem = ({
44095
44315
  onChange,
44096
44316
  refreshBranchList,
44097
44317
  previewFunction,
44098
- cms
44318
+ cms,
44319
+ selectedBranch,
44320
+ onSelectBranch
44099
44321
  }) => {
44100
44322
  var _a2, _b;
44101
44323
  const [creatingPR, setCreatingPR] = React.useState(false);
@@ -44121,46 +44343,54 @@ const BranchItem = ({
44121
44343
  }
44122
44344
  };
44123
44345
  const isCurrentBranch = branch.name === currentBranch;
44346
+ const isSelected2 = selectedBranch === branch.name;
44124
44347
  const indexingStatus = (_a2 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a2.status;
44348
+ const handleRowClick = () => {
44349
+ if (indexingStatus === "complete" && !isCurrentBranch) {
44350
+ onSelectBranch(isSelected2 ? null : branch.name);
44351
+ }
44352
+ };
44125
44353
  return /* @__PURE__ */ React.createElement(
44126
44354
  "tr",
44127
44355
  {
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"}`
44356
+ onClick: handleRowClick,
44357
+ 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
44358
  },
44130
- /* @__PURE__ */ React.createElement("td", { className: "pl-3 pr-3 py-1.5 min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1" }, branch.protected && /* @__PURE__ */ React.createElement(BiLock, { className: "w-5 h-auto opacity-70 text-blue-500 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight truncate" }, branch.name)), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status })))),
44359
+ /* @__PURE__ */ React.createElement("td", { className: "pl-3 pr-3 py-1.5 max-w-xs" }, /* @__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))), isCurrentBranch && /* @__PURE__ */ React.createElement(
44360
+ Badge,
44361
+ {
44362
+ calloutStyle: "info",
44363
+ className: "ml-1 w-fit flex-shrink-0",
44364
+ displayIcon: false
44365
+ },
44366
+ /* @__PURE__ */ React.createElement(BiPencil, { className: "w-3 h-auto inline-block mr-1" }),
44367
+ "Currently",
44368
+ /* @__PURE__ */ React.createElement("br", null),
44369
+ "Editing"
44370
+ )), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status })))),
44131
44371
  /* @__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
44372
  addSuffix: true
44133
44373
  }))),
44134
- /* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 text-left" }, indexingStatus === "complete" && !isCurrentBranch && /* @__PURE__ */ React.createElement(
44374
+ /* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 flex", onClick: (e3) => e3.stopPropagation() }, branch.githubPullRequestUrl ? /* @__PURE__ */ React.createElement(Tooltip$1, { delayDuration: 300 }, /* @__PURE__ */ React.createElement(TooltipTrigger$1, { asChild: true }, /* @__PURE__ */ React.createElement(
44135
44375
  Button$2,
44136
44376
  {
44137
44377
  variant: "white",
44138
44378
  size: "custom",
44139
44379
  onClick: () => {
44140
- onChange(branch.name);
44380
+ window.open(branch.githubPullRequestUrl, "_blank");
44141
44381
  },
44142
- className: "cursor-pointer text-sm h-9 px-4 flex items-center gap-1"
44382
+ className: "cursor-pointer h-9 px-2 flex items-center gap-1"
44143
44383
  },
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(
44384
+ /* @__PURE__ */ React.createElement("span", { className: "text-sm truncate max-w-[120px]" }, "PR: #", extractPullRequestId(branch.githubPullRequestUrl)),
44385
+ /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "h-3.5 w-auto text-gray-700 flex-shrink-0" })
44386
+ )), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent$1, { side: "top" }, "Open Git Pull Request"))) : /* @__PURE__ */ React.createElement(
44149
44387
  OverflowMenu$1,
44150
44388
  {
44151
44389
  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() && {
44390
+ !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() && {
44161
44391
  name: "create-pr",
44162
44392
  label: "Create Pull Request",
44163
- Icon: /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500 opacity-70" }),
44393
+ Icon: /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500" }),
44164
44394
  onMouseDown: () => handleCreatePullRequest()
44165
44395
  },
44166
44396
  typeof previewFunction === "function" && ((_b = previewFunction({ branch: branch.name })) == null ? void 0 : _b.url) && {
@@ -45485,7 +45715,7 @@ function GridMediaItem({ item, active, onClick }) {
45485
45715
  src: thumbnail,
45486
45716
  alt: item.filename
45487
45717
  }
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)))
45718
+ )) : /* @__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
45719
  ));
45490
45720
  }
45491
45721
  const DeleteModal$1 = ({
@@ -46414,7 +46644,7 @@ const NavProvider = ({
46414
46644
  };
46415
46645
  return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
46416
46646
  };
46417
- const version$1 = "3.0.0";
46647
+ const version$1 = "3.0.1";
46418
46648
  const VersionInfo = () => {
46419
46649
  var _a2, _b, _c, _d, _e, _f;
46420
46650
  const cms = useCMS();
@@ -48416,7 +48646,7 @@ const BranchButton = ({ className = "" }) => {
48416
48646
  variant: "secondary",
48417
48647
  size: "custom",
48418
48648
  className: cn(
48419
- "pointer-events-auto px-3 py-3 flex shrink gap-1 items-center justify-between",
48649
+ "pointer-events-auto px-3 py-3 flex shrink gap-1 items-center justify-between max-w-sm",
48420
48650
  className
48421
48651
  ),
48422
48652
  onClick: () => setOpen(true),
@@ -67191,6 +67421,23 @@ function LinkFloatingToolbar({
67191
67421
  }) {
67192
67422
  const activeCommentId = usePluginOption({ key: "comment" }, "activeId");
67193
67423
  const activeSuggestionId = usePluginOption({ key: "suggestion" }, "activeId");
67424
+ const { api, editor } = useEditorPlugin(LinkPlugin);
67425
+ const isUrlValidator = usePluginOption(LinkPlugin, "isUrl");
67426
+ const [currentUrl, setCurrentUrl] = React.useState("");
67427
+ const [isValidUrl, setIsValidUrl] = React.useState(true);
67428
+ const handleUrlInput = React.useCallback(
67429
+ (e3) => {
67430
+ const value = e3.currentTarget.value;
67431
+ setCurrentUrl(value);
67432
+ if (value && isUrlValidator) {
67433
+ const valid = isUrlValidator(value);
67434
+ setIsValidUrl(valid);
67435
+ } else {
67436
+ setIsValidUrl(true);
67437
+ }
67438
+ },
67439
+ [isUrlValidator]
67440
+ );
67194
67441
  const floatingOptions = React.useMemo(() => {
67195
67442
  return {
67196
67443
  middleware: [
@@ -67234,22 +67481,70 @@ function LinkFloatingToolbar({
67234
67481
  });
67235
67482
  if (hidden)
67236
67483
  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",
67484
+ const input = /* @__PURE__ */ React.createElement(
67485
+ "div",
67246
67486
  {
67247
- className: inputVariants(),
67248
- placeholder: "Text to display",
67249
- "data-plate-focus": true,
67250
- ...textInputProps
67251
- }
67252
- )));
67487
+ className: "z-[999999] flex w-[330px] flex-col relative",
67488
+ ...inputProps
67489
+ },
67490
+ !isValidUrl && currentUrl && /* @__PURE__ */ React.createElement("div", { className: "absolute -top-16 left-0 right-0 z-[1000000] mb-2" }, /* @__PURE__ */ React.createElement(
67491
+ "div",
67492
+ {
67493
+ className: "bg-red-50 border border-red-200 rounded-md p-2 shadow-lg",
67494
+ role: "alert",
67495
+ "aria-live": "polite"
67496
+ },
67497
+ /* @__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")),
67498
+ /* @__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" })
67499
+ )),
67500
+ /* @__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(
67501
+ FloatingLinkUrlInput,
67502
+ {
67503
+ className: inputVariants(),
67504
+ placeholder: "Paste link",
67505
+ "data-plate-focus": true,
67506
+ onInput: handleUrlInput
67507
+ }
67508
+ )),
67509
+ /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
67510
+ /* @__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(
67511
+ "input",
67512
+ {
67513
+ className: inputVariants(),
67514
+ placeholder: "Text to display",
67515
+ "data-plate-focus": true,
67516
+ ...textInputProps
67517
+ }
67518
+ )),
67519
+ /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
67520
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-end gap-2 px-2 py-1" }, /* @__PURE__ */ React.createElement(
67521
+ "button",
67522
+ {
67523
+ type: "button",
67524
+ className: buttonVariants$2({ size: "sm", variant: "ghost" }),
67525
+ onClick: () => {
67526
+ api.floatingLink.hide();
67527
+ }
67528
+ },
67529
+ "Cancel"
67530
+ ), /* @__PURE__ */ React.createElement(
67531
+ "button",
67532
+ {
67533
+ type: "button",
67534
+ className: buttonVariants$2({
67535
+ size: "sm",
67536
+ variant: "tinaPrimary"
67537
+ }),
67538
+ onClick: () => {
67539
+ if (isValidUrl && currentUrl) {
67540
+ submitFloatingLink(editor);
67541
+ }
67542
+ },
67543
+ disabled: !isValidUrl && !!currentUrl
67544
+ },
67545
+ "OK"
67546
+ ))
67547
+ );
67253
67548
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex items-center" }, /* @__PURE__ */ React.createElement(
67254
67549
  "button",
67255
67550
  {
@@ -67270,7 +67565,25 @@ function LinkFloatingToolbar({
67270
67565
  },
67271
67566
  /* @__PURE__ */ React.createElement(Unlink, { width: 18 })
67272
67567
  ));
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));
67568
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
67569
+ "div",
67570
+ {
67571
+ ref: insertRef,
67572
+ className: popoverVariants(),
67573
+ ...insertProps,
67574
+ style: insertProps.style
67575
+ },
67576
+ input
67577
+ ), /* @__PURE__ */ React.createElement(
67578
+ "div",
67579
+ {
67580
+ ref: editRef,
67581
+ className: popoverVariants(),
67582
+ ...editProps,
67583
+ style: editProps.style
67584
+ },
67585
+ editContent
67586
+ ));
67274
67587
  }
67275
67588
  function LinkOpenButton() {
67276
67589
  const editor = useEditorRef();
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { WidgetProps } from './color-input';
3
+ export declare const BlockWidget: React.FC<WidgetProps>;
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ export interface WidgetProps {
3
+ presetColors: string[];
4
+ color: string;
5
+ onChange: (color: string | null) => void;
6
+ width: string;
7
+ }
8
+ export declare const useHexInput: (color: string, onChange: (color: string | null) => void) => {
9
+ inputValue: string;
10
+ handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
+ handleFocus: () => void;
12
+ handleBlur: () => void;
13
+ handleSwatchClick: (c: string) => void;
14
+ };
15
+ export declare const SwatchButton: React.FC<{
16
+ color: string;
17
+ isSelected: boolean;
18
+ onClick: () => void;
19
+ }>;
20
+ export declare const ColorPreview: React.FC<{
21
+ color: string;
22
+ size?: 'sm' | 'lg';
23
+ }>;
24
+ export declare const HexInput: React.FC<{
25
+ value: string;
26
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
27
+ onFocus: () => void;
28
+ onBlur: () => void;
29
+ fullWidth?: boolean;
30
+ }>;
31
+ export declare const SwatchGrid: React.FC<{
32
+ colors: string[];
33
+ selectedColor: string;
34
+ onSelect: (color: string) => void;
35
+ }>;
@@ -1,11 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { ColorFormat } from './color-formatter';
3
- type WrappedFieldProps = any;
3
+ interface FieldInput {
4
+ value: string | null;
5
+ onChange: (value: string | null) => void;
6
+ }
4
7
  interface Props {
5
8
  colorFormat: ColorFormat;
6
9
  userColors: string[];
7
10
  widget?: 'sketch' | 'block';
8
- input: WrappedFieldProps['input'];
11
+ width?: string;
12
+ input: FieldInput;
9
13
  }
10
14
  export declare const ColorPicker: React.FC<Props>;
11
15
  export {};
@@ -0,0 +1,37 @@
1
+ export declare const TRANSPARENT = "transparent";
2
+ export declare const isValidHex: (value: string) => boolean;
3
+ export declare const expandHex: (hex: string) => string;
4
+ export declare const hexToRgb: (hex: string) => {
5
+ r: number;
6
+ g: number;
7
+ b: number;
8
+ } | null;
9
+ /**
10
+ * Converts RGB color values to a hex color string (e.g., "#FF0000" for red).
11
+ *
12
+ * How it works:
13
+ * We need to convert three numbers (r, g, b) each ranging 0-255 into a 6-digit hex string.
14
+ * For example: rgb(255, 128, 0) should become "#FF8000"
15
+ *
16
+ * The bit-shifting approach combines all three values into one number:
17
+ * - (1 << 24) = 16777216 (0x1000000) - This adds a leading '1' to guarantee we always
18
+ * get 7 hex digits, which we later remove. Without this, rgb(0, 0, 255) would give
19
+ * us "FF" instead of "0000FF".
20
+ * - (r << 16) shifts red left by 16 bits, placing it in positions for the first two hex digits
21
+ * - (g << 8) shifts green left by 8 bits, placing it in positions for the middle two hex digits
22
+ * - b stays as-is, occupying the last two hex digits
23
+ *
24
+ * Example with rgb(255, 128, 0):
25
+ * 16777216 + (255 << 16) + (128 << 8) + 0
26
+ * = 16777216 + 16711680 + 32768 + 0
27
+ * = 33521664
28
+ * = 0x1FF8000 (as hex string: "1FF8000")
29
+ * After slice(1): "FF8000"
30
+ * Final result: "#FF8000"
31
+ */
32
+ export declare const rgbToHex: (r: number, g: number, b: number) => string;
33
+ export declare const checkerboardStyle: (size?: number) => {
34
+ backgroundImage: string;
35
+ backgroundSize: string;
36
+ backgroundPosition: string;
37
+ };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { WidgetProps } from './color-input';
3
+ export declare const SketchWidget: React.FC<WidgetProps>;
@@ -4,6 +4,7 @@ export interface ColorFieldProps {
4
4
  colorFormat: string;
5
5
  colors: string[];
6
6
  widget?: 'sketch' | 'block';
7
+ width?: string;
7
8
  }
8
9
  export declare const ColorField: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, ColorFieldProps>) => React.JSX.Element;
9
10
  export declare const ColorFieldPlugin: {
@@ -11,7 +11,7 @@ export declare const EditorContainer: {
11
11
  declare const editorVariants: (props?: {
12
12
  disabled?: boolean;
13
13
  focused?: boolean;
14
- variant?: "default" | "select" | "none" | "comment" | "demo" | "ai" | "aiChat" | "fullWidth";
14
+ variant?: "default" | "select" | "none" | "fullWidth" | "comment" | "demo" | "ai" | "aiChat";
15
15
  } & import("class-variance-authority/types").ClassProp) => string;
16
16
  export type EditorProps = PlateContentProps & VariantProps<typeof editorVariants>;
17
17
  export declare const Editor: React.ForwardRefExoticComponent<Omit<import("@udecode/plate").EditableProps, "decorate"> & {
@@ -22,6 +22,6 @@ export declare const Editor: React.ForwardRefExoticComponent<Omit<import("@udeco
22
22
  } & VariantProps<(props?: {
23
23
  disabled?: boolean;
24
24
  focused?: boolean;
25
- variant?: "default" | "select" | "none" | "comment" | "demo" | "ai" | "aiChat" | "fullWidth";
25
+ variant?: "default" | "select" | "none" | "fullWidth" | "comment" | "demo" | "ai" | "aiChat";
26
26
  } & import("class-variance-authority/types").ClassProp) => string> & React.RefAttributes<HTMLDivElement>>;
27
27
  export {};
@@ -3,12 +3,12 @@ import { type VariantProps } from 'class-variance-authority';
3
3
  export declare const buttonVariants: (props?: {
4
4
  isMenu?: boolean;
5
5
  size?: "default" | "none" | "icon" | "sm" | "lg" | "sms" | "xs";
6
- variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink";
6
+ variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink" | "tinaPrimary";
7
7
  } & import("class-variance-authority/types").ClassProp) => string;
8
8
  export declare const Button: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
9
9
  asChild?: boolean;
10
10
  } & VariantProps<(props?: {
11
11
  isMenu?: boolean;
12
12
  size?: "default" | "none" | "icon" | "sm" | "lg" | "sms" | "xs";
13
- variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink";
13
+ variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | "inlineLink" | "tinaPrimary";
14
14
  } & import("class-variance-authority/types").ClassProp) => string> & React.RefAttributes<HTMLButtonElement>>;
@@ -6,7 +6,7 @@ export declare const Command: React.ForwardRefExoticComponent<Omit<Omit<{
6
6
  ref?: React.Ref<HTMLDivElement>;
7
7
  } & {
8
8
  asChild?: boolean;
9
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
9
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
10
10
  label?: string;
11
11
  shouldFilter?: boolean;
12
12
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -22,7 +22,7 @@ export declare const Command: React.ForwardRefExoticComponent<Omit<Omit<{
22
22
  ref?: React.Ref<HTMLDivElement>;
23
23
  } & {
24
24
  asChild?: boolean;
25
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
25
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
26
26
  label?: string;
27
27
  shouldFilter?: boolean;
28
28
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -68,7 +68,7 @@ export declare const CommandList: React.ForwardRefExoticComponent<Omit<{
68
68
  ref?: React.Ref<HTMLDivElement>;
69
69
  } & {
70
70
  asChild?: boolean;
71
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
71
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
72
72
  label?: string;
73
73
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
74
74
  export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -77,14 +77,14 @@ export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
77
77
  ref?: React.Ref<HTMLDivElement>;
78
78
  } & {
79
79
  asChild?: boolean;
80
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
80
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
81
81
  export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
82
82
  children?: React.ReactNode;
83
83
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
84
84
  ref?: React.Ref<HTMLDivElement>;
85
85
  } & {
86
86
  asChild?: boolean;
87
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
87
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
88
88
  heading?: React.ReactNode;
89
89
  value?: string;
90
90
  forceMount?: boolean;
@@ -93,7 +93,7 @@ export declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick
93
93
  ref?: React.Ref<HTMLDivElement>;
94
94
  } & {
95
95
  asChild?: boolean;
96
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
96
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
97
97
  alwaysRender?: boolean;
98
98
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
99
99
  export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -102,7 +102,7 @@ export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
102
102
  ref?: React.Ref<HTMLDivElement>;
103
103
  } & {
104
104
  asChild?: boolean;
105
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
105
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "disabled" | "onSelect"> & {
106
106
  disabled?: boolean;
107
107
  onSelect?: (value: string) => void;
108
108
  value?: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tinacms",
3
3
  "type": "module",
4
4
  "typings": "dist/index.d.ts",
5
- "version": "0.0.0-f99bbbc-20251203005753",
5
+ "version": "0.0.0-fbc6afb-20251208042646",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -105,7 +105,7 @@
105
105
  "monaco-editor": "0.31.0",
106
106
  "prism-react-renderer": "^2.4.1",
107
107
  "prop-types": "15.7.2",
108
- "react-color": "^2.19.3",
108
+ "react-colorful": "^5.6.1",
109
109
  "react-datetime": "^3.3.1",
110
110
  "react-day-picker": "^9.11.1",
111
111
  "react-dropzone": "14.2.3",
@@ -117,9 +117,9 @@
117
117
  "webfontloader": "1.6.28",
118
118
  "yup": "^1.6.1",
119
119
  "zod": "^3.24.2",
120
- "@tinacms/schema-tools": "2.0.0",
121
120
  "@tinacms/mdx": "2.0.0",
122
- "@tinacms/search": "1.1.4"
121
+ "@tinacms/schema-tools": "2.0.0",
122
+ "@tinacms/search": "0.0.0-fbc6afb-20251208042646"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@graphql-tools/utils": "^10.8.1",
@@ -133,11 +133,9 @@
133
133
  "@types/node": "^22.13.1",
134
134
  "@types/prop-types": "^15.7.14",
135
135
  "@types/react": "^18.3.18",
136
- "@types/react-color": "^3.0.13",
137
136
  "@types/react-dom": "^18.3.5",
138
137
  "happy-dom": "15.10.2",
139
138
  "identity-obj-proxy": "^3.0.0",
140
- "isomorphic-fetch": "^3.0.0",
141
139
  "jest-file-snapshot": "^0.7.0",
142
140
  "lowlight": "^3.3.0",
143
141
  "next": "14.2.10",
@@ -149,7 +147,7 @@
149
147
  "typescript": "^5.7.3",
150
148
  "vite": "^5.4.14",
151
149
  "vitest": "^2.1.9",
152
- "@tinacms/scripts": "1.4.1"
150
+ "@tinacms/scripts": "0.0.0-fbc6afb-20251208042646"
153
151
  },
154
152
  "peerDependencies": {
155
153
  "react": ">=16.14.0",