@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
export { intervalToSeconds } from "./interval/intervalToSeconds.js";
|
|
4
|
+
export { defineAlert, defineAlertCondition, defineDrawing, defineIndicator, } from "./define/index.js";
|
|
5
|
+
export { ta } from "./ta/index.js";
|
|
6
|
+
export { input } from "./input/index.js";
|
|
7
|
+
export { state } from "./state/index.js";
|
|
8
|
+
export { barstate, syminfo, timeframe } from "./views/index.js";
|
|
9
|
+
export { request } from "./request/index.js";
|
|
10
|
+
export { runtime } from "./runtime/index.js";
|
|
11
|
+
export { color, fromGradient, hsl, rgb, withAlpha } from "./color/index.js";
|
|
12
|
+
export { hline, plot } from "./plot/index.js";
|
|
13
|
+
export { alert } from "./alert/index.js";
|
|
14
|
+
export { STATEFUL_PRIMITIVES, STATEFUL_PRIMITIVES_BY_NAME } from "./statefulPrimitives.js";
|
|
15
|
+
export { DRAWING_KINDS, KIND_BUCKET, KIND_CAMELCASE, KIND_KEBABCASE, bucketFor, draw, } from "./draw/index.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAyB/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACH,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,eAAe,GAClB,MAAM,mBAAmB,CAAC;AAU3B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAuInC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAmBzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EACH,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,SAAS,EACT,IAAI,GACP,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { input } from "./input.js";
|
|
2
|
+
export type { BoolDescriptor, ColorDescriptor, EnumDescriptor, ExternalSeriesDescriptor, FloatDescriptor, InputDescriptor, InputKind, IntDescriptor, IntervalDescriptorInput, PriceDescriptor, Schema, SourceDescriptor, SourceField, StringDescriptor, SymbolDescriptor, TimeDescriptor, } from "./inputDescriptor.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EACR,cAAc,EACd,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACjB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { Color, Price, Time } from "../types.js";
|
|
2
|
+
import type { BoolDescriptor, ColorDescriptor, EnumDescriptor, ExternalSeriesDescriptor, FloatDescriptor, IntDescriptor, IntervalDescriptorInput, PriceDescriptor, Schema, SourceDescriptor, SourceField, StringDescriptor, SymbolDescriptor, TimeDescriptor } from "./inputDescriptor.js";
|
|
3
|
+
/**
|
|
4
|
+
* The `input.*` namespace. Every builder is a compile-time literal: the
|
|
5
|
+
* compiler reads the call expression and serialises the descriptor into
|
|
6
|
+
* `manifest.inputs`.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.4
|
|
9
|
+
* @stable
|
|
10
|
+
* @example
|
|
11
|
+
* import { input } from "@invinite-org/chartlang-core";
|
|
12
|
+
* const length = input.int(20, { min: 1, max: 200, title: "Length" });
|
|
13
|
+
* void length;
|
|
14
|
+
*/
|
|
15
|
+
export declare const input: Readonly<{
|
|
16
|
+
/**
|
|
17
|
+
* Build an integer input descriptor.
|
|
18
|
+
*
|
|
19
|
+
* @since 0.4
|
|
20
|
+
* @stable
|
|
21
|
+
* @example
|
|
22
|
+
* const length = input.int(20, { min: 1, max: 200 });
|
|
23
|
+
* void length;
|
|
24
|
+
*/
|
|
25
|
+
int(defaultValue: number, opts?: {
|
|
26
|
+
readonly min?: number;
|
|
27
|
+
readonly max?: number;
|
|
28
|
+
readonly step?: number;
|
|
29
|
+
readonly title?: string;
|
|
30
|
+
}): IntDescriptor;
|
|
31
|
+
/**
|
|
32
|
+
* Build a floating-point input descriptor.
|
|
33
|
+
*
|
|
34
|
+
* @since 0.4
|
|
35
|
+
* @stable
|
|
36
|
+
* @example
|
|
37
|
+
* const multiplier = input.float(2.5, { step: 0.5 });
|
|
38
|
+
* void multiplier;
|
|
39
|
+
*/
|
|
40
|
+
float(defaultValue: number, opts?: {
|
|
41
|
+
readonly min?: number;
|
|
42
|
+
readonly max?: number;
|
|
43
|
+
readonly step?: number;
|
|
44
|
+
readonly title?: string;
|
|
45
|
+
}): FloatDescriptor;
|
|
46
|
+
/**
|
|
47
|
+
* Build a boolean input descriptor.
|
|
48
|
+
*
|
|
49
|
+
* @since 0.4
|
|
50
|
+
* @stable
|
|
51
|
+
* @example
|
|
52
|
+
* const enabled = input.bool(true);
|
|
53
|
+
* void enabled;
|
|
54
|
+
*/
|
|
55
|
+
bool(defaultValue: boolean, opts?: {
|
|
56
|
+
readonly title?: string;
|
|
57
|
+
}): BoolDescriptor;
|
|
58
|
+
/**
|
|
59
|
+
* Build a string input descriptor.
|
|
60
|
+
*
|
|
61
|
+
* @since 0.4
|
|
62
|
+
* @stable
|
|
63
|
+
* @example
|
|
64
|
+
* const symbol = input.string("AAPL");
|
|
65
|
+
* void symbol;
|
|
66
|
+
*/
|
|
67
|
+
string(defaultValue: string, opts?: {
|
|
68
|
+
readonly title?: string;
|
|
69
|
+
readonly multiline?: boolean;
|
|
70
|
+
}): StringDescriptor;
|
|
71
|
+
/**
|
|
72
|
+
* Build a string enum input descriptor.
|
|
73
|
+
*
|
|
74
|
+
* @since 0.4
|
|
75
|
+
* @stable
|
|
76
|
+
* @example
|
|
77
|
+
* const mode = input.enum("fast", ["fast", "slow"]);
|
|
78
|
+
* void mode;
|
|
79
|
+
*/
|
|
80
|
+
enum<T extends string>(defaultValue: T, options: ReadonlyArray<T>, opts?: {
|
|
81
|
+
readonly title?: string;
|
|
82
|
+
}): EnumDescriptor<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Build a color input descriptor.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.4
|
|
87
|
+
* @stable
|
|
88
|
+
* @example
|
|
89
|
+
* const c = input.color("#26a69a");
|
|
90
|
+
* void c;
|
|
91
|
+
*/
|
|
92
|
+
color(defaultValue: Color, opts?: {
|
|
93
|
+
readonly title?: string;
|
|
94
|
+
}): ColorDescriptor;
|
|
95
|
+
/**
|
|
96
|
+
* Build a source-field input descriptor.
|
|
97
|
+
*
|
|
98
|
+
* @since 0.4
|
|
99
|
+
* @stable
|
|
100
|
+
* @example
|
|
101
|
+
* const source = input.source("close");
|
|
102
|
+
* void source;
|
|
103
|
+
*/
|
|
104
|
+
source(defaultValue: SourceField, opts?: {
|
|
105
|
+
readonly title?: string;
|
|
106
|
+
}): SourceDescriptor;
|
|
107
|
+
/**
|
|
108
|
+
* Build a time input descriptor.
|
|
109
|
+
*
|
|
110
|
+
* @since 0.4
|
|
111
|
+
* @stable
|
|
112
|
+
* @example
|
|
113
|
+
* const anchor = input.time(1_700_000_000_000, { pickFromChart: true });
|
|
114
|
+
* void anchor;
|
|
115
|
+
*/
|
|
116
|
+
time(defaultValue: Time, opts?: {
|
|
117
|
+
readonly title?: string;
|
|
118
|
+
readonly pickFromChart?: boolean;
|
|
119
|
+
}): TimeDescriptor;
|
|
120
|
+
/**
|
|
121
|
+
* Build a price input descriptor.
|
|
122
|
+
*
|
|
123
|
+
* @since 0.4
|
|
124
|
+
* @stable
|
|
125
|
+
* @example
|
|
126
|
+
* const level = input.price(101.25);
|
|
127
|
+
* void level;
|
|
128
|
+
*/
|
|
129
|
+
price(defaultValue: Price, opts?: {
|
|
130
|
+
readonly title?: string;
|
|
131
|
+
}): PriceDescriptor;
|
|
132
|
+
/**
|
|
133
|
+
* Build a symbol input descriptor.
|
|
134
|
+
*
|
|
135
|
+
* @since 0.4
|
|
136
|
+
* @stable
|
|
137
|
+
* @example
|
|
138
|
+
* const ticker = input.symbol("AAPL");
|
|
139
|
+
* void ticker;
|
|
140
|
+
*/
|
|
141
|
+
symbol(defaultValue: string, opts?: {
|
|
142
|
+
readonly title?: string;
|
|
143
|
+
}): SymbolDescriptor;
|
|
144
|
+
/**
|
|
145
|
+
* Build a main-interval input descriptor.
|
|
146
|
+
*
|
|
147
|
+
* @since 0.4
|
|
148
|
+
* @stable
|
|
149
|
+
* @example
|
|
150
|
+
* const interval = input.interval("1D");
|
|
151
|
+
* void interval;
|
|
152
|
+
*/
|
|
153
|
+
interval(defaultValue: string, opts?: {
|
|
154
|
+
readonly title?: string;
|
|
155
|
+
}): IntervalDescriptorInput;
|
|
156
|
+
/**
|
|
157
|
+
* Build an adapter-supplied external series input descriptor.
|
|
158
|
+
*
|
|
159
|
+
* @since 0.4
|
|
160
|
+
* @stable
|
|
161
|
+
* @example
|
|
162
|
+
* const earnings = input.externalSeries({
|
|
163
|
+
* name: "earnings",
|
|
164
|
+
* schema: { kind: "external-series-schema" },
|
|
165
|
+
* });
|
|
166
|
+
* void earnings;
|
|
167
|
+
*/
|
|
168
|
+
externalSeries<T>(args: {
|
|
169
|
+
readonly name: string;
|
|
170
|
+
readonly schema: Schema<T>;
|
|
171
|
+
readonly title?: string;
|
|
172
|
+
}): ExternalSeriesDescriptor<T>;
|
|
173
|
+
}>;
|
|
174
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/input/input.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EACR,cAAc,EACd,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACjB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK;IACd;;;;;;;;OAQG;sBAEe,MAAM,SACb;QACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;KAC3B,GACF,aAAa;IAIhB;;;;;;;;OAQG;wBAEe,MAAM,SACb;QACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;KAC3B,GACF,eAAe;IAIlB;;;;;;;;OAQG;uBACgB,OAAO,SAAS;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;IAI/E;;;;;;;;OAQG;yBAEe,MAAM,SACb;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ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Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
/**
|
|
4
|
+
* The `input.*` namespace. Every builder is a compile-time literal: the
|
|
5
|
+
* compiler reads the call expression and serialises the descriptor into
|
|
6
|
+
* `manifest.inputs`.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.4
|
|
9
|
+
* @stable
|
|
10
|
+
* @example
|
|
11
|
+
* import { input } from "@invinite-org/chartlang-core";
|
|
12
|
+
* const length = input.int(20, { min: 1, max: 200, title: "Length" });
|
|
13
|
+
* void length;
|
|
14
|
+
*/
|
|
15
|
+
export const input = Object.freeze({
|
|
16
|
+
/**
|
|
17
|
+
* Build an integer input descriptor.
|
|
18
|
+
*
|
|
19
|
+
* @since 0.4
|
|
20
|
+
* @stable
|
|
21
|
+
* @example
|
|
22
|
+
* const length = input.int(20, { min: 1, max: 200 });
|
|
23
|
+
* void length;
|
|
24
|
+
*/
|
|
25
|
+
int(defaultValue, opts) {
|
|
26
|
+
return Object.freeze({ kind: "int", defaultValue, ...opts });
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Build a floating-point input descriptor.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.4
|
|
32
|
+
* @stable
|
|
33
|
+
* @example
|
|
34
|
+
* const multiplier = input.float(2.5, { step: 0.5 });
|
|
35
|
+
* void multiplier;
|
|
36
|
+
*/
|
|
37
|
+
float(defaultValue, opts) {
|
|
38
|
+
return Object.freeze({ kind: "float", defaultValue, ...opts });
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Build a boolean input descriptor.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.4
|
|
44
|
+
* @stable
|
|
45
|
+
* @example
|
|
46
|
+
* const enabled = input.bool(true);
|
|
47
|
+
* void enabled;
|
|
48
|
+
*/
|
|
49
|
+
bool(defaultValue, opts) {
|
|
50
|
+
return Object.freeze({ kind: "bool", defaultValue, ...opts });
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Build a string input descriptor.
|
|
54
|
+
*
|
|
55
|
+
* @since 0.4
|
|
56
|
+
* @stable
|
|
57
|
+
* @example
|
|
58
|
+
* const symbol = input.string("AAPL");
|
|
59
|
+
* void symbol;
|
|
60
|
+
*/
|
|
61
|
+
string(defaultValue, opts) {
|
|
62
|
+
return Object.freeze({ kind: "string", defaultValue, ...opts });
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Build a string enum input descriptor.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.4
|
|
68
|
+
* @stable
|
|
69
|
+
* @example
|
|
70
|
+
* const mode = input.enum("fast", ["fast", "slow"]);
|
|
71
|
+
* void mode;
|
|
72
|
+
*/
|
|
73
|
+
enum(defaultValue, options, opts) {
|
|
74
|
+
return Object.freeze({
|
|
75
|
+
kind: "enum",
|
|
76
|
+
defaultValue,
|
|
77
|
+
options: Object.freeze(options.slice()),
|
|
78
|
+
...opts,
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Build a color input descriptor.
|
|
83
|
+
*
|
|
84
|
+
* @since 0.4
|
|
85
|
+
* @stable
|
|
86
|
+
* @example
|
|
87
|
+
* const c = input.color("#26a69a");
|
|
88
|
+
* void c;
|
|
89
|
+
*/
|
|
90
|
+
color(defaultValue, opts) {
|
|
91
|
+
return Object.freeze({ kind: "color", defaultValue, ...opts });
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Build a source-field input descriptor.
|
|
95
|
+
*
|
|
96
|
+
* @since 0.4
|
|
97
|
+
* @stable
|
|
98
|
+
* @example
|
|
99
|
+
* const source = input.source("close");
|
|
100
|
+
* void source;
|
|
101
|
+
*/
|
|
102
|
+
source(defaultValue, opts) {
|
|
103
|
+
return Object.freeze({ kind: "source", defaultValue, ...opts });
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Build a time input descriptor.
|
|
107
|
+
*
|
|
108
|
+
* @since 0.4
|
|
109
|
+
* @stable
|
|
110
|
+
* @example
|
|
111
|
+
* const anchor = input.time(1_700_000_000_000, { pickFromChart: true });
|
|
112
|
+
* void anchor;
|
|
113
|
+
*/
|
|
114
|
+
time(defaultValue, opts) {
|
|
115
|
+
return Object.freeze({ kind: "time", defaultValue, ...opts });
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Build a price input descriptor.
|
|
119
|
+
*
|
|
120
|
+
* @since 0.4
|
|
121
|
+
* @stable
|
|
122
|
+
* @example
|
|
123
|
+
* const level = input.price(101.25);
|
|
124
|
+
* void level;
|
|
125
|
+
*/
|
|
126
|
+
price(defaultValue, opts) {
|
|
127
|
+
return Object.freeze({ kind: "price", defaultValue, ...opts });
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* Build a symbol input descriptor.
|
|
131
|
+
*
|
|
132
|
+
* @since 0.4
|
|
133
|
+
* @stable
|
|
134
|
+
* @example
|
|
135
|
+
* const ticker = input.symbol("AAPL");
|
|
136
|
+
* void ticker;
|
|
137
|
+
*/
|
|
138
|
+
symbol(defaultValue, opts) {
|
|
139
|
+
return Object.freeze({ kind: "symbol", defaultValue, ...opts });
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Build a main-interval input descriptor.
|
|
143
|
+
*
|
|
144
|
+
* @since 0.4
|
|
145
|
+
* @stable
|
|
146
|
+
* @example
|
|
147
|
+
* const interval = input.interval("1D");
|
|
148
|
+
* void interval;
|
|
149
|
+
*/
|
|
150
|
+
interval(defaultValue, opts) {
|
|
151
|
+
return Object.freeze({ kind: "interval", defaultValue, ...opts });
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Build an adapter-supplied external series input descriptor.
|
|
155
|
+
*
|
|
156
|
+
* @since 0.4
|
|
157
|
+
* @stable
|
|
158
|
+
* @example
|
|
159
|
+
* const earnings = input.externalSeries({
|
|
160
|
+
* name: "earnings",
|
|
161
|
+
* schema: { kind: "external-series-schema" },
|
|
162
|
+
* });
|
|
163
|
+
* void earnings;
|
|
164
|
+
*/
|
|
165
|
+
externalSeries(args) {
|
|
166
|
+
return Object.freeze({
|
|
167
|
+
kind: "external-series",
|
|
168
|
+
name: args.name,
|
|
169
|
+
schema: args.schema,
|
|
170
|
+
...(args.title === undefined ? {} : { title: args.title }),
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/input/input.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAoB/D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B;;;;;;;;OAQG;IACH,GAAG,CACC,YAAoB,EACpB,IAKC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAc,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CACD,YAAoB,EACpB,IAKC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAgB,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,YAAqB,EAAE,IAAkC;QAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CACF,YAAoB,EACpB,IAAgE;QAEhE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI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AAE,UAAmB,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,cAAc,CAAI,IAIjB;QACG,OAAO,MAAM,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,iBAA0B;YAChC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;SAC7D,CAAC,CAAC;IACP,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { Color } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Wire-tagged discriminator for every `input.*` descriptor. Mirrors the
|
|
4
|
+
* adapter-kit `InputKind` alias; the two live in lockstep.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.4
|
|
7
|
+
* @stable
|
|
8
|
+
* @example
|
|
9
|
+
* const k: InputKind = "int";
|
|
10
|
+
* void k;
|
|
11
|
+
*/
|
|
12
|
+
export type InputKind = "int" | "float" | "bool" | "string" | "enum" | "color" | "source" | "time" | "price" | "symbol" | "interval" | "external-series";
|
|
13
|
+
/**
|
|
14
|
+
* Source-field literal for the pre-computed bar sources the runtime
|
|
15
|
+
* populates per close.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.4
|
|
18
|
+
* @stable
|
|
19
|
+
* @example
|
|
20
|
+
* const f: SourceField = "hlc3";
|
|
21
|
+
* void f;
|
|
22
|
+
*/
|
|
23
|
+
export type SourceField = "open" | "high" | "low" | "close" | "hl2" | "hlc3" | "ohlc4" | "hlcc4";
|
|
24
|
+
/**
|
|
25
|
+
* Opaque schema wrapper for `input.externalSeries`. Phase 4 ships the type
|
|
26
|
+
* only; runtime validation lands in Phase 5.
|
|
27
|
+
*
|
|
28
|
+
* @since 0.4
|
|
29
|
+
* @stable
|
|
30
|
+
* @example
|
|
31
|
+
* const s: Schema<number> = { kind: "external-series-schema" };
|
|
32
|
+
* void s;
|
|
33
|
+
*/
|
|
34
|
+
export type Schema<T> = Readonly<{
|
|
35
|
+
kind: "external-series-schema";
|
|
36
|
+
__brand?: T;
|
|
37
|
+
}>;
|
|
38
|
+
type NumericInputOpts = Readonly<{
|
|
39
|
+
min?: number;
|
|
40
|
+
max?: number;
|
|
41
|
+
step?: number;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Typed input descriptor returned by every `input.*` builder. The `kind`
|
|
45
|
+
* discriminator matches {@link InputKind}; remaining fields carry defaults
|
|
46
|
+
* and UI hints.
|
|
47
|
+
*
|
|
48
|
+
* @since 0.4
|
|
49
|
+
* @stable
|
|
50
|
+
* @example
|
|
51
|
+
* const d: InputDescriptor<number> = {
|
|
52
|
+
* kind: "int",
|
|
53
|
+
* defaultValue: 14,
|
|
54
|
+
* title: "Length",
|
|
55
|
+
* };
|
|
56
|
+
* void d;
|
|
57
|
+
*/
|
|
58
|
+
export type InputDescriptor<T> = IntDescriptor | FloatDescriptor | BoolDescriptor | StringDescriptor | EnumDescriptor<string> | ColorDescriptor | SourceDescriptor | TimeDescriptor | PriceDescriptor | SymbolDescriptor | IntervalDescriptorInput | ExternalSeriesDescriptor<T>;
|
|
59
|
+
type Common<K extends InputKind, T> = Readonly<{
|
|
60
|
+
kind: K;
|
|
61
|
+
defaultValue: T;
|
|
62
|
+
title?: string;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Descriptor for `input.int(...)`.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.4
|
|
68
|
+
* @stable
|
|
69
|
+
* @example
|
|
70
|
+
* const d: IntDescriptor = { kind: "int", defaultValue: 20, min: 1 };
|
|
71
|
+
* void d;
|
|
72
|
+
*/
|
|
73
|
+
export type IntDescriptor = Common<"int", number> & NumericInputOpts;
|
|
74
|
+
/**
|
|
75
|
+
* Descriptor for `input.float(...)`.
|
|
76
|
+
*
|
|
77
|
+
* @since 0.4
|
|
78
|
+
* @stable
|
|
79
|
+
* @example
|
|
80
|
+
* const d: FloatDescriptor = { kind: "float", defaultValue: 2.5, step: 0.5 };
|
|
81
|
+
* void d;
|
|
82
|
+
*/
|
|
83
|
+
export type FloatDescriptor = Common<"float", number> & NumericInputOpts;
|
|
84
|
+
/**
|
|
85
|
+
* Descriptor for `input.bool(...)`.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.4
|
|
88
|
+
* @stable
|
|
89
|
+
* @example
|
|
90
|
+
* const d: BoolDescriptor = { kind: "bool", defaultValue: true };
|
|
91
|
+
* void d;
|
|
92
|
+
*/
|
|
93
|
+
export type BoolDescriptor = Common<"bool", boolean>;
|
|
94
|
+
/**
|
|
95
|
+
* Descriptor for `input.string(...)`.
|
|
96
|
+
*
|
|
97
|
+
* @since 0.4
|
|
98
|
+
* @stable
|
|
99
|
+
* @example
|
|
100
|
+
* const d: StringDescriptor = { kind: "string", defaultValue: "AAPL" };
|
|
101
|
+
* void d;
|
|
102
|
+
*/
|
|
103
|
+
export type StringDescriptor = Common<"string", string> & Readonly<{
|
|
104
|
+
multiline?: boolean;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Descriptor for `input.enum(...)`.
|
|
108
|
+
*
|
|
109
|
+
* @since 0.4
|
|
110
|
+
* @stable
|
|
111
|
+
* @example
|
|
112
|
+
* const d: EnumDescriptor<"a" | "b"> = {
|
|
113
|
+
* kind: "enum",
|
|
114
|
+
* defaultValue: "a",
|
|
115
|
+
* options: ["a", "b"],
|
|
116
|
+
* };
|
|
117
|
+
* void d;
|
|
118
|
+
*/
|
|
119
|
+
export type EnumDescriptor<T extends string> = Common<"enum", T> & Readonly<{
|
|
120
|
+
options: ReadonlyArray<T>;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Descriptor for `input.color(...)`.
|
|
124
|
+
*
|
|
125
|
+
* @since 0.4
|
|
126
|
+
* @stable
|
|
127
|
+
* @example
|
|
128
|
+
* const d: ColorDescriptor = { kind: "color", defaultValue: "#26a69a" };
|
|
129
|
+
* void d;
|
|
130
|
+
*/
|
|
131
|
+
export type ColorDescriptor = Common<"color", Color>;
|
|
132
|
+
/**
|
|
133
|
+
* Descriptor for `input.source(...)`.
|
|
134
|
+
*
|
|
135
|
+
* @since 0.4
|
|
136
|
+
* @stable
|
|
137
|
+
* @example
|
|
138
|
+
* const d: SourceDescriptor = { kind: "source", defaultValue: "close" };
|
|
139
|
+
* void d;
|
|
140
|
+
*/
|
|
141
|
+
export type SourceDescriptor = Common<"source", SourceField>;
|
|
142
|
+
/**
|
|
143
|
+
* Descriptor for `input.time(...)`.
|
|
144
|
+
*
|
|
145
|
+
* @since 0.4
|
|
146
|
+
* @stable
|
|
147
|
+
* @example
|
|
148
|
+
* const d: TimeDescriptor = { kind: "time", defaultValue: 1_700_000_000_000 };
|
|
149
|
+
* void d;
|
|
150
|
+
*/
|
|
151
|
+
export type TimeDescriptor = Common<"time", number> & Readonly<{
|
|
152
|
+
pickFromChart?: boolean;
|
|
153
|
+
}>;
|
|
154
|
+
/**
|
|
155
|
+
* Descriptor for `input.price(...)`.
|
|
156
|
+
*
|
|
157
|
+
* @since 0.4
|
|
158
|
+
* @stable
|
|
159
|
+
* @example
|
|
160
|
+
* const d: PriceDescriptor = { kind: "price", defaultValue: 101.25 };
|
|
161
|
+
* void d;
|
|
162
|
+
*/
|
|
163
|
+
export type PriceDescriptor = Common<"price", number>;
|
|
164
|
+
/**
|
|
165
|
+
* Descriptor for `input.symbol(...)`.
|
|
166
|
+
*
|
|
167
|
+
* @since 0.4
|
|
168
|
+
* @stable
|
|
169
|
+
* @example
|
|
170
|
+
* const d: SymbolDescriptor = { kind: "symbol", defaultValue: "AAPL" };
|
|
171
|
+
* void d;
|
|
172
|
+
*/
|
|
173
|
+
export type SymbolDescriptor = Common<"symbol", string>;
|
|
174
|
+
/**
|
|
175
|
+
* Descriptor for `input.interval(...)`.
|
|
176
|
+
*
|
|
177
|
+
* @since 0.4
|
|
178
|
+
* @stable
|
|
179
|
+
* @example
|
|
180
|
+
* const d: IntervalDescriptorInput = { kind: "interval", defaultValue: "1D" };
|
|
181
|
+
* void d;
|
|
182
|
+
*/
|
|
183
|
+
export type IntervalDescriptorInput = Common<"interval", string>;
|
|
184
|
+
/**
|
|
185
|
+
* Descriptor for `input.externalSeries(...)`.
|
|
186
|
+
*
|
|
187
|
+
* @since 0.4
|
|
188
|
+
* @stable
|
|
189
|
+
* @example
|
|
190
|
+
* const d: ExternalSeriesDescriptor<number> = {
|
|
191
|
+
* kind: "external-series",
|
|
192
|
+
* name: "earnings",
|
|
193
|
+
* schema: { kind: "external-series-schema" },
|
|
194
|
+
* };
|
|
195
|
+
* void d;
|
|
196
|
+
*/
|
|
197
|
+
export type ExternalSeriesDescriptor<T> = Readonly<{
|
|
198
|
+
kind: "external-series";
|
|
199
|
+
name: string;
|
|
200
|
+
schema: Schema<T>;
|
|
201
|
+
title?: string;
|
|
202
|
+
}>;
|
|
203
|
+
export {};
|
|
204
|
+
//# sourceMappingURL=inputDescriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputDescriptor.d.ts","sourceRoot":"","sources":["../../src/input/inputDescriptor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GACf,KAAK,GACL,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,UAAU,GACV,iBAAiB,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO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A+D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IntervalDescriptor } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Convert an {@link IntervalDescriptor} to its effective second count.
|
|
4
|
+
*
|
|
5
|
+
* The helper prefers `intervalSeconds` when present. Otherwise it parses
|
|
6
|
+
* `value` as `<positive-integer><suffix>`, where no suffix means Pine-style
|
|
7
|
+
* minutes. Month and year suffixes use fixed 30-day and 365-day
|
|
8
|
+
* approximations; adapters that need calendar-exact durations should provide
|
|
9
|
+
* `intervalSeconds`.
|
|
10
|
+
*
|
|
11
|
+
* @throws Error when the override is non-positive / non-finite, or `value`
|
|
12
|
+
* cannot be parsed.
|
|
13
|
+
* @since 0.6
|
|
14
|
+
* @stable
|
|
15
|
+
* @example
|
|
16
|
+
* intervalToSeconds({ value: "1D", label: "1 day", group: "day" });
|
|
17
|
+
* intervalToSeconds({ value: "custom", label: "custom", group: "x", intervalSeconds: 7 });
|
|
18
|
+
*/
|
|
19
|
+
export declare function intervalToSeconds(d: IntervalDescriptor): number;
|
|
20
|
+
//# sourceMappingURL=intervalToSeconds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intervalToSeconds.d.ts","sourceRoot":"","sources":["../../src/interval/intervalToSeconds.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AActD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA2B/D"}
|