@funnest/charts-ui 0.5.2 → 0.6.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/context.d.ts +8 -2
- package/dist/i18n.d.ts +42 -0
- package/dist/icons.d.ts +14 -0
- package/dist/index.js +883 -522
- package/dist/shell.d.ts +4 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -267,6 +267,160 @@ n = { __e: function(n2, t3, r3, u3) {
|
|
|
267
267
|
return n2.__v.__b - t3.__v.__b;
|
|
268
268
|
}, e = /* @__PURE__ */ Symbol(), l = /(PointerCapture)$|Capture$/i, c = 0, a = {}, s = 0;
|
|
269
269
|
|
|
270
|
+
// ../../node_modules/.pnpm/preact@11.2.0/node_modules/preact/hooks/dist/hooks.mjs
|
|
271
|
+
var t2;
|
|
272
|
+
var r2;
|
|
273
|
+
var u2;
|
|
274
|
+
var i2;
|
|
275
|
+
var o2 = Object.is;
|
|
276
|
+
var f2 = 0;
|
|
277
|
+
var c2 = [];
|
|
278
|
+
var e2 = [];
|
|
279
|
+
var a2 = n;
|
|
280
|
+
var v2 = a2.__b;
|
|
281
|
+
var l2 = a2.__r;
|
|
282
|
+
var m2 = a2.diffed;
|
|
283
|
+
var h2 = a2.__c;
|
|
284
|
+
var s2 = a2.unmount;
|
|
285
|
+
var p2 = a2.__;
|
|
286
|
+
function y2(n2, t3) {
|
|
287
|
+
a2.__h && a2.__h(r2, n2, f2 || t3), f2 = 0;
|
|
288
|
+
var u3 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
289
|
+
return n2 >= u3.__.length && u3.__.push({}), u3.__[n2];
|
|
290
|
+
}
|
|
291
|
+
function d2(n2) {
|
|
292
|
+
return f2 = 1, _2(G2, n2);
|
|
293
|
+
}
|
|
294
|
+
function _2(n2, u3, i3) {
|
|
295
|
+
var f4 = y2(t2++, 2);
|
|
296
|
+
if (f4.t = n2, !f4.__c && (f4.__ = [i3 ? i3(u3) : G2(void 0, u3), function(n3) {
|
|
297
|
+
var t3 = (f4.__N || f4.__)[0], r3 = f4.t(t3, n3);
|
|
298
|
+
o2(t3, r3) || (f4.__N = [r3, f4.__[1]], f4.__c.setState({}));
|
|
299
|
+
}], f4.__c = r2, !r2.__f)) {
|
|
300
|
+
r2.__f = true;
|
|
301
|
+
var c3 = r2.shouldComponentUpdate;
|
|
302
|
+
r2.shouldComponentUpdate = function(n3, t3, r3) {
|
|
303
|
+
var u4 = this.__H;
|
|
304
|
+
if (!u4) return true;
|
|
305
|
+
var i4 = false, f5 = this.props != n3;
|
|
306
|
+
if (u4.__.some(function(n4) {
|
|
307
|
+
n4.__N && (i4 = true, o2(n4.__[0], n4.__N[0]) || (f5 = true));
|
|
308
|
+
}), c3) {
|
|
309
|
+
var e3 = c3.call(this, n3, t3, r3);
|
|
310
|
+
return i4 ? e3 || f5 : e3;
|
|
311
|
+
}
|
|
312
|
+
return !i4 || f5;
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return f4.__;
|
|
316
|
+
}
|
|
317
|
+
function A2(n2, u3) {
|
|
318
|
+
var i3 = y2(t2++, 3);
|
|
319
|
+
!a2.__s && E2(i3.__H, u3) && (i3.__P = true, i3.__ = n2, i3.u = u3, r2.__H.__h.push(i3));
|
|
320
|
+
}
|
|
321
|
+
function F2(n2, u3) {
|
|
322
|
+
var i3 = y2(t2++, 4);
|
|
323
|
+
!a2.__s && E2(i3.__H, u3) && (i3.__P = false, i3.__ = n2, i3.u = u3, r2.__h.push(i3));
|
|
324
|
+
}
|
|
325
|
+
function T2(n2) {
|
|
326
|
+
return f2 = 5, w2(function() {
|
|
327
|
+
return { current: n2 };
|
|
328
|
+
}, []);
|
|
329
|
+
}
|
|
330
|
+
function w2(n2, r3) {
|
|
331
|
+
var u3 = y2(t2++, 7);
|
|
332
|
+
return E2(u3.__H, r3) && (u3.__ = n2(), u3.__H = r3), u3.__;
|
|
333
|
+
}
|
|
334
|
+
function g2() {
|
|
335
|
+
var n2;
|
|
336
|
+
do {
|
|
337
|
+
for (; n2 = e2.shift(); ) try {
|
|
338
|
+
C2(n2);
|
|
339
|
+
} catch (t4) {
|
|
340
|
+
a2.__e(t4, { __: (n2 = n2.__P) && n2.__v });
|
|
341
|
+
}
|
|
342
|
+
for (; n2 = c2.shift(); ) {
|
|
343
|
+
var t3 = n2.__H;
|
|
344
|
+
if (n2.__P && t3) try {
|
|
345
|
+
t3.__h.some(C2), t3.__h.some(D2), t3.__h = [];
|
|
346
|
+
} catch (r3) {
|
|
347
|
+
t3.__h = [], a2.__e(r3, n2.__v);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
} while (e2.length);
|
|
351
|
+
}
|
|
352
|
+
a2.__b = function(n2) {
|
|
353
|
+
r2 = null, v2 && v2(n2);
|
|
354
|
+
}, a2.__ = function(n2, t3) {
|
|
355
|
+
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), p2 && p2(n2, t3);
|
|
356
|
+
}, a2.__r = function(n2) {
|
|
357
|
+
l2 && l2(n2), t2 = 0;
|
|
358
|
+
var i3 = (r2 = n2.__c).__H;
|
|
359
|
+
i3 && (u2 == r2 ? r2.__h = [] : (i3.__h.some(C2), i3.__h.some(D2), t2 = 0), i3.__h = [], i3.__.some(function(n3) {
|
|
360
|
+
n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
|
|
361
|
+
})), u2 = r2;
|
|
362
|
+
}, a2.diffed = function(n2) {
|
|
363
|
+
m2 && m2(n2);
|
|
364
|
+
var t3 = n2.__c;
|
|
365
|
+
t3 && t3.__H && (t3.__H.__h.length && B2(c2.push(t3)), t3.__H.__.some(function(n3) {
|
|
366
|
+
n3.u && (n3.__H = n3.u);
|
|
367
|
+
})), u2 = r2 = null;
|
|
368
|
+
}, a2.__c = function(n2, t3) {
|
|
369
|
+
t3.some(function(n3) {
|
|
370
|
+
try {
|
|
371
|
+
n3.__h.some(C2), n3.__h = n3.__h.filter(function(n4) {
|
|
372
|
+
return !n4.__ || D2(n4);
|
|
373
|
+
});
|
|
374
|
+
} catch (t4) {
|
|
375
|
+
n3.__h = [function() {
|
|
376
|
+
throw t4;
|
|
377
|
+
}];
|
|
378
|
+
}
|
|
379
|
+
}), h2 && h2(n2, t3);
|
|
380
|
+
}, a2.unmount = function(n2) {
|
|
381
|
+
s2 && s2(n2);
|
|
382
|
+
var t3, r3, u3 = n2.__c;
|
|
383
|
+
u3 && u3.__H && (u3.__H.__.some(function(u4) {
|
|
384
|
+
try {
|
|
385
|
+
if (u4.__P && u4.__c) {
|
|
386
|
+
if (void 0 === r3) {
|
|
387
|
+
for (r3 = n2.__; r3 && (!r3.__c || !r3.__c.__P); ) r3 = r3.__;
|
|
388
|
+
r3 = r3 && r3.__c;
|
|
389
|
+
}
|
|
390
|
+
u4.__P = r3, B2(e2.push(u4));
|
|
391
|
+
} else C2(u4);
|
|
392
|
+
} catch (n3) {
|
|
393
|
+
t3 = n3;
|
|
394
|
+
}
|
|
395
|
+
}), u3.__H = void 0, t3 && a2.__e(t3, u3.__v));
|
|
396
|
+
};
|
|
397
|
+
var k = "function" == typeof requestAnimationFrame;
|
|
398
|
+
function z2(n2) {
|
|
399
|
+
var t3, r3 = function() {
|
|
400
|
+
clearTimeout(u3), k && cancelAnimationFrame(t3), setTimeout(n2);
|
|
401
|
+
}, u3 = setTimeout(r3, 35);
|
|
402
|
+
k && (t3 = requestAnimationFrame(r3));
|
|
403
|
+
}
|
|
404
|
+
function B2(n2) {
|
|
405
|
+
1 != n2 && i2 == a2.requestAnimationFrame || ((i2 = a2.requestAnimationFrame) || z2)(g2);
|
|
406
|
+
}
|
|
407
|
+
function C2(n2) {
|
|
408
|
+
var t3 = r2, u3 = n2.__c;
|
|
409
|
+
"function" == typeof u3 && (n2.__c = void 0, u3()), r2 = t3;
|
|
410
|
+
}
|
|
411
|
+
function D2(n2) {
|
|
412
|
+
var t3 = r2;
|
|
413
|
+
n2.__c = n2.__(), r2 = t3;
|
|
414
|
+
}
|
|
415
|
+
function E2(n2, t3) {
|
|
416
|
+
return !n2 || n2.length != t3.length || t3.some(function(t4, r3) {
|
|
417
|
+
return !o2(t4, n2[r3]);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function G2(n2, t3) {
|
|
421
|
+
return "function" == typeof t3 ? t3(n2) : t3;
|
|
422
|
+
}
|
|
423
|
+
|
|
270
424
|
// src/i18n.ts
|
|
271
425
|
var STRINGS = {
|
|
272
426
|
ko: {
|
|
@@ -310,6 +464,27 @@ var STRINGS = {
|
|
|
310
464
|
settingLastPrice: "\uD604\uC7AC\uAC00 \uC120",
|
|
311
465
|
settingVolume: "\uAC70\uB798\uB7C9",
|
|
312
466
|
settingNavButtons: "\uD655\uB300\xB7\uC774\uB3D9 \uBC84\uD2BC",
|
|
467
|
+
settingCountdown: "\uBD09 \uB9C8\uAC10\uAE4C\uC9C0 \uB0A8\uC740 \uC2DC\uAC04",
|
|
468
|
+
settingsScale: "\uAC00\uACA9 \uCD95",
|
|
469
|
+
scaleNormal: "\uC77C\uBC18",
|
|
470
|
+
scaleLog: "\uB85C\uADF8",
|
|
471
|
+
scalePercent: "%",
|
|
472
|
+
undo: "\uB418\uB3CC\uB9AC\uAE30",
|
|
473
|
+
redo: "\uB2E4\uC2DC \uC2E4\uD589",
|
|
474
|
+
compare: "\uBE44\uAD50",
|
|
475
|
+
compareSymbol: "\uBE44\uAD50\uD560 \uC885\uBAA9 \uCD94\uAC00",
|
|
476
|
+
removeCompare: "\uBE44\uAD50 \uD574\uC81C",
|
|
477
|
+
replay: "\uB9AC\uD50C\uB808\uC774",
|
|
478
|
+
replayPick: "\uC2DC\uC791\uD560 \uBD09\uC744 \uB204\uB974\uC138\uC694",
|
|
479
|
+
replayPlay: "\uC7AC\uC0DD",
|
|
480
|
+
replayPause: "\uC77C\uC2DC\uC815\uC9C0",
|
|
481
|
+
replayStep: "\uD55C \uBD09 \uC55E\uC73C\uB85C",
|
|
482
|
+
replayExit: "\uB9AC\uD50C\uB808\uC774 \uC885\uB8CC",
|
|
483
|
+
replaySpeed: "\uC18D\uB3C4",
|
|
484
|
+
replayRestart: "\uC2DC\uC791 \uC9C0\uC810 \uB2E4\uC2DC \uACE0\uB974\uAE30",
|
|
485
|
+
replayDone: "\uB05D\uAE4C\uC9C0 \uC7AC\uC0DD\uD588\uC5B4\uC694",
|
|
486
|
+
searchIndicators: "\uC9C0\uD45C \uAC80\uC0C9",
|
|
487
|
+
moreTools: "\uB3C4\uAD6C \uB354 \uBCF4\uAE30",
|
|
313
488
|
settingGridH: "\uAC00\uB85C \uACA9\uC790",
|
|
314
489
|
settingGridV: "\uC138\uB85C \uACA9\uC790",
|
|
315
490
|
resetDefaults: "\uAE30\uBCF8\uAC12\uC73C\uB85C",
|
|
@@ -417,6 +592,27 @@ var STRINGS = {
|
|
|
417
592
|
settingLastPrice: "Last price line",
|
|
418
593
|
settingVolume: "Volume",
|
|
419
594
|
settingNavButtons: "Zoom & scroll buttons",
|
|
595
|
+
settingCountdown: "Time to bar close",
|
|
596
|
+
settingsScale: "Price scale",
|
|
597
|
+
scaleNormal: "Regular",
|
|
598
|
+
scaleLog: "Log",
|
|
599
|
+
scalePercent: "%",
|
|
600
|
+
undo: "Undo",
|
|
601
|
+
redo: "Redo",
|
|
602
|
+
compare: "Compare",
|
|
603
|
+
compareSymbol: "Add symbol to compare",
|
|
604
|
+
removeCompare: "Remove comparison",
|
|
605
|
+
replay: "Replay",
|
|
606
|
+
replayPick: "Click the bar to start from",
|
|
607
|
+
replayPlay: "Play",
|
|
608
|
+
replayPause: "Pause",
|
|
609
|
+
replayStep: "Step forward",
|
|
610
|
+
replayExit: "Exit replay",
|
|
611
|
+
replaySpeed: "Speed",
|
|
612
|
+
replayRestart: "Pick a new start",
|
|
613
|
+
replayDone: "Reached the end",
|
|
614
|
+
searchIndicators: "Search indicators",
|
|
615
|
+
moreTools: "More tools",
|
|
420
616
|
settingGridH: "Horizontal grid",
|
|
421
617
|
settingGridV: "Vertical grid",
|
|
422
618
|
resetDefaults: "Reset",
|
|
@@ -506,19 +702,19 @@ function resolutionLabel(resolution, locale, form = "short") {
|
|
|
506
702
|
}
|
|
507
703
|
|
|
508
704
|
// ../../node_modules/.pnpm/preact@11.2.0/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
509
|
-
var
|
|
510
|
-
var
|
|
511
|
-
function
|
|
705
|
+
var f3 = /* @__PURE__ */ Symbol.for("pv");
|
|
706
|
+
var o3 = 0;
|
|
707
|
+
function a3(t3, e3, n2, u3, a4, i3) {
|
|
512
708
|
e3 || (e3 = {});
|
|
513
709
|
var c3, l3, p3 = e3;
|
|
514
710
|
if ("ref" in p3 && "function" != typeof t3) for (l3 in p3 = {}, e3) "ref" == l3 ? c3 = e3[l3] : p3[l3] = e3[l3];
|
|
515
|
-
var s3 = { type: t3, props: p3, key: n2, ref: c3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor:
|
|
711
|
+
var s3 = { type: t3, props: p3, key: n2, ref: c3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: f3, __v: --o3, __i: -1, __u: 0 };
|
|
516
712
|
return (a4 || i3) && (s3.__source = a4, s3.__self = i3), n.vnode && n.vnode(s3), s3;
|
|
517
713
|
}
|
|
518
714
|
|
|
519
715
|
// src/icons.tsx
|
|
520
716
|
function Icon({ children, size = 20 }) {
|
|
521
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ a3(
|
|
522
718
|
"svg",
|
|
523
719
|
{
|
|
524
720
|
width: size,
|
|
@@ -534,245 +730,129 @@ function Icon({ children, size = 20 }) {
|
|
|
534
730
|
}
|
|
535
731
|
);
|
|
536
732
|
}
|
|
537
|
-
var SearchIcon = () => /* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
733
|
+
var SearchIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: [
|
|
734
|
+
/* @__PURE__ */ a3("circle", { cx: "9", cy: "9", r: "5.5" }),
|
|
735
|
+
/* @__PURE__ */ a3("path", { d: "M13 13l3.5 3.5" })
|
|
540
736
|
] });
|
|
541
|
-
var CloseIcon = () => /* @__PURE__ */
|
|
542
|
-
var CameraIcon = () => /* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */
|
|
737
|
+
var CloseIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M5.5 5.5l9 9M14.5 5.5l-9 9" }) });
|
|
738
|
+
var CameraIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
739
|
+
/* @__PURE__ */ a3("path", { d: "M3.5 7.2c0-.9.7-1.6 1.6-1.6h1.6l1.2-1.8h4.2l1.2 1.8h1.6c.9 0 1.6.7 1.6 1.6v6.6c0 .9-.7 1.6-1.6 1.6H5.1c-.9 0-1.6-.7-1.6-1.6z" }),
|
|
740
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10.4", r: "2.6" })
|
|
545
741
|
] });
|
|
546
|
-
var ExpandIcon = () => /* @__PURE__ */
|
|
547
|
-
var CollapseIcon = () => /* @__PURE__ */
|
|
548
|
-
var MinusIcon = () => /* @__PURE__ */
|
|
549
|
-
var PlusIcon = () => /* @__PURE__ */
|
|
550
|
-
var ChevronLeftIcon = () => /* @__PURE__ */
|
|
551
|
-
var ChevronRightIcon = () => /* @__PURE__ */
|
|
552
|
-
var ResetIcon = () => /* @__PURE__ */
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
742
|
+
var ExpandIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M4 8V4h4M16 8V4h-4M4 12v4h4M16 12v4h-4" }) });
|
|
743
|
+
var CollapseIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M8 4v4H4M12 4v4h4M8 16v-4H4M12 16v-4h4" }) });
|
|
744
|
+
var MinusIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M5 10h10" }) });
|
|
745
|
+
var PlusIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M5 10h10M10 5v10" }) });
|
|
746
|
+
var ChevronLeftIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M12 5l-5 5 5 5" }) });
|
|
747
|
+
var ChevronRightIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M8 5l5 5-5 5" }) });
|
|
748
|
+
var ResetIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: [
|
|
749
|
+
/* @__PURE__ */ a3("path", { d: "M4.5 10a5.5 5.5 0 1 0 1.7-4" }),
|
|
750
|
+
/* @__PURE__ */ a3("path", { d: "M4.5 3.5V7H8" })
|
|
555
751
|
] });
|
|
556
|
-
var ToRealtimeIcon = () => /* @__PURE__ */
|
|
557
|
-
var ChevronDownIcon = () => /* @__PURE__ */
|
|
558
|
-
var CursorIcon = () => /* @__PURE__ */
|
|
559
|
-
var TrendLineIcon = () => /* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
752
|
+
var ToRealtimeIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M5 5.5l4.5 4.5L5 14.5M10 5.5l4.5 4.5-4.5 4.5" }) });
|
|
753
|
+
var ChevronDownIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M5 8l5 5 5-5" }) });
|
|
754
|
+
var CursorIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M5 3.5l10 6.2-4.4 1.1-2 4.2z" }) });
|
|
755
|
+
var TrendLineIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
756
|
+
/* @__PURE__ */ a3("path", { d: "M5 15L15 5" }),
|
|
757
|
+
/* @__PURE__ */ a3("circle", { cx: "5", cy: "15", r: "1.6", fill: "currentColor" }),
|
|
758
|
+
/* @__PURE__ */ a3("circle", { cx: "15", cy: "5", r: "1.6", fill: "currentColor" })
|
|
563
759
|
] });
|
|
564
|
-
var HorizontalLineIcon = () => /* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
760
|
+
var HorizontalLineIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
761
|
+
/* @__PURE__ */ a3("path", { d: "M3 10h14" }),
|
|
762
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "1.6", fill: "currentColor" })
|
|
567
763
|
] });
|
|
568
|
-
var FibonacciIcon = () => /* @__PURE__ */
|
|
569
|
-
var TrashIcon = () => /* @__PURE__ */
|
|
570
|
-
var PencilIcon = () => /* @__PURE__ */
|
|
571
|
-
var CandlesIcon = () => /* @__PURE__ */
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
-
/* @__PURE__ */
|
|
574
|
-
/* @__PURE__ */
|
|
764
|
+
var FibonacciIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M3 4.5h14M3 8.2h14M3 11.8h14M3 15.5h14" }) });
|
|
765
|
+
var TrashIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M4.5 6h11M8 6V4.5h4V6M6 6l.7 9.5h6.6L14 6" }) });
|
|
766
|
+
var PencilIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M12.8 4.2l3 3L7.5 15.5 4 16l.5-3.5z" }) });
|
|
767
|
+
var CandlesIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
768
|
+
/* @__PURE__ */ a3("path", { d: "M6.5 3.5v13M13.5 3.5v13" }),
|
|
769
|
+
/* @__PURE__ */ a3("rect", { x: "4.5", y: "6", width: "4", height: "6", rx: "0.8", fill: "currentColor" }),
|
|
770
|
+
/* @__PURE__ */ a3("rect", { x: "11.5", y: "8", width: "4", height: "5", rx: "0.8" })
|
|
575
771
|
] });
|
|
576
|
-
var LineChartIcon = () => /* @__PURE__ */
|
|
577
|
-
var AreaChartIcon = () => /* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
772
|
+
var LineChartIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7" }) });
|
|
773
|
+
var AreaChartIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
774
|
+
/* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7" }),
|
|
775
|
+
/* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7V17H3z", fill: "currentColor", "fill-opacity": "0.25", stroke: "none" })
|
|
580
776
|
] });
|
|
581
|
-
var IndicatorIcon = () => /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
777
|
+
var IndicatorIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
778
|
+
/* @__PURE__ */ a3("path", { d: "M3 15.5l4-5 3 2.5 3.5-5L17 11" }),
|
|
779
|
+
/* @__PURE__ */ a3("path", { d: "M3 4.5v11.5h14" })
|
|
584
780
|
] });
|
|
585
|
-
var GearIcon = () => /* @__PURE__ */
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
781
|
+
var GearIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
|
|
782
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.4" }),
|
|
783
|
+
/* @__PURE__ */ a3("path", { d: "M10 3v2M10 15v2M3 10h2M15 10h2M5 5l1.4 1.4M13.6 13.6L15 15M5 15l1.4-1.4M13.6 6.4L15 5" })
|
|
588
784
|
] });
|
|
589
|
-
var SmallCloseIcon = () => /* @__PURE__ */
|
|
590
|
-
var EyeIcon = () => /* @__PURE__ */
|
|
591
|
-
/* @__PURE__ */
|
|
592
|
-
/* @__PURE__ */
|
|
785
|
+
var SmallCloseIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M6 6l8 8M14 6l-8 8" }) });
|
|
786
|
+
var EyeIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
|
|
787
|
+
/* @__PURE__ */ a3("path", { d: "M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z" }),
|
|
788
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.3" })
|
|
593
789
|
] });
|
|
594
|
-
var EyeOffIcon = () => /* @__PURE__ */
|
|
595
|
-
var MagnetIcon = () => /* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
790
|
+
var EyeOffIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M3 3l14 14M8.2 5a8 8 0 0 1 1.8-.5c5 0 8 5.5 8 5.5a14 14 0 0 1-2.2 2.9M5.4 6.4A14 14 0 0 0 2 10s3 5.5 8 5.5a7.7 7.7 0 0 0 3.6-.9" }) });
|
|
791
|
+
var MagnetIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
792
|
+
/* @__PURE__ */ a3("path", { d: "M5 4h3v6.5a2 2 0 0 0 4 0V4h3v6.5a5 5 0 0 1-10 0z" }),
|
|
793
|
+
/* @__PURE__ */ a3("path", { d: "M5 7h3M12 7h3" })
|
|
598
794
|
] });
|
|
599
|
-
var StarIcon = ({ filled = false }) => /* @__PURE__ */
|
|
795
|
+
var StarIcon = ({ filled = false }) => /* @__PURE__ */ a3(Icon, { size: 16, children: /* @__PURE__ */ a3(
|
|
600
796
|
"path",
|
|
601
797
|
{
|
|
602
798
|
d: "M10 3.2l2.1 4.3 4.7.7-3.4 3.3.8 4.7L10 14l-4.2 2.2.8-4.7-3.4-3.3 4.7-.7z",
|
|
603
799
|
fill: filled ? "currentColor" : "none"
|
|
604
800
|
}
|
|
605
801
|
) });
|
|
606
|
-
var CollapseLeftIcon = () => /* @__PURE__ */
|
|
607
|
-
var SettingsIcon = () => /* @__PURE__ */
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
/* @__PURE__ */
|
|
802
|
+
var CollapseLeftIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M11 5l-5 5 5 5M15 5l-5 5 5 5" }) });
|
|
803
|
+
var SettingsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
804
|
+
/* @__PURE__ */ a3("path", { d: "M10 12.6a2.6 2.6 0 1 0 0-5.2 2.6 2.6 0 0 0 0 5.2z" }),
|
|
805
|
+
/* @__PURE__ */ a3("path", { d: "M16.2 12a1.3 1.3 0 0 0 .26 1.43l.05.05a1.6 1.6 0 1 1-2.26 2.26l-.05-.05a1.3 1.3 0 0 0-1.43-.26 1.3 1.3 0 0 0-.79 1.19v.14a1.6 1.6 0 0 1-3.2 0v-.07a1.3 1.3 0 0 0-.85-1.19 1.3 1.3 0 0 0-1.43.26l-.05.05a1.6 1.6 0 1 1-2.26-2.26l.05-.05A1.3 1.3 0 0 0 4.5 12a1.3 1.3 0 0 0-1.19-.79h-.14a1.6 1.6 0 0 1 0-3.2h.07a1.3 1.3 0 0 0 1.19-.85 1.3 1.3 0 0 0-.26-1.43l-.05-.05a1.6 1.6 0 1 1 2.26-2.26l.05.05a1.3 1.3 0 0 0 1.43.26h.06a1.3 1.3 0 0 0 .79-1.19v-.14a1.6 1.6 0 0 1 3.2 0v.07a1.3 1.3 0 0 0 .79 1.19 1.3 1.3 0 0 0 1.43-.26l.05-.05a1.6 1.6 0 1 1 2.26 2.26l-.05.05a1.3 1.3 0 0 0-.26 1.43v.06a1.3 1.3 0 0 0 1.19.79h.14a1.6 1.6 0 0 1 0 3.2h-.07a1.3 1.3 0 0 0-1.19.79z" })
|
|
610
806
|
] });
|
|
611
|
-
var FunnestMark = () => /* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
807
|
+
var FunnestMark = () => /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 32 32", fill: "none", "aria-hidden": "true", children: [
|
|
808
|
+
/* @__PURE__ */ a3("rect", { width: "32", height: "32", rx: "9", fill: "#6C4DFF" }),
|
|
809
|
+
/* @__PURE__ */ a3("path", { d: "M7 13.5C9.5 21.5 17 23.5 23.4 11.2", stroke: "#fff", "stroke-width": "3.2", "stroke-linecap": "round" }),
|
|
810
|
+
/* @__PURE__ */ a3("circle", { cx: "24.6", cy: "8.6", r: "2.9", fill: "#FFD43B" })
|
|
615
811
|
] });
|
|
616
|
-
var LinkIcon = () => /* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
812
|
+
var LinkIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
813
|
+
/* @__PURE__ */ a3("path", { d: "M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-1 1" }),
|
|
814
|
+
/* @__PURE__ */ a3("path", { d: "M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l1-1" })
|
|
619
815
|
] });
|
|
620
|
-
var MaximizeIcon = () => /* @__PURE__ */
|
|
621
|
-
var RestoreIcon = () => /* @__PURE__ */
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
var
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
var
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
if (!u4) return true;
|
|
658
|
-
var i4 = false, f5 = this.props != n3;
|
|
659
|
-
if (u4.__.some(function(n4) {
|
|
660
|
-
n4.__N && (i4 = true, o3(n4.__[0], n4.__N[0]) || (f5 = true));
|
|
661
|
-
}), c3) {
|
|
662
|
-
var e3 = c3.call(this, n3, t3, r3);
|
|
663
|
-
return i4 ? e3 || f5 : e3;
|
|
664
|
-
}
|
|
665
|
-
return !i4 || f5;
|
|
666
|
-
};
|
|
816
|
+
var MaximizeIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: /* @__PURE__ */ a3("path", { d: "M11 4h5v5M9 16H4v-5M16 4l-5 5M4 16l5-5" }) });
|
|
817
|
+
var RestoreIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: /* @__PURE__ */ a3("path", { d: "M15 9h-4V5M5 11h4v4M11 9l5-5M9 11l-5 5" }) });
|
|
818
|
+
var UndoIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: [
|
|
819
|
+
/* @__PURE__ */ a3("path", { d: "M7 5L3.5 8.5 7 12" }),
|
|
820
|
+
/* @__PURE__ */ a3("path", { d: "M3.5 8.5h8.5a4.5 4.5 0 0 1 0 9H9" })
|
|
821
|
+
] });
|
|
822
|
+
var RedoIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: [
|
|
823
|
+
/* @__PURE__ */ a3("path", { d: "M13 5l3.5 3.5L13 12" }),
|
|
824
|
+
/* @__PURE__ */ a3("path", { d: "M16.5 8.5H8a4.5 4.5 0 0 0 0 9h3" })
|
|
825
|
+
] });
|
|
826
|
+
var CompareIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
827
|
+
/* @__PURE__ */ a3("path", { d: "M3 14l4-4 3 2 7-7" }),
|
|
828
|
+
/* @__PURE__ */ a3("path", { d: "M3 9l4 2 3-3 7 5", opacity: "0.55" })
|
|
829
|
+
] });
|
|
830
|
+
var ReplayIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
831
|
+
/* @__PURE__ */ a3("path", { d: "M5 4v12" }),
|
|
832
|
+
/* @__PURE__ */ a3("path", { d: "M16 4.5v11L8 10z" })
|
|
833
|
+
] });
|
|
834
|
+
var PlayIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M6 4.5v11l9-5.5z", fill: "currentColor" }) });
|
|
835
|
+
var PauseIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: /* @__PURE__ */ a3("path", { d: "M7 4.5v11M13 4.5v11", "stroke-width": "2.4" }) });
|
|
836
|
+
var StepIcon = () => /* @__PURE__ */ a3(Icon, { size: 18, children: [
|
|
837
|
+
/* @__PURE__ */ a3("path", { d: "M4.5 4.5v11l8-5.5z" }),
|
|
838
|
+
/* @__PURE__ */ a3("path", { d: "M15.5 4.5v11" })
|
|
839
|
+
] });
|
|
840
|
+
var SvgIcon = ({ markup }) => markup.trim().startsWith("<svg") ? /* @__PURE__ */ a3("span", { class: "fnc-svg-icon", dangerouslySetInnerHTML: { __html: markup } }) : /* @__PURE__ */ a3(
|
|
841
|
+
"svg",
|
|
842
|
+
{
|
|
843
|
+
width: 20,
|
|
844
|
+
height: 20,
|
|
845
|
+
viewBox: "0 0 20 20",
|
|
846
|
+
fill: "none",
|
|
847
|
+
stroke: "currentColor",
|
|
848
|
+
"stroke-width": "1.6",
|
|
849
|
+
"stroke-linecap": "round",
|
|
850
|
+
"stroke-linejoin": "round",
|
|
851
|
+
"aria-hidden": "true",
|
|
852
|
+
dangerouslySetInnerHTML: { __html: markup }
|
|
667
853
|
}
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
function A2(n2, u3) {
|
|
671
|
-
var i3 = y2(t2++, 3);
|
|
672
|
-
!a3.__s && E2(i3.__H, u3) && (i3.__P = true, i3.__ = n2, i3.u = u3, r2.__H.__h.push(i3));
|
|
673
|
-
}
|
|
674
|
-
function F2(n2, u3) {
|
|
675
|
-
var i3 = y2(t2++, 4);
|
|
676
|
-
!a3.__s && E2(i3.__H, u3) && (i3.__P = false, i3.__ = n2, i3.u = u3, r2.__h.push(i3));
|
|
677
|
-
}
|
|
678
|
-
function T2(n2) {
|
|
679
|
-
return f3 = 5, w2(function() {
|
|
680
|
-
return { current: n2 };
|
|
681
|
-
}, []);
|
|
682
|
-
}
|
|
683
|
-
function w2(n2, r3) {
|
|
684
|
-
var u3 = y2(t2++, 7);
|
|
685
|
-
return E2(u3.__H, r3) && (u3.__ = n2(), u3.__H = r3), u3.__;
|
|
686
|
-
}
|
|
687
|
-
function g2() {
|
|
688
|
-
var n2;
|
|
689
|
-
do {
|
|
690
|
-
for (; n2 = e2.shift(); ) try {
|
|
691
|
-
C2(n2);
|
|
692
|
-
} catch (t4) {
|
|
693
|
-
a3.__e(t4, { __: (n2 = n2.__P) && n2.__v });
|
|
694
|
-
}
|
|
695
|
-
for (; n2 = c2.shift(); ) {
|
|
696
|
-
var t3 = n2.__H;
|
|
697
|
-
if (n2.__P && t3) try {
|
|
698
|
-
t3.__h.some(C2), t3.__h.some(D2), t3.__h = [];
|
|
699
|
-
} catch (r3) {
|
|
700
|
-
t3.__h = [], a3.__e(r3, n2.__v);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
} while (e2.length);
|
|
704
|
-
}
|
|
705
|
-
a3.__b = function(n2) {
|
|
706
|
-
r2 = null, v2 && v2(n2);
|
|
707
|
-
}, a3.__ = function(n2, t3) {
|
|
708
|
-
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), p2 && p2(n2, t3);
|
|
709
|
-
}, a3.__r = function(n2) {
|
|
710
|
-
l2 && l2(n2), t2 = 0;
|
|
711
|
-
var i3 = (r2 = n2.__c).__H;
|
|
712
|
-
i3 && (u2 == r2 ? r2.__h = [] : (i3.__h.some(C2), i3.__h.some(D2), t2 = 0), i3.__h = [], i3.__.some(function(n3) {
|
|
713
|
-
n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
|
|
714
|
-
})), u2 = r2;
|
|
715
|
-
}, a3.diffed = function(n2) {
|
|
716
|
-
m2 && m2(n2);
|
|
717
|
-
var t3 = n2.__c;
|
|
718
|
-
t3 && t3.__H && (t3.__H.__h.length && B2(c2.push(t3)), t3.__H.__.some(function(n3) {
|
|
719
|
-
n3.u && (n3.__H = n3.u);
|
|
720
|
-
})), u2 = r2 = null;
|
|
721
|
-
}, a3.__c = function(n2, t3) {
|
|
722
|
-
t3.some(function(n3) {
|
|
723
|
-
try {
|
|
724
|
-
n3.__h.some(C2), n3.__h = n3.__h.filter(function(n4) {
|
|
725
|
-
return !n4.__ || D2(n4);
|
|
726
|
-
});
|
|
727
|
-
} catch (t4) {
|
|
728
|
-
n3.__h = [function() {
|
|
729
|
-
throw t4;
|
|
730
|
-
}];
|
|
731
|
-
}
|
|
732
|
-
}), h2 && h2(n2, t3);
|
|
733
|
-
}, a3.unmount = function(n2) {
|
|
734
|
-
s2 && s2(n2);
|
|
735
|
-
var t3, r3, u3 = n2.__c;
|
|
736
|
-
u3 && u3.__H && (u3.__H.__.some(function(u4) {
|
|
737
|
-
try {
|
|
738
|
-
if (u4.__P && u4.__c) {
|
|
739
|
-
if (void 0 === r3) {
|
|
740
|
-
for (r3 = n2.__; r3 && (!r3.__c || !r3.__c.__P); ) r3 = r3.__;
|
|
741
|
-
r3 = r3 && r3.__c;
|
|
742
|
-
}
|
|
743
|
-
u4.__P = r3, B2(e2.push(u4));
|
|
744
|
-
} else C2(u4);
|
|
745
|
-
} catch (n3) {
|
|
746
|
-
t3 = n3;
|
|
747
|
-
}
|
|
748
|
-
}), u3.__H = void 0, t3 && a3.__e(t3, u3.__v));
|
|
749
|
-
};
|
|
750
|
-
var k = "function" == typeof requestAnimationFrame;
|
|
751
|
-
function z2(n2) {
|
|
752
|
-
var t3, r3 = function() {
|
|
753
|
-
clearTimeout(u3), k && cancelAnimationFrame(t3), setTimeout(n2);
|
|
754
|
-
}, u3 = setTimeout(r3, 35);
|
|
755
|
-
k && (t3 = requestAnimationFrame(r3));
|
|
756
|
-
}
|
|
757
|
-
function B2(n2) {
|
|
758
|
-
1 != n2 && i2 == a3.requestAnimationFrame || ((i2 = a3.requestAnimationFrame) || z2)(g2);
|
|
759
|
-
}
|
|
760
|
-
function C2(n2) {
|
|
761
|
-
var t3 = r2, u3 = n2.__c;
|
|
762
|
-
"function" == typeof u3 && (n2.__c = void 0, u3()), r2 = t3;
|
|
763
|
-
}
|
|
764
|
-
function D2(n2) {
|
|
765
|
-
var t3 = r2;
|
|
766
|
-
n2.__c = n2.__(), r2 = t3;
|
|
767
|
-
}
|
|
768
|
-
function E2(n2, t3) {
|
|
769
|
-
return !n2 || n2.length != t3.length || t3.some(function(t4, r3) {
|
|
770
|
-
return !o3(t4, n2[r3]);
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
function G2(n2, t3) {
|
|
774
|
-
return "function" == typeof t3 ? t3(n2) : t3;
|
|
775
|
-
}
|
|
854
|
+
);
|
|
855
|
+
var CornerIcon = () => /* @__PURE__ */ a3("svg", { width: "6", height: "6", viewBox: "0 0 6 6", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M6 0v6H0z", fill: "currentColor" }) });
|
|
776
856
|
|
|
777
857
|
// src/store.ts
|
|
778
858
|
var Store = class {
|
|
@@ -811,22 +891,71 @@ function useStore(store) {
|
|
|
811
891
|
}
|
|
812
892
|
|
|
813
893
|
// src/components/drawing-toolbar.tsx
|
|
814
|
-
var
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
894
|
+
var BUILTIN_ICONS = {
|
|
895
|
+
trendline: TrendLineIcon,
|
|
896
|
+
horizontal: HorizontalLineIcon,
|
|
897
|
+
fibonacci: FibonacciIcon
|
|
898
|
+
};
|
|
899
|
+
function ToolIcon({ def, locale }) {
|
|
900
|
+
const Builtin = BUILTIN_ICONS[def.type];
|
|
901
|
+
if (Builtin) return /* @__PURE__ */ a3(Builtin, {});
|
|
902
|
+
if (def.icon) return /* @__PURE__ */ a3(SvgIcon, { markup: def.icon });
|
|
903
|
+
return /* @__PURE__ */ a3("span", { class: "fnc-tool-letter", children: def.name[locale].slice(0, 1) });
|
|
904
|
+
}
|
|
905
|
+
function toolGroups(defs) {
|
|
906
|
+
const groups = /* @__PURE__ */ new Map();
|
|
907
|
+
for (const def of defs) {
|
|
908
|
+
const key = def.group ?? def.type;
|
|
909
|
+
groups.set(key, [...groups.get(key) ?? [], def]);
|
|
910
|
+
}
|
|
911
|
+
return [...groups];
|
|
912
|
+
}
|
|
913
|
+
function ToolGroup({
|
|
914
|
+
ctx,
|
|
915
|
+
tools,
|
|
916
|
+
open,
|
|
917
|
+
onOpen,
|
|
918
|
+
onPick
|
|
919
|
+
}) {
|
|
920
|
+
const s3 = useStore(ctx.store);
|
|
921
|
+
const t3 = STRINGS[s3.locale];
|
|
922
|
+
const [chosen, setChosen] = d2(tools[0].type);
|
|
923
|
+
const armed = tools.find((d3) => d3.type === s3.drawingTool);
|
|
924
|
+
const current = armed ?? tools.find((d3) => d3.type === chosen) ?? tools[0];
|
|
925
|
+
const name = current.name[s3.locale];
|
|
926
|
+
const ref = T2(null);
|
|
927
|
+
A2(() => {
|
|
928
|
+
if (!open) return;
|
|
929
|
+
const close = (e3) => !ref.current?.contains(e3.target) && onOpen(false);
|
|
930
|
+
document.addEventListener("pointerdown", close, true);
|
|
931
|
+
return () => document.removeEventListener("pointerdown", close, true);
|
|
932
|
+
}, [open]);
|
|
933
|
+
const pick = (def) => {
|
|
934
|
+
setChosen(def.type);
|
|
935
|
+
onOpen(false);
|
|
936
|
+
onPick(def.type);
|
|
937
|
+
};
|
|
938
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-tool-group", ref, "data-open": open, children: [
|
|
939
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": name, "aria-label": name, "aria-pressed": !!armed, onClick: () => pick(current), children: /* @__PURE__ */ a3(ToolIcon, { def: current, locale: s3.locale }) }),
|
|
940
|
+
tools.length > 1 && /* @__PURE__ */ a3("button", { class: "fnc-tool-more", "aria-label": `${t3.moreTools}: ${name}`, "aria-haspopup": "menu", "aria-expanded": open, onClick: () => onOpen(!open), children: /* @__PURE__ */ a3(CornerIcon, {}) }),
|
|
941
|
+
open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", children: tools.map((def) => /* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitemradio", "aria-checked": def.type === current.type, onClick: () => pick(def), children: [
|
|
942
|
+
/* @__PURE__ */ a3(ToolIcon, { def, locale: s3.locale }),
|
|
943
|
+
/* @__PURE__ */ a3("span", { children: def.name[s3.locale] })
|
|
944
|
+
] })) })
|
|
945
|
+
] });
|
|
946
|
+
}
|
|
820
947
|
function DrawingToolbar({ ctx }) {
|
|
821
948
|
const s3 = useStore(ctx.store);
|
|
822
949
|
const t3 = STRINGS[s3.locale];
|
|
950
|
+
const [openGroup, setOpenGroup] = d2(null);
|
|
951
|
+
const groups = toolGroups(ctx.chart.drawingDefinitions());
|
|
823
952
|
const pick = (tool) => {
|
|
824
953
|
ctx.chart.setDrawingTool(tool);
|
|
825
954
|
if (tool && ctx.store.get().drawbarOpen) ctx.store.set({ drawbarOpen: false });
|
|
826
955
|
};
|
|
827
|
-
return /* @__PURE__ */
|
|
828
|
-
s3.drawbarCollapsed && /* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
956
|
+
return /* @__PURE__ */ a3($, { children: [
|
|
957
|
+
s3.drawbarCollapsed && /* @__PURE__ */ a3("button", { class: "fnc-drawbar-tab", "aria-label": t3.expandDrawbar, "data-tip": t3.expandDrawbar, onClick: () => ctx.setDrawbarCollapsed(false), children: /* @__PURE__ */ a3(ChevronRightIcon, {}) }),
|
|
958
|
+
/* @__PURE__ */ a3(
|
|
830
959
|
"div",
|
|
831
960
|
{
|
|
832
961
|
class: "fnc-drawbar",
|
|
@@ -836,19 +965,20 @@ function DrawingToolbar({ ctx }) {
|
|
|
836
965
|
"data-open": s3.drawbarOpen,
|
|
837
966
|
"data-collapsed": s3.drawbarCollapsed,
|
|
838
967
|
children: [
|
|
839
|
-
|
|
840
|
-
|
|
968
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.cursor, "aria-label": t3.cursor, "aria-pressed": s3.drawingTool === null, onClick: () => pick(null), children: /* @__PURE__ */ a3(CursorIcon, {}) }),
|
|
969
|
+
groups.map(([key, tools]) => /* @__PURE__ */ a3(
|
|
970
|
+
ToolGroup,
|
|
841
971
|
{
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
972
|
+
ctx,
|
|
973
|
+
tools,
|
|
974
|
+
open: openGroup === key,
|
|
975
|
+
onOpen: (open) => setOpenGroup(open ? key : null),
|
|
976
|
+
onPick: pick
|
|
977
|
+
},
|
|
978
|
+
key
|
|
849
979
|
)),
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ a3("div", { class: "fnc-hsep" }),
|
|
981
|
+
/* @__PURE__ */ a3(
|
|
852
982
|
"button",
|
|
853
983
|
{
|
|
854
984
|
class: "fnc-btn",
|
|
@@ -856,10 +986,10 @@ function DrawingToolbar({ ctx }) {
|
|
|
856
986
|
"aria-label": t3.magnet,
|
|
857
987
|
"aria-pressed": s3.magnet,
|
|
858
988
|
onClick: () => ctx.chart.setMagnet(!s3.magnet),
|
|
859
|
-
children: /* @__PURE__ */
|
|
989
|
+
children: /* @__PURE__ */ a3(MagnetIcon, {})
|
|
860
990
|
}
|
|
861
991
|
),
|
|
862
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ a3(
|
|
863
993
|
"button",
|
|
864
994
|
{
|
|
865
995
|
class: "fnc-btn",
|
|
@@ -867,18 +997,18 @@ function DrawingToolbar({ ctx }) {
|
|
|
867
997
|
"aria-label": t3.removeAll,
|
|
868
998
|
disabled: s3.drawingCount === 0,
|
|
869
999
|
onClick: () => ctx.chart.clearDrawings(),
|
|
870
|
-
children: /* @__PURE__ */
|
|
1000
|
+
children: /* @__PURE__ */ a3(TrashIcon, {})
|
|
871
1001
|
}
|
|
872
1002
|
),
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ a3("span", { class: "fnc-spacer" }),
|
|
1004
|
+
/* @__PURE__ */ a3(
|
|
875
1005
|
"button",
|
|
876
1006
|
{
|
|
877
1007
|
class: "fnc-btn fnc-drawbar-collapse",
|
|
878
1008
|
"data-tip": t3.collapseDrawbar,
|
|
879
1009
|
"aria-label": t3.collapseDrawbar,
|
|
880
1010
|
onClick: () => ctx.setDrawbarCollapsed(true),
|
|
881
|
-
children: /* @__PURE__ */
|
|
1011
|
+
children: /* @__PURE__ */ a3(ChevronLeftIcon, {})
|
|
882
1012
|
}
|
|
883
1013
|
)
|
|
884
1014
|
]
|
|
@@ -892,8 +1022,8 @@ function SelectionBar({ ctx }) {
|
|
|
892
1022
|
const t3 = STRINGS[s3.locale];
|
|
893
1023
|
const d3 = s3.selection;
|
|
894
1024
|
if (!d3 || s3.layout.plotWidth <= 0) return null;
|
|
895
|
-
return /* @__PURE__ */
|
|
896
|
-
SWATCHES.map((color) => /* @__PURE__ */
|
|
1025
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-selbar", role: "toolbar", style: { left: `${s3.layout.plotWidth / 2}px` }, children: [
|
|
1026
|
+
SWATCHES.map((color) => /* @__PURE__ */ a3(
|
|
897
1027
|
"button",
|
|
898
1028
|
{
|
|
899
1029
|
class: "fnc-swatch",
|
|
@@ -904,8 +1034,8 @@ function SelectionBar({ ctx }) {
|
|
|
904
1034
|
onClick: () => ctx.chart.updateDrawing(d3.id, { color })
|
|
905
1035
|
}
|
|
906
1036
|
)),
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
1038
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.remove, "aria-label": t3.remove, onClick: () => ctx.chart.removeDrawing(d3.id), children: /* @__PURE__ */ a3(TrashIcon, {}) })
|
|
909
1039
|
] });
|
|
910
1040
|
}
|
|
911
1041
|
|
|
@@ -964,8 +1094,8 @@ function ChartTypeMenu({ ctx }) {
|
|
|
964
1094
|
ctx.store.set({ chartType: type });
|
|
965
1095
|
setOpen(false);
|
|
966
1096
|
};
|
|
967
|
-
return /* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
1097
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-menu-wrap fnc-chart-type", ref, children: [
|
|
1098
|
+
/* @__PURE__ */ a3(
|
|
969
1099
|
"button",
|
|
970
1100
|
{
|
|
971
1101
|
class: "fnc-btn fnc-btn-wide",
|
|
@@ -975,12 +1105,12 @@ function ChartTypeMenu({ ctx }) {
|
|
|
975
1105
|
"aria-expanded": open,
|
|
976
1106
|
onClick: () => setOpen(!open),
|
|
977
1107
|
children: [
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ a3(current.icon, {}),
|
|
1109
|
+
/* @__PURE__ */ a3(ChevronDownIcon, {})
|
|
980
1110
|
]
|
|
981
1111
|
}
|
|
982
1112
|
),
|
|
983
|
-
open && /* @__PURE__ */
|
|
1113
|
+
open && /* @__PURE__ */ a3("div", { class: "fnc-menu", role: "menu", ref: menuRef, children: TYPES.map(({ type, label, icon: Icon2 }) => /* @__PURE__ */ a3(
|
|
984
1114
|
"button",
|
|
985
1115
|
{
|
|
986
1116
|
class: "fnc-menu-item",
|
|
@@ -988,8 +1118,8 @@ function ChartTypeMenu({ ctx }) {
|
|
|
988
1118
|
"aria-checked": type === s3.chartType,
|
|
989
1119
|
onClick: () => choose(type),
|
|
990
1120
|
children: [
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ a3(Icon2, {}),
|
|
1122
|
+
/* @__PURE__ */ a3("span", { children: t3[label] })
|
|
993
1123
|
]
|
|
994
1124
|
}
|
|
995
1125
|
)) })
|
|
@@ -998,7 +1128,6 @@ function ChartTypeMenu({ ctx }) {
|
|
|
998
1128
|
|
|
999
1129
|
// src/components/indicator-dialogs.tsx
|
|
1000
1130
|
import {
|
|
1001
|
-
INDICATORS,
|
|
1002
1131
|
maLines,
|
|
1003
1132
|
PRICE_SOURCES,
|
|
1004
1133
|
SERIES_COLORS
|
|
@@ -1019,6 +1148,7 @@ var SECTIONS = [
|
|
|
1019
1148
|
toggles: [
|
|
1020
1149
|
{ key: "highLowMarkers", label: "settingHighLow" },
|
|
1021
1150
|
{ key: "lastPriceLine", label: "settingLastPrice" },
|
|
1151
|
+
{ key: "countdown", label: "settingCountdown" },
|
|
1022
1152
|
{ key: "volume", label: "settingVolume" },
|
|
1023
1153
|
{ key: "navigationButtons", label: "settingNavButtons" }
|
|
1024
1154
|
]
|
|
@@ -1031,6 +1161,11 @@ var SECTIONS = [
|
|
|
1031
1161
|
]
|
|
1032
1162
|
}
|
|
1033
1163
|
];
|
|
1164
|
+
var SCALES = [
|
|
1165
|
+
{ mode: "normal", label: "scaleNormal" },
|
|
1166
|
+
{ mode: "log", label: "scaleLog" },
|
|
1167
|
+
{ mode: "percent", label: "scalePercent" }
|
|
1168
|
+
];
|
|
1034
1169
|
function SettingsDialog({ ctx }) {
|
|
1035
1170
|
const { locale } = useStore(ctx.store);
|
|
1036
1171
|
const t3 = STRINGS[locale];
|
|
@@ -1039,16 +1174,16 @@ function SettingsDialog({ ctx }) {
|
|
|
1039
1174
|
const close = () => ctx.store.set({ dialog: null });
|
|
1040
1175
|
const set = (patch) => ctx.chart.setSettings(patch);
|
|
1041
1176
|
const themeColor = (name) => toHex(getComputedStyle(ctx.root).getPropertyValue(name).trim());
|
|
1042
|
-
return /* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3("div", { class: "fnc-dialog", role: "dialog", "aria-modal": "true", "aria-label": t3.chartSettings, onKeyDown: (e3) => e3.key === "Escape" && close(), children: [
|
|
1178
|
+
/* @__PURE__ */ a3("div", { class: "fnc-dialog-head", children: [
|
|
1179
|
+
/* @__PURE__ */ a3("b", { children: t3.chartSettings }),
|
|
1180
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.close, onClick: close, children: /* @__PURE__ */ a3(CloseIcon, {}) })
|
|
1046
1181
|
] }),
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
["upColor", "downColor"].map((key) => /* @__PURE__ */
|
|
1050
|
-
/* @__PURE__ */
|
|
1051
|
-
/* @__PURE__ */
|
|
1182
|
+
/* @__PURE__ */ a3("form", { class: "fnc-form", onSubmit: (e3) => (e3.preventDefault(), close()), children: [
|
|
1183
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsCandles }),
|
|
1184
|
+
["upColor", "downColor"].map((key) => /* @__PURE__ */ a3("label", { class: "fnc-row", children: [
|
|
1185
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: key === "upColor" ? t3.settingUpColor : t3.settingDownColor }),
|
|
1186
|
+
/* @__PURE__ */ a3(
|
|
1052
1187
|
"input",
|
|
1053
1188
|
{
|
|
1054
1189
|
type: "color",
|
|
@@ -1057,13 +1192,24 @@ function SettingsDialog({ ctx }) {
|
|
|
1057
1192
|
onInput: (e3) => set({ [key]: e3.currentTarget.value })
|
|
1058
1193
|
}
|
|
1059
1194
|
),
|
|
1060
|
-
settings[key] && /* @__PURE__ */
|
|
1195
|
+
settings[key] && /* @__PURE__ */ a3("button", { type: "button", class: "fnc-link", onClick: () => set({ [key]: null }), children: t3.followTheme })
|
|
1061
1196
|
] })),
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1197
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsScale }),
|
|
1198
|
+
/* @__PURE__ */ a3("div", { class: "fnc-row", children: /* @__PURE__ */ a3("div", { class: "fnc-seg", role: "radiogroup", "aria-label": t3.settingsScale, children: SCALES.map(({ mode, label }) => /* @__PURE__ */ a3(
|
|
1199
|
+
"button",
|
|
1200
|
+
{
|
|
1201
|
+
type: "button",
|
|
1202
|
+
role: "radio",
|
|
1203
|
+
"aria-checked": settings.priceScale === mode,
|
|
1204
|
+
onClick: () => set({ priceScale: mode }),
|
|
1205
|
+
children: t3[label]
|
|
1206
|
+
}
|
|
1207
|
+
)) }) }),
|
|
1208
|
+
SECTIONS.map((section) => /* @__PURE__ */ a3($, { children: [
|
|
1209
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3[section.title] }),
|
|
1210
|
+
section.toggles.map(({ key, label }) => /* @__PURE__ */ a3("label", { class: "fnc-row fnc-toggle-row", children: [
|
|
1211
|
+
/* @__PURE__ */ a3("span", { children: t3[label] }),
|
|
1212
|
+
/* @__PURE__ */ a3(
|
|
1067
1213
|
"input",
|
|
1068
1214
|
{
|
|
1069
1215
|
type: "checkbox",
|
|
@@ -1075,9 +1221,9 @@ function SettingsDialog({ ctx }) {
|
|
|
1075
1221
|
)
|
|
1076
1222
|
] }))
|
|
1077
1223
|
] })),
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ a3("div", { class: "fnc-form-actions", children: [
|
|
1225
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-action fnc-action-danger", onClick: () => ctx.chart.setSettings(DEFAULT_CHART_SETTINGS), children: t3.resetDefaults }),
|
|
1226
|
+
/* @__PURE__ */ a3("button", { type: "submit", class: "fnc-action fnc-action-primary", children: t3.done })
|
|
1081
1227
|
] })
|
|
1082
1228
|
] })
|
|
1083
1229
|
] }) });
|
|
@@ -1089,7 +1235,7 @@ function Dialog({ title, onClose, children, wide }) {
|
|
|
1089
1235
|
A2(() => {
|
|
1090
1236
|
ref.current?.querySelector("input, button.fnc-sr-row")?.focus();
|
|
1091
1237
|
}, []);
|
|
1092
|
-
return /* @__PURE__ */
|
|
1238
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && onClose(), children: /* @__PURE__ */ a3(
|
|
1093
1239
|
"div",
|
|
1094
1240
|
{
|
|
1095
1241
|
class: wide ? "fnc-dialog fnc-dialog-wide" : "fnc-dialog",
|
|
@@ -1099,49 +1245,71 @@ function Dialog({ title, onClose, children, wide }) {
|
|
|
1099
1245
|
ref,
|
|
1100
1246
|
onKeyDown: (e3) => e3.key === "Escape" && onClose(),
|
|
1101
1247
|
children: [
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ a3("div", { class: "fnc-dialog-head", children: [
|
|
1249
|
+
/* @__PURE__ */ a3("b", { children: title }),
|
|
1250
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": "close", onClick: onClose, children: /* @__PURE__ */ a3(CloseIcon, {}) })
|
|
1105
1251
|
] }),
|
|
1106
1252
|
children
|
|
1107
1253
|
]
|
|
1108
1254
|
}
|
|
1109
1255
|
) });
|
|
1110
1256
|
}
|
|
1257
|
+
var SEARCH_THRESHOLD = 8;
|
|
1111
1258
|
function IndicatorPicker({ ctx }) {
|
|
1112
1259
|
const { locale } = useStore(ctx.store);
|
|
1113
1260
|
const t3 = STRINGS[locale];
|
|
1261
|
+
const [query, setQuery] = d2("");
|
|
1114
1262
|
const close = () => ctx.store.set({ dialog: null });
|
|
1115
1263
|
const add = (type) => {
|
|
1116
1264
|
ctx.chart.addIndicator(type);
|
|
1117
1265
|
close();
|
|
1118
1266
|
};
|
|
1267
|
+
const all = ctx.chart.indicatorDefinitions();
|
|
1268
|
+
const q2 = query.trim().toLowerCase();
|
|
1269
|
+
const matches = (d3) => !q2 || [d3.type, d3.name.ko, d3.name.en, d3.description[locale]].some((s3) => s3.toLowerCase().includes(q2));
|
|
1119
1270
|
const groups = [
|
|
1120
|
-
[locale === "ko" ? "\uAC00\uACA9 \uCC28\uD2B8\uC5D0 \uD45C\uC2DC" : "On price",
|
|
1121
|
-
[locale === "ko" ? "\uC544\uB798 \uC601\uC5ED\uC5D0 \uD45C\uC2DC" : "Separate pane",
|
|
1122
|
-
];
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1271
|
+
[locale === "ko" ? "\uAC00\uACA9 \uCC28\uD2B8\uC5D0 \uD45C\uC2DC" : "On price", all.filter((d3) => d3.overlay && matches(d3))],
|
|
1272
|
+
[locale === "ko" ? "\uC544\uB798 \uC601\uC5ED\uC5D0 \uD45C\uC2DC" : "Separate pane", all.filter((d3) => !d3.overlay && matches(d3))]
|
|
1273
|
+
].filter(([, defs]) => defs.length > 0);
|
|
1274
|
+
const first = groups[0]?.[1][0];
|
|
1275
|
+
return /* @__PURE__ */ a3(Dialog, { title: t3.addIndicator, onClose: close, children: [
|
|
1276
|
+
all.length > SEARCH_THRESHOLD && /* @__PURE__ */ a3("div", { class: "fnc-search fnc-ind-search", children: /* @__PURE__ */ a3(
|
|
1277
|
+
"input",
|
|
1278
|
+
{
|
|
1279
|
+
value: query,
|
|
1280
|
+
placeholder: t3.searchIndicators,
|
|
1281
|
+
"aria-label": t3.searchIndicators,
|
|
1282
|
+
autocomplete: "off",
|
|
1283
|
+
onInput: (e3) => setQuery(e3.currentTarget.value),
|
|
1284
|
+
onKeyDown: (e3) => e3.key === "Enter" && first && add(first.type)
|
|
1285
|
+
}
|
|
1286
|
+
) }),
|
|
1287
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sr-list fnc-scroll", children: [
|
|
1288
|
+
groups.length === 0 && /* @__PURE__ */ a3("div", { class: "fnc-empty", children: t3.noResults }),
|
|
1289
|
+
groups.map(([label, defs]) => /* @__PURE__ */ a3($, { children: [
|
|
1290
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sr-section", children: label }),
|
|
1291
|
+
defs.map((def) => {
|
|
1292
|
+
const type = def.type;
|
|
1293
|
+
return /* @__PURE__ */ a3("button", { class: "fnc-sr-row", onClick: () => add(type), children: /* @__PURE__ */ a3("span", { class: "fnc-sr-main", children: [
|
|
1294
|
+
/* @__PURE__ */ a3("span", { class: "fnc-sr-name", children: def.name[locale] }),
|
|
1295
|
+
/* @__PURE__ */ a3("span", { class: "fnc-sr-meta", children: def.description[locale] })
|
|
1296
|
+
] }) });
|
|
1297
|
+
})
|
|
1298
|
+
] }))
|
|
1299
|
+
] })
|
|
1300
|
+
] });
|
|
1133
1301
|
}
|
|
1134
1302
|
var WIDTHS = [1, 2, 3, 4];
|
|
1135
|
-
function defaultSeries(
|
|
1136
|
-
return
|
|
1303
|
+
function defaultSeries(def, params) {
|
|
1304
|
+
return def.compute([], params).series.filter((s3) => s3.kind === "line");
|
|
1137
1305
|
}
|
|
1138
1306
|
function StyleControls({
|
|
1139
1307
|
t: t3,
|
|
1140
1308
|
row: row2,
|
|
1141
1309
|
onChange
|
|
1142
1310
|
}) {
|
|
1143
|
-
return /* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ a3($, { children: [
|
|
1312
|
+
/* @__PURE__ */ a3(
|
|
1145
1313
|
"input",
|
|
1146
1314
|
{
|
|
1147
1315
|
type: "checkbox",
|
|
@@ -1151,7 +1319,7 @@ function StyleControls({
|
|
|
1151
1319
|
onChange: (e3) => onChange({ visible: e3.currentTarget.checked })
|
|
1152
1320
|
}
|
|
1153
1321
|
),
|
|
1154
|
-
/* @__PURE__ */
|
|
1322
|
+
/* @__PURE__ */ a3(
|
|
1155
1323
|
"input",
|
|
1156
1324
|
{
|
|
1157
1325
|
type: "color",
|
|
@@ -1161,24 +1329,24 @@ function StyleControls({
|
|
|
1161
1329
|
onInput: (e3) => onChange({ color: e3.currentTarget.value })
|
|
1162
1330
|
}
|
|
1163
1331
|
),
|
|
1164
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-width", value: row2.width, "aria-label": t3.lineWidth, onChange: (e3) => onChange({ width: Number(e3.currentTarget.value) }), children: WIDTHS.map((w3) => /* @__PURE__ */ a3("option", { value: w3, children: [
|
|
1165
1333
|
w3,
|
|
1166
1334
|
"px"
|
|
1167
1335
|
] })) })
|
|
1168
1336
|
] });
|
|
1169
1337
|
}
|
|
1170
1338
|
function SourceSelect({ value, locale, label, onChange }) {
|
|
1171
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-source", value, "aria-label": label, onChange: (e3) => onChange(e3.currentTarget.value), children: PRICE_SOURCES.map((s3) => /* @__PURE__ */ a3("option", { value: s3.value, children: s3.label[locale] })) });
|
|
1172
1340
|
}
|
|
1173
1341
|
function IndicatorSettings({ ctx, id }) {
|
|
1174
1342
|
const { locale, indicators } = useStore(ctx.store);
|
|
1175
1343
|
const t3 = STRINGS[locale];
|
|
1176
1344
|
const config = indicators.find((c3) => c3.id === id);
|
|
1177
|
-
const def = config ?
|
|
1345
|
+
const def = config ? ctx.chart.indicatorDefinition(config.type) ?? null : null;
|
|
1178
1346
|
const hasLines = !!def?.params.some((p3) => p3.kind === "lines");
|
|
1179
1347
|
const [lines, setLines] = d2(() => {
|
|
1180
|
-
if (!config || !hasLines) return [];
|
|
1181
|
-
const defaults = defaultSeries(
|
|
1348
|
+
if (!config || !def || !hasLines) return [];
|
|
1349
|
+
const defaults = defaultSeries(def, config.params);
|
|
1182
1350
|
return maLines(config.params).map((l3, i3) => {
|
|
1183
1351
|
const style = config.styles?.[`l${i3}`];
|
|
1184
1352
|
return {
|
|
@@ -1194,8 +1362,8 @@ function IndicatorSettings({ ctx, id }) {
|
|
|
1194
1362
|
() => Object.fromEntries(Object.entries(config?.params ?? {}).filter(([, v3]) => !Array.isArray(v3)).map(([k2, v3]) => [k2, String(v3)]))
|
|
1195
1363
|
);
|
|
1196
1364
|
const [styles, setStyles] = d2(() => {
|
|
1197
|
-
if (!config || hasLines) return [];
|
|
1198
|
-
return defaultSeries(
|
|
1365
|
+
if (!config || !def || hasLines) return [];
|
|
1366
|
+
return defaultSeries(def, config.params).map((s3) => {
|
|
1199
1367
|
const style = config.styles?.[s3.key];
|
|
1200
1368
|
return { key: s3.key, label: s3.label, color: style?.color ?? s3.color, width: style?.width ?? s3.width, visible: style?.visible ?? true };
|
|
1201
1369
|
});
|
|
@@ -1238,16 +1406,16 @@ function IndicatorSettings({ ctx, id }) {
|
|
|
1238
1406
|
ctx.chart.updateIndicator(id, { params, styles: nextStyles });
|
|
1239
1407
|
close();
|
|
1240
1408
|
};
|
|
1241
|
-
return /* @__PURE__ */
|
|
1242
|
-
hasLines ? /* @__PURE__ */
|
|
1243
|
-
lines.map((l3, i3) => /* @__PURE__ */
|
|
1244
|
-
/* @__PURE__ */
|
|
1409
|
+
return /* @__PURE__ */ a3(Dialog, { title: `${def.name[locale]} \xB7 ${t3.indicatorSettings}`, onClose: close, wide: true, children: /* @__PURE__ */ a3("form", { class: "fnc-form", onSubmit: apply, children: [
|
|
1410
|
+
hasLines ? /* @__PURE__ */ a3("div", { class: "fnc-rows", children: [
|
|
1411
|
+
lines.map((l3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
1412
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label", children: [
|
|
1245
1413
|
t3.period,
|
|
1246
1414
|
i3 + 1
|
|
1247
1415
|
] }),
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1416
|
+
/* @__PURE__ */ a3(StyleControls, { t: t3, row: l3, onChange: (p3) => updateLine(i3, p3) }),
|
|
1417
|
+
/* @__PURE__ */ a3(SourceSelect, { value: l3.source, locale, label: t3.source, onChange: (source) => updateLine(i3, { source }) }),
|
|
1418
|
+
/* @__PURE__ */ a3(
|
|
1251
1419
|
"input",
|
|
1252
1420
|
{
|
|
1253
1421
|
class: "fnc-input fnc-input-period",
|
|
@@ -1257,17 +1425,17 @@ function IndicatorSettings({ ctx, id }) {
|
|
|
1257
1425
|
onInput: (e3) => updateLine(i3, { period: e3.currentTarget.value.replace(/\D/g, "") })
|
|
1258
1426
|
}
|
|
1259
1427
|
),
|
|
1260
|
-
/* @__PURE__ */
|
|
1428
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-ind-btn", "aria-label": t3.removePeriod, "data-tip": t3.removePeriod, onClick: () => setLines(lines.filter((_3, j2) => j2 !== i3)), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
1261
1429
|
] })),
|
|
1262
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-add-row", onClick: addLine, children: [
|
|
1263
1431
|
"+ ",
|
|
1264
1432
|
t3.addPeriod
|
|
1265
1433
|
] })
|
|
1266
|
-
] }) : /* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
def.params.map((spec) => /* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
spec.kind === "source" ? /* @__PURE__ */
|
|
1434
|
+
] }) : /* @__PURE__ */ a3($, { children: [
|
|
1435
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.inputs }),
|
|
1436
|
+
def.params.map((spec) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
1437
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: spec.label[locale] }),
|
|
1438
|
+
spec.kind === "source" ? /* @__PURE__ */ a3(
|
|
1271
1439
|
SourceSelect,
|
|
1272
1440
|
{
|
|
1273
1441
|
value: values[spec.key] ?? "close",
|
|
@@ -1275,7 +1443,7 @@ function IndicatorSettings({ ctx, id }) {
|
|
|
1275
1443
|
label: spec.label[locale],
|
|
1276
1444
|
onChange: (v3) => setValues({ ...values, [spec.key]: v3 })
|
|
1277
1445
|
}
|
|
1278
|
-
) : /* @__PURE__ */
|
|
1446
|
+
) : /* @__PURE__ */ a3(
|
|
1279
1447
|
"input",
|
|
1280
1448
|
{
|
|
1281
1449
|
class: "fnc-input",
|
|
@@ -1286,14 +1454,14 @@ function IndicatorSettings({ ctx, id }) {
|
|
|
1286
1454
|
}
|
|
1287
1455
|
)
|
|
1288
1456
|
] })),
|
|
1289
|
-
styles.length > 0 && /* @__PURE__ */
|
|
1290
|
-
styles.map((row2, i3) => /* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
/* @__PURE__ */
|
|
1457
|
+
styles.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.style }),
|
|
1458
|
+
styles.map((row2, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
1459
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: row2.label }),
|
|
1460
|
+
/* @__PURE__ */ a3(StyleControls, { t: t3, row: row2, onChange: (p3) => setStyles(styles.map((s3, j2) => j2 === i3 ? { ...s3, ...p3 } : s3)) })
|
|
1293
1461
|
] }))
|
|
1294
1462
|
] }),
|
|
1295
|
-
/* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1463
|
+
/* @__PURE__ */ a3("div", { class: "fnc-form-actions", children: [
|
|
1464
|
+
/* @__PURE__ */ a3(
|
|
1297
1465
|
"button",
|
|
1298
1466
|
{
|
|
1299
1467
|
type: "button",
|
|
@@ -1305,16 +1473,16 @@ function IndicatorSettings({ ctx, id }) {
|
|
|
1305
1473
|
children: t3.remove
|
|
1306
1474
|
}
|
|
1307
1475
|
),
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1476
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-action", onClick: close, children: t3.cancel }),
|
|
1477
|
+
/* @__PURE__ */ a3("button", { type: "submit", class: "fnc-action fnc-action-primary", children: t3.apply })
|
|
1310
1478
|
] })
|
|
1311
1479
|
] }) });
|
|
1312
1480
|
}
|
|
1313
1481
|
function Dialogs({ ctx }) {
|
|
1314
1482
|
const { dialog } = useStore(ctx.store);
|
|
1315
|
-
if (dialog?.kind === "indicators") return /* @__PURE__ */
|
|
1316
|
-
if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */
|
|
1317
|
-
if (dialog?.kind === "chartSettings") return /* @__PURE__ */
|
|
1483
|
+
if (dialog?.kind === "indicators") return /* @__PURE__ */ a3(IndicatorPicker, { ctx });
|
|
1484
|
+
if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id });
|
|
1485
|
+
if (dialog?.kind === "chartSettings") return /* @__PURE__ */ a3(SettingsDialog, { ctx });
|
|
1318
1486
|
return null;
|
|
1319
1487
|
}
|
|
1320
1488
|
|
|
@@ -1349,8 +1517,8 @@ function IntervalPicker({ ctx }) {
|
|
|
1349
1517
|
setOpen(false);
|
|
1350
1518
|
ctx.selectResolution(r3);
|
|
1351
1519
|
};
|
|
1352
|
-
return /* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1520
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-interval-picker", ref, children: [
|
|
1521
|
+
/* @__PURE__ */ a3("div", { class: "fnc-intervals", children: favorites.map((r3) => /* @__PURE__ */ a3(
|
|
1354
1522
|
"button",
|
|
1355
1523
|
{
|
|
1356
1524
|
class: "fnc-chip",
|
|
@@ -1361,7 +1529,7 @@ function IntervalPicker({ ctx }) {
|
|
|
1361
1529
|
children: resolutionLabel(r3, s3.locale)
|
|
1362
1530
|
}
|
|
1363
1531
|
)) }),
|
|
1364
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ a3(
|
|
1365
1533
|
"button",
|
|
1366
1534
|
{
|
|
1367
1535
|
class: `fnc-btn fnc-btn-wide fnc-interval-trigger${favorites.includes(s3.resolution) ? "" : " fnc-interval-trigger-active"}`,
|
|
@@ -1371,18 +1539,18 @@ function IntervalPicker({ ctx }) {
|
|
|
1371
1539
|
"aria-expanded": open,
|
|
1372
1540
|
onClick: () => setOpen(!open),
|
|
1373
1541
|
children: [
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ a3("b", { class: "fnc-interval-current", children: resolutionLabel(s3.resolution, s3.locale) }),
|
|
1543
|
+
/* @__PURE__ */ a3(ChevronDownIcon, {})
|
|
1376
1544
|
]
|
|
1377
1545
|
}
|
|
1378
1546
|
),
|
|
1379
|
-
open && /* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1547
|
+
open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-interval-menu", role: "menu", ref: menuRef, children: ctx.intervalGroups.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-menu-group", role: "group", "aria-label": t3[GROUP_LABEL[group.id]], children: [
|
|
1548
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-title", children: t3[GROUP_LABEL[group.id]] }),
|
|
1381
1549
|
group.intervals.map((r3) => {
|
|
1382
1550
|
const favorite = s3.favoriteIntervals.includes(r3);
|
|
1383
1551
|
const ok = isSupported(r3);
|
|
1384
|
-
return /* @__PURE__ */
|
|
1385
|
-
/* @__PURE__ */
|
|
1552
|
+
return /* @__PURE__ */ a3("div", { class: `fnc-menu-row${favorite ? " is-favorite" : ""}`, children: [
|
|
1553
|
+
/* @__PURE__ */ a3(
|
|
1386
1554
|
"button",
|
|
1387
1555
|
{
|
|
1388
1556
|
class: "fnc-menu-item",
|
|
@@ -1394,7 +1562,7 @@ function IntervalPicker({ ctx }) {
|
|
|
1394
1562
|
children: resolutionLabel(r3, s3.locale, "long")
|
|
1395
1563
|
}
|
|
1396
1564
|
),
|
|
1397
|
-
/* @__PURE__ */
|
|
1565
|
+
/* @__PURE__ */ a3(
|
|
1398
1566
|
"button",
|
|
1399
1567
|
{
|
|
1400
1568
|
class: "fnc-star",
|
|
@@ -1402,7 +1570,7 @@ function IntervalPicker({ ctx }) {
|
|
|
1402
1570
|
"aria-label": `${resolutionLabel(r3, s3.locale, "long")} ${favorite ? t3.removeFavorite : t3.addFavorite}`,
|
|
1403
1571
|
"data-tip": favorite ? t3.removeFavorite : t3.addFavorite,
|
|
1404
1572
|
onClick: () => ctx.toggleFavoriteInterval(r3),
|
|
1405
|
-
children: /* @__PURE__ */
|
|
1573
|
+
children: /* @__PURE__ */ a3(StarIcon, { filled: favorite })
|
|
1406
1574
|
}
|
|
1407
1575
|
)
|
|
1408
1576
|
] });
|
|
@@ -1480,7 +1648,7 @@ function layoutRects(node, x2 = 0, y3 = 0, w3 = 20, h3 = 16, gap = 1.6) {
|
|
|
1480
1648
|
// src/components/layout-menu.tsx
|
|
1481
1649
|
var LAYOUT_PANES = (id) => paneCount(LAYOUTS[id]);
|
|
1482
1650
|
function LayoutGlyph({ id }) {
|
|
1483
|
-
return /* @__PURE__ */
|
|
1651
|
+
return /* @__PURE__ */ a3("svg", { width: "20", height: "16", viewBox: "0 0 20 16", "aria-hidden": "true", children: layoutRects(LAYOUTS[id]).map((r3) => /* @__PURE__ */ a3("rect", { x: r3.x + 0.5, y: r3.y + 0.5, width: Math.max(0, r3.w - 1), height: Math.max(0, r3.h - 1), rx: "1.5", fill: "none", stroke: "currentColor", "stroke-width": "1.2" })) });
|
|
1484
1652
|
}
|
|
1485
1653
|
function usePopover() {
|
|
1486
1654
|
const [open, setOpen] = d2(false);
|
|
@@ -1513,9 +1681,9 @@ function LayoutMenu({ ctx, multi }) {
|
|
|
1513
1681
|
const layoutMenuRef = useKeepInView(layout.open);
|
|
1514
1682
|
const syncMenuRef = useKeepInView(sync.open);
|
|
1515
1683
|
const anySync = Object.values(m3.sync).some(Boolean);
|
|
1516
|
-
return /* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1684
|
+
return /* @__PURE__ */ a3($, { children: [
|
|
1685
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-wrap", ref: layout.ref, children: [
|
|
1686
|
+
/* @__PURE__ */ a3(
|
|
1519
1687
|
"button",
|
|
1520
1688
|
{
|
|
1521
1689
|
class: "fnc-btn fnc-btn-wide fnc-btn-layout",
|
|
@@ -1525,14 +1693,14 @@ function LayoutMenu({ ctx, multi }) {
|
|
|
1525
1693
|
"aria-expanded": layout.open,
|
|
1526
1694
|
onClick: () => layout.setOpen(!layout.open),
|
|
1527
1695
|
children: [
|
|
1528
|
-
/* @__PURE__ */
|
|
1529
|
-
/* @__PURE__ */
|
|
1696
|
+
/* @__PURE__ */ a3(LayoutGlyph, { id: m3.layout }),
|
|
1697
|
+
/* @__PURE__ */ a3(ChevronDownIcon, {})
|
|
1530
1698
|
]
|
|
1531
1699
|
}
|
|
1532
1700
|
),
|
|
1533
|
-
layout.open && /* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
group.map((id) => /* @__PURE__ */
|
|
1701
|
+
layout.open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-layout-menu", role: "menu", "aria-label": t3.layout, ref: layoutMenuRef, children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
|
|
1702
|
+
/* @__PURE__ */ a3("span", { class: "fnc-layout-count", children: group[0].split("-")[0] }),
|
|
1703
|
+
group.map((id) => /* @__PURE__ */ a3(
|
|
1536
1704
|
"button",
|
|
1537
1705
|
{
|
|
1538
1706
|
class: "fnc-layout-opt",
|
|
@@ -1544,13 +1712,13 @@ function LayoutMenu({ ctx, multi }) {
|
|
|
1544
1712
|
multi.setLayout(id);
|
|
1545
1713
|
layout.setOpen(false);
|
|
1546
1714
|
},
|
|
1547
|
-
children: /* @__PURE__ */
|
|
1715
|
+
children: /* @__PURE__ */ a3(LayoutGlyph, { id })
|
|
1548
1716
|
}
|
|
1549
1717
|
))
|
|
1550
1718
|
] })) })
|
|
1551
1719
|
] }),
|
|
1552
|
-
LAYOUT_PANES(m3.layout) > 1 && /* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1720
|
+
LAYOUT_PANES(m3.layout) > 1 && /* @__PURE__ */ a3("div", { class: "fnc-menu-wrap", ref: sync.ref, children: [
|
|
1721
|
+
/* @__PURE__ */ a3(
|
|
1554
1722
|
"button",
|
|
1555
1723
|
{
|
|
1556
1724
|
class: "fnc-btn fnc-btn-sync",
|
|
@@ -1560,15 +1728,15 @@ function LayoutMenu({ ctx, multi }) {
|
|
|
1560
1728
|
"aria-expanded": sync.open,
|
|
1561
1729
|
"aria-pressed": anySync,
|
|
1562
1730
|
onClick: () => sync.setOpen(!sync.open),
|
|
1563
|
-
children: /* @__PURE__ */
|
|
1731
|
+
children: /* @__PURE__ */ a3(LinkIcon, {})
|
|
1564
1732
|
}
|
|
1565
1733
|
),
|
|
1566
|
-
sync.open && /* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1734
|
+
sync.open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-sync-menu", role: "menu", "aria-label": t3.sync, ref: syncMenuRef, children: [
|
|
1735
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-title", children: [
|
|
1568
1736
|
t3.sync,
|
|
1569
|
-
/* @__PURE__ */
|
|
1737
|
+
/* @__PURE__ */ a3("small", { children: t3.syncHint })
|
|
1570
1738
|
] }),
|
|
1571
|
-
SYNC_KEYS.map(({ key, label }) => /* @__PURE__ */
|
|
1739
|
+
SYNC_KEYS.map(({ key, label }) => /* @__PURE__ */ a3(
|
|
1572
1740
|
"button",
|
|
1573
1741
|
{
|
|
1574
1742
|
class: "fnc-menu-item fnc-sync-item",
|
|
@@ -1576,8 +1744,8 @@ function LayoutMenu({ ctx, multi }) {
|
|
|
1576
1744
|
"aria-checked": m3.sync[key],
|
|
1577
1745
|
onClick: () => multi.setSync({ [key]: !m3.sync[key] }),
|
|
1578
1746
|
children: [
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1747
|
+
/* @__PURE__ */ a3("span", { children: t3[label] }),
|
|
1748
|
+
/* @__PURE__ */ a3("span", { class: "fnc-switch", "data-on": m3.sync[key] ? "true" : "false", "aria-hidden": "true" })
|
|
1581
1749
|
]
|
|
1582
1750
|
}
|
|
1583
1751
|
))
|
|
@@ -1593,7 +1761,7 @@ function Slot({ el, fixed = false }) {
|
|
|
1593
1761
|
ref.current?.appendChild(el);
|
|
1594
1762
|
return () => el.remove();
|
|
1595
1763
|
}, [el]);
|
|
1596
|
-
return /* @__PURE__ */
|
|
1764
|
+
return /* @__PURE__ */ a3("div", { class: fixed ? "fnc-slot-host fnc-slot-host-fixed" : "fnc-slot-host", ref });
|
|
1597
1765
|
}
|
|
1598
1766
|
|
|
1599
1767
|
// src/components/symbol-avatar.tsx
|
|
@@ -1607,10 +1775,10 @@ function SymbolAvatar({ info, size = 24 }) {
|
|
|
1607
1775
|
A2(() => setFailed(false), [info.logoUrl]);
|
|
1608
1776
|
const style = { width: `${size}px`, height: `${size}px`, fontSize: `${Math.round(size * 0.46)}px` };
|
|
1609
1777
|
if (info.logoUrl && !failed) {
|
|
1610
|
-
return /* @__PURE__ */
|
|
1778
|
+
return /* @__PURE__ */ a3("img", { class: "fnc-avatar", src: info.logoUrl, alt: "", style, onError: () => setFailed(true) });
|
|
1611
1779
|
}
|
|
1612
1780
|
const h3 = hue(info.symbol);
|
|
1613
|
-
return /* @__PURE__ */
|
|
1781
|
+
return /* @__PURE__ */ a3(
|
|
1614
1782
|
"span",
|
|
1615
1783
|
{
|
|
1616
1784
|
class: "fnc-avatar fnc-avatar-initial",
|
|
@@ -1631,18 +1799,18 @@ var displayCode = (symbol) => symbol.slice(symbol.lastIndexOf(":") + 1);
|
|
|
1631
1799
|
var toStored = (info) => JSON.parse(JSON.stringify({ ...info, tickSize: 0, price: void 0, changePercent: void 0, sparkline: void 0 }));
|
|
1632
1800
|
function Highlight({ text, query }) {
|
|
1633
1801
|
const q2 = query.trim();
|
|
1634
|
-
if (!q2) return /* @__PURE__ */
|
|
1802
|
+
if (!q2) return /* @__PURE__ */ a3($, { children: text });
|
|
1635
1803
|
const parts = [];
|
|
1636
1804
|
const lower = text.toLowerCase();
|
|
1637
1805
|
const needle = q2.toLowerCase();
|
|
1638
1806
|
let i3 = 0;
|
|
1639
1807
|
for (let at = lower.indexOf(needle); at >= 0; at = lower.indexOf(needle, i3)) {
|
|
1640
1808
|
if (at > i3) parts.push(text.slice(i3, at));
|
|
1641
|
-
parts.push(/* @__PURE__ */
|
|
1809
|
+
parts.push(/* @__PURE__ */ a3("mark", { children: text.slice(at, at + q2.length) }));
|
|
1642
1810
|
i3 = at + q2.length;
|
|
1643
1811
|
}
|
|
1644
1812
|
parts.push(text.slice(i3));
|
|
1645
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ a3($, { children: parts });
|
|
1646
1814
|
}
|
|
1647
1815
|
function Sparkline({ values, up }) {
|
|
1648
1816
|
if (values.length < 2) return null;
|
|
@@ -1651,10 +1819,11 @@ function Sparkline({ values, up }) {
|
|
|
1651
1819
|
const w3 = 72;
|
|
1652
1820
|
const h3 = 24;
|
|
1653
1821
|
const points = values.map((v3, i3) => `${(i3 / (values.length - 1) * w3).toFixed(1)},${(h3 - 2 - (v3 - min) / (max - min || 1) * (h3 - 4)).toFixed(1)}`).join(" ");
|
|
1654
|
-
return /* @__PURE__ */
|
|
1822
|
+
return /* @__PURE__ */ a3("svg", { class: `fnc-sr-spark ${up ? "fnc-up" : "fnc-down"}`, width: w3, height: h3, viewBox: `0 0 ${w3} ${h3}`, "aria-hidden": "true", children: /* @__PURE__ */ a3("polyline", { points, fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" }) });
|
|
1655
1823
|
}
|
|
1656
1824
|
function SymbolSearch({ ctx }) {
|
|
1657
|
-
const { locale, symbol: current } = useStore(ctx.store);
|
|
1825
|
+
const { locale, symbol: current, searchTarget } = useStore(ctx.store);
|
|
1826
|
+
const comparing = searchTarget === "compare";
|
|
1658
1827
|
const t3 = STRINGS[locale];
|
|
1659
1828
|
const [query, setQuery] = d2("");
|
|
1660
1829
|
const [category, setCategory] = d2(ctx.searchCategories[0]?.id ?? "all");
|
|
@@ -1708,7 +1877,8 @@ function SymbolSearch({ ctx }) {
|
|
|
1708
1877
|
if (!info) return;
|
|
1709
1878
|
save(RECENT_KEY, [toStored(info), ...recent.filter((r3) => r3.symbol !== info.symbol)].slice(0, MAX_RECENT), setRecent);
|
|
1710
1879
|
close();
|
|
1711
|
-
ctx.
|
|
1880
|
+
if (comparing) ctx.chart.addCompare(info.symbol).catch((error) => console.error("funnest-charts: compare failed", error));
|
|
1881
|
+
else ctx.selectSymbol(info.symbol);
|
|
1712
1882
|
};
|
|
1713
1883
|
const onKeyDown = (e3) => {
|
|
1714
1884
|
const count = rows.length;
|
|
@@ -1726,7 +1896,7 @@ function SymbolSearch({ ctx }) {
|
|
|
1726
1896
|
const change = info.changePercent ?? 0;
|
|
1727
1897
|
const up = change >= 0;
|
|
1728
1898
|
const trend = change > 0 ? "fnc-up" : change < 0 ? "fnc-down" : "fnc-flat";
|
|
1729
|
-
return /* @__PURE__ */
|
|
1899
|
+
return /* @__PURE__ */ a3(
|
|
1730
1900
|
"div",
|
|
1731
1901
|
{
|
|
1732
1902
|
class: "fnc-sr-row",
|
|
@@ -1736,7 +1906,7 @@ function SymbolSearch({ ctx }) {
|
|
|
1736
1906
|
onPointerMove: () => setActive(index),
|
|
1737
1907
|
onClick: () => choose(info),
|
|
1738
1908
|
children: [
|
|
1739
|
-
/* @__PURE__ */
|
|
1909
|
+
/* @__PURE__ */ a3(
|
|
1740
1910
|
"button",
|
|
1741
1911
|
{
|
|
1742
1912
|
class: `fnc-sr-star${fav ? " is-on" : ""}`,
|
|
@@ -1747,32 +1917,32 @@ function SymbolSearch({ ctx }) {
|
|
|
1747
1917
|
e3.stopPropagation();
|
|
1748
1918
|
toggleFavorite(info);
|
|
1749
1919
|
},
|
|
1750
|
-
children: /* @__PURE__ */
|
|
1920
|
+
children: /* @__PURE__ */ a3(StarIcon, { filled: fav })
|
|
1751
1921
|
}
|
|
1752
1922
|
),
|
|
1753
|
-
ctx.showLogo && /* @__PURE__ */
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
1757
|
-
current?.symbol === info.symbol && /* @__PURE__ */
|
|
1923
|
+
ctx.showLogo && /* @__PURE__ */ a3(SymbolAvatar, { info, size: 32 }),
|
|
1924
|
+
/* @__PURE__ */ a3("span", { class: "fnc-sr-main", children: [
|
|
1925
|
+
/* @__PURE__ */ a3("span", { class: "fnc-sr-name", children: [
|
|
1926
|
+
/* @__PURE__ */ a3(Highlight, { text: info.name, query }),
|
|
1927
|
+
current?.symbol === info.symbol && /* @__PURE__ */ a3("span", { class: "fnc-sr-current", children: t3.current })
|
|
1758
1928
|
] }),
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
/* @__PURE__ */
|
|
1929
|
+
/* @__PURE__ */ a3("span", { class: "fnc-sr-meta", children: [
|
|
1930
|
+
/* @__PURE__ */ a3(Highlight, { text: displayCode(info.symbol), query }),
|
|
1761
1931
|
" \xB7 ",
|
|
1762
1932
|
info.exchange,
|
|
1763
1933
|
cat && ` \xB7 ${cat.label[locale]}`
|
|
1764
1934
|
] })
|
|
1765
1935
|
] }),
|
|
1766
|
-
info.sparkline && /* @__PURE__ */
|
|
1767
|
-
info.price !== void 0 && /* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
info.changePercent !== void 0 && /* @__PURE__ */
|
|
1936
|
+
info.sparkline && /* @__PURE__ */ a3(Sparkline, { values: info.sparkline, up }),
|
|
1937
|
+
info.price !== void 0 && /* @__PURE__ */ a3("span", { class: "fnc-sr-quote", children: [
|
|
1938
|
+
/* @__PURE__ */ a3("b", { children: formatPrice(info.price, info.pricePrecision) }),
|
|
1939
|
+
info.changePercent !== void 0 && /* @__PURE__ */ a3("span", { class: trend, children: [
|
|
1770
1940
|
change > 0 ? "\u2191 " : change < 0 ? "\u2193 " : "",
|
|
1771
1941
|
Math.abs(info.changePercent).toFixed(2),
|
|
1772
1942
|
"%"
|
|
1773
1943
|
] })
|
|
1774
1944
|
] }),
|
|
1775
|
-
isRecent && /* @__PURE__ */
|
|
1945
|
+
isRecent && /* @__PURE__ */ a3(
|
|
1776
1946
|
"button",
|
|
1777
1947
|
{
|
|
1778
1948
|
class: "fnc-ind-btn",
|
|
@@ -1782,30 +1952,30 @@ function SymbolSearch({ ctx }) {
|
|
|
1782
1952
|
e3.stopPropagation();
|
|
1783
1953
|
save(RECENT_KEY, recent.filter((r3) => r3.symbol !== info.symbol), setRecent);
|
|
1784
1954
|
},
|
|
1785
|
-
children: /* @__PURE__ */
|
|
1955
|
+
children: /* @__PURE__ */ a3(SmallCloseIcon, {})
|
|
1786
1956
|
}
|
|
1787
1957
|
)
|
|
1788
1958
|
]
|
|
1789
1959
|
}
|
|
1790
1960
|
);
|
|
1791
1961
|
};
|
|
1792
|
-
const sideItem = (label, selected, onClick, extra) => /* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1962
|
+
const sideItem = (label, selected, onClick, extra) => /* @__PURE__ */ a3("button", { class: "fnc-sr-side-item", "aria-pressed": selected, onClick, children: [
|
|
1963
|
+
/* @__PURE__ */ a3("span", { children: label }),
|
|
1794
1964
|
extra
|
|
1795
1965
|
] });
|
|
1796
|
-
return /* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
exchange && /* @__PURE__ */
|
|
1966
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3("div", { class: "fnc-dialog fnc-search-dialog", role: "dialog", "aria-modal": "true", "aria-label": comparing ? t3.compareSymbol : t3.searchSymbol, onKeyDown, children: [
|
|
1967
|
+
/* @__PURE__ */ a3("div", { class: "fnc-search", children: [
|
|
1968
|
+
/* @__PURE__ */ a3(SearchIcon, {}),
|
|
1969
|
+
exchange && /* @__PURE__ */ a3("span", { class: "fnc-chip-token", children: [
|
|
1800
1970
|
exchange,
|
|
1801
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ a3("button", { "aria-label": `${exchange} ${t3.cancel}`, onClick: () => setExchange(null), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
1802
1972
|
] }),
|
|
1803
|
-
/* @__PURE__ */
|
|
1973
|
+
/* @__PURE__ */ a3(
|
|
1804
1974
|
"input",
|
|
1805
1975
|
{
|
|
1806
1976
|
ref: inputRef,
|
|
1807
1977
|
value: query,
|
|
1808
|
-
placeholder: t3.searchPlaceholder,
|
|
1978
|
+
placeholder: comparing ? t3.compareSymbol : t3.searchPlaceholder,
|
|
1809
1979
|
role: "combobox",
|
|
1810
1980
|
"aria-expanded": "true",
|
|
1811
1981
|
"aria-controls": "fnc-search-results",
|
|
@@ -1814,50 +1984,50 @@ function SymbolSearch({ ctx }) {
|
|
|
1814
1984
|
onInput: (e3) => setQuery(e3.currentTarget.value)
|
|
1815
1985
|
}
|
|
1816
1986
|
),
|
|
1817
|
-
query && /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1987
|
+
query && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "aria-label": t3.cancel, onClick: () => (setQuery(""), inputRef.current?.focus()), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) }),
|
|
1988
|
+
/* @__PURE__ */ a3("button", { class: "fnc-kbd fnc-kbd-btn fnc-hide-mobile", "aria-label": t3.close, "data-tip": t3.close, onClick: close, children: "ESC" })
|
|
1819
1989
|
] }),
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ a3("div", { class: "fnc-tabs", role: "tablist", children: ctx.searchCategories.map((c3) => /* @__PURE__ */ a3("button", { class: "fnc-tab", role: "tab", "aria-selected": c3.id === category, onClick: () => setCategory(c3.id), children: c3.label[locale] })) }),
|
|
1991
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sr-body", children: [
|
|
1992
|
+
/* @__PURE__ */ a3("nav", { class: "fnc-sr-side fnc-scroll", "aria-label": t3.searchSymbol, children: [
|
|
1993
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sr-side-title", children: t3.browse }),
|
|
1824
1994
|
sideItem(t3.allSymbols, view.kind === "all" && !exchange, () => (setView({ kind: "all" }), setExchange(null))),
|
|
1825
|
-
sideItem(t3.favorites, view.kind === "favorites", () => (setView({ kind: "favorites" }), setExchange(null)), /* @__PURE__ */
|
|
1826
|
-
exchanges.length > 0 && /* @__PURE__ */
|
|
1995
|
+
sideItem(t3.favorites, view.kind === "favorites", () => (setView({ kind: "favorites" }), setExchange(null)), /* @__PURE__ */ a3("em", { children: favorites.length || "" })),
|
|
1996
|
+
exchanges.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-sr-side-title", children: t3.exchanges }),
|
|
1827
1997
|
exchanges.map(
|
|
1828
|
-
([name, count]) => sideItem(name, exchange === name, () => (setView({ kind: "all" }), setExchange(exchange === name ? null : name)), /* @__PURE__ */
|
|
1998
|
+
([name, count]) => sideItem(name, exchange === name, () => (setView({ kind: "all" }), setExchange(exchange === name ? null : name)), /* @__PURE__ */ a3("em", { children: count }))
|
|
1829
1999
|
)
|
|
1830
2000
|
] }),
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
recentRows.length > 0 && /* @__PURE__ */
|
|
1833
|
-
/* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
2001
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sr-list fnc-scroll", id: "fnc-search-results", role: "listbox", ref: listRef, children: [
|
|
2002
|
+
recentRows.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-sr-section", children: [
|
|
2003
|
+
/* @__PURE__ */ a3("span", { children: t3.recentSearches }),
|
|
2004
|
+
/* @__PURE__ */ a3("button", { class: "fnc-link", onClick: () => save(RECENT_KEY, [], setRecent), children: t3.clearRecent })
|
|
1835
2005
|
] }),
|
|
1836
2006
|
recentRows.map((info, i3) => row2(info, i3, true)),
|
|
1837
|
-
(recentRows.length > 0 || view.kind === "favorites") && /* @__PURE__ */
|
|
1838
|
-
loading && !results && view.kind === "all" ? Array.from({ length: 6 }, () => /* @__PURE__ */
|
|
1839
|
-
!loading && rows.length === 0 && /* @__PURE__ */
|
|
2007
|
+
(recentRows.length > 0 || view.kind === "favorites") && /* @__PURE__ */ a3("div", { class: "fnc-sr-section", children: view.kind === "favorites" ? t3.favorites : t3.symbols }),
|
|
2008
|
+
loading && !results && view.kind === "all" ? Array.from({ length: 6 }, () => /* @__PURE__ */ a3("div", { class: "fnc-sr-skeleton", "aria-hidden": "true" })) : resultRows.map((info, i3) => row2(info, recentRows.length + i3, false)),
|
|
2009
|
+
!loading && rows.length === 0 && /* @__PURE__ */ a3("div", { class: "fnc-empty", children: view.kind === "favorites" && favorites.length === 0 ? t3.noFavorites : t3.noResults })
|
|
1840
2010
|
] })
|
|
1841
2011
|
] }),
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sr-footer", children: [
|
|
2013
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2014
|
+
/* @__PURE__ */ a3("kbd", { class: "fnc-kbd", children: "\u2191\u2193" }),
|
|
1845
2015
|
" ",
|
|
1846
2016
|
t3.navigate
|
|
1847
2017
|
] }),
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2019
|
+
/* @__PURE__ */ a3("kbd", { class: "fnc-kbd", children: "\u21B5" }),
|
|
1850
2020
|
" ",
|
|
1851
2021
|
t3.openAction
|
|
1852
2022
|
] }),
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ a3("button", { class: "fnc-sr-foot-btn", onClick: close, children: [
|
|
2024
|
+
/* @__PURE__ */ a3("kbd", { class: "fnc-kbd", children: "ESC" }),
|
|
1855
2025
|
" ",
|
|
1856
2026
|
t3.close
|
|
1857
2027
|
] }),
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
/* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ a3("span", { class: "fnc-spacer" }),
|
|
2029
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2030
|
+
/* @__PURE__ */ a3("kbd", { class: "fnc-kbd", children: [
|
|
1861
2031
|
/Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl",
|
|
1862
2032
|
" + K"
|
|
1863
2033
|
] }),
|
|
@@ -1873,29 +2043,30 @@ function Toolbar({ ctx }) {
|
|
|
1873
2043
|
const s3 = useStore(ctx.store);
|
|
1874
2044
|
const t3 = STRINGS[s3.locale];
|
|
1875
2045
|
const canSearch = typeof ctx.datafeed.searchSymbols === "function";
|
|
1876
|
-
|
|
1877
|
-
|
|
2046
|
+
const mod = /Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl";
|
|
2047
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-toolbar", role: "toolbar", children: [
|
|
2048
|
+
/* @__PURE__ */ a3(
|
|
1878
2049
|
"button",
|
|
1879
2050
|
{
|
|
1880
2051
|
class: "fnc-symbol",
|
|
1881
2052
|
disabled: !canSearch,
|
|
1882
2053
|
"data-tip": canSearch ? t3.searchSymbol : void 0,
|
|
1883
2054
|
"aria-haspopup": "dialog",
|
|
1884
|
-
onClick: () => ctx.setSearchOpen(true),
|
|
2055
|
+
onClick: () => ctx.setSearchOpen(true, "symbol"),
|
|
1885
2056
|
children: [
|
|
1886
|
-
ctx.showLogo && s3.symbol ? /* @__PURE__ */
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
canSearch && ctx.showLogo && /* @__PURE__ */
|
|
2057
|
+
ctx.showLogo && s3.symbol ? /* @__PURE__ */ a3(SymbolAvatar, { info: s3.symbol, size: 24 }) : canSearch && /* @__PURE__ */ a3("span", { class: "fnc-icon", children: /* @__PURE__ */ a3(SearchIcon, {}) }),
|
|
2058
|
+
/* @__PURE__ */ a3("span", { class: "fnc-symbol-name", children: s3.symbol?.name ?? "\u2014" }),
|
|
2059
|
+
canSearch && ctx.showLogo && /* @__PURE__ */ a3("span", { class: "fnc-icon", children: /* @__PURE__ */ a3(ChevronDownIcon, {}) })
|
|
1889
2060
|
]
|
|
1890
2061
|
}
|
|
1891
2062
|
),
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
/* @__PURE__ */
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
2064
|
+
/* @__PURE__ */ a3(IntervalPicker, { ctx }),
|
|
2065
|
+
/* @__PURE__ */ a3(Slot, { el: ctx.slots.toolbar }),
|
|
2066
|
+
/* @__PURE__ */ a3("div", { class: "fnc-spacer" }),
|
|
2067
|
+
/* @__PURE__ */ a3("div", { class: "fnc-tools", children: [
|
|
2068
|
+
/* @__PURE__ */ a3(ChartTypeMenu, { ctx }),
|
|
2069
|
+
/* @__PURE__ */ a3(
|
|
1899
2070
|
"button",
|
|
1900
2071
|
{
|
|
1901
2072
|
class: "fnc-btn fnc-btn-wide fnc-btn-label fnc-btn-indicators",
|
|
@@ -1904,15 +2075,38 @@ function Toolbar({ ctx }) {
|
|
|
1904
2075
|
"aria-haspopup": "dialog",
|
|
1905
2076
|
onClick: () => ctx.store.set({ dialog: { kind: "indicators" } }),
|
|
1906
2077
|
children: [
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
/* @__PURE__ */
|
|
2078
|
+
/* @__PURE__ */ a3(IndicatorIcon, {}),
|
|
2079
|
+
/* @__PURE__ */ a3("span", { children: t3.indicators })
|
|
1909
2080
|
]
|
|
1910
2081
|
}
|
|
1911
2082
|
),
|
|
1912
|
-
|
|
2083
|
+
canSearch && /* @__PURE__ */ a3(
|
|
2084
|
+
"button",
|
|
2085
|
+
{
|
|
2086
|
+
class: "fnc-btn fnc-btn-compare",
|
|
2087
|
+
"data-tip": t3.compareSymbol,
|
|
2088
|
+
"aria-label": t3.compareSymbol,
|
|
2089
|
+
"aria-haspopup": "dialog",
|
|
2090
|
+
disabled: s3.compares.length >= 5,
|
|
2091
|
+
onClick: () => ctx.setSearchOpen(true, "compare"),
|
|
2092
|
+
children: /* @__PURE__ */ a3(CompareIcon, {})
|
|
2093
|
+
}
|
|
2094
|
+
),
|
|
2095
|
+
/* @__PURE__ */ a3(
|
|
2096
|
+
"button",
|
|
2097
|
+
{
|
|
2098
|
+
class: "fnc-btn fnc-btn-replay",
|
|
2099
|
+
"data-tip": s3.replay.selecting ? t3.replayPick : t3.replay,
|
|
2100
|
+
"aria-label": t3.replay,
|
|
2101
|
+
"aria-pressed": s3.replay.selecting || s3.replay.active,
|
|
2102
|
+
onClick: () => s3.replay.active ? ctx.chart.stopReplay() : ctx.chart.setReplaySelecting(!s3.replay.selecting),
|
|
2103
|
+
children: /* @__PURE__ */ a3(ReplayIcon, {})
|
|
2104
|
+
}
|
|
2105
|
+
),
|
|
2106
|
+
ctx.multi && /* @__PURE__ */ a3(LayoutMenu, { ctx, multi: ctx.multi })
|
|
1913
2107
|
] }),
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
ctx.drawingToolbar && /* @__PURE__ */
|
|
2108
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
2109
|
+
ctx.drawingToolbar && /* @__PURE__ */ a3(
|
|
1916
2110
|
"button",
|
|
1917
2111
|
{
|
|
1918
2112
|
class: "fnc-btn fnc-btn-drawbar",
|
|
@@ -1920,11 +2114,13 @@ function Toolbar({ ctx }) {
|
|
|
1920
2114
|
"aria-label": t3.drawingTools,
|
|
1921
2115
|
"aria-pressed": s3.drawbarOpen || s3.drawingTool !== null,
|
|
1922
2116
|
onClick: () => ctx.store.set({ drawbarOpen: !s3.drawbarOpen }),
|
|
1923
|
-
children: /* @__PURE__ */
|
|
2117
|
+
children: /* @__PURE__ */ a3(PencilIcon, {})
|
|
1924
2118
|
}
|
|
1925
2119
|
),
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
2120
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-btn-undo", "data-tip": `${t3.undo} (${mod}+Z)`, "aria-label": t3.undo, disabled: !s3.canUndo, onClick: () => ctx.chart.undo(), children: /* @__PURE__ */ a3(UndoIcon, {}) }),
|
|
2121
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-btn-undo", "data-tip": `${t3.redo} (${mod}+Shift+Z)`, "aria-label": t3.redo, disabled: !s3.canRedo, onClick: () => ctx.chart.redo(), children: /* @__PURE__ */ a3(RedoIcon, {}) }),
|
|
2122
|
+
/* @__PURE__ */ a3(Slot, { el: ctx.slots.toolbarEnd, fixed: true }),
|
|
2123
|
+
/* @__PURE__ */ a3(
|
|
1928
2124
|
"button",
|
|
1929
2125
|
{
|
|
1930
2126
|
class: "fnc-btn fnc-btn-settings",
|
|
@@ -1932,22 +2128,22 @@ function Toolbar({ ctx }) {
|
|
|
1932
2128
|
"aria-label": t3.chartSettings,
|
|
1933
2129
|
"aria-haspopup": "dialog",
|
|
1934
2130
|
onClick: () => ctx.store.set({ dialog: { kind: "chartSettings" } }),
|
|
1935
|
-
children: /* @__PURE__ */
|
|
2131
|
+
children: /* @__PURE__ */ a3(SettingsIcon, {})
|
|
1936
2132
|
}
|
|
1937
2133
|
),
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
2134
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-btn-screenshot", "data-tip": t3.screenshot, "aria-label": t3.screenshot, onClick: ctx.screenshot, children: /* @__PURE__ */ a3(CameraIcon, {}) }),
|
|
2135
|
+
/* @__PURE__ */ a3(
|
|
1940
2136
|
"button",
|
|
1941
2137
|
{
|
|
1942
2138
|
class: "fnc-btn fnc-btn-fullscreen",
|
|
1943
2139
|
"data-tip": s3.fullscreen ? t3.exitFullscreen : t3.fullscreen,
|
|
1944
2140
|
"aria-label": s3.fullscreen ? t3.exitFullscreen : t3.fullscreen,
|
|
1945
2141
|
onClick: ctx.toggleFullscreen,
|
|
1946
|
-
children: s3.fullscreen ? /* @__PURE__ */
|
|
2142
|
+
children: s3.fullscreen ? /* @__PURE__ */ a3(CollapseIcon, {}) : /* @__PURE__ */ a3(ExpandIcon, {})
|
|
1947
2143
|
}
|
|
1948
2144
|
),
|
|
1949
|
-
s3.searchOpen && canSearch && /* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
2145
|
+
s3.searchOpen && canSearch && /* @__PURE__ */ a3(SymbolSearch, { ctx }),
|
|
2146
|
+
/* @__PURE__ */ a3(Dialogs, { ctx })
|
|
1951
2147
|
] });
|
|
1952
2148
|
}
|
|
1953
2149
|
|
|
@@ -1961,7 +2157,7 @@ var CONTROL_OFFSET = 52;
|
|
|
1961
2157
|
var dirClass = (v3) => v3 > 0 ? "fnc-up" : v3 < 0 ? "fnc-down" : "fnc-flat";
|
|
1962
2158
|
function IndicatorItem({ ctx, item }) {
|
|
1963
2159
|
const t3 = STRINGS[ctx.store.get().locale];
|
|
1964
|
-
return /* @__PURE__ */
|
|
2160
|
+
return /* @__PURE__ */ a3(
|
|
1965
2161
|
"div",
|
|
1966
2162
|
{
|
|
1967
2163
|
class: item.visible ? "fnc-ind" : "fnc-ind fnc-ind-hidden",
|
|
@@ -1974,7 +2170,7 @@ function IndicatorItem({ ctx, item }) {
|
|
|
1974
2170
|
},
|
|
1975
2171
|
onKeyDown: (e3) => e3.key === "Enter" && ctx.store.set({ dialog: { kind: "indicatorSettings", id: item.id } }),
|
|
1976
2172
|
children: [
|
|
1977
|
-
/* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ a3(
|
|
1978
2174
|
"button",
|
|
1979
2175
|
{
|
|
1980
2176
|
class: "fnc-ind-btn fnc-ind-eye",
|
|
@@ -1985,30 +2181,30 @@ function IndicatorItem({ ctx, item }) {
|
|
|
1985
2181
|
e3.stopPropagation();
|
|
1986
2182
|
ctx.chart.setIndicatorVisible(item.id, !item.visible);
|
|
1987
2183
|
},
|
|
1988
|
-
children: item.visible ? /* @__PURE__ */
|
|
2184
|
+
children: item.visible ? /* @__PURE__ */ a3(EyeIcon, {}) : /* @__PURE__ */ a3(EyeOffIcon, {})
|
|
1989
2185
|
}
|
|
1990
2186
|
),
|
|
1991
|
-
/* @__PURE__ */
|
|
1992
|
-
item.visible && item.values.map((v3) => /* @__PURE__ */
|
|
1993
|
-
/* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ a3("span", { class: "fnc-ind-title", children: item.title }),
|
|
2188
|
+
item.visible && item.values.map((v3) => /* @__PURE__ */ a3("b", { style: { color: v3.color }, "data-tip": v3.label, children: v3.value })),
|
|
2189
|
+
/* @__PURE__ */ a3("span", { class: "fnc-ind-actions", children: [
|
|
2190
|
+
/* @__PURE__ */ a3(
|
|
1995
2191
|
"button",
|
|
1996
2192
|
{
|
|
1997
2193
|
class: "fnc-ind-btn",
|
|
1998
2194
|
"data-tip": t3.indicatorSettings,
|
|
1999
2195
|
"aria-label": `${item.title} ${t3.indicatorSettings}`,
|
|
2000
2196
|
onClick: () => ctx.store.set({ dialog: { kind: "indicatorSettings", id: item.id } }),
|
|
2001
|
-
children: /* @__PURE__ */
|
|
2197
|
+
children: /* @__PURE__ */ a3(GearIcon, {})
|
|
2002
2198
|
}
|
|
2003
2199
|
),
|
|
2004
|
-
/* @__PURE__ */
|
|
2200
|
+
/* @__PURE__ */ a3(
|
|
2005
2201
|
"button",
|
|
2006
2202
|
{
|
|
2007
2203
|
class: "fnc-ind-btn",
|
|
2008
2204
|
"data-tip": t3.removeIndicator,
|
|
2009
2205
|
"aria-label": `${item.title} ${t3.removeIndicator}`,
|
|
2010
2206
|
onClick: () => ctx.chart.removeIndicator(item.id),
|
|
2011
|
-
children: /* @__PURE__ */
|
|
2207
|
+
children: /* @__PURE__ */ a3(SmallCloseIcon, {})
|
|
2012
2208
|
}
|
|
2013
2209
|
)
|
|
2014
2210
|
] })
|
|
@@ -2028,7 +2224,9 @@ function Legend({ ctx }) {
|
|
|
2028
2224
|
"crosshairMove",
|
|
2029
2225
|
(info) => setHover(info ? { bar: info.bar, prev: ctx.chart.bars[info.index - 1], index: info.index } : null)
|
|
2030
2226
|
),
|
|
2031
|
-
ctx.chart.on("dataChange", () => refresh(void 0))
|
|
2227
|
+
ctx.chart.on("dataChange", () => refresh(void 0)),
|
|
2228
|
+
// Compare values are % from the first visible bar, so they change while scrolling.
|
|
2229
|
+
ctx.chart.on("visibleRangeChange", () => ctx.store.get().compares.length > 0 && refresh(void 0))
|
|
2032
2230
|
];
|
|
2033
2231
|
return () => offs.forEach((off) => off());
|
|
2034
2232
|
}, [ctx.chart]);
|
|
@@ -2041,7 +2239,7 @@ function Legend({ ctx }) {
|
|
|
2041
2239
|
ro.observe(el);
|
|
2042
2240
|
return () => ro.disconnect();
|
|
2043
2241
|
}, [ctx.chart]);
|
|
2044
|
-
if (!s3.symbol) return /* @__PURE__ */
|
|
2242
|
+
if (!s3.symbol) return /* @__PURE__ */ a3("div", { class: "fnc-legend", ref });
|
|
2045
2243
|
const bars = ctx.chart.bars;
|
|
2046
2244
|
const bar = hover?.bar ?? bars[bars.length - 1];
|
|
2047
2245
|
const prev = hover ? hover.prev : bars[bars.length - 2];
|
|
@@ -2052,28 +2250,28 @@ function Legend({ ctx }) {
|
|
|
2052
2250
|
const change = prev ? bar.close - prev.close : 0;
|
|
2053
2251
|
const pct = prev && prev.close ? change / prev.close * 100 : 0;
|
|
2054
2252
|
const sign = change > 0 ? "+" : "";
|
|
2055
|
-
values = /* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2253
|
+
values = /* @__PURE__ */ a3("div", { class: "fnc-legend-values", children: [
|
|
2254
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2057
2255
|
t3.open,
|
|
2058
2256
|
" ",
|
|
2059
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ a3("b", { class: cls, children: fmt(bar.open) })
|
|
2060
2258
|
] }),
|
|
2061
|
-
/* @__PURE__ */
|
|
2259
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2062
2260
|
t3.high,
|
|
2063
2261
|
" ",
|
|
2064
|
-
/* @__PURE__ */
|
|
2262
|
+
/* @__PURE__ */ a3("b", { class: cls, children: fmt(bar.high) })
|
|
2065
2263
|
] }),
|
|
2066
|
-
/* @__PURE__ */
|
|
2264
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2067
2265
|
t3.low,
|
|
2068
2266
|
" ",
|
|
2069
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ a3("b", { class: cls, children: fmt(bar.low) })
|
|
2070
2268
|
] }),
|
|
2071
|
-
/* @__PURE__ */
|
|
2269
|
+
/* @__PURE__ */ a3("span", { children: [
|
|
2072
2270
|
t3.close_,
|
|
2073
2271
|
" ",
|
|
2074
|
-
/* @__PURE__ */
|
|
2272
|
+
/* @__PURE__ */ a3("b", { class: cls, children: fmt(bar.close) })
|
|
2075
2273
|
] }),
|
|
2076
|
-
/* @__PURE__ */
|
|
2274
|
+
/* @__PURE__ */ a3("b", { class: dirClass(change), children: [
|
|
2077
2275
|
sign,
|
|
2078
2276
|
fmt(change),
|
|
2079
2277
|
" (",
|
|
@@ -2081,33 +2279,48 @@ function Legend({ ctx }) {
|
|
|
2081
2279
|
pct.toFixed(2),
|
|
2082
2280
|
"%)"
|
|
2083
2281
|
] }),
|
|
2084
|
-
bar.volume !== void 0 && /* @__PURE__ */
|
|
2282
|
+
bar.volume !== void 0 && /* @__PURE__ */ a3("span", { children: [
|
|
2085
2283
|
t3.volume,
|
|
2086
2284
|
" ",
|
|
2087
|
-
/* @__PURE__ */
|
|
2285
|
+
/* @__PURE__ */ a3("b", { class: "fnc-flat", children: formatCompact(bar.volume, s3.locale) })
|
|
2088
2286
|
] })
|
|
2089
2287
|
] });
|
|
2090
2288
|
}
|
|
2091
2289
|
const items = s3.indicators.length ? ctx.chart.indicatorLegend(hover?.index) : [];
|
|
2092
2290
|
const overlayItems = items.filter((i3) => i3.overlay);
|
|
2093
2291
|
const paneLegends = s3.layout.panes.filter((p3) => p3.kind === "indicator").map((pane) => ({ pane, item: items.find((i3) => i3.id === pane.id) }));
|
|
2094
|
-
return /* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
ctx.showLogo && /* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
s3.loading && /* @__PURE__ */
|
|
2292
|
+
return /* @__PURE__ */ a3($, { children: [
|
|
2293
|
+
/* @__PURE__ */ a3("div", { class: "fnc-legend", ref, children: [
|
|
2294
|
+
/* @__PURE__ */ a3("div", { class: "fnc-legend-title", children: [
|
|
2295
|
+
ctx.showLogo && /* @__PURE__ */ a3(SymbolAvatar, { info: s3.symbol, size: 18 }),
|
|
2296
|
+
/* @__PURE__ */ a3("b", { children: s3.symbol.name }),
|
|
2297
|
+
/* @__PURE__ */ a3("span", { children: "\xB7" }),
|
|
2298
|
+
/* @__PURE__ */ a3("span", { children: resolutionLabel(s3.resolution, s3.locale) }),
|
|
2299
|
+
/* @__PURE__ */ a3("span", { children: "\xB7" }),
|
|
2300
|
+
/* @__PURE__ */ a3("span", { children: s3.symbol.exchange }),
|
|
2301
|
+
s3.loading && /* @__PURE__ */ a3("span", { class: "fnc-spinner", role: "status" })
|
|
2104
2302
|
] }),
|
|
2105
2303
|
values,
|
|
2106
|
-
|
|
2107
|
-
|
|
2304
|
+
s3.compares.length > 0 && ctx.chart.compareLegend(hover?.index).map((c3) => /* @__PURE__ */ a3("div", { class: "fnc-cmp", children: [
|
|
2305
|
+
/* @__PURE__ */ a3("i", { class: "fnc-cmp-dot", style: { background: c3.color } }),
|
|
2306
|
+
/* @__PURE__ */ a3("span", { class: "fnc-cmp-name", children: c3.name }),
|
|
2307
|
+
/* @__PURE__ */ a3("b", { children: c3.value }),
|
|
2308
|
+
/* @__PURE__ */ a3(
|
|
2309
|
+
"button",
|
|
2310
|
+
{
|
|
2311
|
+
class: "fnc-ind-btn",
|
|
2312
|
+
"data-tip": t3.removeCompare,
|
|
2313
|
+
"aria-label": `${c3.name} ${t3.removeCompare}`,
|
|
2314
|
+
onClick: () => ctx.chart.removeCompare(c3.symbol),
|
|
2315
|
+
children: /* @__PURE__ */ a3(SmallCloseIcon, {})
|
|
2316
|
+
}
|
|
2317
|
+
)
|
|
2318
|
+
] })),
|
|
2319
|
+
!collapsed && overlayItems.map((item) => /* @__PURE__ */ a3(IndicatorItem, { ctx, item })),
|
|
2320
|
+
overlayItems.length > 0 && (collapsed ? /* @__PURE__ */ a3("button", { class: "fnc-ind-handle", "aria-expanded": "false", "aria-label": t3.expand, "data-tip": t3.expand, onClick: () => setCollapsed(false), children: /* @__PURE__ */ a3("span", {}) }) : /* @__PURE__ */ a3("button", { class: "fnc-ind-collapse", "aria-expanded": "true", "aria-label": t3.collapse, "data-tip": t3.collapse, onClick: () => setCollapsed(true), children: /* @__PURE__ */ a3(CollapseLeftIcon, {}) }))
|
|
2108
2321
|
] }),
|
|
2109
2322
|
paneLegends.map(
|
|
2110
|
-
({ pane, item }) => item && /* @__PURE__ */
|
|
2323
|
+
({ pane, item }) => item && /* @__PURE__ */ a3("div", { class: "fnc-legend fnc-pane-legend", style: { top: `${pane.top + 4}px` }, children: /* @__PURE__ */ a3(IndicatorItem, { ctx, item }) })
|
|
2111
2324
|
)
|
|
2112
2325
|
] });
|
|
2113
2326
|
}
|
|
@@ -2120,16 +2333,17 @@ function NavControls({ ctx }) {
|
|
|
2120
2333
|
if (plotWidth <= 0) return null;
|
|
2121
2334
|
const top = panesHeight - CONTROL_OFFSET;
|
|
2122
2335
|
const page = () => Math.max(1, Math.round(plotWidth / ctx.chart.timeScale.barSpacing / 3));
|
|
2123
|
-
const button = (label, onClick, icon) => /* @__PURE__ */
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
button(t3.
|
|
2128
|
-
button(t3.
|
|
2129
|
-
button(t3.
|
|
2130
|
-
button(t3.
|
|
2336
|
+
const button = (label, onClick, icon) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, onClick, children: icon });
|
|
2337
|
+
const replaying = s3.replay.active || s3.replay.selecting;
|
|
2338
|
+
return /* @__PURE__ */ a3($, { children: [
|
|
2339
|
+
showButtons && !replaying && /* @__PURE__ */ a3("div", { class: "fnc-nav", style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
|
|
2340
|
+
button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
|
|
2341
|
+
button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
|
|
2342
|
+
button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
|
|
2343
|
+
button(t3.scrollForward, () => ctx.chart.scrollBars(page()), /* @__PURE__ */ a3(ChevronRightIcon, {})),
|
|
2344
|
+
button(t3.resetView, () => ctx.chart.resetView(), /* @__PURE__ */ a3(ResetIcon, {}))
|
|
2131
2345
|
] }),
|
|
2132
|
-
!s3.atRealtime && /* @__PURE__ */
|
|
2346
|
+
!s3.atRealtime && /* @__PURE__ */ a3(
|
|
2133
2347
|
"button",
|
|
2134
2348
|
{
|
|
2135
2349
|
class: "fnc-realtime",
|
|
@@ -2137,7 +2351,7 @@ function NavControls({ ctx }) {
|
|
|
2137
2351
|
"data-tip": t3.toRealtime,
|
|
2138
2352
|
"aria-label": t3.toRealtime,
|
|
2139
2353
|
onClick: () => ctx.chart.scrollToRealtime(),
|
|
2140
|
-
children: /* @__PURE__ */
|
|
2354
|
+
children: /* @__PURE__ */ a3(ToRealtimeIcon, {})
|
|
2141
2355
|
}
|
|
2142
2356
|
)
|
|
2143
2357
|
] });
|
|
@@ -2148,7 +2362,7 @@ function Attribution({ ctx }) {
|
|
|
2148
2362
|
const { panesHeight, plotWidth } = s3.layout;
|
|
2149
2363
|
if (!ctx.attribution || plotWidth <= 0) return null;
|
|
2150
2364
|
const label = s3.locale === "ko" ? "Funnest \uCC28\uD2B8" : "Charts by Funnest";
|
|
2151
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ a3(
|
|
2152
2366
|
"a",
|
|
2153
2367
|
{
|
|
2154
2368
|
class: "fnc-attribution",
|
|
@@ -2159,14 +2373,14 @@ function Attribution({ ctx }) {
|
|
|
2159
2373
|
"aria-label": label,
|
|
2160
2374
|
style: { top: `${panesHeight - 36}px` },
|
|
2161
2375
|
children: [
|
|
2162
|
-
/* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2376
|
+
/* @__PURE__ */ a3(FunnestMark, {}),
|
|
2377
|
+
/* @__PURE__ */ a3("span", { children: "funnest" })
|
|
2164
2378
|
]
|
|
2165
2379
|
}
|
|
2166
2380
|
);
|
|
2167
2381
|
}
|
|
2168
2382
|
function PaneTools({ ctx }) {
|
|
2169
|
-
return ctx.multi ? /* @__PURE__ */
|
|
2383
|
+
return ctx.multi ? /* @__PURE__ */ a3(PaneMaximize, { ctx, multi: ctx.multi }) : null;
|
|
2170
2384
|
}
|
|
2171
2385
|
function PaneMaximize({ ctx, multi }) {
|
|
2172
2386
|
const s3 = useStore(ctx.store);
|
|
@@ -2175,7 +2389,7 @@ function PaneMaximize({ ctx, multi }) {
|
|
|
2175
2389
|
const t3 = STRINGS[s3.locale];
|
|
2176
2390
|
const maximized = m3.maximized !== null;
|
|
2177
2391
|
const label = maximized ? t3.restorePane : t3.maximizePane;
|
|
2178
|
-
return /* @__PURE__ */
|
|
2392
|
+
return /* @__PURE__ */ a3(
|
|
2179
2393
|
"button",
|
|
2180
2394
|
{
|
|
2181
2395
|
class: "fnc-btn fnc-pane-max",
|
|
@@ -2187,17 +2401,58 @@ function PaneMaximize({ ctx, multi }) {
|
|
|
2187
2401
|
const index = multi.store.get().active;
|
|
2188
2402
|
multi.toggleMaximize(index);
|
|
2189
2403
|
},
|
|
2190
|
-
children: maximized ? /* @__PURE__ */
|
|
2404
|
+
children: maximized ? /* @__PURE__ */ a3(RestoreIcon, {}) : /* @__PURE__ */ a3(MaximizeIcon, {})
|
|
2191
2405
|
}
|
|
2192
2406
|
);
|
|
2193
2407
|
}
|
|
2408
|
+
var REPLAY_SPEEDS = [
|
|
2409
|
+
{ label: "1x", interval: 1e3 },
|
|
2410
|
+
{ label: "3x", interval: 333 },
|
|
2411
|
+
{ label: "10x", interval: 100 }
|
|
2412
|
+
];
|
|
2413
|
+
function ReplayBar({ ctx }) {
|
|
2414
|
+
const s3 = useStore(ctx.store);
|
|
2415
|
+
const t3 = STRINGS[s3.locale];
|
|
2416
|
+
const r3 = s3.replay;
|
|
2417
|
+
const { plotWidth, panesHeight } = s3.layout;
|
|
2418
|
+
if (plotWidth <= 0 || !r3.active && !r3.selecting) return null;
|
|
2419
|
+
const style = { left: `${plotWidth / 2}px`, top: `${panesHeight - CONTROL_OFFSET}px` };
|
|
2420
|
+
if (!r3.active) {
|
|
2421
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-replay fnc-replay-hint", style, role: "status", children: [
|
|
2422
|
+
/* @__PURE__ */ a3(ReplayIcon, {}),
|
|
2423
|
+
/* @__PURE__ */ a3("span", { children: t3.replayPick }),
|
|
2424
|
+
/* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "aria-label": t3.cancel, "data-tip": `${t3.cancel} (Esc)`, onClick: () => ctx.chart.setReplaySelecting(false), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
2425
|
+
] });
|
|
2426
|
+
}
|
|
2427
|
+
const done = r3.remaining === 0;
|
|
2428
|
+
const button = (label, onClick, icon, disabled = false) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, disabled, onClick, children: icon });
|
|
2429
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-replay", style, role: "toolbar", "aria-label": t3.replay, children: [
|
|
2430
|
+
r3.playing ? button(t3.replayPause, () => ctx.chart.replayPause(), /* @__PURE__ */ a3(PauseIcon, {})) : button(t3.replayPlay, () => ctx.chart.replayPlay(), /* @__PURE__ */ a3(PlayIcon, {}), done),
|
|
2431
|
+
button(t3.replayStep, () => ctx.chart.replayStep(), /* @__PURE__ */ a3(StepIcon, {}), done),
|
|
2432
|
+
/* @__PURE__ */ a3("div", { class: "fnc-seg fnc-seg-sm", role: "radiogroup", "aria-label": t3.replaySpeed, children: REPLAY_SPEEDS.map((speed) => /* @__PURE__ */ a3(
|
|
2433
|
+
"button",
|
|
2434
|
+
{
|
|
2435
|
+
type: "button",
|
|
2436
|
+
role: "radio",
|
|
2437
|
+
"aria-checked": r3.interval === speed.interval,
|
|
2438
|
+
onClick: () => ctx.chart.setReplayInterval(speed.interval),
|
|
2439
|
+
children: speed.label
|
|
2440
|
+
}
|
|
2441
|
+
)) }),
|
|
2442
|
+
done && /* @__PURE__ */ a3("span", { class: "fnc-replay-note", children: t3.replayDone }),
|
|
2443
|
+
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
2444
|
+
button(t3.replayRestart, () => ctx.chart.setReplaySelecting(true), /* @__PURE__ */ a3(ReplayIcon, {})),
|
|
2445
|
+
button(t3.replayExit, () => ctx.chart.stopReplay(), /* @__PURE__ */ a3(SmallCloseIcon, {}))
|
|
2446
|
+
] });
|
|
2447
|
+
}
|
|
2194
2448
|
function Overlay({ ctx }) {
|
|
2195
|
-
return /* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
/* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ a3($, { children: [
|
|
2450
|
+
/* @__PURE__ */ a3(Attribution, { ctx }),
|
|
2451
|
+
/* @__PURE__ */ a3(Legend, { ctx }),
|
|
2452
|
+
/* @__PURE__ */ a3(NavControls, { ctx }),
|
|
2453
|
+
/* @__PURE__ */ a3(ReplayBar, { ctx }),
|
|
2454
|
+
/* @__PURE__ */ a3(SelectionBar, { ctx }),
|
|
2455
|
+
/* @__PURE__ */ a3(PaneTools, { ctx })
|
|
2201
2456
|
] });
|
|
2202
2457
|
}
|
|
2203
2458
|
|
|
@@ -2996,6 +3251,20 @@ var CSS = (
|
|
|
2996
3251
|
.fnc-action-primary { background: var(--fnc-accent); color: #fff; }
|
|
2997
3252
|
.fnc-action-danger { flex: 0 0 auto; padding: 0 16px; color: var(--fnc-danger, #F04452); background: none; }
|
|
2998
3253
|
|
|
3254
|
+
/* \u2500\u2500 Narrow widgets (split screens next to side panels): the widget's own width decides, so
|
|
3255
|
+
every toolbar button stays reachable. Ctrl/\u2318+Z still undoes when the buttons are hidden. \u2500\u2500 */
|
|
3256
|
+
.fnc-root { container: fnc / inline-size; }
|
|
3257
|
+
@container fnc (max-width: 1100px) {
|
|
3258
|
+
.fnc-btn-undo { display: none; }
|
|
3259
|
+
.fnc-btn-label span { display: none; }
|
|
3260
|
+
.fnc-toolbar .fnc-btn-label { padding: 0 6px; }
|
|
3261
|
+
}
|
|
3262
|
+
@container fnc (max-width: 940px) {
|
|
3263
|
+
.fnc-intervals { display: none; }
|
|
3264
|
+
.fnc-interval-current { display: inline; }
|
|
3265
|
+
.fnc-btn-screenshot { display: none; }
|
|
3266
|
+
}
|
|
3267
|
+
|
|
2999
3268
|
/* \u2500\u2500 Narrow phones (\u2264 400px): drop the menu chevrons and separators so every button fits \u2500\u2500 */
|
|
3000
3269
|
@media (max-width: 400px) {
|
|
3001
3270
|
.fnc-toolbar .fnc-btn-wide > svg:last-child { display: none; }
|
|
@@ -3100,8 +3369,79 @@ var CSS = (
|
|
|
3100
3369
|
.fnc-switch[data-on='true'] { background: var(--fnc-text-2); }
|
|
3101
3370
|
.fnc-switch[data-on='true']::after { transform: translateX(16px); }
|
|
3102
3371
|
|
|
3372
|
+
/* \u2500\u2500 Drawing tool groups \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
3373
|
+
.fnc-tool-group { position: relative; display: flex; }
|
|
3374
|
+
.fnc-tool-group[data-open='true'] { z-index: 30; }
|
|
3375
|
+
.fnc-tool-more {
|
|
3376
|
+
position: absolute;
|
|
3377
|
+
right: -2px;
|
|
3378
|
+
bottom: -2px;
|
|
3379
|
+
display: flex;
|
|
3380
|
+
align-items: flex-end;
|
|
3381
|
+
justify-content: flex-end;
|
|
3382
|
+
width: 14px;
|
|
3383
|
+
height: 14px;
|
|
3384
|
+
padding: 3px;
|
|
3385
|
+
color: var(--fnc-text-2);
|
|
3386
|
+
opacity: 0.7;
|
|
3387
|
+
}
|
|
3388
|
+
.fnc-tool-more:hover, .fnc-tool-more[aria-expanded='true'] { opacity: 1; color: var(--fnc-text); }
|
|
3389
|
+
.fnc-tool-menu { top: 0; left: calc(100% + 8px); min-width: 180px; }
|
|
3390
|
+
.fnc-tool-menu .fnc-menu-item { white-space: nowrap; }
|
|
3391
|
+
.fnc-tool-letter { font-size: 13px; font-weight: 700; }
|
|
3392
|
+
.fnc-svg-icon { display: inline-flex; }
|
|
3393
|
+
.fnc-svg-icon svg { width: 20px; height: 20px; }
|
|
3394
|
+
|
|
3395
|
+
/* \u2500\u2500 Segmented control (price scale, replay speed) \u2500\u2500\u2500\u2500 */
|
|
3396
|
+
.fnc-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: calc(var(--fnc-radius) + 2px); background: var(--fnc-surface); }
|
|
3397
|
+
.fnc-seg button {
|
|
3398
|
+
min-width: 56px;
|
|
3399
|
+
height: 30px;
|
|
3400
|
+
padding: 0 12px;
|
|
3401
|
+
border-radius: var(--fnc-radius);
|
|
3402
|
+
font-size: 13px;
|
|
3403
|
+
color: var(--fnc-text-2);
|
|
3404
|
+
}
|
|
3405
|
+
.fnc-seg button[aria-checked='true'] { background: var(--fnc-bg); color: var(--fnc-text); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
|
|
3406
|
+
.fnc-seg-sm button { min-width: 36px; height: 26px; padding: 0 6px; font-size: 12px; }
|
|
3407
|
+
|
|
3408
|
+
/* \u2500\u2500 Compare legend rows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
3409
|
+
.fnc-cmp { display: flex; align-items: center; gap: 6px; min-height: 22px; font-size: 12px; color: var(--fnc-text-2); pointer-events: auto; }
|
|
3410
|
+
.fnc-cmp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
|
|
3411
|
+
.fnc-cmp-name { color: var(--fnc-text); }
|
|
3412
|
+
.fnc-cmp b { color: var(--fnc-text); font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
3413
|
+
.fnc-cmp .fnc-ind-btn { opacity: 0; }
|
|
3414
|
+
.fnc-cmp:hover .fnc-ind-btn, .fnc-cmp .fnc-ind-btn:focus-visible { opacity: 1; }
|
|
3415
|
+
@media (hover: none) { .fnc-cmp .fnc-ind-btn { opacity: 1; } }
|
|
3416
|
+
|
|
3417
|
+
/* \u2500\u2500 Replay \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
3418
|
+
.fnc-replay {
|
|
3419
|
+
position: absolute;
|
|
3420
|
+
z-index: 6;
|
|
3421
|
+
display: flex;
|
|
3422
|
+
align-items: center;
|
|
3423
|
+
gap: 4px;
|
|
3424
|
+
padding: 4px;
|
|
3425
|
+
transform: translateX(-50%);
|
|
3426
|
+
border-radius: calc(var(--fnc-radius) + 4px);
|
|
3427
|
+
background: var(--fnc-bg);
|
|
3428
|
+
box-shadow: 0 2px 12px rgb(0 0 0 / 0.12), 0 0 0 1px var(--fnc-border);
|
|
3429
|
+
white-space: nowrap;
|
|
3430
|
+
pointer-events: auto;
|
|
3431
|
+
}
|
|
3432
|
+
.fnc-replay .fnc-btn { width: 32px; height: 32px; }
|
|
3433
|
+
.fnc-replay .fnc-sep { height: 20px; margin: 0 2px; }
|
|
3434
|
+
.fnc-replay-hint { gap: 8px; padding: 4px 4px 4px 12px; font-size: 13px; color: var(--fnc-text); }
|
|
3435
|
+
.fnc-replay-hint svg { color: var(--fnc-text-2); }
|
|
3436
|
+
.fnc-replay-note { padding: 0 6px; font-size: 12px; color: var(--fnc-text-2); }
|
|
3437
|
+
|
|
3438
|
+
/* Indicator picker search (shown when custom indicators make the list long) */
|
|
3439
|
+
.fnc-ind-search { height: 48px; padding: 0 16px; }
|
|
3440
|
+
.fnc-ind-search input { font-size: 15px; }
|
|
3441
|
+
|
|
3103
3442
|
/* \u2500\u2500 Mobile \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
3104
3443
|
@media (max-width: 640px) {
|
|
3444
|
+
.fnc-btn-compare, .fnc-btn-replay, .fnc-btn-undo { display: none; }
|
|
3105
3445
|
.fnc-toolbar { padding: 0 4px; gap: 2px; }
|
|
3106
3446
|
.fnc-toolbar .fnc-btn { width: 32px; height: 32px; }
|
|
3107
3447
|
.fnc-toolbar .fnc-btn-wide, .fnc-toolbar .fnc-btn-label { width: auto; padding: 0 6px; }
|
|
@@ -3351,10 +3691,21 @@ function createShell(container, options) {
|
|
|
3351
3691
|
}
|
|
3352
3692
|
function bindWidgetKeys(shell, active, searchHotkey, extra) {
|
|
3353
3693
|
const { root } = shell;
|
|
3694
|
+
let focused = false;
|
|
3695
|
+
const onPointerDown = (e3) => focused = root.contains(e3.target);
|
|
3354
3696
|
const onKeyDown = (e3) => {
|
|
3355
3697
|
const pane = active();
|
|
3356
3698
|
if (!pane) return;
|
|
3357
3699
|
const s3 = pane.store.get();
|
|
3700
|
+
const target = e3.target;
|
|
3701
|
+
const typing = !!target && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName));
|
|
3702
|
+
const key = e3.key.toLowerCase();
|
|
3703
|
+
if (focused && !typing && !s3.dialog && !s3.searchOpen && (e3.ctrlKey || e3.metaKey) && !e3.altKey && (key === "z" || key === "y")) {
|
|
3704
|
+
e3.preventDefault();
|
|
3705
|
+
if (key === "y" || e3.shiftKey) pane.chart.redo();
|
|
3706
|
+
else pane.chart.undo();
|
|
3707
|
+
return;
|
|
3708
|
+
}
|
|
3358
3709
|
if (searchHotkey && (e3.ctrlKey || e3.metaKey) && e3.key.toLowerCase() === "k" && pane.canSearch && !s3.dialog) {
|
|
3359
3710
|
e3.preventDefault();
|
|
3360
3711
|
pane.store.set({ searchOpen: true });
|
|
@@ -3379,9 +3730,11 @@ function bindWidgetKeys(shell, active, searchHotkey, extra) {
|
|
|
3379
3730
|
};
|
|
3380
3731
|
document.addEventListener("keydown", onKeyDown);
|
|
3381
3732
|
document.addEventListener("keyup", onKeyUp);
|
|
3733
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
3382
3734
|
return () => {
|
|
3383
3735
|
document.removeEventListener("keydown", onKeyDown);
|
|
3384
3736
|
document.removeEventListener("keyup", onKeyUp);
|
|
3737
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
3385
3738
|
};
|
|
3386
3739
|
}
|
|
3387
3740
|
|
|
@@ -3405,6 +3758,11 @@ function createPane(shell, config) {
|
|
|
3405
3758
|
layout: chart.layout,
|
|
3406
3759
|
atRealtime: true,
|
|
3407
3760
|
searchOpen: false,
|
|
3761
|
+
searchTarget: "symbol",
|
|
3762
|
+
canUndo: chart.canUndo,
|
|
3763
|
+
canRedo: chart.canRedo,
|
|
3764
|
+
compares: chart.getCompares(),
|
|
3765
|
+
replay: chart.replay,
|
|
3408
3766
|
chartType: config.chartType,
|
|
3409
3767
|
drawingTool: null,
|
|
3410
3768
|
selection: null,
|
|
@@ -3427,7 +3785,10 @@ function createPane(shell, config) {
|
|
|
3427
3785
|
chart.on("drawingsChange", (drawings) => store.set({ drawingCount: drawings.length })),
|
|
3428
3786
|
chart.on("indicatorsChange", (indicators) => store.set({ indicators })),
|
|
3429
3787
|
chart.on("magnetChange", (magnet) => store.set({ magnet })),
|
|
3430
|
-
chart.on("chartTypeChange", (chartType) => store.set({ chartType }))
|
|
3788
|
+
chart.on("chartTypeChange", (chartType) => store.set({ chartType })),
|
|
3789
|
+
chart.on("historyChange", ({ canUndo, canRedo }) => store.set({ canUndo, canRedo })),
|
|
3790
|
+
chart.on("comparesChange", (compares) => store.set({ compares })),
|
|
3791
|
+
chart.on("replayChange", (replay) => store.set({ replay }))
|
|
3431
3792
|
];
|
|
3432
3793
|
const load = (sym, res) => {
|
|
3433
3794
|
store.set({ resolution: res });
|
|
@@ -3457,7 +3818,7 @@ function createPane(shell, config) {
|
|
|
3457
3818
|
if (current) void load(current.symbol, res);
|
|
3458
3819
|
},
|
|
3459
3820
|
toggleFavoriteInterval: shell.toggleFavoriteInterval,
|
|
3460
|
-
setSearchOpen: (open) => store.set({ searchOpen:
|
|
3821
|
+
setSearchOpen: (open, target = "symbol") => store.set(open ? { searchOpen: true, searchTarget: target } : { searchOpen: false }),
|
|
3461
3822
|
screenshot: () => {
|
|
3462
3823
|
const s3 = store.get();
|
|
3463
3824
|
chart.takeScreenshot().toBlob((blob) => {
|
|
@@ -3471,7 +3832,7 @@ function createPane(shell, config) {
|
|
|
3471
3832
|
},
|
|
3472
3833
|
toggleFullscreen: shell.toggleFullscreen
|
|
3473
3834
|
};
|
|
3474
|
-
Q(/* @__PURE__ */
|
|
3835
|
+
Q(/* @__PURE__ */ a3(Overlay, { ctx }), overlayHost);
|
|
3475
3836
|
return {
|
|
3476
3837
|
stage,
|
|
3477
3838
|
chart,
|
|
@@ -3549,8 +3910,8 @@ function createTradingChart(container, options) {
|
|
|
3549
3910
|
shell.main.insertBefore(pane.stage, shell.slots.bottom);
|
|
3550
3911
|
shell.setPanes(() => [pane]);
|
|
3551
3912
|
const unbindKeys = bindWidgetKeys(shell, () => pane, searchHotkey);
|
|
3552
|
-
Q(/* @__PURE__ */
|
|
3553
|
-
if (shell.drawbarHost) Q(/* @__PURE__ */
|
|
3913
|
+
Q(/* @__PURE__ */ a3(Toolbar, { ctx: pane.ctx }), shell.toolbarHost);
|
|
3914
|
+
if (shell.drawbarHost) Q(/* @__PURE__ */ a3(DrawingToolbar, { ctx: pane.ctx }), shell.drawbarHost);
|
|
3554
3915
|
void pane.load(symbol, resolution);
|
|
3555
3916
|
return {
|
|
3556
3917
|
chart: pane.chart,
|
|
@@ -3584,17 +3945,17 @@ var DEFAULT_SYNC = { crosshair: true, time: false, symbol: false, interval: fals
|
|
|
3584
3945
|
function PaneTab({ pane, index, active, onSelect }) {
|
|
3585
3946
|
const s3 = useStore(pane.store);
|
|
3586
3947
|
const t3 = STRINGS[s3.locale];
|
|
3587
|
-
return /* @__PURE__ */
|
|
3588
|
-
/* @__PURE__ */
|
|
3948
|
+
return /* @__PURE__ */ a3("button", { class: "fnc-pane-tab", role: "tab", "aria-selected": active, onClick: onSelect, children: [
|
|
3949
|
+
/* @__PURE__ */ a3("span", { class: "fnc-pane-tab-num", children: index + 1 }),
|
|
3589
3950
|
s3.symbol?.name ?? `${t3.pane} ${index + 1}`,
|
|
3590
|
-
/* @__PURE__ */
|
|
3951
|
+
/* @__PURE__ */ a3("small", { children: resolutionLabel(s3.resolution, s3.locale) })
|
|
3591
3952
|
] });
|
|
3592
3953
|
}
|
|
3593
3954
|
function PaneTabs({ multi, panes }) {
|
|
3594
3955
|
const m3 = useStore(multi.store);
|
|
3595
3956
|
const visible = panes().slice(0, paneCount(LAYOUTS[m3.layout]));
|
|
3596
3957
|
if (!m3.narrow || visible.length < 2) return null;
|
|
3597
|
-
return /* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-pane-tabs", role: "tablist", children: visible.map((p3, i3) => /* @__PURE__ */ a3(PaneTab, { pane: p3, index: i3, active: i3 === m3.active, onSelect: () => multi.activate(i3) })) });
|
|
3598
3959
|
}
|
|
3599
3960
|
function createMultiChart(container, options) {
|
|
3600
3961
|
const {
|
|
@@ -3799,8 +4160,8 @@ function createMultiChart(container, options) {
|
|
|
3799
4160
|
}
|
|
3800
4161
|
function bindToolbar() {
|
|
3801
4162
|
const pane = panes[store.get().active];
|
|
3802
|
-
Q(/* @__PURE__ */
|
|
3803
|
-
if (shell.drawbarHost) Q(/* @__PURE__ */
|
|
4163
|
+
Q(/* @__PURE__ */ a3(Toolbar, { ctx: pane.ctx }, store.get().active), shell.toolbarHost);
|
|
4164
|
+
if (shell.drawbarHost) Q(/* @__PURE__ */ a3(DrawingToolbar, { ctx: pane.ctx }, store.get().active), shell.drawbarHost);
|
|
3804
4165
|
}
|
|
3805
4166
|
function activate(index) {
|
|
3806
4167
|
const s3 = store.get();
|
|
@@ -3857,7 +4218,7 @@ function createMultiChart(container, options) {
|
|
|
3857
4218
|
ensurePanes(Math.max(visibleCount(), Math.min(paneSpecs.length, MAX_PANES)));
|
|
3858
4219
|
shell.setPanes(() => panes);
|
|
3859
4220
|
bindToolbar();
|
|
3860
|
-
Q(/* @__PURE__ */
|
|
4221
|
+
Q(/* @__PURE__ */ a3(PaneTabs, { multi: controls, panes: () => panes }), tabsHost);
|
|
3861
4222
|
renderGrid();
|
|
3862
4223
|
const resize = new ResizeObserver(() => {
|
|
3863
4224
|
const narrow = shell.root.clientWidth > 0 && shell.root.clientWidth < narrowWidth;
|