@tradecanvas/commons 0.1.1 → 0.1.2

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 (2) hide show
  1. package/README.md +67 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @tradecanvas/commons
2
+
3
+ Shared types, utilities, constants, themes, i18n, and market presets for the [@tradecanvas/chart](https://www.npmjs.com/package/@tradecanvas/chart) library.
4
+
5
+ **[Live Demo](https://bonguynvan.github.io/tradecanvas/)** | **[GitHub](https://github.com/bonguynvan/tradecanvas)** | **[Documentation](https://bonguynvan.github.io/tradecanvas/#getting-started)**
6
+
7
+ ## Install
8
+
9
+ You don't need to install this package directly. It's included as a dependency of `@tradecanvas/chart`.
10
+
11
+ ```bash
12
+ npm install @tradecanvas/chart
13
+ ```
14
+
15
+ ## What's Inside
16
+
17
+ ### Types
18
+
19
+ All TypeScript interfaces and types used across the library:
20
+
21
+ - `OHLCBar`, `DataSeries`, `TimeFrame` -- data format
22
+ - `ChartOptions`, `ChartType`, `FeaturesConfig` -- chart configuration
23
+ - `Theme`, `ThemeName` -- theming
24
+ - `IndicatorPlugin`, `IndicatorDescriptor`, `IndicatorConfig` -- indicators
25
+ - `DrawingToolType`, `DrawingState`, `DrawingStyle` -- drawing tools
26
+ - `TradingPosition`, `TradingOrder`, `TradingConfig` -- trading overlay
27
+ - `DataAdapter`, `StreamConfig`, `ConnectionState` -- real-time streaming
28
+ - `ChartEventType`, `ChartEvent` -- events
29
+ - `MarketConfig`, `TradingSession` -- market configuration
30
+
31
+ ### Themes
32
+
33
+ ```typescript
34
+ import { DARK_THEME, LIGHT_THEME } from '@tradecanvas/commons'
35
+ ```
36
+
37
+ 19 customizable properties: `background`, `text`, `candleUp`, `candleDown`, `grid`, `crosshair`, `volumeUp`, `volumeDown`, and more.
38
+
39
+ ### Constants
40
+
41
+ - Default chart options and feature flags
42
+ - Market presets: `MARKET_HOSE`, `MARKET_HNX`, `MARKET_UPCOM`, `MARKET_CRYPTO`, `MARKET_NYSE`
43
+ - Vietnamese stock market color schemes
44
+
45
+ ### Utilities
46
+
47
+ - `computePriceRange()` -- compute visible price range from OHLC data
48
+ - `timeframeToMs()` -- convert timeframe string to milliseconds
49
+ - `formatNumber()`, `formatVND()`, `formatVolumeLoc()` -- number formatting
50
+ - Color, math, precision, and data manipulation helpers
51
+
52
+ ### i18n
53
+
54
+ Built-in locales: English (`en`), Vietnamese (`vi`). Extensible via `registerLocale()`.
55
+
56
+ ## Direct Usage
57
+
58
+ If you need just the types or utilities without the full chart:
59
+
60
+ ```typescript
61
+ import type { OHLCBar, TimeFrame, ChartType } from '@tradecanvas/commons'
62
+ import { DARK_THEME, computePriceRange, timeframeToMs } from '@tradecanvas/commons'
63
+ ```
64
+
65
+ ## License
66
+
67
+ [MIT](https://github.com/bonguynvan/tradecanvas/blob/main/LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradecanvas/commons",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Shared types and utilities for @tradecanvas/chart",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "require": "./dist/index.cjs"
25
25
  }
26
26
  },
27
- "files": ["dist"],
27
+ "files": ["dist", "README.md"],
28
28
  "scripts": {
29
29
  "build": "vite build",
30
30
  "dev": "vite build --watch",