tinacms 3.0.1 → 3.0.2
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 +376 -103
- package/dist/toolkit/fields/components/color-picker/block-widget.d.ts +3 -0
- package/dist/toolkit/fields/components/color-picker/color-input.d.ts +35 -0
- package/dist/toolkit/fields/components/color-picker/color-picker.d.ts +6 -2
- package/dist/toolkit/fields/components/color-picker/color-utils.d.ts +37 -0
- package/dist/toolkit/fields/components/color-picker/sketch-widget.d.ts +3 -0
- package/dist/toolkit/fields/plugins/color-field-plugin.d.ts +1 -0
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/editor.d.ts +2 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/button.d.ts +2 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/command.d.ts +7 -7
- package/package.json +4 -6
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
|
|
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 =
|
|
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
|
|
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
|
|
39576
|
+
return to$1.hex(colorVals).toUpperCase();
|
|
39413
39577
|
},
|
|
39414
39578
|
parse: ParseColorStr
|
|
39415
39579
|
}
|
|
39416
39580
|
};
|
|
39417
|
-
const
|
|
39418
|
-
|
|
39419
|
-
|
|
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
|
+
));
|
|
39420
39633
|
};
|
|
39421
|
-
const
|
|
39422
|
-
|
|
39423
|
-
|
|
39424
|
-
|
|
39425
|
-
|
|
39426
|
-
}
|
|
39634
|
+
const isLightBackground = function(backgroundColor) {
|
|
39635
|
+
return !backgroundColor || backgroundColor.r * 0.299 + backgroundColor.g * 0.587 + backgroundColor.b * 0.114 > 186;
|
|
39636
|
+
};
|
|
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
|
|
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
|
|
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:
|
|
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-
|
|
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 [
|
|
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
|
-
|
|
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 =
|
|
39533
|
-
setTimeout(
|
|
39534
|
-
updateTriggerBoundingBox();
|
|
39535
|
-
}, delay);
|
|
39717
|
+
let timeout = null;
|
|
39718
|
+
timeout = setTimeout(updateTriggerBoundingBox, delay);
|
|
39536
39719
|
const handleResize = () => {
|
|
39537
|
-
|
|
39720
|
+
if (timeout)
|
|
39721
|
+
clearTimeout(timeout);
|
|
39538
39722
|
timeout = setTimeout(updateTriggerBoundingBox, delay);
|
|
39539
39723
|
};
|
|
39540
39724
|
window.addEventListener("resize", handleResize);
|
|
39541
|
-
return () =>
|
|
39542
|
-
|
|
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
|
|
39552
|
-
|
|
39553
|
-
|
|
39554
|
-
|
|
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
|
-
|
|
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,
|
|
39591
|
-
color:
|
|
39780
|
+
presetColors: [...userColors, TRANSPARENT],
|
|
39781
|
+
color: currentHexColor,
|
|
39592
39782
|
onChange: handleChange,
|
|
39593
|
-
|
|
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
|
);
|
|
@@ -46414,7 +46604,7 @@ const NavProvider = ({
|
|
|
46414
46604
|
};
|
|
46415
46605
|
return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
|
|
46416
46606
|
};
|
|
46417
|
-
const version$1 = "3.0.
|
|
46607
|
+
const version$1 = "3.0.2";
|
|
46418
46608
|
const VersionInfo = () => {
|
|
46419
46609
|
var _a2, _b, _c, _d, _e, _f;
|
|
46420
46610
|
const cms = useCMS();
|
|
@@ -67191,6 +67381,23 @@ function LinkFloatingToolbar({
|
|
|
67191
67381
|
}) {
|
|
67192
67382
|
const activeCommentId = usePluginOption({ key: "comment" }, "activeId");
|
|
67193
67383
|
const activeSuggestionId = usePluginOption({ key: "suggestion" }, "activeId");
|
|
67384
|
+
const { api, editor } = useEditorPlugin(LinkPlugin);
|
|
67385
|
+
const isUrlValidator = usePluginOption(LinkPlugin, "isUrl");
|
|
67386
|
+
const [currentUrl, setCurrentUrl] = React.useState("");
|
|
67387
|
+
const [isValidUrl, setIsValidUrl] = React.useState(true);
|
|
67388
|
+
const handleUrlInput = React.useCallback(
|
|
67389
|
+
(e3) => {
|
|
67390
|
+
const value = e3.currentTarget.value;
|
|
67391
|
+
setCurrentUrl(value);
|
|
67392
|
+
if (value && isUrlValidator) {
|
|
67393
|
+
const valid = isUrlValidator(value);
|
|
67394
|
+
setIsValidUrl(valid);
|
|
67395
|
+
} else {
|
|
67396
|
+
setIsValidUrl(true);
|
|
67397
|
+
}
|
|
67398
|
+
},
|
|
67399
|
+
[isUrlValidator]
|
|
67400
|
+
);
|
|
67194
67401
|
const floatingOptions = React.useMemo(() => {
|
|
67195
67402
|
return {
|
|
67196
67403
|
middleware: [
|
|
@@ -67234,22 +67441,70 @@ function LinkFloatingToolbar({
|
|
|
67234
67441
|
});
|
|
67235
67442
|
if (hidden)
|
|
67236
67443
|
return null;
|
|
67237
|
-
const input = /* @__PURE__ */ React.createElement(
|
|
67238
|
-
|
|
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",
|
|
67444
|
+
const input = /* @__PURE__ */ React.createElement(
|
|
67445
|
+
"div",
|
|
67246
67446
|
{
|
|
67247
|
-
className:
|
|
67248
|
-
|
|
67249
|
-
|
|
67250
|
-
|
|
67251
|
-
|
|
67252
|
-
|
|
67447
|
+
className: "z-[999999] flex w-[330px] flex-col relative",
|
|
67448
|
+
...inputProps
|
|
67449
|
+
},
|
|
67450
|
+
!isValidUrl && currentUrl && /* @__PURE__ */ React.createElement("div", { className: "absolute -top-16 left-0 right-0 z-[1000000] mb-2" }, /* @__PURE__ */ React.createElement(
|
|
67451
|
+
"div",
|
|
67452
|
+
{
|
|
67453
|
+
className: "bg-red-50 border border-red-200 rounded-md p-2 shadow-lg",
|
|
67454
|
+
role: "alert",
|
|
67455
|
+
"aria-live": "polite"
|
|
67456
|
+
},
|
|
67457
|
+
/* @__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")),
|
|
67458
|
+
/* @__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" })
|
|
67459
|
+
)),
|
|
67460
|
+
/* @__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(
|
|
67461
|
+
FloatingLinkUrlInput,
|
|
67462
|
+
{
|
|
67463
|
+
className: inputVariants(),
|
|
67464
|
+
placeholder: "Paste link",
|
|
67465
|
+
"data-plate-focus": true,
|
|
67466
|
+
onInput: handleUrlInput
|
|
67467
|
+
}
|
|
67468
|
+
)),
|
|
67469
|
+
/* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
|
|
67470
|
+
/* @__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(
|
|
67471
|
+
"input",
|
|
67472
|
+
{
|
|
67473
|
+
className: inputVariants(),
|
|
67474
|
+
placeholder: "Text to display",
|
|
67475
|
+
"data-plate-focus": true,
|
|
67476
|
+
...textInputProps
|
|
67477
|
+
}
|
|
67478
|
+
)),
|
|
67479
|
+
/* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
|
|
67480
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-end gap-2 px-2 py-1" }, /* @__PURE__ */ React.createElement(
|
|
67481
|
+
"button",
|
|
67482
|
+
{
|
|
67483
|
+
type: "button",
|
|
67484
|
+
className: buttonVariants$2({ size: "sm", variant: "ghost" }),
|
|
67485
|
+
onClick: () => {
|
|
67486
|
+
api.floatingLink.hide();
|
|
67487
|
+
}
|
|
67488
|
+
},
|
|
67489
|
+
"Cancel"
|
|
67490
|
+
), /* @__PURE__ */ React.createElement(
|
|
67491
|
+
"button",
|
|
67492
|
+
{
|
|
67493
|
+
type: "button",
|
|
67494
|
+
className: buttonVariants$2({
|
|
67495
|
+
size: "sm",
|
|
67496
|
+
variant: "tinaPrimary"
|
|
67497
|
+
}),
|
|
67498
|
+
onClick: () => {
|
|
67499
|
+
if (isValidUrl && currentUrl) {
|
|
67500
|
+
submitFloatingLink(editor);
|
|
67501
|
+
}
|
|
67502
|
+
},
|
|
67503
|
+
disabled: !isValidUrl && !!currentUrl
|
|
67504
|
+
},
|
|
67505
|
+
"OK"
|
|
67506
|
+
))
|
|
67507
|
+
);
|
|
67253
67508
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex items-center" }, /* @__PURE__ */ React.createElement(
|
|
67254
67509
|
"button",
|
|
67255
67510
|
{
|
|
@@ -67270,7 +67525,25 @@ function LinkFloatingToolbar({
|
|
|
67270
67525
|
},
|
|
67271
67526
|
/* @__PURE__ */ React.createElement(Unlink, { width: 18 })
|
|
67272
67527
|
));
|
|
67273
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
67528
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
67529
|
+
"div",
|
|
67530
|
+
{
|
|
67531
|
+
ref: insertRef,
|
|
67532
|
+
className: popoverVariants(),
|
|
67533
|
+
...insertProps,
|
|
67534
|
+
style: insertProps.style
|
|
67535
|
+
},
|
|
67536
|
+
input
|
|
67537
|
+
), /* @__PURE__ */ React.createElement(
|
|
67538
|
+
"div",
|
|
67539
|
+
{
|
|
67540
|
+
ref: editRef,
|
|
67541
|
+
className: popoverVariants(),
|
|
67542
|
+
...editProps,
|
|
67543
|
+
style: editProps.style
|
|
67544
|
+
},
|
|
67545
|
+
editContent
|
|
67546
|
+
));
|
|
67274
67547
|
}
|
|
67275
67548
|
function LinkOpenButton() {
|
|
67276
67549
|
const editor = useEditorRef();
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
+
};
|
|
@@ -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" | "
|
|
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" | "
|
|
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" |
|
|
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" |
|
|
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" |
|
|
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" |
|
|
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" |
|
|
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" |
|
|
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" |
|
|
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": "3.0.
|
|
5
|
+
"version": "3.0.2",
|
|
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-
|
|
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",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"zod": "^3.24.2",
|
|
120
120
|
"@tinacms/mdx": "2.0.0",
|
|
121
121
|
"@tinacms/schema-tools": "2.0.0",
|
|
122
|
-
"@tinacms/search": "1.1.
|
|
122
|
+
"@tinacms/search": "1.1.5"
|
|
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.
|
|
150
|
+
"@tinacms/scripts": "1.4.2"
|
|
153
151
|
},
|
|
154
152
|
"peerDependencies": {
|
|
155
153
|
"react": ">=16.14.0",
|