minerva-design 1.6.1 → 1.7.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.
@@ -12,6 +12,11 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
12
12
  colorScale: import('vue').PropType<import('../../../charts/core.js').OrderBookHeatmapScale>;
13
13
  contrast: NumberConstructor;
14
14
  maxSize: NumberConstructor;
15
+ sizeUnit: StringConstructor;
16
+ legend: {
17
+ readonly type: BooleanConstructor;
18
+ readonly default: undefined;
19
+ };
15
20
  colors: import('vue').PropType<readonly string[]>;
16
21
  bubbles: {
17
22
  readonly type: BooleanConstructor;
@@ -71,6 +76,11 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
71
76
  colorScale: import('vue').PropType<import('../../../charts/core.js').OrderBookHeatmapScale>;
72
77
  contrast: NumberConstructor;
73
78
  maxSize: NumberConstructor;
79
+ sizeUnit: StringConstructor;
80
+ legend: {
81
+ readonly type: BooleanConstructor;
82
+ readonly default: undefined;
83
+ };
74
84
  colors: import('vue').PropType<readonly string[]>;
75
85
  bubbles: {
76
86
  readonly type: BooleanConstructor;
@@ -120,6 +130,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
120
130
  onFollowChange?: ((follow: boolean) => any) | undefined;
121
131
  }>, {
122
132
  tooltip: boolean;
133
+ legend: boolean;
123
134
  bubbles: boolean;
124
135
  interactive: boolean;
125
136
  deep: boolean;
@@ -196,6 +196,13 @@ export declare const orderBookHeatmapProps: {
196
196
  contrast: NumberConstructor;
197
197
  /** Size drawn with the last color; follows the data by default */
198
198
  maxSize: NumberConstructor;
199
+ /** Unit after the sizes of the legend and tooltip, e.g. "BTC" */
200
+ sizeUnit: StringConstructor;
201
+ /** Color legend with its size range at the top left (default `true`) */
202
+ legend: {
203
+ readonly type: BooleanConstructor;
204
+ readonly default: undefined;
205
+ };
199
206
  /** Colors from no liquidity to `maxSize` (any CSS colors) */
200
207
  colors: PropType<readonly string[]>;
201
208
  /** Trades as bubbles (default `true`) */
@@ -72,6 +72,8 @@ var a = {
72
72
  colorScale: String,
73
73
  contrast: Number,
74
74
  maxSize: Number,
75
+ sizeUnit: String,
76
+ legend: a,
75
77
  colors: Array,
76
78
  bubbles: a,
77
79
  bubbleSize: Number,
@@ -1 +1 @@
1
- {"version":3,"file":"orderbook.js","names":["optionalBoolean","commonProps","chartFrameProps","depthChartProps","orderBookProps","orderBookHeatmapProps","timeAndSalesProps","STREAMED","useBookWidget","previous","feed","list","raw","props","before","trades","n","engine","useChartEngine","factory","definedOptions","instance","bind","watch","book"],"sources":["../../../../../vue/src/components/Chart/orderbook.ts"],"sourcesContent":["import { watch, type PropType } from \"vue\";\nimport type {\n ChartRendererPreference,\n ChartTimeZone,\n DepthChartLabels,\n DepthChartPriceLine,\n OrderBookColorConvention,\n OrderBookDelta,\n OrderBookHeatmapLabels,\n OrderBookHeatmapScale,\n OrderBookLabels,\n OrderBookMode,\n OrderBookSnapshot,\n TimeAndSalesColumn,\n TimeAndSalesLabels,\n} from \"minerva-design/charts/core\";\nimport { raw, useChartEngine, type EngineInstance } from \"./engine\";\nimport { chartFrameProps } from \"./props\";\nimport { definedOptions } from \"./trading\";\nimport type { ChartTrades } from \"./types\";\n\nconst optionalBoolean = { type: Boolean, default: undefined } as const;\n\n/** Options shared by the order book components */\nconst commonProps = {\n ...chartFrameProps,\n /** Color of the bids / buys (any CSS color); from `colorConvention` by default */\n upColor: String,\n /** Color of the asks / sells */\n downColor: String,\n /** `red-up` swaps the default colors (default `green-up`) */\n colorConvention: String as PropType<OrderBookColorConvention>,\n /** Decimals of the prices; detected from the data by default */\n pricePrecision: Number,\n /** Decimals of the sizes; detected from the data by default */\n sizePrecision: Number,\n /** Locale of the numbers and texts (`\"zh-CN\"`); the page language by default */\n locale: String,\n /** Formats the prices; overrides `pricePrecision` */\n formatPrice: Function as PropType<(price: number) => string>,\n /** Formats the sizes; overrides `sizePrecision` */\n formatSize: Function as PropType<(size: number) => string>,\n /** Font family of the texts (default: the theme font) */\n fontFamily: String,\n /** Font size of the texts, in pixels (default 12) */\n fontSize: Number,\n /** Accessible label */\n ariaLabel: String,\n};\n\n/** Props of DepthChart */\nexport const depthChartProps = {\n ...commonProps,\n /** Book to draw, applied when the object changes (stream updates through the handle's `applyDeltas`) */\n book: Object as PropType<OrderBookSnapshot>,\n /** Visible range on each side of the mid price, as a fraction of the mid; fits the book by default */\n range: Number,\n /** Smallest and largest `range` reachable by zooming (default `[0.0005, 0.5]`) */\n rangeLimits: Array as unknown as PropType<readonly [number, number]>,\n /** Zoom around the mid with the wheel / pinch (default `true`) */\n zoomable: optionalBoolean,\n /** Stepped or straight curves (default `step`) */\n curve: String as PropType<\"step\" | \"linear\">,\n /** Cumulative amount in the base asset or the quote notional (default `base`) */\n amount: String as PropType<\"base\" | \"quote\">,\n /** Eased transitions between books (default `true`) */\n animate: optionalBoolean,\n /** Opacity of the areas, 0-1 (default 0.28) */\n fillOpacity: Number,\n /** Line and label at the mid price (default `true`) */\n midLine: optionalBoolean,\n /** Legend with the spread (default `true`) */\n legend: optionalBoolean,\n /** Grid lines (default `true`) */\n grid: optionalBoolean,\n /** Price and amount axes (default `true`) */\n axes: optionalBoolean,\n /** Hover readout (default `true`) */\n tooltip: optionalBoolean,\n /** Mirrored readout on the other side (default `true`) */\n mirror: optionalBoolean,\n /** Reference lines at prices (an order, a liquidation) */\n priceLines: Array as PropType<readonly DepthChartPriceLine[]>,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<DepthChartLabels>>,\n};\n\n/** Props of OrderBook */\nexport const orderBookProps = {\n ...commonProps,\n /** Book to draw, applied when the object changes (stream updates through the handle's `applyDeltas`) */\n book: Object as PropType<OrderBookSnapshot>,\n /** Price of the spread row, colored by its last move; the mid price when omitted */\n lastPrice: { type: Number as PropType<number | null>, default: undefined },\n /** Sides shown (default `both`) */\n mode: String as PropType<OrderBookMode>,\n /** Price step the levels are grouped by (default 0: none) */\n grouping: Number,\n /** Rows per side; fills the height by default */\n rows: Number,\n /** Height of a row, in pixels (default 20) */\n rowHeight: Number,\n /** Depth bars behind the rows (default `cumulative`) */\n depthBars: String as PropType<\"cumulative\" | \"level\" | \"none\">,\n /** Total column in the base asset or the quote notional (default `base`) */\n total: String as PropType<\"base\" | \"quote\">,\n /** Columns, in order (default `[\"price\", \"size\", \"total\"]`) */\n columns: Array as PropType<readonly (\"price\" | \"size\" | \"total\")[]>,\n /** Flashes the changed sizes (default `true`) */\n flash: optionalBoolean,\n /** Duration of a flash, in ms (default 450) */\n flashDuration: Number,\n /** Highlights the levels at or above this size */\n largeOrderThreshold: Number,\n /** Column headers (default `true`) */\n header: optionalBoolean,\n /** Spread row between the sides (default `true`) */\n spreadRow: optionalBoolean,\n /** Bid / ask imbalance bar (default `true`) */\n imbalance: optionalBoolean,\n /** Hover summary of the cumulative levels (default `true`) */\n tooltip: optionalBoolean,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<OrderBookLabels>>,\n};\n\n/** Props of OrderBookHeatmap */\nexport const orderBookHeatmapProps = {\n ...commonProps,\n /** Book, applied when the object changes (stream updates through the handle's `applyDeltas`) */\n book: Object as PropType<OrderBookSnapshot>,\n /** Trades; when the array grows, only the appended ones are added */\n trades: Array as PropType<ChartTrades>,\n /** Price step of the rows; detected from the book by default */\n tickSize: Number,\n /** Duration of a column, in ms (default 100) */\n interval: Number,\n /** Time shown, in ms (default 60000) */\n window: Number,\n /** Time kept for panning back, in ms (default 300000) */\n history: Number,\n /** Price levels kept on each side (default 160) */\n depth: Number,\n /** Price range shown around the mid; from `depth` by default */\n priceSpan: Number,\n /** Scale of the sizes to the colors (default `log`) */\n colorScale: String as PropType<OrderBookHeatmapScale>,\n /** Contrast of the colors (default 1) */\n contrast: Number,\n /** Size drawn with the last color; follows the data by default */\n maxSize: Number,\n /** Colors from no liquidity to `maxSize` (any CSS colors) */\n colors: Array as PropType<readonly string[]>,\n /** Trades as bubbles (default `true`) */\n bubbles: optionalBoolean,\n /** Diameter of the largest bubble, in pixels (default 28) */\n bubbleSize: Number,\n /** Trade volume of the largest bubble; follows the data by default */\n bubbleVolume: Number,\n /** Best bid / ask lines (default `true`) */\n bestLines: optionalBoolean,\n /** Size profile of the current book at the right (default `true`) */\n profile: optionalBoolean,\n /** Zoom and pan (default `true`) */\n interactive: optionalBoolean,\n /** Hover readout (default `true`) */\n tooltip: optionalBoolean,\n /** Backend: WebGPU, then WebGL2, WebGL, Canvas2D (default `auto`) */\n renderer: String as PropType<ChartRendererPreference>,\n /** Clock of the time axis and the tooltip: the local time or UTC, the clock of most exchanges (default `local`) */\n timeZone: String as PropType<ChartTimeZone>,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<OrderBookHeatmapLabels>>,\n};\n\n/** Props of TimeAndSales */\nexport const timeAndSalesProps = {\n ...commonProps,\n /** Trades, oldest first; when the array grows, only the appended ones are added (other changes replace the tape) */\n trades: Array as PropType<ChartTrades>,\n /** Trades kept (default 200000) */\n capacity: Number,\n /** Height of a row, in pixels (default 20) */\n rowHeight: Number,\n /** Columns, in order (default `[\"time\", \"price\", \"size\"]`) */\n columns: Array as PropType<readonly TimeAndSalesColumn[]>,\n /** Hides the trades below this size (default 0) */\n minSize: Number,\n /** Highlights the trades at or above this size */\n largeTradeThreshold: Number,\n /** Merges the consecutive trades of the same side and price (default `false`) */\n aggregate: optionalBoolean,\n /** Price color: the side of the trade or the tick direction (default `side`) */\n priceColor: String as PropType<\"side\" | \"tick\">,\n /** Pauses the tape while hovered (default `true`) */\n pauseOnHover: optionalBoolean,\n /** Slides the new rows in (default `true`) */\n animate: optionalBoolean,\n /** Column headers (default `true`) */\n header: optionalBoolean,\n /** Milliseconds in the times (default `true`) */\n milliseconds: optionalBoolean,\n /** Clock of the default time format: the local time or UTC, the clock of most exchanges (default `local`) */\n timeZone: String as PropType<ChartTimeZone>,\n /** Formats the times */\n formatTime: Function as PropType<(time: number) => string>,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<TimeAndSalesLabels>>,\n};\n\n/** Props passed through engine methods rather than the options */\nconst STREAMED = [\"book\", \"trades\", \"lastPrice\"];\n\ninterface Widget<O> extends EngineInstance<O> {\n setBook?(snapshot: OrderBookSnapshot): void;\n applyDeltas?(deltas: OrderBookDelta | readonly OrderBookDelta[]): void;\n}\n\n/**\n * Mounts an order book engine: the options are every set prop but the\n * streamed ones; `book` goes through `setBook` when the object changes,\n * `trades` through `add` (the appended trades) / `replace` (any other\n * change)\n */\nexport function useBookWidget<O, I extends Widget<O>>(\n factory: (container: HTMLElement, options: O) => I,\n props: Record<string, unknown> & {\n book?: OrderBookSnapshot;\n trades?: ChartTrades;\n deep?: boolean;\n },\n bind: (engine: I) => Array<() => void>,\n trades?: {\n add: (engine: I, trades: ChartTrades) => void;\n replace: (engine: I, trades: ChartTrades) => void;\n },\n) {\n let previous: ChartTrades | undefined;\n const feed = (engine: I) => {\n const list = raw(props.trades);\n const before = previous;\n previous = list;\n if (!trades || !list || list === before) return;\n const n = before?.length ?? 0;\n if (\n before &&\n n > 0 &&\n list.length >= n &&\n list[0] === before[0] &&\n list[n - 1] === before[n - 1]\n ) {\n if (list.length > n) trades.add(engine, list.slice(n));\n return;\n }\n trades.replace(engine, list);\n };\n const engine = useChartEngine<O, I>(\n factory,\n props,\n () => definedOptions<O>(props, STREAMED),\n (instance) => {\n previous = undefined;\n if (props.book) instance.setBook?.(raw(props.book));\n feed(instance);\n return bind(instance);\n },\n () => definedOptions(props, STREAMED),\n );\n watch(\n () => props.book,\n (book) => {\n if (book) engine.instance.value?.setBook?.(raw(book));\n },\n );\n watch(\n () => props.trades,\n () => {\n if (engine.instance.value) feed(engine.instance.value);\n },\n );\n return engine;\n}\n"],"mappings":";;;;;AAqBA,IAAMA,IAAkB;CAAE,MAAM;CAAS,SAAS,KAAA;AAAU,GAGtDC,IAAc;CAClB,GAAGC;CAEH,SAAS;CAET,WAAW;CAEX,iBAAiB;C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C,KAAQ,MAAc;EAC1B,IAAMC,IAAOC,EAAIC,EAAM,MAAM,GACvBC,IAASL;EAEf,IADA,IAAWE,GACP,CAACI,KAAU,CAACJ,KAAQA,MAASG,GAAQ;EACzC,IAAME,IAAIF,GAAQ,UAAU;EAC5B,IACEA,KACAE,IAAI,KACJL,EAAK,UAAUK,KACfL,EAAK,OAAOG,EAAO,MACnBH,EAAKK,IAAI,OAAOF,EAAOE,IAAI,IAC3B;GACA,AAAIL,EAAK,SAASK,KAAGD,EAAO,IAAIE,GAAQN,EAAK,MAAMK,CAAC,CAAC;GACrD;EACF;EACA,EAAO,QAAQC,GAAQN,CAAI;CAC7B,GACMM,IAASC,EACbC,GACAN,SACMO,EAAkBP,GAAON,CAAQ,IACtC,OACC,IAAW,KAAA,GACPM,EAAM,QAAMQ,EAAS,UAAUT,EAAIC,EAAM,IAAI,CAAC,GAClDH,EAAKW,CAAQ,GACNC,EAAKD,CAAQ,UAEhBD,EAAeP,GAAON,CAAQ,CACtC;CAaA,OAZAgB,QACQV,EAAM,OACX,MAAS;EACR,AAAIW,KAAMP,EAAO,SAAS,OAAO,UAAUL,EAAIY,CAAI,CAAC;CACtD,CACF,GACAD,QACQV,EAAM,cACN;EACJ,AAAII,EAAO,SAAS,SAAOP,EAAKO,EAAO,SAAS,KAAK;CACvD,CACF,GACOA;AACT"}
1
+ {"version":3,"file":"orderbook.js","names":["optionalBoolean","commonProps","chartFrameProps","depthChartProps","orderBookProps","orderBookHeatmapProps","timeAndSalesProps","STREAMED","useBookWidget","previous","feed","list","raw","props","before","trades","n","engine","useChartEngine","factory","definedOptions","instance","bind","watch","book"],"sources":["../../../../../vue/src/components/Chart/orderbook.ts"],"sourcesContent":["import { watch, type PropType } from \"vue\";\nimport type {\n ChartRendererPreference,\n ChartTimeZone,\n DepthChartLabels,\n DepthChartPriceLine,\n OrderBookColorConvention,\n OrderBookDelta,\n OrderBookHeatmapLabels,\n OrderBookHeatmapScale,\n OrderBookLabels,\n OrderBookMode,\n OrderBookSnapshot,\n TimeAndSalesColumn,\n TimeAndSalesLabels,\n} from \"minerva-design/charts/core\";\nimport { raw, useChartEngine, type EngineInstance } from \"./engine\";\nimport { chartFrameProps } from \"./props\";\nimport { definedOptions } from \"./trading\";\nimport type { ChartTrades } from \"./types\";\n\nconst optionalBoolean = { type: Boolean, default: undefined } as const;\n\n/** Options shared by the order book components */\nconst commonProps = {\n ...chartFrameProps,\n /** Color of the bids / buys (any CSS color); from `colorConvention` by default */\n upColor: String,\n /** Color of the asks / sells */\n downColor: String,\n /** `red-up` swaps the default colors (default `green-up`) */\n colorConvention: String as PropType<OrderBookColorConvention>,\n /** Decimals of the prices; detected from the data by default */\n pricePrecision: Number,\n /** Decimals of the sizes; detected from the data by default */\n sizePrecision: Number,\n /** Locale of the numbers and texts (`\"zh-CN\"`); the page language by default */\n locale: String,\n /** Formats the prices; overrides `pricePrecision` */\n formatPrice: Function as PropType<(price: number) => string>,\n /** Formats the sizes; overrides `sizePrecision` */\n formatSize: Function as PropType<(size: number) => string>,\n /** Font family of the texts (default: the theme font) */\n fontFamily: String,\n /** Font size of the texts, in pixels (default 12) */\n fontSize: Number,\n /** Accessible label */\n ariaLabel: String,\n};\n\n/** Props of DepthChart */\nexport const depthChartProps = {\n ...commonProps,\n /** Book to draw, applied when the object changes (stream updates through the handle's `applyDeltas`) */\n book: Object as PropType<OrderBookSnapshot>,\n /** Visible range on each side of the mid price, as a fraction of the mid; fits the book by default */\n range: Number,\n /** Smallest and largest `range` reachable by zooming (default `[0.0005, 0.5]`) */\n rangeLimits: Array as unknown as PropType<readonly [number, number]>,\n /** Zoom around the mid with the wheel / pinch (default `true`) */\n zoomable: optionalBoolean,\n /** Stepped or straight curves (default `step`) */\n curve: String as PropType<\"step\" | \"linear\">,\n /** Cumulative amount in the base asset or the quote notional (default `base`) */\n amount: String as PropType<\"base\" | \"quote\">,\n /** Eased transitions between books (default `true`) */\n animate: optionalBoolean,\n /** Opacity of the areas, 0-1 (default 0.28) */\n fillOpacity: Number,\n /** Line and label at the mid price (default `true`) */\n midLine: optionalBoolean,\n /** Legend with the spread (default `true`) */\n legend: optionalBoolean,\n /** Grid lines (default `true`) */\n grid: optionalBoolean,\n /** Price and amount axes (default `true`) */\n axes: optionalBoolean,\n /** Hover readout (default `true`) */\n tooltip: optionalBoolean,\n /** Mirrored readout on the other side (default `true`) */\n mirror: optionalBoolean,\n /** Reference lines at prices (an order, a liquidation) */\n priceLines: Array as PropType<readonly DepthChartPriceLine[]>,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<DepthChartLabels>>,\n};\n\n/** Props of OrderBook */\nexport const orderBookProps = {\n ...commonProps,\n /** Book to draw, applied when the object changes (stream updates through the handle's `applyDeltas`) */\n book: Object as PropType<OrderBookSnapshot>,\n /** Price of the spread row, colored by its last move; the mid price when omitted */\n lastPrice: { type: Number as PropType<number | null>, default: undefined },\n /** Sides shown (default `both`) */\n mode: String as PropType<OrderBookMode>,\n /** Price step the levels are grouped by (default 0: none) */\n grouping: Number,\n /** Rows per side; fills the height by default */\n rows: Number,\n /** Height of a row, in pixels (default 20) */\n rowHeight: Number,\n /** Depth bars behind the rows (default `cumulative`) */\n depthBars: String as PropType<\"cumulative\" | \"level\" | \"none\">,\n /** Total column in the base asset or the quote notional (default `base`) */\n total: String as PropType<\"base\" | \"quote\">,\n /** Columns, in order (default `[\"price\", \"size\", \"total\"]`) */\n columns: Array as PropType<readonly (\"price\" | \"size\" | \"total\")[]>,\n /** Flashes the changed sizes (default `true`) */\n flash: optionalBoolean,\n /** Duration of a flash, in ms (default 450) */\n flashDuration: Number,\n /** Highlights the levels at or above this size */\n largeOrderThreshold: Number,\n /** Column headers (default `true`) */\n header: optionalBoolean,\n /** Spread row between the sides (default `true`) */\n spreadRow: optionalBoolean,\n /** Bid / ask imbalance bar (default `true`) */\n imbalance: optionalBoolean,\n /** Hover summary of the cumulative levels (default `true`) */\n tooltip: optionalBoolean,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<OrderBookLabels>>,\n};\n\n/** Props of OrderBookHeatmap */\nexport const orderBookHeatmapProps = {\n ...commonProps,\n /** Book, applied when the object changes (stream updates through the handle's `applyDeltas`) */\n book: Object as PropType<OrderBookSnapshot>,\n /** Trades; when the array grows, only the appended ones are added */\n trades: Array as PropType<ChartTrades>,\n /** Price step of the rows; detected from the book by default */\n tickSize: Number,\n /** Duration of a column, in ms (default 100) */\n interval: Number,\n /** Time shown, in ms (default 60000) */\n window: Number,\n /** Time kept for panning back, in ms (default 300000) */\n history: Number,\n /** Price levels kept on each side (default 160) */\n depth: Number,\n /** Price range shown around the mid; from `depth` by default */\n priceSpan: Number,\n /** Scale of the sizes to the colors (default `log`) */\n colorScale: String as PropType<OrderBookHeatmapScale>,\n /** Contrast of the colors (default 1) */\n contrast: Number,\n /** Size drawn with the last color; follows the data by default */\n maxSize: Number,\n /** Unit after the sizes of the legend and tooltip, e.g. \"BTC\" */\n sizeUnit: String,\n /** Color legend with its size range at the top left (default `true`) */\n legend: optionalBoolean,\n /** Colors from no liquidity to `maxSize` (any CSS colors) */\n colors: Array as PropType<readonly string[]>,\n /** Trades as bubbles (default `true`) */\n bubbles: optionalBoolean,\n /** Diameter of the largest bubble, in pixels (default 28) */\n bubbleSize: Number,\n /** Trade volume of the largest bubble; follows the data by default */\n bubbleVolume: Number,\n /** Best bid / ask lines (default `true`) */\n bestLines: optionalBoolean,\n /** Size profile of the current book at the right (default `true`) */\n profile: optionalBoolean,\n /** Zoom and pan (default `true`) */\n interactive: optionalBoolean,\n /** Hover readout (default `true`) */\n tooltip: optionalBoolean,\n /** Backend: WebGPU, then WebGL2, WebGL, Canvas2D (default `auto`) */\n renderer: String as PropType<ChartRendererPreference>,\n /** Clock of the time axis and the tooltip: the local time or UTC, the clock of most exchanges (default `local`) */\n timeZone: String as PropType<ChartTimeZone>,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<OrderBookHeatmapLabels>>,\n};\n\n/** Props of TimeAndSales */\nexport const timeAndSalesProps = {\n ...commonProps,\n /** Trades, oldest first; when the array grows, only the appended ones are added (other changes replace the tape) */\n trades: Array as PropType<ChartTrades>,\n /** Trades kept (default 200000) */\n capacity: Number,\n /** Height of a row, in pixels (default 20) */\n rowHeight: Number,\n /** Columns, in order (default `[\"time\", \"price\", \"size\"]`) */\n columns: Array as PropType<readonly TimeAndSalesColumn[]>,\n /** Hides the trades below this size (default 0) */\n minSize: Number,\n /** Highlights the trades at or above this size */\n largeTradeThreshold: Number,\n /** Merges the consecutive trades of the same side and price (default `false`) */\n aggregate: optionalBoolean,\n /** Price color: the side of the trade or the tick direction (default `side`) */\n priceColor: String as PropType<\"side\" | \"tick\">,\n /** Pauses the tape while hovered (default `true`) */\n pauseOnHover: optionalBoolean,\n /** Slides the new rows in (default `true`) */\n animate: optionalBoolean,\n /** Column headers (default `true`) */\n header: optionalBoolean,\n /** Milliseconds in the times (default `true`) */\n milliseconds: optionalBoolean,\n /** Clock of the default time format: the local time or UTC, the clock of most exchanges (default `local`) */\n timeZone: String as PropType<ChartTimeZone>,\n /** Formats the times */\n formatTime: Function as PropType<(time: number) => string>,\n /** Overrides of the built-in texts of the `locale` */\n labels: Object as PropType<Partial<TimeAndSalesLabels>>,\n};\n\n/** Props passed through engine methods rather than the options */\nconst STREAMED = [\"book\", \"trades\", \"lastPrice\"];\n\ninterface Widget<O> extends EngineInstance<O> {\n setBook?(snapshot: OrderBookSnapshot): void;\n applyDeltas?(deltas: OrderBookDelta | readonly OrderBookDelta[]): void;\n}\n\n/**\n * Mounts an order book engine: the options are every set prop but the\n * streamed ones; `book` goes through `setBook` when the object changes,\n * `trades` through `add` (the appended trades) / `replace` (any other\n * change)\n */\nexport function useBookWidget<O, I extends Widget<O>>(\n factory: (container: HTMLElement, options: O) => I,\n props: Record<string, unknown> & {\n book?: OrderBookSnapshot;\n trades?: ChartTrades;\n deep?: boolean;\n },\n bind: (engine: I) => Array<() => void>,\n trades?: {\n add: (engine: I, trades: ChartTrades) => void;\n replace: (engine: I, trades: ChartTrades) => void;\n },\n) {\n let previous: ChartTrades | undefined;\n const feed = (engine: I) => {\n const list = raw(props.trades);\n const before = previous;\n previous = list;\n if (!trades || !list || list === before) return;\n const n = before?.length ?? 0;\n if (\n before &&\n n > 0 &&\n list.length >= n &&\n list[0] === before[0] &&\n list[n - 1] === before[n - 1]\n ) {\n if (list.length > n) trades.add(engine, list.slice(n));\n return;\n }\n trades.replace(engine, list);\n };\n const engine = useChartEngine<O, I>(\n factory,\n props,\n () => definedOptions<O>(props, STREAMED),\n (instance) => {\n previous = undefined;\n if (props.book) instance.setBook?.(raw(props.book));\n feed(instance);\n return bind(instance);\n },\n () => definedOptions(props, STREAMED),\n );\n watch(\n () => props.book,\n (book) => {\n if (book) engine.instance.value?.setBook?.(raw(book));\n },\n );\n watch(\n () => props.trades,\n () => {\n if (engine.instance.value) feed(engine.instance.value);\n },\n );\n return engine;\n}\n"],"mappings":";;;;;AAqBA,IAAMA,IAAkB;CAAE,MAAM;CAAS,SAAS,KAAA;AAAU,GAGtDC,IAAc;CAClB,GAAGC;CAEH,SAAS;CAET,WAAW;CAEX,iBAAiB;CAEjB,gBAAgB;CAEhB,eAAe;CAEf,QAAQ;CAER,aAAa;CAEb,YAAY;CAEZ,YAAY;CAEZ,UAAU;CAEV,WAAW;AACb,GAGaC,IAAkB;CAC7B,GAAGF;CAEH,MAAM;CAEN,OAAO;CAEP,aAAa;CAEb,UAAUD;CAEV,OAAO;CAEP,QAAQ;CAER,SAASA;CAET,aAAa;CAEb,SAASA;CAET,QAAQA;CAER,MAAMA;CAEN,MAAMA;CAEN,SAASA;CAET,QAAQA;CAER,YAAY;CAEZ,QAAQ;AACV,GAGaI,IAAiB;CAC5B,GAAGH;CAEH,MAAM;CAEN,WAAW;EAAE,MAAM;EAAmC,SAAS,KAAA;CAAU;CAEzE,MAAM;CAEN,UAAU;CAEV,MAAM;CAEN,WAAW;CAEX,WAAW;CAEX,OAAO;CAEP,SAAS;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M,EAAM,QAAMQ,EAAS,UAAUT,EAAIC,EAAM,IAAI,CAAC,GAClDH,EAAKW,CAAQ,GACNC,EAAKD,CAAQ,UAEhBD,EAAeP,GAAON,CAAQ,CACtC;CAaA,OAZAgB,QACQV,EAAM,OACX,MAAS;EACR,AAAIW,KAAMP,EAAO,SAAS,OAAO,UAAUL,EAAIY,CAAI,CAAC;CACtD,CACF,GACAD,QACQV,EAAM,cACN;EACJ,AAAII,EAAO,SAAS,SAAOP,EAAKO,EAAO,SAAS,KAAK;CACvD,CACF,GACOA;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minerva-design",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Minerva Design: React, Vue, Angular, Web Components and native platform components with shared design tokens and contracts",
5
5
  "license": "MIT",
6
6
  "author": "fwx5618177 <fwx5618177@gmail.com>",