@pixerate/editor-react 0.164.0 → 0.166.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.
|
@@ -6,8 +6,8 @@ export interface PaperPanelProps {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* The paper library by family (each a generated grain preview) and the current paper's colour,
|
|
9
|
-
* grain depth, scale, shading and contrast, the wet-media properties
|
|
10
|
-
* change one undo step; sliders commit on release); then the light for thick paint and metallic
|
|
9
|
+
* grain depth, scale, shading and contrast, the wet-media properties, metallic sheen and backlight
|
|
10
|
+
* with its colour (each change one undo step; sliders commit on release); then the light for thick paint and metallic
|
|
11
11
|
* paper (not an undo step) and Flatten relief for the active layer.
|
|
12
12
|
*/
|
|
13
13
|
export declare const PaperPanel: React.FC<PaperPanelProps>;
|
|
@@ -6,8 +6,8 @@ export interface PaperPanelProps {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* The paper library by family (each a generated grain preview) and the current paper's colour,
|
|
9
|
-
* grain depth, scale, shading and contrast, the wet-media properties
|
|
10
|
-
* change one undo step; sliders commit on release); then the light for thick paint and metallic
|
|
9
|
+
* grain depth, scale, shading and contrast, the wet-media properties, metallic sheen and backlight
|
|
10
|
+
* with its colour (each change one undo step; sliders commit on release); then the light for thick paint and metallic
|
|
11
11
|
* paper (not an undo step) and Flatten relief for the active layer.
|
|
12
12
|
*/
|
|
13
13
|
export declare const PaperPanel: React.FC<PaperPanelProps>;
|
|
@@ -837,6 +837,10 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
837
837
|
}
|
|
838
838
|
)
|
|
839
839
|
] }),
|
|
840
|
+
engine.light && brush.light.amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2", title: "Pressure scales the light the brush lays", children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": "Light follows pressure", checked: brush.light.pressure, onChange: (e) => controller.setBrush({ light: { pressure: e.target.checked } }) }),
|
|
842
|
+
" Light follows pressure"
|
|
843
|
+
] }),
|
|
840
844
|
engine.dirty && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2", title: "Keep the colour the brush picked up for the next stroke (needs Pick-up above 0)", children: [
|
|
841
845
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": "Dirty brush", checked: brush.behavior.dirty, onChange: (e) => controller.setBrush({ behavior: { dirty: e.target.checked } }) }),
|
|
842
846
|
" Dirty brush"
|
|
@@ -922,6 +926,10 @@ var PaperPanel = ({ controller, className }) => {
|
|
|
922
926
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
923
927
|
] }),
|
|
924
928
|
import_paint_editor7.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor7.patchPath)(paper, c.path, v))) }, c.path)),
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between", children: [
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor7.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
932
|
+
] }),
|
|
925
933
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
926
934
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
|
|
927
935
|
" Mirror tiling"
|
|
@@ -1157,6 +1165,7 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1157
1165
|
const [renaming, setRenaming] = (0, import_react9.useState)(null);
|
|
1158
1166
|
const layers = controller.listLayers();
|
|
1159
1167
|
const active = layers.find((l) => l.active) ?? null;
|
|
1168
|
+
const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
|
|
1160
1169
|
const move = (delta) => {
|
|
1161
1170
|
if (!active) return;
|
|
1162
1171
|
const { index, count } = siblingIndex(layers, active);
|
|
@@ -1253,6 +1262,20 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1253
1262
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-1", children: [
|
|
1254
1263
|
["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
|
|
1255
1264
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
|
|
1265
|
+
] }),
|
|
1266
|
+
light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
|
|
1270
|
+
] }),
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
|
|
1274
|
+
] }),
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
1276
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" })
|
|
1278
|
+
] })
|
|
1256
1279
|
] })
|
|
1257
1280
|
] }),
|
|
1258
1281
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorLine, { error })
|
|
@@ -709,6 +709,10 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
709
709
|
}
|
|
710
710
|
)
|
|
711
711
|
] }),
|
|
712
|
+
engine.light && brush.light.amount > 0 && /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2", title: "Pressure scales the light the brush lays", children: [
|
|
713
|
+
/* @__PURE__ */ jsx5("input", { type: "checkbox", "aria-label": "Light follows pressure", checked: brush.light.pressure, onChange: (e) => controller.setBrush({ light: { pressure: e.target.checked } }) }),
|
|
714
|
+
" Light follows pressure"
|
|
715
|
+
] }),
|
|
712
716
|
engine.dirty && /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2", title: "Keep the colour the brush picked up for the next stroke (needs Pick-up above 0)", children: [
|
|
713
717
|
/* @__PURE__ */ jsx5("input", { type: "checkbox", "aria-label": "Dirty brush", checked: brush.behavior.dirty, onChange: (e) => controller.setBrush({ behavior: { dirty: e.target.checked } }) }),
|
|
714
718
|
" Dirty brush"
|
|
@@ -763,7 +767,7 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
763
767
|
|
|
764
768
|
// src/paint-editor/PaperPanel.tsx
|
|
765
769
|
import { useMemo as useMemo4 } from "react";
|
|
766
|
-
import { LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, patchPath as patchPath2, readPath as readPath2, renderPaper } from "@pixerate/editor/paint-editor";
|
|
770
|
+
import { DEFAULT_BACKLIGHT_COLOR, LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, patchPath as patchPath2, readPath as readPath2, renderPaper } from "@pixerate/editor/paint-editor";
|
|
767
771
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
768
772
|
var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
|
|
769
773
|
var PaperPanel = ({ controller, className }) => {
|
|
@@ -794,6 +798,10 @@ var PaperPanel = ({ controller, className }) => {
|
|
|
794
798
|
/* @__PURE__ */ jsx6(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
795
799
|
] }),
|
|
796
800
|
PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx6(PaintSlider, { control: c, value: readPath2(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath2(paper, c.path, v))) }, c.path)),
|
|
801
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between", children: [
|
|
802
|
+
/* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Backlight colour" }),
|
|
803
|
+
/* @__PURE__ */ jsx6(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
804
|
+
] }),
|
|
797
805
|
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2", children: [
|
|
798
806
|
/* @__PURE__ */ jsx6("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
|
|
799
807
|
" Mirror tiling"
|
|
@@ -1043,6 +1051,7 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1043
1051
|
const [renaming, setRenaming] = useState7(null);
|
|
1044
1052
|
const layers = controller.listLayers();
|
|
1045
1053
|
const active = layers.find((l) => l.active) ?? null;
|
|
1054
|
+
const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
|
|
1046
1055
|
const move = (delta) => {
|
|
1047
1056
|
if (!active) return;
|
|
1048
1057
|
const { index, count } = siblingIndex(layers, active);
|
|
@@ -1139,6 +1148,20 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1139
1148
|
/* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
|
|
1140
1149
|
["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx8("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
|
|
1141
1150
|
/* @__PURE__ */ jsx8("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
|
|
1151
|
+
] }),
|
|
1152
|
+
light?.hasLight && /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
|
|
1153
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
|
|
1154
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
|
|
1155
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
|
|
1156
|
+
] }),
|
|
1157
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
|
|
1158
|
+
/* @__PURE__ */ jsx8("span", { className: "w-14 text-slate-400", children: "Spill" }),
|
|
1159
|
+
/* @__PURE__ */ jsx8("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
|
|
1160
|
+
] }),
|
|
1161
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
|
|
1162
|
+
/* @__PURE__ */ jsx8("span", { className: "w-14 text-slate-400", children: "Strength" }),
|
|
1163
|
+
/* @__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
|
+
] })
|
|
1142
1165
|
] })
|
|
1143
1166
|
] }),
|
|
1144
1167
|
/* @__PURE__ */ jsx8(ErrorLine, { error })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.166.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.244.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.244.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|