@funnest/charts-ui 0.11.18 → 0.11.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n.d.ts +0 -8
- package/dist/index.js +0 -116
- package/package.json +2 -2
- package/dist/components/indicator-templates.d.ts +0 -13
package/dist/i18n.d.ts
CHANGED
|
@@ -164,10 +164,6 @@ export declare const STRINGS: {
|
|
|
164
164
|
saveTemplate: string;
|
|
165
165
|
templateName: string;
|
|
166
166
|
noTemplates: string;
|
|
167
|
-
indicatorTemplates: string;
|
|
168
|
-
saveIndicatorTemplate: string;
|
|
169
|
-
noIndicatorTemplates: string;
|
|
170
|
-
noIndicatorsToSave: string;
|
|
171
167
|
deleteTemplate: string;
|
|
172
168
|
lineWidth: string;
|
|
173
169
|
lineStyle: string;
|
|
@@ -498,10 +494,6 @@ export declare const STRINGS: {
|
|
|
498
494
|
saveTemplate: string;
|
|
499
495
|
templateName: string;
|
|
500
496
|
noTemplates: string;
|
|
501
|
-
indicatorTemplates: string;
|
|
502
|
-
saveIndicatorTemplate: string;
|
|
503
|
-
noIndicatorTemplates: string;
|
|
504
|
-
noIndicatorsToSave: string;
|
|
505
497
|
deleteTemplate: string;
|
|
506
498
|
lineWidth: string;
|
|
507
499
|
lineStyle: string;
|
package/dist/index.js
CHANGED
|
@@ -599,10 +599,6 @@ var STRINGS = {
|
|
|
599
599
|
saveTemplate: "\uC9C0\uAE08 \uBAA8\uC591\uC744 \uD15C\uD50C\uB9BF\uC73C\uB85C \uC800\uC7A5",
|
|
600
600
|
templateName: "\uD15C\uD50C\uB9BF \uC774\uB984",
|
|
601
601
|
noTemplates: "\uC774 \uB3C4\uAD6C\uB85C \uC800\uC7A5\uD55C \uD15C\uD50C\uB9BF\uC774 \uC5C6\uC5B4\uC694",
|
|
602
|
-
indicatorTemplates: "\uC9C0\uD45C \uD15C\uD50C\uB9BF",
|
|
603
|
-
saveIndicatorTemplate: "\uC9C0\uAE08 \uC9C0\uD45C\uB97C \uD15C\uD50C\uB9BF\uC73C\uB85C \uC800\uC7A5",
|
|
604
|
-
noIndicatorTemplates: "\uC800\uC7A5\uD55C \uC9C0\uD45C \uD15C\uD50C\uB9BF\uC774 \uC5C6\uC5B4\uC694. \uC9C0\uD45C\uB97C \uB123\uC740 \uB4A4 \uC544\uB798\uC5D0\uC11C \uC800\uC7A5\uD558\uBA74 \uB2E4\uB978 \uCC28\uD2B8\uC5D0\uB3C4 \uD55C \uBC88\uC5D0 \uB123\uC744 \uC218 \uC788\uC5B4\uC694.",
|
|
605
|
-
noIndicatorsToSave: "\uC800\uC7A5\uD560 \uC9C0\uD45C\uAC00 \uC5C6\uC5B4\uC694",
|
|
606
602
|
deleteTemplate: "\uD15C\uD50C\uB9BF \uC9C0\uC6B0\uAE30",
|
|
607
603
|
lineWidth: "\uC120 \uAD75\uAE30",
|
|
608
604
|
lineStyle: "\uC120 \uBAA8\uC591",
|
|
@@ -935,10 +931,6 @@ var STRINGS = {
|
|
|
935
931
|
saveTemplate: "Save this look as a template",
|
|
936
932
|
templateName: "Template name",
|
|
937
933
|
noTemplates: "No templates for this tool yet",
|
|
938
|
-
indicatorTemplates: "Indicator templates",
|
|
939
|
-
saveIndicatorTemplate: "Save these indicators as a template",
|
|
940
|
-
noIndicatorTemplates: "No indicator templates yet. Add indicators, save them below, and put them on any chart in one go.",
|
|
941
|
-
noIndicatorsToSave: "No indicators to save",
|
|
942
934
|
deleteTemplate: "Delete template",
|
|
943
935
|
lineWidth: "Line width",
|
|
944
936
|
lineStyle: "Line style",
|
|
@@ -4306,108 +4298,6 @@ function ToolsMenu({ ctx }) {
|
|
|
4306
4298
|
] });
|
|
4307
4299
|
}
|
|
4308
4300
|
|
|
4309
|
-
// src/components/indicator-templates.tsx
|
|
4310
|
-
var KEY = "fnc-indicator-templates";
|
|
4311
|
-
var MAX = 30;
|
|
4312
|
-
function readIndicatorTemplates() {
|
|
4313
|
-
try {
|
|
4314
|
-
const raw = localStorage.getItem(KEY);
|
|
4315
|
-
const list = raw ? JSON.parse(raw) : [];
|
|
4316
|
-
return Array.isArray(list) ? list.filter((x2) => !!x2 && typeof x2.name === "string" && Array.isArray(x2.indicators)) : [];
|
|
4317
|
-
} catch {
|
|
4318
|
-
return [];
|
|
4319
|
-
}
|
|
4320
|
-
}
|
|
4321
|
-
function writeIndicatorTemplates(list) {
|
|
4322
|
-
try {
|
|
4323
|
-
localStorage.setItem(KEY, JSON.stringify(list));
|
|
4324
|
-
} catch {
|
|
4325
|
-
}
|
|
4326
|
-
}
|
|
4327
|
-
function IndicatorTemplates({ ctx }) {
|
|
4328
|
-
const s3 = useStore(ctx.store);
|
|
4329
|
-
const t3 = stringsOf(s3);
|
|
4330
|
-
const [open, setOpen] = d2(false);
|
|
4331
|
-
const [list, setList] = d2(() => readIndicatorTemplates());
|
|
4332
|
-
const [naming, setNaming] = d2(null);
|
|
4333
|
-
const ref = T2(null);
|
|
4334
|
-
const menuRef = useKeepInView(open);
|
|
4335
|
-
A2(() => {
|
|
4336
|
-
if (!open) return;
|
|
4337
|
-
setList(readIndicatorTemplates());
|
|
4338
|
-
const onDown = (e3) => !ref.current?.contains(e3.target) && setOpen(false);
|
|
4339
|
-
const onKey = (e3) => e3.key === "Escape" && setOpen(false);
|
|
4340
|
-
document.addEventListener("pointerdown", onDown);
|
|
4341
|
-
document.addEventListener("keydown", onKey);
|
|
4342
|
-
return () => {
|
|
4343
|
-
document.removeEventListener("pointerdown", onDown);
|
|
4344
|
-
document.removeEventListener("keydown", onKey);
|
|
4345
|
-
};
|
|
4346
|
-
}, [open]);
|
|
4347
|
-
const keep = (next) => {
|
|
4348
|
-
setList(next);
|
|
4349
|
-
writeIndicatorTemplates(next);
|
|
4350
|
-
};
|
|
4351
|
-
const current = ctx.chart.getIndicators();
|
|
4352
|
-
const save = () => {
|
|
4353
|
-
const name = (naming ?? "").trim().slice(0, 30);
|
|
4354
|
-
if (!name || current.length === 0) return setNaming(null);
|
|
4355
|
-
const titles = ctx.chart.indicatorLegend().map((i3) => i3.title);
|
|
4356
|
-
keep([{ name, indicators: JSON.parse(JSON.stringify(current)), titles }, ...list.filter((x2) => x2.name !== name)].slice(0, MAX));
|
|
4357
|
-
setNaming(null);
|
|
4358
|
-
};
|
|
4359
|
-
const apply = (tpl) => {
|
|
4360
|
-
ctx.chart.setIndicators(JSON.parse(JSON.stringify(tpl.indicators)));
|
|
4361
|
-
setOpen(false);
|
|
4362
|
-
};
|
|
4363
|
-
return /* @__PURE__ */ a3("div", { class: "fnc-menu-wrap fnc-indtpl-wrap", ref, children: [
|
|
4364
|
-
/* @__PURE__ */ a3(
|
|
4365
|
-
"button",
|
|
4366
|
-
{
|
|
4367
|
-
class: "fnc-btn fnc-btn-indtpl",
|
|
4368
|
-
"data-tip": t3.indicatorTemplates,
|
|
4369
|
-
"aria-label": t3.indicatorTemplates,
|
|
4370
|
-
"aria-haspopup": "menu",
|
|
4371
|
-
"aria-expanded": open,
|
|
4372
|
-
onClick: () => {
|
|
4373
|
-
setNaming(null);
|
|
4374
|
-
setOpen(!open);
|
|
4375
|
-
},
|
|
4376
|
-
children: /* @__PURE__ */ a3(TemplateIcon, {})
|
|
4377
|
-
}
|
|
4378
|
-
),
|
|
4379
|
-
open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-template-menu fnc-indtpl-menu", role: "menu", "aria-label": t3.indicatorTemplates, ref: menuRef, children: [
|
|
4380
|
-
/* @__PURE__ */ a3("div", { class: "fnc-menu-title", children: t3.indicatorTemplates }),
|
|
4381
|
-
list.length === 0 && /* @__PURE__ */ a3("div", { class: "fnc-menu-note", children: t3.noIndicatorTemplates }),
|
|
4382
|
-
list.map((tpl) => /* @__PURE__ */ a3("div", { class: "fnc-template-row", children: [
|
|
4383
|
-
/* @__PURE__ */ a3("button", { class: "fnc-menu-item fnc-indtpl-item", role: "menuitem", onClick: () => apply(tpl), children: [
|
|
4384
|
-
/* @__PURE__ */ a3("span", { class: "fnc-indtpl-name", children: tpl.name }),
|
|
4385
|
-
/* @__PURE__ */ a3("small", { class: "fnc-indtpl-sub", children: tpl.titles.length ? tpl.titles.join(" \xB7 ") : `${tpl.indicators.length}` })
|
|
4386
|
-
] }),
|
|
4387
|
-
/* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.deleteTemplate, "aria-label": `${tpl.name} ${t3.deleteTemplate}`, onClick: () => keep(list.filter((x2) => x2 !== tpl)), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
4388
|
-
] })),
|
|
4389
|
-
/* @__PURE__ */ a3("div", { class: "fnc-menu-sep" }),
|
|
4390
|
-
naming === null ? /* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitem", disabled: current.length === 0, onClick: () => setNaming(""), children: current.length === 0 ? t3.noIndicatorsToSave : t3.saveIndicatorTemplate }) : /* @__PURE__ */ a3(
|
|
4391
|
-
"input",
|
|
4392
|
-
{
|
|
4393
|
-
class: "fnc-selbar-text fnc-template-name",
|
|
4394
|
-
value: naming,
|
|
4395
|
-
placeholder: t3.templateName,
|
|
4396
|
-
"aria-label": t3.templateName,
|
|
4397
|
-
maxLength: 30,
|
|
4398
|
-
autoFocus: true,
|
|
4399
|
-
onInput: (e3) => setNaming(e3.target.value),
|
|
4400
|
-
onKeyDown: (e3) => {
|
|
4401
|
-
e3.stopPropagation();
|
|
4402
|
-
if (e3.key === "Enter") save();
|
|
4403
|
-
if (e3.key === "Escape") setNaming(null);
|
|
4404
|
-
}
|
|
4405
|
-
}
|
|
4406
|
-
)
|
|
4407
|
-
] })
|
|
4408
|
-
] });
|
|
4409
|
-
}
|
|
4410
|
-
|
|
4411
4301
|
// src/components/toolbar.tsx
|
|
4412
4302
|
function Toolbar({ ctx }) {
|
|
4413
4303
|
const s3 = useStore(ctx.store);
|
|
@@ -4448,7 +4338,6 @@ function Toolbar({ ctx }) {
|
|
|
4448
4338
|
]
|
|
4449
4339
|
}
|
|
4450
4340
|
),
|
|
4451
|
-
/* @__PURE__ */ a3(IndicatorTemplates, { ctx }),
|
|
4452
4341
|
/* @__PURE__ */ a3(ToolsMenu, { ctx })
|
|
4453
4342
|
] }),
|
|
4454
4343
|
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
@@ -6338,11 +6227,6 @@ var CSS = (
|
|
|
6338
6227
|
.fnc-tools-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 0 6px; }
|
|
6339
6228
|
.fnc-tools-seg svg { width: 16px; height: 16px; flex: none; }
|
|
6340
6229
|
.fnc-template-menu { min-width: 220px; }
|
|
6341
|
-
.fnc-indtpl-menu { width: 280px; max-height: 60vh; overflow-y: auto; }
|
|
6342
|
-
.fnc-indtpl-menu .fnc-menu-note { line-height: 1.5; }
|
|
6343
|
-
.fnc-indtpl-item { flex-direction: column; align-items: flex-start !important; gap: 1px !important; padding-top: 6px; padding-bottom: 6px; }
|
|
6344
|
-
.fnc-indtpl-name { font-weight: 600; }
|
|
6345
|
-
.fnc-template-row .fnc-menu-item .fnc-indtpl-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--fnc-text-2); }
|
|
6346
6230
|
.fnc-levels-menu { min-width: 340px; }
|
|
6347
6231
|
.fnc-level-text { flex: 1; min-width: 0; width: 110px; height: 28px; padding: 0 8px; font-size: 13px; }
|
|
6348
6232
|
.fnc-options-menu { min-width: 280px; max-height: min(70vh, 560px); overflow-y: auto; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.20",
|
|
4
4
|
"description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"NOTICE"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@funnest/charts": "0.11.
|
|
45
|
+
"@funnest/charts": "0.11.20"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @jsxImportSource preact */
|
|
2
|
-
import type { IndicatorConfig } from '@funnest/charts';
|
|
3
|
-
import type { WidgetContext } from '../context.js';
|
|
4
|
-
export interface IndicatorTemplate {
|
|
5
|
-
name: string;
|
|
6
|
-
indicators: IndicatorConfig[];
|
|
7
|
-
/** What it holds, as the legend names them (for the list). */
|
|
8
|
-
titles: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare function readIndicatorTemplates(): IndicatorTemplate[];
|
|
11
|
-
export declare function IndicatorTemplates({ ctx }: {
|
|
12
|
-
ctx: WidgetContext;
|
|
13
|
-
}): import("preact").JSX.Element;
|