@stellar-expert/ui-framework 1.21.1 → 1.21.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.
Files changed (76) hide show
  1. package/account/account-address.js +6 -6
  2. package/account/signer-key.js +1 -1
  3. package/api/explorer-api-hooks.js +4 -4
  4. package/api/explorer-api-paginated-list-hooks.js +4 -4
  5. package/api/explorer-tx-api.js +3 -3
  6. package/api/ledger-stream.js +2 -2
  7. package/asset/amount.js +2 -2
  8. package/asset/asset-icon.js +2 -2
  9. package/asset/asset-issuer.js +2 -2
  10. package/asset/asset-link.js +6 -6
  11. package/asset/asset-list-hooks.js +3 -3
  12. package/asset/asset-meta-hooks.js +3 -3
  13. package/asset/asset-selector.js +3 -3
  14. package/charts/axis/axis.js +24 -4
  15. package/charts/axis/tick-positioner.js +1 -1
  16. package/charts/chart-default-options.js +1 -1
  17. package/charts/chart-options-builder.js +2 -2
  18. package/charts/chart.js +5 -5
  19. package/charts/core/animate.js +1 -1
  20. package/charts/core/chart.js +25 -15
  21. package/charts/core/options.js +1 -1
  22. package/charts/globals.js +5 -5
  23. package/charts/index.js +2 -2
  24. package/charts/interaction/tooltip.js +2 -2
  25. package/charts/pie/pie-chart.js +2 -2
  26. package/charts/polar/polar-chart.js +2 -2
  27. package/charts/series/area-series.js +3 -3
  28. package/charts/series/candlestick-series.js +3 -3
  29. package/charts/series/column-series.js +3 -3
  30. package/charts/series/index.js +4 -4
  31. package/charts/series/line-series.js +3 -3
  32. package/charts/series/series.js +1 -1
  33. package/charts/stock/data-grouping.js +1 -1
  34. package/charts/stock/navigator.js +33 -5
  35. package/charts/stock/range-selector.js +25 -3
  36. package/claimable-balance/claimable-balance-claimants.js +2 -2
  37. package/claimable-balance/claimable-balance-id.js +1 -1
  38. package/contract/contract-api.js +2 -2
  39. package/contract/invocation-info-view.js +6 -6
  40. package/contract/sc-val.js +1 -1
  41. package/controls/dropdown.js +1 -1
  42. package/controls/info-tooltip.js +1 -1
  43. package/controls/tabs.js +1 -1
  44. package/controls/update-highlighter.js +1 -1
  45. package/date/utc-timestamp.js +28 -28
  46. package/directory/directory-hooks.js +2 -2
  47. package/effect/effect-description.js +9 -9
  48. package/effect/op-effects-view.js +57 -57
  49. package/errors/error-boundary.js +1 -1
  50. package/filter/editors/account-filter-view.js +2 -2
  51. package/filter/editors/asset-filter-view.js +2 -2
  52. package/filter/editors/timestamp-filter-view.js +3 -3
  53. package/filter/editors/type-filter-view.js +1 -1
  54. package/filter/filter-editors.js +6 -6
  55. package/filter/filter-view.js +2 -2
  56. package/horizon/horizon-account-helpers.js +1 -1
  57. package/horizon/horizon-ledger-helpers.js +1 -1
  58. package/horizon/horizon-orderbook-helpers.js +14 -14
  59. package/horizon/horizon-trades-helper.js +1 -1
  60. package/horizon/horizon-transaction-helpers.js +1 -1
  61. package/index.js +73 -73
  62. package/interaction/system-dialog.js +2 -2
  63. package/interaction/theme-selector.js +1 -1
  64. package/ledger/ledger-entry-href-formatter.js +1 -1
  65. package/ledger/ledger-entry-link.js +2 -2
  66. package/module/dynamic-module.js +1 -1
  67. package/package.json +2 -3
  68. package/state/page-visibility-hooks.js +1 -1
  69. package/toast/toast-notifications-block.js +2 -2
  70. package/tx/op-accounting-changes.js +26 -26
  71. package/tx/op-description-view.js +13 -13
  72. package/tx/parser/tx-details-parser.js +2 -2
  73. package/tx/parser/tx-matcher.js +1 -1
  74. package/tx/tx-fee-effect.js +13 -13
  75. package/tx/tx-list-hooks.js +2 -2
  76. package/tx/tx-operations-list.js +6 -6
@@ -1,12 +1,12 @@
1
1
  import React from 'react'
2
2
  import cn from 'classnames'
3
3
  import {shortenString} from '@stellar-expert/formatter'
4
- import {AccountIdenticon} from './identicon.js'
5
- import {InfoTooltip} from '../controls/info-tooltip.js'
6
- import {useDirectory} from '../directory/directory-hooks.js'
7
- import {formatExplorerLink} from '../ledger/ledger-entry-href-formatter.js'
8
- import {useStellarNetwork} from '../state/stellar-network-hooks.js'
9
- import {decodeKeyType} from '../stellar/key-type.js'
4
+ import {AccountIdenticon} from './identicon'
5
+ import {InfoTooltip} from '../controls/info-tooltip'
6
+ import {useDirectory} from '../directory/directory-hooks'
7
+ import {formatExplorerLink} from '../ledger/ledger-entry-href-formatter'
8
+ import {useStellarNetwork} from '../state/stellar-network-hooks'
9
+ import {decodeKeyType} from '../stellar/key-type'
10
10
  import './account-address.scss'
11
11
 
12
12
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import {StrKey} from '@stellar/stellar-sdk'
3
- import {AccountAddress} from './account-address.js'
3
+ import {AccountAddress} from './account-address'
4
4
 
5
5
  /**
6
6
  * Decode a Stellar signer object (XDR or parsed) into a StrKey-encoded key and weight
@@ -1,10 +1,10 @@
1
1
  import {useEffect, useState} from 'react'
2
2
  import isEqual from 'react-fast-compare'
3
3
  import {stringifyQuery} from '@stellar-expert/navigation'
4
- import {addVisibilityChangeListener, isDocumentVisible} from '../state/page-visibility-helpers.js'
5
- import {useStellarNetwork} from '../state/stellar-network-hooks.js'
6
- import {fetchExplorerApi} from './explorer-api-call.js'
7
- import apiCache from './api-cache.js'
4
+ import {addVisibilityChangeListener, isDocumentVisible} from '../state/page-visibility-helpers'
5
+ import {useStellarNetwork} from '../state/stellar-network-hooks'
6
+ import {fetchExplorerApi} from './explorer-api-call'
7
+ import apiCache from './api-cache'
8
8
 
9
9
  export class ExplorerApiResult {
10
10
  constructor(apiEndpoint, data, ts) {
@@ -1,10 +1,10 @@
1
1
  import {useRef} from 'react'
2
2
  import isEqual from 'react-fast-compare'
3
3
  import {parseQuery, stringifyQuery, navigation} from '@stellar-expert/navigation'
4
- import {useStellarNetwork} from '../state/stellar-network-hooks.js'
5
- import {useDependantState} from '../state/state-hooks.js'
6
- import {fetchExplorerApi} from './explorer-api-call.js'
7
- import apiCache from './api-cache.js'
4
+ import {useStellarNetwork} from '../state/stellar-network-hooks'
5
+ import {useDependantState} from '../state/state-hooks'
6
+ import {fetchExplorerApi} from './explorer-api-call'
7
+ import apiCache from './api-cache'
8
8
 
9
9
  function inverseOrder(order) {
10
10
  return order === 'desc' ? 'asc' : 'desc'
@@ -1,6 +1,6 @@
1
- import {parseStellarGenericId} from '../stellar/ledger-generic-id.js'
2
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks.js'
3
- import {fetchExplorerApi} from './explorer-api-call.js'
1
+ import {parseStellarGenericId} from '../stellar/ledger-generic-id'
2
+ import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
3
+ import {fetchExplorerApi} from './explorer-api-call'
4
4
 
5
5
  /**
6
6
  * Load transaction from API
@@ -1,5 +1,5 @@
1
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks.js'
2
- import {fetchExplorerApi} from './explorer-api-call.js'
1
+ import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
2
+ import {fetchExplorerApi} from './explorer-api-call'
3
3
 
4
4
  /**
5
5
  * Long-polling stream that notifies listeners about new ledgers
package/asset/amount.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import {formatWithPrecision, formatWithAutoPrecision, fromStroops} from '@stellar-expert/formatter'
3
3
  import {AssetDescriptor, isAssetValid, isValidPoolId} from '@stellar-expert/asset-descriptor'
4
- import {useAssetMeta} from './asset-meta-hooks.js'
5
- import {AssetLink} from './asset-link.js'
4
+ import {useAssetMeta} from './asset-meta-hooks'
5
+ import {AssetLink} from './asset-link'
6
6
 
7
7
  /**
8
8
  * Formatted tokens amount
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import {AssetDescriptor} from '@stellar-expert/asset-descriptor'
3
- import {drawIdenticon} from '../account/identicon.js'
4
- import {useAssetMeta} from './asset-meta-hooks.js'
3
+ import {drawIdenticon} from '../account/identicon'
4
+ import {useAssetMeta} from './asset-meta-hooks'
5
5
 
6
6
  /**
7
7
  * Inline asset icon
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import {AssetDescriptor} from '@stellar-expert/asset-descriptor'
3
- import {AccountAddress} from '../account/account-address.js'
4
- import {useAssetMeta} from './asset-meta-hooks.js'
3
+ import {AccountAddress} from '../account/account-address'
4
+ import {useAssetMeta} from './asset-meta-hooks'
5
5
 
6
6
  /**
7
7
  * Inline asset issuer
@@ -2,12 +2,12 @@ import React from 'react'
2
2
  import cn from 'classnames'
3
3
  import {shortenString} from '@stellar-expert/formatter'
4
4
  import {AssetDescriptor} from '@stellar-expert/asset-descriptor'
5
- import {useStellarNetwork} from '../state/stellar-network-hooks.js'
6
- import {formatExplorerLink} from '../ledger/ledger-entry-href-formatter.js'
7
- import {AccountAddress} from '../account/account-address.js'
8
- import {useAssetMeta} from './asset-meta-hooks.js'
9
- import {AssetIcon} from './asset-icon.js'
10
- import {AssetIssuer} from './asset-issuer.js'
5
+ import {useStellarNetwork} from '../state/stellar-network-hooks'
6
+ import {formatExplorerLink} from '../ledger/ledger-entry-href-formatter'
7
+ import {AccountAddress} from '../account/account-address'
8
+ import {useAssetMeta} from './asset-meta-hooks'
9
+ import {AssetIcon} from './asset-icon'
10
+ import {AssetIssuer} from './asset-issuer'
11
11
  import './asset-link.scss'
12
12
 
13
13
  /**
@@ -2,9 +2,9 @@ import React, {useState} from 'react'
2
2
  import {throttle} from 'throttle-debounce'
3
3
  import equal from 'react-fast-compare'
4
4
  import {stringifyQuery} from '@stellar-expert/navigation'
5
- import {fetchExplorerApi} from '../api/explorer-api-call.js'
6
- import {useDeepEffect} from '../state/state-hooks.js'
7
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks.js'
5
+ import {fetchExplorerApi} from '../api/explorer-api-call'
6
+ import {useDeepEffect} from '../state/state-hooks'
7
+ import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
8
8
 
9
9
  const defaults = {
10
10
  limit: 20,
@@ -2,9 +2,9 @@ import {useEffect, useState} from 'react'
2
2
  import {AssetDescriptor} from '@stellar-expert/asset-descriptor'
3
3
  import {stringifyQuery} from '@stellar-expert/navigation'
4
4
  import {InMemoryClientCache} from '@stellar-expert/client-cache'
5
- import {fetchExplorerApi} from '../api/explorer-api-call.js'
6
- import {ExplorerBatchInfoLoader} from '../api/explorer-batch-info-loader.js'
7
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks.js'
5
+ import {fetchExplorerApi} from '../api/explorer-api-call'
6
+ import {ExplorerBatchInfoLoader} from '../api/explorer-batch-info-loader'
7
+ import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
8
8
 
9
9
  /**
10
10
  * @typedef AssetBasicTomlInfo
@@ -1,7 +1,7 @@
1
1
  import React, {useCallback, useRef, useState} from 'react'
2
- import {Dropdown} from '../controls/dropdown.js'
3
- import {AssetLink} from './asset-link.js'
4
- import {useAssetList} from './asset-list-hooks.js'
2
+ import {Dropdown} from '../controls/dropdown'
3
+ import {AssetLink} from './asset-link'
4
+ import {useAssetList} from './asset-list-hooks'
5
5
  import './asset-selector.scss'
6
6
 
7
7
  /**
@@ -1,6 +1,6 @@
1
- import {isNumber, pick, relativeLength, defined} from '../core/utilities.js'
2
- import {getDateTimeTickPositions, dateTimeLabelFormat, dateFormat} from '../core/time.js'
3
- import {getLinearTickPositions, niceAlignedTicks, zeroBasedGridTicks, formatAxisNumber, axisNumberUnit} from './tick-positioner.js'
1
+ import {isNumber, pick, relativeLength, defined} from '../core/utilities'
2
+ import {getDateTimeTickPositions, dateTimeLabelFormat, dateFormat} from '../core/time'
3
+ import {getLinearTickPositions, niceAlignedTicks, zeroBasedGridTicks, formatAxisNumber, axisNumberUnit} from './tick-positioner'
4
4
 
5
5
  const LABEL_FONT = 12
6
6
  const LABEL_FONT_CSS = LABEL_FONT + 'px "Roboto Condensed",sans-serif'
@@ -131,6 +131,21 @@ export class Axis {
131
131
  this.dataMax = dataMax
132
132
  }
133
133
 
134
+ //pixels at the top of the pane that must stay clear of drawn data — the floating range-selector
135
+ //buttons overlay the top ~26px of the plot, so the pane that starts at the plot top scales its
136
+ //max up until the tallest point (incl. candle wicks) renders below the controls
137
+ reservedTopPixels() {
138
+ const c = this.chart
139
+ if (this.isXAxis || c.chartType !== 'StockChart' || !c.options.rangeSelector)
140
+ return 0
141
+ if (!isNumber(this.len) || !isNumber(this.top) || !isNumber(c.plotTop))
142
+ return 0
143
+ //only the top pane sits under the controls; lower panes (e.g. a volume strip) are unaffected
144
+ if (this.top > c.plotTop + 1)
145
+ return 0
146
+ return 26
147
+ }
148
+
134
149
  setScale() {
135
150
  this.getSeriesExtremes()
136
151
  let min = pick(this.userMin, this.dataMin)
@@ -226,7 +241,12 @@ export class Axis {
226
241
  drawn = drawn.slice(0, -1)
227
242
  const nIntervals = drawn.length - 1
228
243
  const dataSteps = r.interval > 0 ? (max - r.min) / r.interval : nIntervals
229
- const M = Math.max(nIntervals + 0.7, dataSteps + 0.15)
244
+ let M = Math.max(nIntervals + 0.7, dataSteps + 0.15)
245
+ //widen the headroom so the data top maps below the reserved zoom-controls band:
246
+ //(M - dataSteps)/M of the pane height must be at least reserve/len
247
+ const reserve = this.reservedTopPixels()
248
+ if (reserve && this.len > reserve * 2)
249
+ M = Math.max(M, dataSteps / (1 - reserve / this.len))
230
250
  this.tickInterval = r.interval
231
251
  this.tickPositions = drawn
232
252
  this.labelledPositions = null
@@ -1,5 +1,5 @@
1
1
  //Linear "nice number" tick interval + positions.
2
- import {addThousandsSep} from '../core/utilities.js'
2
+ import {addThousandsSep} from '../core/utilities'
3
3
 
4
4
  /**
5
5
  * Round an interval to a human-friendly value (1, 2, 2.5, 5, 10 * 10^n).
@@ -1,6 +1,6 @@
1
1
  //StellarExpert explorer chart theme — colors, fonts and per-type defaults applied on top of the
2
2
  //engine baseline via setOptions, plus the custom logarithmic axis scaling used by balance/distribution charts.
3
- import ChartEngine from './globals.js'
3
+ import ChartEngine from './globals'
4
4
 
5
5
  //allow negative values on the logarithmic axis
6
6
  ChartEngine.Axis.prototype.allowNegativeLog = true
@@ -1,7 +1,7 @@
1
1
  //Normalizes per-chart options before they reach the engine: applies grouping/range/legend flags and
2
2
  //registers optional engine modules. Uses the engine's own merge (no deepmerge dependency).
3
- import {merge} from './core/utilities.js'
4
- import {ChartEngine} from './chart-default-options.js'
3
+ import {merge} from './core/utilities'
4
+ import {ChartEngine} from './chart-default-options'
5
5
 
6
6
  const rangeSelectorOptions = {
7
7
  //the in-house range selector renders span controls styled via chart.scss (.chart-zoom-btn);
package/charts/chart.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import React, {useRef} from 'react'
2
2
  import cn from 'classnames'
3
3
  import PropTypes from 'prop-types'
4
- import {useDeepEffect} from '../state/state-hooks.js'
5
- import {withErrorBoundary} from '../errors/error-boundary.js'
6
- import {ChartEngine} from './chart-default-options.js'
7
- import {prepareChartOptions} from './chart-options-builder.js'
8
- import {ChartLoader} from './chart-loader.js'
4
+ import {useDeepEffect} from '../state/state-hooks'
5
+ import {withErrorBoundary} from '../errors/error-boundary'
6
+ import {ChartEngine} from './chart-default-options'
7
+ import {prepareChartOptions} from './chart-options-builder'
8
+ import {ChartLoader} from './chart-loader'
9
9
  import './chart.scss'
10
10
 
11
11
  export {ChartEngine, ChartLoader}
@@ -1,6 +1,6 @@
1
1
  //Load/draw animations for the initial chart render (a per-series-type entrance).
2
2
  //Only runs once, on first paint — redraws (zoom, legend toggle, resize) skip it.
3
- import {uniqueId} from './utilities.js'
3
+ import {uniqueId} from './utilities'
4
4
 
5
5
  export const DEFAULT_DURATION = 1500
6
6
 
@@ -1,16 +1,16 @@
1
- import {Axis} from '../axis/axis.js'
2
- import {niceAlignedTicks} from '../axis/tick-positioner.js'
3
- import {createSeries} from '../series/index.js'
4
- import {Legend} from '../interaction/legend.js'
5
- import {Tooltip} from '../interaction/tooltip.js'
6
- import {groupSeriesData} from '../stock/data-grouping.js'
7
- import {RangeSelector} from '../stock/range-selector.js'
8
- import {renderPolar} from '../polar/polar-chart.js'
9
- import {renderPie} from '../pie/pie-chart.js'
10
- import {Navigator} from '../stock/navigator.js'
11
- import {merge, resolveContainer, pick, relativeLength, uniqueId, defined, isNumber} from './utilities.js'
12
- import {getOptions} from './options.js'
13
- import {SvgRenderer} from './svg-renderer.js'
1
+ import {Axis} from '../axis/axis'
2
+ import {niceAlignedTicks} from '../axis/tick-positioner'
3
+ import {createSeries} from '../series'
4
+ import {Legend} from '../interaction/legend'
5
+ import {Tooltip} from '../interaction/tooltip'
6
+ import {groupSeriesData} from '../stock/data-grouping'
7
+ import {RangeSelector} from '../stock/range-selector'
8
+ import {renderPolar} from '../polar/polar-chart'
9
+ import {renderPie} from '../pie/pie-chart'
10
+ import {Navigator} from '../stock/navigator'
11
+ import {merge, resolveContainer, pick, relativeLength, uniqueId, defined, isNumber} from './utilities'
12
+ import {getOptions} from './options'
13
+ import {SvgRenderer} from './svg-renderer'
14
14
 
15
15
  const X_LABEL_HEIGHT = 22
16
16
 
@@ -62,9 +62,15 @@ export class Chart {
62
62
  this.hideLoading()
63
63
  const el = document.createElement('div')
64
64
  el.className = 'ix-chart-loading'
65
- el.textContent = text || 'Loading…'
65
+ if (text)
66
+ el.textContent = text
66
67
  Object.assign(el.style, {
67
- position: 'absolute', inset: '0', display: 'flex', alignItems: 'center',
68
+ position: 'absolute',
69
+ left: (this.plotLeft || 0) + 'px',
70
+ top: (this.plotTop || 0) + 'px',
71
+ width: (this.plotWidth || 0) + 'px',
72
+ height: (this.plotHeight || 0) + 'px',
73
+ display: 'flex', alignItems: 'center',
68
74
  justifyContent: 'center', background: 'rgba(0,0,0,0.25)', color: 'var(--color-text)', zIndex: 15
69
75
  })
70
76
  this.container.appendChild(el)
@@ -266,6 +272,10 @@ export class Chart {
266
272
  const nIntervals = s.drawn.length - 1
267
273
  const dataSteps = s.interval > 0 ? (s.dataMax - s.base) / s.interval : nIntervals
268
274
  M = Math.max(M, nIntervals + STEP_HEAD, dataSteps + 0.15)
275
+ //keep the data top below the reserved zoom-controls band (see Axis.reservedTopPixels)
276
+ const reserve = s.a.reservedTopPixels()
277
+ if (reserve && s.a.len > reserve * 2)
278
+ M = Math.max(M, dataSteps / (1 - reserve / s.a.len))
269
279
  }
270
280
  for (const s of specs) {
271
281
  s.a.tickInterval = s.interval
@@ -1,4 +1,4 @@
1
- import {merge} from './utilities.js'
1
+ import {merge} from './utilities'
2
2
 
3
3
  //Engine baseline defaults. The explorer theme (applied via setOptions in chart-default-options.js)
4
4
  //deep-merges on top of this, and per-chart options on top of that.
package/charts/globals.js CHANGED
@@ -1,10 +1,10 @@
1
1
  //The engine namespace exposed to consumers and to the theme/options-builder — the small public
2
2
  //surface (chart constructors, options, Color, Axis, merge) that views and modules touch.
3
- import {Chart} from './core/chart.js'
4
- import {getOptions, setOptions} from './core/options.js'
5
- import {Color} from './core/color.js'
6
- import {Axis} from './axis/axis.js'
7
- import {merge} from './core/utilities.js'
3
+ import {Chart} from './core/chart'
4
+ import {getOptions, setOptions} from './core/options'
5
+ import {Color} from './core/color'
6
+ import {Axis} from './axis/axis'
7
+ import {merge} from './core/utilities'
8
8
 
9
9
  function ChartCtor(renderTo, options) {
10
10
  return new Chart(renderTo, options, 'Chart')
package/charts/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //Pure-JS SVG charting library — public entry point.
2
2
  //Props: options/type/title/grouped/range/noLegend/inline/modules/children.
3
- export {default} from './chart.js'
4
- export {ChartEngine, ChartLoader} from './chart.js'
3
+ export {default} from './chart'
4
+ export {ChartEngine, ChartLoader} from './chart'
@@ -1,5 +1,5 @@
1
- import {dateFormat} from '../core/time.js'
2
- import {isNumber, addThousandsSep} from '../core/utilities.js'
1
+ import {dateFormat} from '../core/time'
2
+ import {isNumber, addThousandsSep} from '../core/utilities'
3
3
 
4
4
  function formatValue(v, tooltipOpts) {
5
5
  if (!isNumber(v))
@@ -1,7 +1,7 @@
1
1
  //Pie / variable-pie rendering path (contract users chart).
2
2
  //variable-pie: slice ANGLE scales with y, slice OUTER RADIUS scales with z.
3
- import {pick, relativeLength, isNumber, addThousandsSep} from '../core/utilities.js'
4
- import {animate, DEFAULT_DURATION} from '../core/animate.js'
3
+ import {pick, relativeLength, isNumber, addThousandsSep} from '../core/utilities'
4
+ import {animate, DEFAULT_DURATION} from '../core/animate'
5
5
 
6
6
  const TEXT_STYLE = {
7
7
  fontSize: '12px',
@@ -1,7 +1,7 @@
1
1
  //Polar/radar rendering path (asset rating chart): categories around a circle, radial value axis,
2
2
  //polygon gridlines (gridLineInterpolation: 'polygon').
3
- import {pick, relativeLength} from '../core/utilities.js'
4
- import {animateFromCenter} from '../core/animate.js'
3
+ import {pick, relativeLength} from '../core/utilities'
4
+ import {animateFromCenter} from '../core/animate'
5
5
 
6
6
  const TEXT_STYLE = {
7
7
  fontSize: '12px',
@@ -1,6 +1,6 @@
1
- import {pick, uniqueId, isNumber, clamp} from '../core/utilities.js'
2
- import {revealLeftToRight} from '../core/animate.js'
3
- import {LineSeries} from './line-series.js'
1
+ import {pick, uniqueId, isNumber, clamp} from '../core/utilities'
2
+ import {revealLeftToRight} from '../core/animate'
3
+ import {LineSeries} from './line-series'
4
4
 
5
5
  export class AreaSeries extends LineSeries {
6
6
  resolveFill() {
@@ -1,5 +1,5 @@
1
- import {isNumber, pick} from '../core/utilities.js'
2
- import {Series} from './series.js'
1
+ import {isNumber, pick} from '../core/utilities'
2
+ import {Series} from './series'
3
3
 
4
4
  export class CandlestickSeries extends Series {
5
5
  //candlesticks plot OHLC, not a single y; expose extremes from high/low for the axis
@@ -40,7 +40,7 @@ export class CandlestickSeries extends Series {
40
40
  continue
41
41
  const cx = xAxis.toPixels(p.x)
42
42
  const catW = Math.abs(xAxis.toPixels(p.x + pr) - xAxis.toPixels(p.x))
43
- const w = Math.max(1, catW * 0.6)
43
+ const w = Math.max(1.5, catW * 0.8 - 0.5)
44
44
  const up = p.close >= p.open
45
45
  const color = up ? upColor : downColor
46
46
  const yHigh = yAxis.toPixels(p.high)
@@ -1,6 +1,6 @@
1
- import {Series} from './series.js'
2
- import {pick, isNumber, clamp} from '../core/utilities.js'
3
- import {animateColumns} from '../core/animate.js'
1
+ import {Series} from './series'
2
+ import {pick, isNumber, clamp} from '../core/utilities'
3
+ import {animateColumns} from '../core/animate'
4
4
 
5
5
  export class ColumnSeries extends Series {
6
6
  render(group) {
@@ -1,7 +1,7 @@
1
- import {LineSeries} from './line-series.js'
2
- import {AreaSeries} from './area-series.js'
3
- import {ColumnSeries} from './column-series.js'
4
- import {CandlestickSeries} from './candlestick-series.js'
1
+ import {LineSeries} from './line-series'
2
+ import {AreaSeries} from './area-series'
3
+ import {ColumnSeries} from './column-series'
4
+ import {CandlestickSeries} from './candlestick-series'
5
5
 
6
6
  //series type registry — extended in later phases (spline-smoothing, candlestick, variablepie, ...)
7
7
  export const seriesTypes = {
@@ -1,6 +1,6 @@
1
- import {pick} from '../core/utilities.js'
2
- import {revealLeftToRight} from '../core/animate.js'
3
- import {Series} from './series.js'
1
+ import {pick} from '../core/utilities'
2
+ import {revealLeftToRight} from '../core/animate'
3
+ import {Series} from './series'
4
4
 
5
5
  export class LineSeries extends Series {
6
6
  render(group) {
@@ -1,4 +1,4 @@
1
- import {pick, isNumber} from '../core/utilities.js'
1
+ import {pick, isNumber} from '../core/utilities'
2
2
 
3
3
  //Catmull-Rom -> cubic bezier smoothing for spline series
4
4
  function smoothSegmentPath(pts) {
@@ -1,5 +1,5 @@
1
1
  //Downsample raw series points into calendar-aligned time buckets (stock data grouping).
2
- import {isNumber} from '../core/utilities.js'
2
+ import {isNumber} from '../core/utilities'
3
3
 
4
4
  const day = 24 * 3600 * 1000
5
5
  const week = 7 * day
@@ -1,6 +1,6 @@
1
- import {isNumber, clamp} from '../core/utilities.js'
2
- import {animateLineDraw} from '../core/animate.js'
3
- import {getDateTimeTickPositions, dateTimeLabelFormat, dateFormat} from '../core/time.js'
1
+ import {isNumber, clamp} from '../core/utilities'
2
+ import {animateLineDraw} from '../core/animate'
3
+ import {getDateTimeTickPositions, dateTimeLabelFormat, dateFormat} from '../core/time'
4
4
 
5
5
  //Navigator look: a thin red overview line, the SELECTED window masked with a light fill,
6
6
  //a light outline, and small grip handles centred vertically on each edge.
@@ -57,7 +57,8 @@ export class Navigator {
57
57
  const yToPx = v => top + height - ((v - yMin) / ((yMax - yMin) || 1)) * (height - 4) - 2
58
58
 
59
59
  //faint background
60
- renderer.rect(left, top, width, height, {}).css({fill: 'var(--color-border-shadow)', 'fill-opacity': 0.15}).add(group)
60
+ const bg = renderer.rect(left, top, width, height, {}).css({fill: 'var(--color-border-shadow)', 'fill-opacity': 0.15, cursor: 'pointer'}).add(group)
61
+ this.bindBackground(bg)
61
62
  //time breakpoints across the full overview range, so it's clear where the selected window sits
62
63
  this.renderTimeAxis(group, top, height, dMin, dMax, xToPx)
63
64
  //overview as a thin line (no fill)
@@ -70,7 +71,7 @@ export class Navigator {
70
71
  started = true
71
72
  }
72
73
  }
73
- const lineEl = renderer.path(d.trim(), {'stroke-width': 1, fill: 'none'}).css({stroke: NAV_LINE}).add(group)
74
+ const lineEl = renderer.path(d.trim(), {'stroke-width': 1, fill: 'none'}).css({stroke: NAV_LINE, 'pointer-events': 'none'}).add(group)
74
75
 
75
76
  //selection window edges (clamped into the strip) — use the LOGICAL extremes (pre display-padding)
76
77
  const x0 = clamp(xToPx(viewMin(xAxis)), left, left + width)
@@ -131,6 +132,33 @@ export class Navigator {
131
132
  return rect
132
133
  }
133
134
 
135
+ //click on the unselected part of the strip: move the selection window (same span) so it centers
136
+ //on the clicked date, clamped to the data edges
137
+ bindBackground(bg) {
138
+ const chart = this.chart
139
+ const xAxis = chart.xAxis[0]
140
+ bg.on('mousedown', e => {
141
+ e.preventDefault()
142
+ const svg = chart.renderer.root.element
143
+ const rect = svg.getBoundingClientRect()
144
+ const scaleX = chart.chartWidth / rect.width
145
+ const px = (e.clientX - rect.left) * scaleX
146
+ const v = this.dataMin + ((px - this.left) / this.width) * (this.dataMax - this.dataMin)
147
+ const span = viewMax(xAxis) - viewMin(xAxis)
148
+ let min = v - span / 2
149
+ let max = v + span / 2
150
+ if (min < this.dataMin) {
151
+ min = this.dataMin
152
+ max = min + span
153
+ }
154
+ if (max > this.dataMax) {
155
+ max = this.dataMax
156
+ min = max - span
157
+ }
158
+ xAxis.setExtremes(min, max)
159
+ })
160
+ }
161
+
134
162
  bindBand(band) {
135
163
  const chart = this.chart
136
164
  const xAxis = chart.xAxis[0]
@@ -1,4 +1,4 @@
1
- import {isNumber} from '../core/utilities.js'
1
+ import {isNumber} from '../core/utilities'
2
2
 
3
3
  const DAY = 24 * 3600 * 1000
4
4
 
@@ -88,18 +88,40 @@ export class RangeSelector {
88
88
  this.zoomLabel.style.display = compact ? 'none' : ''
89
89
  }
90
90
 
91
+ //full data range, unioned with the navigator's own series. Views that lazy-load data on zoom replace
92
+ //the main series with just the visible sub-window (keeping the full lifespan only in navigator.series),
93
+ //so the axis' dataMin/dataMax shrink to the loaded slice — anchoring the buttons on those would make
94
+ //'All' re-select the current window instead of the whole history
95
+ getUnionExtremes() {
96
+ const xAxis = this.chart.xAxis[0]
97
+ let {dataMin, dataMax} = xAxis
98
+ const navSeries = this.chart.options.navigator && this.chart.options.navigator.series
99
+ const navData = navSeries && navSeries.data
100
+ if (navData && navData.length) {
101
+ for (const p of navData) {
102
+ const x = Array.isArray(p) ? p[0] : p && p.x
103
+ if (!isNumber(x))
104
+ continue
105
+ if (!isNumber(dataMin) || x < dataMin) dataMin = x
106
+ if (!isNumber(dataMax) || x > dataMax) dataMax = x
107
+ }
108
+ }
109
+ return {dataMin, dataMax}
110
+ }
111
+
91
112
  apply(b, i) {
92
113
  const xAxis = this.chart.xAxis[0]
114
+ const {dataMin, dataMax} = this.getUnionExtremes()
93
115
  if (b.type === 'all') {
94
116
  this.selected = 'all'
95
117
  //explicit full extremes so the initial xAxis.range window doesn't re-apply
96
- xAxis.setExtremes(xAxis.dataMin, xAxis.dataMax)
118
+ xAxis.setExtremes(dataMin, dataMax)
97
119
  } else {
98
120
  const count = b.count || 1
99
121
  //the window always ENDS at the last data point; going back a calendar
100
122
  //month/year/day for the start. Anchoring the end on dataMax keeps the right edge flush with the
101
123
  //data instead of snapping forward to the next month boundary (which left a gap on the right).
102
- const max = xAxis.dataMax
124
+ const max = dataMax
103
125
  const d = new Date(max)
104
126
  if (b.type === 'year')
105
127
  d.setUTCFullYear(d.getUTCFullYear() - count)
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import {xdrParseClaimant} from '@stellar-expert/claimable-balance-utils'
3
- import {AccountAddress} from '../account/account-address.js'
4
- import {CodeBlock} from '../controls/code-block.js'
3
+ import {AccountAddress} from '../account/account-address'
4
+ import {CodeBlock} from '../controls/code-block'
5
5
 
6
6
  /**
7
7
  * Displays a list of claimable balance claimants with their addresses and predicates
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import {shortenString} from '@stellar-expert/formatter'
3
- import {formatExplorerLink} from '../ledger/ledger-entry-href-formatter.js'
3
+ import {formatExplorerLink} from '../ledger/ledger-entry-href-formatter'
4
4
 
5
5
  export function ClaimableBalanceId({balance}) {
6
6
  if (!balance)
@@ -1,6 +1,6 @@
1
1
  import {useEffect, useState} from 'react'
2
- import {useExplorerApi} from '../api/explorer-api-hooks.js'
3
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks.js'
2
+ import {useExplorerApi} from '../api/explorer-api-hooks'
3
+ import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
4
4
 
5
5
  /**
6
6
  * React hook that fetches contract information from the Explorer API