@nextlyhq/ui 0.0.2-alpha.56 → 0.0.2-alpha.57
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/color.cjs +33 -0
- package/dist/color.cjs.map +1 -1
- package/dist/color.d.cts +84 -1
- package/dist/color.d.ts +84 -1
- package/dist/color.mjs +28 -1
- package/dist/color.mjs.map +1 -1
- package/dist/index.cjs +413 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.mjs +409 -65
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.scoped.css +1 -1
- package/dist/theme.css +41 -13
- package/docs/plugin-ui-authoring.md +12 -10
- package/package.json +9 -7
package/dist/index.cjs
CHANGED
|
@@ -65,6 +65,7 @@ __export(src_exports, {
|
|
|
65
65
|
Collapsible: () => Collapsible,
|
|
66
66
|
CollapsibleContent: () => CollapsibleContent2,
|
|
67
67
|
CollapsibleTrigger: () => CollapsibleTrigger2,
|
|
68
|
+
ColorPicker: () => ColorPicker,
|
|
68
69
|
Command: () => Command,
|
|
69
70
|
CommandDialog: () => CommandDialog,
|
|
70
71
|
CommandEmpty: () => CommandEmpty,
|
|
@@ -2292,7 +2293,7 @@ var TableSkeleton = ({
|
|
|
2292
2293
|
] })
|
|
2293
2294
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GrayBar, { className: "h-4 w-[60%] max-w-[120px]" }) }, colIdx)) }, rowIdx)) })
|
|
2294
2295
|
] }) }),
|
|
2295
|
-
!hideFooter && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "table-footer border-t border-border", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between px-2 py-4
|
|
2296
|
+
!hideFooter && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "table-footer border-t border-border", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between px-2 py-4", children: [
|
|
2296
2297
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex items-center gap-2 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GrayBar, { className: "h-4 w-[120px]" }) }),
|
|
2297
2298
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-6", children: [
|
|
2298
2299
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2317,11 +2318,353 @@ var TableSkeleton = ({
|
|
|
2317
2318
|
};
|
|
2318
2319
|
TableSkeleton.displayName = "TableSkeleton";
|
|
2319
2320
|
|
|
2320
|
-
// src/components/
|
|
2321
|
-
var ContextMenuPrimitive = __toESM(require("@radix-ui/react-context-menu"), 1);
|
|
2321
|
+
// src/components/color-picker.tsx
|
|
2322
2322
|
var import_lucide_react12 = require("lucide-react");
|
|
2323
2323
|
var React9 = __toESM(require("react"), 1);
|
|
2324
|
+
|
|
2325
|
+
// src/lib/color/convert.ts
|
|
2326
|
+
var clamp01 = (n) => n < 0 ? 0 : n > 1 ? 1 : n;
|
|
2327
|
+
function normalizeHue(hue) {
|
|
2328
|
+
if (!Number.isFinite(hue)) return 0;
|
|
2329
|
+
const wrapped = hue % 360;
|
|
2330
|
+
return wrapped < 0 ? wrapped + 360 : wrapped;
|
|
2331
|
+
}
|
|
2332
|
+
function hsvToRgb({ h, s, v }) {
|
|
2333
|
+
const hue = normalizeHue(h);
|
|
2334
|
+
const sat = clamp01(s);
|
|
2335
|
+
const val = clamp01(v);
|
|
2336
|
+
const sector = hue / 60;
|
|
2337
|
+
const chroma = val * sat;
|
|
2338
|
+
const x = chroma * (1 - Math.abs(sector % 2 - 1));
|
|
2339
|
+
const base = val - chroma;
|
|
2340
|
+
let rgb;
|
|
2341
|
+
if (sector < 1) rgb = [chroma, x, 0];
|
|
2342
|
+
else if (sector < 2) rgb = [x, chroma, 0];
|
|
2343
|
+
else if (sector < 3) rgb = [0, chroma, x];
|
|
2344
|
+
else if (sector < 4) rgb = [0, x, chroma];
|
|
2345
|
+
else if (sector < 5) rgb = [x, 0, chroma];
|
|
2346
|
+
else rgb = [chroma, 0, x];
|
|
2347
|
+
return { r: rgb[0] + base, g: rgb[1] + base, b: rgb[2] + base };
|
|
2348
|
+
}
|
|
2349
|
+
function rgbToHsv({ r, g, b }) {
|
|
2350
|
+
const red = clamp01(r);
|
|
2351
|
+
const green = clamp01(g);
|
|
2352
|
+
const blue = clamp01(b);
|
|
2353
|
+
const max = Math.max(red, green, blue);
|
|
2354
|
+
const min = Math.min(red, green, blue);
|
|
2355
|
+
const chroma = max - min;
|
|
2356
|
+
let hue = 0;
|
|
2357
|
+
if (chroma !== 0) {
|
|
2358
|
+
if (max === red) hue = (green - blue) / chroma % 6;
|
|
2359
|
+
else if (max === green) hue = (blue - red) / chroma + 2;
|
|
2360
|
+
else hue = (red - green) / chroma + 4;
|
|
2361
|
+
hue *= 60;
|
|
2362
|
+
}
|
|
2363
|
+
return {
|
|
2364
|
+
h: normalizeHue(hue),
|
|
2365
|
+
s: max === 0 ? 0 : chroma / max,
|
|
2366
|
+
v: max
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
// src/lib/color/hex.ts
|
|
2371
|
+
var HEX = /^#?(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
2372
|
+
var clamp012 = (n) => n < 0 ? 0 : n > 1 ? 1 : n;
|
|
2373
|
+
function pair(channel) {
|
|
2374
|
+
const value = Number.isFinite(channel) ? clamp012(channel) : 0;
|
|
2375
|
+
return Math.round(value * 255).toString(16).padStart(2, "0");
|
|
2376
|
+
}
|
|
2377
|
+
function parseHex(input) {
|
|
2378
|
+
const text = input.trim();
|
|
2379
|
+
if (!HEX.test(text)) return null;
|
|
2380
|
+
const digits = text.replace("#", "");
|
|
2381
|
+
const short = digits.length < 6;
|
|
2382
|
+
const size = short ? 1 : 2;
|
|
2383
|
+
const channel = (index) => {
|
|
2384
|
+
const slice = digits.slice(index * size, index * size + size);
|
|
2385
|
+
return parseInt(short ? slice + slice : slice, 16) / 255;
|
|
2386
|
+
};
|
|
2387
|
+
const hasAlpha = digits.length === 4 || digits.length === 8;
|
|
2388
|
+
return {
|
|
2389
|
+
r: channel(0),
|
|
2390
|
+
g: channel(1),
|
|
2391
|
+
b: channel(2),
|
|
2392
|
+
alpha: hasAlpha ? channel(3) : 1
|
|
2393
|
+
};
|
|
2394
|
+
}
|
|
2395
|
+
function toHex(color, alpha = 1) {
|
|
2396
|
+
const opacity = Number.isFinite(alpha) ? clamp012(alpha) : 1;
|
|
2397
|
+
const opaque = `#${pair(color.r)}${pair(color.g)}${pair(color.b)}`;
|
|
2398
|
+
return opacity === 1 ? opaque : `${opaque}${pair(opacity)}`;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
// src/lib/color/picker-geometry.ts
|
|
2402
|
+
var clamp013 = (n) => n < 0 ? 0 : n > 1 ? 1 : n;
|
|
2403
|
+
function pointOnSurface(clientX, clientY, rect) {
|
|
2404
|
+
return {
|
|
2405
|
+
x: rect.width === 0 ? 0 : clamp013((clientX - rect.left) / rect.width),
|
|
2406
|
+
y: rect.height === 0 ? 0 : clamp013((clientY - rect.top) / rect.height)
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
function saturationValueAt(point) {
|
|
2410
|
+
return { s: clamp013(point.x), v: 1 - clamp013(point.y) };
|
|
2411
|
+
}
|
|
2412
|
+
function surfacePointFor(s, v) {
|
|
2413
|
+
return { x: clamp013(s), y: 1 - clamp013(v) };
|
|
2414
|
+
}
|
|
2415
|
+
function hueAt(fraction) {
|
|
2416
|
+
const hue = clamp013(fraction) * 360;
|
|
2417
|
+
return hue >= 360 ? 0 : hue;
|
|
2418
|
+
}
|
|
2419
|
+
function huePosition(hue) {
|
|
2420
|
+
const wrapped = (hue % 360 + 360) % 360;
|
|
2421
|
+
return wrapped / 360;
|
|
2422
|
+
}
|
|
2423
|
+
function hueSliderValue(hue, max) {
|
|
2424
|
+
const step = Math.round(huePosition(hue) * (max + 1));
|
|
2425
|
+
return step > max ? max : step;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
// src/components/color-picker.tsx
|
|
2324
2429
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2430
|
+
function toHsva(hex) {
|
|
2431
|
+
const parsed = parseHex(hex);
|
|
2432
|
+
if (!parsed) return { h: 0, s: 0, v: 0, a: 1 };
|
|
2433
|
+
const { r, g, b, alpha } = parsed;
|
|
2434
|
+
return { ...rgbToHsv({ r, g, b }), a: alpha };
|
|
2435
|
+
}
|
|
2436
|
+
function toHexString(hsva, withAlpha) {
|
|
2437
|
+
return toHex(hsvToRgb(hsva), withAlpha ? hsva.a : 1);
|
|
2438
|
+
}
|
|
2439
|
+
var HUE_MAX = 359;
|
|
2440
|
+
function hsvaFrom(color, alpha, currentHue) {
|
|
2441
|
+
const hsv = rgbToHsv(color);
|
|
2442
|
+
return { ...hsv, h: hsv.s === 0 ? currentHue : hsv.h, a: alpha };
|
|
2443
|
+
}
|
|
2444
|
+
var SLIDER = "h-3 w-full cursor-pointer appearance-none rounded-full";
|
|
2445
|
+
var CHECKERBOARD = "repeating-conic-gradient(#c8c8c8 0% 25%, #ffffff 0% 50%)";
|
|
2446
|
+
function eyeDropperSupported() {
|
|
2447
|
+
return typeof window !== "undefined" && "EyeDropper" in window;
|
|
2448
|
+
}
|
|
2449
|
+
function ColorPicker({
|
|
2450
|
+
color,
|
|
2451
|
+
onColorChange,
|
|
2452
|
+
swatches = [],
|
|
2453
|
+
onSwatchSelect,
|
|
2454
|
+
recentColors = [],
|
|
2455
|
+
showAlpha = false,
|
|
2456
|
+
className
|
|
2457
|
+
}) {
|
|
2458
|
+
const fieldId = React9.useId();
|
|
2459
|
+
const surfaceRef = React9.useRef(null);
|
|
2460
|
+
const [hsva, setHsva] = React9.useState(() => toHsva(color));
|
|
2461
|
+
const [draftHex, setDraftHex] = React9.useState(null);
|
|
2462
|
+
const rendered = toHexString(hsva, showAlpha);
|
|
2463
|
+
React9.useEffect(() => {
|
|
2464
|
+
const incoming = parseHex(color);
|
|
2465
|
+
if (incoming && toHex(incoming, showAlpha ? incoming.alpha : 1) !== rendered) {
|
|
2466
|
+
setHsva((prev) => hsvaFrom(incoming, incoming.alpha, prev.h));
|
|
2467
|
+
}
|
|
2468
|
+
}, [color, rendered, showAlpha]);
|
|
2469
|
+
const commit = (next) => {
|
|
2470
|
+
setHsva(next);
|
|
2471
|
+
setDraftHex(null);
|
|
2472
|
+
onColorChange(toHexString(next, showAlpha));
|
|
2473
|
+
};
|
|
2474
|
+
const trackPointer = (event) => {
|
|
2475
|
+
const rect = surfaceRef.current?.getBoundingClientRect();
|
|
2476
|
+
if (!rect) return;
|
|
2477
|
+
const { s, v } = saturationValueAt(
|
|
2478
|
+
pointOnSurface(event.clientX, event.clientY, rect)
|
|
2479
|
+
);
|
|
2480
|
+
commit({ ...hsva, s, v });
|
|
2481
|
+
};
|
|
2482
|
+
const nudge = (ds, dv) => {
|
|
2483
|
+
const { s, v } = saturationValueAt(
|
|
2484
|
+
surfacePointFor(hsva.s + ds, hsva.v + dv)
|
|
2485
|
+
);
|
|
2486
|
+
commit({ ...hsva, s, v });
|
|
2487
|
+
};
|
|
2488
|
+
const handleSurfaceKey = (event) => {
|
|
2489
|
+
const step = event.shiftKey ? 0.1 : 0.01;
|
|
2490
|
+
const moves = {
|
|
2491
|
+
ArrowLeft: [-step, 0],
|
|
2492
|
+
ArrowRight: [step, 0],
|
|
2493
|
+
ArrowUp: [0, step],
|
|
2494
|
+
ArrowDown: [0, -step]
|
|
2495
|
+
};
|
|
2496
|
+
const move = moves[event.key];
|
|
2497
|
+
if (!move) return;
|
|
2498
|
+
event.preventDefault();
|
|
2499
|
+
nudge(move[0], move[1]);
|
|
2500
|
+
};
|
|
2501
|
+
const [canPickFromScreen, setCanPickFromScreen] = React9.useState(false);
|
|
2502
|
+
React9.useEffect(() => {
|
|
2503
|
+
setCanPickFromScreen(eyeDropperSupported());
|
|
2504
|
+
}, []);
|
|
2505
|
+
const handle = surfacePointFor(hsva.s, hsva.v);
|
|
2506
|
+
const hueOnly = toHex(hsvToRgb({ h: hsva.h, s: 1, v: 1 }));
|
|
2507
|
+
const pickFromScreen = async () => {
|
|
2508
|
+
const ctor = window.EyeDropper;
|
|
2509
|
+
if (!ctor) return;
|
|
2510
|
+
let sampled;
|
|
2511
|
+
try {
|
|
2512
|
+
sampled = (await new ctor().open()).sRGBHex;
|
|
2513
|
+
} catch {
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
const parsed = parseHex(sampled);
|
|
2517
|
+
if (parsed) commit(hsvaFrom(parsed, hsva.a, hsva.h));
|
|
2518
|
+
};
|
|
2519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("w-64 space-y-3", className), children: [
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2521
|
+
"div",
|
|
2522
|
+
{
|
|
2523
|
+
ref: surfaceRef,
|
|
2524
|
+
role: "application",
|
|
2525
|
+
tabIndex: 0,
|
|
2526
|
+
"aria-label": `Saturation and brightness: ${Math.round(hsva.s * 100)}% saturation, ${Math.round(hsva.v * 100)}% brightness. Arrow keys adjust.`,
|
|
2527
|
+
className: "ring-offset-background focus-visible:ring-ring relative h-40 w-full cursor-crosshair touch-none rounded-md focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
2528
|
+
style: {
|
|
2529
|
+
backgroundColor: hueOnly,
|
|
2530
|
+
// Value on TOP of saturation. CSS paints the first layer nearest the
|
|
2531
|
+
// viewer, so the reverse order lets the opaque white end of the
|
|
2532
|
+
// saturation ramp cover the black end of the value ramp: the
|
|
2533
|
+
// bottom-left corner displays white while selecting black.
|
|
2534
|
+
backgroundImage: "linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)"
|
|
2535
|
+
},
|
|
2536
|
+
onKeyDown: handleSurfaceKey,
|
|
2537
|
+
onPointerDown: (event) => {
|
|
2538
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
2539
|
+
trackPointer(event);
|
|
2540
|
+
},
|
|
2541
|
+
onPointerMove: (event) => {
|
|
2542
|
+
if (event.buttons === 1) trackPointer(event);
|
|
2543
|
+
},
|
|
2544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2545
|
+
"span",
|
|
2546
|
+
{
|
|
2547
|
+
"aria-hidden": "true",
|
|
2548
|
+
className: "pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-sm ring-1 ring-black/60",
|
|
2549
|
+
style: { left: `${handle.x * 100}%`, top: `${handle.y * 100}%` }
|
|
2550
|
+
}
|
|
2551
|
+
)
|
|
2552
|
+
}
|
|
2553
|
+
),
|
|
2554
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "sr-only", htmlFor: `${fieldId}-hue`, children: "Hue" }),
|
|
2555
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2556
|
+
"input",
|
|
2557
|
+
{
|
|
2558
|
+
id: `${fieldId}-hue`,
|
|
2559
|
+
type: "range",
|
|
2560
|
+
min: 0,
|
|
2561
|
+
max: HUE_MAX,
|
|
2562
|
+
step: 1,
|
|
2563
|
+
value: hueSliderValue(hsva.h, HUE_MAX),
|
|
2564
|
+
onChange: (event) => commit({ ...hsva, h: hueAt(+event.target.value / (HUE_MAX + 1)) }),
|
|
2565
|
+
className: SLIDER,
|
|
2566
|
+
style: {
|
|
2567
|
+
backgroundImage: "linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)"
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
),
|
|
2571
|
+
showAlpha && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "sr-only", htmlFor: `${fieldId}-alpha`, children: "Opacity" }),
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2574
|
+
"input",
|
|
2575
|
+
{
|
|
2576
|
+
id: `${fieldId}-alpha`,
|
|
2577
|
+
type: "range",
|
|
2578
|
+
min: 0,
|
|
2579
|
+
max: 100,
|
|
2580
|
+
step: 1,
|
|
2581
|
+
value: Math.round(hsva.a * 100),
|
|
2582
|
+
onChange: (event) => commit({ ...hsva, a: +event.target.value / 100 }),
|
|
2583
|
+
className: SLIDER,
|
|
2584
|
+
style: {
|
|
2585
|
+
// The ramp runs to the colour being edited, over a chequerboard,
|
|
2586
|
+
// so the track shows what the slider actually controls. Without
|
|
2587
|
+
// any background this rendered as a blank 12px strip whose only
|
|
2588
|
+
// label was screen-reader-only.
|
|
2589
|
+
backgroundImage: `linear-gradient(to right, transparent, ${toHexString({ ...hsva, a: 1 }, false)}), ${CHECKERBOARD}`,
|
|
2590
|
+
backgroundSize: "100% 100%, 8px 8px"
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2594
|
+
] }),
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "sr-only", htmlFor: `${fieldId}-hex`, children: "Hex colour" }),
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2598
|
+
Input,
|
|
2599
|
+
{
|
|
2600
|
+
id: `${fieldId}-hex`,
|
|
2601
|
+
className: "font-mono",
|
|
2602
|
+
value: draftHex ?? rendered,
|
|
2603
|
+
onChange: (event) => {
|
|
2604
|
+
const text = event.target.value;
|
|
2605
|
+
setDraftHex(text);
|
|
2606
|
+
const parsed = parseHex(text);
|
|
2607
|
+
if (parsed) {
|
|
2608
|
+
setHsva(hsvaFrom(parsed, parsed.alpha, hsva.h));
|
|
2609
|
+
onColorChange(toHex(parsed, showAlpha ? parsed.alpha : 1));
|
|
2610
|
+
}
|
|
2611
|
+
},
|
|
2612
|
+
onBlur: () => setDraftHex(null)
|
|
2613
|
+
}
|
|
2614
|
+
),
|
|
2615
|
+
canPickFromScreen && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2616
|
+
Button,
|
|
2617
|
+
{
|
|
2618
|
+
type: "button",
|
|
2619
|
+
variant: "outline",
|
|
2620
|
+
size: "icon",
|
|
2621
|
+
"aria-label": "Pick a colour from the screen",
|
|
2622
|
+
onClick: () => void pickFromScreen(),
|
|
2623
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react12.Pipette, { className: "size-4" })
|
|
2624
|
+
}
|
|
2625
|
+
)
|
|
2626
|
+
] }),
|
|
2627
|
+
swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground mb-1 text-xs", children: "Presets" }),
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-wrap gap-1", children: swatches.map((swatch) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2630
|
+
"button",
|
|
2631
|
+
{
|
|
2632
|
+
type: "button",
|
|
2633
|
+
title: swatch.label,
|
|
2634
|
+
"aria-label": swatch.label,
|
|
2635
|
+
className: "size-6 rounded border shadow-sm",
|
|
2636
|
+
style: { backgroundColor: swatch.color },
|
|
2637
|
+
onClick: () => onSwatchSelect?.(swatch)
|
|
2638
|
+
},
|
|
2639
|
+
swatch.id
|
|
2640
|
+
)) })
|
|
2641
|
+
] }),
|
|
2642
|
+
recentColors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground mb-1 text-xs", children: "Recent" }),
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-wrap gap-1", children: recentColors.map((recent) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2645
|
+
"button",
|
|
2646
|
+
{
|
|
2647
|
+
type: "button",
|
|
2648
|
+
title: recent,
|
|
2649
|
+
"aria-label": recent,
|
|
2650
|
+
className: "size-6 rounded border shadow-sm",
|
|
2651
|
+
style: { backgroundColor: recent },
|
|
2652
|
+
onClick: () => {
|
|
2653
|
+
const parsed = parseHex(recent);
|
|
2654
|
+
if (parsed) commit(hsvaFrom(parsed, parsed.alpha, hsva.h));
|
|
2655
|
+
}
|
|
2656
|
+
},
|
|
2657
|
+
recent
|
|
2658
|
+
)) })
|
|
2659
|
+
] })
|
|
2660
|
+
] });
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
// src/components/context-menu.tsx
|
|
2664
|
+
var ContextMenuPrimitive = __toESM(require("@radix-ui/react-context-menu"), 1);
|
|
2665
|
+
var import_lucide_react13 = require("lucide-react");
|
|
2666
|
+
var React10 = __toESM(require("react"), 1);
|
|
2667
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2325
2668
|
var menuItemBase2 = "cursor-pointer transition-colors data-[highlighted]:bg-muted data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
2326
2669
|
var menuSurface = "z-50 max-h-[var(--radix-context-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 origin-[--radix-context-menu-content-transform-origin]";
|
|
2327
2670
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
@@ -2329,7 +2672,7 @@ var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
|
2329
2672
|
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
2330
2673
|
var ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
2331
2674
|
var ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
2332
|
-
var ContextMenuSubTrigger =
|
|
2675
|
+
var ContextMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2333
2676
|
ContextMenuPrimitive.SubTrigger,
|
|
2334
2677
|
{
|
|
2335
2678
|
ref,
|
|
@@ -2342,14 +2685,14 @@ var ContextMenuSubTrigger = React9.forwardRef(({ className, inset, children, ...
|
|
|
2342
2685
|
...props,
|
|
2343
2686
|
children: [
|
|
2344
2687
|
children,
|
|
2345
|
-
/* @__PURE__ */ (0,
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react13.ChevronRight, { className: "ml-auto" })
|
|
2346
2689
|
]
|
|
2347
2690
|
}
|
|
2348
2691
|
));
|
|
2349
2692
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
2350
|
-
var ContextMenuSubContent =
|
|
2693
|
+
var ContextMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => {
|
|
2351
2694
|
const portalContainer = usePortalContainer();
|
|
2352
|
-
return /* @__PURE__ */ (0,
|
|
2695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ContextMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2353
2696
|
ContextMenuPrimitive.SubContent,
|
|
2354
2697
|
{
|
|
2355
2698
|
ref,
|
|
@@ -2359,9 +2702,9 @@ var ContextMenuSubContent = React9.forwardRef(({ className, ...props }, ref) =>
|
|
|
2359
2702
|
) });
|
|
2360
2703
|
});
|
|
2361
2704
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
2362
|
-
var ContextMenuContent =
|
|
2705
|
+
var ContextMenuContent = React10.forwardRef(({ className, ...props }, ref) => {
|
|
2363
2706
|
const portalContainer = usePortalContainer();
|
|
2364
|
-
return /* @__PURE__ */ (0,
|
|
2707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ContextMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2365
2708
|
ContextMenuPrimitive.Content,
|
|
2366
2709
|
{
|
|
2367
2710
|
ref,
|
|
@@ -2371,7 +2714,7 @@ var ContextMenuContent = React9.forwardRef(({ className, ...props }, ref) => {
|
|
|
2371
2714
|
) });
|
|
2372
2715
|
});
|
|
2373
2716
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
2374
|
-
var ContextMenuItem =
|
|
2717
|
+
var ContextMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2375
2718
|
ContextMenuPrimitive.Item,
|
|
2376
2719
|
{
|
|
2377
2720
|
ref,
|
|
@@ -2385,7 +2728,7 @@ var ContextMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) =>
|
|
|
2385
2728
|
}
|
|
2386
2729
|
));
|
|
2387
2730
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
2388
|
-
var ContextMenuCheckboxItem =
|
|
2731
|
+
var ContextMenuCheckboxItem = React10.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2389
2732
|
ContextMenuPrimitive.CheckboxItem,
|
|
2390
2733
|
{
|
|
2391
2734
|
ref,
|
|
@@ -2397,13 +2740,13 @@ var ContextMenuCheckboxItem = React9.forwardRef(({ className, children, checked,
|
|
|
2397
2740
|
checked,
|
|
2398
2741
|
...props,
|
|
2399
2742
|
children: [
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react13.Check, { className: "h-4 w-4" }) }) }),
|
|
2401
2744
|
children
|
|
2402
2745
|
]
|
|
2403
2746
|
}
|
|
2404
2747
|
));
|
|
2405
2748
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
2406
|
-
var ContextMenuRadioItem =
|
|
2749
|
+
var ContextMenuRadioItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2407
2750
|
ContextMenuPrimitive.RadioItem,
|
|
2408
2751
|
{
|
|
2409
2752
|
ref,
|
|
@@ -2414,13 +2757,13 @@ var ContextMenuRadioItem = React9.forwardRef(({ className, children, ...props },
|
|
|
2414
2757
|
),
|
|
2415
2758
|
...props,
|
|
2416
2759
|
children: [
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react13.Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
2418
2761
|
children
|
|
2419
2762
|
]
|
|
2420
2763
|
}
|
|
2421
2764
|
));
|
|
2422
2765
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
2423
|
-
var ContextMenuLabel =
|
|
2766
|
+
var ContextMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2424
2767
|
ContextMenuPrimitive.Label,
|
|
2425
2768
|
{
|
|
2426
2769
|
ref,
|
|
@@ -2433,7 +2776,7 @@ var ContextMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
2433
2776
|
}
|
|
2434
2777
|
));
|
|
2435
2778
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
2436
|
-
var ContextMenuSeparator =
|
|
2779
|
+
var ContextMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2437
2780
|
ContextMenuPrimitive.Separator,
|
|
2438
2781
|
{
|
|
2439
2782
|
ref,
|
|
@@ -2445,7 +2788,7 @@ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
|
2445
2788
|
var ContextMenuShortcut = ({
|
|
2446
2789
|
className,
|
|
2447
2790
|
...props
|
|
2448
|
-
}) => /* @__PURE__ */ (0,
|
|
2791
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2449
2792
|
"span",
|
|
2450
2793
|
{
|
|
2451
2794
|
className: cn(
|
|
@@ -2458,13 +2801,13 @@ var ContextMenuShortcut = ({
|
|
|
2458
2801
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
2459
2802
|
|
|
2460
2803
|
// src/components/resizable.tsx
|
|
2461
|
-
var
|
|
2804
|
+
var import_lucide_react14 = require("lucide-react");
|
|
2462
2805
|
var ResizablePrimitive = __toESM(require("react-resizable-panels"), 1);
|
|
2463
|
-
var
|
|
2806
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2464
2807
|
var ResizablePanelGroup = ({
|
|
2465
2808
|
className,
|
|
2466
2809
|
...props
|
|
2467
|
-
}) => /* @__PURE__ */ (0,
|
|
2810
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2468
2811
|
ResizablePrimitive.Group,
|
|
2469
2812
|
{
|
|
2470
2813
|
className: cn("h-full w-full", className),
|
|
@@ -2477,7 +2820,7 @@ var ResizableHandle = ({
|
|
|
2477
2820
|
className,
|
|
2478
2821
|
children,
|
|
2479
2822
|
...props
|
|
2480
|
-
}) => /* @__PURE__ */ (0,
|
|
2823
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2481
2824
|
ResizablePrimitive.Separator,
|
|
2482
2825
|
{
|
|
2483
2826
|
className: cn(
|
|
@@ -2497,7 +2840,7 @@ var ResizableHandle = ({
|
|
|
2497
2840
|
),
|
|
2498
2841
|
...props,
|
|
2499
2842
|
children: [
|
|
2500
|
-
withGrip ? /* @__PURE__ */ (0,
|
|
2843
|
+
withGrip ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-border bg-border", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react14.GripVertical, { className: "h-2.5 w-2.5 text-muted-foreground" }) }) : null,
|
|
2501
2844
|
children
|
|
2502
2845
|
]
|
|
2503
2846
|
}
|
|
@@ -2505,9 +2848,9 @@ var ResizableHandle = ({
|
|
|
2505
2848
|
|
|
2506
2849
|
// src/components/tree-view.tsx
|
|
2507
2850
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
2508
|
-
var
|
|
2509
|
-
var
|
|
2510
|
-
var
|
|
2851
|
+
var import_lucide_react15 = require("lucide-react");
|
|
2852
|
+
var React11 = __toESM(require("react"), 1);
|
|
2853
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2511
2854
|
var ROW_HEIGHT = 28;
|
|
2512
2855
|
var INDENT_PER_LEVEL = 12;
|
|
2513
2856
|
function textOf(node) {
|
|
@@ -2548,13 +2891,13 @@ function flatten(nodes, expanded) {
|
|
|
2548
2891
|
return rows;
|
|
2549
2892
|
}
|
|
2550
2893
|
function useControllable(controlled, fallback) {
|
|
2551
|
-
const [uncontrolled, setUncontrolled] =
|
|
2894
|
+
const [uncontrolled, setUncontrolled] = React11.useState(fallback);
|
|
2552
2895
|
return [
|
|
2553
2896
|
controlled === void 0 ? uncontrolled : controlled,
|
|
2554
2897
|
setUncontrolled
|
|
2555
2898
|
];
|
|
2556
2899
|
}
|
|
2557
|
-
var TreeView =
|
|
2900
|
+
var TreeView = React11.forwardRef(
|
|
2558
2901
|
({
|
|
2559
2902
|
nodes,
|
|
2560
2903
|
expandedIds,
|
|
@@ -2569,8 +2912,8 @@ var TreeView = React10.forwardRef(
|
|
|
2569
2912
|
"aria-describedby": ariaDescribedBy,
|
|
2570
2913
|
...props
|
|
2571
2914
|
}, forwardedRef) => {
|
|
2572
|
-
const scrollRef =
|
|
2573
|
-
const attachScroll =
|
|
2915
|
+
const scrollRef = React11.useRef(null);
|
|
2916
|
+
const attachScroll = React11.useCallback(
|
|
2574
2917
|
(node) => {
|
|
2575
2918
|
scrollRef.current = node;
|
|
2576
2919
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
@@ -2584,7 +2927,7 @@ var TreeView = React10.forwardRef(
|
|
|
2584
2927
|
expandedIds === void 0 ? void 0 : [...expandedIds],
|
|
2585
2928
|
[...defaultExpandedIds ?? []]
|
|
2586
2929
|
);
|
|
2587
|
-
const expanded =
|
|
2930
|
+
const expanded = React11.useMemo(
|
|
2588
2931
|
() => new Set(expandedIds ?? expandedState),
|
|
2589
2932
|
[expandedIds, expandedState]
|
|
2590
2933
|
);
|
|
@@ -2592,11 +2935,11 @@ var TreeView = React10.forwardRef(
|
|
|
2592
2935
|
selectedId === void 0 ? void 0 : selectedId,
|
|
2593
2936
|
defaultSelectedId ?? null
|
|
2594
2937
|
);
|
|
2595
|
-
const rows =
|
|
2938
|
+
const rows = React11.useMemo(
|
|
2596
2939
|
() => flatten(nodes, expanded),
|
|
2597
2940
|
[nodes, expanded]
|
|
2598
2941
|
);
|
|
2599
|
-
const [activeId, setActiveId] =
|
|
2942
|
+
const [activeId, setActiveId] = React11.useState(null);
|
|
2600
2943
|
const activeIndex = Math.max(
|
|
2601
2944
|
0,
|
|
2602
2945
|
rows.findIndex((row) => row.node.id === (activeId ?? selected))
|
|
@@ -2640,7 +2983,7 @@ var TreeView = React10.forwardRef(
|
|
|
2640
2983
|
}
|
|
2641
2984
|
return from;
|
|
2642
2985
|
};
|
|
2643
|
-
const typeahead =
|
|
2986
|
+
const typeahead = React11.useRef({ query: "", at: 0 });
|
|
2644
2987
|
const onKeyDown = (event) => {
|
|
2645
2988
|
const index = activeIndex;
|
|
2646
2989
|
const row = rows[index];
|
|
@@ -2737,13 +3080,13 @@ var TreeView = React10.forwardRef(
|
|
|
2737
3080
|
const virtualItems = virtualizer.getVirtualItems();
|
|
2738
3081
|
const usable = (index) => rows[index]?.node.disabled !== true;
|
|
2739
3082
|
const tabStopIndex = virtualItems.some((item) => item.index === activeIndex) && usable(activeIndex) ? activeIndex : virtualItems.find((item) => usable(item.index))?.index ?? -1;
|
|
2740
|
-
return /* @__PURE__ */ (0,
|
|
3083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2741
3084
|
"div",
|
|
2742
3085
|
{
|
|
2743
3086
|
ref: attachScroll,
|
|
2744
3087
|
className: cn("overflow-auto", className),
|
|
2745
3088
|
...props,
|
|
2746
|
-
children: /* @__PURE__ */ (0,
|
|
3089
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2747
3090
|
"div",
|
|
2748
3091
|
{
|
|
2749
3092
|
role: "tree",
|
|
@@ -2756,7 +3099,7 @@ var TreeView = React10.forwardRef(
|
|
|
2756
3099
|
const row = rows[item.index];
|
|
2757
3100
|
if (row === void 0) return null;
|
|
2758
3101
|
const isSelected = selected === row.node.id;
|
|
2759
|
-
return /* @__PURE__ */ (0,
|
|
3102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2760
3103
|
"div",
|
|
2761
3104
|
{
|
|
2762
3105
|
"data-tree-index": item.index,
|
|
@@ -2786,7 +3129,7 @@ var TreeView = React10.forwardRef(
|
|
|
2786
3129
|
paddingLeft: 4 + row.level * INDENT_PER_LEVEL
|
|
2787
3130
|
},
|
|
2788
3131
|
children: [
|
|
2789
|
-
/* @__PURE__ */ (0,
|
|
3132
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2790
3133
|
"span",
|
|
2791
3134
|
{
|
|
2792
3135
|
"aria-hidden": "true",
|
|
@@ -2796,8 +3139,8 @@ var TreeView = React10.forwardRef(
|
|
|
2796
3139
|
event.stopPropagation();
|
|
2797
3140
|
setExpansion(row.node.id, !expanded.has(row.node.id));
|
|
2798
3141
|
},
|
|
2799
|
-
children: row.hasChildren ? /* @__PURE__ */ (0,
|
|
2800
|
-
|
|
3142
|
+
children: row.hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3143
|
+
import_lucide_react15.ChevronRight,
|
|
2801
3144
|
{
|
|
2802
3145
|
className: cn(
|
|
2803
3146
|
"size-3.5 text-muted-foreground transition-transform",
|
|
@@ -2807,8 +3150,8 @@ var TreeView = React10.forwardRef(
|
|
|
2807
3150
|
) : null
|
|
2808
3151
|
}
|
|
2809
3152
|
),
|
|
2810
|
-
row.node.icon !== void 0 ? /* @__PURE__ */ (0,
|
|
2811
|
-
/* @__PURE__ */ (0,
|
|
3153
|
+
row.node.icon !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: row.node.icon }) : null,
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "truncate", children: row.node.label })
|
|
2812
3155
|
]
|
|
2813
3156
|
},
|
|
2814
3157
|
row.node.id
|
|
@@ -2824,7 +3167,7 @@ TreeView.displayName = "TreeView";
|
|
|
2824
3167
|
|
|
2825
3168
|
// src/components/slider.tsx
|
|
2826
3169
|
var SliderPrimitive = __toESM(require("@radix-ui/react-slider"), 1);
|
|
2827
|
-
var
|
|
3170
|
+
var React12 = __toESM(require("react"), 1);
|
|
2828
3171
|
|
|
2829
3172
|
// src/lib/dev-warn.ts
|
|
2830
3173
|
var emitted = /* @__PURE__ */ new Set();
|
|
@@ -2843,7 +3186,7 @@ function devWarnOnce(condition, message) {
|
|
|
2843
3186
|
}
|
|
2844
3187
|
|
|
2845
3188
|
// src/components/slider.tsx
|
|
2846
|
-
var
|
|
3189
|
+
var import_jsx_runtime38 = (
|
|
2847
3190
|
// `aria-label`/`aria-labelledby` are destructured out above rather than
|
|
2848
3191
|
// spread here: left on the root they would be a second, roleless copy
|
|
2849
3192
|
// of a name only the thumb is read for.
|
|
@@ -2855,7 +3198,7 @@ function thumbCount(value, defaultValue) {
|
|
|
2855
3198
|
function hasAccessibleName(value) {
|
|
2856
3199
|
return value !== void 0 && value.trim() !== "";
|
|
2857
3200
|
}
|
|
2858
|
-
var Slider =
|
|
3201
|
+
var Slider = React12.forwardRef(
|
|
2859
3202
|
({
|
|
2860
3203
|
className,
|
|
2861
3204
|
value,
|
|
@@ -2866,7 +3209,7 @@ var Slider = React11.forwardRef(
|
|
|
2866
3209
|
"aria-labelledby": ariaLabelledBy,
|
|
2867
3210
|
...props
|
|
2868
3211
|
}, ref) => {
|
|
2869
|
-
const initialUncontrolledCount =
|
|
3212
|
+
const initialUncontrolledCount = React12.useRef(
|
|
2870
3213
|
thumbCount(void 0, defaultValue)
|
|
2871
3214
|
).current;
|
|
2872
3215
|
const count = value?.length ?? initialUncontrolledCount;
|
|
@@ -2907,7 +3250,7 @@ var Slider = React11.forwardRef(
|
|
|
2907
3250
|
};
|
|
2908
3251
|
};
|
|
2909
3252
|
const isVertical = orientation === "vertical";
|
|
2910
|
-
return /* @__PURE__ */ (0,
|
|
3253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2911
3254
|
SliderPrimitive.Root,
|
|
2912
3255
|
{
|
|
2913
3256
|
ref,
|
|
@@ -2935,14 +3278,14 @@ var Slider = React11.forwardRef(
|
|
|
2935
3278
|
defaultValue: isEmptyDefault ? void 0 : defaultValue,
|
|
2936
3279
|
...props,
|
|
2937
3280
|
children: [
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2939
3282
|
SliderPrimitive.Track,
|
|
2940
3283
|
{
|
|
2941
3284
|
className: cn(
|
|
2942
3285
|
"bg-secondary relative grow overflow-hidden rounded-full",
|
|
2943
3286
|
isVertical ? "h-full w-1.5" : "h-1.5 w-full"
|
|
2944
3287
|
),
|
|
2945
|
-
children: /* @__PURE__ */ (0,
|
|
3288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2946
3289
|
SliderPrimitive.Range,
|
|
2947
3290
|
{
|
|
2948
3291
|
className: cn(
|
|
@@ -2953,7 +3296,7 @@ var Slider = React11.forwardRef(
|
|
|
2953
3296
|
)
|
|
2954
3297
|
}
|
|
2955
3298
|
),
|
|
2956
|
-
Array.from({ length: count }, (_, i) => /* @__PURE__ */ (0,
|
|
3299
|
+
Array.from({ length: count }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2957
3300
|
SliderPrimitive.Thumb,
|
|
2958
3301
|
{
|
|
2959
3302
|
...ariaFor(i),
|
|
@@ -2975,7 +3318,7 @@ var Slider = React11.forwardRef(
|
|
|
2975
3318
|
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
2976
3319
|
|
|
2977
3320
|
// src/lib/shortcuts/react.tsx
|
|
2978
|
-
var
|
|
3321
|
+
var React13 = __toESM(require("react"), 1);
|
|
2979
3322
|
|
|
2980
3323
|
// src/lib/shortcuts/key-spec.ts
|
|
2981
3324
|
function normalizeKey(key) {
|
|
@@ -3309,6 +3652,7 @@ function createShortcutManager(options = {}) {
|
|
|
3309
3652
|
}
|
|
3310
3653
|
}
|
|
3311
3654
|
function handle(event) {
|
|
3655
|
+
if (typeof event.key !== "string") return false;
|
|
3312
3656
|
if (event.defaultPrevented) {
|
|
3313
3657
|
abandonSequence();
|
|
3314
3658
|
return true;
|
|
@@ -3502,10 +3846,10 @@ var FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
|
3502
3846
|
]);
|
|
3503
3847
|
|
|
3504
3848
|
// src/lib/shortcuts/react.tsx
|
|
3505
|
-
var
|
|
3506
|
-
var ShortcutContext =
|
|
3849
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3850
|
+
var ShortcutContext = React13.createContext(null);
|
|
3507
3851
|
var ownersByTarget = /* @__PURE__ */ new WeakMap();
|
|
3508
|
-
var useIsomorphicLayoutEffect = typeof document === "undefined" ?
|
|
3852
|
+
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React13.useEffect : React13.useLayoutEffect;
|
|
3509
3853
|
function optionsFingerprint(options) {
|
|
3510
3854
|
return [
|
|
3511
3855
|
options.isApple ?? "auto",
|
|
@@ -3518,13 +3862,13 @@ function ShortcutProvider({
|
|
|
3518
3862
|
target,
|
|
3519
3863
|
...managerOptions
|
|
3520
3864
|
}) {
|
|
3521
|
-
const parent =
|
|
3865
|
+
const parent = React13.useContext(ShortcutContext);
|
|
3522
3866
|
const resolvedTarget = target === null ? null : target ?? (typeof document === "undefined" ? null : document);
|
|
3523
3867
|
const nestedOnSameTarget = parent !== null && parent.target === resolvedTarget;
|
|
3524
|
-
const optionsRef =
|
|
3525
|
-
const ownManagers =
|
|
3526
|
-
const ownDetached =
|
|
3527
|
-
const detached =
|
|
3868
|
+
const optionsRef = React13.useRef(managerOptions);
|
|
3869
|
+
const ownManagers = React13.useRef(/* @__PURE__ */ new WeakMap());
|
|
3870
|
+
const ownDetached = React13.useRef(null);
|
|
3871
|
+
const detached = React13.useMemo(() => {
|
|
3528
3872
|
if (resolvedTarget === null) {
|
|
3529
3873
|
ownDetached.current ??= createShortcutManager(optionsRef.current);
|
|
3530
3874
|
return ownDetached.current;
|
|
@@ -3580,20 +3924,20 @@ function ShortcutProvider({
|
|
|
3580
3924
|
};
|
|
3581
3925
|
}, [resolvedTarget, manager]);
|
|
3582
3926
|
const depth = nestedOnSameTarget && parent ? parent.depth : 0;
|
|
3583
|
-
const value =
|
|
3927
|
+
const value = React13.useMemo(
|
|
3584
3928
|
() => ({ manager, depth, target: resolvedTarget, options: fingerprint }),
|
|
3585
3929
|
[manager, depth, resolvedTarget, fingerprint]
|
|
3586
3930
|
);
|
|
3587
|
-
return /* @__PURE__ */ (0,
|
|
3931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ShortcutContext.Provider, { value, children });
|
|
3588
3932
|
}
|
|
3589
3933
|
function ShortcutScope({
|
|
3590
3934
|
children
|
|
3591
3935
|
}) {
|
|
3592
|
-
const parent =
|
|
3936
|
+
const parent = React13.useContext(ShortcutContext);
|
|
3593
3937
|
if (!parent) {
|
|
3594
3938
|
throw new Error("ShortcutScope must be rendered inside a ShortcutProvider");
|
|
3595
3939
|
}
|
|
3596
|
-
const value =
|
|
3940
|
+
const value = React13.useMemo(
|
|
3597
3941
|
() => ({
|
|
3598
3942
|
manager: parent.manager,
|
|
3599
3943
|
depth: parent.depth + 1,
|
|
@@ -3604,16 +3948,16 @@ function ShortcutScope({
|
|
|
3604
3948
|
}),
|
|
3605
3949
|
[parent.manager, parent.depth, parent.target, parent.options]
|
|
3606
3950
|
);
|
|
3607
|
-
return /* @__PURE__ */ (0,
|
|
3951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ShortcutContext.Provider, { value, children });
|
|
3608
3952
|
}
|
|
3609
3953
|
function useShortcuts(bindings, options) {
|
|
3610
|
-
const context =
|
|
3954
|
+
const context = React13.useContext(ShortcutContext);
|
|
3611
3955
|
if (!context) {
|
|
3612
3956
|
throw new Error("useShortcuts must be called inside a ShortcutProvider");
|
|
3613
3957
|
}
|
|
3614
3958
|
const { manager, depth } = context;
|
|
3615
|
-
const registration =
|
|
3616
|
-
const latest =
|
|
3959
|
+
const registration = React13.useRef(null);
|
|
3960
|
+
const latest = React13.useRef({ bindings, options });
|
|
3617
3961
|
useIsomorphicLayoutEffect(() => {
|
|
3618
3962
|
registration.current = manager.register([], {
|
|
3619
3963
|
name: latest.current.options.name,
|
|
@@ -3635,7 +3979,7 @@ function useShortcuts(bindings, options) {
|
|
|
3635
3979
|
});
|
|
3636
3980
|
}
|
|
3637
3981
|
function useShortcutManager() {
|
|
3638
|
-
const context =
|
|
3982
|
+
const context = React13.useContext(ShortcutContext);
|
|
3639
3983
|
if (!context) {
|
|
3640
3984
|
throw new Error(
|
|
3641
3985
|
"useShortcutManager must be called inside a ShortcutProvider"
|
|
@@ -3645,7 +3989,7 @@ function useShortcutManager() {
|
|
|
3645
3989
|
}
|
|
3646
3990
|
function useActiveShortcuts() {
|
|
3647
3991
|
const manager = useShortcutManager();
|
|
3648
|
-
return
|
|
3992
|
+
return React13.useSyncExternalStore(
|
|
3649
3993
|
manager.subscribe,
|
|
3650
3994
|
manager.activeBindings,
|
|
3651
3995
|
manager.activeBindings
|
|
@@ -3687,6 +4031,7 @@ function useActiveShortcuts() {
|
|
|
3687
4031
|
Collapsible,
|
|
3688
4032
|
CollapsibleContent,
|
|
3689
4033
|
CollapsibleTrigger,
|
|
4034
|
+
ColorPicker,
|
|
3690
4035
|
Command,
|
|
3691
4036
|
CommandDialog,
|
|
3692
4037
|
CommandEmpty,
|