@pixerate/editor-react 0.166.0 → 0.169.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/canvas/index.cjs +415 -332
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +85 -0
- package/dist/canvas/useCanvasProposals.d.cts +52 -0
- package/dist/canvas/useCanvasProposals.d.ts +52 -0
- package/dist/{chunk-65EL63YS.js → chunk-2UD3JH4W.js} +1137 -1376
- package/dist/chunk-EP6C5N54.js +406 -0
- package/dist/image-editor/LayerEffectsPanel.d.cts +3 -2
- package/dist/image-editor/LayerEffectsPanel.d.ts +3 -2
- package/dist/image-editor/index.cjs +121 -121
- package/dist/image-editor/index.js +10 -9
- package/dist/index.cjs +121 -121
- package/dist/index.js +10 -9
- package/dist/paint-editor/PaintLayersPanel.d.cts +2 -1
- package/dist/paint-editor/PaintLayersPanel.d.ts +2 -1
- package/dist/paint-editor/index.cjs +688 -423
- package/dist/paint-editor/index.js +38 -2
- package/package.json +3 -3
- package/dist/chunk-AJCWF6SN.js +0 -125
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
LayerEffectsPanel,
|
|
2
3
|
PaintGradientEditorView
|
|
3
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-EP6C5N54.js";
|
|
4
5
|
import {
|
|
5
6
|
EffectParameters,
|
|
6
7
|
EffectsBrowser,
|
|
@@ -592,6 +593,13 @@ import {
|
|
|
592
593
|
PARTICLE_KIND_LABELS,
|
|
593
594
|
PARTICLE_RENDERS,
|
|
594
595
|
PARTICLE_RENDER_LABELS,
|
|
596
|
+
RIBBON_PAIRS,
|
|
597
|
+
RIBBON_PAIR_LABELS,
|
|
598
|
+
DOT_TEXTURE_ORDERS,
|
|
599
|
+
DOT_TEXTURE_ORDER_LABELS,
|
|
600
|
+
DOT_ROTATIONS,
|
|
601
|
+
DOT_ROTATION_LABELS,
|
|
602
|
+
toggleDotTexture,
|
|
595
603
|
STAMP_KINDS,
|
|
596
604
|
STAMP_LABELS,
|
|
597
605
|
toggleStamp
|
|
@@ -675,6 +683,33 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
675
683
|
/* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", children: [
|
|
676
684
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: "Drawn as" }),
|
|
677
685
|
/* @__PURE__ */ jsx5("select", { "aria-label": "Particle render", value: brush.particle.render, onChange: (e) => controller.setBrush({ particle: { render: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: PARTICLE_RENDERS.map((k) => /* @__PURE__ */ jsx5("option", { value: k, children: PARTICLE_RENDER_LABELS[k] }, k)) })
|
|
686
|
+
] }),
|
|
687
|
+
brush.particle.render === "ribbon" && /* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", children: [
|
|
688
|
+
/* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: "Ribbon joins" }),
|
|
689
|
+
/* @__PURE__ */ jsx5("select", { "aria-label": "Ribbon pairs", value: brush.particle.ribbonPairs, onChange: (e) => controller.setBrush({ particle: { ribbonPairs: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: RIBBON_PAIRS.map((k) => /* @__PURE__ */ jsx5("option", { value: k, children: RIBBON_PAIR_LABELS[k] }, k)) })
|
|
690
|
+
] }),
|
|
691
|
+
(brush.particle.render === "dot" || brush.particle.render === "sequence") && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
692
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Dot textures", title: "Stamps drawn instead of round dots (up to 4; none: round)", children: STAMP_KINDS.map((k) => /* @__PURE__ */ jsx5(
|
|
693
|
+
"button",
|
|
694
|
+
{
|
|
695
|
+
type: "button",
|
|
696
|
+
"aria-pressed": brush.particle.dotTextures.includes(k),
|
|
697
|
+
className: `px-1.5 py-0.5 rounded text-[10px] ${brush.particle.dotTextures.includes(k) ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
|
|
698
|
+
onClick: () => controller.setBrush({ particle: { dotTextures: toggleDotTexture(brush.particle.dotTextures, k) } }),
|
|
699
|
+
children: STAMP_LABELS[k]
|
|
700
|
+
},
|
|
701
|
+
k
|
|
702
|
+
)) }),
|
|
703
|
+
brush.particle.dotTextures.length > 0 && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
704
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", children: [
|
|
705
|
+
/* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: "Texture order" }),
|
|
706
|
+
/* @__PURE__ */ jsx5("select", { "aria-label": "Dot texture order", value: brush.particle.dotTextureOrder, onChange: (e) => controller.setBrush({ particle: { dotTextureOrder: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: DOT_TEXTURE_ORDERS.map((k) => /* @__PURE__ */ jsx5("option", { value: k, children: DOT_TEXTURE_ORDER_LABELS[k] }, k)) })
|
|
707
|
+
] }),
|
|
708
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", children: [
|
|
709
|
+
/* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: "Texture turn" }),
|
|
710
|
+
/* @__PURE__ */ jsx5("select", { "aria-label": "Dot rotation", value: brush.particle.dotRotation, onChange: (e) => controller.setBrush({ particle: { dotRotation: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: DOT_ROTATIONS.map((k) => /* @__PURE__ */ jsx5("option", { value: k, children: DOT_ROTATION_LABELS[k] }, k)) })
|
|
711
|
+
] })
|
|
712
|
+
] })
|
|
678
713
|
] })
|
|
679
714
|
] }),
|
|
680
715
|
engine.stickerStamps && /* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Sticker stamps", children: STAMP_KINDS.map((k) => /* @__PURE__ */ jsx5(
|
|
@@ -1162,7 +1197,8 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1162
1197
|
/* @__PURE__ */ jsx8("span", { className: "w-14 text-slate-400", children: "Strength" }),
|
|
1163
1198
|
/* @__PURE__ */ jsx8("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
|
|
1164
1199
|
] })
|
|
1165
|
-
] })
|
|
1200
|
+
] }),
|
|
1201
|
+
/* @__PURE__ */ jsx8("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ jsx8(LayerEffectsPanel, { controller, layerId: active.id }) })
|
|
1166
1202
|
] }),
|
|
1167
1203
|
/* @__PURE__ */ jsx8(ErrorLine, { error })
|
|
1168
1204
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.169.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
"dependencies": {},
|
|
255
255
|
"peerDependencies": {
|
|
256
256
|
"@dagrejs/dagre": "^1.1.8",
|
|
257
|
-
"@pixerate/editor": ">=0.
|
|
257
|
+
"@pixerate/editor": ">=0.248.0 <1.0.0-0",
|
|
258
258
|
"@tiptap/core": "^2.27.3",
|
|
259
259
|
"@tiptap/extension-bubble-menu": "^2.27.3",
|
|
260
260
|
"@tiptap/extension-placeholder": "^2.27.3",
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
"tsup": "^9.0.0",
|
|
306
306
|
"typescript": "^5.7.3",
|
|
307
307
|
"vitest": "^5.0.5",
|
|
308
|
-
"@pixerate/editor": "0.
|
|
308
|
+
"@pixerate/editor": "0.248.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|
package/dist/chunk-AJCWF6SN.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// src/paint-editor/PaintGradientEditorView.tsx
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
5
|
-
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
6
|
-
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
7
|
-
var pct = (v) => Math.round(v * 1e3) / 10;
|
|
8
|
-
var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
9
|
-
const {
|
|
10
|
-
PAINT_GRADIENT_MAPPINGS,
|
|
11
|
-
PAINT_GRADIENT_MAPPING_LABELS,
|
|
12
|
-
PAINT_GRADIENT_PRESETS,
|
|
13
|
-
PAINT_GRADIENT_REPEATS,
|
|
14
|
-
PAINT_GRADIENT_REPEAT_LABELS,
|
|
15
|
-
PAINT_GRADIENT_SPACES,
|
|
16
|
-
PAINT_GRADIENT_SPACE_LABELS,
|
|
17
|
-
addPaintGradientStop,
|
|
18
|
-
paintGradientMappingFor,
|
|
19
|
-
paintSourceCss,
|
|
20
|
-
removePaintGradientStop,
|
|
21
|
-
reversePaintGradient,
|
|
22
|
-
updatePaintGradientStop
|
|
23
|
-
} = kit;
|
|
24
|
-
const [selected, setSelected] = useState(0);
|
|
25
|
-
const sel = Math.min(selected, value.stops.length - 1);
|
|
26
|
-
const stop = value.stops[sel];
|
|
27
|
-
const map = value.map;
|
|
28
|
-
const stopHex = (c) => c === "paint" ? colors.paint : c === "secondary" ? colors.secondary : c;
|
|
29
|
-
const patchStop = (patch) => {
|
|
30
|
-
const r = updatePaintGradientStop(value, sel, patch);
|
|
31
|
-
setSelected(r.index);
|
|
32
|
-
onChange(r.paint);
|
|
33
|
-
};
|
|
34
|
-
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
|
|
35
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
36
|
-
/* @__PURE__ */ jsxs("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
|
|
37
|
-
/* @__PURE__ */ jsx("option", { value: "", children: "Presets\u2026" }),
|
|
38
|
-
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ jsx("option", { value: i, children: p.name }, p.name))
|
|
39
|
-
] }),
|
|
40
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ jsx(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
role: "slider",
|
|
46
|
-
tabIndex: 0,
|
|
47
|
-
"aria-label": "Gradient ramp: click to add a stop",
|
|
48
|
-
"aria-valuemin": 0,
|
|
49
|
-
"aria-valuemax": 100,
|
|
50
|
-
"aria-valuenow": pct(stop.offset),
|
|
51
|
-
"data-testid": "paint-gradient-ramp",
|
|
52
|
-
className: "relative h-6 cursor-copy rounded ring-1 ring-slate-700",
|
|
53
|
-
style: { background: paintSourceCss(value, colors) },
|
|
54
|
-
onClick: (e) => {
|
|
55
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
56
|
-
const r = addPaintGradientStop(value, rect.width ? (e.clientX - rect.left) / rect.width : 0.5, colors);
|
|
57
|
-
if (r.index >= 0) {
|
|
58
|
-
setSelected(r.index);
|
|
59
|
-
onChange(r.paint);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
/* @__PURE__ */ jsx("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ jsx(
|
|
65
|
-
"button",
|
|
66
|
-
{
|
|
67
|
-
type: "button",
|
|
68
|
-
"aria-label": `Stop ${i + 1} at ${pct(s.offset)}%`,
|
|
69
|
-
"aria-pressed": i === sel,
|
|
70
|
-
className: `absolute top-0 h-4 w-3 -translate-x-1/2 rounded-sm ring-1 ${i === sel ? "ring-white" : "ring-slate-600"}`,
|
|
71
|
-
style: { left: `${s.offset * 100}%`, background: stopHex(s.color) },
|
|
72
|
-
onClick: () => setSelected(i)
|
|
73
|
-
},
|
|
74
|
-
i
|
|
75
|
-
)) }),
|
|
76
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
|
|
77
|
-
/* @__PURE__ */ jsxs("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
|
|
78
|
-
/* @__PURE__ */ jsx("option", { value: "color", children: "Colour" }),
|
|
79
|
-
/* @__PURE__ */ jsx("option", { value: "paint", children: "Paint colour" }),
|
|
80
|
-
/* @__PURE__ */ jsx("option", { value: "secondary", children: "Second colour" })
|
|
81
|
-
] }),
|
|
82
|
-
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ jsx("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
|
|
83
|
-
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1", children: [
|
|
84
|
-
"At",
|
|
85
|
-
/* @__PURE__ */ jsx("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
|
|
86
|
-
"%"
|
|
87
|
-
] }),
|
|
88
|
-
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1", children: [
|
|
89
|
-
"Opacity",
|
|
90
|
-
/* @__PURE__ */ jsx("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
|
|
91
|
-
"%"
|
|
92
|
-
] }),
|
|
93
|
-
sel < value.stops.length - 1 && /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1", children: [
|
|
94
|
-
"Midpoint",
|
|
95
|
-
/* @__PURE__ */ jsx("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
|
|
96
|
-
"%"
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
|
|
99
|
-
] }),
|
|
100
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
101
|
-
/* @__PURE__ */ jsx("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ jsx("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
|
|
102
|
-
map.by === "distance" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
103
|
-
/* @__PURE__ */ jsx("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
|
|
104
|
-
/* @__PURE__ */ jsxs("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
|
|
105
|
-
/* @__PURE__ */ jsx("option", { value: "px", children: "px" }),
|
|
106
|
-
/* @__PURE__ */ jsx("option", { value: "dabs", children: "dabs" })
|
|
107
|
-
] })
|
|
108
|
-
] }),
|
|
109
|
-
map.by === "time" && /* @__PURE__ */ jsx("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
|
|
110
|
-
map.by === "random" && /* @__PURE__ */ jsx("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
|
|
111
|
-
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ jsx("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ jsx("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
|
|
112
|
-
] }),
|
|
113
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
114
|
-
/* @__PURE__ */ jsx("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ jsx("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
|
|
115
|
-
/* @__PURE__ */ jsxs("label", { className: "flex flex-1 items-center gap-1", children: [
|
|
116
|
-
"Softness",
|
|
117
|
-
/* @__PURE__ */ jsx("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
|
|
118
|
-
] })
|
|
119
|
-
] })
|
|
120
|
-
] });
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export {
|
|
124
|
-
PaintGradientEditorView
|
|
125
|
-
};
|