@trdrs/quickcharts 5.5.0 → 5.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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.6.0
6
+
7
+ The currency and unit box holds its words in a 24px row inside its outline, at the row's start, 3px in from each end on a radius of 3. With `scaleUnitMenu` the row ends in a 7 by 5 caret and lights under the pointer, and `ScaleUnitMenuRequest.expanded(open)` lets the host say its menu stands open, which keeps the row lit and turns the caret up. The auto-scale and logarithmic buttons stand 4px apart, the pair centred on the scale.
8
+
5
9
  ## 5.5.0
6
10
 
7
11
  The indicator picker's rail offers Favorites only while something is starred, and keeps it while it is open. The author and count columns stand only while a listed row fills them, so a list of starred built-ins reads as stars and names. Items a host answers for the `builtin` collection list in Technicals after the shipped definitions, under the host's own kinds. `IndicatorPickerCollection.empty` gives a collection an empty state: a title, text, a mark drawn 120px square from the 28-unit glyph grid, and one action that reaches `act` with a `collection` target. `IndicatorPickerEmpty` is exported. `chart.indicators.open` takes a `kind` beside `collection` and opens with that kind's filter pressed.
package/README.md CHANGED
@@ -2462,7 +2462,9 @@ the same in both modes, in `CHART_FACTORY_COLORS`. The sections and what stands
2462
2462
  `scaleUnitMenu` option the box is a button titled with the setting's name: a press hands your
2463
2463
  handler a `ScaleUnitMenuRequest` (the chart, the box's place in viewport pixels, and whether the
2464
2464
  keyboard pressed it) so your own currency and unit menu opens against it, and the box stays
2465
- while the pointer rests on it. Without the option the box is a label that takes no pointer, so
2465
+ while the pointer rests on it. Call the request's `expanded(true)` as your menu opens and
2466
+ `expanded(false)` as it closes: while it stands open the box stays lit and the caret at the end
2467
+ of its row points up. Without the option the box is a label that takes no pointer, so
2466
2468
  the scale under it still drags. The price-to-bar
2467
2469
  ratio lock (`lockPriceToBarRatio`) holds the price one bar's width spans: engaging it with no
2468
2470
  `priceToBarRatio` of its own takes the ratio on screen into that leaf, the scale stops framing
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.5.0",
2
+ "version": "5.6.0",
3
3
  "styles": [
4
4
  {
5
5
  "id": "candles",
package/dist/index.d.ts CHANGED
@@ -5608,6 +5608,9 @@ interface ScaleUnitMenuRequest {
5608
5608
  };
5609
5609
  /** Whether the box was pressed from the keyboard, so the menu takes the focus. */
5610
5610
  readonly keyboard: boolean;
5611
+ /** Say whether the menu stands open: `true` as it opens and `false` as it closes. While it is open
5612
+ * the box stays lit and its caret points up. */
5613
+ expanded(open: boolean): void;
5611
5614
  }
5612
5615
  /** Everything needed to construct a widget. `container` and `datafeed` are the two hard
5613
5616
  * requirements; every other field has a working default. */
package/dist/index.js CHANGED
@@ -10205,6 +10205,9 @@ var ICONS = {
10205
10205
  /** The pickers' wide caret, on its native 16 by 8 grid: the trigger arrow, which
10206
10206
  * renders half size beside a picker's text. */
10207
10207
  menuArrowWide: { viewBox: "0 0 16 8", body: solid(polyline([[0.6, 0.7], [8, 7], [15.4, 0.7]], 1.8)) },
10208
+ /** The currency and unit box's caret, on its native 7 by 5 grid: a 1.2 stroke bent down at its
10209
+ * middle, drawn at its own size after the box's words. */
10210
+ scaleUnitArrow: { viewBox: "0 0 7 5", body: '<path d="M1 1.5l2.5 2 2.5-2" stroke="currentColor" stroke-width="1.2"/>' },
10208
10211
  // Hairline weight: these two sit beside a label rather than alone in a 38px cell. A tray taking an
10209
10212
  // arrow, and two sheets, the back one broken where the front lies over it.
10210
10213
  download: { viewBox: "0 0 28 28", body: solid(bend([[6.5, 17], [6.5, 22.5], [22.5, 22.5], [22.5, 17]], 1) + line2([14.5, 6], [14.5, 18]) + polyline([[10.5, 14.5], [14.5, 18.5], [18.5, 14.5]])) },
@@ -18195,7 +18198,7 @@ var CONTROL_ICONS = byMeaning({
18195
18198
  image: [ICONS.camera],
18196
18199
  download: [ICONS.download],
18197
18200
  copy: [ICONS.copy],
18198
- caret: [ICONS.menuArrowWide],
18201
+ caret: [ICONS.menuArrowWide, ICONS.scaleUnitArrow],
18199
18202
  info: [ICONS.info],
18200
18203
  // The legend.
18201
18204
  visible: [ICONS.legendEye],
@@ -20435,7 +20438,7 @@ function mountNavControls(deps) {
20435
20438
  }
20436
20439
 
20437
20440
  // src/ui/chrome/scaleControls.ts
20438
- var BUTTON = { width: 20, height: 22, gap: 15, foot: 4 };
20441
+ var BUTTON = { width: 20, height: 22, gap: 4, foot: 4 };
20439
20442
  var UNIT_BOX = { inset: 4 };
20440
20443
  function mountScaleControls(deps) {
20441
20444
  const t = deps.i18n.t;
@@ -20445,12 +20448,15 @@ function mountScaleControls(deps) {
20445
20448
  modes.append(auto, log);
20446
20449
  stopPointer(modes);
20447
20450
  const door = deps.openUnitMenu;
20448
- const unit = door ? h("button", { type: "button", class: "qc-scale-unit", "data-role": "scale-unit" }) : h("div", { class: "qc-scale-unit", "data-role": "scale-unit" });
20451
+ const unit = door ? h("button", { type: "button", class: "qc-scale-unit", "data-role": "scale-unit", "aria-haspopup": "menu", "aria-expanded": "false" }) : h("div", { class: "qc-scale-unit", "data-role": "scale-unit" });
20452
+ const unitText = h("span", {});
20453
+ unit.append(h("span", { class: "qc-scale-unit-row" }, unitText, door ? deps.icons.glyph(ICONS.scaleUnitArrow, { size: 7, height: 5, className: "qc-scale-unit-arrow" }) : null));
20449
20454
  if (door) {
20450
20455
  stopPointer(unit);
20456
+ const expanded = (open2) => unit.setAttribute("aria-expanded", String(open2 === true));
20451
20457
  unit.addEventListener("click", (event) => {
20452
20458
  const box2 = unit.getBoundingClientRect();
20453
- door({ left: box2.left, top: box2.top, right: box2.right, bottom: box2.bottom }, event.detail === 0);
20459
+ door({ left: box2.left, top: box2.top, right: box2.right, bottom: box2.bottom }, event.detail === 0, expanded);
20454
20460
  });
20455
20461
  }
20456
20462
  deps.chrome.appendChild(unit);
@@ -20569,7 +20575,7 @@ function mountScaleControls(deps) {
20569
20575
  const currency = named2?.currency?.trim() ?? "";
20570
20576
  const unitId = named2?.unit?.trim() ?? "";
20571
20577
  const text2 = currency && unitId ? t("chrome.currencyAndUnit", { currency, unit: unitId }) : currency || unitId;
20572
- unit.textContent = text2;
20578
+ unitText.textContent = text2;
20573
20579
  unit.dataset.qcVisibility = visibility;
20574
20580
  unit.hidden = text2 === "" || visibility === "never" || visibility === "hover" && !overScale && !overControls;
20575
20581
  unit.style.top = `${Math.round(box2.top + UNIT_BOX.inset)}px`;
@@ -22766,6 +22772,7 @@ function createChartInstance(deps) {
22766
22772
  chrome: chrome2,
22767
22773
  gestures,
22768
22774
  i18n,
22775
+ icons: deps.icons,
22769
22776
  box: priceScaleBox,
22770
22777
  modeButtons: () => eff.priceScale.scaleModeButtons,
22771
22778
  unitBox: () => eff.priceScale.currencyAndUnit,
@@ -22782,7 +22789,7 @@ function createChartInstance(deps) {
22782
22789
  openPriceMenu: (anchor2, keyboard) => {
22783
22790
  menu2?.raisePriceMenu(anchor2, keyboard);
22784
22791
  },
22785
- ...deps.scaleUnitMenu ? { openUnitMenu: (anchor2, keyboard) => deps.scaleUnitMenu?.({ chart: handle, anchor: anchor2, keyboard }) } : {}
22792
+ ...deps.scaleUnitMenu ? { openUnitMenu: (anchor2, keyboard, expanded) => deps.scaleUnitMenu?.({ chart: handle, anchor: anchor2, keyboard, expanded }) } : {}
22786
22793
  }) : null;
22787
22794
  scalePlus = scaleControls && menu2 ? attachScalePlus({
22788
22795
  chart,