@tranding-custom-chart/financial 0.0.0-stage → 2.0.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.
Files changed (53) hide show
  1. package/README.md +40 -2
  2. package/dist/adapter.d.ts +24 -0
  3. package/dist/adapter.d.ts.map +1 -0
  4. package/dist/adapter.js +47 -0
  5. package/dist/index.d.ts +21 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +20 -0
  8. package/dist/indicators/atr.d.ts +13 -0
  9. package/dist/indicators/atr.d.ts.map +1 -0
  10. package/dist/indicators/atr.js +40 -0
  11. package/dist/indicators/bollinger.d.ts +12 -0
  12. package/dist/indicators/bollinger.d.ts.map +1 -0
  13. package/dist/indicators/bollinger.js +34 -0
  14. package/dist/indicators/ema.d.ts +7 -0
  15. package/dist/indicators/ema.d.ts.map +1 -0
  16. package/dist/indicators/ema.js +26 -0
  17. package/dist/indicators/heikin-ashi.d.ts +14 -0
  18. package/dist/indicators/heikin-ashi.d.ts.map +1 -0
  19. package/dist/indicators/heikin-ashi.js +36 -0
  20. package/dist/indicators/kagi.d.ts +20 -0
  21. package/dist/indicators/kagi.d.ts.map +1 -0
  22. package/dist/indicators/kagi.js +122 -0
  23. package/dist/indicators/line-break.d.ts +18 -0
  24. package/dist/indicators/line-break.d.ts.map +1 -0
  25. package/dist/indicators/line-break.js +73 -0
  26. package/dist/indicators/macd.d.ts +13 -0
  27. package/dist/indicators/macd.d.ts.map +1 -0
  28. package/dist/indicators/macd.js +60 -0
  29. package/dist/indicators/renko.d.ts +19 -0
  30. package/dist/indicators/renko.d.ts.map +1 -0
  31. package/dist/indicators/renko.js +84 -0
  32. package/dist/indicators/rsi.d.ts +7 -0
  33. package/dist/indicators/rsi.d.ts.map +1 -0
  34. package/dist/indicators/rsi.js +47 -0
  35. package/dist/indicators/sma.d.ts +15 -0
  36. package/dist/indicators/sma.d.ts.map +1 -0
  37. package/dist/indicators/sma.js +37 -0
  38. package/dist/indicators/supertrend.d.ts +8 -0
  39. package/dist/indicators/supertrend.d.ts.map +1 -0
  40. package/dist/indicators/supertrend.js +88 -0
  41. package/dist/indicators/volume-profile.d.ts +10 -0
  42. package/dist/indicators/volume-profile.d.ts.map +1 -0
  43. package/dist/indicators/volume-profile.js +134 -0
  44. package/dist/indicators/vwap.d.ts +7 -0
  45. package/dist/indicators/vwap.d.ts.map +1 -0
  46. package/dist/indicators/vwap.js +33 -0
  47. package/dist/indicators/wma.d.ts +7 -0
  48. package/dist/indicators/wma.d.ts.map +1 -0
  49. package/dist/indicators/wma.js +21 -0
  50. package/dist/layout/pane-layout.d.ts +19 -0
  51. package/dist/layout/pane-layout.d.ts.map +1 -0
  52. package/dist/layout/pane-layout.js +39 -0
  53. package/package.json +33 -4
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @file packages/chart-financial/src/layout/pane-layout.ts
3
+ * Multi-pane vertical split layout manager (Price, Volume, Indicators).
4
+ */
5
+ export function computePaneLayouts(totalBounds, padding, panes, paneGap = 8) {
6
+ if (panes.length === 0)
7
+ return [];
8
+ const availableHeight = totalBounds.height - padding.top - padding.bottom;
9
+ const totalGaps = (panes.length - 1) * paneGap;
10
+ const netHeight = Math.max(10, availableHeight - totalGaps);
11
+ const totalRatio = panes.reduce((sum, p) => sum + p.heightRatio, 0) || 1;
12
+ const computed = [];
13
+ let currentY = padding.top;
14
+ for (let i = 0; i < panes.length; i++) {
15
+ const pane = panes[i];
16
+ const isLast = i === panes.length - 1;
17
+ const isFirst = i === 0;
18
+ let paneHeight = Math.round((pane.heightRatio / totalRatio) * netHeight);
19
+ if (pane.minHeight && paneHeight < pane.minHeight) {
20
+ paneHeight = pane.minHeight;
21
+ }
22
+ const paneTop = currentY;
23
+ const paneBottom = paneTop + paneHeight;
24
+ computed.push({
25
+ id: pane.id,
26
+ top: paneTop,
27
+ bottom: paneBottom,
28
+ height: paneHeight,
29
+ padding: {
30
+ top: isFirst ? padding.top : 2,
31
+ bottom: isLast ? padding.bottom : 2,
32
+ left: padding.left,
33
+ right: padding.right,
34
+ },
35
+ });
36
+ currentY = paneBottom + paneGap;
37
+ }
38
+ return computed;
39
+ }
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@tranding-custom-chart/financial",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.0",
4
+ "description": "Enterprise financial math, technical indicators, and multi-pane layout algorithms for Trend Chart",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/thecreatorstudio97/trend-chart.git",
10
+ "directory": "packages/chart-financial"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "dependencies": {
21
+ "@tranding-custom-chart/core": "^2.0.0"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.build.json",
32
+ "typecheck": "tsc --noEmit -p tsconfig.json",
33
+ "test": "vitest run --config vitest.config.ts"
34
+ }
35
+ }