@funnest/charts-ui 0.11.61 → 0.11.63
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/i18n.d.ts +2 -0
- package/dist/index.js +76 -7
- package/package.json +2 -2
package/dist/i18n.d.ts
CHANGED
|
@@ -233,6 +233,7 @@ export declare const STRINGS: {
|
|
|
233
233
|
lock: string;
|
|
234
234
|
unlock: string;
|
|
235
235
|
duplicate: string;
|
|
236
|
+
moreActions: string;
|
|
236
237
|
moveBar: string;
|
|
237
238
|
indicators: string;
|
|
238
239
|
addIndicator: string;
|
|
@@ -638,6 +639,7 @@ export declare const STRINGS: {
|
|
|
638
639
|
lock: string;
|
|
639
640
|
unlock: string;
|
|
640
641
|
duplicate: string;
|
|
642
|
+
moreActions: string;
|
|
641
643
|
moveBar: string;
|
|
642
644
|
indicators: string;
|
|
643
645
|
addIndicator: string;
|
package/dist/index.js
CHANGED
|
@@ -668,6 +668,7 @@ var STRINGS = {
|
|
|
668
668
|
lock: "\uC7A0\uADF8\uAE30",
|
|
669
669
|
unlock: "\uC7A0\uAE08 \uD480\uAE30",
|
|
670
670
|
duplicate: "\uBCF5\uC81C",
|
|
671
|
+
moreActions: "\uB354\uBCF4\uAE30",
|
|
671
672
|
moveBar: "\uB04C\uC5B4\uC11C \uC62E\uAE30\uAE30 (\uB450 \uBC88 \uB204\uB974\uBA74 \uC81C\uC790\uB9AC)",
|
|
672
673
|
indicators: "\uC9C0\uD45C",
|
|
673
674
|
addIndicator: "\uC9C0\uD45C \uCD94\uAC00",
|
|
@@ -1075,6 +1076,7 @@ var STRINGS = {
|
|
|
1075
1076
|
lock: "Lock",
|
|
1076
1077
|
unlock: "Unlock",
|
|
1077
1078
|
duplicate: "Duplicate",
|
|
1079
|
+
moreActions: "More",
|
|
1078
1080
|
moveBar: "Drag to move (double-click to reset)",
|
|
1079
1081
|
indicators: "Indicators",
|
|
1080
1082
|
addIndicator: "Add indicator",
|
|
@@ -2993,6 +2995,8 @@ var CSS = (
|
|
|
2993
2995
|
.fnc-menu.fnc-brush-pop { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; }
|
|
2994
2996
|
.fnc-brush-pop .fnc-swatch { width: 24px; height: 24px; }
|
|
2995
2997
|
.fnc-selbar-pop.fnc-note-menu { width: auto; }
|
|
2998
|
+
.fnc-line-pop { padding: 6px 14px; }
|
|
2999
|
+
.fnc-line-pop .fnc-ss-seg button { width: 42px; }
|
|
2996
3000
|
.fnc-note-menu .fnc-ss-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--fnc-text-2); }
|
|
2997
3001
|
.fnc-tool-row .fnc-menu-item { flex: 1; padding-right: 36px; }
|
|
2998
3002
|
.fnc-tool-fav { position: absolute; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--fnc-text-2); opacity: 0; cursor: pointer; }
|
|
@@ -3272,12 +3276,14 @@ var CSS = (
|
|
|
3272
3276
|
bottom: 56px;
|
|
3273
3277
|
left: 8px !important;
|
|
3274
3278
|
right: 8px;
|
|
3275
|
-
|
|
3279
|
+
/* Docked: its grip (first, on the left) lifts it up the chart and back. */
|
|
3280
|
+
--fnc-selbar-dock: bottom;
|
|
3281
|
+
transform: translateY(calc(-1 * var(--fnc-selbar-lift, 0px)));
|
|
3276
3282
|
flex-wrap: wrap;
|
|
3277
3283
|
justify-content: center;
|
|
3278
3284
|
row-gap: 4px;
|
|
3279
3285
|
}
|
|
3280
|
-
.fnc-selbar-grip {
|
|
3286
|
+
.fnc-selbar-grip { width: 24px !important; }
|
|
3281
3287
|
.fnc-selbar-menu { position: static; }
|
|
3282
3288
|
.fnc-selbar-pop {
|
|
3283
3289
|
top: auto;
|
|
@@ -4474,6 +4480,7 @@ var WIDTHS = [1, 2, 3, 4];
|
|
|
4474
4480
|
var FONT_SIZES = [10, 12, 14, 16, 20, 24, 32];
|
|
4475
4481
|
var DASH_ORDER = ["solid", "dashed", "dotted"];
|
|
4476
4482
|
var POS_KEY = "fnc-selbar-pos";
|
|
4483
|
+
var LIFT_KEY = "fnc-selbar-lift";
|
|
4477
4484
|
var TEMPLATES_KEY = "fnc-drawing-templates";
|
|
4478
4485
|
var TEMPLATES_MAX = 20;
|
|
4479
4486
|
var lookOf = (style) => {
|
|
@@ -4501,9 +4508,16 @@ var writeJson = (key, value) => {
|
|
|
4501
4508
|
} catch {
|
|
4502
4509
|
}
|
|
4503
4510
|
};
|
|
4504
|
-
function DashGlyph({ dash }) {
|
|
4511
|
+
function DashGlyph({ dash, width = 2 }) {
|
|
4505
4512
|
const pattern = dash === "dashed" ? "4 3" : dash === "dotted" ? "1 3" : void 0;
|
|
4506
|
-
return /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", "stroke-width":
|
|
4513
|
+
return /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", "stroke-width": width, "stroke-linecap": "round", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M3 10h14", "stroke-dasharray": pattern }) });
|
|
4514
|
+
}
|
|
4515
|
+
function MoreIcon() {
|
|
4516
|
+
return /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
|
|
4517
|
+
/* @__PURE__ */ a3("circle", { cx: "4.5", cy: "10", r: "1.5" }),
|
|
4518
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "1.5" }),
|
|
4519
|
+
/* @__PURE__ */ a3("circle", { cx: "15.5", cy: "10", r: "1.5" })
|
|
4520
|
+
] });
|
|
4507
4521
|
}
|
|
4508
4522
|
function DrawingCoords({ ctx, drawing, t: t3 }) {
|
|
4509
4523
|
const tz = ctx.chart.timeZone;
|
|
@@ -4551,6 +4565,7 @@ function SelectionBar({ ctx }) {
|
|
|
4551
4565
|
const t3 = stringsOf(s3);
|
|
4552
4566
|
const d3 = s3.selection;
|
|
4553
4567
|
const [offset, setOffset] = d2(() => readJson(POS_KEY, [0, 0]));
|
|
4568
|
+
const [lift, setLift] = d2(() => readJson(LIFT_KEY, 0));
|
|
4554
4569
|
const [recent, setRecent] = d2(() => recentColors().slice(0, 3));
|
|
4555
4570
|
const [menu, setMenu] = d2(null);
|
|
4556
4571
|
const [sheet, setSheet] = d2(false);
|
|
@@ -4561,15 +4576,30 @@ function SelectionBar({ ctx }) {
|
|
|
4561
4576
|
const pop = bar.current?.querySelector(".fnc-selbar-pop");
|
|
4562
4577
|
if (!pop || !bar.current) return;
|
|
4563
4578
|
pop.style.maxHeight = "";
|
|
4579
|
+
pop.style.top = "";
|
|
4580
|
+
pop.style.bottom = "";
|
|
4564
4581
|
const host = ctx.root.getBoundingClientRect();
|
|
4565
|
-
|
|
4566
|
-
const
|
|
4582
|
+
let r3 = pop.getBoundingClientRect();
|
|
4583
|
+
const b = bar.current.getBoundingClientRect();
|
|
4584
|
+
let up = r3.bottom <= b.top + 1;
|
|
4585
|
+
if (up && r3.height > r3.bottom - Math.max(host.top, 0) - 8 && Math.min(host.bottom, innerHeight) - b.bottom > b.top - Math.max(host.top, 0)) {
|
|
4586
|
+
pop.style.top = "calc(100% + 6px)";
|
|
4587
|
+
pop.style.bottom = "auto";
|
|
4588
|
+
r3 = pop.getBoundingClientRect();
|
|
4589
|
+
up = false;
|
|
4590
|
+
}
|
|
4567
4591
|
const room = up ? r3.bottom - Math.max(host.top, 0) - 8 : Math.min(host.bottom, innerHeight) - r3.top - 8;
|
|
4568
4592
|
if (r3.height > room) {
|
|
4569
4593
|
pop.style.maxHeight = `${Math.max(120, Math.floor(room))}px`;
|
|
4570
4594
|
pop.style.overflowY = "auto";
|
|
4571
4595
|
}
|
|
4572
4596
|
}, [menu]);
|
|
4597
|
+
F2(() => {
|
|
4598
|
+
const el = bar.current;
|
|
4599
|
+
if (!el || !lift) return;
|
|
4600
|
+
const over = Math.max(ctx.root.getBoundingClientRect().top, 0) + 8 - el.getBoundingClientRect().top;
|
|
4601
|
+
if (over > 0) setLift(Math.max(0, lift - Math.ceil(over)));
|
|
4602
|
+
});
|
|
4573
4603
|
if (!d3 || s3.layout.plotWidth <= 0) return null;
|
|
4574
4604
|
const def = ctx.chart.drawingDefinitions().find((x2) => x2.type === d3.type);
|
|
4575
4605
|
const style = d3.style ?? {};
|
|
@@ -4629,6 +4659,26 @@ function SelectionBar({ ctx }) {
|
|
|
4629
4659
|
const actions = ctx.drawingActions?.(d3, ctx.chart) ?? [];
|
|
4630
4660
|
const startMove = (e3) => {
|
|
4631
4661
|
e3.preventDefault();
|
|
4662
|
+
const el = bar.current;
|
|
4663
|
+
if (el && getComputedStyle(el).getPropertyValue("--fnc-selbar-dock").trim() === "bottom") {
|
|
4664
|
+
const y0 = e3.clientY;
|
|
4665
|
+
const from2 = lift;
|
|
4666
|
+
const top = el.getBoundingClientRect().top + from2 - Math.max(ctx.root.getBoundingClientRect().top, 0) - 8;
|
|
4667
|
+
const at = (ev) => Math.round(Math.min(Math.max(0, from2 + y0 - ev.clientY), Math.max(0, top)));
|
|
4668
|
+
const move2 = (ev) => setLift(at(ev));
|
|
4669
|
+
const up2 = (ev) => {
|
|
4670
|
+
document.removeEventListener("pointermove", move2);
|
|
4671
|
+
document.removeEventListener("pointerup", up2);
|
|
4672
|
+
document.removeEventListener("pointercancel", up2);
|
|
4673
|
+
const next = at(ev);
|
|
4674
|
+
setLift(next);
|
|
4675
|
+
writeJson(LIFT_KEY, next);
|
|
4676
|
+
};
|
|
4677
|
+
document.addEventListener("pointermove", move2);
|
|
4678
|
+
document.addEventListener("pointerup", up2);
|
|
4679
|
+
document.addEventListener("pointercancel", up2);
|
|
4680
|
+
return;
|
|
4681
|
+
}
|
|
4632
4682
|
const start = [e3.clientX, e3.clientY];
|
|
4633
4683
|
const from = offset;
|
|
4634
4684
|
const move = (ev) => setOffset([from[0] + ev.clientX - start[0], from[1] + ev.clientY - start[1]]);
|
|
@@ -4916,7 +4966,7 @@ function SelectionBar({ ctx }) {
|
|
|
4916
4966
|
}
|
|
4917
4967
|
)
|
|
4918
4968
|
] });
|
|
4919
|
-
return /* @__PURE__ */ a3("div", { ref: bar, class: "fnc-selbar", role: "toolbar", style: { left: `${s3.layout.plotWidth / 2 + offset[0]}px`, top: `${8 + offset[1]}px` }, children: [
|
|
4969
|
+
return /* @__PURE__ */ a3("div", { ref: bar, class: "fnc-selbar", role: "toolbar", style: { left: `${s3.layout.plotWidth / 2 + offset[0]}px`, top: `${8 + offset[1]}px`, "--fnc-selbar-lift": `${lift}px` }, children: [
|
|
4920
4970
|
/* @__PURE__ */ a3(
|
|
4921
4971
|
"button",
|
|
4922
4972
|
{
|
|
@@ -4927,6 +4977,8 @@ function SelectionBar({ ctx }) {
|
|
|
4927
4977
|
onDblClick: () => {
|
|
4928
4978
|
setOffset([0, 0]);
|
|
4929
4979
|
writeJson(POS_KEY, [0, 0]);
|
|
4980
|
+
setLift(0);
|
|
4981
|
+
writeJson(LIFT_KEY, 0);
|
|
4930
4982
|
},
|
|
4931
4983
|
children: /* @__PURE__ */ a3(GripIcon, {})
|
|
4932
4984
|
}
|
|
@@ -4984,6 +5036,19 @@ function SelectionBar({ ctx }) {
|
|
|
4984
5036
|
] })
|
|
4985
5037
|
] }) : noteBody() })
|
|
4986
5038
|
] }),
|
|
5039
|
+
phone && !def?.plain && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
5040
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.lineStyle, "aria-expanded": menu === "line", onClick: () => setMenu(menu === "line" ? null : "line"), children: /* @__PURE__ */ a3(DashGlyph, { dash, width: style.width ?? 2 }) }),
|
|
5041
|
+
menu === "line" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-line-pop", role: "menu", children: [
|
|
5042
|
+
/* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
|
|
5043
|
+
/* @__PURE__ */ a3("span", { children: t3.lineStyle }),
|
|
5044
|
+
/* @__PURE__ */ a3("div", { class: "fnc-ss-seg", role: "radiogroup", "aria-label": t3.lineStyle, children: DASH_ORDER.map((k2) => /* @__PURE__ */ a3("button", { role: "radio", "aria-checked": dash === k2, "aria-label": k2 === "solid" ? t3.lineSolid : k2 === "dashed" ? t3.lineDashed : t3.lineDotted, onClick: () => setStyle({ dash: k2 }), children: /* @__PURE__ */ a3(DashGlyph, { dash: k2 }) })) })
|
|
5045
|
+
] }),
|
|
5046
|
+
/* @__PURE__ */ a3("div", { class: "fnc-ss-row", children: [
|
|
5047
|
+
/* @__PURE__ */ a3("span", { children: t3.lineWidth }),
|
|
5048
|
+
/* @__PURE__ */ a3("div", { class: "fnc-ss-seg", role: "radiogroup", "aria-label": t3.lineWidth, children: WIDTHS.map((w3) => /* @__PURE__ */ a3("button", { role: "radio", "aria-checked": (style.width ?? 2) === w3, "aria-label": `${w3}px`, onClick: () => setStyle({ width: w3 }), children: /* @__PURE__ */ a3(DashGlyph, { dash: "solid", width: w3 }) })) })
|
|
5049
|
+
] })
|
|
5050
|
+
] })
|
|
5051
|
+
] }),
|
|
4987
5052
|
phone && /* @__PURE__ */ a3(
|
|
4988
5053
|
"button",
|
|
4989
5054
|
{
|
|
@@ -5164,6 +5229,10 @@ function SelectionBar({ ctx }) {
|
|
|
5164
5229
|
menu === "visibility" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-visibility-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: visibilityBody() })
|
|
5165
5230
|
] })
|
|
5166
5231
|
] }),
|
|
5232
|
+
phone && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
5233
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.moreActions, "aria-expanded": menu === "more", onClick: () => setMenu(menu === "more" ? null : "more"), children: /* @__PURE__ */ a3(MoreIcon, {}) }),
|
|
5234
|
+
menu === "more" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop", role: "menu", children: orderBody() })
|
|
5235
|
+
] }),
|
|
5167
5236
|
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": locked ? t3.unlock : t3.lock, "aria-label": locked ? t3.unlock : t3.lock, "aria-pressed": locked, onClick: () => setStyle({ locked: !locked }), children: /* @__PURE__ */ a3(LockIcon, { open: !locked }) }),
|
|
5168
5237
|
/* @__PURE__ */ a3(
|
|
5169
5238
|
"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.63",
|
|
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.63"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|