@funnest/charts-ui 0.9.2 → 0.9.4
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 +6 -0
- package/dist/index.js +89 -9
- package/package.json +2 -2
package/dist/i18n.d.ts
CHANGED
|
@@ -107,9 +107,12 @@ export declare const STRINGS: {
|
|
|
107
107
|
resetColors: string;
|
|
108
108
|
templates: string;
|
|
109
109
|
levels: string;
|
|
110
|
+
drawingOptions: string;
|
|
111
|
+
resetOptions: string;
|
|
110
112
|
levelShown: string;
|
|
111
113
|
levelValue: string;
|
|
112
114
|
levelColor: string;
|
|
115
|
+
levelText: string;
|
|
113
116
|
removeLevel: string;
|
|
114
117
|
addLevel: string;
|
|
115
118
|
resetLevels: string;
|
|
@@ -326,9 +329,12 @@ export declare const STRINGS: {
|
|
|
326
329
|
resetColors: string;
|
|
327
330
|
templates: string;
|
|
328
331
|
levels: string;
|
|
332
|
+
drawingOptions: string;
|
|
333
|
+
resetOptions: string;
|
|
329
334
|
levelShown: string;
|
|
330
335
|
levelValue: string;
|
|
331
336
|
levelColor: string;
|
|
337
|
+
levelText: string;
|
|
332
338
|
removeLevel: string;
|
|
333
339
|
addLevel: string;
|
|
334
340
|
resetLevels: string;
|
package/dist/index.js
CHANGED
|
@@ -270,7 +270,7 @@ n = { __e: function(n2, t3, r3, u3) {
|
|
|
270
270
|
}, e = /* @__PURE__ */ Symbol(), l = /(PointerCapture)$|Capture$/i, c = 0, a = {}, s = 0;
|
|
271
271
|
|
|
272
272
|
// src/components/drawing-toolbar.tsx
|
|
273
|
-
import { drawingLevels } from "@funnest/charts";
|
|
273
|
+
import { drawingLevels, drawingOption } from "@funnest/charts";
|
|
274
274
|
|
|
275
275
|
// ../../node_modules/.pnpm/preact@11.2.0/node_modules/preact/hooks/dist/hooks.mjs
|
|
276
276
|
var t2;
|
|
@@ -536,9 +536,12 @@ var STRINGS = {
|
|
|
536
536
|
resetColors: "\uAE30\uBCF8 \uC0C9\uC73C\uB85C",
|
|
537
537
|
templates: "\uD15C\uD50C\uB9BF",
|
|
538
538
|
levels: "\uB808\uBCA8 \uC124\uC815",
|
|
539
|
+
drawingOptions: "\uB3C4\uAD6C \uC124\uC815",
|
|
540
|
+
resetOptions: "\uAE30\uBCF8 \uC124\uC815\uC73C\uB85C",
|
|
539
541
|
levelShown: "\uB808\uBCA8 \uBCF4\uC774\uAE30",
|
|
540
542
|
levelValue: "\uB808\uBCA8 \uAC12",
|
|
541
543
|
levelColor: "\uB808\uBCA8 \uC0C9",
|
|
544
|
+
levelText: "\uBB38\uC790",
|
|
542
545
|
removeLevel: "\uB808\uBCA8 \uBE7C\uAE30",
|
|
543
546
|
addLevel: "\uB808\uBCA8 \uCD94\uAC00",
|
|
544
547
|
resetLevels: "\uAE30\uBCF8 \uB808\uBCA8\uB85C",
|
|
@@ -757,9 +760,12 @@ var STRINGS = {
|
|
|
757
760
|
resetColors: "Reset colors",
|
|
758
761
|
templates: "Templates",
|
|
759
762
|
levels: "Levels",
|
|
763
|
+
drawingOptions: "Settings",
|
|
764
|
+
resetOptions: "Default settings",
|
|
760
765
|
levelShown: "Show level",
|
|
761
766
|
levelValue: "Level value",
|
|
762
767
|
levelColor: "Level color",
|
|
768
|
+
levelText: "Text",
|
|
763
769
|
removeLevel: "Remove level",
|
|
764
770
|
addLevel: "Add level",
|
|
765
771
|
resetLevels: "Default levels",
|
|
@@ -1435,13 +1441,14 @@ var POS_KEY = "fnc-selbar-pos";
|
|
|
1435
1441
|
var TEMPLATES_KEY = "fnc-drawing-templates";
|
|
1436
1442
|
var TEMPLATES_MAX = 20;
|
|
1437
1443
|
var lookOf = (style) => {
|
|
1438
|
-
const { width, dash, fontSize, colors, levels } = style;
|
|
1444
|
+
const { width, dash, fontSize, colors, levels, options } = style;
|
|
1439
1445
|
return {
|
|
1440
1446
|
...width ? { width } : {},
|
|
1441
1447
|
...dash ? { dash } : {},
|
|
1442
1448
|
...fontSize ? { fontSize } : {},
|
|
1443
1449
|
...colors ? { colors: { ...colors } } : {},
|
|
1444
|
-
...levels ? { levels: levels.map((l3) => ({ ...l3 })) } : {}
|
|
1450
|
+
...levels ? { levels: levels.map((l3) => ({ ...l3 })) } : {},
|
|
1451
|
+
...options ? { options: { ...options } } : {}
|
|
1445
1452
|
};
|
|
1446
1453
|
};
|
|
1447
1454
|
var readJson = (key, fallback) => {
|
|
@@ -1556,9 +1563,9 @@ function SelectionBar({ ctx }) {
|
|
|
1556
1563
|
children: /* @__PURE__ */ a3(GripIcon, {})
|
|
1557
1564
|
}
|
|
1558
1565
|
),
|
|
1559
|
-
[...SWATCHES, ...recent.filter((c3) => !SWATCHES.includes(c3))].map((color) => /* @__PURE__ */ a3("button", { class: "fnc-swatch", style: { background: color }, "data-tip": t3.color, "aria-label": `${t3.color} ${color}`, "aria-pressed": current === color, onClick: () => pickColor(color) })),
|
|
1560
|
-
/* @__PURE__ */ a3("label", { class: "fnc-swatch fnc-swatch-add", "data-tip": t3.customColor, "aria-label": t3.customColor, children: [
|
|
1561
|
-
"
|
|
1566
|
+
!def?.levels && [...SWATCHES, ...recent.filter((c3) => !SWATCHES.includes(c3))].map((color) => /* @__PURE__ */ a3("button", { class: "fnc-swatch", style: { background: color }, "data-tip": t3.color, "aria-label": `${t3.color} ${color}`, "aria-pressed": current === color, onClick: () => pickColor(color) })),
|
|
1567
|
+
!def?.levels && /* @__PURE__ */ a3("label", { class: "fnc-swatch fnc-swatch-add", "data-tip": t3.customColor, "aria-label": t3.customColor, children: [
|
|
1568
|
+
/* @__PURE__ */ a3("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M5 1.5v7M1.5 5h7", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) }),
|
|
1562
1569
|
/* @__PURE__ */ a3(
|
|
1563
1570
|
"input",
|
|
1564
1571
|
{
|
|
@@ -1604,6 +1611,57 @@ function SelectionBar({ ctx }) {
|
|
|
1604
1611
|
)
|
|
1605
1612
|
] })
|
|
1606
1613
|
] }),
|
|
1614
|
+
def?.options && def.options.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
1615
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.drawingOptions, "aria-label": t3.drawingOptions, "aria-expanded": menu === "options", onClick: () => setMenu(menu === "options" ? null : "options"), children: /* @__PURE__ */ a3(SettingsIcon, {}) }),
|
|
1616
|
+
menu === "options" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-options-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
|
|
1617
|
+
def.options.map((o4) => {
|
|
1618
|
+
const value = drawingOption(def, d3, o4.key);
|
|
1619
|
+
const set = (v3) => setStyle({ options: { ...style.options, [o4.key]: v3 } });
|
|
1620
|
+
if (o4.kind === "toggle")
|
|
1621
|
+
return /* @__PURE__ */ a3("label", { class: "fnc-menu-item fnc-option-row", children: [
|
|
1622
|
+
/* @__PURE__ */ a3("input", { type: "checkbox", checked: value === true, onChange: (e3) => set(e3.target.checked) }),
|
|
1623
|
+
/* @__PURE__ */ a3("span", { children: o4.label[s3.locale] })
|
|
1624
|
+
] });
|
|
1625
|
+
if (o4.kind === "choice")
|
|
1626
|
+
return /* @__PURE__ */ a3("label", { class: "fnc-option-row fnc-option-field", children: [
|
|
1627
|
+
/* @__PURE__ */ a3("span", { children: o4.label[s3.locale] }),
|
|
1628
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select", value: String(value), onChange: (e3) => set(e3.target.value), children: o4.choices?.map((c3) => /* @__PURE__ */ a3("option", { value: c3.value, children: c3.label[s3.locale] })) })
|
|
1629
|
+
] });
|
|
1630
|
+
return /* @__PURE__ */ a3("label", { class: "fnc-option-row fnc-option-field", children: [
|
|
1631
|
+
/* @__PURE__ */ a3("span", { children: o4.label[s3.locale] }),
|
|
1632
|
+
/* @__PURE__ */ a3(
|
|
1633
|
+
"input",
|
|
1634
|
+
{
|
|
1635
|
+
class: "fnc-input fnc-option-number",
|
|
1636
|
+
type: "number",
|
|
1637
|
+
step: o4.step ?? "any",
|
|
1638
|
+
min: o4.min,
|
|
1639
|
+
max: o4.max,
|
|
1640
|
+
defaultValue: String(value),
|
|
1641
|
+
onChange: (e3) => {
|
|
1642
|
+
const v3 = Number(e3.target.value);
|
|
1643
|
+
if (Number.isFinite(v3)) set(v3);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
),
|
|
1647
|
+
o4.unit && /* @__PURE__ */ a3("span", { class: "fnc-option-unit", children: o4.unit })
|
|
1648
|
+
] }, `${o4.key}:${String(value)}`);
|
|
1649
|
+
}),
|
|
1650
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-sep" }),
|
|
1651
|
+
/* @__PURE__ */ a3(
|
|
1652
|
+
"button",
|
|
1653
|
+
{
|
|
1654
|
+
class: "fnc-menu-item",
|
|
1655
|
+
role: "menuitem",
|
|
1656
|
+
onClick: () => {
|
|
1657
|
+
const { options: _drop, ...rest } = style;
|
|
1658
|
+
setStyleRaw(rest);
|
|
1659
|
+
},
|
|
1660
|
+
children: t3.resetOptions
|
|
1661
|
+
}
|
|
1662
|
+
)
|
|
1663
|
+
] })
|
|
1664
|
+
] }),
|
|
1607
1665
|
def?.levels && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
1608
1666
|
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.levels, "aria-label": t3.levels, "aria-expanded": menu === "levels", onClick: () => setMenu(menu === "levels" ? null : "levels"), children: /* @__PURE__ */ a3(LevelsIcon, {}) }),
|
|
1609
1667
|
menu === "levels" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-levels-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
|
|
@@ -1640,6 +1698,18 @@ function SelectionBar({ ctx }) {
|
|
|
1640
1698
|
onInput: (e3) => setLevels(levelRows.map((x2, j2) => j2 === i3 ? { ...x2, color: e3.target.value } : x2))
|
|
1641
1699
|
}
|
|
1642
1700
|
) }),
|
|
1701
|
+
/* @__PURE__ */ a3(
|
|
1702
|
+
"input",
|
|
1703
|
+
{
|
|
1704
|
+
class: "fnc-input fnc-level-text",
|
|
1705
|
+
type: "text",
|
|
1706
|
+
maxLength: 40,
|
|
1707
|
+
defaultValue: l3.text ?? "",
|
|
1708
|
+
placeholder: t3.levelText,
|
|
1709
|
+
"aria-label": `${l3.value} ${t3.levelText}`,
|
|
1710
|
+
onChange: (e3) => setLevels(levelRows.map((x2, j2) => j2 === i3 ? { ...x2, text: e3.target.value.trim() } : x2))
|
|
1711
|
+
}
|
|
1712
|
+
),
|
|
1643
1713
|
/* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.removeLevel, "aria-label": `${l3.value} ${t3.removeLevel}`, onClick: () => setLevels(levelRows.filter((_3, j2) => j2 !== i3)), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
1644
1714
|
] }, `${i3}:${l3.value}`)) }),
|
|
1645
1715
|
/* @__PURE__ */ a3("div", { class: "fnc-menu-sep" }),
|
|
@@ -4267,7 +4337,8 @@ var CSS = (
|
|
|
4267
4337
|
.fnc-selbar { padding-left: 4px; }
|
|
4268
4338
|
.fnc-selbar-grip { cursor: grab; touch-action: none; }
|
|
4269
4339
|
.fnc-selbar-grip:active { cursor: grabbing; }
|
|
4270
|
-
.fnc-swatch-add { position: relative; display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--fnc-text-2); color: var(--fnc-text-2);
|
|
4340
|
+
.fnc-swatch-add { position: relative; display: grid; place-items: center; box-sizing: border-box; overflow: hidden; border: 1px dashed var(--fnc-text-2); color: var(--fnc-text-2); cursor: pointer; }
|
|
4341
|
+
.fnc-swatch-add svg { display: block; }
|
|
4271
4342
|
.fnc-swatch-add input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
|
|
4272
4343
|
.fnc-selbar-menu { position: relative; }
|
|
4273
4344
|
.fnc-selbar-pop { top: calc(100% + 6px); left: 50%; transform: translateX(-50%); min-width: 110px; }
|
|
@@ -5085,8 +5156,17 @@ var CSS = (
|
|
|
5085
5156
|
.fnc-tools-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 0 6px; }
|
|
5086
5157
|
.fnc-tools-seg svg { width: 16px; height: 16px; flex: none; }
|
|
5087
5158
|
.fnc-template-menu { min-width: 220px; }
|
|
5088
|
-
.fnc-levels-menu { min-width:
|
|
5089
|
-
.fnc-
|
|
5159
|
+
.fnc-levels-menu { min-width: 340px; }
|
|
5160
|
+
.fnc-level-text { flex: 1; min-width: 0; width: 110px; height: 28px; padding: 0 8px; font-size: 13px; }
|
|
5161
|
+
.fnc-options-menu { min-width: 280px; max-height: min(70vh, 560px); overflow-y: auto; }
|
|
5162
|
+
.fnc-option-row { display: flex; align-items: center; gap: 8px; }
|
|
5163
|
+
.fnc-option-row input[type='checkbox'] { width: 15px; height: 15px; margin: 0; accent-color: var(--fnc-accent, #3182f6); }
|
|
5164
|
+
.fnc-option-field { justify-content: space-between; padding: 4px 10px; font-size: 13px; color: var(--fnc-text); }
|
|
5165
|
+
.fnc-option-field > span:first-child { flex: 1; }
|
|
5166
|
+
.fnc-option-number { flex: none; width: 90px; height: 28px; padding: 0 8px; font-size: 13px; }
|
|
5167
|
+
.fnc-option-unit { color: var(--fnc-text-2); font-size: 12px; }
|
|
5168
|
+
.fnc-option-field .fnc-select { height: 28px; font-size: 13px; }
|
|
5169
|
+
.fnc-levels-list { max-height: min(55vh, 420px); overflow-y: auto; padding: 2px 0; }
|
|
5090
5170
|
.fnc-level-row { display: flex; align-items: center; gap: 8px; padding: 3px 8px; }
|
|
5091
5171
|
.fnc-level-row input[type='checkbox'] { width: 15px; height: 15px; margin: 0; accent-color: var(--fnc-accent, #3182f6); }
|
|
5092
5172
|
.fnc-level-value { flex: none; width: 84px; height: 28px; padding: 0 8px; font-size: 13px; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
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.9.
|
|
45
|
+
"@funnest/charts": "0.9.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|