@pixerate/editor-react 0.179.0 → 0.181.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/brushes/BrushEditor.d.cts +40 -0
- package/dist/brushes/BrushEditor.d.ts +40 -0
- package/dist/brushes/BrushLibraryEditor.d.cts +31 -0
- package/dist/brushes/BrushLibraryEditor.d.ts +31 -0
- package/dist/brushes/index.cjs +292 -20
- package/dist/brushes/index.d.cts +2 -0
- package/dist/brushes/index.d.ts +2 -0
- package/dist/brushes/index.js +6 -2
- package/dist/chunk-THMOZMEE.js +122 -0
- package/dist/{chunk-UR4KL7WE.js → chunk-WCSMREA4.js} +26 -6
- package/dist/chunk-XORL5PGL.js +263 -0
- package/dist/image-editor/BrushOptionsBar.d.cts +6 -1
- package/dist/image-editor/BrushOptionsBar.d.ts +6 -1
- package/dist/image-editor/index.cjs +1181 -894
- package/dist/image-editor/index.js +3 -3
- package/dist/index.cjs +1722 -1435
- package/dist/index.js +3 -3
- package/dist/paint-editor/index.cjs +22 -24
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +415 -610
- package/dist/vector/VectorAppearancePanel.d.cts +8 -2
- package/dist/vector/VectorAppearancePanel.d.ts +8 -2
- package/dist/vector/index.cjs +1113 -748
- package/dist/vector/index.js +90 -59
- package/package.json +3 -3
- package/dist/chunk-62FMEDGG.js +0 -54
- package/dist/chunk-PQK2UMAY.js +0 -23
- package/dist/paint-editor/BrushEditor.d.cts +0 -29
- package/dist/paint-editor/BrushEditor.d.ts +0 -29
package/dist/vector/index.cjs
CHANGED
|
@@ -996,7 +996,7 @@ function VectorCanvas({
|
|
|
996
996
|
}
|
|
997
997
|
|
|
998
998
|
// src/vector/VectorToolbar.tsx
|
|
999
|
-
var
|
|
999
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
1000
1000
|
var import_vector20 = require("@pixerate/editor/vector");
|
|
1001
1001
|
|
|
1002
1002
|
// src/vector/VectorEffectsPanel.tsx
|
|
@@ -1149,15 +1149,361 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
// src/vector/VectorAppearancePanel.tsx
|
|
1152
|
+
var import_react12 = require("react");
|
|
1153
|
+
var import_brushes4 = require("@pixerate/editor/brushes");
|
|
1152
1154
|
var import_vector5 = require("@pixerate/editor/vector");
|
|
1155
|
+
|
|
1156
|
+
// src/brushes/BrushLibraryBrowser.tsx
|
|
1157
|
+
var import_react7 = require("react");
|
|
1158
|
+
var import_brushes = require("@pixerate/editor/brushes");
|
|
1153
1159
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1160
|
+
var Thumbnail = ({ image, label, style }) => {
|
|
1161
|
+
const ref = (0, import_react7.useRef)(null);
|
|
1162
|
+
(0, import_react7.useEffect)(() => {
|
|
1163
|
+
const canvas = ref.current;
|
|
1164
|
+
const ctx = canvas?.getContext("2d");
|
|
1165
|
+
if (!canvas || !ctx || !image || typeof image === "string" || typeof ctx.createImageData !== "function") return;
|
|
1166
|
+
canvas.width = image.width;
|
|
1167
|
+
canvas.height = image.height;
|
|
1168
|
+
const img = ctx.createImageData(image.width, image.height);
|
|
1169
|
+
img.data.set(image.data);
|
|
1170
|
+
ctx.putImageData(img, 0, 0);
|
|
1171
|
+
}, [image]);
|
|
1172
|
+
if (typeof image === "string") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: image, alt: label, className: "rounded object-contain", style });
|
|
1173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("canvas", { ref, role: "img", "aria-label": label, className: "rounded", style, width: image?.width, height: image?.height });
|
|
1174
|
+
};
|
|
1175
|
+
var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
|
|
1176
|
+
const [text, setText] = (0, import_react7.useState)("");
|
|
1177
|
+
const groups = (0, import_react7.useMemo)(() => (0, import_brushes.brushLibraryGroups)(entries, { text, profile }), [entries, text, profile]);
|
|
1178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "brush-library", children: [
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "search", value: text, placeholder: "Find a brush", "aria-label": "Find a brush", onChange: (e) => setText(e.target.value), className: "rounded bg-slate-800 px-1.5 py-0.5" }),
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-1.5", role: "listbox", "aria-label": "Brushes", children: [
|
|
1181
|
+
groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "group", "aria-label": g.title, className: "flex flex-col gap-0.5", children: [
|
|
1182
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[10px] uppercase tracking-wide text-slate-500", children: g.title }),
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap(
|
|
1184
|
+
(v) => v.entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1185
|
+
"button",
|
|
1186
|
+
{
|
|
1187
|
+
type: "button",
|
|
1188
|
+
role: "option",
|
|
1189
|
+
"aria-selected": activeId === e.brush.id,
|
|
1190
|
+
title: [e.brush.name, v.title.toLowerCase() === e.brush.name.toLowerCase() ? "" : v.title, e.builtin ? "" : "saved"].filter(Boolean).join(" \xB7 "),
|
|
1191
|
+
className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${activeId === e.brush.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
|
|
1192
|
+
onClick: () => onSelect(e.brush.id),
|
|
1193
|
+
children: [
|
|
1194
|
+
thumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Thumbnail, { image: thumbnail(e.brush.id) ?? null, label: `${e.brush.name} thumbnail`, style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate text-[10px] text-slate-300", children: e.brush.name })
|
|
1196
|
+
]
|
|
1197
|
+
},
|
|
1198
|
+
e.brush.id
|
|
1199
|
+
))
|
|
1200
|
+
) })
|
|
1201
|
+
] }, g.id)),
|
|
1202
|
+
!groups.length && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-500", children: "No brush matches." })
|
|
1203
|
+
] })
|
|
1204
|
+
] });
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
// src/brushes/BrushLibraryEditor.tsx
|
|
1208
|
+
var import_react10 = require("react");
|
|
1209
|
+
var import_brushes3 = require("@pixerate/editor/brushes");
|
|
1210
|
+
|
|
1211
|
+
// src/paint-editor/shared.tsx
|
|
1212
|
+
var import_react8 = require("react");
|
|
1213
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1214
|
+
var chip = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
1215
|
+
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
1216
|
+
var PixelCanvas = ({ pixels, label, className, style }) => {
|
|
1217
|
+
const ref = (0, import_react8.useRef)(null);
|
|
1218
|
+
(0, import_react8.useEffect)(() => {
|
|
1219
|
+
const canvas = ref.current;
|
|
1220
|
+
const ctx = canvas?.getContext("2d");
|
|
1221
|
+
if (!canvas || !ctx || !pixels || typeof ctx.createImageData !== "function") return;
|
|
1222
|
+
canvas.width = pixels.width;
|
|
1223
|
+
canvas.height = pixels.height;
|
|
1224
|
+
const img = ctx.createImageData(pixels.width, pixels.height);
|
|
1225
|
+
img.data.set(pixels.data);
|
|
1226
|
+
ctx.putImageData(img, 0, 0);
|
|
1227
|
+
}, [pixels]);
|
|
1228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("canvas", { ref, role: "img", "aria-label": label, className, style, width: pixels?.width, height: pixels?.height });
|
|
1229
|
+
};
|
|
1230
|
+
var fmt = (c, v) => c.step >= 1 ? String(Math.round(v)) : v.toFixed(2);
|
|
1231
|
+
var PaintSlider = ({ control, value, onChange, onCommit }) => {
|
|
1232
|
+
const [draft, setDraft] = (0, import_react8.useState)(null);
|
|
1233
|
+
const ref = (0, import_react8.useRef)(null);
|
|
1234
|
+
const commit = (0, import_react8.useRef)(onCommit);
|
|
1235
|
+
commit.current = onCommit;
|
|
1236
|
+
(0, import_react8.useEffect)(() => {
|
|
1237
|
+
const el = ref.current;
|
|
1238
|
+
if (!el) return;
|
|
1239
|
+
const done = () => {
|
|
1240
|
+
commit.current?.(Number(el.value));
|
|
1241
|
+
setDraft(null);
|
|
1242
|
+
};
|
|
1243
|
+
el.addEventListener("change", done);
|
|
1244
|
+
return () => el.removeEventListener("change", done);
|
|
1245
|
+
}, []);
|
|
1246
|
+
const shown = draft ?? value;
|
|
1247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex flex-col gap-0.5", "data-path": control.path, children: [
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: control.label }),
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-mono", children: fmt(control, shown) })
|
|
1251
|
+
] }),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1253
|
+
"input",
|
|
1254
|
+
{
|
|
1255
|
+
ref,
|
|
1256
|
+
type: "range",
|
|
1257
|
+
"aria-label": control.label,
|
|
1258
|
+
min: control.min,
|
|
1259
|
+
max: control.max,
|
|
1260
|
+
step: control.step,
|
|
1261
|
+
value: shown,
|
|
1262
|
+
onChange: (e) => {
|
|
1263
|
+
const v = Number(e.target.value);
|
|
1264
|
+
if (onCommit) setDraft(v);
|
|
1265
|
+
onChange?.(v);
|
|
1266
|
+
},
|
|
1267
|
+
className: "w-full accent-indigo-500"
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
] });
|
|
1271
|
+
};
|
|
1272
|
+
var ErrorLine = ({ error }) => error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: error }) : null;
|
|
1273
|
+
|
|
1274
|
+
// src/brushes/BrushEditor.tsx
|
|
1275
|
+
var import_react9 = require("react");
|
|
1276
|
+
var import_brushes2 = require("@pixerate/editor/brushes");
|
|
1277
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1278
|
+
var BrushEditor = ({ brush, profile = import_brushes2.PAINT_PROFILE, onChange, preview, previewBackground, onSave, saveLabel = "Save", onSaveAs, renderExtra, className }) => {
|
|
1279
|
+
const sections = (0, import_react9.useMemo)(() => (0, import_brushes2.brushEditorSections)(brush, profile), [brush, profile]);
|
|
1280
|
+
const scope = (0, import_react9.useMemo)(() => (0, import_brushes2.brushEditorScope)(brush, profile), [brush, profile]);
|
|
1281
|
+
const [problems, setProblems] = (0, import_react9.useState)(null);
|
|
1282
|
+
const [name, setName] = (0, import_react9.useState)("");
|
|
1283
|
+
const save = async (fn, after) => {
|
|
1284
|
+
try {
|
|
1285
|
+
await fn();
|
|
1286
|
+
after?.();
|
|
1287
|
+
setProblems(null);
|
|
1288
|
+
} catch (e) {
|
|
1289
|
+
setProblems(e.message);
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
const set = (path, value) => {
|
|
1293
|
+
const r = (0, import_brushes2.setBrushEditorValue)(brush, path, value);
|
|
1294
|
+
setProblems(r.problems.length ? r.problems.join(" ") : null);
|
|
1295
|
+
if (r.brush !== brush) onChange(r.brush);
|
|
1296
|
+
};
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-2 ${className ?? ""}`, "data-testid": "brush-editor", children: [
|
|
1298
|
+
typeof preview === "string" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: preview, alt: "Brush preview", className: "rounded object-contain", style: { width: "100%", aspectRatio: "4 / 1", ...previewBackground ? { background: previewBackground } : {} } }) : preview !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PixelCanvas, { pixels: preview, label: "Brush preview", className: "rounded", style: { width: "100%", aspectRatio: preview ? `${preview.width} / ${preview.height}` : "4 / 1" } }),
|
|
1299
|
+
scope.note && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[10px] text-amber-400", "data-testid": "brush-editor-scope", title: `${profile.name} shows only what it can use; these are kept unchanged when you save.`, children: scope.note }),
|
|
1300
|
+
sections.map((s) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "flex flex-col gap-1.5", "data-section": s.id, ...s.id === "behaviour" ? { "data-testid": "brush-engine" } : {}, children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-medium text-slate-300", children: s.title }),
|
|
1302
|
+
s.controls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(EditorControl, { control: c, onSet: set }, c.path)),
|
|
1303
|
+
renderExtra?.(s.id)
|
|
1304
|
+
] }, s.id)),
|
|
1305
|
+
(onSave || onSaveAs) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1306
|
+
onSave && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => save(onSave), children: saveLabel }),
|
|
1307
|
+
onSaveAs && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1308
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { value: name, placeholder: "Brush name", "aria-label": "Brush name", onChange: (e) => setName(e.target.value), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }),
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, disabled: !name.trim(), onClick: () => save(() => onSaveAs(name.trim()), () => setName("")), children: "Save brush" })
|
|
1310
|
+
] })
|
|
1311
|
+
] }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorLine, { error: problems })
|
|
1313
|
+
] });
|
|
1314
|
+
};
|
|
1315
|
+
var EditorControl = ({ control: c, onSet }) => {
|
|
1316
|
+
const note = c.note ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[10px] text-amber-400", children: c.note }) : null;
|
|
1317
|
+
switch (c.kind) {
|
|
1318
|
+
case "slider":
|
|
1319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { title: c.note, children: [
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaintSlider, { control: c, value: c.value, onChange: (v) => onSet(c.path, v) }),
|
|
1321
|
+
note
|
|
1322
|
+
] });
|
|
1323
|
+
case "choice":
|
|
1324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", title: c.note, children: [
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: c.label }),
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": c.ariaLabel, value: c.value, onChange: (e) => onSet(c.path, e.target.value), className: "max-w-[60%] rounded bg-slate-800 px-1 py-0.5", children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, children: o.label }, o.value)) })
|
|
1327
|
+
] });
|
|
1328
|
+
case "toggle":
|
|
1329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", title: c.note, children: [
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": c.ariaLabel, checked: c.value, onChange: (e) => onSet(c.path, e.target.checked) }),
|
|
1331
|
+
" ",
|
|
1332
|
+
c.label
|
|
1333
|
+
] });
|
|
1334
|
+
case "text":
|
|
1335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: c.label }),
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { "aria-label": c.ariaLabel, defaultValue: c.value, placeholder: c.placeholder, onBlur: (e) => e.target.value !== c.value && onSet(c.path, e.target.value.trim().toLowerCase()), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }, c.value)
|
|
1338
|
+
] });
|
|
1339
|
+
case "colour": {
|
|
1340
|
+
const set = (light, dark) => onSet(c.path, dark === null ? light : { light, dark });
|
|
1341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1343
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: c.label }),
|
|
1344
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-1", children: [
|
|
1345
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": c.ariaLabel, title: c.dark !== null ? "On light backgrounds" : void 0, value: c.value ?? "#000000", onChange: (e) => set(e.target.value, c.dark), className: "h-5 w-8" }),
|
|
1346
|
+
c.dark !== null && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": `${c.ariaLabel} (dark)`, title: "On dark backgrounds", value: c.dark, onChange: (e) => set(c.value ?? "#000000", e.target.value), className: "h-5 w-8" }),
|
|
1347
|
+
(c.value || c.gradient) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => onSet(c.path, void 0), children: "None" })
|
|
1348
|
+
] })
|
|
1349
|
+
] }),
|
|
1350
|
+
c.gradient ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[10px] text-slate-500", children: "A gradient (its own paint)." }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": `${c.ariaLabel}: light and dark`, checked: c.dark !== null, onChange: (e) => set(c.value ?? "#000000", e.target.checked ? c.value ?? "#ffffff" : null) }),
|
|
1352
|
+
" Light / dark"
|
|
1353
|
+
] })
|
|
1354
|
+
] });
|
|
1355
|
+
}
|
|
1356
|
+
case "palette": {
|
|
1357
|
+
const at = (i, entry) => onSet(c.path, c.value.map((x, j) => j === i ? entry : x));
|
|
1358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": c.ariaLabel, children: [
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: c.label }),
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1361
|
+
c.value.map((col, i) => {
|
|
1362
|
+
const light = typeof col === "string" ? col : col.light;
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-0.5 rounded bg-slate-900 p-0.5", children: [
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": `Palette colour ${i + 1}`, value: light, onChange: (e) => at(i, typeof col === "string" ? e.target.value : { ...col, light: e.target.value }), className: "h-4 w-5" }),
|
|
1365
|
+
typeof col !== "string" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": `Palette colour ${i + 1} (dark)`, value: col.dark, onChange: (e) => at(i, { ...col, dark: e.target.value }), className: "h-4 w-5" }),
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": `Remove palette colour ${i + 1}`, className: "px-0.5 text-slate-400 hover:text-white", onClick: () => onSet(c.path, c.value.filter((_, j) => j !== i)), children: "\xD7" })
|
|
1367
|
+
] }, i);
|
|
1368
|
+
}),
|
|
1369
|
+
c.value.length < c.max && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": "Add a palette colour", onChange: (e) => onSet(c.path, [...c.value, e.target.value]), className: "h-4 w-6" }),
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => onSet(c.path, [...c.value, { light: "#334155", dark: "#e2e8f0" }]), children: "Add light / dark pair" })
|
|
1372
|
+
] })
|
|
1373
|
+
] })
|
|
1374
|
+
] });
|
|
1375
|
+
}
|
|
1376
|
+
case "stamps":
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": c.ariaLabel, title: `Up to ${c.max}`, children: c.options.map((o) => {
|
|
1378
|
+
const on = c.value.includes(o.value);
|
|
1379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-pressed": on, className: chip(on), onClick: () => onSet(c.path, on ? c.value.filter((v) => v !== o.value) : [...c.value, o.value].slice(-c.max)), children: o.label }, o.value);
|
|
1380
|
+
}) });
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
// src/brushes/BrushLibraryEditor.tsx
|
|
1385
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1386
|
+
var BrushLibraryEditor = ({ library, brushId, profile, renderPreview, previewPaper = "#ffffff", previewColor, onSaved, onClose, className }) => {
|
|
1387
|
+
const [original, setOriginal] = (0, import_react10.useState)(null);
|
|
1388
|
+
const [builtin, setBuiltin] = (0, import_react10.useState)(false);
|
|
1389
|
+
const [draft, setDraft] = (0, import_react10.useState)(null);
|
|
1390
|
+
const [status, setStatus] = (0, import_react10.useState)(null);
|
|
1391
|
+
const [preview, setPreview] = (0, import_react10.useState)(null);
|
|
1392
|
+
(0, import_react10.useEffect)(() => {
|
|
1393
|
+
let live = true;
|
|
1394
|
+
setStatus(null);
|
|
1395
|
+
void (async () => {
|
|
1396
|
+
const entry = brushId ? await library.get(brushId) : null;
|
|
1397
|
+
if (!live) return;
|
|
1398
|
+
setOriginal(entry?.brush ?? null);
|
|
1399
|
+
setBuiltin(!!entry?.builtin);
|
|
1400
|
+
setDraft(entry?.brush ?? (0, import_brushes3.newBrushFor)(profile));
|
|
1401
|
+
})();
|
|
1402
|
+
return () => {
|
|
1403
|
+
live = false;
|
|
1404
|
+
};
|
|
1405
|
+
}, [library, brushId, profile]);
|
|
1406
|
+
const paper = renderPreview?.paper ?? previewPaper;
|
|
1407
|
+
const colours = (0, import_react10.useMemo)(() => draft ? (0, import_brushes3.brushPreviewColours)(draft, { paper, profile }) : null, [draft, paper, profile]);
|
|
1408
|
+
const colour = previewColor ?? colours?.color ?? "#475569";
|
|
1409
|
+
(0, import_react10.useEffect)(() => {
|
|
1410
|
+
if (!draft || !renderPreview) return;
|
|
1411
|
+
let live = true;
|
|
1412
|
+
Promise.resolve(renderPreview(draft, { width: 240, height: 60, color: colour.slice(0, 7) })).then((img) => live && setPreview(img.data ? `data:${img.mimeType};base64,${img.data}` : null)).catch(() => live && setPreview(null));
|
|
1413
|
+
return () => {
|
|
1414
|
+
live = false;
|
|
1415
|
+
};
|
|
1416
|
+
}, [draft, renderPreview, colour]);
|
|
1417
|
+
const check = (0, import_react10.useMemo)(() => draft ? (0, import_brushes3.checkBrushEdit)(original, draft, profile) : null, [original, draft, profile]);
|
|
1418
|
+
if (!draft) return null;
|
|
1419
|
+
const save = async (name) => {
|
|
1420
|
+
const saved = await (0, import_brushes3.saveBrushEdit)(library, { original, brush: draft, profile, ...name !== void 0 ? { name } : {} });
|
|
1421
|
+
setOriginal(saved.brush);
|
|
1422
|
+
setBuiltin(false);
|
|
1423
|
+
setDraft(saved.brush);
|
|
1424
|
+
setStatus(`Saved \u201C${saved.brush.name}\u201D${saved.kept.length ? `, keeping what ${profile.name} can't use` : ""}.`);
|
|
1425
|
+
onSaved?.(saved.brush);
|
|
1426
|
+
};
|
|
1427
|
+
const errors = check?.issues.filter((i) => i.severity === "error") ?? [];
|
|
1428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-library-editor", children: [
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium", "data-testid": "brush-library-editor-title", children: original ? `${draft.name}${builtin ? " (built in: saves a copy)" : ""}` : "New brush" }),
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex gap-1", children: [
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1433
|
+
"button",
|
|
1434
|
+
{
|
|
1435
|
+
type: "button",
|
|
1436
|
+
className: button,
|
|
1437
|
+
title: `A new brush from this one, with only what ${profile.name} uses`,
|
|
1438
|
+
onClick: () => {
|
|
1439
|
+
setOriginal(null);
|
|
1440
|
+
setBuiltin(false);
|
|
1441
|
+
setDraft((0, import_brushes3.newBrushFor)(profile, draft));
|
|
1442
|
+
setStatus(null);
|
|
1443
|
+
},
|
|
1444
|
+
children: "New brush"
|
|
1445
|
+
}
|
|
1446
|
+
),
|
|
1447
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: onClose, children: "Close" })
|
|
1448
|
+
] })
|
|
1449
|
+
] }),
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1451
|
+
BrushEditor,
|
|
1452
|
+
{
|
|
1453
|
+
brush: draft,
|
|
1454
|
+
profile,
|
|
1455
|
+
preview: renderPreview ? preview : void 0,
|
|
1456
|
+
previewBackground: colours?.background,
|
|
1457
|
+
onChange: (next) => {
|
|
1458
|
+
setDraft(next);
|
|
1459
|
+
setStatus(null);
|
|
1460
|
+
},
|
|
1461
|
+
onSave: original ? () => save() : void 0,
|
|
1462
|
+
saveLabel: builtin ? "Save a copy" : "Save",
|
|
1463
|
+
onSaveAs: (name) => save(name)
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "text-[11px] text-rose-400", "data-testid": "brush-library-editor-issues", children: errors.map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { children: [
|
|
1467
|
+
i.reason,
|
|
1468
|
+
" ",
|
|
1469
|
+
i.fix
|
|
1470
|
+
] }, i.facet)) }),
|
|
1471
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "status", className: "text-[11px] text-emerald-400", children: status })
|
|
1472
|
+
] });
|
|
1473
|
+
};
|
|
1474
|
+
|
|
1475
|
+
// src/brushes/useBrushLibrary.ts
|
|
1476
|
+
var import_react11 = require("react");
|
|
1477
|
+
function useBrushLibrary(library, filter = {}) {
|
|
1478
|
+
const [entries, setEntries] = (0, import_react11.useState)([]);
|
|
1479
|
+
const { profile, ...rest } = filter;
|
|
1480
|
+
const key = `${profile?.id ?? ""}:${JSON.stringify(rest)}`;
|
|
1481
|
+
(0, import_react11.useEffect)(() => {
|
|
1482
|
+
if (!library) return;
|
|
1483
|
+
let live = true;
|
|
1484
|
+
const read = () => void library.list(filter).then((list) => live && setEntries(list), () => void 0);
|
|
1485
|
+
read();
|
|
1486
|
+
const unsubscribe = library.subscribe(read);
|
|
1487
|
+
return () => {
|
|
1488
|
+
live = false;
|
|
1489
|
+
unsubscribe();
|
|
1490
|
+
};
|
|
1491
|
+
}, [library, key]);
|
|
1492
|
+
return entries;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// src/vector/VectorAppearancePanel.tsx
|
|
1496
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1154
1497
|
var buttonClass2 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
1155
1498
|
var numberClass2 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
1156
1499
|
var selectClass2 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1157
1500
|
var headingClass = "text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1158
1501
|
var labelClass2 = "w-full truncate text-[11px] text-muted-foreground";
|
|
1159
|
-
function VectorAppearancePanel({ controller, className }) {
|
|
1502
|
+
function VectorAppearancePanel({ controller, renderBrushPreview, className }) {
|
|
1160
1503
|
const state = useVectorEditorState(controller);
|
|
1504
|
+
const [brushUi, setBrushUi] = (0, import_react12.useState)(null);
|
|
1505
|
+
const library = controller.brushLibrary;
|
|
1506
|
+
const entries = useBrushLibrary(brushUi ? library : null, { profile: import_brushes4.VECTOR_PROFILE });
|
|
1161
1507
|
const panel = (0, import_vector5.getVectorAppearancePanel)(state);
|
|
1162
1508
|
if (!panel) return null;
|
|
1163
1509
|
const end = () => controller.endMergedEdit();
|
|
@@ -1166,53 +1512,72 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1166
1512
|
const layerRow = (l, count) => {
|
|
1167
1513
|
const name = `${l.kind === "fill" ? "Fill" : "Stroke"} ${l.index + 1}`;
|
|
1168
1514
|
if (l.brushstroke)
|
|
1169
|
-
return /* @__PURE__ */ (0,
|
|
1170
|
-
/* @__PURE__ */ (0,
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
{
|
|
1176
|
-
type: "number",
|
|
1177
|
-
min: 0.5,
|
|
1178
|
-
step: 0.5,
|
|
1179
|
-
"aria-label": `${name} brush size`,
|
|
1180
|
-
title: "Brush size",
|
|
1181
|
-
className: numberClass2,
|
|
1182
|
-
value: l.brushstroke.size,
|
|
1183
|
-
onChange: (e) => {
|
|
1184
|
-
const n = parseFloat(e.target.value);
|
|
1185
|
-
if (Number.isFinite(n) && n > 0) controller.setBrushstroke(l.index, { size: Math.min(500, n) }, { ids, merge: true });
|
|
1186
|
-
},
|
|
1187
|
-
onBlur: end
|
|
1188
|
-
}
|
|
1189
|
-
),
|
|
1190
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-0.5 text-[11px]", title: "Brush character: seeded jitter and paper grain", children: [
|
|
1191
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-layer": `${l.kind}-${l.index}`, "data-vector-brushstroke": "", children: [
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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 }),
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children: controller.listBrushstrokeBrushes().map((b) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: b.id, children: b.name }, b.id)) }),
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1192
1521
|
"input",
|
|
1193
1522
|
{
|
|
1194
|
-
type: "
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1523
|
+
type: "number",
|
|
1524
|
+
min: 0.5,
|
|
1525
|
+
step: 0.5,
|
|
1526
|
+
"aria-label": `${name} brush size`,
|
|
1527
|
+
title: "Brush size",
|
|
1528
|
+
className: numberClass2,
|
|
1529
|
+
value: l.brushstroke.size,
|
|
1530
|
+
onChange: (e) => {
|
|
1531
|
+
const n = parseFloat(e.target.value);
|
|
1532
|
+
if (Number.isFinite(n) && n > 0) controller.setBrushstroke(l.index, { size: Math.min(500, n) }, { ids, merge: true });
|
|
1533
|
+
},
|
|
1534
|
+
onBlur: end
|
|
1199
1535
|
}
|
|
1200
1536
|
),
|
|
1201
|
-
"
|
|
1537
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-0.5 text-[11px]", title: "Brush character: seeded jitter and paper grain", children: [
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1539
|
+
"input",
|
|
1540
|
+
{
|
|
1541
|
+
type: "checkbox",
|
|
1542
|
+
"aria-label": `${name} grain`,
|
|
1543
|
+
"data-vector-brushstroke-grain": "",
|
|
1544
|
+
checked: l.brushstroke.grain,
|
|
1545
|
+
onChange: (e) => controller.setBrushstroke(l.index, e.target.checked ? { paper: {}, ...l.brushstroke.seed === void 0 ? { seed: (0, import_vector5.randomVectorBrushstrokeSeed)() } : {} } : { paper: null }, { ids })
|
|
1546
|
+
}
|
|
1547
|
+
),
|
|
1548
|
+
"Grain"
|
|
1549
|
+
] }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${name}`, onClick: () => controller.removePaintLayer("stroke", l.index, { ids }), children: "\xD7" })
|
|
1202
1551
|
] }),
|
|
1203
|
-
/* @__PURE__ */ (0,
|
|
1204
|
-
|
|
1552
|
+
library && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1", children: [
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, "aria-expanded": brushUi?.index === l.index && brushUi.mode === "pick", title: "Pick a brush from the brush library", onClick: () => setBrushUi((u) => u?.index === l.index && u.mode === "pick" ? null : { index: l.index, mode: "pick" }), children: "Brush\u2026" }),
|
|
1554
|
+
(0, import_brushes4.isBrushLibrary)(library) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, "aria-expanded": brushUi?.index === l.index && brushUi.mode === "edit", title: "Edit this brush, or make a new one, in the shared brush library", onClick: () => setBrushUi((u) => u?.index === l.index && u.mode === "edit" ? null : { index: l.index, mode: "edit" }), children: "Edit brush\u2026" })
|
|
1555
|
+
] }),
|
|
1556
|
+
brushUi?.index === l.index && brushUi.mode === "pick" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrushLibraryBrowser, { entries, activeId: l.brushstroke.brushId, profile: import_brushes4.VECTOR_PROFILE, onSelect: (id) => controller.setBrushstroke(l.index, { brushId: id }, { ids }) }),
|
|
1557
|
+
brushUi?.index === l.index && brushUi.mode === "edit" && (0, import_brushes4.isBrushLibrary)(library) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1558
|
+
BrushLibraryEditor,
|
|
1559
|
+
{
|
|
1560
|
+
library,
|
|
1561
|
+
brushId: l.brushstroke.brushId,
|
|
1562
|
+
profile: import_brushes4.VECTOR_PROFILE,
|
|
1563
|
+
renderPreview: renderBrushPreview ?? controller.brushPreview ?? void 0,
|
|
1564
|
+
className: "rounded border border-border bg-slate-950 p-2",
|
|
1565
|
+
onSaved: (saved) => void controller.refreshBrushes().then(() => controller.setBrushstroke(l.index, { brushId: saved.id, keepColour: true }, { ids })),
|
|
1566
|
+
onClose: () => setBrushUi(null)
|
|
1567
|
+
}
|
|
1568
|
+
)
|
|
1569
|
+
] }, `${l.kind}-${l.index}`);
|
|
1205
1570
|
if (l.unknownKind)
|
|
1206
|
-
return /* @__PURE__ */ (0,
|
|
1571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-[11px] text-muted-foreground", "data-vector-layer": `${l.kind}-${l.index}`, children: [
|
|
1207
1572
|
name,
|
|
1208
1573
|
": ",
|
|
1209
1574
|
l.unknownKind,
|
|
1210
1575
|
" (not drawn by this version)"
|
|
1211
1576
|
] }, `${l.kind}-${l.index}`);
|
|
1212
|
-
return /* @__PURE__ */ (0,
|
|
1213
|
-
/* @__PURE__ */ (0,
|
|
1214
|
-
/* @__PURE__ */ (0,
|
|
1215
|
-
l.gradient ? /* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-layer": `${l.kind}-${l.index}`, "data-vector-layer-editing": l.editing ? "" : void 0, children: [
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1580
|
+
l.gradient ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1216
1581
|
"button",
|
|
1217
1582
|
{
|
|
1218
1583
|
type: "button",
|
|
@@ -1222,7 +1587,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1222
1587
|
style: { background: l.swatch },
|
|
1223
1588
|
onClick: () => controller.setGradientTarget(l.kind, l.index)
|
|
1224
1589
|
}
|
|
1225
|
-
) : /* @__PURE__ */ (0,
|
|
1590
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1226
1591
|
"input",
|
|
1227
1592
|
{
|
|
1228
1593
|
type: "color",
|
|
@@ -1233,7 +1598,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1233
1598
|
onBlur: end
|
|
1234
1599
|
}
|
|
1235
1600
|
),
|
|
1236
|
-
/* @__PURE__ */ (0,
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1237
1602
|
"input",
|
|
1238
1603
|
{
|
|
1239
1604
|
type: "number",
|
|
@@ -1251,10 +1616,10 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1251
1616
|
onBlur: end
|
|
1252
1617
|
}
|
|
1253
1618
|
),
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": `${name} blend mode`, className: selectClass2, value: l.blendMode, onChange: (e) => update(l, { blendMode: e.target.value }), children: import_vector5.VECTOR_BLEND_MODE_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: m.mode, children: m.label }, m.mode)) })
|
|
1255
1620
|
] }),
|
|
1256
|
-
l.kind === "stroke" && /* @__PURE__ */ (0,
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1621
|
+
l.kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1258
1623
|
"input",
|
|
1259
1624
|
{
|
|
1260
1625
|
type: "number",
|
|
@@ -1271,22 +1636,22 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1271
1636
|
onBlur: end
|
|
1272
1637
|
}
|
|
1273
1638
|
),
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": `${name} alignment`, className: selectClass2, value: l.strokeAlign ?? "center", onChange: (e) => update(l, { strokeAlign: e.target.value }), children: Object.keys(import_vector5.VECTOR_STROKE_ALIGN_LABELS).map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: a, children: import_vector5.VECTOR_STROKE_ALIGN_LABELS[a] }, a)) })
|
|
1275
1640
|
] }),
|
|
1276
|
-
/* @__PURE__ */ (0,
|
|
1277
|
-
/* @__PURE__ */ (0,
|
|
1278
|
-
/* @__PURE__ */ (0,
|
|
1279
|
-
/* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
/* @__PURE__ */ (0,
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1" }),
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Edit gradient", "aria-label": `Edit ${name} gradient`, "aria-pressed": l.editing, onClick: () => controller.setGradientTarget(l.kind, l.index), children: "\u270E" }),
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Move up", "aria-label": `Move ${name} up`, disabled: l.index === count - 1, onClick: () => controller.movePaintLayer(l.kind, l.index, l.index + 1, { ids }), children: "\u2191" }),
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Move down", "aria-label": `Move ${name} down`, disabled: l.index === 0, onClick: () => controller.movePaintLayer(l.kind, l.index, l.index - 1, { ids }), children: "\u2193" }),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${name}`, onClick: () => controller.removePaintLayer(l.kind, l.index, { ids }), children: "\xD7" })
|
|
1282
1647
|
] })
|
|
1283
1648
|
] }, `${l.kind}-${l.index}`);
|
|
1284
1649
|
};
|
|
1285
|
-
const stack = (kind, layers, mixed) => /* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
mixed && /* @__PURE__ */ (0,
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1650
|
+
const stack = (kind, layers, mixed) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1", "data-vector-stack": kind, children: [
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `flex-1 ${headingClass}`, children: kind === "fill" ? "Fills" : "Strokes" }),
|
|
1653
|
+
mixed && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" }),
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1290
1655
|
"button",
|
|
1291
1656
|
{
|
|
1292
1657
|
type: "button",
|
|
@@ -1298,7 +1663,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1298
1663
|
children: "+"
|
|
1299
1664
|
}
|
|
1300
1665
|
),
|
|
1301
|
-
kind === "stroke" && /* @__PURE__ */ (0,
|
|
1666
|
+
kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime10.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: controller.listBrushstrokeBrushes()[0].id, seed: (0, import_vector5.randomVectorBrushstrokeSeed)() }, { ids }), children: "\u270E+" })
|
|
1302
1667
|
] }),
|
|
1303
1668
|
[...layers].reverse().map((l) => layerRow(l, layers.length))
|
|
1304
1669
|
] });
|
|
@@ -1309,9 +1674,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1309
1674
|
const filterParam = (f, spec) => {
|
|
1310
1675
|
const label = `${f.label} ${spec.label}`;
|
|
1311
1676
|
if (spec.kind === "color")
|
|
1312
|
-
return /* @__PURE__ */ (0,
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1314
|
-
/* @__PURE__ */ (0,
|
|
1677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-filter-param": spec.key, children: [
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-14 truncate text-[11px] text-muted-foreground", children: spec.label }),
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1315
1680
|
"input",
|
|
1316
1681
|
{
|
|
1317
1682
|
type: "color",
|
|
@@ -1329,9 +1694,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1329
1694
|
const n = parseFloat(e.target.value);
|
|
1330
1695
|
if (Number.isFinite(n)) setFilter(f, spec.key, n, true);
|
|
1331
1696
|
};
|
|
1332
|
-
return /* @__PURE__ */ (0,
|
|
1333
|
-
/* @__PURE__ */ (0,
|
|
1334
|
-
spec.slider && /* @__PURE__ */ (0,
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-filter-param": spec.key, children: [
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: labelClass2, children: spec.label }),
|
|
1699
|
+
spec.slider && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1335
1700
|
"input",
|
|
1336
1701
|
{
|
|
1337
1702
|
type: "range",
|
|
@@ -1347,21 +1712,21 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1347
1712
|
onBlur: end
|
|
1348
1713
|
}
|
|
1349
1714
|
),
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "number", min: spec.min, max: spec.max, step: spec.step, "aria-label": label, className: numberClass2, value: Math.round(value * 1e3) / 1e3, onChange, onBlur: end })
|
|
1351
1716
|
] }, spec.key);
|
|
1352
1717
|
};
|
|
1353
|
-
return /* @__PURE__ */ (0,
|
|
1718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-appearance": "", "aria-label": "Appearance", children: [
|
|
1354
1719
|
ids.length > 0 && stack("stroke", panel.strokes, panel.mixed.strokes),
|
|
1355
1720
|
ids.length > 0 && stack("fill", panel.fills, panel.mixed.fills),
|
|
1356
|
-
/* @__PURE__ */ (0,
|
|
1357
|
-
/* @__PURE__ */ (0,
|
|
1358
|
-
/* @__PURE__ */ (0,
|
|
1359
|
-
panel.mixed.blendMode && /* @__PURE__ */ (0,
|
|
1721
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "blendMode", children: [
|
|
1722
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-16", children: "Blend" }),
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": "Blend mode", className: selectClass2, value: panel.blendMode, onChange: (e) => controller.setBlendMode(e.target.value, { ids: panel.nodeIds }), children: import_vector5.VECTOR_BLEND_MODE_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: m.mode, children: m.label }, m.mode)) }),
|
|
1724
|
+
panel.mixed.blendMode && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
1360
1725
|
] }),
|
|
1361
|
-
/* @__PURE__ */ (0,
|
|
1362
|
-
/* @__PURE__ */ (0,
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1364
|
-
/* @__PURE__ */ (0,
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2", "data-vector-filters": "", children: [
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1728
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `w-16 ${headingClass}`, children: "Filters" }),
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1365
1730
|
"select",
|
|
1366
1731
|
{
|
|
1367
1732
|
"aria-label": "Add filter",
|
|
@@ -1371,22 +1736,22 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1371
1736
|
if (e.target.value) controller.addFilter(e.target.value, { ids: panel.nodeIds });
|
|
1372
1737
|
},
|
|
1373
1738
|
children: [
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1375
|
-
import_vector5.VECTOR_FILTER_MENU.map((m) => /* @__PURE__ */ (0,
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Add filter\u2026" }),
|
|
1740
|
+
import_vector5.VECTOR_FILTER_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: m.type, children: m.label }, m.type))
|
|
1376
1741
|
]
|
|
1377
1742
|
}
|
|
1378
1743
|
)
|
|
1379
1744
|
] }),
|
|
1380
|
-
!filterNode && /* @__PURE__ */ (0,
|
|
1381
|
-
filterNode && panel.filters.map((f, i) => /* @__PURE__ */ (0,
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
/* @__PURE__ */ (0,
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1745
|
+
!filterNode && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select one object to edit its filters." }),
|
|
1746
|
+
filterNode && panel.filters.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 rounded border border-border p-1.5", "data-vector-filter": f.id, "data-vector-filter-type": f.type, children: [
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex min-w-0 flex-1 items-center gap-1.5 text-xs font-medium text-foreground", children: [
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", "aria-label": `${f.label} on`, checked: f.enabled, onChange: (e) => controller.updateFilter(filterNode, f.id, { enabled: e.target.checked }) }),
|
|
1750
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate", children: f.label })
|
|
1386
1751
|
] }),
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1389
|
-
/* @__PURE__ */ (0,
|
|
1752
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Move up", "aria-label": `Move ${f.label} up`, disabled: i === 0, onClick: () => controller.moveFilter(filterNode, f.id, i - 1), children: "\u2191" }),
|
|
1753
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Move down", "aria-label": `Move ${f.label} down`, disabled: i === panel.filters.length - 1, onClick: () => controller.moveFilter(filterNode, f.id, i + 1), children: "\u2193" }),
|
|
1754
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${f.label}`, onClick: () => controller.removeFilter(filterNode, f.id), children: "\xD7" })
|
|
1390
1755
|
] }),
|
|
1391
1756
|
f.specs.map((spec) => filterParam(f, spec))
|
|
1392
1757
|
] }, f.id))
|
|
@@ -1395,9 +1760,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1395
1760
|
}
|
|
1396
1761
|
|
|
1397
1762
|
// src/vector/VectorEnvelopePanel.tsx
|
|
1398
|
-
var
|
|
1763
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
1399
1764
|
var import_vector6 = require("@pixerate/editor/vector");
|
|
1400
|
-
var
|
|
1765
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1401
1766
|
var buttonClass3 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
1402
1767
|
var numberClass3 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
1403
1768
|
var selectClass3 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -1410,7 +1775,7 @@ var SLIDERS = [
|
|
|
1410
1775
|
function VectorEnvelopePanel({ controller, className }) {
|
|
1411
1776
|
const state = useVectorEditorState(controller);
|
|
1412
1777
|
const panel = (0, import_vector6.getVectorEnvelopePanel)(state);
|
|
1413
|
-
const [size, setSize] =
|
|
1778
|
+
const [size, setSize] = import_react13.default.useState({ rows: 2, columns: 2 });
|
|
1414
1779
|
if (!panel) return null;
|
|
1415
1780
|
const env = panel.envelope;
|
|
1416
1781
|
const ids = panel.nodeId ? [panel.nodeId] : void 0;
|
|
@@ -1424,11 +1789,11 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1424
1789
|
if (env) set({ [key]: n });
|
|
1425
1790
|
else setSize({ ...size, [key]: n });
|
|
1426
1791
|
};
|
|
1427
|
-
return /* @__PURE__ */ (0,
|
|
1428
|
-
/* @__PURE__ */ (0,
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1430
|
-
/* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-envelope": "", "aria-label": "Envelope", children: [
|
|
1793
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Envelope" }),
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "data-vector-envelope-action": "warp", className: buttonClass3, title: "Make with Warp", "aria-label": "Make with Warp", disabled: !panel.canMake || !!env, onClick: () => set({ style: "arc", bend: 50 }), children: "Warp" }),
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1432
1797
|
"button",
|
|
1433
1798
|
{
|
|
1434
1799
|
type: "button",
|
|
@@ -1441,7 +1806,7 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1441
1806
|
children: "Mesh"
|
|
1442
1807
|
}
|
|
1443
1808
|
),
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1445
1810
|
"button",
|
|
1446
1811
|
{
|
|
1447
1812
|
type: "button",
|
|
@@ -1454,12 +1819,12 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1454
1819
|
children: "Top"
|
|
1455
1820
|
}
|
|
1456
1821
|
),
|
|
1457
|
-
/* @__PURE__ */ (0,
|
|
1458
|
-
/* @__PURE__ */ (0,
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "data-vector-envelope-action": "release", className: buttonClass3, title: "Release Envelope", "aria-label": "Release Envelope", disabled: !panel.canRelease, onClick: () => controller.releaseEnvelope(), children: "Release" }),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "data-vector-envelope-action": "expand", className: buttonClass3, title: "Expand Envelope", "aria-label": "Expand Envelope", disabled: !panel.canRelease, onClick: () => controller.expandAppearance(), children: "Expand" })
|
|
1459
1824
|
] }),
|
|
1460
|
-
env && /* @__PURE__ */ (0,
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1825
|
+
env && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-envelope-param": "style", children: [
|
|
1826
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass3, children: "Warp" }),
|
|
1827
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("select", { "aria-label": "Envelope warp", className: selectClass3, value: env.params.style, onChange: (e) => set({ style: e.target.value }), children: import_vector6.VECTOR_ENVELOPE_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: o.value, children: o.label }, o.value)) })
|
|
1463
1828
|
] }),
|
|
1464
1829
|
env && env.params.style !== "mesh" && SLIDERS.map((s) => {
|
|
1465
1830
|
const value = env.params[s.key];
|
|
@@ -1467,9 +1832,9 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1467
1832
|
const n = parseFloat(ev.target.value);
|
|
1468
1833
|
if (Number.isFinite(n)) set({ [s.key]: n }, true);
|
|
1469
1834
|
};
|
|
1470
|
-
return /* @__PURE__ */ (0,
|
|
1471
|
-
/* @__PURE__ */ (0,
|
|
1472
|
-
/* @__PURE__ */ (0,
|
|
1835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-envelope-param": s.key, children: [
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass3, children: s.label }),
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1473
1838
|
"input",
|
|
1474
1839
|
{
|
|
1475
1840
|
type: "range",
|
|
@@ -1485,29 +1850,29 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1485
1850
|
onBlur: end
|
|
1486
1851
|
}
|
|
1487
1852
|
),
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "number", min: -100, max: 100, step: 1, "aria-label": `Envelope ${s.label}`, className: numberClass3, value, onChange, onBlur: end })
|
|
1489
1854
|
] }, s.key);
|
|
1490
1855
|
}),
|
|
1491
|
-
env && env.params.style !== "mesh" && /* @__PURE__ */ (0,
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
1494
|
-
/* @__PURE__ */ (0,
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1856
|
+
env && env.params.style !== "mesh" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-envelope-param": "orientation", children: [
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass3, children: "Orientation" }),
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { "aria-label": "Envelope orientation", className: selectClass3, value: env.params.orientation, onChange: (e) => set({ orientation: e.target.value }), children: [
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "horizontal", children: "Horizontal" }),
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "vertical", children: "Vertical" })
|
|
1496
1861
|
] })
|
|
1497
1862
|
] }),
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1499
|
-
/* @__PURE__ */ (0,
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-envelope-param": "mesh", children: [
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "min-w-0 flex-1 truncate text-[11px] text-muted-foreground", children: "Mesh rows \xD7 columns" }),
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "number", min: 1, max: 16, step: 1, "aria-label": "Envelope mesh rows", className: numberClass3, value: rows, onChange: (e) => setCount("rows", e.target.value) }),
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "number", min: 1, max: 16, step: 1, "aria-label": "Envelope mesh columns", className: numberClass3, value: columns, onChange: (e) => setCount("columns", e.target.value) })
|
|
1502
1867
|
] }),
|
|
1503
|
-
panel.count > 1 && !panel.canMakeWithTopObject && /* @__PURE__ */ (0,
|
|
1504
|
-
env && /* @__PURE__ */ (0,
|
|
1868
|
+
panel.count > 1 && !panel.canMakeWithTopObject && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select one object to edit its envelope." }),
|
|
1869
|
+
env && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Edit the mesh with the Envelope tool (U)." })
|
|
1505
1870
|
] });
|
|
1506
1871
|
}
|
|
1507
1872
|
|
|
1508
1873
|
// src/vector/VectorMaskPanel.tsx
|
|
1509
1874
|
var import_vector7 = require("@pixerate/editor/vector");
|
|
1510
|
-
var
|
|
1875
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1511
1876
|
var buttonClass4 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
1512
1877
|
var selectClass4 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1513
1878
|
function VectorMaskPanel({ controller, className }) {
|
|
@@ -1516,10 +1881,10 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1516
1881
|
if (!panel) return null;
|
|
1517
1882
|
const g = panel.group;
|
|
1518
1883
|
const ids = g ? [g.id] : void 0;
|
|
1519
|
-
return /* @__PURE__ */ (0,
|
|
1520
|
-
/* @__PURE__ */ (0,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-mask-panel": "", "aria-label": "Mask", children: [
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Mask" }),
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1523
1888
|
"button",
|
|
1524
1889
|
{
|
|
1525
1890
|
type: "button",
|
|
@@ -1532,7 +1897,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1532
1897
|
children: "Clip"
|
|
1533
1898
|
}
|
|
1534
1899
|
),
|
|
1535
|
-
/* @__PURE__ */ (0,
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1536
1901
|
"button",
|
|
1537
1902
|
{
|
|
1538
1903
|
type: "button",
|
|
@@ -1545,7 +1910,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1545
1910
|
children: "Opacity"
|
|
1546
1911
|
}
|
|
1547
1912
|
),
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1549
1914
|
"button",
|
|
1550
1915
|
{
|
|
1551
1916
|
type: "button",
|
|
@@ -1559,9 +1924,9 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1559
1924
|
}
|
|
1560
1925
|
)
|
|
1561
1926
|
] }),
|
|
1562
|
-
g && /* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1564
|
-
/* @__PURE__ */ (0,
|
|
1927
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-2", "data-vector-mask-group": g.id, "data-mask-type": g.type, children: [
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1565
1930
|
"select",
|
|
1566
1931
|
{
|
|
1567
1932
|
"aria-label": "Mask type",
|
|
@@ -1569,16 +1934,16 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1569
1934
|
value: g.type,
|
|
1570
1935
|
title: import_vector7.VECTOR_MASK_TYPE_OPTIONS.find((o) => o.value === g.type)?.title,
|
|
1571
1936
|
onChange: (e) => controller.setMaskOptions({ type: e.target.value }, { ids }),
|
|
1572
|
-
children: import_vector7.VECTOR_MASK_TYPE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
1937
|
+
children: import_vector7.VECTOR_MASK_TYPE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: o.value, title: o.title, children: o.label }, o.value))
|
|
1573
1938
|
}
|
|
1574
1939
|
),
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1576
|
-
/* @__PURE__ */ (0,
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Show the contents where the mask hides them", children: [
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "checkbox", "aria-label": "Invert mask", checked: g.invert, onChange: (e) => controller.setMaskOptions({ invert: e.target.checked }, { ids }) }),
|
|
1577
1942
|
"Invert"
|
|
1578
1943
|
] })
|
|
1579
1944
|
] }),
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1946
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1582
1947
|
"button",
|
|
1583
1948
|
{
|
|
1584
1949
|
type: "button",
|
|
@@ -1591,7 +1956,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1591
1956
|
children: "Edit mask"
|
|
1592
1957
|
}
|
|
1593
1958
|
),
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1595
1960
|
"button",
|
|
1596
1961
|
{
|
|
1597
1962
|
type: "button",
|
|
@@ -1605,7 +1970,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1605
1970
|
children: "Contents"
|
|
1606
1971
|
}
|
|
1607
1972
|
),
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1609
1974
|
"button",
|
|
1610
1975
|
{
|
|
1611
1976
|
type: "button",
|
|
@@ -1624,9 +1989,9 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1624
1989
|
}
|
|
1625
1990
|
|
|
1626
1991
|
// src/vector/VectorTextPanel.tsx
|
|
1627
|
-
var
|
|
1992
|
+
var import_react14 = require("react");
|
|
1628
1993
|
var import_vector8 = require("@pixerate/editor/vector");
|
|
1629
|
-
var
|
|
1994
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1630
1995
|
var buttonClass5 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
1631
1996
|
var inputClass = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1632
1997
|
var labelClass4 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
@@ -1636,19 +2001,19 @@ var num = (v) => {
|
|
|
1636
2001
|
};
|
|
1637
2002
|
function VectorTextPanel({ controller, className }) {
|
|
1638
2003
|
const state = useVectorEditorState(controller);
|
|
1639
|
-
const listId = `vector-fonts-${(0,
|
|
2004
|
+
const listId = `vector-fonts-${(0, import_react14.useId)().replace(/:/g, "")}`;
|
|
1640
2005
|
const panel = (0, import_vector8.getVectorTextPanel)(state);
|
|
1641
2006
|
if (!panel) return null;
|
|
1642
2007
|
const f = panel.font;
|
|
1643
2008
|
const style = (patch, merge) => (0, import_vector8.applyVectorTextStyle)(controller, patch, merge ? { merge } : {});
|
|
1644
2009
|
const where = panel.target === "range" ? "Selected characters" : panel.target === "nodes" ? "Selected text" : "New text";
|
|
1645
|
-
return /* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
2010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-text-panel": panel.target, "aria-label": "Text", children: [
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: labelClass4, children: "Text" }),
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-muted-foreground", children: where })
|
|
1649
2014
|
] }),
|
|
1650
|
-
/* @__PURE__ */ (0,
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1652
2017
|
"input",
|
|
1653
2018
|
{
|
|
1654
2019
|
"aria-label": "Font family",
|
|
@@ -1666,15 +2031,15 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1666
2031
|
},
|
|
1667
2032
|
`family:${f.fontFamily}`
|
|
1668
2033
|
),
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("datalist", { id: listId, children: panel.families.map((fam) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: fam }, fam)) })
|
|
1670
2035
|
] }),
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1672
|
-
/* @__PURE__ */ (0,
|
|
1673
|
-
f.fontWeight === null && /* @__PURE__ */ (0,
|
|
1674
|
-
import_vector8.VECTOR_FONT_WEIGHTS.map((w) => /* @__PURE__ */ (0,
|
|
1675
|
-
f.fontWeight !== null && !import_vector8.VECTOR_FONT_WEIGHTS.some((w) => w.value === f.fontWeight) && /* @__PURE__ */ (0,
|
|
2036
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("select", { "aria-label": "Font weight", className: inputClass, value: f.fontWeight ?? "", onChange: (e) => style({ fontWeight: Number(e.target.value) }), children: [
|
|
2038
|
+
f.fontWeight === null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Mixed" }),
|
|
2039
|
+
import_vector8.VECTOR_FONT_WEIGHTS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: w.value, children: w.label }, w.value)),
|
|
2040
|
+
f.fontWeight !== null && !import_vector8.VECTOR_FONT_WEIGHTS.some((w) => w.value === f.fontWeight) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: f.fontWeight, children: f.fontWeight })
|
|
1676
2041
|
] }),
|
|
1677
|
-
/* @__PURE__ */ (0,
|
|
2042
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1678
2043
|
"input",
|
|
1679
2044
|
{
|
|
1680
2045
|
type: "number",
|
|
@@ -1693,14 +2058,14 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1693
2058
|
}
|
|
1694
2059
|
)
|
|
1695
2060
|
] }),
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1697
|
-
/* @__PURE__ */ (0,
|
|
1698
|
-
/* @__PURE__ */ (0,
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1700
|
-
/* @__PURE__ */ (0,
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Bold", "aria-pressed": (f.fontWeight ?? 0) >= 600, onClick: () => style({ fontWeight: (f.fontWeight ?? 400) >= 600 ? 400 : 700 }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: "B" }) }),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Italic", "aria-pressed": f.italic === true, onClick: () => style({ italic: !f.italic }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("i", { children: "I" }) }),
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Underline", "aria-pressed": f.underline === true, onClick: () => style({ underline: !f.underline }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("u", { children: "U" }) }),
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Strike through", "aria-pressed": f.strikethrough === true, onClick: () => style({ strikethrough: !f.strikethrough }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("s", { children: "S" }) })
|
|
1701
2066
|
] }),
|
|
1702
|
-
panel.target !== "defaults" && /* @__PURE__ */ (0,
|
|
1703
|
-
/* @__PURE__ */ (0,
|
|
2067
|
+
panel.target !== "defaults" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Orientation", children: [
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1704
2069
|
"button",
|
|
1705
2070
|
{
|
|
1706
2071
|
type: "button",
|
|
@@ -1711,7 +2076,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1711
2076
|
children: "Horizontal"
|
|
1712
2077
|
}
|
|
1713
2078
|
),
|
|
1714
|
-
/* @__PURE__ */ (0,
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1715
2080
|
"button",
|
|
1716
2081
|
{
|
|
1717
2082
|
type: "button",
|
|
@@ -1723,7 +2088,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1723
2088
|
children: "Vertical"
|
|
1724
2089
|
}
|
|
1725
2090
|
),
|
|
1726
|
-
panel.orientation === "vertical" && /* @__PURE__ */ (0,
|
|
2091
|
+
panel.orientation === "vertical" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1727
2092
|
"button",
|
|
1728
2093
|
{
|
|
1729
2094
|
type: "button",
|
|
@@ -1735,10 +2100,10 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1735
2100
|
}
|
|
1736
2101
|
)
|
|
1737
2102
|
] }),
|
|
1738
|
-
/* @__PURE__ */ (0,
|
|
1739
|
-
/* @__PURE__ */ (0,
|
|
1740
|
-
/* @__PURE__ */ (0,
|
|
1741
|
-
/* @__PURE__ */ (0,
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Tracking (1/1000 em)", children: [
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "VA" }),
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1742
2107
|
"input",
|
|
1743
2108
|
{
|
|
1744
2109
|
type: "number",
|
|
@@ -1752,9 +2117,9 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1752
2117
|
}
|
|
1753
2118
|
)
|
|
1754
2119
|
] }),
|
|
1755
|
-
/* @__PURE__ */ (0,
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1757
|
-
/* @__PURE__ */ (0,
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Leading (empty: auto)", children: [
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "\u2195" }),
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1758
2123
|
"input",
|
|
1759
2124
|
{
|
|
1760
2125
|
type: "number",
|
|
@@ -1770,7 +2135,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1770
2135
|
)
|
|
1771
2136
|
] })
|
|
1772
2137
|
] }),
|
|
1773
|
-
/* @__PURE__ */ (0,
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Alignment", children: import_vector8.VECTOR_TEXT_ALIGN_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1774
2139
|
"button",
|
|
1775
2140
|
{
|
|
1776
2141
|
type: "button",
|
|
@@ -1782,8 +2147,8 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1782
2147
|
},
|
|
1783
2148
|
o.value
|
|
1784
2149
|
)) }),
|
|
1785
|
-
panel.target !== "defaults" && panel.ids.length === 1 && /* @__PURE__ */ (0,
|
|
1786
|
-
/* @__PURE__ */ (0,
|
|
2150
|
+
panel.target !== "defaults" && panel.ids.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1787
2152
|
"button",
|
|
1788
2153
|
{
|
|
1789
2154
|
type: "button",
|
|
@@ -1794,7 +2159,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1794
2159
|
children: "Point"
|
|
1795
2160
|
}
|
|
1796
2161
|
),
|
|
1797
|
-
/* @__PURE__ */ (0,
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1798
2163
|
"button",
|
|
1799
2164
|
{
|
|
1800
2165
|
type: "button",
|
|
@@ -1806,8 +2171,8 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1806
2171
|
}
|
|
1807
2172
|
)
|
|
1808
2173
|
] }),
|
|
1809
|
-
/* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
2174
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1811
2176
|
"button",
|
|
1812
2177
|
{
|
|
1813
2178
|
type: "button",
|
|
@@ -1822,7 +2187,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1822
2187
|
children: "Type on path"
|
|
1823
2188
|
}
|
|
1824
2189
|
),
|
|
1825
|
-
/* @__PURE__ */ (0,
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1826
2191
|
"button",
|
|
1827
2192
|
{
|
|
1828
2193
|
type: "button",
|
|
@@ -1839,56 +2204,56 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1839
2204
|
}
|
|
1840
2205
|
|
|
1841
2206
|
// src/vector/VectorSymbolsPanel.tsx
|
|
1842
|
-
var
|
|
2207
|
+
var import_react15 = require("react");
|
|
1843
2208
|
var import_vector9 = require("@pixerate/editor/vector");
|
|
1844
|
-
var
|
|
2209
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1845
2210
|
var buttonClass6 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
1846
2211
|
var selectClass5 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1847
2212
|
var labelClass5 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1848
2213
|
function VectorSymbolsPanel({ controller, className }) {
|
|
1849
2214
|
const state = useVectorEditorState(controller);
|
|
1850
|
-
const uid = (0,
|
|
2215
|
+
const uid = (0, import_react15.useId)().replace(/:/g, "");
|
|
1851
2216
|
const panel = (0, import_vector9.getVectorSymbolsPanel)(state, { idPrefix: `vsym${uid}-` });
|
|
1852
|
-
const [error, setError] = (0,
|
|
2217
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
1853
2218
|
const report = (r) => setError(r.ok ? null : r.message ?? null);
|
|
1854
2219
|
const inst = panel.instance;
|
|
1855
|
-
return /* @__PURE__ */ (0,
|
|
1856
|
-
/* @__PURE__ */ (0,
|
|
1857
|
-
/* @__PURE__ */ (0,
|
|
1858
|
-
/* @__PURE__ */ (0,
|
|
1859
|
-
panel.editing && /* @__PURE__ */ (0,
|
|
2220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-symbols-panel": "", "aria-label": "Symbols", children: [
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: labelClass5, children: "Symbols" }),
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, "data-vector-symbol-action": "make", disabled: !panel.canMake, title: "New Symbol from the selection (F8)", onClick: () => report(controller.makeSymbol()), children: "New" }),
|
|
2224
|
+
panel.editing && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, "data-vector-symbol-action": "exit", title: "Leave the symbol (Escape)", onClick: () => controller.exitSymbolEdit(), children: "Done" })
|
|
1860
2225
|
] }),
|
|
1861
|
-
panel.symbols.length > 0 && /* @__PURE__ */ (0,
|
|
1862
|
-
/* @__PURE__ */ (0,
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1865
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
panel.symbols.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "space-y-1", children: panel.symbols.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { "data-vector-symbol": s.id, "data-editing": s.editing || void 0, className: "flex items-center gap-1", children: [
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { viewBox: s.viewBox, width: 28, height: 28, className: "shrink-0 rounded border border-border bg-background", "aria-hidden": "true", children: [
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VectorGradientDefs, { defs: s.scene.defs }),
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VectorFilterDefs, { filters: s.scene.filters }),
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VectorSceneNodes, { nodes: s.scene.nodes })
|
|
1866
2231
|
] }),
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "min-w-0 flex-1 truncate text-xs text-foreground", title: `${s.name} \xB7 ${s.instances} instance${s.instances === 1 ? "" : "s"}`, children: [
|
|
1868
2233
|
s.name,
|
|
1869
2234
|
" ",
|
|
1870
|
-
/* @__PURE__ */ (0,
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1871
2236
|
"\xB7 ",
|
|
1872
2237
|
s.instances
|
|
1873
2238
|
] })
|
|
1874
2239
|
] }),
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1877
|
-
/* @__PURE__ */ (0,
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, "aria-label": `Place ${s.name}`, title: "Place an instance", onClick: () => report(controller.placeSymbol(s.id)), children: "+" }),
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, "aria-label": `Edit ${s.name}`, "aria-pressed": s.editing, title: "Edit Symbol (isolation mode)", onClick: () => report(controller.editSymbol(s.id)), children: "\u270E" }),
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, "aria-label": `Delete ${s.name}`, title: "Delete the symbol (its instances become groups)", onClick: () => report(controller.deleteSymbol(s.id, { detach: true })), children: "\xD7" })
|
|
1878
2243
|
] }, s.id)) }),
|
|
1879
|
-
inst && /* @__PURE__ */ (0,
|
|
1880
|
-
/* @__PURE__ */ (0,
|
|
1881
|
-
/* @__PURE__ */ (0,
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
2244
|
+
inst && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", "data-vector-instance": inst.id, children: [
|
|
2245
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Instance symbol", className: selectClass5, value: inst.symbolId, onChange: (e) => report(controller.replaceSymbol(e.target.value, { ids: [inst.id] })), children: panel.symbols.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: s.id, children: s.name }, s.id)) }),
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, title: "Break Link to Symbol: a plain group of its art", onClick: () => report(controller.detachInstances({ ids: [inst.id] })), children: "Detach" })
|
|
1883
2248
|
] }),
|
|
1884
|
-
/* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2250
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", "aria-label": "Scale strokes", checked: inst.scaleStrokes, onChange: (e) => report(controller.setInstanceOptions({ scaleStrokes: e.target.checked }, { ids: [inst.id] })) }),
|
|
1887
2252
|
"Scale strokes"
|
|
1888
2253
|
] }),
|
|
1889
|
-
/* @__PURE__ */ (0,
|
|
2254
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Paint every fill of the art in this instance", children: [
|
|
1890
2255
|
"Tint",
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1892
2257
|
"input",
|
|
1893
2258
|
{
|
|
1894
2259
|
type: "color",
|
|
@@ -1899,41 +2264,41 @@ function VectorSymbolsPanel({ controller, className }) {
|
|
|
1899
2264
|
}
|
|
1900
2265
|
)
|
|
1901
2266
|
] }),
|
|
1902
|
-
inst.fill !== null && /* @__PURE__ */ (0,
|
|
2267
|
+
inst.fill !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: buttonClass6, "aria-label": "Clear tint", onClick: () => report(controller.setInstanceOptions({ fill: null }, { ids: [inst.id] })), children: "\xD7" })
|
|
1903
2268
|
] })
|
|
1904
2269
|
] }),
|
|
1905
|
-
error && /* @__PURE__ */ (0,
|
|
2270
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-destructive", children: error })
|
|
1906
2271
|
] });
|
|
1907
2272
|
}
|
|
1908
2273
|
|
|
1909
2274
|
// src/vector/VectorConstraintsPanel.tsx
|
|
1910
|
-
var
|
|
2275
|
+
var import_react16 = require("react");
|
|
1911
2276
|
var import_vector10 = require("@pixerate/editor/vector");
|
|
1912
|
-
var
|
|
2277
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1913
2278
|
var buttonClass7 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
1914
2279
|
var inputClass2 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1915
2280
|
var labelClass6 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1916
2281
|
function VectorConstraintsPanel({ controller, className }) {
|
|
1917
2282
|
const state = useVectorEditorState(controller);
|
|
1918
2283
|
const panel = (0, import_vector10.getVectorConstraintPanel)(state);
|
|
1919
|
-
const [error, setError] = (0,
|
|
1920
|
-
const [param, setParam] = (0,
|
|
2284
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
2285
|
+
const [param, setParam] = (0, import_react16.useState)({ name: "", value: "" });
|
|
1921
2286
|
const report = (r) => setError(r.ok ? null : r.message ?? null);
|
|
1922
2287
|
const add = (a) => report(controller.addConstraint({ kind: a.kind, refs: a.refs }));
|
|
1923
2288
|
if (!panel.actions.length && !panel.constraints.length && !state.document.constraints?.length && state.tool !== "direct") return null;
|
|
1924
|
-
return /* @__PURE__ */ (0,
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
1926
|
-
/* @__PURE__ */ (0,
|
|
1927
|
-
/* @__PURE__ */ (0,
|
|
1928
|
-
/* @__PURE__ */ (0,
|
|
2289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-constraints-panel": "", "data-dof-status": panel.dof.status, "aria-label": "Constraints", children: [
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: labelClass6, children: "Constraints" }),
|
|
2292
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex-1 truncate text-[11px] text-muted-foreground", "data-vector-dof": "", children: panel.dof.message }),
|
|
2293
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: buttonClass7, title: "Auto Constrain: add what the selection (or the drawing) nearly satisfies", onClick: () => report(controller.autoConstrain()), children: "Auto" })
|
|
1929
2294
|
] }),
|
|
1930
|
-
panel.actions.length > 0 && /* @__PURE__ */ (0,
|
|
1931
|
-
panel.constraints.length > 0 && /* @__PURE__ */ (0,
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2295
|
+
panel.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Add constraint", children: panel.actions.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: buttonClass7, "data-vector-constraint-action": a.kind, title: `Add ${a.label}`, onClick: () => add(a), children: a.label }, a.kind)) }),
|
|
2296
|
+
panel.constraints.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "space-y-1", children: panel.constraints.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { "data-vector-constraint": c.id, "data-satisfied": c.satisfied && !c.conflict ? "true" : "false", className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: `min-w-0 flex-1 truncate ${c.conflict || !c.satisfied ? "text-destructive" : ""}`, children: [
|
|
1933
2298
|
c.label,
|
|
1934
2299
|
c.name ? ` ${c.name}` : ""
|
|
1935
2300
|
] }),
|
|
1936
|
-
c.value !== void 0 && /* @__PURE__ */ (0,
|
|
2301
|
+
c.value !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1937
2302
|
"input",
|
|
1938
2303
|
{
|
|
1939
2304
|
"aria-label": `Value of ${c.name ?? c.id}`,
|
|
@@ -1948,12 +2313,12 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1948
2313
|
},
|
|
1949
2314
|
`${c.id}:${c.value}`
|
|
1950
2315
|
),
|
|
1951
|
-
/* @__PURE__ */ (0,
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: buttonClass7, "aria-label": `Remove ${c.label} constraint`, onClick: () => report(controller.removeConstraints([c.id])), children: "\xD7" })
|
|
1952
2317
|
] }, c.id)) }),
|
|
1953
|
-
/* @__PURE__ */ (0,
|
|
1954
|
-
panel.parameters.map((p) => /* @__PURE__ */ (0,
|
|
1955
|
-
/* @__PURE__ */ (0,
|
|
1956
|
-
/* @__PURE__ */ (0,
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1", "aria-label": "Parameters", children: [
|
|
2319
|
+
panel.parameters.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
2320
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-12 truncate font-mono", children: p.name }),
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1957
2322
|
"input",
|
|
1958
2323
|
{
|
|
1959
2324
|
"aria-label": `Parameter ${p.name}`,
|
|
@@ -1968,9 +2333,9 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1968
2333
|
},
|
|
1969
2334
|
`${p.name}:${p.value}`
|
|
1970
2335
|
),
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
2336
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-10 text-right text-muted-foreground", children: p.result === null ? "!" : Math.round(p.result * 100) / 100 })
|
|
1972
2337
|
] }, p.name)),
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
2338
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1974
2339
|
"form",
|
|
1975
2340
|
{
|
|
1976
2341
|
className: "flex items-center gap-1",
|
|
@@ -1982,20 +2347,20 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1982
2347
|
if (r.ok) setParam({ name: "", value: "" });
|
|
1983
2348
|
},
|
|
1984
2349
|
children: [
|
|
1985
|
-
/* @__PURE__ */ (0,
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { "aria-label": "New parameter name", placeholder: "name", className: `${inputClass2} w-12 flex-none`, value: param.name, onChange: (e) => setParam({ ...param, name: e.target.value }) }),
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { "aria-label": "New parameter value", placeholder: "value", className: inputClass2, value: param.value, onChange: (e) => setParam({ ...param, value: e.target.value }) }),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "submit", className: buttonClass7, "aria-label": "Add parameter", children: "+" })
|
|
1988
2353
|
]
|
|
1989
2354
|
}
|
|
1990
2355
|
)
|
|
1991
2356
|
] }),
|
|
1992
|
-
error && /* @__PURE__ */ (0,
|
|
2357
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-destructive", children: error })
|
|
1993
2358
|
] });
|
|
1994
2359
|
}
|
|
1995
2360
|
|
|
1996
2361
|
// src/vector/VectorFramePanel.tsx
|
|
1997
2362
|
var import_vector11 = require("@pixerate/editor/vector");
|
|
1998
|
-
var
|
|
2363
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1999
2364
|
var buttonClass8 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
2000
2365
|
var selectClass6 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2001
2366
|
var numberClass4 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2005,9 +2370,9 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2005
2370
|
const f = panel.frame;
|
|
2006
2371
|
const ids = f ? [f.id] : void 0;
|
|
2007
2372
|
const fillHex = f ? (0, import_vector11.vectorPaintToHex)(f.frame.fill ?? null) : null;
|
|
2008
|
-
const number = (key, label) => /* @__PURE__ */ (0,
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2010
|
-
/* @__PURE__ */ (0,
|
|
2373
|
+
const number = (key, label) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-4 text-muted-foreground", children: label }),
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2011
2376
|
"input",
|
|
2012
2377
|
{
|
|
2013
2378
|
type: "number",
|
|
@@ -2027,10 +2392,10 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2027
2392
|
`${f.id}:${f.frame[key]}`
|
|
2028
2393
|
)
|
|
2029
2394
|
] });
|
|
2030
|
-
return /* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2032
|
-
/* @__PURE__ */ (0,
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-frame-panel": "", "aria-label": "Frame", children: [
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Frame" }),
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2034
2399
|
"button",
|
|
2035
2400
|
{
|
|
2036
2401
|
type: "button",
|
|
@@ -2044,16 +2409,16 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2044
2409
|
}
|
|
2045
2410
|
)
|
|
2046
2411
|
] }),
|
|
2047
|
-
f && /* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2412
|
+
f && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-2", "data-vector-frame": f.id, children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-2 gap-1", children: [
|
|
2049
2414
|
number("x", "X"),
|
|
2050
2415
|
number("y", "Y"),
|
|
2051
2416
|
number("width", "W"),
|
|
2052
2417
|
number("height", "H")
|
|
2053
2418
|
] }),
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
2055
|
-
/* @__PURE__ */ (0,
|
|
2056
|
-
/* @__PURE__ */ (0,
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex w-16 items-center gap-1.5 text-xs text-foreground", children: [
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2057
2422
|
"input",
|
|
2058
2423
|
{
|
|
2059
2424
|
type: "checkbox",
|
|
@@ -2064,7 +2429,7 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2064
2429
|
),
|
|
2065
2430
|
"Fill"
|
|
2066
2431
|
] }),
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2068
2433
|
"input",
|
|
2069
2434
|
{
|
|
2070
2435
|
type: "color",
|
|
@@ -2075,16 +2440,16 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2075
2440
|
onChange: (e) => controller.setFrame({ fill: e.target.value }, { ids, merge: "frame-fill" })
|
|
2076
2441
|
}
|
|
2077
2442
|
),
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
/* @__PURE__ */ (0,
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Hide what lies outside the frame", children: [
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "checkbox", "aria-label": "Clip content", checked: f.frame.clip !== false, onChange: (e) => controller.setFrame({ clip: e.target.checked }, { ids }) }),
|
|
2080
2445
|
"Clip"
|
|
2081
2446
|
] })
|
|
2082
2447
|
] })
|
|
2083
2448
|
] }),
|
|
2084
|
-
panel.resizing && /* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2087
|
-
/* @__PURE__ */ (0,
|
|
2449
|
+
panel.resizing && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-vector-resizing": "", children: [
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16", children: "Horizontal" }),
|
|
2452
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2088
2453
|
"select",
|
|
2089
2454
|
{
|
|
2090
2455
|
"aria-label": "Horizontal constraint",
|
|
@@ -2092,15 +2457,15 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2092
2457
|
value: panel.resizing.horizontal,
|
|
2093
2458
|
onChange: (e) => controller.setResizing({ horizontal: e.target.value }, { ids: panel.resizing.ids }),
|
|
2094
2459
|
children: [
|
|
2095
|
-
panel.resizing.horizontal === "mixed" && /* @__PURE__ */ (0,
|
|
2096
|
-
import_vector11.VECTOR_HORIZONTAL_RESIZING.map((h) => /* @__PURE__ */ (0,
|
|
2460
|
+
panel.resizing.horizontal === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "mixed", disabled: true, children: "Mixed" }),
|
|
2461
|
+
import_vector11.VECTOR_HORIZONTAL_RESIZING.map((h) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: h, children: import_vector11.VECTOR_HORIZONTAL_RESIZING_LABELS[h] }, h))
|
|
2097
2462
|
]
|
|
2098
2463
|
}
|
|
2099
2464
|
)
|
|
2100
2465
|
] }),
|
|
2101
|
-
/* @__PURE__ */ (0,
|
|
2102
|
-
/* @__PURE__ */ (0,
|
|
2103
|
-
/* @__PURE__ */ (0,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2467
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16", children: "Vertical" }),
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2104
2469
|
"select",
|
|
2105
2470
|
{
|
|
2106
2471
|
"aria-label": "Vertical constraint",
|
|
@@ -2108,8 +2473,8 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2108
2473
|
value: panel.resizing.vertical,
|
|
2109
2474
|
onChange: (e) => controller.setResizing({ vertical: e.target.value }, { ids: panel.resizing.ids }),
|
|
2110
2475
|
children: [
|
|
2111
|
-
panel.resizing.vertical === "mixed" && /* @__PURE__ */ (0,
|
|
2112
|
-
import_vector11.VECTOR_VERTICAL_RESIZING.map((v) => /* @__PURE__ */ (0,
|
|
2476
|
+
panel.resizing.vertical === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "mixed", disabled: true, children: "Mixed" }),
|
|
2477
|
+
import_vector11.VECTOR_VERTICAL_RESIZING.map((v) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: v, children: import_vector11.VECTOR_VERTICAL_RESIZING_LABELS[v] }, v))
|
|
2113
2478
|
]
|
|
2114
2479
|
}
|
|
2115
2480
|
)
|
|
@@ -2120,7 +2485,7 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2120
2485
|
|
|
2121
2486
|
// src/vector/VectorPagesPanel.tsx
|
|
2122
2487
|
var import_vector12 = require("@pixerate/editor/vector");
|
|
2123
|
-
var
|
|
2488
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2124
2489
|
var buttonClass9 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-[current=true]:bg-primary aria-[current=true]:text-primary-foreground";
|
|
2125
2490
|
var selectClass7 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2126
2491
|
function VectorPagesPanel({ controller, className }) {
|
|
@@ -2129,19 +2494,19 @@ function VectorPagesPanel({ controller, className }) {
|
|
|
2129
2494
|
const masters = (0, import_vector12.vectorMasterPages)(state.document);
|
|
2130
2495
|
const selected = state.selection.map((id) => state.document.nodes.find((n) => n.id === id)).find((n) => (0, import_vector12.isVectorFrame)(n));
|
|
2131
2496
|
const page = selected && !selected.frame.master ? selected : null;
|
|
2132
|
-
return /* @__PURE__ */ (0,
|
|
2133
|
-
/* @__PURE__ */ (0,
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2135
|
-
pages.map((p, i) => /* @__PURE__ */ (0,
|
|
2136
|
-
masters.map((m) => /* @__PURE__ */ (0,
|
|
2137
|
-
/* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-pages-panel": "", "aria-label": "Pages", children: [
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Pages" }),
|
|
2500
|
+
pages.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: buttonClass9, "aria-current": state.selection.includes(p.id), "data-vector-page": p.id, title: `Go to ${p.name ?? `page ${i + 1}`}`, onClick: () => controller.goToPage(p.id), children: i + 1 }, p.id)),
|
|
2501
|
+
masters.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: buttonClass9, "aria-current": state.selection.includes(m.id), "data-vector-master-page": m.id, title: `Go to master page ${m.name ?? ""}`, onClick: () => controller.goToPage(m.id), children: m.name ?? "Master" }, m.id)),
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: buttonClass9, "data-vector-pages-action": "add", title: "Add a page after the last", onClick: () => controller.addPage(), children: "+ Page" }),
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: buttonClass9, "data-vector-pages-action": "master", title: "Add a master page used by every page (headers, footers, {page} numbers)", onClick: () => controller.addMasterPage({ assignTo: "all" }), children: "+ Master" })
|
|
2139
2504
|
] }),
|
|
2140
|
-
page && masters.length > 0 && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
/* @__PURE__ */ (0,
|
|
2143
|
-
/* @__PURE__ */ (0,
|
|
2144
|
-
masters.map((m) => /* @__PURE__ */ (0,
|
|
2505
|
+
page && masters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16" }),
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { "aria-label": "Master page", className: selectClass7, value: page.frame.masterId ?? "", onChange: (e) => controller.setPageMaster(e.target.value || null, { ids: [page.id] }), children: [
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "No master" }),
|
|
2509
|
+
masters.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m.id, children: m.name ?? "Master" }, m.id))
|
|
2145
2510
|
] })
|
|
2146
2511
|
] })
|
|
2147
2512
|
] });
|
|
@@ -2149,7 +2514,7 @@ function VectorPagesPanel({ controller, className }) {
|
|
|
2149
2514
|
|
|
2150
2515
|
// src/vector/VectorConnectorPanel.tsx
|
|
2151
2516
|
var import_vector13 = require("@pixerate/editor/vector");
|
|
2152
|
-
var
|
|
2517
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2153
2518
|
var buttonClass10 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
2154
2519
|
var selectClass8 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2155
2520
|
var numberClass5 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2158,27 +2523,27 @@ function VectorConnectorPanel({ controller, className }) {
|
|
|
2158
2523
|
const panel = (0, import_vector13.getVectorConnectorPanel)(state);
|
|
2159
2524
|
if (!panel) return null;
|
|
2160
2525
|
const ids = [panel.id];
|
|
2161
|
-
const end = (key, label, e) => /* @__PURE__ */ (0,
|
|
2162
|
-
/* @__PURE__ */ (0,
|
|
2163
|
-
e ? /* @__PURE__ */ (0,
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2526
|
+
const end = (key, label, e) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", "data-vector-connector-end": key, children: [
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16 text-xs text-foreground", children: label }),
|
|
2528
|
+
e ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2165
2530
|
"select",
|
|
2166
2531
|
{
|
|
2167
2532
|
"aria-label": `${label} side`,
|
|
2168
2533
|
className: selectClass8,
|
|
2169
2534
|
value: e.side ?? "auto",
|
|
2170
2535
|
onChange: (ev) => controller.setConnector({ [key]: { nodeId: e.nodeId, side: ev.target.value } }, { ids }),
|
|
2171
|
-
children: import_vector13.VECTOR_CONNECTOR_SIDES.map((s) => /* @__PURE__ */ (0,
|
|
2536
|
+
children: import_vector13.VECTOR_CONNECTOR_SIDES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: s, children: import_vector13.VECTOR_CONNECTOR_SIDE_LABELS[s] }, s))
|
|
2172
2537
|
}
|
|
2173
2538
|
),
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2175
|
-
] }) : /* @__PURE__ */ (0,
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: buttonClass10, title: "Unglue: the end stays where it is", "aria-label": `Unglue ${label.toLowerCase()}`, onClick: () => controller.setConnector({ [key]: null }, { ids }), children: "Unglue" })
|
|
2540
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Free" })
|
|
2176
2541
|
] });
|
|
2177
|
-
return /* @__PURE__ */ (0,
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
2179
|
-
/* @__PURE__ */ (0,
|
|
2180
|
-
/* @__PURE__ */ (0,
|
|
2181
|
-
panel.route === "elbow" && /* @__PURE__ */ (0,
|
|
2542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-connector-panel": panel.id, "aria-label": "Connector", children: [
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Connector" }),
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Connector route", className: selectClass8, value: panel.route, onChange: (e) => controller.setConnector({ route: e.target.value }, { ids }), children: import_vector13.VECTOR_CONNECTOR_ROUTES.map((r) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: r, children: import_vector13.VECTOR_CONNECTOR_ROUTE_LABELS[r] }, r)) }),
|
|
2546
|
+
panel.route === "elbow" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2182
2547
|
"input",
|
|
2183
2548
|
{
|
|
2184
2549
|
type: "number",
|
|
@@ -2201,15 +2566,15 @@ function VectorConnectorPanel({ controller, className }) {
|
|
|
2201
2566
|
}
|
|
2202
2567
|
|
|
2203
2568
|
// src/vector/VectorShadingPanel.tsx
|
|
2204
|
-
var
|
|
2569
|
+
var import_react17 = require("react");
|
|
2205
2570
|
var import_vector14 = require("@pixerate/editor/vector");
|
|
2206
|
-
var
|
|
2571
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2207
2572
|
var buttonClass11 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
2208
2573
|
var numberClass6 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
2209
2574
|
function VectorShadingPanel({ controller, className }) {
|
|
2210
2575
|
const state = useVectorEditorState(controller);
|
|
2211
|
-
const [rows, setRows] = (0,
|
|
2212
|
-
const [columns, setColumns] = (0,
|
|
2576
|
+
const [rows, setRows] = (0, import_react17.useState)(2);
|
|
2577
|
+
const [columns, setColumns] = (0, import_react17.useState)(2);
|
|
2213
2578
|
const path = state.selection.map((id) => controller.getNode(id)).find((n) => n?.type === "path");
|
|
2214
2579
|
if (!path) return null;
|
|
2215
2580
|
const fill = path.fill;
|
|
@@ -2224,38 +2589,38 @@ function VectorShadingPanel({ controller, className }) {
|
|
|
2224
2589
|
if (mesh) controller.setMeshPoint(path.id, sel.index, patch, merge ? { merge } : {});
|
|
2225
2590
|
else controller.setFreeformPoint(path.id, sel.index, patch, merge ? { merge } : {});
|
|
2226
2591
|
};
|
|
2227
|
-
return /* @__PURE__ */ (0,
|
|
2228
|
-
/* @__PURE__ */ (0,
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2232
|
-
/* @__PURE__ */ (0,
|
|
2233
|
-
/* @__PURE__ */ (0,
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-shading-panel": path.id, "aria-label": "Mesh and freeform gradient", children: [
|
|
2593
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2594
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Shading" }),
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", min: 1, max: 32, "aria-label": "Mesh rows", title: "Mesh rows", className: numberClass6, value: rows, onChange: (e) => setRows(Math.max(1, Math.min(32, parseInt(e.target.value, 10) || 1))) }),
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-muted-foreground", children: "\xD7" }),
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", min: 1, max: 32, "aria-label": "Mesh columns", title: "Mesh columns", className: numberClass6, value: columns, onChange: (e) => setColumns(Math.max(1, Math.min(32, parseInt(e.target.value, 10) || 1))) }),
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: buttonClass11, "data-vector-shading-action": "mesh", title: "Create Gradient Mesh: smooth patches whose points blend colours (edit them with the Gradient tool)", onClick: () => controller.setMeshGradient({ rows, columns }, { ids: [path.id] }), children: "Mesh" }),
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: buttonClass11, "data-vector-shading-action": "freeform", title: "Freeform Gradient: colour points blended across the shape (click inside with the Gradient tool to add one)", onClick: () => controller.setFreeformGradient({}, { ids: [path.id] }), children: "Freeform" })
|
|
2235
2600
|
] }),
|
|
2236
|
-
(mesh || free) && !sel && /* @__PURE__ */ (0,
|
|
2601
|
+
(mesh || free) && !sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2237
2602
|
"Gradient tool (G): drag points; ",
|
|
2238
2603
|
free ? "click inside to add one, Alt-click to remove." : "pick one to colour it."
|
|
2239
2604
|
] }),
|
|
2240
|
-
sel && /* @__PURE__ */ (0,
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
2605
|
+
sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-vector-shading-point": sel.index, children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "w-16 text-xs text-foreground", children: [
|
|
2242
2607
|
"Point ",
|
|
2243
2608
|
sel.index
|
|
2244
2609
|
] }),
|
|
2245
|
-
/* @__PURE__ */ (0,
|
|
2246
|
-
/* @__PURE__ */ (0,
|
|
2247
|
-
free && /* @__PURE__ */ (0,
|
|
2248
|
-
/* @__PURE__ */ (0,
|
|
2249
|
-
/* @__PURE__ */ (0,
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "color", "aria-label": "Point colour", className: "h-7 w-10 cursor-pointer rounded border border-border bg-background", value: (0, import_vector14.vectorPaintToHex)(color ?? "#000000") ?? "#000000", onChange: (e) => edit({ color: e.target.value }, "shading-color") }),
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "range", min: 0, max: 1, step: 0.05, "aria-label": "Point opacity", title: "Opacity", className: "h-4 w-20 accent-primary", value: opacity, onChange: (e) => edit({ opacity: parseFloat(e.target.value) }, "shading-opacity") }),
|
|
2612
|
+
free && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "range", min: 0, max: 1, step: 0.05, "aria-label": "Point spread", title: "Spread: pure colour round the point", className: "h-4 w-20 accent-primary", value: spread, onChange: (e) => edit({ spread: parseFloat(e.target.value) }, "shading-spread") }),
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: buttonClass11, "aria-label": "Remove point", onClick: () => controller.removeFreeformPoint(path.id, sel.index), children: "Remove" })
|
|
2250
2615
|
] })
|
|
2251
2616
|
] })
|
|
2252
2617
|
] });
|
|
2253
2618
|
}
|
|
2254
2619
|
|
|
2255
2620
|
// src/vector/VectorTracePanel.tsx
|
|
2256
|
-
var
|
|
2621
|
+
var import_react18 = require("react");
|
|
2257
2622
|
var import_vector15 = require("@pixerate/editor/vector");
|
|
2258
|
-
var
|
|
2623
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2259
2624
|
var buttonClass12 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
2260
2625
|
var selectClass9 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2261
2626
|
var numberClass7 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2272,10 +2637,10 @@ async function filePixels(file, max = 1e6) {
|
|
|
2272
2637
|
return { width, height, data: ctx.getImageData(0, 0, width, height).data };
|
|
2273
2638
|
}
|
|
2274
2639
|
function VectorTracePanel({ controller, className }) {
|
|
2275
|
-
const input = (0,
|
|
2276
|
-
const [mode, setMode] = (0,
|
|
2277
|
-
const [colors, setColors] = (0,
|
|
2278
|
-
const [message, setMessage] = (0,
|
|
2640
|
+
const input = (0, import_react18.useRef)(null);
|
|
2641
|
+
const [mode, setMode] = (0, import_react18.useState)("threshold");
|
|
2642
|
+
const [colors, setColors] = (0, import_react18.useState)(6);
|
|
2643
|
+
const [message, setMessage] = (0, import_react18.useState)(null);
|
|
2279
2644
|
const trace = async (file) => {
|
|
2280
2645
|
try {
|
|
2281
2646
|
const pixels = await filePixels(file);
|
|
@@ -2288,17 +2653,17 @@ function VectorTracePanel({ controller, className }) {
|
|
|
2288
2653
|
setMessage("That file could not be read as an image.");
|
|
2289
2654
|
}
|
|
2290
2655
|
};
|
|
2291
|
-
return /* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2294
|
-
/* @__PURE__ */ (0,
|
|
2295
|
-
/* @__PURE__ */ (0,
|
|
2296
|
-
/* @__PURE__ */ (0,
|
|
2297
|
-
import_vector15.VECTOR_STYLIZE_STYLES.map((s) => /* @__PURE__ */ (0,
|
|
2656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-1 ${className ?? ""}`, "data-vector-trace-panel": "", "aria-label": "Image trace", children: [
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Trace" }),
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { "aria-label": "Trace mode", className: selectClass9, value: mode, onChange: (e) => setMode(e.target.value), children: [
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "threshold", children: "Black & white" }),
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "color", children: "Colours" }),
|
|
2662
|
+
import_vector15.VECTOR_STYLIZE_STYLES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: s, children: import_vector15.VECTOR_STYLIZE_LABELS[s] }, s))
|
|
2298
2663
|
] }),
|
|
2299
|
-
mode === "color" && /* @__PURE__ */ (0,
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2301
|
-
/* @__PURE__ */ (0,
|
|
2664
|
+
mode === "color" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "number", min: 2, max: 32, "aria-label": "Trace colours", title: "Colours", className: numberClass7, value: colors, onChange: (e) => setColors(Math.max(2, Math.min(32, parseInt(e.target.value, 10) || 2))) }),
|
|
2665
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: buttonClass12, "data-vector-trace-action": "", title: "Image Trace: pick an image to turn into paths", onClick: () => input.current?.click(), children: "Image\u2026" }),
|
|
2666
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2302
2667
|
"input",
|
|
2303
2668
|
{
|
|
2304
2669
|
ref: input,
|
|
@@ -2313,13 +2678,13 @@ function VectorTracePanel({ controller, className }) {
|
|
|
2313
2678
|
}
|
|
2314
2679
|
)
|
|
2315
2680
|
] }),
|
|
2316
|
-
message && /* @__PURE__ */ (0,
|
|
2681
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-red-600", children: message })
|
|
2317
2682
|
] });
|
|
2318
2683
|
}
|
|
2319
2684
|
|
|
2320
2685
|
// src/vector/VectorSymmetryPanel.tsx
|
|
2321
2686
|
var import_vector16 = require("@pixerate/editor/vector");
|
|
2322
|
-
var
|
|
2687
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2323
2688
|
var buttonClass13 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
2324
2689
|
var selectClass10 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2325
2690
|
var numberClass8 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2329,35 +2694,35 @@ function VectorSymmetryPanel({ controller, className }) {
|
|
|
2329
2694
|
const s = group?.symmetry;
|
|
2330
2695
|
const ids = group ? [group.id] : void 0;
|
|
2331
2696
|
const drawing = !!group && state.symmetryTarget === group.id;
|
|
2332
|
-
return /* @__PURE__ */ (0,
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
!group && /* @__PURE__ */ (0,
|
|
2336
|
-
!group && /* @__PURE__ */ (0,
|
|
2337
|
-
group && s && /* @__PURE__ */ (0,
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2339
|
-
s.mode === "radial" && /* @__PURE__ */ (0,
|
|
2340
|
-
/* @__PURE__ */ (0,
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2342
|
-
/* @__PURE__ */ (0,
|
|
2697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-symmetry-panel": "", "aria-label": "Symmetry", children: [
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2699
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Symmetry" }),
|
|
2700
|
+
!group && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: buttonClass13, "data-vector-symmetry-action": "make", title: "Make Symmetry: the selection (or nothing yet) mirrored live across a vertical axis", onClick: () => controller.makeSymmetry({ mode: "vertical" }), children: "Mirror" }),
|
|
2701
|
+
!group && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: buttonClass13, "data-vector-symmetry-action": "radial", title: "Make Symmetry: the selection repeated round its centre", onClick: () => controller.makeSymmetry({ mode: "radial", copies: 6 }), children: "Radial" }),
|
|
2702
|
+
group && s && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Symmetry mode", className: selectClass10, value: s.mode, onChange: (e) => controller.setSymmetry({ mode: e.target.value }, { ids }), children: import_vector16.VECTOR_SYMMETRY_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: m, children: import_vector16.VECTOR_SYMMETRY_MODE_LABELS[m] }, m)) }),
|
|
2704
|
+
s.mode === "radial" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", min: 2, max: 64, "aria-label": "Symmetry copies", title: "Copies round the circle", className: numberClass8, value: s.copies ?? 6, onChange: (e) => controller.setSymmetry({ copies: Math.max(2, Math.min(64, parseInt(e.target.value, 10) || 2)) }, { ids }) }),
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Mirror each copy too (kaleidoscope)", children: [
|
|
2707
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Mirror copies", checked: !!s.mirror, onChange: (e) => controller.setSymmetry({ mirror: e.target.checked }, { ids }) }),
|
|
2343
2708
|
"Mirror"
|
|
2344
2709
|
] })
|
|
2345
2710
|
] })
|
|
2346
2711
|
] })
|
|
2347
2712
|
] }),
|
|
2348
|
-
group && /* @__PURE__ */ (0,
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2351
|
-
/* @__PURE__ */ (0,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2713
|
+
group && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16" }),
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: buttonClass13, "aria-pressed": drawing, "data-vector-symmetry-action": "draw", title: "Draw inside: new pen, pencil, shape and text art goes into the group, mirrored as you draw (Escape stops)", onClick: () => drawing ? controller.exitSymmetry() : controller.enterSymmetry(group.id), children: "Draw inside" }),
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: buttonClass13, title: "Expand: keep the copies as real objects", onClick: () => controller.releaseSymmetry({ ids, expand: true }), children: "Expand" }),
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: buttonClass13, title: "Release: stop repeating (the copies go)", onClick: () => controller.releaseSymmetry({ ids }), children: "Release" })
|
|
2353
2718
|
] })
|
|
2354
2719
|
] });
|
|
2355
2720
|
}
|
|
2356
2721
|
|
|
2357
2722
|
// src/vector/VectorPerspectivePanel.tsx
|
|
2358
|
-
var
|
|
2723
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
2359
2724
|
var import_vector17 = require("@pixerate/editor/vector");
|
|
2360
|
-
var
|
|
2725
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2361
2726
|
var buttonClass14 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
2362
2727
|
var selectClass11 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2363
2728
|
var PLANE_LABELS = { floor: "Floor", left: "Left wall", right: "Right wall", side: "Side wall", front: "Front" };
|
|
@@ -2365,43 +2730,43 @@ function VectorPerspectivePanel({ controller, className }) {
|
|
|
2365
2730
|
const state = useVectorEditorState(controller);
|
|
2366
2731
|
const grid = state.document.perspective ?? null;
|
|
2367
2732
|
const planes = grid ? (0, import_vector17.vectorPerspectivePlanes)(grid) : [];
|
|
2368
|
-
const [attachTo, setAttachTo] =
|
|
2733
|
+
const [attachTo, setAttachTo] = import_react19.default.useState("");
|
|
2369
2734
|
const target = (state.perspectivePlane ?? attachTo) || planes[0];
|
|
2370
2735
|
const add = (n) => controller.setPerspective((0, import_vector17.vectorPerspectivePreset)(n, state.document.width, state.document.height));
|
|
2371
|
-
return /* @__PURE__ */ (0,
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2373
|
-
/* @__PURE__ */ (0,
|
|
2374
|
-
[1, 2, 3].map((n) => /* @__PURE__ */ (0,
|
|
2736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-perspective-panel": "", "aria-label": "Perspective", children: [
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Perspective" }),
|
|
2739
|
+
[1, 2, 3].map((n) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("button", { type: "button", className: buttonClass14, "aria-pressed": grid?.vanishingPoints.length === n, "data-vector-perspective-preset": n, title: `A ${n}-point perspective grid for the page`, onClick: () => add(n), children: [
|
|
2375
2740
|
n,
|
|
2376
2741
|
"-pt"
|
|
2377
2742
|
] }, n))
|
|
2378
2743
|
] }),
|
|
2379
|
-
grid && /* @__PURE__ */ (0,
|
|
2380
|
-
/* @__PURE__ */ (0,
|
|
2381
|
-
/* @__PURE__ */ (0,
|
|
2382
|
-
/* @__PURE__ */ (0,
|
|
2383
|
-
planes.map((p) => /* @__PURE__ */ (0,
|
|
2744
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-16" }),
|
|
2746
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("select", { "aria-label": "Draw on plane", title: "New rectangles, ellipses, polygons and stars are drawn on this plane", className: selectClass11, value: state.perspectivePlane ?? "", onChange: (e) => controller.setPerspectivePlane(e.target.value || null), children: [
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Draw flat" }),
|
|
2748
|
+
planes.map((p) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: p, children: [
|
|
2384
2749
|
"Draw on ",
|
|
2385
2750
|
PLANE_LABELS[p].toLowerCase()
|
|
2386
2751
|
] }, p))
|
|
2387
2752
|
] })
|
|
2388
2753
|
] }),
|
|
2389
|
-
grid && /* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2391
|
-
!state.perspectivePlane && /* @__PURE__ */ (0,
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2754
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2755
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-16" }),
|
|
2756
|
+
!state.perspectivePlane && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Attach to plane", className: "h-7 w-24 rounded border border-border bg-background px-1 text-xs", value: attachTo || planes[0], onChange: (e) => setAttachTo(e.target.value), children: planes.map((p) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: p, children: PLANE_LABELS[p] }, p)) }),
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: buttonClass14, disabled: !state.selection.length, title: "Lay the selection onto the plane (read flat from the grid's origin)", onClick: () => controller.attachToPerspective(target), children: "Attach" }),
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Show the grid on the canvas", children: [
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Show perspective grid", checked: grid.visible !== false, onChange: (e) => controller.setPerspective({ ...grid, visible: e.target.checked }) }),
|
|
2395
2760
|
"Show"
|
|
2396
2761
|
] }),
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: buttonClass14, title: "Remove the grid (art on it stays)", onClick: () => controller.setPerspective(null), children: "Remove" })
|
|
2398
2763
|
] })
|
|
2399
2764
|
] });
|
|
2400
2765
|
}
|
|
2401
2766
|
|
|
2402
2767
|
// src/vector/VectorLensPanel.tsx
|
|
2403
2768
|
var import_vector18 = require("@pixerate/editor/vector");
|
|
2404
|
-
var
|
|
2769
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2405
2770
|
var selectClass12 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2406
2771
|
var numberClass9 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
2407
2772
|
function VectorLensPanel({ controller, className }) {
|
|
@@ -2411,10 +2776,10 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2411
2776
|
const lens = path.lens ?? null;
|
|
2412
2777
|
const spec = lens ? import_vector18.VECTOR_LENS_SPECS[lens.type] : null;
|
|
2413
2778
|
const ids = [path.id];
|
|
2414
|
-
return /* @__PURE__ */ (0,
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-lens-panel": "", "aria-label": "Lens", children: [
|
|
2780
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Lens" }),
|
|
2782
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2418
2783
|
"select",
|
|
2419
2784
|
{
|
|
2420
2785
|
"aria-label": "Lens type",
|
|
@@ -2422,15 +2787,15 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2422
2787
|
value: lens?.type ?? "",
|
|
2423
2788
|
onChange: (e) => e.target.value ? controller.setLens({ type: e.target.value }, { ids }) : controller.setLens(null, { ids }),
|
|
2424
2789
|
children: [
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2426
|
-
import_vector18.VECTOR_LENS_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2790
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "None" }),
|
|
2791
|
+
import_vector18.VECTOR_LENS_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: t, children: import_vector18.VECTOR_LENS_LABELS[t] }, t))
|
|
2427
2792
|
]
|
|
2428
2793
|
}
|
|
2429
2794
|
)
|
|
2430
2795
|
] }),
|
|
2431
|
-
lens && spec && /* @__PURE__ */ (0,
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2433
|
-
/* @__PURE__ */ (0,
|
|
2796
|
+
lens && spec && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2797
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-16" }),
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2434
2799
|
"input",
|
|
2435
2800
|
{
|
|
2436
2801
|
type: "number",
|
|
@@ -2447,14 +2812,14 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2447
2812
|
}
|
|
2448
2813
|
}
|
|
2449
2814
|
),
|
|
2450
|
-
spec.color !== null && /* @__PURE__ */ (0,
|
|
2815
|
+
spec.color !== null && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "color", "aria-label": "Lens colour", title: "Lens colour", className: "h-7 w-9 rounded border border-border bg-background", value: lens.color ?? spec.color, onChange: (e) => controller.setLens({ color: e.target.value }, { ids, merge: `lens-color-${path.id}` }) })
|
|
2451
2816
|
] })
|
|
2452
2817
|
] });
|
|
2453
2818
|
}
|
|
2454
2819
|
|
|
2455
2820
|
// src/vector/VectorGradientEditor.tsx
|
|
2456
2821
|
var import_vector19 = require("@pixerate/editor/vector");
|
|
2457
|
-
var
|
|
2822
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2458
2823
|
var selectClass13 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2459
2824
|
var numberClass10 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
2460
2825
|
var buttonClass15 = "inline-flex h-7 min-w-7 items-center justify-center rounded border border-border bg-background px-1.5 text-xs text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
@@ -2472,23 +2837,23 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2472
2837
|
controller.setStyle({ [ed.target]: (0, import_vector19.vectorPaintToHex)(first?.color) ?? first?.color ?? "#000000" }, void 0, { label: "Solid Colour" });
|
|
2473
2838
|
} else controller.setGradient({ type: value });
|
|
2474
2839
|
};
|
|
2475
|
-
return /* @__PURE__ */ (0,
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
2478
|
-
["fill", "stroke"].map((t) => /* @__PURE__ */ (0,
|
|
2479
|
-
ed.mixed && /* @__PURE__ */ (0,
|
|
2840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `space-y-1.5 ${className ?? ""}`, "data-vector-gradient-editor": ed.target, "aria-label": "Gradient", children: [
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Gradient" }),
|
|
2843
|
+
["fill", "stroke"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: buttonClass15, "aria-pressed": ed.target === t, onClick: () => controller.setGradientTarget(t), children: t === "fill" ? "Fill" : "Stroke" }, t)),
|
|
2844
|
+
ed.mixed && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
2480
2845
|
] }),
|
|
2481
|
-
/* @__PURE__ */ (0,
|
|
2482
|
-
/* @__PURE__ */ (0,
|
|
2483
|
-
/* @__PURE__ */ (0,
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2485
|
-
import_vector19.VECTOR_GRADIENT_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Type" }),
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("select", { "aria-label": "Gradient type", className: selectClass13, value: ed.type ?? "solid", onChange: (e) => setType(e.target.value), children: [
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "solid", children: "Solid" }),
|
|
2850
|
+
import_vector19.VECTOR_GRADIENT_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: t, children: import_vector19.VECTOR_GRADIENT_TYPE_LABELS[t] }, t))
|
|
2486
2851
|
] }),
|
|
2487
|
-
/* @__PURE__ */ (0,
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: buttonClass15, "aria-label": "Reverse gradient", title: "Reverse gradient", disabled: !g, onClick: () => controller.reverseGradient(), children: "\u21C4" })
|
|
2488
2853
|
] }),
|
|
2489
|
-
g && /* @__PURE__ */ (0,
|
|
2490
|
-
/* @__PURE__ */ (0,
|
|
2491
|
-
/* @__PURE__ */ (0,
|
|
2854
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative h-8", "data-vector-gradient-ramp": "", children: [
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2492
2857
|
"div",
|
|
2493
2858
|
{
|
|
2494
2859
|
role: "button",
|
|
@@ -2502,7 +2867,7 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2502
2867
|
}
|
|
2503
2868
|
}
|
|
2504
2869
|
),
|
|
2505
|
-
ed.stops.map((s) => /* @__PURE__ */ (0,
|
|
2870
|
+
ed.stops.map((s) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2506
2871
|
"button",
|
|
2507
2872
|
{
|
|
2508
2873
|
type: "button",
|
|
@@ -2516,8 +2881,8 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2516
2881
|
s.index
|
|
2517
2882
|
))
|
|
2518
2883
|
] }),
|
|
2519
|
-
sel && /* @__PURE__ */ (0,
|
|
2520
|
-
/* @__PURE__ */ (0,
|
|
2884
|
+
sel && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", "data-vector-gradient-selected-stop": sel.index, children: [
|
|
2885
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2521
2886
|
"input",
|
|
2522
2887
|
{
|
|
2523
2888
|
type: "color",
|
|
@@ -2528,9 +2893,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2528
2893
|
onBlur: end
|
|
2529
2894
|
}
|
|
2530
2895
|
),
|
|
2531
|
-
/* @__PURE__ */ (0,
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2532
2897
|
"Opacity",
|
|
2533
|
-
/* @__PURE__ */ (0,
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2534
2899
|
"input",
|
|
2535
2900
|
{
|
|
2536
2901
|
type: "number",
|
|
@@ -2547,9 +2912,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2547
2912
|
}
|
|
2548
2913
|
)
|
|
2549
2914
|
] }),
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2551
2916
|
"At",
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2553
2918
|
"input",
|
|
2554
2919
|
{
|
|
2555
2920
|
type: "number",
|
|
@@ -2566,9 +2931,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2566
2931
|
}
|
|
2567
2932
|
)
|
|
2568
2933
|
] }),
|
|
2569
|
-
!sel.last && /* @__PURE__ */ (0,
|
|
2934
|
+
!sel.last && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2570
2935
|
"Midpoint",
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2572
2937
|
"input",
|
|
2573
2938
|
{
|
|
2574
2939
|
type: "number",
|
|
@@ -2585,15 +2950,15 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2585
2950
|
}
|
|
2586
2951
|
)
|
|
2587
2952
|
] }),
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: buttonClass15, "aria-label": "Delete stop", title: "Delete stop", disabled: ed.stops.length <= 2, onClick: () => controller.removeGradientStop(sel.index), children: "\u2715" })
|
|
2589
2954
|
] }),
|
|
2590
|
-
/* @__PURE__ */ (0,
|
|
2591
|
-
/* @__PURE__ */ (0,
|
|
2592
|
-
/* @__PURE__ */ (0,
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "Colours" }),
|
|
2957
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Gradient interpolation", className: selectClass13, value: ed.interpolation, onChange: (e) => controller.setGradient({ interpolation: e.target.value }), children: import_vector19.VECTOR_GRADIENT_INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: i, children: import_vector19.VECTOR_GRADIENT_INTERPOLATION_LABELS[i] }, i)) })
|
|
2593
2958
|
] }),
|
|
2594
|
-
/* @__PURE__ */ (0,
|
|
2595
|
-
/* @__PURE__ */ (0,
|
|
2596
|
-
/* @__PURE__ */ (0,
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "Smooth" }),
|
|
2961
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2597
2962
|
"input",
|
|
2598
2963
|
{
|
|
2599
2964
|
type: "range",
|
|
@@ -2609,20 +2974,20 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2609
2974
|
}
|
|
2610
2975
|
)
|
|
2611
2976
|
] }),
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
2613
|
-
/* @__PURE__ */ (0,
|
|
2614
|
-
/* @__PURE__ */ (0,
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "Spread" }),
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Gradient spread", className: selectClass13, value: ed.spread, onChange: (e) => controller.setGradient({ spread: e.target.value }), children: import_vector19.VECTOR_GRADIENT_SPREADS.map((sp) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: sp, children: import_vector19.VECTOR_GRADIENT_SPREAD_LABELS[sp] }, sp)) })
|
|
2615
2980
|
] }),
|
|
2616
|
-
ed.target === "stroke" && /* @__PURE__ */ (0,
|
|
2617
|
-
/* @__PURE__ */ (0,
|
|
2618
|
-
/* @__PURE__ */ (0,
|
|
2981
|
+
ed.target === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "On stroke" }),
|
|
2983
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Gradient on stroke", className: selectClass13, value: ed.strokeMode, onChange: (e) => controller.setGradient({ strokeMode: e.target.value }), children: import_vector19.VECTOR_STROKE_GRADIENT_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: m, children: import_vector19.VECTOR_STROKE_GRADIENT_MODE_LABELS[m] }, m)) })
|
|
2619
2984
|
] })
|
|
2620
2985
|
] })
|
|
2621
2986
|
] });
|
|
2622
2987
|
}
|
|
2623
2988
|
|
|
2624
2989
|
// src/vector/VectorToolbar.tsx
|
|
2625
|
-
var
|
|
2990
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2626
2991
|
var VECTOR_SNAP_TITLE = "Snap to objects";
|
|
2627
2992
|
var modKeyLabel = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform ?? "") ? "\u2318" : "Ctrl";
|
|
2628
2993
|
var buttonClass16 = "inline-flex h-8 min-w-8 items-center justify-center rounded-md border border-border bg-background px-2 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:bg-primary aria-pressed:text-primary-foreground";
|
|
@@ -2643,11 +3008,11 @@ function VectorToolbar({
|
|
|
2643
3008
|
const editing = state.editing;
|
|
2644
3009
|
const groupSelected = state.selection.some((id) => controller.getNode(id)?.type === "group");
|
|
2645
3010
|
const maskSelected = state.selection.some((id) => (0, import_vector20.isVectorMaskGroup)(controller.getNode(id)));
|
|
2646
|
-
const [live, setLive] =
|
|
3011
|
+
const [live, setLive] = import_react20.default.useState(false);
|
|
2647
3012
|
const booleanDisabled = live ? count < 1 : count < 2;
|
|
2648
|
-
const act = (label, title, run, disabled = false) => /* @__PURE__ */ (0,
|
|
2649
|
-
return /* @__PURE__ */ (0,
|
|
2650
|
-
/* @__PURE__ */ (0,
|
|
3013
|
+
const act = (label, title, run, disabled = false) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: buttonClass16, title, "aria-label": title, disabled, onClick: () => void run(), children: label }, label);
|
|
3014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "toolbar", "aria-label": "Vector tools", className: `flex flex-wrap items-center gap-1 ${className ?? ""}`, children: [
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "Tools", children: tools.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2651
3016
|
"button",
|
|
2652
3017
|
{
|
|
2653
3018
|
type: "button",
|
|
@@ -2661,12 +3026,12 @@ function VectorToolbar({
|
|
|
2661
3026
|
},
|
|
2662
3027
|
tool
|
|
2663
3028
|
)) }),
|
|
2664
|
-
showHistory && /* @__PURE__ */ (0,
|
|
3029
|
+
showHistory && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "History", children: [
|
|
2665
3030
|
act("\u21B6", state.canUndo ? `Undo ${state.undoLabel}` : "Undo", () => controller.undo(), !state.canUndo),
|
|
2666
3031
|
act("\u21B7", state.canRedo ? `Redo ${state.redoLabel}` : "Redo", () => controller.redo(), !state.canRedo)
|
|
2667
3032
|
] }),
|
|
2668
|
-
showSnap && /* @__PURE__ */ (0,
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
showSnap && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Snapping", children: [
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2670
3035
|
"button",
|
|
2671
3036
|
{
|
|
2672
3037
|
type: "button",
|
|
@@ -2679,7 +3044,7 @@ function VectorToolbar({
|
|
|
2679
3044
|
children: "Snap"
|
|
2680
3045
|
}
|
|
2681
3046
|
),
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2683
3048
|
"select",
|
|
2684
3049
|
{
|
|
2685
3050
|
"data-vector-polar": "",
|
|
@@ -2689,8 +3054,8 @@ function VectorToolbar({
|
|
|
2689
3054
|
value: String((0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) ?? ""),
|
|
2690
3055
|
onChange: (e) => controller.setSnap({ angles: (0, import_vector20.vectorPolarAngles)(Number(e.target.value)) }),
|
|
2691
3056
|
children: [
|
|
2692
|
-
(0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) === null && /* @__PURE__ */ (0,
|
|
2693
|
-
[90, 45, 30, 15].map((n) => /* @__PURE__ */ (0,
|
|
3057
|
+
(0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) === null && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "Custom" }),
|
|
3058
|
+
[90, 45, 30, 15].map((n) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("option", { value: n, children: [
|
|
2694
3059
|
n,
|
|
2695
3060
|
"\xB0"
|
|
2696
3061
|
] }, n))
|
|
@@ -2698,8 +3063,8 @@ function VectorToolbar({
|
|
|
2698
3063
|
}
|
|
2699
3064
|
)
|
|
2700
3065
|
] }),
|
|
2701
|
-
showPathEdit && /* @__PURE__ */ (0,
|
|
2702
|
-
import_vector20.VECTOR_PATH_ACTIONS.map((a) => /* @__PURE__ */ (0,
|
|
3066
|
+
showPathEdit && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Path editing", children: [
|
|
3067
|
+
import_vector20.VECTOR_PATH_ACTIONS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2703
3068
|
"button",
|
|
2704
3069
|
{
|
|
2705
3070
|
type: "button",
|
|
@@ -2713,7 +3078,7 @@ function VectorToolbar({
|
|
|
2713
3078
|
},
|
|
2714
3079
|
a.id
|
|
2715
3080
|
)),
|
|
2716
|
-
import_vector20.VECTOR_EDIT_TOGGLES.map((t) => /* @__PURE__ */ (0,
|
|
3081
|
+
import_vector20.VECTOR_EDIT_TOGGLES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2717
3082
|
"button",
|
|
2718
3083
|
{
|
|
2719
3084
|
type: "button",
|
|
@@ -2727,9 +3092,9 @@ function VectorToolbar({
|
|
|
2727
3092
|
},
|
|
2728
3093
|
t.key
|
|
2729
3094
|
)),
|
|
2730
|
-
state.tool === "pencil" && /* @__PURE__ */ (0,
|
|
3095
|
+
state.tool === "pencil" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2731
3096
|
"Smoothing",
|
|
2732
|
-
/* @__PURE__ */ (0,
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2733
3098
|
"input",
|
|
2734
3099
|
{
|
|
2735
3100
|
type: "range",
|
|
@@ -2743,9 +3108,9 @@ function VectorToolbar({
|
|
|
2743
3108
|
}
|
|
2744
3109
|
)
|
|
2745
3110
|
] }),
|
|
2746
|
-
state.tool === "eraser" && /* @__PURE__ */ (0,
|
|
3111
|
+
state.tool === "eraser" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2747
3112
|
"Size",
|
|
2748
|
-
/* @__PURE__ */ (0,
|
|
3113
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2749
3114
|
"input",
|
|
2750
3115
|
{
|
|
2751
3116
|
type: "number",
|
|
@@ -2761,21 +3126,21 @@ function VectorToolbar({
|
|
|
2761
3126
|
}
|
|
2762
3127
|
)
|
|
2763
3128
|
] }),
|
|
2764
|
-
state.tool === "distort" && /* @__PURE__ */ (0,
|
|
2765
|
-
/* @__PURE__ */ (0,
|
|
2766
|
-
/* @__PURE__ */ (0,
|
|
3129
|
+
state.tool === "distort" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex flex-wrap items-center gap-1", "data-vector-distort-options": "", children: [
|
|
3130
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { "aria-label": "Distort brush", title: "What the brush does to the outlines it passes over", className: "h-7 rounded border border-border bg-background px-1 text-xs", value: editing.distortMode, onChange: (e) => controller.setEditing({ distortMode: e.target.value }), children: import_vector20.VECTOR_DISTORT_BRUSH_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: m, children: m[0].toUpperCase() + m.slice(1) }, m)) }),
|
|
3131
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2767
3132
|
"Size",
|
|
2768
|
-
/* @__PURE__ */ (0,
|
|
3133
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "number", min: 1, step: 1, "aria-label": "Distort brush size", className: "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs", value: editing.distortSize, onChange: (e) => {
|
|
2769
3134
|
const n = parseFloat(e.target.value);
|
|
2770
3135
|
if (Number.isFinite(n) && n > 0) controller.setEditing({ distortSize: n });
|
|
2771
3136
|
} })
|
|
2772
3137
|
] }),
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2774
3139
|
"Strength",
|
|
2775
|
-
/* @__PURE__ */ (0,
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "range", min: 0, max: 1, step: 0.05, "aria-label": "Distort brush strength", className: "h-4 w-20 accent-primary", value: editing.distortStrength, onChange: (e) => controller.setEditing({ distortStrength: parseFloat(e.target.value) }) })
|
|
2776
3141
|
] })
|
|
2777
3142
|
] }),
|
|
2778
|
-
state.tool === "paintBucket" && /* @__PURE__ */ (0,
|
|
3143
|
+
state.tool === "paintBucket" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2779
3144
|
"button",
|
|
2780
3145
|
{
|
|
2781
3146
|
type: "button",
|
|
@@ -2789,7 +3154,7 @@ function VectorToolbar({
|
|
|
2789
3154
|
}
|
|
2790
3155
|
)
|
|
2791
3156
|
] }),
|
|
2792
|
-
showDistort && /* @__PURE__ */ (0,
|
|
3157
|
+
showDistort && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Distort", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2793
3158
|
"button",
|
|
2794
3159
|
{
|
|
2795
3160
|
type: "button",
|
|
@@ -2802,10 +3167,10 @@ function VectorToolbar({
|
|
|
2802
3167
|
children: "Distort"
|
|
2803
3168
|
}
|
|
2804
3169
|
) }),
|
|
2805
|
-
showBlend && /* @__PURE__ */ (0,
|
|
2806
|
-
showArrange && /* @__PURE__ */ (0,
|
|
2807
|
-
/* @__PURE__ */ (0,
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
3170
|
+
showBlend && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorBlendControls, { controller }),
|
|
3171
|
+
showArrange && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Combine", children: [
|
|
3173
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2809
3174
|
"button",
|
|
2810
3175
|
{
|
|
2811
3176
|
type: "button",
|
|
@@ -2827,7 +3192,7 @@ function VectorToolbar({
|
|
|
2827
3192
|
act("\u25D0", `Make Clipping Mask (${modKeyLabel()}+7)`, () => controller.makeMask("clip"), count < 2),
|
|
2828
3193
|
act("\u25D1", `Release Mask (${modKeyLabel()}+Alt+7)`, () => controller.releaseMask(), !maskSelected)
|
|
2829
3194
|
] }),
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
3195
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Pathfinder", children: import_vector20.VECTOR_PATHFINDER_ACTIONS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2831
3196
|
"button",
|
|
2832
3197
|
{
|
|
2833
3198
|
type: "button",
|
|
@@ -2841,7 +3206,7 @@ function VectorToolbar({
|
|
|
2841
3206
|
},
|
|
2842
3207
|
a.id
|
|
2843
3208
|
)) }),
|
|
2844
|
-
/* @__PURE__ */ (0,
|
|
3209
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Arrange", children: [
|
|
2845
3210
|
act("\u21C8", "Bring to Front", () => controller.arrange("front"), count < 1),
|
|
2846
3211
|
act("\u21CA", "Send to Back", () => controller.arrange("back"), count < 1),
|
|
2847
3212
|
act("\u21E4", "Align Left", () => controller.align("left"), count < 1),
|
|
@@ -2859,19 +3224,19 @@ function VectorBlendControls({ controller }) {
|
|
|
2859
3224
|
const blend = (0, import_vector20.getVectorBlendControls)(state);
|
|
2860
3225
|
const o = blend.options;
|
|
2861
3226
|
const selected = blend.ids.length > 0;
|
|
2862
|
-
return /* @__PURE__ */ (0,
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
3227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Blend", "data-vector-blend-controls": "", children: [
|
|
3228
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "data-vector-blend-action": "make", className: buttonClass16, title: "Make Blend", "aria-label": "Make Blend", disabled: !blend.canBlend, onClick: () => controller.blend(), children: "\u29D3" }),
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2865
3230
|
"select",
|
|
2866
3231
|
{
|
|
2867
3232
|
"aria-label": "Blend spacing",
|
|
2868
3233
|
className: "h-7 rounded border border-border bg-background px-1 text-xs",
|
|
2869
3234
|
value: o.spacing,
|
|
2870
3235
|
onChange: (e) => (0, import_vector20.applyVectorBlendOptions)(controller, { spacing: e.target.value }),
|
|
2871
|
-
children: import_vector20.VECTOR_BLEND_SPACINGS.map((sp) => /* @__PURE__ */ (0,
|
|
3236
|
+
children: import_vector20.VECTOR_BLEND_SPACINGS.map((sp) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: sp, children: import_vector20.VECTOR_BLEND_SPACING_LABELS[sp] }, sp))
|
|
2872
3237
|
}
|
|
2873
3238
|
),
|
|
2874
|
-
o.spacing !== "smoothColor" && /* @__PURE__ */ (0,
|
|
3239
|
+
o.spacing !== "smoothColor" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2875
3240
|
"input",
|
|
2876
3241
|
{
|
|
2877
3242
|
type: "number",
|
|
@@ -2887,7 +3252,7 @@ function VectorBlendControls({ controller }) {
|
|
|
2887
3252
|
}
|
|
2888
3253
|
}
|
|
2889
3254
|
),
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2891
3256
|
"button",
|
|
2892
3257
|
{
|
|
2893
3258
|
type: "button",
|
|
@@ -2900,7 +3265,7 @@ function VectorBlendControls({ controller }) {
|
|
|
2900
3265
|
children: "\u293F"
|
|
2901
3266
|
}
|
|
2902
3267
|
),
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2904
3269
|
"button",
|
|
2905
3270
|
{
|
|
2906
3271
|
type: "button",
|
|
@@ -2913,8 +3278,8 @@ function VectorBlendControls({ controller }) {
|
|
|
2913
3278
|
children: "\u2307"
|
|
2914
3279
|
}
|
|
2915
3280
|
),
|
|
2916
|
-
/* @__PURE__ */ (0,
|
|
2917
|
-
/* @__PURE__ */ (0,
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "data-vector-blend-action": "expand", className: buttonClass16, title: "Expand Blend", "aria-label": "Expand Blend", disabled: !selected, onClick: () => controller.expandBlend(), children: "\u29C9" }),
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "data-vector-blend-action": "release", className: buttonClass16, title: "Release Blend", "aria-label": "Release Blend", disabled: !selected, onClick: () => controller.releaseBlend(), children: "\u29C4" })
|
|
2918
3283
|
] });
|
|
2919
3284
|
}
|
|
2920
3285
|
var selectClass14 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -2950,17 +3315,17 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2950
3315
|
if (style) controller.setWidthProfile(id);
|
|
2951
3316
|
else controller.setDefaults({ strokeWidthProfile: (0, import_vector20.widthProfilePreset)(id)?.length ? (0, import_vector20.widthProfilePreset)(id) : null });
|
|
2952
3317
|
};
|
|
2953
|
-
const mixed = (key) => style?.mixed[key] ? /* @__PURE__ */ (0,
|
|
3318
|
+
const mixed = (key) => style?.mixed[key] ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" }) : null;
|
|
2954
3319
|
const arrowRow = (end, label) => {
|
|
2955
3320
|
const key = end === "start" ? "startArrow" : "endArrow";
|
|
2956
3321
|
const scaleKey = end === "start" ? "startArrowScale" : "endArrowScale";
|
|
2957
|
-
return /* @__PURE__ */ (0,
|
|
2958
|
-
/* @__PURE__ */ (0,
|
|
2959
|
-
/* @__PURE__ */ (0,
|
|
2960
|
-
/* @__PURE__ */ (0,
|
|
2961
|
-
import_vector20.VECTOR_ARROWHEADS.map((h) => /* @__PURE__ */ (0,
|
|
3322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": key, children: [
|
|
3323
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16 text-xs text-foreground", children: label }),
|
|
3324
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("select", { "aria-label": `${label} arrowhead`, className: selectClass14, value: source[key] ?? "", onChange: (e) => apply({ [key]: e.target.value || null }), children: [
|
|
3325
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "None" }),
|
|
3326
|
+
import_vector20.VECTOR_ARROWHEADS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: h, children: import_vector20.VECTOR_ARROWHEAD_LABELS[h] }, h))
|
|
2962
3327
|
] }),
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
3328
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2964
3329
|
"input",
|
|
2965
3330
|
{
|
|
2966
3331
|
type: "number",
|
|
@@ -2986,12 +3351,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2986
3351
|
const paint = source[key];
|
|
2987
3352
|
const hex = (0, import_vector20.vectorPaintToHex)(paint);
|
|
2988
3353
|
const on = paint !== null && paint !== "none";
|
|
2989
|
-
return /* @__PURE__ */ (0,
|
|
2990
|
-
/* @__PURE__ */ (0,
|
|
2991
|
-
/* @__PURE__ */ (0,
|
|
3354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": key, children: [
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex w-16 items-center gap-1.5 text-xs text-foreground", children: [
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", checked: on, "aria-label": `${label} on`, onChange: (e) => apply({ [key]: e.target.checked ? hex ?? "#000000" : null }) }),
|
|
2992
3357
|
label
|
|
2993
3358
|
] }),
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2995
3360
|
"input",
|
|
2996
3361
|
{
|
|
2997
3362
|
type: "color",
|
|
@@ -3002,18 +3367,18 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3002
3367
|
onChange: (e) => apply({ [key]: e.target.value })
|
|
3003
3368
|
}
|
|
3004
3369
|
),
|
|
3005
|
-
on && !hex && /* @__PURE__ */ (0,
|
|
3006
|
-
style?.mixed[key] && /* @__PURE__ */ (0,
|
|
3370
|
+
on && !hex && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: typeof paint === "string" ? paint : "Gradient" }),
|
|
3371
|
+
style?.mixed[key] && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
3007
3372
|
] });
|
|
3008
3373
|
};
|
|
3009
|
-
return /* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "aria-label": style ? "Selection style" : "New shape style", children: [
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: style ? "Selection" : "New shapes" }),
|
|
3011
3376
|
paintRow("fill", "Fill"),
|
|
3012
3377
|
paintRow("stroke", "Stroke"),
|
|
3013
|
-
style && /* @__PURE__ */ (0,
|
|
3014
|
-
/* @__PURE__ */ (0,
|
|
3015
|
-
/* @__PURE__ */ (0,
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3378
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorGradientEditor, { controller }),
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
3380
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Width" }),
|
|
3381
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3017
3382
|
"input",
|
|
3018
3383
|
{
|
|
3019
3384
|
type: "number",
|
|
@@ -3029,14 +3394,14 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3029
3394
|
}
|
|
3030
3395
|
)
|
|
3031
3396
|
] }),
|
|
3032
|
-
/* @__PURE__ */ (0,
|
|
3033
|
-
/* @__PURE__ */ (0,
|
|
3034
|
-
/* @__PURE__ */ (0,
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "strokeAlign", children: [
|
|
3398
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Align" }),
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { "aria-label": "Stroke alignment", className: selectClass14, value: source.strokeAlign, onChange: (e) => apply({ strokeAlign: e.target.value }), children: Object.keys(import_vector20.VECTOR_STROKE_ALIGN_LABELS).map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: a, children: import_vector20.VECTOR_STROKE_ALIGN_LABELS[a] }, a)) }),
|
|
3035
3400
|
mixed("strokeAlign")
|
|
3036
3401
|
] }),
|
|
3037
|
-
/* @__PURE__ */ (0,
|
|
3038
|
-
/* @__PURE__ */ (0,
|
|
3039
|
-
/* @__PURE__ */ (0,
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "widthProfile", children: [
|
|
3403
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Profile" }),
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3040
3405
|
"select",
|
|
3041
3406
|
{
|
|
3042
3407
|
"aria-label": "Width profile",
|
|
@@ -3046,12 +3411,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3046
3411
|
if (e.target.value !== "custom") setProfile(e.target.value);
|
|
3047
3412
|
},
|
|
3048
3413
|
children: [
|
|
3049
|
-
import_vector20.VECTOR_WIDTH_PRESETS.map((p) => /* @__PURE__ */ (0,
|
|
3050
|
-
source.widthProfile === "custom" && /* @__PURE__ */ (0,
|
|
3414
|
+
import_vector20.VECTOR_WIDTH_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: p.id, children: p.label }, p.id)),
|
|
3415
|
+
source.widthProfile === "custom" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "custom", disabled: true, children: "Custom" })
|
|
3051
3416
|
]
|
|
3052
3417
|
}
|
|
3053
3418
|
),
|
|
3054
|
-
/* @__PURE__ */ (0,
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3055
3420
|
"button",
|
|
3056
3421
|
{
|
|
3057
3422
|
type: "button",
|
|
@@ -3065,20 +3430,20 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3065
3430
|
),
|
|
3066
3431
|
mixed("widthProfile")
|
|
3067
3432
|
] }),
|
|
3068
|
-
source.hasOpenPath && /* @__PURE__ */ (0,
|
|
3433
|
+
source.hasOpenPath && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3069
3434
|
arrowRow("start", "Start"),
|
|
3070
3435
|
arrowRow("end", "End"),
|
|
3071
|
-
(source.startArrow || source.endArrow) && /* @__PURE__ */ (0,
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3073
|
-
/* @__PURE__ */ (0,
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3075
|
-
/* @__PURE__ */ (0,
|
|
3436
|
+
(source.startArrow || source.endArrow) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "arrowAlign", children: [
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Heads" }),
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("select", { "aria-label": "Arrowhead alignment", className: selectClass14, value: source.arrowAlign, onChange: (e) => apply({ arrowAlign: e.target.value }), children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "extend", children: "Tip past end" }),
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "tip", children: "Tip at end" })
|
|
3076
3441
|
] })
|
|
3077
3442
|
] })
|
|
3078
3443
|
] }),
|
|
3079
|
-
source.corners > 0 && /* @__PURE__ */ (0,
|
|
3080
|
-
/* @__PURE__ */ (0,
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3444
|
+
source.corners > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": "corners", children: [
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Corners" }),
|
|
3446
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3082
3447
|
"input",
|
|
3083
3448
|
{
|
|
3084
3449
|
type: "number",
|
|
@@ -3093,12 +3458,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3093
3458
|
}
|
|
3094
3459
|
}
|
|
3095
3460
|
),
|
|
3096
|
-
/* @__PURE__ */ (0,
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { "aria-label": "Corner kind", className: selectClass14, value: source.cornerKind, onChange: (e) => setCorners({ kind: e.target.value }), children: import_vector20.VECTOR_CORNER_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: k, children: import_vector20.VECTOR_CORNER_KIND_LABELS[k] }, k)) }),
|
|
3097
3462
|
mixed("cornerRadius")
|
|
3098
3463
|
] }),
|
|
3099
|
-
style && source.corners > 0 && source.cornerKind === "round" && source.cornerRadius > 0 && /* @__PURE__ */ (0,
|
|
3100
|
-
/* @__PURE__ */ (0,
|
|
3101
|
-
/* @__PURE__ */ (0,
|
|
3464
|
+
style && source.corners > 0 && source.cornerKind === "round" && source.cornerRadius > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "corner-smoothing", title: "Corner smoothing: squircle corners that ease into the curve (0.6 is iOS-like)", children: [
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Smoothing" }),
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3102
3467
|
"input",
|
|
3103
3468
|
{
|
|
3104
3469
|
type: "range",
|
|
@@ -3113,9 +3478,9 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3113
3478
|
}
|
|
3114
3479
|
)
|
|
3115
3480
|
] }),
|
|
3116
|
-
style && /* @__PURE__ */ (0,
|
|
3117
|
-
/* @__PURE__ */ (0,
|
|
3118
|
-
/* @__PURE__ */ (0,
|
|
3481
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
3482
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Opacity" }),
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3119
3484
|
"input",
|
|
3120
3485
|
{
|
|
3121
3486
|
type: "range",
|
|
@@ -3129,36 +3494,36 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3129
3494
|
}
|
|
3130
3495
|
)
|
|
3131
3496
|
] }),
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3133
|
-
style && /* @__PURE__ */ (0,
|
|
3134
|
-
style && /* @__PURE__ */ (0,
|
|
3135
|
-
style && /* @__PURE__ */ (0,
|
|
3136
|
-
style && /* @__PURE__ */ (0,
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3138
|
-
/* @__PURE__ */ (0,
|
|
3139
|
-
/* @__PURE__ */ (0,
|
|
3140
|
-
/* @__PURE__ */ (0,
|
|
3141
|
-
/* @__PURE__ */ (0,
|
|
3142
|
-
/* @__PURE__ */ (0,
|
|
3143
|
-
/* @__PURE__ */ (0,
|
|
3144
|
-
/* @__PURE__ */ (0,
|
|
3145
|
-
/* @__PURE__ */ (0,
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorTextPanel, { controller }),
|
|
3498
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorAppearancePanel, { controller }),
|
|
3499
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorEffectsPanel, { controller }),
|
|
3500
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorEnvelopePanel, { controller }),
|
|
3501
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorMaskPanel, { controller }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorFramePanel, { controller }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorPagesPanel, { controller }),
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorConnectorPanel, { controller }),
|
|
3505
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorShadingPanel, { controller }),
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorSymmetryPanel, { controller }),
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorPerspectivePanel, { controller }),
|
|
3508
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorLensPanel, { controller }),
|
|
3509
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorTracePanel, { controller }),
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorConstraintsPanel, { controller }),
|
|
3511
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorSymbolsPanel, { controller })
|
|
3147
3512
|
] });
|
|
3148
3513
|
}
|
|
3149
3514
|
|
|
3150
3515
|
// src/effects/useEffects.ts
|
|
3151
|
-
var
|
|
3516
|
+
var import_react21 = require("react");
|
|
3152
3517
|
function useEffects(host, provider) {
|
|
3153
|
-
(0,
|
|
3518
|
+
(0, import_react21.useEffect)(() => {
|
|
3154
3519
|
if (!host || !provider) return;
|
|
3155
3520
|
return host.useEffects(provider);
|
|
3156
3521
|
}, [host, provider]);
|
|
3157
3522
|
}
|
|
3158
3523
|
function useEffectDescription(provider, effect) {
|
|
3159
|
-
const [state, setState] = (0,
|
|
3524
|
+
const [state, setState] = (0, import_react21.useState)({ key: "", description: null, error: null });
|
|
3160
3525
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
3161
|
-
(0,
|
|
3526
|
+
(0, import_react21.useEffect)(() => {
|
|
3162
3527
|
if (!provider || !effect) return;
|
|
3163
3528
|
let live = true;
|
|
3164
3529
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -3173,14 +3538,14 @@ function useEffectDescription(provider, effect) {
|
|
|
3173
3538
|
}
|
|
3174
3539
|
|
|
3175
3540
|
// src/effects/EffectThumbnail.tsx
|
|
3176
|
-
var
|
|
3541
|
+
var import_react22 = require("react");
|
|
3177
3542
|
var import_effects = require("@pixerate/editor/effects");
|
|
3178
|
-
var
|
|
3543
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3179
3544
|
var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
|
|
3180
3545
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
3181
|
-
const ref = (0,
|
|
3182
|
-
const [failed, setFailed] = (0,
|
|
3183
|
-
(0,
|
|
3546
|
+
const ref = (0, import_react22.useRef)(null);
|
|
3547
|
+
const [failed, setFailed] = (0, import_react22.useState)(effect.kind in LABELS);
|
|
3548
|
+
(0, import_react22.useEffect)(() => {
|
|
3184
3549
|
if (effect.kind in LABELS) return;
|
|
3185
3550
|
let live = true;
|
|
3186
3551
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -3195,28 +3560,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
3195
3560
|
live = false;
|
|
3196
3561
|
};
|
|
3197
3562
|
}, [provider, effect, width, height]);
|
|
3198
|
-
return /* @__PURE__ */ (0,
|
|
3563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3199
3564
|
"div",
|
|
3200
3565
|
{
|
|
3201
3566
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
3202
3567
|
style: { aspectRatio: `${width} / ${height}` },
|
|
3203
3568
|
"data-effect-thumbnail": effect.id,
|
|
3204
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
3569
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
3205
3570
|
}
|
|
3206
3571
|
);
|
|
3207
3572
|
}
|
|
3208
3573
|
|
|
3209
3574
|
// src/effects/EffectsBrowser.tsx
|
|
3210
|
-
var
|
|
3575
|
+
var import_react23 = require("react");
|
|
3211
3576
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
3212
|
-
var
|
|
3577
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3213
3578
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
3214
|
-
const [all, setAll] = (0,
|
|
3215
|
-
const [query, setQuery] = (0,
|
|
3216
|
-
const [category, setCategory] = (0,
|
|
3217
|
-
const [use, setUse] = (0,
|
|
3218
|
-
const [error, setError] = (0,
|
|
3219
|
-
(0,
|
|
3579
|
+
const [all, setAll] = (0, import_react23.useState)([]);
|
|
3580
|
+
const [query, setQuery] = (0, import_react23.useState)("");
|
|
3581
|
+
const [category, setCategory] = (0, import_react23.useState)("");
|
|
3582
|
+
const [use, setUse] = (0, import_react23.useState)("");
|
|
3583
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
3584
|
+
(0, import_react23.useEffect)(() => {
|
|
3220
3585
|
if (!provider) return setAll([]);
|
|
3221
3586
|
let live = true;
|
|
3222
3587
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -3227,8 +3592,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3227
3592
|
live = false;
|
|
3228
3593
|
};
|
|
3229
3594
|
}, [provider]);
|
|
3230
|
-
const [found, setFound] = (0,
|
|
3231
|
-
(0,
|
|
3595
|
+
const [found, setFound] = (0, import_react23.useState)([]);
|
|
3596
|
+
(0, import_react23.useEffect)(() => {
|
|
3232
3597
|
if (!provider) return setFound([]);
|
|
3233
3598
|
let live = true;
|
|
3234
3599
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -3237,14 +3602,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3237
3602
|
};
|
|
3238
3603
|
}, [provider, query, category, use]);
|
|
3239
3604
|
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
3240
|
-
const categories = (0,
|
|
3605
|
+
const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
3241
3606
|
const shown = found.filter(allowed);
|
|
3242
3607
|
if (!provider)
|
|
3243
|
-
return /* @__PURE__ */ (0,
|
|
3244
|
-
return /* @__PURE__ */ (0,
|
|
3245
|
-
title && /* @__PURE__ */ (0,
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
|
|
3609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
3610
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
3611
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
3612
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3248
3613
|
"input",
|
|
3249
3614
|
{
|
|
3250
3615
|
type: "search",
|
|
@@ -3255,17 +3620,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3255
3620
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
3256
3621
|
}
|
|
3257
3622
|
),
|
|
3258
|
-
/* @__PURE__ */ (0,
|
|
3259
|
-
/* @__PURE__ */ (0,
|
|
3260
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "All categories" }),
|
|
3625
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: c, children: c }, c))
|
|
3261
3626
|
] }),
|
|
3262
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
3263
|
-
/* @__PURE__ */ (0,
|
|
3264
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
3627
|
+
uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "Any use" }),
|
|
3629
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
3265
3630
|
] })
|
|
3266
3631
|
] }),
|
|
3267
|
-
error && /* @__PURE__ */ (0,
|
|
3268
|
-
/* @__PURE__ */ (0,
|
|
3632
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3269
3634
|
"button",
|
|
3270
3635
|
{
|
|
3271
3636
|
type: "button",
|
|
@@ -3274,23 +3639,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3274
3639
|
"data-effect-id": e.id,
|
|
3275
3640
|
onClick: () => onPick(e),
|
|
3276
3641
|
children: [
|
|
3277
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
3278
|
-
/* @__PURE__ */ (0,
|
|
3279
|
-
/* @__PURE__ */ (0,
|
|
3642
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
|
|
3280
3645
|
]
|
|
3281
3646
|
}
|
|
3282
3647
|
) }, e.id)) }),
|
|
3283
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
3648
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
3284
3649
|
] });
|
|
3285
3650
|
}
|
|
3286
3651
|
|
|
3287
3652
|
// src/effects/EffectParameters.tsx
|
|
3288
|
-
var
|
|
3653
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
3289
3654
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
3290
3655
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
3291
3656
|
|
|
3292
3657
|
// src/parameters/fields.tsx
|
|
3293
|
-
var
|
|
3658
|
+
var import_react28 = require("react");
|
|
3294
3659
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
3295
3660
|
|
|
3296
3661
|
// src/color/index.ts
|
|
@@ -3303,9 +3668,9 @@ __export(color_exports, {
|
|
|
3303
3668
|
});
|
|
3304
3669
|
|
|
3305
3670
|
// src/color/ColorPicker.tsx
|
|
3306
|
-
var
|
|
3671
|
+
var import_react24 = require("react");
|
|
3307
3672
|
var import_color = require("@pixerate/editor/color");
|
|
3308
|
-
var
|
|
3673
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3309
3674
|
var LOCAL_STORAGE_KEY = "pixerate:color:recent";
|
|
3310
3675
|
function readLocalRecents() {
|
|
3311
3676
|
try {
|
|
@@ -3343,24 +3708,24 @@ var ColorPicker = ({
|
|
|
3343
3708
|
id,
|
|
3344
3709
|
"aria-label": ariaLabel = "Color picker"
|
|
3345
3710
|
}) => {
|
|
3346
|
-
const generatedId = (0,
|
|
3711
|
+
const generatedId = (0, import_react24.useId)();
|
|
3347
3712
|
const pickerId = id || generatedId;
|
|
3348
|
-
const [pickerState, setPickerState] = (0,
|
|
3713
|
+
const [pickerState, setPickerState] = (0, import_react24.useState)(
|
|
3349
3714
|
() => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
|
|
3350
3715
|
);
|
|
3351
|
-
const stateRef = (0,
|
|
3716
|
+
const stateRef = (0, import_react24.useRef)(pickerState);
|
|
3352
3717
|
stateRef.current = pickerState;
|
|
3353
|
-
(0,
|
|
3718
|
+
(0, import_react24.useEffect)(() => {
|
|
3354
3719
|
const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
|
|
3355
3720
|
if (next) {
|
|
3356
3721
|
setPickerState(next);
|
|
3357
3722
|
}
|
|
3358
3723
|
}, [value]);
|
|
3359
|
-
const [internalRecent, setInternalRecent] = (0,
|
|
3724
|
+
const [internalRecent, setInternalRecent] = (0, import_react24.useState)(
|
|
3360
3725
|
() => controlledRecent ? [] : readLocalRecents()
|
|
3361
3726
|
);
|
|
3362
3727
|
const activeRecent = controlledRecent ?? internalRecent;
|
|
3363
|
-
const recordRecent = (0,
|
|
3728
|
+
const recordRecent = (0, import_react24.useCallback)(
|
|
3364
3729
|
(color) => {
|
|
3365
3730
|
const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
|
|
3366
3731
|
if (!controlledRecent) {
|
|
@@ -3371,11 +3736,11 @@ var ColorPicker = ({
|
|
|
3371
3736
|
},
|
|
3372
3737
|
[activeRecent, controlledRecent, onRecentChange]
|
|
3373
3738
|
);
|
|
3374
|
-
const [textDraft, setTextDraft] = (0,
|
|
3375
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
3376
|
-
const [isClipped, setIsClipped] = (0,
|
|
3377
|
-
const isTypingRef = (0,
|
|
3378
|
-
(0,
|
|
3739
|
+
const [textDraft, setTextDraft] = (0, import_react24.useState)(value);
|
|
3740
|
+
const [isInvalid, setIsInvalid] = (0, import_react24.useState)(false);
|
|
3741
|
+
const [isClipped, setIsClipped] = (0, import_react24.useState)(false);
|
|
3742
|
+
const isTypingRef = (0, import_react24.useRef)(false);
|
|
3743
|
+
(0, import_react24.useEffect)(() => {
|
|
3379
3744
|
if (!isTypingRef.current) {
|
|
3380
3745
|
setTextDraft(value);
|
|
3381
3746
|
setIsInvalid(false);
|
|
@@ -3383,11 +3748,11 @@ var ColorPicker = ({
|
|
|
3383
3748
|
setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
|
|
3384
3749
|
}
|
|
3385
3750
|
}, [value]);
|
|
3386
|
-
const [hasEyeDropper, setHasEyeDropper] = (0,
|
|
3387
|
-
(0,
|
|
3751
|
+
const [hasEyeDropper, setHasEyeDropper] = (0, import_react24.useState)(false);
|
|
3752
|
+
(0, import_react24.useEffect)(() => {
|
|
3388
3753
|
setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
|
|
3389
3754
|
}, []);
|
|
3390
|
-
const emitColorChange = (0,
|
|
3755
|
+
const emitColorChange = (0, import_react24.useCallback)(
|
|
3391
3756
|
(nextState) => {
|
|
3392
3757
|
setPickerState(nextState);
|
|
3393
3758
|
const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
|
|
@@ -3395,10 +3760,10 @@ var ColorPicker = ({
|
|
|
3395
3760
|
},
|
|
3396
3761
|
[alpha, onChange]
|
|
3397
3762
|
);
|
|
3398
|
-
const latest = (0,
|
|
3763
|
+
const latest = (0, import_react24.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
|
|
3399
3764
|
latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
|
|
3400
|
-
const endDragRef = (0,
|
|
3401
|
-
(0,
|
|
3765
|
+
const endDragRef = (0, import_react24.useRef)(null);
|
|
3766
|
+
(0, import_react24.useEffect)(() => () => endDragRef.current?.(), []);
|
|
3402
3767
|
const startDrag = (e, next) => {
|
|
3403
3768
|
if (disabled) return;
|
|
3404
3769
|
e.preventDefault();
|
|
@@ -3500,7 +3865,7 @@ var ColorPicker = ({
|
|
|
3500
3865
|
} catch {
|
|
3501
3866
|
}
|
|
3502
3867
|
};
|
|
3503
|
-
const contrastResult = (0,
|
|
3868
|
+
const contrastResult = (0, import_react24.useMemo)(() => {
|
|
3504
3869
|
if (!contrastAgainst) return null;
|
|
3505
3870
|
const fg = (0, import_color.parseColor)(value);
|
|
3506
3871
|
const bg = (0, import_color.parseColor)(contrastAgainst);
|
|
@@ -3512,7 +3877,7 @@ var ColorPicker = ({
|
|
|
3512
3877
|
}, [value, contrastAgainst]);
|
|
3513
3878
|
const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
|
|
3514
3879
|
const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
|
|
3515
|
-
return /* @__PURE__ */ (0,
|
|
3880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3516
3881
|
"div",
|
|
3517
3882
|
{
|
|
3518
3883
|
id: pickerId,
|
|
@@ -3536,7 +3901,7 @@ var ColorPicker = ({
|
|
|
3536
3901
|
pointerEvents: disabled ? "none" : "auto"
|
|
3537
3902
|
},
|
|
3538
3903
|
children: [
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3904
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3540
3905
|
"span",
|
|
3541
3906
|
{
|
|
3542
3907
|
role: "status",
|
|
@@ -3555,7 +3920,7 @@ var ColorPicker = ({
|
|
|
3555
3920
|
children: liveDescription
|
|
3556
3921
|
}
|
|
3557
3922
|
),
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
3923
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3559
3924
|
"div",
|
|
3560
3925
|
{
|
|
3561
3926
|
role: "slider",
|
|
@@ -3577,7 +3942,7 @@ var ColorPicker = ({
|
|
|
3577
3942
|
touchAction: "none",
|
|
3578
3943
|
outline: "none"
|
|
3579
3944
|
},
|
|
3580
|
-
children: /* @__PURE__ */ (0,
|
|
3945
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3581
3946
|
"div",
|
|
3582
3947
|
{
|
|
3583
3948
|
style: {
|
|
@@ -3597,7 +3962,7 @@ var ColorPicker = ({
|
|
|
3597
3962
|
)
|
|
3598
3963
|
}
|
|
3599
3964
|
),
|
|
3600
|
-
/* @__PURE__ */ (0,
|
|
3965
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3601
3966
|
"div",
|
|
3602
3967
|
{
|
|
3603
3968
|
role: "slider",
|
|
@@ -3620,7 +3985,7 @@ var ColorPicker = ({
|
|
|
3620
3985
|
touchAction: "none",
|
|
3621
3986
|
outline: "none"
|
|
3622
3987
|
},
|
|
3623
|
-
children: /* @__PURE__ */ (0,
|
|
3988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3624
3989
|
"div",
|
|
3625
3990
|
{
|
|
3626
3991
|
style: {
|
|
@@ -3640,7 +4005,7 @@ var ColorPicker = ({
|
|
|
3640
4005
|
)
|
|
3641
4006
|
}
|
|
3642
4007
|
),
|
|
3643
|
-
alpha && /* @__PURE__ */ (0,
|
|
4008
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3644
4009
|
"div",
|
|
3645
4010
|
{
|
|
3646
4011
|
role: "slider",
|
|
@@ -3666,7 +4031,7 @@ var ColorPicker = ({
|
|
|
3666
4031
|
overflow: "hidden"
|
|
3667
4032
|
},
|
|
3668
4033
|
children: [
|
|
3669
|
-
/* @__PURE__ */ (0,
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3670
4035
|
"div",
|
|
3671
4036
|
{
|
|
3672
4037
|
style: {
|
|
@@ -3676,7 +4041,7 @@ var ColorPicker = ({
|
|
|
3676
4041
|
}
|
|
3677
4042
|
}
|
|
3678
4043
|
),
|
|
3679
|
-
/* @__PURE__ */ (0,
|
|
4044
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3680
4045
|
"div",
|
|
3681
4046
|
{
|
|
3682
4047
|
style: {
|
|
@@ -3697,8 +4062,8 @@ var ColorPicker = ({
|
|
|
3697
4062
|
]
|
|
3698
4063
|
}
|
|
3699
4064
|
),
|
|
3700
|
-
/* @__PURE__ */ (0,
|
|
3701
|
-
/* @__PURE__ */ (0,
|
|
4065
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
|
|
4066
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3702
4067
|
"div",
|
|
3703
4068
|
{
|
|
3704
4069
|
style: {
|
|
@@ -3712,7 +4077,7 @@ var ColorPicker = ({
|
|
|
3712
4077
|
flexShrink: 0,
|
|
3713
4078
|
border: "1px solid rgba(255,255,255,0.15)"
|
|
3714
4079
|
},
|
|
3715
|
-
children: /* @__PURE__ */ (0,
|
|
4080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3716
4081
|
"div",
|
|
3717
4082
|
{
|
|
3718
4083
|
style: {
|
|
@@ -3724,7 +4089,7 @@ var ColorPicker = ({
|
|
|
3724
4089
|
)
|
|
3725
4090
|
}
|
|
3726
4091
|
),
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
4092
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3728
4093
|
"input",
|
|
3729
4094
|
{
|
|
3730
4095
|
type: "text",
|
|
@@ -3754,7 +4119,7 @@ var ColorPicker = ({
|
|
|
3754
4119
|
}
|
|
3755
4120
|
}
|
|
3756
4121
|
),
|
|
3757
|
-
hasEyeDropper && /* @__PURE__ */ (0,
|
|
4122
|
+
hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3758
4123
|
"button",
|
|
3759
4124
|
{
|
|
3760
4125
|
type: "button",
|
|
@@ -3774,7 +4139,7 @@ var ColorPicker = ({
|
|
|
3774
4139
|
color: "inherit",
|
|
3775
4140
|
cursor: disabled ? "default" : "pointer"
|
|
3776
4141
|
},
|
|
3777
|
-
children: /* @__PURE__ */ (0,
|
|
4142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3778
4143
|
"svg",
|
|
3779
4144
|
{
|
|
3780
4145
|
width: "14",
|
|
@@ -3786,16 +4151,16 @@ var ColorPicker = ({
|
|
|
3786
4151
|
strokeLinecap: "round",
|
|
3787
4152
|
strokeLinejoin: "round",
|
|
3788
4153
|
children: [
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3790
|
-
/* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
4154
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
|
|
4155
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 6 4 4" })
|
|
3792
4157
|
]
|
|
3793
4158
|
}
|
|
3794
4159
|
)
|
|
3795
4160
|
}
|
|
3796
4161
|
)
|
|
3797
4162
|
] }),
|
|
3798
|
-
isClipped && /* @__PURE__ */ (0,
|
|
4163
|
+
isClipped && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3799
4164
|
"div",
|
|
3800
4165
|
{
|
|
3801
4166
|
role: "note",
|
|
@@ -3811,10 +4176,10 @@ var ColorPicker = ({
|
|
|
3811
4176
|
borderRadius: "4px",
|
|
3812
4177
|
alignSelf: "flex-start"
|
|
3813
4178
|
},
|
|
3814
|
-
children: /* @__PURE__ */ (0,
|
|
4179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
|
|
3815
4180
|
}
|
|
3816
4181
|
),
|
|
3817
|
-
contrastResult && /* @__PURE__ */ (0,
|
|
4182
|
+
contrastResult && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3818
4183
|
"div",
|
|
3819
4184
|
{
|
|
3820
4185
|
style: {
|
|
@@ -3828,15 +4193,15 @@ var ColorPicker = ({
|
|
|
3828
4193
|
border: "1px solid rgba(255,255,255,0.1)"
|
|
3829
4194
|
},
|
|
3830
4195
|
children: [
|
|
3831
|
-
/* @__PURE__ */ (0,
|
|
4196
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
|
|
3832
4197
|
"Contrast: ",
|
|
3833
|
-
/* @__PURE__ */ (0,
|
|
4198
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { children: [
|
|
3834
4199
|
contrastResult.ratio.toFixed(2),
|
|
3835
4200
|
":1"
|
|
3836
4201
|
] })
|
|
3837
4202
|
] }),
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3840
4205
|
"span",
|
|
3841
4206
|
{
|
|
3842
4207
|
style: {
|
|
@@ -3849,7 +4214,7 @@ var ColorPicker = ({
|
|
|
3849
4214
|
]
|
|
3850
4215
|
}
|
|
3851
4216
|
),
|
|
3852
|
-
/* @__PURE__ */ (0,
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3853
4218
|
"span",
|
|
3854
4219
|
{
|
|
3855
4220
|
style: {
|
|
@@ -3866,9 +4231,9 @@ var ColorPicker = ({
|
|
|
3866
4231
|
]
|
|
3867
4232
|
}
|
|
3868
4233
|
),
|
|
3869
|
-
swatches && swatches.length > 0 && /* @__PURE__ */ (0,
|
|
3870
|
-
/* @__PURE__ */ (0,
|
|
3871
|
-
/* @__PURE__ */ (0,
|
|
4234
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
4235
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
|
|
4236
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3872
4237
|
"button",
|
|
3873
4238
|
{
|
|
3874
4239
|
type: "button",
|
|
@@ -3894,9 +4259,9 @@ var ColorPicker = ({
|
|
|
3894
4259
|
`${color}-${idx}`
|
|
3895
4260
|
)) })
|
|
3896
4261
|
] }),
|
|
3897
|
-
activeRecent.length > 0 && /* @__PURE__ */ (0,
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
4262
|
+
activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
4263
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3900
4265
|
"button",
|
|
3901
4266
|
{
|
|
3902
4267
|
type: "button",
|
|
@@ -3927,9 +4292,9 @@ var ColorPicker = ({
|
|
|
3927
4292
|
};
|
|
3928
4293
|
|
|
3929
4294
|
// src/color/DualColorPicker.tsx
|
|
3930
|
-
var
|
|
4295
|
+
var import_react25 = require("react");
|
|
3931
4296
|
var import_color2 = require("@pixerate/editor/color");
|
|
3932
|
-
var
|
|
4297
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3933
4298
|
function DualColorPicker({
|
|
3934
4299
|
value,
|
|
3935
4300
|
onChange,
|
|
@@ -3944,8 +4309,8 @@ function DualColorPicker({
|
|
|
3944
4309
|
disabled = false,
|
|
3945
4310
|
className = ""
|
|
3946
4311
|
}) {
|
|
3947
|
-
const sameId = (0,
|
|
3948
|
-
const [internalScheme, setInternalScheme] = (0,
|
|
4312
|
+
const sameId = (0, import_react25.useId)();
|
|
4313
|
+
const [internalScheme, setInternalScheme] = (0, import_react25.useState)("light");
|
|
3949
4314
|
const activeScheme = controlledScheme ?? internalScheme;
|
|
3950
4315
|
const handleSchemeSelect = (nextScheme) => {
|
|
3951
4316
|
if (onSchemeChange) {
|
|
@@ -3956,7 +4321,7 @@ function DualColorPicker({
|
|
|
3956
4321
|
};
|
|
3957
4322
|
const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
|
|
3958
4323
|
const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
|
|
3959
|
-
const [sameInBoth, setSameInBoth] = (0,
|
|
4324
|
+
const [sameInBoth, setSameInBoth] = (0, import_react25.useState)(isSame);
|
|
3960
4325
|
const handleSameToggle = (e) => {
|
|
3961
4326
|
const nextSame = e.target.checked;
|
|
3962
4327
|
setSameInBoth(nextSame);
|
|
@@ -3988,7 +4353,7 @@ function DualColorPicker({
|
|
|
3988
4353
|
const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
|
|
3989
4354
|
const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
|
|
3990
4355
|
const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
|
|
3991
|
-
return /* @__PURE__ */ (0,
|
|
4356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3992
4357
|
"div",
|
|
3993
4358
|
{
|
|
3994
4359
|
className: `pixerate-dual-color-picker ${className}`,
|
|
@@ -4007,7 +4372,7 @@ function DualColorPicker({
|
|
|
4007
4372
|
boxSizing: "border-box"
|
|
4008
4373
|
},
|
|
4009
4374
|
children: [
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4011
4376
|
"div",
|
|
4012
4377
|
{
|
|
4013
4378
|
role: "tablist",
|
|
@@ -4020,7 +4385,7 @@ function DualColorPicker({
|
|
|
4020
4385
|
gap: "2px"
|
|
4021
4386
|
},
|
|
4022
4387
|
children: [
|
|
4023
|
-
/* @__PURE__ */ (0,
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4024
4389
|
"button",
|
|
4025
4390
|
{
|
|
4026
4391
|
type: "button",
|
|
@@ -4043,7 +4408,7 @@ function DualColorPicker({
|
|
|
4043
4408
|
children: "Light"
|
|
4044
4409
|
}
|
|
4045
4410
|
),
|
|
4046
|
-
/* @__PURE__ */ (0,
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4047
4412
|
"button",
|
|
4048
4413
|
{
|
|
4049
4414
|
type: "button",
|
|
@@ -4069,8 +4434,8 @@ function DualColorPicker({
|
|
|
4069
4434
|
]
|
|
4070
4435
|
}
|
|
4071
4436
|
),
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4073
|
-
/* @__PURE__ */ (0,
|
|
4437
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
4438
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4074
4439
|
"button",
|
|
4075
4440
|
{
|
|
4076
4441
|
type: "button",
|
|
@@ -4092,7 +4457,7 @@ function DualColorPicker({
|
|
|
4092
4457
|
outline: "none"
|
|
4093
4458
|
},
|
|
4094
4459
|
children: [
|
|
4095
|
-
/* @__PURE__ */ (0,
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4096
4461
|
"span",
|
|
4097
4462
|
{
|
|
4098
4463
|
style: {
|
|
@@ -4104,11 +4469,11 @@ function DualColorPicker({
|
|
|
4104
4469
|
}
|
|
4105
4470
|
}
|
|
4106
4471
|
),
|
|
4107
|
-
/* @__PURE__ */ (0,
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
|
|
4108
4473
|
]
|
|
4109
4474
|
}
|
|
4110
4475
|
),
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4112
4477
|
"button",
|
|
4113
4478
|
{
|
|
4114
4479
|
type: "button",
|
|
@@ -4130,7 +4495,7 @@ function DualColorPicker({
|
|
|
4130
4495
|
outline: "none"
|
|
4131
4496
|
},
|
|
4132
4497
|
children: [
|
|
4133
|
-
/* @__PURE__ */ (0,
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4134
4499
|
"span",
|
|
4135
4500
|
{
|
|
4136
4501
|
style: {
|
|
@@ -4142,12 +4507,12 @@ function DualColorPicker({
|
|
|
4142
4507
|
}
|
|
4143
4508
|
}
|
|
4144
4509
|
),
|
|
4145
|
-
/* @__PURE__ */ (0,
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
|
|
4146
4511
|
]
|
|
4147
4512
|
}
|
|
4148
4513
|
)
|
|
4149
4514
|
] }),
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4515
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4151
4516
|
"div",
|
|
4152
4517
|
{
|
|
4153
4518
|
style: {
|
|
@@ -4158,7 +4523,7 @@ function DualColorPicker({
|
|
|
4158
4523
|
padding: "2px 0"
|
|
4159
4524
|
},
|
|
4160
4525
|
children: [
|
|
4161
|
-
/* @__PURE__ */ (0,
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4162
4527
|
"label",
|
|
4163
4528
|
{
|
|
4164
4529
|
htmlFor: sameId,
|
|
@@ -4172,7 +4537,7 @@ function DualColorPicker({
|
|
|
4172
4537
|
color: "#c4cad4"
|
|
4173
4538
|
},
|
|
4174
4539
|
children: [
|
|
4175
|
-
/* @__PURE__ */ (0,
|
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4176
4541
|
"input",
|
|
4177
4542
|
{
|
|
4178
4543
|
id: sameId,
|
|
@@ -4183,11 +4548,11 @@ function DualColorPicker({
|
|
|
4183
4548
|
style: { cursor: disabled ? "not-allowed" : "pointer" }
|
|
4184
4549
|
}
|
|
4185
4550
|
),
|
|
4186
|
-
/* @__PURE__ */ (0,
|
|
4551
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Same in both" })
|
|
4187
4552
|
]
|
|
4188
4553
|
}
|
|
4189
4554
|
),
|
|
4190
|
-
/* @__PURE__ */ (0,
|
|
4555
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4191
4556
|
"button",
|
|
4192
4557
|
{
|
|
4193
4558
|
type: "button",
|
|
@@ -4209,7 +4574,7 @@ function DualColorPicker({
|
|
|
4209
4574
|
]
|
|
4210
4575
|
}
|
|
4211
4576
|
),
|
|
4212
|
-
dualContrast && /* @__PURE__ */ (0,
|
|
4577
|
+
dualContrast && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4213
4578
|
"div",
|
|
4214
4579
|
{
|
|
4215
4580
|
"data-testid": "dual-contrast-summary",
|
|
@@ -4223,20 +4588,20 @@ function DualColorPicker({
|
|
|
4223
4588
|
color: "#8c95a6"
|
|
4224
4589
|
},
|
|
4225
4590
|
children: [
|
|
4226
|
-
/* @__PURE__ */ (0,
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
4227
4592
|
"Light:",
|
|
4228
4593
|
" ",
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4594
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
4230
4595
|
dualContrast.light.ratio.toFixed(2),
|
|
4231
4596
|
" (",
|
|
4232
4597
|
dualContrast.light.level,
|
|
4233
4598
|
")"
|
|
4234
4599
|
] })
|
|
4235
4600
|
] }),
|
|
4236
|
-
/* @__PURE__ */ (0,
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
4237
4602
|
"Dark:",
|
|
4238
4603
|
" ",
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
4240
4605
|
dualContrast.dark.ratio.toFixed(2),
|
|
4241
4606
|
" (",
|
|
4242
4607
|
dualContrast.dark.level,
|
|
@@ -4246,7 +4611,7 @@ function DualColorPicker({
|
|
|
4246
4611
|
]
|
|
4247
4612
|
}
|
|
4248
4613
|
),
|
|
4249
|
-
/* @__PURE__ */ (0,
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4250
4615
|
ColorPicker,
|
|
4251
4616
|
{
|
|
4252
4617
|
value: activeColor,
|
|
@@ -4265,7 +4630,7 @@ function DualColorPicker({
|
|
|
4265
4630
|
}
|
|
4266
4631
|
|
|
4267
4632
|
// src/color/useColorScheme.ts
|
|
4268
|
-
var
|
|
4633
|
+
var import_react26 = require("react");
|
|
4269
4634
|
var import_color3 = require("@pixerate/editor/color");
|
|
4270
4635
|
function getSnapshot(attribute) {
|
|
4271
4636
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
@@ -4290,7 +4655,7 @@ function getServerSnapshot() {
|
|
|
4290
4655
|
function useColorScheme(options) {
|
|
4291
4656
|
const override = options?.override;
|
|
4292
4657
|
const attribute = options?.attribute;
|
|
4293
|
-
const subscribe = (0,
|
|
4658
|
+
const subscribe = (0, import_react26.useMemo)(() => {
|
|
4294
4659
|
return (callback) => {
|
|
4295
4660
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
4296
4661
|
return () => {
|
|
@@ -4316,7 +4681,7 @@ function useColorScheme(options) {
|
|
|
4316
4681
|
};
|
|
4317
4682
|
};
|
|
4318
4683
|
}, [attribute]);
|
|
4319
|
-
const detected = (0,
|
|
4684
|
+
const detected = (0, import_react26.useSyncExternalStore)(
|
|
4320
4685
|
subscribe,
|
|
4321
4686
|
() => getSnapshot(attribute),
|
|
4322
4687
|
getServerSnapshot
|
|
@@ -4333,11 +4698,11 @@ function useResolvedColor(value, scheme) {
|
|
|
4333
4698
|
__reExport(color_exports, require("@pixerate/editor/color"));
|
|
4334
4699
|
|
|
4335
4700
|
// src/parameters/controls.tsx
|
|
4336
|
-
var
|
|
4337
|
-
var
|
|
4338
|
-
var ParameterComponentsContext = (0,
|
|
4701
|
+
var import_react27 = require("react");
|
|
4702
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4703
|
+
var ParameterComponentsContext = (0, import_react27.createContext)({});
|
|
4339
4704
|
function useParameterComponents() {
|
|
4340
|
-
return (0,
|
|
4705
|
+
return (0, import_react27.useContext)(ParameterComponentsContext);
|
|
4341
4706
|
}
|
|
4342
4707
|
function resolveParameterComponents(explicit, context) {
|
|
4343
4708
|
return {
|
|
@@ -4349,7 +4714,7 @@ function resolveParameterComponents(explicit, context) {
|
|
|
4349
4714
|
}
|
|
4350
4715
|
|
|
4351
4716
|
// src/parameters/fields.tsx
|
|
4352
|
-
var
|
|
4717
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4353
4718
|
var parameterInputStyle = import_parameters.parameterThemeStyles.input;
|
|
4354
4719
|
var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
|
|
4355
4720
|
var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
|
|
@@ -4358,9 +4723,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
|
|
|
4358
4723
|
var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
|
|
4359
4724
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
4360
4725
|
function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
|
|
4361
|
-
const inputRef = (0,
|
|
4362
|
-
const lastCommitted = (0,
|
|
4363
|
-
(0,
|
|
4726
|
+
const inputRef = (0, import_react28.useRef)(null);
|
|
4727
|
+
const lastCommitted = (0, import_react28.useRef)(null);
|
|
4728
|
+
(0, import_react28.useLayoutEffect)(() => {
|
|
4364
4729
|
lastCommitted.current = null;
|
|
4365
4730
|
const el = inputRef.current;
|
|
4366
4731
|
if (el && el.value !== value) el.value = value;
|
|
@@ -4371,9 +4736,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
4371
4736
|
onCommit(text, el);
|
|
4372
4737
|
lastCommitted.current = el.value === text ? text : null;
|
|
4373
4738
|
};
|
|
4374
|
-
const commitRef = (0,
|
|
4739
|
+
const commitRef = (0, import_react28.useRef)(commit);
|
|
4375
4740
|
commitRef.current = commit;
|
|
4376
|
-
(0,
|
|
4741
|
+
(0, import_react28.useEffect)(() => {
|
|
4377
4742
|
const el = inputRef.current;
|
|
4378
4743
|
if (!el) return;
|
|
4379
4744
|
const change = () => commitRef.current(el);
|
|
@@ -4404,7 +4769,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
4404
4769
|
if (typeof forwarded === "function") forwarded(el);
|
|
4405
4770
|
else if (forwarded) forwarded.current = el;
|
|
4406
4771
|
};
|
|
4407
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
4772
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "text", ...props, ref: setRef });
|
|
4408
4773
|
}
|
|
4409
4774
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
4410
4775
|
function ParameterNumberInput(props) {
|
|
@@ -4438,9 +4803,9 @@ function ParameterNumberInput(props) {
|
|
|
4438
4803
|
onCommit: handleCommit,
|
|
4439
4804
|
onKeyDown: handleKeyDown
|
|
4440
4805
|
};
|
|
4441
|
-
return /* @__PURE__ */ (0,
|
|
4442
|
-
CustomInput ? /* @__PURE__ */ (0,
|
|
4443
|
-
field.unit && /* @__PURE__ */ (0,
|
|
4806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
4807
|
+
CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterCommitInput, { ...inputProps }),
|
|
4808
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
4444
4809
|
] });
|
|
4445
4810
|
}
|
|
4446
4811
|
function ParameterSlider(props) {
|
|
@@ -4448,7 +4813,7 @@ function ParameterSlider(props) {
|
|
|
4448
4813
|
const ctx = useParameterComponents();
|
|
4449
4814
|
const resolved = resolveParameterComponents(components, ctx);
|
|
4450
4815
|
const CustomSlider = resolved.slider;
|
|
4451
|
-
const dragging = (0,
|
|
4816
|
+
const dragging = (0, import_react28.useRef)(false);
|
|
4452
4817
|
const start = () => {
|
|
4453
4818
|
if (dragging.current) return;
|
|
4454
4819
|
dragging.current = true;
|
|
@@ -4459,7 +4824,7 @@ function ParameterSlider(props) {
|
|
|
4459
4824
|
dragging.current = false;
|
|
4460
4825
|
onGestureEnd?.();
|
|
4461
4826
|
};
|
|
4462
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
4827
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props });
|
|
4463
4828
|
const step = (0, import_parameters.parameterStep)(field);
|
|
4464
4829
|
const sliderProps = {
|
|
4465
4830
|
"aria-label": (0, import_parameters.parameterLabel)(field),
|
|
@@ -4473,8 +4838,8 @@ function ParameterSlider(props) {
|
|
|
4473
4838
|
className: rangeClass,
|
|
4474
4839
|
style: parameterRangeStyle
|
|
4475
4840
|
};
|
|
4476
|
-
return /* @__PURE__ */ (0,
|
|
4477
|
-
CustomSlider ? /* @__PURE__ */ (0,
|
|
4841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4842
|
+
CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4478
4843
|
CustomSlider,
|
|
4479
4844
|
{
|
|
4480
4845
|
...sliderProps,
|
|
@@ -4484,7 +4849,7 @@ function ParameterSlider(props) {
|
|
|
4484
4849
|
onGestureStart: start,
|
|
4485
4850
|
onGestureEnd: end
|
|
4486
4851
|
}
|
|
4487
|
-
) : /* @__PURE__ */ (0,
|
|
4852
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4488
4853
|
"input",
|
|
4489
4854
|
{
|
|
4490
4855
|
type: "range",
|
|
@@ -4496,11 +4861,11 @@ function ParameterSlider(props) {
|
|
|
4496
4861
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
4497
4862
|
}
|
|
4498
4863
|
),
|
|
4499
|
-
/* @__PURE__ */ (0,
|
|
4864
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
4500
4865
|
] });
|
|
4501
4866
|
}
|
|
4502
4867
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
4503
|
-
return /* @__PURE__ */ (0,
|
|
4868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4504
4869
|
"button",
|
|
4505
4870
|
{
|
|
4506
4871
|
type: "button",
|
|
@@ -4511,7 +4876,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
4511
4876
|
disabled: disabled || field.readOnly,
|
|
4512
4877
|
onClick: () => onChange(!value),
|
|
4513
4878
|
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
|
|
4514
|
-
children: /* @__PURE__ */ (0,
|
|
4879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4515
4880
|
"span",
|
|
4516
4881
|
{
|
|
4517
4882
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -4528,7 +4893,7 @@ function ParameterSelect(props) {
|
|
|
4528
4893
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
4529
4894
|
const off = disabled || field.readOnly;
|
|
4530
4895
|
if (field.control === "segmented") {
|
|
4531
|
-
return /* @__PURE__ */ (0,
|
|
4896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4532
4897
|
"button",
|
|
4533
4898
|
{
|
|
4534
4899
|
type: "button",
|
|
@@ -4545,7 +4910,7 @@ function ParameterSelect(props) {
|
|
|
4545
4910
|
}
|
|
4546
4911
|
if (CustomSelect) {
|
|
4547
4912
|
const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
|
|
4548
|
-
return /* @__PURE__ */ (0,
|
|
4913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4549
4914
|
CustomSelect,
|
|
4550
4915
|
{
|
|
4551
4916
|
id,
|
|
@@ -4561,7 +4926,7 @@ function ParameterSelect(props) {
|
|
|
4561
4926
|
);
|
|
4562
4927
|
}
|
|
4563
4928
|
const index = options.findIndex((o) => o.value === value);
|
|
4564
|
-
return /* @__PURE__ */ (0,
|
|
4929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4565
4930
|
"select",
|
|
4566
4931
|
{
|
|
4567
4932
|
id,
|
|
@@ -4574,23 +4939,23 @@ function ParameterSelect(props) {
|
|
|
4574
4939
|
},
|
|
4575
4940
|
className: parameterInputClass,
|
|
4576
4941
|
style: parameterSelectStyle,
|
|
4577
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
4942
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
4578
4943
|
}
|
|
4579
4944
|
);
|
|
4580
4945
|
}
|
|
4581
4946
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
|
|
4582
4947
|
const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
|
|
4583
|
-
const [open, setOpen] = (0,
|
|
4584
|
-
const containerRef = (0,
|
|
4585
|
-
const buttonRef = (0,
|
|
4586
|
-
const popoverRef = (0,
|
|
4948
|
+
const [open, setOpen] = (0, import_react28.useState)(false);
|
|
4949
|
+
const containerRef = (0, import_react28.useRef)(null);
|
|
4950
|
+
const buttonRef = (0, import_react28.useRef)(null);
|
|
4951
|
+
const popoverRef = (0, import_react28.useRef)(null);
|
|
4587
4952
|
const alpha = !!field.alpha;
|
|
4588
4953
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
4589
4954
|
const rgb = hex.slice(0, 7);
|
|
4590
4955
|
const shown = alpha ? hex : rgb;
|
|
4591
4956
|
const off = disabled || field.readOnly;
|
|
4592
4957
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
4593
|
-
(0,
|
|
4958
|
+
(0, import_react28.useEffect)(() => {
|
|
4594
4959
|
if (!open) return;
|
|
4595
4960
|
const onPointerDown = (e) => {
|
|
4596
4961
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -4612,7 +4977,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4612
4977
|
};
|
|
4613
4978
|
}, [open]);
|
|
4614
4979
|
if (CustomColor) {
|
|
4615
|
-
return /* @__PURE__ */ (0,
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4616
4981
|
CustomColor,
|
|
4617
4982
|
{
|
|
4618
4983
|
id,
|
|
@@ -4627,9 +4992,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4627
4992
|
}
|
|
4628
4993
|
);
|
|
4629
4994
|
}
|
|
4630
|
-
return /* @__PURE__ */ (0,
|
|
4631
|
-
/* @__PURE__ */ (0,
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
4995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4633
4998
|
"button",
|
|
4634
4999
|
{
|
|
4635
5000
|
ref: buttonRef,
|
|
@@ -4640,10 +5005,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4640
5005
|
disabled: off,
|
|
4641
5006
|
onClick: () => setOpen((prev) => !prev),
|
|
4642
5007
|
className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
4643
|
-
children: /* @__PURE__ */ (0,
|
|
5008
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
|
|
4644
5009
|
}
|
|
4645
5010
|
),
|
|
4646
|
-
/* @__PURE__ */ (0,
|
|
5011
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4647
5012
|
ParameterCommitInput,
|
|
4648
5013
|
{
|
|
4649
5014
|
id,
|
|
@@ -4659,7 +5024,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4659
5024
|
}
|
|
4660
5025
|
)
|
|
4661
5026
|
] }),
|
|
4662
|
-
open && /* @__PURE__ */ (0,
|
|
5027
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4663
5028
|
"div",
|
|
4664
5029
|
{
|
|
4665
5030
|
ref: popoverRef,
|
|
@@ -4673,7 +5038,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4673
5038
|
},
|
|
4674
5039
|
className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
|
|
4675
5040
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
4676
|
-
children: /* @__PURE__ */ (0,
|
|
5041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4677
5042
|
ColorPicker,
|
|
4678
5043
|
{
|
|
4679
5044
|
value: shown,
|
|
@@ -4691,11 +5056,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4691
5056
|
}
|
|
4692
5057
|
function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
4693
5058
|
const size = (0, import_parameters.vectorSize)(field);
|
|
4694
|
-
return /* @__PURE__ */ (0,
|
|
5059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
4695
5060
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
4696
|
-
return /* @__PURE__ */ (0,
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4698
|
-
/* @__PURE__ */ (0,
|
|
5061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
5062
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
5063
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4699
5064
|
ParameterNumberInput,
|
|
4700
5065
|
{
|
|
4701
5066
|
field: component,
|
|
@@ -4713,11 +5078,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
|
4713
5078
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
4714
5079
|
const off = disabled || field.readOnly;
|
|
4715
5080
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
4716
|
-
return /* @__PURE__ */ (0,
|
|
4717
|
-
/* @__PURE__ */ (0,
|
|
4718
|
-
/* @__PURE__ */ (0,
|
|
4719
|
-
/* @__PURE__ */ (0,
|
|
4720
|
-
/* @__PURE__ */ (0,
|
|
5081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1.5", children: [
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5083
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
5084
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4721
5086
|
ParameterCommitInput,
|
|
4722
5087
|
{
|
|
4723
5088
|
id,
|
|
@@ -4728,15 +5093,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4728
5093
|
onCommit: (text) => onChange(text.trim())
|
|
4729
5094
|
}
|
|
4730
5095
|
),
|
|
4731
|
-
/* @__PURE__ */ (0,
|
|
4732
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
5096
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
5097
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4733
5098
|
"label",
|
|
4734
5099
|
{
|
|
4735
5100
|
style: parameterButtonStyle,
|
|
4736
5101
|
className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
|
|
4737
5102
|
children: [
|
|
4738
5103
|
"Choose file\u2026",
|
|
4739
|
-
/* @__PURE__ */ (0,
|
|
5104
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4740
5105
|
"input",
|
|
4741
5106
|
{
|
|
4742
5107
|
type: "file",
|
|
@@ -4754,7 +5119,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4754
5119
|
]
|
|
4755
5120
|
}
|
|
4756
5121
|
),
|
|
4757
|
-
value && /* @__PURE__ */ (0,
|
|
5122
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4758
5123
|
"button",
|
|
4759
5124
|
{
|
|
4760
5125
|
type: "button",
|
|
@@ -4769,7 +5134,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4769
5134
|
] })
|
|
4770
5135
|
] })
|
|
4771
5136
|
] }),
|
|
4772
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
5137
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4773
5138
|
"button",
|
|
4774
5139
|
{
|
|
4775
5140
|
type: "button",
|
|
@@ -4779,14 +5144,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4779
5144
|
disabled: off,
|
|
4780
5145
|
onClick: () => onChange(o.url),
|
|
4781
5146
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
4782
|
-
children: /* @__PURE__ */ (0,
|
|
5147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
4783
5148
|
},
|
|
4784
5149
|
o.url
|
|
4785
5150
|
)) })
|
|
4786
5151
|
] });
|
|
4787
5152
|
}
|
|
4788
5153
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
4789
|
-
return /* @__PURE__ */ (0,
|
|
5154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4790
5155
|
ParameterCommitInput,
|
|
4791
5156
|
{
|
|
4792
5157
|
id,
|
|
@@ -4805,24 +5170,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
4805
5170
|
switch (field.type) {
|
|
4806
5171
|
case "number":
|
|
4807
5172
|
case "int":
|
|
4808
|
-
return /* @__PURE__ */ (0,
|
|
5173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
4809
5174
|
case "boolean":
|
|
4810
|
-
return /* @__PURE__ */ (0,
|
|
5175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
4811
5176
|
case "choice":
|
|
4812
|
-
return /* @__PURE__ */ (0,
|
|
5177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
4813
5178
|
case "color":
|
|
4814
|
-
return /* @__PURE__ */ (0,
|
|
5179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
4815
5180
|
case "vector":
|
|
4816
|
-
return /* @__PURE__ */ (0,
|
|
5181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
4817
5182
|
case "image":
|
|
4818
|
-
return /* @__PURE__ */ (0,
|
|
5183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
4819
5184
|
case "text":
|
|
4820
|
-
return /* @__PURE__ */ (0,
|
|
5185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
4821
5186
|
}
|
|
4822
5187
|
}
|
|
4823
5188
|
|
|
4824
5189
|
// src/effects/EffectParameters.tsx
|
|
4825
|
-
var
|
|
5190
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4826
5191
|
function EffectParameters({
|
|
4827
5192
|
description,
|
|
4828
5193
|
values,
|
|
@@ -4837,10 +5202,10 @@ function EffectParameters({
|
|
|
4837
5202
|
className = "",
|
|
4838
5203
|
components
|
|
4839
5204
|
}) {
|
|
4840
|
-
const fields = (0,
|
|
4841
|
-
const idBase = (0,
|
|
4842
|
-
const gesture =
|
|
4843
|
-
const count =
|
|
5205
|
+
const fields = (0, import_react29.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
5206
|
+
const idBase = (0, import_react29.useId)();
|
|
5207
|
+
const gesture = import_react29.default.useRef(null);
|
|
5208
|
+
const count = import_react29.default.useRef(0);
|
|
4844
5209
|
const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
|
|
4845
5210
|
const handlePresetSelect = (name) => {
|
|
4846
5211
|
if (!name) return;
|
|
@@ -4851,8 +5216,8 @@ function EffectParameters({
|
|
|
4851
5216
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
4852
5217
|
}
|
|
4853
5218
|
};
|
|
4854
|
-
return /* @__PURE__ */ (0,
|
|
4855
|
-
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0,
|
|
5219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
5220
|
+
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4856
5221
|
CustomPresetSelect,
|
|
4857
5222
|
{
|
|
4858
5223
|
"aria-label": `${description.name} presets`,
|
|
@@ -4867,7 +5232,7 @@ function EffectParameters({
|
|
|
4867
5232
|
],
|
|
4868
5233
|
onChange: (name) => handlePresetSelect(String(name))
|
|
4869
5234
|
}
|
|
4870
|
-
) : /* @__PURE__ */ (0,
|
|
5235
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4871
5236
|
"select",
|
|
4872
5237
|
{
|
|
4873
5238
|
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
@@ -4877,8 +5242,8 @@ function EffectParameters({
|
|
|
4877
5242
|
disabled,
|
|
4878
5243
|
onChange: (e) => handlePresetSelect(e.currentTarget.value),
|
|
4879
5244
|
children: [
|
|
4880
|
-
/* @__PURE__ */ (0,
|
|
4881
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
|
|
5246
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
|
|
4882
5247
|
]
|
|
4883
5248
|
}
|
|
4884
5249
|
)),
|
|
@@ -4888,14 +5253,14 @@ function EffectParameters({
|
|
|
4888
5253
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
4889
5254
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
4890
5255
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
4891
|
-
return /* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
keyed && /* @__PURE__ */ (0,
|
|
5256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
5258
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
5259
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
4895
5260
|
renderControlAddon?.(field.id),
|
|
4896
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
5261
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
|
|
4897
5262
|
] }),
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4899
5264
|
ParameterFieldControl,
|
|
4900
5265
|
{
|
|
4901
5266
|
field,
|
|
@@ -4910,25 +5275,25 @@ function EffectParameters({
|
|
|
4910
5275
|
)
|
|
4911
5276
|
] }, field.id);
|
|
4912
5277
|
}),
|
|
4913
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
5278
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
4914
5279
|
] });
|
|
4915
5280
|
}
|
|
4916
5281
|
|
|
4917
5282
|
// src/vector/VectorProviderEffectsPanel.tsx
|
|
4918
|
-
var
|
|
4919
|
-
var
|
|
5283
|
+
var import_react30 = require("react");
|
|
5284
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4920
5285
|
var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
4921
5286
|
function Controls({ controller, group }) {
|
|
4922
5287
|
const provider = controller.effectsProvider;
|
|
4923
5288
|
const tag = group.providerEffect;
|
|
4924
5289
|
const { description, error } = useEffectDescription(provider, tag.effect);
|
|
4925
|
-
const [message, setMessage] = (0,
|
|
5290
|
+
const [message, setMessage] = (0, import_react30.useState)(null);
|
|
4926
5291
|
const run = (work) => void work.then(() => setMessage(null), (e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
4927
|
-
if (!provider) return /* @__PURE__ */ (0,
|
|
4928
|
-
if (error) return /* @__PURE__ */ (0,
|
|
4929
|
-
if (!description) return /* @__PURE__ */ (0,
|
|
4930
|
-
return /* @__PURE__ */ (0,
|
|
4931
|
-
/* @__PURE__ */ (0,
|
|
5292
|
+
if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: the shapes are kept as they are." });
|
|
5293
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
|
|
5294
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
5295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4932
5297
|
EffectParameters,
|
|
4933
5298
|
{
|
|
4934
5299
|
description,
|
|
@@ -4938,18 +5303,18 @@ function Controls({ controller, group }) {
|
|
|
4938
5303
|
onPreset: (v) => run(controller.updateVectorEffect(group.id, v))
|
|
4939
5304
|
}
|
|
4940
5305
|
),
|
|
4941
|
-
message && /* @__PURE__ */ (0,
|
|
5306
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
4942
5307
|
] });
|
|
4943
5308
|
}
|
|
4944
5309
|
function VectorProviderEffectsPanel({ controller, className = "" }) {
|
|
4945
5310
|
const state = useVectorEditorState(controller);
|
|
4946
|
-
const provider = (0,
|
|
5311
|
+
const provider = (0, import_react30.useSyncExternalStore)(
|
|
4947
5312
|
(cb) => controller.effects.subscribe(cb),
|
|
4948
5313
|
() => controller.effects.provider,
|
|
4949
5314
|
() => controller.effects.provider
|
|
4950
5315
|
);
|
|
4951
|
-
const [browse, setBrowse] = (0,
|
|
4952
|
-
const [message, setMessage] = (0,
|
|
5316
|
+
const [browse, setBrowse] = (0, import_react30.useState)(false);
|
|
5317
|
+
const [message, setMessage] = (0, import_react30.useState)(null);
|
|
4953
5318
|
void state;
|
|
4954
5319
|
const groups = controller.vectorEffectGroups();
|
|
4955
5320
|
const selected = groups.filter((g) => state.selection.includes(g.id));
|
|
@@ -4957,60 +5322,60 @@ function VectorProviderEffectsPanel({ controller, className = "" }) {
|
|
|
4957
5322
|
setMessage(null);
|
|
4958
5323
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
4959
5324
|
};
|
|
4960
|
-
return /* @__PURE__ */ (0,
|
|
4961
|
-
/* @__PURE__ */ (0,
|
|
4962
|
-
/* @__PURE__ */ (0,
|
|
4963
|
-
/* @__PURE__ */ (0,
|
|
5325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Vector effects", "data-vector-provider-effects": "", children: [
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse, onClick: () => setBrowse(!browse), children: "Add effect\u2026" })
|
|
4964
5329
|
] }),
|
|
4965
|
-
!provider && /* @__PURE__ */ (0,
|
|
4966
|
-
browse && /* @__PURE__ */ (0,
|
|
4967
|
-
selected.map((g) => /* @__PURE__ */ (0,
|
|
4968
|
-
/* @__PURE__ */ (0,
|
|
4969
|
-
/* @__PURE__ */ (0,
|
|
4970
|
-
/* @__PURE__ */ (0,
|
|
5330
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effect groups are kept as shapes." }),
|
|
5331
|
+
browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(false), run(() => controller.addVectorEffect(e.id))) }),
|
|
5332
|
+
selected.map((g) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-effect-group": g.id, children: [
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5334
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.providerEffect.name ?? g.providerEffect.effect }),
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn, title: "Keep the shapes as a plain group", onClick: () => run(() => controller.detachVectorEffect(g.id)), children: "Detach" })
|
|
4971
5336
|
] }),
|
|
4972
|
-
/* @__PURE__ */ (0,
|
|
5337
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { controller, group: g })
|
|
4973
5338
|
] }, g.id)),
|
|
4974
|
-
groups.length > 0 && !selected.length && /* @__PURE__ */ (0,
|
|
5339
|
+
groups.length > 0 && !selected.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
4975
5340
|
"Select an effect group (",
|
|
4976
5341
|
groups.length,
|
|
4977
5342
|
" in the drawing) to change it."
|
|
4978
5343
|
] }),
|
|
4979
|
-
message && /* @__PURE__ */ (0,
|
|
5344
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
4980
5345
|
] });
|
|
4981
5346
|
}
|
|
4982
5347
|
|
|
4983
5348
|
// src/vector/VectorEditor.tsx
|
|
4984
|
-
var
|
|
5349
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4985
5350
|
function VectorEditor({ controller, tools, showStylePanel = true, height = 520, canvasProps, effects, className }) {
|
|
4986
5351
|
useEffects(controller, effects);
|
|
4987
5352
|
const effectsShown = !!effects || controller.vectorEffectGroups().length > 0;
|
|
4988
|
-
return /* @__PURE__ */ (0,
|
|
4989
|
-
/* @__PURE__ */ (0,
|
|
4990
|
-
/* @__PURE__ */ (0,
|
|
4991
|
-
/* @__PURE__ */ (0,
|
|
4992
|
-
showStylePanel && /* @__PURE__ */ (0,
|
|
4993
|
-
/* @__PURE__ */ (0,
|
|
4994
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
5353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 ${className ?? ""}`, "data-vector-editor": "", children: [
|
|
5354
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorToolbar, { controller, tools }),
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-h-0 flex-col gap-2 md:flex-row", children: [
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "relative min-h-[320px] flex-1 overflow-hidden rounded-md border border-border bg-muted/40", style: { height }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorCanvas, { controller, ...canvasProps }) }),
|
|
5357
|
+
showStylePanel && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex w-full shrink-0 flex-col gap-2 md:w-56", children: [
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorStylePanel, { controller, className: "rounded-md border border-border p-3" }),
|
|
5359
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorProviderEffectsPanel, { controller, className: "rounded-md border border-border p-3" })
|
|
4995
5360
|
] })
|
|
4996
5361
|
] })
|
|
4997
5362
|
] });
|
|
4998
5363
|
}
|
|
4999
5364
|
|
|
5000
5365
|
// src/vector/VectorGeneratePanel.tsx
|
|
5001
|
-
var
|
|
5366
|
+
var import_react31 = require("react");
|
|
5002
5367
|
var import_vector21 = require("@pixerate/editor/vector");
|
|
5003
|
-
var
|
|
5368
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5004
5369
|
var buttonClass17 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
5005
5370
|
var selectClass15 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
5006
5371
|
var AS_LABELS = { color: "Traced in colour", threshold: "Traced in one colour", mosaic: "Mosaic", halftone: "Halftone", lowPoly: "Low poly", hatch: "Engraving" };
|
|
5007
5372
|
function VectorGeneratePanel({ controller, models, generate, className }) {
|
|
5008
5373
|
const usable = (0, import_vector21.vectorArtModels)(models);
|
|
5009
|
-
const [prompt, setPrompt] = (0,
|
|
5010
|
-
const [model, setModel] = (0,
|
|
5011
|
-
const [as, setAs] = (0,
|
|
5012
|
-
const [busy, setBusy] = (0,
|
|
5013
|
-
const [message, setMessage] = (0,
|
|
5374
|
+
const [prompt, setPrompt] = (0, import_react31.useState)("");
|
|
5375
|
+
const [model, setModel] = (0, import_react31.useState)("");
|
|
5376
|
+
const [as, setAs] = (0, import_react31.useState)("color");
|
|
5377
|
+
const [busy, setBusy] = (0, import_react31.useState)(false);
|
|
5378
|
+
const [message, setMessage] = (0, import_react31.useState)(null);
|
|
5014
5379
|
const chosen = usable.find((m) => m.id === model) ?? usable[0];
|
|
5015
5380
|
if (!usable.length) return null;
|
|
5016
5381
|
const run = async () => {
|
|
@@ -5020,18 +5385,18 @@ function VectorGeneratePanel({ controller, models, generate, className }) {
|
|
|
5020
5385
|
setBusy(false);
|
|
5021
5386
|
setMessage(r.ok ? null : r.message ?? "Generation failed.");
|
|
5022
5387
|
};
|
|
5023
|
-
return /* @__PURE__ */ (0,
|
|
5024
|
-
/* @__PURE__ */ (0,
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5026
|
-
/* @__PURE__ */ (0,
|
|
5027
|
-
chosen.media === "image" && /* @__PURE__ */ (0,
|
|
5388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `space-y-1 ${className ?? ""}`, "data-vector-generate-panel": "", "aria-label": "Generate", children: [
|
|
5389
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5390
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Generate" }),
|
|
5391
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("select", { "aria-label": "Generation model", className: selectClass15, value: chosen.id, onChange: (e) => setModel(e.target.value), children: usable.map((m) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: m.id, children: m.name ?? m.id }, m.id)) }),
|
|
5392
|
+
chosen.media === "image" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("select", { "aria-label": "Image to vectors", className: selectClass15, value: as, onChange: (e) => setAs(e.target.value), children: import_vector21.VECTOR_GENERATED_IMAGE_AS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: a, children: AS_LABELS[a] }, a)) })
|
|
5028
5393
|
] }),
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5030
|
-
/* @__PURE__ */ (0,
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5394
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5395
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-16" }),
|
|
5396
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "text", "aria-label": "Prompt", placeholder: "Describe the art\u2026", className: "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1.5 text-xs", value: prompt, onChange: (e) => setPrompt(e.target.value), onKeyDown: (e) => e.key === "Enter" && prompt.trim() && !busy && void run() }),
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: buttonClass17, "data-vector-generate-action": "", disabled: !prompt.trim() || busy, onClick: () => void run(), children: busy ? "Generating\u2026" : "Generate" })
|
|
5033
5398
|
] }),
|
|
5034
|
-
message && /* @__PURE__ */ (0,
|
|
5399
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-[11px] text-red-600", children: message })
|
|
5035
5400
|
] });
|
|
5036
5401
|
}
|
|
5037
5402
|
// Annotate the CommonJS export names for ESM import in node:
|