@trdrs/quickcharts 5.3.0 → 5.5.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 +14 -0
- package/README.md +45 -9
- package/dist/{chunk-FRZFOTMO.js → chunk-ETG46YGK.js} +28 -1
- package/dist/{chunk-FRZFOTMO.js.map → chunk-ETG46YGK.js.map} +1 -1
- package/dist/drawings.js +1 -1
- package/dist/feature-manifest.json +1 -1
- package/dist/index.d.ts +321 -286
- package/dist/index.js +115 -22
- package/dist/index.js.map +1 -1
- package/dist/quickcharts.css +262 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 5.5.0
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## 5.4.0
|
|
10
|
+
|
|
11
|
+
What is drawn over the canvas reads its ink from the canvas's lightness. Over a canvas of the other mode's lightness, such as a white canvas in dark mode, the legend, the scales' boxes and buttons, the pane and navigation buttons and the corner mark wear that mode's built-in colors, and the factory scale text and lines, grid and watermark are that mode's, so they read dark on a light canvas and light on a dark one. A color the host or the viewer named stays theirs.
|
|
12
|
+
|
|
13
|
+
The rows of a settings page, in the chart settings, a host's pages and the drawing settings dialogs, are each as tall as what they hold while the page scrolls, so a row whose controls wrap onto a second line keeps that line clear of the next row in a short window.
|
|
14
|
+
|
|
15
|
+
The price scale's auto-scale and logarithmic buttons write their letters at 14px on an 18px line, stand 15px apart, each centred in a 35x30 cell, and a held button steps lighter under the pointer.
|
|
16
|
+
|
|
17
|
+
The `scaleUnitMenu` option makes the currency and unit box at the top of the price scale a button that opens the host's own menu: a press hands the handler a `ScaleUnitMenuRequest` with the chart, the box's place in viewport pixels and whether the keyboard pressed it. Without the option the box is a label that takes no pointer.
|
|
18
|
+
|
|
5
19
|
## 5.3.0
|
|
6
20
|
|
|
7
21
|
The built-in palettes carry a deeper dark end of the grey ramp: the dark chrome and canvas are `#000000`, dialogs and menus `#131313`, the hover fill `#1a1a1a`, the pressed fill `#2b2b2b`, menu rules `#464646` and the quiet edges `#555555`, and the light inks that stood at `#0f0f0f` are `#000000`. The light secondary ink, the ink of search rows, lists and toolbar labels, is `#000000`, and the light tooltip is `#1a1a1a`.
|
package/README.md
CHANGED
|
@@ -1603,20 +1603,26 @@ part in each through `contributeCapture` (see Extensions).
|
|
|
1603
1603
|
### Indicator picker content
|
|
1604
1604
|
|
|
1605
1605
|
The Indicators button and `commands.execute('chart.indicators.open')` open the same picker.
|
|
1606
|
-
Pass `{ collection: 'saved' }` as the command argument to open a declared host collection directly
|
|
1606
|
+
Pass `{ collection: 'saved' }` as the command argument to open a declared host collection directly,
|
|
1607
|
+
and `kind` beside it (`{ collection: 'builtin', kind: 'template' }`) to open with that kind's filter
|
|
1608
|
+
pressed; a kind neither the chart's `indicator` nor one your source declares leaves every kind listed.
|
|
1607
1609
|
An unknown collection falls back to the shipped catalog. Reopening an already open picker keeps its current selection and query.
|
|
1608
1610
|
The picker opens on the same search field as the symbol search. Beside its list stands a rail of
|
|
1609
|
-
collections: Favorites under Personal, and the 23 shipped definitions as
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1611
|
+
collections: Favorites under Personal while anything is starred, and the 23 shipped definitions as
|
|
1612
|
+
Technicals under Built-in. Favorites stays in the rail while it is open, so unstarring the last row
|
|
1613
|
+
there leaves the trader where they are. Pressing a definition's row adds a new instance to the
|
|
1614
|
+
currently active chart and keeps the picker open. Favorites use your `ChartStorage` port. The list
|
|
1615
|
+
reads as a table of each row's star, name, author, favorite count and actions; the author and count
|
|
1616
|
+
columns stand only while a listed row fills them, so the shipped catalog shows the star, the name
|
|
1617
|
+
and the actions. Escape and a press outside the box close the picker.
|
|
1614
1618
|
|
|
1615
1619
|
Supply `ChartWidgetOptions.indicatorPicker` to include additional localized collections and rows
|
|
1616
1620
|
in that picker. You supply data and opaque actions, not DOM, indicator definitions, or a renderer.
|
|
1617
1621
|
Built-in annotations can add favorite state, counts and actions; they cannot replace a definition,
|
|
1618
|
-
its name, or Add, and their counts show wherever the list is a table
|
|
1619
|
-
|
|
1622
|
+
its name, or Add, and their counts show wherever the list is a table. Items you answer for the
|
|
1623
|
+
`builtin` collection list in Technicals after the shipped definitions, so a kind of your own (see
|
|
1624
|
+
`kinds` below) can stand beside the chart's indicators there. Without a source, the picker has only
|
|
1625
|
+
shipped built-ins and Favorites.
|
|
1620
1626
|
|
|
1621
1627
|
```ts
|
|
1622
1628
|
import type { IndicatorPickerSource } from '@trdrs/quickcharts'
|
|
@@ -1679,6 +1685,23 @@ const withTemplates: IndicatorPickerSource = {
|
|
|
1679
1685
|
}
|
|
1680
1686
|
```
|
|
1681
1687
|
|
|
1688
|
+
A collection can carry an `empty` state for the list to show while it lists nothing and no search
|
|
1689
|
+
is typed: a `title`, optional `text`, an optional `icon` drawn 120px square from the same 28-unit
|
|
1690
|
+
grid as every contributed glyph, and an optional `action`, a button whose press reaches `act` with
|
|
1691
|
+
the target `{ kind: 'collection', id }`. The kind filters step aside while it shows. Without one, an
|
|
1692
|
+
empty collection reads the chart's own no-matches line.
|
|
1693
|
+
|
|
1694
|
+
```ts
|
|
1695
|
+
import type { IndicatorPickerCollection } from '@trdrs/quickcharts'
|
|
1696
|
+
|
|
1697
|
+
const scripts: IndicatorPickerCollection = {
|
|
1698
|
+
id: 'scripts',
|
|
1699
|
+
label: 'My scripts',
|
|
1700
|
+
layout: 'list',
|
|
1701
|
+
empty: { title: 'No scripts yet', text: 'Write one and it lists here.', action: { id: 'create', label: 'Create script' } },
|
|
1702
|
+
}
|
|
1703
|
+
```
|
|
1704
|
+
|
|
1682
1705
|
A favorite action receives the requested next boolean. Successful actions refresh the current
|
|
1683
1706
|
collection unless they return `close: true`. Refusals and exceptions keep the picker open with
|
|
1684
1707
|
plain text, never rendered markup. Icons reuse `ChartExtensionIcon`; invalid icons draw no glyph.
|
|
@@ -2365,6 +2388,14 @@ watermark and the scale text and lines) follow the mode. A switch of mode hands
|
|
|
2365
2388
|
of them back to the new mode's look, and keeps every other leaf. A saved chart states the mode they
|
|
2366
2389
|
were chosen in (`settingsMode`), so a chart opened in the other mode takes that mode's look for them.
|
|
2367
2390
|
|
|
2391
|
+
What is drawn over the canvas reads its ink from the canvas's lightness. Where the canvas a chart's
|
|
2392
|
+
settings land on has the other mode's lightness, such as a white canvas in dark mode or a black one in
|
|
2393
|
+
light mode, everything over the plot (the legend, the price and time scales' boxes and buttons, the
|
|
2394
|
+
pane and navigation buttons and the corner mark) wears that mode's built-in colors, and the factory
|
|
2395
|
+
scale text and lines, grid and watermark are that mode's, so they read dark on a light canvas and
|
|
2396
|
+
light on a dark one. A color the host or the viewer named stays theirs. A gradient canvas is weighed
|
|
2397
|
+
by its top color, the one the legend stands on.
|
|
2398
|
+
|
|
2368
2399
|
## Chart settings
|
|
2369
2400
|
|
|
2370
2401
|
`chart.settings()` answers the effective tree; `chart.applySettings(partial)` layers a partial over
|
|
@@ -2427,7 +2458,12 @@ the same in both modes, in `CHART_FACTORY_COLORS`. The sections and what stands
|
|
|
2427
2458
|
scale between framing itself and holding where it was dragged, and "L" between a regular and a
|
|
2428
2459
|
logarithmic scale, each the chart's own verb. The currency and unit box (`currencyAndUnit`)
|
|
2429
2460
|
names what the symbol's prices are in (its `currencyCode` and `unitId`) at the top of the main
|
|
2430
|
-
scale on the same terms, and shows nothing for a symbol that states neither.
|
|
2461
|
+
scale on the same terms, and shows nothing for a symbol that states neither. With the widget's
|
|
2462
|
+
`scaleUnitMenu` option the box is a button titled with the setting's name: a press hands your
|
|
2463
|
+
handler a `ScaleUnitMenuRequest` (the chart, the box's place in viewport pixels, and whether the
|
|
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
|
|
2466
|
+
the scale under it still drags. The price-to-bar
|
|
2431
2467
|
ratio lock (`lockPriceToBarRatio`) holds the price one bar's width spans: engaging it with no
|
|
2432
2468
|
`priceToBarRatio` of its own takes the ratio on screen into that leaf, the scale stops framing
|
|
2433
2469
|
itself, and every zoom of the time scale rescales the price axis by the same factor about its
|
|
@@ -10999,6 +10999,32 @@ function parseCssColor(input) {
|
|
|
10999
10999
|
const clamp = (n, hi) => Math.min(hi, Math.max(0, n));
|
|
11000
11000
|
return { r: clamp(Math.round(rgb[0]), 255), g: clamp(Math.round(rgb[1]), 255), b: clamp(Math.round(rgb[2]), 255), a: clamp(a, 1) };
|
|
11001
11001
|
}
|
|
11002
|
+
function compositeOver(front, back) {
|
|
11003
|
+
if (front.a >= 1) return { ...front, a: 1 };
|
|
11004
|
+
const mix = (f, b) => Math.round(f * front.a + b * (1 - front.a));
|
|
11005
|
+
return { r: mix(front.r, back.r), g: mix(front.g, back.g), b: mix(front.b, back.b), a: 1 };
|
|
11006
|
+
}
|
|
11007
|
+
function relativeLuminance(c) {
|
|
11008
|
+
const linear = (v) => {
|
|
11009
|
+
const s = v / 255;
|
|
11010
|
+
return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
11011
|
+
};
|
|
11012
|
+
return 0.2126 * linear(c.r) + 0.7152 * linear(c.g) + 0.0722 * linear(c.b);
|
|
11013
|
+
}
|
|
11014
|
+
var WHITE = { r: 255, g: 255, b: 255, a: 1 };
|
|
11015
|
+
function contrastRatio(foreground, background, beneath) {
|
|
11016
|
+
const back = compositeOver(background, beneath ? compositeOver(beneath, WHITE) : WHITE);
|
|
11017
|
+
const front = compositeOver(foreground, back);
|
|
11018
|
+
const [hi, lo] = [relativeLuminance(front), relativeLuminance(back)].sort((a, b) => b - a);
|
|
11019
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
11020
|
+
}
|
|
11021
|
+
function contrastOf(foreground, background, beneath) {
|
|
11022
|
+
const f = parseCssColor(foreground);
|
|
11023
|
+
const b = parseCssColor(background);
|
|
11024
|
+
const under = beneath === void 0 ? void 0 : parseCssColor(beneath);
|
|
11025
|
+
if (!f || !b || under === null) return null;
|
|
11026
|
+
return contrastRatio(f, b, under);
|
|
11027
|
+
}
|
|
11002
11028
|
|
|
11003
11029
|
// src/ui/controls/color/palette.ts
|
|
11004
11030
|
var to2 = (n) => Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, "0");
|
|
@@ -12018,6 +12044,7 @@ export {
|
|
|
12018
12044
|
BRAND_UP,
|
|
12019
12045
|
BRAND_DOWN,
|
|
12020
12046
|
parseCssColor,
|
|
12047
|
+
contrastOf,
|
|
12021
12048
|
DEFAULT_VISIBILITY,
|
|
12022
12049
|
visibilityPreset,
|
|
12023
12050
|
parseTimeframeContext,
|
|
@@ -12157,4 +12184,4 @@ export {
|
|
|
12157
12184
|
fitScale,
|
|
12158
12185
|
fittedSize
|
|
12159
12186
|
};
|
|
12160
|
-
//# sourceMappingURL=chunk-
|
|
12187
|
+
//# sourceMappingURL=chunk-ETG46YGK.js.map
|