oakscriptjs 0.23.0 → 0.25.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 +25 -1
- package/bin/oakscript.mjs +10 -3
- package/dist/cjs/box/index.d.ts +348 -289
- package/dist/cjs/box/index.d.ts.map +1 -1
- package/dist/cjs/box/index.js.map +2 -2
- package/dist/cjs/check/node.d.ts.map +1 -1
- package/dist/cjs/check/node.js +1 -0
- package/dist/cjs/check/node.js.map +2 -2
- package/dist/cjs/check/preview.d.ts +31 -0
- package/dist/cjs/check/preview.d.ts.map +1 -0
- package/dist/cjs/check/preview.js +303 -0
- package/dist/cjs/check/preview.js.map +7 -0
- package/dist/cjs/color/index.d.ts +11 -11
- package/dist/cjs/color/index.js.map +1 -1
- package/dist/cjs/color/parse.d.ts +2 -0
- package/dist/cjs/color/parse.d.ts.map +1 -1
- package/dist/cjs/color/parse.js +6 -0
- package/dist/cjs/color/parse.js.map +2 -2
- package/dist/cjs/compare/index.d.ts +76 -12
- package/dist/cjs/compare/index.d.ts.map +1 -1
- package/dist/cjs/compare/index.js.map +2 -2
- package/dist/cjs/drawing/registry.d.ts +28 -5
- package/dist/cjs/drawing/registry.d.ts.map +1 -1
- package/dist/cjs/drawing/registry.js +14 -0
- package/dist/cjs/drawing/registry.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/label/index.d.ts +265 -187
- package/dist/cjs/label/index.d.ts.map +1 -1
- package/dist/cjs/label/index.js +1 -1
- package/dist/cjs/label/index.js.map +2 -2
- package/dist/cjs/line/index.d.ts +247 -207
- package/dist/cjs/line/index.d.ts.map +1 -1
- package/dist/cjs/line/index.js.map +2 -2
- package/dist/cjs/linefill/index.d.ts +61 -89
- package/dist/cjs/linefill/index.d.ts.map +1 -1
- package/dist/cjs/linefill/index.js.map +2 -2
- package/dist/cjs/math/index.d.ts +49 -40
- package/dist/cjs/math/index.d.ts.map +1 -1
- package/dist/cjs/math/index.js.map +2 -2
- package/dist/cjs/polyline/index.d.ts +57 -78
- package/dist/cjs/polyline/index.d.ts.map +1 -1
- package/dist/cjs/polyline/index.js.map +2 -2
- package/dist/cjs/runtime/input-active.d.ts +2 -2
- package/dist/cjs/runtime/input-active.js.map +1 -1
- package/dist/cjs/runtime/series.d.ts +241 -161
- package/dist/cjs/runtime/series.d.ts.map +1 -1
- package/dist/cjs/runtime/series.js +223 -127
- package/dist/cjs/runtime/series.js.map +2 -2
- package/dist/cjs/script/api/alert.d.ts +37 -0
- package/dist/cjs/script/api/alert.d.ts.map +1 -0
- package/dist/cjs/script/api/alert.js +17 -0
- package/dist/cjs/script/api/alert.js.map +7 -0
- package/dist/cjs/script/api/calc.d.ts +232 -0
- package/dist/cjs/script/api/calc.d.ts.map +1 -0
- package/dist/cjs/script/api/calc.js +17 -0
- package/dist/cjs/script/api/calc.js.map +7 -0
- package/dist/cjs/script/api/color.d.ts +213 -0
- package/dist/cjs/script/api/color.d.ts.map +1 -0
- package/dist/cjs/script/api/color.js +17 -0
- package/dist/cjs/script/api/color.js.map +7 -0
- package/dist/cjs/script/api/context.d.ts +764 -0
- package/dist/cjs/script/api/context.d.ts.map +1 -0
- package/dist/cjs/script/api/context.js +17 -0
- package/dist/cjs/script/api/context.js.map +7 -0
- package/dist/cjs/script/api/log.d.ts +58 -0
- package/dist/cjs/script/api/log.d.ts.map +1 -0
- package/dist/cjs/script/api/log.js +17 -0
- package/dist/cjs/script/api/log.js.map +7 -0
- package/dist/cjs/script/api/strategy.d.ts +391 -0
- package/dist/cjs/script/api/strategy.d.ts.map +1 -0
- package/dist/cjs/script/api/strategy.js +17 -0
- package/dist/cjs/script/api/strategy.js.map +7 -0
- package/dist/cjs/script/api/ta.d.ts +1012 -0
- package/dist/cjs/script/api/ta.d.ts.map +1 -0
- package/dist/cjs/script/api/ta.js +17 -0
- package/dist/cjs/script/api/ta.js.map +7 -0
- package/dist/cjs/script/api/table.d.ts +479 -0
- package/dist/cjs/script/api/table.d.ts.map +1 -0
- package/dist/cjs/script/api/table.js +17 -0
- package/dist/cjs/script/api/table.js.map +7 -0
- package/dist/cjs/script/constants.d.ts +228 -83
- package/dist/cjs/script/constants.d.ts.map +1 -1
- package/dist/cjs/script/constants.js +87 -0
- package/dist/cjs/script/constants.js.map +2 -2
- package/dist/cjs/script/define.d.ts +94 -0
- package/dist/cjs/script/define.d.ts.map +1 -0
- package/dist/cjs/script/define.js +127 -0
- package/dist/cjs/script/define.js.map +7 -0
- package/dist/cjs/script/drawing-args.d.ts.map +1 -1
- package/dist/cjs/script/drawing-args.js +1 -1
- package/dist/cjs/script/drawing-args.js.map +2 -2
- package/dist/cjs/script/formula.d.ts +53 -0
- package/dist/cjs/script/formula.d.ts.map +1 -0
- package/dist/cjs/script/formula.js +402 -0
- package/dist/cjs/script/formula.js.map +7 -0
- package/dist/cjs/script/globals.d.ts +10 -0
- package/dist/cjs/script/globals.d.ts.map +1 -1
- package/dist/cjs/script/globals.js.map +1 -1
- package/dist/cjs/script/index.d.ts +1065 -1006
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +532 -61
- package/dist/cjs/script/index.js.map +3 -3
- package/dist/cjs/script/json.d.ts +117 -0
- package/dist/cjs/script/json.d.ts.map +1 -0
- package/dist/cjs/script/json.js +321 -0
- package/dist/cjs/script/json.js.map +7 -0
- package/dist/cjs/security/other.d.ts +8 -3
- package/dist/cjs/security/other.d.ts.map +1 -1
- package/dist/cjs/security/other.js +23 -6
- package/dist/cjs/security/other.js.map +2 -2
- package/dist/cjs/str/index.d.ts +50 -75
- package/dist/cjs/str/index.d.ts.map +1 -1
- package/dist/cjs/str/index.js +2 -2
- package/dist/cjs/str/index.js.map +2 -2
- package/dist/cjs/strategy/index.d.ts +102 -1
- package/dist/cjs/strategy/index.d.ts.map +1 -1
- package/dist/cjs/strategy/index.js.map +2 -2
- package/dist/cjs/table/index.d.ts +330 -49
- package/dist/cjs/table/index.d.ts.map +1 -1
- package/dist/cjs/table/index.js +55 -27
- package/dist/cjs/table/index.js.map +2 -2
- package/dist/cjs/text/index.d.ts +12 -14
- package/dist/cjs/text/index.d.ts.map +1 -1
- package/dist/cjs/text/index.js.map +2 -2
- package/dist/cjs/types/index.d.ts +15 -8
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +12 -3
- package/dist/cjs/types/index.js.map +2 -2
- package/dist/esm/box/index.d.ts +348 -289
- package/dist/esm/box/index.d.ts.map +1 -1
- package/dist/esm/box/index.js +276 -276
- package/dist/esm/box/index.js.map +1 -1
- package/dist/esm/check/node.d.ts.map +1 -1
- package/dist/esm/check/node.js +1 -0
- package/dist/esm/check/node.js.map +1 -1
- package/dist/esm/check/preview.d.ts +31 -0
- package/dist/esm/check/preview.d.ts.map +1 -0
- package/dist/esm/check/preview.js +296 -0
- package/dist/esm/check/preview.js.map +1 -0
- package/dist/esm/color/index.d.ts +11 -11
- package/dist/esm/color/index.js +11 -11
- package/dist/esm/color/parse.d.ts +2 -0
- package/dist/esm/color/parse.d.ts.map +1 -1
- package/dist/esm/color/parse.js +7 -0
- package/dist/esm/color/parse.js.map +1 -1
- package/dist/esm/compare/index.d.ts +76 -12
- package/dist/esm/compare/index.d.ts.map +1 -1
- package/dist/esm/compare/index.js +76 -12
- package/dist/esm/compare/index.js.map +1 -1
- package/dist/esm/drawing/registry.d.ts +28 -5
- package/dist/esm/drawing/registry.d.ts.map +1 -1
- package/dist/esm/drawing/registry.js +39 -3
- package/dist/esm/drawing/registry.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/label/index.d.ts +265 -187
- package/dist/esm/label/index.d.ts.map +1 -1
- package/dist/esm/label/index.js +207 -177
- package/dist/esm/label/index.js.map +1 -1
- package/dist/esm/line/index.d.ts +247 -207
- package/dist/esm/line/index.d.ts.map +1 -1
- package/dist/esm/line/index.js +202 -194
- package/dist/esm/line/index.js.map +1 -1
- package/dist/esm/linefill/index.d.ts +61 -89
- package/dist/esm/linefill/index.d.ts.map +1 -1
- package/dist/esm/linefill/index.js +61 -89
- package/dist/esm/linefill/index.js.map +1 -1
- package/dist/esm/math/index.d.ts +49 -40
- package/dist/esm/math/index.d.ts.map +1 -1
- package/dist/esm/math/index.js +22 -9
- package/dist/esm/math/index.js.map +1 -1
- package/dist/esm/polyline/index.d.ts +57 -78
- package/dist/esm/polyline/index.d.ts.map +1 -1
- package/dist/esm/polyline/index.js +57 -78
- package/dist/esm/polyline/index.js.map +1 -1
- package/dist/esm/runtime/input-active.d.ts +2 -2
- package/dist/esm/runtime/input-active.js +2 -2
- package/dist/esm/runtime/series.d.ts +241 -161
- package/dist/esm/runtime/series.d.ts.map +1 -1
- package/dist/esm/runtime/series.js +241 -161
- package/dist/esm/runtime/series.js.map +1 -1
- package/dist/esm/script/api/alert.d.ts +37 -0
- package/dist/esm/script/api/alert.d.ts.map +1 -0
- package/dist/esm/script/api/alert.js +7 -0
- package/dist/esm/script/api/alert.js.map +1 -0
- package/dist/esm/script/api/calc.d.ts +232 -0
- package/dist/esm/script/api/calc.d.ts.map +1 -0
- package/dist/esm/script/api/calc.js +6 -0
- package/dist/esm/script/api/calc.js.map +1 -0
- package/dist/esm/script/api/color.d.ts +213 -0
- package/dist/esm/script/api/color.d.ts.map +1 -0
- package/dist/esm/script/api/color.js +6 -0
- package/dist/esm/script/api/color.js.map +1 -0
- package/dist/esm/script/api/context.d.ts +764 -0
- package/dist/esm/script/api/context.d.ts.map +1 -0
- package/dist/esm/script/api/context.js +7 -0
- package/dist/esm/script/api/context.js.map +1 -0
- package/dist/esm/script/api/log.d.ts +58 -0
- package/dist/esm/script/api/log.d.ts.map +1 -0
- package/dist/esm/script/api/log.js +6 -0
- package/dist/esm/script/api/log.js.map +1 -0
- package/dist/esm/script/api/strategy.d.ts +391 -0
- package/dist/esm/script/api/strategy.d.ts.map +1 -0
- package/dist/esm/script/api/strategy.js +7 -0
- package/dist/esm/script/api/strategy.js.map +1 -0
- package/dist/esm/script/api/ta.d.ts +1012 -0
- package/dist/esm/script/api/ta.d.ts.map +1 -0
- package/dist/esm/script/api/ta.js +6 -0
- package/dist/esm/script/api/ta.js.map +1 -0
- package/dist/esm/script/api/table.d.ts +479 -0
- package/dist/esm/script/api/table.d.ts.map +1 -0
- package/dist/esm/script/api/table.js +7 -0
- package/dist/esm/script/api/table.js.map +1 -0
- package/dist/esm/script/constants.d.ts +228 -83
- package/dist/esm/script/constants.d.ts.map +1 -1
- package/dist/esm/script/constants.js +110 -24
- package/dist/esm/script/constants.js.map +1 -1
- package/dist/esm/script/define.d.ts +94 -0
- package/dist/esm/script/define.d.ts.map +1 -0
- package/dist/esm/script/define.js +136 -0
- package/dist/esm/script/define.js.map +1 -0
- package/dist/esm/script/drawing-args.d.ts.map +1 -1
- package/dist/esm/script/drawing-args.js +2 -1
- package/dist/esm/script/drawing-args.js.map +1 -1
- package/dist/esm/script/formula.d.ts +53 -0
- package/dist/esm/script/formula.d.ts.map +1 -0
- package/dist/esm/script/formula.js +408 -0
- package/dist/esm/script/formula.js.map +1 -0
- package/dist/esm/script/globals.d.ts +10 -0
- package/dist/esm/script/globals.d.ts.map +1 -1
- package/dist/esm/script/globals.js.map +1 -1
- package/dist/esm/script/index.d.ts +1065 -1006
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +1099 -153
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/script/json.d.ts +117 -0
- package/dist/esm/script/json.d.ts.map +1 -0
- package/dist/esm/script/json.js +375 -0
- package/dist/esm/script/json.js.map +1 -0
- package/dist/esm/security/other.d.ts +8 -3
- package/dist/esm/security/other.d.ts.map +1 -1
- package/dist/esm/security/other.js +45 -10
- package/dist/esm/security/other.js.map +1 -1
- package/dist/esm/str/index.d.ts +50 -75
- package/dist/esm/str/index.d.ts.map +1 -1
- package/dist/esm/str/index.js +51 -76
- package/dist/esm/str/index.js.map +1 -1
- package/dist/esm/strategy/index.d.ts +102 -1
- package/dist/esm/strategy/index.d.ts.map +1 -1
- package/dist/esm/strategy/index.js +1 -1
- package/dist/esm/strategy/index.js.map +1 -1
- package/dist/esm/table/index.d.ts +330 -49
- package/dist/esm/table/index.d.ts.map +1 -1
- package/dist/esm/table/index.js +372 -61
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/text/index.d.ts +12 -14
- package/dist/esm/text/index.d.ts.map +1 -1
- package/dist/esm/text/index.js +12 -14
- package/dist/esm/text/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +15 -8
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +15 -8
- package/dist/esm/types/index.js.map +1 -1
- package/docs/first-indicator.md +152 -0
- package/docs/guide.md +1185 -0
- package/docs/inventory.md +772 -0
- package/docs/no-code.md +207 -0
- package/docs/recipes.md +202 -0
- package/package.json +2 -1
- package/skills/oakscript/SKILL.md +8 -0
- package/skills/oakscript/reference/errors.md +3 -2
- package/skills/oakscript/reference/timeframes-symbols.md +4 -0
- package/src/box/index.ts +348 -289
- package/src/check/node.ts +1 -0
- package/src/check/preview.ts +307 -0
- package/src/color/index.ts +11 -11
- package/src/color/parse.ts +7 -0
- package/src/compare/index.ts +76 -12
- package/src/drawing/registry.ts +44 -5
- package/src/index.ts +1 -1
- package/src/label/index.ts +267 -189
- package/src/line/index.ts +248 -208
- package/src/linefill/index.ts +61 -89
- package/src/math/index.ts +51 -42
- package/src/polyline/index.ts +57 -78
- package/src/runtime/input-active.ts +2 -2
- package/src/runtime/series.ts +243 -163
- package/src/script/api/alert.ts +43 -0
- package/src/script/api/calc.ts +250 -0
- package/src/script/api/color.ts +245 -0
- package/src/script/api/context.ts +944 -0
- package/src/script/api/log.ts +60 -0
- package/src/script/api/strategy.ts +410 -0
- package/src/script/api/ta.ts +1115 -0
- package/src/script/api/table.ts +538 -0
- package/src/script/constants.ts +229 -25
- package/src/script/define.ts +221 -0
- package/src/script/drawing-args.ts +2 -1
- package/src/script/formula.ts +438 -0
- package/src/script/globals.ts +10 -0
- package/src/script/index.ts +1520 -241
- package/src/script/json.ts +457 -0
- package/src/security/other.ts +43 -9
- package/src/str/index.ts +51 -76
- package/src/strategy/index.ts +102 -1
- package/src/table/index.ts +388 -62
- package/src/text/index.ts +12 -14
- package/src/types/index.ts +15 -8
package/dist/esm/table/index.js
CHANGED
|
@@ -27,13 +27,28 @@ function freePosition(position, force_overlay, keep) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Creates a
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* Creates a table fixed at a place of the pane (it does not scroll with the bars) and returns its handle; fill its
|
|
31
|
+
* cells with `table.cell()`. A pane holds one table per position: a live table at the same position (with the same
|
|
32
|
+
* `force_overlay`) is deleted. The arguments after `rows` can also be given by name in an object.
|
|
33
|
+
* @param position - Where the table sits: `position.top_left`, `position.top_center`, `position.top_right`,
|
|
34
|
+
* `position.middle_left`, `position.middle_center`, `position.middle_right`, `position.bottom_left`,
|
|
35
|
+
* `position.bottom_center` or `position.bottom_right`.
|
|
36
|
+
* @param columns - Number of columns.
|
|
37
|
+
* @param rows - Number of rows.
|
|
38
|
+
* @param bgcolor - Background colour of the whole table. Default: none (transparent).
|
|
39
|
+
* @param frame_color - Colour of the outer frame. Default: none.
|
|
40
|
+
* @param frame_width - Width of the outer frame in pixels. Default: 0 (no frame).
|
|
41
|
+
* @param border_color - Colour of the lines between the cells. Default: none.
|
|
42
|
+
* @param border_width - Width of the lines between the cells in pixels. Default: 0 (no lines).
|
|
43
|
+
* @param force_overlay - When true, the table is drawn on the price pane even if the script has its own pane.
|
|
44
|
+
* Default: false.
|
|
45
|
+
* @returns The new table.
|
|
33
46
|
* @example
|
|
34
|
-
* ```
|
|
35
|
-
* const t = table.new(position.top_right, 2,
|
|
36
|
-
*
|
|
47
|
+
* ```js
|
|
48
|
+
* const t = table.new(position.top_right, 2, 1, { bgcolor: color.new(color.black, 20), border_width: 1 });
|
|
49
|
+
* eachBar((c) => {
|
|
50
|
+
* if (c.i === c.n - 1) table.cell(t, 0, 0, "Close", { text_color: color.white });
|
|
51
|
+
* });
|
|
37
52
|
* ```
|
|
38
53
|
*/
|
|
39
54
|
export function new_table(position, columns, rows, bgcolor, frame_color, frame_width, border_color, border_width, force_overlay) {
|
|
@@ -68,7 +83,34 @@ function cellOf(caller, id, column, row) {
|
|
|
68
83
|
return cell;
|
|
69
84
|
}
|
|
70
85
|
/**
|
|
71
|
-
*
|
|
86
|
+
* Writes a cell of a table: its text and look. The properties not given get their default, so calling it again
|
|
87
|
+
* replaces the whole cell; use `table.cell_set_*()` to change one property. A column or row outside the table is an
|
|
88
|
+
* error; on a deleted table it does nothing. The arguments after `row` can also be given by name in an object.
|
|
89
|
+
* @param table_id - The table (from `table.new()`).
|
|
90
|
+
* @param column - Column of the cell, from 0 (left).
|
|
91
|
+
* @param row - Row of the cell, from 0 (top).
|
|
92
|
+
* @param text - Text of the cell; `\n` starts a new line. Default: "".
|
|
93
|
+
* @param width - Width of the cell in percent of the pane's width; 0 fits the text. Default: 0.
|
|
94
|
+
* @param height - Height of the cell in percent of the pane's height; 0 fits the text. Default: 0.
|
|
95
|
+
* @param text_color - Text colour. Default: dark gray (#363A45).
|
|
96
|
+
* @param text_halign - Horizontal alignment of the text: `text.align_left`, `text.align_center` or
|
|
97
|
+
* `text.align_right`. Default: `text.align_center`.
|
|
98
|
+
* @param text_valign - Vertical alignment of the text: `text.align_top`, `text.align_center` or
|
|
99
|
+
* `text.align_bottom`. Default: `text.align_center`.
|
|
100
|
+
* @param text_size - `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`, `size.auto`, or a size in
|
|
101
|
+
* points. Default: `size.auto`.
|
|
102
|
+
* @param bgcolor - Background colour of the cell. Default: none (the table's background shows).
|
|
103
|
+
* @param tooltip - Text shown when the pointer is over the cell. Default: none.
|
|
104
|
+
* @param text_font_family - `font.family_default` or `font.family_monospace`. Default: `font.family_default`.
|
|
105
|
+
* @param text_formatting - `text.format_bold`, `text.format_italic`, their sum, or `text.format_none`.
|
|
106
|
+
* Default: `text.format_none`.
|
|
107
|
+
* @example
|
|
108
|
+
* ```js
|
|
109
|
+
* const t = table.new(position.bottom_right, 2, 1);
|
|
110
|
+
* eachBar((c) => {
|
|
111
|
+
* if (c.i === c.n - 1) table.cell(t, 1, 0, str.tostring(c.close, "#.##"), { bgcolor: color.teal, text_color: color.white });
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
72
114
|
*/
|
|
73
115
|
export function cell(table_id, column, row, text, width, height, text_color, text_halign, text_valign, text_size, bgcolor, tooltip, text_font_family, text_formatting) {
|
|
74
116
|
if (isDeleted(table_id))
|
|
@@ -88,38 +130,208 @@ export function cell(table_id, column, row, text, width, height, text_color, tex
|
|
|
88
130
|
text_formatting,
|
|
89
131
|
});
|
|
90
132
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
133
|
+
/** Sets one property of a cell (the cell is created when it was not defined); nothing on a deleted table. */
|
|
134
|
+
function setCell(name, field, table_id, column, row, value) {
|
|
135
|
+
if (isDeleted(table_id))
|
|
136
|
+
return;
|
|
137
|
+
cellOf(`table.${name}()`, table_id, column, row)[field] = value;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Changes the text of a cell and keeps its other properties. A cell that was not written yet is created.
|
|
141
|
+
* A column or row outside the table is an error; on a deleted table it does nothing.
|
|
142
|
+
* @param table_id - The table.
|
|
143
|
+
* @param column - Column of the cell, from 0.
|
|
144
|
+
* @param row - Row of the cell, from 0.
|
|
145
|
+
* @param value - New text; `\n` starts a new line.
|
|
146
|
+
* @example
|
|
147
|
+
* ```js
|
|
148
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
149
|
+
* eachBar((c) => {
|
|
150
|
+
* if (c.i === c.n - 1) table.cell_set_text(t, 0, 0, "Close " + str.tostring(c.close, "#.##"));
|
|
151
|
+
* });
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export function cell_set_text(table_id, column, row, value) {
|
|
155
|
+
setCell('cell_set_text', 'text', table_id, column, row, value);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Changes the width of a cell. A cell that was not written yet is created.
|
|
159
|
+
* @param table_id - The table.
|
|
160
|
+
* @param column - Column of the cell, from 0.
|
|
161
|
+
* @param row - Row of the cell, from 0.
|
|
162
|
+
* @param value - Width in percent of the pane's width; 0 fits the text.
|
|
163
|
+
* @example
|
|
164
|
+
* ```js
|
|
165
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
166
|
+
* table.cell(t, 0, 0, "Trend");
|
|
167
|
+
* table.cell_set_width(t, 0, 0, 10);
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export function cell_set_width(table_id, column, row, value) {
|
|
171
|
+
setCell('cell_set_width', 'width', table_id, column, row, value);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Changes the height of a cell. A cell that was not written yet is created.
|
|
175
|
+
* @param table_id - The table.
|
|
176
|
+
* @param column - Column of the cell, from 0.
|
|
177
|
+
* @param row - Row of the cell, from 0.
|
|
178
|
+
* @param value - Height in percent of the pane's height; 0 fits the text.
|
|
179
|
+
* @example
|
|
180
|
+
* ```js
|
|
181
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
182
|
+
* table.cell(t, 0, 0, "Trend");
|
|
183
|
+
* table.cell_set_height(t, 0, 0, 5);
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export function cell_set_height(table_id, column, row, value) {
|
|
187
|
+
setCell('cell_set_height', 'height', table_id, column, row, value);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Changes the text colour of a cell. A cell that was not written yet is created.
|
|
191
|
+
* @param table_id - The table.
|
|
192
|
+
* @param column - Column of the cell, from 0.
|
|
193
|
+
* @param row - Row of the cell, from 0.
|
|
194
|
+
* @param value - New text colour (`color.red`, `"#FF0000"`...).
|
|
195
|
+
* @example
|
|
196
|
+
* ```js
|
|
197
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
198
|
+
* eachBar((c) => {
|
|
199
|
+
* if (c.i === c.n - 1) table.cell_set_text_color(t, 0, 0, c.close > c.open ? color.green : color.red);
|
|
200
|
+
* });
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export function cell_set_text_color(table_id, column, row, value) {
|
|
204
|
+
setCell('cell_set_text_color', 'text_color', table_id, column, row, value);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Changes the horizontal alignment of the text of a cell. A cell that was not written yet is created.
|
|
208
|
+
* @param table_id - The table.
|
|
209
|
+
* @param column - Column of the cell, from 0.
|
|
210
|
+
* @param row - Row of the cell, from 0.
|
|
211
|
+
* @param value - `text.align_left`, `text.align_center` or `text.align_right`.
|
|
212
|
+
* @example
|
|
213
|
+
* ```js
|
|
214
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
215
|
+
* table.cell(t, 0, 0, "Volume", { width: 15 });
|
|
216
|
+
* table.cell_set_text_halign(t, 0, 0, text.align_left);
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export function cell_set_text_halign(table_id, column, row, value) {
|
|
220
|
+
setCell('cell_set_text_halign', 'text_halign', table_id, column, row, value);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Changes the vertical alignment of the text of a cell. A cell that was not written yet is created.
|
|
224
|
+
* @param table_id - The table.
|
|
225
|
+
* @param column - Column of the cell, from 0.
|
|
226
|
+
* @param row - Row of the cell, from 0.
|
|
227
|
+
* @param value - `text.align_top`, `text.align_center` or `text.align_bottom`.
|
|
228
|
+
* @example
|
|
229
|
+
* ```js
|
|
230
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
231
|
+
* table.cell(t, 0, 0, "Volume", { height: 8 });
|
|
232
|
+
* table.cell_set_text_valign(t, 0, 0, text.align_bottom);
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
export function cell_set_text_valign(table_id, column, row, value) {
|
|
236
|
+
setCell('cell_set_text_valign', 'text_valign', table_id, column, row, value);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Changes the text size of a cell. A cell that was not written yet is created.
|
|
240
|
+
* @param table_id - The table.
|
|
241
|
+
* @param column - Column of the cell, from 0.
|
|
242
|
+
* @param row - Row of the cell, from 0.
|
|
243
|
+
* @param value - `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`, `size.auto`, or a size in points.
|
|
244
|
+
* @example
|
|
245
|
+
* ```js
|
|
246
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
247
|
+
* table.cell(t, 0, 0, "Signal");
|
|
248
|
+
* table.cell_set_text_size(t, 0, 0, size.large);
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
export function cell_set_text_size(table_id, column, row, value) {
|
|
252
|
+
setCell('cell_set_text_size', 'text_size', table_id, column, row, value);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Changes the background colour of a cell. A cell that was not written yet is created.
|
|
256
|
+
* @param table_id - The table.
|
|
257
|
+
* @param column - Column of the cell, from 0.
|
|
258
|
+
* @param row - Row of the cell, from 0.
|
|
259
|
+
* @param value - New background colour.
|
|
260
|
+
* @example
|
|
261
|
+
* ```js
|
|
262
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
263
|
+
* eachBar((c) => {
|
|
264
|
+
* if (c.i === c.n - 1) table.cell_set_bgcolor(t, 0, 0, c.close > c.open ? color.teal : color.maroon);
|
|
265
|
+
* });
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
export function cell_set_bgcolor(table_id, column, row, value) {
|
|
269
|
+
setCell('cell_set_bgcolor', 'bgcolor', table_id, column, row, value);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Changes the tooltip of a cell: the text shown when the pointer is over it. A cell that was not written yet is
|
|
273
|
+
* created.
|
|
274
|
+
* @param table_id - The table.
|
|
275
|
+
* @param column - Column of the cell, from 0.
|
|
276
|
+
* @param row - Row of the cell, from 0.
|
|
277
|
+
* @param value - Tooltip text.
|
|
278
|
+
* @example
|
|
279
|
+
* ```js
|
|
280
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
281
|
+
* table.cell(t, 0, 0, "ATR");
|
|
282
|
+
* table.cell_set_tooltip(t, 0, 0, "Average true range over 14 bars");
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
export function cell_set_tooltip(table_id, column, row, value) {
|
|
286
|
+
setCell('cell_set_tooltip', 'tooltip', table_id, column, row, value);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Changes the font of a cell's text. A cell that was not written yet is created.
|
|
290
|
+
* @param table_id - The table.
|
|
291
|
+
* @param column - Column of the cell, from 0.
|
|
292
|
+
* @param row - Row of the cell, from 0.
|
|
293
|
+
* @param value - `font.family_default` or `font.family_monospace`.
|
|
294
|
+
* @example
|
|
295
|
+
* ```js
|
|
296
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
297
|
+
* table.cell(t, 0, 0, "123.45");
|
|
298
|
+
* table.cell_set_text_font_family(t, 0, 0, font.family_monospace);
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
export function cell_set_text_font_family(table_id, column, row, value) {
|
|
302
|
+
setCell('cell_set_text_font_family', 'text_font_family', table_id, column, row, value);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Makes a cell's text bold, italic, both or plain. A cell that was not written yet is created.
|
|
306
|
+
* @param table_id - The table.
|
|
307
|
+
* @param column - Column of the cell, from 0.
|
|
308
|
+
* @param row - Row of the cell, from 0.
|
|
309
|
+
* @param value - `text.format_bold`, `text.format_italic`, their sum, or `text.format_none`.
|
|
310
|
+
* @example
|
|
311
|
+
* ```js
|
|
312
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
313
|
+
* table.cell(t, 0, 0, "Summary");
|
|
314
|
+
* table.cell_set_text_formatting(t, 0, 0, text.format_bold + text.format_italic);
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
export function cell_set_text_formatting(table_id, column, row, value) {
|
|
318
|
+
setCell('cell_set_text_formatting', 'text_formatting', table_id, column, row, value);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Joins a block of cells into one cell, for a title over several columns for example. The merged cell shows the
|
|
322
|
+
* content and look of its start (top-left) cell. Merging the same block again does nothing. A cell outside the table,
|
|
323
|
+
* or an end before the start, is an error; on a deleted table it does nothing.
|
|
324
|
+
* @param table_id - The table.
|
|
325
|
+
* @param start_column - Column of the top-left cell of the block, from 0.
|
|
326
|
+
* @param start_row - Row of the top-left cell of the block, from 0.
|
|
327
|
+
* @param end_column - Column of the bottom-right cell of the block (not before `start_column`).
|
|
328
|
+
* @param end_row - Row of the bottom-right cell of the block (not before `start_row`).
|
|
329
|
+
* @example
|
|
330
|
+
* ```js
|
|
331
|
+
* const t = table.new(position.top_right, 2, 2);
|
|
332
|
+
* table.cell(t, 0, 0, "Daily stats");
|
|
333
|
+
* table.merge_cells(t, 0, 0, 1, 0); // the title spans both columns
|
|
334
|
+
* ```
|
|
123
335
|
*/
|
|
124
336
|
export function merge_cells(table_id, start_column, start_row, end_column, end_row) {
|
|
125
337
|
if (isDeleted(table_id))
|
|
@@ -136,8 +348,20 @@ export function merge_cells(table_id, start_column, start_row, end_column, end_r
|
|
|
136
348
|
}
|
|
137
349
|
}
|
|
138
350
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
351
|
+
* Empties a block of cells (text and look), and removes the merges that start inside it. Without an end, only the
|
|
352
|
+
* start cell is cleared. A cell outside the table is an error; on a deleted table it does nothing.
|
|
353
|
+
* @param table_id - The table.
|
|
354
|
+
* @param start_column - Column of the top-left cell of the block, from 0.
|
|
355
|
+
* @param start_row - Row of the top-left cell of the block, from 0.
|
|
356
|
+
* @param end_column - Column of the bottom-right cell of the block. Default: `start_column`.
|
|
357
|
+
* @param end_row - Row of the bottom-right cell of the block. Default: `start_row`.
|
|
358
|
+
* @example
|
|
359
|
+
* ```js
|
|
360
|
+
* const t = table.new(position.top_right, 3, 3);
|
|
361
|
+
* eachBar((c) => {
|
|
362
|
+
* if (c.i === c.n - 1) table.clear(t, 0, 0, 2, 2); // empty all nine cells
|
|
363
|
+
* });
|
|
364
|
+
* ```
|
|
141
365
|
*/
|
|
142
366
|
export function clear(table_id, start_column, start_row, end_column = start_column, end_row = start_row) {
|
|
143
367
|
if (isDeleted(table_id))
|
|
@@ -152,16 +376,25 @@ export function clear(table_id, start_column, start_row, end_column = start_colu
|
|
|
152
376
|
if (table_id.merges)
|
|
153
377
|
table_id.merges = table_id.merges.filter((m) => !inside(m.start_column, m.start_row));
|
|
154
378
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
};
|
|
379
|
+
/** Sets one property of a table; nothing on a deleted table. */
|
|
380
|
+
function setTable(table_id, field, value) {
|
|
381
|
+
if (isDeleted(table_id))
|
|
382
|
+
return;
|
|
383
|
+
table_id[field] = value;
|
|
161
384
|
}
|
|
162
385
|
/**
|
|
163
|
-
* Moves the table to another
|
|
164
|
-
* deleted
|
|
386
|
+
* Moves the table to another place of the pane. A live table already at that position (with the same
|
|
387
|
+
* `force_overlay`) is deleted. Does nothing on a deleted table.
|
|
388
|
+
* @param table_id - The table.
|
|
389
|
+
* @param position - New place: `position.top_left`, `position.top_center`, `position.top_right`,
|
|
390
|
+
* `position.middle_left`, `position.middle_center`, `position.middle_right`, `position.bottom_left`,
|
|
391
|
+
* `position.bottom_center` or `position.bottom_right`.
|
|
392
|
+
* @example
|
|
393
|
+
* ```js
|
|
394
|
+
* const where = input.string("Top right", "Table", { options: ["Top right", "Bottom left"] });
|
|
395
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
396
|
+
* if (where === "Bottom left") table.set_position(t, position.bottom_left);
|
|
397
|
+
* ```
|
|
165
398
|
*/
|
|
166
399
|
export function set_position(table_id, position) {
|
|
167
400
|
if (isDeleted(table_id))
|
|
@@ -169,21 +402,99 @@ export function set_position(table_id, position) {
|
|
|
169
402
|
freePosition(position, table_id.force_overlay ?? false, table_id);
|
|
170
403
|
table_id.position = position;
|
|
171
404
|
}
|
|
172
|
-
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
405
|
+
/**
|
|
406
|
+
* Changes the background colour of the whole table (cells with their own background keep it). Does nothing on a
|
|
407
|
+
* deleted table.
|
|
408
|
+
* @param table_id - The table.
|
|
409
|
+
* @param value - New background colour.
|
|
410
|
+
* @example
|
|
411
|
+
* ```js
|
|
412
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
413
|
+
* eachBar((c) => {
|
|
414
|
+
* if (c.i === c.n - 1) table.set_bgcolor(t, c.close > c.open ? color.new(color.green, 80) : color.new(color.red, 80));
|
|
415
|
+
* });
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
export function set_bgcolor(table_id, value) {
|
|
419
|
+
setTable(table_id, 'bgcolor', value);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Changes the colour of the outer frame of the table. Does nothing on a deleted table.
|
|
423
|
+
* @param table_id - The table.
|
|
424
|
+
* @param value - New frame colour.
|
|
425
|
+
* @example
|
|
426
|
+
* ```js
|
|
427
|
+
* const t = table.new(position.top_right, 1, 1, { frame_width: 1 });
|
|
428
|
+
* table.set_frame_color(t, color.gray);
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
export function set_frame_color(table_id, value) {
|
|
432
|
+
setTable(table_id, 'frame_color', value);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Changes the width of the outer frame of the table. Does nothing on a deleted table.
|
|
436
|
+
* @param table_id - The table.
|
|
437
|
+
* @param value - New frame width in pixels; 0 hides the frame.
|
|
438
|
+
* @example
|
|
439
|
+
* ```js
|
|
440
|
+
* const t = table.new(position.top_right, 1, 1, { frame_color: color.gray });
|
|
441
|
+
* table.set_frame_width(t, 2);
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
export function set_frame_width(table_id, value) {
|
|
445
|
+
setTable(table_id, 'frame_width', value);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Changes the colour of the lines between the cells. Does nothing on a deleted table.
|
|
449
|
+
* @param table_id - The table.
|
|
450
|
+
* @param value - New border colour.
|
|
451
|
+
* @example
|
|
452
|
+
* ```js
|
|
453
|
+
* const t = table.new(position.top_right, 2, 2, { border_width: 1 });
|
|
454
|
+
* table.set_border_color(t, color.silver);
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
export function set_border_color(table_id, value) {
|
|
458
|
+
setTable(table_id, 'border_color', value);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Changes the width of the lines between the cells. Does nothing on a deleted table.
|
|
462
|
+
* @param table_id - The table.
|
|
463
|
+
* @param value - New border width in pixels; 0 hides the lines.
|
|
464
|
+
* @example
|
|
465
|
+
* ```js
|
|
466
|
+
* const t = table.new(position.top_right, 2, 2, { border_color: color.silver });
|
|
467
|
+
* table.set_border_width(t, 1);
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
export function set_border_width(table_id, value) {
|
|
471
|
+
setTable(table_id, 'border_width', value);
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Removes the table from the pane and from `table.all`. Afterwards the table functions do nothing on it; deleting it
|
|
475
|
+
* again does nothing.
|
|
476
|
+
* @param table_id - The table to delete.
|
|
477
|
+
* @example
|
|
478
|
+
* ```js
|
|
479
|
+
* const show = input.bool(true, "Show table");
|
|
480
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
481
|
+
* if (!show) table.delete(t);
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
183
484
|
export function delete_table(table_id) {
|
|
184
485
|
remove('table', table_id);
|
|
185
486
|
}
|
|
186
|
-
/**
|
|
487
|
+
/**
|
|
488
|
+
* Returns the tables that are still on the pane, oldest first. The array is a copy.
|
|
489
|
+
* (In a script, `table.all` is read as a value, without a call.)
|
|
490
|
+
* @returns The live tables in creation order.
|
|
491
|
+
* @example
|
|
492
|
+
* ```js
|
|
493
|
+
* eachBar((c) => {
|
|
494
|
+
* if (c.i === c.n - 1) for (const t of table.all) table.set_bgcolor(t, color.new(color.black, 50));
|
|
495
|
+
* });
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
187
498
|
export function all() {
|
|
188
499
|
return allDrawings('table');
|
|
189
500
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAQzF,0GAA0G;AAC1G,SAAS,YAAY,CAAC,QAAuB,EAAE,aAAsB,EAAE,IAAY;IACjF,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ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AC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED,gCAAgC;AAChC,OAAO,EAAE,SAAS,IAAI,GAAG,EAAE,CAAC;AAC5B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,CAAC"}
|
package/dist/esm/text/index.d.ts
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Text namespace
|
|
3
|
-
*
|
|
4
|
-
* `text.align_*` / `text.wrap_*` constants.
|
|
2
|
+
* Text namespace: the `text.format_*` constants of `label.set_text_formatting()` and `box.set_text_formatting()`
|
|
3
|
+
* (`text_formatting` option), and the `text.align_*` / `text.wrap_*` constants of labels, boxes and table cells.
|
|
5
4
|
*
|
|
6
|
-
* The format values are flags that add up
|
|
7
|
-
* They are the values PineScript uses for drawn labels and boxes.
|
|
5
|
+
* The format values are flags that add up: `text.format_bold + text.format_italic` is bold italic text.
|
|
8
6
|
*/
|
|
9
|
-
/**
|
|
7
|
+
/** Plain text: neither bold nor italic (the default). */
|
|
10
8
|
export declare const format_none = 0;
|
|
11
|
-
/** Bold text. */
|
|
9
|
+
/** Bold text; add `text.format_italic` for bold italic. */
|
|
12
10
|
export declare const format_bold = 1;
|
|
13
|
-
/** Italic text. */
|
|
11
|
+
/** Italic text; add `text.format_bold` for bold italic. */
|
|
14
12
|
export declare const format_italic = 2;
|
|
15
|
-
/** Text aligned to the left (`table.cell
|
|
13
|
+
/** Text aligned to the left (`text_halign` of `table.cell()` and `box.new()`, `textalign` of `label.new()`). */
|
|
16
14
|
export declare const align_left: "left";
|
|
17
|
-
/** Text centred horizontally or vertically. */
|
|
15
|
+
/** Text centred, horizontally or vertically. */
|
|
18
16
|
export declare const align_center: "center";
|
|
19
17
|
/** Text aligned to the right. */
|
|
20
18
|
export declare const align_right: "right";
|
|
21
|
-
/** Text aligned to the top (`table.cell
|
|
19
|
+
/** Text aligned to the top (`text_valign` of `table.cell()` and `box.new()`). */
|
|
22
20
|
export declare const align_top: "top";
|
|
23
|
-
/** Text aligned to the bottom. */
|
|
21
|
+
/** Text aligned to the bottom (`text_valign`). */
|
|
24
22
|
export declare const align_bottom: "bottom";
|
|
25
|
-
/** Text wrapped to the box
|
|
23
|
+
/** Text wrapped onto several lines to fit the width of the box (`text_wrap` of `box.new()`). */
|
|
26
24
|
export declare const wrap_auto: "auto";
|
|
27
|
-
/** Text not wrapped. */
|
|
25
|
+
/** Text not wrapped: each line of the text stays on one line. */
|
|
28
26
|
export declare const wrap_none: "none";
|
|
29
27
|
//# 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;;;;;GAKG;AAEH,yDAAyD;AACzD,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,2DAA2D;AAC3D,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,2DAA2D;AAC3D,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,gHAAgH;AAChH,eAAO,MAAM,UAAU,EAAG,MAAe,CAAC;AAC1C,gDAAgD;AAChD,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAC9C,iCAAiC;AACjC,eAAO,MAAM,WAAW,EAAG,OAAgB,CAAC;AAC5C,iFAAiF;AACjF,eAAO,MAAM,SAAS,EAAG,KAAc,CAAC;AACxC,kDAAkD;AAClD,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAC9C,gGAAgG;AAChG,eAAO,MAAM,SAAS,EAAG,MAAe,CAAC;AACzC,iEAAiE;AACjE,eAAO,MAAM,SAAS,EAAG,MAAe,CAAC"}
|
package/dist/esm/text/index.js
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Text namespace
|
|
3
|
-
*
|
|
4
|
-
* `text.align_*` / `text.wrap_*` constants.
|
|
2
|
+
* Text namespace: the `text.format_*` constants of `label.set_text_formatting()` and `box.set_text_formatting()`
|
|
3
|
+
* (`text_formatting` option), and the `text.align_*` / `text.wrap_*` constants of labels, boxes and table cells.
|
|
5
4
|
*
|
|
6
|
-
* The format values are flags that add up
|
|
7
|
-
* They are the values PineScript uses for drawn labels and boxes.
|
|
5
|
+
* The format values are flags that add up: `text.format_bold + text.format_italic` is bold italic text.
|
|
8
6
|
*/
|
|
9
|
-
/**
|
|
7
|
+
/** Plain text: neither bold nor italic (the default). */
|
|
10
8
|
export const format_none = 0;
|
|
11
|
-
/** Bold text. */
|
|
9
|
+
/** Bold text; add `text.format_italic` for bold italic. */
|
|
12
10
|
export const format_bold = 1;
|
|
13
|
-
/** Italic text. */
|
|
11
|
+
/** Italic text; add `text.format_bold` for bold italic. */
|
|
14
12
|
export const format_italic = 2;
|
|
15
|
-
/** Text aligned to the left (`table.cell
|
|
13
|
+
/** Text aligned to the left (`text_halign` of `table.cell()` and `box.new()`, `textalign` of `label.new()`). */
|
|
16
14
|
export const align_left = 'left';
|
|
17
|
-
/** Text centred horizontally or vertically. */
|
|
15
|
+
/** Text centred, horizontally or vertically. */
|
|
18
16
|
export const align_center = 'center';
|
|
19
17
|
/** Text aligned to the right. */
|
|
20
18
|
export const align_right = 'right';
|
|
21
|
-
/** Text aligned to the top (`table.cell
|
|
19
|
+
/** Text aligned to the top (`text_valign` of `table.cell()` and `box.new()`). */
|
|
22
20
|
export const align_top = 'top';
|
|
23
|
-
/** Text aligned to the bottom. */
|
|
21
|
+
/** Text aligned to the bottom (`text_valign`). */
|
|
24
22
|
export const align_bottom = 'bottom';
|
|
25
|
-
/** Text wrapped to the box
|
|
23
|
+
/** Text wrapped onto several lines to fit the width of the box (`text_wrap` of `box.new()`). */
|
|
26
24
|
export const wrap_auto = 'auto';
|
|
27
|
-
/** Text not wrapped. */
|
|
25
|
+
/** Text not wrapped: each line of the text stays on one line. */
|
|
28
26
|
export const wrap_none = 'none';
|
|
29
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/text/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,2DAA2D;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,2DAA2D;AAC3D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,gHAAgH;AAChH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAe,CAAC;AAC1C,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,QAAiB,CAAC;AAC9C,iCAAiC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,OAAgB,CAAC;AAC5C,iFAAiF;AACjF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAc,CAAC;AACxC,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,QAAiB,CAAC;AAC9C,gGAAgG;AAChG,MAAM,CAAC,MAAM,SAAS,GAAG,MAAe,CAAC;AACzC,iEAAiE;AACjE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAe,CAAC"}
|