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