@enigmax/primitives 0.27.0 → 0.28.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/{chunk-VKL3DEIQ.js → chunk-6WIGVIQF.js} +58 -37
- package/dist/{chunk-O2UJ5ZIX.js → chunk-CB7K6VW4.js} +1 -1
- package/dist/{chunk-2RIO4VDV.js → chunk-IQMHDRJF.js} +2 -2
- package/dist/{chunk-PVDU6AZU.js → chunk-JPBVKXOL.js} +1 -1
- package/dist/{chunk-CPJJ3FPW.js → chunk-RRPWJAIJ.js} +26 -12
- package/dist/chunk-RXEO4WPI.js +111 -0
- package/dist/{chunk-RMNXVWQ4.js → chunk-YHH5U2NW.js} +1 -1
- package/dist/{color-T63FLJNH.js → color-WBNVPFT5.js} +157 -158
- package/dist/{menu-52PXC5PL.js → menu-5JZMGNOT.js} +2 -1
- package/dist/{menu-YIGMPFUP.js → menu-O3G4LM5O.js} +3 -2
- package/dist/next/index.js +6 -5
- package/dist/react/context-menu.d.ts +1 -1
- package/dist/react/context-menu.js +2 -1
- package/dist/react/image.js +1 -1
- package/dist/react/index.js +6 -5
- package/dist/react/input.js +1 -1
- package/dist/react/select.d.ts +6 -1
- package/dist/react/select.js +2 -1
- package/dist/react/video.js +1 -1
- package/dist/react-router/index.js +6 -5
- package/dist/viewer-C323RYNZ.js +3 -0
- package/package.json +1 -1
- package/recipes/color/styles.css +12 -7
- package/recipes/context-menu/styles.css +9 -2
- package/recipes/select/styles.css +24 -7
- package/registry.json +98 -5
- package/src/core/floating.ts +71 -0
- package/src/react/context-menu/root.tsx +30 -15
- package/src/react/context-menu/styles.ts +9 -2
- package/src/react/floating.ts +185 -0
- package/src/react/input/color-styles.ts +12 -7
- package/src/react/input/color.tsx +30 -27
- package/src/react/select/context.ts +5 -0
- package/src/react/select/root.tsx +33 -21
- package/src/react/select/styles.ts +24 -7
- package/dist/viewer-N5WLFB24.js +0 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { parseColor, rgbToHsv, colorEquals, hsvToRgb, formatColor, toHex } from './chunk-S2FPN5ID.js';
|
|
2
2
|
import { writeValue, ColorSwatch } from './chunk-KVLSOQTI.js';
|
|
3
|
+
import { useFloating, tabOut } from './chunk-RXEO4WPI.js';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
3
5
|
import { useLayoutEffect, useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
4
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
7
|
|
|
@@ -23,6 +25,11 @@ var COLOR_STYLES = `
|
|
|
23
25
|
on, which is why only one colour is a property. */
|
|
24
26
|
--enigma-color-checker: rgba(255, 255, 255, 0.22);
|
|
25
27
|
--enigma-color-checker-size: 0.5rem;
|
|
28
|
+
|
|
29
|
+
/* The layer every portaled popup shares, declared with the same value by the select and
|
|
30
|
+
the context menu: above the lightbox (9999), because a popup is opened FROM whatever
|
|
31
|
+
is on top. Not in the light-scheme block, or half the readers get no z-index. */
|
|
32
|
+
--enigma-floating-z: 10000;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
@media (prefers-color-scheme: light) {
|
|
@@ -39,9 +46,7 @@ var COLOR_STYLES = `
|
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
|
|
42
|
-
/* The anchor the panel
|
|
43
|
-
positioning context so the panel needs no portal and no scroll listener: it moves with
|
|
44
|
-
the field because it is INSIDE it. */
|
|
49
|
+
/* The anchor the panel is placed against. Inline so it sits in the field's own row. */
|
|
45
50
|
[data-enigma-color] { position: relative; display: inline-flex; flex: none; }
|
|
46
51
|
|
|
47
52
|
[data-enigma-color-swatch] {
|
|
@@ -65,8 +70,13 @@ var COLOR_STYLES = `
|
|
|
65
70
|
rather than the last good colour: a stale swatch says the value is fine when it is not. */
|
|
66
71
|
[data-enigma-color-swatch][data-invalid] [data-enigma-color-fill] { background: none; }
|
|
67
72
|
|
|
73
|
+
/* Portaled and placed in viewport coordinates against the swatch (see react/floating.ts),
|
|
74
|
+
so a dialog or a card with overflow: hidden cannot cut it off. left, top, max-height and
|
|
75
|
+
data-side are written by the placement: below, flipped above when there is more room
|
|
76
|
+
there, and capped to the room it has - scrolling inside rather than off the screen. */
|
|
68
77
|
[data-enigma-color-panel] {
|
|
69
|
-
position:
|
|
78
|
+
position: fixed; z-index: var(--enigma-floating-z);
|
|
79
|
+
overflow-y: auto; overscroll-behavior: contain;
|
|
70
80
|
display: grid; gap: 0.625rem;
|
|
71
81
|
box-sizing: border-box; width: var(--enigma-color-panel-width); padding: 0.625rem;
|
|
72
82
|
color: var(--enigma-color-text); background: var(--enigma-color-panel-bg);
|
|
@@ -74,9 +84,6 @@ var COLOR_STYLES = `
|
|
|
74
84
|
border-radius: var(--enigma-color-panel-radius);
|
|
75
85
|
box-shadow: var(--enigma-color-panel-shadow);
|
|
76
86
|
}
|
|
77
|
-
/* Flipped when the field sits near the bottom of the window. Without it the panel opens off
|
|
78
|
-
the screen and the controls are unreachable, which is the same defect the select fixes. */
|
|
79
|
-
[data-enigma-color-panel][data-side="top"] { top: auto; bottom: calc(100% + 0.375rem); }
|
|
80
87
|
|
|
81
88
|
[data-enigma-color-area] {
|
|
82
89
|
position: relative; height: var(--enigma-color-area-height);
|
|
@@ -164,6 +171,7 @@ var COLOR_STYLES = `
|
|
|
164
171
|
var INITIAL = { h: 0, s: 0, v: 0, a: 1 };
|
|
165
172
|
var STEP = { fine: 0.01, coarse: 0.1, hue: 1, hueCoarse: 10 };
|
|
166
173
|
var MARGIN = 12;
|
|
174
|
+
var GAP = 6;
|
|
167
175
|
var FORMATS = ["hex", "rgb", "hsl"];
|
|
168
176
|
var FORMAT_LABELS = { hex: "HEX", rgb: "RGB", hsl: "HSL" };
|
|
169
177
|
var injected = false;
|
|
@@ -200,7 +208,6 @@ function ColorExtras({
|
|
|
200
208
|
const swatchRef = useRef(null);
|
|
201
209
|
const areaRef = useRef(null);
|
|
202
210
|
const [open, setOpen] = useState(openOnMount && !locked);
|
|
203
|
-
const [side, setSide] = useState(placement === "top" ? "top" : "bottom");
|
|
204
211
|
const parsed = useMemo(() => parseColor(value), [value]);
|
|
205
212
|
const [hsv, setHsv] = useState(() => parsed ? rgbToHsv(parsed) : INITIAL);
|
|
206
213
|
useEffect(() => {
|
|
@@ -230,22 +237,14 @@ function ColorExtras({
|
|
|
230
237
|
setOpenState(false);
|
|
231
238
|
if (focusSwatch) swatchRef.current?.focus();
|
|
232
239
|
}, [setOpenState]);
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const below = window.innerHeight - anchor.bottom;
|
|
239
|
-
setSide(below < panel.height + MARGIN && anchor.top > below ? "top" : "bottom");
|
|
240
|
-
}, [placement]);
|
|
241
|
-
useLayoutEffect(() => {
|
|
242
|
-
if (!open) return;
|
|
243
|
-
place();
|
|
244
|
-
}, [open, place]);
|
|
240
|
+
const showing = open && !locked;
|
|
241
|
+
const container = useFloating({ open: showing, anchorRef, panelRef, gap: GAP, margin: MARGIN, side: placement });
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
if (showing && container) areaRef.current?.focus();
|
|
244
|
+
}, [showing, container]);
|
|
245
245
|
useEffect(() => {
|
|
246
246
|
if (!open) return;
|
|
247
|
-
|
|
248
|
-
const inside = (target) => Boolean(anchorRef.current?.contains(target));
|
|
247
|
+
const inside = (target) => Boolean(anchorRef.current?.contains(target) || panelRef.current?.contains(target));
|
|
249
248
|
const onPointerDown = (event) => {
|
|
250
249
|
if (!inside(event.target)) setOpenState(false);
|
|
251
250
|
};
|
|
@@ -253,16 +252,13 @@ function ColorExtras({
|
|
|
253
252
|
if (event.target === document.body || inside(event.target)) return;
|
|
254
253
|
setOpenState(false);
|
|
255
254
|
};
|
|
256
|
-
const onResize = () => place();
|
|
257
255
|
document.addEventListener("pointerdown", onPointerDown, true);
|
|
258
256
|
document.addEventListener("focusin", onFocusIn, true);
|
|
259
|
-
window.addEventListener("resize", onResize);
|
|
260
257
|
return () => {
|
|
261
258
|
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
262
259
|
document.removeEventListener("focusin", onFocusIn, true);
|
|
263
|
-
window.removeEventListener("resize", onResize);
|
|
264
260
|
};
|
|
265
|
-
}, [open,
|
|
261
|
+
}, [open, setOpenState]);
|
|
266
262
|
const track = useCallback((event, onMove) => {
|
|
267
263
|
if (event.button !== 0) return;
|
|
268
264
|
const element = event.currentTarget;
|
|
@@ -354,149 +350,152 @@ function ColorExtras({
|
|
|
354
350
|
locked,
|
|
355
351
|
label: text.open ?? "Pick a colour",
|
|
356
352
|
onPress: () => open ? close(true) : setOpenState(true),
|
|
357
|
-
children:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
ref: areaRef,
|
|
376
|
-
"data-enigma-color-area": "",
|
|
377
|
-
role: "slider",
|
|
378
|
-
tabIndex: 0,
|
|
379
|
-
"aria-label": text.area ?? "Saturation and brightness",
|
|
380
|
-
"aria-valuemin": 0,
|
|
381
|
-
"aria-valuemax": 100,
|
|
382
|
-
"aria-valuenow": Math.round(hsv.s * 100),
|
|
383
|
-
"aria-valuetext": `${Math.round(hsv.s * 100)}% saturation, ${Math.round(hsv.v * 100)}% brightness, ${valueText}`,
|
|
384
|
-
onKeyDown: areaKeys,
|
|
385
|
-
onPointerDown: (event) => track(event, (x, y) => commit({ ...hsv, s: x, v: 1 - y })),
|
|
386
|
-
children: /* @__PURE__ */ jsx("span", { "data-enigma-color-thumb": "", style: { left: `${hsv.s * 100}%`, top: `${(1 - hsv.v) * 100}%` } })
|
|
387
|
-
}
|
|
388
|
-
),
|
|
389
|
-
/* @__PURE__ */ jsxs("div", { "data-enigma-color-controls": "", children: [
|
|
390
|
-
/* @__PURE__ */ jsx("span", { "data-enigma-color-preview": "", "data-enigma-color-checkers": "", children: /* @__PURE__ */ jsx("span", { "data-enigma-color-fill": "", style: { background: css } }) }),
|
|
391
|
-
dropper && /* @__PURE__ */ jsx(
|
|
392
|
-
"button",
|
|
353
|
+
children: showing && container && createPortal(
|
|
354
|
+
/* @__PURE__ */ jsxs(
|
|
355
|
+
"div",
|
|
356
|
+
{
|
|
357
|
+
ref: panelRef,
|
|
358
|
+
"data-enigma-color-panel": "",
|
|
359
|
+
role: "dialog",
|
|
360
|
+
"aria-label": text.panel ?? "Colour picker",
|
|
361
|
+
style: panelStyle,
|
|
362
|
+
onKeyDown: (event) => {
|
|
363
|
+
if (tabOut(event, panelRef.current, swatchRef.current)) return;
|
|
364
|
+
if (event.key !== "Escape") return;
|
|
365
|
+
event.stopPropagation();
|
|
366
|
+
close(true);
|
|
367
|
+
},
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
"div",
|
|
393
371
|
{
|
|
394
|
-
|
|
395
|
-
"data-enigma-color-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
372
|
+
ref: areaRef,
|
|
373
|
+
"data-enigma-color-area": "",
|
|
374
|
+
role: "slider",
|
|
375
|
+
tabIndex: 0,
|
|
376
|
+
"aria-label": text.area ?? "Saturation and brightness",
|
|
377
|
+
"aria-valuemin": 0,
|
|
378
|
+
"aria-valuemax": 100,
|
|
379
|
+
"aria-valuenow": Math.round(hsv.s * 100),
|
|
380
|
+
"aria-valuetext": `${Math.round(hsv.s * 100)}% saturation, ${Math.round(hsv.v * 100)}% brightness, ${valueText}`,
|
|
381
|
+
onKeyDown: areaKeys,
|
|
382
|
+
onPointerDown: (event) => track(event, (x, y) => commit({ ...hsv, s: x, v: 1 - y })),
|
|
383
|
+
children: /* @__PURE__ */ jsx("span", { "data-enigma-color-thumb": "", style: { left: `${hsv.s * 100}%`, top: `${(1 - hsv.v) * 100}%` } })
|
|
402
384
|
}
|
|
403
385
|
),
|
|
404
|
-
/* @__PURE__ */ jsxs("div", { "data-enigma-color-
|
|
386
|
+
/* @__PURE__ */ jsxs("div", { "data-enigma-color-controls": "", children: [
|
|
387
|
+
/* @__PURE__ */ jsx("span", { "data-enigma-color-preview": "", "data-enigma-color-checkers": "", children: /* @__PURE__ */ jsx("span", { "data-enigma-color-fill": "", style: { background: css } }) }),
|
|
388
|
+
dropper && /* @__PURE__ */ jsx(
|
|
389
|
+
"button",
|
|
390
|
+
{
|
|
391
|
+
type: "button",
|
|
392
|
+
"data-enigma-color-eyedropper": "",
|
|
393
|
+
"aria-label": text.eyedropper ?? "Pick a colour from the screen",
|
|
394
|
+
title: text.eyedropper ?? "Pick a colour from the screen",
|
|
395
|
+
onClick: () => {
|
|
396
|
+
void pick();
|
|
397
|
+
},
|
|
398
|
+
children: /* @__PURE__ */ jsx(EyedropperIcon, {})
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
/* @__PURE__ */ jsxs("div", { "data-enigma-color-rails": "", children: [
|
|
402
|
+
/* @__PURE__ */ jsx(
|
|
403
|
+
"div",
|
|
404
|
+
{
|
|
405
|
+
"data-enigma-color-rail": "hue",
|
|
406
|
+
role: "slider",
|
|
407
|
+
tabIndex: 0,
|
|
408
|
+
"aria-label": text.hue ?? "Hue",
|
|
409
|
+
"aria-valuemin": 0,
|
|
410
|
+
"aria-valuemax": 360,
|
|
411
|
+
"aria-valuenow": Math.round(hsv.h),
|
|
412
|
+
"aria-valuetext": `${Math.round(hsv.h)} degrees`,
|
|
413
|
+
onKeyDown: (event) => railKeys(event, "hue"),
|
|
414
|
+
onPointerDown: (event) => track(event, (x) => commit({ ...hsv, h: x * 360 })),
|
|
415
|
+
children: /* @__PURE__ */ jsx("span", { "data-enigma-color-thumb": "", style: { left: `${hsv.h / 360 * 100}%` } })
|
|
416
|
+
}
|
|
417
|
+
),
|
|
418
|
+
alpha && /* @__PURE__ */ jsxs(
|
|
419
|
+
"div",
|
|
420
|
+
{
|
|
421
|
+
"data-enigma-color-rail": "alpha",
|
|
422
|
+
"data-enigma-color-checkers": "",
|
|
423
|
+
role: "slider",
|
|
424
|
+
tabIndex: 0,
|
|
425
|
+
"aria-label": text.alpha ?? "Opacity",
|
|
426
|
+
"aria-valuemin": 0,
|
|
427
|
+
"aria-valuemax": 100,
|
|
428
|
+
"aria-valuenow": Math.round(hsv.a * 100),
|
|
429
|
+
"aria-valuetext": `${Math.round(hsv.a * 100)}% opacity`,
|
|
430
|
+
onKeyDown: (event) => railKeys(event, "alpha"),
|
|
431
|
+
onPointerDown: (event) => track(event, (x) => commit({ ...hsv, a: x })),
|
|
432
|
+
children: [
|
|
433
|
+
/* @__PURE__ */ jsx("span", { "data-enigma-color-gradient": "" }),
|
|
434
|
+
/* @__PURE__ */ jsx("span", { "data-enigma-color-thumb": "", style: { left: `${hsv.a * 100}%` } })
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] })
|
|
439
|
+
] }),
|
|
440
|
+
/* @__PURE__ */ jsxs("div", { "data-enigma-color-value": "", children: [
|
|
405
441
|
/* @__PURE__ */ jsx(
|
|
406
|
-
"
|
|
442
|
+
"button",
|
|
407
443
|
{
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
onPointerDown: (event) => track(event, (x) => commit({ ...hsv, h: x * 360 })),
|
|
418
|
-
children: /* @__PURE__ */ jsx("span", { "data-enigma-color-thumb": "", style: { left: `${hsv.h / 360 * 100}%` } })
|
|
444
|
+
type: "button",
|
|
445
|
+
"data-enigma-color-format": "",
|
|
446
|
+
"aria-label": `${text.formatAs ?? "Show as"} ${FORMAT_LABELS[nextFormat]}`,
|
|
447
|
+
title: `${text.formatAs ?? "Show as"} ${FORMAT_LABELS[nextFormat]}`,
|
|
448
|
+
onClick: () => {
|
|
449
|
+
setShown(nextFormat);
|
|
450
|
+
setDraft(null);
|
|
451
|
+
},
|
|
452
|
+
children: FORMAT_LABELS[shown]
|
|
419
453
|
}
|
|
420
454
|
),
|
|
421
|
-
|
|
422
|
-
"
|
|
455
|
+
/* @__PURE__ */ jsx(
|
|
456
|
+
"input",
|
|
423
457
|
{
|
|
424
|
-
|
|
425
|
-
"data-enigma-color-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
"
|
|
430
|
-
"
|
|
431
|
-
"
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
458
|
+
type: "text",
|
|
459
|
+
"data-enigma-color-input": "",
|
|
460
|
+
value: draft ?? readout,
|
|
461
|
+
"aria-label": text.value ?? "Colour value",
|
|
462
|
+
spellCheck: false,
|
|
463
|
+
autoComplete: "off",
|
|
464
|
+
autoCorrect: "off",
|
|
465
|
+
autoCapitalize: "off",
|
|
466
|
+
onChange: (event) => typed(event.target.value),
|
|
467
|
+
onBlur: () => setDraft(null),
|
|
468
|
+
onKeyDown: (event) => {
|
|
469
|
+
if (event.key !== "Enter") return;
|
|
470
|
+
event.preventDefault();
|
|
471
|
+
setDraft(null);
|
|
472
|
+
}
|
|
439
473
|
}
|
|
440
474
|
)
|
|
441
|
-
] })
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
475
|
+
] }),
|
|
476
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ jsx("div", { "data-enigma-color-swatches": "", role: "group", "aria-label": text.swatches ?? "Preset colours", children: swatches.map((preset) => {
|
|
477
|
+
const colour = parseColor(preset);
|
|
478
|
+
return /* @__PURE__ */ jsx(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
type: "button",
|
|
482
|
+
"data-enigma-color-preset": "",
|
|
483
|
+
"data-enigma-color-checkers": "",
|
|
484
|
+
style: { background: preset },
|
|
485
|
+
"aria-label": preset,
|
|
486
|
+
title: preset,
|
|
487
|
+
"aria-pressed": colourEqualsPreset(colour, css),
|
|
488
|
+
onClick: () => {
|
|
489
|
+
if (colour) commit(rgbToHsv(alpha ? colour : { ...colour, a: 1 }, hsv.h));
|
|
490
|
+
}
|
|
454
491
|
},
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
)
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
"data-enigma-color-input": "",
|
|
463
|
-
value: draft ?? readout,
|
|
464
|
-
"aria-label": text.value ?? "Colour value",
|
|
465
|
-
spellCheck: false,
|
|
466
|
-
autoComplete: "off",
|
|
467
|
-
autoCorrect: "off",
|
|
468
|
-
autoCapitalize: "off",
|
|
469
|
-
onChange: (event) => typed(event.target.value),
|
|
470
|
-
onBlur: () => setDraft(null),
|
|
471
|
-
onKeyDown: (event) => {
|
|
472
|
-
if (event.key !== "Enter") return;
|
|
473
|
-
event.preventDefault();
|
|
474
|
-
setDraft(null);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
)
|
|
478
|
-
] }),
|
|
479
|
-
swatches && swatches.length > 0 && /* @__PURE__ */ jsx("div", { "data-enigma-color-swatches": "", role: "group", "aria-label": text.swatches ?? "Preset colours", children: swatches.map((preset) => {
|
|
480
|
-
const colour = parseColor(preset);
|
|
481
|
-
return /* @__PURE__ */ jsx(
|
|
482
|
-
"button",
|
|
483
|
-
{
|
|
484
|
-
type: "button",
|
|
485
|
-
"data-enigma-color-preset": "",
|
|
486
|
-
"data-enigma-color-checkers": "",
|
|
487
|
-
style: { background: preset },
|
|
488
|
-
"aria-label": preset,
|
|
489
|
-
title: preset,
|
|
490
|
-
"aria-pressed": colourEqualsPreset(colour, css),
|
|
491
|
-
onClick: () => {
|
|
492
|
-
if (colour) commit(rgbToHsv(alpha ? colour : { ...colour, a: 1 }, hsv.h));
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
preset
|
|
496
|
-
);
|
|
497
|
-
}) })
|
|
498
|
-
]
|
|
499
|
-
}
|
|
492
|
+
preset
|
|
493
|
+
);
|
|
494
|
+
}) })
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
container
|
|
500
499
|
)
|
|
501
500
|
}
|
|
502
501
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ContextMenu, useContextMenuContext } from './chunk-
|
|
1
|
+
import { ContextMenu, useContextMenuContext } from './chunk-RRPWJAIJ.js';
|
|
2
2
|
import './chunk-YQV5XZIA.js';
|
|
3
|
+
import './chunk-RXEO4WPI.js';
|
|
3
4
|
import './chunk-4VUHQFAT.js';
|
|
4
5
|
import './chunk-HS3X3XCW.js';
|
|
5
6
|
import './chunk-4ZPMP47J.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Download, NewTab, MenuButton } from './chunk-
|
|
1
|
+
import { Download, NewTab, MenuButton } from './chunk-CB7K6VW4.js';
|
|
2
2
|
import { downloadFile, openInNewTab } from './chunk-HUUINHPR.js';
|
|
3
|
-
import { ContextMenu, useContextMenuContext } from './chunk-
|
|
3
|
+
import { ContextMenu, useContextMenuContext } from './chunk-RRPWJAIJ.js';
|
|
4
4
|
import './chunk-EYZ366LP.js';
|
|
5
5
|
import './chunk-YQV5XZIA.js';
|
|
6
|
+
import './chunk-RXEO4WPI.js';
|
|
6
7
|
import './chunk-4VUHQFAT.js';
|
|
7
8
|
import './chunk-HS3X3XCW.js';
|
|
8
9
|
import './chunk-4ZPMP47J.js';
|
package/dist/next/index.js
CHANGED
|
@@ -4,11 +4,11 @@ export { useSearch } from '../chunk-45UHLZYT.js';
|
|
|
4
4
|
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
5
5
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
6
6
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
7
|
-
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
7
|
+
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-RRPWJAIJ.js';
|
|
8
8
|
export { SelectionList, useSelection } from '../chunk-N6PDHMAX.js';
|
|
9
|
-
export { Image } from '../chunk-
|
|
9
|
+
export { Image } from '../chunk-IQMHDRJF.js';
|
|
10
10
|
import '../chunk-EYZ366LP.js';
|
|
11
|
-
export { Video } from '../chunk-
|
|
11
|
+
export { Video } from '../chunk-JPBVKXOL.js';
|
|
12
12
|
import { Button } from '../chunk-6BGBYUSZ.js';
|
|
13
13
|
export { getLinkComponent, setLinkComponent, useButton } from '../chunk-6BGBYUSZ.js';
|
|
14
14
|
export { Flag } from '../chunk-NPHRS2Q7.js';
|
|
@@ -27,11 +27,12 @@ import '../chunk-MMQPZGSU.js';
|
|
|
27
27
|
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-LMZJBOZG.js';
|
|
28
28
|
import '../chunk-SNYUBXWQ.js';
|
|
29
29
|
import '../chunk-UOSSNUSC.js';
|
|
30
|
-
export { Input } from '../chunk-
|
|
30
|
+
export { Input } from '../chunk-YHH5U2NW.js';
|
|
31
31
|
import '../chunk-KVLSOQTI.js';
|
|
32
32
|
import '../chunk-F25CGNQC.js';
|
|
33
33
|
export { PaletteContent, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteRoot, PaletteTrigger, SearchPalette, usePaletteContext } from '../chunk-FGBIZDV2.js';
|
|
34
|
-
export { Select, SelectContent, SelectList, SelectOptionRow, SelectRoot, SelectSearch, SelectTrigger, SelectValue, useSelectContext } from '../chunk-
|
|
34
|
+
export { Select, SelectContent, SelectList, SelectOptionRow, SelectRoot, SelectSearch, SelectTrigger, SelectValue, useSelectContext } from '../chunk-6WIGVIQF.js';
|
|
35
|
+
import '../chunk-RXEO4WPI.js';
|
|
35
36
|
export { createSelect } from '../chunk-NONGREXC.js';
|
|
36
37
|
export { isApplePlatform, matchesShortcut, parseShortcut, shortcutText, shortcutTokens } from '../chunk-4VUHQFAT.js';
|
|
37
38
|
export { Slot, mergeSlotProps } from '../chunk-HS3X3XCW.js';
|
|
@@ -130,7 +130,7 @@ declare function ContextMenuRow({ level, index, entry, children, ...props }: Con
|
|
|
130
130
|
* is PREPENDED to `<head>`, so anything the document already has wins on source order at
|
|
131
131
|
* equal specificity.
|
|
132
132
|
*/
|
|
133
|
-
declare const CONTEXT_MENU_STYLES = "\n:root {\n --enigma-menu-bg: #1c1c1c;\n --enigma-menu-border: #333333;\n --enigma-menu-radius: 0.625rem;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);\n --enigma-menu-text: #f5f5f5;\n --enigma-menu-muted: #a3a3a3;\n --enigma-menu-font-size: 0.8125rem;\n --enigma-menu-min-width: 12rem;\n --enigma-menu-max-height: 20rem;\n\n --enigma-menu-active-bg: #2a2a2a;\n --enigma-menu-accent: #fbbf24;\n --enigma-menu-danger: #f87171;\n --enigma-menu-danger-bg: rgba(248, 113, 113, 0.12);\n\n /* Above the lightbox, which sits at 9999, because a menu is opened FROM whatever is on\n top: the image viewer's own three-dot menu was portalled to the same body and painted\n underneath it, so its rows could be neither seen nor pressed. A menu is the topmost\n transient surface on a page, and this is the number that says so. It belongs here and\n not in the light-scheme block, or half the readers get an invalid z-index. */\n --enigma-
|
|
133
|
+
declare const CONTEXT_MENU_STYLES = "\n:root {\n --enigma-menu-bg: #1c1c1c;\n --enigma-menu-border: #333333;\n --enigma-menu-radius: 0.625rem;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);\n --enigma-menu-text: #f5f5f5;\n --enigma-menu-muted: #a3a3a3;\n --enigma-menu-font-size: 0.8125rem;\n --enigma-menu-min-width: 12rem;\n --enigma-menu-max-height: 20rem;\n\n --enigma-menu-active-bg: #2a2a2a;\n --enigma-menu-accent: #fbbf24;\n --enigma-menu-danger: #f87171;\n --enigma-menu-danger-bg: rgba(248, 113, 113, 0.12);\n\n /* Above the lightbox, which sits at 9999, because a menu is opened FROM whatever is on\n top: the image viewer's own three-dot menu was portalled to the same body and painted\n underneath it, so its rows could be neither seen nor pressed. A menu is the topmost\n transient surface on a page, and this is the number that says so. It belongs here and\n not in the light-scheme block, or half the readers get an invalid z-index.\n --enigma-floating-z is the layer the select and the colour picker share, declared with\n the same value in their sheets, so overriding it once moves every popup together. */\n --enigma-floating-z: 10000;\n --enigma-menu-z: var(--enigma-floating-z);\n}\n\n@media (prefers-color-scheme: light) {\n :root {\n --enigma-menu-bg: #ffffff;\n --enigma-menu-border: #e5e5e5;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);\n --enigma-menu-text: #171717;\n --enigma-menu-muted: #737373;\n --enigma-menu-active-bg: #f5f5f5;\n --enigma-menu-accent: #b45309;\n --enigma-menu-danger: #b91c1c;\n --enigma-menu-danger-bg: rgba(185, 28, 28, 0.08);\n }\n}\n\n/* Every panel is positioned in VIEWPORT coordinates, which is what a pointer event reports\n and what a menu opened at the pointer needs. Fixed rather than absolute so a scrolling\n ancestor cannot drag it away from the place it was opened. */\n[data-enigma-menu-panel] {\n position: fixed; z-index: var(--enigma-menu-z);\n /* A column, so the max-height the placement writes in a short window shrinks the LIST,\n which scrolls, rather than letting rows spill past the panel's edge. */\n display: flex; flex-direction: column;\n box-sizing: border-box;\n min-width: var(--enigma-menu-min-width);\n max-width: min(22rem, calc(100vw - 1rem));\n padding: 0.25rem;\n color: var(--enigma-menu-text);\n background: var(--enigma-menu-bg);\n border: 1px solid var(--enigma-menu-border);\n border-radius: var(--enigma-menu-radius);\n box-shadow: var(--enigma-menu-shadow);\n font-size: var(--enigma-menu-font-size);\n animation: enigma-menu-in 90ms ease-out;\n /* Measured before it is placed, and placed before it is seen: without this the panel is\n painted at 0,0 for one frame and jumps to the pointer on the next. */\n visibility: hidden;\n}\n[data-enigma-menu-panel][data-placed] { visibility: visible; }\n/* No focus ring around the panel. It takes focus so the keyboard has somewhere to be, not\n because it is a control: what MOVES is the highlighted row, drawn by [data-active] and\n announced through aria-activedescendant. A ring around the whole menu says the menu is the\n thing focused, which is not what is happening - and it appears the moment you press an\n arrow, over a surface that was already showing you where you are. Nothing is lost by\n removing it, because nothing inside is reachable by Tab: the menu owns that key. */\n[data-enigma-menu-panel]:focus,\n[data-enigma-menu-panel]:focus-visible { outline: none; }\n@keyframes enigma-menu-in {\n from { opacity: 0; transform: scale(0.98); }\n to { opacity: 1; transform: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n [data-enigma-menu-panel] { animation: none; }\n}\n\n/* The heading: what the menu is acting ON. A long file name is cut rather than allowed to\n set the panel's width, and the full one stays reachable through its title attribute. */\n[data-enigma-menu-title] {\n margin: 0; padding: 0.375rem 0.5rem 0.25rem;\n font-size: 0.6875rem; font-weight: 600;\n color: var(--enigma-menu-muted);\n overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n}\n\n[data-enigma-menu-search] {\n width: 100%; box-sizing: border-box;\n padding: 0.375rem 0.5rem 0.5rem;\n font: inherit; font-size: var(--enigma-menu-font-size);\n color: var(--enigma-menu-text); background: transparent;\n border: 0; border-bottom: 1px solid var(--enigma-menu-border);\n outline: none;\n}\n[data-enigma-menu-search]::-webkit-search-cancel-button,\n[data-enigma-menu-search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }\n\n[data-enigma-menu-list] {\n max-height: var(--enigma-menu-max-height);\n min-height: 0; flex: 0 1 auto;\n overflow-y: auto; overscroll-behavior: contain;\n}\n\n[data-enigma-menu-item] {\n display: flex; align-items: center; gap: 0.5rem;\n padding: 0.3125rem 0.5rem; border-radius: 0.375rem;\n line-height: 1.4;\n color: var(--enigma-menu-text);\n /* The hand, not the arrow. A native menu uses the arrow because the whole surface is\n drawn by the OS and nothing on a page looks like it; here the rows sit on a web page,\n where the hand is what says \"this is a thing you press\". */\n cursor: pointer; user-select: none;\n}\n[data-enigma-menu-item][data-active] { background: var(--enigma-menu-active-bg); }\n[data-enigma-menu-item][data-disabled] { opacity: 0.45; cursor: not-allowed; }\n[data-enigma-menu-item][data-destructive] { color: var(--enigma-menu-danger); }\n[data-enigma-menu-item][data-destructive][data-active] { background: var(--enigma-menu-danger-bg); }\n\n[data-enigma-menu-item-text] { display: grid; min-width: 0; }\n[data-enigma-menu-item-label] { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n[data-enigma-menu-item-description] {\n font-size: 0.6875rem; color: var(--enigma-menu-muted);\n overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n}\n\n[data-enigma-menu-icon] { display: inline-flex; align-items: center; flex: none; width: 1rem; max-height: 1.25em; line-height: 0; }\n\n/* The shortcut, on the right, the way every desktop menu prints it. margin-left: auto is\n what pushes it there, and flex: none is what stops a long label squashing it. */\n[data-enigma-menu-shortcut] {\n display: flex; align-items: center; gap: 0.125rem;\n flex: none; margin-left: auto; padding-left: 1.5rem;\n font-size: 0.6875rem; color: var(--enigma-menu-muted);\n font-variant-numeric: tabular-nums;\n}\n[data-enigma-menu-shortcut] kbd { font: inherit; }\n\n/* The submenu arrow shares the shortcut's slot, so a row never has both pushed apart. */\n[data-enigma-menu-arrow] {\n flex: none; margin-left: auto;\n width: 0.35rem; height: 0.35rem;\n border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor;\n transform: rotate(45deg);\n opacity: 0.6;\n}\n[data-enigma-menu-shortcut] + [data-enigma-menu-arrow] { margin-left: 0.5rem; }\n\n/* Check and radio: drawn rather than loaded, and reserving their space either way so\n choosing a row does not shift the label under the pointer. */\n[data-enigma-menu-check] {\n flex: none; width: 1rem; height: 1rem;\n display: grid; place-items: center;\n color: var(--enigma-menu-accent);\n}\n[data-enigma-menu-check]::after { content: \"\"; width: 0.35rem; height: 0.6rem; opacity: 0; }\n[data-enigma-menu-item][aria-checked=\"true\"] [data-enigma-menu-check]::after {\n opacity: 1;\n border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;\n transform: rotate(45deg) translate(-0.05rem, -0.05rem);\n}\n[data-enigma-menu-item][role=\"menuitemradio\"] [data-enigma-menu-check]::after {\n width: 0.4rem; height: 0.4rem; border-radius: 999px; background: currentColor;\n transform: none; border: 0;\n}\n\n[data-enigma-menu-separator] {\n height: 1px; margin: 0.25rem 0.25rem;\n background: var(--enigma-menu-border);\n}\n\n[data-enigma-menu-label] {\n margin: 0.375rem 0 0.125rem; padding: 0 0.5rem;\n font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;\n color: var(--enigma-menu-muted);\n}\n\n[data-enigma-menu-status] {\n margin: 0; padding: 0.625rem 0.5rem;\n font-size: var(--enigma-menu-font-size); color: var(--enigma-menu-muted);\n /* The quoted query is cut in the text as well, but a pasted string with no spaces has no\n break opportunity at all - so this is what stops it stretching the panel. */\n overflow-wrap: anywhere;\n}\n[data-enigma-menu-status][data-error] { color: var(--enigma-menu-danger); }\n\n/* The end-of-window marker: one pixel, so it has a box to be scrolled into. */\n[data-enigma-menu-more] { height: 1px; }\n";
|
|
134
134
|
|
|
135
135
|
type ContextMenuProps = ContextMenuRootProps & {
|
|
136
136
|
/** How many rows to put in the document at once. `Infinity` renders the lot. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { CONTEXT_MENU_STYLES, ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
2
|
+
export { CONTEXT_MENU_STYLES, ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-RRPWJAIJ.js';
|
|
3
3
|
export { CLIPBOARD_PREFIX, CONTEXT_MENU_SEARCH_KEYS, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-YQV5XZIA.js';
|
|
4
|
+
import '../chunk-RXEO4WPI.js';
|
|
4
5
|
export { matchesShortcut, parseShortcut, shortcutText, shortcutTokens } from '../chunk-4VUHQFAT.js';
|
|
5
6
|
import '../chunk-HS3X3XCW.js';
|
|
6
7
|
import '../chunk-4ZPMP47J.js';
|
package/dist/react/image.js
CHANGED
package/dist/react/index.js
CHANGED
|
@@ -4,11 +4,11 @@ export { useSearch } from '../chunk-45UHLZYT.js';
|
|
|
4
4
|
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
5
5
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
6
6
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
7
|
-
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
7
|
+
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-RRPWJAIJ.js';
|
|
8
8
|
export { SelectionList, useSelection } from '../chunk-N6PDHMAX.js';
|
|
9
|
-
export { Image } from '../chunk-
|
|
9
|
+
export { Image } from '../chunk-IQMHDRJF.js';
|
|
10
10
|
import '../chunk-EYZ366LP.js';
|
|
11
|
-
export { Video } from '../chunk-
|
|
11
|
+
export { Video } from '../chunk-JPBVKXOL.js';
|
|
12
12
|
export { Button, getLinkComponent, setLinkComponent, useButton } from '../chunk-6BGBYUSZ.js';
|
|
13
13
|
export { Flag } from '../chunk-NPHRS2Q7.js';
|
|
14
14
|
export { Toaster, toast, useSonner } from '../chunk-WPTBURIC.js';
|
|
@@ -26,11 +26,12 @@ import '../chunk-MMQPZGSU.js';
|
|
|
26
26
|
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-LMZJBOZG.js';
|
|
27
27
|
import '../chunk-SNYUBXWQ.js';
|
|
28
28
|
import '../chunk-UOSSNUSC.js';
|
|
29
|
-
export { Input } from '../chunk-
|
|
29
|
+
export { Input } from '../chunk-YHH5U2NW.js';
|
|
30
30
|
import '../chunk-KVLSOQTI.js';
|
|
31
31
|
import '../chunk-F25CGNQC.js';
|
|
32
32
|
export { PaletteContent, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteRoot, PaletteTrigger, SearchPalette, usePaletteContext } from '../chunk-FGBIZDV2.js';
|
|
33
|
-
export { Select, SelectContent, SelectList, SelectOptionRow, SelectRoot, SelectSearch, SelectTrigger, SelectValue, useSelectContext } from '../chunk-
|
|
33
|
+
export { Select, SelectContent, SelectList, SelectOptionRow, SelectRoot, SelectSearch, SelectTrigger, SelectValue, useSelectContext } from '../chunk-6WIGVIQF.js';
|
|
34
|
+
import '../chunk-RXEO4WPI.js';
|
|
34
35
|
export { createSelect } from '../chunk-NONGREXC.js';
|
|
35
36
|
export { isApplePlatform, matchesShortcut, parseShortcut, shortcutText, shortcutTokens } from '../chunk-4VUHQFAT.js';
|
|
36
37
|
export { Slot, mergeSlotProps } from '../chunk-HS3X3XCW.js';
|
package/dist/react/input.js
CHANGED