oakscriptjs 0.9.6 → 0.10.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/README.md +1 -1
- package/dist/cjs/array/index.d.ts +9 -23
- package/dist/cjs/array/index.d.ts.map +1 -1
- package/dist/cjs/array/index.js +4 -0
- package/dist/cjs/array/index.js.map +2 -2
- package/dist/cjs/drawing/bar-time.d.ts +24 -0
- package/dist/cjs/drawing/bar-time.d.ts.map +1 -0
- package/dist/cjs/drawing/bar-time.js +47 -0
- package/dist/cjs/drawing/bar-time.js.map +7 -0
- package/dist/cjs/drawing/output.d.ts +32 -0
- package/dist/cjs/drawing/output.d.ts.map +1 -0
- package/dist/cjs/drawing/output.js +184 -0
- package/dist/cjs/drawing/output.js.map +7 -0
- package/dist/cjs/drawing/registry.d.ts +5 -4
- package/dist/cjs/drawing/registry.d.ts.map +1 -1
- package/dist/cjs/drawing/registry.js +11 -2
- package/dist/cjs/drawing/registry.js.map +2 -2
- package/dist/cjs/index.d.ts +6 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/polyline/index.d.ts +3 -5
- package/dist/cjs/polyline/index.d.ts.map +1 -1
- package/dist/cjs/polyline/index.js +0 -5
- package/dist/cjs/polyline/index.js.map +2 -2
- package/dist/cjs/runtime/types.d.ts +22 -0
- package/dist/cjs/runtime/types.d.ts.map +1 -1
- package/dist/cjs/runtime/types.js.map +1 -1
- package/dist/cjs/script/index.d.ts +82 -5
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +141 -26
- package/dist/cjs/script/index.js.map +3 -3
- package/dist/cjs/table/index.d.ts +87 -0
- package/dist/cjs/table/index.d.ts.map +1 -0
- package/dist/cjs/table/index.js +150 -0
- package/dist/cjs/table/index.js.map +7 -0
- package/dist/cjs/text/index.d.ts +17 -2
- package/dist/cjs/text/index.d.ts.map +1 -1
- package/dist/cjs/text/index.js +15 -1
- package/dist/cjs/text/index.js.map +2 -2
- package/dist/cjs/types/index.d.ts +30 -1
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +12 -0
- package/dist/cjs/types/index.js.map +2 -2
- package/dist/cjs/types/metadata.d.ts +258 -26
- package/dist/cjs/types/metadata.d.ts.map +1 -1
- package/dist/cjs/types/metadata.js.map +1 -1
- package/dist/esm/array/index.d.ts +9 -23
- package/dist/esm/array/index.d.ts.map +1 -1
- package/dist/esm/array/index.js +10 -22
- package/dist/esm/array/index.js.map +1 -1
- package/dist/esm/drawing/bar-time.d.ts +24 -0
- package/dist/esm/drawing/bar-time.d.ts.map +1 -0
- package/dist/esm/drawing/bar-time.js +44 -0
- package/dist/esm/drawing/bar-time.js.map +1 -0
- package/dist/esm/drawing/output.d.ts +32 -0
- package/dist/esm/drawing/output.d.ts.map +1 -0
- package/dist/esm/drawing/output.js +190 -0
- package/dist/esm/drawing/output.js.map +1 -0
- package/dist/esm/drawing/registry.d.ts +5 -4
- package/dist/esm/drawing/registry.d.ts.map +1 -1
- package/dist/esm/drawing/registry.js +12 -2
- package/dist/esm/drawing/registry.js.map +1 -1
- package/dist/esm/index.d.ts +6 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/polyline/index.d.ts +3 -5
- package/dist/esm/polyline/index.d.ts.map +1 -1
- package/dist/esm/polyline/index.js +3 -9
- package/dist/esm/polyline/index.js.map +1 -1
- package/dist/esm/runtime/types.d.ts +22 -0
- package/dist/esm/runtime/types.d.ts.map +1 -1
- package/dist/esm/script/index.d.ts +82 -5
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +167 -21
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/table/index.d.ts +87 -0
- package/dist/esm/table/index.d.ts.map +1 -0
- package/dist/esm/table/index.js +169 -0
- package/dist/esm/table/index.js.map +1 -0
- package/dist/esm/text/index.d.ts +17 -2
- package/dist/esm/text/index.d.ts.map +1 -1
- package/dist/esm/text/index.js +17 -2
- package/dist/esm/text/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +30 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +14 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/metadata.d.ts +258 -26
- package/dist/esm/types/metadata.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/array/index.ts +12 -23
- package/src/drawing/bar-time.ts +42 -0
- package/src/drawing/output.ts +214 -0
- package/src/drawing/registry.ts +16 -6
- package/src/index.ts +9 -3
- package/src/polyline/index.ts +3 -12
- package/src/runtime/types.ts +23 -0
- package/src/script/index.ts +254 -24
- package/src/table/index.ts +221 -0
- package/src/text/index.ts +18 -2
- package/src/types/index.ts +32 -1
- package/src/types/metadata.ts +325 -26
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table namespace
|
|
3
|
+
* Functions for creating and filling table drawing objects.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* A table is drawn at a fixed position of the pane (`position.*`), not at a bar. Tables have no getters in
|
|
7
|
+
* PineScript; the script API returns the live tables in `result.tables`.
|
|
8
|
+
*
|
|
9
|
+
* PineScript rules:
|
|
10
|
+
* - `table.cell` defines a cell: the arguments it does not give get their default, a previous definition of the
|
|
11
|
+
* cell is replaced
|
|
12
|
+
* - `table.cell_set_*` changes one property of a cell (a cell that was not defined is created)
|
|
13
|
+
* - a column or row outside the table is a runtime error
|
|
14
|
+
* - a deleted table is `na`: its functions do nothing
|
|
15
|
+
*
|
|
16
|
+
* @version 6
|
|
17
|
+
*/
|
|
18
|
+
import type { Table, color } from '../types/index.js';
|
|
19
|
+
type TablePosition = Table['position'];
|
|
20
|
+
type HAlign = 'left' | 'center' | 'right';
|
|
21
|
+
type VAlign = 'top' | 'center' | 'bottom';
|
|
22
|
+
type FontFamily = 'default' | 'monospace';
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new table (PineScript `table.new`).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const t = table.new(position.top_right, 2, 3, '#131722', '#787B86', 1);
|
|
29
|
+
* table.cell(t, 0, 0, 'RSI', 0, 0, '#FFFFFF');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function new_table(position: TablePosition, columns: number, rows: number, bgcolor?: color, frame_color?: color, frame_width?: number, border_color?: color, border_width?: number, force_overlay?: boolean): Table;
|
|
33
|
+
/**
|
|
34
|
+
* Defines a cell (PineScript `table.cell`): its text and properties. Omitted properties get their default.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cell(table_id: Table, column: number, row: number, text?: string, width?: number, height?: number, text_color?: color, text_halign?: HAlign, text_valign?: VAlign, text_size?: string | number, bgcolor?: color, tooltip?: string, text_font_family?: FontFamily, text_formatting?: number): void;
|
|
37
|
+
/** Sets the text of a cell. */
|
|
38
|
+
export declare const cell_set_text: (table_id: Table, column: number, row: number, value: string | undefined) => void;
|
|
39
|
+
/** Sets the width of a cell (% of the chart width; 0 fits the text). */
|
|
40
|
+
export declare const cell_set_width: (table_id: Table, column: number, row: number, value: number | undefined) => void;
|
|
41
|
+
/** Sets the height of a cell (% of the chart height; 0 fits the text). */
|
|
42
|
+
export declare const cell_set_height: (table_id: Table, column: number, row: number, value: number | undefined) => void;
|
|
43
|
+
/** Sets the text colour of a cell. */
|
|
44
|
+
export declare const cell_set_text_color: (table_id: Table, column: number, row: number, value: color | undefined) => void;
|
|
45
|
+
/** Sets the horizontal text alignment of a cell. */
|
|
46
|
+
export declare const cell_set_text_halign: (table_id: Table, column: number, row: number, value: "left" | "right" | "center" | undefined) => void;
|
|
47
|
+
/** Sets the vertical text alignment of a cell. */
|
|
48
|
+
export declare const cell_set_text_valign: (table_id: Table, column: number, row: number, value: "center" | "top" | "bottom" | undefined) => void;
|
|
49
|
+
/** Sets the text size of a cell. */
|
|
50
|
+
export declare const cell_set_text_size: (table_id: Table, column: number, row: number, value: string | number | undefined) => void;
|
|
51
|
+
/** Sets the background colour of a cell. */
|
|
52
|
+
export declare const cell_set_bgcolor: (table_id: Table, column: number, row: number, value: color | undefined) => void;
|
|
53
|
+
/** Sets the tooltip of a cell. */
|
|
54
|
+
export declare const cell_set_tooltip: (table_id: Table, column: number, row: number, value: string | undefined) => void;
|
|
55
|
+
/** Sets the font family of a cell. */
|
|
56
|
+
export declare const cell_set_text_font_family: (table_id: Table, column: number, row: number, value: "default" | "monospace" | undefined) => void;
|
|
57
|
+
/** Sets the text formatting of a cell (`text.format_*` flags). */
|
|
58
|
+
export declare const cell_set_text_formatting: (table_id: Table, column: number, row: number, value: number | undefined) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Merges the cells from start_column / start_row to end_column / end_row (PineScript `table.merge_cells`). The
|
|
61
|
+
* merged cell shows the content of the start cell.
|
|
62
|
+
*/
|
|
63
|
+
export declare function merge_cells(table_id: Table, start_column: number, start_row: number, end_column: number, end_row: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Removes the cells from start_column / start_row to end_column / end_row (PineScript `table.clear`; default end:
|
|
66
|
+
* the start cell), and the merges that start in that range.
|
|
67
|
+
*/
|
|
68
|
+
export declare function clear(table_id: Table, start_column: number, start_row: number, end_column?: number, end_row?: number): void;
|
|
69
|
+
/** Moves the table to another position (`position.*`). */
|
|
70
|
+
export declare const set_position: (table_id: Table, value: "top_left" | "top_center" | "top_right" | "middle_left" | "middle_center" | "middle_right" | "bottom_left" | "bottom_center" | "bottom_right") => void;
|
|
71
|
+
/** Sets the background colour of the table. */
|
|
72
|
+
export declare const set_bgcolor: (table_id: Table, value: color | undefined) => void;
|
|
73
|
+
/** Sets the colour of the outer frame. */
|
|
74
|
+
export declare const set_frame_color: (table_id: Table, value: color | undefined) => void;
|
|
75
|
+
/** Sets the width of the outer frame. */
|
|
76
|
+
export declare const set_frame_width: (table_id: Table, value: number | undefined) => void;
|
|
77
|
+
/** Sets the colour of the cell borders. */
|
|
78
|
+
export declare const set_border_color: (table_id: Table, value: color | undefined) => void;
|
|
79
|
+
/** Sets the width of the cell borders. */
|
|
80
|
+
export declare const set_border_width: (table_id: Table, value: number | undefined) => void;
|
|
81
|
+
/** Deletes the table (PineScript `table.delete`). */
|
|
82
|
+
export declare function delete_table(table_id: Table): void;
|
|
83
|
+
/** All live tables, in creation order (PineScript `table.all`). A new array. */
|
|
84
|
+
export declare function all(): Table[];
|
|
85
|
+
export { new_table as new };
|
|
86
|
+
export { delete_table as delete };
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAa,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEjE,KAAK,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;AACvC,KAAK,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC1C,KAAK,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC1C,KAAK,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,KAAK,EACf,WAAW,CAAC,EAAE,KAAK,EACnB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,KAAK,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,OAAO,GACtB,KAAK,CAcP;AAqBD;;GAEG;AACH,wBAAgB,IAAI,CAClB,QAAQ,EAAE,KAAK,EACf,MAAM,EAAE,MAAM,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AY,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all2) => {
|
|
7
|
+
for (var name in all2)
|
|
8
|
+
__defProp(target, name, { get: all2[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key2 of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
14
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var table_exports = {};
|
|
20
|
+
__export(table_exports, {
|
|
21
|
+
all: () => all,
|
|
22
|
+
cell: () => cell,
|
|
23
|
+
cell_set_bgcolor: () => cell_set_bgcolor,
|
|
24
|
+
cell_set_height: () => cell_set_height,
|
|
25
|
+
cell_set_text: () => cell_set_text,
|
|
26
|
+
cell_set_text_color: () => cell_set_text_color,
|
|
27
|
+
cell_set_text_font_family: () => cell_set_text_font_family,
|
|
28
|
+
cell_set_text_formatting: () => cell_set_text_formatting,
|
|
29
|
+
cell_set_text_halign: () => cell_set_text_halign,
|
|
30
|
+
cell_set_text_size: () => cell_set_text_size,
|
|
31
|
+
cell_set_text_valign: () => cell_set_text_valign,
|
|
32
|
+
cell_set_tooltip: () => cell_set_tooltip,
|
|
33
|
+
cell_set_width: () => cell_set_width,
|
|
34
|
+
clear: () => clear,
|
|
35
|
+
delete: () => delete_table,
|
|
36
|
+
delete_table: () => delete_table,
|
|
37
|
+
merge_cells: () => merge_cells,
|
|
38
|
+
new: () => new_table,
|
|
39
|
+
new_table: () => new_table,
|
|
40
|
+
set_bgcolor: () => set_bgcolor,
|
|
41
|
+
set_border_color: () => set_border_color,
|
|
42
|
+
set_border_width: () => set_border_width,
|
|
43
|
+
set_frame_color: () => set_frame_color,
|
|
44
|
+
set_frame_width: () => set_frame_width,
|
|
45
|
+
set_position: () => set_position
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(table_exports);
|
|
48
|
+
var import_registry = require("../drawing/registry.js");
|
|
49
|
+
function new_table(position, columns, rows, bgcolor, frame_color, frame_width, border_color, border_width, force_overlay) {
|
|
50
|
+
return (0, import_registry.register)("table", {
|
|
51
|
+
position,
|
|
52
|
+
columns,
|
|
53
|
+
rows,
|
|
54
|
+
bgcolor,
|
|
55
|
+
frame_color,
|
|
56
|
+
frame_width,
|
|
57
|
+
border_color,
|
|
58
|
+
border_width,
|
|
59
|
+
force_overlay: force_overlay ?? false,
|
|
60
|
+
cells: /* @__PURE__ */ new Map(),
|
|
61
|
+
merges: []
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function checkCell(caller, id, column, row) {
|
|
65
|
+
if (!(column >= 0 && column < id.columns && row >= 0 && row < id.rows)) {
|
|
66
|
+
throw new RangeError(
|
|
67
|
+
`${caller}: column ${column}, row ${row} is outside the table (${id.columns} columns, ${id.rows} rows).`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const key = (column, row) => `${column},${row}`;
|
|
72
|
+
function cellOf(caller, id, column, row) {
|
|
73
|
+
checkCell(caller, id, column, row);
|
|
74
|
+
const cells = id.cells ??= /* @__PURE__ */ new Map();
|
|
75
|
+
let cell2 = cells.get(key(column, row));
|
|
76
|
+
if (!cell2) cells.set(key(column, row), cell2 = { text: "" });
|
|
77
|
+
return cell2;
|
|
78
|
+
}
|
|
79
|
+
function cell(table_id, column, row, text, width, height, text_color, text_halign, text_valign, text_size, bgcolor, tooltip, text_font_family, text_formatting) {
|
|
80
|
+
if ((0, import_registry.isDeleted)(table_id)) return;
|
|
81
|
+
checkCell("table.cell()", table_id, column, row);
|
|
82
|
+
(table_id.cells ??= /* @__PURE__ */ new Map()).set(key(column, row), {
|
|
83
|
+
text: text ?? "",
|
|
84
|
+
width,
|
|
85
|
+
height,
|
|
86
|
+
text_color,
|
|
87
|
+
text_halign,
|
|
88
|
+
text_valign,
|
|
89
|
+
text_size,
|
|
90
|
+
bgcolor,
|
|
91
|
+
tooltip,
|
|
92
|
+
text_font_family,
|
|
93
|
+
text_formatting
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function setCell(name, field) {
|
|
97
|
+
return (table_id, column, row, value) => {
|
|
98
|
+
if ((0, import_registry.isDeleted)(table_id)) return;
|
|
99
|
+
cellOf(`table.${name}()`, table_id, column, row)[field] = value;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const cell_set_text = setCell("cell_set_text", "text");
|
|
103
|
+
const cell_set_width = setCell("cell_set_width", "width");
|
|
104
|
+
const cell_set_height = setCell("cell_set_height", "height");
|
|
105
|
+
const cell_set_text_color = setCell("cell_set_text_color", "text_color");
|
|
106
|
+
const cell_set_text_halign = setCell("cell_set_text_halign", "text_halign");
|
|
107
|
+
const cell_set_text_valign = setCell("cell_set_text_valign", "text_valign");
|
|
108
|
+
const cell_set_text_size = setCell("cell_set_text_size", "text_size");
|
|
109
|
+
const cell_set_bgcolor = setCell("cell_set_bgcolor", "bgcolor");
|
|
110
|
+
const cell_set_tooltip = setCell("cell_set_tooltip", "tooltip");
|
|
111
|
+
const cell_set_text_font_family = setCell("cell_set_text_font_family", "text_font_family");
|
|
112
|
+
const cell_set_text_formatting = setCell("cell_set_text_formatting", "text_formatting");
|
|
113
|
+
function merge_cells(table_id, start_column, start_row, end_column, end_row) {
|
|
114
|
+
if ((0, import_registry.isDeleted)(table_id)) return;
|
|
115
|
+
checkCell("table.merge_cells()", table_id, start_column, start_row);
|
|
116
|
+
checkCell("table.merge_cells()", table_id, end_column, end_row);
|
|
117
|
+
if (end_column < start_column || end_row < start_row) {
|
|
118
|
+
throw new RangeError("table.merge_cells(): the end cell is before the start cell.");
|
|
119
|
+
}
|
|
120
|
+
(table_id.merges ??= []).push({ start_column, start_row, end_column, end_row });
|
|
121
|
+
}
|
|
122
|
+
function clear(table_id, start_column, start_row, end_column = start_column, end_row = start_row) {
|
|
123
|
+
if ((0, import_registry.isDeleted)(table_id)) return;
|
|
124
|
+
checkCell("table.clear()", table_id, start_column, start_row);
|
|
125
|
+
checkCell("table.clear()", table_id, end_column, end_row);
|
|
126
|
+
const inside = (column, row) => column >= start_column && column <= end_column && row >= start_row && row <= end_row;
|
|
127
|
+
for (let column = start_column; column <= end_column; column++) {
|
|
128
|
+
for (let row = start_row; row <= end_row; row++) table_id.cells?.delete(key(column, row));
|
|
129
|
+
}
|
|
130
|
+
if (table_id.merges) table_id.merges = table_id.merges.filter((m) => !inside(m.start_column, m.start_row));
|
|
131
|
+
}
|
|
132
|
+
function setTable(field) {
|
|
133
|
+
return (table_id, value) => {
|
|
134
|
+
if ((0, import_registry.isDeleted)(table_id)) return;
|
|
135
|
+
table_id[field] = value;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const set_position = setTable("position");
|
|
139
|
+
const set_bgcolor = setTable("bgcolor");
|
|
140
|
+
const set_frame_color = setTable("frame_color");
|
|
141
|
+
const set_frame_width = setTable("frame_width");
|
|
142
|
+
const set_border_color = setTable("border_color");
|
|
143
|
+
const set_border_width = setTable("border_width");
|
|
144
|
+
function delete_table(table_id) {
|
|
145
|
+
(0, import_registry.remove)("table", table_id);
|
|
146
|
+
}
|
|
147
|
+
function all() {
|
|
148
|
+
return (0, import_registry.all)("table");
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/table/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Table namespace\n * Functions for creating and filling table drawing objects.\n *\n * @remarks\n * A table is drawn at a fixed position of the pane (`position.*`), not at a bar. Tables have no getters in\n * PineScript; the script API returns the live tables in `result.tables`.\n *\n * PineScript rules:\n * - `table.cell` defines a cell: the arguments it does not give get their default, a previous definition of the\n * cell is replaced\n * - `table.cell_set_*` changes one property of a cell (a cell that was not defined is created)\n * - a column or row outside the table is a runtime error\n * - a deleted table is `na`: its functions do nothing\n *\n * @version 6\n */\n\nimport { all as allDrawings, isDeleted, register, remove } from '../drawing/registry.js';\nimport type { Table, TableCell, color } from '../types/index.js';\n\ntype TablePosition = Table['position'];\ntype HAlign = 'left' | 'center' | 'right';\ntype VAlign = 'top' | 'center' | 'bottom';\ntype FontFamily = 'default' | 'monospace';\n\n/**\n * Creates a new table (PineScript `table.new`).\n *\n * @example\n * ```typescript\n * const t = table.new(position.top_right, 2, 3, '#131722', '#787B86', 1);\n * table.cell(t, 0, 0, 'RSI', 0, 0, '#FFFFFF');\n * ```\n */\nexport function new_table(\n position: TablePosition,\n columns: number,\n rows: number,\n bgcolor?: color,\n frame_color?: color,\n frame_width?: number,\n border_color?: color,\n border_width?: number,\n force_overlay?: boolean\n): Table {\n return register('table', {\n position,\n columns,\n rows,\n bgcolor,\n frame_color,\n frame_width,\n border_color,\n border_width,\n force_overlay: force_overlay ?? false,\n cells: new Map(),\n merges: [],\n });\n}\n\nfunction checkCell(caller: string, id: Table, column: number, row: number): void {\n if (!(column >= 0 && column < id.columns && row >= 0 && row < id.rows)) {\n throw new RangeError(\n `${caller}: column ${column}, row ${row} is outside the table (${id.columns} columns, ${id.rows} rows).`\n );\n }\n}\n\nconst key = (column: number, row: number): string => `${column},${row}`;\n\n/** The cell at column / row, created when it was not defined. */\nfunction cellOf(caller: string, id: Table, column: number, row: number): TableCell {\n checkCell(caller, id, column, row);\n const cells = (id.cells ??= new Map());\n let cell = cells.get(key(column, row));\n if (!cell) cells.set(key(column, row), (cell = { text: '' }));\n return cell;\n}\n\n/**\n * Defines a cell (PineScript `table.cell`): its text and properties. Omitted properties get their default.\n */\nexport function cell(\n table_id: Table,\n column: number,\n row: number,\n text?: string,\n width?: number,\n height?: number,\n text_color?: color,\n text_halign?: HAlign,\n text_valign?: VAlign,\n text_size?: string | number,\n bgcolor?: color,\n tooltip?: string,\n text_font_family?: FontFamily,\n text_formatting?: number\n): void {\n if (isDeleted(table_id)) return;\n checkCell('table.cell()', table_id, column, row);\n (table_id.cells ??= new Map()).set(key(column, row), {\n text: text ?? '',\n width,\n height,\n text_color,\n text_halign,\n text_valign,\n text_size,\n bgcolor,\n tooltip,\n text_font_family,\n text_formatting,\n });\n}\n\nfunction setCell<K extends keyof TableCell>(name: string, field: K) {\n return (table_id: Table, column: number, row: number, value: TableCell[K]): void => {\n if (isDeleted(table_id)) return;\n cellOf(`table.${name}()`, table_id, column, row)[field] = value;\n };\n}\n\n/** Sets the text of a cell. */\nexport const cell_set_text = setCell('cell_set_text', 'text');\n/** Sets the width of a cell (% of the chart width; 0 fits the text). */\nexport const cell_set_width = setCell('cell_set_width', 'width');\n/** Sets the height of a cell (% of the chart height; 0 fits the text). */\nexport const cell_set_height = setCell('cell_set_height', 'height');\n/** Sets the text colour of a cell. */\nexport const cell_set_text_color = setCell('cell_set_text_color', 'text_color');\n/** Sets the horizontal text alignment of a cell. */\nexport const cell_set_text_halign = setCell('cell_set_text_halign', 'text_halign');\n/** Sets the vertical text alignment of a cell. */\nexport const cell_set_text_valign = setCell('cell_set_text_valign', 'text_valign');\n/** Sets the text size of a cell. */\nexport const cell_set_text_size = setCell('cell_set_text_size', 'text_size');\n/** Sets the background colour of a cell. */\nexport const cell_set_bgcolor = setCell('cell_set_bgcolor', 'bgcolor');\n/** Sets the tooltip of a cell. */\nexport const cell_set_tooltip = setCell('cell_set_tooltip', 'tooltip');\n/** Sets the font family of a cell. */\nexport const cell_set_text_font_family = setCell('cell_set_text_font_family', 'text_font_family');\n/** Sets the text formatting of a cell (`text.format_*` flags). */\nexport const cell_set_text_formatting = setCell('cell_set_text_formatting', 'text_formatting');\n\n/**\n * Merges the cells from start_column / start_row to end_column / end_row (PineScript `table.merge_cells`). The\n * merged cell shows the content of the start cell.\n */\nexport function merge_cells(\n table_id: Table,\n start_column: number,\n start_row: number,\n end_column: number,\n end_row: number\n): void {\n if (isDeleted(table_id)) return;\n checkCell('table.merge_cells()', table_id, start_column, start_row);\n checkCell('table.merge_cells()', table_id, end_column, end_row);\n if (end_column < start_column || end_row < start_row) {\n throw new RangeError('table.merge_cells(): the end cell is before the start cell.');\n }\n (table_id.merges ??= []).push({ start_column, start_row, end_column, end_row });\n}\n\n/**\n * Removes the cells from start_column / start_row to end_column / end_row (PineScript `table.clear`; default end:\n * the start cell), and the merges that start in that range.\n */\nexport function clear(\n table_id: Table,\n start_column: number,\n start_row: number,\n end_column: number = start_column,\n end_row: number = start_row\n): void {\n if (isDeleted(table_id)) return;\n checkCell('table.clear()', table_id, start_column, start_row);\n checkCell('table.clear()', table_id, end_column, end_row);\n const inside = (column: number, row: number): boolean =>\n column >= start_column && column <= end_column && row >= start_row && row <= end_row;\n for (let column = start_column; column <= end_column; column++) {\n for (let row = start_row; row <= end_row; row++) table_id.cells?.delete(key(column, row));\n }\n if (table_id.merges) table_id.merges = table_id.merges.filter((m) => !inside(m.start_column, m.start_row));\n}\n\nfunction setTable<K extends keyof Table>(field: K) {\n return (table_id: Table, value: Table[K]): void => {\n if (isDeleted(table_id)) return;\n table_id[field] = value;\n };\n}\n\n/** Moves the table to another position (`position.*`). */\nexport const set_position = setTable('position');\n/** Sets the background colour of the table. */\nexport const set_bgcolor = setTable('bgcolor');\n/** Sets the colour of the outer frame. */\nexport const set_frame_color = setTable('frame_color');\n/** Sets the width of the outer frame. */\nexport const set_frame_width = setTable('frame_width');\n/** Sets the colour of the cell borders. */\nexport const set_border_color = setTable('border_color');\n/** Sets the width of the cell borders. */\nexport const set_border_width = setTable('border_width');\n\n/** Deletes the table (PineScript `table.delete`). */\nexport function delete_table(table_id: Table): void {\n remove('table', table_id);\n}\n\n/** All live tables, in creation order (PineScript `table.all`). A new array. */\nexport function all(): Table[] {\n return allDrawings('table');\n}\n\n// Alias to match PineScript API\nexport { new_table as new };\nexport { delete_table as delete };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,sBAAgE;AAiBzD,SAAS,UACd,UACA,SACA,MACA,SACA,aACA,aACA,cACA,cACA,eACO;AACP,aAAO,0BAAS,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,iBAAiB;AAAA,IAChC,OAAO,oBAAI,IAAI;AAAA,IACf,QAAQ,CAAC;AAAA,EACX,CAAC;AACH;AAEA,SAAS,UAAU,QAAgB,IAAW,QAAgB,KAAmB;AAC/E,MAAI,EAAE,UAAU,KAAK,SAAS,GAAG,WAAW,OAAO,KAAK,MAAM,GAAG,OAAO;AACtE,UAAM,IAAI;AAAA,MACR,GAAG,MAAM,YAAY,MAAM,SAAS,GAAG,0BAA0B,GAAG,OAAO,aAAa,GAAG,IAAI;AAAA,IACjG;AAAA,EACF;AACF;AAEA,MAAM,MAAM,CAAC,QAAgB,QAAwB,GAAG,MAAM,IAAI,GAAG;AAGrE,SAAS,OAAO,QAAgB,IAAW,QAAgB,KAAwB;AACjF,YAAU,QAAQ,IAAI,QAAQ,GAAG;AACjC,QAAM,QAAS,GAAG,UAAU,oBAAI,IAAI;AACpC,MAAIA,QAAO,MAAM,IAAI,IAAI,QAAQ,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|
6
|
+
"names": ["cell", "allDrawings"]
|
|
7
|
+
}
|
package/dist/cjs/text/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Text namespace
|
|
3
|
-
* PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting
|
|
3
|
+
* PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting`, and the
|
|
4
|
+
* `text.align_*` / `text.wrap_*` constants.
|
|
4
5
|
*
|
|
5
|
-
* The values are flags that add up, as in PineScript (`text.format_bold + text.format_italic`).
|
|
6
|
+
* The format values are flags that add up, as in PineScript (`text.format_bold + text.format_italic`).
|
|
6
7
|
* They are the values PineScript uses for drawn labels and boxes.
|
|
7
8
|
*/
|
|
8
9
|
/** No formatting. */
|
|
@@ -11,4 +12,18 @@ export declare const format_none = 0;
|
|
|
11
12
|
export declare const format_bold = 1;
|
|
12
13
|
/** Italic text. */
|
|
13
14
|
export declare const format_italic = 2;
|
|
15
|
+
/** Text aligned to the left (`table.cell`, `box.new`, `label.new` textalign). */
|
|
16
|
+
export declare const align_left: "left";
|
|
17
|
+
/** Text centred horizontally or vertically. */
|
|
18
|
+
export declare const align_center: "center";
|
|
19
|
+
/** Text aligned to the right. */
|
|
20
|
+
export declare const align_right: "right";
|
|
21
|
+
/** Text aligned to the top (`table.cell`, `box.new` text_valign). */
|
|
22
|
+
export declare const align_top: "top";
|
|
23
|
+
/** Text aligned to the bottom. */
|
|
24
|
+
export declare const align_bottom: "bottom";
|
|
25
|
+
/** Text wrapped to the box width (`box.new` text_wrap). */
|
|
26
|
+
export declare const wrap_auto: "auto";
|
|
27
|
+
/** Text not wrapped. */
|
|
28
|
+
export declare const wrap_none: "none";
|
|
14
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAqB;AACrB,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,iBAAiB;AACjB,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,mBAAmB;AACnB,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,iFAAiF;AACjF,eAAO,MAAM,UAAU,EAAG,MAAe,CAAC;AAC1C,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAC9C,iCAAiC;AACjC,eAAO,MAAM,WAAW,EAAG,OAAgB,CAAC;AAC5C,qEAAqE;AACrE,eAAO,MAAM,SAAS,EAAG,KAAc,CAAC;AACxC,kCAAkC;AAClC,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAC9C,2DAA2D;AAC3D,eAAO,MAAM,SAAS,EAAG,MAAe,CAAC;AACzC,wBAAwB;AACxB,eAAO,MAAM,SAAS,EAAG,MAAe,CAAC"}
|
package/dist/cjs/text/index.js
CHANGED
|
@@ -18,12 +18,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var text_exports = {};
|
|
20
20
|
__export(text_exports, {
|
|
21
|
+
align_bottom: () => align_bottom,
|
|
22
|
+
align_center: () => align_center,
|
|
23
|
+
align_left: () => align_left,
|
|
24
|
+
align_right: () => align_right,
|
|
25
|
+
align_top: () => align_top,
|
|
21
26
|
format_bold: () => format_bold,
|
|
22
27
|
format_italic: () => format_italic,
|
|
23
|
-
format_none: () => format_none
|
|
28
|
+
format_none: () => format_none,
|
|
29
|
+
wrap_auto: () => wrap_auto,
|
|
30
|
+
wrap_none: () => wrap_none
|
|
24
31
|
});
|
|
25
32
|
module.exports = __toCommonJS(text_exports);
|
|
26
33
|
const format_none = 0;
|
|
27
34
|
const format_bold = 1;
|
|
28
35
|
const format_italic = 2;
|
|
36
|
+
const align_left = "left";
|
|
37
|
+
const align_center = "center";
|
|
38
|
+
const align_right = "right";
|
|
39
|
+
const align_top = "top";
|
|
40
|
+
const align_bottom = "bottom";
|
|
41
|
+
const wrap_auto = "auto";
|
|
42
|
+
const wrap_none = "none";
|
|
29
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/text/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Text namespace\n * PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Text namespace\n * PineScript `text.format_*` constants for `label.set_text_formatting` and `box.set_text_formatting`, and the\n * `text.align_*` / `text.wrap_*` constants.\n *\n * The format values are flags that add up, as in PineScript (`text.format_bold + text.format_italic`).\n * They are the values PineScript uses for drawn labels and boxes.\n */\n\n/** No formatting. */\nexport const format_none = 0;\n/** Bold text. */\nexport const format_bold = 1;\n/** Italic text. */\nexport const format_italic = 2;\n\n/** Text aligned to the left (`table.cell`, `box.new`, `label.new` textalign). */\nexport const align_left = 'left' as const;\n/** Text centred horizontally or vertically. */\nexport const align_center = 'center' as const;\n/** Text aligned to the right. */\nexport const align_right = 'right' as const;\n/** Text aligned to the top (`table.cell`, `box.new` text_valign). */\nexport const align_top = 'top' as const;\n/** Text aligned to the bottom. */\nexport const align_bottom = 'bottom' as const;\n/** Text wrapped to the box width (`box.new` text_wrap). */\nexport const wrap_auto = 'auto' as const;\n/** Text not wrapped. */\nexport const wrap_none = 'none' as const;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,cAAc;AAEpB,MAAM,cAAc;AAEpB,MAAM,gBAAgB;AAGtB,MAAM,aAAa;AAEnB,MAAM,eAAe;AAErB,MAAM,cAAc;AAEpB,MAAM,YAAY;AAElB,MAAM,eAAe;AAErB,MAAM,YAAY;AAElB,MAAM,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -181,8 +181,21 @@ export interface Table {
|
|
|
181
181
|
border_width?: number;
|
|
182
182
|
/** Table background color */
|
|
183
183
|
bgcolor?: color;
|
|
184
|
-
/**
|
|
184
|
+
/** Display on the main chart pane (PineScript force_overlay) */
|
|
185
|
+
force_overlay?: boolean;
|
|
186
|
+
/** Cells by "column,row" */
|
|
185
187
|
cells?: Map<string, TableCell>;
|
|
188
|
+
/** Merged cell ranges (PineScript table.merge_cells) */
|
|
189
|
+
merges?: TableMerge[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Merged cell range of a table
|
|
193
|
+
*/
|
|
194
|
+
export interface TableMerge {
|
|
195
|
+
start_column: number;
|
|
196
|
+
start_row: number;
|
|
197
|
+
end_column: number;
|
|
198
|
+
end_row: number;
|
|
186
199
|
}
|
|
187
200
|
/**
|
|
188
201
|
* Table cell data
|
|
@@ -208,6 +221,8 @@ export interface TableCell {
|
|
|
208
221
|
tooltip?: string;
|
|
209
222
|
/** Text font family */
|
|
210
223
|
text_font_family?: 'default' | 'monospace';
|
|
224
|
+
/** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */
|
|
225
|
+
text_formatting?: number;
|
|
211
226
|
}
|
|
212
227
|
export type series_line = series<Line>;
|
|
213
228
|
export type series_box = series<Box>;
|
|
@@ -296,6 +311,20 @@ export declare const xloc: {
|
|
|
296
311
|
/** X-coordinates are UNIX timestamps in milliseconds */
|
|
297
312
|
bar_time: "bar_time";
|
|
298
313
|
};
|
|
314
|
+
/**
|
|
315
|
+
* Table position constants (PineScript `position.*`), for `table.new` and `table.set_position`
|
|
316
|
+
*/
|
|
317
|
+
export declare const position: {
|
|
318
|
+
top_left: "top_left";
|
|
319
|
+
top_center: "top_center";
|
|
320
|
+
top_right: "top_right";
|
|
321
|
+
middle_left: "middle_left";
|
|
322
|
+
middle_center: "middle_center";
|
|
323
|
+
middle_right: "middle_right";
|
|
324
|
+
bottom_left: "bottom_left";
|
|
325
|
+
bottom_center: "bottom_center";
|
|
326
|
+
bottom_right: "bottom_right";
|
|
327
|
+
};
|
|
299
328
|
/**
|
|
300
329
|
* ChartPoint interface - Represents a point on the chart
|
|
301
330
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AACzB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAC3B,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC;AAE3B,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAGpC,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC5B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACrC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACzC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACvC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAGzC,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC;AAC7B,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC;AACjC,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC;AAC/B,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,YAAY,GAAG,KAAK,CAA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AAK,GAAG,IAAI,CAAC;IAClC,iBAAiB;IACjB,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnD,2BAA2B;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAGD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var types_exports = {};
|
|
20
20
|
__export(types_exports, {
|
|
21
21
|
na: () => na,
|
|
22
|
+
position: () => position,
|
|
22
23
|
xloc: () => xloc
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -29,4 +30,15 @@ const xloc = {
|
|
|
29
30
|
/** X-coordinates are UNIX timestamps in milliseconds */
|
|
30
31
|
bar_time: "bar_time"
|
|
31
32
|
};
|
|
33
|
+
const position = {
|
|
34
|
+
top_left: "top_left",
|
|
35
|
+
top_center: "top_center",
|
|
36
|
+
top_right: "top_right",
|
|
37
|
+
middle_left: "middle_left",
|
|
38
|
+
middle_center: "middle_center",
|
|
39
|
+
middle_right: "middle_right",
|
|
40
|
+
bottom_left: "bottom_left",
|
|
41
|
+
bottom_center: "bottom_center",
|
|
42
|
+
bottom_right: "bottom_right"
|
|
43
|
+
};
|
|
32
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Core types for OakScriptJS\n * These types mirror the PineScript type system\n */\n\n// Basic types\nexport type int = number;\nexport type float = number;\nexport type bool = boolean;\n//export type string = string;\nexport type color = string | number;\n\n// Series types - In PineScript, series are time-series arrays\nexport type series<T> = T[];\nexport type series_int = series<int>;\nexport type series_float = series<float>;\nexport type series_bool = series<bool>;\nexport type series_string = series<string>;\nexport type series_color = series<color>;\n\n// Simple types (non-series)\nexport type simple_int = int;\nexport type simple_float = float;\nexport type simple_bool = bool;\nexport type simple_string = string;\nexport type simple_color = color;\n\n// Input types\nexport type input_int = int;\nexport type input_float = float;\nexport type input_bool = bool;\nexport type input_string = string;\nexport type input_color = color;\n\n// Const types (compile-time constants)\nexport type const_int = int;\nexport type const_float = float;\nexport type const_bool = bool;\nexport type const_string = string;\nexport type const_color = color;\n\n// Source types for indicators\nexport type Source = series_float;\n\n// Array types\n// PineScript arrays are JS arrays; aliased for API parity and future extension.\nexport type PineArray<T> = Array<T>;\n\n// Map types\n// PineScript maps are JS Maps: keys in insertion order, exact key equality.\nexport type PineMapKey = number | string | boolean;\nexport type PineMap<K extends PineMapKey, V> = Map<K, V>;\n\n// Matrix types\nexport interface PineMatrix<T> {\n rows: int;\n columns: int;\n data: T[][];\n}\n\n// Drawing object types - Now implemented for computational use!\n// While primarily used for visualization in PineScript, these objects have computational value:\n// - line.get_price() for trend analysis\n// - box getters for gap detection and range breakouts\n\n/**\n * Line object - Represents a line on the chart\n * @remarks\n * While lines are visual in PineScript, line.get_price() provides computational value\n * for detecting trend line breakouts, calculating support/resistance levels, etc.\n */\nexport interface Line {\n /** First point's x coordinate (bar index or UNIX timestamp) */\n x1: number;\n /** First point's y coordinate (price level) */\n y1: number;\n /** Second point's x coordinate (bar index or UNIX timestamp) */\n x2: number;\n /** Second point's y coordinate (price level) */\n y2: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Line color (stored but not used for calculations) */\n color?: color;\n /** Line style (stored but not used for calculations) */\n style?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n /** Line width in pixels (stored but not used for calculations) */\n width?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Box object - Represents a rectangular area on the chart\n * @remarks\n * Box getters (get_top, get_bottom, get_left, get_right) enable gap detection,\n * range breakout analysis, and consolidation zone identification.\n */\nexport interface Box {\n /** Left border x coordinate (bar index or UNIX timestamp) */\n left: number;\n /** Top border y coordinate (price level) */\n top: number;\n /** Right border x coordinate (bar index or UNIX timestamp) */\n right: number;\n /** Bottom border y coordinate (price level) */\n bottom: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Horizontal extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Border color (stored but not used for calculations) */\n border_color?: color;\n /** Border width in pixels (stored but not used for calculations) */\n border_width?: number;\n /** Border style (stored but not used for calculations) */\n border_style?: 'solid' | 'dotted' | 'dashed';\n /** Background fill color (stored but not used for calculations) */\n bgcolor?: color;\n /** Text content displayed in the box */\n text?: string;\n /** Text size */\n text_size?: string | number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text wrapping mode */\n text_wrap?: 'none' | 'auto';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Label object - Represents a label/annotation on the chart\n * @remarks\n * Labels have limited computational value. Primarily used for marking points and displaying text.\n */\nexport interface Label {\n /** X coordinate (bar index or UNIX timestamp) */\n x: number;\n /** Y coordinate (price level when yloc = 'price') */\n y: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Y-axis positioning mode */\n yloc: 'price' | 'abovebar' | 'belowbar';\n /** Label text content */\n text?: string;\n /** Tooltip text shown on hover */\n tooltip?: string;\n /** Border and arrow color */\n color?: color;\n /** Label style */\n style?: 'none' | 'xcross' | 'cross' | 'triangleup' | 'triangledown' | 'flag' | 'circle' |\n 'arrowup' | 'arrowdown' | 'label_up' | 'label_down' | 'label_left' | 'label_right' |\n 'label_lower_left' | 'label_lower_right' | 'label_upper_left' | 'label_upper_right' |\n 'label_center' | 'square' | 'diamond' | 'text_outline';\n /** Text color */\n textcolor?: color;\n /** Label size */\n size?: string | number;\n /** Text alignment */\n textalign?: 'left' | 'center' | 'right';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Linefill object - Represents a filled area between two lines\n * @remarks\n * Minimal computational value. Used to fill channel areas visually.\n */\nexport interface Linefill {\n /** First line reference */\n line1: Line;\n /** Second line reference */\n line2: Line;\n /** Fill color */\n color?: color;\n}\n\n/**\n * Table object - Represents a table for displaying data\n * @remarks\n * Tables have NO computational value (no getter functions in PineScript).\n * Purely for display/visualization purposes.\n */\nexport interface Table {\n /** Table position on chart */\n position: 'top_left' | 'top_center' | 'top_right' |\n 'middle_left' | 'middle_center' | 'middle_right' |\n 'bottom_left' | 'bottom_center' | 'bottom_right';\n /** Number of columns */\n columns: number;\n /** Number of rows */\n rows: number;\n /** Outer frame color */\n frame_color?: color;\n /** Outer frame width */\n frame_width?: number;\n /** Cell border color */\n border_color?: color;\n /** Cell border width */\n border_width?: number;\n /** Table background color */\n bgcolor?: color;\n /** Cell data (internal storage) */\n cells?: Map<string, TableCell>;\n}\n\n/**\n * Table cell data\n */\nexport interface TableCell {\n /** Cell text content */\n text?: string;\n /** Cell width as percentage */\n width?: number;\n /** Cell height as percentage */\n height?: number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text size */\n text_size?: string | number;\n /** Cell background color */\n bgcolor?: color;\n /** Cell tooltip */\n tooltip?: string;\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n}\n\n// Series types for drawing objects\nexport type series_line = series<Line>;\nexport type series_box = series<Box>;\nexport type series_label = series<Label>;\nexport type series_linefill = series<Linefill>;\nexport type series_table = series<Table>;\n\n/**\n * Plot object - Represents a plot instance created by plot() function\n * @remarks\n * In PineScript, plot() returns a reference to a plot instance that can be used with fill().\n * This ID is used to reference the plot for filling between plots.\n */\nexport interface Plot {\n /** Unique identifier for this plot */\n id: string;\n /** Series being plotted */\n series: any;\n /** Plot title */\n title?: string;\n /** Plot color */\n color?: any;\n /** Line width */\n linewidth?: number;\n /** Plot style */\n style?: 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns';\n /** Track price on y-axis */\n trackprice?: boolean;\n /** Histogram base level */\n histbase?: number;\n /** Offset in bars */\n offset?: number;\n /** Join gaps */\n join?: boolean;\n /** Editable in chart */\n editable?: boolean;\n /** Display mode */\n display?: 'all' | 'none';\n}\n\n/**\n * HLine object - Represents a horizontal line instance created by hline() function\n * @remarks\n * In PineScript, hline() returns a reference to an hline instance that can be used with fill().\n * This ID is used to reference the horizontal line for filling between levels.\n */\nexport interface HLine {\n /** Unique identifier for this hline */\n id: string;\n /** Price level for the horizontal line */\n price: number;\n /** Line title */\n title?: string;\n /** Line color */\n color?: any;\n /** Line style */\n linestyle?: 'solid' | 'dashed' | 'dotted';\n /** Line width */\n linewidth?: number;\n /** Editable in chart */\n editable?: boolean;\n}\n\n// Series types for plot and hline (always series qualifier in PineScript)\nexport type series_plot = Plot;\nexport type series_hline = HLine;\n\n// Excluded types (StrategyEntry, StrategyExit) - not used in calculation-only library\n\n// Bar data\nexport interface Bar {\n time: int;\n open: float;\n high: float;\n low: float;\n close: float;\n volume?: float;\n}\n\n// OHLC data type\nexport interface OHLC {\n open: series_float;\n high: series_float;\n low: series_float;\n close: series_float;\n}\n\n// Constants\nexport const na = null;\nexport type na = null;\n\n/**\n * X-axis location constants\n * Used to specify whether x-coordinates are bar indices or timestamps\n */\nexport const xloc = {\n /** X-coordinates are bar indices */\n bar_index: 'bar_index' as const,\n /** X-coordinates are UNIX timestamps in milliseconds */\n bar_time: 'bar_time' as const,\n};\n\n/**\n * ChartPoint interface - Represents a point on the chart\n * @remarks\n * A chart point can have time, index, and price coordinates.\n * At least one of time or index should be provided for x-coordinate positioning.\n */\nexport interface ChartPoint {\n /** UNIX timestamp in milliseconds (null if using bar index) */\n readonly time: number | null;\n /** Bar index (null if using time) */\n readonly index: number | null;\n /** Y-axis price value */\n readonly price: number;\n}\n\n/**\n * Polyline interface - Represents a polyline on the chart\n * @remarks\n * A polyline connects multiple chart points with line segments.\n * When closed, it forms a polygon that can be filled with color.\n */\nexport interface Polyline {\n /** Unique identifier for this polyline */\n readonly id: string;\n /** Array of chart points that define the polyline */\n readonly points: readonly ChartPoint[];\n /** If true, use curved line segments (not yet supported - uses straight lines) */\n readonly curved: boolean;\n /** If true, connect the first point to the last point */\n readonly closed: boolean;\n /** X-coordinate mode: 'bar_index' or 'bar_time' */\n readonly xloc: 'bar_index' | 'bar_time';\n /** Color of line segments */\n readonly line_color: color;\n /** Fill color for closed polylines (null for no fill) */\n readonly fill_color: color | null;\n /** Line style */\n readonly line_style: 'solid' | 'dotted' | 'dashed';\n /** Line width in pixels */\n readonly line_width: number;\n /** Force display on main pane */\n readonly force_overlay: boolean;\n}\n\n// Series types for chart point and polyline\nexport type series_chartpoint = series<ChartPoint>;\nexport type series_polyline = series<Polyline>;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Core types for OakScriptJS\n * These types mirror the PineScript type system\n */\n\n// Basic types\nexport type int = number;\nexport type float = number;\nexport type bool = boolean;\n//export type string = string;\nexport type color = string | number;\n\n// Series types - In PineScript, series are time-series arrays\nexport type series<T> = T[];\nexport type series_int = series<int>;\nexport type series_float = series<float>;\nexport type series_bool = series<bool>;\nexport type series_string = series<string>;\nexport type series_color = series<color>;\n\n// Simple types (non-series)\nexport type simple_int = int;\nexport type simple_float = float;\nexport type simple_bool = bool;\nexport type simple_string = string;\nexport type simple_color = color;\n\n// Input types\nexport type input_int = int;\nexport type input_float = float;\nexport type input_bool = bool;\nexport type input_string = string;\nexport type input_color = color;\n\n// Const types (compile-time constants)\nexport type const_int = int;\nexport type const_float = float;\nexport type const_bool = bool;\nexport type const_string = string;\nexport type const_color = color;\n\n// Source types for indicators\nexport type Source = series_float;\n\n// Array types\n// PineScript arrays are JS arrays; aliased for API parity and future extension.\nexport type PineArray<T> = Array<T>;\n\n// Map types\n// PineScript maps are JS Maps: keys in insertion order, exact key equality.\nexport type PineMapKey = number | string | boolean;\nexport type PineMap<K extends PineMapKey, V> = Map<K, V>;\n\n// Matrix types\nexport interface PineMatrix<T> {\n rows: int;\n columns: int;\n data: T[][];\n}\n\n// Drawing object types - Now implemented for computational use!\n// While primarily used for visualization in PineScript, these objects have computational value:\n// - line.get_price() for trend analysis\n// - box getters for gap detection and range breakouts\n\n/**\n * Line object - Represents a line on the chart\n * @remarks\n * While lines are visual in PineScript, line.get_price() provides computational value\n * for detecting trend line breakouts, calculating support/resistance levels, etc.\n */\nexport interface Line {\n /** First point's x coordinate (bar index or UNIX timestamp) */\n x1: number;\n /** First point's y coordinate (price level) */\n y1: number;\n /** Second point's x coordinate (bar index or UNIX timestamp) */\n x2: number;\n /** Second point's y coordinate (price level) */\n y2: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Line color (stored but not used for calculations) */\n color?: color;\n /** Line style (stored but not used for calculations) */\n style?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n /** Line width in pixels (stored but not used for calculations) */\n width?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Box object - Represents a rectangular area on the chart\n * @remarks\n * Box getters (get_top, get_bottom, get_left, get_right) enable gap detection,\n * range breakout analysis, and consolidation zone identification.\n */\nexport interface Box {\n /** Left border x coordinate (bar index or UNIX timestamp) */\n left: number;\n /** Top border y coordinate (price level) */\n top: number;\n /** Right border x coordinate (bar index or UNIX timestamp) */\n right: number;\n /** Bottom border y coordinate (price level) */\n bottom: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Horizontal extension mode */\n extend: 'none' | 'left' | 'right' | 'both';\n /** Border color (stored but not used for calculations) */\n border_color?: color;\n /** Border width in pixels (stored but not used for calculations) */\n border_width?: number;\n /** Border style (stored but not used for calculations) */\n border_style?: 'solid' | 'dotted' | 'dashed';\n /** Background fill color (stored but not used for calculations) */\n bgcolor?: color;\n /** Text content displayed in the box */\n text?: string;\n /** Text size */\n text_size?: string | number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text wrapping mode */\n text_wrap?: 'none' | 'auto';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Label object - Represents a label/annotation on the chart\n * @remarks\n * Labels have limited computational value. Primarily used for marking points and displaying text.\n */\nexport interface Label {\n /** X coordinate (bar index or UNIX timestamp) */\n x: number;\n /** Y coordinate (price level when yloc = 'price') */\n y: number;\n /** X-axis coordinate system */\n xloc: 'bar_index' | 'bar_time';\n /** Y-axis positioning mode */\n yloc: 'price' | 'abovebar' | 'belowbar';\n /** Label text content */\n text?: string;\n /** Tooltip text shown on hover */\n tooltip?: string;\n /** Border and arrow color */\n color?: color;\n /** Label style */\n style?: 'none' | 'xcross' | 'cross' | 'triangleup' | 'triangledown' | 'flag' | 'circle' |\n 'arrowup' | 'arrowdown' | 'label_up' | 'label_down' | 'label_left' | 'label_right' |\n 'label_lower_left' | 'label_lower_right' | 'label_upper_left' | 'label_upper_right' |\n 'label_center' | 'square' | 'diamond' | 'text_outline';\n /** Text color */\n textcolor?: color;\n /** Label size */\n size?: string | number;\n /** Text alignment */\n textalign?: 'left' | 'center' | 'right';\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n}\n\n/**\n * Linefill object - Represents a filled area between two lines\n * @remarks\n * Minimal computational value. Used to fill channel areas visually.\n */\nexport interface Linefill {\n /** First line reference */\n line1: Line;\n /** Second line reference */\n line2: Line;\n /** Fill color */\n color?: color;\n}\n\n/**\n * Table object - Represents a table for displaying data\n * @remarks\n * Tables have NO computational value (no getter functions in PineScript).\n * Purely for display/visualization purposes.\n */\nexport interface Table {\n /** Table position on chart */\n position: 'top_left' | 'top_center' | 'top_right' |\n 'middle_left' | 'middle_center' | 'middle_right' |\n 'bottom_left' | 'bottom_center' | 'bottom_right';\n /** Number of columns */\n columns: number;\n /** Number of rows */\n rows: number;\n /** Outer frame color */\n frame_color?: color;\n /** Outer frame width */\n frame_width?: number;\n /** Cell border color */\n border_color?: color;\n /** Cell border width */\n border_width?: number;\n /** Table background color */\n bgcolor?: color;\n /** Display on the main chart pane (PineScript force_overlay) */\n force_overlay?: boolean;\n /** Cells by \"column,row\" */\n cells?: Map<string, TableCell>;\n /** Merged cell ranges (PineScript table.merge_cells) */\n merges?: TableMerge[];\n}\n\n/**\n * Merged cell range of a table\n */\nexport interface TableMerge {\n start_column: number;\n start_row: number;\n end_column: number;\n end_row: number;\n}\n\n/**\n * Table cell data\n */\nexport interface TableCell {\n /** Cell text content */\n text?: string;\n /** Cell width as percentage */\n width?: number;\n /** Cell height as percentage */\n height?: number;\n /** Text color */\n text_color?: color;\n /** Horizontal text alignment */\n text_halign?: 'left' | 'center' | 'right';\n /** Vertical text alignment */\n text_valign?: 'top' | 'center' | 'bottom';\n /** Text size */\n text_size?: string | number;\n /** Cell background color */\n bgcolor?: color;\n /** Cell tooltip */\n tooltip?: string;\n /** Text font family */\n text_font_family?: 'default' | 'monospace';\n /** Text formatting flags: 0 none, 1 bold, 2 italic, 3 bold + italic (PineScript text.format_*) */\n text_formatting?: number;\n}\n\n// Series types for drawing objects\nexport type series_line = series<Line>;\nexport type series_box = series<Box>;\nexport type series_label = series<Label>;\nexport type series_linefill = series<Linefill>;\nexport type series_table = series<Table>;\n\n/**\n * Plot object - Represents a plot instance created by plot() function\n * @remarks\n * In PineScript, plot() returns a reference to a plot instance that can be used with fill().\n * This ID is used to reference the plot for filling between plots.\n */\nexport interface Plot {\n /** Unique identifier for this plot */\n id: string;\n /** Series being plotted */\n series: any;\n /** Plot title */\n title?: string;\n /** Plot color */\n color?: any;\n /** Line width */\n linewidth?: number;\n /** Plot style */\n style?: 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns';\n /** Track price on y-axis */\n trackprice?: boolean;\n /** Histogram base level */\n histbase?: number;\n /** Offset in bars */\n offset?: number;\n /** Join gaps */\n join?: boolean;\n /** Editable in chart */\n editable?: boolean;\n /** Display mode */\n display?: 'all' | 'none';\n}\n\n/**\n * HLine object - Represents a horizontal line instance created by hline() function\n * @remarks\n * In PineScript, hline() returns a reference to an hline instance that can be used with fill().\n * This ID is used to reference the horizontal line for filling between levels.\n */\nexport interface HLine {\n /** Unique identifier for this hline */\n id: string;\n /** Price level for the horizontal line */\n price: number;\n /** Line title */\n title?: string;\n /** Line color */\n color?: any;\n /** Line style */\n linestyle?: 'solid' | 'dashed' | 'dotted';\n /** Line width */\n linewidth?: number;\n /** Editable in chart */\n editable?: boolean;\n}\n\n// Series types for plot and hline (always series qualifier in PineScript)\nexport type series_plot = Plot;\nexport type series_hline = HLine;\n\n// Excluded types (StrategyEntry, StrategyExit) - not used in calculation-only library\n\n// Bar data\nexport interface Bar {\n time: int;\n open: float;\n high: float;\n low: float;\n close: float;\n volume?: float;\n}\n\n// OHLC data type\nexport interface OHLC {\n open: series_float;\n high: series_float;\n low: series_float;\n close: series_float;\n}\n\n// Constants\nexport const na = null;\nexport type na = null;\n\n/**\n * X-axis location constants\n * Used to specify whether x-coordinates are bar indices or timestamps\n */\nexport const xloc = {\n /** X-coordinates are bar indices */\n bar_index: 'bar_index' as const,\n /** X-coordinates are UNIX timestamps in milliseconds */\n bar_time: 'bar_time' as const,\n};\n\n/**\n * Table position constants (PineScript `position.*`), for `table.new` and `table.set_position`\n */\nexport const position = {\n top_left: 'top_left' as const,\n top_center: 'top_center' as const,\n top_right: 'top_right' as const,\n middle_left: 'middle_left' as const,\n middle_center: 'middle_center' as const,\n middle_right: 'middle_right' as const,\n bottom_left: 'bottom_left' as const,\n bottom_center: 'bottom_center' as const,\n bottom_right: 'bottom_right' as const,\n};\n\n/**\n * ChartPoint interface - Represents a point on the chart\n * @remarks\n * A chart point can have time, index, and price coordinates.\n * At least one of time or index should be provided for x-coordinate positioning.\n */\nexport interface ChartPoint {\n /** UNIX timestamp in milliseconds (null if using bar index) */\n readonly time: number | null;\n /** Bar index (null if using time) */\n readonly index: number | null;\n /** Y-axis price value */\n readonly price: number;\n}\n\n/**\n * Polyline interface - Represents a polyline on the chart\n * @remarks\n * A polyline connects multiple chart points with line segments.\n * When closed, it forms a polygon that can be filled with color.\n */\nexport interface Polyline {\n /** Unique identifier for this polyline */\n readonly id: string;\n /** Array of chart points that define the polyline */\n readonly points: readonly ChartPoint[];\n /** If true, use curved line segments (not yet supported - uses straight lines) */\n readonly curved: boolean;\n /** If true, connect the first point to the last point */\n readonly closed: boolean;\n /** X-coordinate mode: 'bar_index' or 'bar_time' */\n readonly xloc: 'bar_index' | 'bar_time';\n /** Color of line segments */\n readonly line_color: color;\n /** Fill color for closed polylines (null for no fill) */\n readonly fill_color: color | null;\n /** Line style */\n readonly line_style: 'solid' | 'dotted' | 'dashed';\n /** Line width in pixels */\n readonly line_width: number;\n /** Force display on main pane */\n readonly force_overlay: boolean;\n}\n\n// Series types for chart point and polyline\nexport type series_chartpoint = series<ChartPoint>;\nexport type series_polyline = series<Polyline>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiWO,MAAM,KAAK;AAOX,MAAM,OAAO;AAAA;AAAA,EAElB,WAAW;AAAA;AAAA,EAEX,UAAU;AACZ;AAKO,MAAM,WAAW;AAAA,EACtB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AAAA,EACf,cAAc;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|