@pixerate/editor-react 0.65.0 → 0.67.0
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/{chunk-OSBDCFF4.js → chunk-LCTQWNTL.js} +67 -3
- package/dist/{chunk-OSBDCFF4.js.map → chunk-LCTQWNTL.js.map} +1 -1
- package/dist/image-editor/index.cjs +65 -1
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +4 -3
- package/dist/image-editor/index.d.ts +4 -3
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +65 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/vector/index.cjs +482 -210
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +19 -2
- package/dist/vector/index.d.ts +19 -2
- package/dist/vector/index.js +468 -193
- package/dist/vector/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1663,6 +1663,11 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
1663
1663
|
(0, import_react10.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
1664
1664
|
const bar = tool.bar();
|
|
1665
1665
|
if (!tool.active || !bar) return null;
|
|
1666
|
+
const warp = tool.warpBar();
|
|
1667
|
+
const warpNumber = (key, raw) => {
|
|
1668
|
+
const v = Number(raw);
|
|
1669
|
+
if (raw.trim() !== "" && Number.isFinite(v) && v !== warp[key]) tool.setWarp({ [key]: Math.max(-100, Math.min(100, v)) });
|
|
1670
|
+
};
|
|
1666
1671
|
const apply = (field, raw) => {
|
|
1667
1672
|
const v = Number(raw);
|
|
1668
1673
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
@@ -1670,7 +1675,66 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
1670
1675
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
1671
1676
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor11.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip2(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
1672
1677
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor11.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
|
|
1673
|
-
|
|
1678
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Warp" }),
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5", children: import_image_editor11.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
1682
|
+
] }),
|
|
1683
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1686
|
+
"input",
|
|
1687
|
+
{
|
|
1688
|
+
type: "number",
|
|
1689
|
+
"aria-label": k === "bend" ? "Warp bend in percent" : `Warp ${k} distortion in percent`,
|
|
1690
|
+
defaultValue: warp[k],
|
|
1691
|
+
min: -100,
|
|
1692
|
+
max: 100,
|
|
1693
|
+
disabled: warp.style === "custom",
|
|
1694
|
+
className: "w-14 rounded border border-slate-700 bg-slate-900 px-1 py-0.5 text-right disabled:opacity-40",
|
|
1695
|
+
onBlur: (e) => warpNumber(k, e.currentTarget.value),
|
|
1696
|
+
onKeyDown: (e) => {
|
|
1697
|
+
if (e.key === "Enter") {
|
|
1698
|
+
e.preventDefault();
|
|
1699
|
+
e.stopPropagation();
|
|
1700
|
+
warpNumber(k, e.currentTarget.value);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
},
|
|
1704
|
+
`${k}:${warp[k]}`
|
|
1705
|
+
),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-500", children: "%" })
|
|
1707
|
+
] }, k)),
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1709
|
+
"button",
|
|
1710
|
+
{
|
|
1711
|
+
type: "button",
|
|
1712
|
+
title: "Bend along the vertical axis",
|
|
1713
|
+
"aria-pressed": warp.orientation === "vertical",
|
|
1714
|
+
disabled: warp.style === "custom",
|
|
1715
|
+
className: chip2(warp.orientation === "vertical"),
|
|
1716
|
+
onClick: () => tool.setWarp({ orientation: warp.orientation === "vertical" ? "horizontal" : "vertical" }),
|
|
1717
|
+
children: "Vertical"
|
|
1718
|
+
}
|
|
1719
|
+
),
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
1721
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Grid" }),
|
|
1722
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1723
|
+
"select",
|
|
1724
|
+
{
|
|
1725
|
+
"aria-label": "Warp grid",
|
|
1726
|
+
value: import_image_editor11.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
|
|
1727
|
+
onChange: (e) => {
|
|
1728
|
+
const g = import_image_editor11.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
|
|
1729
|
+
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
1730
|
+
},
|
|
1731
|
+
className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
|
|
1732
|
+
children: import_image_editor11.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
1733
|
+
}
|
|
1734
|
+
)
|
|
1735
|
+
] })
|
|
1736
|
+
] }),
|
|
1737
|
+
tool.mode !== "warp" && import_image_editor11.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
1674
1738
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: f.label }),
|
|
1675
1739
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1676
1740
|
"input",
|