@funnest/charts-ui 0.11.64 → 0.11.66
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/components/color-picker.d.ts +23 -5
- package/dist/components/page-layer.d.ts +1 -1
- package/dist/i18n.d.ts +2 -0
- package/dist/index.js +332 -307
- package/package.json +2 -2
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
|
-
import type
|
|
2
|
+
import { type ComponentChildren } from 'preact';
|
|
3
3
|
import type { Strings } from '../i18n.js';
|
|
4
4
|
/** Rows of the board: grays, three lighter rows, the hues, two darker rows. */
|
|
5
5
|
export declare const PALETTE: readonly (readonly string[])[];
|
|
6
6
|
export declare function recentColors(): string[];
|
|
7
7
|
/** A color picked with the browser's picker: first among the recent ones (shared by every field). */
|
|
8
8
|
export declare function rememberColor(color: string): string[];
|
|
9
|
+
type PaletteStrings = Pick<Strings, 'paletteCustom' | 'paletteRecent'>;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* The board itself: the ready colors, the ones picked lately, and 직접 고르기 (the browser's picker).
|
|
12
|
+
* In ColorPicker's pop, or right in a menu (🖌 on the drawing bar).
|
|
12
13
|
*/
|
|
13
|
-
export declare function
|
|
14
|
+
export declare function PaletteBoard({ value, label, t, onPick, onCustom }: {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
t: PaletteStrings;
|
|
18
|
+
onPick(color: string): void;
|
|
19
|
+
onCustom?(color: string): void;
|
|
20
|
+
}): import("preact").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* A button (`children`: what it shows) that opens the board under it — or above when there's no room.
|
|
23
|
+
* The board is on a layer over the page: a scrolling list, a menu or a moved (transformed) bar it
|
|
24
|
+
* sits in can't cut it off.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ColorPicker({ value, label, t, onPick, class: cls, style, tip, boardClass, onOpen, children, }: {
|
|
14
27
|
/** #rrggbb (anything else: nothing marked). */
|
|
15
28
|
value: string;
|
|
16
29
|
label: string;
|
|
17
|
-
t:
|
|
30
|
+
t: PaletteStrings;
|
|
18
31
|
onPick(color: string): void;
|
|
19
32
|
class?: string;
|
|
20
33
|
style?: Record<string, string>;
|
|
21
34
|
tip?: string;
|
|
35
|
+
/** A class for the board (fnc-palette-big: bigger cells for a finger). */
|
|
36
|
+
boardClass?: string;
|
|
37
|
+
/** The board opened (e.g. to close the menus beside the button). */
|
|
38
|
+
onOpen?(): void;
|
|
22
39
|
children?: ComponentChildren;
|
|
23
40
|
}): import("preact").JSX.Element;
|
|
41
|
+
export {};
|
package/dist/i18n.d.ts
CHANGED
|
@@ -316,6 +316,7 @@ export declare const STRINGS: {
|
|
|
316
316
|
moreToolsDown: string;
|
|
317
317
|
lockView: string;
|
|
318
318
|
unlockView: string;
|
|
319
|
+
hideNavButtons: string;
|
|
319
320
|
lockRatio: string;
|
|
320
321
|
settingAutoScale: string;
|
|
321
322
|
hintAutoScale: string;
|
|
@@ -722,6 +723,7 @@ export declare const STRINGS: {
|
|
|
722
723
|
moreToolsDown: string;
|
|
723
724
|
lockView: string;
|
|
724
725
|
unlockView: string;
|
|
726
|
+
hideNavButtons: string;
|
|
725
727
|
lockRatio: string;
|
|
726
728
|
settingAutoScale: string;
|
|
727
729
|
hintAutoScale: string;
|
package/dist/index.js
CHANGED
|
@@ -751,6 +751,7 @@ var STRINGS = {
|
|
|
751
751
|
moreToolsDown: "\uC544\uB798 \uB3C4\uAD6C \uB354 \uBCF4\uAE30",
|
|
752
752
|
lockView: "\uCC28\uD2B8 \uACE0\uC815",
|
|
753
753
|
unlockView: "\uCC28\uD2B8 \uACE0\uC815 \uD480\uAE30",
|
|
754
|
+
hideNavButtons: "\uD655\uB300\xB7\uC774\uB3D9 \uBC84\uD2BC \uC228\uAE30\uAE30 (\uCC28\uD2B8 \uC124\uC815\uC5D0\uC11C \uB2E4\uC2DC \uCF1C\uC694)",
|
|
754
755
|
lockRatio: "\uAC00\uACA9 \uCD95 \uBE44\uC728 \uACE0\uC815",
|
|
755
756
|
settingAutoScale: "\uC790\uB3D9 \uB9DE\uCDA4",
|
|
756
757
|
hintAutoScale: "\uD654\uBA74\uC5D0 \uBCF4\uC774\uB294 \uCE94\uB4E4\uC5D0 \uB9DE\uCDB0 \uAC00\uACA9 \uCD95\uC744 \uB298\uC774\uACE0 \uC904\uC5EC\uC694. \uAC00\uACA9 \uCD95\uC744 \uB04C\uC5B4 \uC9C1\uC811 \uB9DE\uCD94\uBA74 \uAEBC\uC9C0\uACE0, \uAC00\uACA9 \uCD95\uC744 \uB354\uBE14\uD074\uB9AD\uD558\uBA74 \uB2E4\uC2DC \uCF1C\uC838\uC694.",
|
|
@@ -1159,6 +1160,7 @@ var STRINGS = {
|
|
|
1159
1160
|
moreToolsDown: "More tools below",
|
|
1160
1161
|
lockView: "Lock chart",
|
|
1161
1162
|
unlockView: "Unlock chart",
|
|
1163
|
+
hideNavButtons: "Hide zoom & scroll buttons (turn them back on in chart settings)",
|
|
1162
1164
|
lockRatio: "Lock price to bar ratio",
|
|
1163
1165
|
settingAutoScale: "Auto (fit to screen)",
|
|
1164
1166
|
hintAutoScale: "The price axis stretches to fit the candles on screen. Dragging the axis turns it off; double-click the axis to turn it back on.",
|
|
@@ -1337,258 +1339,6 @@ function IntervalVisibilityEditor({ t: t3, value, onChange }) {
|
|
|
1337
1339
|
}) });
|
|
1338
1340
|
}
|
|
1339
1341
|
|
|
1340
|
-
// src/components/color-picker.tsx
|
|
1341
|
-
var GRAYS = ["#FFFFFF", "#F2F4F6", "#D1D6DB", "#B0B8C1", "#8B95A1", "#6B7684", "#4E5968", "#333D4B", "#191F28", "#000000"];
|
|
1342
|
-
var HUES = ["#F04452", "#FF9F0A", "#FFD43B", "#94D82D", "#12B886", "#15AABF", "#3182F6", "#4C6EF5", "#7048E8", "#E64980"];
|
|
1343
|
-
var hex = (n2) => Math.round(Math.max(0, Math.min(255, n2))).toString(16).padStart(2, "0");
|
|
1344
|
-
function mix(color, t3) {
|
|
1345
|
-
const v3 = [1, 3, 5].map((i3) => parseInt(color.slice(i3, i3 + 2), 16));
|
|
1346
|
-
const to = t3 > 0 ? 255 : 0;
|
|
1347
|
-
const k2 = Math.abs(t3);
|
|
1348
|
-
return `#${v3.map((c3) => hex(c3 + (to - c3) * k2)).join("")}`.toUpperCase();
|
|
1349
|
-
}
|
|
1350
|
-
var PALETTE = [GRAYS, ...[0.75, 0.5, 0.25].map((t3) => HUES.map((c3) => mix(c3, t3))), HUES, ...[-0.25, -0.5].map((t3) => HUES.map((c3) => mix(c3, t3)))];
|
|
1351
|
-
var RECENT_KEY = "fnc-drawing-colors";
|
|
1352
|
-
var RECENT_MAX = 10;
|
|
1353
|
-
function recentColors() {
|
|
1354
|
-
try {
|
|
1355
|
-
const list = JSON.parse(localStorage.getItem(RECENT_KEY) ?? "[]");
|
|
1356
|
-
return Array.isArray(list) ? list.filter((c3) => typeof c3 === "string" && /^#[0-9a-f]{6}$/i.test(c3)).slice(0, RECENT_MAX) : [];
|
|
1357
|
-
} catch {
|
|
1358
|
-
return [];
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
function rememberColor(color) {
|
|
1362
|
-
const next = [color, ...recentColors().filter((c3) => c3.toLowerCase() !== color.toLowerCase())].slice(0, RECENT_MAX);
|
|
1363
|
-
try {
|
|
1364
|
-
localStorage.setItem(RECENT_KEY, JSON.stringify(next));
|
|
1365
|
-
} catch {
|
|
1366
|
-
}
|
|
1367
|
-
return next;
|
|
1368
|
-
}
|
|
1369
|
-
var MARGIN = 8;
|
|
1370
|
-
var same = (a4, b) => a4.slice(0, 7).toLowerCase() === b.slice(0, 7).toLowerCase();
|
|
1371
|
-
function ColorPicker({
|
|
1372
|
-
value,
|
|
1373
|
-
label,
|
|
1374
|
-
t: t3,
|
|
1375
|
-
onPick,
|
|
1376
|
-
class: cls,
|
|
1377
|
-
style,
|
|
1378
|
-
tip,
|
|
1379
|
-
children
|
|
1380
|
-
}) {
|
|
1381
|
-
const [open, setOpen] = d2(false);
|
|
1382
|
-
const [recent, setRecent] = d2([]);
|
|
1383
|
-
const wrap = T2(null);
|
|
1384
|
-
const button = T2(null);
|
|
1385
|
-
const pop = T2(null);
|
|
1386
|
-
A2(() => {
|
|
1387
|
-
if (!open) return;
|
|
1388
|
-
setRecent(recentColors());
|
|
1389
|
-
const close = (e3) => !wrap.current?.contains(e3.target) && setOpen(false);
|
|
1390
|
-
const esc = (e3) => {
|
|
1391
|
-
if (e3.key !== "Escape") return;
|
|
1392
|
-
e3.stopPropagation();
|
|
1393
|
-
setOpen(false);
|
|
1394
|
-
button.current?.focus();
|
|
1395
|
-
};
|
|
1396
|
-
document.addEventListener("pointerdown", close, true);
|
|
1397
|
-
document.addEventListener("keydown", esc, true);
|
|
1398
|
-
return () => {
|
|
1399
|
-
document.removeEventListener("pointerdown", close, true);
|
|
1400
|
-
document.removeEventListener("keydown", esc, true);
|
|
1401
|
-
};
|
|
1402
|
-
}, [open]);
|
|
1403
|
-
F2(() => {
|
|
1404
|
-
const el = pop.current;
|
|
1405
|
-
const a4 = button.current;
|
|
1406
|
-
if (!open || !el || !a4) return;
|
|
1407
|
-
const place = () => {
|
|
1408
|
-
const r3 = a4.getBoundingClientRect();
|
|
1409
|
-
el.style.left = "0px";
|
|
1410
|
-
el.style.top = "0px";
|
|
1411
|
-
const origin = el.getBoundingClientRect();
|
|
1412
|
-
const vw = document.documentElement.clientWidth;
|
|
1413
|
-
const vh = document.documentElement.clientHeight;
|
|
1414
|
-
const below = r3.bottom + 6;
|
|
1415
|
-
const top = below + el.offsetHeight + MARGIN <= vh ? below : Math.max(MARGIN, r3.top - 6 - el.offsetHeight);
|
|
1416
|
-
const left = Math.max(MARGIN, Math.min(vw - MARGIN - el.offsetWidth, r3.left));
|
|
1417
|
-
el.style.left = `${Math.round(left - origin.left)}px`;
|
|
1418
|
-
el.style.top = `${Math.round(top - origin.top)}px`;
|
|
1419
|
-
};
|
|
1420
|
-
place();
|
|
1421
|
-
window.addEventListener("resize", place);
|
|
1422
|
-
window.addEventListener("scroll", place, true);
|
|
1423
|
-
return () => {
|
|
1424
|
-
window.removeEventListener("resize", place);
|
|
1425
|
-
window.removeEventListener("scroll", place, true);
|
|
1426
|
-
};
|
|
1427
|
-
}, [open]);
|
|
1428
|
-
const pick = (color) => {
|
|
1429
|
-
onPick(color);
|
|
1430
|
-
setOpen(false);
|
|
1431
|
-
};
|
|
1432
|
-
const swatch = (color) => /* @__PURE__ */ a3(
|
|
1433
|
-
"button",
|
|
1434
|
-
{
|
|
1435
|
-
type: "button",
|
|
1436
|
-
class: "fnc-palette-cell",
|
|
1437
|
-
role: "option",
|
|
1438
|
-
style: { background: color },
|
|
1439
|
-
"aria-label": color,
|
|
1440
|
-
"aria-selected": same(color, value),
|
|
1441
|
-
onClick: () => pick(color)
|
|
1442
|
-
},
|
|
1443
|
-
color
|
|
1444
|
-
);
|
|
1445
|
-
return /* @__PURE__ */ a3("span", { class: "fnc-palette-wrap", ref: wrap, children: [
|
|
1446
|
-
/* @__PURE__ */ a3(
|
|
1447
|
-
"button",
|
|
1448
|
-
{
|
|
1449
|
-
type: "button",
|
|
1450
|
-
ref: button,
|
|
1451
|
-
class: cls,
|
|
1452
|
-
style,
|
|
1453
|
-
"data-tip": tip,
|
|
1454
|
-
"aria-label": label,
|
|
1455
|
-
"aria-haspopup": "listbox",
|
|
1456
|
-
"aria-expanded": open,
|
|
1457
|
-
onClick: () => setOpen(!open),
|
|
1458
|
-
children
|
|
1459
|
-
}
|
|
1460
|
-
),
|
|
1461
|
-
open && /* @__PURE__ */ a3("div", { class: "fnc-palette", ref: pop, role: "dialog", "aria-label": label, onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
|
|
1462
|
-
/* @__PURE__ */ a3("div", { class: "fnc-palette-grid", role: "listbox", "aria-label": label, children: PALETTE.map((row2) => row2.map(swatch)) }),
|
|
1463
|
-
recent.length > 0 && /* @__PURE__ */ a3($, { children: [
|
|
1464
|
-
/* @__PURE__ */ a3("div", { class: "fnc-palette-title", children: t3.paletteRecent }),
|
|
1465
|
-
/* @__PURE__ */ a3("div", { class: "fnc-palette-grid", role: "listbox", "aria-label": t3.paletteRecent, children: recent.map(swatch) })
|
|
1466
|
-
] }),
|
|
1467
|
-
/* @__PURE__ */ a3("label", { class: "fnc-palette-custom", children: [
|
|
1468
|
-
/* @__PURE__ */ a3("span", { class: "fnc-palette-custom-chip", style: { background: /^#[0-9a-f]{6}/i.test(value) ? value.slice(0, 7) : "#3182F6" } }),
|
|
1469
|
-
/* @__PURE__ */ a3("span", { children: t3.paletteCustom }),
|
|
1470
|
-
/* @__PURE__ */ a3(
|
|
1471
|
-
"input",
|
|
1472
|
-
{
|
|
1473
|
-
type: "color",
|
|
1474
|
-
value: /^#[0-9a-f]{6}/i.test(value) ? value.slice(0, 7) : "#3182f6",
|
|
1475
|
-
onInput: (e3) => onPick(e3.target.value),
|
|
1476
|
-
onChange: (e3) => setRecent(rememberColor(e3.target.value))
|
|
1477
|
-
}
|
|
1478
|
-
)
|
|
1479
|
-
] })
|
|
1480
|
-
] })
|
|
1481
|
-
] });
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
// src/components/hover-open.ts
|
|
1485
|
-
var HIDE_TIP = "fnc-hide-tip";
|
|
1486
|
-
var OPEN_MS = 140;
|
|
1487
|
-
var CLOSE_MS = 260;
|
|
1488
|
-
function useHoverOpen(open, onOpen, group) {
|
|
1489
|
-
const timer = T2(null);
|
|
1490
|
-
const byHover = T2(false);
|
|
1491
|
-
const clear = () => {
|
|
1492
|
-
if (timer.current) clearTimeout(timer.current);
|
|
1493
|
-
timer.current = null;
|
|
1494
|
-
};
|
|
1495
|
-
A2(() => {
|
|
1496
|
-
if (open) {
|
|
1497
|
-
group?.current?.dispatchEvent(new CustomEvent(HIDE_TIP, { bubbles: true }));
|
|
1498
|
-
return;
|
|
1499
|
-
}
|
|
1500
|
-
byHover.current = false;
|
|
1501
|
-
clear();
|
|
1502
|
-
}, [open]);
|
|
1503
|
-
A2(() => clear, []);
|
|
1504
|
-
return {
|
|
1505
|
-
onPointerEnter: (e3) => {
|
|
1506
|
-
if (e3.pointerType !== "mouse") return;
|
|
1507
|
-
clear();
|
|
1508
|
-
if (open) return;
|
|
1509
|
-
timer.current = setTimeout(() => {
|
|
1510
|
-
byHover.current = true;
|
|
1511
|
-
onOpen(true);
|
|
1512
|
-
}, OPEN_MS);
|
|
1513
|
-
},
|
|
1514
|
-
onPointerLeave: (e3) => {
|
|
1515
|
-
if (e3.pointerType !== "mouse") return;
|
|
1516
|
-
clear();
|
|
1517
|
-
if (!open || !byHover.current) return;
|
|
1518
|
-
timer.current = setTimeout(() => onOpen(false), CLOSE_MS);
|
|
1519
|
-
},
|
|
1520
|
-
/** The corner button: opens or closes the list — or, when hovering opened it, keeps it open until a click outside. */
|
|
1521
|
-
toggle: () => {
|
|
1522
|
-
clear();
|
|
1523
|
-
if (open && byHover.current) {
|
|
1524
|
-
byHover.current = false;
|
|
1525
|
-
return;
|
|
1526
|
-
}
|
|
1527
|
-
onOpen(!open);
|
|
1528
|
-
}
|
|
1529
|
-
};
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
// src/components/keep-in-view.ts
|
|
1533
|
-
var MARGIN2 = 8;
|
|
1534
|
-
function useKeepInView(open) {
|
|
1535
|
-
const ref = T2(null);
|
|
1536
|
-
F2(() => {
|
|
1537
|
-
const el = ref.current;
|
|
1538
|
-
if (!open || !el) return;
|
|
1539
|
-
el.style.translate = "";
|
|
1540
|
-
const fit2 = () => {
|
|
1541
|
-
el.style.translate = "";
|
|
1542
|
-
el.style.maxHeight = "";
|
|
1543
|
-
const r3 = el.getBoundingClientRect();
|
|
1544
|
-
const root = el.closest(".fnc-root")?.getBoundingClientRect();
|
|
1545
|
-
const maxY = Math.min(document.documentElement.clientHeight, root?.bottom ?? Infinity) - MARGIN2;
|
|
1546
|
-
if (r3.bottom > maxY) {
|
|
1547
|
-
el.style.maxHeight = `${Math.max(120, Math.floor(maxY - r3.top))}px`;
|
|
1548
|
-
el.style.overflowY = "auto";
|
|
1549
|
-
}
|
|
1550
|
-
const minX = Math.max(0, root?.left ?? 0) + MARGIN2;
|
|
1551
|
-
const maxX = Math.min(document.documentElement.clientWidth, root?.right ?? Infinity) - MARGIN2;
|
|
1552
|
-
let dx = 0;
|
|
1553
|
-
if (r3.right > maxX) dx = maxX - r3.right;
|
|
1554
|
-
if (r3.left + dx < minX) dx = minX - r3.left;
|
|
1555
|
-
if (dx) el.style.translate = `${Math.round(dx)}px 0`;
|
|
1556
|
-
};
|
|
1557
|
-
fit2();
|
|
1558
|
-
window.addEventListener("resize", fit2);
|
|
1559
|
-
return () => window.removeEventListener("resize", fit2);
|
|
1560
|
-
}, [open]);
|
|
1561
|
-
return ref;
|
|
1562
|
-
}
|
|
1563
|
-
function useBesideAnchor(open, anchor) {
|
|
1564
|
-
const ref = T2(null);
|
|
1565
|
-
F2(() => {
|
|
1566
|
-
const el = ref.current;
|
|
1567
|
-
const a4 = anchor.current;
|
|
1568
|
-
if (!open || !el || !a4) return;
|
|
1569
|
-
const place = () => {
|
|
1570
|
-
const r3 = a4.getBoundingClientRect();
|
|
1571
|
-
el.style.position = "fixed";
|
|
1572
|
-
el.style.left = "0px";
|
|
1573
|
-
el.style.top = "0px";
|
|
1574
|
-
const origin = el.getBoundingClientRect();
|
|
1575
|
-
const vh = document.documentElement.clientHeight;
|
|
1576
|
-
const top = Math.max(MARGIN2, Math.min(r3.top, vh - MARGIN2 - el.offsetHeight));
|
|
1577
|
-
el.style.left = `${Math.round(r3.right + 8 - origin.left)}px`;
|
|
1578
|
-
el.style.top = `${Math.round(top - origin.top)}px`;
|
|
1579
|
-
};
|
|
1580
|
-
place();
|
|
1581
|
-
const bar = a4.closest(".fnc-drawbar");
|
|
1582
|
-
window.addEventListener("resize", place);
|
|
1583
|
-
bar?.addEventListener("scroll", place);
|
|
1584
|
-
return () => {
|
|
1585
|
-
window.removeEventListener("resize", place);
|
|
1586
|
-
bar?.removeEventListener("scroll", place);
|
|
1587
|
-
};
|
|
1588
|
-
}, [open]);
|
|
1589
|
-
return ref;
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
1342
|
// src/shell.ts
|
|
1593
1343
|
import { darkTheme, directionColors, lightTheme } from "@funnest/charts";
|
|
1594
1344
|
|
|
@@ -2330,8 +2080,11 @@ var CSS = (
|
|
|
2330
2080
|
opacity: 0;
|
|
2331
2081
|
transition: opacity 0.15s;
|
|
2332
2082
|
}
|
|
2333
|
-
.
|
|
2083
|
+
/* Shown while the mouse is near the chart's bottom (overlay.tsx): unseen, they don't take clicks either. */
|
|
2084
|
+
.fnc-nav.is-near, .fnc-nav:focus-within { opacity: 1; }
|
|
2085
|
+
.fnc-nav:not(.is-near):not(:focus-within):not(.fnc-nav-locked) .fnc-btn { pointer-events: none; }
|
|
2334
2086
|
.fnc-nav .fnc-btn { width: 32px; height: 32px; }
|
|
2087
|
+
.fnc-nav .fnc-sep { align-self: center; height: 18px; margin: 0 1px; }
|
|
2335
2088
|
.fnc-realtime {
|
|
2336
2089
|
position: absolute;
|
|
2337
2090
|
display: flex;
|
|
@@ -2743,9 +2496,6 @@ var CSS = (
|
|
|
2743
2496
|
.fnc-resizing-x, .fnc-resizing-x * { cursor: col-resize !important; user-select: none; }
|
|
2744
2497
|
.fnc-resizing-y, .fnc-resizing-y * { cursor: row-resize !important; user-select: none; }
|
|
2745
2498
|
.fnc-parking { display: none; }
|
|
2746
|
-
/* Navigation controls follow the hovered pane, not the whole widget. */
|
|
2747
|
-
.fnc-multi .fnc-body:hover .fnc-nav { opacity: 0; }
|
|
2748
|
-
.fnc-multi .fnc-stage:hover .fnc-nav, .fnc-multi .fnc-nav:focus-within { opacity: 1; }
|
|
2749
2499
|
.fnc-pane-max {
|
|
2750
2500
|
position: absolute;
|
|
2751
2501
|
top: 6px;
|
|
@@ -2991,9 +2741,9 @@ var CSS = (
|
|
|
2991
2741
|
.fnc-ss-text { box-sizing: border-box; width: 100%; height: 42px; font-size: 15px; }
|
|
2992
2742
|
.fnc-ss-body .fnc-menu-item { min-height: 44px; font-size: 15px; }
|
|
2993
2743
|
.fnc-ss-body .fnc-levels-list { max-height: none; }
|
|
2994
|
-
/*
|
|
2995
|
-
.fnc-
|
|
2996
|
-
.fnc-
|
|
2744
|
+
/* A list over the bar that's taller than the room scrolls, but shows no scroll bar. */
|
|
2745
|
+
.fnc-selbar-pop { scrollbar-width: none; }
|
|
2746
|
+
.fnc-selbar-pop::-webkit-scrollbar { display: none; }
|
|
2997
2747
|
.fnc-selbar-pop.fnc-note-menu { width: auto; }
|
|
2998
2748
|
.fnc-line-pop { padding: 6px 14px; }
|
|
2999
2749
|
.fnc-line-pop .fnc-ss-seg button { width: 42px; }
|
|
@@ -3232,6 +2982,9 @@ var CSS = (
|
|
|
3232
2982
|
z-index: 30;
|
|
3233
2983
|
}
|
|
3234
2984
|
.fnc-levels-list { max-height: none; }
|
|
2985
|
+
/* T's note on a phone on its side: a shorter field, so it fits over the chart without scrolling. */
|
|
2986
|
+
.fnc-note-menu { gap: 6px; padding: 8px 12px; }
|
|
2987
|
+
.fnc-note-menu textarea { min-height: 36px; }
|
|
3235
2988
|
/* Thin indicator panes: their legend stays on one line (not over the pane below). */
|
|
3236
2989
|
.fnc-pane-legend .fnc-ind { flex-wrap: nowrap; white-space: nowrap; }
|
|
3237
2990
|
.fnc-backdrop { padding: 0; align-items: stretch; }
|
|
@@ -3328,6 +3081,15 @@ var CSS = (
|
|
|
3328
3081
|
box-shadow: 0 8px 28px rgb(0 0 0 / 0.16), 0 0 0 1px var(--fnc-border);
|
|
3329
3082
|
cursor: default;
|
|
3330
3083
|
}
|
|
3084
|
+
@media (pointer: coarse) {
|
|
3085
|
+
/* \u{1F58C}'s board for a finger: cells up to 30px, as many as the screen's width and height leave room for. */
|
|
3086
|
+
.fnc-palette-big .fnc-palette-grid { --cell: min(30px, calc((100vw - 81px) / 10), calc((100dvh - 142px) / 8)); grid-template-columns: repeat(10, var(--cell)); gap: 5px; }
|
|
3087
|
+
.fnc-palette-big .fnc-palette-cell { width: var(--cell); height: var(--cell); }
|
|
3088
|
+
}
|
|
3089
|
+
.fnc-palette-board { display: flex; flex-direction: column; gap: 6px; }
|
|
3090
|
+
/* The board's page layer: only the board takes taps, the page under it stays live. */
|
|
3091
|
+
.fnc-root.fnc-layer.fnc-layer-pass { pointer-events: none; }
|
|
3092
|
+
.fnc-layer-pass > * { pointer-events: auto; }
|
|
3331
3093
|
.fnc-palette-grid { display: grid; grid-template-columns: repeat(10, 20px); gap: 4px; }
|
|
3332
3094
|
.fnc-palette-cell { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; cursor: pointer; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.22); }
|
|
3333
3095
|
.fnc-palette-cell:hover { transform: scale(1.12); }
|
|
@@ -3757,6 +3519,280 @@ function usePageLayer(anchor, settings) {
|
|
|
3757
3519
|
return layer;
|
|
3758
3520
|
}
|
|
3759
3521
|
|
|
3522
|
+
// src/components/color-picker.tsx
|
|
3523
|
+
var GRAYS = ["#FFFFFF", "#F2F4F6", "#D1D6DB", "#B0B8C1", "#8B95A1", "#6B7684", "#4E5968", "#333D4B", "#191F28", "#000000"];
|
|
3524
|
+
var HUES = ["#F04452", "#FF9F0A", "#FFD43B", "#94D82D", "#12B886", "#15AABF", "#3182F6", "#4C6EF5", "#7048E8", "#E64980"];
|
|
3525
|
+
var hex = (n2) => Math.round(Math.max(0, Math.min(255, n2))).toString(16).padStart(2, "0");
|
|
3526
|
+
function mix(color, t3) {
|
|
3527
|
+
const v3 = [1, 3, 5].map((i3) => parseInt(color.slice(i3, i3 + 2), 16));
|
|
3528
|
+
const to = t3 > 0 ? 255 : 0;
|
|
3529
|
+
const k2 = Math.abs(t3);
|
|
3530
|
+
return `#${v3.map((c3) => hex(c3 + (to - c3) * k2)).join("")}`.toUpperCase();
|
|
3531
|
+
}
|
|
3532
|
+
var PALETTE = [GRAYS, ...[0.75, 0.5, 0.25].map((t3) => HUES.map((c3) => mix(c3, t3))), HUES, ...[-0.25, -0.5].map((t3) => HUES.map((c3) => mix(c3, t3)))];
|
|
3533
|
+
var RECENT_KEY = "fnc-drawing-colors";
|
|
3534
|
+
var RECENT_MAX = 10;
|
|
3535
|
+
function recentColors() {
|
|
3536
|
+
try {
|
|
3537
|
+
const list = JSON.parse(localStorage.getItem(RECENT_KEY) ?? "[]");
|
|
3538
|
+
return Array.isArray(list) ? list.filter((c3) => typeof c3 === "string" && /^#[0-9a-f]{6}$/i.test(c3)).slice(0, RECENT_MAX) : [];
|
|
3539
|
+
} catch {
|
|
3540
|
+
return [];
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
function rememberColor(color) {
|
|
3544
|
+
const next = [color, ...recentColors().filter((c3) => c3.toLowerCase() !== color.toLowerCase())].slice(0, RECENT_MAX);
|
|
3545
|
+
try {
|
|
3546
|
+
localStorage.setItem(RECENT_KEY, JSON.stringify(next));
|
|
3547
|
+
} catch {
|
|
3548
|
+
}
|
|
3549
|
+
return next;
|
|
3550
|
+
}
|
|
3551
|
+
var MARGIN = 8;
|
|
3552
|
+
var same = (a4, b) => a4.slice(0, 7).toLowerCase() === b.slice(0, 7).toLowerCase();
|
|
3553
|
+
function PaletteBoard({ value, label, t: t3, onPick, onCustom }) {
|
|
3554
|
+
const [recent, setRecent] = d2(recentColors);
|
|
3555
|
+
const swatch = (color) => /* @__PURE__ */ a3(
|
|
3556
|
+
"button",
|
|
3557
|
+
{
|
|
3558
|
+
type: "button",
|
|
3559
|
+
class: "fnc-palette-cell",
|
|
3560
|
+
role: "option",
|
|
3561
|
+
style: { background: color },
|
|
3562
|
+
"aria-label": color,
|
|
3563
|
+
"aria-selected": same(color, value),
|
|
3564
|
+
onClick: () => onPick(color)
|
|
3565
|
+
},
|
|
3566
|
+
color
|
|
3567
|
+
);
|
|
3568
|
+
const hex63 = /^#[0-9a-f]{6}/i.test(value) ? value.slice(0, 7) : "";
|
|
3569
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-palette-board", children: [
|
|
3570
|
+
/* @__PURE__ */ a3("div", { class: "fnc-palette-grid", role: "listbox", "aria-label": label, children: PALETTE.map((row2) => row2.map(swatch)) }),
|
|
3571
|
+
recent.length > 0 && /* @__PURE__ */ a3($, { children: [
|
|
3572
|
+
/* @__PURE__ */ a3("div", { class: "fnc-palette-title", children: t3.paletteRecent }),
|
|
3573
|
+
/* @__PURE__ */ a3("div", { class: "fnc-palette-grid", role: "listbox", "aria-label": t3.paletteRecent, children: recent.map(swatch) })
|
|
3574
|
+
] }),
|
|
3575
|
+
/* @__PURE__ */ a3("label", { class: "fnc-palette-custom", children: [
|
|
3576
|
+
/* @__PURE__ */ a3("span", { class: "fnc-palette-custom-chip", style: { background: hex63 || "#3182F6" } }),
|
|
3577
|
+
/* @__PURE__ */ a3("span", { children: t3.paletteCustom }),
|
|
3578
|
+
/* @__PURE__ */ a3(
|
|
3579
|
+
"input",
|
|
3580
|
+
{
|
|
3581
|
+
type: "color",
|
|
3582
|
+
value: hex63.toLowerCase() || "#3182f6",
|
|
3583
|
+
onInput: (e3) => (onCustom ?? onPick)(e3.target.value),
|
|
3584
|
+
onChange: (e3) => setRecent(rememberColor(e3.target.value))
|
|
3585
|
+
}
|
|
3586
|
+
)
|
|
3587
|
+
] })
|
|
3588
|
+
] });
|
|
3589
|
+
}
|
|
3590
|
+
function ColorPicker({
|
|
3591
|
+
value,
|
|
3592
|
+
label,
|
|
3593
|
+
t: t3,
|
|
3594
|
+
onPick,
|
|
3595
|
+
class: cls,
|
|
3596
|
+
style,
|
|
3597
|
+
tip,
|
|
3598
|
+
boardClass,
|
|
3599
|
+
onOpen,
|
|
3600
|
+
children
|
|
3601
|
+
}) {
|
|
3602
|
+
const [open, setOpen] = d2(false);
|
|
3603
|
+
const wrap = T2(null);
|
|
3604
|
+
const button = T2(null);
|
|
3605
|
+
const pop = T2(null);
|
|
3606
|
+
A2(() => {
|
|
3607
|
+
if (!open) return;
|
|
3608
|
+
const close = (e3) => !wrap.current?.contains(e3.target) && !pop.current?.contains(e3.target) && setOpen(false);
|
|
3609
|
+
const esc = (e3) => {
|
|
3610
|
+
if (e3.key !== "Escape") return;
|
|
3611
|
+
e3.stopPropagation();
|
|
3612
|
+
setOpen(false);
|
|
3613
|
+
button.current?.focus();
|
|
3614
|
+
};
|
|
3615
|
+
document.addEventListener("pointerdown", close, true);
|
|
3616
|
+
document.addEventListener("keydown", esc, true);
|
|
3617
|
+
return () => {
|
|
3618
|
+
document.removeEventListener("pointerdown", close, true);
|
|
3619
|
+
document.removeEventListener("keydown", esc, true);
|
|
3620
|
+
};
|
|
3621
|
+
}, [open]);
|
|
3622
|
+
return /* @__PURE__ */ a3("span", { class: "fnc-palette-wrap", ref: wrap, children: [
|
|
3623
|
+
/* @__PURE__ */ a3(
|
|
3624
|
+
"button",
|
|
3625
|
+
{
|
|
3626
|
+
type: "button",
|
|
3627
|
+
ref: button,
|
|
3628
|
+
class: cls,
|
|
3629
|
+
style,
|
|
3630
|
+
"data-tip": tip,
|
|
3631
|
+
"aria-label": label,
|
|
3632
|
+
"aria-haspopup": "listbox",
|
|
3633
|
+
"aria-expanded": open,
|
|
3634
|
+
onClick: () => {
|
|
3635
|
+
if (!open) onOpen?.();
|
|
3636
|
+
setOpen(!open);
|
|
3637
|
+
},
|
|
3638
|
+
children
|
|
3639
|
+
}
|
|
3640
|
+
),
|
|
3641
|
+
open && /* @__PURE__ */ a3(FloatingBoard, { anchor: button, pop, label, class: boardClass, children: /* @__PURE__ */ a3(
|
|
3642
|
+
PaletteBoard,
|
|
3643
|
+
{
|
|
3644
|
+
value,
|
|
3645
|
+
label,
|
|
3646
|
+
t: t3,
|
|
3647
|
+
onPick: (color) => {
|
|
3648
|
+
onPick(color);
|
|
3649
|
+
setOpen(false);
|
|
3650
|
+
},
|
|
3651
|
+
onCustom: onPick
|
|
3652
|
+
}
|
|
3653
|
+
) })
|
|
3654
|
+
] });
|
|
3655
|
+
}
|
|
3656
|
+
function FloatingBoard({ anchor, pop, label, class: cls, children }) {
|
|
3657
|
+
const layer = usePageLayer(anchor);
|
|
3658
|
+
F2(() => {
|
|
3659
|
+
const el = pop.current;
|
|
3660
|
+
const a4 = anchor.current;
|
|
3661
|
+
if (!layer || !el || !a4) return;
|
|
3662
|
+
layer.classList.add("fnc-layer-pass");
|
|
3663
|
+
const place = () => {
|
|
3664
|
+
const r3 = a4.getBoundingClientRect();
|
|
3665
|
+
const vw = document.documentElement.clientWidth;
|
|
3666
|
+
const vh = document.documentElement.clientHeight;
|
|
3667
|
+
const below = r3.bottom + 6;
|
|
3668
|
+
const top = below + el.offsetHeight + MARGIN <= vh ? below : Math.max(MARGIN, r3.top - 6 - el.offsetHeight);
|
|
3669
|
+
const left = Math.max(MARGIN, Math.min(vw - MARGIN - el.offsetWidth, r3.left));
|
|
3670
|
+
el.style.left = `${Math.round(left)}px`;
|
|
3671
|
+
el.style.top = `${Math.round(top)}px`;
|
|
3672
|
+
};
|
|
3673
|
+
place();
|
|
3674
|
+
window.addEventListener("resize", place);
|
|
3675
|
+
window.addEventListener("scroll", place, true);
|
|
3676
|
+
return () => {
|
|
3677
|
+
window.removeEventListener("resize", place);
|
|
3678
|
+
window.removeEventListener("scroll", place, true);
|
|
3679
|
+
};
|
|
3680
|
+
}, [layer]);
|
|
3681
|
+
if (!layer) return null;
|
|
3682
|
+
return X(
|
|
3683
|
+
/* @__PURE__ */ a3("div", { class: cls ? `fnc-palette ${cls}` : "fnc-palette", ref: pop, role: "dialog", "aria-label": label, onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children }),
|
|
3684
|
+
layer
|
|
3685
|
+
);
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
// src/components/hover-open.ts
|
|
3689
|
+
var HIDE_TIP = "fnc-hide-tip";
|
|
3690
|
+
var OPEN_MS = 140;
|
|
3691
|
+
var CLOSE_MS = 260;
|
|
3692
|
+
function useHoverOpen(open, onOpen, group) {
|
|
3693
|
+
const timer = T2(null);
|
|
3694
|
+
const byHover = T2(false);
|
|
3695
|
+
const clear = () => {
|
|
3696
|
+
if (timer.current) clearTimeout(timer.current);
|
|
3697
|
+
timer.current = null;
|
|
3698
|
+
};
|
|
3699
|
+
A2(() => {
|
|
3700
|
+
if (open) {
|
|
3701
|
+
group?.current?.dispatchEvent(new CustomEvent(HIDE_TIP, { bubbles: true }));
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
byHover.current = false;
|
|
3705
|
+
clear();
|
|
3706
|
+
}, [open]);
|
|
3707
|
+
A2(() => clear, []);
|
|
3708
|
+
return {
|
|
3709
|
+
onPointerEnter: (e3) => {
|
|
3710
|
+
if (e3.pointerType !== "mouse") return;
|
|
3711
|
+
clear();
|
|
3712
|
+
if (open) return;
|
|
3713
|
+
timer.current = setTimeout(() => {
|
|
3714
|
+
byHover.current = true;
|
|
3715
|
+
onOpen(true);
|
|
3716
|
+
}, OPEN_MS);
|
|
3717
|
+
},
|
|
3718
|
+
onPointerLeave: (e3) => {
|
|
3719
|
+
if (e3.pointerType !== "mouse") return;
|
|
3720
|
+
clear();
|
|
3721
|
+
if (!open || !byHover.current) return;
|
|
3722
|
+
timer.current = setTimeout(() => onOpen(false), CLOSE_MS);
|
|
3723
|
+
},
|
|
3724
|
+
/** The corner button: opens or closes the list — or, when hovering opened it, keeps it open until a click outside. */
|
|
3725
|
+
toggle: () => {
|
|
3726
|
+
clear();
|
|
3727
|
+
if (open && byHover.current) {
|
|
3728
|
+
byHover.current = false;
|
|
3729
|
+
return;
|
|
3730
|
+
}
|
|
3731
|
+
onOpen(!open);
|
|
3732
|
+
}
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
// src/components/keep-in-view.ts
|
|
3737
|
+
var MARGIN2 = 8;
|
|
3738
|
+
function useKeepInView(open) {
|
|
3739
|
+
const ref = T2(null);
|
|
3740
|
+
F2(() => {
|
|
3741
|
+
const el = ref.current;
|
|
3742
|
+
if (!open || !el) return;
|
|
3743
|
+
el.style.translate = "";
|
|
3744
|
+
const fit2 = () => {
|
|
3745
|
+
el.style.translate = "";
|
|
3746
|
+
el.style.maxHeight = "";
|
|
3747
|
+
const r3 = el.getBoundingClientRect();
|
|
3748
|
+
const root = el.closest(".fnc-root")?.getBoundingClientRect();
|
|
3749
|
+
const maxY = Math.min(document.documentElement.clientHeight, root?.bottom ?? Infinity) - MARGIN2;
|
|
3750
|
+
if (r3.bottom > maxY) {
|
|
3751
|
+
el.style.maxHeight = `${Math.max(120, Math.floor(maxY - r3.top))}px`;
|
|
3752
|
+
el.style.overflowY = "auto";
|
|
3753
|
+
}
|
|
3754
|
+
const minX = Math.max(0, root?.left ?? 0) + MARGIN2;
|
|
3755
|
+
const maxX = Math.min(document.documentElement.clientWidth, root?.right ?? Infinity) - MARGIN2;
|
|
3756
|
+
let dx = 0;
|
|
3757
|
+
if (r3.right > maxX) dx = maxX - r3.right;
|
|
3758
|
+
if (r3.left + dx < minX) dx = minX - r3.left;
|
|
3759
|
+
if (dx) el.style.translate = `${Math.round(dx)}px 0`;
|
|
3760
|
+
};
|
|
3761
|
+
fit2();
|
|
3762
|
+
window.addEventListener("resize", fit2);
|
|
3763
|
+
return () => window.removeEventListener("resize", fit2);
|
|
3764
|
+
}, [open]);
|
|
3765
|
+
return ref;
|
|
3766
|
+
}
|
|
3767
|
+
function useBesideAnchor(open, anchor) {
|
|
3768
|
+
const ref = T2(null);
|
|
3769
|
+
F2(() => {
|
|
3770
|
+
const el = ref.current;
|
|
3771
|
+
const a4 = anchor.current;
|
|
3772
|
+
if (!open || !el || !a4) return;
|
|
3773
|
+
const place = () => {
|
|
3774
|
+
const r3 = a4.getBoundingClientRect();
|
|
3775
|
+
el.style.position = "fixed";
|
|
3776
|
+
el.style.left = "0px";
|
|
3777
|
+
el.style.top = "0px";
|
|
3778
|
+
const origin = el.getBoundingClientRect();
|
|
3779
|
+
const vh = document.documentElement.clientHeight;
|
|
3780
|
+
const top = Math.max(MARGIN2, Math.min(r3.top, vh - MARGIN2 - el.offsetHeight));
|
|
3781
|
+
el.style.left = `${Math.round(r3.right + 8 - origin.left)}px`;
|
|
3782
|
+
el.style.top = `${Math.round(top - origin.top)}px`;
|
|
3783
|
+
};
|
|
3784
|
+
place();
|
|
3785
|
+
const bar = a4.closest(".fnc-drawbar");
|
|
3786
|
+
window.addEventListener("resize", place);
|
|
3787
|
+
bar?.addEventListener("scroll", place);
|
|
3788
|
+
return () => {
|
|
3789
|
+
window.removeEventListener("resize", place);
|
|
3790
|
+
bar?.removeEventListener("scroll", place);
|
|
3791
|
+
};
|
|
3792
|
+
}, [open]);
|
|
3793
|
+
return ref;
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3760
3796
|
// src/icons.tsx
|
|
3761
3797
|
function Icon({ children, size = 20 }) {
|
|
3762
3798
|
return /* @__PURE__ */ a3(
|
|
@@ -4566,7 +4602,6 @@ function SelectionBar({ ctx }) {
|
|
|
4566
4602
|
const d3 = s3.selection;
|
|
4567
4603
|
const [offset, setOffset] = d2(() => readJson(POS_KEY, [0, 0]));
|
|
4568
4604
|
const [lift, setLift] = d2(() => readJson(LIFT_KEY, 0));
|
|
4569
|
-
const [recent, setRecent] = d2(() => recentColors().slice(0, 3));
|
|
4570
4605
|
const [menu, setMenu] = d2(null);
|
|
4571
4606
|
const [sheet, setSheet] = d2(false);
|
|
4572
4607
|
const [templates, setTemplates] = d2(() => readJson(TEMPLATES_KEY, {}));
|
|
@@ -4983,26 +5018,7 @@ function SelectionBar({ ctx }) {
|
|
|
4983
5018
|
children: /* @__PURE__ */ a3(GripIcon, {})
|
|
4984
5019
|
}
|
|
4985
5020
|
),
|
|
4986
|
-
|
|
4987
|
-
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-selbar-brush", "aria-label": t3.color, "aria-expanded": menu === "brush", onClick: () => setMenu(menu === "brush" ? null : "brush"), children: /* @__PURE__ */ a3(BrushIcon, { color: current }) }),
|
|
4988
|
-
menu === "brush" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-brush-pop", role: "menu", children: [
|
|
4989
|
-
[...SWATCHES, ...recent.filter((c3) => !SWATCHES.includes(c3))].map((color) => /* @__PURE__ */ a3("button", { class: "fnc-swatch", style: { background: color }, "aria-label": `${t3.color} ${color}`, "aria-pressed": current === color, onClick: () => pickColor(color) })),
|
|
4990
|
-
/* @__PURE__ */ a3(
|
|
4991
|
-
ColorPicker,
|
|
4992
|
-
{
|
|
4993
|
-
class: "fnc-swatch fnc-swatch-add",
|
|
4994
|
-
value: current,
|
|
4995
|
-
label: t3.palette,
|
|
4996
|
-
t: t3,
|
|
4997
|
-
onPick: (color) => {
|
|
4998
|
-
pickColor(color);
|
|
4999
|
-
setRecent(recentColors().slice(0, 3));
|
|
5000
|
-
},
|
|
5001
|
-
children: /* @__PURE__ */ a3("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M5 1.5v7M1.5 5h7", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) })
|
|
5002
|
-
}
|
|
5003
|
-
)
|
|
5004
|
-
] })
|
|
5005
|
-
] }),
|
|
5021
|
+
!def?.levels && !def?.plain && /* @__PURE__ */ a3(ColorPicker, { class: "fnc-btn fnc-selbar-brush", boardClass: "fnc-palette-big", value: current, label: t3.color, tip: t3.color, t: t3, onPick: pickColor, onOpen: () => setMenu(null), children: /* @__PURE__ */ a3(BrushIcon, { color: current }) }),
|
|
5006
5022
|
phone && def && (def.text || !def.plain) && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
5007
5023
|
/* @__PURE__ */ a3(
|
|
5008
5024
|
"button",
|
|
@@ -5063,22 +5079,6 @@ function SelectionBar({ ctx }) {
|
|
|
5063
5079
|
}
|
|
5064
5080
|
),
|
|
5065
5081
|
!phone && /* @__PURE__ */ a3($, { children: [
|
|
5066
|
-
!def?.levels && !def?.plain && [...SWATCHES, ...recent.filter((c3) => !SWATCHES.includes(c3))].map((color) => /* @__PURE__ */ a3("button", { class: "fnc-swatch", style: { background: color }, "data-tip": t3.color, "aria-label": `${t3.color} ${color}`, "aria-pressed": current === color, onClick: () => pickColor(color) })),
|
|
5067
|
-
!def?.levels && !def?.plain && /* @__PURE__ */ a3(
|
|
5068
|
-
ColorPicker,
|
|
5069
|
-
{
|
|
5070
|
-
class: "fnc-swatch fnc-swatch-add",
|
|
5071
|
-
value: current,
|
|
5072
|
-
label: t3.palette,
|
|
5073
|
-
tip: t3.palette,
|
|
5074
|
-
t: t3,
|
|
5075
|
-
onPick: (color) => {
|
|
5076
|
-
pickColor(color);
|
|
5077
|
-
setRecent(recentColors().slice(0, 3));
|
|
5078
|
-
},
|
|
5079
|
-
children: /* @__PURE__ */ a3("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M5 1.5v7M1.5 5h7", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) })
|
|
5080
|
-
}
|
|
5081
|
-
),
|
|
5082
5082
|
slots.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
5083
5083
|
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.partColors, "aria-label": t3.partColors, "aria-expanded": menu === "colors", onClick: () => setMenu(menu === "colors" ? null : "colors"), children: /* @__PURE__ */ a3(PaletteIcon, {}) }),
|
|
5084
5084
|
menu === "colors" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-part-menu", role: "menu", children: colorsBody() })
|
|
@@ -5260,10 +5260,7 @@ function SelectionBar({ ctx }) {
|
|
|
5260
5260
|
value: current,
|
|
5261
5261
|
label: t3.color,
|
|
5262
5262
|
t: t3,
|
|
5263
|
-
onPick:
|
|
5264
|
-
pickColor(color);
|
|
5265
|
-
setRecent(recentColors().slice(0, 3));
|
|
5266
|
-
}
|
|
5263
|
+
onPick: pickColor
|
|
5267
5264
|
}
|
|
5268
5265
|
)
|
|
5269
5266
|
] }),
|
|
@@ -5312,10 +5309,12 @@ function SelectionBar({ ctx }) {
|
|
|
5312
5309
|
] });
|
|
5313
5310
|
}
|
|
5314
5311
|
function BrushIcon({ color }) {
|
|
5315
|
-
return /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", "stroke-width": "1.
|
|
5316
|
-
/* @__PURE__ */ a3("path", { d: "
|
|
5317
|
-
/* @__PURE__ */ a3("path", { d: "
|
|
5318
|
-
/* @__PURE__ */ a3("
|
|
5312
|
+
return /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", "stroke-width": "1.6", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", children: [
|
|
5313
|
+
/* @__PURE__ */ a3("path", { d: "M11.4 6.8 15 3.2a1.2 1.2 0 0 1 1.7 1.7L13.1 8.5" }),
|
|
5314
|
+
/* @__PURE__ */ a3("path", { d: "M10.4 7.5 12.4 9.5" }),
|
|
5315
|
+
/* @__PURE__ */ a3("path", { d: "M10.4 7.5C7.8 7.3 5.6 8.6 4.9 11c-.4 1.3-.5 2.4-1.1 3.4 1.2.1 2.6 0 4-.5 3.1-1 4.6-3 4.6-4.4Z" }),
|
|
5316
|
+
/* @__PURE__ */ a3("path", { d: "M8.3 9.9 6.4 12.6" }),
|
|
5317
|
+
/* @__PURE__ */ a3("rect", { x: "4.2", y: "15.4", width: "11.6", height: "2", rx: "1", fill: color, stroke: "none" })
|
|
5319
5318
|
] });
|
|
5320
5319
|
}
|
|
5321
5320
|
function StyleSheet({ ctx, title, resetLabel, onReset, onClose, children }) {
|
|
@@ -8318,6 +8317,7 @@ function PriceAxisPlus({ ctx }) {
|
|
|
8318
8317
|
// src/components/overlay.tsx
|
|
8319
8318
|
var ZOOM_STEP = 1.25;
|
|
8320
8319
|
var CONTROL_OFFSET = 52;
|
|
8320
|
+
var NAV_NEAR = 100;
|
|
8321
8321
|
var dirClass = (v3) => v3 > 0 ? "fnc-up" : v3 < 0 ? "fnc-down" : "fnc-flat";
|
|
8322
8322
|
function IndicatorControls({ ctx, id, controls }) {
|
|
8323
8323
|
const set = (key, value) => ctx.chart.setIndicatorControl(id, key, value);
|
|
@@ -8724,14 +8724,35 @@ function NavControls({ ctx }) {
|
|
|
8724
8724
|
}),
|
|
8725
8725
|
[ctx.chart]
|
|
8726
8726
|
);
|
|
8727
|
+
const nav = T2(null);
|
|
8728
|
+
const [near, setNear] = d2(false);
|
|
8727
8729
|
const { plotWidth, panesHeight } = s3.layout;
|
|
8730
|
+
const shown = (showButtons || locked) && !(s3.replay.active || s3.replay.selecting);
|
|
8731
|
+
A2(() => {
|
|
8732
|
+
const overlay = nav.current?.closest(".fnc-overlay");
|
|
8733
|
+
const host = overlay?.parentElement;
|
|
8734
|
+
if (!shown || !overlay || !host) return;
|
|
8735
|
+
const move = (e3) => {
|
|
8736
|
+
if (e3.pointerType !== "mouse") return;
|
|
8737
|
+
const r3 = overlay.getBoundingClientRect();
|
|
8738
|
+
const x2 = e3.clientX - r3.left;
|
|
8739
|
+
const y3 = e3.clientY - r3.top;
|
|
8740
|
+
setNear(x2 >= 0 && x2 <= plotWidth && y3 >= panesHeight - NAV_NEAR && y3 <= panesHeight + 30);
|
|
8741
|
+
};
|
|
8742
|
+
const leave = () => setNear(false);
|
|
8743
|
+
host.addEventListener("pointermove", move);
|
|
8744
|
+
host.addEventListener("pointerleave", leave);
|
|
8745
|
+
return () => {
|
|
8746
|
+
host.removeEventListener("pointermove", move);
|
|
8747
|
+
host.removeEventListener("pointerleave", leave);
|
|
8748
|
+
};
|
|
8749
|
+
}, [shown, plotWidth, panesHeight]);
|
|
8728
8750
|
if (plotWidth <= 0) return null;
|
|
8729
8751
|
const top = panesHeight - CONTROL_OFFSET;
|
|
8730
8752
|
const page = () => Math.max(1, Math.round(plotWidth / ctx.chart.timeScale.barSpacing / 3));
|
|
8731
8753
|
const button = (label, onClick, icon) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, onClick, children: icon });
|
|
8732
|
-
const replaying = s3.replay.active || s3.replay.selecting;
|
|
8733
8754
|
return /* @__PURE__ */ a3($, { children: [
|
|
8734
|
-
|
|
8755
|
+
shown && /* @__PURE__ */ a3("div", { ref: nav, class: `fnc-nav${locked ? " fnc-nav-locked" : ""}${near ? " is-near" : ""}`, style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
|
|
8735
8756
|
!locked && button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
|
|
8736
8757
|
!locked && button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
|
|
8737
8758
|
!locked && button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
|
|
@@ -8747,7 +8768,11 @@ function NavControls({ ctx }) {
|
|
|
8747
8768
|
onClick: () => ctx.chart.setSettings({ lockView: !locked }),
|
|
8748
8769
|
children: /* @__PURE__ */ a3(LockIcon, { open: !locked })
|
|
8749
8770
|
}
|
|
8750
|
-
)
|
|
8771
|
+
),
|
|
8772
|
+
!locked && /* @__PURE__ */ a3($, { children: [
|
|
8773
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
8774
|
+
button(t3.hideNavButtons, () => ctx.chart.setSettings({ navigationButtons: false }), /* @__PURE__ */ a3(SmallCloseIcon, {}))
|
|
8775
|
+
] })
|
|
8751
8776
|
] }),
|
|
8752
8777
|
!s3.atRealtime && /* @__PURE__ */ a3(
|
|
8753
8778
|
"button",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.66",
|
|
4
4
|
"description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"NOTICE"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@funnest/charts": "0.11.
|
|
45
|
+
"@funnest/charts": "0.11.66"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|