@invinite-org/chartlang-core 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +226 -0
- package/README.md +2 -1
- package/dist/draw/buckets.d.ts.map +1 -1
- package/dist/draw/buckets.js +1 -0
- package/dist/draw/buckets.js.map +1 -1
- package/dist/draw/draw.d.ts +8 -1
- package/dist/draw/draw.d.ts.map +1 -1
- package/dist/draw/draw.js.map +1 -1
- package/dist/draw/drawingKind.d.ts +8 -8
- package/dist/draw/drawingKind.d.ts.map +1 -1
- package/dist/draw/drawingKind.js +5 -3
- package/dist/draw/drawingKind.js.map +1 -1
- package/dist/draw/drawingState.d.ts +27 -3
- package/dist/draw/drawingState.d.ts.map +1 -1
- package/dist/draw/drawingState.js.map +1 -1
- package/dist/draw/drawingStyle.d.ts +52 -9
- package/dist/draw/drawingStyle.d.ts.map +1 -1
- package/dist/draw/drawingStyle.js.map +1 -1
- package/dist/draw/index.d.ts +2 -2
- package/dist/draw/index.d.ts.map +1 -1
- package/dist/draw/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plot/plot.d.ts +15 -0
- package/dist/plot/plot.d.ts.map +1 -1
- package/dist/plot/plot.js.map +1 -1
- package/dist/request/index.d.ts +1 -1
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js.map +1 -1
- package/dist/request/request.d.ts +82 -20
- package/dist/request/request.d.ts.map +1 -1
- package/dist/request/request.js +27 -26
- package/dist/request/request.js.map +1 -1
- package/dist/state/state.d.ts +17 -0
- package/dist/state/state.d.ts.map +1 -1
- package/dist/state/state.js +18 -0
- package/dist/state/state.js.map +1 -1
- package/dist/statefulPrimitives.d.ts +9 -5
- package/dist/statefulPrimitives.d.ts.map +1 -1
- package/dist/statefulPrimitives.js +17 -5
- package/dist/statefulPrimitives.js.map +1 -1
- package/dist/ta/ta.d.ts +39 -8
- package/dist/ta/ta.d.ts.map +1 -1
- package/dist/ta/ta.js +6 -0
- package/dist/ta/ta.js.map +1 -1
- package/dist/types.d.ts +166 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type { AlertSeverity, AlertConditionDefinition, AlertConditionDescriptor, Bar, BarViewport, CapabilityId, Color, CompiledScriptBundle, CompiledScriptObject, ComputeContext, ComputeFn, DrawingCounts, InputSchema, IntervalDescriptor, JsonValue, LineStyle, PlotLineStyle, PlotOverride, PlotSlotDescriptor, Price, ScriptManifest, Series, Time, Volume, } from "./types.js";
|
|
1
|
+
export type { AlertSeverity, AlertConditionDefinition, AlertConditionDescriptor, Bar, BarSeries, BarViewport, CapabilityId, Color, CompiledScriptBundle, CompiledScriptObject, ComputeContext, ComputeFn, DrawingCounts, InputSchema, IntervalDescriptor, JsonValue, LineStyle, NumberSeriesSlot, PlotLineStyle, PlotOverride, PlotSlotDescriptor, Price, PriceSeries, ScriptManifest, SecurityExpressionDescriptor, Series, Time, Volume, VolumeSeries, } from "./types.js";
|
|
2
2
|
export { isCompiledScriptBundle } from "./types.js";
|
|
3
3
|
export { intervalToSeconds } from "./interval/intervalToSeconds.js";
|
|
4
4
|
export { defineAlert, defineAlertCondition, defineDrawing, defineIndicator, } from "./define/index.js";
|
|
5
5
|
export type { DefineAlertConditionOpts, DefineAlertOpts, DefineDrawingOpts, DefineIndicatorOpts, DependencyDeclaration, OutputDeclaration, ScaleAxis, ScriptOverrides, ValueFormat, } from "./define/index.js";
|
|
6
6
|
export { ta } from "./ta/index.js";
|
|
7
|
-
export type { AdlOpts, AdrOpts, AdxOpts, AlmaOpts, AnchoredVolumeProfileOpts, AnchoredVolumeProfileResult, AnchoredVwapOpts, AoOpts, AroonOpts, AroonOscOpts, AroonResult, AtrOpts, BarssinceOpts, BbOpts, BbPercentBOpts, BbResult, BbwOpts, BopOpts, CciOpts, ChandeKrollStopOpts, ChandeKrollStopResult, ChandelierOpts, ChaikinOscOpts, ChandelierResult, ChangeOpts, ChopOpts, CmfOpts, CmoOpts, ConnorsRsiOpts, CoppockOpts, CrossoverOpts, CrossunderOpts, DemaOpts, DmiOpts, DmiResult, DonchianOpts, DonchianResult, DpoOpts, EmaOpts, EomOpts, EnvelopeOpts, EnvelopeResult, FisherOpts, FisherResult, FixedRangeVolumeProfileOpts, FixedRangeVolumeProfileResult, HighestOpts, HmaOpts, HvOpts, IchimokuOpts, IchimokuResult, KamaOpts, KeltnerOpts, KeltnerResult, KlingerOpts, KlingerResult, KstOpts, KstResult, LowestOpts, LsmaOpts, MacdOpts, MacdResult, MaRibbonOpts, MaRibbonResult, MassIndexOpts, MaTypeNoVolume, McginleyOpts, MedianOpts, MfiOpts, MomentumOpts, NetVolumeOpts, NviOpts, ObvOpts, PivotsHighLowOpts, PivotsHighLowResult, PivotsStandardOpts, PivotsStandardResult, PivotsStandardSystem, PmoOpts, PmoResult, PpoOpts, PpoResult, PsarOpts, PsarResult, PviOpts, PvoOpts, PvoResult, PvtOpts, RocOpts, RsiOpts, RvgiOpts, RvgiResult, RviOpts, SessionVolumeProfileOpts, SessionVolumeProfileResult, SmaOpts, SmiOpts, SmiResult, SmmaOpts, StdevOpts, StochOpts, StochResult, StochRsiOpts, StochRsiResult, SupertrendOpts, SupertrendResult, TaNamespace, TemaOpts, TrendStrengthIndexOpts, TrixOpts, TrixResult, TsiOpts, TsiResult, UlcerIndexOpts, UltimateOscOpts, ValuewhenOpts, VolOpts, VolatilityStopOpts, VolatilityStopResult, VortexOpts, VortexResult, VisibleRangeVolumeProfileOpts, VisibleRangeVolumeProfileResult, VwapOpts, VwmaOpts, WilliamsFractalOpts, WilliamsFractalResult, WilliamsROpts, WmaOpts, ZigZagOpts, ZigZagResult, } from "./ta/ta.js";
|
|
7
|
+
export type { AdlOpts, AdrOpts, AdxOpts, AlmaOpts, AnchoredVolumeProfileOpts, AnchoredVolumeProfileResult, AnchoredVwapOpts, AoOpts, AroonOpts, AroonOscOpts, AroonResult, AtrOpts, BarssinceOpts, BbOpts, BbPercentBOpts, BbResult, BbwOpts, BopOpts, CciOpts, ChandeKrollStopOpts, ChandeKrollStopResult, ChandelierOpts, ChaikinOscOpts, ChandelierResult, ChangeOpts, ChopOpts, CmfOpts, CmoOpts, ConnorsRsiOpts, CoppockOpts, CrossoverOpts, CrossunderOpts, DemaOpts, DmiOpts, DmiResult, DonchianOpts, DonchianResult, DpoOpts, EmaOpts, EomOpts, EnvelopeOpts, EnvelopeResult, FisherOpts, FisherResult, FixedRangeVolumeProfileOpts, FixedRangeVolumeProfileResult, HighestOpts, HighestbarsOpts, HmaOpts, HvOpts, IchimokuOpts, IchimokuResult, KamaOpts, KeltnerOpts, KeltnerResult, KlingerOpts, KlingerResult, KstOpts, KstResult, LowestOpts, LowestbarsOpts, LsmaOpts, MacdOpts, MacdResult, MaRibbonOpts, MaRibbonResult, MassIndexOpts, MaTypeNoVolume, McginleyOpts, MedianOpts, MfiOpts, MomentumOpts, NetVolumeOpts, NviOpts, ObvOpts, PivotsHighLowOpts, PivotsHighLowResult, PivotsStandardOpts, PivotsStandardResult, PivotsStandardSystem, PmoOpts, PmoResult, PpoOpts, PpoResult, PsarOpts, PsarResult, PviOpts, PvoOpts, PvoResult, PvtOpts, RocOpts, RsiOpts, RvgiOpts, RvgiResult, RviOpts, SessionVolumeProfileOpts, SessionVolumeProfileResult, SmaOpts, SmiOpts, SmiResult, SmmaOpts, StdevOpts, StochOpts, StochResult, StochRsiOpts, StochRsiResult, SupertrendOpts, SupertrendResult, TaNamespace, TemaOpts, TrendStrengthIndexOpts, TrixOpts, TrixResult, TsiOpts, TsiResult, UlcerIndexOpts, UltimateOscOpts, ValuewhenOpts, VolOpts, VolatilityStopOpts, VolatilityStopResult, VortexOpts, VortexResult, VisibleRangeVolumeProfileOpts, VisibleRangeVolumeProfileResult, VwapOpts, VwmaOpts, WilliamsFractalOpts, WilliamsFractalResult, WilliamsROpts, WmaOpts, ZigZagOpts, ZigZagResult, } from "./ta/ta.js";
|
|
8
8
|
export type { StatefulPrimitiveEntry } from "./statefulPrimitives.js";
|
|
9
9
|
export { input } from "./input/index.js";
|
|
10
10
|
export type { BoolDescriptor, ColorDescriptor, EnumDescriptor, ExternalSeriesDescriptor, FloatDescriptor, InputDescriptor, InputKind, IntDescriptor, IntervalDescriptorInput, PriceDescriptor, Schema, SourceDescriptor, SourceField, StringDescriptor, SymbolDescriptor, TimeDescriptor, } from "./input/index.js";
|
|
@@ -14,7 +14,7 @@ export type { RunnerSnapshot, StateSnapshot, StateStoreKey, StreamSnapshot, } fr
|
|
|
14
14
|
export { barstate, syminfo, timeframe } from "./views/index.js";
|
|
15
15
|
export type { BarStateView, SymbolType, SymInfoView, TimeframeView } from "./views/index.js";
|
|
16
16
|
export { request } from "./request/index.js";
|
|
17
|
-
export type { RequestLowerTfOpts, RequestNamespace, RequestSecurityOpts, SecurityBar, } from "./request/index.js";
|
|
17
|
+
export type { RequestLowerTfOpts, RequestNamespace, RequestSecurityOpts, SecurityBar, SecurityExpr, } from "./request/index.js";
|
|
18
18
|
export { runtime } from "./runtime/index.js";
|
|
19
19
|
export type { LogLevel, RuntimeNamespace } from "./runtime/index.js";
|
|
20
20
|
export { color, fromGradient, hsl, rgb, withAlpha } from "./color/index.js";
|
|
@@ -25,5 +25,5 @@ export { alert } from "./alert/index.js";
|
|
|
25
25
|
export type { AlertOpts } from "./alert/alert.js";
|
|
26
26
|
export { STATEFUL_PRIMITIVES, STATEFUL_PRIMITIVES_BY_NAME } from "./statefulPrimitives.js";
|
|
27
27
|
export { DRAWING_KINDS, KIND_BUCKET, KIND_CAMELCASE, KIND_KEBABCASE, bucketFor, draw, } from "./draw/index.js";
|
|
28
|
-
export type { AbcdPatternState, AnchorHept, AnchorPair, AnchorQuad, AnchorQuint, AnchorTriple, ArcState, ArrowMarkDownState, ArrowMarkUpState, ArrowMarkerOpts, ArrowMarkerState, ArrowOpts, ArrowState, BrushState, BrushStyle, CircleState, CrossLineState, CurveState, CyclicLinesState, CypherPatternState, DisjointChannelState, DoubleCurveState, DrawNamespace, DrawingBucket, DrawingHandle, DrawingKind, DrawingMeta, DrawingState, ElliottCorrectionWaveState, ElliottDoubleComboState, ElliottImpulseWaveState, ElliottTriangleWaveState, ElliottTripleComboState, EllipseState, FibChannelState, FibCirclesState, FibOpts, FibRetracementState, FibSpeedArcsState, FibSpeedFanState, FibSpiralState, FibTimeZoneState, FibTrendExtensionState, FibTrendTimeState, FibWedgeState, FlatTopBottomState, FrameOpts, FrameState, GannBoxState, GannFanState, GannSquareFixedState, GannSquareState, GroupState, HeadAndShouldersState, HighlighterState, HighlighterStyle, HorizontalLineState, HorizontalRayState, LineDrawStyle, LineState, MarkerState, PathOpts, PathState, PenState, PitchfanState, PitchforkState, PolylineState, RectangleState, RegressionTrendOpts, RegressionTrendState, RotatedRectangleState, ShapeStyle, SineLineState, TableCell, TableOpts, TablePosition, TableState, TextOpts, TextState, ThreeDrivesPatternState, TimeCyclesState, TrendAngleState, TrendChannelState, TriangleState, TrianglePatternState, VerticalLineState, WorldPoint, XabcdPatternState, } from "./draw/index.js";
|
|
28
|
+
export type { AbcdPatternState, AnchorHept, AnchorPair, AnchorQuad, AnchorQuint, AnchorTriple, ArcState, ArrowMarkDownState, ArrowMarkUpState, ArrowMarkerOpts, ArrowMarkerState, ArrowOpts, ArrowState, BrushState, BrushStyle, CircleState, CrossLineState, CurveState, CyclicLinesState, CypherPatternState, DisjointChannelState, DoubleCurveState, DrawNamespace, DrawingBucket, DrawingHandle, DrawingKind, DrawingMeta, DrawingState, ElliottCorrectionWaveState, ElliottDoubleComboState, ElliottImpulseWaveState, ElliottTriangleWaveState, ElliottTripleComboState, EllipseState, FibChannelState, FibCirclesState, FibOpts, FibRetracementState, FibSpeedArcsState, FibSpeedFanState, FibSpiralState, FibTimeZoneState, FibTrendExtensionState, FibTrendTimeState, FibWedgeState, FillBetweenState, FillBetweenStyle, FlatTopBottomState, FrameOpts, FrameState, GannBoxState, GannFanState, GannSquareFixedState, GannSquareState, GroupState, HeadAndShouldersState, HighlighterState, HighlighterStyle, HorizontalLineState, HorizontalRayState, LineDrawStyle, LineState, MarkerState, PathOpts, PathState, PenState, PitchfanState, PitchforkState, PolylineState, RectangleState, RegressionTrendOpts, RegressionTrendState, RotatedRectangleState, ShapeStyle, SineLineState, TableCell, TableOpts, TablePosition, TableState, TextOpts, TextState, ThreeDrivesPatternState, TimeCyclesState, TrendAngleState, TrendChannelState, TriangleState, TrianglePatternState, VerticalLineState, WorldPoint, XabcdPatternState, ZOrdered, } from "./draw/index.js";
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACR,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,GAAG,EACH,WAAW,EACX,YAAY,EACZ,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,KAAK,EACL,cAAc,EACd,MAAM,EACN,IAAI,EACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACR,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,GAAG,EACH,SAAS,EACT,WAAW,EACX,YAAY,EACZ,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,KAAK,EACL,WAAW,EACX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AY,EACZ,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,EACT,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,QAAQ,GACX,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAiC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACH,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,eAAe,GAClB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAyInC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAmBzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQ7C,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","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport type {\n AlertSeverity,\n AlertConditionDefinition,\n AlertConditionDescriptor,\n Bar,\n BarSeries,\n BarViewport,\n CapabilityId,\n Color,\n CompiledScriptBundle,\n CompiledScriptObject,\n ComputeContext,\n ComputeFn,\n DrawingCounts,\n InputSchema,\n IntervalDescriptor,\n JsonValue,\n LineStyle,\n NumberSeriesSlot,\n PlotLineStyle,\n PlotOverride,\n PlotSlotDescriptor,\n Price,\n PriceSeries,\n ScriptManifest,\n SecurityExpressionDescriptor,\n Series,\n Time,\n Volume,\n VolumeSeries,\n} from \"./types.js\";\nexport { isCompiledScriptBundle } from \"./types.js\";\nexport { intervalToSeconds } from \"./interval/intervalToSeconds.js\";\nexport {\n defineAlert,\n defineAlertCondition,\n defineDrawing,\n defineIndicator,\n} from \"./define/index.js\";\nexport type {\n DefineAlertConditionOpts,\n DefineAlertOpts,\n DefineDrawingOpts,\n DefineIndicatorOpts,\n DependencyDeclaration,\n OutputDeclaration,\n ScaleAxis,\n ScriptOverrides,\n ValueFormat,\n} from \"./define/index.js\";\nexport { ta } from \"./ta/index.js\";\nexport type {\n AdlOpts,\n AdrOpts,\n AdxOpts,\n AlmaOpts,\n AnchoredVolumeProfileOpts,\n AnchoredVolumeProfileResult,\n AnchoredVwapOpts,\n AoOpts,\n AroonOpts,\n AroonOscOpts,\n AroonResult,\n AtrOpts,\n BarssinceOpts,\n BbOpts,\n BbPercentBOpts,\n BbResult,\n BbwOpts,\n BopOpts,\n CciOpts,\n ChandeKrollStopOpts,\n ChandeKrollStopResult,\n ChandelierOpts,\n ChaikinOscOpts,\n ChandelierResult,\n ChangeOpts,\n ChopOpts,\n CmfOpts,\n CmoOpts,\n ConnorsRsiOpts,\n CoppockOpts,\n CrossoverOpts,\n CrossunderOpts,\n DemaOpts,\n DmiOpts,\n DmiResult,\n DonchianOpts,\n DonchianResult,\n DpoOpts,\n EmaOpts,\n EomOpts,\n EnvelopeOpts,\n EnvelopeResult,\n FisherOpts,\n FisherResult,\n FixedRangeVolumeProfileOpts,\n FixedRangeVolumeProfileResult,\n HighestOpts,\n HighestbarsOpts,\n HmaOpts,\n HvOpts,\n IchimokuOpts,\n IchimokuResult,\n KamaOpts,\n KeltnerOpts,\n KeltnerResult,\n KlingerOpts,\n KlingerResult,\n KstOpts,\n KstResult,\n LowestOpts,\n LowestbarsOpts,\n LsmaOpts,\n MacdOpts,\n MacdResult,\n MaRibbonOpts,\n MaRibbonResult,\n MassIndexOpts,\n MaTypeNoVolume,\n McginleyOpts,\n MedianOpts,\n MfiOpts,\n MomentumOpts,\n NetVolumeOpts,\n NviOpts,\n ObvOpts,\n PivotsHighLowOpts,\n PivotsHighLowResult,\n PivotsStandardOpts,\n PivotsStandardResult,\n PivotsStandardSystem,\n PmoOpts,\n PmoResult,\n PpoOpts,\n PpoResult,\n PsarOpts,\n PsarResult,\n PviOpts,\n PvoOpts,\n PvoResult,\n PvtOpts,\n RocOpts,\n RsiOpts,\n RvgiOpts,\n RvgiResult,\n RviOpts,\n SessionVolumeProfileOpts,\n SessionVolumeProfileResult,\n SmaOpts,\n SmiOpts,\n SmiResult,\n SmmaOpts,\n StdevOpts,\n StochOpts,\n StochResult,\n StochRsiOpts,\n StochRsiResult,\n SupertrendOpts,\n SupertrendResult,\n TaNamespace,\n TemaOpts,\n TrendStrengthIndexOpts,\n TrixOpts,\n TrixResult,\n TsiOpts,\n TsiResult,\n UlcerIndexOpts,\n UltimateOscOpts,\n ValuewhenOpts,\n VolOpts,\n VolatilityStopOpts,\n VolatilityStopResult,\n VortexOpts,\n VortexResult,\n VisibleRangeVolumeProfileOpts,\n VisibleRangeVolumeProfileResult,\n VwapOpts,\n VwmaOpts,\n WilliamsFractalOpts,\n WilliamsFractalResult,\n WilliamsROpts,\n WmaOpts,\n ZigZagOpts,\n ZigZagResult,\n} from \"./ta/ta.js\";\nexport type { StatefulPrimitiveEntry } from \"./statefulPrimitives.js\";\nexport { input } from \"./input/index.js\";\nexport type {\n BoolDescriptor,\n ColorDescriptor,\n EnumDescriptor,\n ExternalSeriesDescriptor,\n FloatDescriptor,\n InputDescriptor,\n InputKind,\n IntDescriptor,\n IntervalDescriptorInput,\n PriceDescriptor,\n Schema,\n SourceDescriptor,\n SourceField,\n StringDescriptor,\n SymbolDescriptor,\n TimeDescriptor,\n} from \"./input/index.js\";\nexport { state } from \"./state/index.js\";\nexport type { MutableSlot, StateNamespace } from \"./state/index.js\";\nexport type {\n RunnerSnapshot,\n StateSnapshot,\n StateStoreKey,\n StreamSnapshot,\n} from \"./state/index.js\";\nexport { barstate, syminfo, timeframe } from \"./views/index.js\";\nexport type { BarStateView, SymbolType, SymInfoView, TimeframeView } from \"./views/index.js\";\nexport { request } from \"./request/index.js\";\nexport type {\n RequestLowerTfOpts,\n RequestNamespace,\n RequestSecurityOpts,\n SecurityBar,\n SecurityExpr,\n} from \"./request/index.js\";\nexport { runtime } from \"./runtime/index.js\";\nexport type { LogLevel, RuntimeNamespace } from \"./runtime/index.js\";\nexport { color, fromGradient, hsl, rgb, withAlpha } from \"./color/index.js\";\nexport type { GradientStop } from \"./color/index.js\";\nexport { hline, plot } from \"./plot/index.js\";\nexport type { HLineOpts, PlotKind, PlotOpts, PlotOptsStyle } from \"./plot/plot.js\";\nexport { alert } from \"./alert/index.js\";\nexport type { AlertOpts } from \"./alert/alert.js\";\nexport { STATEFUL_PRIMITIVES, STATEFUL_PRIMITIVES_BY_NAME } from \"./statefulPrimitives.js\";\nexport {\n DRAWING_KINDS,\n KIND_BUCKET,\n KIND_CAMELCASE,\n KIND_KEBABCASE,\n bucketFor,\n draw,\n} from \"./draw/index.js\";\nexport type {\n AbcdPatternState,\n AnchorHept,\n AnchorPair,\n AnchorQuad,\n AnchorQuint,\n AnchorTriple,\n ArcState,\n ArrowMarkDownState,\n ArrowMarkUpState,\n ArrowMarkerOpts,\n ArrowMarkerState,\n ArrowOpts,\n ArrowState,\n BrushState,\n BrushStyle,\n CircleState,\n CrossLineState,\n CurveState,\n CyclicLinesState,\n CypherPatternState,\n DisjointChannelState,\n DoubleCurveState,\n DrawNamespace,\n DrawingBucket,\n DrawingHandle,\n DrawingKind,\n DrawingMeta,\n DrawingState,\n ElliottCorrectionWaveState,\n ElliottDoubleComboState,\n ElliottImpulseWaveState,\n ElliottTriangleWaveState,\n ElliottTripleComboState,\n EllipseState,\n FibChannelState,\n FibCirclesState,\n FibOpts,\n FibRetracementState,\n FibSpeedArcsState,\n FibSpeedFanState,\n FibSpiralState,\n FibTimeZoneState,\n FibTrendExtensionState,\n FibTrendTimeState,\n FibWedgeState,\n FillBetweenState,\n FillBetweenStyle,\n FlatTopBottomState,\n FrameOpts,\n FrameState,\n GannBoxState,\n GannFanState,\n GannSquareFixedState,\n GannSquareState,\n GroupState,\n HeadAndShouldersState,\n HighlighterState,\n HighlighterStyle,\n HorizontalLineState,\n HorizontalRayState,\n LineDrawStyle,\n LineState,\n MarkerState,\n PathOpts,\n PathState,\n PenState,\n PitchfanState,\n PitchforkState,\n PolylineState,\n RectangleState,\n RegressionTrendOpts,\n RegressionTrendState,\n RotatedRectangleState,\n ShapeStyle,\n SineLineState,\n TableCell,\n TableOpts,\n TablePosition,\n TableState,\n TextOpts,\n TextState,\n ThreeDrivesPatternState,\n TimeCyclesState,\n TrendAngleState,\n TrendChannelState,\n TriangleState,\n TrianglePatternState,\n VerticalLineState,\n WorldPoint,\n XabcdPatternState,\n ZOrdered,\n} from \"./draw/index.js\";\n"]}
|
package/dist/plot/plot.d.ts
CHANGED
|
@@ -228,6 +228,21 @@ export type PlotOpts = Readonly<{
|
|
|
228
228
|
lineStyle?: LineStyle;
|
|
229
229
|
pane?: "overlay" | "new" | string;
|
|
230
230
|
style?: PlotOptsStyle;
|
|
231
|
+
/**
|
|
232
|
+
* Presentation-only render-order key (z-index). Default `0`.
|
|
233
|
+
* Higher `z` renders on top; lower `z` renders behind. Marks with
|
|
234
|
+
* equal `z` keep the default group order (plots below drawings) and,
|
|
235
|
+
* within a group, declaration order. `z` may be any finite number —
|
|
236
|
+
* fractional values (e.g. `1.5`) slot a mark between two layers
|
|
237
|
+
* without renumbering. It affects **only** stacking: `value`,
|
|
238
|
+
* alerts, and `state.*` are unaffected.
|
|
239
|
+
*
|
|
240
|
+
* @since 1.4
|
|
241
|
+
* @stable
|
|
242
|
+
* @example
|
|
243
|
+
* plot(ta.sma(bar.close, 50), { z: -1 }); // behind other plots
|
|
244
|
+
*/
|
|
245
|
+
z?: number;
|
|
231
246
|
}>;
|
|
232
247
|
/**
|
|
233
248
|
* Styling options accepted by `hline(...)`. `pane` follows the same shape as
|
package/dist/plot/plot.d.ts.map
CHANGED
|
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,QAAQ,GACd,MAAM,GACN,WAAW,GACX,iBAAiB,GACjB,WAAW,GACX,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,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,GACnB;IAAE,Q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AAiB;IACnD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Color, LineStyle, Series } from \"../types.js\";\n\n/**\n * Rendered-shape discriminator for `plot` emissions reaching the adapter.\n * The full 0.5 inventory is `line`, `step-line`, `horizontal-line`,\n * `histogram`, `area`, `filled-band`, `label`, `marker`,\n * `shape`, `character`, `arrow`, `candle-override`, `bar-override`,\n * `bg-color`, `bar-color`, and `horizontal-histogram`. Every expansion is\n * additive — the `apiVersion: 1` script header stays unchanged.\n *\n * Typical Phase-2 consumers:\n *\n * - `histogram` → volume bars, MACD histogram, momentum-style oscillators.\n * - `area` → filled region under a polyline (BB midline, regression).\n * - `filled-band` → Bollinger / Keltner / Donchian / Ichimoku envelopes.\n * - `label` → text annotations at a world-space anchor (fractal, pivot).\n * - `marker` → discrete glyph (circle / triangle / square / diamond) for\n * fractals / divergence / supertrend flips.\n *\n * @since 0.1\n * @example\n * const k: PlotKind = \"line\";\n * const histogram: PlotKind = \"histogram\";\n * const shape: PlotKind = \"shape\";\n * void k; void histogram; void shape;\n */\nexport type PlotKind =\n | \"line\"\n | \"step-line\"\n | \"horizontal-line\"\n | \"histogram\"\n | \"area\"\n | \"filled-band\"\n | \"label\"\n | \"marker\"\n | \"shape\"\n | \"character\"\n | \"arrow\"\n | \"candle-override\"\n | \"bar-override\"\n | \"bg-color\"\n | \"bar-color\"\n | \"horizontal-histogram\";\n\n/**\n * Marker glyphs shared by Phase 2 `marker` and Phase 5 `shape` plot styles.\n *\n * @since 0.5\n * @stable\n * @example\n * const shape: PlotGlyphShape = \"circle\";\n * void shape;\n */\nexport type PlotGlyphShape = \"circle\" | \"triangle-up\" | \"triangle-down\" | \"square\" | \"diamond\";\n\n/**\n * Full glyph inventory for Phase 5 `shape` plot styles.\n *\n * @since 0.5\n * @stable\n * @example\n * const shape: PlotShapeGlyph = \"flag\";\n * void shape;\n */\nexport type PlotShapeGlyph = PlotGlyphShape | \"cross\" | \"xcross\" | \"flag\";\n\n/**\n * Vertical anchoring mode for glyph-like Phase 5 plot styles.\n *\n * @since 0.5\n * @stable\n * @example\n * const location: PlotLocation = \"above\";\n * void location;\n */\nexport type PlotLocation = \"above\" | \"below\" | \"absolute\";\n\n/**\n * Single row in a Phase 5 horizontal-histogram plot emission.\n *\n * @since 0.5\n * @stable\n * @example\n * const bucket: HorizontalHistogramBucket = { price: 100, volume: 25 };\n * void bucket;\n */\nexport type HorizontalHistogramBucket = Readonly<{\n readonly price: number;\n readonly volume: number;\n readonly color?: Color;\n}>;\n\n/**\n * Script-author selectable plot style. The runtime maps this to the\n * adapter-kit's wire `PlotStyle` discriminated union and fills in defaults\n * from sibling {@link PlotOpts} fields (`lineWidth` / `lineStyle`) for\n * line-like styles.\n *\n * `histogram.baseline` defaults to `0` when omitted.\n *\n * @formula N/A — script-facing style input\n * @since 0.2\n * @stable\n * @example\n * const lineStyle: PlotOptsStyle = { kind: \"line\" };\n * const histStyle: PlotOptsStyle = { kind: \"histogram\", baseline: 0 };\n * void lineStyle; void histStyle;\n */\nexport type PlotOptsStyle =\n | { readonly kind: \"line\" }\n | { readonly kind: \"step-line\" }\n | { readonly kind: \"horizontal-line\" }\n | { readonly kind: \"histogram\"; readonly baseline?: number }\n | {\n readonly kind: \"marker\";\n readonly shape: PlotGlyphShape;\n readonly size: number;\n }\n /**\n * Glyph at world-anchor — Pine's `plotshape`. Location selects vertical\n * anchoring; `size` is in CSS pixels.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"shape\", shape: \"triangle-up\", size: 8, location: \"below\" } });\n */\n | {\n readonly kind: \"shape\";\n readonly shape: PlotShapeGlyph;\n readonly size: number;\n readonly location?: PlotLocation;\n }\n /**\n * Text glyph at world-anchor — Pine's `plotchar`. `char` may be any\n * non-empty UTF-8 string; `size` is in CSS pixels.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"character\", char: \"▲\", size: 12, location: \"above\" } });\n */\n | {\n readonly kind: \"character\";\n readonly char: string;\n readonly size: number;\n readonly location?: PlotLocation;\n }\n /**\n * Directional marker at world-anchor — Pine's `plotarrow`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.low, { style: { kind: \"arrow\", direction: \"up\", size: 10 } });\n */\n | { readonly kind: \"arrow\"; readonly direction: \"up\" | \"down\"; readonly size: number }\n /**\n * Candle body color override — Pine's `plotcandle`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"candle-override\", bull: \"#26a69a\", bear: \"#ef5350\" } });\n */\n | {\n readonly kind: \"candle-override\";\n readonly bull: Color;\n readonly bear: Color;\n readonly doji?: Color;\n }\n /**\n * OHLC bar outline override — Pine's `plotbar`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"bar-override\", color: \"#f59e0b\" } });\n */\n | { readonly kind: \"bar-override\"; readonly color: Color }\n /**\n * Pane background color band — Pine's `bgcolor`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"bg-color\", color: \"#1d4ed8\", transp: 80 } });\n */\n | { readonly kind: \"bg-color\"; readonly color: Color; readonly transp?: number }\n /**\n * Main candle/bar tint — Pine's `barcolor`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"bar-color\", color: \"#a855f7\" } });\n */\n | { readonly kind: \"bar-color\"; readonly color: Color }\n /**\n * Right-edge volume-profile bars keyed by price bucket.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"horizontal-histogram\", buckets: [{ price: bar.close, volume: bar.volume }] } });\n */\n | {\n readonly kind: \"horizontal-histogram\";\n readonly buckets: ReadonlyArray<HorizontalHistogramBucket>;\n };\n\n/**\n * Styling options accepted by `plot(...)`. `pane: \"overlay\"` (the default) is\n * the only pane the Phase-1 canvas2d adapter renders — `\"new\"` and named\n * panes are reserved for Phase 2+. `style` (Phase 2) lets the script pick\n * a non-line {@link PlotOptsStyle} — defaults to `{ kind: \"line\" }`.\n *\n * @since 0.1\n * @example\n * const opts: PlotOpts = {\n * color: \"#3b82f6\",\n * title: \"EMA(20)\",\n * lineWidth: 2,\n * lineStyle: \"solid\",\n * pane: \"overlay\",\n * style: { kind: \"line\" },\n * };\n */\nexport type PlotOpts = Readonly<{\n color?: Color;\n title?: string;\n lineWidth?: number;\n lineStyle?: LineStyle;\n pane?: \"overlay\" | \"new\" | string;\n style?: PlotOptsStyle;\n}>;\n\n/**\n * Styling options accepted by `hline(...)`. `pane` follows the same shape as\n * {@link PlotOpts.pane}: omit to fall back to the script's manifest-resolved\n * default (overlay unless `defineIndicator({ overlay: false })` was declared);\n * `\"overlay\"` pins the line to the price pane; `\"new\"` opens / joins the\n * per-script subpane; named panes route to a shared subpane key.\n *\n * @since 0.1\n * @stable\n * @example\n * const opts: HLineOpts = {\n * color: \"#ef4444\",\n * title: \"RSI 70\",\n * lineStyle: \"dashed\",\n * pane: \"new\",\n * };\n */\nexport type HLineOpts = Readonly<{\n color?: Color;\n title?: string;\n lineWidth?: number;\n lineStyle?: LineStyle;\n /**\n * Routes the horizontal line to a pane. Mirrors {@link PlotOpts.pane}:\n * omit to fall back to the script's manifest-resolved default,\n * `\"overlay\"` pins to the price pane, `\"new\"` joins the per-script\n * subpane, and named keys route to a shared subpane (folded to overlay\n * with `unsupported-pane` on `subPanes: 0` adapters).\n *\n * @since 0.2\n */\n pane?: \"overlay\" | \"new\" | string;\n}>;\n\n/**\n * Compile-time callable hole for `plot(value, opts?)`. The compiler rewrites\n * every callsite to dispatch to the runtime's `plot` implementation;\n * calling this outside a compiled runtime throws the sentinel.\n *\n * Accepts `number | Series<number>` — scalars emit a single bar value;\n * series emissions pull from `series.current`.\n *\n * @since 0.1\n * @stable\n * @example\n * // Inside a compiled `compute`:\n * // plot(bar.close, { color: \"#3b82f6\" });\n * import { plot } from \"@invinite-org/chartlang-core\";\n * try { plot(0); } catch {}\n */\nexport function plot(_value: number | Series<number>, _opts?: PlotOpts): void {\n throw new Error(\"plot called outside compiled runtime\");\n}\n\n/**\n * Compile-time callable hole for `hline(price, opts?)`. Same semantics as\n * `plot` but pinned to a fixed price across all bars.\n *\n * @since 0.1\n * @stable\n * @example\n * // Inside a compiled `compute`:\n * // hline(70, { color: \"#ef4444\" });\n * import { hline } from \"@invinite-org/chartlang-core\";\n * try { hline(70); } catch {}\n */\nexport function hline(_price: number, _opts?: HLineOpts): void {\n throw new Error(\"hline called outside compiled runtime\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/plot/plot.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAgS/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","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Color, LineStyle, Series } from \"../types.js\";\n\n/**\n * Rendered-shape discriminator for `plot` emissions reaching the adapter.\n * The full 0.5 inventory is `line`, `step-line`, `horizontal-line`,\n * `histogram`, `area`, `filled-band`, `label`, `marker`,\n * `shape`, `character`, `arrow`, `candle-override`, `bar-override`,\n * `bg-color`, `bar-color`, and `horizontal-histogram`. Every expansion is\n * additive — the `apiVersion: 1` script header stays unchanged.\n *\n * Typical Phase-2 consumers:\n *\n * - `histogram` → volume bars, MACD histogram, momentum-style oscillators.\n * - `area` → filled region under a polyline (BB midline, regression).\n * - `filled-band` → Bollinger / Keltner / Donchian / Ichimoku envelopes.\n * - `label` → text annotations at a world-space anchor (fractal, pivot).\n * - `marker` → discrete glyph (circle / triangle / square / diamond) for\n * fractals / divergence / supertrend flips.\n *\n * @since 0.1\n * @example\n * const k: PlotKind = \"line\";\n * const histogram: PlotKind = \"histogram\";\n * const shape: PlotKind = \"shape\";\n * void k; void histogram; void shape;\n */\nexport type PlotKind =\n | \"line\"\n | \"step-line\"\n | \"horizontal-line\"\n | \"histogram\"\n | \"area\"\n | \"filled-band\"\n | \"label\"\n | \"marker\"\n | \"shape\"\n | \"character\"\n | \"arrow\"\n | \"candle-override\"\n | \"bar-override\"\n | \"bg-color\"\n | \"bar-color\"\n | \"horizontal-histogram\";\n\n/**\n * Marker glyphs shared by Phase 2 `marker` and Phase 5 `shape` plot styles.\n *\n * @since 0.5\n * @stable\n * @example\n * const shape: PlotGlyphShape = \"circle\";\n * void shape;\n */\nexport type PlotGlyphShape = \"circle\" | \"triangle-up\" | \"triangle-down\" | \"square\" | \"diamond\";\n\n/**\n * Full glyph inventory for Phase 5 `shape` plot styles.\n *\n * @since 0.5\n * @stable\n * @example\n * const shape: PlotShapeGlyph = \"flag\";\n * void shape;\n */\nexport type PlotShapeGlyph = PlotGlyphShape | \"cross\" | \"xcross\" | \"flag\";\n\n/**\n * Vertical anchoring mode for glyph-like Phase 5 plot styles.\n *\n * @since 0.5\n * @stable\n * @example\n * const location: PlotLocation = \"above\";\n * void location;\n */\nexport type PlotLocation = \"above\" | \"below\" | \"absolute\";\n\n/**\n * Single row in a Phase 5 horizontal-histogram plot emission.\n *\n * @since 0.5\n * @stable\n * @example\n * const bucket: HorizontalHistogramBucket = { price: 100, volume: 25 };\n * void bucket;\n */\nexport type HorizontalHistogramBucket = Readonly<{\n readonly price: number;\n readonly volume: number;\n readonly color?: Color;\n}>;\n\n/**\n * Script-author selectable plot style. The runtime maps this to the\n * adapter-kit's wire `PlotStyle` discriminated union and fills in defaults\n * from sibling {@link PlotOpts} fields (`lineWidth` / `lineStyle`) for\n * line-like styles.\n *\n * `histogram.baseline` defaults to `0` when omitted.\n *\n * @formula N/A — script-facing style input\n * @since 0.2\n * @stable\n * @example\n * const lineStyle: PlotOptsStyle = { kind: \"line\" };\n * const histStyle: PlotOptsStyle = { kind: \"histogram\", baseline: 0 };\n * void lineStyle; void histStyle;\n */\nexport type PlotOptsStyle =\n | { readonly kind: \"line\" }\n | { readonly kind: \"step-line\" }\n | { readonly kind: \"horizontal-line\" }\n | { readonly kind: \"histogram\"; readonly baseline?: number }\n | {\n readonly kind: \"marker\";\n readonly shape: PlotGlyphShape;\n readonly size: number;\n }\n /**\n * Glyph at world-anchor — Pine's `plotshape`. Location selects vertical\n * anchoring; `size` is in CSS pixels.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"shape\", shape: \"triangle-up\", size: 8, location: \"below\" } });\n */\n | {\n readonly kind: \"shape\";\n readonly shape: PlotShapeGlyph;\n readonly size: number;\n readonly location?: PlotLocation;\n }\n /**\n * Text glyph at world-anchor — Pine's `plotchar`. `char` may be any\n * non-empty UTF-8 string; `size` is in CSS pixels.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"character\", char: \"▲\", size: 12, location: \"above\" } });\n */\n | {\n readonly kind: \"character\";\n readonly char: string;\n readonly size: number;\n readonly location?: PlotLocation;\n }\n /**\n * Directional marker at world-anchor — Pine's `plotarrow`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.low, { style: { kind: \"arrow\", direction: \"up\", size: 10 } });\n */\n | { readonly kind: \"arrow\"; readonly direction: \"up\" | \"down\"; readonly size: number }\n /**\n * Candle body color override — Pine's `plotcandle`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"candle-override\", bull: \"#26a69a\", bear: \"#ef5350\" } });\n */\n | {\n readonly kind: \"candle-override\";\n readonly bull: Color;\n readonly bear: Color;\n readonly doji?: Color;\n }\n /**\n * OHLC bar outline override — Pine's `plotbar`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"bar-override\", color: \"#f59e0b\" } });\n */\n | { readonly kind: \"bar-override\"; readonly color: Color }\n /**\n * Pane background color band — Pine's `bgcolor`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"bg-color\", color: \"#1d4ed8\", transp: 80 } });\n */\n | { readonly kind: \"bg-color\"; readonly color: Color; readonly transp?: number }\n /**\n * Main candle/bar tint — Pine's `barcolor`.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"bar-color\", color: \"#a855f7\" } });\n */\n | { readonly kind: \"bar-color\"; readonly color: Color }\n /**\n * Right-edge volume-profile bars keyed by price bucket.\n *\n * @since 0.5\n * @stable\n * @example\n * plot(bar.close, { style: { kind: \"horizontal-histogram\", buckets: [{ price: bar.close, volume: bar.volume }] } });\n */\n | {\n readonly kind: \"horizontal-histogram\";\n readonly buckets: ReadonlyArray<HorizontalHistogramBucket>;\n };\n\n/**\n * Styling options accepted by `plot(...)`. `pane: \"overlay\"` (the default) is\n * the only pane the Phase-1 canvas2d adapter renders — `\"new\"` and named\n * panes are reserved for Phase 2+. `style` (Phase 2) lets the script pick\n * a non-line {@link PlotOptsStyle} — defaults to `{ kind: \"line\" }`.\n *\n * @since 0.1\n * @example\n * const opts: PlotOpts = {\n * color: \"#3b82f6\",\n * title: \"EMA(20)\",\n * lineWidth: 2,\n * lineStyle: \"solid\",\n * pane: \"overlay\",\n * style: { kind: \"line\" },\n * };\n */\nexport type PlotOpts = Readonly<{\n color?: Color;\n title?: string;\n lineWidth?: number;\n lineStyle?: LineStyle;\n pane?: \"overlay\" | \"new\" | string;\n style?: PlotOptsStyle;\n /**\n * Presentation-only render-order key (z-index). Default `0`.\n * Higher `z` renders on top; lower `z` renders behind. Marks with\n * equal `z` keep the default group order (plots below drawings) and,\n * within a group, declaration order. `z` may be any finite number —\n * fractional values (e.g. `1.5`) slot a mark between two layers\n * without renumbering. It affects **only** stacking: `value`,\n * alerts, and `state.*` are unaffected.\n *\n * @since 1.4\n * @stable\n * @example\n * plot(ta.sma(bar.close, 50), { z: -1 }); // behind other plots\n */\n z?: number;\n}>;\n\n/**\n * Styling options accepted by `hline(...)`. `pane` follows the same shape as\n * {@link PlotOpts.pane}: omit to fall back to the script's manifest-resolved\n * default (overlay unless `defineIndicator({ overlay: false })` was declared);\n * `\"overlay\"` pins the line to the price pane; `\"new\"` opens / joins the\n * per-script subpane; named panes route to a shared subpane key.\n *\n * @since 0.1\n * @stable\n * @example\n * const opts: HLineOpts = {\n * color: \"#ef4444\",\n * title: \"RSI 70\",\n * lineStyle: \"dashed\",\n * pane: \"new\",\n * };\n */\nexport type HLineOpts = Readonly<{\n color?: Color;\n title?: string;\n lineWidth?: number;\n lineStyle?: LineStyle;\n /**\n * Routes the horizontal line to a pane. Mirrors {@link PlotOpts.pane}:\n * omit to fall back to the script's manifest-resolved default,\n * `\"overlay\"` pins to the price pane, `\"new\"` joins the per-script\n * subpane, and named keys route to a shared subpane (folded to overlay\n * with `unsupported-pane` on `subPanes: 0` adapters).\n *\n * @since 0.2\n */\n pane?: \"overlay\" | \"new\" | string;\n}>;\n\n/**\n * Compile-time callable hole for `plot(value, opts?)`. The compiler rewrites\n * every callsite to dispatch to the runtime's `plot` implementation;\n * calling this outside a compiled runtime throws the sentinel.\n *\n * Accepts `number | Series<number>` — scalars emit a single bar value;\n * series emissions pull from `series.current`.\n *\n * @since 0.1\n * @stable\n * @example\n * // Inside a compiled `compute`:\n * // plot(bar.close, { color: \"#3b82f6\" });\n * import { plot } from \"@invinite-org/chartlang-core\";\n * try { plot(0); } catch {}\n */\nexport function plot(_value: number | Series<number>, _opts?: PlotOpts): void {\n throw new Error(\"plot called outside compiled runtime\");\n}\n\n/**\n * Compile-time callable hole for `hline(price, opts?)`. Same semantics as\n * `plot` but pinned to a fixed price across all bars.\n *\n * @since 0.1\n * @stable\n * @example\n * // Inside a compiled `compute`:\n * // hline(70, { color: \"#ef4444\" });\n * import { hline } from \"@invinite-org/chartlang-core\";\n * try { hline(70); } catch {}\n */\nexport function hline(_price: number, _opts?: HLineOpts): void {\n throw new Error(\"hline called outside compiled runtime\");\n}\n"]}
|
package/dist/request/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { request, type RequestNamespace, type RequestLowerTfOpts, type RequestSecurityOpts, type SecurityBar, } from "./request.js";
|
|
1
|
+
export { request, type RequestNamespace, type RequestLowerTfOpts, type RequestSecurityOpts, type SecurityBar, type SecurityExpr, } from "./request.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,EAChB,KAAK,YAAY,GACpB,MAAM,cAAc,CAAC"}
|
|
@@ -1 +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,
|
|
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,GAMV,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport {\n request,\n type RequestNamespace,\n type RequestLowerTfOpts,\n type RequestSecurityOpts,\n type SecurityBar,\n type SecurityExpr,\n} from \"./request.js\";\n"]}
|
|
@@ -58,6 +58,85 @@ export type SecurityBar = Readonly<{
|
|
|
58
58
|
readonly symbol: Series<string>;
|
|
59
59
|
readonly interval: Series<string>;
|
|
60
60
|
}>;
|
|
61
|
+
/**
|
|
62
|
+
* A higher-timeframe expression callback for {@link RequestNamespace.security}.
|
|
63
|
+
* Receives the HTF {@link SecurityBar} (OHLCV series on the secondary
|
|
64
|
+
* stream's own clock) and returns the value to evaluate per HTF bar.
|
|
65
|
+
* The body may reference only the `bar` parameter, the ambient `ta`
|
|
66
|
+
* namespace, `inputs`, safe `Math.*` globals, and literal constants —
|
|
67
|
+
* capturing any other outer binding is a compile error
|
|
68
|
+
* (`request-security-expr-captures-local`).
|
|
69
|
+
*
|
|
70
|
+
* Returning a `Series<number>` (e.g. `(bar) => ta.ema(bar.close, 20)`)
|
|
71
|
+
* lets `ta.*` accumulate over HTF bars; returning a bare `number`
|
|
72
|
+
* (e.g. `(bar) => bar.close.current * 2`) samples the scalar once per
|
|
73
|
+
* HTF bar. Either way the result aligns no-lookahead to the main timeline.
|
|
74
|
+
*
|
|
75
|
+
* @since 0.7
|
|
76
|
+
* @stable
|
|
77
|
+
* @example
|
|
78
|
+
* const trend: SecurityExpr = (bar) => bar.close;
|
|
79
|
+
* void trend;
|
|
80
|
+
*/
|
|
81
|
+
export type SecurityExpr = (bar: SecurityBar) => Series<number> | number;
|
|
82
|
+
/**
|
|
83
|
+
* Read a secondary candle stream at a script-author-fixed **higher**
|
|
84
|
+
* interval. Two forms:
|
|
85
|
+
*
|
|
86
|
+
* - **Data**: `request.security({ interval })` → a `SecurityBar`.
|
|
87
|
+
* Every OHLCV field — plus the derived `hl2` / `hlc3` / `ohlc4` /
|
|
88
|
+
* `hlcc4` and `symbol` / `interval` — is a `Series<...>` aligned
|
|
89
|
+
* no-lookahead to the chart's bars, so a script can read prior secondary
|
|
90
|
+
* values such as `weekly.close[5]`.
|
|
91
|
+
* - **Expression**: `request.security({ interval }, (bar) => …)` →
|
|
92
|
+
* `Series<number>`. The callback runs **on the higher-timeframe clock**
|
|
93
|
+
* (once per HTF bar), so `ta.*` inside it accumulate over HTF bars; the
|
|
94
|
+
* result is aligned no-lookahead down to the main timeline. This is the
|
|
95
|
+
* only correct way to get a "weekly EMA(20)" — the data form's series is
|
|
96
|
+
* clocked to the main timeline, so `ta.ema(weekly.close, 20)` would
|
|
97
|
+
* average 20 *main* bars.
|
|
98
|
+
*
|
|
99
|
+
* The `interval` must be a compile-time literal (a string literal or an
|
|
100
|
+
* `input.enum` value); the compiler walks every call to populate
|
|
101
|
+
* `manifest.requestedIntervals`. When the adapter does not advertise
|
|
102
|
+
* `Capabilities.multiTimeframe`, the series degrades to all-NaN rather than
|
|
103
|
+
* erroring. See the multi-timeframe guide for alignment and interval-format
|
|
104
|
+
* details.
|
|
105
|
+
*
|
|
106
|
+
* @since 0.4
|
|
107
|
+
* @stable
|
|
108
|
+
* @example
|
|
109
|
+
* // weekly EMA(20) — computed over weekly bars, drawn on the chart
|
|
110
|
+
* const trend = request.security({ interval: "1W" }, (bar) => ta.ema(bar.close, 20));
|
|
111
|
+
* plot(trend, { title: "Weekly EMA(20)" });
|
|
112
|
+
* @example
|
|
113
|
+
* // data form — aligned weekly close
|
|
114
|
+
* const weekly = request.security({ interval: "1W" });
|
|
115
|
+
* plot(weekly.close, { title: "Weekly close" });
|
|
116
|
+
*/
|
|
117
|
+
declare function security(opts: RequestSecurityOpts): SecurityBar;
|
|
118
|
+
declare function security(opts: RequestSecurityOpts, expr: SecurityExpr): Series<number>;
|
|
119
|
+
/**
|
|
120
|
+
* Read **lower**-timeframe bars contained by each main-stream bar. The
|
|
121
|
+
* result is a `Series<ReadonlyArray<Bar>>` — for every main bar, the array
|
|
122
|
+
* of finer-grained bars that fall inside it (an empty frozen array for
|
|
123
|
+
* out-of-range or unsupported reads). The requested `interval` must be a
|
|
124
|
+
* compile-time literal and **strictly lower** than the chart interval; an
|
|
125
|
+
* equal-or-higher ordering is rejected at compile time with
|
|
126
|
+
* `lower-tf-not-lower` when statically known. Like `request.security`, it
|
|
127
|
+
* degrades to empty arrays when the adapter lacks
|
|
128
|
+
* `Capabilities.multiTimeframe`. See the multi-timeframe guide for the
|
|
129
|
+
* contained-bar model and interval format.
|
|
130
|
+
*
|
|
131
|
+
* @since 0.6
|
|
132
|
+
* @stable
|
|
133
|
+
* @example
|
|
134
|
+
* // Each main bar carries the array of intrabar 30-second candles.
|
|
135
|
+
* const intrabar = request.lowerTf({ interval: "30s" });
|
|
136
|
+
* const count = intrabar.current.length;
|
|
137
|
+
* void count;
|
|
138
|
+
*/
|
|
139
|
+
declare function lowerTf(_opts: RequestLowerTfOpts): Series<ReadonlyArray<Bar>>;
|
|
61
140
|
/**
|
|
62
141
|
* `request.*` namespace for secondary timeframe reads. The compiler walks
|
|
63
142
|
* `request.security(...)` calls to populate `manifest.requestedIntervals`;
|
|
@@ -71,26 +150,8 @@ export type SecurityBar = Readonly<{
|
|
|
71
150
|
* void ns;
|
|
72
151
|
*/
|
|
73
152
|
export declare const request: Readonly<{
|
|
74
|
-
|
|
75
|
-
|
|
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>>;
|
|
153
|
+
security: typeof security;
|
|
154
|
+
lowerTf: typeof lowerTf;
|
|
94
155
|
}>;
|
|
95
156
|
/**
|
|
96
157
|
* Static type of the `request` namespace. Runtime implementations satisfy
|
|
@@ -103,4 +164,5 @@ export declare const request: Readonly<{
|
|
|
103
164
|
* void ns;
|
|
104
165
|
*/
|
|
105
166
|
export type RequestNamespace = typeof request;
|
|
167
|
+
export {};
|
|
106
168
|
//# sourceMappingURL=request.d.ts.map
|
|
@@ -1 +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,CAA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AAQ,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;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAMzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,CAAC;AAC1D,iBAAS,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAKjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO;;;EAAuC,CAAC;AAE5D;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,OAAO,CAAC"}
|
package/dist/request/request.js
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
const sentinel = (name) => {
|
|
4
4
|
throw new Error(`${name} called outside an active script step`);
|
|
5
5
|
};
|
|
6
|
+
function security(_opts, _expr) {
|
|
7
|
+
return sentinel("request.security");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Read **lower**-timeframe bars contained by each main-stream bar. The
|
|
11
|
+
* result is a `Series<ReadonlyArray<Bar>>` — for every main bar, the array
|
|
12
|
+
* of finer-grained bars that fall inside it (an empty frozen array for
|
|
13
|
+
* out-of-range or unsupported reads). The requested `interval` must be a
|
|
14
|
+
* compile-time literal and **strictly lower** than the chart interval; an
|
|
15
|
+
* equal-or-higher ordering is rejected at compile time with
|
|
16
|
+
* `lower-tf-not-lower` when statically known. Like `request.security`, it
|
|
17
|
+
* degrades to empty arrays when the adapter lacks
|
|
18
|
+
* `Capabilities.multiTimeframe`. See the multi-timeframe guide for the
|
|
19
|
+
* contained-bar model and interval format.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.6
|
|
22
|
+
* @stable
|
|
23
|
+
* @example
|
|
24
|
+
* // Each main bar carries the array of intrabar 30-second candles.
|
|
25
|
+
* const intrabar = request.lowerTf({ interval: "30s" });
|
|
26
|
+
* const count = intrabar.current.length;
|
|
27
|
+
* void count;
|
|
28
|
+
*/
|
|
29
|
+
function lowerTf(_opts) {
|
|
30
|
+
return sentinel("request.lowerTf");
|
|
31
|
+
}
|
|
6
32
|
/**
|
|
7
33
|
* `request.*` namespace for secondary timeframe reads. The compiler walks
|
|
8
34
|
* `request.security(...)` calls to populate `manifest.requestedIntervals`;
|
|
@@ -15,30 +41,5 @@ const sentinel = (name) => {
|
|
|
15
41
|
* const ns: typeof request = request;
|
|
16
42
|
* void ns;
|
|
17
43
|
*/
|
|
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
|
+
export const request = Object.freeze({ security, lowerTf });
|
|
44
45
|
//# sourceMappingURL=request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAwF/D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAS,EAAE;IACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;AACpE,CAAC,CAAC;AAuCF,SAAS,QAAQ,CAAC,KAA0B,EAAE,KAAoB;IAC9D,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,OAAO,CAAC,KAAyB;IACtC,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Bar, Price, Series, Time, Volume } from \"../types.js\";\n\n/**\n * Argument to {@link request.security}. The `interval` must be a string\n * literal or an `input.enum` value; the compiler's literal-only pass rejects\n * dynamic expressions with `request-security-interval-not-literal`.\n *\n * @since 0.4\n * @stable\n * @example\n * const opts: RequestSecurityOpts = { interval: \"1D\" };\n * void opts;\n */\nexport type RequestSecurityOpts = Readonly<{\n readonly interval: string;\n}>;\n\n/**\n * Argument to {@link request.lowerTf}. The `interval` must be strictly lower\n * than the script's main interval; invalid orderings are rejected by the\n * compiler's `lower-tf-not-lower` diagnostic when statically known.\n *\n * @since 0.6\n * @stable\n * @example\n * const opts: RequestLowerTfOpts = { interval: \"30s\" };\n * void opts;\n */\nexport type RequestLowerTfOpts = Readonly<{\n readonly interval: string;\n}>;\n\n/**\n * Secondary-stream bar returned by {@link request.security}. Each field is a\n * `Series<...>` aligned from the runtime's secondary-stream ring buffer to\n * the current main stream, or by the all-NaN fallback when\n * `Capabilities.multiTimeframe` is `false`, the interval is unsupported, or\n * the host fails to register the secondary stream.\n *\n * This is intentionally a series-shaped view rather than the scalar\n * {@link Bar} shape so scripts can read historical secondary values aligned\n * to main bars, such as `daily.close[5]`.\n *\n * @since 0.4\n * @stable\n * @example\n * const close: SecurityBar[\"close\"] = { current: 1, length: 1 };\n * void close;\n */\nexport type SecurityBar = Readonly<{\n readonly time: Series<Time>;\n readonly open: Series<Price>;\n readonly high: Series<Price>;\n readonly low: Series<Price>;\n readonly close: Series<Price>;\n readonly volume: Series<Volume>;\n readonly hl2: Series<Price>;\n readonly hlc3: Series<Price>;\n readonly ohlc4: Series<Price>;\n readonly hlcc4: Series<Price>;\n readonly symbol: Series<string>;\n readonly interval: Series<string>;\n}>;\n\n/**\n * A higher-timeframe expression callback for {@link RequestNamespace.security}.\n * Receives the HTF {@link SecurityBar} (OHLCV series on the secondary\n * stream's own clock) and returns the value to evaluate per HTF bar.\n * The body may reference only the `bar` parameter, the ambient `ta`\n * namespace, `inputs`, safe `Math.*` globals, and literal constants —\n * capturing any other outer binding is a compile error\n * (`request-security-expr-captures-local`).\n *\n * Returning a `Series<number>` (e.g. `(bar) => ta.ema(bar.close, 20)`)\n * lets `ta.*` accumulate over HTF bars; returning a bare `number`\n * (e.g. `(bar) => bar.close.current * 2`) samples the scalar once per\n * HTF bar. Either way the result aligns no-lookahead to the main timeline.\n *\n * @since 0.7\n * @stable\n * @example\n * const trend: SecurityExpr = (bar) => bar.close;\n * void trend;\n */\nexport type SecurityExpr = (bar: SecurityBar) => Series<number> | number;\n\nconst sentinel = (name: string): never => {\n throw new Error(`${name} called outside an active script step`);\n};\n\n/**\n * Read a secondary candle stream at a script-author-fixed **higher**\n * interval. Two forms:\n *\n * - **Data**: `request.security({ interval })` → a `SecurityBar`.\n * Every OHLCV field — plus the derived `hl2` / `hlc3` / `ohlc4` /\n * `hlcc4` and `symbol` / `interval` — is a `Series<...>` aligned\n * no-lookahead to the chart's bars, so a script can read prior secondary\n * values such as `weekly.close[5]`.\n * - **Expression**: `request.security({ interval }, (bar) => …)` →\n * `Series<number>`. The callback runs **on the higher-timeframe clock**\n * (once per HTF bar), so `ta.*` inside it accumulate over HTF bars; the\n * result is aligned no-lookahead down to the main timeline. This is the\n * only correct way to get a \"weekly EMA(20)\" — the data form's series is\n * clocked to the main timeline, so `ta.ema(weekly.close, 20)` would\n * average 20 *main* bars.\n *\n * The `interval` must be a compile-time literal (a string literal or an\n * `input.enum` value); the compiler walks every call to populate\n * `manifest.requestedIntervals`. When the adapter does not advertise\n * `Capabilities.multiTimeframe`, the series degrades to all-NaN rather than\n * erroring. See the multi-timeframe guide for alignment and interval-format\n * details.\n *\n * @since 0.4\n * @stable\n * @example\n * // weekly EMA(20) — computed over weekly bars, drawn on the chart\n * const trend = request.security({ interval: \"1W\" }, (bar) => ta.ema(bar.close, 20));\n * plot(trend, { title: \"Weekly EMA(20)\" });\n * @example\n * // data form — aligned weekly close\n * const weekly = request.security({ interval: \"1W\" });\n * plot(weekly.close, { title: \"Weekly close\" });\n */\nfunction security(opts: RequestSecurityOpts): SecurityBar;\nfunction security(opts: RequestSecurityOpts, expr: SecurityExpr): Series<number>;\nfunction security(_opts: RequestSecurityOpts, _expr?: SecurityExpr): SecurityBar | Series<number> {\n return sentinel(\"request.security\");\n}\n\n/**\n * Read **lower**-timeframe bars contained by each main-stream bar. The\n * result is a `Series<ReadonlyArray<Bar>>` — for every main bar, the array\n * of finer-grained bars that fall inside it (an empty frozen array for\n * out-of-range or unsupported reads). The requested `interval` must be a\n * compile-time literal and **strictly lower** than the chart interval; an\n * equal-or-higher ordering is rejected at compile time with\n * `lower-tf-not-lower` when statically known. Like `request.security`, it\n * degrades to empty arrays when the adapter lacks\n * `Capabilities.multiTimeframe`. See the multi-timeframe guide for the\n * contained-bar model and interval format.\n *\n * @since 0.6\n * @stable\n * @example\n * // Each main bar carries the array of intrabar 30-second candles.\n * const intrabar = request.lowerTf({ interval: \"30s\" });\n * const count = intrabar.current.length;\n * void count;\n */\nfunction lowerTf(_opts: RequestLowerTfOpts): Series<ReadonlyArray<Bar>> {\n return sentinel(\"request.lowerTf\");\n}\n\n/**\n * `request.*` namespace for secondary timeframe reads. The compiler walks\n * `request.security(...)` calls to populate `manifest.requestedIntervals`;\n * the runtime replaces this callable hole with a slot-aware implementation\n * through `ComputeContext.request`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: typeof request = request;\n * void ns;\n */\nexport const request = Object.freeze({ security, lowerTf });\n\n/**\n * Static type of the `request` namespace. Runtime implementations satisfy\n * this shape structurally when installed on `ComputeContext.request`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: RequestNamespace = request;\n * void ns;\n */\nexport type RequestNamespace = typeof request;\n"]}
|
package/dist/state/state.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NumberSeriesSlot } from "../types.js";
|
|
1
2
|
import type { MutableSlot } from "./mutableSlot.js";
|
|
2
3
|
/**
|
|
3
4
|
* Persistent state slots, Pine `var` semantics. Writes during a tick are
|
|
@@ -55,6 +56,22 @@ export declare const state: Readonly<{
|
|
|
55
56
|
* void fn;
|
|
56
57
|
*/
|
|
57
58
|
string(_init: string): MutableSlot<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Allocate or read a persistent **series** slot — a writable, indexable
|
|
61
|
+
* number history. `s.value = expr` writes the current bar's value;
|
|
62
|
+
* `s[0]` / `s.current` / `+s` read it back, `s[1]` reads one bar ago.
|
|
63
|
+
* The allocation bar's pre-write head is seeded with `init`; unwritten later
|
|
64
|
+
* bars and out-of-range history reads are `NaN`. Unlike `state.float`, the
|
|
65
|
+
* slot retains a bounded window of prior committed values (sized to the
|
|
66
|
+
* script's deepest literal `s[n]` lookback).
|
|
67
|
+
*
|
|
68
|
+
* @since 1.3
|
|
69
|
+
* @stable
|
|
70
|
+
* @example
|
|
71
|
+
* const fn: typeof state.series = state.series;
|
|
72
|
+
* void fn;
|
|
73
|
+
*/
|
|
74
|
+
series(_init: number): NumberSeriesSlot;
|
|
58
75
|
/**
|
|
59
76
|
* Tick-persistent state slots, Pine `varip` semantics. Writes commit
|
|
60
77
|
* immediately, even during a tick.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;IACd;;;;;;;;OAQG;iBACU,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIzC;;;;;;;;OAQG;eACQ,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIvC;;;;;;;;OAQG;gBACS,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;IAI1C;;;;;;;;OAQG;kBACW,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAI1C;;;;;;;;;OASG;;qBAEc,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;mBAG9B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;oBAG3B,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;sBAG5B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;;EAIhD,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;IACd;;;;;;;;OAQG;iBACU,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIzC;;;;;;;;OAQG;eACQ,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIvC;;;;;;;;OAQG;gBACS,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;IAI1C;;;;;;;;OAQG;kBACW,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAI1C;;;;;;;;;;;;;;OAcG;kBACW,MAAM,GAAG,gBAAgB;IAIvC;;;;;;;;;OASG;;qBAEc,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;mBAG9B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;oBAG3B,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;sBAG5B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;;EAIhD,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,KAAK,CAAC"}
|
package/dist/state/state.js
CHANGED
|
@@ -67,6 +67,24 @@ export const state = Object.freeze({
|
|
|
67
67
|
string(_init) {
|
|
68
68
|
return sentinel("state.string");
|
|
69
69
|
},
|
|
70
|
+
/**
|
|
71
|
+
* Allocate or read a persistent **series** slot — a writable, indexable
|
|
72
|
+
* number history. `s.value = expr` writes the current bar's value;
|
|
73
|
+
* `s[0]` / `s.current` / `+s` read it back, `s[1]` reads one bar ago.
|
|
74
|
+
* The allocation bar's pre-write head is seeded with `init`; unwritten later
|
|
75
|
+
* bars and out-of-range history reads are `NaN`. Unlike `state.float`, the
|
|
76
|
+
* slot retains a bounded window of prior committed values (sized to the
|
|
77
|
+
* script's deepest literal `s[n]` lookback).
|
|
78
|
+
*
|
|
79
|
+
* @since 1.3
|
|
80
|
+
* @stable
|
|
81
|
+
* @example
|
|
82
|
+
* const fn: typeof state.series = state.series;
|
|
83
|
+
* void fn;
|
|
84
|
+
*/
|
|
85
|
+
series(_init) {
|
|
86
|
+
return sentinel("state.series");
|
|
87
|
+
},
|
|
70
88
|
/**
|
|
71
89
|
* Tick-persistent state slots, Pine `varip` semantics. Writes commit
|
|
72
90
|
* immediately, even during a tick.
|
package/dist/state/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAK/D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAS,EAAE;IACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,KAAa;QACb,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,KAAc;QACf,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAa;QAChB,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,KAAa;QAChB,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QAChB,KAAK,CAAC,KAAa;YACf,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QACxC,CAAC;QACD,GAAG,CAAC,KAAa;YACb,OAAO,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,KAAc;YACf,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QACvC,CAAC;QACD,MAAM,CAAC,KAAa;YAChB,OAAO,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACzC,CAAC;KACJ,CAAC;CACL,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { NumberSeriesSlot } from \"../types.js\";\nimport type { MutableSlot } from \"./mutableSlot.js\";\n\nconst sentinel = (name: string): never => {\n throw new Error(`${name} called outside an active script step`);\n};\n\n/**\n * Persistent state slots, Pine `var` semantics. Writes during a tick are\n * tentative and discarded if a later tick replaces the head bar; on bar\n * close the tentative value commits. Reads return the active tentative\n * value for the current step.\n *\n * The runtime replaces this compile-time callable hole with a slot-aware\n * namespace through `ComputeContext.state`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: typeof state = state;\n * void ns;\n */\nexport const state = Object.freeze({\n /**\n * Allocate or read a persistent number slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.float = state.float;\n * void fn;\n */\n float(_init: number): MutableSlot<number> {\n return sentinel(\"state.float\");\n },\n\n /**\n * Allocate or read a persistent integer slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.int = state.int;\n * void fn;\n */\n int(_init: number): MutableSlot<number> {\n return sentinel(\"state.int\");\n },\n\n /**\n * Allocate or read a persistent boolean slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.bool = state.bool;\n * void fn;\n */\n bool(_init: boolean): MutableSlot<boolean> {\n return sentinel(\"state.bool\");\n },\n\n /**\n * Allocate or read a persistent string slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.string = state.string;\n * void fn;\n */\n string(_init: string): MutableSlot<string> {\n return sentinel(\"state.string\");\n },\n\n /**\n * Allocate or read a persistent **series** slot — a writable, indexable\n * number history. `s.value = expr` writes the current bar's value;\n * `s[0]` / `s.current` / `+s` read it back, `s[1]` reads one bar ago.\n * The allocation bar's pre-write head is seeded with `init`; unwritten later\n * bars and out-of-range history reads are `NaN`. Unlike `state.float`, the\n * slot retains a bounded window of prior committed values (sized to the\n * script's deepest literal `s[n]` lookback).\n *\n * @since 1.3\n * @stable\n * @example\n * const fn: typeof state.series = state.series;\n * void fn;\n */\n series(_init: number): NumberSeriesSlot {\n return sentinel(\"state.series\");\n },\n\n /**\n * Tick-persistent state slots, Pine `varip` semantics. Writes commit\n * immediately, even during a tick.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.tick.float = state.tick.float;\n * void fn;\n */\n tick: Object.freeze({\n float(_init: number): MutableSlot<number> {\n return sentinel(\"state.tick.float\");\n },\n int(_init: number): MutableSlot<number> {\n return sentinel(\"state.tick.int\");\n },\n bool(_init: boolean): MutableSlot<boolean> {\n return sentinel(\"state.tick.bool\");\n },\n string(_init: string): MutableSlot<string> {\n return sentinel(\"state.tick.string\");\n },\n }),\n});\n\n/**\n * Static type of the `state` namespace. Runtime implementations satisfy\n * this shape structurally when they are installed on `ComputeContext.state`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: StateNamespace = state;\n * void ns;\n */\nexport type StateNamespace = typeof state;\n"]}
|
|
@@ -33,8 +33,10 @@ export type StatefulPrimitiveEntry = Readonly<{
|
|
|
33
33
|
* logging/error as stateless loop-diagnostic entries plus `draw.table`
|
|
34
34
|
* as a slot-backed viewport drawing.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Additive within `apiVersion: 1` (currently 176 entries): new entries MAY
|
|
37
|
+
* be appended in a `1.x` release (a new call name is additive — new callsites
|
|
38
|
+
* only, no change to any existing script). Removing or renaming an entry, or
|
|
39
|
+
* flipping its `slot`, is a language change and requires `apiVersion: 2` — see
|
|
38
40
|
* `docs/spec/versioning.md`.
|
|
39
41
|
*
|
|
40
42
|
* @since 0.1
|
|
@@ -52,12 +54,14 @@ export declare const STATEFUL_PRIMITIVES: ReadonlySet<StatefulPrimitiveEntry>;
|
|
|
52
54
|
* Name → entry index of {@link STATEFUL_PRIMITIVES}. The compiler's
|
|
53
55
|
* `callsiteIdInjection` and `statefulCallInLoop` passes consult this map
|
|
54
56
|
* by callee name once per call site — O(1) lookup instead of an O(n) scan
|
|
55
|
-
* over the
|
|
57
|
+
* over the 176-entry set on every visited call. The map is derived from
|
|
56
58
|
* the same canonical entry list as {@link STATEFUL_PRIMITIVES} so adding
|
|
57
59
|
* a primitive to the set adds it here automatically.
|
|
58
60
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
+
* Additive within `apiVersion: 1` (currently 176 entries): new entries MAY
|
|
62
|
+
* be appended in a `1.x` release (a new call name is additive — new callsites
|
|
63
|
+
* only, no change to any existing script). Removing or renaming an entry, or
|
|
64
|
+
* flipping its `slot`, is a language change and requires `apiVersion: 2` — see
|
|
61
65
|
* `docs/spec/versioning.md`.
|
|
62
66
|
*
|
|
63
67
|
* @since 0.2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statefulPrimitives.d.ts","sourceRoot":"","sources":["../src/statefulPrimitives.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"statefulPrimitives.d.ts","sourceRoot":"","sources":["../src/statefulPrimitives.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AA4L/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,sBAAsB,CAEnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAGnB,CAAC"}
|