oakscriptjs 0.9.5 → 0.9.6
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/dist/cjs/array/index.d.ts +84 -27
- package/dist/cjs/array/index.d.ts.map +1 -1
- package/dist/cjs/array/index.js +235 -78
- package/dist/cjs/array/index.js.map +3 -3
- package/dist/cjs/callsite/index.d.ts +81 -2
- package/dist/cjs/callsite/index.d.ts.map +1 -1
- package/dist/cjs/callsite/index.js +62 -1
- package/dist/cjs/callsite/index.js.map +2 -2
- package/dist/cjs/color/index.d.ts +7 -3
- package/dist/cjs/color/index.d.ts.map +1 -1
- package/dist/cjs/color/index.js +6 -1
- package/dist/cjs/color/index.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.map +1 -1
- package/dist/cjs/label/index.js +2 -1
- package/dist/cjs/label/index.js.map +2 -2
- package/dist/cjs/linefill/index.d.ts.map +1 -1
- package/dist/cjs/linefill/index.js +1 -0
- package/dist/cjs/linefill/index.js.map +2 -2
- package/dist/cjs/math/index.d.ts +76 -21
- package/dist/cjs/math/index.d.ts.map +1 -1
- package/dist/cjs/math/index.js +155 -41
- package/dist/cjs/math/index.js.map +3 -3
- package/dist/cjs/matrix/index.d.ts.map +1 -1
- package/dist/cjs/matrix/index.js +42 -36
- package/dist/cjs/matrix/index.js.map +2 -2
- package/dist/cjs/runtime/series.d.ts +9 -0
- package/dist/cjs/runtime/series.d.ts.map +1 -1
- package/dist/cjs/runtime/series.js +16 -2
- package/dist/cjs/runtime/series.js.map +2 -2
- package/dist/cjs/script/index.d.ts +15 -31
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +32 -0
- package/dist/cjs/script/index.js.map +2 -2
- package/dist/cjs/session/calendar.d.ts.map +1 -1
- package/dist/cjs/session/calendar.js +15 -2
- package/dist/cjs/session/calendar.js.map +2 -2
- package/dist/cjs/str/index.d.ts +50 -38
- package/dist/cjs/str/index.d.ts.map +1 -1
- package/dist/cjs/str/index.js +43 -15
- package/dist/cjs/str/index.js.map +2 -2
- package/dist/cjs/str/messageformat.d.ts +2 -1
- package/dist/cjs/str/messageformat.d.ts.map +1 -1
- package/dist/cjs/str/messageformat.js +4 -1
- package/dist/cjs/str/messageformat.js.map +2 -2
- package/dist/cjs/str/numberformat.d.ts +4 -0
- package/dist/cjs/str/numberformat.d.ts.map +1 -1
- package/dist/cjs/str/numberformat.js +26 -4
- package/dist/cjs/str/numberformat.js.map +3 -3
- package/dist/cjs/ta/index.d.ts +86 -43
- package/dist/cjs/ta/index.d.ts.map +1 -1
- package/dist/cjs/ta/index.js +173 -267
- package/dist/cjs/ta/index.js.map +3 -3
- package/dist/cjs/ta/running-sum.d.ts +54 -2
- package/dist/cjs/ta/running-sum.d.ts.map +1 -1
- package/dist/cjs/ta/running-sum.js +132 -52
- package/dist/cjs/ta/running-sum.js.map +2 -2
- package/dist/cjs/ta-series.d.ts +4 -4
- package/dist/cjs/ta-series.d.ts.map +1 -1
- package/dist/cjs/ta-series.js +4 -3
- package/dist/cjs/ta-series.js.map +2 -2
- package/dist/cjs/time/datestring.d.ts +1 -0
- package/dist/cjs/time/datestring.d.ts.map +1 -1
- package/dist/cjs/time/datestring.js +7 -0
- package/dist/cjs/time/datestring.js.map +2 -2
- package/dist/cjs/time/index.d.ts.map +1 -1
- package/dist/cjs/time/index.js +2 -1
- package/dist/cjs/time/index.js.map +2 -2
- package/dist/cjs/time/session.d.ts +28 -9
- package/dist/cjs/time/session.d.ts.map +1 -1
- package/dist/cjs/time/session.js +74 -28
- package/dist/cjs/time/session.js.map +2 -2
- package/dist/cjs/time/timezone.d.ts +5 -0
- package/dist/cjs/time/timezone.d.ts.map +1 -1
- package/dist/cjs/time/timezone.js +15 -1
- package/dist/cjs/time/timezone.js.map +2 -2
- package/dist/esm/array/index.d.ts +84 -27
- package/dist/esm/array/index.d.ts.map +1 -1
- package/dist/esm/array/index.js +373 -111
- package/dist/esm/array/index.js.map +1 -1
- package/dist/esm/callsite/index.d.ts +81 -2
- package/dist/esm/callsite/index.d.ts.map +1 -1
- package/dist/esm/callsite/index.js +145 -3
- package/dist/esm/callsite/index.js.map +1 -1
- package/dist/esm/color/index.d.ts +7 -3
- package/dist/esm/color/index.d.ts.map +1 -1
- package/dist/esm/color/index.js +15 -3
- package/dist/esm/color/index.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.map +1 -1
- package/dist/esm/label/index.js +2 -1
- package/dist/esm/label/index.js.map +1 -1
- package/dist/esm/linefill/index.d.ts.map +1 -1
- package/dist/esm/linefill/index.js +3 -0
- package/dist/esm/linefill/index.js.map +1 -1
- package/dist/esm/math/index.d.ts +76 -21
- package/dist/esm/math/index.d.ts.map +1 -1
- package/dist/esm/math/index.js +227 -61
- package/dist/esm/math/index.js.map +1 -1
- package/dist/esm/matrix/index.d.ts.map +1 -1
- package/dist/esm/matrix/index.js +57 -43
- package/dist/esm/matrix/index.js.map +1 -1
- package/dist/esm/runtime/series.d.ts +9 -0
- package/dist/esm/runtime/series.d.ts.map +1 -1
- package/dist/esm/runtime/series.js +18 -1
- package/dist/esm/runtime/series.js.map +1 -1
- package/dist/esm/script/index.d.ts +15 -31
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +44 -1
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/session/calendar.d.ts.map +1 -1
- package/dist/esm/session/calendar.js +22 -2
- package/dist/esm/session/calendar.js.map +1 -1
- package/dist/esm/str/index.d.ts +50 -38
- package/dist/esm/str/index.d.ts.map +1 -1
- package/dist/esm/str/index.js +103 -52
- package/dist/esm/str/index.js.map +1 -1
- package/dist/esm/str/messageformat.d.ts +2 -1
- package/dist/esm/str/messageformat.d.ts.map +1 -1
- package/dist/esm/str/messageformat.js +7 -2
- package/dist/esm/str/messageformat.js.map +1 -1
- package/dist/esm/str/numberformat.d.ts +4 -0
- package/dist/esm/str/numberformat.d.ts.map +1 -1
- package/dist/esm/str/numberformat.js +38 -4
- package/dist/esm/str/numberformat.js.map +1 -1
- package/dist/esm/ta/index.d.ts +86 -43
- package/dist/esm/ta/index.d.ts.map +1 -1
- package/dist/esm/ta/index.js +296 -348
- package/dist/esm/ta/index.js.map +1 -1
- package/dist/esm/ta/running-sum.d.ts +54 -2
- package/dist/esm/ta/running-sum.d.ts.map +1 -1
- package/dist/esm/ta/running-sum.js +166 -71
- package/dist/esm/ta/running-sum.js.map +1 -1
- package/dist/esm/ta-series.d.ts +4 -4
- package/dist/esm/ta-series.d.ts.map +1 -1
- package/dist/esm/ta-series.js +5 -4
- package/dist/esm/ta-series.js.map +1 -1
- package/dist/esm/time/datestring.d.ts +1 -0
- package/dist/esm/time/datestring.d.ts.map +1 -1
- package/dist/esm/time/datestring.js +12 -0
- package/dist/esm/time/datestring.js.map +1 -1
- package/dist/esm/time/index.d.ts.map +1 -1
- package/dist/esm/time/index.js +3 -1
- package/dist/esm/time/index.js.map +1 -1
- package/dist/esm/time/session.d.ts +28 -9
- package/dist/esm/time/session.d.ts.map +1 -1
- package/dist/esm/time/session.js +113 -42
- package/dist/esm/time/session.js.map +1 -1
- package/dist/esm/time/timezone.d.ts +5 -0
- package/dist/esm/time/timezone.d.ts.map +1 -1
- package/dist/esm/time/timezone.js +21 -1
- package/dist/esm/time/timezone.js.map +1 -1
- package/package.json +1 -1
- package/src/array/index.ts +352 -127
- package/src/callsite/index.ts +147 -3
- package/src/color/index.ts +15 -5
- package/src/index.ts +1 -1
- package/src/label/index.ts +2 -1
- package/src/linefill/index.ts +2 -0
- package/src/math/index.ts +256 -74
- package/src/matrix/index.ts +52 -52
- package/src/runtime/series.ts +22 -1
- package/src/script/index.ts +53 -1
- package/src/session/calendar.ts +22 -2
- package/src/str/index.ts +95 -51
- package/src/str/messageformat.ts +7 -2
- package/src/str/numberformat.ts +39 -4
- package/src/ta/index.ts +306 -386
- package/src/ta/running-sum.ts +187 -74
- package/src/ta-series.ts +8 -7
- package/src/time/datestring.ts +10 -0
- package/src/time/index.ts +3 -1
- package/src/time/session.ts +97 -47
- package/src/time/timezone.ts +21 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Color namespace\n * Mirrors PineScript's color.* functions for color creation and manipulation.\n *\n * @remarks\n * All color functions in this namespace follow PineScript v6 API specifications.\n * Colors are represented as RGB or RGBA strings.\n * Transparency values range from 0 (fully opaque) to 100 (fully transparent).\n *\n * @version 6\n */\n\nimport type { color, int, float, simple_int, simple_float } from '../types/index.js';\nimport { alphaByte, parseColor } from './parse.js';\n\n/** Channel of color.rgb: na is 0, a fraction is truncated. */\nconst channel = (v: number): int =>\n v === null || v === undefined || Number.isNaN(v) ? 0 : Math.max(0, Math.min(255, Math.trunc(v)));\n\n/**\n * Alpha (0-1) of a transparency given to color.rgb / color.new: na is fully transparent, clamped to 0..100.\n * `1 - t / 100` as in PineScript: `color.new(c, 90)` has the alpha byte 25 (0.09999999999999998 * 255 rounded).\n */\nconst alphaOf = (transp: number): float =>\n transp === null || Number.isNaN(transp) ? 0 : 1 - Math.max(0, Math.min(100, transp)) / 100;\n\n/**\n * Creates a color from RGB values with optional transparency.\n *\n * @param red - Red component (0-255, values are clamped)\n * @param green - Green component (0-255, values are clamped)\n * @param blue - Blue component (0-255, values are clamped)\n * @param transp - Optional transparency (0-100). 0 = opaque, 100 = fully transparent\n * @returns Color string in rgb() or rgba() format\n *\n * @remarks\n * - RGB values are automatically clamped to the 0-255 range\n * - Transparency of 0 or omitted results in rgb() format\n * - Transparency > 0 results in rgba() format\n * - Transparency is converted to alpha channel (0-1 range)\n *\n * PineScript rules:\n * - an `na` channel is 0; a fractional channel is truncated (127.6 is 127)\n * - the transparency is clamped to 0..100 (140 is fully transparent, -5 is opaque); an `na` transparency is fully\n * transparent\n *\n * @example\n * ```typescript\n * color.rgb(255, 0, 0) // Returns: \"rgb(255, 0, 0)\" - Red\n * color.rgb(0, 255, 0, 50) // Returns: \"rgba(0, 255, 0, 0.5)\" - Semi-transparent green\n * color.rgb(300, 0, 0) // Returns: \"rgb(255, 0, 0)\" - Clamped to 255\n * ```\n */\nexport function rgb(red: simple_int, green: simple_int, blue: simple_int, transp?: simple_float): string {\n const r = channel(red);\n const g = channel(green);\n const b = channel(blue);\n const a = transp !== undefined ? alphaOf(transp) : 1;\n\n if (a === 1) {\n return `rgb(${r}, ${g}, ${b})`;\n }\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n}\n\n/**\n * Creates a color from a hexadecimal string with optional transparency.\n *\n * @param hex - Hex color string (with or without '#' prefix, e.g., \"#FF0000\" or \"FF0000\")\n * @param transp - Optional transparency (0-100). 0 = opaque, 100 = fully transparent\n * @returns Color string in rgb() or rgba() format\n *\n * @remarks\n * - Accepts hex strings with or without '#' prefix\n * - Case-insensitive (accepts both \"FF0000\" and \"ff0000\")\n * - Must be 6 characters (excluding '#')\n * - Format: RRGGBB where each component is 00-FF\n *\n * @example\n * ```typescript\n * color.from_hex(\"#FF0000\") // Returns: \"rgb(255, 0, 0)\" - Red\n * color.from_hex(\"00FF00\", 50) // Returns: \"rgba(0, 255, 0, 0.5)\" - Semi-transparent green\n * color.from_hex(\"#0000FF\") // Returns: \"rgb(0, 0, 255)\" - Blue\n * color.from_hex(\"FFA500\") // Returns: \"rgb(255, 165, 0)\" - Orange\n * ```\n */\nexport function from_hex(hex: string, transp?: simple_float): string {\n // Remove # if present\n hex = hex.replace('#', '');\n\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n\n return rgb(r, g, b, transp);\n}\n\n/**\n * Creates a new color with modified transparency, preserving RGB components.\n *\n * @param baseColor - The base color to modify\n * @param transp - New transparency value (0-100). 0 = opaque, 100 = fully transparent\n * @returns New color with updated transparency\n *\n * @remarks\n * - Preserves the RGB values from the base color\n * - Replaces the transparency with the new value\n * - Useful for creating semi-transparent versions of existing colors\n * - PineScript clamps the transparency to 0..100 (`color.new(c, 140)` is fully transparent, `color.new(c, -5)` is\n * opaque); an `na` transparency is fully transparent\n *\n * @example\n * ```typescript\n * const red = color.rgb(255, 0, 0)\n * color.new_color(red, 50) // Returns: \"rgba(255, 0, 0, 0.5)\" - Semi-transparent red\n * color.new_color(red, 0) // Returns: \"rgb(255, 0, 0)\" - Fully opaque\n * color.new_color(red, 100) // Returns: \"rgba(255, 0, 0, 0)\" - Fully transparent\n * ```\n */\nexport function new_color(baseColor: color, transp: simple_float): string {\n // Parse the color and apply transparency\n const rgba = parseColor(baseColor);\n return rgb(rgba.r, rgba.g, rgba.b, transp);\n}\n\n/**\n * Extracts the red component from a color.\n *\n * @param clr - The color to extract from\n * @returns Red component value (0-255)\n *\n * @example\n * ```typescript\n * color.r(color.rgb(255, 128, 64)) // Returns: 255\n * color.r(color.from_hex(\"#FF0000\")) // Returns: 255\n * color.r(color.from_hex(\"#FFA500\")) // Returns: 255 (orange)\n * ```\n */\nexport function r(clr: color): int {\n return parseColor(clr).r;\n}\n\n/**\n * Extracts the green component from a color.\n *\n * @param clr - The color to extract from\n * @returns Green component value (0-255)\n *\n * @example\n * ```typescript\n * color.g(color.rgb(255, 128, 64)) // Returns: 128\n * color.g(color.from_hex(\"#00FF00\")) // Returns: 255\n * color.g(color.from_hex(\"#FFA500\")) // Returns: 165 (orange)\n * ```\n */\nexport function g(clr: color): int {\n return parseColor(clr).g;\n}\n\n/**\n * Extracts the blue component from a color.\n *\n * @param clr - The color to extract from\n * @returns Blue component value (0-255)\n *\n * @example\n * ```typescript\n * color.b(color.rgb(255, 128, 64)) // Returns: 64\n * color.b(color.from_hex(\"#0000FF\")) // Returns: 255\n * color.b(color.from_hex(\"#FFA500\")) // Returns: 0 (orange)\n * ```\n */\nexport function b(clr: color): int {\n return parseColor(clr).b;\n}\n\n/**\n * Extracts the transparency component from a color.\n *\n * @param clr - The color to extract from\n * @returns Transparency value (0-100). 0 = fully opaque, 100 = fully transparent\n *\n * @remarks\n * - Returns 0 for colors without transparency (rgb format)\n * - Converts alpha channel (0-1) to transparency (0-100)\n * - PineScript stores the alpha as a byte (0-255) and returns an integer transparency:\n * `color.t(color.new(c, 33.3))` is 33\n *\n * @example\n * ```typescript\n * color.t(color.rgb(255, 0, 0)) // Returns: 0 (opaque)\n * color.t(color.rgb(255, 0, 0, 50)) // Returns: 50\n * color.t(color.rgb(255, 0, 0, 100)) // Returns: 100 (fully transparent)\n * ```\n */\nexport function t(clr: color): float {\n return Math.round((1 - alphaByte(parseColor(clr).a) / 255) * 100);\n}\n\n// Predefined color constants of PineScript v6.\n// PineScript v5 differs for red (#FF5252), teal (#00897B) and yellow (#FFEB3B).\n/**\n * Aqua/Cyan color constant\n * @constant {string} #00BCD4 - RGB(0, 188, 212)\n */\nexport const aqua = '#00BCD4';\n\n/**\n * Black color constant\n * @constant {string} #363A45 - RGB(54, 58, 69)\n */\nexport const black = '#363A45';\n\n/**\n * Blue color constant\n * @constant {string} #2962FF - RGB(41, 98, 255)\n */\nexport const blue = '#2962FF';\n\n/**\n * Fuchsia/Magenta color constant\n * @constant {string} #E040FB - RGB(224, 64, 251)\n */\nexport const fuchsia = '#E040FB';\n\n/**\n * Gray color constant\n * @constant {string} #787B86 - RGB(120, 123, 134)\n */\nexport const gray = '#787B86';\n\n/**\n * Green color constant (same as lime)\n * @constant {string} #4CAF50 - RGB(76, 175, 80)\n */\nexport const green = '#4CAF50';\n\n/**\n * Lime color constant (same as green)\n * @constant {string} #00E676 - RGB(0, 230, 118)\n */\nexport const lime = '#00E676';\n\n/**\n * Maroon color constant\n * @constant {string} #880E4F - RGB(136, 14, 79)\n */\nexport const maroon = '#880E4F';\n\n/**\n * Navy color constant\n * @constant {string} #311B92 - RGB(49, 27, 146)\n */\nexport const navy = '#311B92';\n\n/**\n * Olive color constant\n * @constant {string} #808000 - RGB(128, 128, 0)\n */\nexport const olive = '#808000';\n\n/**\n * Orange color constant\n * @constant {string} #FF9800 - RGB(255, 152, 0)\n */\nexport const orange = '#FF9800';\n\n/**\n * Purple color constant\n * @constant {string} #9C27B0 - RGB(156, 39, 176)\n */\nexport const purple = '#9C27B0';\n\n/**\n * Red color constant\n * @constant {string} #F23645 - RGB(242, 54, 69)\n */\nexport const red = '#F23645';\n\n/**\n * Silver color constant\n * @constant {string} #B2B5BE - RGB(178, 181, 190)\n */\nexport const silver = '#B2B5BE';\n\n/**\n * Teal color constant\n * @constant {string} #089981 - RGB(8, 153, 129)\n */\nexport const teal = '#089981';\n\n/**\n * White color constant\n * @constant {string} #FFFFFF - RGB(255, 255, 255)\n */\nexport const white = '#FFFFFF';\n\n/**\n * Yellow color constant\n * @constant {string} #FDD835 - RGB(253, 216, 53)\n */\nexport const yellow = '#FDD835';\n\n/**\n * Creates a color from a gradient based on value position.\n *\n * @param value - Value to calculate position-dependent color\n * @param bottom_value - Bottom position value corresponding to bottom_color\n * @param top_value - Top position value corresponding to top_color\n * @param bottom_color - Bottom position color\n * @param top_color - Top position color\n * @returns Color calculated from linear gradient\n *\n * @remarks\n * PineScript rules:\n * - If value <= bottom_value, returns bottom_color; else if value >= top_value, returns top_color\n * - An inverted range (bottom_value > top_value) returns bottom_color, wherever the value is\n * - Otherwise the colours are mixed with their transparency (premultiplied alpha, alpha as a byte); the RGB channels\n * and the alpha are truncated. PineScript's float rounding order is not known: a channel can differ by 1 when the\n * exact result is an integer (same RGB at both ends)\n * - An na value or bottom_value / top_value, or bottom_value == top_value, gives a fully transparent colour\n * - An na colour counts as fully transparent\n * - Works with rgb(), rgba() and hex (#RRGGBB, #RRGGBBAA) colours\n *\n * @example\n * ```typescript\n * // Value at middle of range gets middle color\n * const midColor = color.from_gradient(50, 0, 100,\n * color.rgb(255, 0, 0), // Red at bottom\n * color.rgb(0, 255, 0) // Green at top\n * ); // Returns color between red and green\n *\n * // Value at extremes\n * const lowColor = color.from_gradient(-10, 0, 100, red, green); // Returns red\n * const highColor = color.from_gradient(150, 0, 100, red, green); // Returns green\n * ```\n */\nexport function from_gradient(\n value: float,\n bottom_value: float,\n top_value: float,\n bottom_color: color,\n top_color: color\n): string {\n const transparent = 'rgba(0, 0, 0, 0)';\n if ([value, bottom_value, top_value].some((v) => v === null || v === undefined || Number.isNaN(v)) || bottom_value === top_value) {\n return transparent;\n }\n const k =\n value <= bottom_value || bottom_value > top_value\n ? 0\n : value >= top_value\n ? 1\n : (value - bottom_value) / (top_value - bottom_value);\n // alpha as a byte (0-255), as PineScript stores it; an na colour (null / undefined) is fully transparent\n const rgba = (c: color) => {\n if (c === null || c === undefined) return { r: 0, g: 0, b: 0, a: 0 };\n const p = parseColor(c);\n return { r: p.r, g: p.g, b: p.b, a: alphaByte(p.a) };\n };\n const c1 = rgba(bottom_color);\n const c2 = rgba(top_color);\n const a = c1.a * (1 - k) + c2.a * k;\n if (a === 0) return transparent;\n // operation order with the fewest differences to PineScript (channels as 0-1, alpha as a byte)\n const mix = (x1: number, x2: number) => Math.floor((((x1 / 255) * c1.a) * (1 - k) + ((x2 / 255) * c2.a) * k) / (a / 255));\n const [r, g, b] = [mix(c1.r, c2.r), mix(c1.g, c2.g), mix(c1.b, c2.b)];\n const alpha = Math.floor(a);\n return alpha === 255 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${alpha / 255})`;\n}\n\n/**\n * Alias for new_color function.\n * Creates a new color with specified transparency from an existing color.\n *\n * @param baseColor - The base color\n * @param transp - Transparency value (0-100). 0 = fully opaque, 100 = fully transparent\n * @returns New color with applied transparency\n *\n * @remarks\n * This is an alias for `new_color()` to match PineScript's `color.new()` syntax.\n *\n * @example\n * ```typescript\n * const redColor = color.rgb(255, 0, 0);\n * const transparentRed = color.new(redColor, 50); // 50% transparent red\n * ```\n */\nexport { new_color as new };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;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n *\n * @remarks\n * All color functions in this namespace follow PineScript v6 API specifications.\n * Colors are represented as RGB or RGBA strings.\n * Transparency values range from 0 (fully opaque) to 100 (fully transparent).\n *\n * @version 6\n */\n\nimport type { color, int, float, simple_int, simple_float } from '../types/index.js';\nimport { alphaByte, parseColor } from './parse.js';\n\n/** Channel of color.rgb: na is 0, a fraction is truncated. */\nconst channel = (v: number): int =>\n v === null || v === undefined || Number.isNaN(v) ? 0 : Math.max(0, Math.min(255, Math.trunc(v)));\n\n/**\n * Alpha (0-1) of a transparency given to color.rgb / color.new: na is fully transparent, clamped to 0..100.\n * `1 - t / 100` as in PineScript: `color.new(c, 90)` has the alpha byte 25 (0.09999999999999998 * 255 rounded).\n */\nconst alphaOf = (transp: number): float =>\n transp === null || Number.isNaN(transp) ? 0 : 1 - Math.max(0, Math.min(100, transp)) / 100;\n\n/**\n * Creates a color from RGB values with optional transparency.\n *\n * @param red - Red component (0-255, values are clamped)\n * @param green - Green component (0-255, values are clamped)\n * @param blue - Blue component (0-255, values are clamped)\n * @param transp - Optional transparency (0-100). 0 = opaque, 100 = fully transparent\n * @returns Color string in rgb() or rgba() format\n *\n * @remarks\n * - RGB values are automatically clamped to the 0-255 range\n * - Transparency of 0 or omitted results in rgb() format\n * - Transparency > 0 results in rgba() format\n * - Transparency is converted to alpha channel (0-1 range)\n *\n * PineScript rules:\n * - an `na` channel is 0; a fractional channel is truncated (127.6 is 127)\n * - the transparency is clamped to 0..100 (140 is fully transparent, -5 is opaque); an `na` transparency is fully\n * transparent\n *\n * @example\n * ```typescript\n * color.rgb(255, 0, 0) // Returns: \"rgb(255, 0, 0)\" - Red\n * color.rgb(0, 255, 0, 50) // Returns: \"rgba(0, 255, 0, 0.5)\" - Semi-transparent green\n * color.rgb(300, 0, 0) // Returns: \"rgb(255, 0, 0)\" - Clamped to 255\n * ```\n */\nexport function rgb(red: simple_int, green: simple_int, blue: simple_int, transp?: simple_float): string {\n const r = channel(red);\n const g = channel(green);\n const b = channel(blue);\n const a = transp !== undefined ? alphaOf(transp) : 1;\n\n if (a === 1) {\n return `rgb(${r}, ${g}, ${b})`;\n }\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n}\n\n/**\n * Creates a color from a hexadecimal string with optional transparency.\n *\n * @param hex - Hex color string (with or without '#' prefix, e.g., \"#FF0000\" or \"FF0000\")\n * @param transp - Optional transparency (0-100). 0 = opaque, 100 = fully transparent\n * @returns Color string in rgb() or rgba() format\n *\n * @remarks\n * - Accepts hex strings with or without '#' prefix\n * - Case-insensitive (accepts both \"FF0000\" and \"ff0000\")\n * - Must be 6 characters (excluding '#')\n * - Format: RRGGBB where each component is 00-FF\n *\n * @example\n * ```typescript\n * color.from_hex(\"#FF0000\") // Returns: \"rgb(255, 0, 0)\" - Red\n * color.from_hex(\"00FF00\", 50) // Returns: \"rgba(0, 255, 0, 0.5)\" - Semi-transparent green\n * color.from_hex(\"#0000FF\") // Returns: \"rgb(0, 0, 255)\" - Blue\n * color.from_hex(\"FFA500\") // Returns: \"rgb(255, 165, 0)\" - Orange\n * ```\n */\nexport function from_hex(hex: string, transp?: simple_float): string {\n // Remove # if present\n hex = hex.replace('#', '');\n\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n\n return rgb(r, g, b, transp);\n}\n\n/**\n * Creates a new color with modified transparency, preserving RGB components.\n *\n * @param baseColor - The base color to modify\n * @param transp - New transparency value (0-100). 0 = opaque, 100 = fully transparent\n * @returns New color with updated transparency\n *\n * @remarks\n * - Preserves the RGB values from the base color\n * - Replaces the transparency with the new value\n * - Useful for creating semi-transparent versions of existing colors\n * - PineScript clamps the transparency to 0..100 (`color.new(c, 140)` is fully transparent, `color.new(c, -5)` is\n * opaque); an `na` transparency is fully transparent (measured: the colour is not na, its RGB is kept)\n * - an `na` colour (null / undefined) gives black with the new transparency: `color.new(na, 30)` is\n * `rgba(0, 0, 0, 0.7)`, as PineScript does for an na colour variable (measured, #150). In PineScript, the constant\n * `color.new(color(na), 30)` is computed at compile time and stays na; a JS function cannot tell the two apart.\n *\n * @example\n * ```typescript\n * const red = color.rgb(255, 0, 0)\n * color.new_color(red, 50) // Returns: \"rgba(255, 0, 0, 0.5)\" - Semi-transparent red\n * color.new_color(red, 0) // Returns: \"rgb(255, 0, 0)\" - Fully opaque\n * color.new_color(red, 100) // Returns: \"rgba(255, 0, 0, 0)\" - Fully transparent\n * ```\n */\nexport function new_color(baseColor: color | null | undefined, transp: simple_float): string {\n if (baseColor === null || baseColor === undefined) return rgb(0, 0, 0, transp); // na colour: black\n // Parse the color and apply transparency\n const rgba = parseColor(baseColor);\n return rgb(rgba.r, rgba.g, rgba.b, transp);\n}\n\n/**\n * Extracts the red component from a color.\n *\n * @param clr - The color to extract from\n * @returns Red component value (0-255)\n *\n * @example\n * ```typescript\n * color.r(color.rgb(255, 128, 64)) // Returns: 255\n * color.r(color.from_hex(\"#FF0000\")) // Returns: 255\n * color.r(color.from_hex(\"#FFA500\")) // Returns: 255 (orange)\n * ```\n */\nexport function r(clr: color): int {\n return parseColor(clr).r;\n}\n\n/**\n * Extracts the green component from a color.\n *\n * @param clr - The color to extract from\n * @returns Green component value (0-255)\n *\n * @example\n * ```typescript\n * color.g(color.rgb(255, 128, 64)) // Returns: 128\n * color.g(color.from_hex(\"#00FF00\")) // Returns: 255\n * color.g(color.from_hex(\"#FFA500\")) // Returns: 165 (orange)\n * ```\n */\nexport function g(clr: color): int {\n return parseColor(clr).g;\n}\n\n/**\n * Extracts the blue component from a color.\n *\n * @param clr - The color to extract from\n * @returns Blue component value (0-255)\n *\n * @example\n * ```typescript\n * color.b(color.rgb(255, 128, 64)) // Returns: 64\n * color.b(color.from_hex(\"#0000FF\")) // Returns: 255\n * color.b(color.from_hex(\"#FFA500\")) // Returns: 0 (orange)\n * ```\n */\nexport function b(clr: color): int {\n return parseColor(clr).b;\n}\n\n/**\n * Extracts the transparency component from a color.\n *\n * @param clr - The color to extract from\n * @returns Transparency value (0-100). 0 = fully opaque, 100 = fully transparent\n *\n * @remarks\n * - Returns 0 for colors without transparency (rgb format)\n * - Converts alpha channel (0-1) to transparency (0-100)\n * - PineScript stores the alpha as a byte (0-255) and returns an integer transparency:\n * `color.t(color.new(c, 33.3))` is 33\n * - an `na` colour (null / undefined) is fully transparent: 100\n *\n * @example\n * ```typescript\n * color.t(color.rgb(255, 0, 0)) // Returns: 0 (opaque)\n * color.t(color.rgb(255, 0, 0, 50)) // Returns: 50\n * color.t(color.rgb(255, 0, 0, 100)) // Returns: 100 (fully transparent)\n * ```\n */\nexport function t(clr: color | null | undefined): float {\n if (clr === null || clr === undefined) return 100;\n return Math.round((1 - alphaByte(parseColor(clr).a) / 255) * 100);\n}\n\n// Predefined color constants of PineScript v6.\n// PineScript v5 differs for red (#FF5252), teal (#00897B) and yellow (#FFEB3B).\n/**\n * Aqua/Cyan color constant\n * @constant {string} #00BCD4 - RGB(0, 188, 212)\n */\nexport const aqua = '#00BCD4';\n\n/**\n * Black color constant\n * @constant {string} #363A45 - RGB(54, 58, 69)\n */\nexport const black = '#363A45';\n\n/**\n * Blue color constant\n * @constant {string} #2962FF - RGB(41, 98, 255)\n */\nexport const blue = '#2962FF';\n\n/**\n * Fuchsia/Magenta color constant\n * @constant {string} #E040FB - RGB(224, 64, 251)\n */\nexport const fuchsia = '#E040FB';\n\n/**\n * Gray color constant\n * @constant {string} #787B86 - RGB(120, 123, 134)\n */\nexport const gray = '#787B86';\n\n/**\n * Green color constant (same as lime)\n * @constant {string} #4CAF50 - RGB(76, 175, 80)\n */\nexport const green = '#4CAF50';\n\n/**\n * Lime color constant (same as green)\n * @constant {string} #00E676 - RGB(0, 230, 118)\n */\nexport const lime = '#00E676';\n\n/**\n * Maroon color constant\n * @constant {string} #880E4F - RGB(136, 14, 79)\n */\nexport const maroon = '#880E4F';\n\n/**\n * Navy color constant\n * @constant {string} #311B92 - RGB(49, 27, 146)\n */\nexport const navy = '#311B92';\n\n/**\n * Olive color constant\n * @constant {string} #808000 - RGB(128, 128, 0)\n */\nexport const olive = '#808000';\n\n/**\n * Orange color constant\n * @constant {string} #FF9800 - RGB(255, 152, 0)\n */\nexport const orange = '#FF9800';\n\n/**\n * Purple color constant\n * @constant {string} #9C27B0 - RGB(156, 39, 176)\n */\nexport const purple = '#9C27B0';\n\n/**\n * Red color constant\n * @constant {string} #F23645 - RGB(242, 54, 69)\n */\nexport const red = '#F23645';\n\n/**\n * Silver color constant\n * @constant {string} #B2B5BE - RGB(178, 181, 190)\n */\nexport const silver = '#B2B5BE';\n\n/**\n * Teal color constant\n * @constant {string} #089981 - RGB(8, 153, 129)\n */\nexport const teal = '#089981';\n\n/**\n * White color constant\n * @constant {string} #FFFFFF - RGB(255, 255, 255)\n */\nexport const white = '#FFFFFF';\n\n/**\n * Yellow color constant\n * @constant {string} #FDD835 - RGB(253, 216, 53)\n */\nexport const yellow = '#FDD835';\n\n/**\n * Creates a color from a gradient based on value position.\n *\n * @param value - Value to calculate position-dependent color\n * @param bottom_value - Bottom position value corresponding to bottom_color\n * @param top_value - Top position value corresponding to top_color\n * @param bottom_color - Bottom position color\n * @param top_color - Top position color\n * @returns Color calculated from linear gradient\n *\n * @remarks\n * PineScript rules:\n * - If value <= bottom_value, returns bottom_color; else if value >= top_value, returns top_color\n * - An inverted range (bottom_value > top_value) returns bottom_color, wherever the value is\n * - Otherwise the colours are mixed with their transparency (premultiplied alpha, alpha as a byte); the RGB channels\n * and the alpha are truncated. PineScript's float rounding order is not known: a channel can differ by 1 when the\n * exact result is an integer (same RGB at both ends)\n * - An na value or bottom_value / top_value, or bottom_value == top_value, gives a fully transparent colour\n * - An na colour counts as fully transparent\n * - Works with rgb(), rgba() and hex (#RRGGBB, #RRGGBBAA) colours\n *\n * @example\n * ```typescript\n * // Value at middle of range gets middle color\n * const midColor = color.from_gradient(50, 0, 100,\n * color.rgb(255, 0, 0), // Red at bottom\n * color.rgb(0, 255, 0) // Green at top\n * ); // Returns color between red and green\n *\n * // Value at extremes\n * const lowColor = color.from_gradient(-10, 0, 100, red, green); // Returns red\n * const highColor = color.from_gradient(150, 0, 100, red, green); // Returns green\n * ```\n */\nexport function from_gradient(\n value: float,\n bottom_value: float,\n top_value: float,\n bottom_color: color,\n top_color: color\n): string {\n const transparent = 'rgba(0, 0, 0, 0)';\n if ([value, bottom_value, top_value].some((v) => v === null || v === undefined || Number.isNaN(v)) || bottom_value === top_value) {\n return transparent;\n }\n const k =\n value <= bottom_value || bottom_value > top_value\n ? 0\n : value >= top_value\n ? 1\n : (value - bottom_value) / (top_value - bottom_value);\n // alpha as a byte (0-255), as PineScript stores it; an na colour (null / undefined) is fully transparent\n const rgba = (c: color) => {\n if (c === null || c === undefined) return { r: 0, g: 0, b: 0, a: 0 };\n const p = parseColor(c);\n return { r: p.r, g: p.g, b: p.b, a: alphaByte(p.a) };\n };\n const c1 = rgba(bottom_color);\n const c2 = rgba(top_color);\n const a = c1.a * (1 - k) + c2.a * k;\n if (a === 0) return transparent;\n // PineScript order (bit for bit, #146): premultiplied channels ((alpha / 255) * channel) * weight, divided by the\n // byte-alpha mix / 255, truncated. At an end (k = 0 / 1) this is floor(x * a / a): the end colour or one unit less.\n const scale = a / 255;\n const w1 = c1.a / 255;\n const w2 = c2.a / 255;\n const mix = (x1: number, x2: number) => Math.floor(((w1 * x1) * (1 - k) + (w2 * x2) * k) / scale);\n const [r, g, b] = [mix(c1.r, c2.r), mix(c1.g, c2.g), mix(c1.b, c2.b)];\n const alpha = Math.floor(a);\n return alpha === 255 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${alpha / 255})`;\n}\n\n/**\n * Alias for new_color function.\n * Creates a new color with specified transparency from an existing color.\n *\n * @param baseColor - The base color\n * @param transp - Transparency value (0-100). 0 = fully opaque, 100 = fully transparent\n * @returns New color with applied transparency\n *\n * @remarks\n * This is an alias for `new_color()` to match PineScript's `color.new()` syntax.\n *\n * @example\n * ```typescript\n * const redColor = color.rgb(255, 0, 0);\n * const transpar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,QAAQ,MAAM,OAAW,QAAO,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AACnE,UAAM,QAAI,yBAAW,CAAC;AACtB,WAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,OAAG,wBAAU,EAAE,CAAC,EAAE;AAAA,EACrD;AACA,QAAM,KAAK,KAAK,YAAY;AAC5B,QAAM,KAAK,KAAK,SAAS;AACzB,QAAM,IAAI,GAAG,KAAK,IAAI,KAAK,GAAG,IAAI;AAClC,MAAI,MAAM,EAAG,QAAO;AAGpB,QAAM,QAAQ,IAAI;AAClB,QAAM,KAAK,GAAG,IAAI;AAClB,QAAM,KAAK,GAAG,IAAI;AAClB,QAAM,MAAM,CAAC,IAAY,OAAe,KAAK,OAAQ,KAAK,MAAO,IAAI,KAAM,KAAK,KAAM,KAAK,KAAK;AAChG,QAAM,CAACF,IAAGC,IAAGC,EAAC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AACpE,QAAM,QAAQ,KAAK,MAAM,CAAC;AAC1B,SAAO,UAAU,MAAM,OAAOF,EAAC,KAAKC,EAAC,KAAKC,EAAC,MAAM,QAAQF,EAAC,KAAKC,EAAC,KAAKC,EAAC,KAAK,QAAQ,GAAG;AACxF;",
|
|
6
6
|
"names": ["red", "green", "blue", "r", "g", "b"]
|
|
7
7
|
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type * from './strategy/index.js';
|
|
|
54
54
|
export { LightweightChartsAdapter } from './runtime/adapters/LightweightChartsAdapter.js';
|
|
55
55
|
export type { LightweightSeriesDefinitions } from './runtime/adapters/LightweightChartsAdapter.js';
|
|
56
56
|
export { SimpleInputAdapter } from './runtime/adapters/SimpleInputAdapter.js';
|
|
57
|
-
export declare const VERSION = "0.9.
|
|
57
|
+
export declare const VERSION = "0.9.6";
|
|
58
58
|
/**
|
|
59
59
|
* Library information
|
|
60
60
|
*/
|
package/dist/cjs/index.js
CHANGED
|
@@ -160,7 +160,7 @@ var import_inputs = require("./runtime/inputs.js");
|
|
|
160
160
|
var import_strategy = require("./strategy/index.js");
|
|
161
161
|
var import_LightweightChartsAdapter = require("./runtime/adapters/LightweightChartsAdapter.js");
|
|
162
162
|
var import_SimpleInputAdapter = require("./runtime/adapters/SimpleInputAdapter.js");
|
|
163
|
-
const VERSION = "0.9.
|
|
163
|
+
const VERSION = "0.9.6";
|
|
164
164
|
const info = {
|
|
165
165
|
name: "OakScriptJS",
|
|
166
166
|
version: VERSION,
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * OakScriptJS - Simplified PineScript-like library for JavaScript\n *\n * This library provides Series-based lazy evaluation and technical analysis functions\n * for building trading indicators. The PineScript-style script API is in `oakscriptjs/script`.\n *\n * Key features:\n * - Series class for lazy evaluation and method chaining\n * - Core TA functions (array-based)\n * - TA-Series wrappers (Series-based)\n *\n * @packageDocumentation\n */\n\n// Export all types\nexport * from './types/index.js';\nexport * from './types/metadata.js';\n\n// Export core namespaces (array-based functions)\nimport * as taCore from './ta/index.js';\nimport * as math from './math/index.js';\nimport * as array from './array/index.js';\nimport * as map from './map/index.js';\nimport * as str from './str/index.js';\nimport * as color from './color/index.js';\nimport * as time from './time/index.js';\nimport * as timeframe from './timeframe/index.js';\nimport * as matrix from './matrix/index.js';\nimport * as line from './line/index.js';\nimport * as box from './box/index.js';\nimport * as label from './label/index.js';\nimport * as linefill from './linefill/index.js';\nimport * as chartPoint from './chartpoint/index.js';\nimport * as polyline from './polyline/index.js';\nimport * as text from './text/index.js';\nimport * as compare from './compare/index.js';\nimport * as callsite from './callsite/index.js';\n\nexport { taCore, math, array, map, str, color, time, timeframe, matrix, line, box, label, linefill, chartPoint, polyline, text, compare, callsite };\n\n// Export Series class (self-contained, no context)\nexport { Series, BarData } from './runtime/series.js';\nexport type { SeriesExtractor } from './runtime/series.js';\n\n// Export TA-Series namespace (Series-based wrappers)\nimport * as ta from './ta-series.js';\nexport { ta };\n\n// Export metadata types for indicator return values\nexport type {\n PlotOptions,\n HLineOptions,\n FillOptions,\n InputMetadata,\n PlotMetadata,\n IndicatorMetadata,\n TimeValue,\n PlotData,\n HLineData,\n FillData,\n FillGradient,\n IndicatorResult,\n IndicatorFactory,\n PlotStyle,\n LineStyle,\n PlotDisplay,\n InputType\n} from './types/metadata.js';\n\n// Re-export commonly used functions for convenience\nexport { sma, ema, rsi, macd, bb, stdev, crossover, crossunder, change, tr, atr, cum, vwap } from './ta-series.js';\nexport { abs, ceil, floor, round, max, min, avg, sum, sqrt, pow, exp, log, sin, cos, tan } from './math/index.js';\nexport { rgb, from_hex as color_from_hex, new_color } from './color/index.js';\n\n// Export chart data utilities\nexport { ohlcFromBars, getClose, getHigh, getLow, getOpen, getSource, getSourceSeries, at, div } from './utils/index.js';\n\n// Export libraries (ZigZag, etc.)\nexport * from './lib/index.js';\n\n// Export helper functions for generated indicators (PineScript compatibility)\nexport {isNA as na, nz, fixnan} from './utils/index.js';\n\n// Export indicator infrastructure\nexport {\n indicator,\n type IndicatorMetadataConfig,\n type InputDefinition,\n type IndicatorContext,\n type IndicatorInstance,\n type IndicatorConstructor,\n} from './indicator.js';\n\nexport {\n input,\n type InputValue,\n type IntInputOptions,\n type FloatInputOptions,\n type SourceInputOptions,\n type BoolInputOptions,\n type StringInputOptions,\n type TimeInputOptions,\n type SourceType,\n} from './input.js';\n\nexport {\n plot as plotHelper,\n createPlot,\n type Time,\n type TimeValuePair,\n type PlotOptions as PlotHelperOptions,\n type PlotResult,\n} from './plot.js';\n\n// Runtime exports - global context runtime (setContext, plot, hline) drawing through a ChartAdapter\nexport {\n setContext,\n clearContext,\n getContext,\n registerCalculate,\n recalculate,\n plot,\n hline,\n clearPlots,\n} from './runtime/runtime.js';\n\nexport {\n input_int,\n input_float,\n input_bool,\n input_string,\n input_source,\n input_timeframe,\n input_session,\n input_time,\n} from './runtime/inputs.js';\n\nexport type {\n OakScriptContext,\n ChartAdapter,\n InputAdapter,\n SeriesHandle,\n SeriesOptions,\n InputConfig,\n InputOptions,\n OhlcvData,\n PlotConfig,\n HLineConfig,\n FillConfig,\n ArrowConfig,\n} from './runtime/types.js';\n\n// Strategy types and constants (the script API forwards strategy.* calls to a host engine)\nexport {\n STRATEGY_CONSTANTS,\n STRATEGY_DEFAULTS,\n STRATEGY_NUMBER_VARIABLES,\n STRATEGY_TEXT_VARIABLES,\n} from './strategy/index.js';\nexport type * from './strategy/index.js';\n\nexport { LightweightChartsAdapter } from './runtime/adapters/LightweightChartsAdapter.js';\nexport type { LightweightSeriesDefinitions } from './runtime/adapters/LightweightChartsAdapter.js';\nexport { SimpleInputAdapter } from './runtime/adapters/SimpleInputAdapter.js';\n\n// Version\nexport const VERSION = '0.9.
|
|
4
|
+
"sourcesContent": ["/**\n * OakScriptJS - Simplified PineScript-like library for JavaScript\n *\n * This library provides Series-based lazy evaluation and technical analysis functions\n * for building trading indicators. The PineScript-style script API is in `oakscriptjs/script`.\n *\n * Key features:\n * - Series class for lazy evaluation and method chaining\n * - Core TA functions (array-based)\n * - TA-Series wrappers (Series-based)\n *\n * @packageDocumentation\n */\n\n// Export all types\nexport * from './types/index.js';\nexport * from './types/metadata.js';\n\n// Export core namespaces (array-based functions)\nimport * as taCore from './ta/index.js';\nimport * as math from './math/index.js';\nimport * as array from './array/index.js';\nimport * as map from './map/index.js';\nimport * as str from './str/index.js';\nimport * as color from './color/index.js';\nimport * as time from './time/index.js';\nimport * as timeframe from './timeframe/index.js';\nimport * as matrix from './matrix/index.js';\nimport * as line from './line/index.js';\nimport * as box from './box/index.js';\nimport * as label from './label/index.js';\nimport * as linefill from './linefill/index.js';\nimport * as chartPoint from './chartpoint/index.js';\nimport * as polyline from './polyline/index.js';\nimport * as text from './text/index.js';\nimport * as compare from './compare/index.js';\nimport * as callsite from './callsite/index.js';\n\nexport { taCore, math, array, map, str, color, time, timeframe, matrix, line, box, label, linefill, chartPoint, polyline, text, compare, callsite };\n\n// Export Series class (self-contained, no context)\nexport { Series, BarData } from './runtime/series.js';\nexport type { SeriesExtractor } from './runtime/series.js';\n\n// Export TA-Series namespace (Series-based wrappers)\nimport * as ta from './ta-series.js';\nexport { ta };\n\n// Export metadata types for indicator return values\nexport type {\n PlotOptions,\n HLineOptions,\n FillOptions,\n InputMetadata,\n PlotMetadata,\n IndicatorMetadata,\n TimeValue,\n PlotData,\n HLineData,\n FillData,\n FillGradient,\n IndicatorResult,\n IndicatorFactory,\n PlotStyle,\n LineStyle,\n PlotDisplay,\n InputType\n} from './types/metadata.js';\n\n// Re-export commonly used functions for convenience\nexport { sma, ema, rsi, macd, bb, stdev, crossover, crossunder, change, tr, atr, cum, vwap } from './ta-series.js';\nexport { abs, ceil, floor, round, max, min, avg, sum, sqrt, pow, exp, log, sin, cos, tan } from './math/index.js';\nexport { rgb, from_hex as color_from_hex, new_color } from './color/index.js';\n\n// Export chart data utilities\nexport { ohlcFromBars, getClose, getHigh, getLow, getOpen, getSource, getSourceSeries, at, div } from './utils/index.js';\n\n// Export libraries (ZigZag, etc.)\nexport * from './lib/index.js';\n\n// Export helper functions for generated indicators (PineScript compatibility)\nexport {isNA as na, nz, fixnan} from './utils/index.js';\n\n// Export indicator infrastructure\nexport {\n indicator,\n type IndicatorMetadataConfig,\n type InputDefinition,\n type IndicatorContext,\n type IndicatorInstance,\n type IndicatorConstructor,\n} from './indicator.js';\n\nexport {\n input,\n type InputValue,\n type IntInputOptions,\n type FloatInputOptions,\n type SourceInputOptions,\n type BoolInputOptions,\n type StringInputOptions,\n type TimeInputOptions,\n type SourceType,\n} from './input.js';\n\nexport {\n plot as plotHelper,\n createPlot,\n type Time,\n type TimeValuePair,\n type PlotOptions as PlotHelperOptions,\n type PlotResult,\n} from './plot.js';\n\n// Runtime exports - global context runtime (setContext, plot, hline) drawing through a ChartAdapter\nexport {\n setContext,\n clearContext,\n getContext,\n registerCalculate,\n recalculate,\n plot,\n hline,\n clearPlots,\n} from './runtime/runtime.js';\n\nexport {\n input_int,\n input_float,\n input_bool,\n input_string,\n input_source,\n input_timeframe,\n input_session,\n input_time,\n} from './runtime/inputs.js';\n\nexport type {\n OakScriptContext,\n ChartAdapter,\n InputAdapter,\n SeriesHandle,\n SeriesOptions,\n InputConfig,\n InputOptions,\n OhlcvData,\n PlotConfig,\n HLineConfig,\n FillConfig,\n ArrowConfig,\n} from './runtime/types.js';\n\n// Strategy types and constants (the script API forwards strategy.* calls to a host engine)\nexport {\n STRATEGY_CONSTANTS,\n STRATEGY_DEFAULTS,\n STRATEGY_NUMBER_VARIABLES,\n STRATEGY_TEXT_VARIABLES,\n} from './strategy/index.js';\nexport type * from './strategy/index.js';\n\nexport { LightweightChartsAdapter } from './runtime/adapters/LightweightChartsAdapter.js';\nexport type { LightweightSeriesDefinitions } from './runtime/adapters/LightweightChartsAdapter.js';\nexport { SimpleInputAdapter } from './runtime/adapters/SimpleInputAdapter.js';\n\n// Version\nexport const VERSION = '0.9.6';\n\n/**\n * Library information\n */\nexport const info = {\n name: 'OakScriptJS',\n version: VERSION,\n description: 'Simplified PineScript-like library - Series + TA functions',\n features: {\n series: 'Lazy evaluation with Series class',\n ta: 'Technical analysis functions (Series and array-based)',\n script: 'PineScript-style script API (oakscriptjs/script): indicator, strategy, inputs, plots, request.security',\n runtime: 'Global context runtime drawing through a ChartAdapter',\n indicator: 'Indicator function with automatic pane management'\n },\n namespaces: {\n core: ['ta', 'math', 'array', 'map', 'str', 'color', 'time', 'timeframe', 'matrix'],\n drawing: ['line', 'box', 'label', 'linefill', 'chartPoint', 'polyline', 'text'],\n runtime: ['setContext', 'plot', 'hline', 'input_*'],\n indicator: ['indicator', 'input', 'plotHelper', 'createPlot']\n }\n};\n\n// PineScript compatibility stubs - functions that have no runtime effect\n// These are no-ops so that PineScript-style code runs without modification\n\n/**\n * alertcondition() - Stub for PineScript alert configuration\n * In PineScript, this registers an alert condition. In oakscriptjs, it's a no-op\n * since alert configuration is handled by the host application.\n */\nexport function alertcondition(_condition: unknown, _title?: string, _message?: string): void {\n // No-op: Alert conditions are handled by the host application\n}\n"],
|
|
5
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;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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,0BAAc,6BAfd;AAgBA,0BAAc,gCAhBd;AAmBA,aAAwB;AACxB,WAAsB;AACtB,YAAuB;AACvB,UAAqB;AACrB,UAAqB;AACrB,YAAuB;AACvB,WAAsB;AACtB,gBAA2B;AAC3B,aAAwB;AACxB,WAAsB;AACtB,UAAqB;AACrB,YAAuB;AACvB,eAA0B;AAC1B,iBAA4B;AAC5B,eAA0B;AAC1B,WAAsB;AACtB,cAAyB;AACzB,eAA0B;AAK1B,oBAAgC;AAIhC,SAAoB;AAyBpB,uBAAkG;AAClG,kBAAgG;AAChG,mBAA2D;AAG3D,mB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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/label/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Label namespace\n * Functions for creating and manipulating label drawing objects.\n *\n * @remarks\n * Labels are primarily used for annotations and marking points on the chart.\n * They have limited computational value compared to lines and boxes, but getters\n * allow retrieving position and text for conditional logic.\n *\n * @version 6\n */\n\nimport { all as allDrawings, isDeleted, register, remove } from '../drawing/registry.js';\nimport type { ChartPoint, Label, color } from '../types/index.js';\n\ntype LabelXloc = 'bar_index' | 'bar_time';\ntype LabelYloc = 'price' | 'abovebar' | 'belowbar';\ntype LabelStyle = NonNullable<Label['style']>;\n\n/**\n * Creates a new label (PineScript `label.new`), with a chart point or with coordinates:\n *\n * - `label.new(point, text?, xloc?, yloc?, color?, style?, textcolor?, size?, textalign?, tooltip?,\n * text_font_family?, force_overlay?, text_formatting?)`\n * - `label.new(x, y, text?, xloc?, yloc?, color?, style?, textcolor?, size?, textalign?, tooltip?,\n * text_font_family?, force_overlay?, text_formatting?)`\n *\n * With a chart point, x is `point.index` for `bar_index` labels and `point.time` for `bar_time` labels.\n *\n * @example\n * ```typescript\n * const signal = label.new(10, 105.5, 'BUY');\n * const atPoint = label.new(chartPoint.from_index(10, 105.5), 'BUY');\n * ```\n */\nexport function new_label(\n point: ChartPoint,\n text?: string,\n xloc?: LabelXloc,\n yloc?: LabelYloc,\n labelColor?: color,\n style?: LabelStyle,\n textcolor?: color,\n size?: string | number,\n textalign?: 'left' | 'center' | 'right',\n tooltip?: string,\n text_font_family?: 'default' | 'monospace',\n force_overlay?: boolean,\n text_formatting?: number\n): Label;\nexport function new_label(\n x: number,\n y: number,\n text?: string,\n xloc?: LabelXloc,\n yloc?: LabelYloc,\n labelColor?: color,\n style?: LabelStyle,\n textcolor?: color,\n size?: string | number,\n textalign?: 'left' | 'center' | 'right',\n tooltip?: string,\n text_font_family?: 'default' | 'monospace',\n force_overlay?: boolean,\n text_formatting?: number\n): Label;\nexport function new_label(...args: unknown[]): Label {\n let x: number, y: number, rest: unknown[];\n if (typeof args[0] === 'object' && args[0] !== null) {\n const point = args[0] as ChartPoint;\n rest = args.slice(1);\n x = pointX(point, (rest[1] as LabelXloc | undefined) ?? 'bar_index');\n y = point.price;\n } else {\n [x, y] = args as [number, number];\n rest = args.slice(2);\n }\n const [text, xloc, yloc, labelColor, style, textcolor, size, textalign, tooltip, text_font_family,\n force_overlay, text_formatting] = rest as [\n string?, LabelXloc?, LabelYloc?, color?, LabelStyle?, color?, (string | number)?,\n ('left' | 'center' | 'right')?, string?, ('default' | 'monospace')?, boolean?, number?,\n ];\n return register('label', {\n x,\n y,\n xloc: xloc ?? 'bar_index',\n yloc: yloc ?? 'price',\n text,\n tooltip,\n color: labelColor,\n style,\n textcolor,\n size,\n textalign,\n text_font_family,\n force_overlay: force_overlay ?? false,\n text_formatting,\n });\n}\n\n/**\n * Returns the x coordinate.\n *\n * @param id - Label object\n * @returns X coordinate (bar index or timestamp)\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * const x = label.get_x(label); // Returns 50\n * ```\n */\nexport function get_x(id: Label): number {\n return id.x;\n}\n\n/**\n * Returns the y coordinate (price level).\n *\n * @param id - Label object\n * @returns Y coordinate (price)\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * const y = label.get_y(label); // Returns 155.5\n * ```\n */\nexport function get_y(id: Label): number {\n return id.y;\n}\n\n/**\n * Returns the label text content.\n *\n * @param id - Label object\n * @returns Text content (or undefined if no text)\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot High');\n * const text = label.get_text(label); // Returns 'Pivot High'\n * ```\n */\nexport function get_text(id: Label): string | undefined {\n return id.text;\n}\n\n/**\n * Creates a copy of the label object.\n *\n * @param id - Label object to copy\n * @returns New label object with same properties\n *\n * @remarks\n * Creates a shallow copy of the label. Modifications to the copy won't affect the original.\n *\n * @example\n * ```typescript\n * const original = label.new(50, 155.5, 'Pivot');\n * const copied = label.copy(original);\n *\n * // Modify copy without affecting original\n * copied.text = 'New Text';\n * ```\n */\nexport function copy(id: Label): Label {\n return register('label', { ...id });\n}\n\n// =============================================================================\n// POSITION SETTERS\n// =============================================================================\n\n/**\n * Sets the x coordinate.\n *\n * @param id - Label object to modify\n * @param x - New x coordinate\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_x(label, 55); // Move to bar 55\n * ```\n */\nexport function set_x(id: Label, x: number): Label {\n if (isDeleted(id)) return id;\n id.x = x;\n return id;\n}\n\n/**\n * Sets the y coordinate (price level).\n *\n * @param id - Label object to modify\n * @param y - New y coordinate\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_y(label, 160); // Move to price 160\n * ```\n */\nexport function set_y(id: Label, y: number): Label {\n if (isDeleted(id)) return id;\n id.y = y;\n return id;\n}\n\n/**\n * Sets both x and y coordinates.\n *\n * @param id - Label object to modify\n * @param x - New x coordinate\n * @param y - New y coordinate\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_xy(label, 60, 160); // Move to (60, 160)\n * ```\n */\nexport function set_xy(id: Label, x: number, y: number): Label {\n if (isDeleted(id)) return id;\n id.x = x;\n id.y = y;\n return id;\n}\n\n/**\n * Sets the x-axis coordinate system.\n *\n * @param id - Label object to modify\n * @param x - New x coordinate\n * @param xloc - New coordinate system\n * @returns Modified label object\n *\n * @remarks\n * When changing xloc, you must provide an appropriate x coordinate for the new system.\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_xloc(label, 1609459200000, 'bar_time'); // Change to timestamp\n * ```\n */\nexport function set_xloc(id: Label, x: number, xloc: 'bar_index' | 'bar_time'): Label {\n if (isDeleted(id)) return id;\n id.x = x;\n id.xloc = xloc;\n return id;\n}\n\n/**\n * Sets the y-location mode of the label (PineScript `label.set_yloc(id, yloc)`): `price` uses the\n * label's y, `abovebar` / `belowbar` place it above / below the bar.\n */\nexport function set_yloc(id: Label, yloc: 'price' | 'abovebar' | 'belowbar'): Label {\n if (isDeleted(id)) return id;\n id.yloc = yloc;\n return id;\n}\n\n// =============================================================================\n// CONTENT SETTERS\n// =============================================================================\n\n/**\n * Sets the text content.\n *\n * @param id - Label object to modify\n * @param text - New text content\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_text(label, 'Updated Text');\n * ```\n */\nexport function set_text(id: Label, text: string): Label {\n if (isDeleted(id)) return id;\n id.text = text;\n return id;\n}\n\n/**\n * Sets the tooltip text.\n *\n * @param id - Label object to modify\n * @param tooltip - New tooltip text\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_tooltip(label, 'Resistance level formed at 155.5');\n * ```\n */\nexport function set_tooltip(id: Label, tooltip: string): Label {\n if (isDeleted(id)) return id;\n id.tooltip = tooltip;\n return id;\n}\n\n// =============================================================================\n// STYLING SETTERS\n// =============================================================================\n\n/**\n * Sets the label color (border and arrow).\n *\n * @param id - Label object to modify\n * @param labelColor - New color\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_color(label, '#FF0000'); // Red label\n * ```\n */\nexport function set_color(id: Label, labelColor: color): Label {\n if (isDeleted(id)) return id;\n id.color = labelColor;\n return id;\n}\n\n/**\n * Sets the text color.\n *\n * @param id - Label object to modify\n * @param textColor - New text color\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_textcolor(label, '#FFFFFF'); // White text\n * ```\n */\nexport function set_textcolor(id: Label, textColor: color): Label {\n if (isDeleted(id)) return id;\n id.textcolor = textColor;\n return id;\n}\n\n/**\n * Sets the label style.\n *\n * @param id - Label object to modify\n * @param style - New label style\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_style(label, 'label_down'); // Arrow pointing down\n * ```\n */\nexport function set_style(\n id: Label,\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): Label {\n if (isDeleted(id)) return id;\n id.style = style;\n return id;\n}\n\n/**\n * Sets the label size.\n *\n * @param id - Label object to modify\n * @param size - New size\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_size(label, 'large'); // Larger label\n * ```\n */\nexport function set_size(id: Label, size: string | number): Label {\n if (isDeleted(id)) return id;\n id.size = size;\n return id;\n}\n\n/**\n * Sets the text alignment.\n *\n * @param id - Label object to modify\n * @param align - New text alignment\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_textalign(label, 'center'); // Center-aligned text\n * ```\n */\nexport function set_textalign(id: Label, align: 'left' | 'center' | 'right'): Label {\n if (isDeleted(id)) return id;\n id.textalign = align;\n return id;\n}\n\n/**\n * Sets the text font family.\n *\n * @param id - Label object to modify\n * @param font - New font family\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_text_font_family(label, 'monospace');\n * ```\n */\nexport function set_text_font_family(id: Label, font: 'default' | 'monospace'): Label {\n if (isDeleted(id)) return id;\n id.text_font_family = font;\n return id;\n}\n\n/**\n * Deletes the label object.\n *\n * @param id - Label object to delete\n *\n * @remarks\n * Removes the label from `label.all()`. As in PineScript, the deleted label is `na`: its getters\n * return NaN and its setters do nothing. Deleting it twice has no effect.\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.delete(label);\n * // label.all() no longer contains it\n * ```\n */\nexport function delete_label(id: Label): void {\n remove('label', id);\n}\n\n/** x coordinate of a chart point for an object's xloc (`na` when the point has no such coordinate). */\nfunction pointX(point: ChartPoint, xloc: 'bar_index' | 'bar_time'): number {\n const x = xloc === 'bar_time' ? point.time : point.index;\n return x ?? NaN;\n}\n\n/**\n * All live labels, in creation order (PineScript `label.all`). A new array.\n */\nexport function all(): Label[] {\n return allDrawings('label');\n}\n\n/**\n * Sets the label position from a chart point: `point.index` for `bar_index` labels, `point.time`\n * for `bar_time` labels, and `point.price`.\n */\nexport function set_point(id: Label, point: ChartPoint): Label {\n if (isDeleted(id)) return id;\n id.x = pointX(point, id.xloc);\n id.y = point.price;\n return id;\n}\n\n/**\n * Sets the text formatting: `text.format_none`, `text.format_bold`, `text.format_italic`,\n * or `text.format_bold + text.format_italic`.\n */\nexport function set_text_formatting(id: Label, formatting: number): Label {\n if (isDeleted(id)) return id;\n id.text_formatting = formatting;\n return id;\n}\n\n// Alias to match PineScript API\nexport { new_label as new };\nexport { delete_label 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;AAYA,sBAAgE;AAsDzD,SAAS,aAAa,MAAwB;AACnD,MAAI,GAAW,GAAW;AAC1B,MAAI,OAAO,KAAK,CAAC,MAAM,YAAY,KAAK,CAAC,MAAM,MAAM;AACnD,UAAM,QAAQ,KAAK,CAAC;AACpB,WAAO,KAAK,MAAM,CAAC;AACnB,QAAI,OAAO,OAAQ,KAAK,CAAC,KAA+B,WAAW;AACnE,QAAI,MAAM;AAAA,EACZ,OAAO;AACL,KAAC,GAAG,CAAC,IAAI;AACT,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AACA,QAAM;AAAA,IAAC;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAY;AAAA,IAAO;AAAA,IAAW;AAAA,IAAM;AAAA,IAAW;AAAA,IAAS;AAAA,IAC/E;AAAA,IAAe;AAAA,EAAe,IAAI;AAIpC,aAAO,0BAAS,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA,MAAM,QAAQ;AAAA,IACd,MAAM,QAAQ;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * Label namespace\n * Functions for creating and manipulating label drawing objects.\n *\n * @remarks\n * Labels are primarily used for annotations and marking points on the chart.\n * They have limited computational value compared to lines and boxes, but getters\n * allow retrieving position and text for conditional logic.\n *\n * @version 6\n */\n\nimport { all as allDrawings, isDeleted, register, remove } from '../drawing/registry.js';\nimport type { ChartPoint, Label, color } from '../types/index.js';\n\ntype LabelXloc = 'bar_index' | 'bar_time';\ntype LabelYloc = 'price' | 'abovebar' | 'belowbar';\ntype LabelStyle = NonNullable<Label['style']>;\n\n/**\n * Creates a new label (PineScript `label.new`), with a chart point or with coordinates:\n *\n * - `label.new(point, text?, xloc?, yloc?, color?, style?, textcolor?, size?, textalign?, tooltip?,\n * text_font_family?, force_overlay?, text_formatting?)`\n * - `label.new(x, y, text?, xloc?, yloc?, color?, style?, textcolor?, size?, textalign?, tooltip?,\n * text_font_family?, force_overlay?, text_formatting?)`\n *\n * With a chart point, x is `point.index` for `bar_index` labels and `point.time` for `bar_time` labels.\n *\n * @example\n * ```typescript\n * const signal = label.new(10, 105.5, 'BUY');\n * const atPoint = label.new(chartPoint.from_index(10, 105.5), 'BUY');\n * ```\n */\nexport function new_label(\n point: ChartPoint,\n text?: string,\n xloc?: LabelXloc,\n yloc?: LabelYloc,\n labelColor?: color,\n style?: LabelStyle,\n textcolor?: color,\n size?: string | number,\n textalign?: 'left' | 'center' | 'right',\n tooltip?: string,\n text_font_family?: 'default' | 'monospace',\n force_overlay?: boolean,\n text_formatting?: number\n): Label;\nexport function new_label(\n x: number,\n y: number,\n text?: string,\n xloc?: LabelXloc,\n yloc?: LabelYloc,\n labelColor?: color,\n style?: LabelStyle,\n textcolor?: color,\n size?: string | number,\n textalign?: 'left' | 'center' | 'right',\n tooltip?: string,\n text_font_family?: 'default' | 'monospace',\n force_overlay?: boolean,\n text_formatting?: number\n): Label;\nexport function new_label(...args: unknown[]): Label {\n let x: number, y: number, rest: unknown[];\n if (typeof args[0] === 'object' && args[0] !== null) {\n const point = args[0] as ChartPoint;\n rest = args.slice(1);\n x = pointX(point, (rest[1] as LabelXloc | undefined) ?? 'bar_index');\n y = point.price;\n } else {\n [x, y] = args as [number, number];\n rest = args.slice(2);\n }\n const [text, xloc, yloc, labelColor, style, textcolor, size, textalign, tooltip, text_font_family,\n force_overlay, text_formatting] = rest as [\n string?, LabelXloc?, LabelYloc?, color?, LabelStyle?, color?, (string | number)?,\n ('left' | 'center' | 'right')?, string?, ('default' | 'monospace')?, boolean?, number?,\n ];\n return register('label', {\n x,\n y,\n xloc: xloc ?? 'bar_index',\n yloc: yloc ?? 'price',\n // PineScript: a label without text has the text \"\" (label.get_text gives \"\")\n text: text ?? '',\n tooltip,\n color: labelColor,\n style,\n textcolor,\n size,\n textalign,\n text_font_family,\n force_overlay: force_overlay ?? false,\n text_formatting,\n });\n}\n\n/**\n * Returns the x coordinate.\n *\n * @param id - Label object\n * @returns X coordinate (bar index or timestamp)\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * const x = label.get_x(label); // Returns 50\n * ```\n */\nexport function get_x(id: Label): number {\n return id.x;\n}\n\n/**\n * Returns the y coordinate (price level).\n *\n * @param id - Label object\n * @returns Y coordinate (price)\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * const y = label.get_y(label); // Returns 155.5\n * ```\n */\nexport function get_y(id: Label): number {\n return id.y;\n}\n\n/**\n * Returns the label text content.\n *\n * @param id - Label object\n * @returns Text content (or undefined if no text)\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot High');\n * const text = label.get_text(label); // Returns 'Pivot High'\n * ```\n */\nexport function get_text(id: Label): string | undefined {\n return id.text;\n}\n\n/**\n * Creates a copy of the label object.\n *\n * @param id - Label object to copy\n * @returns New label object with same properties\n *\n * @remarks\n * Creates a shallow copy of the label. Modifications to the copy won't affect the original.\n *\n * @example\n * ```typescript\n * const original = label.new(50, 155.5, 'Pivot');\n * const copied = label.copy(original);\n *\n * // Modify copy without affecting original\n * copied.text = 'New Text';\n * ```\n */\nexport function copy(id: Label): Label {\n return register('label', { ...id });\n}\n\n// =============================================================================\n// POSITION SETTERS\n// =============================================================================\n\n/**\n * Sets the x coordinate.\n *\n * @param id - Label object to modify\n * @param x - New x coordinate\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_x(label, 55); // Move to bar 55\n * ```\n */\nexport function set_x(id: Label, x: number): Label {\n if (isDeleted(id)) return id;\n id.x = x;\n return id;\n}\n\n/**\n * Sets the y coordinate (price level).\n *\n * @param id - Label object to modify\n * @param y - New y coordinate\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_y(label, 160); // Move to price 160\n * ```\n */\nexport function set_y(id: Label, y: number): Label {\n if (isDeleted(id)) return id;\n id.y = y;\n return id;\n}\n\n/**\n * Sets both x and y coordinates.\n *\n * @param id - Label object to modify\n * @param x - New x coordinate\n * @param y - New y coordinate\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_xy(label, 60, 160); // Move to (60, 160)\n * ```\n */\nexport function set_xy(id: Label, x: number, y: number): Label {\n if (isDeleted(id)) return id;\n id.x = x;\n id.y = y;\n return id;\n}\n\n/**\n * Sets the x-axis coordinate system.\n *\n * @param id - Label object to modify\n * @param x - New x coordinate\n * @param xloc - New coordinate system\n * @returns Modified label object\n *\n * @remarks\n * When changing xloc, you must provide an appropriate x coordinate for the new system.\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_xloc(label, 1609459200000, 'bar_time'); // Change to timestamp\n * ```\n */\nexport function set_xloc(id: Label, x: number, xloc: 'bar_index' | 'bar_time'): Label {\n if (isDeleted(id)) return id;\n id.x = x;\n id.xloc = xloc;\n return id;\n}\n\n/**\n * Sets the y-location mode of the label (PineScript `label.set_yloc(id, yloc)`): `price` uses the\n * label's y, `abovebar` / `belowbar` place it above / below the bar.\n */\nexport function set_yloc(id: Label, yloc: 'price' | 'abovebar' | 'belowbar'): Label {\n if (isDeleted(id)) return id;\n id.yloc = yloc;\n return id;\n}\n\n// =============================================================================\n// CONTENT SETTERS\n// =============================================================================\n\n/**\n * Sets the text content.\n *\n * @param id - Label object to modify\n * @param text - New text content\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_text(label, 'Updated Text');\n * ```\n */\nexport function set_text(id: Label, text: string): Label {\n if (isDeleted(id)) return id;\n id.text = text;\n return id;\n}\n\n/**\n * Sets the tooltip text.\n *\n * @param id - Label object to modify\n * @param tooltip - New tooltip text\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_tooltip(label, 'Resistance level formed at 155.5');\n * ```\n */\nexport function set_tooltip(id: Label, tooltip: string): Label {\n if (isDeleted(id)) return id;\n id.tooltip = tooltip;\n return id;\n}\n\n// =============================================================================\n// STYLING SETTERS\n// =============================================================================\n\n/**\n * Sets the label color (border and arrow).\n *\n * @param id - Label object to modify\n * @param labelColor - New color\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_color(label, '#FF0000'); // Red label\n * ```\n */\nexport function set_color(id: Label, labelColor: color): Label {\n if (isDeleted(id)) return id;\n id.color = labelColor;\n return id;\n}\n\n/**\n * Sets the text color.\n *\n * @param id - Label object to modify\n * @param textColor - New text color\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_textcolor(label, '#FFFFFF'); // White text\n * ```\n */\nexport function set_textcolor(id: Label, textColor: color): Label {\n if (isDeleted(id)) return id;\n id.textcolor = textColor;\n return id;\n}\n\n/**\n * Sets the label style.\n *\n * @param id - Label object to modify\n * @param style - New label style\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_style(label, 'label_down'); // Arrow pointing down\n * ```\n */\nexport function set_style(\n id: Label,\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): Label {\n if (isDeleted(id)) return id;\n id.style = style;\n return id;\n}\n\n/**\n * Sets the label size.\n *\n * @param id - Label object to modify\n * @param size - New size\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_size(label, 'large'); // Larger label\n * ```\n */\nexport function set_size(id: Label, size: string | number): Label {\n if (isDeleted(id)) return id;\n id.size = size;\n return id;\n}\n\n/**\n * Sets the text alignment.\n *\n * @param id - Label object to modify\n * @param align - New text alignment\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_textalign(label, 'center'); // Center-aligned text\n * ```\n */\nexport function set_textalign(id: Label, align: 'left' | 'center' | 'right'): Label {\n if (isDeleted(id)) return id;\n id.textalign = align;\n return id;\n}\n\n/**\n * Sets the text font family.\n *\n * @param id - Label object to modify\n * @param font - New font family\n * @returns Modified label object\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.set_text_font_family(label, 'monospace');\n * ```\n */\nexport function set_text_font_family(id: Label, font: 'default' | 'monospace'): Label {\n if (isDeleted(id)) return id;\n id.text_font_family = font;\n return id;\n}\n\n/**\n * Deletes the label object.\n *\n * @param id - Label object to delete\n *\n * @remarks\n * Removes the label from `label.all()`. As in PineScript, the deleted label is `na`: its getters\n * return NaN and its setters do nothing. Deleting it twice has no effect.\n *\n * @example\n * ```typescript\n * const label = label.new(50, 155.5, 'Pivot');\n * label.delete(label);\n * // label.all() no longer contains it\n * ```\n */\nexport function delete_label(id: Label): void {\n remove('label', id);\n}\n\n/** x coordinate of a chart point for an object's xloc (`na` when the point has no such coordinate). */\nfunction pointX(point: ChartPoint, xloc: 'bar_index' | 'bar_time'): number {\n const x = xloc === 'bar_time' ? point.time : point.index;\n return x ?? NaN;\n}\n\n/**\n * All live labels, in creation order (PineScript `label.all`). A new array.\n */\nexport function all(): Label[] {\n return allDrawings('label');\n}\n\n/**\n * Sets the label position from a chart point: `point.index` for `bar_index` labels, `point.time`\n * for `bar_time` labels, and `point.price`.\n */\nexport function set_point(id: Label, point: ChartPoint): Label {\n if (isDeleted(id)) return id;\n id.x = pointX(point, id.xloc);\n id.y = point.price;\n return id;\n}\n\n/**\n * Sets the text formatting: `text.format_none`, `text.format_bold`, `text.format_italic`,\n * or `text.format_bold + text.format_italic`.\n */\nexport function set_text_formatting(id: Label, formatting: number): Label {\n if (isDeleted(id)) return id;\n id.text_formatting = formatting;\n return id;\n}\n\n// Alias to match PineScript API\nexport { new_label as new };\nexport { delete_label 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;AAYA,sBAAgE;AAsDzD,SAAS,aAAa,MAAwB;AACnD,MAAI,GAAW,GAAW;AAC1B,MAAI,OAAO,KAAK,CAAC,MAAM,YAAY,KAAK,CAAC,MAAM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;AAKO,SAAS,MAAe;AAC7B,aAAO,gBAAAA,KAAY,OAAO;AAC5B;AAMO,SAAS,UAAU,IAAW,OAA0B;AAC7D,UAAI,2BAAU,EAAE,EAAG,QAAO;AAC1B,KAAG,IAAI,OAAO,OAAO,GAAG,IAAI;AAC5B,KAAG,IAAI,MAAM;AACb,SAAO;AACT;AAMO,SAAS,oBAAoB,IAAW,YAA2B;AACxE,UAAI,2BAAU,EAAE,EAAG,QAAO;AAC1B,KAAG,kBAAkB;AACrB,SAAO;AACT;",
|
|
6
6
|
"names": ["allDrawings"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/linefill/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/linefill/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAQlF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAE5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAE5C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAG,QAAQ,CAIlE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAElD;AAGD;;GAEG;AACH,wBAAgB,GAAG,IAAI,QAAQ,EAAE,CAEhC;AAGD,OAAO,EAAE,YAAY,IAAI,GAAG,EAAE,CAAC;AAC/B,OAAO,EAAE,eAAe,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -30,6 +30,7 @@ __export(linefill_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(linefill_exports);
|
|
31
31
|
var import_registry = require("../drawing/registry.js");
|
|
32
32
|
function new_linefill(line1, line2, fillColor) {
|
|
33
|
+
if (line1 === null || line1 === void 0 || line2 === null || line2 === void 0) return null;
|
|
33
34
|
return (0, import_registry.register)("linefill", {
|
|
34
35
|
line1,
|
|
35
36
|
line2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/linefill/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Linefill namespace\n * Functions for creating and manipulating linefill drawing objects.\n *\n * @remarks\n * Linefill objects fill the area between two lines with a color.\n * They have minimal computational value but automatically follow line movements\n * and provide a way to retrieve the underlying line references.\n *\n * @version 6\n */\n\nimport { all as allDrawings, isDeleted, register, remove } from '../drawing/registry.js';\nimport type { Linefill, Line, color } from '../types/index.js';\n\n/**\n * Creates a new linefill object that fills the area between two lines.\n *\n * @param line1 - First line object\n * @param line2 - Second line object\n * @param fillColor - Fill color (optional)\n * @returns New linefill object\n *\n * @remarks\n * - Automatically follows line movements (if lines are updated, fill updates too)\n * - Automatically deleted if either line is deleted\n * - If both lines extend in same direction, fill extends too\n * - Purely visual in PineScript, but getters allow retrieving line references\n *\n * @example\n * ```typescript\n * import { line, linefill } from 'oakscriptjs';\n *\n * // Create channel lines\n * const upperLine = line.new(0, 160, 50, 170, 'bar_index', 'right');\n * const lowerLine = line.new(0, 140, 50, 150, 'bar_index', 'right');\n *\n * // Fill channel with color\n * const channelFill = linefill.new(upperLine, lowerLine, '#0000FF20'); // Transparent blue\n * ```\n */\nexport function new_linefill(line1: Line, line2: Line, fillColor?: color): Linefill {\n return register('linefill', {\n line1,\n line2,\n color: fillColor\n });\n}\n\n/**\n * Returns the first line reference.\n *\n * @param id - Linefill object\n * @returns First line object\n *\n * @remarks\n * Can be used to retrieve and manipulate the first line.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine);\n *\n * // Later, retrieve and update the first line\n * const line1 = linefill.get_line1(channelFill);\n * line.set_y2(line1, 175); // Update upper line's second point\n * ```\n */\nexport function get_line1(id: Linefill): Line {\n return id.line1;\n}\n\n/**\n * Returns the second line reference.\n *\n * @param id - Linefill object\n * @returns Second line object\n *\n * @remarks\n * Can be used to retrieve and manipulate the second line.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine);\n *\n * // Later, retrieve and update the second line\n * const line2 = linefill.get_line2(channelFill);\n * line.set_y2(line2, 145); // Update lower line's second point\n * ```\n */\nexport function get_line2(id: Linefill): Line {\n return id.line2;\n}\n\n/**\n * Sets the fill color.\n *\n * @param id - Linefill object to modify\n * @param fillColor - New fill color\n * @returns Modified linefill object\n *\n * @remarks\n * Useful for dynamically changing channel colors based on conditions.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine, '#0000FF20');\n *\n * // Change color based on trend\n * if (bullish) {\n * linefill.set_color(channelFill, '#00FF0020'); // Green\n * } else {\n * linefill.set_color(channelFill, '#FF000020'); // Red\n * }\n * ```\n */\nexport function set_color(id: Linefill, fillColor: color): Linefill {\n if (isDeleted(id)) return id;\n id.color = fillColor;\n return id;\n}\n\n/**\n * Deletes the linefill object.\n *\n * @param id - Linefill object to delete\n *\n * @remarks\n * Removes the linefill from `linefill.all()`. As in PineScript, the deleted linefill is `na`: its getters\n * return NaN and its setters do nothing. Deleting it twice has no effect.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine);\n * linefill.delete(channelFill);\n * // linefill.all() no longer contains it\n * ```\n */\nexport function delete_linefill(id: Linefill): void {\n remove('linefill', id);\n}\n\n\n/**\n * All live linefills, in creation order (PineScript `linefill.all`). A new array.\n */\nexport function all(): Linefill[] {\n return allDrawings('linefill');\n}\n\n// Alias to match PineScript API\nexport { new_linefill as new };\nexport { delete_linefill as delete };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,sBAAgE;AA6BzD,SAAS,aAAa,OAAa,OAAa,WAA6B;
|
|
4
|
+
"sourcesContent": ["/**\n * Linefill namespace\n * Functions for creating and manipulating linefill drawing objects.\n *\n * @remarks\n * Linefill objects fill the area between two lines with a color.\n * They have minimal computational value but automatically follow line movements\n * and provide a way to retrieve the underlying line references.\n *\n * @version 6\n */\n\nimport { all as allDrawings, isDeleted, register, remove } from '../drawing/registry.js';\nimport type { Linefill, Line, color } from '../types/index.js';\n\n/**\n * Creates a new linefill object that fills the area between two lines.\n *\n * @param line1 - First line object\n * @param line2 - Second line object\n * @param fillColor - Fill color (optional)\n * @returns New linefill object\n *\n * @remarks\n * - Automatically follows line movements (if lines are updated, fill updates too)\n * - Automatically deleted if either line is deleted\n * - If both lines extend in same direction, fill extends too\n * - Purely visual in PineScript, but getters allow retrieving line references\n *\n * @example\n * ```typescript\n * import { line, linefill } from 'oakscriptjs';\n *\n * // Create channel lines\n * const upperLine = line.new(0, 160, 50, 170, 'bar_index', 'right');\n * const lowerLine = line.new(0, 140, 50, 150, 'bar_index', 'right');\n *\n * // Fill channel with color\n * const channelFill = linefill.new(upperLine, lowerLine, '#0000FF20'); // Transparent blue\n * ```\n */\nexport function new_linefill(line1: Line, line2: Line, fillColor?: color): Linefill {\n // PineScript: an na line gives an na linefill\n if (line1 === null || line1 === undefined || line2 === null || line2 === undefined) return null as unknown as Linefill;\n return register('linefill', {\n line1,\n line2,\n color: fillColor\n });\n}\n\n/**\n * Returns the first line reference.\n *\n * @param id - Linefill object\n * @returns First line object\n *\n * @remarks\n * Can be used to retrieve and manipulate the first line.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine);\n *\n * // Later, retrieve and update the first line\n * const line1 = linefill.get_line1(channelFill);\n * line.set_y2(line1, 175); // Update upper line's second point\n * ```\n */\nexport function get_line1(id: Linefill): Line {\n return id.line1;\n}\n\n/**\n * Returns the second line reference.\n *\n * @param id - Linefill object\n * @returns Second line object\n *\n * @remarks\n * Can be used to retrieve and manipulate the second line.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine);\n *\n * // Later, retrieve and update the second line\n * const line2 = linefill.get_line2(channelFill);\n * line.set_y2(line2, 145); // Update lower line's second point\n * ```\n */\nexport function get_line2(id: Linefill): Line {\n return id.line2;\n}\n\n/**\n * Sets the fill color.\n *\n * @param id - Linefill object to modify\n * @param fillColor - New fill color\n * @returns Modified linefill object\n *\n * @remarks\n * Useful for dynamically changing channel colors based on conditions.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine, '#0000FF20');\n *\n * // Change color based on trend\n * if (bullish) {\n * linefill.set_color(channelFill, '#00FF0020'); // Green\n * } else {\n * linefill.set_color(channelFill, '#FF000020'); // Red\n * }\n * ```\n */\nexport function set_color(id: Linefill, fillColor: color): Linefill {\n if (isDeleted(id)) return id;\n id.color = fillColor;\n return id;\n}\n\n/**\n * Deletes the linefill object.\n *\n * @param id - Linefill object to delete\n *\n * @remarks\n * Removes the linefill from `linefill.all()`. As in PineScript, the deleted linefill is `na`: its getters\n * return NaN and its setters do nothing. Deleting it twice has no effect.\n *\n * @example\n * ```typescript\n * const channelFill = linefill.new(upperLine, lowerLine);\n * linefill.delete(channelFill);\n * // linefill.all() no longer contains it\n * ```\n */\nexport function delete_linefill(id: Linefill): void {\n remove('linefill', id);\n}\n\n\n/**\n * All live linefills, in creation order (PineScript `linefill.all`). A new array.\n */\nexport function all(): Linefill[] {\n return allDrawings('linefill');\n}\n\n// Alias to match PineScript API\nexport { new_linefill as new };\nexport { delete_linefill as delete };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,sBAAgE;AA6BzD,SAAS,aAAa,OAAa,OAAa,WAA6B;AAElF,MAAI,UAAU,QAAQ,UAAU,UAAa,UAAU,QAAQ,UAAU,OAAW,QAAO;AAC3F,aAAO,0BAAS,YAAY;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACT,CAAC;AACH;AAoBO,SAAS,UAAU,IAAoB;AAC5C,SAAO,GAAG;AACZ;AAoBO,SAAS,UAAU,IAAoB;AAC5C,SAAO,GAAG;AACZ;AAwBO,SAAS,UAAU,IAAc,WAA4B;AAClE,UAAI,2BAAU,EAAE,EAAG,QAAO;AAC1B,KAAG,QAAQ;AACX,SAAO;AACT;AAkBO,SAAS,gBAAgB,IAAoB;AAClD,8BAAO,YAAY,EAAE;AACvB;AAMO,SAAS,MAAkB;AAChC,aAAO,gBAAAA,KAAY,UAAU;AAC/B;",
|
|
6
6
|
"names": ["allDrawings"]
|
|
7
7
|
}
|
package/dist/cjs/math/index.d.ts
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Known difference: `log10`, `exp`, `log`, `pow`, `sin`, `cos`, `tan` use JavaScript's `Math`. PineScript uses
|
|
10
10
|
* other algorithms, whose results differ by 1 or 2 units in the last place on part of the inputs (`log10` about 4 %,
|
|
11
|
-
* `exp` about 9 %, `sin` / `cos` / `tan` about 3 %, `log` 0.4 %, `pow` 0.05 % of random inputs).
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `exp` about 9 %, `sin` / `cos` / `tan` about 3 %, `log` 0.4 %, `pow` 0.05 % of random inputs). This is visible
|
|
12
|
+
* only when a script amplifies these tiny differences (e.g. `ma > ma[1]` on values of 1e195); `sqrt`, `atan`,
|
|
13
|
+
* `asin`, `acos` are equal. A constant argument (`math.log10(2)`) is computed before the script runs, with other
|
|
14
|
+
* rules: see `constant`.
|
|
14
15
|
*
|
|
15
16
|
* @version 6
|
|
16
17
|
*/
|
|
@@ -90,20 +91,55 @@ export declare function floor(value: float): int;
|
|
|
90
91
|
* @remarks
|
|
91
92
|
* - Rounds to nearest integer by default
|
|
92
93
|
* - With precision, rounds to that many decimal places
|
|
93
|
-
* - Uses "round half up" strategy (0.5 rounds to 1)
|
|
94
94
|
* - If value is a Series, returns a Series; if value is a number, returns a number
|
|
95
95
|
*
|
|
96
|
+
* PineScript rules:
|
|
97
|
+
* - ties go away from zero (2.5 -> 3, -2.5 -> -3, -0.5 -> -1)
|
|
98
|
+
* - without a precision, or with a precision <= 0, the result is the integer rounding (1234.5678 @ -2 -> 1235)
|
|
99
|
+
* - a positive precision rounds only the fraction: `int + round(frac * scale) / scale` with
|
|
100
|
+
* `scale = 1 / 10^-precision` (precision above 16 acts as 16); the tie is decided on the exact value of
|
|
101
|
+
* `frac * scale` with a 1e-10 tolerance (1.005 @ 2 -> 1.01, 0.285 @ 2 -> 0.29, -1.45 @ 1 -> -1.5)
|
|
102
|
+
* - an infinite value gives na
|
|
103
|
+
*
|
|
96
104
|
* @example
|
|
97
105
|
* ```typescript
|
|
98
106
|
* math.round(4.2) // Returns: 4
|
|
99
107
|
* math.round(4.5) // Returns: 5
|
|
100
|
-
* math.round(
|
|
108
|
+
* math.round(-2.5) // Returns: -3
|
|
101
109
|
* math.round(4.567, 2) // Returns: 4.57
|
|
102
|
-
* math.round(
|
|
110
|
+
* math.round(1.005, 2) // Returns: 1.01
|
|
103
111
|
* ```
|
|
104
112
|
*/
|
|
105
113
|
export declare function round(value: Series, precision?: int): Series;
|
|
106
114
|
export declare function round(value: float, precision?: int): float;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the value PineScript gives to a constant float expression (not a PineScript function).
|
|
117
|
+
*
|
|
118
|
+
* @param value - The result of the constant expression, computed in JavaScript (e.g. `1 / 255`)
|
|
119
|
+
* @returns The value of the same expression in a PineScript script
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* PineScript computes a constant expression (only literals and constants: `1 / 255`, `0.1 * 3`,
|
|
123
|
+
* `math.sqrt(0.1)`) before the script runs, and the value is then rounded. JavaScript cannot tell a constant from a
|
|
124
|
+
* series value, so wrap the constant expressions of a script with this function.
|
|
125
|
+
* - |value| >= 0.001: the exact value of the double is rounded to 16 decimals, ties to even
|
|
126
|
+
* (`1 / 255` -> 0.003921568627451, `1 / 7` -> 0.1428571428571428)
|
|
127
|
+
* - |value| < 0.001, na and infinities: unchanged
|
|
128
|
+
* - the whole expression is computed first, then rounded once (`(1 / 7) * 7` is 1)
|
|
129
|
+
* - math functions of constants use JavaScript's `Math` there: `math.constant(math.sqrt(0.1))` is the PineScript
|
|
130
|
+
* value; `math.log10` of a constant is `math.log(x) / math.log(10)` there:
|
|
131
|
+
* `math.constant(math.log(2) / math.log(10))` -> 0.3010299956639811
|
|
132
|
+
* - the same expression with a series operand (`close / 255`) is not rounded: do not wrap it
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* // Pine: var const float i_255 = 1 / 255
|
|
137
|
+
* const i_255 = math.constant(1 / 255) // 0.003921568627451 (JavaScript: 0.00392156862745098)
|
|
138
|
+
* math.constant(1 / 7) // 0.1428571428571428 (JavaScript: 0.14285714285714285)
|
|
139
|
+
* math.constant(1 / 3) // 0.3333333333333333 (unchanged)
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare function constant(value: float): float;
|
|
107
143
|
/**
|
|
108
144
|
* Returns the maximum value from the arguments.
|
|
109
145
|
*
|
|
@@ -156,6 +192,8 @@ export declare function min(...values: (float | Series)[]): float | Series;
|
|
|
156
192
|
* - Calculates sum of all values divided by count
|
|
157
193
|
* - Returns NaN if no arguments provided (division by zero)
|
|
158
194
|
* - If any argument is a Series, returns a Series; otherwise returns a number
|
|
195
|
+
* - PineScript rule: with 1 or 2 values the sum is plain; with 3 values or more it is a Kahan compensated sum whose
|
|
196
|
+
* pending correction is subtracted before the division (math.avg(0.1, 0.2, 0.3) = 0.19999999999999998)
|
|
159
197
|
*
|
|
160
198
|
* @example
|
|
161
199
|
* ```typescript
|
|
@@ -170,7 +208,7 @@ export declare function avg(...values: (float | Series)[]): float | Series;
|
|
|
170
208
|
* Returns the sum of values over a sliding window.
|
|
171
209
|
*
|
|
172
210
|
* @param source - Series of values or array
|
|
173
|
-
* @param length - Window length for summation
|
|
211
|
+
* @param length - Window length for summation, or one length per bar (a series length: array or Series)
|
|
174
212
|
* @returns Series or array with rolling sum values
|
|
175
213
|
*
|
|
176
214
|
* @remarks
|
|
@@ -180,6 +218,11 @@ export declare function avg(...values: (float | Series)[]): float | Series;
|
|
|
180
218
|
* - A compensated running sum, as in PineScript, so the result can differ from the exact window sum in the last
|
|
181
219
|
* bits (bit for bit with PineScript)
|
|
182
220
|
* - When passed a Series, returns a Series; when passed an array, returns an array
|
|
221
|
+
* - With a series length, PineScript moves the running sum to the new length when the length changes, with Kahan
|
|
222
|
+
* steps of the raw values: a smaller length removes the values that leave the window (oldest first); a larger
|
|
223
|
+
* length adds back the values from the one before the old window down to the one `length` values back (newest
|
|
224
|
+
* first), then the usual step removes the stored value of the one `length` values back. A bar with an `na` value
|
|
225
|
+
* gives the sum of the last `length` earlier values
|
|
183
226
|
*
|
|
184
227
|
* @example
|
|
185
228
|
* ```typescript
|
|
@@ -187,8 +230,8 @@ export declare function avg(...values: (float | Series)[]): float | Series;
|
|
|
187
230
|
* // Explanation: [NaN, NaN, 1+2+3, 2+3+4, 3+4+5]
|
|
188
231
|
* ```
|
|
189
232
|
*/
|
|
190
|
-
export declare function sum(source: Series, length: simple_int): Series;
|
|
191
|
-
export declare function sum(source: series_float, length: simple_int): series_float;
|
|
233
|
+
export declare function sum(source: Series, length: simple_int | ArrayLike<number> | Series): Series;
|
|
234
|
+
export declare function sum(source: series_float, length: simple_int | ArrayLike<number> | Series): series_float;
|
|
192
235
|
/**
|
|
193
236
|
* Returns the square root of a number.
|
|
194
237
|
*
|
|
@@ -485,29 +528,36 @@ export declare function toradians(degrees: float): float;
|
|
|
485
528
|
*/
|
|
486
529
|
export declare function todegrees(radians: Series): Series;
|
|
487
530
|
export declare function todegrees(radians: float): float;
|
|
531
|
+
/**
|
|
532
|
+
* PineScript's seeded generator: Java's linear congruential generator (`java.util.Random`), `nextDouble()`.
|
|
533
|
+
* Each generator draws one number per call.
|
|
534
|
+
*/
|
|
535
|
+
export declare function seededRandom(seed: int): (min?: float, max?: float) => float;
|
|
536
|
+
/** Starts every seeded sequence of `math.random` again (called at the start of a script run). */
|
|
537
|
+
export declare function resetRandom(): void;
|
|
488
538
|
/**
|
|
489
539
|
* Returns a pseudo-random number.
|
|
490
540
|
*
|
|
491
|
-
* @param min - Optional minimum value (inclusive)
|
|
492
|
-
* @param max - Optional maximum value (exclusive)
|
|
493
|
-
* @param seed - Optional seed
|
|
541
|
+
* @param min - Optional minimum value (inclusive), default 0
|
|
542
|
+
* @param max - Optional maximum value (exclusive), default 1
|
|
543
|
+
* @param seed - Optional seed: a repeatable sequence, as PineScript (Java's `java.util.Random`)
|
|
494
544
|
* @returns A random number in the specified range, or [0, 1) if no range specified
|
|
495
545
|
*
|
|
496
546
|
* @remarks
|
|
497
|
-
* - Without
|
|
498
|
-
* - With
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
547
|
+
* - Without a seed: `Math.random()`
|
|
548
|
+
* - With a seed: PineScript's sequence, one number per call (measured: the call on each bar draws the next number
|
|
549
|
+
* of `new java.util.Random(seed).nextDouble()` from the first bar of the history). PineScript keeps one generator
|
|
550
|
+
* per call site; here there is one generator per seed value (started again by `executeScript`): for two call sites
|
|
551
|
+
* with the same seed use `callsite.random(seed)`
|
|
502
552
|
*
|
|
503
553
|
* @example
|
|
504
554
|
* ```typescript
|
|
505
555
|
* math.random() // Returns: value between 0 and 1 (e.g., 0.234...)
|
|
506
556
|
* math.random(0, 10) // Returns: value between 0 and 10 (e.g., 7.45...)
|
|
507
|
-
* math.random(
|
|
557
|
+
* math.random(0, 1, 42) // Returns: 0.7275636800328681 on the first call, as PineScript
|
|
508
558
|
* ```
|
|
509
559
|
*/
|
|
510
|
-
export declare function random(min?: float, max?: float,
|
|
560
|
+
export declare function random(min?: float, max?: float, seed?: int): float;
|
|
511
561
|
/**
|
|
512
562
|
* Returns the sign of a number.
|
|
513
563
|
*
|
|
@@ -545,9 +595,14 @@ export declare function sign(value: float): int;
|
|
|
545
595
|
* - **JavaScript signature**: Requires explicit `mintick` OR use `createContext()` with syminfo
|
|
546
596
|
* - Rounds to the nearest value divisible by mintick
|
|
547
597
|
* - Returns NaN for NaN input
|
|
548
|
-
* - Ties round up (0.5 -> 1)
|
|
549
598
|
* - If number is a Series, returns a Series; if number is a float, returns a float
|
|
550
599
|
*
|
|
600
|
+
* PineScript rules:
|
|
601
|
+
* - mintick is `minmove / pricescale` (here rebuilt from `mintick`: the smallest power of 10 that makes it an
|
|
602
|
+
* integer); the position on the tick grid is `|number| * pricescale / minmove`
|
|
603
|
+
* - ties go away from zero, decided on the exact value of that product with a 1e-10 tolerance
|
|
604
|
+
* (-1.075 -> -1.08, 1.005 -> 1.01, 2.675 -> 2.68 at mintick 0.01)
|
|
605
|
+
*
|
|
551
606
|
* @example
|
|
552
607
|
* ```typescript
|
|
553
608
|
* // Direct call with explicit mintick
|
|
@@ -564,5 +619,5 @@ export declare function round_to_mintick(number: float, mintick?: float): float;
|
|
|
564
619
|
export declare const pi: number;
|
|
565
620
|
export declare const e: number;
|
|
566
621
|
export declare const phi = 1.618033988749895;
|
|
567
|
-
export declare const rphi = 0.
|
|
622
|
+
export declare const rphi = 0.6180339887498948;
|
|
568
623
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/math/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/math/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;AAC3C,wBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;AAmBzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;AAC5C,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC;AAmBxC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;AAC7C,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC;AAmBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;AAC9D,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC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