@pixerate/editor-react 0.87.0 → 0.88.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/vector/index.cjs +32 -2
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.js +34 -3
- package/dist/vector/index.js.map +1 -1
- package/package.json +3 -3
package/dist/vector/index.cjs
CHANGED
|
@@ -325,7 +325,12 @@ var VectorSceneNode = import_react3.default.memo(function VectorSceneNode2({ nod
|
|
|
325
325
|
if (node.layers)
|
|
326
326
|
return (
|
|
327
327
|
// Fill and stroke stacks: each layer in order, bottom to top.
|
|
328
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", { "data-vector-id": node.id, transform: node.transform, opacity: node.opacity < 1 ? node.opacity : void 0, filter: node.filter, style: blendStyle(node.blendMode), children: node.layers.map(
|
|
328
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", { "data-vector-id": node.id, transform: node.transform, opacity: node.opacity < 1 ? node.opacity : void 0, filter: node.filter, style: blendStyle(node.blendMode), children: node.layers.map(
|
|
329
|
+
(layer) => layer.kind === "brushstroke" ? (
|
|
330
|
+
// A brushstroke: its rendered brush images over their boxes.
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", { "data-vector-layer": `brushstroke-${layer.index}`, opacity: layer.opacity < 1 ? layer.opacity : void 0, style: blendStyle(layer.blendMode), children: (layer.images ?? []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("image", { href: im.href, x: im.x, y: im.y, width: im.width, height: im.height, preserveAspectRatio: "none" }, i)) }, `${layer.kind}-${layer.index}`)
|
|
332
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(VectorPaintPath, { paint: layer, d: node.d, fillRule: node.fillRule, layer: `${layer.kind}-${layer.index}` }, `${layer.kind}-${layer.index}`)
|
|
333
|
+
) })
|
|
329
334
|
);
|
|
330
335
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(VectorPaintPath, { paint: node, d: node.d, fillRule: node.fillRule, id: node.id, transform: node.transform, filter: node.filter, blendMode: node.blendMode });
|
|
331
336
|
});
|
|
@@ -1033,6 +1038,30 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1033
1038
|
const update = (l, patch, merge = false) => controller.updatePaintLayer(l.kind, l.index, patch, { ids, merge });
|
|
1034
1039
|
const layerRow = (l, count) => {
|
|
1035
1040
|
const name = `${l.kind === "fill" ? "Fill" : "Stroke"} ${l.index + 1}`;
|
|
1041
|
+
if (l.brushstroke)
|
|
1042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-layer": `${l.kind}-${l.index}`, "data-vector-brushstroke": "", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "color", "aria-label": `${name} colour`, className: "h-7 w-10 cursor-pointer rounded border border-border bg-background", value: l.color ?? "#000000", onChange: (e) => controller.setBrushstroke(l.index, { color: e.target.value }, { ids, merge: true }), onBlur: end }),
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children: (0, import_vector5.vectorBrushstrokeBrushes)().map((b) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: b.id, children: b.name }, b.id)) }),
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1047
|
+
"input",
|
|
1048
|
+
{
|
|
1049
|
+
type: "number",
|
|
1050
|
+
min: 0.5,
|
|
1051
|
+
step: 0.5,
|
|
1052
|
+
"aria-label": `${name} brush size`,
|
|
1053
|
+
title: "Brush size",
|
|
1054
|
+
className: numberClass2,
|
|
1055
|
+
value: l.brushstroke.size,
|
|
1056
|
+
onChange: (e) => {
|
|
1057
|
+
const n = parseFloat(e.target.value);
|
|
1058
|
+
if (Number.isFinite(n) && n > 0) controller.setBrushstroke(l.index, { size: Math.min(500, n) }, { ids, merge: true });
|
|
1059
|
+
},
|
|
1060
|
+
onBlur: end
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1063
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${name}`, onClick: () => controller.removePaintLayer("stroke", l.index, { ids }), children: "\xD7" })
|
|
1064
|
+
] }) }, `${l.kind}-${l.index}`);
|
|
1036
1065
|
if (l.unknownKind)
|
|
1037
1066
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "text-[11px] text-muted-foreground", "data-vector-layer": `${l.kind}-${l.index}`, children: [
|
|
1038
1067
|
name,
|
|
@@ -1128,7 +1157,8 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1128
1157
|
onClick: () => controller.addPaintLayer(kind, {}, { ids }),
|
|
1129
1158
|
children: "+"
|
|
1130
1159
|
}
|
|
1131
|
-
)
|
|
1160
|
+
),
|
|
1161
|
+
kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: buttonClass2, title: "Add a brushstroke (a natural-media brush along the path)", "aria-label": "Add brushstroke", "data-vector-add-brushstroke": "", disabled: !ids.length, onClick: () => controller.addBrushstroke({ brushId: (0, import_vector5.vectorBrushstrokeBrushes)()[0].id }, { ids }), children: "\u270E+" })
|
|
1132
1162
|
] }),
|
|
1133
1163
|
[...layers].reverse().map((l) => layerRow(l, layers.length))
|
|
1134
1164
|
] });
|