@pixerate/editor-react 0.179.0 → 0.180.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/{paint-editor → brushes}/BrushEditor.d.cts +14 -5
- package/dist/{paint-editor → brushes}/BrushEditor.d.ts +14 -5
- package/dist/brushes/BrushLibraryEditor.d.cts +26 -0
- package/dist/brushes/BrushLibraryEditor.d.ts +26 -0
- package/dist/brushes/index.cjs +289 -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-76JBZXLM.js +263 -0
- package/dist/chunk-QIJJCDYW.js +119 -0
- package/dist/{chunk-UR4KL7WE.js → chunk-XAPJMT3W.js} +26 -6
- package/dist/image-editor/BrushOptionsBar.d.cts +6 -1
- package/dist/image-editor/BrushOptionsBar.d.ts +6 -1
- package/dist/image-editor/index.cjs +1178 -894
- package/dist/image-editor/index.js +3 -3
- package/dist/index.cjs +1719 -1435
- package/dist/index.js +3 -3
- package/dist/paint-editor/index.cjs +20 -23
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +413 -609
- package/dist/vector/VectorAppearancePanel.d.cts +8 -2
- package/dist/vector/VectorAppearancePanel.d.ts +8 -2
- package/dist/vector/index.cjs +1110 -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/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,358 @@ 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, 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" } }) : 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, previewColor = "#64748b", 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 colour = draft && (0, import_brushes3.brushColourHex)(draft.colour?.default ?? "", "light") || previewColor;
|
|
1407
|
+
(0, import_react10.useEffect)(() => {
|
|
1408
|
+
if (!draft || !renderPreview) return;
|
|
1409
|
+
let live = true;
|
|
1410
|
+
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));
|
|
1411
|
+
return () => {
|
|
1412
|
+
live = false;
|
|
1413
|
+
};
|
|
1414
|
+
}, [draft, renderPreview, colour]);
|
|
1415
|
+
const check = (0, import_react10.useMemo)(() => draft ? (0, import_brushes3.checkBrushEdit)(original, draft, profile) : null, [original, draft, profile]);
|
|
1416
|
+
if (!draft) return null;
|
|
1417
|
+
const save = async (name) => {
|
|
1418
|
+
const saved = await (0, import_brushes3.saveBrushEdit)(library, { original, brush: draft, profile, ...name !== void 0 ? { name } : {} });
|
|
1419
|
+
setOriginal(saved.brush);
|
|
1420
|
+
setBuiltin(false);
|
|
1421
|
+
setDraft(saved.brush);
|
|
1422
|
+
setStatus(`Saved \u201C${saved.brush.name}\u201D${saved.kept.length ? `, keeping what ${profile.name} can't use` : ""}.`);
|
|
1423
|
+
onSaved?.(saved.brush);
|
|
1424
|
+
};
|
|
1425
|
+
const errors = check?.issues.filter((i) => i.severity === "error") ?? [];
|
|
1426
|
+
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: [
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1428
|
+
/* @__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" }),
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex gap-1", children: [
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1431
|
+
"button",
|
|
1432
|
+
{
|
|
1433
|
+
type: "button",
|
|
1434
|
+
className: button,
|
|
1435
|
+
title: `A new brush from this one, with only what ${profile.name} uses`,
|
|
1436
|
+
onClick: () => {
|
|
1437
|
+
setOriginal(null);
|
|
1438
|
+
setBuiltin(false);
|
|
1439
|
+
setDraft((0, import_brushes3.newBrushFor)(profile, draft));
|
|
1440
|
+
setStatus(null);
|
|
1441
|
+
},
|
|
1442
|
+
children: "New brush"
|
|
1443
|
+
}
|
|
1444
|
+
),
|
|
1445
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: onClose, children: "Close" })
|
|
1446
|
+
] })
|
|
1447
|
+
] }),
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1449
|
+
BrushEditor,
|
|
1450
|
+
{
|
|
1451
|
+
brush: draft,
|
|
1452
|
+
profile,
|
|
1453
|
+
preview: renderPreview ? preview : void 0,
|
|
1454
|
+
onChange: (next) => {
|
|
1455
|
+
setDraft(next);
|
|
1456
|
+
setStatus(null);
|
|
1457
|
+
},
|
|
1458
|
+
onSave: original ? () => save() : void 0,
|
|
1459
|
+
saveLabel: builtin ? "Save a copy" : "Save",
|
|
1460
|
+
onSaveAs: (name) => save(name)
|
|
1461
|
+
}
|
|
1462
|
+
),
|
|
1463
|
+
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: [
|
|
1464
|
+
i.reason,
|
|
1465
|
+
" ",
|
|
1466
|
+
i.fix
|
|
1467
|
+
] }, i.facet)) }),
|
|
1468
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "status", className: "text-[11px] text-emerald-400", children: status })
|
|
1469
|
+
] });
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
// src/brushes/useBrushLibrary.ts
|
|
1473
|
+
var import_react11 = require("react");
|
|
1474
|
+
function useBrushLibrary(library, filter = {}) {
|
|
1475
|
+
const [entries, setEntries] = (0, import_react11.useState)([]);
|
|
1476
|
+
const { profile, ...rest } = filter;
|
|
1477
|
+
const key = `${profile?.id ?? ""}:${JSON.stringify(rest)}`;
|
|
1478
|
+
(0, import_react11.useEffect)(() => {
|
|
1479
|
+
if (!library) return;
|
|
1480
|
+
let live = true;
|
|
1481
|
+
const read = () => void library.list(filter).then((list) => live && setEntries(list), () => void 0);
|
|
1482
|
+
read();
|
|
1483
|
+
const unsubscribe = library.subscribe(read);
|
|
1484
|
+
return () => {
|
|
1485
|
+
live = false;
|
|
1486
|
+
unsubscribe();
|
|
1487
|
+
};
|
|
1488
|
+
}, [library, key]);
|
|
1489
|
+
return entries;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
// src/vector/VectorAppearancePanel.tsx
|
|
1493
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1154
1494
|
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
1495
|
var numberClass2 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
1156
1496
|
var selectClass2 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1157
1497
|
var headingClass = "text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1158
1498
|
var labelClass2 = "w-full truncate text-[11px] text-muted-foreground";
|
|
1159
|
-
function VectorAppearancePanel({ controller, className }) {
|
|
1499
|
+
function VectorAppearancePanel({ controller, renderBrushPreview, className }) {
|
|
1160
1500
|
const state = useVectorEditorState(controller);
|
|
1501
|
+
const [brushUi, setBrushUi] = (0, import_react12.useState)(null);
|
|
1502
|
+
const library = controller.brushLibrary;
|
|
1503
|
+
const entries = useBrushLibrary(brushUi ? library : null, { profile: import_brushes4.VECTOR_PROFILE });
|
|
1161
1504
|
const panel = (0, import_vector5.getVectorAppearancePanel)(state);
|
|
1162
1505
|
if (!panel) return null;
|
|
1163
1506
|
const end = () => controller.endMergedEdit();
|
|
@@ -1166,53 +1509,72 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1166
1509
|
const layerRow = (l, count) => {
|
|
1167
1510
|
const name = `${l.kind === "fill" ? "Fill" : "Stroke"} ${l.index + 1}`;
|
|
1168
1511
|
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)(
|
|
1512
|
+
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: [
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1514
|
+
/* @__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 }) }),
|
|
1515
|
+
/* @__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 }),
|
|
1516
|
+
/* @__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)) }),
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1192
1518
|
"input",
|
|
1193
1519
|
{
|
|
1194
|
-
type: "
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1520
|
+
type: "number",
|
|
1521
|
+
min: 0.5,
|
|
1522
|
+
step: 0.5,
|
|
1523
|
+
"aria-label": `${name} brush size`,
|
|
1524
|
+
title: "Brush size",
|
|
1525
|
+
className: numberClass2,
|
|
1526
|
+
value: l.brushstroke.size,
|
|
1527
|
+
onChange: (e) => {
|
|
1528
|
+
const n = parseFloat(e.target.value);
|
|
1529
|
+
if (Number.isFinite(n) && n > 0) controller.setBrushstroke(l.index, { size: Math.min(500, n) }, { ids, merge: true });
|
|
1530
|
+
},
|
|
1531
|
+
onBlur: end
|
|
1199
1532
|
}
|
|
1200
1533
|
),
|
|
1201
|
-
"
|
|
1534
|
+
/* @__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: [
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1536
|
+
"input",
|
|
1537
|
+
{
|
|
1538
|
+
type: "checkbox",
|
|
1539
|
+
"aria-label": `${name} grain`,
|
|
1540
|
+
"data-vector-brushstroke-grain": "",
|
|
1541
|
+
checked: l.brushstroke.grain,
|
|
1542
|
+
onChange: (e) => controller.setBrushstroke(l.index, e.target.checked ? { paper: {}, ...l.brushstroke.seed === void 0 ? { seed: (0, import_vector5.randomVectorBrushstrokeSeed)() } : {} } : { paper: null }, { ids })
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1545
|
+
"Grain"
|
|
1546
|
+
] }),
|
|
1547
|
+
/* @__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
1548
|
] }),
|
|
1203
|
-
/* @__PURE__ */ (0,
|
|
1204
|
-
|
|
1549
|
+
library && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1", children: [
|
|
1550
|
+
/* @__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" }),
|
|
1551
|
+
(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" })
|
|
1552
|
+
] }),
|
|
1553
|
+
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 }) }),
|
|
1554
|
+
brushUi?.index === l.index && brushUi.mode === "edit" && (0, import_brushes4.isBrushLibrary)(library) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1555
|
+
BrushLibraryEditor,
|
|
1556
|
+
{
|
|
1557
|
+
library,
|
|
1558
|
+
brushId: l.brushstroke.brushId,
|
|
1559
|
+
profile: import_brushes4.VECTOR_PROFILE,
|
|
1560
|
+
renderPreview: renderBrushPreview ?? controller.brushPreview ?? void 0,
|
|
1561
|
+
className: "rounded border border-border bg-slate-950 p-2",
|
|
1562
|
+
onSaved: (saved) => void controller.refreshBrushes().then(() => controller.setBrushstroke(l.index, { brushId: saved.id, keepColour: true }, { ids })),
|
|
1563
|
+
onClose: () => setBrushUi(null)
|
|
1564
|
+
}
|
|
1565
|
+
)
|
|
1566
|
+
] }, `${l.kind}-${l.index}`);
|
|
1205
1567
|
if (l.unknownKind)
|
|
1206
|
-
return /* @__PURE__ */ (0,
|
|
1568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-[11px] text-muted-foreground", "data-vector-layer": `${l.kind}-${l.index}`, children: [
|
|
1207
1569
|
name,
|
|
1208
1570
|
": ",
|
|
1209
1571
|
l.unknownKind,
|
|
1210
1572
|
" (not drawn by this version)"
|
|
1211
1573
|
] }, `${l.kind}-${l.index}`);
|
|
1212
|
-
return /* @__PURE__ */ (0,
|
|
1213
|
-
/* @__PURE__ */ (0,
|
|
1214
|
-
/* @__PURE__ */ (0,
|
|
1215
|
-
l.gradient ? /* @__PURE__ */ (0,
|
|
1574
|
+
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: [
|
|
1575
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1576
|
+
/* @__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 }) }),
|
|
1577
|
+
l.gradient ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1216
1578
|
"button",
|
|
1217
1579
|
{
|
|
1218
1580
|
type: "button",
|
|
@@ -1222,7 +1584,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1222
1584
|
style: { background: l.swatch },
|
|
1223
1585
|
onClick: () => controller.setGradientTarget(l.kind, l.index)
|
|
1224
1586
|
}
|
|
1225
|
-
) : /* @__PURE__ */ (0,
|
|
1587
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1226
1588
|
"input",
|
|
1227
1589
|
{
|
|
1228
1590
|
type: "color",
|
|
@@ -1233,7 +1595,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1233
1595
|
onBlur: end
|
|
1234
1596
|
}
|
|
1235
1597
|
),
|
|
1236
|
-
/* @__PURE__ */ (0,
|
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1237
1599
|
"input",
|
|
1238
1600
|
{
|
|
1239
1601
|
type: "number",
|
|
@@ -1251,10 +1613,10 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1251
1613
|
onBlur: end
|
|
1252
1614
|
}
|
|
1253
1615
|
),
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
/* @__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
1617
|
] }),
|
|
1256
|
-
l.kind === "stroke" && /* @__PURE__ */ (0,
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1618
|
+
l.kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1258
1620
|
"input",
|
|
1259
1621
|
{
|
|
1260
1622
|
type: "number",
|
|
@@ -1271,22 +1633,22 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1271
1633
|
onBlur: end
|
|
1272
1634
|
}
|
|
1273
1635
|
),
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1636
|
+
/* @__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
1637
|
] }),
|
|
1276
|
-
/* @__PURE__ */ (0,
|
|
1277
|
-
/* @__PURE__ */ (0,
|
|
1278
|
-
/* @__PURE__ */ (0,
|
|
1279
|
-
/* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
/* @__PURE__ */ (0,
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1" }),
|
|
1640
|
+
/* @__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" }),
|
|
1641
|
+
/* @__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" }),
|
|
1642
|
+
/* @__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" }),
|
|
1643
|
+
/* @__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
1644
|
] })
|
|
1283
1645
|
] }, `${l.kind}-${l.index}`);
|
|
1284
1646
|
};
|
|
1285
|
-
const stack = (kind, layers, mixed) => /* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
mixed && /* @__PURE__ */ (0,
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1647
|
+
const stack = (kind, layers, mixed) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1", "data-vector-stack": kind, children: [
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `flex-1 ${headingClass}`, children: kind === "fill" ? "Fills" : "Strokes" }),
|
|
1650
|
+
mixed && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1290
1652
|
"button",
|
|
1291
1653
|
{
|
|
1292
1654
|
type: "button",
|
|
@@ -1298,7 +1660,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1298
1660
|
children: "+"
|
|
1299
1661
|
}
|
|
1300
1662
|
),
|
|
1301
|
-
kind === "stroke" && /* @__PURE__ */ (0,
|
|
1663
|
+
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
1664
|
] }),
|
|
1303
1665
|
[...layers].reverse().map((l) => layerRow(l, layers.length))
|
|
1304
1666
|
] });
|
|
@@ -1309,9 +1671,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1309
1671
|
const filterParam = (f, spec) => {
|
|
1310
1672
|
const label = `${f.label} ${spec.label}`;
|
|
1311
1673
|
if (spec.kind === "color")
|
|
1312
|
-
return /* @__PURE__ */ (0,
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1314
|
-
/* @__PURE__ */ (0,
|
|
1674
|
+
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: [
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-14 truncate text-[11px] text-muted-foreground", children: spec.label }),
|
|
1676
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1315
1677
|
"input",
|
|
1316
1678
|
{
|
|
1317
1679
|
type: "color",
|
|
@@ -1329,9 +1691,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1329
1691
|
const n = parseFloat(e.target.value);
|
|
1330
1692
|
if (Number.isFinite(n)) setFilter(f, spec.key, n, true);
|
|
1331
1693
|
};
|
|
1332
|
-
return /* @__PURE__ */ (0,
|
|
1333
|
-
/* @__PURE__ */ (0,
|
|
1334
|
-
spec.slider && /* @__PURE__ */ (0,
|
|
1694
|
+
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: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: labelClass2, children: spec.label }),
|
|
1696
|
+
spec.slider && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1335
1697
|
"input",
|
|
1336
1698
|
{
|
|
1337
1699
|
type: "range",
|
|
@@ -1347,21 +1709,21 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1347
1709
|
onBlur: end
|
|
1348
1710
|
}
|
|
1349
1711
|
),
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
1712
|
+
/* @__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
1713
|
] }, spec.key);
|
|
1352
1714
|
};
|
|
1353
|
-
return /* @__PURE__ */ (0,
|
|
1715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-appearance": "", "aria-label": "Appearance", children: [
|
|
1354
1716
|
ids.length > 0 && stack("stroke", panel.strokes, panel.mixed.strokes),
|
|
1355
1717
|
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,
|
|
1718
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "blendMode", children: [
|
|
1719
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-16", children: "Blend" }),
|
|
1720
|
+
/* @__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)) }),
|
|
1721
|
+
panel.mixed.blendMode && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
1360
1722
|
] }),
|
|
1361
|
-
/* @__PURE__ */ (0,
|
|
1362
|
-
/* @__PURE__ */ (0,
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1364
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2", "data-vector-filters": "", children: [
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `w-16 ${headingClass}`, children: "Filters" }),
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1365
1727
|
"select",
|
|
1366
1728
|
{
|
|
1367
1729
|
"aria-label": "Add filter",
|
|
@@ -1371,22 +1733,22 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1371
1733
|
if (e.target.value) controller.addFilter(e.target.value, { ids: panel.nodeIds });
|
|
1372
1734
|
},
|
|
1373
1735
|
children: [
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1375
|
-
import_vector5.VECTOR_FILTER_MENU.map((m) => /* @__PURE__ */ (0,
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Add filter\u2026" }),
|
|
1737
|
+
import_vector5.VECTOR_FILTER_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: m.type, children: m.label }, m.type))
|
|
1376
1738
|
]
|
|
1377
1739
|
}
|
|
1378
1740
|
)
|
|
1379
1741
|
] }),
|
|
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,
|
|
1742
|
+
!filterNode && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select one object to edit its filters." }),
|
|
1743
|
+
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: [
|
|
1744
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1745
|
+
/* @__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: [
|
|
1746
|
+
/* @__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 }) }),
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate", children: f.label })
|
|
1386
1748
|
] }),
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1389
|
-
/* @__PURE__ */ (0,
|
|
1749
|
+
/* @__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" }),
|
|
1750
|
+
/* @__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" }),
|
|
1751
|
+
/* @__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
1752
|
] }),
|
|
1391
1753
|
f.specs.map((spec) => filterParam(f, spec))
|
|
1392
1754
|
] }, f.id))
|
|
@@ -1395,9 +1757,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1395
1757
|
}
|
|
1396
1758
|
|
|
1397
1759
|
// src/vector/VectorEnvelopePanel.tsx
|
|
1398
|
-
var
|
|
1760
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
1399
1761
|
var import_vector6 = require("@pixerate/editor/vector");
|
|
1400
|
-
var
|
|
1762
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1401
1763
|
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
1764
|
var numberClass3 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
1403
1765
|
var selectClass3 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -1410,7 +1772,7 @@ var SLIDERS = [
|
|
|
1410
1772
|
function VectorEnvelopePanel({ controller, className }) {
|
|
1411
1773
|
const state = useVectorEditorState(controller);
|
|
1412
1774
|
const panel = (0, import_vector6.getVectorEnvelopePanel)(state);
|
|
1413
|
-
const [size, setSize] =
|
|
1775
|
+
const [size, setSize] = import_react13.default.useState({ rows: 2, columns: 2 });
|
|
1414
1776
|
if (!panel) return null;
|
|
1415
1777
|
const env = panel.envelope;
|
|
1416
1778
|
const ids = panel.nodeId ? [panel.nodeId] : void 0;
|
|
@@ -1424,11 +1786,11 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1424
1786
|
if (env) set({ [key]: n });
|
|
1425
1787
|
else setSize({ ...size, [key]: n });
|
|
1426
1788
|
};
|
|
1427
|
-
return /* @__PURE__ */ (0,
|
|
1428
|
-
/* @__PURE__ */ (0,
|
|
1429
|
-
/* @__PURE__ */ (0,
|
|
1430
|
-
/* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-envelope": "", "aria-label": "Envelope", children: [
|
|
1790
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Envelope" }),
|
|
1792
|
+
/* @__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" }),
|
|
1793
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1432
1794
|
"button",
|
|
1433
1795
|
{
|
|
1434
1796
|
type: "button",
|
|
@@ -1441,7 +1803,7 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1441
1803
|
children: "Mesh"
|
|
1442
1804
|
}
|
|
1443
1805
|
),
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1445
1807
|
"button",
|
|
1446
1808
|
{
|
|
1447
1809
|
type: "button",
|
|
@@ -1454,12 +1816,12 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1454
1816
|
children: "Top"
|
|
1455
1817
|
}
|
|
1456
1818
|
),
|
|
1457
|
-
/* @__PURE__ */ (0,
|
|
1458
|
-
/* @__PURE__ */ (0,
|
|
1819
|
+
/* @__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" }),
|
|
1820
|
+
/* @__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
1821
|
] }),
|
|
1460
|
-
env && /* @__PURE__ */ (0,
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1822
|
+
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: [
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass3, children: "Warp" }),
|
|
1824
|
+
/* @__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
1825
|
] }),
|
|
1464
1826
|
env && env.params.style !== "mesh" && SLIDERS.map((s) => {
|
|
1465
1827
|
const value = env.params[s.key];
|
|
@@ -1467,9 +1829,9 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1467
1829
|
const n = parseFloat(ev.target.value);
|
|
1468
1830
|
if (Number.isFinite(n)) set({ [s.key]: n }, true);
|
|
1469
1831
|
};
|
|
1470
|
-
return /* @__PURE__ */ (0,
|
|
1471
|
-
/* @__PURE__ */ (0,
|
|
1472
|
-
/* @__PURE__ */ (0,
|
|
1832
|
+
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: [
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass3, children: s.label }),
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1473
1835
|
"input",
|
|
1474
1836
|
{
|
|
1475
1837
|
type: "range",
|
|
@@ -1485,29 +1847,29 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1485
1847
|
onBlur: end
|
|
1486
1848
|
}
|
|
1487
1849
|
),
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1850
|
+
/* @__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
1851
|
] }, s.key);
|
|
1490
1852
|
}),
|
|
1491
|
-
env && env.params.style !== "mesh" && /* @__PURE__ */ (0,
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
1494
|
-
/* @__PURE__ */ (0,
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1853
|
+
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: [
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass3, children: "Orientation" }),
|
|
1855
|
+
/* @__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: [
|
|
1856
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "horizontal", children: "Horizontal" }),
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "vertical", children: "Vertical" })
|
|
1496
1858
|
] })
|
|
1497
1859
|
] }),
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1499
|
-
/* @__PURE__ */ (0,
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-envelope-param": "mesh", children: [
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "min-w-0 flex-1 truncate text-[11px] text-muted-foreground", children: "Mesh rows \xD7 columns" }),
|
|
1862
|
+
/* @__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) }),
|
|
1863
|
+
/* @__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
1864
|
] }),
|
|
1503
|
-
panel.count > 1 && !panel.canMakeWithTopObject && /* @__PURE__ */ (0,
|
|
1504
|
-
env && /* @__PURE__ */ (0,
|
|
1865
|
+
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." }),
|
|
1866
|
+
env && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Edit the mesh with the Envelope tool (U)." })
|
|
1505
1867
|
] });
|
|
1506
1868
|
}
|
|
1507
1869
|
|
|
1508
1870
|
// src/vector/VectorMaskPanel.tsx
|
|
1509
1871
|
var import_vector7 = require("@pixerate/editor/vector");
|
|
1510
|
-
var
|
|
1872
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1511
1873
|
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
1874
|
var selectClass4 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1513
1875
|
function VectorMaskPanel({ controller, className }) {
|
|
@@ -1516,10 +1878,10 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1516
1878
|
if (!panel) return null;
|
|
1517
1879
|
const g = panel.group;
|
|
1518
1880
|
const ids = g ? [g.id] : void 0;
|
|
1519
|
-
return /* @__PURE__ */ (0,
|
|
1520
|
-
/* @__PURE__ */ (0,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-mask-panel": "", "aria-label": "Mask", children: [
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Mask" }),
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1523
1885
|
"button",
|
|
1524
1886
|
{
|
|
1525
1887
|
type: "button",
|
|
@@ -1532,7 +1894,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1532
1894
|
children: "Clip"
|
|
1533
1895
|
}
|
|
1534
1896
|
),
|
|
1535
|
-
/* @__PURE__ */ (0,
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1536
1898
|
"button",
|
|
1537
1899
|
{
|
|
1538
1900
|
type: "button",
|
|
@@ -1545,7 +1907,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1545
1907
|
children: "Opacity"
|
|
1546
1908
|
}
|
|
1547
1909
|
),
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1549
1911
|
"button",
|
|
1550
1912
|
{
|
|
1551
1913
|
type: "button",
|
|
@@ -1559,9 +1921,9 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1559
1921
|
}
|
|
1560
1922
|
)
|
|
1561
1923
|
] }),
|
|
1562
|
-
g && /* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1564
|
-
/* @__PURE__ */ (0,
|
|
1924
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-2", "data-vector-mask-group": g.id, "data-mask-type": g.type, children: [
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1565
1927
|
"select",
|
|
1566
1928
|
{
|
|
1567
1929
|
"aria-label": "Mask type",
|
|
@@ -1569,16 +1931,16 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1569
1931
|
value: g.type,
|
|
1570
1932
|
title: import_vector7.VECTOR_MASK_TYPE_OPTIONS.find((o) => o.value === g.type)?.title,
|
|
1571
1933
|
onChange: (e) => controller.setMaskOptions({ type: e.target.value }, { ids }),
|
|
1572
|
-
children: import_vector7.VECTOR_MASK_TYPE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
1934
|
+
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
1935
|
}
|
|
1574
1936
|
),
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1576
|
-
/* @__PURE__ */ (0,
|
|
1937
|
+
/* @__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: [
|
|
1938
|
+
/* @__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
1939
|
"Invert"
|
|
1578
1940
|
] })
|
|
1579
1941
|
] }),
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1582
1944
|
"button",
|
|
1583
1945
|
{
|
|
1584
1946
|
type: "button",
|
|
@@ -1591,7 +1953,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1591
1953
|
children: "Edit mask"
|
|
1592
1954
|
}
|
|
1593
1955
|
),
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1956
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1595
1957
|
"button",
|
|
1596
1958
|
{
|
|
1597
1959
|
type: "button",
|
|
@@ -1605,7 +1967,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1605
1967
|
children: "Contents"
|
|
1606
1968
|
}
|
|
1607
1969
|
),
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1609
1971
|
"button",
|
|
1610
1972
|
{
|
|
1611
1973
|
type: "button",
|
|
@@ -1624,9 +1986,9 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1624
1986
|
}
|
|
1625
1987
|
|
|
1626
1988
|
// src/vector/VectorTextPanel.tsx
|
|
1627
|
-
var
|
|
1989
|
+
var import_react14 = require("react");
|
|
1628
1990
|
var import_vector8 = require("@pixerate/editor/vector");
|
|
1629
|
-
var
|
|
1991
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1630
1992
|
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
1993
|
var inputClass = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1632
1994
|
var labelClass4 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
@@ -1636,19 +1998,19 @@ var num = (v) => {
|
|
|
1636
1998
|
};
|
|
1637
1999
|
function VectorTextPanel({ controller, className }) {
|
|
1638
2000
|
const state = useVectorEditorState(controller);
|
|
1639
|
-
const listId = `vector-fonts-${(0,
|
|
2001
|
+
const listId = `vector-fonts-${(0, import_react14.useId)().replace(/:/g, "")}`;
|
|
1640
2002
|
const panel = (0, import_vector8.getVectorTextPanel)(state);
|
|
1641
2003
|
if (!panel) return null;
|
|
1642
2004
|
const f = panel.font;
|
|
1643
2005
|
const style = (patch, merge) => (0, import_vector8.applyVectorTextStyle)(controller, patch, merge ? { merge } : {});
|
|
1644
2006
|
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,
|
|
2007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-text-panel": panel.target, "aria-label": "Text", children: [
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: labelClass4, children: "Text" }),
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-muted-foreground", children: where })
|
|
1649
2011
|
] }),
|
|
1650
|
-
/* @__PURE__ */ (0,
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1652
2014
|
"input",
|
|
1653
2015
|
{
|
|
1654
2016
|
"aria-label": "Font family",
|
|
@@ -1666,15 +2028,15 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1666
2028
|
},
|
|
1667
2029
|
`family:${f.fontFamily}`
|
|
1668
2030
|
),
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
2031
|
+
/* @__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
2032
|
] }),
|
|
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,
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2034
|
+
/* @__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: [
|
|
2035
|
+
f.fontWeight === null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Mixed" }),
|
|
2036
|
+
import_vector8.VECTOR_FONT_WEIGHTS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: w.value, children: w.label }, w.value)),
|
|
2037
|
+
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
2038
|
] }),
|
|
1677
|
-
/* @__PURE__ */ (0,
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1678
2040
|
"input",
|
|
1679
2041
|
{
|
|
1680
2042
|
type: "number",
|
|
@@ -1693,14 +2055,14 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1693
2055
|
}
|
|
1694
2056
|
)
|
|
1695
2057
|
] }),
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1697
|
-
/* @__PURE__ */ (0,
|
|
1698
|
-
/* @__PURE__ */ (0,
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1700
|
-
/* @__PURE__ */ (0,
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2059
|
+
/* @__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" }) }),
|
|
2060
|
+
/* @__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" }) }),
|
|
2061
|
+
/* @__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" }) }),
|
|
2062
|
+
/* @__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
2063
|
] }),
|
|
1702
|
-
panel.target !== "defaults" && /* @__PURE__ */ (0,
|
|
1703
|
-
/* @__PURE__ */ (0,
|
|
2064
|
+
panel.target !== "defaults" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Orientation", children: [
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1704
2066
|
"button",
|
|
1705
2067
|
{
|
|
1706
2068
|
type: "button",
|
|
@@ -1711,7 +2073,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1711
2073
|
children: "Horizontal"
|
|
1712
2074
|
}
|
|
1713
2075
|
),
|
|
1714
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1715
2077
|
"button",
|
|
1716
2078
|
{
|
|
1717
2079
|
type: "button",
|
|
@@ -1723,7 +2085,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1723
2085
|
children: "Vertical"
|
|
1724
2086
|
}
|
|
1725
2087
|
),
|
|
1726
|
-
panel.orientation === "vertical" && /* @__PURE__ */ (0,
|
|
2088
|
+
panel.orientation === "vertical" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1727
2089
|
"button",
|
|
1728
2090
|
{
|
|
1729
2091
|
type: "button",
|
|
@@ -1735,10 +2097,10 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1735
2097
|
}
|
|
1736
2098
|
)
|
|
1737
2099
|
] }),
|
|
1738
|
-
/* @__PURE__ */ (0,
|
|
1739
|
-
/* @__PURE__ */ (0,
|
|
1740
|
-
/* @__PURE__ */ (0,
|
|
1741
|
-
/* @__PURE__ */ (0,
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2101
|
+
/* @__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: [
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "VA" }),
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1742
2104
|
"input",
|
|
1743
2105
|
{
|
|
1744
2106
|
type: "number",
|
|
@@ -1752,9 +2114,9 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1752
2114
|
}
|
|
1753
2115
|
)
|
|
1754
2116
|
] }),
|
|
1755
|
-
/* @__PURE__ */ (0,
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1757
|
-
/* @__PURE__ */ (0,
|
|
2117
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Leading (empty: auto)", children: [
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "\u2195" }),
|
|
2119
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1758
2120
|
"input",
|
|
1759
2121
|
{
|
|
1760
2122
|
type: "number",
|
|
@@ -1770,7 +2132,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1770
2132
|
)
|
|
1771
2133
|
] })
|
|
1772
2134
|
] }),
|
|
1773
|
-
/* @__PURE__ */ (0,
|
|
2135
|
+
/* @__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
2136
|
"button",
|
|
1775
2137
|
{
|
|
1776
2138
|
type: "button",
|
|
@@ -1782,8 +2144,8 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1782
2144
|
},
|
|
1783
2145
|
o.value
|
|
1784
2146
|
)) }),
|
|
1785
|
-
panel.target !== "defaults" && panel.ids.length === 1 && /* @__PURE__ */ (0,
|
|
1786
|
-
/* @__PURE__ */ (0,
|
|
2147
|
+
panel.target !== "defaults" && panel.ids.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2148
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1787
2149
|
"button",
|
|
1788
2150
|
{
|
|
1789
2151
|
type: "button",
|
|
@@ -1794,7 +2156,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1794
2156
|
children: "Point"
|
|
1795
2157
|
}
|
|
1796
2158
|
),
|
|
1797
|
-
/* @__PURE__ */ (0,
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1798
2160
|
"button",
|
|
1799
2161
|
{
|
|
1800
2162
|
type: "button",
|
|
@@ -1806,8 +2168,8 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1806
2168
|
}
|
|
1807
2169
|
)
|
|
1808
2170
|
] }),
|
|
1809
|
-
/* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1811
2173
|
"button",
|
|
1812
2174
|
{
|
|
1813
2175
|
type: "button",
|
|
@@ -1822,7 +2184,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1822
2184
|
children: "Type on path"
|
|
1823
2185
|
}
|
|
1824
2186
|
),
|
|
1825
|
-
/* @__PURE__ */ (0,
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1826
2188
|
"button",
|
|
1827
2189
|
{
|
|
1828
2190
|
type: "button",
|
|
@@ -1839,56 +2201,56 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1839
2201
|
}
|
|
1840
2202
|
|
|
1841
2203
|
// src/vector/VectorSymbolsPanel.tsx
|
|
1842
|
-
var
|
|
2204
|
+
var import_react15 = require("react");
|
|
1843
2205
|
var import_vector9 = require("@pixerate/editor/vector");
|
|
1844
|
-
var
|
|
2206
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1845
2207
|
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
2208
|
var selectClass5 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1847
2209
|
var labelClass5 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1848
2210
|
function VectorSymbolsPanel({ controller, className }) {
|
|
1849
2211
|
const state = useVectorEditorState(controller);
|
|
1850
|
-
const uid = (0,
|
|
2212
|
+
const uid = (0, import_react15.useId)().replace(/:/g, "");
|
|
1851
2213
|
const panel = (0, import_vector9.getVectorSymbolsPanel)(state, { idPrefix: `vsym${uid}-` });
|
|
1852
|
-
const [error, setError] = (0,
|
|
2214
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
1853
2215
|
const report = (r) => setError(r.ok ? null : r.message ?? null);
|
|
1854
2216
|
const inst = panel.instance;
|
|
1855
|
-
return /* @__PURE__ */ (0,
|
|
1856
|
-
/* @__PURE__ */ (0,
|
|
1857
|
-
/* @__PURE__ */ (0,
|
|
1858
|
-
/* @__PURE__ */ (0,
|
|
1859
|
-
panel.editing && /* @__PURE__ */ (0,
|
|
2217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-symbols-panel": "", "aria-label": "Symbols", children: [
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: labelClass5, children: "Symbols" }),
|
|
2220
|
+
/* @__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" }),
|
|
2221
|
+
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
2222
|
] }),
|
|
1861
|
-
panel.symbols.length > 0 && /* @__PURE__ */ (0,
|
|
1862
|
-
/* @__PURE__ */ (0,
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1865
|
-
/* @__PURE__ */ (0,
|
|
2223
|
+
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: [
|
|
2224
|
+
/* @__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: [
|
|
2225
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VectorGradientDefs, { defs: s.scene.defs }),
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VectorFilterDefs, { filters: s.scene.filters }),
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(VectorSceneNodes, { nodes: s.scene.nodes })
|
|
1866
2228
|
] }),
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
2229
|
+
/* @__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
2230
|
s.name,
|
|
1869
2231
|
" ",
|
|
1870
|
-
/* @__PURE__ */ (0,
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1871
2233
|
"\xB7 ",
|
|
1872
2234
|
s.instances
|
|
1873
2235
|
] })
|
|
1874
2236
|
] }),
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1877
|
-
/* @__PURE__ */ (0,
|
|
2237
|
+
/* @__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: "+" }),
|
|
2238
|
+
/* @__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" }),
|
|
2239
|
+
/* @__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
2240
|
] }, s.id)) }),
|
|
1879
|
-
inst && /* @__PURE__ */ (0,
|
|
1880
|
-
/* @__PURE__ */ (0,
|
|
1881
|
-
/* @__PURE__ */ (0,
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
2241
|
+
inst && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", "data-vector-instance": inst.id, children: [
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2243
|
+
/* @__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)) }),
|
|
2244
|
+
/* @__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
2245
|
] }),
|
|
1884
|
-
/* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2248
|
+
/* @__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
2249
|
"Scale strokes"
|
|
1888
2250
|
] }),
|
|
1889
|
-
/* @__PURE__ */ (0,
|
|
2251
|
+
/* @__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
2252
|
"Tint",
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1892
2254
|
"input",
|
|
1893
2255
|
{
|
|
1894
2256
|
type: "color",
|
|
@@ -1899,41 +2261,41 @@ function VectorSymbolsPanel({ controller, className }) {
|
|
|
1899
2261
|
}
|
|
1900
2262
|
)
|
|
1901
2263
|
] }),
|
|
1902
|
-
inst.fill !== null && /* @__PURE__ */ (0,
|
|
2264
|
+
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
2265
|
] })
|
|
1904
2266
|
] }),
|
|
1905
|
-
error && /* @__PURE__ */ (0,
|
|
2267
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-destructive", children: error })
|
|
1906
2268
|
] });
|
|
1907
2269
|
}
|
|
1908
2270
|
|
|
1909
2271
|
// src/vector/VectorConstraintsPanel.tsx
|
|
1910
|
-
var
|
|
2272
|
+
var import_react16 = require("react");
|
|
1911
2273
|
var import_vector10 = require("@pixerate/editor/vector");
|
|
1912
|
-
var
|
|
2274
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1913
2275
|
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
2276
|
var inputClass2 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1915
2277
|
var labelClass6 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1916
2278
|
function VectorConstraintsPanel({ controller, className }) {
|
|
1917
2279
|
const state = useVectorEditorState(controller);
|
|
1918
2280
|
const panel = (0, import_vector10.getVectorConstraintPanel)(state);
|
|
1919
|
-
const [error, setError] = (0,
|
|
1920
|
-
const [param, setParam] = (0,
|
|
2281
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
2282
|
+
const [param, setParam] = (0, import_react16.useState)({ name: "", value: "" });
|
|
1921
2283
|
const report = (r) => setError(r.ok ? null : r.message ?? null);
|
|
1922
2284
|
const add = (a) => report(controller.addConstraint({ kind: a.kind, refs: a.refs }));
|
|
1923
2285
|
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,
|
|
2286
|
+
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: [
|
|
2287
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: labelClass6, children: "Constraints" }),
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex-1 truncate text-[11px] text-muted-foreground", "data-vector-dof": "", children: panel.dof.message }),
|
|
2290
|
+
/* @__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
2291
|
] }),
|
|
1930
|
-
panel.actions.length > 0 && /* @__PURE__ */ (0,
|
|
1931
|
-
panel.constraints.length > 0 && /* @__PURE__ */ (0,
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2292
|
+
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)) }),
|
|
2293
|
+
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: [
|
|
2294
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: `min-w-0 flex-1 truncate ${c.conflict || !c.satisfied ? "text-destructive" : ""}`, children: [
|
|
1933
2295
|
c.label,
|
|
1934
2296
|
c.name ? ` ${c.name}` : ""
|
|
1935
2297
|
] }),
|
|
1936
|
-
c.value !== void 0 && /* @__PURE__ */ (0,
|
|
2298
|
+
c.value !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1937
2299
|
"input",
|
|
1938
2300
|
{
|
|
1939
2301
|
"aria-label": `Value of ${c.name ?? c.id}`,
|
|
@@ -1948,12 +2310,12 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1948
2310
|
},
|
|
1949
2311
|
`${c.id}:${c.value}`
|
|
1950
2312
|
),
|
|
1951
|
-
/* @__PURE__ */ (0,
|
|
2313
|
+
/* @__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
2314
|
] }, c.id)) }),
|
|
1953
|
-
/* @__PURE__ */ (0,
|
|
1954
|
-
panel.parameters.map((p) => /* @__PURE__ */ (0,
|
|
1955
|
-
/* @__PURE__ */ (0,
|
|
1956
|
-
/* @__PURE__ */ (0,
|
|
2315
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1", "aria-label": "Parameters", children: [
|
|
2316
|
+
panel.parameters.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-12 truncate font-mono", children: p.name }),
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1957
2319
|
"input",
|
|
1958
2320
|
{
|
|
1959
2321
|
"aria-label": `Parameter ${p.name}`,
|
|
@@ -1968,9 +2330,9 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1968
2330
|
},
|
|
1969
2331
|
`${p.name}:${p.value}`
|
|
1970
2332
|
),
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
2333
|
+
/* @__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
2334
|
] }, p.name)),
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1974
2336
|
"form",
|
|
1975
2337
|
{
|
|
1976
2338
|
className: "flex items-center gap-1",
|
|
@@ -1982,20 +2344,20 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1982
2344
|
if (r.ok) setParam({ name: "", value: "" });
|
|
1983
2345
|
},
|
|
1984
2346
|
children: [
|
|
1985
|
-
/* @__PURE__ */ (0,
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
2347
|
+
/* @__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 }) }),
|
|
2348
|
+
/* @__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 }) }),
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "submit", className: buttonClass7, "aria-label": "Add parameter", children: "+" })
|
|
1988
2350
|
]
|
|
1989
2351
|
}
|
|
1990
2352
|
)
|
|
1991
2353
|
] }),
|
|
1992
|
-
error && /* @__PURE__ */ (0,
|
|
2354
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-destructive", children: error })
|
|
1993
2355
|
] });
|
|
1994
2356
|
}
|
|
1995
2357
|
|
|
1996
2358
|
// src/vector/VectorFramePanel.tsx
|
|
1997
2359
|
var import_vector11 = require("@pixerate/editor/vector");
|
|
1998
|
-
var
|
|
2360
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1999
2361
|
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
2362
|
var selectClass6 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2001
2363
|
var numberClass4 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2005,9 +2367,9 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2005
2367
|
const f = panel.frame;
|
|
2006
2368
|
const ids = f ? [f.id] : void 0;
|
|
2007
2369
|
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,
|
|
2370
|
+
const number = (key, label) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-4 text-muted-foreground", children: label }),
|
|
2372
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2011
2373
|
"input",
|
|
2012
2374
|
{
|
|
2013
2375
|
type: "number",
|
|
@@ -2027,10 +2389,10 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2027
2389
|
`${f.id}:${f.frame[key]}`
|
|
2028
2390
|
)
|
|
2029
2391
|
] });
|
|
2030
|
-
return /* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2032
|
-
/* @__PURE__ */ (0,
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-frame-panel": "", "aria-label": "Frame", children: [
|
|
2393
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Frame" }),
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2034
2396
|
"button",
|
|
2035
2397
|
{
|
|
2036
2398
|
type: "button",
|
|
@@ -2044,16 +2406,16 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2044
2406
|
}
|
|
2045
2407
|
)
|
|
2046
2408
|
] }),
|
|
2047
|
-
f && /* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2409
|
+
f && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-2", "data-vector-frame": f.id, children: [
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-2 gap-1", children: [
|
|
2049
2411
|
number("x", "X"),
|
|
2050
2412
|
number("y", "Y"),
|
|
2051
2413
|
number("width", "W"),
|
|
2052
2414
|
number("height", "H")
|
|
2053
2415
|
] }),
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
2055
|
-
/* @__PURE__ */ (0,
|
|
2056
|
-
/* @__PURE__ */ (0,
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex w-16 items-center gap-1.5 text-xs text-foreground", children: [
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2057
2419
|
"input",
|
|
2058
2420
|
{
|
|
2059
2421
|
type: "checkbox",
|
|
@@ -2064,7 +2426,7 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2064
2426
|
),
|
|
2065
2427
|
"Fill"
|
|
2066
2428
|
] }),
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2429
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2068
2430
|
"input",
|
|
2069
2431
|
{
|
|
2070
2432
|
type: "color",
|
|
@@ -2075,16 +2437,16 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2075
2437
|
onChange: (e) => controller.setFrame({ fill: e.target.value }, { ids, merge: "frame-fill" })
|
|
2076
2438
|
}
|
|
2077
2439
|
),
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
/* @__PURE__ */ (0,
|
|
2440
|
+
/* @__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: [
|
|
2441
|
+
/* @__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
2442
|
"Clip"
|
|
2081
2443
|
] })
|
|
2082
2444
|
] })
|
|
2083
2445
|
] }),
|
|
2084
|
-
panel.resizing && /* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2087
|
-
/* @__PURE__ */ (0,
|
|
2446
|
+
panel.resizing && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-vector-resizing": "", children: [
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16", children: "Horizontal" }),
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2088
2450
|
"select",
|
|
2089
2451
|
{
|
|
2090
2452
|
"aria-label": "Horizontal constraint",
|
|
@@ -2092,15 +2454,15 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2092
2454
|
value: panel.resizing.horizontal,
|
|
2093
2455
|
onChange: (e) => controller.setResizing({ horizontal: e.target.value }, { ids: panel.resizing.ids }),
|
|
2094
2456
|
children: [
|
|
2095
|
-
panel.resizing.horizontal === "mixed" && /* @__PURE__ */ (0,
|
|
2096
|
-
import_vector11.VECTOR_HORIZONTAL_RESIZING.map((h) => /* @__PURE__ */ (0,
|
|
2457
|
+
panel.resizing.horizontal === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "mixed", disabled: true, children: "Mixed" }),
|
|
2458
|
+
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
2459
|
]
|
|
2098
2460
|
}
|
|
2099
2461
|
)
|
|
2100
2462
|
] }),
|
|
2101
|
-
/* @__PURE__ */ (0,
|
|
2102
|
-
/* @__PURE__ */ (0,
|
|
2103
|
-
/* @__PURE__ */ (0,
|
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2464
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16", children: "Vertical" }),
|
|
2465
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2104
2466
|
"select",
|
|
2105
2467
|
{
|
|
2106
2468
|
"aria-label": "Vertical constraint",
|
|
@@ -2108,8 +2470,8 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2108
2470
|
value: panel.resizing.vertical,
|
|
2109
2471
|
onChange: (e) => controller.setResizing({ vertical: e.target.value }, { ids: panel.resizing.ids }),
|
|
2110
2472
|
children: [
|
|
2111
|
-
panel.resizing.vertical === "mixed" && /* @__PURE__ */ (0,
|
|
2112
|
-
import_vector11.VECTOR_VERTICAL_RESIZING.map((v) => /* @__PURE__ */ (0,
|
|
2473
|
+
panel.resizing.vertical === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "mixed", disabled: true, children: "Mixed" }),
|
|
2474
|
+
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
2475
|
]
|
|
2114
2476
|
}
|
|
2115
2477
|
)
|
|
@@ -2120,7 +2482,7 @@ function VectorFramePanel({ controller, className }) {
|
|
|
2120
2482
|
|
|
2121
2483
|
// src/vector/VectorPagesPanel.tsx
|
|
2122
2484
|
var import_vector12 = require("@pixerate/editor/vector");
|
|
2123
|
-
var
|
|
2485
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2124
2486
|
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
2487
|
var selectClass7 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2126
2488
|
function VectorPagesPanel({ controller, className }) {
|
|
@@ -2129,19 +2491,19 @@ function VectorPagesPanel({ controller, className }) {
|
|
|
2129
2491
|
const masters = (0, import_vector12.vectorMasterPages)(state.document);
|
|
2130
2492
|
const selected = state.selection.map((id) => state.document.nodes.find((n) => n.id === id)).find((n) => (0, import_vector12.isVectorFrame)(n));
|
|
2131
2493
|
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,
|
|
2494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-pages-panel": "", "aria-label": "Pages", children: [
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Pages" }),
|
|
2497
|
+
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)),
|
|
2498
|
+
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)),
|
|
2499
|
+
/* @__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" }),
|
|
2500
|
+
/* @__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
2501
|
] }),
|
|
2140
|
-
page && masters.length > 0 && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
/* @__PURE__ */ (0,
|
|
2143
|
-
/* @__PURE__ */ (0,
|
|
2144
|
-
masters.map((m) => /* @__PURE__ */ (0,
|
|
2502
|
+
page && masters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16" }),
|
|
2504
|
+
/* @__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: [
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "No master" }),
|
|
2506
|
+
masters.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m.id, children: m.name ?? "Master" }, m.id))
|
|
2145
2507
|
] })
|
|
2146
2508
|
] })
|
|
2147
2509
|
] });
|
|
@@ -2149,7 +2511,7 @@ function VectorPagesPanel({ controller, className }) {
|
|
|
2149
2511
|
|
|
2150
2512
|
// src/vector/VectorConnectorPanel.tsx
|
|
2151
2513
|
var import_vector13 = require("@pixerate/editor/vector");
|
|
2152
|
-
var
|
|
2514
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2153
2515
|
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
2516
|
var selectClass8 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2155
2517
|
var numberClass5 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2158,27 +2520,27 @@ function VectorConnectorPanel({ controller, className }) {
|
|
|
2158
2520
|
const panel = (0, import_vector13.getVectorConnectorPanel)(state);
|
|
2159
2521
|
if (!panel) return null;
|
|
2160
2522
|
const ids = [panel.id];
|
|
2161
|
-
const end = (key, label, e) => /* @__PURE__ */ (0,
|
|
2162
|
-
/* @__PURE__ */ (0,
|
|
2163
|
-
e ? /* @__PURE__ */ (0,
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
const end = (key, label, e) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", "data-vector-connector-end": key, children: [
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16 text-xs text-foreground", children: label }),
|
|
2525
|
+
e ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2165
2527
|
"select",
|
|
2166
2528
|
{
|
|
2167
2529
|
"aria-label": `${label} side`,
|
|
2168
2530
|
className: selectClass8,
|
|
2169
2531
|
value: e.side ?? "auto",
|
|
2170
2532
|
onChange: (ev) => controller.setConnector({ [key]: { nodeId: e.nodeId, side: ev.target.value } }, { ids }),
|
|
2171
|
-
children: import_vector13.VECTOR_CONNECTOR_SIDES.map((s) => /* @__PURE__ */ (0,
|
|
2533
|
+
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
2534
|
}
|
|
2173
2535
|
),
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2175
|
-
] }) : /* @__PURE__ */ (0,
|
|
2536
|
+
/* @__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" })
|
|
2537
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Free" })
|
|
2176
2538
|
] });
|
|
2177
|
-
return /* @__PURE__ */ (0,
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
2179
|
-
/* @__PURE__ */ (0,
|
|
2180
|
-
/* @__PURE__ */ (0,
|
|
2181
|
-
panel.route === "elbow" && /* @__PURE__ */ (0,
|
|
2539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-connector-panel": panel.id, "aria-label": "Connector", children: [
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Connector" }),
|
|
2542
|
+
/* @__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)) }),
|
|
2543
|
+
panel.route === "elbow" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2182
2544
|
"input",
|
|
2183
2545
|
{
|
|
2184
2546
|
type: "number",
|
|
@@ -2201,15 +2563,15 @@ function VectorConnectorPanel({ controller, className }) {
|
|
|
2201
2563
|
}
|
|
2202
2564
|
|
|
2203
2565
|
// src/vector/VectorShadingPanel.tsx
|
|
2204
|
-
var
|
|
2566
|
+
var import_react17 = require("react");
|
|
2205
2567
|
var import_vector14 = require("@pixerate/editor/vector");
|
|
2206
|
-
var
|
|
2568
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2207
2569
|
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
2570
|
var numberClass6 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
2209
2571
|
function VectorShadingPanel({ controller, className }) {
|
|
2210
2572
|
const state = useVectorEditorState(controller);
|
|
2211
|
-
const [rows, setRows] = (0,
|
|
2212
|
-
const [columns, setColumns] = (0,
|
|
2573
|
+
const [rows, setRows] = (0, import_react17.useState)(2);
|
|
2574
|
+
const [columns, setColumns] = (0, import_react17.useState)(2);
|
|
2213
2575
|
const path = state.selection.map((id) => controller.getNode(id)).find((n) => n?.type === "path");
|
|
2214
2576
|
if (!path) return null;
|
|
2215
2577
|
const fill = path.fill;
|
|
@@ -2224,38 +2586,38 @@ function VectorShadingPanel({ controller, className }) {
|
|
|
2224
2586
|
if (mesh) controller.setMeshPoint(path.id, sel.index, patch, merge ? { merge } : {});
|
|
2225
2587
|
else controller.setFreeformPoint(path.id, sel.index, patch, merge ? { merge } : {});
|
|
2226
2588
|
};
|
|
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,
|
|
2589
|
+
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: [
|
|
2590
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2591
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Shading" }),
|
|
2592
|
+
/* @__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))) }),
|
|
2593
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs text-muted-foreground", children: "\xD7" }),
|
|
2594
|
+
/* @__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))) }),
|
|
2595
|
+
/* @__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" }),
|
|
2596
|
+
/* @__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
2597
|
] }),
|
|
2236
|
-
(mesh || free) && !sel && /* @__PURE__ */ (0,
|
|
2598
|
+
(mesh || free) && !sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2237
2599
|
"Gradient tool (G): drag points; ",
|
|
2238
2600
|
free ? "click inside to add one, Alt-click to remove." : "pick one to colour it."
|
|
2239
2601
|
] }),
|
|
2240
|
-
sel && /* @__PURE__ */ (0,
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
2602
|
+
sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-vector-shading-point": sel.index, children: [
|
|
2603
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "w-16 text-xs text-foreground", children: [
|
|
2242
2604
|
"Point ",
|
|
2243
2605
|
sel.index
|
|
2244
2606
|
] }),
|
|
2245
|
-
/* @__PURE__ */ (0,
|
|
2246
|
-
/* @__PURE__ */ (0,
|
|
2247
|
-
free && /* @__PURE__ */ (0,
|
|
2248
|
-
/* @__PURE__ */ (0,
|
|
2249
|
-
/* @__PURE__ */ (0,
|
|
2607
|
+
/* @__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") }),
|
|
2608
|
+
/* @__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") }),
|
|
2609
|
+
free && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2610
|
+
/* @__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") }),
|
|
2611
|
+
/* @__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
2612
|
] })
|
|
2251
2613
|
] })
|
|
2252
2614
|
] });
|
|
2253
2615
|
}
|
|
2254
2616
|
|
|
2255
2617
|
// src/vector/VectorTracePanel.tsx
|
|
2256
|
-
var
|
|
2618
|
+
var import_react18 = require("react");
|
|
2257
2619
|
var import_vector15 = require("@pixerate/editor/vector");
|
|
2258
|
-
var
|
|
2620
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2259
2621
|
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
2622
|
var selectClass9 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2261
2623
|
var numberClass7 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2272,10 +2634,10 @@ async function filePixels(file, max = 1e6) {
|
|
|
2272
2634
|
return { width, height, data: ctx.getImageData(0, 0, width, height).data };
|
|
2273
2635
|
}
|
|
2274
2636
|
function VectorTracePanel({ controller, className }) {
|
|
2275
|
-
const input = (0,
|
|
2276
|
-
const [mode, setMode] = (0,
|
|
2277
|
-
const [colors, setColors] = (0,
|
|
2278
|
-
const [message, setMessage] = (0,
|
|
2637
|
+
const input = (0, import_react18.useRef)(null);
|
|
2638
|
+
const [mode, setMode] = (0, import_react18.useState)("threshold");
|
|
2639
|
+
const [colors, setColors] = (0, import_react18.useState)(6);
|
|
2640
|
+
const [message, setMessage] = (0, import_react18.useState)(null);
|
|
2279
2641
|
const trace = async (file) => {
|
|
2280
2642
|
try {
|
|
2281
2643
|
const pixels = await filePixels(file);
|
|
@@ -2288,17 +2650,17 @@ function VectorTracePanel({ controller, className }) {
|
|
|
2288
2650
|
setMessage("That file could not be read as an image.");
|
|
2289
2651
|
}
|
|
2290
2652
|
};
|
|
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,
|
|
2653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-1 ${className ?? ""}`, "data-vector-trace-panel": "", "aria-label": "Image trace", children: [
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Trace" }),
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { "aria-label": "Trace mode", className: selectClass9, value: mode, onChange: (e) => setMode(e.target.value), children: [
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "threshold", children: "Black & white" }),
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "color", children: "Colours" }),
|
|
2659
|
+
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
2660
|
] }),
|
|
2299
|
-
mode === "color" && /* @__PURE__ */ (0,
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2301
|
-
/* @__PURE__ */ (0,
|
|
2661
|
+
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))) }),
|
|
2662
|
+
/* @__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" }),
|
|
2663
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2302
2664
|
"input",
|
|
2303
2665
|
{
|
|
2304
2666
|
ref: input,
|
|
@@ -2313,13 +2675,13 @@ function VectorTracePanel({ controller, className }) {
|
|
|
2313
2675
|
}
|
|
2314
2676
|
)
|
|
2315
2677
|
] }),
|
|
2316
|
-
message && /* @__PURE__ */ (0,
|
|
2678
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-red-600", children: message })
|
|
2317
2679
|
] });
|
|
2318
2680
|
}
|
|
2319
2681
|
|
|
2320
2682
|
// src/vector/VectorSymmetryPanel.tsx
|
|
2321
2683
|
var import_vector16 = require("@pixerate/editor/vector");
|
|
2322
|
-
var
|
|
2684
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2323
2685
|
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
2686
|
var selectClass10 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2325
2687
|
var numberClass8 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2329,35 +2691,35 @@ function VectorSymmetryPanel({ controller, className }) {
|
|
|
2329
2691
|
const s = group?.symmetry;
|
|
2330
2692
|
const ids = group ? [group.id] : void 0;
|
|
2331
2693
|
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,
|
|
2694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-symmetry-panel": "", "aria-label": "Symmetry", children: [
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Symmetry" }),
|
|
2697
|
+
!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" }),
|
|
2698
|
+
!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" }),
|
|
2699
|
+
group && s && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2700
|
+
/* @__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)) }),
|
|
2701
|
+
s.mode === "radial" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2702
|
+
/* @__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 }) }),
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Mirror each copy too (kaleidoscope)", children: [
|
|
2704
|
+
/* @__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
2705
|
"Mirror"
|
|
2344
2706
|
] })
|
|
2345
2707
|
] })
|
|
2346
2708
|
] })
|
|
2347
2709
|
] }),
|
|
2348
|
-
group && /* @__PURE__ */ (0,
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2351
|
-
/* @__PURE__ */ (0,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2710
|
+
group && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2711
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16" }),
|
|
2712
|
+
/* @__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" }),
|
|
2713
|
+
/* @__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" }),
|
|
2714
|
+
/* @__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
2715
|
] })
|
|
2354
2716
|
] });
|
|
2355
2717
|
}
|
|
2356
2718
|
|
|
2357
2719
|
// src/vector/VectorPerspectivePanel.tsx
|
|
2358
|
-
var
|
|
2720
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
2359
2721
|
var import_vector17 = require("@pixerate/editor/vector");
|
|
2360
|
-
var
|
|
2722
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2361
2723
|
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
2724
|
var selectClass11 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2363
2725
|
var PLANE_LABELS = { floor: "Floor", left: "Left wall", right: "Right wall", side: "Side wall", front: "Front" };
|
|
@@ -2365,43 +2727,43 @@ function VectorPerspectivePanel({ controller, className }) {
|
|
|
2365
2727
|
const state = useVectorEditorState(controller);
|
|
2366
2728
|
const grid = state.document.perspective ?? null;
|
|
2367
2729
|
const planes = grid ? (0, import_vector17.vectorPerspectivePlanes)(grid) : [];
|
|
2368
|
-
const [attachTo, setAttachTo] =
|
|
2730
|
+
const [attachTo, setAttachTo] = import_react19.default.useState("");
|
|
2369
2731
|
const target = (state.perspectivePlane ?? attachTo) || planes[0];
|
|
2370
2732
|
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,
|
|
2733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-perspective-panel": "", "aria-label": "Perspective", children: [
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Perspective" }),
|
|
2736
|
+
[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
2737
|
n,
|
|
2376
2738
|
"-pt"
|
|
2377
2739
|
] }, n))
|
|
2378
2740
|
] }),
|
|
2379
|
-
grid && /* @__PURE__ */ (0,
|
|
2380
|
-
/* @__PURE__ */ (0,
|
|
2381
|
-
/* @__PURE__ */ (0,
|
|
2382
|
-
/* @__PURE__ */ (0,
|
|
2383
|
-
planes.map((p) => /* @__PURE__ */ (0,
|
|
2741
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-16" }),
|
|
2743
|
+
/* @__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: [
|
|
2744
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Draw flat" }),
|
|
2745
|
+
planes.map((p) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("option", { value: p, children: [
|
|
2384
2746
|
"Draw on ",
|
|
2385
2747
|
PLANE_LABELS[p].toLowerCase()
|
|
2386
2748
|
] }, p))
|
|
2387
2749
|
] })
|
|
2388
2750
|
] }),
|
|
2389
|
-
grid && /* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2391
|
-
!state.perspectivePlane && /* @__PURE__ */ (0,
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2751
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2752
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-16" }),
|
|
2753
|
+
!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)) }),
|
|
2754
|
+
/* @__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" }),
|
|
2755
|
+
/* @__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: [
|
|
2756
|
+
/* @__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
2757
|
"Show"
|
|
2396
2758
|
] }),
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2759
|
+
/* @__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
2760
|
] })
|
|
2399
2761
|
] });
|
|
2400
2762
|
}
|
|
2401
2763
|
|
|
2402
2764
|
// src/vector/VectorLensPanel.tsx
|
|
2403
2765
|
var import_vector18 = require("@pixerate/editor/vector");
|
|
2404
|
-
var
|
|
2766
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2405
2767
|
var selectClass12 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2406
2768
|
var numberClass9 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
2407
2769
|
function VectorLensPanel({ controller, className }) {
|
|
@@ -2411,10 +2773,10 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2411
2773
|
const lens = path.lens ?? null;
|
|
2412
2774
|
const spec = lens ? import_vector18.VECTOR_LENS_SPECS[lens.type] : null;
|
|
2413
2775
|
const ids = [path.id];
|
|
2414
|
-
return /* @__PURE__ */ (0,
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-lens-panel": "", "aria-label": "Lens", children: [
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Lens" }),
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2418
2780
|
"select",
|
|
2419
2781
|
{
|
|
2420
2782
|
"aria-label": "Lens type",
|
|
@@ -2422,15 +2784,15 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2422
2784
|
value: lens?.type ?? "",
|
|
2423
2785
|
onChange: (e) => e.target.value ? controller.setLens({ type: e.target.value }, { ids }) : controller.setLens(null, { ids }),
|
|
2424
2786
|
children: [
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2426
|
-
import_vector18.VECTOR_LENS_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "None" }),
|
|
2788
|
+
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
2789
|
]
|
|
2428
2790
|
}
|
|
2429
2791
|
)
|
|
2430
2792
|
] }),
|
|
2431
|
-
lens && spec && /* @__PURE__ */ (0,
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2433
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
lens && spec && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-16" }),
|
|
2795
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2434
2796
|
"input",
|
|
2435
2797
|
{
|
|
2436
2798
|
type: "number",
|
|
@@ -2447,14 +2809,14 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2447
2809
|
}
|
|
2448
2810
|
}
|
|
2449
2811
|
),
|
|
2450
|
-
spec.color !== null && /* @__PURE__ */ (0,
|
|
2812
|
+
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
2813
|
] })
|
|
2452
2814
|
] });
|
|
2453
2815
|
}
|
|
2454
2816
|
|
|
2455
2817
|
// src/vector/VectorGradientEditor.tsx
|
|
2456
2818
|
var import_vector19 = require("@pixerate/editor/vector");
|
|
2457
|
-
var
|
|
2819
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2458
2820
|
var selectClass13 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2459
2821
|
var numberClass10 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
2460
2822
|
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 +2834,23 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2472
2834
|
controller.setStyle({ [ed.target]: (0, import_vector19.vectorPaintToHex)(first?.color) ?? first?.color ?? "#000000" }, void 0, { label: "Solid Colour" });
|
|
2473
2835
|
} else controller.setGradient({ type: value });
|
|
2474
2836
|
};
|
|
2475
|
-
return /* @__PURE__ */ (0,
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
2478
|
-
["fill", "stroke"].map((t) => /* @__PURE__ */ (0,
|
|
2479
|
-
ed.mixed && /* @__PURE__ */ (0,
|
|
2837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `space-y-1.5 ${className ?? ""}`, "data-vector-gradient-editor": ed.target, "aria-label": "Gradient", children: [
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Gradient" }),
|
|
2840
|
+
["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)),
|
|
2841
|
+
ed.mixed && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
2480
2842
|
] }),
|
|
2481
|
-
/* @__PURE__ */ (0,
|
|
2482
|
-
/* @__PURE__ */ (0,
|
|
2483
|
-
/* @__PURE__ */ (0,
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2485
|
-
import_vector19.VECTOR_GRADIENT_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Type" }),
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("select", { "aria-label": "Gradient type", className: selectClass13, value: ed.type ?? "solid", onChange: (e) => setType(e.target.value), children: [
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "solid", children: "Solid" }),
|
|
2847
|
+
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
2848
|
] }),
|
|
2487
|
-
/* @__PURE__ */ (0,
|
|
2849
|
+
/* @__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
2850
|
] }),
|
|
2489
|
-
g && /* @__PURE__ */ (0,
|
|
2490
|
-
/* @__PURE__ */ (0,
|
|
2491
|
-
/* @__PURE__ */ (0,
|
|
2851
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative h-8", "data-vector-gradient-ramp": "", children: [
|
|
2853
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2492
2854
|
"div",
|
|
2493
2855
|
{
|
|
2494
2856
|
role: "button",
|
|
@@ -2502,7 +2864,7 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2502
2864
|
}
|
|
2503
2865
|
}
|
|
2504
2866
|
),
|
|
2505
|
-
ed.stops.map((s) => /* @__PURE__ */ (0,
|
|
2867
|
+
ed.stops.map((s) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2506
2868
|
"button",
|
|
2507
2869
|
{
|
|
2508
2870
|
type: "button",
|
|
@@ -2516,8 +2878,8 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2516
2878
|
s.index
|
|
2517
2879
|
))
|
|
2518
2880
|
] }),
|
|
2519
|
-
sel && /* @__PURE__ */ (0,
|
|
2520
|
-
/* @__PURE__ */ (0,
|
|
2881
|
+
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: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2521
2883
|
"input",
|
|
2522
2884
|
{
|
|
2523
2885
|
type: "color",
|
|
@@ -2528,9 +2890,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2528
2890
|
onBlur: end
|
|
2529
2891
|
}
|
|
2530
2892
|
),
|
|
2531
|
-
/* @__PURE__ */ (0,
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2532
2894
|
"Opacity",
|
|
2533
|
-
/* @__PURE__ */ (0,
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2534
2896
|
"input",
|
|
2535
2897
|
{
|
|
2536
2898
|
type: "number",
|
|
@@ -2547,9 +2909,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2547
2909
|
}
|
|
2548
2910
|
)
|
|
2549
2911
|
] }),
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2551
2913
|
"At",
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2553
2915
|
"input",
|
|
2554
2916
|
{
|
|
2555
2917
|
type: "number",
|
|
@@ -2566,9 +2928,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2566
2928
|
}
|
|
2567
2929
|
)
|
|
2568
2930
|
] }),
|
|
2569
|
-
!sel.last && /* @__PURE__ */ (0,
|
|
2931
|
+
!sel.last && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2570
2932
|
"Midpoint",
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2572
2934
|
"input",
|
|
2573
2935
|
{
|
|
2574
2936
|
type: "number",
|
|
@@ -2585,15 +2947,15 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2585
2947
|
}
|
|
2586
2948
|
)
|
|
2587
2949
|
] }),
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
2950
|
+
/* @__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
2951
|
] }),
|
|
2590
|
-
/* @__PURE__ */ (0,
|
|
2591
|
-
/* @__PURE__ */ (0,
|
|
2592
|
-
/* @__PURE__ */ (0,
|
|
2952
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "Colours" }),
|
|
2954
|
+
/* @__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
2955
|
] }),
|
|
2594
|
-
/* @__PURE__ */ (0,
|
|
2595
|
-
/* @__PURE__ */ (0,
|
|
2596
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2957
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "Smooth" }),
|
|
2958
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2597
2959
|
"input",
|
|
2598
2960
|
{
|
|
2599
2961
|
type: "range",
|
|
@@ -2609,20 +2971,20 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2609
2971
|
}
|
|
2610
2972
|
)
|
|
2611
2973
|
] }),
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
2613
|
-
/* @__PURE__ */ (0,
|
|
2614
|
-
/* @__PURE__ */ (0,
|
|
2974
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "Spread" }),
|
|
2976
|
+
/* @__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
2977
|
] }),
|
|
2616
|
-
ed.target === "stroke" && /* @__PURE__ */ (0,
|
|
2617
|
-
/* @__PURE__ */ (0,
|
|
2618
|
-
/* @__PURE__ */ (0,
|
|
2978
|
+
ed.target === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-16", children: "On stroke" }),
|
|
2980
|
+
/* @__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
2981
|
] })
|
|
2620
2982
|
] })
|
|
2621
2983
|
] });
|
|
2622
2984
|
}
|
|
2623
2985
|
|
|
2624
2986
|
// src/vector/VectorToolbar.tsx
|
|
2625
|
-
var
|
|
2987
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2626
2988
|
var VECTOR_SNAP_TITLE = "Snap to objects";
|
|
2627
2989
|
var modKeyLabel = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform ?? "") ? "\u2318" : "Ctrl";
|
|
2628
2990
|
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 +3005,11 @@ function VectorToolbar({
|
|
|
2643
3005
|
const editing = state.editing;
|
|
2644
3006
|
const groupSelected = state.selection.some((id) => controller.getNode(id)?.type === "group");
|
|
2645
3007
|
const maskSelected = state.selection.some((id) => (0, import_vector20.isVectorMaskGroup)(controller.getNode(id)));
|
|
2646
|
-
const [live, setLive] =
|
|
3008
|
+
const [live, setLive] = import_react20.default.useState(false);
|
|
2647
3009
|
const booleanDisabled = live ? count < 1 : count < 2;
|
|
2648
|
-
const act = (label, title, run, disabled = false) => /* @__PURE__ */ (0,
|
|
2649
|
-
return /* @__PURE__ */ (0,
|
|
2650
|
-
/* @__PURE__ */ (0,
|
|
3010
|
+
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);
|
|
3011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { role: "toolbar", "aria-label": "Vector tools", className: `flex flex-wrap items-center gap-1 ${className ?? ""}`, children: [
|
|
3012
|
+
/* @__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
3013
|
"button",
|
|
2652
3014
|
{
|
|
2653
3015
|
type: "button",
|
|
@@ -2661,12 +3023,12 @@ function VectorToolbar({
|
|
|
2661
3023
|
},
|
|
2662
3024
|
tool
|
|
2663
3025
|
)) }),
|
|
2664
|
-
showHistory && /* @__PURE__ */ (0,
|
|
3026
|
+
showHistory && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "History", children: [
|
|
2665
3027
|
act("\u21B6", state.canUndo ? `Undo ${state.undoLabel}` : "Undo", () => controller.undo(), !state.canUndo),
|
|
2666
3028
|
act("\u21B7", state.canRedo ? `Redo ${state.redoLabel}` : "Redo", () => controller.redo(), !state.canRedo)
|
|
2667
3029
|
] }),
|
|
2668
|
-
showSnap && /* @__PURE__ */ (0,
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
3030
|
+
showSnap && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Snapping", children: [
|
|
3031
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2670
3032
|
"button",
|
|
2671
3033
|
{
|
|
2672
3034
|
type: "button",
|
|
@@ -2679,7 +3041,7 @@ function VectorToolbar({
|
|
|
2679
3041
|
children: "Snap"
|
|
2680
3042
|
}
|
|
2681
3043
|
),
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2683
3045
|
"select",
|
|
2684
3046
|
{
|
|
2685
3047
|
"data-vector-polar": "",
|
|
@@ -2689,8 +3051,8 @@ function VectorToolbar({
|
|
|
2689
3051
|
value: String((0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) ?? ""),
|
|
2690
3052
|
onChange: (e) => controller.setSnap({ angles: (0, import_vector20.vectorPolarAngles)(Number(e.target.value)) }),
|
|
2691
3053
|
children: [
|
|
2692
|
-
(0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) === null && /* @__PURE__ */ (0,
|
|
2693
|
-
[90, 45, 30, 15].map((n) => /* @__PURE__ */ (0,
|
|
3054
|
+
(0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) === null && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "Custom" }),
|
|
3055
|
+
[90, 45, 30, 15].map((n) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("option", { value: n, children: [
|
|
2694
3056
|
n,
|
|
2695
3057
|
"\xB0"
|
|
2696
3058
|
] }, n))
|
|
@@ -2698,8 +3060,8 @@ function VectorToolbar({
|
|
|
2698
3060
|
}
|
|
2699
3061
|
)
|
|
2700
3062
|
] }),
|
|
2701
|
-
showPathEdit && /* @__PURE__ */ (0,
|
|
2702
|
-
import_vector20.VECTOR_PATH_ACTIONS.map((a) => /* @__PURE__ */ (0,
|
|
3063
|
+
showPathEdit && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Path editing", children: [
|
|
3064
|
+
import_vector20.VECTOR_PATH_ACTIONS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2703
3065
|
"button",
|
|
2704
3066
|
{
|
|
2705
3067
|
type: "button",
|
|
@@ -2713,7 +3075,7 @@ function VectorToolbar({
|
|
|
2713
3075
|
},
|
|
2714
3076
|
a.id
|
|
2715
3077
|
)),
|
|
2716
|
-
import_vector20.VECTOR_EDIT_TOGGLES.map((t) => /* @__PURE__ */ (0,
|
|
3078
|
+
import_vector20.VECTOR_EDIT_TOGGLES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2717
3079
|
"button",
|
|
2718
3080
|
{
|
|
2719
3081
|
type: "button",
|
|
@@ -2727,9 +3089,9 @@ function VectorToolbar({
|
|
|
2727
3089
|
},
|
|
2728
3090
|
t.key
|
|
2729
3091
|
)),
|
|
2730
|
-
state.tool === "pencil" && /* @__PURE__ */ (0,
|
|
3092
|
+
state.tool === "pencil" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2731
3093
|
"Smoothing",
|
|
2732
|
-
/* @__PURE__ */ (0,
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2733
3095
|
"input",
|
|
2734
3096
|
{
|
|
2735
3097
|
type: "range",
|
|
@@ -2743,9 +3105,9 @@ function VectorToolbar({
|
|
|
2743
3105
|
}
|
|
2744
3106
|
)
|
|
2745
3107
|
] }),
|
|
2746
|
-
state.tool === "eraser" && /* @__PURE__ */ (0,
|
|
3108
|
+
state.tool === "eraser" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2747
3109
|
"Size",
|
|
2748
|
-
/* @__PURE__ */ (0,
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2749
3111
|
"input",
|
|
2750
3112
|
{
|
|
2751
3113
|
type: "number",
|
|
@@ -2761,21 +3123,21 @@ function VectorToolbar({
|
|
|
2761
3123
|
}
|
|
2762
3124
|
)
|
|
2763
3125
|
] }),
|
|
2764
|
-
state.tool === "distort" && /* @__PURE__ */ (0,
|
|
2765
|
-
/* @__PURE__ */ (0,
|
|
2766
|
-
/* @__PURE__ */ (0,
|
|
3126
|
+
state.tool === "distort" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex flex-wrap items-center gap-1", "data-vector-distort-options": "", children: [
|
|
3127
|
+
/* @__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)) }),
|
|
3128
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2767
3129
|
"Size",
|
|
2768
|
-
/* @__PURE__ */ (0,
|
|
3130
|
+
/* @__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
3131
|
const n = parseFloat(e.target.value);
|
|
2770
3132
|
if (Number.isFinite(n) && n > 0) controller.setEditing({ distortSize: n });
|
|
2771
3133
|
} })
|
|
2772
3134
|
] }),
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2774
3136
|
"Strength",
|
|
2775
|
-
/* @__PURE__ */ (0,
|
|
3137
|
+
/* @__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
3138
|
] })
|
|
2777
3139
|
] }),
|
|
2778
|
-
state.tool === "paintBucket" && /* @__PURE__ */ (0,
|
|
3140
|
+
state.tool === "paintBucket" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2779
3141
|
"button",
|
|
2780
3142
|
{
|
|
2781
3143
|
type: "button",
|
|
@@ -2789,7 +3151,7 @@ function VectorToolbar({
|
|
|
2789
3151
|
}
|
|
2790
3152
|
)
|
|
2791
3153
|
] }),
|
|
2792
|
-
showDistort && /* @__PURE__ */ (0,
|
|
3154
|
+
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
3155
|
"button",
|
|
2794
3156
|
{
|
|
2795
3157
|
type: "button",
|
|
@@ -2802,10 +3164,10 @@ function VectorToolbar({
|
|
|
2802
3164
|
children: "Distort"
|
|
2803
3165
|
}
|
|
2804
3166
|
) }),
|
|
2805
|
-
showBlend && /* @__PURE__ */ (0,
|
|
2806
|
-
showArrange && /* @__PURE__ */ (0,
|
|
2807
|
-
/* @__PURE__ */ (0,
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
3167
|
+
showBlend && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorBlendControls, { controller }),
|
|
3168
|
+
showArrange && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Combine", children: [
|
|
3170
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2809
3171
|
"button",
|
|
2810
3172
|
{
|
|
2811
3173
|
type: "button",
|
|
@@ -2827,7 +3189,7 @@ function VectorToolbar({
|
|
|
2827
3189
|
act("\u25D0", `Make Clipping Mask (${modKeyLabel()}+7)`, () => controller.makeMask("clip"), count < 2),
|
|
2828
3190
|
act("\u25D1", `Release Mask (${modKeyLabel()}+Alt+7)`, () => controller.releaseMask(), !maskSelected)
|
|
2829
3191
|
] }),
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
3192
|
+
/* @__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
3193
|
"button",
|
|
2832
3194
|
{
|
|
2833
3195
|
type: "button",
|
|
@@ -2841,7 +3203,7 @@ function VectorToolbar({
|
|
|
2841
3203
|
},
|
|
2842
3204
|
a.id
|
|
2843
3205
|
)) }),
|
|
2844
|
-
/* @__PURE__ */ (0,
|
|
3206
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Arrange", children: [
|
|
2845
3207
|
act("\u21C8", "Bring to Front", () => controller.arrange("front"), count < 1),
|
|
2846
3208
|
act("\u21CA", "Send to Back", () => controller.arrange("back"), count < 1),
|
|
2847
3209
|
act("\u21E4", "Align Left", () => controller.align("left"), count < 1),
|
|
@@ -2859,19 +3221,19 @@ function VectorBlendControls({ controller }) {
|
|
|
2859
3221
|
const blend = (0, import_vector20.getVectorBlendControls)(state);
|
|
2860
3222
|
const o = blend.options;
|
|
2861
3223
|
const selected = blend.ids.length > 0;
|
|
2862
|
-
return /* @__PURE__ */ (0,
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
3224
|
+
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: [
|
|
3225
|
+
/* @__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" }),
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2865
3227
|
"select",
|
|
2866
3228
|
{
|
|
2867
3229
|
"aria-label": "Blend spacing",
|
|
2868
3230
|
className: "h-7 rounded border border-border bg-background px-1 text-xs",
|
|
2869
3231
|
value: o.spacing,
|
|
2870
3232
|
onChange: (e) => (0, import_vector20.applyVectorBlendOptions)(controller, { spacing: e.target.value }),
|
|
2871
|
-
children: import_vector20.VECTOR_BLEND_SPACINGS.map((sp) => /* @__PURE__ */ (0,
|
|
3233
|
+
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
3234
|
}
|
|
2873
3235
|
),
|
|
2874
|
-
o.spacing !== "smoothColor" && /* @__PURE__ */ (0,
|
|
3236
|
+
o.spacing !== "smoothColor" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2875
3237
|
"input",
|
|
2876
3238
|
{
|
|
2877
3239
|
type: "number",
|
|
@@ -2887,7 +3249,7 @@ function VectorBlendControls({ controller }) {
|
|
|
2887
3249
|
}
|
|
2888
3250
|
}
|
|
2889
3251
|
),
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2891
3253
|
"button",
|
|
2892
3254
|
{
|
|
2893
3255
|
type: "button",
|
|
@@ -2900,7 +3262,7 @@ function VectorBlendControls({ controller }) {
|
|
|
2900
3262
|
children: "\u293F"
|
|
2901
3263
|
}
|
|
2902
3264
|
),
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2904
3266
|
"button",
|
|
2905
3267
|
{
|
|
2906
3268
|
type: "button",
|
|
@@ -2913,8 +3275,8 @@ function VectorBlendControls({ controller }) {
|
|
|
2913
3275
|
children: "\u2307"
|
|
2914
3276
|
}
|
|
2915
3277
|
),
|
|
2916
|
-
/* @__PURE__ */ (0,
|
|
2917
|
-
/* @__PURE__ */ (0,
|
|
3278
|
+
/* @__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" }),
|
|
3279
|
+
/* @__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
3280
|
] });
|
|
2919
3281
|
}
|
|
2920
3282
|
var selectClass14 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -2950,17 +3312,17 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2950
3312
|
if (style) controller.setWidthProfile(id);
|
|
2951
3313
|
else controller.setDefaults({ strokeWidthProfile: (0, import_vector20.widthProfilePreset)(id)?.length ? (0, import_vector20.widthProfilePreset)(id) : null });
|
|
2952
3314
|
};
|
|
2953
|
-
const mixed = (key) => style?.mixed[key] ? /* @__PURE__ */ (0,
|
|
3315
|
+
const mixed = (key) => style?.mixed[key] ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" }) : null;
|
|
2954
3316
|
const arrowRow = (end, label) => {
|
|
2955
3317
|
const key = end === "start" ? "startArrow" : "endArrow";
|
|
2956
3318
|
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,
|
|
3319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": key, children: [
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16 text-xs text-foreground", children: label }),
|
|
3321
|
+
/* @__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: [
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "None" }),
|
|
3323
|
+
import_vector20.VECTOR_ARROWHEADS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: h, children: import_vector20.VECTOR_ARROWHEAD_LABELS[h] }, h))
|
|
2962
3324
|
] }),
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
3325
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2964
3326
|
"input",
|
|
2965
3327
|
{
|
|
2966
3328
|
type: "number",
|
|
@@ -2986,12 +3348,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2986
3348
|
const paint = source[key];
|
|
2987
3349
|
const hex = (0, import_vector20.vectorPaintToHex)(paint);
|
|
2988
3350
|
const on = paint !== null && paint !== "none";
|
|
2989
|
-
return /* @__PURE__ */ (0,
|
|
2990
|
-
/* @__PURE__ */ (0,
|
|
2991
|
-
/* @__PURE__ */ (0,
|
|
3351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": key, children: [
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex w-16 items-center gap-1.5 text-xs text-foreground", children: [
|
|
3353
|
+
/* @__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
3354
|
label
|
|
2993
3355
|
] }),
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2995
3357
|
"input",
|
|
2996
3358
|
{
|
|
2997
3359
|
type: "color",
|
|
@@ -3002,18 +3364,18 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3002
3364
|
onChange: (e) => apply({ [key]: e.target.value })
|
|
3003
3365
|
}
|
|
3004
3366
|
),
|
|
3005
|
-
on && !hex && /* @__PURE__ */ (0,
|
|
3006
|
-
style?.mixed[key] && /* @__PURE__ */ (0,
|
|
3367
|
+
on && !hex && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: typeof paint === "string" ? paint : "Gradient" }),
|
|
3368
|
+
style?.mixed[key] && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
3007
3369
|
] });
|
|
3008
3370
|
};
|
|
3009
|
-
return /* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "aria-label": style ? "Selection style" : "New shape style", children: [
|
|
3372
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: style ? "Selection" : "New shapes" }),
|
|
3011
3373
|
paintRow("fill", "Fill"),
|
|
3012
3374
|
paintRow("stroke", "Stroke"),
|
|
3013
|
-
style && /* @__PURE__ */ (0,
|
|
3014
|
-
/* @__PURE__ */ (0,
|
|
3015
|
-
/* @__PURE__ */ (0,
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3375
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorGradientEditor, { controller }),
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
3377
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Width" }),
|
|
3378
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3017
3379
|
"input",
|
|
3018
3380
|
{
|
|
3019
3381
|
type: "number",
|
|
@@ -3029,14 +3391,14 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3029
3391
|
}
|
|
3030
3392
|
)
|
|
3031
3393
|
] }),
|
|
3032
|
-
/* @__PURE__ */ (0,
|
|
3033
|
-
/* @__PURE__ */ (0,
|
|
3034
|
-
/* @__PURE__ */ (0,
|
|
3394
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "strokeAlign", children: [
|
|
3395
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Align" }),
|
|
3396
|
+
/* @__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
3397
|
mixed("strokeAlign")
|
|
3036
3398
|
] }),
|
|
3037
|
-
/* @__PURE__ */ (0,
|
|
3038
|
-
/* @__PURE__ */ (0,
|
|
3039
|
-
/* @__PURE__ */ (0,
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "widthProfile", children: [
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Profile" }),
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3040
3402
|
"select",
|
|
3041
3403
|
{
|
|
3042
3404
|
"aria-label": "Width profile",
|
|
@@ -3046,12 +3408,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3046
3408
|
if (e.target.value !== "custom") setProfile(e.target.value);
|
|
3047
3409
|
},
|
|
3048
3410
|
children: [
|
|
3049
|
-
import_vector20.VECTOR_WIDTH_PRESETS.map((p) => /* @__PURE__ */ (0,
|
|
3050
|
-
source.widthProfile === "custom" && /* @__PURE__ */ (0,
|
|
3411
|
+
import_vector20.VECTOR_WIDTH_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: p.id, children: p.label }, p.id)),
|
|
3412
|
+
source.widthProfile === "custom" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "custom", disabled: true, children: "Custom" })
|
|
3051
3413
|
]
|
|
3052
3414
|
}
|
|
3053
3415
|
),
|
|
3054
|
-
/* @__PURE__ */ (0,
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3055
3417
|
"button",
|
|
3056
3418
|
{
|
|
3057
3419
|
type: "button",
|
|
@@ -3065,20 +3427,20 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3065
3427
|
),
|
|
3066
3428
|
mixed("widthProfile")
|
|
3067
3429
|
] }),
|
|
3068
|
-
source.hasOpenPath && /* @__PURE__ */ (0,
|
|
3430
|
+
source.hasOpenPath && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3069
3431
|
arrowRow("start", "Start"),
|
|
3070
3432
|
arrowRow("end", "End"),
|
|
3071
|
-
(source.startArrow || source.endArrow) && /* @__PURE__ */ (0,
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3073
|
-
/* @__PURE__ */ (0,
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3075
|
-
/* @__PURE__ */ (0,
|
|
3433
|
+
(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: [
|
|
3434
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Heads" }),
|
|
3435
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("select", { "aria-label": "Arrowhead alignment", className: selectClass14, value: source.arrowAlign, onChange: (e) => apply({ arrowAlign: e.target.value }), children: [
|
|
3436
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "extend", children: "Tip past end" }),
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "tip", children: "Tip at end" })
|
|
3076
3438
|
] })
|
|
3077
3439
|
] })
|
|
3078
3440
|
] }),
|
|
3079
|
-
source.corners > 0 && /* @__PURE__ */ (0,
|
|
3080
|
-
/* @__PURE__ */ (0,
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3441
|
+
source.corners > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": "corners", children: [
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Corners" }),
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3082
3444
|
"input",
|
|
3083
3445
|
{
|
|
3084
3446
|
type: "number",
|
|
@@ -3093,12 +3455,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3093
3455
|
}
|
|
3094
3456
|
}
|
|
3095
3457
|
),
|
|
3096
|
-
/* @__PURE__ */ (0,
|
|
3458
|
+
/* @__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
3459
|
mixed("cornerRadius")
|
|
3098
3460
|
] }),
|
|
3099
|
-
style && source.corners > 0 && source.cornerKind === "round" && source.cornerRadius > 0 && /* @__PURE__ */ (0,
|
|
3100
|
-
/* @__PURE__ */ (0,
|
|
3101
|
-
/* @__PURE__ */ (0,
|
|
3461
|
+
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: [
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Smoothing" }),
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3102
3464
|
"input",
|
|
3103
3465
|
{
|
|
3104
3466
|
type: "range",
|
|
@@ -3113,9 +3475,9 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3113
3475
|
}
|
|
3114
3476
|
)
|
|
3115
3477
|
] }),
|
|
3116
|
-
style && /* @__PURE__ */ (0,
|
|
3117
|
-
/* @__PURE__ */ (0,
|
|
3118
|
-
/* @__PURE__ */ (0,
|
|
3478
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
3479
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-16", children: "Opacity" }),
|
|
3480
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3119
3481
|
"input",
|
|
3120
3482
|
{
|
|
3121
3483
|
type: "range",
|
|
@@ -3129,36 +3491,36 @@ function VectorStylePanel({ controller, className }) {
|
|
|
3129
3491
|
}
|
|
3130
3492
|
)
|
|
3131
3493
|
] }),
|
|
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,
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorTextPanel, { controller }),
|
|
3495
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorAppearancePanel, { controller }),
|
|
3496
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorEffectsPanel, { controller }),
|
|
3497
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorEnvelopePanel, { controller }),
|
|
3498
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorMaskPanel, { controller }),
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorFramePanel, { controller }),
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorPagesPanel, { controller }),
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorConnectorPanel, { controller }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorShadingPanel, { controller }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorSymmetryPanel, { controller }),
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorPerspectivePanel, { controller }),
|
|
3505
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorLensPanel, { controller }),
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorTracePanel, { controller }),
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorConstraintsPanel, { controller }),
|
|
3508
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VectorSymbolsPanel, { controller })
|
|
3147
3509
|
] });
|
|
3148
3510
|
}
|
|
3149
3511
|
|
|
3150
3512
|
// src/effects/useEffects.ts
|
|
3151
|
-
var
|
|
3513
|
+
var import_react21 = require("react");
|
|
3152
3514
|
function useEffects(host, provider) {
|
|
3153
|
-
(0,
|
|
3515
|
+
(0, import_react21.useEffect)(() => {
|
|
3154
3516
|
if (!host || !provider) return;
|
|
3155
3517
|
return host.useEffects(provider);
|
|
3156
3518
|
}, [host, provider]);
|
|
3157
3519
|
}
|
|
3158
3520
|
function useEffectDescription(provider, effect) {
|
|
3159
|
-
const [state, setState] = (0,
|
|
3521
|
+
const [state, setState] = (0, import_react21.useState)({ key: "", description: null, error: null });
|
|
3160
3522
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
3161
|
-
(0,
|
|
3523
|
+
(0, import_react21.useEffect)(() => {
|
|
3162
3524
|
if (!provider || !effect) return;
|
|
3163
3525
|
let live = true;
|
|
3164
3526
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -3173,14 +3535,14 @@ function useEffectDescription(provider, effect) {
|
|
|
3173
3535
|
}
|
|
3174
3536
|
|
|
3175
3537
|
// src/effects/EffectThumbnail.tsx
|
|
3176
|
-
var
|
|
3538
|
+
var import_react22 = require("react");
|
|
3177
3539
|
var import_effects = require("@pixerate/editor/effects");
|
|
3178
|
-
var
|
|
3540
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3179
3541
|
var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
|
|
3180
3542
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
3181
|
-
const ref = (0,
|
|
3182
|
-
const [failed, setFailed] = (0,
|
|
3183
|
-
(0,
|
|
3543
|
+
const ref = (0, import_react22.useRef)(null);
|
|
3544
|
+
const [failed, setFailed] = (0, import_react22.useState)(effect.kind in LABELS);
|
|
3545
|
+
(0, import_react22.useEffect)(() => {
|
|
3184
3546
|
if (effect.kind in LABELS) return;
|
|
3185
3547
|
let live = true;
|
|
3186
3548
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -3195,28 +3557,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
3195
3557
|
live = false;
|
|
3196
3558
|
};
|
|
3197
3559
|
}, [provider, effect, width, height]);
|
|
3198
|
-
return /* @__PURE__ */ (0,
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3199
3561
|
"div",
|
|
3200
3562
|
{
|
|
3201
3563
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
3202
3564
|
style: { aspectRatio: `${width} / ${height}` },
|
|
3203
3565
|
"data-effect-thumbnail": effect.id,
|
|
3204
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
3566
|
+
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
3567
|
}
|
|
3206
3568
|
);
|
|
3207
3569
|
}
|
|
3208
3570
|
|
|
3209
3571
|
// src/effects/EffectsBrowser.tsx
|
|
3210
|
-
var
|
|
3572
|
+
var import_react23 = require("react");
|
|
3211
3573
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
3212
|
-
var
|
|
3574
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3213
3575
|
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,
|
|
3576
|
+
const [all, setAll] = (0, import_react23.useState)([]);
|
|
3577
|
+
const [query, setQuery] = (0, import_react23.useState)("");
|
|
3578
|
+
const [category, setCategory] = (0, import_react23.useState)("");
|
|
3579
|
+
const [use, setUse] = (0, import_react23.useState)("");
|
|
3580
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
3581
|
+
(0, import_react23.useEffect)(() => {
|
|
3220
3582
|
if (!provider) return setAll([]);
|
|
3221
3583
|
let live = true;
|
|
3222
3584
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -3227,8 +3589,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3227
3589
|
live = false;
|
|
3228
3590
|
};
|
|
3229
3591
|
}, [provider]);
|
|
3230
|
-
const [found, setFound] = (0,
|
|
3231
|
-
(0,
|
|
3592
|
+
const [found, setFound] = (0, import_react23.useState)([]);
|
|
3593
|
+
(0, import_react23.useEffect)(() => {
|
|
3232
3594
|
if (!provider) return setFound([]);
|
|
3233
3595
|
let live = true;
|
|
3234
3596
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -3237,14 +3599,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3237
3599
|
};
|
|
3238
3600
|
}, [provider, query, category, use]);
|
|
3239
3601
|
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
3240
|
-
const categories = (0,
|
|
3602
|
+
const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
3241
3603
|
const shown = found.filter(allowed);
|
|
3242
3604
|
if (!provider)
|
|
3243
|
-
return /* @__PURE__ */ (0,
|
|
3244
|
-
return /* @__PURE__ */ (0,
|
|
3245
|
-
title && /* @__PURE__ */ (0,
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3605
|
+
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." });
|
|
3606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
3607
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
3609
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3248
3610
|
"input",
|
|
3249
3611
|
{
|
|
3250
3612
|
type: "search",
|
|
@@ -3255,17 +3617,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3255
3617
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
3256
3618
|
}
|
|
3257
3619
|
),
|
|
3258
|
-
/* @__PURE__ */ (0,
|
|
3259
|
-
/* @__PURE__ */ (0,
|
|
3260
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
3620
|
+
/* @__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: [
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "All categories" }),
|
|
3622
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: c, children: c }, c))
|
|
3261
3623
|
] }),
|
|
3262
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
3263
|
-
/* @__PURE__ */ (0,
|
|
3264
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
3624
|
+
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: [
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "Any use" }),
|
|
3626
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
3265
3627
|
] })
|
|
3266
3628
|
] }),
|
|
3267
|
-
error && /* @__PURE__ */ (0,
|
|
3268
|
-
/* @__PURE__ */ (0,
|
|
3629
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
3630
|
+
/* @__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
3631
|
"button",
|
|
3270
3632
|
{
|
|
3271
3633
|
type: "button",
|
|
@@ -3274,23 +3636,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3274
3636
|
"data-effect-id": e.id,
|
|
3275
3637
|
onClick: () => onPick(e),
|
|
3276
3638
|
children: [
|
|
3277
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
3278
|
-
/* @__PURE__ */ (0,
|
|
3279
|
-
/* @__PURE__ */ (0,
|
|
3639
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
3640
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
3641
|
+
/* @__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
3642
|
]
|
|
3281
3643
|
}
|
|
3282
3644
|
) }, e.id)) }),
|
|
3283
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
3645
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
3284
3646
|
] });
|
|
3285
3647
|
}
|
|
3286
3648
|
|
|
3287
3649
|
// src/effects/EffectParameters.tsx
|
|
3288
|
-
var
|
|
3650
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
3289
3651
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
3290
3652
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
3291
3653
|
|
|
3292
3654
|
// src/parameters/fields.tsx
|
|
3293
|
-
var
|
|
3655
|
+
var import_react28 = require("react");
|
|
3294
3656
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
3295
3657
|
|
|
3296
3658
|
// src/color/index.ts
|
|
@@ -3303,9 +3665,9 @@ __export(color_exports, {
|
|
|
3303
3665
|
});
|
|
3304
3666
|
|
|
3305
3667
|
// src/color/ColorPicker.tsx
|
|
3306
|
-
var
|
|
3668
|
+
var import_react24 = require("react");
|
|
3307
3669
|
var import_color = require("@pixerate/editor/color");
|
|
3308
|
-
var
|
|
3670
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3309
3671
|
var LOCAL_STORAGE_KEY = "pixerate:color:recent";
|
|
3310
3672
|
function readLocalRecents() {
|
|
3311
3673
|
try {
|
|
@@ -3343,24 +3705,24 @@ var ColorPicker = ({
|
|
|
3343
3705
|
id,
|
|
3344
3706
|
"aria-label": ariaLabel = "Color picker"
|
|
3345
3707
|
}) => {
|
|
3346
|
-
const generatedId = (0,
|
|
3708
|
+
const generatedId = (0, import_react24.useId)();
|
|
3347
3709
|
const pickerId = id || generatedId;
|
|
3348
|
-
const [pickerState, setPickerState] = (0,
|
|
3710
|
+
const [pickerState, setPickerState] = (0, import_react24.useState)(
|
|
3349
3711
|
() => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
|
|
3350
3712
|
);
|
|
3351
|
-
const stateRef = (0,
|
|
3713
|
+
const stateRef = (0, import_react24.useRef)(pickerState);
|
|
3352
3714
|
stateRef.current = pickerState;
|
|
3353
|
-
(0,
|
|
3715
|
+
(0, import_react24.useEffect)(() => {
|
|
3354
3716
|
const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
|
|
3355
3717
|
if (next) {
|
|
3356
3718
|
setPickerState(next);
|
|
3357
3719
|
}
|
|
3358
3720
|
}, [value]);
|
|
3359
|
-
const [internalRecent, setInternalRecent] = (0,
|
|
3721
|
+
const [internalRecent, setInternalRecent] = (0, import_react24.useState)(
|
|
3360
3722
|
() => controlledRecent ? [] : readLocalRecents()
|
|
3361
3723
|
);
|
|
3362
3724
|
const activeRecent = controlledRecent ?? internalRecent;
|
|
3363
|
-
const recordRecent = (0,
|
|
3725
|
+
const recordRecent = (0, import_react24.useCallback)(
|
|
3364
3726
|
(color) => {
|
|
3365
3727
|
const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
|
|
3366
3728
|
if (!controlledRecent) {
|
|
@@ -3371,11 +3733,11 @@ var ColorPicker = ({
|
|
|
3371
3733
|
},
|
|
3372
3734
|
[activeRecent, controlledRecent, onRecentChange]
|
|
3373
3735
|
);
|
|
3374
|
-
const [textDraft, setTextDraft] = (0,
|
|
3375
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
3376
|
-
const [isClipped, setIsClipped] = (0,
|
|
3377
|
-
const isTypingRef = (0,
|
|
3378
|
-
(0,
|
|
3736
|
+
const [textDraft, setTextDraft] = (0, import_react24.useState)(value);
|
|
3737
|
+
const [isInvalid, setIsInvalid] = (0, import_react24.useState)(false);
|
|
3738
|
+
const [isClipped, setIsClipped] = (0, import_react24.useState)(false);
|
|
3739
|
+
const isTypingRef = (0, import_react24.useRef)(false);
|
|
3740
|
+
(0, import_react24.useEffect)(() => {
|
|
3379
3741
|
if (!isTypingRef.current) {
|
|
3380
3742
|
setTextDraft(value);
|
|
3381
3743
|
setIsInvalid(false);
|
|
@@ -3383,11 +3745,11 @@ var ColorPicker = ({
|
|
|
3383
3745
|
setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
|
|
3384
3746
|
}
|
|
3385
3747
|
}, [value]);
|
|
3386
|
-
const [hasEyeDropper, setHasEyeDropper] = (0,
|
|
3387
|
-
(0,
|
|
3748
|
+
const [hasEyeDropper, setHasEyeDropper] = (0, import_react24.useState)(false);
|
|
3749
|
+
(0, import_react24.useEffect)(() => {
|
|
3388
3750
|
setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
|
|
3389
3751
|
}, []);
|
|
3390
|
-
const emitColorChange = (0,
|
|
3752
|
+
const emitColorChange = (0, import_react24.useCallback)(
|
|
3391
3753
|
(nextState) => {
|
|
3392
3754
|
setPickerState(nextState);
|
|
3393
3755
|
const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
|
|
@@ -3395,10 +3757,10 @@ var ColorPicker = ({
|
|
|
3395
3757
|
},
|
|
3396
3758
|
[alpha, onChange]
|
|
3397
3759
|
);
|
|
3398
|
-
const latest = (0,
|
|
3760
|
+
const latest = (0, import_react24.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
|
|
3399
3761
|
latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
|
|
3400
|
-
const endDragRef = (0,
|
|
3401
|
-
(0,
|
|
3762
|
+
const endDragRef = (0, import_react24.useRef)(null);
|
|
3763
|
+
(0, import_react24.useEffect)(() => () => endDragRef.current?.(), []);
|
|
3402
3764
|
const startDrag = (e, next) => {
|
|
3403
3765
|
if (disabled) return;
|
|
3404
3766
|
e.preventDefault();
|
|
@@ -3500,7 +3862,7 @@ var ColorPicker = ({
|
|
|
3500
3862
|
} catch {
|
|
3501
3863
|
}
|
|
3502
3864
|
};
|
|
3503
|
-
const contrastResult = (0,
|
|
3865
|
+
const contrastResult = (0, import_react24.useMemo)(() => {
|
|
3504
3866
|
if (!contrastAgainst) return null;
|
|
3505
3867
|
const fg = (0, import_color.parseColor)(value);
|
|
3506
3868
|
const bg = (0, import_color.parseColor)(contrastAgainst);
|
|
@@ -3512,7 +3874,7 @@ var ColorPicker = ({
|
|
|
3512
3874
|
}, [value, contrastAgainst]);
|
|
3513
3875
|
const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
|
|
3514
3876
|
const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
|
|
3515
|
-
return /* @__PURE__ */ (0,
|
|
3877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3516
3878
|
"div",
|
|
3517
3879
|
{
|
|
3518
3880
|
id: pickerId,
|
|
@@ -3536,7 +3898,7 @@ var ColorPicker = ({
|
|
|
3536
3898
|
pointerEvents: disabled ? "none" : "auto"
|
|
3537
3899
|
},
|
|
3538
3900
|
children: [
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3540
3902
|
"span",
|
|
3541
3903
|
{
|
|
3542
3904
|
role: "status",
|
|
@@ -3555,7 +3917,7 @@ var ColorPicker = ({
|
|
|
3555
3917
|
children: liveDescription
|
|
3556
3918
|
}
|
|
3557
3919
|
),
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
3920
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3559
3921
|
"div",
|
|
3560
3922
|
{
|
|
3561
3923
|
role: "slider",
|
|
@@ -3577,7 +3939,7 @@ var ColorPicker = ({
|
|
|
3577
3939
|
touchAction: "none",
|
|
3578
3940
|
outline: "none"
|
|
3579
3941
|
},
|
|
3580
|
-
children: /* @__PURE__ */ (0,
|
|
3942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3581
3943
|
"div",
|
|
3582
3944
|
{
|
|
3583
3945
|
style: {
|
|
@@ -3597,7 +3959,7 @@ var ColorPicker = ({
|
|
|
3597
3959
|
)
|
|
3598
3960
|
}
|
|
3599
3961
|
),
|
|
3600
|
-
/* @__PURE__ */ (0,
|
|
3962
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3601
3963
|
"div",
|
|
3602
3964
|
{
|
|
3603
3965
|
role: "slider",
|
|
@@ -3620,7 +3982,7 @@ var ColorPicker = ({
|
|
|
3620
3982
|
touchAction: "none",
|
|
3621
3983
|
outline: "none"
|
|
3622
3984
|
},
|
|
3623
|
-
children: /* @__PURE__ */ (0,
|
|
3985
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3624
3986
|
"div",
|
|
3625
3987
|
{
|
|
3626
3988
|
style: {
|
|
@@ -3640,7 +4002,7 @@ var ColorPicker = ({
|
|
|
3640
4002
|
)
|
|
3641
4003
|
}
|
|
3642
4004
|
),
|
|
3643
|
-
alpha && /* @__PURE__ */ (0,
|
|
4005
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3644
4006
|
"div",
|
|
3645
4007
|
{
|
|
3646
4008
|
role: "slider",
|
|
@@ -3666,7 +4028,7 @@ var ColorPicker = ({
|
|
|
3666
4028
|
overflow: "hidden"
|
|
3667
4029
|
},
|
|
3668
4030
|
children: [
|
|
3669
|
-
/* @__PURE__ */ (0,
|
|
4031
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3670
4032
|
"div",
|
|
3671
4033
|
{
|
|
3672
4034
|
style: {
|
|
@@ -3676,7 +4038,7 @@ var ColorPicker = ({
|
|
|
3676
4038
|
}
|
|
3677
4039
|
}
|
|
3678
4040
|
),
|
|
3679
|
-
/* @__PURE__ */ (0,
|
|
4041
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3680
4042
|
"div",
|
|
3681
4043
|
{
|
|
3682
4044
|
style: {
|
|
@@ -3697,8 +4059,8 @@ var ColorPicker = ({
|
|
|
3697
4059
|
]
|
|
3698
4060
|
}
|
|
3699
4061
|
),
|
|
3700
|
-
/* @__PURE__ */ (0,
|
|
3701
|
-
/* @__PURE__ */ (0,
|
|
4062
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
|
|
4063
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3702
4064
|
"div",
|
|
3703
4065
|
{
|
|
3704
4066
|
style: {
|
|
@@ -3712,7 +4074,7 @@ var ColorPicker = ({
|
|
|
3712
4074
|
flexShrink: 0,
|
|
3713
4075
|
border: "1px solid rgba(255,255,255,0.15)"
|
|
3714
4076
|
},
|
|
3715
|
-
children: /* @__PURE__ */ (0,
|
|
4077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3716
4078
|
"div",
|
|
3717
4079
|
{
|
|
3718
4080
|
style: {
|
|
@@ -3724,7 +4086,7 @@ var ColorPicker = ({
|
|
|
3724
4086
|
)
|
|
3725
4087
|
}
|
|
3726
4088
|
),
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
4089
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3728
4090
|
"input",
|
|
3729
4091
|
{
|
|
3730
4092
|
type: "text",
|
|
@@ -3754,7 +4116,7 @@ var ColorPicker = ({
|
|
|
3754
4116
|
}
|
|
3755
4117
|
}
|
|
3756
4118
|
),
|
|
3757
|
-
hasEyeDropper && /* @__PURE__ */ (0,
|
|
4119
|
+
hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3758
4120
|
"button",
|
|
3759
4121
|
{
|
|
3760
4122
|
type: "button",
|
|
@@ -3774,7 +4136,7 @@ var ColorPicker = ({
|
|
|
3774
4136
|
color: "inherit",
|
|
3775
4137
|
cursor: disabled ? "default" : "pointer"
|
|
3776
4138
|
},
|
|
3777
|
-
children: /* @__PURE__ */ (0,
|
|
4139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3778
4140
|
"svg",
|
|
3779
4141
|
{
|
|
3780
4142
|
width: "14",
|
|
@@ -3786,16 +4148,16 @@ var ColorPicker = ({
|
|
|
3786
4148
|
strokeLinecap: "round",
|
|
3787
4149
|
strokeLinejoin: "round",
|
|
3788
4150
|
children: [
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3790
|
-
/* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
4151
|
+
/* @__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" }),
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
|
|
4153
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 6 4 4" })
|
|
3792
4154
|
]
|
|
3793
4155
|
}
|
|
3794
4156
|
)
|
|
3795
4157
|
}
|
|
3796
4158
|
)
|
|
3797
4159
|
] }),
|
|
3798
|
-
isClipped && /* @__PURE__ */ (0,
|
|
4160
|
+
isClipped && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3799
4161
|
"div",
|
|
3800
4162
|
{
|
|
3801
4163
|
role: "note",
|
|
@@ -3811,10 +4173,10 @@ var ColorPicker = ({
|
|
|
3811
4173
|
borderRadius: "4px",
|
|
3812
4174
|
alignSelf: "flex-start"
|
|
3813
4175
|
},
|
|
3814
|
-
children: /* @__PURE__ */ (0,
|
|
4176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
|
|
3815
4177
|
}
|
|
3816
4178
|
),
|
|
3817
|
-
contrastResult && /* @__PURE__ */ (0,
|
|
4179
|
+
contrastResult && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3818
4180
|
"div",
|
|
3819
4181
|
{
|
|
3820
4182
|
style: {
|
|
@@ -3828,15 +4190,15 @@ var ColorPicker = ({
|
|
|
3828
4190
|
border: "1px solid rgba(255,255,255,0.1)"
|
|
3829
4191
|
},
|
|
3830
4192
|
children: [
|
|
3831
|
-
/* @__PURE__ */ (0,
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
|
|
3832
4194
|
"Contrast: ",
|
|
3833
|
-
/* @__PURE__ */ (0,
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { children: [
|
|
3834
4196
|
contrastResult.ratio.toFixed(2),
|
|
3835
4197
|
":1"
|
|
3836
4198
|
] })
|
|
3837
4199
|
] }),
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
4200
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
4201
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3840
4202
|
"span",
|
|
3841
4203
|
{
|
|
3842
4204
|
style: {
|
|
@@ -3849,7 +4211,7 @@ var ColorPicker = ({
|
|
|
3849
4211
|
]
|
|
3850
4212
|
}
|
|
3851
4213
|
),
|
|
3852
|
-
/* @__PURE__ */ (0,
|
|
4214
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3853
4215
|
"span",
|
|
3854
4216
|
{
|
|
3855
4217
|
style: {
|
|
@@ -3866,9 +4228,9 @@ var ColorPicker = ({
|
|
|
3866
4228
|
]
|
|
3867
4229
|
}
|
|
3868
4230
|
),
|
|
3869
|
-
swatches && swatches.length > 0 && /* @__PURE__ */ (0,
|
|
3870
|
-
/* @__PURE__ */ (0,
|
|
3871
|
-
/* @__PURE__ */ (0,
|
|
4231
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
4232
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
|
|
4233
|
+
/* @__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
4234
|
"button",
|
|
3873
4235
|
{
|
|
3874
4236
|
type: "button",
|
|
@@ -3894,9 +4256,9 @@ var ColorPicker = ({
|
|
|
3894
4256
|
`${color}-${idx}`
|
|
3895
4257
|
)) })
|
|
3896
4258
|
] }),
|
|
3897
|
-
activeRecent.length > 0 && /* @__PURE__ */ (0,
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
4259
|
+
activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
|
|
4261
|
+
/* @__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
4262
|
"button",
|
|
3901
4263
|
{
|
|
3902
4264
|
type: "button",
|
|
@@ -3927,9 +4289,9 @@ var ColorPicker = ({
|
|
|
3927
4289
|
};
|
|
3928
4290
|
|
|
3929
4291
|
// src/color/DualColorPicker.tsx
|
|
3930
|
-
var
|
|
4292
|
+
var import_react25 = require("react");
|
|
3931
4293
|
var import_color2 = require("@pixerate/editor/color");
|
|
3932
|
-
var
|
|
4294
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3933
4295
|
function DualColorPicker({
|
|
3934
4296
|
value,
|
|
3935
4297
|
onChange,
|
|
@@ -3944,8 +4306,8 @@ function DualColorPicker({
|
|
|
3944
4306
|
disabled = false,
|
|
3945
4307
|
className = ""
|
|
3946
4308
|
}) {
|
|
3947
|
-
const sameId = (0,
|
|
3948
|
-
const [internalScheme, setInternalScheme] = (0,
|
|
4309
|
+
const sameId = (0, import_react25.useId)();
|
|
4310
|
+
const [internalScheme, setInternalScheme] = (0, import_react25.useState)("light");
|
|
3949
4311
|
const activeScheme = controlledScheme ?? internalScheme;
|
|
3950
4312
|
const handleSchemeSelect = (nextScheme) => {
|
|
3951
4313
|
if (onSchemeChange) {
|
|
@@ -3956,7 +4318,7 @@ function DualColorPicker({
|
|
|
3956
4318
|
};
|
|
3957
4319
|
const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
|
|
3958
4320
|
const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
|
|
3959
|
-
const [sameInBoth, setSameInBoth] = (0,
|
|
4321
|
+
const [sameInBoth, setSameInBoth] = (0, import_react25.useState)(isSame);
|
|
3960
4322
|
const handleSameToggle = (e) => {
|
|
3961
4323
|
const nextSame = e.target.checked;
|
|
3962
4324
|
setSameInBoth(nextSame);
|
|
@@ -3988,7 +4350,7 @@ function DualColorPicker({
|
|
|
3988
4350
|
const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
|
|
3989
4351
|
const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
|
|
3990
4352
|
const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
|
|
3991
|
-
return /* @__PURE__ */ (0,
|
|
4353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3992
4354
|
"div",
|
|
3993
4355
|
{
|
|
3994
4356
|
className: `pixerate-dual-color-picker ${className}`,
|
|
@@ -4007,7 +4369,7 @@ function DualColorPicker({
|
|
|
4007
4369
|
boxSizing: "border-box"
|
|
4008
4370
|
},
|
|
4009
4371
|
children: [
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4372
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4011
4373
|
"div",
|
|
4012
4374
|
{
|
|
4013
4375
|
role: "tablist",
|
|
@@ -4020,7 +4382,7 @@ function DualColorPicker({
|
|
|
4020
4382
|
gap: "2px"
|
|
4021
4383
|
},
|
|
4022
4384
|
children: [
|
|
4023
|
-
/* @__PURE__ */ (0,
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4024
4386
|
"button",
|
|
4025
4387
|
{
|
|
4026
4388
|
type: "button",
|
|
@@ -4043,7 +4405,7 @@ function DualColorPicker({
|
|
|
4043
4405
|
children: "Light"
|
|
4044
4406
|
}
|
|
4045
4407
|
),
|
|
4046
|
-
/* @__PURE__ */ (0,
|
|
4408
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4047
4409
|
"button",
|
|
4048
4410
|
{
|
|
4049
4411
|
type: "button",
|
|
@@ -4069,8 +4431,8 @@ function DualColorPicker({
|
|
|
4069
4431
|
]
|
|
4070
4432
|
}
|
|
4071
4433
|
),
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4073
|
-
/* @__PURE__ */ (0,
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4074
4436
|
"button",
|
|
4075
4437
|
{
|
|
4076
4438
|
type: "button",
|
|
@@ -4092,7 +4454,7 @@ function DualColorPicker({
|
|
|
4092
4454
|
outline: "none"
|
|
4093
4455
|
},
|
|
4094
4456
|
children: [
|
|
4095
|
-
/* @__PURE__ */ (0,
|
|
4457
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4096
4458
|
"span",
|
|
4097
4459
|
{
|
|
4098
4460
|
style: {
|
|
@@ -4104,11 +4466,11 @@ function DualColorPicker({
|
|
|
4104
4466
|
}
|
|
4105
4467
|
}
|
|
4106
4468
|
),
|
|
4107
|
-
/* @__PURE__ */ (0,
|
|
4469
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
|
|
4108
4470
|
]
|
|
4109
4471
|
}
|
|
4110
4472
|
),
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4112
4474
|
"button",
|
|
4113
4475
|
{
|
|
4114
4476
|
type: "button",
|
|
@@ -4130,7 +4492,7 @@ function DualColorPicker({
|
|
|
4130
4492
|
outline: "none"
|
|
4131
4493
|
},
|
|
4132
4494
|
children: [
|
|
4133
|
-
/* @__PURE__ */ (0,
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4134
4496
|
"span",
|
|
4135
4497
|
{
|
|
4136
4498
|
style: {
|
|
@@ -4142,12 +4504,12 @@ function DualColorPicker({
|
|
|
4142
4504
|
}
|
|
4143
4505
|
}
|
|
4144
4506
|
),
|
|
4145
|
-
/* @__PURE__ */ (0,
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
|
|
4146
4508
|
]
|
|
4147
4509
|
}
|
|
4148
4510
|
)
|
|
4149
4511
|
] }),
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4151
4513
|
"div",
|
|
4152
4514
|
{
|
|
4153
4515
|
style: {
|
|
@@ -4158,7 +4520,7 @@ function DualColorPicker({
|
|
|
4158
4520
|
padding: "2px 0"
|
|
4159
4521
|
},
|
|
4160
4522
|
children: [
|
|
4161
|
-
/* @__PURE__ */ (0,
|
|
4523
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4162
4524
|
"label",
|
|
4163
4525
|
{
|
|
4164
4526
|
htmlFor: sameId,
|
|
@@ -4172,7 +4534,7 @@ function DualColorPicker({
|
|
|
4172
4534
|
color: "#c4cad4"
|
|
4173
4535
|
},
|
|
4174
4536
|
children: [
|
|
4175
|
-
/* @__PURE__ */ (0,
|
|
4537
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4176
4538
|
"input",
|
|
4177
4539
|
{
|
|
4178
4540
|
id: sameId,
|
|
@@ -4183,11 +4545,11 @@ function DualColorPicker({
|
|
|
4183
4545
|
style: { cursor: disabled ? "not-allowed" : "pointer" }
|
|
4184
4546
|
}
|
|
4185
4547
|
),
|
|
4186
|
-
/* @__PURE__ */ (0,
|
|
4548
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Same in both" })
|
|
4187
4549
|
]
|
|
4188
4550
|
}
|
|
4189
4551
|
),
|
|
4190
|
-
/* @__PURE__ */ (0,
|
|
4552
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4191
4553
|
"button",
|
|
4192
4554
|
{
|
|
4193
4555
|
type: "button",
|
|
@@ -4209,7 +4571,7 @@ function DualColorPicker({
|
|
|
4209
4571
|
]
|
|
4210
4572
|
}
|
|
4211
4573
|
),
|
|
4212
|
-
dualContrast && /* @__PURE__ */ (0,
|
|
4574
|
+
dualContrast && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4213
4575
|
"div",
|
|
4214
4576
|
{
|
|
4215
4577
|
"data-testid": "dual-contrast-summary",
|
|
@@ -4223,20 +4585,20 @@ function DualColorPicker({
|
|
|
4223
4585
|
color: "#8c95a6"
|
|
4224
4586
|
},
|
|
4225
4587
|
children: [
|
|
4226
|
-
/* @__PURE__ */ (0,
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
4227
4589
|
"Light:",
|
|
4228
4590
|
" ",
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
4230
4592
|
dualContrast.light.ratio.toFixed(2),
|
|
4231
4593
|
" (",
|
|
4232
4594
|
dualContrast.light.level,
|
|
4233
4595
|
")"
|
|
4234
4596
|
] })
|
|
4235
4597
|
] }),
|
|
4236
|
-
/* @__PURE__ */ (0,
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
4237
4599
|
"Dark:",
|
|
4238
4600
|
" ",
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
4240
4602
|
dualContrast.dark.ratio.toFixed(2),
|
|
4241
4603
|
" (",
|
|
4242
4604
|
dualContrast.dark.level,
|
|
@@ -4246,7 +4608,7 @@ function DualColorPicker({
|
|
|
4246
4608
|
]
|
|
4247
4609
|
}
|
|
4248
4610
|
),
|
|
4249
|
-
/* @__PURE__ */ (0,
|
|
4611
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4250
4612
|
ColorPicker,
|
|
4251
4613
|
{
|
|
4252
4614
|
value: activeColor,
|
|
@@ -4265,7 +4627,7 @@ function DualColorPicker({
|
|
|
4265
4627
|
}
|
|
4266
4628
|
|
|
4267
4629
|
// src/color/useColorScheme.ts
|
|
4268
|
-
var
|
|
4630
|
+
var import_react26 = require("react");
|
|
4269
4631
|
var import_color3 = require("@pixerate/editor/color");
|
|
4270
4632
|
function getSnapshot(attribute) {
|
|
4271
4633
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
@@ -4290,7 +4652,7 @@ function getServerSnapshot() {
|
|
|
4290
4652
|
function useColorScheme(options) {
|
|
4291
4653
|
const override = options?.override;
|
|
4292
4654
|
const attribute = options?.attribute;
|
|
4293
|
-
const subscribe = (0,
|
|
4655
|
+
const subscribe = (0, import_react26.useMemo)(() => {
|
|
4294
4656
|
return (callback) => {
|
|
4295
4657
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
4296
4658
|
return () => {
|
|
@@ -4316,7 +4678,7 @@ function useColorScheme(options) {
|
|
|
4316
4678
|
};
|
|
4317
4679
|
};
|
|
4318
4680
|
}, [attribute]);
|
|
4319
|
-
const detected = (0,
|
|
4681
|
+
const detected = (0, import_react26.useSyncExternalStore)(
|
|
4320
4682
|
subscribe,
|
|
4321
4683
|
() => getSnapshot(attribute),
|
|
4322
4684
|
getServerSnapshot
|
|
@@ -4333,11 +4695,11 @@ function useResolvedColor(value, scheme) {
|
|
|
4333
4695
|
__reExport(color_exports, require("@pixerate/editor/color"));
|
|
4334
4696
|
|
|
4335
4697
|
// src/parameters/controls.tsx
|
|
4336
|
-
var
|
|
4337
|
-
var
|
|
4338
|
-
var ParameterComponentsContext = (0,
|
|
4698
|
+
var import_react27 = require("react");
|
|
4699
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4700
|
+
var ParameterComponentsContext = (0, import_react27.createContext)({});
|
|
4339
4701
|
function useParameterComponents() {
|
|
4340
|
-
return (0,
|
|
4702
|
+
return (0, import_react27.useContext)(ParameterComponentsContext);
|
|
4341
4703
|
}
|
|
4342
4704
|
function resolveParameterComponents(explicit, context) {
|
|
4343
4705
|
return {
|
|
@@ -4349,7 +4711,7 @@ function resolveParameterComponents(explicit, context) {
|
|
|
4349
4711
|
}
|
|
4350
4712
|
|
|
4351
4713
|
// src/parameters/fields.tsx
|
|
4352
|
-
var
|
|
4714
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4353
4715
|
var parameterInputStyle = import_parameters.parameterThemeStyles.input;
|
|
4354
4716
|
var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
|
|
4355
4717
|
var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
|
|
@@ -4358,9 +4720,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
|
|
|
4358
4720
|
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
4721
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
4360
4722
|
function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
|
|
4361
|
-
const inputRef = (0,
|
|
4362
|
-
const lastCommitted = (0,
|
|
4363
|
-
(0,
|
|
4723
|
+
const inputRef = (0, import_react28.useRef)(null);
|
|
4724
|
+
const lastCommitted = (0, import_react28.useRef)(null);
|
|
4725
|
+
(0, import_react28.useLayoutEffect)(() => {
|
|
4364
4726
|
lastCommitted.current = null;
|
|
4365
4727
|
const el = inputRef.current;
|
|
4366
4728
|
if (el && el.value !== value) el.value = value;
|
|
@@ -4371,9 +4733,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
4371
4733
|
onCommit(text, el);
|
|
4372
4734
|
lastCommitted.current = el.value === text ? text : null;
|
|
4373
4735
|
};
|
|
4374
|
-
const commitRef = (0,
|
|
4736
|
+
const commitRef = (0, import_react28.useRef)(commit);
|
|
4375
4737
|
commitRef.current = commit;
|
|
4376
|
-
(0,
|
|
4738
|
+
(0, import_react28.useEffect)(() => {
|
|
4377
4739
|
const el = inputRef.current;
|
|
4378
4740
|
if (!el) return;
|
|
4379
4741
|
const change = () => commitRef.current(el);
|
|
@@ -4404,7 +4766,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
4404
4766
|
if (typeof forwarded === "function") forwarded(el);
|
|
4405
4767
|
else if (forwarded) forwarded.current = el;
|
|
4406
4768
|
};
|
|
4407
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
4769
|
+
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
4770
|
}
|
|
4409
4771
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
4410
4772
|
function ParameterNumberInput(props) {
|
|
@@ -4438,9 +4800,9 @@ function ParameterNumberInput(props) {
|
|
|
4438
4800
|
onCommit: handleCommit,
|
|
4439
4801
|
onKeyDown: handleKeyDown
|
|
4440
4802
|
};
|
|
4441
|
-
return /* @__PURE__ */ (0,
|
|
4442
|
-
CustomInput ? /* @__PURE__ */ (0,
|
|
4443
|
-
field.unit && /* @__PURE__ */ (0,
|
|
4803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
4804
|
+
CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterCommitInput, { ...inputProps }),
|
|
4805
|
+
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
4806
|
] });
|
|
4445
4807
|
}
|
|
4446
4808
|
function ParameterSlider(props) {
|
|
@@ -4448,7 +4810,7 @@ function ParameterSlider(props) {
|
|
|
4448
4810
|
const ctx = useParameterComponents();
|
|
4449
4811
|
const resolved = resolveParameterComponents(components, ctx);
|
|
4450
4812
|
const CustomSlider = resolved.slider;
|
|
4451
|
-
const dragging = (0,
|
|
4813
|
+
const dragging = (0, import_react28.useRef)(false);
|
|
4452
4814
|
const start = () => {
|
|
4453
4815
|
if (dragging.current) return;
|
|
4454
4816
|
dragging.current = true;
|
|
@@ -4459,7 +4821,7 @@ function ParameterSlider(props) {
|
|
|
4459
4821
|
dragging.current = false;
|
|
4460
4822
|
onGestureEnd?.();
|
|
4461
4823
|
};
|
|
4462
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
4824
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props });
|
|
4463
4825
|
const step = (0, import_parameters.parameterStep)(field);
|
|
4464
4826
|
const sliderProps = {
|
|
4465
4827
|
"aria-label": (0, import_parameters.parameterLabel)(field),
|
|
@@ -4473,8 +4835,8 @@ function ParameterSlider(props) {
|
|
|
4473
4835
|
className: rangeClass,
|
|
4474
4836
|
style: parameterRangeStyle
|
|
4475
4837
|
};
|
|
4476
|
-
return /* @__PURE__ */ (0,
|
|
4477
|
-
CustomSlider ? /* @__PURE__ */ (0,
|
|
4838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4839
|
+
CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4478
4840
|
CustomSlider,
|
|
4479
4841
|
{
|
|
4480
4842
|
...sliderProps,
|
|
@@ -4484,7 +4846,7 @@ function ParameterSlider(props) {
|
|
|
4484
4846
|
onGestureStart: start,
|
|
4485
4847
|
onGestureEnd: end
|
|
4486
4848
|
}
|
|
4487
|
-
) : /* @__PURE__ */ (0,
|
|
4849
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4488
4850
|
"input",
|
|
4489
4851
|
{
|
|
4490
4852
|
type: "range",
|
|
@@ -4496,11 +4858,11 @@ function ParameterSlider(props) {
|
|
|
4496
4858
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
4497
4859
|
}
|
|
4498
4860
|
),
|
|
4499
|
-
/* @__PURE__ */ (0,
|
|
4861
|
+
/* @__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
4862
|
] });
|
|
4501
4863
|
}
|
|
4502
4864
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
4503
|
-
return /* @__PURE__ */ (0,
|
|
4865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4504
4866
|
"button",
|
|
4505
4867
|
{
|
|
4506
4868
|
type: "button",
|
|
@@ -4511,7 +4873,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
4511
4873
|
disabled: disabled || field.readOnly,
|
|
4512
4874
|
onClick: () => onChange(!value),
|
|
4513
4875
|
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,
|
|
4876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4515
4877
|
"span",
|
|
4516
4878
|
{
|
|
4517
4879
|
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 +4890,7 @@ function ParameterSelect(props) {
|
|
|
4528
4890
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
4529
4891
|
const off = disabled || field.readOnly;
|
|
4530
4892
|
if (field.control === "segmented") {
|
|
4531
|
-
return /* @__PURE__ */ (0,
|
|
4893
|
+
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
4894
|
"button",
|
|
4533
4895
|
{
|
|
4534
4896
|
type: "button",
|
|
@@ -4545,7 +4907,7 @@ function ParameterSelect(props) {
|
|
|
4545
4907
|
}
|
|
4546
4908
|
if (CustomSelect) {
|
|
4547
4909
|
const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
|
|
4548
|
-
return /* @__PURE__ */ (0,
|
|
4910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4549
4911
|
CustomSelect,
|
|
4550
4912
|
{
|
|
4551
4913
|
id,
|
|
@@ -4561,7 +4923,7 @@ function ParameterSelect(props) {
|
|
|
4561
4923
|
);
|
|
4562
4924
|
}
|
|
4563
4925
|
const index = options.findIndex((o) => o.value === value);
|
|
4564
|
-
return /* @__PURE__ */ (0,
|
|
4926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4565
4927
|
"select",
|
|
4566
4928
|
{
|
|
4567
4929
|
id,
|
|
@@ -4574,23 +4936,23 @@ function ParameterSelect(props) {
|
|
|
4574
4936
|
},
|
|
4575
4937
|
className: parameterInputClass,
|
|
4576
4938
|
style: parameterSelectStyle,
|
|
4577
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
4939
|
+
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
4940
|
}
|
|
4579
4941
|
);
|
|
4580
4942
|
}
|
|
4581
4943
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
|
|
4582
4944
|
const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
|
|
4583
|
-
const [open, setOpen] = (0,
|
|
4584
|
-
const containerRef = (0,
|
|
4585
|
-
const buttonRef = (0,
|
|
4586
|
-
const popoverRef = (0,
|
|
4945
|
+
const [open, setOpen] = (0, import_react28.useState)(false);
|
|
4946
|
+
const containerRef = (0, import_react28.useRef)(null);
|
|
4947
|
+
const buttonRef = (0, import_react28.useRef)(null);
|
|
4948
|
+
const popoverRef = (0, import_react28.useRef)(null);
|
|
4587
4949
|
const alpha = !!field.alpha;
|
|
4588
4950
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
4589
4951
|
const rgb = hex.slice(0, 7);
|
|
4590
4952
|
const shown = alpha ? hex : rgb;
|
|
4591
4953
|
const off = disabled || field.readOnly;
|
|
4592
4954
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
4593
|
-
(0,
|
|
4955
|
+
(0, import_react28.useEffect)(() => {
|
|
4594
4956
|
if (!open) return;
|
|
4595
4957
|
const onPointerDown = (e) => {
|
|
4596
4958
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -4612,7 +4974,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4612
4974
|
};
|
|
4613
4975
|
}, [open]);
|
|
4614
4976
|
if (CustomColor) {
|
|
4615
|
-
return /* @__PURE__ */ (0,
|
|
4977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4616
4978
|
CustomColor,
|
|
4617
4979
|
{
|
|
4618
4980
|
id,
|
|
@@ -4627,9 +4989,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4627
4989
|
}
|
|
4628
4990
|
);
|
|
4629
4991
|
}
|
|
4630
|
-
return /* @__PURE__ */ (0,
|
|
4631
|
-
/* @__PURE__ */ (0,
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
4992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
4993
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4633
4995
|
"button",
|
|
4634
4996
|
{
|
|
4635
4997
|
ref: buttonRef,
|
|
@@ -4640,10 +5002,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4640
5002
|
disabled: off,
|
|
4641
5003
|
onClick: () => setOpen((prev) => !prev),
|
|
4642
5004
|
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,
|
|
5005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
|
|
4644
5006
|
}
|
|
4645
5007
|
),
|
|
4646
|
-
/* @__PURE__ */ (0,
|
|
5008
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4647
5009
|
ParameterCommitInput,
|
|
4648
5010
|
{
|
|
4649
5011
|
id,
|
|
@@ -4659,7 +5021,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4659
5021
|
}
|
|
4660
5022
|
)
|
|
4661
5023
|
] }),
|
|
4662
|
-
open && /* @__PURE__ */ (0,
|
|
5024
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4663
5025
|
"div",
|
|
4664
5026
|
{
|
|
4665
5027
|
ref: popoverRef,
|
|
@@ -4673,7 +5035,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4673
5035
|
},
|
|
4674
5036
|
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
5037
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
4676
|
-
children: /* @__PURE__ */ (0,
|
|
5038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4677
5039
|
ColorPicker,
|
|
4678
5040
|
{
|
|
4679
5041
|
value: shown,
|
|
@@ -4691,11 +5053,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
4691
5053
|
}
|
|
4692
5054
|
function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
4693
5055
|
const size = (0, import_parameters.vectorSize)(field);
|
|
4694
|
-
return /* @__PURE__ */ (0,
|
|
5056
|
+
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
5057
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
4696
|
-
return /* @__PURE__ */ (0,
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4698
|
-
/* @__PURE__ */ (0,
|
|
5058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
5059
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4699
5061
|
ParameterNumberInput,
|
|
4700
5062
|
{
|
|
4701
5063
|
field: component,
|
|
@@ -4713,11 +5075,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
|
4713
5075
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
4714
5076
|
const off = disabled || field.readOnly;
|
|
4715
5077
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
4716
|
-
return /* @__PURE__ */ (0,
|
|
4717
|
-
/* @__PURE__ */ (0,
|
|
4718
|
-
/* @__PURE__ */ (0,
|
|
4719
|
-
/* @__PURE__ */ (0,
|
|
4720
|
-
/* @__PURE__ */ (0,
|
|
5078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1.5", children: [
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5080
|
+
/* @__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" }) }),
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4721
5083
|
ParameterCommitInput,
|
|
4722
5084
|
{
|
|
4723
5085
|
id,
|
|
@@ -4728,15 +5090,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4728
5090
|
onCommit: (text) => onChange(text.trim())
|
|
4729
5091
|
}
|
|
4730
5092
|
),
|
|
4731
|
-
/* @__PURE__ */ (0,
|
|
4732
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
5094
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4733
5095
|
"label",
|
|
4734
5096
|
{
|
|
4735
5097
|
style: parameterButtonStyle,
|
|
4736
5098
|
className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
|
|
4737
5099
|
children: [
|
|
4738
5100
|
"Choose file\u2026",
|
|
4739
|
-
/* @__PURE__ */ (0,
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4740
5102
|
"input",
|
|
4741
5103
|
{
|
|
4742
5104
|
type: "file",
|
|
@@ -4754,7 +5116,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4754
5116
|
]
|
|
4755
5117
|
}
|
|
4756
5118
|
),
|
|
4757
|
-
value && /* @__PURE__ */ (0,
|
|
5119
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4758
5120
|
"button",
|
|
4759
5121
|
{
|
|
4760
5122
|
type: "button",
|
|
@@ -4769,7 +5131,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4769
5131
|
] })
|
|
4770
5132
|
] })
|
|
4771
5133
|
] }),
|
|
4772
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
5134
|
+
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
5135
|
"button",
|
|
4774
5136
|
{
|
|
4775
5137
|
type: "button",
|
|
@@ -4779,14 +5141,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
4779
5141
|
disabled: off,
|
|
4780
5142
|
onClick: () => onChange(o.url),
|
|
4781
5143
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
4782
|
-
children: /* @__PURE__ */ (0,
|
|
5144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
4783
5145
|
},
|
|
4784
5146
|
o.url
|
|
4785
5147
|
)) })
|
|
4786
5148
|
] });
|
|
4787
5149
|
}
|
|
4788
5150
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
4789
|
-
return /* @__PURE__ */ (0,
|
|
5151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4790
5152
|
ParameterCommitInput,
|
|
4791
5153
|
{
|
|
4792
5154
|
id,
|
|
@@ -4805,24 +5167,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
4805
5167
|
switch (field.type) {
|
|
4806
5168
|
case "number":
|
|
4807
5169
|
case "int":
|
|
4808
|
-
return /* @__PURE__ */ (0,
|
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
4809
5171
|
case "boolean":
|
|
4810
|
-
return /* @__PURE__ */ (0,
|
|
5172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
4811
5173
|
case "choice":
|
|
4812
|
-
return /* @__PURE__ */ (0,
|
|
5174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
4813
5175
|
case "color":
|
|
4814
|
-
return /* @__PURE__ */ (0,
|
|
5176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
4815
5177
|
case "vector":
|
|
4816
|
-
return /* @__PURE__ */ (0,
|
|
5178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
4817
5179
|
case "image":
|
|
4818
|
-
return /* @__PURE__ */ (0,
|
|
5180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
4819
5181
|
case "text":
|
|
4820
|
-
return /* @__PURE__ */ (0,
|
|
5182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
4821
5183
|
}
|
|
4822
5184
|
}
|
|
4823
5185
|
|
|
4824
5186
|
// src/effects/EffectParameters.tsx
|
|
4825
|
-
var
|
|
5187
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4826
5188
|
function EffectParameters({
|
|
4827
5189
|
description,
|
|
4828
5190
|
values,
|
|
@@ -4837,10 +5199,10 @@ function EffectParameters({
|
|
|
4837
5199
|
className = "",
|
|
4838
5200
|
components
|
|
4839
5201
|
}) {
|
|
4840
|
-
const fields = (0,
|
|
4841
|
-
const idBase = (0,
|
|
4842
|
-
const gesture =
|
|
4843
|
-
const count =
|
|
5202
|
+
const fields = (0, import_react29.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
5203
|
+
const idBase = (0, import_react29.useId)();
|
|
5204
|
+
const gesture = import_react29.default.useRef(null);
|
|
5205
|
+
const count = import_react29.default.useRef(0);
|
|
4844
5206
|
const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
|
|
4845
5207
|
const handlePresetSelect = (name) => {
|
|
4846
5208
|
if (!name) return;
|
|
@@ -4851,8 +5213,8 @@ function EffectParameters({
|
|
|
4851
5213
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
4852
5214
|
}
|
|
4853
5215
|
};
|
|
4854
|
-
return /* @__PURE__ */ (0,
|
|
4855
|
-
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0,
|
|
5216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
5217
|
+
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4856
5218
|
CustomPresetSelect,
|
|
4857
5219
|
{
|
|
4858
5220
|
"aria-label": `${description.name} presets`,
|
|
@@ -4867,7 +5229,7 @@ function EffectParameters({
|
|
|
4867
5229
|
],
|
|
4868
5230
|
onChange: (name) => handlePresetSelect(String(name))
|
|
4869
5231
|
}
|
|
4870
|
-
) : /* @__PURE__ */ (0,
|
|
5232
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4871
5233
|
"select",
|
|
4872
5234
|
{
|
|
4873
5235
|
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
@@ -4877,8 +5239,8 @@ function EffectParameters({
|
|
|
4877
5239
|
disabled,
|
|
4878
5240
|
onChange: (e) => handlePresetSelect(e.currentTarget.value),
|
|
4879
5241
|
children: [
|
|
4880
|
-
/* @__PURE__ */ (0,
|
|
4881
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
5242
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
|
|
5243
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
|
|
4882
5244
|
]
|
|
4883
5245
|
}
|
|
4884
5246
|
)),
|
|
@@ -4888,14 +5250,14 @@ function EffectParameters({
|
|
|
4888
5250
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
4889
5251
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
4890
5252
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
4891
|
-
return /* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
keyed && /* @__PURE__ */ (0,
|
|
5253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
5255
|
+
/* @__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 }),
|
|
5256
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
4895
5257
|
renderControlAddon?.(field.id),
|
|
4896
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
5258
|
+
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
5259
|
] }),
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
5260
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4899
5261
|
ParameterFieldControl,
|
|
4900
5262
|
{
|
|
4901
5263
|
field,
|
|
@@ -4910,25 +5272,25 @@ function EffectParameters({
|
|
|
4910
5272
|
)
|
|
4911
5273
|
] }, field.id);
|
|
4912
5274
|
}),
|
|
4913
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
5275
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
4914
5276
|
] });
|
|
4915
5277
|
}
|
|
4916
5278
|
|
|
4917
5279
|
// src/vector/VectorProviderEffectsPanel.tsx
|
|
4918
|
-
var
|
|
4919
|
-
var
|
|
5280
|
+
var import_react30 = require("react");
|
|
5281
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4920
5282
|
var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
4921
5283
|
function Controls({ controller, group }) {
|
|
4922
5284
|
const provider = controller.effectsProvider;
|
|
4923
5285
|
const tag = group.providerEffect;
|
|
4924
5286
|
const { description, error } = useEffectDescription(provider, tag.effect);
|
|
4925
|
-
const [message, setMessage] = (0,
|
|
5287
|
+
const [message, setMessage] = (0, import_react30.useState)(null);
|
|
4926
5288
|
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,
|
|
5289
|
+
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." });
|
|
5290
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
|
|
5291
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
5292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4932
5294
|
EffectParameters,
|
|
4933
5295
|
{
|
|
4934
5296
|
description,
|
|
@@ -4938,18 +5300,18 @@ function Controls({ controller, group }) {
|
|
|
4938
5300
|
onPreset: (v) => run(controller.updateVectorEffect(group.id, v))
|
|
4939
5301
|
}
|
|
4940
5302
|
),
|
|
4941
|
-
message && /* @__PURE__ */ (0,
|
|
5303
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
4942
5304
|
] });
|
|
4943
5305
|
}
|
|
4944
5306
|
function VectorProviderEffectsPanel({ controller, className = "" }) {
|
|
4945
5307
|
const state = useVectorEditorState(controller);
|
|
4946
|
-
const provider = (0,
|
|
5308
|
+
const provider = (0, import_react30.useSyncExternalStore)(
|
|
4947
5309
|
(cb) => controller.effects.subscribe(cb),
|
|
4948
5310
|
() => controller.effects.provider,
|
|
4949
5311
|
() => controller.effects.provider
|
|
4950
5312
|
);
|
|
4951
|
-
const [browse, setBrowse] = (0,
|
|
4952
|
-
const [message, setMessage] = (0,
|
|
5313
|
+
const [browse, setBrowse] = (0, import_react30.useState)(false);
|
|
5314
|
+
const [message, setMessage] = (0, import_react30.useState)(null);
|
|
4953
5315
|
void state;
|
|
4954
5316
|
const groups = controller.vectorEffectGroups();
|
|
4955
5317
|
const selected = groups.filter((g) => state.selection.includes(g.id));
|
|
@@ -4957,60 +5319,60 @@ function VectorProviderEffectsPanel({ controller, className = "" }) {
|
|
|
4957
5319
|
setMessage(null);
|
|
4958
5320
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
4959
5321
|
};
|
|
4960
|
-
return /* @__PURE__ */ (0,
|
|
4961
|
-
/* @__PURE__ */ (0,
|
|
4962
|
-
/* @__PURE__ */ (0,
|
|
4963
|
-
/* @__PURE__ */ (0,
|
|
5322
|
+
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: [
|
|
5323
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse, onClick: () => setBrowse(!browse), children: "Add effect\u2026" })
|
|
4964
5326
|
] }),
|
|
4965
|
-
!provider && /* @__PURE__ */ (0,
|
|
4966
|
-
browse && /* @__PURE__ */ (0,
|
|
4967
|
-
selected.map((g) => /* @__PURE__ */ (0,
|
|
4968
|
-
/* @__PURE__ */ (0,
|
|
4969
|
-
/* @__PURE__ */ (0,
|
|
4970
|
-
/* @__PURE__ */ (0,
|
|
5327
|
+
!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." }),
|
|
5328
|
+
browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(false), run(() => controller.addVectorEffect(e.id))) }),
|
|
5329
|
+
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: [
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.providerEffect.name ?? g.providerEffect.effect }),
|
|
5332
|
+
/* @__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
5333
|
] }),
|
|
4972
|
-
/* @__PURE__ */ (0,
|
|
5334
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { controller, group: g })
|
|
4973
5335
|
] }, g.id)),
|
|
4974
|
-
groups.length > 0 && !selected.length && /* @__PURE__ */ (0,
|
|
5336
|
+
groups.length > 0 && !selected.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
4975
5337
|
"Select an effect group (",
|
|
4976
5338
|
groups.length,
|
|
4977
5339
|
" in the drawing) to change it."
|
|
4978
5340
|
] }),
|
|
4979
|
-
message && /* @__PURE__ */ (0,
|
|
5341
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
4980
5342
|
] });
|
|
4981
5343
|
}
|
|
4982
5344
|
|
|
4983
5345
|
// src/vector/VectorEditor.tsx
|
|
4984
|
-
var
|
|
5346
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4985
5347
|
function VectorEditor({ controller, tools, showStylePanel = true, height = 520, canvasProps, effects, className }) {
|
|
4986
5348
|
useEffects(controller, effects);
|
|
4987
5349
|
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,
|
|
5350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 ${className ?? ""}`, "data-vector-editor": "", children: [
|
|
5351
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorToolbar, { controller, tools }),
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-h-0 flex-col gap-2 md:flex-row", children: [
|
|
5353
|
+
/* @__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 }) }),
|
|
5354
|
+
showStylePanel && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex w-full shrink-0 flex-col gap-2 md:w-56", children: [
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorStylePanel, { controller, className: "rounded-md border border-border p-3" }),
|
|
5356
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VectorProviderEffectsPanel, { controller, className: "rounded-md border border-border p-3" })
|
|
4995
5357
|
] })
|
|
4996
5358
|
] })
|
|
4997
5359
|
] });
|
|
4998
5360
|
}
|
|
4999
5361
|
|
|
5000
5362
|
// src/vector/VectorGeneratePanel.tsx
|
|
5001
|
-
var
|
|
5363
|
+
var import_react31 = require("react");
|
|
5002
5364
|
var import_vector21 = require("@pixerate/editor/vector");
|
|
5003
|
-
var
|
|
5365
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5004
5366
|
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
5367
|
var selectClass15 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
5006
5368
|
var AS_LABELS = { color: "Traced in colour", threshold: "Traced in one colour", mosaic: "Mosaic", halftone: "Halftone", lowPoly: "Low poly", hatch: "Engraving" };
|
|
5007
5369
|
function VectorGeneratePanel({ controller, models, generate, className }) {
|
|
5008
5370
|
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,
|
|
5371
|
+
const [prompt, setPrompt] = (0, import_react31.useState)("");
|
|
5372
|
+
const [model, setModel] = (0, import_react31.useState)("");
|
|
5373
|
+
const [as, setAs] = (0, import_react31.useState)("color");
|
|
5374
|
+
const [busy, setBusy] = (0, import_react31.useState)(false);
|
|
5375
|
+
const [message, setMessage] = (0, import_react31.useState)(null);
|
|
5014
5376
|
const chosen = usable.find((m) => m.id === model) ?? usable[0];
|
|
5015
5377
|
if (!usable.length) return null;
|
|
5016
5378
|
const run = async () => {
|
|
@@ -5020,18 +5382,18 @@ function VectorGeneratePanel({ controller, models, generate, className }) {
|
|
|
5020
5382
|
setBusy(false);
|
|
5021
5383
|
setMessage(r.ok ? null : r.message ?? "Generation failed.");
|
|
5022
5384
|
};
|
|
5023
|
-
return /* @__PURE__ */ (0,
|
|
5024
|
-
/* @__PURE__ */ (0,
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5026
|
-
/* @__PURE__ */ (0,
|
|
5027
|
-
chosen.media === "image" && /* @__PURE__ */ (0,
|
|
5385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `space-y-1 ${className ?? ""}`, "data-vector-generate-panel": "", "aria-label": "Generate", children: [
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5387
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Generate" }),
|
|
5388
|
+
/* @__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)) }),
|
|
5389
|
+
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
5390
|
] }),
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5030
|
-
/* @__PURE__ */ (0,
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5391
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5392
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-16" }),
|
|
5393
|
+
/* @__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() }),
|
|
5394
|
+
/* @__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
5395
|
] }),
|
|
5034
|
-
message && /* @__PURE__ */ (0,
|
|
5396
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-[11px] text-red-600", children: message })
|
|
5035
5397
|
] });
|
|
5036
5398
|
}
|
|
5037
5399
|
// Annotate the CommonJS export names for ESM import in node:
|