@invinite-org/chartlang-core 1.0.1
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/CHANGELOG.md +1694 -0
- package/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/alert/alert.d.ts +32 -0
- package/dist/alert/alert.d.ts.map +1 -0
- package/dist/alert/alert.js +19 -0
- package/dist/alert/alert.js.map +1 -0
- package/dist/alert/index.d.ts +2 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/alert/index.js +4 -0
- package/dist/alert/index.js.map +1 -0
- package/dist/color/colorHelpers.d.ts +65 -0
- package/dist/color/colorHelpers.d.ts.map +1 -0
- package/dist/color/colorHelpers.js +137 -0
- package/dist/color/colorHelpers.js.map +1 -0
- package/dist/color/index.d.ts +37 -0
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/index.js +23 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/parseColor.d.ts +48 -0
- package/dist/color/parseColor.d.ts.map +1 -0
- package/dist/color/parseColor.js +141 -0
- package/dist/color/parseColor.js.map +1 -0
- package/dist/define/defineAlert.d.ts +43 -0
- package/dist/define/defineAlert.d.ts.map +1 -0
- package/dist/define/defineAlert.js +49 -0
- package/dist/define/defineAlert.js.map +1 -0
- package/dist/define/defineAlertCondition.d.ts +65 -0
- package/dist/define/defineAlertCondition.d.ts.map +1 -0
- package/dist/define/defineAlertCondition.js +64 -0
- package/dist/define/defineAlertCondition.js.map +1 -0
- package/dist/define/defineDrawing.d.ts +62 -0
- package/dist/define/defineDrawing.d.ts.map +1 -0
- package/dist/define/defineDrawing.js +67 -0
- package/dist/define/defineDrawing.js.map +1 -0
- package/dist/define/defineIndicator.d.ts +48 -0
- package/dist/define/defineIndicator.d.ts.map +1 -0
- package/dist/define/defineIndicator.js +54 -0
- package/dist/define/defineIndicator.js.map +1 -0
- package/dist/define/index.d.ts +6 -0
- package/dist/define/index.d.ts.map +1 -0
- package/dist/define/index.js +7 -0
- package/dist/define/index.js.map +1 -0
- package/dist/define/overrides.d.ts +102 -0
- package/dist/define/overrides.d.ts.map +1 -0
- package/dist/define/overrides.js +4 -0
- package/dist/define/overrides.js.map +1 -0
- package/dist/draw/buckets.d.ts +57 -0
- package/dist/draw/buckets.d.ts.map +1 -0
- package/dist/draw/buckets.js +110 -0
- package/dist/draw/buckets.js.map +1 -0
- package/dist/draw/draw.d.ts +128 -0
- package/dist/draw/draw.d.ts.map +1 -0
- package/dist/draw/draw.js +40 -0
- package/dist/draw/draw.js.map +1 -0
- package/dist/draw/drawingKind.d.ts +80 -0
- package/dist/draw/drawingKind.d.ts.map +1 -0
- package/dist/draw/drawingKind.js +177 -0
- package/dist/draw/drawingKind.js.map +1 -0
- package/dist/draw/drawingState.d.ts +1420 -0
- package/dist/draw/drawingState.d.ts.map +1 -0
- package/dist/draw/drawingState.js +4 -0
- package/dist/draw/drawingState.js.map +1 -0
- package/dist/draw/drawingStyle.d.ts +219 -0
- package/dist/draw/drawingStyle.d.ts.map +1 -0
- package/dist/draw/drawingStyle.js +4 -0
- package/dist/draw/drawingStyle.js.map +1 -0
- package/dist/draw/handle.d.ts +32 -0
- package/dist/draw/handle.d.ts.map +1 -0
- package/dist/draw/handle.js +4 -0
- package/dist/draw/handle.js.map +1 -0
- package/dist/draw/index.d.ts +13 -0
- package/dist/draw/index.d.ts.map +1 -0
- package/dist/draw/index.js +7 -0
- package/dist/draw/index.js.map +1 -0
- package/dist/draw/table.d.ts +84 -0
- package/dist/draw/table.d.ts.map +1 -0
- package/dist/draw/table.js +22 -0
- package/dist/draw/table.js.map +1 -0
- package/dist/draw/worldPoint.d.ts +114 -0
- package/dist/draw/worldPoint.d.ts.map +1 -0
- package/dist/draw/worldPoint.js +4 -0
- package/dist/draw/worldPoint.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input/index.js +4 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/input.d.ts +174 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +174 -0
- package/dist/input/input.js.map +1 -0
- package/dist/input/inputDescriptor.d.ts +204 -0
- package/dist/input/inputDescriptor.d.ts.map +1 -0
- package/dist/input/inputDescriptor.js +4 -0
- package/dist/input/inputDescriptor.js.map +1 -0
- package/dist/interval/intervalToSeconds.d.ts +20 -0
- package/dist/interval/intervalToSeconds.d.ts.map +1 -0
- package/dist/interval/intervalToSeconds.js +50 -0
- package/dist/interval/intervalToSeconds.js.map +1 -0
- package/dist/plot/index.d.ts +2 -0
- package/dist/plot/index.d.ts.map +1 -0
- package/dist/plot/index.js +4 -0
- package/dist/plot/index.js.map +1 -0
- package/dist/plot/plot.d.ts +277 -0
- package/dist/plot/plot.d.ts.map +1 -0
- package/dist/plot/plot.js +37 -0
- package/dist/plot/plot.js.map +1 -0
- package/dist/request/index.d.ts +2 -0
- package/dist/request/index.d.ts.map +1 -0
- package/dist/request/index.js +4 -0
- package/dist/request/index.js.map +1 -0
- package/dist/request/request.d.ts +106 -0
- package/dist/request/request.d.ts.map +1 -0
- package/dist/request/request.js +44 -0
- package/dist/request/request.js.map +1 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/runtime.d.ts +84 -0
- package/dist/runtime/runtime.d.ts.map +1 -0
- package/dist/runtime/runtime.js +72 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/state/index.d.ts +5 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/mutableSlot.d.ts +25 -0
- package/dist/state/mutableSlot.d.ts.map +1 -0
- package/dist/state/mutableSlot.js +4 -0
- package/dist/state/mutableSlot.js.map +1 -0
- package/dist/state/snapshot.d.ts +108 -0
- package/dist/state/snapshot.d.ts.map +1 -0
- package/dist/state/snapshot.js +4 -0
- package/dist/state/snapshot.js.map +1 -0
- package/dist/state/state.d.ts +86 -0
- package/dist/state/state.d.ts.map +1 -0
- package/dist/state/state.js +95 -0
- package/dist/state/state.js.map +1 -0
- package/dist/statefulPrimitives.d.ts +71 -0
- package/dist/statefulPrimitives.d.ts.map +1 -0
- package/dist/statefulPrimitives.js +234 -0
- package/dist/statefulPrimitives.js.map +1 -0
- package/dist/ta/index.d.ts +2 -0
- package/dist/ta/index.d.ts.map +1 -0
- package/dist/ta/index.js +4 -0
- package/dist/ta/index.js.map +1 -0
- package/dist/ta/ta.d.ts +2476 -0
- package/dist/ta/ta.d.ts.map +1 -0
- package/dist/ta/ta.js +312 -0
- package/dist/ta/ta.js.map +1 -0
- package/dist/time/_lib/dateTimeFormatCache.d.ts +11 -0
- package/dist/time/_lib/dateTimeFormatCache.d.ts.map +1 -0
- package/dist/time/_lib/dateTimeFormatCache.js +22 -0
- package/dist/time/_lib/dateTimeFormatCache.js.map +1 -0
- package/dist/time/index.d.ts +7 -0
- package/dist/time/index.d.ts.map +1 -0
- package/dist/time/index.js +8 -0
- package/dist/time/index.js.map +1 -0
- package/dist/time/nyDayKey.d.ts +24 -0
- package/dist/time/nyDayKey.d.ts.map +1 -0
- package/dist/time/nyDayKey.js +49 -0
- package/dist/time/nyDayKey.js.map +1 -0
- package/dist/time/session.d.ts +16 -0
- package/dist/time/session.d.ts.map +1 -0
- package/dist/time/session.js +18 -0
- package/dist/time/session.js.map +1 -0
- package/dist/time/sessionBoundaries.d.ts +40 -0
- package/dist/time/sessionBoundaries.d.ts.map +1 -0
- package/dist/time/sessionBoundaries.js +102 -0
- package/dist/time/sessionBoundaries.js.map +1 -0
- package/dist/time/types.d.ts +34 -0
- package/dist/time/types.d.ts.map +1 -0
- package/dist/time/types.js +4 -0
- package/dist/time/types.js.map +1 -0
- package/dist/time/weekKey.d.ts +11 -0
- package/dist/time/weekKey.d.ts.map +1 -0
- package/dist/time/weekKey.js +25 -0
- package/dist/time/weekKey.js.map +1 -0
- package/dist/time/weekday.d.ts +12 -0
- package/dist/time/weekday.d.ts.map +1 -0
- package/dist/time/weekday.js +22 -0
- package/dist/time/weekday.js.map +1 -0
- package/dist/types.d.ts +464 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/views/barstate.d.ts +40 -0
- package/dist/views/barstate.d.ts.map +1 -0
- package/dist/views/barstate.js +22 -0
- package/dist/views/barstate.js.map +1 -0
- package/dist/views/index.d.ts +4 -0
- package/dist/views/index.d.ts.map +1 -0
- package/dist/views/index.js +4 -0
- package/dist/views/index.js.map +1 -0
- package/dist/views/syminfo.d.ts +46 -0
- package/dist/views/syminfo.d.ts.map +1 -0
- package/dist/views/syminfo.js +25 -0
- package/dist/views/syminfo.js.map +1 -0
- package/dist/views/timeframe.d.ts +40 -0
- package/dist/views/timeframe.d.ts.map +1 -0
- package/dist/views/timeframe.js +21 -0
- package/dist/views/timeframe.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
const MULTIPLIERS = Object.freeze({
|
|
4
|
+
s: 1,
|
|
5
|
+
"": 60,
|
|
6
|
+
m: 60,
|
|
7
|
+
H: 3_600,
|
|
8
|
+
h: 3_600,
|
|
9
|
+
D: 86_400,
|
|
10
|
+
W: 604_800,
|
|
11
|
+
M: 2_592_000,
|
|
12
|
+
Y: 31_536_000,
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Convert an {@link IntervalDescriptor} to its effective second count.
|
|
16
|
+
*
|
|
17
|
+
* The helper prefers `intervalSeconds` when present. Otherwise it parses
|
|
18
|
+
* `value` as `<positive-integer><suffix>`, where no suffix means Pine-style
|
|
19
|
+
* minutes. Month and year suffixes use fixed 30-day and 365-day
|
|
20
|
+
* approximations; adapters that need calendar-exact durations should provide
|
|
21
|
+
* `intervalSeconds`.
|
|
22
|
+
*
|
|
23
|
+
* @throws Error when the override is non-positive / non-finite, or `value`
|
|
24
|
+
* cannot be parsed.
|
|
25
|
+
* @since 0.6
|
|
26
|
+
* @stable
|
|
27
|
+
* @example
|
|
28
|
+
* intervalToSeconds({ value: "1D", label: "1 day", group: "day" });
|
|
29
|
+
* intervalToSeconds({ value: "custom", label: "custom", group: "x", intervalSeconds: 7 });
|
|
30
|
+
*/
|
|
31
|
+
export function intervalToSeconds(d) {
|
|
32
|
+
if (d.intervalSeconds !== undefined) {
|
|
33
|
+
if (!Number.isFinite(d.intervalSeconds) || d.intervalSeconds <= 0) {
|
|
34
|
+
throw new Error(`intervalToSeconds: intervalSeconds must be a positive finite number; received ${d.intervalSeconds}`);
|
|
35
|
+
}
|
|
36
|
+
return Math.round(d.intervalSeconds);
|
|
37
|
+
}
|
|
38
|
+
const match = /^(\d+)([smHhDWMY]?)$/.exec(d.value);
|
|
39
|
+
if (match === null) {
|
|
40
|
+
throw new Error(`intervalToSeconds: cannot parse interval value ${JSON.stringify(d.value)}`);
|
|
41
|
+
}
|
|
42
|
+
const n = Number.parseInt(match[1], 10);
|
|
43
|
+
if (!Number.isFinite(n) || n <= 0) {
|
|
44
|
+
throw new Error(`intervalToSeconds: numeric prefix must be a positive integer; received ${JSON.stringify(d.value)}`);
|
|
45
|
+
}
|
|
46
|
+
const suffix = match[2];
|
|
47
|
+
const multiplier = MULTIPLIERS[suffix];
|
|
48
|
+
return n * multiplier;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=intervalToSeconds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intervalToSeconds.js","sourceRoot":"","sources":["../../src/interval/intervalToSeconds.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAI/D,MAAM,WAAW,GAAG,MAAM,CAAC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AC;IACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,UAAU,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plot/index.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plot/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import type { Color, LineStyle, Series } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Rendered-shape discriminator for `plot` emissions reaching the adapter.
|
|
4
|
+
* The full 0.5 inventory is `line`, `step-line`, `horizontal-line`,
|
|
5
|
+
* `histogram`, `bars`, `area`, `filled-band`, `label`, `marker`,
|
|
6
|
+
* `shape`, `character`, `arrow`, `candle-override`, `bar-override`,
|
|
7
|
+
* `bg-color`, `bar-color`, and `horizontal-histogram`. Every expansion is
|
|
8
|
+
* additive — the `apiVersion: 1` script header stays unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Typical Phase-2 consumers:
|
|
11
|
+
*
|
|
12
|
+
* - `histogram` → volume bars, MACD histogram, momentum-style oscillators.
|
|
13
|
+
* - `bars` → narrow vertical bar plotted at integer x (signed momentum).
|
|
14
|
+
* - `area` → filled region under a polyline (BB midline, regression).
|
|
15
|
+
* - `filled-band` → Bollinger / Keltner / Donchian / Ichimoku envelopes.
|
|
16
|
+
* - `label` → text annotations at a world-space anchor (fractal, pivot).
|
|
17
|
+
* - `marker` → discrete glyph (circle / triangle / square / diamond) for
|
|
18
|
+
* fractals / divergence / supertrend flips.
|
|
19
|
+
*
|
|
20
|
+
* @since 0.1
|
|
21
|
+
* @example
|
|
22
|
+
* const k: PlotKind = "line";
|
|
23
|
+
* const histogram: PlotKind = "histogram";
|
|
24
|
+
* const shape: PlotKind = "shape";
|
|
25
|
+
* void k; void histogram; void shape;
|
|
26
|
+
*/
|
|
27
|
+
export type PlotKind = "line" | "step-line" | "horizontal-line" | "histogram" | "bars" | "area" | "filled-band" | "label" | "marker" | "shape" | "character" | "arrow" | "candle-override" | "bar-override" | "bg-color" | "bar-color" | "horizontal-histogram";
|
|
28
|
+
/**
|
|
29
|
+
* Marker glyphs shared by Phase 2 `marker` and Phase 5 `shape` plot styles.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.5
|
|
32
|
+
* @stable
|
|
33
|
+
* @example
|
|
34
|
+
* const shape: PlotGlyphShape = "circle";
|
|
35
|
+
* void shape;
|
|
36
|
+
*/
|
|
37
|
+
export type PlotGlyphShape = "circle" | "triangle-up" | "triangle-down" | "square" | "diamond";
|
|
38
|
+
/**
|
|
39
|
+
* Full glyph inventory for Phase 5 `shape` plot styles.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.5
|
|
42
|
+
* @stable
|
|
43
|
+
* @example
|
|
44
|
+
* const shape: PlotShapeGlyph = "flag";
|
|
45
|
+
* void shape;
|
|
46
|
+
*/
|
|
47
|
+
export type PlotShapeGlyph = PlotGlyphShape | "cross" | "xcross" | "flag";
|
|
48
|
+
/**
|
|
49
|
+
* Vertical anchoring mode for glyph-like Phase 5 plot styles.
|
|
50
|
+
*
|
|
51
|
+
* @since 0.5
|
|
52
|
+
* @stable
|
|
53
|
+
* @example
|
|
54
|
+
* const location: PlotLocation = "above";
|
|
55
|
+
* void location;
|
|
56
|
+
*/
|
|
57
|
+
export type PlotLocation = "above" | "below" | "absolute";
|
|
58
|
+
/**
|
|
59
|
+
* Single row in a Phase 5 horizontal-histogram plot emission.
|
|
60
|
+
*
|
|
61
|
+
* @since 0.5
|
|
62
|
+
* @stable
|
|
63
|
+
* @example
|
|
64
|
+
* const bucket: HorizontalHistogramBucket = { price: 100, volume: 25 };
|
|
65
|
+
* void bucket;
|
|
66
|
+
*/
|
|
67
|
+
export type HorizontalHistogramBucket = Readonly<{
|
|
68
|
+
readonly price: number;
|
|
69
|
+
readonly volume: number;
|
|
70
|
+
readonly color?: Color;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Script-author selectable plot style. The runtime maps this to the
|
|
74
|
+
* adapter-kit's wire `PlotStyle` discriminated union and fills in defaults
|
|
75
|
+
* from sibling {@link PlotOpts} fields (`lineWidth` / `lineStyle`) for
|
|
76
|
+
* line-like styles.
|
|
77
|
+
*
|
|
78
|
+
* `histogram.baseline` defaults to `0` when omitted.
|
|
79
|
+
*
|
|
80
|
+
* @formula N/A — script-facing style input
|
|
81
|
+
* @since 0.2
|
|
82
|
+
* @stable
|
|
83
|
+
* @example
|
|
84
|
+
* const lineStyle: PlotOptsStyle = { kind: "line" };
|
|
85
|
+
* const histStyle: PlotOptsStyle = { kind: "histogram", baseline: 0 };
|
|
86
|
+
* void lineStyle; void histStyle;
|
|
87
|
+
*/
|
|
88
|
+
export type PlotOptsStyle = {
|
|
89
|
+
readonly kind: "line";
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: "step-line";
|
|
92
|
+
} | {
|
|
93
|
+
readonly kind: "horizontal-line";
|
|
94
|
+
} | {
|
|
95
|
+
readonly kind: "histogram";
|
|
96
|
+
readonly baseline?: number;
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: "marker";
|
|
99
|
+
readonly shape: PlotGlyphShape;
|
|
100
|
+
readonly size: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Glyph at world-anchor — Pine's `plotshape`. Location selects vertical
|
|
104
|
+
* anchoring; `size` is in CSS pixels.
|
|
105
|
+
*
|
|
106
|
+
* @since 0.5
|
|
107
|
+
* @stable
|
|
108
|
+
* @example
|
|
109
|
+
* plot(bar.close, { style: { kind: "shape", shape: "triangle-up", size: 8, location: "below" } });
|
|
110
|
+
*/
|
|
111
|
+
| {
|
|
112
|
+
readonly kind: "shape";
|
|
113
|
+
readonly shape: PlotShapeGlyph;
|
|
114
|
+
readonly size: number;
|
|
115
|
+
readonly location?: PlotLocation;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Text glyph at world-anchor — Pine's `plotchar`. `char` may be any
|
|
119
|
+
* non-empty UTF-8 string; `size` is in CSS pixels.
|
|
120
|
+
*
|
|
121
|
+
* @since 0.5
|
|
122
|
+
* @stable
|
|
123
|
+
* @example
|
|
124
|
+
* plot(bar.close, { style: { kind: "character", char: "▲", size: 12, location: "above" } });
|
|
125
|
+
*/
|
|
126
|
+
| {
|
|
127
|
+
readonly kind: "character";
|
|
128
|
+
readonly char: string;
|
|
129
|
+
readonly size: number;
|
|
130
|
+
readonly location?: PlotLocation;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Directional marker at world-anchor — Pine's `plotarrow`.
|
|
134
|
+
*
|
|
135
|
+
* @since 0.5
|
|
136
|
+
* @stable
|
|
137
|
+
* @example
|
|
138
|
+
* plot(bar.low, { style: { kind: "arrow", direction: "up", size: 10 } });
|
|
139
|
+
*/
|
|
140
|
+
| {
|
|
141
|
+
readonly kind: "arrow";
|
|
142
|
+
readonly direction: "up" | "down";
|
|
143
|
+
readonly size: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Candle body color override — Pine's `plotcandle`.
|
|
147
|
+
*
|
|
148
|
+
* @since 0.5
|
|
149
|
+
* @stable
|
|
150
|
+
* @example
|
|
151
|
+
* plot(bar.close, { style: { kind: "candle-override", bull: "#26a69a", bear: "#ef5350" } });
|
|
152
|
+
*/
|
|
153
|
+
| {
|
|
154
|
+
readonly kind: "candle-override";
|
|
155
|
+
readonly bull: Color;
|
|
156
|
+
readonly bear: Color;
|
|
157
|
+
readonly doji?: Color;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* OHLC bar outline override — Pine's `plotbar`.
|
|
161
|
+
*
|
|
162
|
+
* @since 0.5
|
|
163
|
+
* @stable
|
|
164
|
+
* @example
|
|
165
|
+
* plot(bar.close, { style: { kind: "bar-override", color: "#f59e0b" } });
|
|
166
|
+
*/
|
|
167
|
+
| {
|
|
168
|
+
readonly kind: "bar-override";
|
|
169
|
+
readonly color: Color;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Pane background color band — Pine's `bgcolor`.
|
|
173
|
+
*
|
|
174
|
+
* @since 0.5
|
|
175
|
+
* @stable
|
|
176
|
+
* @example
|
|
177
|
+
* plot(bar.close, { style: { kind: "bg-color", color: "#1d4ed8", transp: 80 } });
|
|
178
|
+
*/
|
|
179
|
+
| {
|
|
180
|
+
readonly kind: "bg-color";
|
|
181
|
+
readonly color: Color;
|
|
182
|
+
readonly transp?: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Main candle/bar tint — Pine's `barcolor`.
|
|
186
|
+
*
|
|
187
|
+
* @since 0.5
|
|
188
|
+
* @stable
|
|
189
|
+
* @example
|
|
190
|
+
* plot(bar.close, { style: { kind: "bar-color", color: "#a855f7" } });
|
|
191
|
+
*/
|
|
192
|
+
| {
|
|
193
|
+
readonly kind: "bar-color";
|
|
194
|
+
readonly color: Color;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Right-edge volume-profile bars keyed by price bucket.
|
|
198
|
+
*
|
|
199
|
+
* @since 0.5
|
|
200
|
+
* @stable
|
|
201
|
+
* @example
|
|
202
|
+
* plot(bar.close, { style: { kind: "horizontal-histogram", buckets: [{ price: bar.close, volume: bar.volume }] } });
|
|
203
|
+
*/
|
|
204
|
+
| {
|
|
205
|
+
readonly kind: "horizontal-histogram";
|
|
206
|
+
readonly buckets: ReadonlyArray<HorizontalHistogramBucket>;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Styling options accepted by `plot(...)`. `pane: "overlay"` (the default) is
|
|
210
|
+
* the only pane the Phase-1 canvas2d adapter renders — `"new"` and named
|
|
211
|
+
* panes are reserved for Phase 2+. `style` (Phase 2) lets the script pick
|
|
212
|
+
* a non-line {@link PlotOptsStyle} — defaults to `{ kind: "line" }`.
|
|
213
|
+
*
|
|
214
|
+
* @since 0.1
|
|
215
|
+
* @example
|
|
216
|
+
* const opts: PlotOpts = {
|
|
217
|
+
* color: "#3b82f6",
|
|
218
|
+
* title: "EMA(20)",
|
|
219
|
+
* lineWidth: 2,
|
|
220
|
+
* lineStyle: "solid",
|
|
221
|
+
* pane: "overlay",
|
|
222
|
+
* style: { kind: "line" },
|
|
223
|
+
* };
|
|
224
|
+
*/
|
|
225
|
+
export type PlotOpts = Readonly<{
|
|
226
|
+
color?: Color;
|
|
227
|
+
title?: string;
|
|
228
|
+
lineWidth?: number;
|
|
229
|
+
lineStyle?: LineStyle;
|
|
230
|
+
pane?: "overlay" | "new" | string;
|
|
231
|
+
style?: PlotOptsStyle;
|
|
232
|
+
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Styling options accepted by `hline(...)`. Unlike `plot`, `hline` is always
|
|
235
|
+
* a single horizontal line at a fixed price; no pane override.
|
|
236
|
+
*
|
|
237
|
+
* @since 0.1
|
|
238
|
+
* @example
|
|
239
|
+
* const opts: HLineOpts = { color: "#ef4444", title: "Stop", lineStyle: "dashed" };
|
|
240
|
+
*/
|
|
241
|
+
export type HLineOpts = Readonly<{
|
|
242
|
+
color?: Color;
|
|
243
|
+
title?: string;
|
|
244
|
+
lineWidth?: number;
|
|
245
|
+
lineStyle?: LineStyle;
|
|
246
|
+
}>;
|
|
247
|
+
/**
|
|
248
|
+
* Compile-time callable hole for `plot(value, opts?)`. The compiler rewrites
|
|
249
|
+
* every callsite (Task 2) to dispatch to the runtime's `plot` implementation;
|
|
250
|
+
* calling this outside a compiled runtime throws the sentinel.
|
|
251
|
+
*
|
|
252
|
+
* Accepts `number | Series<number>` — scalars emit a single bar value;
|
|
253
|
+
* series emissions pull from `series.current`.
|
|
254
|
+
*
|
|
255
|
+
* @since 0.1
|
|
256
|
+
* @stable
|
|
257
|
+
* @example
|
|
258
|
+
* // Inside a compiled `compute`:
|
|
259
|
+
* // plot(bar.close, { color: "#3b82f6" });
|
|
260
|
+
* import { plot } from "@invinite-org/chartlang-core";
|
|
261
|
+
* try { plot(0); } catch {}
|
|
262
|
+
*/
|
|
263
|
+
export declare function plot(_value: number | Series<number>, _opts?: PlotOpts): void;
|
|
264
|
+
/**
|
|
265
|
+
* Compile-time callable hole for `hline(price, opts?)`. Same semantics as
|
|
266
|
+
* `plot` but pinned to a fixed price across all bars.
|
|
267
|
+
*
|
|
268
|
+
* @since 0.1
|
|
269
|
+
* @stable
|
|
270
|
+
* @example
|
|
271
|
+
* // Inside a compiled `compute`:
|
|
272
|
+
* // hline(70, { color: "#ef4444" });
|
|
273
|
+
* import { hline } from "@invinite-org/chartlang-core";
|
|
274
|
+
* try { hline(70); } catch {}
|
|
275
|
+
*/
|
|
276
|
+
export declare function hline(_price: number, _opts?: HLineOpts): void;
|
|
277
|
+
//# sourceMappingURL=plot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/plot/plot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,QAAQ,GACd,MAAM,GACN,WAAW,GACX,iBAAiB,GACjB,WAAW,GACX,MAAM,GACN,MAAM,GACN,aAAa,GACb,OAAO,GACP,QAAQ,GACR,OAAO,GACP,WAAW,GACX,OAAO,GACP,iBAAiB,GACjB,cAAc,GACd,UAAU,GACV,WAAW,GACX,sBAAsB,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,aAAa,GAAG,eAAe,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/F;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,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E,aAAa,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAE5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAE7D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
/**
|
|
4
|
+
* Compile-time callable hole for `plot(value, opts?)`. The compiler rewrites
|
|
5
|
+
* every callsite (Task 2) to dispatch to the runtime's `plot` implementation;
|
|
6
|
+
* calling this outside a compiled runtime throws the sentinel.
|
|
7
|
+
*
|
|
8
|
+
* Accepts `number | Series<number>` — scalars emit a single bar value;
|
|
9
|
+
* series emissions pull from `series.current`.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.1
|
|
12
|
+
* @stable
|
|
13
|
+
* @example
|
|
14
|
+
* // Inside a compiled `compute`:
|
|
15
|
+
* // plot(bar.close, { color: "#3b82f6" });
|
|
16
|
+
* import { plot } from "@invinite-org/chartlang-core";
|
|
17
|
+
* try { plot(0); } catch {}
|
|
18
|
+
*/
|
|
19
|
+
export function plot(_value, _opts) {
|
|
20
|
+
throw new Error("plot called outside compiled runtime");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compile-time callable hole for `hline(price, opts?)`. Same semantics as
|
|
24
|
+
* `plot` but pinned to a fixed price across all bars.
|
|
25
|
+
*
|
|
26
|
+
* @since 0.1
|
|
27
|
+
* @stable
|
|
28
|
+
* @example
|
|
29
|
+
* // Inside a compiled `compute`:
|
|
30
|
+
* // hline(70, { color: "#ef4444" });
|
|
31
|
+
* import { hline } from "@invinite-org/chartlang-core";
|
|
32
|
+
* try { hline(70); } catch {}
|
|
33
|
+
*/
|
|
34
|
+
export function hline(_price, _opts) {
|
|
35
|
+
throw new Error("hline called outside compiled runtime");
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=plot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/plot/plot.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAgQ/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,IAAI,CAAC,MAA+B,EAAE,KAAgB;IAClE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE,KAAiB;IACnD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACnB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EACH,OAAO,GAKV,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Bar, Price, Series, Time, Volume } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Argument to {@link request.security}. The `interval` must be a string
|
|
4
|
+
* literal or an `input.enum` value; the compiler's literal-only pass rejects
|
|
5
|
+
* dynamic expressions with `request-security-interval-not-literal`.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.4
|
|
8
|
+
* @stable
|
|
9
|
+
* @example
|
|
10
|
+
* const opts: RequestSecurityOpts = { interval: "1D" };
|
|
11
|
+
* void opts;
|
|
12
|
+
*/
|
|
13
|
+
export type RequestSecurityOpts = Readonly<{
|
|
14
|
+
readonly interval: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Argument to {@link request.lowerTf}. The `interval` must be strictly lower
|
|
18
|
+
* than the script's main interval; invalid orderings are rejected by the
|
|
19
|
+
* compiler's `lower-tf-not-lower` diagnostic when statically known.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.6
|
|
22
|
+
* @stable
|
|
23
|
+
* @example
|
|
24
|
+
* const opts: RequestLowerTfOpts = { interval: "30s" };
|
|
25
|
+
* void opts;
|
|
26
|
+
*/
|
|
27
|
+
export type RequestLowerTfOpts = Readonly<{
|
|
28
|
+
readonly interval: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Secondary-stream bar returned by {@link request.security}. Each field is a
|
|
32
|
+
* `Series<...>` aligned from the runtime's secondary-stream ring buffer to
|
|
33
|
+
* the current main stream, or by the all-NaN fallback when
|
|
34
|
+
* `Capabilities.multiTimeframe` is `false`, the interval is unsupported, or
|
|
35
|
+
* the host fails to register the secondary stream.
|
|
36
|
+
*
|
|
37
|
+
* This is intentionally a series-shaped view rather than the scalar
|
|
38
|
+
* {@link Bar} shape so scripts can read historical secondary values aligned
|
|
39
|
+
* to main bars, such as `daily.close[5]`.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.4
|
|
42
|
+
* @stable
|
|
43
|
+
* @example
|
|
44
|
+
* const close: SecurityBar["close"] = { current: 1, length: 1 };
|
|
45
|
+
* void close;
|
|
46
|
+
*/
|
|
47
|
+
export type SecurityBar = Readonly<{
|
|
48
|
+
readonly time: Series<Time>;
|
|
49
|
+
readonly open: Series<Price>;
|
|
50
|
+
readonly high: Series<Price>;
|
|
51
|
+
readonly low: Series<Price>;
|
|
52
|
+
readonly close: Series<Price>;
|
|
53
|
+
readonly volume: Series<Volume>;
|
|
54
|
+
readonly hl2: Series<Price>;
|
|
55
|
+
readonly hlc3: Series<Price>;
|
|
56
|
+
readonly ohlc4: Series<Price>;
|
|
57
|
+
readonly hlcc4: Series<Price>;
|
|
58
|
+
readonly symbol: Series<string>;
|
|
59
|
+
readonly interval: Series<string>;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* `request.*` namespace for secondary timeframe reads. The compiler walks
|
|
63
|
+
* `request.security(...)` calls to populate `manifest.requestedIntervals`;
|
|
64
|
+
* the runtime replaces this callable hole with a slot-aware implementation
|
|
65
|
+
* through `ComputeContext.request`.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.4
|
|
68
|
+
* @stable
|
|
69
|
+
* @example
|
|
70
|
+
* const ns: typeof request = request;
|
|
71
|
+
* void ns;
|
|
72
|
+
*/
|
|
73
|
+
export declare const request: Readonly<{
|
|
74
|
+
/**
|
|
75
|
+
* Read a secondary candle stream at a script-author-fixed interval.
|
|
76
|
+
*
|
|
77
|
+
* @since 0.4
|
|
78
|
+
* @stable
|
|
79
|
+
* @example
|
|
80
|
+
* const fn: typeof request.security = request.security;
|
|
81
|
+
* void fn;
|
|
82
|
+
*/
|
|
83
|
+
security(_opts: RequestSecurityOpts): SecurityBar;
|
|
84
|
+
/**
|
|
85
|
+
* Read lower-timeframe bars contained by each main-stream bar.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.6
|
|
88
|
+
* @stable
|
|
89
|
+
* @example
|
|
90
|
+
* const fn: typeof request.lowerTf = request.lowerTf;
|
|
91
|
+
* void fn;
|
|
92
|
+
*/
|
|
93
|
+
lowerTf(_opts: RequestLowerTfOpts): Series<ReadonlyArray<Bar>>;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Static type of the `request` namespace. Runtime implementations satisfy
|
|
97
|
+
* this shape structurally when installed on `ComputeContext.request`.
|
|
98
|
+
*
|
|
99
|
+
* @since 0.4
|
|
100
|
+
* @stable
|
|
101
|
+
* @example
|
|
102
|
+
* const ns: RequestNamespace = request;
|
|
103
|
+
* void ns;
|
|
104
|
+
*/
|
|
105
|
+
export type RequestNamespace = typeof request;
|
|
106
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CACrC,CAAC,CAAC;AAMH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO;IAChB;;;;;;;;OAQG;oBACa,mBAAmB,GAAG,WAAW;IAGjD;;;;;;;;OAQG;mBACY,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;EAGhE,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,OAAO,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
const sentinel = (name) => {
|
|
4
|
+
throw new Error(`${name} called outside an active script step`);
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* `request.*` namespace for secondary timeframe reads. The compiler walks
|
|
8
|
+
* `request.security(...)` calls to populate `manifest.requestedIntervals`;
|
|
9
|
+
* the runtime replaces this callable hole with a slot-aware implementation
|
|
10
|
+
* through `ComputeContext.request`.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.4
|
|
13
|
+
* @stable
|
|
14
|
+
* @example
|
|
15
|
+
* const ns: typeof request = request;
|
|
16
|
+
* void ns;
|
|
17
|
+
*/
|
|
18
|
+
export const request = Object.freeze({
|
|
19
|
+
/**
|
|
20
|
+
* Read a secondary candle stream at a script-author-fixed interval.
|
|
21
|
+
*
|
|
22
|
+
* @since 0.4
|
|
23
|
+
* @stable
|
|
24
|
+
* @example
|
|
25
|
+
* const fn: typeof request.security = request.security;
|
|
26
|
+
* void fn;
|
|
27
|
+
*/
|
|
28
|
+
security(_opts) {
|
|
29
|
+
return sentinel("request.security");
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Read lower-timeframe bars contained by each main-stream bar.
|
|
33
|
+
*
|
|
34
|
+
* @since 0.6
|
|
35
|
+
* @stable
|
|
36
|
+
* @example
|
|
37
|
+
* const fn: typeof request.lowerTf = request.lowerTf;
|
|
38
|
+
* void fn;
|
|
39
|
+
*/
|
|
40
|
+
lowerTf(_opts) {
|
|
41
|
+
return sentinel("request.lowerTf");
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAkE/D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAS,EAAE;IACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAA0B;QAC/B,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;IACD;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAyB;QAC7B,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|