@funnest/charts-ui 0.9.2 → 0.9.3

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 CHANGED
@@ -107,6 +107,8 @@ 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;
@@ -326,6 +328,8 @@ export declare const STRINGS: {
326
328
  resetColors: string;
327
329
  templates: string;
328
330
  levels: string;
331
+ drawingOptions: string;
332
+ resetOptions: string;
329
333
  levelShown: string;
330
334
  levelValue: string;
331
335
  levelColor: 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,6 +536,8 @@ 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",
@@ -757,6 +759,8 @@ var STRINGS = {
757
759
  resetColors: "Reset colors",
758
760
  templates: "Templates",
759
761
  levels: "Levels",
762
+ drawingOptions: "Settings",
763
+ resetOptions: "Default settings",
760
764
  levelShown: "Show level",
761
765
  levelValue: "Level value",
762
766
  levelColor: "Level color",
@@ -1435,13 +1439,14 @@ var POS_KEY = "fnc-selbar-pos";
1435
1439
  var TEMPLATES_KEY = "fnc-drawing-templates";
1436
1440
  var TEMPLATES_MAX = 20;
1437
1441
  var lookOf = (style) => {
1438
- const { width, dash, fontSize, colors, levels } = style;
1442
+ const { width, dash, fontSize, colors, levels, options } = style;
1439
1443
  return {
1440
1444
  ...width ? { width } : {},
1441
1445
  ...dash ? { dash } : {},
1442
1446
  ...fontSize ? { fontSize } : {},
1443
1447
  ...colors ? { colors: { ...colors } } : {},
1444
- ...levels ? { levels: levels.map((l3) => ({ ...l3 })) } : {}
1448
+ ...levels ? { levels: levels.map((l3) => ({ ...l3 })) } : {},
1449
+ ...options ? { options: { ...options } } : {}
1445
1450
  };
1446
1451
  };
1447
1452
  var readJson = (key, fallback) => {
@@ -1604,6 +1609,57 @@ function SelectionBar({ ctx }) {
1604
1609
  )
1605
1610
  ] })
1606
1611
  ] }),
1612
+ def?.options && def.options.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
1613
+ /* @__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(GearIcon, {}) }),
1614
+ menu === "options" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-options-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
1615
+ def.options.map((o4) => {
1616
+ const value = drawingOption(def, d3, o4.key);
1617
+ const set = (v3) => setStyle({ options: { ...style.options, [o4.key]: v3 } });
1618
+ if (o4.kind === "toggle")
1619
+ return /* @__PURE__ */ a3("label", { class: "fnc-menu-item fnc-option-row", children: [
1620
+ /* @__PURE__ */ a3("input", { type: "checkbox", checked: value === true, onChange: (e3) => set(e3.target.checked) }),
1621
+ /* @__PURE__ */ a3("span", { children: o4.label[s3.locale] })
1622
+ ] });
1623
+ if (o4.kind === "choice")
1624
+ return /* @__PURE__ */ a3("label", { class: "fnc-option-row fnc-option-field", children: [
1625
+ /* @__PURE__ */ a3("span", { children: o4.label[s3.locale] }),
1626
+ /* @__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] })) })
1627
+ ] });
1628
+ return /* @__PURE__ */ a3("label", { class: "fnc-option-row fnc-option-field", children: [
1629
+ /* @__PURE__ */ a3("span", { children: o4.label[s3.locale] }),
1630
+ /* @__PURE__ */ a3(
1631
+ "input",
1632
+ {
1633
+ class: "fnc-input fnc-option-number",
1634
+ type: "number",
1635
+ step: o4.step ?? "any",
1636
+ min: o4.min,
1637
+ max: o4.max,
1638
+ defaultValue: String(value),
1639
+ onChange: (e3) => {
1640
+ const v3 = Number(e3.target.value);
1641
+ if (Number.isFinite(v3)) set(v3);
1642
+ }
1643
+ }
1644
+ ),
1645
+ o4.unit && /* @__PURE__ */ a3("span", { class: "fnc-option-unit", children: o4.unit })
1646
+ ] }, `${o4.key}:${String(value)}`);
1647
+ }),
1648
+ /* @__PURE__ */ a3("div", { class: "fnc-menu-sep" }),
1649
+ /* @__PURE__ */ a3(
1650
+ "button",
1651
+ {
1652
+ class: "fnc-menu-item",
1653
+ role: "menuitem",
1654
+ onClick: () => {
1655
+ const { options: _drop, ...rest } = style;
1656
+ setStyleRaw(rest);
1657
+ },
1658
+ children: t3.resetOptions
1659
+ }
1660
+ )
1661
+ ] })
1662
+ ] }),
1607
1663
  def?.levels && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
1608
1664
  /* @__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
1665
  menu === "levels" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-levels-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
@@ -5086,6 +5142,14 @@ var CSS = (
5086
5142
  .fnc-tools-seg svg { width: 16px; height: 16px; flex: none; }
5087
5143
  .fnc-template-menu { min-width: 220px; }
5088
5144
  .fnc-levels-menu { min-width: 230px; }
5145
+ .fnc-options-menu { min-width: 250px; }
5146
+ .fnc-option-row { display: flex; align-items: center; gap: 8px; }
5147
+ .fnc-option-row input[type='checkbox'] { width: 15px; height: 15px; margin: 0; accent-color: var(--fnc-accent, #3182f6); }
5148
+ .fnc-option-field { justify-content: space-between; padding: 4px 10px; font-size: 13px; color: var(--fnc-text); }
5149
+ .fnc-option-field > span:first-child { flex: 1; }
5150
+ .fnc-option-number { flex: none; width: 90px; height: 28px; padding: 0 8px; font-size: 13px; }
5151
+ .fnc-option-unit { color: var(--fnc-text-2); font-size: 12px; }
5152
+ .fnc-option-field .fnc-select { height: 28px; font-size: 13px; }
5089
5153
  .fnc-levels-list { max-height: 300px; overflow-y: auto; padding: 2px 0; }
5090
5154
  .fnc-level-row { display: flex; align-items: center; gap: 8px; padding: 3px 8px; }
5091
5155
  .fnc-level-row input[type='checkbox'] { width: 15px; height: 15px; margin: 0; accent-color: var(--fnc-accent, #3182f6); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
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.2"
45
+ "@funnest/charts": "0.9.3"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"