@pixerate/editor-react 0.91.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
- package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
- package/dist/canvas/index.cjs +1032 -893
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +125 -74
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
- package/dist/{chunk-SMMO7CZB.js → chunk-6MDTFAPY.js} +84 -2
- package/dist/chunk-ECBC4HD7.js +95 -0
- package/dist/hooks/useAgentToolProvider.d.cts +6 -2
- package/dist/hooks/useAgentToolProvider.d.ts +6 -2
- package/dist/image-editor/ImageEditor.d.cts +10 -0
- package/dist/image-editor/ImageEditor.d.ts +10 -0
- package/dist/image-editor/index.cjs +1027 -864
- package/dist/image-editor/index.js +2 -1
- package/dist/index.cjs +1986 -1810
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -2
- package/dist/playback/AgentPlaybackContext.d.cts +9 -0
- package/dist/playback/AgentPlaybackContext.d.ts +9 -0
- package/dist/playback/PresenceLayer.d.cts +28 -0
- package/dist/playback/PresenceLayer.d.ts +28 -0
- package/dist/playback/index.d.cts +3 -0
- package/dist/playback/index.d.ts +3 -0
- package/dist/playback/usePlaybackSurface.d.cts +9 -0
- package/dist/playback/usePlaybackSurface.d.ts +9 -0
- package/dist/vector/VectorCanvas.d.cts +11 -1
- package/dist/vector/VectorCanvas.d.ts +11 -1
- package/dist/vector/index.cjs +945 -826
- package/dist/vector/index.js +42 -3
- package/package.json +13 -13
package/dist/vector/index.cjs
CHANGED
|
@@ -142,21 +142,107 @@ function useVectorGenerationTools(registry, controller, options) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// src/vector/VectorCanvas.tsx
|
|
145
|
-
var
|
|
145
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
146
146
|
var import_vector3 = require("@pixerate/editor/vector");
|
|
147
147
|
|
|
148
|
-
// src/
|
|
148
|
+
// src/playback/AgentPlaybackContext.tsx
|
|
149
149
|
var import_react2 = require("react");
|
|
150
|
-
var import_vector2 = require("@pixerate/editor/vector");
|
|
151
150
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
151
|
+
var AgentPlaybackContext = (0, import_react2.createContext)(null);
|
|
152
|
+
function useAgentPlayback() {
|
|
153
|
+
return (0, import_react2.useContext)(AgentPlaybackContext);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/playback/usePlaybackSurface.ts
|
|
157
|
+
var import_react3 = require("react");
|
|
158
|
+
var import_tools = require("@pixerate/editor/tools");
|
|
159
|
+
function usePlaybackSurface(playback, id, options = {}) {
|
|
160
|
+
const ambient = useAgentPlayback();
|
|
161
|
+
const target = playback === void 0 ? ambient : playback;
|
|
162
|
+
const [presence] = (0, import_react3.useState)(() => new import_tools.PresenceStore());
|
|
163
|
+
const latest = (0, import_react3.useRef)(options);
|
|
164
|
+
latest.current = options;
|
|
165
|
+
(0, import_react3.useEffect)(() => {
|
|
166
|
+
if (!target || !id) return;
|
|
167
|
+
const o = () => latest.current;
|
|
168
|
+
const surface = {
|
|
169
|
+
presence,
|
|
170
|
+
locate: (ref) => o().locate?.(ref) ?? null,
|
|
171
|
+
bounds: () => o().bounds?.() ?? null,
|
|
172
|
+
visible: () => o().visible?.() ?? true,
|
|
173
|
+
toViewport: (p) => o().toViewport?.(p) ?? p,
|
|
174
|
+
fromViewport: (p) => o().fromViewport?.(p) ?? p,
|
|
175
|
+
beginGesture: (key) => o().beginGesture?.(key),
|
|
176
|
+
endGesture: () => o().endGesture?.(),
|
|
177
|
+
reveal: () => o().reveal?.(),
|
|
178
|
+
open: (ref) => o().open?.(ref),
|
|
179
|
+
get defaultKind() {
|
|
180
|
+
return o().defaultKind;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const detach = target.attach(id, surface);
|
|
184
|
+
return () => {
|
|
185
|
+
detach();
|
|
186
|
+
for (const a of presence.getState().actors) presence.remove(a.id);
|
|
187
|
+
};
|
|
188
|
+
}, [target, id, presence]);
|
|
189
|
+
return presence;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/playback/PresenceLayer.tsx
|
|
193
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
194
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
195
|
+
function PresenceLayer({ presence, viewport, className = "" }) {
|
|
196
|
+
const { actors } = (0, import_react4.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
197
|
+
if (!actors.length) return null;
|
|
198
|
+
const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
className: `pixerate-presence ${className}`.trim(),
|
|
203
|
+
"aria-hidden": "true",
|
|
204
|
+
"data-testid": "presence-layer",
|
|
205
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
|
|
206
|
+
children: actors.map((a) => {
|
|
207
|
+
const at = map(a);
|
|
208
|
+
const ring = a.focus && (() => {
|
|
209
|
+
const tl = map(a.focus);
|
|
210
|
+
const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
|
|
211
|
+
return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
|
|
212
|
+
})();
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react4.default.Fragment, { children: [
|
|
214
|
+
ring && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
"data-actor-focus": a.id,
|
|
218
|
+
style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
|
|
225
|
+
a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
|
|
226
|
+
] })
|
|
227
|
+
] })
|
|
228
|
+
] }, a.id);
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/vector/VectorWidthPointEditor.tsx
|
|
235
|
+
var import_react5 = require("react");
|
|
236
|
+
var import_vector2 = require("@pixerate/editor/vector");
|
|
237
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
152
238
|
var round = (v, digits) => String(Math.round(v * 10 ** digits) / 10 ** digits);
|
|
153
239
|
var fieldStyle = { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 6 };
|
|
154
240
|
var inputStyle = { width: 72, font: "inherit", padding: "1px 4px" };
|
|
155
241
|
function VectorWidthPointEditor({ controller, edit, accentColor = import_vector2.VECTOR_OVERLAY_THEME.accent, className, style }) {
|
|
156
|
-
const [position, setPosition] = (0,
|
|
157
|
-
const [left, setLeft] = (0,
|
|
158
|
-
const [right, setRight] = (0,
|
|
159
|
-
const formRef = (0,
|
|
242
|
+
const [position, setPosition] = (0, import_react5.useState)(() => round(edit.t * 100, 2));
|
|
243
|
+
const [left, setLeft] = (0, import_react5.useState)(() => round(edit.left, 3));
|
|
244
|
+
const [right, setRight] = (0, import_react5.useState)(() => round(edit.right, 3));
|
|
245
|
+
const formRef = (0, import_react5.useRef)(null);
|
|
160
246
|
const refocus = () => formRef.current?.closest("svg")?.focus?.({ preventScroll: true });
|
|
161
247
|
const close = () => {
|
|
162
248
|
refocus();
|
|
@@ -169,7 +255,7 @@ function VectorWidthPointEditor({ controller, edit, accentColor = import_vector2
|
|
|
169
255
|
controller.commitWidthPointEdit({ t: t === void 0 ? void 0 : Math.min(Math.max(t, 0), 100) / 100, left: num2(left), right: num2(right) });
|
|
170
256
|
};
|
|
171
257
|
const stop = (e) => e.stopPropagation();
|
|
172
|
-
return /* @__PURE__ */ (0,
|
|
258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
173
259
|
"form",
|
|
174
260
|
{
|
|
175
261
|
ref: formRef,
|
|
@@ -207,21 +293,21 @@ function VectorWidthPointEditor({ controller, edit, accentColor = import_vector2
|
|
|
207
293
|
apply();
|
|
208
294
|
},
|
|
209
295
|
children: [
|
|
210
|
-
/* @__PURE__ */ (0,
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: fieldStyle, children: [
|
|
211
297
|
"Position %",
|
|
212
|
-
/* @__PURE__ */ (0,
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": "Width point position", type: "number", min: 0, max: 100, step: "any", value: position, onChange: (e) => setPosition(e.target.value), style: inputStyle, autoFocus: true })
|
|
213
299
|
] }),
|
|
214
|
-
/* @__PURE__ */ (0,
|
|
300
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: fieldStyle, children: [
|
|
215
301
|
"Left",
|
|
216
|
-
/* @__PURE__ */ (0,
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": "Width point left side", type: "number", min: 0, step: "any", value: left, onChange: (e) => setLeft(e.target.value), style: inputStyle })
|
|
217
303
|
] }),
|
|
218
|
-
/* @__PURE__ */ (0,
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: fieldStyle, children: [
|
|
219
305
|
"Right",
|
|
220
|
-
/* @__PURE__ */ (0,
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { "aria-label": "Width point right side", type: "number", min: 0, step: "any", value: right, onChange: (e) => setRight(e.target.value), style: inputStyle })
|
|
221
307
|
] }),
|
|
222
|
-
/* @__PURE__ */ (0,
|
|
223
|
-
/* @__PURE__ */ (0,
|
|
224
|
-
/* @__PURE__ */ (0,
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 4, marginTop: 2 }, children: [
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: close, children: "Cancel" }),
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "submit", style: { background: accentColor, color: "#ffffff", border: "none", borderRadius: 4, padding: "2px 8px" }, children: edit.index === null ? "Add" : "Apply" })
|
|
225
311
|
] })
|
|
226
312
|
]
|
|
227
313
|
}
|
|
@@ -229,30 +315,30 @@ function VectorWidthPointEditor({ controller, edit, accentColor = import_vector2
|
|
|
229
315
|
}
|
|
230
316
|
|
|
231
317
|
// src/vector/VectorCanvas.tsx
|
|
232
|
-
var
|
|
318
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
233
319
|
function GradientElement({ def }) {
|
|
234
|
-
const stops = def.stops.map((s, i) => /* @__PURE__ */ (0,
|
|
235
|
-
return def.type === "radial" ? /* @__PURE__ */ (0,
|
|
320
|
+
const stops = def.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("stop", { offset: s.offset, stopColor: s.stopColor, stopOpacity: s.stopOpacity }, i));
|
|
321
|
+
return def.type === "radial" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("radialGradient", { id: def.id, ...def.attrs, children: stops }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("linearGradient", { id: def.id, ...def.attrs, children: stops });
|
|
236
322
|
}
|
|
237
323
|
function VectorGradientDefs({ defs }) {
|
|
238
324
|
if (!defs.length) return null;
|
|
239
|
-
return /* @__PURE__ */ (0,
|
|
240
|
-
(def) => def.type === "pattern" ? /* @__PURE__ */ (0,
|
|
241
|
-
def.gradients.map((g) => /* @__PURE__ */ (0,
|
|
242
|
-
def.tiles.map((t, i) => /* @__PURE__ */ (0,
|
|
243
|
-
] }, def.id) : /* @__PURE__ */ (0,
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: defs.map(
|
|
326
|
+
(def) => def.type === "pattern" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("pattern", { id: def.id, ...def.attrs, children: [
|
|
327
|
+
def.gradients.map((g) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GradientElement, { def: g }, g.id)),
|
|
328
|
+
def.tiles.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: t.d, fill: t.fill }, i))
|
|
329
|
+
] }, def.id) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GradientElement, { def }, def.id)
|
|
244
330
|
) });
|
|
245
331
|
}
|
|
246
332
|
function VectorGradientAnnotator({ annotator: g, accentColor = import_vector3.VECTOR_OVERLAY_THEME.accent }) {
|
|
247
333
|
const r = import_vector3.VECTOR_OVERLAY_THEME.handleRadius + 1.5;
|
|
248
|
-
const ring = (p, part, size = r) => /* @__PURE__ */ (0,
|
|
249
|
-
return /* @__PURE__ */ (0,
|
|
250
|
-
g.extent && /* @__PURE__ */ (0,
|
|
251
|
-
/* @__PURE__ */ (0,
|
|
252
|
-
/* @__PURE__ */ (0,
|
|
253
|
-
g.aspect && /* @__PURE__ */ (0,
|
|
334
|
+
const ring = (p, part, size = r) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-gradient-handle": part, cx: p.x, cy: p.y, r: size + (p.hovered ? 1 : 0), fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor, strokeWidth: p.hovered ? 2 : 1 });
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-gradient-annotator": g.type, children: [
|
|
336
|
+
g.extent && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-gradient-extent": "", d: g.extent, fill: "none", stroke: accentColor, strokeDasharray: "4 3" }),
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: g.start.x, y1: g.start.y, x2: g.end.x, y2: g.end.y, stroke: "#ffffff", strokeWidth: 3 }),
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { "data-vector-gradient-bar": "", x1: g.start.x, y1: g.start.y, x2: g.end.x, y2: g.end.y, stroke: accentColor }),
|
|
339
|
+
g.aspect && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: g.start.x, y1: g.start.y, x2: g.aspect.x, y2: g.aspect.y, stroke: accentColor, strokeDasharray: "2 2" }),
|
|
254
340
|
ring(g.start, "start"),
|
|
255
|
-
/* @__PURE__ */ (0,
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
256
342
|
"rect",
|
|
257
343
|
{
|
|
258
344
|
"data-vector-gradient-handle": g.end.handle,
|
|
@@ -266,24 +352,24 @@ function VectorGradientAnnotator({ annotator: g, accentColor = import_vector3.VE
|
|
|
266
352
|
}
|
|
267
353
|
),
|
|
268
354
|
g.aspect && ring(g.aspect, "aspect", import_vector3.VECTOR_OVERLAY_THEME.handleRadius),
|
|
269
|
-
g.focal && /* @__PURE__ */ (0,
|
|
270
|
-
g.midpoints.map((m) => /* @__PURE__ */ (0,
|
|
271
|
-
g.stops.map((s) => /* @__PURE__ */ (0,
|
|
272
|
-
/* @__PURE__ */ (0,
|
|
273
|
-
/* @__PURE__ */ (0,
|
|
274
|
-
/* @__PURE__ */ (0,
|
|
355
|
+
g.focal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-gradient-handle": "focal", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: g.focal.x, cy: g.focal.y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius - 1 + (g.focal.hovered ? 1 : 0), fill: accentColor, stroke: import_vector3.VECTOR_OVERLAY_THEME.handleFill }) }),
|
|
356
|
+
g.midpoints.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-gradient-midpoint": m.index, d: (0, import_vector3.vectorDiamondPath)(m.x, m.y, 4 + (m.hovered ? 1 : 0)), fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, m.index)),
|
|
357
|
+
g.stops.map((s) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-gradient-stop": s.index, "data-selected": s.selected || void 0, opacity: g.removing && s.selected ? 0.35 : 1, children: [
|
|
358
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: s.barX, y1: s.barY, x2: s.x, y2: s.y, stroke: accentColor }),
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: s.x - 5, y: s.y - 5, width: 10, height: 10, rx: 2, fill: s.color, fillOpacity: s.opacity, stroke: s.selected ? accentColor : "#ffffff", strokeWidth: s.selected || s.hovered ? 2 : 1 }),
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: s.x - 6.5, y: s.y - 6.5, width: 13, height: 13, rx: 3, fill: "none", stroke: s.selected ? "#ffffff" : accentColor })
|
|
275
361
|
] }, s.index))
|
|
276
362
|
] });
|
|
277
363
|
}
|
|
278
364
|
function VectorFilterDefs({ filters }) {
|
|
279
365
|
if (!filters.length) return null;
|
|
280
366
|
const props = (attrs) => Object.fromEntries(Object.entries(attrs).map(([k, v]) => [k.replace(/-([a-z])/g, (_, c) => c.toUpperCase()), v]));
|
|
281
|
-
const primitive = (p, key) =>
|
|
282
|
-
return /* @__PURE__ */ (0,
|
|
367
|
+
const primitive = (p, key) => import_react6.default.createElement(p.tag, { key, ...props(p.attrs) }, p.children?.map(primitive));
|
|
368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: filters.map((f) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("filter", { id: f.id, filterUnits: "userSpaceOnUse", x: f.x, y: f.y, width: f.width, height: f.height, colorInterpolationFilters: "sRGB", children: f.primitives.map(primitive) }, f.id)) });
|
|
283
369
|
}
|
|
284
370
|
var blendStyle = (blendMode) => blendMode ? { mixBlendMode: blendMode } : void 0;
|
|
285
371
|
function VectorTextElement({ node }) {
|
|
286
|
-
return /* @__PURE__ */ (0,
|
|
372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-id": node.id, "data-vector-text": "", transform: node.transform, opacity: node.opacity < 1 ? node.opacity : void 0, filter: node.filter, style: blendStyle(node.blendMode), children: node.layers.map((layer, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
287
373
|
"text",
|
|
288
374
|
{
|
|
289
375
|
"data-vector-layer": layer.kind,
|
|
@@ -295,7 +381,7 @@ function VectorTextElement({ node }) {
|
|
|
295
381
|
strokeDasharray: layer.strokeDasharray,
|
|
296
382
|
opacity: layer.opacity < 1 ? layer.opacity : void 0,
|
|
297
383
|
style: { whiteSpace: "pre", ...blendStyle(layer.blendMode) },
|
|
298
|
-
children: node.spans.map((sp, k) => /* @__PURE__ */ (0,
|
|
384
|
+
children: node.spans.map((sp, k) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
299
385
|
"tspan",
|
|
300
386
|
{
|
|
301
387
|
x: sp.x,
|
|
@@ -316,29 +402,29 @@ function VectorTextElement({ node }) {
|
|
|
316
402
|
)) });
|
|
317
403
|
}
|
|
318
404
|
function VectorSceneNodes({ nodes }) {
|
|
319
|
-
return /* @__PURE__ */ (0,
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: nodes.map((node) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNode, { node }, node.id)) });
|
|
320
406
|
}
|
|
321
|
-
var VectorSceneNode =
|
|
322
|
-
if (node.kind === "text") return /* @__PURE__ */ (0,
|
|
407
|
+
var VectorSceneNode = import_react6.default.memo(function VectorSceneNode2({ node }) {
|
|
408
|
+
if (node.kind === "text") return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorTextElement, { node });
|
|
323
409
|
if (node.kind === "group")
|
|
324
|
-
return /* @__PURE__ */ (0,
|
|
410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-id": node.id, "data-vector-mask": node.mask?.type, transform: node.transform, opacity: node.opacity < 1 ? node.opacity : void 0, filter: node.filter, style: blendStyle(node.blendMode), children: node.mask ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorMaskedNodes, { mask: node.mask, nodes: node.children }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNodes, { nodes: node.children }) });
|
|
325
411
|
if (node.layers)
|
|
326
412
|
return (
|
|
327
413
|
// Fill and stroke stacks: each layer in order, bottom to top.
|
|
328
|
-
/* @__PURE__ */ (0,
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-id": node.id, transform: node.transform, opacity: node.opacity < 1 ? node.opacity : void 0, filter: node.filter, style: blendStyle(node.blendMode), children: node.layers.map(
|
|
329
415
|
(layer) => layer.kind === "brushstroke" ? (
|
|
330
416
|
// A brushstroke: its rendered brush images over their boxes.
|
|
331
|
-
/* @__PURE__ */ (0,
|
|
332
|
-
) : /* @__PURE__ */ (0,
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-layer": `brushstroke-${layer.index}`, opacity: layer.opacity < 1 ? layer.opacity : void 0, style: blendStyle(layer.blendMode), children: (layer.images ?? []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("image", { href: im.href, x: im.x, y: im.y, width: im.width, height: im.height, preserveAspectRatio: "none" }, i)) }, `${layer.kind}-${layer.index}`)
|
|
418
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorPaintPath, { paint: layer, d: node.d, fillRule: node.fillRule, layer: `${layer.kind}-${layer.index}` }, `${layer.kind}-${layer.index}`)
|
|
333
419
|
) })
|
|
334
420
|
);
|
|
335
|
-
return /* @__PURE__ */ (0,
|
|
421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorPaintPath, { paint: node, d: node.d, fillRule: node.fillRule, id: node.id, transform: node.transform, filter: node.filter, blendMode: node.blendMode });
|
|
336
422
|
});
|
|
337
423
|
function VectorMaskedNodes({ mask, nodes }) {
|
|
338
424
|
const b = mask.bounds;
|
|
339
|
-
return /* @__PURE__ */ (0,
|
|
340
|
-
/* @__PURE__ */ (0,
|
|
341
|
-
/* @__PURE__ */ (0,
|
|
425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: mask.clip ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("clipPath", { id: mask.id, children: mask.clip.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: c.d, clipRule: c.clipRule }, i)) }) : b && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("mask", { id: mask.id, maskUnits: "userSpaceOnUse", x: b.x, y: b.y, width: b.width, height: b.height, style: mask.type === "alpha" ? { maskType: "alpha" } : void 0, children: mask.filter ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { filter: mask.filter, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNodes, { nodes: mask.nodes ?? [] }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNodes, { nodes: mask.nodes ?? [] }) }) }),
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-masked": "", clipPath: mask.clip ? `url(#${mask.id})` : void 0, mask: mask.clip ? void 0 : `url(#${mask.id})`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNodes, { nodes }) })
|
|
342
428
|
] });
|
|
343
429
|
}
|
|
344
430
|
function VectorPaintPath({
|
|
@@ -355,7 +441,7 @@ function VectorPaintPath({
|
|
|
355
441
|
const style = blendStyle(blendMode ?? (layer ? paint.blendMode : void 0));
|
|
356
442
|
const sp = paint.strokeParts;
|
|
357
443
|
if (!sp)
|
|
358
|
-
return /* @__PURE__ */ (0,
|
|
444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
359
445
|
"path",
|
|
360
446
|
{
|
|
361
447
|
"data-vector-id": id,
|
|
@@ -376,15 +462,15 @@ function VectorPaintPath({
|
|
|
376
462
|
);
|
|
377
463
|
const clip = sp.clip;
|
|
378
464
|
const b = clip?.bounds;
|
|
379
|
-
return /* @__PURE__ */ (0,
|
|
380
|
-
clip && b && /* @__PURE__ */ (0,
|
|
381
|
-
/* @__PURE__ */ (0,
|
|
382
|
-
/* @__PURE__ */ (0,
|
|
465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-id": id, "data-vector-layer": layer, "data-vector-stroke-align": sp.align, transform, opacity, filter, style, children: [
|
|
466
|
+
clip && b && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: clip.kind === "clip" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("clipPath", { id: clip.id, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d, clipRule: fillRule }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("mask", { id: clip.id, maskUnits: "userSpaceOnUse", x: b.x, y: b.y, width: b.width, height: b.height, children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: b.x, y: b.y, width: b.width, height: b.height, fill: "#fff" }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d, fill: "#000", fillRule })
|
|
383
469
|
] }) }),
|
|
384
|
-
/* @__PURE__ */ (0,
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-part": "fill", d, fill: paint.fill, fillRule, stroke: "none" }),
|
|
385
471
|
sp.outline !== void 0 ? (
|
|
386
472
|
// A variable-width stroke: its outline, filled.
|
|
387
|
-
/* @__PURE__ */ (0,
|
|
473
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
388
474
|
"path",
|
|
389
475
|
{
|
|
390
476
|
"data-vector-part": "stroke-outline",
|
|
@@ -394,7 +480,7 @@ function VectorPaintPath({
|
|
|
394
480
|
mask: clip?.kind === "mask" ? `url(#${clip.id})` : void 0
|
|
395
481
|
}
|
|
396
482
|
)
|
|
397
|
-
) : /* @__PURE__ */ (0,
|
|
483
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
398
484
|
"path",
|
|
399
485
|
{
|
|
400
486
|
"data-vector-part": "stroke",
|
|
@@ -409,7 +495,7 @@ function VectorPaintPath({
|
|
|
409
495
|
mask: clip?.kind === "mask" ? `url(#${clip.id})` : void 0
|
|
410
496
|
}
|
|
411
497
|
),
|
|
412
|
-
sp.heads.map((head, i) => /* @__PURE__ */ (0,
|
|
498
|
+
sp.heads.map((head, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-part": "head", d: head, fill: paint.stroke }, i))
|
|
413
499
|
] });
|
|
414
500
|
}
|
|
415
501
|
function VectorCanvas({
|
|
@@ -420,19 +506,22 @@ function VectorCanvas({
|
|
|
420
506
|
guideColor = import_vector3.VECTOR_OVERLAY_THEME.guide,
|
|
421
507
|
className,
|
|
422
508
|
style,
|
|
423
|
-
"aria-label": ariaLabel = "Vector canvas"
|
|
509
|
+
"aria-label": ariaLabel = "Vector canvas",
|
|
510
|
+
playback,
|
|
511
|
+
playbackId = "vector",
|
|
512
|
+
onPlaybackReveal
|
|
424
513
|
}) {
|
|
425
514
|
const state = useVectorEditorState(controller);
|
|
426
|
-
const svgRef = (0,
|
|
427
|
-
const textRef = (0,
|
|
515
|
+
const svgRef = (0, import_react6.useRef)(null);
|
|
516
|
+
const textRef = (0, import_react6.useRef)(null);
|
|
428
517
|
const editingText = state.textEdit?.nodeId ?? null;
|
|
429
|
-
const fitted = (0,
|
|
430
|
-
const uid = (0,
|
|
431
|
-
const [size, setSize] = (0,
|
|
518
|
+
const fitted = (0, import_react6.useRef)(!fitOnMount);
|
|
519
|
+
const uid = (0, import_react6.useId)().replace(/:/g, "");
|
|
520
|
+
const [size, setSize] = (0, import_react6.useState)(null);
|
|
432
521
|
const scene = (0, import_vector3.getVectorSceneRenderData)(state, { idPrefix: `ve${uid}-`, ...size ? { viewportSize: size } : {} });
|
|
433
522
|
const overlay = (0, import_vector3.getVectorOverlayRenderData)(state);
|
|
434
523
|
const host = (0, import_vector3.getVectorSymbolEditBackground)(state, { idPrefix: `ve${uid}-host-` });
|
|
435
|
-
(0,
|
|
524
|
+
(0, import_react6.useEffect)(() => {
|
|
436
525
|
const el = svgRef.current;
|
|
437
526
|
if (!el || fitted.current) return;
|
|
438
527
|
const fit = () => {
|
|
@@ -447,7 +536,7 @@ function VectorCanvas({
|
|
|
447
536
|
observer.observe(el);
|
|
448
537
|
return () => observer.disconnect();
|
|
449
538
|
}, [controller]);
|
|
450
|
-
(0,
|
|
539
|
+
(0, import_react6.useEffect)(() => {
|
|
451
540
|
const el = svgRef.current;
|
|
452
541
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
453
542
|
const measure = () => {
|
|
@@ -459,12 +548,12 @@ function VectorCanvas({
|
|
|
459
548
|
observer.observe(el);
|
|
460
549
|
return () => observer.disconnect();
|
|
461
550
|
}, []);
|
|
462
|
-
(0,
|
|
551
|
+
(0, import_react6.useEffect)(() => {
|
|
463
552
|
if (!editingText) return;
|
|
464
553
|
const t = setTimeout(() => textRef.current?.focus({ preventScroll: true }), 0);
|
|
465
554
|
return () => clearTimeout(t);
|
|
466
555
|
}, [editingText]);
|
|
467
|
-
(0,
|
|
556
|
+
(0, import_react6.useEffect)(() => {
|
|
468
557
|
const el = svgRef.current;
|
|
469
558
|
if (!el) return;
|
|
470
559
|
const onWheel = (e) => {
|
|
@@ -474,6 +563,34 @@ function VectorCanvas({
|
|
|
474
563
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
475
564
|
return () => el.removeEventListener("wheel", onWheel);
|
|
476
565
|
}, [controller]);
|
|
566
|
+
const ambientPlayback = useAgentPlayback();
|
|
567
|
+
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
568
|
+
const [locate] = (0, import_react6.useState)(() => (0, import_vector3.createVectorPlaybackLocator)(controller));
|
|
569
|
+
const svgBox = () => svgRef.current?.getBoundingClientRect() ?? null;
|
|
570
|
+
const presence = usePlaybackSurface(playing, playbackId, {
|
|
571
|
+
defaultKind: "vector",
|
|
572
|
+
locate,
|
|
573
|
+
bounds: () => {
|
|
574
|
+
const r = svgBox();
|
|
575
|
+
const v = controller.getState().viewport;
|
|
576
|
+
return r && r.width > 0 ? { x: -v.x / v.zoom, y: -v.y / v.zoom, width: r.width / v.zoom, height: r.height / v.zoom } : null;
|
|
577
|
+
},
|
|
578
|
+
visible: () => {
|
|
579
|
+
const r = svgBox();
|
|
580
|
+
return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
|
|
581
|
+
},
|
|
582
|
+
toViewport: (p) => {
|
|
583
|
+
const r = svgBox();
|
|
584
|
+
const v = controller.getState().viewport;
|
|
585
|
+
return { x: (r?.left ?? 0) + p.x * v.zoom + v.x, y: (r?.top ?? 0) + p.y * v.zoom + v.y };
|
|
586
|
+
},
|
|
587
|
+
fromViewport: (p) => {
|
|
588
|
+
const r = svgBox();
|
|
589
|
+
const v = controller.getState().viewport;
|
|
590
|
+
return { x: (p.x - (r?.left ?? 0) - v.x) / v.zoom, y: (p.y - (r?.top ?? 0) - v.y) / v.zoom };
|
|
591
|
+
},
|
|
592
|
+
reveal: () => onPlaybackReveal?.()
|
|
593
|
+
});
|
|
477
594
|
const local = (e) => {
|
|
478
595
|
const rect = svgRef.current?.getBoundingClientRect();
|
|
479
596
|
return { x: e.clientX - (rect?.left ?? 0), y: e.clientY - (rect?.top ?? 0) };
|
|
@@ -498,7 +615,7 @@ function VectorCanvas({
|
|
|
498
615
|
const box = overlay.selectionBox;
|
|
499
616
|
const edit = state.widthPointEdit;
|
|
500
617
|
const editAt = edit && { x: edit.point.x * state.viewport.zoom + state.viewport.x, y: edit.point.y * state.viewport.zoom + state.viewport.y };
|
|
501
|
-
return /* @__PURE__ */ (0,
|
|
618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
502
619
|
"svg",
|
|
503
620
|
{
|
|
504
621
|
ref: svgRef,
|
|
@@ -530,14 +647,14 @@ function VectorCanvas({
|
|
|
530
647
|
onCut: clipboard("cut"),
|
|
531
648
|
onPaste: clipboard("paste"),
|
|
532
649
|
children: [
|
|
533
|
-
checkerboard && /* @__PURE__ */ (0,
|
|
534
|
-
/* @__PURE__ */ (0,
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
650
|
+
checkerboard && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("pattern", { id: `ve${uid}-checker`, width: 16, height: 16, patternUnits: "userSpaceOnUse", children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: 16, height: 16, fill: "#ffffff" }),
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: 8, height: 8, fill: "#e5e7eb" }),
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: 8, y: 8, width: 8, height: 8, fill: "#e5e7eb" })
|
|
537
654
|
] }) }),
|
|
538
|
-
/* @__PURE__ */ (0,
|
|
539
|
-
/* @__PURE__ */ (0,
|
|
540
|
-
/* @__PURE__ */ (0,
|
|
655
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorGradientDefs, { defs: scene.defs }),
|
|
656
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorFilterDefs, { filters: scene.filters }),
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
541
658
|
"rect",
|
|
542
659
|
{
|
|
543
660
|
"data-vector-artboard": "",
|
|
@@ -549,13 +666,13 @@ function VectorCanvas({
|
|
|
549
666
|
stroke: "rgba(0,0,0,0.12)"
|
|
550
667
|
}
|
|
551
668
|
),
|
|
552
|
-
host && /* @__PURE__ */ (0,
|
|
553
|
-
/* @__PURE__ */ (0,
|
|
554
|
-
/* @__PURE__ */ (0,
|
|
555
|
-
/* @__PURE__ */ (0,
|
|
669
|
+
host && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-symbol-host": "", opacity: 0.3, pointerEvents: "none", transform: host.transform, children: [
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorGradientDefs, { defs: host.defs }),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorFilterDefs, { filters: host.filters }),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNodes, { nodes: host.nodes })
|
|
556
673
|
] }),
|
|
557
|
-
/* @__PURE__ */ (0,
|
|
558
|
-
overlay.frames.length > 0 && /* @__PURE__ */ (0,
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-scene": "", transform: scene.transform, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorSceneNodes, { nodes: scene.nodes }) }),
|
|
675
|
+
overlay.frames.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-frame-labels": "", children: overlay.frames.map((f) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
559
676
|
"text",
|
|
560
677
|
{
|
|
561
678
|
"data-vector-frame-label": f.id,
|
|
@@ -573,46 +690,46 @@ function VectorCanvas({
|
|
|
573
690
|
},
|
|
574
691
|
f.id
|
|
575
692
|
)) }),
|
|
576
|
-
/* @__PURE__ */ (0,
|
|
577
|
-
overlay.outlines.map((o) => /* @__PURE__ */ (0,
|
|
578
|
-
overlay.penPreview && /* @__PURE__ */ (0,
|
|
579
|
-
box && /* @__PURE__ */ (0,
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
581
|
-
/* @__PURE__ */ (0,
|
|
693
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-overlay": "", pointerEvents: "none", fill: "none", children: [
|
|
694
|
+
overlay.outlines.map((o) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: o.d, stroke: accentColor, strokeWidth: o.selected ? 1 : 1.5, opacity: o.selected ? 1 : 0.7 }, o.id)),
|
|
695
|
+
overlay.penPreview && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: overlay.penPreview, stroke: accentColor, strokeDasharray: "4 3" }),
|
|
696
|
+
box && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-selection": "", "data-free-distort": box.freeDistort || void 0, transform: box.transform || void 0, children: [
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: box.x, y: box.y, width: box.width, height: box.height, stroke: accentColor }),
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: box.x + box.width / 2, y1: box.y, x2: box.x + box.width / 2, y2: box.y - 24, stroke: accentColor }),
|
|
582
699
|
box.handles.map(
|
|
583
|
-
(h) => h.handle === "rotate" ? /* @__PURE__ */ (0,
|
|
700
|
+
(h) => h.handle === "rotate" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-handle": h.handle, cx: h.x, cy: h.y, r: hs / 2 + 1, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, h.handle) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { "data-handle": h.handle, x: h.x - hs / 2, y: h.y - hs / 2, width: hs, height: hs, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, h.handle)
|
|
584
701
|
)
|
|
585
702
|
] }),
|
|
586
|
-
overlay.distort && /* @__PURE__ */ (0,
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
588
|
-
overlay.distort.corners.map((c, i) => /* @__PURE__ */ (0,
|
|
703
|
+
overlay.distort && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-distort": overlay.distort.mode, children: [
|
|
704
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: overlay.distort.d, stroke: accentColor }),
|
|
705
|
+
overlay.distort.corners.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: c.x - hs / 2, y: c.y - hs / 2, width: hs, height: hs, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, i))
|
|
589
706
|
] }),
|
|
590
|
-
overlay.envelope && /* @__PURE__ */ (0,
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
592
|
-
overlay.envelope.handles.map((h) => /* @__PURE__ */ (0,
|
|
593
|
-
/* @__PURE__ */ (0,
|
|
594
|
-
/* @__PURE__ */ (0,
|
|
707
|
+
overlay.envelope && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-envelope-mesh": overlay.envelope.nodeId, children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-envelope-grid": "", d: overlay.envelope.grid, stroke: accentColor, strokeOpacity: 0.8 }),
|
|
709
|
+
overlay.envelope.handles.map((h) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-envelope-handle": h.index, children: [
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: h.anchorX, y1: h.anchorY, x2: h.x, y2: h.y, stroke: accentColor, strokeOpacity: 0.6 }),
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: h.x, cy: h.y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius + (h.hovered || h.active ? 1 : 0), fill: h.active ? accentColor : import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor })
|
|
595
712
|
] }, h.index)),
|
|
596
713
|
overlay.envelope.anchors.map((a) => {
|
|
597
714
|
const size2 = as + (a.hovered || a.active ? 2 : 0);
|
|
598
|
-
return /* @__PURE__ */ (0,
|
|
715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { "data-vector-envelope-anchor": a.index, x: a.x - size2 / 2, y: a.y - size2 / 2, width: size2, height: size2, fill: a.active ? accentColor : import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, a.index);
|
|
599
716
|
})
|
|
600
717
|
] }),
|
|
601
|
-
overlay.handles.map((h) => /* @__PURE__ */ (0,
|
|
602
|
-
/* @__PURE__ */ (0,
|
|
603
|
-
/* @__PURE__ */ (0,
|
|
718
|
+
overlay.handles.map((h) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-handle": h.ref.handle, children: [
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: h.anchorX, y1: h.anchorY, x2: h.x, y2: h.y, stroke: accentColor }),
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: h.x, cy: h.y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius + (h.hovered ? 1 : 0), fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor })
|
|
604
721
|
] }, `${h.ref.nodeId}:${h.ref.subpath}:${h.ref.index}:${h.ref.handle}`)),
|
|
605
722
|
overlay.anchors.map((a) => {
|
|
606
723
|
const size2 = as + (a.hovered ? 2 : 0);
|
|
607
724
|
const fill = a.selected ? accentColor : import_vector3.VECTOR_OVERLAY_THEME.handleFill;
|
|
608
725
|
const key = `${a.ref.nodeId}:${a.ref.subpath}:${a.ref.index}`;
|
|
609
|
-
return a.type === "corner" ? /* @__PURE__ */ (0,
|
|
726
|
+
return a.type === "corner" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { "data-vector-anchor": a.ref.index, x: a.x - size2 / 2, y: a.y - size2 / 2, width: size2, height: size2, fill, stroke: accentColor }, key) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-anchor": a.ref.index, cx: a.x, cy: a.y, r: size2 / 2, fill, stroke: accentColor }, key);
|
|
610
727
|
}),
|
|
611
|
-
overlay.cornerWidgets.map((w) => /* @__PURE__ */ (0,
|
|
612
|
-
/* @__PURE__ */ (0,
|
|
613
|
-
/* @__PURE__ */ (0,
|
|
728
|
+
overlay.cornerWidgets.map((w) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-corner-widget": w.ref.index, "data-corner-kind": w.kind, children: [
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: w.x, cy: w.y, r: import_vector3.VECTOR_OVERLAY_THEME.cornerWidgetRadius + (w.hovered ? 1 : 0), fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }),
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: w.x, cy: w.y, r: 1.5, fill: accentColor })
|
|
614
731
|
] }, `corner:${w.ref.nodeId}:${w.ref.subpath}:${w.ref.index}`)),
|
|
615
|
-
overlay.masks.map((m) => /* @__PURE__ */ (0,
|
|
732
|
+
overlay.masks.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
616
733
|
"path",
|
|
617
734
|
{
|
|
618
735
|
"data-vector-mask-indicator": m.id,
|
|
@@ -627,15 +744,15 @@ function VectorCanvas({
|
|
|
627
744
|
},
|
|
628
745
|
`mask:${m.id}`
|
|
629
746
|
)),
|
|
630
|
-
overlay.blend.spines.map((sp) => /* @__PURE__ */ (0,
|
|
631
|
-
/* @__PURE__ */ (0,
|
|
632
|
-
sp.keys.map((k, i) => /* @__PURE__ */ (0,
|
|
747
|
+
overlay.blend.spines.map((sp) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-blend-spine": sp.id, "data-replaced": sp.replaced || void 0, children: [
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: sp.d, fill: "none", stroke: accentColor, strokeDasharray: "4 3" }),
|
|
749
|
+
sp.keys.map((k, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: k.x, cy: k.y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, i))
|
|
633
750
|
] }, `blend:${sp.id}`)),
|
|
634
|
-
overlay.blend.start && /* @__PURE__ */ (0,
|
|
635
|
-
/* @__PURE__ */ (0,
|
|
636
|
-
overlay.blend.start.anchor && /* @__PURE__ */ (0,
|
|
751
|
+
overlay.blend.start && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-blend-start": "", children: [
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: overlay.blend.start.d, fill: "none", stroke: accentColor, strokeWidth: 2 }),
|
|
753
|
+
overlay.blend.start.anchor && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: overlay.blend.start.anchor.x, cy: overlay.blend.start.anchor.y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius + 1, fill: accentColor })
|
|
637
754
|
] }),
|
|
638
|
-
overlay.blend.anchors.map((a, i) => /* @__PURE__ */ (0,
|
|
755
|
+
overlay.blend.anchors.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
639
756
|
"rect",
|
|
640
757
|
{
|
|
641
758
|
"data-vector-blend-anchor": i,
|
|
@@ -648,19 +765,19 @@ function VectorCanvas({
|
|
|
648
765
|
},
|
|
649
766
|
`blend-anchor:${i}`
|
|
650
767
|
)),
|
|
651
|
-
overlay.gradient && /* @__PURE__ */ (0,
|
|
652
|
-
overlay.widthSpot && /* @__PURE__ */ (0,
|
|
653
|
-
/* @__PURE__ */ (0,
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
768
|
+
overlay.gradient && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorGradientAnnotator, { annotator: overlay.gradient, accentColor }),
|
|
769
|
+
overlay.widthSpot && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-width-spot": "", children: [
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: overlay.widthSpot.left.x, y1: overlay.widthSpot.left.y, x2: overlay.widthSpot.right.x, y2: overlay.widthSpot.right.y, stroke: accentColor, strokeDasharray: "3 2" }),
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: (0, import_vector3.vectorDiamondPath)(overlay.widthSpot.x, overlay.widthSpot.y), fill: "none", stroke: accentColor })
|
|
655
772
|
] }),
|
|
656
|
-
overlay.widthPoints.map((w) => /* @__PURE__ */ (0,
|
|
657
|
-
/* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
["left", "right"].map((side) => /* @__PURE__ */ (0,
|
|
773
|
+
overlay.widthPoints.map((w) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-width-point": w.ref.index, "data-selected": w.selected || void 0, children: [
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: w.left.x, y1: w.left.y, x2: w.right.x, y2: w.right.y, stroke: accentColor }),
|
|
775
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: (0, import_vector3.vectorDiamondPath)(w.x, w.y), fill: w.selected || w.active ? accentColor : import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor, strokeWidth: w.hovered === "center" ? 2 : 1 }),
|
|
776
|
+
["left", "right"].map((side) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-width-side": side, cx: w[side].x, cy: w[side].y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius + (w.hovered === side ? 1 : 0), fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }, side))
|
|
660
777
|
] }, `width:${w.ref.nodeId}:${w.ref.subpath}:${w.ref.index}`)),
|
|
661
|
-
state.tool === "pen" && overlay.anchors.some((a) => a.closes && a.hovered) && /* @__PURE__ */ (0,
|
|
662
|
-
overlay.builder && /* @__PURE__ */ (0,
|
|
663
|
-
overlay.builder.faces.map((d, i) => /* @__PURE__ */ (0,
|
|
778
|
+
state.tool === "pen" && overlay.anchors.some((a) => a.closes && a.hovered) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: overlay.anchors.find((a) => a.closes).x, cy: overlay.anchors.find((a) => a.closes).y, r: as, stroke: accentColor }),
|
|
779
|
+
overlay.builder && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-builder": overlay.builder.mode, children: [
|
|
780
|
+
overlay.builder.faces.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
664
781
|
"path",
|
|
665
782
|
{
|
|
666
783
|
"data-vector-builder-face": "",
|
|
@@ -673,7 +790,7 @@ function VectorCanvas({
|
|
|
673
790
|
`f${i}`
|
|
674
791
|
)),
|
|
675
792
|
overlay.builder.hatches.map(
|
|
676
|
-
(d, i) => d ? /* @__PURE__ */ (0,
|
|
793
|
+
(d, i) => d ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
677
794
|
"path",
|
|
678
795
|
{
|
|
679
796
|
"data-vector-builder-hatch": "",
|
|
@@ -686,11 +803,11 @@ function VectorCanvas({
|
|
|
686
803
|
`h${i}`
|
|
687
804
|
) : null
|
|
688
805
|
),
|
|
689
|
-
overlay.builder.lines.map((d, i) => /* @__PURE__ */ (0,
|
|
690
|
-
overlay.builder.trail && /* @__PURE__ */ (0,
|
|
806
|
+
overlay.builder.lines.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-builder-line": "", d, fill: "none", stroke: import_vector3.VECTOR_OVERLAY_THEME.builderErase, strokeWidth: 3, strokeLinecap: "round" }, `l${i}`)),
|
|
807
|
+
overlay.builder.trail && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-builder-trail": "", d: overlay.builder.trail, fill: "none", stroke: overlay.builder.mode === "erase" ? import_vector3.VECTOR_OVERLAY_THEME.builderErase : accentColor, strokeWidth: 1 })
|
|
691
808
|
] }),
|
|
692
|
-
overlay.brush && /* @__PURE__ */ (0,
|
|
693
|
-
overlay.toolStroke && /* @__PURE__ */ (0,
|
|
809
|
+
overlay.brush && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-brush": "", cx: overlay.brush.x, cy: overlay.brush.y, r: overlay.brush.r, fill: "none", stroke: accentColor, strokeWidth: 1, strokeDasharray: "4 3", pointerEvents: "none" }),
|
|
810
|
+
overlay.toolStroke && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
694
811
|
"path",
|
|
695
812
|
{
|
|
696
813
|
"data-vector-tool-stroke": overlay.toolStroke.tool,
|
|
@@ -702,7 +819,7 @@ function VectorCanvas({
|
|
|
702
819
|
strokeDasharray: overlay.toolStroke.tool === "knife" ? "5 3" : void 0
|
|
703
820
|
}
|
|
704
821
|
),
|
|
705
|
-
overlay.pencilString && /* @__PURE__ */ (0,
|
|
822
|
+
overlay.pencilString && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
706
823
|
"line",
|
|
707
824
|
{
|
|
708
825
|
"data-vector-pencil-string": "",
|
|
@@ -714,32 +831,32 @@ function VectorCanvas({
|
|
|
714
831
|
strokeDasharray: "2 2"
|
|
715
832
|
}
|
|
716
833
|
),
|
|
717
|
-
overlay.cutPoint && /* @__PURE__ */ (0,
|
|
718
|
-
overlay.text && /* @__PURE__ */ (0,
|
|
719
|
-
/* @__PURE__ */ (0,
|
|
720
|
-
overlay.text.selection.map((d, i) => /* @__PURE__ */ (0,
|
|
721
|
-
overlay.text.caret && /* @__PURE__ */ (0,
|
|
722
|
-
overlay.text.overflow && /* @__PURE__ */ (0,
|
|
723
|
-
/* @__PURE__ */ (0,
|
|
724
|
-
/* @__PURE__ */ (0,
|
|
834
|
+
overlay.cutPoint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-cut-point": "", cx: overlay.cutPoint.x, cy: overlay.cutPoint.y, r: import_vector3.VECTOR_OVERLAY_THEME.handleRadius + 1, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }),
|
|
835
|
+
overlay.text && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-text-edit": overlay.text.nodeId, "data-editing": overlay.text.editing || void 0, children: [
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: overlay.text.frame, stroke: accentColor, strokeDasharray: overlay.text.editing ? "3 2" : void 0, opacity: 0.8 }),
|
|
837
|
+
overlay.text.selection.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-text-selection": "", d, fill: accentColor, fillOpacity: 0.25, stroke: "none" }, i)),
|
|
838
|
+
overlay.text.caret && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { "data-vector-text-caret": "", x1: overlay.text.caret.x1, y1: overlay.text.caret.y1, x2: overlay.text.caret.x2, y2: overlay.text.caret.y2, stroke: accentColor, strokeWidth: 1.5 }),
|
|
839
|
+
overlay.text.overflow && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-text-overflow": "", transform: `translate(${overlay.text.overflow.x} ${overlay.text.overflow.y})`, children: [
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: -5, y: -5, width: 10, height: 10, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: "#dc2626" }),
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M-3 0H3M0 -3V3", stroke: "#dc2626" })
|
|
725
842
|
] })
|
|
726
843
|
] }),
|
|
727
|
-
overlay.shading.map((sh) => /* @__PURE__ */ (0,
|
|
728
|
-
sh.lines.map((d, i) => /* @__PURE__ */ (0,
|
|
729
|
-
sh.points.map((p) => /* @__PURE__ */ (0,
|
|
844
|
+
overlay.shading.map((sh) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-shading": sh.kind, children: [
|
|
845
|
+
sh.lines.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d, stroke: accentColor, strokeWidth: 1, opacity: 0.7 }, i)),
|
|
846
|
+
sh.points.map((p) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-shading-point": p.index, "data-selected": p.selected || void 0, cx: p.x, cy: p.y, r: p.selected ? 6 : 4.5, fill: p.color, stroke: p.selected ? accentColor : "#ffffff", strokeWidth: p.selected ? 2 : 1.5 }, p.index))
|
|
730
847
|
] }, `shading:${sh.nodeId}`)),
|
|
731
|
-
overlay.perspective && /* @__PURE__ */ (0,
|
|
732
|
-
overlay.perspective.planes.map((pl) => /* @__PURE__ */ (0,
|
|
733
|
-
overlay.perspective.vanishingPoints.map((v, i) => /* @__PURE__ */ (0,
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
848
|
+
overlay.perspective && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-perspective-grid": "", fill: "none", pointerEvents: "none", children: [
|
|
849
|
+
overlay.perspective.planes.map((pl) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-perspective-plane": pl.plane, "data-active": pl.active || void 0, d: pl.d, stroke: pl.active ? accentColor : guideColor, strokeWidth: pl.active ? 1 : 0.75, opacity: pl.active ? 0.55 : 0.25 }, pl.plane)),
|
|
850
|
+
overlay.perspective.vanishingPoints.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-vanishing-point": i, cx: v.x, cy: v.y, r: 4, stroke: accentColor, strokeWidth: 1.5 }, i)),
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { "data-vector-perspective-origin": "", cx: overlay.perspective.origin.x, cy: overlay.perspective.origin.y, r: 3, fill: accentColor })
|
|
735
852
|
] }),
|
|
736
|
-
overlay.symmetry.map((sy) => /* @__PURE__ */ (0,
|
|
737
|
-
overlay.trackingPoints.map((t, i) => /* @__PURE__ */ (0,
|
|
738
|
-
overlay.typedEntry && /* @__PURE__ */ (0,
|
|
739
|
-
/* @__PURE__ */ (0,
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
853
|
+
overlay.symmetry.map((sy) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-symmetry-axes": sy.nodeId, stroke: accentColor, strokeDasharray: sy.drawing ? void 0 : "6 4", opacity: sy.drawing ? 0.9 : 0.6, children: sy.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: l.x1, y1: l.y1, x2: l.x2, y2: l.y2 }, i)) }, `sym:${sy.nodeId}`)),
|
|
854
|
+
overlay.trackingPoints.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { "data-vector-tracking-point": "", d: `M${t.x - 5} ${t.y}H${t.x + 5}M${t.x} ${t.y - 5}V${t.y + 5}`, stroke: guideColor, strokeWidth: 1.5 }, `track:${i}`)),
|
|
855
|
+
overlay.typedEntry && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-typed-entry": "", transform: `translate(${overlay.typedEntry.x + 14} ${overlay.typedEntry.y + 18})`, children: [
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: -3, y: -12, width: overlay.typedEntry.text.length * 7 + 8, height: 17, rx: 3, fill: import_vector3.VECTOR_OVERLAY_THEME.handleFill, stroke: accentColor }),
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("text", { x: 1, y: 1, fontSize: 11, fill: accentColor, style: { fontFamily: "ui-monospace, monospace" }, children: overlay.typedEntry.text })
|
|
741
858
|
] }),
|
|
742
|
-
overlay.connectorSites.map((s) => /* @__PURE__ */ (0,
|
|
859
|
+
overlay.connectorSites.map((s) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
743
860
|
"circle",
|
|
744
861
|
{
|
|
745
862
|
"data-vector-connection-site": s.side,
|
|
@@ -752,12 +869,12 @@ function VectorCanvas({
|
|
|
752
869
|
},
|
|
753
870
|
`site:${s.nodeId}:${s.side}`
|
|
754
871
|
)),
|
|
755
|
-
overlay.constraints.map((c) => /* @__PURE__ */ (0,
|
|
756
|
-
c.dimension && /* @__PURE__ */ (0,
|
|
757
|
-
/* @__PURE__ */ (0,
|
|
872
|
+
overlay.constraints.map((c) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { "data-vector-constraint-glyph": c.kind, "data-satisfied": c.satisfied ? "true" : "false", children: [
|
|
873
|
+
c.dimension && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: c.dimension.x1, y1: c.dimension.y1, x2: c.dimension.x2, y2: c.dimension.y2, stroke: c.satisfied ? import_vector3.VECTOR_OVERLAY_THEME.guide : "#dc2626", strokeDasharray: "2 2" }),
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("text", { x: c.x, y: c.y, fontSize: 10, textAnchor: "middle", fill: c.satisfied ? accentColor : "#dc2626", stroke: "#ffffff", strokeWidth: 3, paintOrder: "stroke", style: { fontFamily: "system-ui, sans-serif" }, children: c.label })
|
|
758
875
|
] }, `constraint:${c.id}`)),
|
|
759
|
-
overlay.textBox && /* @__PURE__ */ (0,
|
|
760
|
-
overlay.marquee && /* @__PURE__ */ (0,
|
|
876
|
+
overlay.textBox && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { "data-vector-text-box": "", x: overlay.textBox.x, y: overlay.textBox.y, width: overlay.textBox.width, height: overlay.textBox.height, stroke: accentColor, strokeDasharray: "3 2" }),
|
|
877
|
+
overlay.marquee && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
761
878
|
"rect",
|
|
762
879
|
{
|
|
763
880
|
"data-vector-marquee": "",
|
|
@@ -770,8 +887,8 @@ function VectorCanvas({
|
|
|
770
887
|
strokeDasharray: "3 2"
|
|
771
888
|
}
|
|
772
889
|
),
|
|
773
|
-
overlay.guides.lines.length > 0 && /* @__PURE__ */ (0,
|
|
774
|
-
overlay.guides.labels.map((l, i) => /* @__PURE__ */ (0,
|
|
890
|
+
overlay.guides.lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { "data-vector-guides": "", stroke: guideColor, children: overlay.guides.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { "data-vector-guide": l.kind, x1: l.x1, y1: l.y1, x2: l.x2, y2: l.y2, strokeDasharray: l.kind === "construction" ? "4 3" : void 0 }, i)) }),
|
|
891
|
+
overlay.guides.labels.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
775
892
|
"text",
|
|
776
893
|
{
|
|
777
894
|
"data-vector-guide-label": l.kind,
|
|
@@ -787,10 +904,10 @@ function VectorCanvas({
|
|
|
787
904
|
},
|
|
788
905
|
i
|
|
789
906
|
)),
|
|
790
|
-
overlay.status && /* @__PURE__ */ (0,
|
|
907
|
+
overlay.status && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("text", { "data-vector-status": "", x: 8, y: "100%", dy: -8, fontSize: 11, fill: accentColor, style: { fontFamily: "system-ui, sans-serif" }, children: overlay.status })
|
|
791
908
|
] }),
|
|
792
909
|
state.textEdit && overlay.text && // A hidden textarea at the caret takes typing and composed (IME) text.
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("foreignObject", { x: overlay.text.caret?.x1 ?? 0, y: overlay.text.caret?.y1 ?? 0, width: 1, height: 1, style: { overflow: "visible" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
794
911
|
"textarea",
|
|
795
912
|
{
|
|
796
913
|
ref: textRef,
|
|
@@ -845,7 +962,7 @@ function VectorCanvas({
|
|
|
845
962
|
}
|
|
846
963
|
) }),
|
|
847
964
|
state.symbolEdit && // Isolation mode: which symbol, and the way out (Escape with nothing selected works too).
|
|
848
|
-
/* @__PURE__ */ (0,
|
|
965
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("foreignObject", { "data-vector-symbol-edit": state.symbolEdit.symbolId, x: 8, y: 8, width: 320, height: 32, style: { overflow: "visible" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
849
966
|
"div",
|
|
850
967
|
{
|
|
851
968
|
style: { display: "inline-flex", alignItems: "center", gap: 8, padding: "4px 8px", borderRadius: 6, background: "rgba(15,23,42,0.85)", color: "#fff", font: "12px system-ui, sans-serif" },
|
|
@@ -853,28 +970,30 @@ function VectorCanvas({
|
|
|
853
970
|
onDoubleClick: (e) => e.stopPropagation(),
|
|
854
971
|
onKeyDown: (e) => e.stopPropagation(),
|
|
855
972
|
children: [
|
|
856
|
-
/* @__PURE__ */ (0,
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
857
974
|
"Symbol: ",
|
|
858
975
|
state.symbolEdit.name
|
|
859
976
|
] }),
|
|
860
|
-
/* @__PURE__ */ (0,
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", "aria-label": "Exit symbol", style: { border: "1px solid rgba(255,255,255,0.4)", borderRadius: 4, padding: "0 6px", background: "transparent", color: "#fff", cursor: "pointer" }, onClick: () => controller.exitSymbolEdit(), children: "Done" })
|
|
861
978
|
]
|
|
862
979
|
}
|
|
863
980
|
) }),
|
|
864
981
|
edit && editAt && // Width Point Edit (double-click with the width tool), beside the point.
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("foreignObject", { "data-vector-width-point-edit": "", x: editAt.x + 12, y: editAt.y + 12, width: 180, height: 140, style: { overflow: "visible" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(VectorWidthPointEditor, { controller, edit, accentColor }, `${edit.nodeId}:${edit.index}:${edit.t}`) }),
|
|
983
|
+
playing && // The agent's cursor (agent playback), over everything and never in the way.
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("foreignObject", { "data-vector-presence": "", x: 0, y: 0, width: "100%", height: "100%", pointerEvents: "none", style: { overflow: "visible", pointerEvents: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { position: "relative", width: "100%", height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PresenceLayer, { presence, viewport: state.viewport }) }) })
|
|
866
985
|
]
|
|
867
986
|
}
|
|
868
987
|
);
|
|
869
988
|
}
|
|
870
989
|
|
|
871
990
|
// src/vector/VectorToolbar.tsx
|
|
872
|
-
var
|
|
991
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
873
992
|
var import_vector20 = require("@pixerate/editor/vector");
|
|
874
993
|
|
|
875
994
|
// src/vector/VectorEffectsPanel.tsx
|
|
876
995
|
var import_vector4 = require("@pixerate/editor/vector");
|
|
877
|
-
var
|
|
996
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
878
997
|
var buttonClass = "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";
|
|
879
998
|
var numberClass = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
880
999
|
var selectClass = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -895,9 +1014,9 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
895
1014
|
const n = parseFloat(ev.target.value);
|
|
896
1015
|
if (Number.isFinite(n)) set(e, spec.key, n, true);
|
|
897
1016
|
};
|
|
898
|
-
return /* @__PURE__ */ (0,
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
900
|
-
spec.slider && /* @__PURE__ */ (0,
|
|
1017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-effect-param": spec.key, children: [
|
|
1018
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: labelClass, children: spec.label }),
|
|
1019
|
+
spec.slider && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
901
1020
|
"input",
|
|
902
1021
|
{
|
|
903
1022
|
type: "range",
|
|
@@ -913,7 +1032,7 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
913
1032
|
onBlur: end
|
|
914
1033
|
}
|
|
915
1034
|
),
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
917
1036
|
"input",
|
|
918
1037
|
{
|
|
919
1038
|
type: "number",
|
|
@@ -931,7 +1050,7 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
931
1050
|
};
|
|
932
1051
|
const vec2 = (e, spec) => {
|
|
933
1052
|
const v = e.params[spec.key] ?? { x: 0, y: 0 };
|
|
934
|
-
const field = (axis) => /* @__PURE__ */ (0,
|
|
1053
|
+
const field = (axis) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
935
1054
|
"input",
|
|
936
1055
|
{
|
|
937
1056
|
type: "number",
|
|
@@ -946,8 +1065,8 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
946
1065
|
onBlur: end
|
|
947
1066
|
}
|
|
948
1067
|
);
|
|
949
|
-
return /* @__PURE__ */ (0,
|
|
950
|
-
/* @__PURE__ */ (0,
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-effect-param": spec.key, children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: labelClass, children: spec.label }),
|
|
951
1070
|
field("x"),
|
|
952
1071
|
field("y")
|
|
953
1072
|
] }, spec.key);
|
|
@@ -956,28 +1075,28 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
956
1075
|
if (spec.kind === "number") return number(e, spec);
|
|
957
1076
|
if (spec.kind === "vec2") return vec2(e, spec);
|
|
958
1077
|
if (spec.kind === "boolean")
|
|
959
|
-
return /* @__PURE__ */ (0,
|
|
960
|
-
/* @__PURE__ */ (0,
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
1078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-effect-param": spec.key, children: [
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "min-w-0 flex-1 truncate", children: spec.label }),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", "aria-label": `${e.label} ${spec.label}`, checked: !!e.params[spec.key], onChange: (ev) => set(e, spec.key, ev.target.checked, false) })
|
|
962
1081
|
] }, spec.key);
|
|
963
1082
|
if (spec.kind === "color") {
|
|
964
1083
|
const c = e.params[spec.key];
|
|
965
|
-
return /* @__PURE__ */ (0,
|
|
966
|
-
/* @__PURE__ */ (0,
|
|
967
|
-
/* @__PURE__ */ (0,
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
1084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-effect-param": spec.key, children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: labelClass, children: spec.label }),
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", "aria-label": `${e.label} ${spec.label} on`, checked: c !== null, onChange: (ev) => set(e, spec.key, ev.target.checked ? "#ffffff" : null, false) }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", "aria-label": `${e.label} ${spec.label}`, className: "h-6 w-8 cursor-pointer rounded border border-border bg-background disabled:opacity-40", disabled: c === null, value: (0, import_vector4.vectorPaintToHex)(c ?? "#ffffff") ?? "#ffffff", onChange: (ev) => set(e, spec.key, ev.target.value, true), onBlur: end })
|
|
969
1088
|
] }, spec.key);
|
|
970
1089
|
}
|
|
971
1090
|
if (spec.kind !== "select") return null;
|
|
972
|
-
return /* @__PURE__ */ (0,
|
|
973
|
-
/* @__PURE__ */ (0,
|
|
974
|
-
/* @__PURE__ */ (0,
|
|
1091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-foreground", "data-vector-effect-param": spec.key, children: [
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: labelClass, children: spec.label }),
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("select", { "aria-label": `${e.label} ${spec.label}`, className: selectClass, value: String(e.params[spec.key] ?? ""), onChange: (ev) => set(e, spec.key, ev.target.value, false), children: spec.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: o.value, children: o.label }, o.value)) })
|
|
975
1094
|
] }, spec.key);
|
|
976
1095
|
};
|
|
977
|
-
return /* @__PURE__ */ (0,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
980
|
-
/* @__PURE__ */ (0,
|
|
1096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-effects": "", "aria-label": "Effects", children: [
|
|
1097
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Effects" }),
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
981
1100
|
"select",
|
|
982
1101
|
{
|
|
983
1102
|
"aria-label": "Add effect",
|
|
@@ -987,22 +1106,22 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
987
1106
|
if (ev.target.value) controller.addEffect(ev.target.value);
|
|
988
1107
|
},
|
|
989
1108
|
children: [
|
|
990
|
-
/* @__PURE__ */ (0,
|
|
991
|
-
import_vector4.VECTOR_EFFECT_MENU.map((m) => /* @__PURE__ */ (0,
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "Add effect\u2026" }),
|
|
1110
|
+
import_vector4.VECTOR_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: m.type, children: m.label }, m.type))
|
|
992
1111
|
]
|
|
993
1112
|
}
|
|
994
1113
|
),
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: buttonClass, title: "Expand Appearance", "aria-label": "Expand Appearance", disabled: !panel.expandable, onClick: () => controller.expandAppearance(), children: "Expand" })
|
|
996
1115
|
] }),
|
|
997
|
-
panel.count > 1 && /* @__PURE__ */ (0,
|
|
998
|
-
nodeId && panel.effects.map((e, i) => /* @__PURE__ */ (0,
|
|
999
|
-
/* @__PURE__ */ (0,
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1002
|
-
/* @__PURE__ */ (0,
|
|
1116
|
+
panel.count > 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select one object to edit its effects." }),
|
|
1117
|
+
nodeId && panel.effects.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1 rounded border border-border p-1.5", "data-vector-effect": e.id, "data-vector-effect-type": e.type, children: [
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex min-w-0 flex-1 items-center gap-1.5 text-xs font-medium text-foreground", children: [
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", "aria-label": `${e.label} on`, checked: e.enabled, onChange: (ev) => controller.updateEffect(nodeId, e.id, { enabled: ev.target.checked }) }),
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: e.label })
|
|
1003
1122
|
] }),
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1005
|
-
/* @__PURE__ */ (0,
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: buttonClass, title: "Move up", "aria-label": `Move ${e.label} up`, disabled: i === 0, onClick: () => controller.moveEffect(nodeId, e.id, i - 1), children: "\u2191" }),
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1006
1125
|
"button",
|
|
1007
1126
|
{
|
|
1008
1127
|
type: "button",
|
|
@@ -1014,7 +1133,7 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
1014
1133
|
children: "\u2193"
|
|
1015
1134
|
}
|
|
1016
1135
|
),
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: buttonClass, title: "Remove", "aria-label": `Remove ${e.label}`, onClick: () => controller.removeEffect(nodeId, e.id), children: "\xD7" })
|
|
1018
1137
|
] }),
|
|
1019
1138
|
e.specs.map((spec) => param(e, spec))
|
|
1020
1139
|
] }, e.id))
|
|
@@ -1023,7 +1142,7 @@ function VectorEffectsPanel({ controller, className }) {
|
|
|
1023
1142
|
|
|
1024
1143
|
// src/vector/VectorAppearancePanel.tsx
|
|
1025
1144
|
var import_vector5 = require("@pixerate/editor/vector");
|
|
1026
|
-
var
|
|
1145
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1027
1146
|
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";
|
|
1028
1147
|
var numberClass2 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
1029
1148
|
var selectClass2 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -1039,11 +1158,11 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1039
1158
|
const layerRow = (l, count) => {
|
|
1040
1159
|
const name = `${l.kind === "fill" ? "Fill" : "Stroke"} ${l.index + 1}`;
|
|
1041
1160
|
if (l.brushstroke)
|
|
1042
|
-
return /* @__PURE__ */ (0,
|
|
1043
|
-
/* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
/* @__PURE__ */ (0,
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-layer": `${l.kind}-${l.index}`, "data-vector-brushstroke": "", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1163
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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 }),
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children: (0, import_vector5.vectorBrushstrokeBrushes)().map((b) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: b.id, children: b.name }, b.id)) }),
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1047
1166
|
"input",
|
|
1048
1167
|
{
|
|
1049
1168
|
type: "number",
|
|
@@ -1060,8 +1179,8 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1060
1179
|
onBlur: end
|
|
1061
1180
|
}
|
|
1062
1181
|
),
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1182
|
+
/* @__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: [
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1065
1184
|
"input",
|
|
1066
1185
|
{
|
|
1067
1186
|
type: "checkbox",
|
|
@@ -1073,19 +1192,19 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1073
1192
|
),
|
|
1074
1193
|
"Grain"
|
|
1075
1194
|
] }),
|
|
1076
|
-
/* @__PURE__ */ (0,
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${name}`, onClick: () => controller.removePaintLayer("stroke", l.index, { ids }), children: "\xD7" })
|
|
1077
1196
|
] }) }, `${l.kind}-${l.index}`);
|
|
1078
1197
|
if (l.unknownKind)
|
|
1079
|
-
return /* @__PURE__ */ (0,
|
|
1198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-[11px] text-muted-foreground", "data-vector-layer": `${l.kind}-${l.index}`, children: [
|
|
1080
1199
|
name,
|
|
1081
1200
|
": ",
|
|
1082
1201
|
l.unknownKind,
|
|
1083
1202
|
" (not drawn by this version)"
|
|
1084
1203
|
] }, `${l.kind}-${l.index}`);
|
|
1085
|
-
return /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
l.gradient ? /* @__PURE__ */ (0,
|
|
1204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.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: [
|
|
1205
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1207
|
+
l.gradient ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1089
1208
|
"button",
|
|
1090
1209
|
{
|
|
1091
1210
|
type: "button",
|
|
@@ -1095,7 +1214,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1095
1214
|
style: { background: l.swatch },
|
|
1096
1215
|
onClick: () => controller.setGradientTarget(l.kind, l.index)
|
|
1097
1216
|
}
|
|
1098
|
-
) : /* @__PURE__ */ (0,
|
|
1217
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1099
1218
|
"input",
|
|
1100
1219
|
{
|
|
1101
1220
|
type: "color",
|
|
@@ -1106,7 +1225,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1106
1225
|
onBlur: end
|
|
1107
1226
|
}
|
|
1108
1227
|
),
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1110
1229
|
"input",
|
|
1111
1230
|
{
|
|
1112
1231
|
type: "number",
|
|
@@ -1124,10 +1243,10 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1124
1243
|
onBlur: end
|
|
1125
1244
|
}
|
|
1126
1245
|
),
|
|
1127
|
-
/* @__PURE__ */ (0,
|
|
1246
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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_runtime6.jsx)("option", { value: m.mode, children: m.label }, m.mode)) })
|
|
1128
1247
|
] }),
|
|
1129
|
-
l.kind === "stroke" && /* @__PURE__ */ (0,
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1248
|
+
l.kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1131
1250
|
"input",
|
|
1132
1251
|
{
|
|
1133
1252
|
type: "number",
|
|
@@ -1144,22 +1263,22 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1144
1263
|
onBlur: end
|
|
1145
1264
|
}
|
|
1146
1265
|
),
|
|
1147
|
-
/* @__PURE__ */ (0,
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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_runtime6.jsx)("option", { value: a, children: import_vector5.VECTOR_STROKE_ALIGN_LABELS[a] }, a)) })
|
|
1148
1267
|
] }),
|
|
1149
|
-
/* @__PURE__ */ (0,
|
|
1150
|
-
/* @__PURE__ */ (0,
|
|
1151
|
-
/* @__PURE__ */ (0,
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
1153
|
-
/* @__PURE__ */ (0,
|
|
1154
|
-
/* @__PURE__ */ (0,
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "flex-1" }),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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" }),
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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" }),
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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" }),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${name}`, onClick: () => controller.removePaintLayer(l.kind, l.index, { ids }), children: "\xD7" })
|
|
1155
1274
|
] })
|
|
1156
1275
|
] }, `${l.kind}-${l.index}`);
|
|
1157
1276
|
};
|
|
1158
|
-
const stack = (kind, layers, mixed) => /* @__PURE__ */ (0,
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1161
|
-
mixed && /* @__PURE__ */ (0,
|
|
1162
|
-
/* @__PURE__ */ (0,
|
|
1277
|
+
const stack = (kind, layers, mixed) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1", "data-vector-stack": kind, children: [
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1279
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `flex-1 ${headingClass}`, children: kind === "fill" ? "Fills" : "Strokes" }),
|
|
1280
|
+
mixed && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" }),
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1163
1282
|
"button",
|
|
1164
1283
|
{
|
|
1165
1284
|
type: "button",
|
|
@@ -1171,7 +1290,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1171
1290
|
children: "+"
|
|
1172
1291
|
}
|
|
1173
1292
|
),
|
|
1174
|
-
kind === "stroke" && /* @__PURE__ */ (0,
|
|
1293
|
+
kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: buttonClass2, title: "Add a brushstroke (a natural-media brush along the path)", "aria-label": "Add brushstroke", "data-vector-add-brushstroke": "", disabled: !ids.length, onClick: () => controller.addBrushstroke({ brushId: (0, import_vector5.vectorBrushstrokeBrushes)()[0].id, seed: (0, import_vector5.randomVectorBrushstrokeSeed)() }, { ids }), children: "\u270E+" })
|
|
1175
1294
|
] }),
|
|
1176
1295
|
[...layers].reverse().map((l) => layerRow(l, layers.length))
|
|
1177
1296
|
] });
|
|
@@ -1182,9 +1301,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1182
1301
|
const filterParam = (f, spec) => {
|
|
1183
1302
|
const label = `${f.label} ${spec.label}`;
|
|
1184
1303
|
if (spec.kind === "color")
|
|
1185
|
-
return /* @__PURE__ */ (0,
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-filter-param": spec.key, children: [
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w-14 truncate text-[11px] text-muted-foreground", children: spec.label }),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1188
1307
|
"input",
|
|
1189
1308
|
{
|
|
1190
1309
|
type: "color",
|
|
@@ -1202,9 +1321,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1202
1321
|
const n = parseFloat(e.target.value);
|
|
1203
1322
|
if (Number.isFinite(n)) setFilter(f, spec.key, n, true);
|
|
1204
1323
|
};
|
|
1205
|
-
return /* @__PURE__ */ (0,
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1207
|
-
spec.slider && /* @__PURE__ */ (0,
|
|
1324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.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: [
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: labelClass2, children: spec.label }),
|
|
1326
|
+
spec.slider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1208
1327
|
"input",
|
|
1209
1328
|
{
|
|
1210
1329
|
type: "range",
|
|
@@ -1220,21 +1339,21 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1220
1339
|
onBlur: end
|
|
1221
1340
|
}
|
|
1222
1341
|
),
|
|
1223
|
-
/* @__PURE__ */ (0,
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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 })
|
|
1224
1343
|
] }, spec.key);
|
|
1225
1344
|
};
|
|
1226
|
-
return /* @__PURE__ */ (0,
|
|
1345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-appearance": "", "aria-label": "Appearance", children: [
|
|
1227
1346
|
ids.length > 0 && stack("stroke", panel.strokes, panel.mixed.strokes),
|
|
1228
1347
|
ids.length > 0 && stack("fill", panel.fills, panel.mixed.fills),
|
|
1229
|
-
/* @__PURE__ */ (0,
|
|
1230
|
-
/* @__PURE__ */ (0,
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1232
|
-
panel.mixed.blendMode && /* @__PURE__ */ (0,
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "blendMode", children: [
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w-16", children: "Blend" }),
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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_runtime6.jsx)("option", { value: m.mode, children: m.label }, m.mode)) }),
|
|
1351
|
+
panel.mixed.blendMode && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
1233
1352
|
] }),
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1235
|
-
/* @__PURE__ */ (0,
|
|
1236
|
-
/* @__PURE__ */ (0,
|
|
1237
|
-
/* @__PURE__ */ (0,
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-2", "data-vector-filters": "", children: [
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `w-16 ${headingClass}`, children: "Filters" }),
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1238
1357
|
"select",
|
|
1239
1358
|
{
|
|
1240
1359
|
"aria-label": "Add filter",
|
|
@@ -1244,22 +1363,22 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1244
1363
|
if (e.target.value) controller.addFilter(e.target.value, { ids: panel.nodeIds });
|
|
1245
1364
|
},
|
|
1246
1365
|
children: [
|
|
1247
|
-
/* @__PURE__ */ (0,
|
|
1248
|
-
import_vector5.VECTOR_FILTER_MENU.map((m) => /* @__PURE__ */ (0,
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "Add filter\u2026" }),
|
|
1367
|
+
import_vector5.VECTOR_FILTER_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: m.type, children: m.label }, m.type))
|
|
1249
1368
|
]
|
|
1250
1369
|
}
|
|
1251
1370
|
)
|
|
1252
1371
|
] }),
|
|
1253
|
-
!filterNode && /* @__PURE__ */ (0,
|
|
1254
|
-
filterNode && panel.filters.map((f, i) => /* @__PURE__ */ (0,
|
|
1255
|
-
/* @__PURE__ */ (0,
|
|
1256
|
-
/* @__PURE__ */ (0,
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1372
|
+
!filterNode && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select one object to edit its filters." }),
|
|
1373
|
+
filterNode && panel.filters.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime6.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: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex min-w-0 flex-1 items-center gap-1.5 text-xs font-medium text-foreground", children: [
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": `${f.label} on`, checked: f.enabled, onChange: (e) => controller.updateFilter(filterNode, f.id, { enabled: e.target.checked }) }),
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate", children: f.label })
|
|
1259
1378
|
] }),
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1261
|
-
/* @__PURE__ */ (0,
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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" }),
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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" }),
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: buttonClass2, title: "Remove", "aria-label": `Remove ${f.label}`, onClick: () => controller.removeFilter(filterNode, f.id), children: "\xD7" })
|
|
1263
1382
|
] }),
|
|
1264
1383
|
f.specs.map((spec) => filterParam(f, spec))
|
|
1265
1384
|
] }, f.id))
|
|
@@ -1268,9 +1387,9 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1268
1387
|
}
|
|
1269
1388
|
|
|
1270
1389
|
// src/vector/VectorEnvelopePanel.tsx
|
|
1271
|
-
var
|
|
1390
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
1272
1391
|
var import_vector6 = require("@pixerate/editor/vector");
|
|
1273
|
-
var
|
|
1392
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1274
1393
|
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";
|
|
1275
1394
|
var numberClass3 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
1276
1395
|
var selectClass3 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -1283,7 +1402,7 @@ var SLIDERS = [
|
|
|
1283
1402
|
function VectorEnvelopePanel({ controller, className }) {
|
|
1284
1403
|
const state = useVectorEditorState(controller);
|
|
1285
1404
|
const panel = (0, import_vector6.getVectorEnvelopePanel)(state);
|
|
1286
|
-
const [size, setSize] =
|
|
1405
|
+
const [size, setSize] = import_react7.default.useState({ rows: 2, columns: 2 });
|
|
1287
1406
|
if (!panel) return null;
|
|
1288
1407
|
const env = panel.envelope;
|
|
1289
1408
|
const ids = panel.nodeId ? [panel.nodeId] : void 0;
|
|
@@ -1297,11 +1416,11 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1297
1416
|
if (env) set({ [key]: n });
|
|
1298
1417
|
else setSize({ ...size, [key]: n });
|
|
1299
1418
|
};
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1301
|
-
/* @__PURE__ */ (0,
|
|
1302
|
-
/* @__PURE__ */ (0,
|
|
1303
|
-
/* @__PURE__ */ (0,
|
|
1304
|
-
/* @__PURE__ */ (0,
|
|
1419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-envelope": "", "aria-label": "Envelope", children: [
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Envelope" }),
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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" }),
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1305
1424
|
"button",
|
|
1306
1425
|
{
|
|
1307
1426
|
type: "button",
|
|
@@ -1314,7 +1433,7 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1314
1433
|
children: "Mesh"
|
|
1315
1434
|
}
|
|
1316
1435
|
),
|
|
1317
|
-
/* @__PURE__ */ (0,
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1318
1437
|
"button",
|
|
1319
1438
|
{
|
|
1320
1439
|
type: "button",
|
|
@@ -1327,12 +1446,12 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1327
1446
|
children: "Top"
|
|
1328
1447
|
}
|
|
1329
1448
|
),
|
|
1330
|
-
/* @__PURE__ */ (0,
|
|
1331
|
-
/* @__PURE__ */ (0,
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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" }),
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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" })
|
|
1332
1451
|
] }),
|
|
1333
|
-
env && /* @__PURE__ */ (0,
|
|
1334
|
-
/* @__PURE__ */ (0,
|
|
1335
|
-
/* @__PURE__ */ (0,
|
|
1452
|
+
env && /* @__PURE__ */ (0, import_jsx_runtime7.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: [
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: labelClass3, children: "Warp" }),
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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_runtime7.jsx)("option", { value: o.value, children: o.label }, o.value)) })
|
|
1336
1455
|
] }),
|
|
1337
1456
|
env && env.params.style !== "mesh" && SLIDERS.map((s) => {
|
|
1338
1457
|
const value = env.params[s.key];
|
|
@@ -1340,9 +1459,9 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1340
1459
|
const n = parseFloat(ev.target.value);
|
|
1341
1460
|
if (Number.isFinite(n)) set({ [s.key]: n }, true);
|
|
1342
1461
|
};
|
|
1343
|
-
return /* @__PURE__ */ (0,
|
|
1344
|
-
/* @__PURE__ */ (0,
|
|
1345
|
-
/* @__PURE__ */ (0,
|
|
1462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.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: [
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: labelClass3, children: s.label }),
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1346
1465
|
"input",
|
|
1347
1466
|
{
|
|
1348
1467
|
type: "range",
|
|
@@ -1358,29 +1477,29 @@ function VectorEnvelopePanel({ controller, className }) {
|
|
|
1358
1477
|
onBlur: end
|
|
1359
1478
|
}
|
|
1360
1479
|
),
|
|
1361
|
-
/* @__PURE__ */ (0,
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "number", min: -100, max: 100, step: 1, "aria-label": `Envelope ${s.label}`, className: numberClass3, value, onChange, onBlur: end })
|
|
1362
1481
|
] }, s.key);
|
|
1363
1482
|
}),
|
|
1364
|
-
env && env.params.style !== "mesh" && /* @__PURE__ */ (0,
|
|
1365
|
-
/* @__PURE__ */ (0,
|
|
1366
|
-
/* @__PURE__ */ (0,
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1368
|
-
/* @__PURE__ */ (0,
|
|
1483
|
+
env && env.params.style !== "mesh" && /* @__PURE__ */ (0, import_jsx_runtime7.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: [
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: labelClass3, children: "Orientation" }),
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { "aria-label": "Envelope orientation", className: selectClass3, value: env.params.orientation, onChange: (e) => set({ orientation: e.target.value }), children: [
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "horizontal", children: "Horizontal" }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "vertical", children: "Vertical" })
|
|
1369
1488
|
] })
|
|
1370
1489
|
] }),
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1372
|
-
/* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-envelope-param": "mesh", children: [
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "min-w-0 flex-1 truncate text-[11px] text-muted-foreground", children: "Mesh rows \xD7 columns" }),
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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) }),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.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) })
|
|
1375
1494
|
] }),
|
|
1376
|
-
panel.count > 1 && !panel.canMakeWithTopObject && /* @__PURE__ */ (0,
|
|
1377
|
-
env && /* @__PURE__ */ (0,
|
|
1495
|
+
panel.count > 1 && !panel.canMakeWithTopObject && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select one object to edit its envelope." }),
|
|
1496
|
+
env && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Edit the mesh with the Envelope tool (U)." })
|
|
1378
1497
|
] });
|
|
1379
1498
|
}
|
|
1380
1499
|
|
|
1381
1500
|
// src/vector/VectorMaskPanel.tsx
|
|
1382
1501
|
var import_vector7 = require("@pixerate/editor/vector");
|
|
1383
|
-
var
|
|
1502
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1384
1503
|
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";
|
|
1385
1504
|
var selectClass4 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1386
1505
|
function VectorMaskPanel({ controller, className }) {
|
|
@@ -1389,10 +1508,10 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1389
1508
|
if (!panel) return null;
|
|
1390
1509
|
const g = panel.group;
|
|
1391
1510
|
const ids = g ? [g.id] : void 0;
|
|
1392
|
-
return /* @__PURE__ */ (0,
|
|
1393
|
-
/* @__PURE__ */ (0,
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-mask-panel": "", "aria-label": "Mask", children: [
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Mask" }),
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1396
1515
|
"button",
|
|
1397
1516
|
{
|
|
1398
1517
|
type: "button",
|
|
@@ -1405,7 +1524,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1405
1524
|
children: "Clip"
|
|
1406
1525
|
}
|
|
1407
1526
|
),
|
|
1408
|
-
/* @__PURE__ */ (0,
|
|
1527
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1409
1528
|
"button",
|
|
1410
1529
|
{
|
|
1411
1530
|
type: "button",
|
|
@@ -1418,7 +1537,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1418
1537
|
children: "Opacity"
|
|
1419
1538
|
}
|
|
1420
1539
|
),
|
|
1421
|
-
/* @__PURE__ */ (0,
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1422
1541
|
"button",
|
|
1423
1542
|
{
|
|
1424
1543
|
type: "button",
|
|
@@ -1432,9 +1551,9 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1432
1551
|
}
|
|
1433
1552
|
)
|
|
1434
1553
|
] }),
|
|
1435
|
-
g && /* @__PURE__ */ (0,
|
|
1436
|
-
/* @__PURE__ */ (0,
|
|
1437
|
-
/* @__PURE__ */ (0,
|
|
1554
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", "data-vector-mask-group": g.id, "data-mask-type": g.type, children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1556
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1438
1557
|
"select",
|
|
1439
1558
|
{
|
|
1440
1559
|
"aria-label": "Mask type",
|
|
@@ -1442,16 +1561,16 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1442
1561
|
value: g.type,
|
|
1443
1562
|
title: import_vector7.VECTOR_MASK_TYPE_OPTIONS.find((o) => o.value === g.type)?.title,
|
|
1444
1563
|
onChange: (e) => controller.setMaskOptions({ type: e.target.value }, { ids }),
|
|
1445
|
-
children: import_vector7.VECTOR_MASK_TYPE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
1564
|
+
children: import_vector7.VECTOR_MASK_TYPE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, title: o.title, children: o.label }, o.value))
|
|
1446
1565
|
}
|
|
1447
1566
|
),
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Show the contents where the mask hides them", children: [
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": "Invert mask", checked: g.invert, onChange: (e) => controller.setMaskOptions({ invert: e.target.checked }, { ids }) }),
|
|
1450
1569
|
"Invert"
|
|
1451
1570
|
] })
|
|
1452
1571
|
] }),
|
|
1453
|
-
/* @__PURE__ */ (0,
|
|
1454
|
-
/* @__PURE__ */ (0,
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1455
1574
|
"button",
|
|
1456
1575
|
{
|
|
1457
1576
|
type: "button",
|
|
@@ -1464,7 +1583,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1464
1583
|
children: "Edit mask"
|
|
1465
1584
|
}
|
|
1466
1585
|
),
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1468
1587
|
"button",
|
|
1469
1588
|
{
|
|
1470
1589
|
type: "button",
|
|
@@ -1478,7 +1597,7 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1478
1597
|
children: "Contents"
|
|
1479
1598
|
}
|
|
1480
1599
|
),
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1482
1601
|
"button",
|
|
1483
1602
|
{
|
|
1484
1603
|
type: "button",
|
|
@@ -1497,9 +1616,9 @@ function VectorMaskPanel({ controller, className }) {
|
|
|
1497
1616
|
}
|
|
1498
1617
|
|
|
1499
1618
|
// src/vector/VectorTextPanel.tsx
|
|
1500
|
-
var
|
|
1619
|
+
var import_react8 = require("react");
|
|
1501
1620
|
var import_vector8 = require("@pixerate/editor/vector");
|
|
1502
|
-
var
|
|
1621
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1503
1622
|
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";
|
|
1504
1623
|
var inputClass = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1505
1624
|
var labelClass4 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
@@ -1509,19 +1628,19 @@ var num = (v) => {
|
|
|
1509
1628
|
};
|
|
1510
1629
|
function VectorTextPanel({ controller, className }) {
|
|
1511
1630
|
const state = useVectorEditorState(controller);
|
|
1512
|
-
const listId = `vector-fonts-${(0,
|
|
1631
|
+
const listId = `vector-fonts-${(0, import_react8.useId)().replace(/:/g, "")}`;
|
|
1513
1632
|
const panel = (0, import_vector8.getVectorTextPanel)(state);
|
|
1514
1633
|
if (!panel) return null;
|
|
1515
1634
|
const f = panel.font;
|
|
1516
1635
|
const style = (patch, merge) => (0, import_vector8.applyVectorTextStyle)(controller, patch, merge ? { merge } : {});
|
|
1517
1636
|
const where = panel.target === "range" ? "Selected characters" : panel.target === "nodes" ? "Selected text" : "New text";
|
|
1518
|
-
return /* @__PURE__ */ (0,
|
|
1519
|
-
/* @__PURE__ */ (0,
|
|
1520
|
-
/* @__PURE__ */ (0,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-text-panel": panel.target, "aria-label": "Text", children: [
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: labelClass4, children: "Text" }),
|
|
1640
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[11px] text-muted-foreground", children: where })
|
|
1522
1641
|
] }),
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1524
|
-
/* @__PURE__ */ (0,
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1525
1644
|
"input",
|
|
1526
1645
|
{
|
|
1527
1646
|
"aria-label": "Font family",
|
|
@@ -1539,15 +1658,15 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1539
1658
|
},
|
|
1540
1659
|
`family:${f.fontFamily}`
|
|
1541
1660
|
),
|
|
1542
|
-
/* @__PURE__ */ (0,
|
|
1661
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("datalist", { id: listId, children: panel.families.map((fam) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: fam }, fam)) })
|
|
1543
1662
|
] }),
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1545
|
-
/* @__PURE__ */ (0,
|
|
1546
|
-
f.fontWeight === null && /* @__PURE__ */ (0,
|
|
1547
|
-
import_vector8.VECTOR_FONT_WEIGHTS.map((w) => /* @__PURE__ */ (0,
|
|
1548
|
-
f.fontWeight !== null && !import_vector8.VECTOR_FONT_WEIGHTS.some((w) => w.value === f.fontWeight) && /* @__PURE__ */ (0,
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { "aria-label": "Font weight", className: inputClass, value: f.fontWeight ?? "", onChange: (e) => style({ fontWeight: Number(e.target.value) }), children: [
|
|
1665
|
+
f.fontWeight === null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "Mixed" }),
|
|
1666
|
+
import_vector8.VECTOR_FONT_WEIGHTS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: w.value, children: w.label }, w.value)),
|
|
1667
|
+
f.fontWeight !== null && !import_vector8.VECTOR_FONT_WEIGHTS.some((w) => w.value === f.fontWeight) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: f.fontWeight, children: f.fontWeight })
|
|
1549
1668
|
] }),
|
|
1550
|
-
/* @__PURE__ */ (0,
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1551
1670
|
"input",
|
|
1552
1671
|
{
|
|
1553
1672
|
type: "number",
|
|
@@ -1566,16 +1685,16 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1566
1685
|
}
|
|
1567
1686
|
)
|
|
1568
1687
|
] }),
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1570
|
-
/* @__PURE__ */ (0,
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("b", { children: "B" }) }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Italic", "aria-pressed": f.italic === true, onClick: () => style({ italic: !f.italic }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", { children: "I" }) }),
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Underline", "aria-pressed": f.underline === true, onClick: () => style({ underline: !f.underline }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("u", { children: "U" }) }),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("s", { children: "S" }) })
|
|
1574
1693
|
] }),
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1576
|
-
/* @__PURE__ */ (0,
|
|
1577
|
-
/* @__PURE__ */ (0,
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Tracking (1/1000 em)", children: [
|
|
1696
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "VA" }),
|
|
1697
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1579
1698
|
"input",
|
|
1580
1699
|
{
|
|
1581
1700
|
type: "number",
|
|
@@ -1589,9 +1708,9 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1589
1708
|
}
|
|
1590
1709
|
)
|
|
1591
1710
|
] }),
|
|
1592
|
-
/* @__PURE__ */ (0,
|
|
1593
|
-
/* @__PURE__ */ (0,
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1711
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Leading (empty: auto)", children: [
|
|
1712
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "\u2195" }),
|
|
1713
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1595
1714
|
"input",
|
|
1596
1715
|
{
|
|
1597
1716
|
type: "number",
|
|
@@ -1607,7 +1726,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1607
1726
|
)
|
|
1608
1727
|
] })
|
|
1609
1728
|
] }),
|
|
1610
|
-
/* @__PURE__ */ (0,
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)(
|
|
1611
1730
|
"button",
|
|
1612
1731
|
{
|
|
1613
1732
|
type: "button",
|
|
@@ -1619,8 +1738,8 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1619
1738
|
},
|
|
1620
1739
|
o.value
|
|
1621
1740
|
)) }),
|
|
1622
|
-
panel.target !== "defaults" && panel.ids.length === 1 && /* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1741
|
+
panel.target !== "defaults" && panel.ids.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1624
1743
|
"button",
|
|
1625
1744
|
{
|
|
1626
1745
|
type: "button",
|
|
@@ -1631,7 +1750,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1631
1750
|
children: "Point"
|
|
1632
1751
|
}
|
|
1633
1752
|
),
|
|
1634
|
-
/* @__PURE__ */ (0,
|
|
1753
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1635
1754
|
"button",
|
|
1636
1755
|
{
|
|
1637
1756
|
type: "button",
|
|
@@ -1643,8 +1762,8 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1643
1762
|
}
|
|
1644
1763
|
)
|
|
1645
1764
|
] }),
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1648
1767
|
"button",
|
|
1649
1768
|
{
|
|
1650
1769
|
type: "button",
|
|
@@ -1659,7 +1778,7 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1659
1778
|
children: "Type on path"
|
|
1660
1779
|
}
|
|
1661
1780
|
),
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1663
1782
|
"button",
|
|
1664
1783
|
{
|
|
1665
1784
|
type: "button",
|
|
@@ -1676,56 +1795,56 @@ function VectorTextPanel({ controller, className }) {
|
|
|
1676
1795
|
}
|
|
1677
1796
|
|
|
1678
1797
|
// src/vector/VectorSymbolsPanel.tsx
|
|
1679
|
-
var
|
|
1798
|
+
var import_react9 = require("react");
|
|
1680
1799
|
var import_vector9 = require("@pixerate/editor/vector");
|
|
1681
|
-
var
|
|
1800
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1682
1801
|
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";
|
|
1683
1802
|
var selectClass5 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1684
1803
|
var labelClass5 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1685
1804
|
function VectorSymbolsPanel({ controller, className }) {
|
|
1686
1805
|
const state = useVectorEditorState(controller);
|
|
1687
|
-
const uid = (0,
|
|
1806
|
+
const uid = (0, import_react9.useId)().replace(/:/g, "");
|
|
1688
1807
|
const panel = (0, import_vector9.getVectorSymbolsPanel)(state, { idPrefix: `vsym${uid}-` });
|
|
1689
|
-
const [error, setError] = (0,
|
|
1808
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
1690
1809
|
const report = (r) => setError(r.ok ? null : r.message ?? null);
|
|
1691
1810
|
const inst = panel.instance;
|
|
1692
|
-
return /* @__PURE__ */ (0,
|
|
1693
|
-
/* @__PURE__ */ (0,
|
|
1694
|
-
/* @__PURE__ */ (0,
|
|
1695
|
-
/* @__PURE__ */ (0,
|
|
1696
|
-
panel.editing && /* @__PURE__ */ (0,
|
|
1811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-symbols-panel": "", "aria-label": "Symbols", children: [
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: labelClass5, children: "Symbols" }),
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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" }),
|
|
1815
|
+
panel.editing && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass6, "data-vector-symbol-action": "exit", title: "Leave the symbol (Escape)", onClick: () => controller.exitSymbolEdit(), children: "Done" })
|
|
1697
1816
|
] }),
|
|
1698
|
-
panel.symbols.length > 0 && /* @__PURE__ */ (0,
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1700
|
-
/* @__PURE__ */ (0,
|
|
1701
|
-
/* @__PURE__ */ (0,
|
|
1702
|
-
/* @__PURE__ */ (0,
|
|
1817
|
+
panel.symbols.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "space-y-1", children: panel.symbols.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { "data-vector-symbol": s.id, "data-editing": s.editing || void 0, className: "flex items-center gap-1", children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: s.viewBox, width: 28, height: 28, className: "shrink-0 rounded border border-border bg-background", "aria-hidden": "true", children: [
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(VectorGradientDefs, { defs: s.scene.defs }),
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(VectorFilterDefs, { filters: s.scene.filters }),
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(VectorSceneNodes, { nodes: s.scene.nodes })
|
|
1703
1822
|
] }),
|
|
1704
|
-
/* @__PURE__ */ (0,
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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: [
|
|
1705
1824
|
s.name,
|
|
1706
1825
|
" ",
|
|
1707
|
-
/* @__PURE__ */ (0,
|
|
1826
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
1708
1827
|
"\xB7 ",
|
|
1709
1828
|
s.instances
|
|
1710
1829
|
] })
|
|
1711
1830
|
] }),
|
|
1712
|
-
/* @__PURE__ */ (0,
|
|
1713
|
-
/* @__PURE__ */ (0,
|
|
1714
|
-
/* @__PURE__ */ (0,
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass6, "aria-label": `Place ${s.name}`, title: "Place an instance", onClick: () => report(controller.placeSymbol(s.id)), children: "+" }),
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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" }),
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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" })
|
|
1715
1834
|
] }, s.id)) }),
|
|
1716
|
-
inst && /* @__PURE__ */ (0,
|
|
1717
|
-
/* @__PURE__ */ (0,
|
|
1718
|
-
/* @__PURE__ */ (0,
|
|
1719
|
-
/* @__PURE__ */ (0,
|
|
1835
|
+
inst && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1", "data-vector-instance": inst.id, children: [
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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_runtime10.jsx)("option", { value: s.id, children: s.name }, s.id)) }),
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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" })
|
|
1720
1839
|
] }),
|
|
1721
|
-
/* @__PURE__ */ (0,
|
|
1722
|
-
/* @__PURE__ */ (0,
|
|
1723
|
-
/* @__PURE__ */ (0,
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", "aria-label": "Scale strokes", checked: inst.scaleStrokes, onChange: (e) => report(controller.setInstanceOptions({ scaleStrokes: e.target.checked }, { ids: [inst.id] })) }),
|
|
1724
1843
|
"Scale strokes"
|
|
1725
1844
|
] }),
|
|
1726
|
-
/* @__PURE__ */ (0,
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Paint every fill of the art in this instance", children: [
|
|
1727
1846
|
"Tint",
|
|
1728
|
-
/* @__PURE__ */ (0,
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1729
1848
|
"input",
|
|
1730
1849
|
{
|
|
1731
1850
|
type: "color",
|
|
@@ -1736,41 +1855,41 @@ function VectorSymbolsPanel({ controller, className }) {
|
|
|
1736
1855
|
}
|
|
1737
1856
|
)
|
|
1738
1857
|
] }),
|
|
1739
|
-
inst.fill !== null && /* @__PURE__ */ (0,
|
|
1858
|
+
inst.fill !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: buttonClass6, "aria-label": "Clear tint", onClick: () => report(controller.setInstanceOptions({ fill: null }, { ids: [inst.id] })), children: "\xD7" })
|
|
1740
1859
|
] })
|
|
1741
1860
|
] }),
|
|
1742
|
-
error && /* @__PURE__ */ (0,
|
|
1861
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-destructive", children: error })
|
|
1743
1862
|
] });
|
|
1744
1863
|
}
|
|
1745
1864
|
|
|
1746
1865
|
// src/vector/VectorConstraintsPanel.tsx
|
|
1747
|
-
var
|
|
1866
|
+
var import_react10 = require("react");
|
|
1748
1867
|
var import_vector10 = require("@pixerate/editor/vector");
|
|
1749
|
-
var
|
|
1868
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1750
1869
|
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";
|
|
1751
1870
|
var inputClass2 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1752
1871
|
var labelClass6 = "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground";
|
|
1753
1872
|
function VectorConstraintsPanel({ controller, className }) {
|
|
1754
1873
|
const state = useVectorEditorState(controller);
|
|
1755
1874
|
const panel = (0, import_vector10.getVectorConstraintPanel)(state);
|
|
1756
|
-
const [error, setError] = (0,
|
|
1757
|
-
const [param, setParam] = (0,
|
|
1875
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
1876
|
+
const [param, setParam] = (0, import_react10.useState)({ name: "", value: "" });
|
|
1758
1877
|
const report = (r) => setError(r.ok ? null : r.message ?? null);
|
|
1759
1878
|
const add = (a) => report(controller.addConstraint({ kind: a.kind, refs: a.refs }));
|
|
1760
1879
|
if (!panel.actions.length && !panel.constraints.length && !state.document.constraints?.length && state.tool !== "direct") return null;
|
|
1761
|
-
return /* @__PURE__ */ (0,
|
|
1762
|
-
/* @__PURE__ */ (0,
|
|
1763
|
-
/* @__PURE__ */ (0,
|
|
1764
|
-
/* @__PURE__ */ (0,
|
|
1765
|
-
/* @__PURE__ */ (0,
|
|
1880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-constraints-panel": "", "data-dof-status": panel.dof.status, "aria-label": "Constraints", children: [
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: labelClass6, children: "Constraints" }),
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex-1 truncate text-[11px] text-muted-foreground", "data-vector-dof": "", children: panel.dof.message }),
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: buttonClass7, title: "Auto Constrain: add what the selection (or the drawing) nearly satisfies", onClick: () => report(controller.autoConstrain()), children: "Auto" })
|
|
1766
1885
|
] }),
|
|
1767
|
-
panel.actions.length > 0 && /* @__PURE__ */ (0,
|
|
1768
|
-
panel.constraints.length > 0 && /* @__PURE__ */ (0,
|
|
1769
|
-
/* @__PURE__ */ (0,
|
|
1886
|
+
panel.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Add constraint", children: panel.actions.map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: buttonClass7, "data-vector-constraint-action": a.kind, title: `Add ${a.label}`, onClick: () => add(a), children: a.label }, a.kind)) }),
|
|
1887
|
+
panel.constraints.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "space-y-1", children: panel.constraints.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.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: [
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: `min-w-0 flex-1 truncate ${c.conflict || !c.satisfied ? "text-destructive" : ""}`, children: [
|
|
1770
1889
|
c.label,
|
|
1771
1890
|
c.name ? ` ${c.name}` : ""
|
|
1772
1891
|
] }),
|
|
1773
|
-
c.value !== void 0 && /* @__PURE__ */ (0,
|
|
1892
|
+
c.value !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1774
1893
|
"input",
|
|
1775
1894
|
{
|
|
1776
1895
|
"aria-label": `Value of ${c.name ?? c.id}`,
|
|
@@ -1785,12 +1904,12 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1785
1904
|
},
|
|
1786
1905
|
`${c.id}:${c.value}`
|
|
1787
1906
|
),
|
|
1788
|
-
/* @__PURE__ */ (0,
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: buttonClass7, "aria-label": `Remove ${c.label} constraint`, onClick: () => report(controller.removeConstraints([c.id])), children: "\xD7" })
|
|
1789
1908
|
] }, c.id)) }),
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
1791
|
-
panel.parameters.map((p) => /* @__PURE__ */ (0,
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1", "aria-label": "Parameters", children: [
|
|
1910
|
+
panel.parameters.map((p) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-12 truncate font-mono", children: p.name }),
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1794
1913
|
"input",
|
|
1795
1914
|
{
|
|
1796
1915
|
"aria-label": `Parameter ${p.name}`,
|
|
@@ -1805,9 +1924,9 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1805
1924
|
},
|
|
1806
1925
|
`${p.name}:${p.value}`
|
|
1807
1926
|
),
|
|
1808
|
-
/* @__PURE__ */ (0,
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-10 text-right text-muted-foreground", children: p.result === null ? "!" : Math.round(p.result * 100) / 100 })
|
|
1809
1928
|
] }, p.name)),
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1811
1930
|
"form",
|
|
1812
1931
|
{
|
|
1813
1932
|
className: "flex items-center gap-1",
|
|
@@ -1819,20 +1938,20 @@ function VectorConstraintsPanel({ controller, className }) {
|
|
|
1819
1938
|
if (r.ok) setParam({ name: "", value: "" });
|
|
1820
1939
|
},
|
|
1821
1940
|
children: [
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.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 }) }),
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { "aria-label": "New parameter value", placeholder: "value", className: inputClass2, value: param.value, onChange: (e) => setParam({ ...param, value: e.target.value }) }),
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", className: buttonClass7, "aria-label": "Add parameter", children: "+" })
|
|
1825
1944
|
]
|
|
1826
1945
|
}
|
|
1827
1946
|
)
|
|
1828
1947
|
] }),
|
|
1829
|
-
error && /* @__PURE__ */ (0,
|
|
1948
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-destructive", children: error })
|
|
1830
1949
|
] });
|
|
1831
1950
|
}
|
|
1832
1951
|
|
|
1833
1952
|
// src/vector/VectorFramePanel.tsx
|
|
1834
1953
|
var import_vector11 = require("@pixerate/editor/vector");
|
|
1835
|
-
var
|
|
1954
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1836
1955
|
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";
|
|
1837
1956
|
var selectClass6 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1838
1957
|
var numberClass4 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -1842,9 +1961,9 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1842
1961
|
const f = panel.frame;
|
|
1843
1962
|
const ids = f ? [f.id] : void 0;
|
|
1844
1963
|
const fillHex = f ? (0, import_vector11.vectorPaintToHex)(f.frame.fill ?? null) : null;
|
|
1845
|
-
const number = (key, label) => /* @__PURE__ */ (0,
|
|
1846
|
-
/* @__PURE__ */ (0,
|
|
1847
|
-
/* @__PURE__ */ (0,
|
|
1964
|
+
const number = (key, label) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-4 text-muted-foreground", children: label }),
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1848
1967
|
"input",
|
|
1849
1968
|
{
|
|
1850
1969
|
type: "number",
|
|
@@ -1864,10 +1983,10 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1864
1983
|
`${f.id}:${f.frame[key]}`
|
|
1865
1984
|
)
|
|
1866
1985
|
] });
|
|
1867
|
-
return /* @__PURE__ */ (0,
|
|
1868
|
-
/* @__PURE__ */ (0,
|
|
1869
|
-
/* @__PURE__ */ (0,
|
|
1870
|
-
/* @__PURE__ */ (0,
|
|
1986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-frame-panel": "", "aria-label": "Frame", children: [
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Frame" }),
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1871
1990
|
"button",
|
|
1872
1991
|
{
|
|
1873
1992
|
type: "button",
|
|
@@ -1881,16 +2000,16 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1881
2000
|
}
|
|
1882
2001
|
)
|
|
1883
2002
|
] }),
|
|
1884
|
-
f && /* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
2003
|
+
f && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-2", "data-vector-frame": f.id, children: [
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-2 gap-1", children: [
|
|
1886
2005
|
number("x", "X"),
|
|
1887
2006
|
number("y", "Y"),
|
|
1888
2007
|
number("width", "W"),
|
|
1889
2008
|
number("height", "H")
|
|
1890
2009
|
] }),
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1893
|
-
/* @__PURE__ */ (0,
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex w-16 items-center gap-1.5 text-xs text-foreground", children: [
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1894
2013
|
"input",
|
|
1895
2014
|
{
|
|
1896
2015
|
type: "checkbox",
|
|
@@ -1901,7 +2020,7 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1901
2020
|
),
|
|
1902
2021
|
"Fill"
|
|
1903
2022
|
] }),
|
|
1904
|
-
/* @__PURE__ */ (0,
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1905
2024
|
"input",
|
|
1906
2025
|
{
|
|
1907
2026
|
type: "color",
|
|
@@ -1912,16 +2031,16 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1912
2031
|
onChange: (e) => controller.setFrame({ fill: e.target.value }, { ids, merge: "frame-fill" })
|
|
1913
2032
|
}
|
|
1914
2033
|
),
|
|
1915
|
-
/* @__PURE__ */ (0,
|
|
1916
|
-
/* @__PURE__ */ (0,
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Hide what lies outside the frame", children: [
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "checkbox", "aria-label": "Clip content", checked: f.frame.clip !== false, onChange: (e) => controller.setFrame({ clip: e.target.checked }, { ids }) }),
|
|
1917
2036
|
"Clip"
|
|
1918
2037
|
] })
|
|
1919
2038
|
] })
|
|
1920
2039
|
] }),
|
|
1921
|
-
panel.resizing && /* @__PURE__ */ (0,
|
|
1922
|
-
/* @__PURE__ */ (0,
|
|
1923
|
-
/* @__PURE__ */ (0,
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
2040
|
+
panel.resizing && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-vector-resizing": "", children: [
|
|
2041
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2042
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16", children: "Horizontal" }),
|
|
2043
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1925
2044
|
"select",
|
|
1926
2045
|
{
|
|
1927
2046
|
"aria-label": "Horizontal constraint",
|
|
@@ -1929,15 +2048,15 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1929
2048
|
value: panel.resizing.horizontal,
|
|
1930
2049
|
onChange: (e) => controller.setResizing({ horizontal: e.target.value }, { ids: panel.resizing.ids }),
|
|
1931
2050
|
children: [
|
|
1932
|
-
panel.resizing.horizontal === "mixed" && /* @__PURE__ */ (0,
|
|
1933
|
-
import_vector11.VECTOR_HORIZONTAL_RESIZING.map((h) => /* @__PURE__ */ (0,
|
|
2051
|
+
panel.resizing.horizontal === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "mixed", disabled: true, children: "Mixed" }),
|
|
2052
|
+
import_vector11.VECTOR_HORIZONTAL_RESIZING.map((h) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: h, children: import_vector11.VECTOR_HORIZONTAL_RESIZING_LABELS[h] }, h))
|
|
1934
2053
|
]
|
|
1935
2054
|
}
|
|
1936
2055
|
)
|
|
1937
2056
|
] }),
|
|
1938
|
-
/* @__PURE__ */ (0,
|
|
1939
|
-
/* @__PURE__ */ (0,
|
|
1940
|
-
/* @__PURE__ */ (0,
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16", children: "Vertical" }),
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1941
2060
|
"select",
|
|
1942
2061
|
{
|
|
1943
2062
|
"aria-label": "Vertical constraint",
|
|
@@ -1945,8 +2064,8 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1945
2064
|
value: panel.resizing.vertical,
|
|
1946
2065
|
onChange: (e) => controller.setResizing({ vertical: e.target.value }, { ids: panel.resizing.ids }),
|
|
1947
2066
|
children: [
|
|
1948
|
-
panel.resizing.vertical === "mixed" && /* @__PURE__ */ (0,
|
|
1949
|
-
import_vector11.VECTOR_VERTICAL_RESIZING.map((v) => /* @__PURE__ */ (0,
|
|
2067
|
+
panel.resizing.vertical === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "mixed", disabled: true, children: "Mixed" }),
|
|
2068
|
+
import_vector11.VECTOR_VERTICAL_RESIZING.map((v) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: v, children: import_vector11.VECTOR_VERTICAL_RESIZING_LABELS[v] }, v))
|
|
1950
2069
|
]
|
|
1951
2070
|
}
|
|
1952
2071
|
)
|
|
@@ -1957,7 +2076,7 @@ function VectorFramePanel({ controller, className }) {
|
|
|
1957
2076
|
|
|
1958
2077
|
// src/vector/VectorPagesPanel.tsx
|
|
1959
2078
|
var import_vector12 = require("@pixerate/editor/vector");
|
|
1960
|
-
var
|
|
2079
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1961
2080
|
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";
|
|
1962
2081
|
var selectClass7 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1963
2082
|
function VectorPagesPanel({ controller, className }) {
|
|
@@ -1966,19 +2085,19 @@ function VectorPagesPanel({ controller, className }) {
|
|
|
1966
2085
|
const masters = (0, import_vector12.vectorMasterPages)(state.document);
|
|
1967
2086
|
const selected = state.selection.map((id) => state.document.nodes.find((n) => n.id === id)).find((n) => (0, import_vector12.isVectorFrame)(n));
|
|
1968
2087
|
const page = selected && !selected.frame.master ? selected : null;
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
1970
|
-
/* @__PURE__ */ (0,
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
1972
|
-
pages.map((p, i) => /* @__PURE__ */ (0,
|
|
1973
|
-
masters.map((m) => /* @__PURE__ */ (0,
|
|
1974
|
-
/* @__PURE__ */ (0,
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
2088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-pages-panel": "", "aria-label": "Pages", children: [
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Pages" }),
|
|
2091
|
+
pages.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime13.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)),
|
|
2092
|
+
masters.map((m) => /* @__PURE__ */ (0, import_jsx_runtime13.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)),
|
|
2093
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: buttonClass9, "data-vector-pages-action": "add", title: "Add a page after the last", onClick: () => controller.addPage(), children: "+ Page" }),
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.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" })
|
|
1976
2095
|
] }),
|
|
1977
|
-
page && masters.length > 0 && /* @__PURE__ */ (0,
|
|
1978
|
-
/* @__PURE__ */ (0,
|
|
1979
|
-
/* @__PURE__ */ (0,
|
|
1980
|
-
/* @__PURE__ */ (0,
|
|
1981
|
-
masters.map((m) => /* @__PURE__ */ (0,
|
|
2096
|
+
page && masters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-16" }),
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("select", { "aria-label": "Master page", className: selectClass7, value: page.frame.masterId ?? "", onChange: (e) => controller.setPageMaster(e.target.value || null, { ids: [page.id] }), children: [
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "No master" }),
|
|
2100
|
+
masters.map((m) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: m.id, children: m.name ?? "Master" }, m.id))
|
|
1982
2101
|
] })
|
|
1983
2102
|
] })
|
|
1984
2103
|
] });
|
|
@@ -1986,7 +2105,7 @@ function VectorPagesPanel({ controller, className }) {
|
|
|
1986
2105
|
|
|
1987
2106
|
// src/vector/VectorConnectorPanel.tsx
|
|
1988
2107
|
var import_vector13 = require("@pixerate/editor/vector");
|
|
1989
|
-
var
|
|
2108
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1990
2109
|
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";
|
|
1991
2110
|
var selectClass8 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
1992
2111
|
var numberClass5 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -1995,27 +2114,27 @@ function VectorConnectorPanel({ controller, className }) {
|
|
|
1995
2114
|
const panel = (0, import_vector13.getVectorConnectorPanel)(state);
|
|
1996
2115
|
if (!panel) return null;
|
|
1997
2116
|
const ids = [panel.id];
|
|
1998
|
-
const end = (key, label, e) => /* @__PURE__ */ (0,
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
2000
|
-
e ? /* @__PURE__ */ (0,
|
|
2001
|
-
/* @__PURE__ */ (0,
|
|
2117
|
+
const end = (key, label, e) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", "data-vector-connector-end": key, children: [
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-xs text-foreground", children: label }),
|
|
2119
|
+
e ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2002
2121
|
"select",
|
|
2003
2122
|
{
|
|
2004
2123
|
"aria-label": `${label} side`,
|
|
2005
2124
|
className: selectClass8,
|
|
2006
2125
|
value: e.side ?? "auto",
|
|
2007
2126
|
onChange: (ev) => controller.setConnector({ [key]: { nodeId: e.nodeId, side: ev.target.value } }, { ids }),
|
|
2008
|
-
children: import_vector13.VECTOR_CONNECTOR_SIDES.map((s) => /* @__PURE__ */ (0,
|
|
2127
|
+
children: import_vector13.VECTOR_CONNECTOR_SIDES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: s, children: import_vector13.VECTOR_CONNECTOR_SIDE_LABELS[s] }, s))
|
|
2009
2128
|
}
|
|
2010
2129
|
),
|
|
2011
|
-
/* @__PURE__ */ (0,
|
|
2012
|
-
] }) : /* @__PURE__ */ (0,
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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" })
|
|
2131
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Free" })
|
|
2013
2132
|
] });
|
|
2014
|
-
return /* @__PURE__ */ (0,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2018
|
-
panel.route === "elbow" && /* @__PURE__ */ (0,
|
|
2133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-connector-panel": panel.id, "aria-label": "Connector", children: [
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Connector" }),
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("option", { value: r, children: import_vector13.VECTOR_CONNECTOR_ROUTE_LABELS[r] }, r)) }),
|
|
2137
|
+
panel.route === "elbow" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2019
2138
|
"input",
|
|
2020
2139
|
{
|
|
2021
2140
|
type: "number",
|
|
@@ -2038,15 +2157,15 @@ function VectorConnectorPanel({ controller, className }) {
|
|
|
2038
2157
|
}
|
|
2039
2158
|
|
|
2040
2159
|
// src/vector/VectorShadingPanel.tsx
|
|
2041
|
-
var
|
|
2160
|
+
var import_react11 = require("react");
|
|
2042
2161
|
var import_vector14 = require("@pixerate/editor/vector");
|
|
2043
|
-
var
|
|
2162
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2044
2163
|
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";
|
|
2045
2164
|
var numberClass6 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
2046
2165
|
function VectorShadingPanel({ controller, className }) {
|
|
2047
2166
|
const state = useVectorEditorState(controller);
|
|
2048
|
-
const [rows, setRows] = (0,
|
|
2049
|
-
const [columns, setColumns] = (0,
|
|
2167
|
+
const [rows, setRows] = (0, import_react11.useState)(2);
|
|
2168
|
+
const [columns, setColumns] = (0, import_react11.useState)(2);
|
|
2050
2169
|
const path = state.selection.map((id) => controller.getNode(id)).find((n) => n?.type === "path");
|
|
2051
2170
|
if (!path) return null;
|
|
2052
2171
|
const fill = path.fill;
|
|
@@ -2061,38 +2180,38 @@ function VectorShadingPanel({ controller, className }) {
|
|
|
2061
2180
|
if (mesh) controller.setMeshPoint(path.id, sel.index, patch, merge ? { merge } : {});
|
|
2062
2181
|
else controller.setFreeformPoint(path.id, sel.index, patch, merge ? { merge } : {});
|
|
2063
2182
|
};
|
|
2064
|
-
return /* @__PURE__ */ (0,
|
|
2065
|
-
/* @__PURE__ */ (0,
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
2070
|
-
/* @__PURE__ */ (0,
|
|
2071
|
-
/* @__PURE__ */ (0,
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-shading-panel": path.id, "aria-label": "Mesh and freeform gradient", children: [
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2185
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Shading" }),
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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))) }),
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-xs text-muted-foreground", children: "\xD7" }),
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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))) }),
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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" }),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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" })
|
|
2072
2191
|
] }),
|
|
2073
|
-
(mesh || free) && !sel && /* @__PURE__ */ (0,
|
|
2192
|
+
(mesh || free) && !sel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
2074
2193
|
"Gradient tool (G): drag points; ",
|
|
2075
2194
|
free ? "click inside to add one, Alt-click to remove." : "pick one to colour it."
|
|
2076
2195
|
] }),
|
|
2077
|
-
sel && /* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2196
|
+
sel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-vector-shading-point": sel.index, children: [
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "w-16 text-xs text-foreground", children: [
|
|
2079
2198
|
"Point ",
|
|
2080
2199
|
sel.index
|
|
2081
2200
|
] }),
|
|
2082
|
-
/* @__PURE__ */ (0,
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2084
|
-
free && /* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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") }),
|
|
2202
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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") }),
|
|
2203
|
+
free && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2204
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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") }),
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: buttonClass11, "aria-label": "Remove point", onClick: () => controller.removeFreeformPoint(path.id, sel.index), children: "Remove" })
|
|
2087
2206
|
] })
|
|
2088
2207
|
] })
|
|
2089
2208
|
] });
|
|
2090
2209
|
}
|
|
2091
2210
|
|
|
2092
2211
|
// src/vector/VectorTracePanel.tsx
|
|
2093
|
-
var
|
|
2212
|
+
var import_react12 = require("react");
|
|
2094
2213
|
var import_vector15 = require("@pixerate/editor/vector");
|
|
2095
|
-
var
|
|
2214
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2096
2215
|
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";
|
|
2097
2216
|
var selectClass9 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2098
2217
|
var numberClass7 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2109,10 +2228,10 @@ async function filePixels(file, max = 1e6) {
|
|
|
2109
2228
|
return { width, height, data: ctx.getImageData(0, 0, width, height).data };
|
|
2110
2229
|
}
|
|
2111
2230
|
function VectorTracePanel({ controller, className }) {
|
|
2112
|
-
const input = (0,
|
|
2113
|
-
const [mode, setMode] = (0,
|
|
2114
|
-
const [colors, setColors] = (0,
|
|
2115
|
-
const [message, setMessage] = (0,
|
|
2231
|
+
const input = (0, import_react12.useRef)(null);
|
|
2232
|
+
const [mode, setMode] = (0, import_react12.useState)("threshold");
|
|
2233
|
+
const [colors, setColors] = (0, import_react12.useState)(6);
|
|
2234
|
+
const [message, setMessage] = (0, import_react12.useState)(null);
|
|
2116
2235
|
const trace = async (file) => {
|
|
2117
2236
|
try {
|
|
2118
2237
|
const pixels = await filePixels(file);
|
|
@@ -2125,17 +2244,17 @@ function VectorTracePanel({ controller, className }) {
|
|
|
2125
2244
|
setMessage("That file could not be read as an image.");
|
|
2126
2245
|
}
|
|
2127
2246
|
};
|
|
2128
|
-
return /* @__PURE__ */ (0,
|
|
2129
|
-
/* @__PURE__ */ (0,
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2131
|
-
/* @__PURE__ */ (0,
|
|
2132
|
-
/* @__PURE__ */ (0,
|
|
2133
|
-
/* @__PURE__ */ (0,
|
|
2134
|
-
import_vector15.VECTOR_STYLIZE_STYLES.map((s) => /* @__PURE__ */ (0,
|
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-1 ${className ?? ""}`, "data-vector-trace-panel": "", "aria-label": "Image trace", children: [
|
|
2248
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Trace" }),
|
|
2250
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": "Trace mode", className: selectClass9, value: mode, onChange: (e) => setMode(e.target.value), children: [
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "threshold", children: "Black & white" }),
|
|
2252
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "color", children: "Colours" }),
|
|
2253
|
+
import_vector15.VECTOR_STYLIZE_STYLES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: s, children: import_vector15.VECTOR_STYLIZE_LABELS[s] }, s))
|
|
2135
2254
|
] }),
|
|
2136
|
-
mode === "color" && /* @__PURE__ */ (0,
|
|
2137
|
-
/* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2255
|
+
mode === "color" && /* @__PURE__ */ (0, import_jsx_runtime16.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))) }),
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.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" }),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2139
2258
|
"input",
|
|
2140
2259
|
{
|
|
2141
2260
|
ref: input,
|
|
@@ -2150,13 +2269,13 @@ function VectorTracePanel({ controller, className }) {
|
|
|
2150
2269
|
}
|
|
2151
2270
|
)
|
|
2152
2271
|
] }),
|
|
2153
|
-
message && /* @__PURE__ */ (0,
|
|
2272
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-red-600", children: message })
|
|
2154
2273
|
] });
|
|
2155
2274
|
}
|
|
2156
2275
|
|
|
2157
2276
|
// src/vector/VectorSymmetryPanel.tsx
|
|
2158
2277
|
var import_vector16 = require("@pixerate/editor/vector");
|
|
2159
|
-
var
|
|
2278
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2160
2279
|
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";
|
|
2161
2280
|
var selectClass10 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2162
2281
|
var numberClass8 = "h-7 w-12 rounded border border-border bg-background px-1.5 text-xs";
|
|
@@ -2166,35 +2285,35 @@ function VectorSymmetryPanel({ controller, className }) {
|
|
|
2166
2285
|
const s = group?.symmetry;
|
|
2167
2286
|
const ids = group ? [group.id] : void 0;
|
|
2168
2287
|
const drawing = !!group && state.symmetryTarget === group.id;
|
|
2169
|
-
return /* @__PURE__ */ (0,
|
|
2170
|
-
/* @__PURE__ */ (0,
|
|
2171
|
-
/* @__PURE__ */ (0,
|
|
2172
|
-
!group && /* @__PURE__ */ (0,
|
|
2173
|
-
!group && /* @__PURE__ */ (0,
|
|
2174
|
-
group && s && /* @__PURE__ */ (0,
|
|
2175
|
-
/* @__PURE__ */ (0,
|
|
2176
|
-
s.mode === "radial" && /* @__PURE__ */ (0,
|
|
2177
|
-
/* @__PURE__ */ (0,
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
2179
|
-
/* @__PURE__ */ (0,
|
|
2288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-symmetry-panel": "", "aria-label": "Symmetry", children: [
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Symmetry" }),
|
|
2291
|
+
!group && /* @__PURE__ */ (0, import_jsx_runtime17.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" }),
|
|
2292
|
+
!group && /* @__PURE__ */ (0, import_jsx_runtime17.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" }),
|
|
2293
|
+
group && s && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2294
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.jsx)("option", { value: m, children: import_vector16.VECTOR_SYMMETRY_MODE_LABELS[m] }, m)) }),
|
|
2295
|
+
s.mode === "radial" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.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 }) }),
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Mirror each copy too (kaleidoscope)", children: [
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Mirror copies", checked: !!s.mirror, onChange: (e) => controller.setSymmetry({ mirror: e.target.checked }, { ids }) }),
|
|
2180
2299
|
"Mirror"
|
|
2181
2300
|
] })
|
|
2182
2301
|
] })
|
|
2183
2302
|
] })
|
|
2184
2303
|
] }),
|
|
2185
|
-
group && /* @__PURE__ */ (0,
|
|
2186
|
-
/* @__PURE__ */ (0,
|
|
2187
|
-
/* @__PURE__ */ (0,
|
|
2188
|
-
/* @__PURE__ */ (0,
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2304
|
+
group && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2305
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16" }),
|
|
2306
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.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" }),
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: buttonClass13, title: "Expand: keep the copies as real objects", onClick: () => controller.releaseSymmetry({ ids, expand: true }), children: "Expand" }),
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: buttonClass13, title: "Release: stop repeating (the copies go)", onClick: () => controller.releaseSymmetry({ ids }), children: "Release" })
|
|
2190
2309
|
] })
|
|
2191
2310
|
] });
|
|
2192
2311
|
}
|
|
2193
2312
|
|
|
2194
2313
|
// src/vector/VectorPerspectivePanel.tsx
|
|
2195
|
-
var
|
|
2314
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2196
2315
|
var import_vector17 = require("@pixerate/editor/vector");
|
|
2197
|
-
var
|
|
2316
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2198
2317
|
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";
|
|
2199
2318
|
var selectClass11 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2200
2319
|
var PLANE_LABELS = { floor: "Floor", left: "Left wall", right: "Right wall", side: "Side wall", front: "Front" };
|
|
@@ -2202,43 +2321,43 @@ function VectorPerspectivePanel({ controller, className }) {
|
|
|
2202
2321
|
const state = useVectorEditorState(controller);
|
|
2203
2322
|
const grid = state.document.perspective ?? null;
|
|
2204
2323
|
const planes = grid ? (0, import_vector17.vectorPerspectivePlanes)(grid) : [];
|
|
2205
|
-
const [attachTo, setAttachTo] =
|
|
2324
|
+
const [attachTo, setAttachTo] = import_react13.default.useState("");
|
|
2206
2325
|
const target = (state.perspectivePlane ?? attachTo) || planes[0];
|
|
2207
2326
|
const add = (n) => controller.setPerspective((0, import_vector17.vectorPerspectivePreset)(n, state.document.width, state.document.height));
|
|
2208
|
-
return /* @__PURE__ */ (0,
|
|
2209
|
-
/* @__PURE__ */ (0,
|
|
2210
|
-
/* @__PURE__ */ (0,
|
|
2211
|
-
[1, 2, 3].map((n) => /* @__PURE__ */ (0,
|
|
2327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-perspective-panel": "", "aria-label": "Perspective", children: [
|
|
2328
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Perspective" }),
|
|
2330
|
+
[1, 2, 3].map((n) => /* @__PURE__ */ (0, import_jsx_runtime18.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: [
|
|
2212
2331
|
n,
|
|
2213
2332
|
"-pt"
|
|
2214
2333
|
] }, n))
|
|
2215
2334
|
] }),
|
|
2216
|
-
grid && /* @__PURE__ */ (0,
|
|
2217
|
-
/* @__PURE__ */ (0,
|
|
2218
|
-
/* @__PURE__ */ (0,
|
|
2219
|
-
/* @__PURE__ */ (0,
|
|
2220
|
-
planes.map((p) => /* @__PURE__ */ (0,
|
|
2335
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2336
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16" }),
|
|
2337
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.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: [
|
|
2338
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Draw flat" }),
|
|
2339
|
+
planes.map((p) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: p, children: [
|
|
2221
2340
|
"Draw on ",
|
|
2222
2341
|
PLANE_LABELS[p].toLowerCase()
|
|
2223
2342
|
] }, p))
|
|
2224
2343
|
] })
|
|
2225
2344
|
] }),
|
|
2226
|
-
grid && /* @__PURE__ */ (0,
|
|
2227
|
-
/* @__PURE__ */ (0,
|
|
2228
|
-
!state.perspectivePlane && /* @__PURE__ */ (0,
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2345
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2346
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-16" }),
|
|
2347
|
+
!state.perspectivePlane && /* @__PURE__ */ (0, import_jsx_runtime18.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_runtime18.jsx)("option", { value: p, children: PLANE_LABELS[p] }, p)) }),
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.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" }),
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", title: "Show the grid on the canvas", children: [
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", "aria-label": "Show perspective grid", checked: grid.visible !== false, onChange: (e) => controller.setPerspective({ ...grid, visible: e.target.checked }) }),
|
|
2232
2351
|
"Show"
|
|
2233
2352
|
] }),
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: buttonClass14, title: "Remove the grid (art on it stays)", onClick: () => controller.setPerspective(null), children: "Remove" })
|
|
2235
2354
|
] })
|
|
2236
2355
|
] });
|
|
2237
2356
|
}
|
|
2238
2357
|
|
|
2239
2358
|
// src/vector/VectorLensPanel.tsx
|
|
2240
2359
|
var import_vector18 = require("@pixerate/editor/vector");
|
|
2241
|
-
var
|
|
2360
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2242
2361
|
var selectClass12 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2243
2362
|
var numberClass9 = "h-7 w-16 rounded border border-border bg-background px-1.5 text-xs";
|
|
2244
2363
|
function VectorLensPanel({ controller, className }) {
|
|
@@ -2248,10 +2367,10 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2248
2367
|
const lens = path.lens ?? null;
|
|
2249
2368
|
const spec = lens ? import_vector18.VECTOR_LENS_SPECS[lens.type] : null;
|
|
2250
2369
|
const ids = [path.id];
|
|
2251
|
-
return /* @__PURE__ */ (0,
|
|
2252
|
-
/* @__PURE__ */ (0,
|
|
2253
|
-
/* @__PURE__ */ (0,
|
|
2254
|
-
/* @__PURE__ */ (0,
|
|
2370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "data-vector-lens-panel": "", "aria-label": "Lens", children: [
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2372
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Lens" }),
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2255
2374
|
"select",
|
|
2256
2375
|
{
|
|
2257
2376
|
"aria-label": "Lens type",
|
|
@@ -2259,15 +2378,15 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2259
2378
|
value: lens?.type ?? "",
|
|
2260
2379
|
onChange: (e) => e.target.value ? controller.setLens({ type: e.target.value }, { ids }) : controller.setLens(null, { ids }),
|
|
2261
2380
|
children: [
|
|
2262
|
-
/* @__PURE__ */ (0,
|
|
2263
|
-
import_vector18.VECTOR_LENS_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2381
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "None" }),
|
|
2382
|
+
import_vector18.VECTOR_LENS_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: t, children: import_vector18.VECTOR_LENS_LABELS[t] }, t))
|
|
2264
2383
|
]
|
|
2265
2384
|
}
|
|
2266
2385
|
)
|
|
2267
2386
|
] }),
|
|
2268
|
-
lens && spec && /* @__PURE__ */ (0,
|
|
2269
|
-
/* @__PURE__ */ (0,
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2387
|
+
lens && spec && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-16" }),
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2271
2390
|
"input",
|
|
2272
2391
|
{
|
|
2273
2392
|
type: "number",
|
|
@@ -2284,14 +2403,14 @@ function VectorLensPanel({ controller, className }) {
|
|
|
2284
2403
|
}
|
|
2285
2404
|
}
|
|
2286
2405
|
),
|
|
2287
|
-
spec.color !== null && /* @__PURE__ */ (0,
|
|
2406
|
+
spec.color !== null && /* @__PURE__ */ (0, import_jsx_runtime19.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}` }) })
|
|
2288
2407
|
] })
|
|
2289
2408
|
] });
|
|
2290
2409
|
}
|
|
2291
2410
|
|
|
2292
2411
|
// src/vector/VectorGradientEditor.tsx
|
|
2293
2412
|
var import_vector19 = require("@pixerate/editor/vector");
|
|
2294
|
-
var
|
|
2413
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2295
2414
|
var selectClass13 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
2296
2415
|
var numberClass10 = "h-7 w-14 rounded border border-border bg-background px-1.5 text-xs";
|
|
2297
2416
|
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";
|
|
@@ -2309,23 +2428,23 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2309
2428
|
controller.setStyle({ [ed.target]: (0, import_vector19.vectorPaintToHex)(first?.color) ?? first?.color ?? "#000000" }, void 0, { label: "Solid Colour" });
|
|
2310
2429
|
} else controller.setGradient({ type: value });
|
|
2311
2430
|
};
|
|
2312
|
-
return /* @__PURE__ */ (0,
|
|
2313
|
-
/* @__PURE__ */ (0,
|
|
2314
|
-
/* @__PURE__ */ (0,
|
|
2315
|
-
["fill", "stroke"].map((t) => /* @__PURE__ */ (0,
|
|
2316
|
-
ed.mixed && /* @__PURE__ */ (0,
|
|
2431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-1.5 ${className ?? ""}`, "data-vector-gradient-editor": ed.target, "aria-label": "Gradient", children: [
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Gradient" }),
|
|
2434
|
+
["fill", "stroke"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: buttonClass15, "aria-pressed": ed.target === t, onClick: () => controller.setGradientTarget(t), children: t === "fill" ? "Fill" : "Stroke" }, t)),
|
|
2435
|
+
ed.mixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
2317
2436
|
] }),
|
|
2318
|
-
/* @__PURE__ */ (0,
|
|
2319
|
-
/* @__PURE__ */ (0,
|
|
2320
|
-
/* @__PURE__ */ (0,
|
|
2321
|
-
/* @__PURE__ */ (0,
|
|
2322
|
-
import_vector19.VECTOR_GRADIENT_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Type" }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { "aria-label": "Gradient type", className: selectClass13, value: ed.type ?? "solid", onChange: (e) => setType(e.target.value), children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "solid", children: "Solid" }),
|
|
2441
|
+
import_vector19.VECTOR_GRADIENT_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: t, children: import_vector19.VECTOR_GRADIENT_TYPE_LABELS[t] }, t))
|
|
2323
2442
|
] }),
|
|
2324
|
-
/* @__PURE__ */ (0,
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: buttonClass15, "aria-label": "Reverse gradient", title: "Reverse gradient", disabled: !g, onClick: () => controller.reverseGradient(), children: "\u21C4" })
|
|
2325
2444
|
] }),
|
|
2326
|
-
g && /* @__PURE__ */ (0,
|
|
2327
|
-
/* @__PURE__ */ (0,
|
|
2328
|
-
/* @__PURE__ */ (0,
|
|
2445
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative h-8", "data-vector-gradient-ramp": "", children: [
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2329
2448
|
"div",
|
|
2330
2449
|
{
|
|
2331
2450
|
role: "button",
|
|
@@ -2339,7 +2458,7 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2339
2458
|
}
|
|
2340
2459
|
}
|
|
2341
2460
|
),
|
|
2342
|
-
ed.stops.map((s) => /* @__PURE__ */ (0,
|
|
2461
|
+
ed.stops.map((s) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2343
2462
|
"button",
|
|
2344
2463
|
{
|
|
2345
2464
|
type: "button",
|
|
@@ -2353,8 +2472,8 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2353
2472
|
s.index
|
|
2354
2473
|
))
|
|
2355
2474
|
] }),
|
|
2356
|
-
sel && /* @__PURE__ */ (0,
|
|
2357
|
-
/* @__PURE__ */ (0,
|
|
2475
|
+
sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", "data-vector-gradient-selected-stop": sel.index, children: [
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2358
2477
|
"input",
|
|
2359
2478
|
{
|
|
2360
2479
|
type: "color",
|
|
@@ -2365,9 +2484,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2365
2484
|
onBlur: end
|
|
2366
2485
|
}
|
|
2367
2486
|
),
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2369
2488
|
"Opacity",
|
|
2370
|
-
/* @__PURE__ */ (0,
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2371
2490
|
"input",
|
|
2372
2491
|
{
|
|
2373
2492
|
type: "number",
|
|
@@ -2384,9 +2503,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2384
2503
|
}
|
|
2385
2504
|
)
|
|
2386
2505
|
] }),
|
|
2387
|
-
/* @__PURE__ */ (0,
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2388
2507
|
"At",
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2390
2509
|
"input",
|
|
2391
2510
|
{
|
|
2392
2511
|
type: "number",
|
|
@@ -2403,9 +2522,9 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2403
2522
|
}
|
|
2404
2523
|
)
|
|
2405
2524
|
] }),
|
|
2406
|
-
!sel.last && /* @__PURE__ */ (0,
|
|
2525
|
+
!sel.last && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
2407
2526
|
"Midpoint",
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2409
2528
|
"input",
|
|
2410
2529
|
{
|
|
2411
2530
|
type: "number",
|
|
@@ -2422,15 +2541,15 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2422
2541
|
}
|
|
2423
2542
|
)
|
|
2424
2543
|
] }),
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
2426
2545
|
] }),
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2429
|
-
/* @__PURE__ */ (0,
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16", children: "Colours" }),
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("option", { value: i, children: import_vector19.VECTOR_GRADIENT_INTERPOLATION_LABELS[i] }, i)) })
|
|
2430
2549
|
] }),
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2433
|
-
/* @__PURE__ */ (0,
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16", children: "Smooth" }),
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2434
2553
|
"input",
|
|
2435
2554
|
{
|
|
2436
2555
|
type: "range",
|
|
@@ -2446,20 +2565,20 @@ function VectorGradientEditor({ controller, className }) {
|
|
|
2446
2565
|
}
|
|
2447
2566
|
)
|
|
2448
2567
|
] }),
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2450
|
-
/* @__PURE__ */ (0,
|
|
2451
|
-
/* @__PURE__ */ (0,
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16", children: "Spread" }),
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("option", { value: sp, children: import_vector19.VECTOR_GRADIENT_SPREAD_LABELS[sp] }, sp)) })
|
|
2452
2571
|
] }),
|
|
2453
|
-
ed.target === "stroke" && /* @__PURE__ */ (0,
|
|
2454
|
-
/* @__PURE__ */ (0,
|
|
2455
|
-
/* @__PURE__ */ (0,
|
|
2572
|
+
ed.target === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5 text-xs text-foreground", children: [
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16", children: "On stroke" }),
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("option", { value: m, children: import_vector19.VECTOR_STROKE_GRADIENT_MODE_LABELS[m] }, m)) })
|
|
2456
2575
|
] })
|
|
2457
2576
|
] })
|
|
2458
2577
|
] });
|
|
2459
2578
|
}
|
|
2460
2579
|
|
|
2461
2580
|
// src/vector/VectorToolbar.tsx
|
|
2462
|
-
var
|
|
2581
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2463
2582
|
var VECTOR_SNAP_TITLE = "Snap to objects";
|
|
2464
2583
|
var modKeyLabel = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform ?? "") ? "\u2318" : "Ctrl";
|
|
2465
2584
|
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";
|
|
@@ -2480,11 +2599,11 @@ function VectorToolbar({
|
|
|
2480
2599
|
const editing = state.editing;
|
|
2481
2600
|
const groupSelected = state.selection.some((id) => controller.getNode(id)?.type === "group");
|
|
2482
2601
|
const maskSelected = state.selection.some((id) => (0, import_vector20.isVectorMaskGroup)(controller.getNode(id)));
|
|
2483
|
-
const [live, setLive] =
|
|
2602
|
+
const [live, setLive] = import_react14.default.useState(false);
|
|
2484
2603
|
const booleanDisabled = live ? count < 1 : count < 2;
|
|
2485
|
-
const act = (label, title, run, disabled = false) => /* @__PURE__ */ (0,
|
|
2486
|
-
return /* @__PURE__ */ (0,
|
|
2487
|
-
/* @__PURE__ */ (0,
|
|
2604
|
+
const act = (label, title, run, disabled = false) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: buttonClass16, title, "aria-label": title, disabled, onClick: () => void run(), children: label }, label);
|
|
2605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { role: "toolbar", "aria-label": "Vector tools", className: `flex flex-wrap items-center gap-1 ${className ?? ""}`, children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "Tools", children: tools.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2488
2607
|
"button",
|
|
2489
2608
|
{
|
|
2490
2609
|
type: "button",
|
|
@@ -2498,12 +2617,12 @@ function VectorToolbar({
|
|
|
2498
2617
|
},
|
|
2499
2618
|
tool
|
|
2500
2619
|
)) }),
|
|
2501
|
-
showHistory && /* @__PURE__ */ (0,
|
|
2620
|
+
showHistory && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "History", children: [
|
|
2502
2621
|
act("\u21B6", state.canUndo ? `Undo ${state.undoLabel}` : "Undo", () => controller.undo(), !state.canUndo),
|
|
2503
2622
|
act("\u21B7", state.canRedo ? `Redo ${state.redoLabel}` : "Redo", () => controller.redo(), !state.canRedo)
|
|
2504
2623
|
] }),
|
|
2505
|
-
showSnap && /* @__PURE__ */ (0,
|
|
2506
|
-
/* @__PURE__ */ (0,
|
|
2624
|
+
showSnap && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Snapping", children: [
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2507
2626
|
"button",
|
|
2508
2627
|
{
|
|
2509
2628
|
type: "button",
|
|
@@ -2516,7 +2635,7 @@ function VectorToolbar({
|
|
|
2516
2635
|
children: "Snap"
|
|
2517
2636
|
}
|
|
2518
2637
|
),
|
|
2519
|
-
/* @__PURE__ */ (0,
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2520
2639
|
"select",
|
|
2521
2640
|
{
|
|
2522
2641
|
"data-vector-polar": "",
|
|
@@ -2526,8 +2645,8 @@ function VectorToolbar({
|
|
|
2526
2645
|
value: String((0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) ?? ""),
|
|
2527
2646
|
onChange: (e) => controller.setSnap({ angles: (0, import_vector20.vectorPolarAngles)(Number(e.target.value)) }),
|
|
2528
2647
|
children: [
|
|
2529
|
-
(0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) === null && /* @__PURE__ */ (0,
|
|
2530
|
-
[90, 45, 30, 15].map((n) => /* @__PURE__ */ (0,
|
|
2648
|
+
(0, import_vector20.vectorPolarIncrementOf)(state.snap.angles) === null && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "Custom" }),
|
|
2649
|
+
[90, 45, 30, 15].map((n) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("option", { value: n, children: [
|
|
2531
2650
|
n,
|
|
2532
2651
|
"\xB0"
|
|
2533
2652
|
] }, n))
|
|
@@ -2535,8 +2654,8 @@ function VectorToolbar({
|
|
|
2535
2654
|
}
|
|
2536
2655
|
)
|
|
2537
2656
|
] }),
|
|
2538
|
-
showPathEdit && /* @__PURE__ */ (0,
|
|
2539
|
-
import_vector20.VECTOR_PATH_ACTIONS.map((a) => /* @__PURE__ */ (0,
|
|
2657
|
+
showPathEdit && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Path editing", children: [
|
|
2658
|
+
import_vector20.VECTOR_PATH_ACTIONS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2540
2659
|
"button",
|
|
2541
2660
|
{
|
|
2542
2661
|
type: "button",
|
|
@@ -2550,7 +2669,7 @@ function VectorToolbar({
|
|
|
2550
2669
|
},
|
|
2551
2670
|
a.id
|
|
2552
2671
|
)),
|
|
2553
|
-
import_vector20.VECTOR_EDIT_TOGGLES.map((t) => /* @__PURE__ */ (0,
|
|
2672
|
+
import_vector20.VECTOR_EDIT_TOGGLES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2554
2673
|
"button",
|
|
2555
2674
|
{
|
|
2556
2675
|
type: "button",
|
|
@@ -2564,9 +2683,9 @@ function VectorToolbar({
|
|
|
2564
2683
|
},
|
|
2565
2684
|
t.key
|
|
2566
2685
|
)),
|
|
2567
|
-
state.tool === "pencil" && /* @__PURE__ */ (0,
|
|
2686
|
+
state.tool === "pencil" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2568
2687
|
"Smoothing",
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2570
2689
|
"input",
|
|
2571
2690
|
{
|
|
2572
2691
|
type: "range",
|
|
@@ -2580,9 +2699,9 @@ function VectorToolbar({
|
|
|
2580
2699
|
}
|
|
2581
2700
|
)
|
|
2582
2701
|
] }),
|
|
2583
|
-
state.tool === "eraser" && /* @__PURE__ */ (0,
|
|
2702
|
+
state.tool === "eraser" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2584
2703
|
"Size",
|
|
2585
|
-
/* @__PURE__ */ (0,
|
|
2704
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2586
2705
|
"input",
|
|
2587
2706
|
{
|
|
2588
2707
|
type: "number",
|
|
@@ -2598,21 +2717,21 @@ function VectorToolbar({
|
|
|
2598
2717
|
}
|
|
2599
2718
|
)
|
|
2600
2719
|
] }),
|
|
2601
|
-
state.tool === "distort" && /* @__PURE__ */ (0,
|
|
2602
|
-
/* @__PURE__ */ (0,
|
|
2603
|
-
/* @__PURE__ */ (0,
|
|
2720
|
+
state.tool === "distort" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex flex-wrap items-center gap-1", "data-vector-distort-options": "", children: [
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("option", { value: m, children: m[0].toUpperCase() + m.slice(1) }, m)) }),
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2604
2723
|
"Size",
|
|
2605
|
-
/* @__PURE__ */ (0,
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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) => {
|
|
2606
2725
|
const n = parseFloat(e.target.value);
|
|
2607
2726
|
if (Number.isFinite(n) && n > 0) controller.setEditing({ distortSize: n });
|
|
2608
2727
|
} })
|
|
2609
2728
|
] }),
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-xs text-foreground", children: [
|
|
2611
2730
|
"Strength",
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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) }) })
|
|
2613
2732
|
] })
|
|
2614
2733
|
] }),
|
|
2615
|
-
state.tool === "paintBucket" && /* @__PURE__ */ (0,
|
|
2734
|
+
state.tool === "paintBucket" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2616
2735
|
"button",
|
|
2617
2736
|
{
|
|
2618
2737
|
type: "button",
|
|
@@ -2626,7 +2745,7 @@ function VectorToolbar({
|
|
|
2626
2745
|
}
|
|
2627
2746
|
)
|
|
2628
2747
|
] }),
|
|
2629
|
-
showDistort && /* @__PURE__ */ (0,
|
|
2748
|
+
showDistort && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Distort", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2630
2749
|
"button",
|
|
2631
2750
|
{
|
|
2632
2751
|
type: "button",
|
|
@@ -2639,10 +2758,10 @@ function VectorToolbar({
|
|
|
2639
2758
|
children: "Distort"
|
|
2640
2759
|
}
|
|
2641
2760
|
) }),
|
|
2642
|
-
showBlend && /* @__PURE__ */ (0,
|
|
2643
|
-
showArrange && /* @__PURE__ */ (0,
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2645
|
-
/* @__PURE__ */ (0,
|
|
2761
|
+
showBlend && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorBlendControls, { controller }),
|
|
2762
|
+
showArrange && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2763
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Combine", children: [
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2646
2765
|
"button",
|
|
2647
2766
|
{
|
|
2648
2767
|
type: "button",
|
|
@@ -2664,7 +2783,7 @@ function VectorToolbar({
|
|
|
2664
2783
|
act("\u25D0", `Make Clipping Mask (${modKeyLabel()}+7)`, () => controller.makeMask("clip"), count < 2),
|
|
2665
2784
|
act("\u25D1", `Release Mask (${modKeyLabel()}+Alt+7)`, () => controller.releaseMask(), !maskSelected)
|
|
2666
2785
|
] }),
|
|
2667
|
-
/* @__PURE__ */ (0,
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(
|
|
2668
2787
|
"button",
|
|
2669
2788
|
{
|
|
2670
2789
|
type: "button",
|
|
@@ -2678,7 +2797,7 @@ function VectorToolbar({
|
|
|
2678
2797
|
},
|
|
2679
2798
|
a.id
|
|
2680
2799
|
)) }),
|
|
2681
|
-
/* @__PURE__ */ (0,
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Arrange", children: [
|
|
2682
2801
|
act("\u21C8", "Bring to Front", () => controller.arrange("front"), count < 1),
|
|
2683
2802
|
act("\u21CA", "Send to Back", () => controller.arrange("back"), count < 1),
|
|
2684
2803
|
act("\u21E4", "Align Left", () => controller.align("left"), count < 1),
|
|
@@ -2696,19 +2815,19 @@ function VectorBlendControls({ controller }) {
|
|
|
2696
2815
|
const blend = (0, import_vector20.getVectorBlendControls)(state);
|
|
2697
2816
|
const o = blend.options;
|
|
2698
2817
|
const selected = blend.ids.length > 0;
|
|
2699
|
-
return /* @__PURE__ */ (0,
|
|
2700
|
-
/* @__PURE__ */ (0,
|
|
2701
|
-
/* @__PURE__ */ (0,
|
|
2818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ml-1 flex items-center gap-1", role: "group", "aria-label": "Blend", "data-vector-blend-controls": "", children: [
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" }),
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2702
2821
|
"select",
|
|
2703
2822
|
{
|
|
2704
2823
|
"aria-label": "Blend spacing",
|
|
2705
2824
|
className: "h-7 rounded border border-border bg-background px-1 text-xs",
|
|
2706
2825
|
value: o.spacing,
|
|
2707
2826
|
onChange: (e) => (0, import_vector20.applyVectorBlendOptions)(controller, { spacing: e.target.value }),
|
|
2708
|
-
children: import_vector20.VECTOR_BLEND_SPACINGS.map((sp) => /* @__PURE__ */ (0,
|
|
2827
|
+
children: import_vector20.VECTOR_BLEND_SPACINGS.map((sp) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: sp, children: import_vector20.VECTOR_BLEND_SPACING_LABELS[sp] }, sp))
|
|
2709
2828
|
}
|
|
2710
2829
|
),
|
|
2711
|
-
o.spacing !== "smoothColor" && /* @__PURE__ */ (0,
|
|
2830
|
+
o.spacing !== "smoothColor" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2712
2831
|
"input",
|
|
2713
2832
|
{
|
|
2714
2833
|
type: "number",
|
|
@@ -2724,7 +2843,7 @@ function VectorBlendControls({ controller }) {
|
|
|
2724
2843
|
}
|
|
2725
2844
|
}
|
|
2726
2845
|
),
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2728
2847
|
"button",
|
|
2729
2848
|
{
|
|
2730
2849
|
type: "button",
|
|
@@ -2737,7 +2856,7 @@ function VectorBlendControls({ controller }) {
|
|
|
2737
2856
|
children: "\u293F"
|
|
2738
2857
|
}
|
|
2739
2858
|
),
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2859
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2741
2860
|
"button",
|
|
2742
2861
|
{
|
|
2743
2862
|
type: "button",
|
|
@@ -2750,8 +2869,8 @@ function VectorBlendControls({ controller }) {
|
|
|
2750
2869
|
children: "\u2307"
|
|
2751
2870
|
}
|
|
2752
2871
|
),
|
|
2753
|
-
/* @__PURE__ */ (0,
|
|
2754
|
-
/* @__PURE__ */ (0,
|
|
2872
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" }),
|
|
2873
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
2755
2874
|
] });
|
|
2756
2875
|
}
|
|
2757
2876
|
var selectClass14 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
@@ -2787,17 +2906,17 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2787
2906
|
if (style) controller.setWidthProfile(id);
|
|
2788
2907
|
else controller.setDefaults({ strokeWidthProfile: (0, import_vector20.widthProfilePreset)(id)?.length ? (0, import_vector20.widthProfilePreset)(id) : null });
|
|
2789
2908
|
};
|
|
2790
|
-
const mixed = (key) => style?.mixed[key] ? /* @__PURE__ */ (0,
|
|
2909
|
+
const mixed = (key) => style?.mixed[key] ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" }) : null;
|
|
2791
2910
|
const arrowRow = (end, label) => {
|
|
2792
2911
|
const key = end === "start" ? "startArrow" : "endArrow";
|
|
2793
2912
|
const scaleKey = end === "start" ? "startArrowScale" : "endArrowScale";
|
|
2794
|
-
return /* @__PURE__ */ (0,
|
|
2795
|
-
/* @__PURE__ */ (0,
|
|
2796
|
-
/* @__PURE__ */ (0,
|
|
2797
|
-
/* @__PURE__ */ (0,
|
|
2798
|
-
import_vector20.VECTOR_ARROWHEADS.map((h) => /* @__PURE__ */ (0,
|
|
2913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": key, children: [
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16 text-xs text-foreground", children: label }),
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": `${label} arrowhead`, className: selectClass14, value: source[key] ?? "", onChange: (e) => apply({ [key]: e.target.value || null }), children: [
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "None" }),
|
|
2917
|
+
import_vector20.VECTOR_ARROWHEADS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: h, children: import_vector20.VECTOR_ARROWHEAD_LABELS[h] }, h))
|
|
2799
2918
|
] }),
|
|
2800
|
-
/* @__PURE__ */ (0,
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2801
2920
|
"input",
|
|
2802
2921
|
{
|
|
2803
2922
|
type: "number",
|
|
@@ -2823,12 +2942,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2823
2942
|
const paint = source[key];
|
|
2824
2943
|
const hex = (0, import_vector20.vectorPaintToHex)(paint);
|
|
2825
2944
|
const on = paint !== null && paint !== "none";
|
|
2826
|
-
return /* @__PURE__ */ (0,
|
|
2827
|
-
/* @__PURE__ */ (0,
|
|
2828
|
-
/* @__PURE__ */ (0,
|
|
2945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": key, children: [
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex w-16 items-center gap-1.5 text-xs text-foreground", children: [
|
|
2947
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: on, "aria-label": `${label} on`, onChange: (e) => apply({ [key]: e.target.checked ? hex ?? "#000000" : null }) }),
|
|
2829
2948
|
label
|
|
2830
2949
|
] }),
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2950
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2832
2951
|
"input",
|
|
2833
2952
|
{
|
|
2834
2953
|
type: "color",
|
|
@@ -2839,18 +2958,18 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2839
2958
|
onChange: (e) => apply({ [key]: e.target.value })
|
|
2840
2959
|
}
|
|
2841
2960
|
),
|
|
2842
|
-
on && !hex && /* @__PURE__ */ (0,
|
|
2843
|
-
style?.mixed[key] && /* @__PURE__ */ (0,
|
|
2961
|
+
on && !hex && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: typeof paint === "string" ? paint : "Gradient" }),
|
|
2962
|
+
style?.mixed[key] && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Mixed" })
|
|
2844
2963
|
] });
|
|
2845
2964
|
};
|
|
2846
|
-
return /* @__PURE__ */ (0,
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `space-y-2 ${className ?? ""}`, "aria-label": style ? "Selection style" : "New shape style", children: [
|
|
2966
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: style ? "Selection" : "New shapes" }),
|
|
2848
2967
|
paintRow("fill", "Fill"),
|
|
2849
2968
|
paintRow("stroke", "Stroke"),
|
|
2850
|
-
style && /* @__PURE__ */ (0,
|
|
2851
|
-
/* @__PURE__ */ (0,
|
|
2852
|
-
/* @__PURE__ */ (0,
|
|
2853
|
-
/* @__PURE__ */ (0,
|
|
2969
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorGradientEditor, { controller }),
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16", children: "Width" }),
|
|
2972
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2854
2973
|
"input",
|
|
2855
2974
|
{
|
|
2856
2975
|
type: "number",
|
|
@@ -2866,14 +2985,14 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2866
2985
|
}
|
|
2867
2986
|
)
|
|
2868
2987
|
] }),
|
|
2869
|
-
/* @__PURE__ */ (0,
|
|
2870
|
-
/* @__PURE__ */ (0,
|
|
2871
|
-
/* @__PURE__ */ (0,
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "strokeAlign", children: [
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16", children: "Align" }),
|
|
2990
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("option", { value: a, children: import_vector20.VECTOR_STROKE_ALIGN_LABELS[a] }, a)) }),
|
|
2872
2991
|
mixed("strokeAlign")
|
|
2873
2992
|
] }),
|
|
2874
|
-
/* @__PURE__ */ (0,
|
|
2875
|
-
/* @__PURE__ */ (0,
|
|
2876
|
-
/* @__PURE__ */ (0,
|
|
2993
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "widthProfile", children: [
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16", children: "Profile" }),
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2877
2996
|
"select",
|
|
2878
2997
|
{
|
|
2879
2998
|
"aria-label": "Width profile",
|
|
@@ -2883,12 +3002,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2883
3002
|
if (e.target.value !== "custom") setProfile(e.target.value);
|
|
2884
3003
|
},
|
|
2885
3004
|
children: [
|
|
2886
|
-
import_vector20.VECTOR_WIDTH_PRESETS.map((p) => /* @__PURE__ */ (0,
|
|
2887
|
-
source.widthProfile === "custom" && /* @__PURE__ */ (0,
|
|
3005
|
+
import_vector20.VECTOR_WIDTH_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: p.id, children: p.label }, p.id)),
|
|
3006
|
+
source.widthProfile === "custom" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "custom", disabled: true, children: "Custom" })
|
|
2888
3007
|
]
|
|
2889
3008
|
}
|
|
2890
3009
|
),
|
|
2891
|
-
/* @__PURE__ */ (0,
|
|
3010
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2892
3011
|
"button",
|
|
2893
3012
|
{
|
|
2894
3013
|
type: "button",
|
|
@@ -2902,20 +3021,20 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2902
3021
|
),
|
|
2903
3022
|
mixed("widthProfile")
|
|
2904
3023
|
] }),
|
|
2905
|
-
source.hasOpenPath && /* @__PURE__ */ (0,
|
|
3024
|
+
source.hasOpenPath && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2906
3025
|
arrowRow("start", "Start"),
|
|
2907
3026
|
arrowRow("end", "End"),
|
|
2908
|
-
(source.startArrow || source.endArrow) && /* @__PURE__ */ (0,
|
|
2909
|
-
/* @__PURE__ */ (0,
|
|
2910
|
-
/* @__PURE__ */ (0,
|
|
2911
|
-
/* @__PURE__ */ (0,
|
|
2912
|
-
/* @__PURE__ */ (0,
|
|
3027
|
+
(source.startArrow || source.endArrow) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", "data-vector-style": "arrowAlign", children: [
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16", children: "Heads" }),
|
|
3029
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Arrowhead alignment", className: selectClass14, value: source.arrowAlign, onChange: (e) => apply({ arrowAlign: e.target.value }), children: [
|
|
3030
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "extend", children: "Tip past end" }),
|
|
3031
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "tip", children: "Tip at end" })
|
|
2913
3032
|
] })
|
|
2914
3033
|
] })
|
|
2915
3034
|
] }),
|
|
2916
|
-
source.corners > 0 && /* @__PURE__ */ (0,
|
|
2917
|
-
/* @__PURE__ */ (0,
|
|
2918
|
-
/* @__PURE__ */ (0,
|
|
3035
|
+
source.corners > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", "data-vector-style": "corners", children: [
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16 text-xs text-foreground", children: "Corners" }),
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2919
3038
|
"input",
|
|
2920
3039
|
{
|
|
2921
3040
|
type: "number",
|
|
@@ -2930,12 +3049,12 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2930
3049
|
}
|
|
2931
3050
|
}
|
|
2932
3051
|
),
|
|
2933
|
-
/* @__PURE__ */ (0,
|
|
3052
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("option", { value: k, children: import_vector20.VECTOR_CORNER_KIND_LABELS[k] }, k)) }),
|
|
2934
3053
|
mixed("cornerRadius")
|
|
2935
3054
|
] }),
|
|
2936
|
-
style && source.corners > 0 && source.cornerKind === "round" && source.cornerRadius > 0 && /* @__PURE__ */ (0,
|
|
2937
|
-
/* @__PURE__ */ (0,
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
style && source.corners > 0 && source.cornerKind === "round" && source.cornerRadius > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16", children: "Smoothing" }),
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2939
3058
|
"input",
|
|
2940
3059
|
{
|
|
2941
3060
|
type: "range",
|
|
@@ -2950,9 +3069,9 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2950
3069
|
}
|
|
2951
3070
|
)
|
|
2952
3071
|
] }),
|
|
2953
|
-
style && /* @__PURE__ */ (0,
|
|
2954
|
-
/* @__PURE__ */ (0,
|
|
2955
|
-
/* @__PURE__ */ (0,
|
|
3072
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-xs text-foreground", children: [
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-16", children: "Opacity" }),
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2956
3075
|
"input",
|
|
2957
3076
|
{
|
|
2958
3077
|
type: "range",
|
|
@@ -2966,36 +3085,36 @@ function VectorStylePanel({ controller, className }) {
|
|
|
2966
3085
|
}
|
|
2967
3086
|
)
|
|
2968
3087
|
] }),
|
|
2969
|
-
/* @__PURE__ */ (0,
|
|
2970
|
-
style && /* @__PURE__ */ (0,
|
|
2971
|
-
style && /* @__PURE__ */ (0,
|
|
2972
|
-
style && /* @__PURE__ */ (0,
|
|
2973
|
-
style && /* @__PURE__ */ (0,
|
|
2974
|
-
/* @__PURE__ */ (0,
|
|
2975
|
-
/* @__PURE__ */ (0,
|
|
2976
|
-
/* @__PURE__ */ (0,
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
2978
|
-
/* @__PURE__ */ (0,
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
2981
|
-
/* @__PURE__ */ (0,
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
2983
|
-
/* @__PURE__ */ (0,
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorTextPanel, { controller }),
|
|
3089
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorAppearancePanel, { controller }),
|
|
3090
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorEffectsPanel, { controller }),
|
|
3091
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorEnvelopePanel, { controller }),
|
|
3092
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorMaskPanel, { controller }),
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorFramePanel, { controller }),
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorPagesPanel, { controller }),
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorConnectorPanel, { controller }),
|
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorShadingPanel, { controller }),
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorSymmetryPanel, { controller }),
|
|
3098
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorPerspectivePanel, { controller }),
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorLensPanel, { controller }),
|
|
3100
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorTracePanel, { controller }),
|
|
3101
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorConstraintsPanel, { controller }),
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VectorSymbolsPanel, { controller })
|
|
2984
3103
|
] });
|
|
2985
3104
|
}
|
|
2986
3105
|
|
|
2987
3106
|
// src/effects/useEffects.ts
|
|
2988
|
-
var
|
|
3107
|
+
var import_react15 = require("react");
|
|
2989
3108
|
function useEffects(host, provider) {
|
|
2990
|
-
(0,
|
|
3109
|
+
(0, import_react15.useEffect)(() => {
|
|
2991
3110
|
if (!host || !provider) return;
|
|
2992
3111
|
return host.useEffects(provider);
|
|
2993
3112
|
}, [host, provider]);
|
|
2994
3113
|
}
|
|
2995
3114
|
function useEffectDescription(provider, effect) {
|
|
2996
|
-
const [state, setState] = (0,
|
|
3115
|
+
const [state, setState] = (0, import_react15.useState)({ key: "", description: null, error: null });
|
|
2997
3116
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
2998
|
-
(0,
|
|
3117
|
+
(0, import_react15.useEffect)(() => {
|
|
2999
3118
|
if (!provider || !effect) return;
|
|
3000
3119
|
let live = true;
|
|
3001
3120
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -3010,13 +3129,13 @@ function useEffectDescription(provider, effect) {
|
|
|
3010
3129
|
}
|
|
3011
3130
|
|
|
3012
3131
|
// src/effects/EffectThumbnail.tsx
|
|
3013
|
-
var
|
|
3132
|
+
var import_react16 = require("react");
|
|
3014
3133
|
var import_effects = require("@pixerate/editor/effects");
|
|
3015
|
-
var
|
|
3134
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3016
3135
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
3017
|
-
const ref = (0,
|
|
3018
|
-
const [failed, setFailed] = (0,
|
|
3019
|
-
(0,
|
|
3136
|
+
const ref = (0, import_react16.useRef)(null);
|
|
3137
|
+
const [failed, setFailed] = (0, import_react16.useState)(effect.kind === "motion");
|
|
3138
|
+
(0, import_react16.useEffect)(() => {
|
|
3020
3139
|
if (effect.kind === "motion") return;
|
|
3021
3140
|
let live = true;
|
|
3022
3141
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -3031,28 +3150,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
3031
3150
|
live = false;
|
|
3032
3151
|
};
|
|
3033
3152
|
}, [provider, effect, width, height]);
|
|
3034
|
-
return /* @__PURE__ */ (0,
|
|
3153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3035
3154
|
"div",
|
|
3036
3155
|
{
|
|
3037
3156
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
3038
3157
|
style: { aspectRatio: `${width} / ${height}` },
|
|
3039
3158
|
"data-effect-thumbnail": effect.id,
|
|
3040
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
3159
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
3041
3160
|
}
|
|
3042
3161
|
);
|
|
3043
3162
|
}
|
|
3044
3163
|
|
|
3045
3164
|
// src/effects/EffectsBrowser.tsx
|
|
3046
|
-
var
|
|
3165
|
+
var import_react17 = require("react");
|
|
3047
3166
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
3048
|
-
var
|
|
3167
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3049
3168
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
3050
|
-
const [all, setAll] = (0,
|
|
3051
|
-
const [query, setQuery] = (0,
|
|
3052
|
-
const [category, setCategory] = (0,
|
|
3053
|
-
const [use, setUse] = (0,
|
|
3054
|
-
const [error, setError] = (0,
|
|
3055
|
-
(0,
|
|
3169
|
+
const [all, setAll] = (0, import_react17.useState)([]);
|
|
3170
|
+
const [query, setQuery] = (0, import_react17.useState)("");
|
|
3171
|
+
const [category, setCategory] = (0, import_react17.useState)("");
|
|
3172
|
+
const [use, setUse] = (0, import_react17.useState)("");
|
|
3173
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
3174
|
+
(0, import_react17.useEffect)(() => {
|
|
3056
3175
|
if (!provider) return setAll([]);
|
|
3057
3176
|
let live = true;
|
|
3058
3177
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -3063,8 +3182,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3063
3182
|
live = false;
|
|
3064
3183
|
};
|
|
3065
3184
|
}, [provider]);
|
|
3066
|
-
const [found, setFound] = (0,
|
|
3067
|
-
(0,
|
|
3185
|
+
const [found, setFound] = (0, import_react17.useState)([]);
|
|
3186
|
+
(0, import_react17.useEffect)(() => {
|
|
3068
3187
|
if (!provider) return setFound([]);
|
|
3069
3188
|
let live = true;
|
|
3070
3189
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -3073,14 +3192,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3073
3192
|
};
|
|
3074
3193
|
}, [provider, query, category, use]);
|
|
3075
3194
|
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== "motion" || uses.includes("motion") : e.kind !== "motion") && (!uses || e.uses.some((u) => uses.includes(u)));
|
|
3076
|
-
const categories = (0,
|
|
3195
|
+
const categories = (0, import_react17.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
3077
3196
|
const shown = found.filter(allowed);
|
|
3078
3197
|
if (!provider)
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
3080
|
-
return /* @__PURE__ */ (0,
|
|
3081
|
-
title && /* @__PURE__ */ (0,
|
|
3082
|
-
/* @__PURE__ */ (0,
|
|
3083
|
-
/* @__PURE__ */ (0,
|
|
3198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.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." });
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
3200
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
3202
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3084
3203
|
"input",
|
|
3085
3204
|
{
|
|
3086
3205
|
type: "search",
|
|
@@ -3091,17 +3210,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3091
3210
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
3092
3211
|
}
|
|
3093
3212
|
),
|
|
3094
|
-
/* @__PURE__ */ (0,
|
|
3095
|
-
/* @__PURE__ */ (0,
|
|
3096
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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: [
|
|
3214
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "All categories" }),
|
|
3215
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: c, children: c }, c))
|
|
3097
3216
|
] }),
|
|
3098
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
3099
|
-
/* @__PURE__ */ (0,
|
|
3100
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
3217
|
+
uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.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: [
|
|
3218
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Any use" }),
|
|
3219
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
3101
3220
|
] })
|
|
3102
3221
|
] }),
|
|
3103
|
-
error && /* @__PURE__ */ (0,
|
|
3104
|
-
/* @__PURE__ */ (0,
|
|
3222
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
3223
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3105
3224
|
"button",
|
|
3106
3225
|
{
|
|
3107
3226
|
type: "button",
|
|
@@ -3110,25 +3229,25 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3110
3229
|
"data-effect-id": e.id,
|
|
3111
3230
|
onClick: () => onPick(e),
|
|
3112
3231
|
children: [
|
|
3113
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
3114
|
-
/* @__PURE__ */ (0,
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3232
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
3234
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
|
|
3116
3235
|
]
|
|
3117
3236
|
}
|
|
3118
3237
|
) }, e.id)) }),
|
|
3119
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
3238
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
3120
3239
|
] });
|
|
3121
3240
|
}
|
|
3122
3241
|
|
|
3123
3242
|
// src/effects/EffectParameters.tsx
|
|
3124
|
-
var
|
|
3243
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
3125
3244
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
3126
3245
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
3127
3246
|
|
|
3128
3247
|
// src/parameters/fields.tsx
|
|
3129
|
-
var
|
|
3248
|
+
var import_react18 = require("react");
|
|
3130
3249
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
3131
|
-
var
|
|
3250
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3132
3251
|
var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
3133
3252
|
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";
|
|
3134
3253
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
@@ -3152,7 +3271,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3152
3271
|
onKeyDown: keyDown,
|
|
3153
3272
|
...rest
|
|
3154
3273
|
};
|
|
3155
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
3274
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "text", ...props }, value);
|
|
3156
3275
|
}
|
|
3157
3276
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
3158
3277
|
function ParameterNumberInput({
|
|
@@ -3163,8 +3282,8 @@ function ParameterNumberInput({
|
|
|
3163
3282
|
id,
|
|
3164
3283
|
"aria-label": ariaLabel
|
|
3165
3284
|
}) {
|
|
3166
|
-
return /* @__PURE__ */ (0,
|
|
3167
|
-
/* @__PURE__ */ (0,
|
|
3285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3168
3287
|
ParameterCommitInput,
|
|
3169
3288
|
{
|
|
3170
3289
|
id,
|
|
@@ -3186,21 +3305,21 @@ function ParameterNumberInput({
|
|
|
3186
3305
|
}
|
|
3187
3306
|
}
|
|
3188
3307
|
),
|
|
3189
|
-
field.unit && /* @__PURE__ */ (0,
|
|
3308
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
3190
3309
|
] });
|
|
3191
3310
|
}
|
|
3192
3311
|
function ParameterSlider(props) {
|
|
3193
3312
|
const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
|
|
3194
|
-
const dragging = (0,
|
|
3313
|
+
const dragging = (0, import_react18.useRef)(false);
|
|
3195
3314
|
const end = () => {
|
|
3196
3315
|
if (!dragging.current) return;
|
|
3197
3316
|
dragging.current = false;
|
|
3198
3317
|
onGestureEnd?.();
|
|
3199
3318
|
};
|
|
3200
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
3319
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterNumberInput, { ...props });
|
|
3201
3320
|
const step = (0, import_parameters.parameterStep)(field);
|
|
3202
|
-
return /* @__PURE__ */ (0,
|
|
3203
|
-
/* @__PURE__ */ (0,
|
|
3321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3204
3323
|
"input",
|
|
3205
3324
|
{
|
|
3206
3325
|
type: "range",
|
|
@@ -3223,11 +3342,11 @@ function ParameterSlider(props) {
|
|
|
3223
3342
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
3224
3343
|
}
|
|
3225
3344
|
),
|
|
3226
|
-
/* @__PURE__ */ (0,
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
3227
3346
|
] });
|
|
3228
3347
|
}
|
|
3229
3348
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
3230
|
-
return /* @__PURE__ */ (0,
|
|
3349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3231
3350
|
"button",
|
|
3232
3351
|
{
|
|
3233
3352
|
type: "button",
|
|
@@ -3238,7 +3357,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
3238
3357
|
disabled: disabled || field.readOnly,
|
|
3239
3358
|
onClick: () => onChange(!value),
|
|
3240
3359
|
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"}`,
|
|
3241
|
-
children: /* @__PURE__ */ (0,
|
|
3360
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3242
3361
|
"span",
|
|
3243
3362
|
{
|
|
3244
3363
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -3251,7 +3370,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3251
3370
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
3252
3371
|
const off = disabled || field.readOnly;
|
|
3253
3372
|
if (field.control === "segmented") {
|
|
3254
|
-
return /* @__PURE__ */ (0,
|
|
3373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(
|
|
3255
3374
|
"button",
|
|
3256
3375
|
{
|
|
3257
3376
|
type: "button",
|
|
@@ -3267,7 +3386,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3267
3386
|
)) });
|
|
3268
3387
|
}
|
|
3269
3388
|
const index = options.findIndex((o) => o.value === value);
|
|
3270
|
-
return /* @__PURE__ */ (0,
|
|
3389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3271
3390
|
"select",
|
|
3272
3391
|
{
|
|
3273
3392
|
id,
|
|
@@ -3279,12 +3398,12 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3279
3398
|
if (option) onChange(option.value);
|
|
3280
3399
|
},
|
|
3281
3400
|
className: parameterInputClass,
|
|
3282
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
3401
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
3283
3402
|
}
|
|
3284
3403
|
);
|
|
3285
3404
|
}
|
|
3286
3405
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
|
|
3287
|
-
const picking = (0,
|
|
3406
|
+
const picking = (0, import_react18.useRef)(false);
|
|
3288
3407
|
const alpha = !!field.alpha;
|
|
3289
3408
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
3290
3409
|
const rgb = hex.slice(0, 7);
|
|
@@ -3300,11 +3419,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3300
3419
|
picking.current = false;
|
|
3301
3420
|
onGestureEnd?.();
|
|
3302
3421
|
};
|
|
3303
|
-
return /* @__PURE__ */ (0,
|
|
3304
|
-
/* @__PURE__ */ (0,
|
|
3305
|
-
/* @__PURE__ */ (0,
|
|
3306
|
-
/* @__PURE__ */ (0,
|
|
3307
|
-
/* @__PURE__ */ (0,
|
|
3422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3424
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { 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]", children: [
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
|
|
3426
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3308
3427
|
"input",
|
|
3309
3428
|
{
|
|
3310
3429
|
type: "color",
|
|
@@ -3320,7 +3439,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3320
3439
|
}
|
|
3321
3440
|
)
|
|
3322
3441
|
] }),
|
|
3323
|
-
/* @__PURE__ */ (0,
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3324
3443
|
ParameterCommitInput,
|
|
3325
3444
|
{
|
|
3326
3445
|
id,
|
|
@@ -3336,7 +3455,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3336
3455
|
}
|
|
3337
3456
|
)
|
|
3338
3457
|
] }),
|
|
3339
|
-
alpha && /* @__PURE__ */ (0,
|
|
3458
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3340
3459
|
"input",
|
|
3341
3460
|
{
|
|
3342
3461
|
type: "range",
|
|
@@ -3354,10 +3473,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3354
3473
|
onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
|
|
3355
3474
|
}
|
|
3356
3475
|
),
|
|
3357
|
-
field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0,
|
|
3476
|
+
field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
|
|
3358
3477
|
const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
|
|
3359
3478
|
if (!swatch) return null;
|
|
3360
|
-
return /* @__PURE__ */ (0,
|
|
3479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3361
3480
|
"button",
|
|
3362
3481
|
{
|
|
3363
3482
|
type: "button",
|
|
@@ -3376,11 +3495,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3376
3495
|
}
|
|
3377
3496
|
function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
3378
3497
|
const size = (0, import_parameters.vectorSize)(field);
|
|
3379
|
-
return /* @__PURE__ */ (0,
|
|
3498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
3380
3499
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
3381
|
-
return /* @__PURE__ */ (0,
|
|
3382
|
-
/* @__PURE__ */ (0,
|
|
3383
|
-
/* @__PURE__ */ (0,
|
|
3500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3384
3503
|
ParameterNumberInput,
|
|
3385
3504
|
{
|
|
3386
3505
|
field: component,
|
|
@@ -3397,11 +3516,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
|
3397
3516
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
3398
3517
|
const off = disabled || field.readOnly;
|
|
3399
3518
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3400
|
-
return /* @__PURE__ */ (0,
|
|
3401
|
-
/* @__PURE__ */ (0,
|
|
3402
|
-
/* @__PURE__ */ (0,
|
|
3403
|
-
/* @__PURE__ */ (0,
|
|
3404
|
-
/* @__PURE__ */ (0,
|
|
3519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3405
3524
|
ParameterCommitInput,
|
|
3406
3525
|
{
|
|
3407
3526
|
id,
|
|
@@ -3412,10 +3531,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3412
3531
|
onCommit: (text) => onChange(text.trim())
|
|
3413
3532
|
}
|
|
3414
3533
|
),
|
|
3415
|
-
/* @__PURE__ */ (0,
|
|
3416
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1", children: [
|
|
3535
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
|
|
3417
3536
|
"Choose file\u2026",
|
|
3418
|
-
/* @__PURE__ */ (0,
|
|
3537
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3419
3538
|
"input",
|
|
3420
3539
|
{
|
|
3421
3540
|
type: "file",
|
|
@@ -3431,11 +3550,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3431
3550
|
}
|
|
3432
3551
|
)
|
|
3433
3552
|
] }),
|
|
3434
|
-
value && /* @__PURE__ */ (0,
|
|
3553
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
|
|
3435
3554
|
] })
|
|
3436
3555
|
] })
|
|
3437
3556
|
] }),
|
|
3438
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
3557
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3439
3558
|
"button",
|
|
3440
3559
|
{
|
|
3441
3560
|
type: "button",
|
|
@@ -3445,14 +3564,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3445
3564
|
disabled: off,
|
|
3446
3565
|
onClick: () => onChange(o.url),
|
|
3447
3566
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
3448
|
-
children: /* @__PURE__ */ (0,
|
|
3567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
3449
3568
|
},
|
|
3450
3569
|
o.url
|
|
3451
3570
|
)) })
|
|
3452
3571
|
] });
|
|
3453
3572
|
}
|
|
3454
3573
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
3455
|
-
return /* @__PURE__ */ (0,
|
|
3574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3456
3575
|
ParameterCommitInput,
|
|
3457
3576
|
{
|
|
3458
3577
|
id,
|
|
@@ -3471,31 +3590,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
3471
3590
|
switch (field.type) {
|
|
3472
3591
|
case "number":
|
|
3473
3592
|
case "int":
|
|
3474
|
-
return /* @__PURE__ */ (0,
|
|
3593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
3475
3594
|
case "boolean":
|
|
3476
|
-
return /* @__PURE__ */ (0,
|
|
3595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
3477
3596
|
case "choice":
|
|
3478
|
-
return /* @__PURE__ */ (0,
|
|
3597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
3479
3598
|
case "color":
|
|
3480
|
-
return /* @__PURE__ */ (0,
|
|
3599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
3481
3600
|
case "vector":
|
|
3482
|
-
return /* @__PURE__ */ (0,
|
|
3601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
3483
3602
|
case "image":
|
|
3484
|
-
return /* @__PURE__ */ (0,
|
|
3603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
3485
3604
|
case "text":
|
|
3486
|
-
return /* @__PURE__ */ (0,
|
|
3605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
3487
3606
|
}
|
|
3488
3607
|
}
|
|
3489
3608
|
|
|
3490
3609
|
// src/effects/EffectParameters.tsx
|
|
3491
|
-
var
|
|
3610
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3492
3611
|
function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
|
|
3493
|
-
const fields = (0,
|
|
3494
|
-
const idBase = (0,
|
|
3495
|
-
const gesture =
|
|
3496
|
-
const count =
|
|
3497
|
-
return /* @__PURE__ */ (0,
|
|
3498
|
-
onPreset && description.presets.length > 0 && /* @__PURE__ */ (0,
|
|
3612
|
+
const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
|
|
3613
|
+
const idBase = (0, import_react19.useId)();
|
|
3614
|
+
const gesture = import_react19.default.useRef(null);
|
|
3615
|
+
const count = import_react19.default.useRef(0);
|
|
3616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
3617
|
+
onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3499
3618
|
"select",
|
|
3500
3619
|
{
|
|
3501
3620
|
className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
|
|
@@ -3507,8 +3626,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
3507
3626
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
3508
3627
|
},
|
|
3509
3628
|
children: [
|
|
3510
|
-
/* @__PURE__ */ (0,
|
|
3511
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
3629
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
3630
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: p.name, children: p.name }, p.name))
|
|
3512
3631
|
]
|
|
3513
3632
|
}
|
|
3514
3633
|
),
|
|
@@ -3518,13 +3637,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
3518
3637
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
3519
3638
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
3520
3639
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
3521
|
-
return /* @__PURE__ */ (0,
|
|
3522
|
-
/* @__PURE__ */ (0,
|
|
3523
|
-
/* @__PURE__ */ (0,
|
|
3524
|
-
keyed && /* @__PURE__ */ (0,
|
|
3525
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
3640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
3643
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
3644
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime25.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" })
|
|
3526
3645
|
] }),
|
|
3527
|
-
/* @__PURE__ */ (0,
|
|
3646
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3528
3647
|
ParameterFieldControl,
|
|
3529
3648
|
{
|
|
3530
3649
|
field,
|
|
@@ -3538,25 +3657,25 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
|
|
|
3538
3657
|
)
|
|
3539
3658
|
] }, field.id);
|
|
3540
3659
|
}),
|
|
3541
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
3660
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
3542
3661
|
] });
|
|
3543
3662
|
}
|
|
3544
3663
|
|
|
3545
3664
|
// src/vector/VectorProviderEffectsPanel.tsx
|
|
3546
|
-
var
|
|
3547
|
-
var
|
|
3665
|
+
var import_react20 = require("react");
|
|
3666
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3548
3667
|
var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
|
|
3549
3668
|
function Controls({ controller, group }) {
|
|
3550
3669
|
const provider = controller.effectsProvider;
|
|
3551
3670
|
const tag = group.providerEffect;
|
|
3552
3671
|
const { description, error } = useEffectDescription(provider, tag.effect);
|
|
3553
|
-
const [message, setMessage] = (0,
|
|
3672
|
+
const [message, setMessage] = (0, import_react20.useState)(null);
|
|
3554
3673
|
const run = (work) => void work.then(() => setMessage(null), (e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
3555
|
-
if (!provider) return /* @__PURE__ */ (0,
|
|
3556
|
-
if (error) return /* @__PURE__ */ (0,
|
|
3557
|
-
if (!description) return /* @__PURE__ */ (0,
|
|
3558
|
-
return /* @__PURE__ */ (0,
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
3674
|
+
if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: the shapes are kept as they are." });
|
|
3675
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
|
|
3676
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
3677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3560
3679
|
EffectParameters,
|
|
3561
3680
|
{
|
|
3562
3681
|
description,
|
|
@@ -3566,18 +3685,18 @@ function Controls({ controller, group }) {
|
|
|
3566
3685
|
onPreset: (v) => run(controller.updateVectorEffect(group.id, v))
|
|
3567
3686
|
}
|
|
3568
3687
|
),
|
|
3569
|
-
message && /* @__PURE__ */ (0,
|
|
3688
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
3570
3689
|
] });
|
|
3571
3690
|
}
|
|
3572
3691
|
function VectorProviderEffectsPanel({ controller, className = "" }) {
|
|
3573
3692
|
const state = useVectorEditorState(controller);
|
|
3574
|
-
const provider = (0,
|
|
3693
|
+
const provider = (0, import_react20.useSyncExternalStore)(
|
|
3575
3694
|
(cb) => controller.effects.subscribe(cb),
|
|
3576
3695
|
() => controller.effects.provider,
|
|
3577
3696
|
() => controller.effects.provider
|
|
3578
3697
|
);
|
|
3579
|
-
const [browse, setBrowse] = (0,
|
|
3580
|
-
const [message, setMessage] = (0,
|
|
3698
|
+
const [browse, setBrowse] = (0, import_react20.useState)(false);
|
|
3699
|
+
const [message, setMessage] = (0, import_react20.useState)(null);
|
|
3581
3700
|
void state;
|
|
3582
3701
|
const groups = controller.vectorEffectGroups();
|
|
3583
3702
|
const selected = groups.filter((g) => state.selection.includes(g.id));
|
|
@@ -3585,60 +3704,60 @@ function VectorProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3585
3704
|
setMessage(null);
|
|
3586
3705
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
3587
3706
|
};
|
|
3588
|
-
return /* @__PURE__ */ (0,
|
|
3589
|
-
/* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
/* @__PURE__ */ (0,
|
|
3707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Vector effects", "data-vector-provider-effects": "", children: [
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3709
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
|
|
3710
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse, onClick: () => setBrowse(!browse), children: "Add effect\u2026" })
|
|
3592
3711
|
] }),
|
|
3593
|
-
!provider && /* @__PURE__ */ (0,
|
|
3594
|
-
browse && /* @__PURE__ */ (0,
|
|
3595
|
-
selected.map((g) => /* @__PURE__ */ (0,
|
|
3596
|
-
/* @__PURE__ */ (0,
|
|
3597
|
-
/* @__PURE__ */ (0,
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
3712
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effect groups are kept as shapes." }),
|
|
3713
|
+
browse && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(false), run(() => controller.addVectorEffect(e.id))) }),
|
|
3714
|
+
selected.map((g) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-effect-group": g.id, children: [
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.providerEffect.name ?? g.providerEffect.effect }),
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn, title: "Keep the shapes as a plain group", onClick: () => run(() => controller.detachVectorEffect(g.id)), children: "Detach" })
|
|
3599
3718
|
] }),
|
|
3600
|
-
/* @__PURE__ */ (0,
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Controls, { controller, group: g })
|
|
3601
3720
|
] }, g.id)),
|
|
3602
|
-
groups.length > 0 && !selected.length && /* @__PURE__ */ (0,
|
|
3721
|
+
groups.length > 0 && !selected.length && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
3603
3722
|
"Select an effect group (",
|
|
3604
3723
|
groups.length,
|
|
3605
3724
|
" in the drawing) to change it."
|
|
3606
3725
|
] }),
|
|
3607
|
-
message && /* @__PURE__ */ (0,
|
|
3726
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
3608
3727
|
] });
|
|
3609
3728
|
}
|
|
3610
3729
|
|
|
3611
3730
|
// src/vector/VectorEditor.tsx
|
|
3612
|
-
var
|
|
3731
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3613
3732
|
function VectorEditor({ controller, tools, showStylePanel = true, height = 520, canvasProps, effects, className }) {
|
|
3614
3733
|
useEffects(controller, effects);
|
|
3615
3734
|
const effectsShown = !!effects || controller.vectorEffectGroups().length > 0;
|
|
3616
|
-
return /* @__PURE__ */ (0,
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3620
|
-
showStylePanel && /* @__PURE__ */ (0,
|
|
3621
|
-
/* @__PURE__ */ (0,
|
|
3622
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
3735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-col gap-2 ${className ?? ""}`, "data-vector-editor": "", children: [
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VectorToolbar, { controller, tools }),
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-h-0 flex-col gap-2 md:flex-row", children: [
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)(VectorCanvas, { controller, ...canvasProps }) }),
|
|
3739
|
+
showStylePanel && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full shrink-0 flex-col gap-2 md:w-56", children: [
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VectorStylePanel, { controller, className: "rounded-md border border-border p-3" }),
|
|
3741
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VectorProviderEffectsPanel, { controller, className: "rounded-md border border-border p-3" })
|
|
3623
3742
|
] })
|
|
3624
3743
|
] })
|
|
3625
3744
|
] });
|
|
3626
3745
|
}
|
|
3627
3746
|
|
|
3628
3747
|
// src/vector/VectorGeneratePanel.tsx
|
|
3629
|
-
var
|
|
3748
|
+
var import_react21 = require("react");
|
|
3630
3749
|
var import_vector21 = require("@pixerate/editor/vector");
|
|
3631
|
-
var
|
|
3750
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3632
3751
|
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";
|
|
3633
3752
|
var selectClass15 = "h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs";
|
|
3634
3753
|
var AS_LABELS = { color: "Traced in colour", threshold: "Traced in one colour", mosaic: "Mosaic", halftone: "Halftone", lowPoly: "Low poly", hatch: "Engraving" };
|
|
3635
3754
|
function VectorGeneratePanel({ controller, models, generate, className }) {
|
|
3636
3755
|
const usable = (0, import_vector21.vectorArtModels)(models);
|
|
3637
|
-
const [prompt, setPrompt] = (0,
|
|
3638
|
-
const [model, setModel] = (0,
|
|
3639
|
-
const [as, setAs] = (0,
|
|
3640
|
-
const [busy, setBusy] = (0,
|
|
3641
|
-
const [message, setMessage] = (0,
|
|
3756
|
+
const [prompt, setPrompt] = (0, import_react21.useState)("");
|
|
3757
|
+
const [model, setModel] = (0, import_react21.useState)("");
|
|
3758
|
+
const [as, setAs] = (0, import_react21.useState)("color");
|
|
3759
|
+
const [busy, setBusy] = (0, import_react21.useState)(false);
|
|
3760
|
+
const [message, setMessage] = (0, import_react21.useState)(null);
|
|
3642
3761
|
const chosen = usable.find((m) => m.id === model) ?? usable[0];
|
|
3643
3762
|
if (!usable.length) return null;
|
|
3644
3763
|
const run = async () => {
|
|
@@ -3648,18 +3767,18 @@ function VectorGeneratePanel({ controller, models, generate, className }) {
|
|
|
3648
3767
|
setBusy(false);
|
|
3649
3768
|
setMessage(r.ok ? null : r.message ?? "Generation failed.");
|
|
3650
3769
|
};
|
|
3651
|
-
return /* @__PURE__ */ (0,
|
|
3652
|
-
/* @__PURE__ */ (0,
|
|
3653
|
-
/* @__PURE__ */ (0,
|
|
3654
|
-
/* @__PURE__ */ (0,
|
|
3655
|
-
chosen.media === "image" && /* @__PURE__ */ (0,
|
|
3770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `space-y-1 ${className ?? ""}`, "data-vector-generate-panel": "", "aria-label": "Generate", children: [
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3772
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-16 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Generate" }),
|
|
3773
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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_runtime28.jsx)("option", { value: m.id, children: m.name ?? m.id }, m.id)) }),
|
|
3774
|
+
chosen.media === "image" && /* @__PURE__ */ (0, import_jsx_runtime28.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_runtime28.jsx)("option", { value: a, children: AS_LABELS[a] }, a)) })
|
|
3656
3775
|
] }),
|
|
3657
|
-
/* @__PURE__ */ (0,
|
|
3658
|
-
/* @__PURE__ */ (0,
|
|
3659
|
-
/* @__PURE__ */ (0,
|
|
3660
|
-
/* @__PURE__ */ (0,
|
|
3776
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-16" }),
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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() }),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: buttonClass17, "data-vector-generate-action": "", disabled: !prompt.trim() || busy, onClick: () => void run(), children: busy ? "Generating\u2026" : "Generate" })
|
|
3661
3780
|
] }),
|
|
3662
|
-
message && /* @__PURE__ */ (0,
|
|
3781
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-red-600", children: message })
|
|
3663
3782
|
] });
|
|
3664
3783
|
}
|
|
3665
3784
|
// Annotate the CommonJS export names for ESM import in node:
|