@pixerate/editor-react 0.176.0 → 0.178.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/index.cjs +6 -1
- package/dist/canvas/index.js +6 -1
- package/dist/canvas/useCanvasDraw.d.cts +9 -0
- package/dist/canvas/useCanvasDraw.d.ts +9 -0
- package/dist/paint-editor/PathStrokePanel.d.cts +12 -0
- package/dist/paint-editor/PathStrokePanel.d.ts +12 -0
- package/dist/paint-editor/index.cjs +351 -317
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +119 -86
- package/package.json +3 -3
|
@@ -45,6 +45,7 @@ __export(paint_editor_exports, {
|
|
|
45
45
|
PaintSlider: () => PaintSlider,
|
|
46
46
|
PaintToolbar: () => PaintToolbar,
|
|
47
47
|
PaperPanel: () => PaperPanel,
|
|
48
|
+
PathStrokePanel: () => PathStrokePanel,
|
|
48
49
|
StickerPanel: () => StickerPanel,
|
|
49
50
|
StickerPicker: () => StickerPicker,
|
|
50
51
|
StrokePanel: () => StrokePanel,
|
|
@@ -1927,29 +1928,60 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1927
1928
|
] });
|
|
1928
1929
|
};
|
|
1929
1930
|
|
|
1931
|
+
// src/paint-editor/PathStrokePanel.tsx
|
|
1932
|
+
var import_react16 = require("react");
|
|
1933
|
+
var import_paint_editor13 = require("@pixerate/editor/paint-editor");
|
|
1934
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1935
|
+
var PathStrokePanel = ({ controller, className }) => {
|
|
1936
|
+
const state = usePaintEditorState(controller);
|
|
1937
|
+
const [error, attempt] = useAttempt();
|
|
1938
|
+
const [path, setPath] = (0, import_react16.useState)("");
|
|
1939
|
+
const [taper, setTaper] = (0, import_react16.useState)(import_paint_editor13.PATH_STROKE_TAPERS[0].id);
|
|
1940
|
+
const pressure = import_paint_editor13.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
|
|
1941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1944
|
+
"textarea",
|
|
1945
|
+
{
|
|
1946
|
+
"aria-label": "SVG path data",
|
|
1947
|
+
placeholder: "M 40 200 C 120 40 280 40 360 200",
|
|
1948
|
+
value: path,
|
|
1949
|
+
onChange: (e) => setPath(e.target.value),
|
|
1950
|
+
rows: 2,
|
|
1951
|
+
className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
|
|
1952
|
+
}
|
|
1953
|
+
),
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor13.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
|
|
1956
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
|
|
1957
|
+
] }),
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
|
|
1959
|
+
] });
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1930
1962
|
// src/paint-editor/PaintEditor.tsx
|
|
1931
|
-
var
|
|
1932
|
-
var
|
|
1963
|
+
var import_react30 = require("react");
|
|
1964
|
+
var import_paint_editor15 = require("@pixerate/editor/paint-editor");
|
|
1933
1965
|
|
|
1934
1966
|
// src/playback/AgentPlaybackContext.tsx
|
|
1935
|
-
var
|
|
1936
|
-
var
|
|
1937
|
-
var AgentPlaybackContext = (0,
|
|
1967
|
+
var import_react17 = require("react");
|
|
1968
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1969
|
+
var AgentPlaybackContext = (0, import_react17.createContext)(null);
|
|
1938
1970
|
function useAgentPlayback() {
|
|
1939
|
-
return (0,
|
|
1971
|
+
return (0, import_react17.useContext)(AgentPlaybackContext);
|
|
1940
1972
|
}
|
|
1941
1973
|
|
|
1942
1974
|
// src/playback/usePlaybackSurface.ts
|
|
1943
|
-
var
|
|
1975
|
+
var import_react18 = require("react");
|
|
1944
1976
|
var import_tools = require("@pixerate/editor/tools");
|
|
1945
1977
|
function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
1946
1978
|
const ambient = useAgentPlayback();
|
|
1947
1979
|
const target = playback === void 0 ? ambient : playback;
|
|
1948
|
-
const [ownPresence] = (0,
|
|
1980
|
+
const [ownPresence] = (0, import_react18.useState)(() => new import_tools.PresenceStore());
|
|
1949
1981
|
const presence = sharedPresence ?? ownPresence;
|
|
1950
|
-
const latest = (0,
|
|
1982
|
+
const latest = (0, import_react18.useRef)(options);
|
|
1951
1983
|
latest.current = options;
|
|
1952
|
-
(0,
|
|
1984
|
+
(0, import_react18.useEffect)(() => {
|
|
1953
1985
|
if (!target || !id) return;
|
|
1954
1986
|
const o = () => latest.current;
|
|
1955
1987
|
const surface = {
|
|
@@ -1981,13 +2013,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
1981
2013
|
}
|
|
1982
2014
|
|
|
1983
2015
|
// src/playback/PresenceLayer.tsx
|
|
1984
|
-
var
|
|
1985
|
-
var
|
|
2016
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
2017
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1986
2018
|
function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
|
|
1987
|
-
const { actors } = (0,
|
|
2019
|
+
const { actors } = (0, import_react19.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
1988
2020
|
if (!actors.length) return null;
|
|
1989
2021
|
const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
|
|
1990
|
-
return /* @__PURE__ */ (0,
|
|
2022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1991
2023
|
"div",
|
|
1992
2024
|
{
|
|
1993
2025
|
className: `pixerate-presence ${className}`.trim(),
|
|
@@ -2001,19 +2033,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
|
|
|
2001
2033
|
const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
|
|
2002
2034
|
return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
|
|
2003
2035
|
})();
|
|
2004
|
-
return /* @__PURE__ */ (0,
|
|
2005
|
-
ring && /* @__PURE__ */ (0,
|
|
2036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react19.default.Fragment, { children: [
|
|
2037
|
+
ring && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2006
2038
|
"div",
|
|
2007
2039
|
{
|
|
2008
2040
|
"data-actor-focus": a.id,
|
|
2009
2041
|
style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
|
|
2010
2042
|
}
|
|
2011
2043
|
),
|
|
2012
|
-
/* @__PURE__ */ (0,
|
|
2013
|
-
/* @__PURE__ */ (0,
|
|
2014
|
-
/* @__PURE__ */ (0,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2016
|
-
a.message && /* @__PURE__ */ (0,
|
|
2044
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.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 } }) }),
|
|
2046
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
|
|
2048
|
+
a.message && /* @__PURE__ */ (0, import_jsx_runtime21.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 })
|
|
2017
2049
|
] })
|
|
2018
2050
|
] }) })
|
|
2019
2051
|
] }, a.id);
|
|
@@ -2023,15 +2055,15 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
|
|
|
2023
2055
|
}
|
|
2024
2056
|
|
|
2025
2057
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
2026
|
-
var
|
|
2027
|
-
var
|
|
2058
|
+
var import_react29 = require("react");
|
|
2059
|
+
var import_paint_editor14 = require("@pixerate/editor/paint-editor");
|
|
2028
2060
|
|
|
2029
2061
|
// src/effects/useEffects.ts
|
|
2030
|
-
var
|
|
2062
|
+
var import_react20 = require("react");
|
|
2031
2063
|
function useEffectDescription(provider, effect) {
|
|
2032
|
-
const [state, setState] = (0,
|
|
2064
|
+
const [state, setState] = (0, import_react20.useState)({ key: "", description: null, error: null });
|
|
2033
2065
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
2034
|
-
(0,
|
|
2066
|
+
(0, import_react20.useEffect)(() => {
|
|
2035
2067
|
if (!provider || !effect) return;
|
|
2036
2068
|
let live = true;
|
|
2037
2069
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -2046,14 +2078,14 @@ function useEffectDescription(provider, effect) {
|
|
|
2046
2078
|
}
|
|
2047
2079
|
|
|
2048
2080
|
// src/effects/EffectThumbnail.tsx
|
|
2049
|
-
var
|
|
2081
|
+
var import_react21 = require("react");
|
|
2050
2082
|
var import_effects = require("@pixerate/editor/effects");
|
|
2051
|
-
var
|
|
2083
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2052
2084
|
var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
|
|
2053
2085
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
2054
|
-
const ref = (0,
|
|
2055
|
-
const [failed, setFailed] = (0,
|
|
2056
|
-
(0,
|
|
2086
|
+
const ref = (0, import_react21.useRef)(null);
|
|
2087
|
+
const [failed, setFailed] = (0, import_react21.useState)(effect.kind in LABELS);
|
|
2088
|
+
(0, import_react21.useEffect)(() => {
|
|
2057
2089
|
if (effect.kind in LABELS) return;
|
|
2058
2090
|
let live = true;
|
|
2059
2091
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -2068,28 +2100,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
2068
2100
|
live = false;
|
|
2069
2101
|
};
|
|
2070
2102
|
}, [provider, effect, width, height]);
|
|
2071
|
-
return /* @__PURE__ */ (0,
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2072
2104
|
"div",
|
|
2073
2105
|
{
|
|
2074
2106
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
2075
2107
|
style: { aspectRatio: `${width} / ${height}` },
|
|
2076
2108
|
"data-effect-thumbnail": effect.id,
|
|
2077
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
2109
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
2078
2110
|
}
|
|
2079
2111
|
);
|
|
2080
2112
|
}
|
|
2081
2113
|
|
|
2082
2114
|
// src/effects/EffectsBrowser.tsx
|
|
2083
|
-
var
|
|
2115
|
+
var import_react22 = require("react");
|
|
2084
2116
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
2085
|
-
var
|
|
2117
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2086
2118
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
2087
|
-
const [all, setAll] = (0,
|
|
2088
|
-
const [query, setQuery] = (0,
|
|
2089
|
-
const [category, setCategory] = (0,
|
|
2090
|
-
const [use, setUse] = (0,
|
|
2091
|
-
const [error, setError] = (0,
|
|
2092
|
-
(0,
|
|
2119
|
+
const [all, setAll] = (0, import_react22.useState)([]);
|
|
2120
|
+
const [query, setQuery] = (0, import_react22.useState)("");
|
|
2121
|
+
const [category, setCategory] = (0, import_react22.useState)("");
|
|
2122
|
+
const [use, setUse] = (0, import_react22.useState)("");
|
|
2123
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
2124
|
+
(0, import_react22.useEffect)(() => {
|
|
2093
2125
|
if (!provider) return setAll([]);
|
|
2094
2126
|
let live = true;
|
|
2095
2127
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -2100,8 +2132,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2100
2132
|
live = false;
|
|
2101
2133
|
};
|
|
2102
2134
|
}, [provider]);
|
|
2103
|
-
const [found, setFound] = (0,
|
|
2104
|
-
(0,
|
|
2135
|
+
const [found, setFound] = (0, import_react22.useState)([]);
|
|
2136
|
+
(0, import_react22.useEffect)(() => {
|
|
2105
2137
|
if (!provider) return setFound([]);
|
|
2106
2138
|
let live = true;
|
|
2107
2139
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -2110,14 +2142,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2110
2142
|
};
|
|
2111
2143
|
}, [provider, query, category, use]);
|
|
2112
2144
|
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
2113
|
-
const categories = (0,
|
|
2145
|
+
const categories = (0, import_react22.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
2114
2146
|
const shown = found.filter(allowed);
|
|
2115
2147
|
if (!provider)
|
|
2116
|
-
return /* @__PURE__ */ (0,
|
|
2117
|
-
return /* @__PURE__ */ (0,
|
|
2118
|
-
title && /* @__PURE__ */ (0,
|
|
2119
|
-
/* @__PURE__ */ (0,
|
|
2120
|
-
/* @__PURE__ */ (0,
|
|
2148
|
+
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." });
|
|
2149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
2150
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2121
2153
|
"input",
|
|
2122
2154
|
{
|
|
2123
2155
|
type: "search",
|
|
@@ -2128,17 +2160,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2128
2160
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
2129
2161
|
}
|
|
2130
2162
|
),
|
|
2131
|
-
/* @__PURE__ */ (0,
|
|
2132
|
-
/* @__PURE__ */ (0,
|
|
2133
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
2163
|
+
/* @__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: [
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "All categories" }),
|
|
2165
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: c, children: c }, c))
|
|
2134
2166
|
] }),
|
|
2135
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
2136
|
-
/* @__PURE__ */ (0,
|
|
2137
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
2167
|
+
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: [
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Any use" }),
|
|
2169
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
2138
2170
|
] })
|
|
2139
2171
|
] }),
|
|
2140
|
-
error && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2172
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
2173
|
+
/* @__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)(
|
|
2142
2174
|
"button",
|
|
2143
2175
|
{
|
|
2144
2176
|
type: "button",
|
|
@@ -2147,23 +2179,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2147
2179
|
"data-effect-id": e.id,
|
|
2148
2180
|
onClick: () => onPick(e),
|
|
2149
2181
|
children: [
|
|
2150
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2182
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
2184
|
+
/* @__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 ") })
|
|
2153
2185
|
]
|
|
2154
2186
|
}
|
|
2155
2187
|
) }, e.id)) }),
|
|
2156
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
2188
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
2157
2189
|
] });
|
|
2158
2190
|
}
|
|
2159
2191
|
|
|
2160
2192
|
// src/effects/EffectParameters.tsx
|
|
2161
|
-
var
|
|
2193
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
2162
2194
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
2163
2195
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
2164
2196
|
|
|
2165
2197
|
// src/parameters/fields.tsx
|
|
2166
|
-
var
|
|
2198
|
+
var import_react27 = require("react");
|
|
2167
2199
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
2168
2200
|
|
|
2169
2201
|
// src/color/index.ts
|
|
@@ -2176,9 +2208,9 @@ __export(color_exports, {
|
|
|
2176
2208
|
});
|
|
2177
2209
|
|
|
2178
2210
|
// src/color/ColorPicker.tsx
|
|
2179
|
-
var
|
|
2211
|
+
var import_react23 = require("react");
|
|
2180
2212
|
var import_color = require("@pixerate/editor/color");
|
|
2181
|
-
var
|
|
2213
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2182
2214
|
var LOCAL_STORAGE_KEY = "pixerate:color:recent";
|
|
2183
2215
|
function readLocalRecents() {
|
|
2184
2216
|
try {
|
|
@@ -2216,24 +2248,24 @@ var ColorPicker = ({
|
|
|
2216
2248
|
id,
|
|
2217
2249
|
"aria-label": ariaLabel = "Color picker"
|
|
2218
2250
|
}) => {
|
|
2219
|
-
const generatedId = (0,
|
|
2251
|
+
const generatedId = (0, import_react23.useId)();
|
|
2220
2252
|
const pickerId = id || generatedId;
|
|
2221
|
-
const [pickerState, setPickerState] = (0,
|
|
2253
|
+
const [pickerState, setPickerState] = (0, import_react23.useState)(
|
|
2222
2254
|
() => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
|
|
2223
2255
|
);
|
|
2224
|
-
const stateRef = (0,
|
|
2256
|
+
const stateRef = (0, import_react23.useRef)(pickerState);
|
|
2225
2257
|
stateRef.current = pickerState;
|
|
2226
|
-
(0,
|
|
2258
|
+
(0, import_react23.useEffect)(() => {
|
|
2227
2259
|
const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
|
|
2228
2260
|
if (next) {
|
|
2229
2261
|
setPickerState(next);
|
|
2230
2262
|
}
|
|
2231
2263
|
}, [value]);
|
|
2232
|
-
const [internalRecent, setInternalRecent] = (0,
|
|
2264
|
+
const [internalRecent, setInternalRecent] = (0, import_react23.useState)(
|
|
2233
2265
|
() => controlledRecent ? [] : readLocalRecents()
|
|
2234
2266
|
);
|
|
2235
2267
|
const activeRecent = controlledRecent ?? internalRecent;
|
|
2236
|
-
const recordRecent = (0,
|
|
2268
|
+
const recordRecent = (0, import_react23.useCallback)(
|
|
2237
2269
|
(color) => {
|
|
2238
2270
|
const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
|
|
2239
2271
|
if (!controlledRecent) {
|
|
@@ -2244,11 +2276,11 @@ var ColorPicker = ({
|
|
|
2244
2276
|
},
|
|
2245
2277
|
[activeRecent, controlledRecent, onRecentChange]
|
|
2246
2278
|
);
|
|
2247
|
-
const [textDraft, setTextDraft] = (0,
|
|
2248
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
2249
|
-
const [isClipped, setIsClipped] = (0,
|
|
2250
|
-
const isTypingRef = (0,
|
|
2251
|
-
(0,
|
|
2279
|
+
const [textDraft, setTextDraft] = (0, import_react23.useState)(value);
|
|
2280
|
+
const [isInvalid, setIsInvalid] = (0, import_react23.useState)(false);
|
|
2281
|
+
const [isClipped, setIsClipped] = (0, import_react23.useState)(false);
|
|
2282
|
+
const isTypingRef = (0, import_react23.useRef)(false);
|
|
2283
|
+
(0, import_react23.useEffect)(() => {
|
|
2252
2284
|
if (!isTypingRef.current) {
|
|
2253
2285
|
setTextDraft(value);
|
|
2254
2286
|
setIsInvalid(false);
|
|
@@ -2256,11 +2288,11 @@ var ColorPicker = ({
|
|
|
2256
2288
|
setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
|
|
2257
2289
|
}
|
|
2258
2290
|
}, [value]);
|
|
2259
|
-
const [hasEyeDropper, setHasEyeDropper] = (0,
|
|
2260
|
-
(0,
|
|
2291
|
+
const [hasEyeDropper, setHasEyeDropper] = (0, import_react23.useState)(false);
|
|
2292
|
+
(0, import_react23.useEffect)(() => {
|
|
2261
2293
|
setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
|
|
2262
2294
|
}, []);
|
|
2263
|
-
const emitColorChange = (0,
|
|
2295
|
+
const emitColorChange = (0, import_react23.useCallback)(
|
|
2264
2296
|
(nextState) => {
|
|
2265
2297
|
setPickerState(nextState);
|
|
2266
2298
|
const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
|
|
@@ -2268,10 +2300,10 @@ var ColorPicker = ({
|
|
|
2268
2300
|
},
|
|
2269
2301
|
[alpha, onChange]
|
|
2270
2302
|
);
|
|
2271
|
-
const latest = (0,
|
|
2303
|
+
const latest = (0, import_react23.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
|
|
2272
2304
|
latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
|
|
2273
|
-
const endDragRef = (0,
|
|
2274
|
-
(0,
|
|
2305
|
+
const endDragRef = (0, import_react23.useRef)(null);
|
|
2306
|
+
(0, import_react23.useEffect)(() => () => endDragRef.current?.(), []);
|
|
2275
2307
|
const startDrag = (e, next) => {
|
|
2276
2308
|
if (disabled) return;
|
|
2277
2309
|
e.preventDefault();
|
|
@@ -2373,7 +2405,7 @@ var ColorPicker = ({
|
|
|
2373
2405
|
} catch {
|
|
2374
2406
|
}
|
|
2375
2407
|
};
|
|
2376
|
-
const contrastResult = (0,
|
|
2408
|
+
const contrastResult = (0, import_react23.useMemo)(() => {
|
|
2377
2409
|
if (!contrastAgainst) return null;
|
|
2378
2410
|
const fg = (0, import_color.parseColor)(value);
|
|
2379
2411
|
const bg = (0, import_color.parseColor)(contrastAgainst);
|
|
@@ -2385,7 +2417,7 @@ var ColorPicker = ({
|
|
|
2385
2417
|
}, [value, contrastAgainst]);
|
|
2386
2418
|
const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
|
|
2387
2419
|
const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
|
|
2388
|
-
return /* @__PURE__ */ (0,
|
|
2420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2389
2421
|
"div",
|
|
2390
2422
|
{
|
|
2391
2423
|
id: pickerId,
|
|
@@ -2409,7 +2441,7 @@ var ColorPicker = ({
|
|
|
2409
2441
|
pointerEvents: disabled ? "none" : "auto"
|
|
2410
2442
|
},
|
|
2411
2443
|
children: [
|
|
2412
|
-
/* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2413
2445
|
"span",
|
|
2414
2446
|
{
|
|
2415
2447
|
role: "status",
|
|
@@ -2428,7 +2460,7 @@ var ColorPicker = ({
|
|
|
2428
2460
|
children: liveDescription
|
|
2429
2461
|
}
|
|
2430
2462
|
),
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2432
2464
|
"div",
|
|
2433
2465
|
{
|
|
2434
2466
|
role: "slider",
|
|
@@ -2450,7 +2482,7 @@ var ColorPicker = ({
|
|
|
2450
2482
|
touchAction: "none",
|
|
2451
2483
|
outline: "none"
|
|
2452
2484
|
},
|
|
2453
|
-
children: /* @__PURE__ */ (0,
|
|
2485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2454
2486
|
"div",
|
|
2455
2487
|
{
|
|
2456
2488
|
style: {
|
|
@@ -2470,7 +2502,7 @@ var ColorPicker = ({
|
|
|
2470
2502
|
)
|
|
2471
2503
|
}
|
|
2472
2504
|
),
|
|
2473
|
-
/* @__PURE__ */ (0,
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2474
2506
|
"div",
|
|
2475
2507
|
{
|
|
2476
2508
|
role: "slider",
|
|
@@ -2493,7 +2525,7 @@ var ColorPicker = ({
|
|
|
2493
2525
|
touchAction: "none",
|
|
2494
2526
|
outline: "none"
|
|
2495
2527
|
},
|
|
2496
|
-
children: /* @__PURE__ */ (0,
|
|
2528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2497
2529
|
"div",
|
|
2498
2530
|
{
|
|
2499
2531
|
style: {
|
|
@@ -2513,7 +2545,7 @@ var ColorPicker = ({
|
|
|
2513
2545
|
)
|
|
2514
2546
|
}
|
|
2515
2547
|
),
|
|
2516
|
-
alpha && /* @__PURE__ */ (0,
|
|
2548
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2517
2549
|
"div",
|
|
2518
2550
|
{
|
|
2519
2551
|
role: "slider",
|
|
@@ -2539,7 +2571,7 @@ var ColorPicker = ({
|
|
|
2539
2571
|
overflow: "hidden"
|
|
2540
2572
|
},
|
|
2541
2573
|
children: [
|
|
2542
|
-
/* @__PURE__ */ (0,
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2543
2575
|
"div",
|
|
2544
2576
|
{
|
|
2545
2577
|
style: {
|
|
@@ -2549,7 +2581,7 @@ var ColorPicker = ({
|
|
|
2549
2581
|
}
|
|
2550
2582
|
}
|
|
2551
2583
|
),
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2584
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2553
2585
|
"div",
|
|
2554
2586
|
{
|
|
2555
2587
|
style: {
|
|
@@ -2570,8 +2602,8 @@ var ColorPicker = ({
|
|
|
2570
2602
|
]
|
|
2571
2603
|
}
|
|
2572
2604
|
),
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2575
2607
|
"div",
|
|
2576
2608
|
{
|
|
2577
2609
|
style: {
|
|
@@ -2585,7 +2617,7 @@ var ColorPicker = ({
|
|
|
2585
2617
|
flexShrink: 0,
|
|
2586
2618
|
border: "1px solid rgba(255,255,255,0.15)"
|
|
2587
2619
|
},
|
|
2588
|
-
children: /* @__PURE__ */ (0,
|
|
2620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2589
2621
|
"div",
|
|
2590
2622
|
{
|
|
2591
2623
|
style: {
|
|
@@ -2597,7 +2629,7 @@ var ColorPicker = ({
|
|
|
2597
2629
|
)
|
|
2598
2630
|
}
|
|
2599
2631
|
),
|
|
2600
|
-
/* @__PURE__ */ (0,
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2601
2633
|
"input",
|
|
2602
2634
|
{
|
|
2603
2635
|
type: "text",
|
|
@@ -2627,7 +2659,7 @@ var ColorPicker = ({
|
|
|
2627
2659
|
}
|
|
2628
2660
|
}
|
|
2629
2661
|
),
|
|
2630
|
-
hasEyeDropper && /* @__PURE__ */ (0,
|
|
2662
|
+
hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2631
2663
|
"button",
|
|
2632
2664
|
{
|
|
2633
2665
|
type: "button",
|
|
@@ -2647,7 +2679,7 @@ var ColorPicker = ({
|
|
|
2647
2679
|
color: "inherit",
|
|
2648
2680
|
cursor: disabled ? "default" : "pointer"
|
|
2649
2681
|
},
|
|
2650
|
-
children: /* @__PURE__ */ (0,
|
|
2682
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2651
2683
|
"svg",
|
|
2652
2684
|
{
|
|
2653
2685
|
width: "14",
|
|
@@ -2659,16 +2691,16 @@ var ColorPicker = ({
|
|
|
2659
2691
|
strokeLinecap: "round",
|
|
2660
2692
|
strokeLinejoin: "round",
|
|
2661
2693
|
children: [
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2663
|
-
/* @__PURE__ */ (0,
|
|
2664
|
-
/* @__PURE__ */ (0,
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m14 6 4 4" })
|
|
2665
2697
|
]
|
|
2666
2698
|
}
|
|
2667
2699
|
)
|
|
2668
2700
|
}
|
|
2669
2701
|
)
|
|
2670
2702
|
] }),
|
|
2671
|
-
isClipped && /* @__PURE__ */ (0,
|
|
2703
|
+
isClipped && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2672
2704
|
"div",
|
|
2673
2705
|
{
|
|
2674
2706
|
role: "note",
|
|
@@ -2684,10 +2716,10 @@ var ColorPicker = ({
|
|
|
2684
2716
|
borderRadius: "4px",
|
|
2685
2717
|
alignSelf: "flex-start"
|
|
2686
2718
|
},
|
|
2687
|
-
children: /* @__PURE__ */ (0,
|
|
2719
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
|
|
2688
2720
|
}
|
|
2689
2721
|
),
|
|
2690
|
-
contrastResult && /* @__PURE__ */ (0,
|
|
2722
|
+
contrastResult && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2691
2723
|
"div",
|
|
2692
2724
|
{
|
|
2693
2725
|
style: {
|
|
@@ -2701,15 +2733,15 @@ var ColorPicker = ({
|
|
|
2701
2733
|
border: "1px solid rgba(255,255,255,0.1)"
|
|
2702
2734
|
},
|
|
2703
2735
|
children: [
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
|
|
2705
2737
|
"Contrast: ",
|
|
2706
|
-
/* @__PURE__ */ (0,
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { children: [
|
|
2707
2739
|
contrastResult.ratio.toFixed(2),
|
|
2708
2740
|
":1"
|
|
2709
2741
|
] })
|
|
2710
2742
|
] }),
|
|
2711
|
-
/* @__PURE__ */ (0,
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
2744
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2713
2745
|
"span",
|
|
2714
2746
|
{
|
|
2715
2747
|
style: {
|
|
@@ -2722,7 +2754,7 @@ var ColorPicker = ({
|
|
|
2722
2754
|
]
|
|
2723
2755
|
}
|
|
2724
2756
|
),
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2726
2758
|
"span",
|
|
2727
2759
|
{
|
|
2728
2760
|
style: {
|
|
@@ -2739,9 +2771,9 @@ var ColorPicker = ({
|
|
|
2739
2771
|
]
|
|
2740
2772
|
}
|
|
2741
2773
|
),
|
|
2742
|
-
swatches && swatches.length > 0 && /* @__PURE__ */ (0,
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2744
|
-
/* @__PURE__ */ (0,
|
|
2774
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
2775
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2745
2777
|
"button",
|
|
2746
2778
|
{
|
|
2747
2779
|
type: "button",
|
|
@@ -2767,9 +2799,9 @@ var ColorPicker = ({
|
|
|
2767
2799
|
`${color}-${idx}`
|
|
2768
2800
|
)) })
|
|
2769
2801
|
] }),
|
|
2770
|
-
activeRecent.length > 0 && /* @__PURE__ */ (0,
|
|
2771
|
-
/* @__PURE__ */ (0,
|
|
2772
|
-
/* @__PURE__ */ (0,
|
|
2802
|
+
activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2773
2805
|
"button",
|
|
2774
2806
|
{
|
|
2775
2807
|
type: "button",
|
|
@@ -2800,9 +2832,9 @@ var ColorPicker = ({
|
|
|
2800
2832
|
};
|
|
2801
2833
|
|
|
2802
2834
|
// src/color/DualColorPicker.tsx
|
|
2803
|
-
var
|
|
2835
|
+
var import_react24 = require("react");
|
|
2804
2836
|
var import_color2 = require("@pixerate/editor/color");
|
|
2805
|
-
var
|
|
2837
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2806
2838
|
function DualColorPicker({
|
|
2807
2839
|
value,
|
|
2808
2840
|
onChange,
|
|
@@ -2817,8 +2849,8 @@ function DualColorPicker({
|
|
|
2817
2849
|
disabled = false,
|
|
2818
2850
|
className = ""
|
|
2819
2851
|
}) {
|
|
2820
|
-
const sameId = (0,
|
|
2821
|
-
const [internalScheme, setInternalScheme] = (0,
|
|
2852
|
+
const sameId = (0, import_react24.useId)();
|
|
2853
|
+
const [internalScheme, setInternalScheme] = (0, import_react24.useState)("light");
|
|
2822
2854
|
const activeScheme = controlledScheme ?? internalScheme;
|
|
2823
2855
|
const handleSchemeSelect = (nextScheme) => {
|
|
2824
2856
|
if (onSchemeChange) {
|
|
@@ -2829,7 +2861,7 @@ function DualColorPicker({
|
|
|
2829
2861
|
};
|
|
2830
2862
|
const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
|
|
2831
2863
|
const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
|
|
2832
|
-
const [sameInBoth, setSameInBoth] = (0,
|
|
2864
|
+
const [sameInBoth, setSameInBoth] = (0, import_react24.useState)(isSame);
|
|
2833
2865
|
const handleSameToggle = (e) => {
|
|
2834
2866
|
const nextSame = e.target.checked;
|
|
2835
2867
|
setSameInBoth(nextSame);
|
|
@@ -2861,7 +2893,7 @@ function DualColorPicker({
|
|
|
2861
2893
|
const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
|
|
2862
2894
|
const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
|
|
2863
2895
|
const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
|
|
2864
|
-
return /* @__PURE__ */ (0,
|
|
2896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2865
2897
|
"div",
|
|
2866
2898
|
{
|
|
2867
2899
|
className: `pixerate-dual-color-picker ${className}`,
|
|
@@ -2880,7 +2912,7 @@ function DualColorPicker({
|
|
|
2880
2912
|
boxSizing: "border-box"
|
|
2881
2913
|
},
|
|
2882
2914
|
children: [
|
|
2883
|
-
/* @__PURE__ */ (0,
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2884
2916
|
"div",
|
|
2885
2917
|
{
|
|
2886
2918
|
role: "tablist",
|
|
@@ -2893,7 +2925,7 @@ function DualColorPicker({
|
|
|
2893
2925
|
gap: "2px"
|
|
2894
2926
|
},
|
|
2895
2927
|
children: [
|
|
2896
|
-
/* @__PURE__ */ (0,
|
|
2928
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2897
2929
|
"button",
|
|
2898
2930
|
{
|
|
2899
2931
|
type: "button",
|
|
@@ -2916,7 +2948,7 @@ function DualColorPicker({
|
|
|
2916
2948
|
children: "Light"
|
|
2917
2949
|
}
|
|
2918
2950
|
),
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
2951
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2920
2952
|
"button",
|
|
2921
2953
|
{
|
|
2922
2954
|
type: "button",
|
|
@@ -2942,8 +2974,8 @@ function DualColorPicker({
|
|
|
2942
2974
|
]
|
|
2943
2975
|
}
|
|
2944
2976
|
),
|
|
2945
|
-
/* @__PURE__ */ (0,
|
|
2946
|
-
/* @__PURE__ */ (0,
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2947
2979
|
"button",
|
|
2948
2980
|
{
|
|
2949
2981
|
type: "button",
|
|
@@ -2965,7 +2997,7 @@ function DualColorPicker({
|
|
|
2965
2997
|
outline: "none"
|
|
2966
2998
|
},
|
|
2967
2999
|
children: [
|
|
2968
|
-
/* @__PURE__ */ (0,
|
|
3000
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2969
3001
|
"span",
|
|
2970
3002
|
{
|
|
2971
3003
|
style: {
|
|
@@ -2977,11 +3009,11 @@ function DualColorPicker({
|
|
|
2977
3009
|
}
|
|
2978
3010
|
}
|
|
2979
3011
|
),
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
3012
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
|
|
2981
3013
|
]
|
|
2982
3014
|
}
|
|
2983
3015
|
),
|
|
2984
|
-
/* @__PURE__ */ (0,
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2985
3017
|
"button",
|
|
2986
3018
|
{
|
|
2987
3019
|
type: "button",
|
|
@@ -3003,7 +3035,7 @@ function DualColorPicker({
|
|
|
3003
3035
|
outline: "none"
|
|
3004
3036
|
},
|
|
3005
3037
|
children: [
|
|
3006
|
-
/* @__PURE__ */ (0,
|
|
3038
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3007
3039
|
"span",
|
|
3008
3040
|
{
|
|
3009
3041
|
style: {
|
|
@@ -3015,12 +3047,12 @@ function DualColorPicker({
|
|
|
3015
3047
|
}
|
|
3016
3048
|
}
|
|
3017
3049
|
),
|
|
3018
|
-
/* @__PURE__ */ (0,
|
|
3050
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
|
|
3019
3051
|
]
|
|
3020
3052
|
}
|
|
3021
3053
|
)
|
|
3022
3054
|
] }),
|
|
3023
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3024
3056
|
"div",
|
|
3025
3057
|
{
|
|
3026
3058
|
style: {
|
|
@@ -3031,7 +3063,7 @@ function DualColorPicker({
|
|
|
3031
3063
|
padding: "2px 0"
|
|
3032
3064
|
},
|
|
3033
3065
|
children: [
|
|
3034
|
-
/* @__PURE__ */ (0,
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3035
3067
|
"label",
|
|
3036
3068
|
{
|
|
3037
3069
|
htmlFor: sameId,
|
|
@@ -3045,7 +3077,7 @@ function DualColorPicker({
|
|
|
3045
3077
|
color: "#c4cad4"
|
|
3046
3078
|
},
|
|
3047
3079
|
children: [
|
|
3048
|
-
/* @__PURE__ */ (0,
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3049
3081
|
"input",
|
|
3050
3082
|
{
|
|
3051
3083
|
id: sameId,
|
|
@@ -3056,11 +3088,11 @@ function DualColorPicker({
|
|
|
3056
3088
|
style: { cursor: disabled ? "not-allowed" : "pointer" }
|
|
3057
3089
|
}
|
|
3058
3090
|
),
|
|
3059
|
-
/* @__PURE__ */ (0,
|
|
3091
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Same in both" })
|
|
3060
3092
|
]
|
|
3061
3093
|
}
|
|
3062
3094
|
),
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3064
3096
|
"button",
|
|
3065
3097
|
{
|
|
3066
3098
|
type: "button",
|
|
@@ -3082,7 +3114,7 @@ function DualColorPicker({
|
|
|
3082
3114
|
]
|
|
3083
3115
|
}
|
|
3084
3116
|
),
|
|
3085
|
-
dualContrast && /* @__PURE__ */ (0,
|
|
3117
|
+
dualContrast && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3086
3118
|
"div",
|
|
3087
3119
|
{
|
|
3088
3120
|
"data-testid": "dual-contrast-summary",
|
|
@@ -3096,20 +3128,20 @@ function DualColorPicker({
|
|
|
3096
3128
|
color: "#8c95a6"
|
|
3097
3129
|
},
|
|
3098
3130
|
children: [
|
|
3099
|
-
/* @__PURE__ */ (0,
|
|
3131
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
|
|
3100
3132
|
"Light:",
|
|
3101
3133
|
" ",
|
|
3102
|
-
/* @__PURE__ */ (0,
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
3103
3135
|
dualContrast.light.ratio.toFixed(2),
|
|
3104
3136
|
" (",
|
|
3105
3137
|
dualContrast.light.level,
|
|
3106
3138
|
")"
|
|
3107
3139
|
] })
|
|
3108
3140
|
] }),
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3141
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
|
|
3110
3142
|
"Dark:",
|
|
3111
3143
|
" ",
|
|
3112
|
-
/* @__PURE__ */ (0,
|
|
3144
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
3113
3145
|
dualContrast.dark.ratio.toFixed(2),
|
|
3114
3146
|
" (",
|
|
3115
3147
|
dualContrast.dark.level,
|
|
@@ -3119,7 +3151,7 @@ function DualColorPicker({
|
|
|
3119
3151
|
]
|
|
3120
3152
|
}
|
|
3121
3153
|
),
|
|
3122
|
-
/* @__PURE__ */ (0,
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3123
3155
|
ColorPicker,
|
|
3124
3156
|
{
|
|
3125
3157
|
value: activeColor,
|
|
@@ -3138,7 +3170,7 @@ function DualColorPicker({
|
|
|
3138
3170
|
}
|
|
3139
3171
|
|
|
3140
3172
|
// src/color/useColorScheme.ts
|
|
3141
|
-
var
|
|
3173
|
+
var import_react25 = require("react");
|
|
3142
3174
|
var import_color3 = require("@pixerate/editor/color");
|
|
3143
3175
|
function getSnapshot(attribute) {
|
|
3144
3176
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
@@ -3163,7 +3195,7 @@ function getServerSnapshot() {
|
|
|
3163
3195
|
function useColorScheme(options) {
|
|
3164
3196
|
const override = options?.override;
|
|
3165
3197
|
const attribute = options?.attribute;
|
|
3166
|
-
const subscribe = (0,
|
|
3198
|
+
const subscribe = (0, import_react25.useMemo)(() => {
|
|
3167
3199
|
return (callback) => {
|
|
3168
3200
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
3169
3201
|
return () => {
|
|
@@ -3189,7 +3221,7 @@ function useColorScheme(options) {
|
|
|
3189
3221
|
};
|
|
3190
3222
|
};
|
|
3191
3223
|
}, [attribute]);
|
|
3192
|
-
const detected = (0,
|
|
3224
|
+
const detected = (0, import_react25.useSyncExternalStore)(
|
|
3193
3225
|
subscribe,
|
|
3194
3226
|
() => getSnapshot(attribute),
|
|
3195
3227
|
getServerSnapshot
|
|
@@ -3206,11 +3238,11 @@ function useResolvedColor(value, scheme) {
|
|
|
3206
3238
|
__reExport(color_exports, require("@pixerate/editor/color"));
|
|
3207
3239
|
|
|
3208
3240
|
// src/parameters/controls.tsx
|
|
3209
|
-
var
|
|
3210
|
-
var
|
|
3211
|
-
var ParameterComponentsContext = (0,
|
|
3241
|
+
var import_react26 = require("react");
|
|
3242
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3243
|
+
var ParameterComponentsContext = (0, import_react26.createContext)({});
|
|
3212
3244
|
function useParameterComponents() {
|
|
3213
|
-
return (0,
|
|
3245
|
+
return (0, import_react26.useContext)(ParameterComponentsContext);
|
|
3214
3246
|
}
|
|
3215
3247
|
function resolveParameterComponents(explicit, context) {
|
|
3216
3248
|
return {
|
|
@@ -3222,7 +3254,7 @@ function resolveParameterComponents(explicit, context) {
|
|
|
3222
3254
|
}
|
|
3223
3255
|
|
|
3224
3256
|
// src/parameters/fields.tsx
|
|
3225
|
-
var
|
|
3257
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3226
3258
|
var parameterInputStyle = import_parameters.parameterThemeStyles.input;
|
|
3227
3259
|
var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
|
|
3228
3260
|
var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
|
|
@@ -3231,9 +3263,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
|
|
|
3231
3263
|
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";
|
|
3232
3264
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
3233
3265
|
function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
|
|
3234
|
-
const inputRef = (0,
|
|
3235
|
-
const lastCommitted = (0,
|
|
3236
|
-
(0,
|
|
3266
|
+
const inputRef = (0, import_react27.useRef)(null);
|
|
3267
|
+
const lastCommitted = (0, import_react27.useRef)(null);
|
|
3268
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
3237
3269
|
lastCommitted.current = null;
|
|
3238
3270
|
const el = inputRef.current;
|
|
3239
3271
|
if (el && el.value !== value) el.value = value;
|
|
@@ -3244,9 +3276,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3244
3276
|
onCommit(text, el);
|
|
3245
3277
|
lastCommitted.current = el.value === text ? text : null;
|
|
3246
3278
|
};
|
|
3247
|
-
const commitRef = (0,
|
|
3279
|
+
const commitRef = (0, import_react27.useRef)(commit);
|
|
3248
3280
|
commitRef.current = commit;
|
|
3249
|
-
(0,
|
|
3281
|
+
(0, import_react27.useEffect)(() => {
|
|
3250
3282
|
const el = inputRef.current;
|
|
3251
3283
|
if (!el) return;
|
|
3252
3284
|
const change = () => commitRef.current(el);
|
|
@@ -3277,7 +3309,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3277
3309
|
if (typeof forwarded === "function") forwarded(el);
|
|
3278
3310
|
else if (forwarded) forwarded.current = el;
|
|
3279
3311
|
};
|
|
3280
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
3312
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "text", ...props, ref: setRef });
|
|
3281
3313
|
}
|
|
3282
3314
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
3283
3315
|
function ParameterNumberInput(props) {
|
|
@@ -3311,9 +3343,9 @@ function ParameterNumberInput(props) {
|
|
|
3311
3343
|
onCommit: handleCommit,
|
|
3312
3344
|
onKeyDown: handleKeyDown
|
|
3313
3345
|
};
|
|
3314
|
-
return /* @__PURE__ */ (0,
|
|
3315
|
-
CustomInput ? /* @__PURE__ */ (0,
|
|
3316
|
-
field.unit && /* @__PURE__ */ (0,
|
|
3346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
3347
|
+
CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterCommitInput, { ...inputProps }),
|
|
3348
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
3317
3349
|
] });
|
|
3318
3350
|
}
|
|
3319
3351
|
function ParameterSlider(props) {
|
|
@@ -3321,7 +3353,7 @@ function ParameterSlider(props) {
|
|
|
3321
3353
|
const ctx = useParameterComponents();
|
|
3322
3354
|
const resolved = resolveParameterComponents(components, ctx);
|
|
3323
3355
|
const CustomSlider = resolved.slider;
|
|
3324
|
-
const dragging = (0,
|
|
3356
|
+
const dragging = (0, import_react27.useRef)(false);
|
|
3325
3357
|
const start = () => {
|
|
3326
3358
|
if (dragging.current) return;
|
|
3327
3359
|
dragging.current = true;
|
|
@@ -3332,7 +3364,7 @@ function ParameterSlider(props) {
|
|
|
3332
3364
|
dragging.current = false;
|
|
3333
3365
|
onGestureEnd?.();
|
|
3334
3366
|
};
|
|
3335
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
3367
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props });
|
|
3336
3368
|
const step = (0, import_parameters.parameterStep)(field);
|
|
3337
3369
|
const sliderProps = {
|
|
3338
3370
|
"aria-label": (0, import_parameters.parameterLabel)(field),
|
|
@@ -3346,8 +3378,8 @@ function ParameterSlider(props) {
|
|
|
3346
3378
|
className: rangeClass,
|
|
3347
3379
|
style: parameterRangeStyle
|
|
3348
3380
|
};
|
|
3349
|
-
return /* @__PURE__ */ (0,
|
|
3350
|
-
CustomSlider ? /* @__PURE__ */ (0,
|
|
3381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3382
|
+
CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3351
3383
|
CustomSlider,
|
|
3352
3384
|
{
|
|
3353
3385
|
...sliderProps,
|
|
@@ -3357,7 +3389,7 @@ function ParameterSlider(props) {
|
|
|
3357
3389
|
onGestureStart: start,
|
|
3358
3390
|
onGestureEnd: end
|
|
3359
3391
|
}
|
|
3360
|
-
) : /* @__PURE__ */ (0,
|
|
3392
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3361
3393
|
"input",
|
|
3362
3394
|
{
|
|
3363
3395
|
type: "range",
|
|
@@ -3369,11 +3401,11 @@ function ParameterSlider(props) {
|
|
|
3369
3401
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
3370
3402
|
}
|
|
3371
3403
|
),
|
|
3372
|
-
/* @__PURE__ */ (0,
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
3373
3405
|
] });
|
|
3374
3406
|
}
|
|
3375
3407
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
3376
|
-
return /* @__PURE__ */ (0,
|
|
3408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3377
3409
|
"button",
|
|
3378
3410
|
{
|
|
3379
3411
|
type: "button",
|
|
@@ -3384,7 +3416,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
3384
3416
|
disabled: disabled || field.readOnly,
|
|
3385
3417
|
onClick: () => onChange(!value),
|
|
3386
3418
|
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"}`,
|
|
3387
|
-
children: /* @__PURE__ */ (0,
|
|
3419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3388
3420
|
"span",
|
|
3389
3421
|
{
|
|
3390
3422
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -3401,7 +3433,7 @@ function ParameterSelect(props) {
|
|
|
3401
3433
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
3402
3434
|
const off = disabled || field.readOnly;
|
|
3403
3435
|
if (field.control === "segmented") {
|
|
3404
|
-
return /* @__PURE__ */ (0,
|
|
3436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)(
|
|
3405
3437
|
"button",
|
|
3406
3438
|
{
|
|
3407
3439
|
type: "button",
|
|
@@ -3418,7 +3450,7 @@ function ParameterSelect(props) {
|
|
|
3418
3450
|
}
|
|
3419
3451
|
if (CustomSelect) {
|
|
3420
3452
|
const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
|
|
3421
|
-
return /* @__PURE__ */ (0,
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3422
3454
|
CustomSelect,
|
|
3423
3455
|
{
|
|
3424
3456
|
id,
|
|
@@ -3434,7 +3466,7 @@ function ParameterSelect(props) {
|
|
|
3434
3466
|
);
|
|
3435
3467
|
}
|
|
3436
3468
|
const index = options.findIndex((o) => o.value === value);
|
|
3437
|
-
return /* @__PURE__ */ (0,
|
|
3469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3438
3470
|
"select",
|
|
3439
3471
|
{
|
|
3440
3472
|
id,
|
|
@@ -3447,23 +3479,23 @@ function ParameterSelect(props) {
|
|
|
3447
3479
|
},
|
|
3448
3480
|
className: parameterInputClass,
|
|
3449
3481
|
style: parameterSelectStyle,
|
|
3450
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
3482
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
3451
3483
|
}
|
|
3452
3484
|
);
|
|
3453
3485
|
}
|
|
3454
3486
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
|
|
3455
3487
|
const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
|
|
3456
|
-
const [open, setOpen] = (0,
|
|
3457
|
-
const containerRef = (0,
|
|
3458
|
-
const buttonRef = (0,
|
|
3459
|
-
const popoverRef = (0,
|
|
3488
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
3489
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
3490
|
+
const buttonRef = (0, import_react27.useRef)(null);
|
|
3491
|
+
const popoverRef = (0, import_react27.useRef)(null);
|
|
3460
3492
|
const alpha = !!field.alpha;
|
|
3461
3493
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
3462
3494
|
const rgb = hex.slice(0, 7);
|
|
3463
3495
|
const shown = alpha ? hex : rgb;
|
|
3464
3496
|
const off = disabled || field.readOnly;
|
|
3465
3497
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3466
|
-
(0,
|
|
3498
|
+
(0, import_react27.useEffect)(() => {
|
|
3467
3499
|
if (!open) return;
|
|
3468
3500
|
const onPointerDown = (e) => {
|
|
3469
3501
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3485,7 +3517,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3485
3517
|
};
|
|
3486
3518
|
}, [open]);
|
|
3487
3519
|
if (CustomColor) {
|
|
3488
|
-
return /* @__PURE__ */ (0,
|
|
3520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3489
3521
|
CustomColor,
|
|
3490
3522
|
{
|
|
3491
3523
|
id,
|
|
@@ -3500,9 +3532,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3500
3532
|
}
|
|
3501
3533
|
);
|
|
3502
3534
|
}
|
|
3503
|
-
return /* @__PURE__ */ (0,
|
|
3504
|
-
/* @__PURE__ */ (0,
|
|
3505
|
-
/* @__PURE__ */ (0,
|
|
3535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
3536
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3537
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3506
3538
|
"button",
|
|
3507
3539
|
{
|
|
3508
3540
|
ref: buttonRef,
|
|
@@ -3513,10 +3545,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3513
3545
|
disabled: off,
|
|
3514
3546
|
onClick: () => setOpen((prev) => !prev),
|
|
3515
3547
|
className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
3516
|
-
children: /* @__PURE__ */ (0,
|
|
3548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
|
|
3517
3549
|
}
|
|
3518
3550
|
),
|
|
3519
|
-
/* @__PURE__ */ (0,
|
|
3551
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3520
3552
|
ParameterCommitInput,
|
|
3521
3553
|
{
|
|
3522
3554
|
id,
|
|
@@ -3532,7 +3564,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3532
3564
|
}
|
|
3533
3565
|
)
|
|
3534
3566
|
] }),
|
|
3535
|
-
open && /* @__PURE__ */ (0,
|
|
3567
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3536
3568
|
"div",
|
|
3537
3569
|
{
|
|
3538
3570
|
ref: popoverRef,
|
|
@@ -3546,7 +3578,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3546
3578
|
},
|
|
3547
3579
|
className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
|
|
3548
3580
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
3549
|
-
children: /* @__PURE__ */ (0,
|
|
3581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3550
3582
|
ColorPicker,
|
|
3551
3583
|
{
|
|
3552
3584
|
value: shown,
|
|
@@ -3564,11 +3596,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3564
3596
|
}
|
|
3565
3597
|
function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
3566
3598
|
const size = (0, import_parameters.vectorSize)(field);
|
|
3567
|
-
return /* @__PURE__ */ (0,
|
|
3599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
3568
3600
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
3569
|
-
return /* @__PURE__ */ (0,
|
|
3570
|
-
/* @__PURE__ */ (0,
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
3601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
3602
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3572
3604
|
ParameterNumberInput,
|
|
3573
3605
|
{
|
|
3574
3606
|
field: component,
|
|
@@ -3586,11 +3618,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
|
3586
3618
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
3587
3619
|
const off = disabled || field.readOnly;
|
|
3588
3620
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3589
|
-
return /* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
/* @__PURE__ */ (0,
|
|
3592
|
-
/* @__PURE__ */ (0,
|
|
3593
|
-
/* @__PURE__ */ (0,
|
|
3621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3622
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3594
3626
|
ParameterCommitInput,
|
|
3595
3627
|
{
|
|
3596
3628
|
id,
|
|
@@ -3601,15 +3633,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3601
3633
|
onCommit: (text) => onChange(text.trim())
|
|
3602
3634
|
}
|
|
3603
3635
|
),
|
|
3604
|
-
/* @__PURE__ */ (0,
|
|
3605
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
|
|
3637
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3606
3638
|
"label",
|
|
3607
3639
|
{
|
|
3608
3640
|
style: parameterButtonStyle,
|
|
3609
3641
|
className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
|
|
3610
3642
|
children: [
|
|
3611
3643
|
"Choose file\u2026",
|
|
3612
|
-
/* @__PURE__ */ (0,
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3613
3645
|
"input",
|
|
3614
3646
|
{
|
|
3615
3647
|
type: "file",
|
|
@@ -3627,7 +3659,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3627
3659
|
]
|
|
3628
3660
|
}
|
|
3629
3661
|
),
|
|
3630
|
-
value && /* @__PURE__ */ (0,
|
|
3662
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3631
3663
|
"button",
|
|
3632
3664
|
{
|
|
3633
3665
|
type: "button",
|
|
@@ -3642,7 +3674,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3642
3674
|
] })
|
|
3643
3675
|
] })
|
|
3644
3676
|
] }),
|
|
3645
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
3677
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3646
3678
|
"button",
|
|
3647
3679
|
{
|
|
3648
3680
|
type: "button",
|
|
@@ -3652,14 +3684,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3652
3684
|
disabled: off,
|
|
3653
3685
|
onClick: () => onChange(o.url),
|
|
3654
3686
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
3655
|
-
children: /* @__PURE__ */ (0,
|
|
3687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
3656
3688
|
},
|
|
3657
3689
|
o.url
|
|
3658
3690
|
)) })
|
|
3659
3691
|
] });
|
|
3660
3692
|
}
|
|
3661
3693
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
3662
|
-
return /* @__PURE__ */ (0,
|
|
3694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3663
3695
|
ParameterCommitInput,
|
|
3664
3696
|
{
|
|
3665
3697
|
id,
|
|
@@ -3678,24 +3710,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
3678
3710
|
switch (field.type) {
|
|
3679
3711
|
case "number":
|
|
3680
3712
|
case "int":
|
|
3681
|
-
return /* @__PURE__ */ (0,
|
|
3713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
3682
3714
|
case "boolean":
|
|
3683
|
-
return /* @__PURE__ */ (0,
|
|
3715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
3684
3716
|
case "choice":
|
|
3685
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
3686
3718
|
case "color":
|
|
3687
|
-
return /* @__PURE__ */ (0,
|
|
3719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
3688
3720
|
case "vector":
|
|
3689
|
-
return /* @__PURE__ */ (0,
|
|
3721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
3690
3722
|
case "image":
|
|
3691
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
3692
3724
|
case "text":
|
|
3693
|
-
return /* @__PURE__ */ (0,
|
|
3725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
3694
3726
|
}
|
|
3695
3727
|
}
|
|
3696
3728
|
|
|
3697
3729
|
// src/effects/EffectParameters.tsx
|
|
3698
|
-
var
|
|
3730
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3699
3731
|
function EffectParameters({
|
|
3700
3732
|
description,
|
|
3701
3733
|
values,
|
|
@@ -3710,10 +3742,10 @@ function EffectParameters({
|
|
|
3710
3742
|
className = "",
|
|
3711
3743
|
components
|
|
3712
3744
|
}) {
|
|
3713
|
-
const fields = (0,
|
|
3714
|
-
const idBase = (0,
|
|
3715
|
-
const gesture =
|
|
3716
|
-
const count =
|
|
3745
|
+
const fields = (0, import_react28.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
3746
|
+
const idBase = (0, import_react28.useId)();
|
|
3747
|
+
const gesture = import_react28.default.useRef(null);
|
|
3748
|
+
const count = import_react28.default.useRef(0);
|
|
3717
3749
|
const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
|
|
3718
3750
|
const handlePresetSelect = (name) => {
|
|
3719
3751
|
if (!name) return;
|
|
@@ -3724,8 +3756,8 @@ function EffectParameters({
|
|
|
3724
3756
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
3725
3757
|
}
|
|
3726
3758
|
};
|
|
3727
|
-
return /* @__PURE__ */ (0,
|
|
3728
|
-
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0,
|
|
3759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
3760
|
+
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3729
3761
|
CustomPresetSelect,
|
|
3730
3762
|
{
|
|
3731
3763
|
"aria-label": `${description.name} presets`,
|
|
@@ -3740,7 +3772,7 @@ function EffectParameters({
|
|
|
3740
3772
|
],
|
|
3741
3773
|
onChange: (name) => handlePresetSelect(String(name))
|
|
3742
3774
|
}
|
|
3743
|
-
) : /* @__PURE__ */ (0,
|
|
3775
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3744
3776
|
"select",
|
|
3745
3777
|
{
|
|
3746
3778
|
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
@@ -3750,8 +3782,8 @@ function EffectParameters({
|
|
|
3750
3782
|
disabled,
|
|
3751
3783
|
onChange: (e) => handlePresetSelect(e.currentTarget.value),
|
|
3752
3784
|
children: [
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
3754
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
|
|
3786
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
|
|
3755
3787
|
]
|
|
3756
3788
|
}
|
|
3757
3789
|
)),
|
|
@@ -3761,14 +3793,14 @@ function EffectParameters({
|
|
|
3761
3793
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
3762
3794
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
3763
3795
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
3765
|
-
/* @__PURE__ */ (0,
|
|
3766
|
-
/* @__PURE__ */ (0,
|
|
3767
|
-
keyed && /* @__PURE__ */ (0,
|
|
3796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3798
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
3799
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
3768
3800
|
renderControlAddon?.(field.id),
|
|
3769
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
3801
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime28.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" })
|
|
3770
3802
|
] }),
|
|
3771
|
-
/* @__PURE__ */ (0,
|
|
3803
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3772
3804
|
ParameterFieldControl,
|
|
3773
3805
|
{
|
|
3774
3806
|
field,
|
|
@@ -3783,15 +3815,15 @@ function EffectParameters({
|
|
|
3783
3815
|
)
|
|
3784
3816
|
] }, field.id);
|
|
3785
3817
|
}),
|
|
3786
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
3818
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
3787
3819
|
] });
|
|
3788
3820
|
}
|
|
3789
3821
|
|
|
3790
3822
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
3791
|
-
var
|
|
3823
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3792
3824
|
function usePaintEffectsProvider(controller) {
|
|
3793
|
-
const [provider, setProvider] = (0,
|
|
3794
|
-
(0,
|
|
3825
|
+
const [provider, setProvider] = (0, import_react29.useState)(controller.effectsProvider);
|
|
3826
|
+
(0, import_react29.useEffect)(() => {
|
|
3795
3827
|
setProvider(controller.effectsProvider);
|
|
3796
3828
|
return controller.effects.subscribe(setProvider);
|
|
3797
3829
|
}, [controller]);
|
|
@@ -3799,27 +3831,27 @@ function usePaintEffectsProvider(controller) {
|
|
|
3799
3831
|
}
|
|
3800
3832
|
function usePaintEffectsTools(registry, controller, options = {}) {
|
|
3801
3833
|
const { id, namespace, readOnly, playbackSurface } = options;
|
|
3802
|
-
(0,
|
|
3834
|
+
(0, import_react29.useEffect)(() => {
|
|
3803
3835
|
if (!registry) return;
|
|
3804
|
-
return registry.register((0,
|
|
3836
|
+
return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
|
|
3805
3837
|
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
3806
3838
|
}
|
|
3807
3839
|
function Controls({ provider, effect, name, values, apply }) {
|
|
3808
3840
|
const { description, error } = useEffectDescription(provider, effect);
|
|
3809
|
-
const drags = (0,
|
|
3810
|
-
if (!provider) return /* @__PURE__ */ (0,
|
|
3841
|
+
const drags = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
3842
|
+
if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
|
|
3811
3843
|
'No effects provider: "',
|
|
3812
3844
|
name ?? effect,
|
|
3813
3845
|
'" is kept as it was drawn.'
|
|
3814
3846
|
] });
|
|
3815
|
-
if (error) return /* @__PURE__ */ (0,
|
|
3816
|
-
if (!description) return /* @__PURE__ */ (0,
|
|
3847
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
|
|
3848
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
|
|
3817
3849
|
const commit = (gesture) => {
|
|
3818
3850
|
if (!gesture || drags.current.has(gesture)) return !gesture;
|
|
3819
3851
|
drags.current.add(gesture);
|
|
3820
3852
|
return true;
|
|
3821
3853
|
};
|
|
3822
|
-
return /* @__PURE__ */ (0,
|
|
3854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3823
3855
|
EffectParameters,
|
|
3824
3856
|
{
|
|
3825
3857
|
description,
|
|
@@ -3841,8 +3873,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3841
3873
|
const state = usePaintEditorState(controller);
|
|
3842
3874
|
const provider = usePaintEffectsProvider(controller);
|
|
3843
3875
|
const [error, attempt] = useAttempt();
|
|
3844
|
-
const [browse, setBrowse] = (0,
|
|
3845
|
-
const [busy, setBusy] = (0,
|
|
3876
|
+
const [browse, setBrowse] = (0, import_react29.useState)(null);
|
|
3877
|
+
const [busy, setBusy] = (0, import_react29.useState)(false);
|
|
3846
3878
|
const paper = controller.getPaperEffect();
|
|
3847
3879
|
const activeId = state.document.activeLayerId;
|
|
3848
3880
|
const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
|
|
@@ -3854,7 +3886,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3854
3886
|
if (!effectPaint) return;
|
|
3855
3887
|
run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
|
|
3856
3888
|
};
|
|
3857
|
-
const thumbnail = (0,
|
|
3889
|
+
const thumbnail = (0, import_react29.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
|
|
3858
3890
|
const run = (work) => attempt(() => {
|
|
3859
3891
|
setBusy(true);
|
|
3860
3892
|
return work().finally(() => setBusy(false));
|
|
@@ -3870,28 +3902,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3870
3902
|
};
|
|
3871
3903
|
const toggle = (b) => setBrowse(browse === b ? null : b);
|
|
3872
3904
|
const pixel = active?.type === "pixel";
|
|
3873
|
-
return /* @__PURE__ */ (0,
|
|
3874
|
-
/* @__PURE__ */ (0,
|
|
3875
|
-
/* @__PURE__ */ (0,
|
|
3876
|
-
/* @__PURE__ */ (0,
|
|
3877
|
-
/* @__PURE__ */ (0,
|
|
3878
|
-
/* @__PURE__ */ (0,
|
|
3879
|
-
/* @__PURE__ */ (0,
|
|
3880
|
-
/* @__PURE__ */ (0,
|
|
3905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
|
|
3906
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3907
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
|
|
3909
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
|
|
3910
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
|
|
3911
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
|
|
3881
3913
|
] }),
|
|
3882
|
-
!provider && /* @__PURE__ */ (0,
|
|
3883
|
-
browse && /* @__PURE__ */ (0,
|
|
3884
|
-
paper && /* @__PURE__ */ (0,
|
|
3885
|
-
/* @__PURE__ */ (0,
|
|
3886
|
-
/* @__PURE__ */ (0,
|
|
3914
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
|
|
3915
|
+
browse && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
|
|
3916
|
+
paper && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
3887
3919
|
"Paper: ",
|
|
3888
3920
|
paper.name ?? paper.effect
|
|
3889
3921
|
] }),
|
|
3890
|
-
/* @__PURE__ */ (0,
|
|
3922
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
|
|
3891
3923
|
] }),
|
|
3892
|
-
/* @__PURE__ */ (0,
|
|
3893
|
-
/* @__PURE__ */ (0,
|
|
3894
|
-
/* @__PURE__ */ (0,
|
|
3924
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3925
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3895
3927
|
"input",
|
|
3896
3928
|
{
|
|
3897
3929
|
type: "range",
|
|
@@ -3913,39 +3945,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3913
3945
|
`o${paper.opacity}`
|
|
3914
3946
|
)
|
|
3915
3947
|
] }),
|
|
3916
|
-
/* @__PURE__ */ (0,
|
|
3917
|
-
/* @__PURE__ */ (0,
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
3948
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3949
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
|
|
3950
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
|
|
3919
3951
|
const blend = e.currentTarget.value;
|
|
3920
3952
|
run(() => controller.updatePaperEffect({ blend }));
|
|
3921
|
-
}, children:
|
|
3953
|
+
}, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: b, children: b }, b)) })
|
|
3922
3954
|
] }),
|
|
3923
|
-
/* @__PURE__ */ (0,
|
|
3955
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
|
|
3924
3956
|
] }),
|
|
3925
|
-
effectPaint && /* @__PURE__ */ (0,
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
3927
|
-
thumbnail ? /* @__PURE__ */ (0,
|
|
3928
|
-
/* @__PURE__ */ (0,
|
|
3957
|
+
effectPaint && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
|
|
3958
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3959
|
+
thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
|
|
3960
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
3929
3961
|
"Paint: ",
|
|
3930
3962
|
effectPaint.effect,
|
|
3931
3963
|
state.effectPaintRendering ? " (rendering\u2026)" : ""
|
|
3932
3964
|
] }),
|
|
3933
|
-
/* @__PURE__ */ (0,
|
|
3965
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
|
|
3934
3966
|
] }),
|
|
3935
|
-
/* @__PURE__ */ (0,
|
|
3936
|
-
/* @__PURE__ */ (0,
|
|
3937
|
-
/* @__PURE__ */ (0,
|
|
3967
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
|
|
3968
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
|
|
3969
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
|
|
3938
3970
|
"Along the stroke"
|
|
3939
3971
|
] }),
|
|
3940
|
-
/* @__PURE__ */ (0,
|
|
3941
|
-
/* @__PURE__ */ (0,
|
|
3972
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
|
|
3973
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
|
|
3942
3974
|
"Live"
|
|
3943
3975
|
] })
|
|
3944
3976
|
] }),
|
|
3945
|
-
effectPaint.map && /* @__PURE__ */ (0,
|
|
3946
|
-
/* @__PURE__ */ (0,
|
|
3947
|
-
/* @__PURE__ */ (0,
|
|
3948
|
-
/* @__PURE__ */ (0,
|
|
3977
|
+
effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3978
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3979
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "Length" }),
|
|
3980
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3949
3981
|
"input",
|
|
3950
3982
|
{
|
|
3951
3983
|
type: "number",
|
|
@@ -3959,55 +3991,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3959
3991
|
effectPaint.map.length
|
|
3960
3992
|
)
|
|
3961
3993
|
] }),
|
|
3962
|
-
/* @__PURE__ */ (0,
|
|
3963
|
-
/* @__PURE__ */ (0,
|
|
3964
|
-
/* @__PURE__ */ (0,
|
|
3965
|
-
/* @__PURE__ */ (0,
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
|
|
3995
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "repeat", children: "Repeat" }),
|
|
3996
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "mirror", children: "Mirror" }),
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "clamp", children: "Clamp" })
|
|
3966
3998
|
] })
|
|
3967
3999
|
] }),
|
|
3968
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
|
|
3969
4001
|
] }),
|
|
3970
|
-
animation && /* @__PURE__ */ (0,
|
|
3971
|
-
/* @__PURE__ */ (0,
|
|
4002
|
+
animation && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
|
|
4003
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
3972
4004
|
"Live paint: ",
|
|
3973
4005
|
animation.strokes,
|
|
3974
4006
|
" ",
|
|
3975
4007
|
animation.strokes === 1 ? "stroke" : "strokes"
|
|
3976
4008
|
] }),
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
3980
|
-
/* @__PURE__ */ (0,
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
|
|
4010
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "fps" }),
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
|
|
3981
4013
|
] })
|
|
3982
4014
|
] }),
|
|
3983
|
-
layerEffect && activeId && /* @__PURE__ */ (0,
|
|
3984
|
-
/* @__PURE__ */ (0,
|
|
3985
|
-
/* @__PURE__ */ (0,
|
|
4015
|
+
layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
|
|
4016
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4017
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
3986
4018
|
"Layer: ",
|
|
3987
4019
|
layerEffect.name ?? layerEffect.effect
|
|
3988
4020
|
] }),
|
|
3989
|
-
/* @__PURE__ */ (0,
|
|
4021
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
|
|
3990
4022
|
] }),
|
|
3991
|
-
/* @__PURE__ */ (0,
|
|
4023
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
|
|
3992
4024
|
] }),
|
|
3993
|
-
/* @__PURE__ */ (0,
|
|
4025
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ErrorLine, { error })
|
|
3994
4026
|
] });
|
|
3995
4027
|
};
|
|
3996
4028
|
|
|
3997
4029
|
// src/paint-editor/PaintEditor.tsx
|
|
3998
|
-
var
|
|
4030
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3999
4031
|
var PAINT_CONTROLS = {
|
|
4000
4032
|
"mixing-pad": '[data-testid="mixing-pad"]',
|
|
4001
4033
|
lighting: '[data-testid="light-panel"]',
|
|
4002
4034
|
symmetry: '[aria-label="Symmetry"]'
|
|
4003
4035
|
};
|
|
4004
4036
|
var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, className, playback, playbackId = "paint", onPlaybackReveal }) => {
|
|
4005
|
-
const [tool, setTool] = (0,
|
|
4006
|
-
const [tab, setTab] = (0,
|
|
4007
|
-
const tabRef = (0,
|
|
4037
|
+
const [tool, setTool] = (0, import_react30.useState)("brush");
|
|
4038
|
+
const [tab, setTab] = (0, import_react30.useState)("color");
|
|
4039
|
+
const tabRef = (0, import_react30.useRef)(tab);
|
|
4008
4040
|
tabRef.current = tab;
|
|
4009
|
-
const rootRef = (0,
|
|
4010
|
-
const [ownPresence] = (0,
|
|
4041
|
+
const rootRef = (0, import_react30.useRef)(null);
|
|
4042
|
+
const [ownPresence] = (0, import_react30.useState)(() => new import_paint_editor15.PaintPresence());
|
|
4011
4043
|
const ambientPlayback = useAgentPlayback();
|
|
4012
4044
|
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
4013
4045
|
const viewBox = () => {
|
|
@@ -4018,12 +4050,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
|
|
|
4018
4050
|
const docToClient = (p) => {
|
|
4019
4051
|
const r = viewBox();
|
|
4020
4052
|
if (!r) return null;
|
|
4021
|
-
const q = (0,
|
|
4053
|
+
const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
|
|
4022
4054
|
return { x: r.left + q.x, y: r.top + q.y };
|
|
4023
4055
|
};
|
|
4024
4056
|
const clientToDoc = (p) => {
|
|
4025
4057
|
const r = viewBox();
|
|
4026
|
-
return r ? (0,
|
|
4058
|
+
return r ? (0, import_paint_editor15.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
|
|
4027
4059
|
};
|
|
4028
4060
|
const elementRect = (selector) => {
|
|
4029
4061
|
const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
|
|
@@ -4063,28 +4095,29 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
|
|
|
4063
4095
|
const box = rootRef.current?.getBoundingClientRect();
|
|
4064
4096
|
return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
|
|
4065
4097
|
};
|
|
4066
|
-
const [error, setError] = (0,
|
|
4098
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
4067
4099
|
const effects = usePaintEffectsProvider(controller);
|
|
4068
4100
|
const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
|
|
4069
|
-
return /* @__PURE__ */ (0,
|
|
4070
|
-
playing && /* @__PURE__ */ (0,
|
|
4071
|
-
/* @__PURE__ */ (0,
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4073
|
-
/* @__PURE__ */ (0,
|
|
4074
|
-
/* @__PURE__ */ (0,
|
|
4075
|
-
/* @__PURE__ */ (0,
|
|
4076
|
-
error && /* @__PURE__ */ (0,
|
|
4101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
|
|
4102
|
+
playing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
|
|
4103
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
|
|
4104
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
|
|
4105
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
|
|
4106
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
4107
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
|
|
4108
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
|
|
4077
4109
|
] }),
|
|
4078
|
-
/* @__PURE__ */ (0,
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4080
|
-
/* @__PURE__ */ (0,
|
|
4081
|
-
tab === "color" && /* @__PURE__ */ (0,
|
|
4082
|
-
tab === "wet" && /* @__PURE__ */ (0,
|
|
4083
|
-
tab === "paper" && /* @__PURE__ */ (0,
|
|
4084
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4085
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4086
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4087
|
-
tab === "
|
|
4110
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
|
|
4111
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
|
|
4112
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
|
|
4113
|
+
tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColorPanel, { controller }),
|
|
4114
|
+
tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(WetPanel, { controller }),
|
|
4115
|
+
tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaperPanel, { controller }),
|
|
4116
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintLayersPanel, { controller }),
|
|
4117
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StrokePanel, { controller }),
|
|
4118
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PathStrokePanel, { controller }),
|
|
4119
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StickerPanel, { controller }),
|
|
4120
|
+
tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintEffectsPanel, { controller })
|
|
4088
4121
|
] })
|
|
4089
4122
|
] })
|
|
4090
4123
|
] })
|
|
@@ -4106,6 +4139,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
|
|
|
4106
4139
|
PaintSlider,
|
|
4107
4140
|
PaintToolbar,
|
|
4108
4141
|
PaperPanel,
|
|
4142
|
+
PathStrokePanel,
|
|
4109
4143
|
StickerPanel,
|
|
4110
4144
|
StickerPicker,
|
|
4111
4145
|
StrokePanel,
|