@invinite-org/chartlang-compiler 1.2.1 → 1.3.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 +246 -0
- package/dist/analysis/extractMaxLookback.d.ts +2 -1
- package/dist/analysis/extractMaxLookback.d.ts.map +1 -1
- package/dist/analysis/extractMaxLookback.js +90 -6
- package/dist/analysis/extractMaxLookback.js.map +1 -1
- package/dist/analysis/extractRequestedIntervals.d.ts +43 -1
- package/dist/analysis/extractRequestedIntervals.d.ts.map +1 -1
- package/dist/analysis/extractRequestedIntervals.js +95 -10
- package/dist/analysis/extractRequestedIntervals.js.map +1 -1
- package/dist/analysis/forbiddenConstructs.d.ts.map +1 -1
- package/dist/analysis/forbiddenConstructs.js +2 -41
- package/dist/analysis/forbiddenConstructs.js.map +1 -1
- package/dist/analysis/index.d.ts +3 -1
- package/dist/analysis/index.d.ts.map +1 -1
- package/dist/analysis/index.js +2 -1
- package/dist/analysis/index.js.map +1 -1
- package/dist/analysis/loopBounds.d.ts +91 -0
- package/dist/analysis/loopBounds.d.ts.map +1 -0
- package/dist/analysis/loopBounds.js +132 -0
- package/dist/analysis/loopBounds.js.map +1 -0
- package/dist/analysis/resolveIndexBound.d.ts +73 -0
- package/dist/analysis/resolveIndexBound.d.ts.map +1 -0
- package/dist/analysis/resolveIndexBound.js +336 -0
- package/dist/analysis/resolveIndexBound.js.map +1 -0
- package/dist/analysis/validateSecurityExpr.d.ts +25 -0
- package/dist/analysis/validateSecurityExpr.d.ts.map +1 -0
- package/dist/analysis/validateSecurityExpr.js +154 -0
- package/dist/analysis/validateSecurityExpr.js.map +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +13 -3
- package/dist/api.js.map +1 -1
- package/dist/diagnostics.d.ts +4 -2
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/manifest.d.ts +2 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +7 -0
- package/dist/manifest.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +91 -14
- package/dist/program.js.map +1 -1
- package/dist/transformers/callsiteIdInjection.d.ts +21 -0
- package/dist/transformers/callsiteIdInjection.d.ts.map +1 -1
- package/dist/transformers/callsiteIdInjection.js +26 -3
- package/dist/transformers/callsiteIdInjection.js.map +1 -1
- package/dist/transformers/resolveCallee.d.ts +21 -0
- package/dist/transformers/resolveCallee.d.ts.map +1 -1
- package/dist/transformers/resolveCallee.js +14 -1
- package/dist/transformers/resolveCallee.js.map +1 -1
- package/package.json +2 -2
package/dist/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAe/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,IAuB7B;IACG,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9D,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1E,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAChD,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAU,CAChE,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;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D,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACzC,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACzE,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAChE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAClD,CAAC,CAAC;AACP,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 {\n AlertConditionDefinition,\n CapabilityId,\n DependencyDeclaration,\n OutputDeclaration,\n PlotSlotDescriptor,\n ScriptManifest,\n} from \"@invinite-org/chartlang-core\";\n\ntype ValueFormat = \"price\" | \"volume\" | \"percent\" | \"compact\";\ntype ScaleAxis = \"price\" | \"left\" | \"right\" | \"new\";\ntype ManifestInputDescriptors = Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n\n/**\n * Build a recursively-frozen `ScriptManifest` from the compiler's\n * extraction passes. Every array, every nested record, and the outer\n * object itself are frozen so the runtime can structurally clone the\n * manifest without worrying about post-build mutation.\n *\n * @since 0.1\n * @example\n * // const manifest = buildManifest({\n * // name: \"EMA(20)\", kind: \"indicator\",\n * // capabilities: [\"alerts\", \"indicators\"],\n * // requestedIntervals: [], userPickableInterval: false,\n * // seriesCapacities: {}, maxLookback: 0, inputs: {},\n * // });\n * const fn: typeof buildManifest = buildManifest;\n * void fn;\n */\nexport function buildManifest(args: {\n readonly name: string;\n readonly kind: \"indicator\" | \"drawing\" | \"alert\" | \"alertCondition\";\n readonly capabilities: ReadonlyArray<CapabilityId>;\n readonly requestedIntervals: ReadonlyArray<string>;\n readonly userPickableInterval: boolean;\n readonly seriesCapacities: Readonly<Record<string, number>>;\n readonly maxLookback: number;\n readonly inputs: ManifestInputDescriptors;\n readonly overlay?: boolean;\n readonly maxBarsBack?: number;\n readonly format?: ValueFormat;\n readonly precision?: number;\n readonly scale?: ScaleAxis;\n readonly requiresIntervals?: ReadonlyArray<string>;\n readonly shortName?: string;\n readonly alertConditions?: ReadonlyArray<AlertConditionDefinition>;\n readonly dependencies?: ReadonlyArray<DependencyDeclaration>;\n readonly outputs?: ReadonlyArray<OutputDeclaration>;\n readonly plots?: ReadonlyArray<PlotSlotDescriptor>;\n readonly exportName?: string;\n readonly isDrawn?: boolean;\n readonly siblings?: ReadonlyArray<ScriptManifest>;\n}): ScriptManifest {\n const capabilities = Object.freeze(args.capabilities.slice());\n const requestedIntervals = Object.freeze(args.requestedIntervals.slice());\n const seriesCapacities = Object.freeze({ ...args.seriesCapacities });\n const inputEntries = Object.entries(args.inputs).map(\n ([key, value]) => [key, Object.freeze({ ...value })] as const,\n );\n const inputs = Object.freeze(Object.fromEntries(inputEntries));\n const scriptInputs = inputs as ScriptManifest[\"inputs\"];\n const requiresIntervals =\n args.requiresIntervals === undefined\n ? undefined\n : Object.freeze(args.requiresIntervals.slice());\n const alertConditions =\n args.alertConditions === undefined\n ? undefined\n : Object.freeze(\n args.alertConditions.map((condition) =>\n Object.freeze({\n id: condition.id,\n title: condition.title,\n description: condition.description,\n defaultMessage: condition.defaultMessage,\n }),\n ),\n );\n const dependencies =\n args.dependencies === undefined || args.dependencies.length === 0\n ? undefined\n : Object.freeze(\n args.dependencies.map((dep) =>\n Object.freeze({\n localId: dep.localId,\n producerName: dep.producerName,\n producerSourcePath: dep.producerSourcePath,\n producerExportName: dep.producerExportName,\n effectiveInputs: Object.freeze({ ...dep.effectiveInputs }),\n outputs: Object.freeze(\n dep.outputs.map((o) =>\n Object.freeze({ title: o.title, kind: o.kind }),\n ),\n ),\n isDrawn: dep.isDrawn,\n }),\n ),\n );\n const outputs =\n args.outputs === undefined || args.outputs.length === 0\n ? undefined\n : Object.freeze(\n args.outputs.map((o) => Object.freeze({ title: o.title, kind: o.kind })),\n );\n const plots =\n args.plots === undefined || args.plots.length === 0\n ? undefined\n : Object.freeze(args.plots.map((s) => Object.freeze({ ...s })));\n const siblings =\n args.siblings === undefined || args.siblings.length === 0\n ? undefined\n : Object.freeze(args.siblings.slice());\n return Object.freeze({\n apiVersion: 1 as const,\n kind: args.kind,\n name: args.name,\n inputs: scriptInputs,\n capabilities,\n requestedIntervals,\n userPickableInterval: args.userPickableInterval,\n seriesCapacities,\n maxLookback: args.maxLookback,\n ...(args.overlay === undefined ? {} : { overlay: args.overlay }),\n ...(args.maxBarsBack === undefined ? {} : { maxBarsBack: args.maxBarsBack }),\n ...(args.format === undefined ? {} : { format: args.format }),\n ...(args.precision === undefined ? {} : { precision: args.precision }),\n ...(args.scale === undefined ? {} : { scale: args.scale }),\n ...(requiresIntervals === undefined ? {} : { requiresIntervals }),\n ...(args.shortName === undefined ? {} : { shortName: args.shortName }),\n ...(alertConditions === undefined ? {} : { alertConditions }),\n ...(dependencies === undefined ? {} : { dependencies }),\n ...(outputs === undefined ? {} : { outputs }),\n ...(plots === undefined ? {} : { plots }),\n ...(args.exportName === undefined ? {} : { exportName: args.exportName }),\n ...(args.isDrawn === undefined ? {} : { isDrawn: args.isDrawn }),\n ...(siblings === undefined ? {} : { siblings }),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAgB/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,IAwB7B;IACG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,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACzC,GAAG,CAAC,mBAAmB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACzE,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAChE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAClD,CAAC,CAAC;AACP,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 {\n AlertConditionDefinition,\n CapabilityId,\n DependencyDeclaration,\n OutputDeclaration,\n PlotSlotDescriptor,\n ScriptManifest,\n SecurityExpressionDescriptor,\n} from \"@invinite-org/chartlang-core\";\n\ntype ValueFormat = \"price\" | \"volume\" | \"percent\" | \"compact\";\ntype ScaleAxis = \"price\" | \"left\" | \"right\" | \"new\";\ntype ManifestInputDescriptors = Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n\n/**\n * Build a recursively-frozen `ScriptManifest` from the compiler's\n * extraction passes. Every array, every nested record, and the outer\n * object itself are frozen so the runtime can structurally clone the\n * manifest without worrying about post-build mutation.\n *\n * @since 0.1\n * @example\n * // const manifest = buildManifest({\n * // name: \"EMA(20)\", kind: \"indicator\",\n * // capabilities: [\"alerts\", \"indicators\"],\n * // requestedIntervals: [], userPickableInterval: false,\n * // seriesCapacities: {}, maxLookback: 0, inputs: {},\n * // });\n * const fn: typeof buildManifest = buildManifest;\n * void fn;\n */\nexport function buildManifest(args: {\n readonly name: string;\n readonly kind: \"indicator\" | \"drawing\" | \"alert\" | \"alertCondition\";\n readonly capabilities: ReadonlyArray<CapabilityId>;\n readonly requestedIntervals: ReadonlyArray<string>;\n readonly userPickableInterval: boolean;\n readonly seriesCapacities: Readonly<Record<string, number>>;\n readonly maxLookback: number;\n readonly inputs: ManifestInputDescriptors;\n readonly overlay?: boolean;\n readonly maxBarsBack?: number;\n readonly format?: ValueFormat;\n readonly precision?: number;\n readonly scale?: ScaleAxis;\n readonly requiresIntervals?: ReadonlyArray<string>;\n readonly shortName?: string;\n readonly alertConditions?: ReadonlyArray<AlertConditionDefinition>;\n readonly dependencies?: ReadonlyArray<DependencyDeclaration>;\n readonly outputs?: ReadonlyArray<OutputDeclaration>;\n readonly plots?: ReadonlyArray<PlotSlotDescriptor>;\n readonly securityExpressions?: ReadonlyArray<SecurityExpressionDescriptor>;\n readonly exportName?: string;\n readonly isDrawn?: boolean;\n readonly siblings?: ReadonlyArray<ScriptManifest>;\n}): ScriptManifest {\n const capabilities = Object.freeze(args.capabilities.slice());\n const requestedIntervals = Object.freeze(args.requestedIntervals.slice());\n const seriesCapacities = Object.freeze({ ...args.seriesCapacities });\n const inputEntries = Object.entries(args.inputs).map(\n ([key, value]) => [key, Object.freeze({ ...value })] as const,\n );\n const inputs = Object.freeze(Object.fromEntries(inputEntries));\n const scriptInputs = inputs as ScriptManifest[\"inputs\"];\n const requiresIntervals =\n args.requiresIntervals === undefined\n ? undefined\n : Object.freeze(args.requiresIntervals.slice());\n const alertConditions =\n args.alertConditions === undefined\n ? undefined\n : Object.freeze(\n args.alertConditions.map((condition) =>\n Object.freeze({\n id: condition.id,\n title: condition.title,\n description: condition.description,\n defaultMessage: condition.defaultMessage,\n }),\n ),\n );\n const dependencies =\n args.dependencies === undefined || args.dependencies.length === 0\n ? undefined\n : Object.freeze(\n args.dependencies.map((dep) =>\n Object.freeze({\n localId: dep.localId,\n producerName: dep.producerName,\n producerSourcePath: dep.producerSourcePath,\n producerExportName: dep.producerExportName,\n effectiveInputs: Object.freeze({ ...dep.effectiveInputs }),\n outputs: Object.freeze(\n dep.outputs.map((o) =>\n Object.freeze({ title: o.title, kind: o.kind }),\n ),\n ),\n isDrawn: dep.isDrawn,\n }),\n ),\n );\n const outputs =\n args.outputs === undefined || args.outputs.length === 0\n ? undefined\n : Object.freeze(\n args.outputs.map((o) => Object.freeze({ title: o.title, kind: o.kind })),\n );\n const plots =\n args.plots === undefined || args.plots.length === 0\n ? undefined\n : Object.freeze(args.plots.map((s) => Object.freeze({ ...s })));\n const securityExpressions =\n args.securityExpressions === undefined || args.securityExpressions.length === 0\n ? undefined\n : Object.freeze(\n args.securityExpressions\n .slice()\n .sort((a, b) => a.slotId.localeCompare(b.slotId))\n .map((s) => Object.freeze({ ...s })),\n );\n const siblings =\n args.siblings === undefined || args.siblings.length === 0\n ? undefined\n : Object.freeze(args.siblings.slice());\n return Object.freeze({\n apiVersion: 1 as const,\n kind: args.kind,\n name: args.name,\n inputs: scriptInputs,\n capabilities,\n requestedIntervals,\n userPickableInterval: args.userPickableInterval,\n seriesCapacities,\n maxLookback: args.maxLookback,\n ...(args.overlay === undefined ? {} : { overlay: args.overlay }),\n ...(args.maxBarsBack === undefined ? {} : { maxBarsBack: args.maxBarsBack }),\n ...(args.format === undefined ? {} : { format: args.format }),\n ...(args.precision === undefined ? {} : { precision: args.precision }),\n ...(args.scale === undefined ? {} : { scale: args.scale }),\n ...(requiresIntervals === undefined ? {} : { requiresIntervals }),\n ...(args.shortName === undefined ? {} : { shortName: args.shortName }),\n ...(alertConditions === undefined ? {} : { alertConditions }),\n ...(dependencies === undefined ? {} : { dependencies }),\n ...(outputs === undefined ? {} : { outputs }),\n ...(plots === undefined ? {} : { plots }),\n ...(securityExpressions === undefined ? {} : { securityExpressions }),\n ...(args.exportName === undefined ? {} : { exportName: args.exportName }),\n ...(args.isDrawn === undefined ? {} : { isDrawn: args.isDrawn }),\n ...(siblings === undefined ? {} : { siblings }),\n });\n}\n"]}
|
package/dist/program.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAu5C3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,eAYjC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACpC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IAC1B,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;CAC3B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IACF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACjD,GACF,gBAAgB,CAsFlB"}
|
package/dist/program.js
CHANGED
|
@@ -73,18 +73,54 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
73
73
|
readonly ohlc4: Price;
|
|
74
74
|
readonly hlcc4: Price;
|
|
75
75
|
readonly viewport?: BarViewport;
|
|
76
|
+
point(offset: number, price: Price): WorldPoint;
|
|
76
77
|
};
|
|
77
78
|
export type Series<T> = {
|
|
78
79
|
readonly current: T;
|
|
79
80
|
readonly [n: number]: T;
|
|
80
81
|
readonly length: number;
|
|
81
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* A bar price field — both a scalar \`Price\` (\`bar.close * 2\`,
|
|
85
|
+
* \`plot(bar.close)\`, \`ta.ema(bar.close, 12)\`) and an indexable
|
|
86
|
+
* \`Series<Price>\` (\`bar.close[1]\`). Mirrors core's \`PriceSeries\`.
|
|
87
|
+
*/
|
|
88
|
+
export type PriceSeries = Price & Series<Price>;
|
|
89
|
+
/** Volume counterpart of \`PriceSeries\`. Mirrors core's \`VolumeSeries\`. */
|
|
90
|
+
export type VolumeSeries = Volume & Series<Volume>;
|
|
91
|
+
/**
|
|
92
|
+
* A user-allocated, writable, indexable number series — the value half of
|
|
93
|
+
* \`state.series(init)\`. Both a writable scalar slot (\`s.value = x\`) and
|
|
94
|
+
* an indexable \`Series<number>\` (\`s[1]\`, \`s.current\`, \`+s\`). Mirrors
|
|
95
|
+
* core's \`NumberSeriesSlot\`.
|
|
96
|
+
*/
|
|
97
|
+
export type NumberSeriesSlot = MutableSlot<number> & Series<number>;
|
|
98
|
+
/**
|
|
99
|
+
* The \`compute\`-facing bar (\`ComputeContext.bar\`): like \`Bar\` but the
|
|
100
|
+
* OHLCV + derived fields are indexable \`PriceSeries\` / \`VolumeSeries\`.
|
|
101
|
+
* Mirrors core's \`BarSeries\`.
|
|
102
|
+
*/
|
|
103
|
+
export type BarSeries = Omit<
|
|
104
|
+
Bar,
|
|
105
|
+
"open" | "high" | "low" | "close" | "volume" | "hl2" | "hlc3" | "ohlc4" | "hlcc4"
|
|
106
|
+
> & {
|
|
107
|
+
readonly open: PriceSeries;
|
|
108
|
+
readonly high: PriceSeries;
|
|
109
|
+
readonly low: PriceSeries;
|
|
110
|
+
readonly close: PriceSeries;
|
|
111
|
+
readonly volume: VolumeSeries;
|
|
112
|
+
readonly hl2: PriceSeries;
|
|
113
|
+
readonly hlc3: PriceSeries;
|
|
114
|
+
readonly ohlc4: PriceSeries;
|
|
115
|
+
readonly hlcc4: PriceSeries;
|
|
116
|
+
};
|
|
82
117
|
/**
|
|
83
118
|
* A \`ta.*\` source-position argument. The runtime
|
|
84
119
|
* (\`packages/runtime/src/ta/lib/sourceValue.ts\`) accepts either a
|
|
85
120
|
* series reference or a scalar; the script-author surface mirrors
|
|
86
|
-
* that contract so \`ta.ema(bar.close, 12)\`
|
|
87
|
-
* \`ta.ema(other, 12)\` (series) both typecheck.
|
|
121
|
+
* that contract so \`ta.ema(bar.close, 12)\` and
|
|
122
|
+
* \`ta.ema(other, 12)\` (series) both typecheck — \`bar.close\` is now a
|
|
123
|
+
* \`PriceSeries\` (\`Price & Series<Price>\`), assignable as both.
|
|
88
124
|
*/
|
|
89
125
|
export type ScalarOrSeries = Series<number> | number;
|
|
90
126
|
export type SmaOpts = Readonly<{ offset?: number }>;
|
|
@@ -103,6 +139,8 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
103
139
|
export type CrossunderOpts = Readonly<{ offset?: number }>;
|
|
104
140
|
export type HighestOpts = Readonly<{ offset?: number }>;
|
|
105
141
|
export type LowestOpts = Readonly<{ offset?: number }>;
|
|
142
|
+
export type HighestbarsOpts = Readonly<{ offset?: number }>;
|
|
143
|
+
export type LowestbarsOpts = Readonly<{ offset?: number }>;
|
|
106
144
|
export type ChangeOpts = Readonly<{ length?: number; offset?: number }>;
|
|
107
145
|
export type PlotLineStyle = "line" | "step" | "dashed" | "circles" | "cross";
|
|
108
146
|
export type WmaOpts = Readonly<{ offset?: number; lineStyle?: PlotLineStyle }>;
|
|
@@ -598,6 +636,12 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
598
636
|
nz(value: number, replacement?: number): number;
|
|
599
637
|
highest(source: ScalarOrSeries, length: number, opts?: HighestOpts): Series<number>;
|
|
600
638
|
lowest(source: ScalarOrSeries, length: number, opts?: LowestOpts): Series<number>;
|
|
639
|
+
highestbars(
|
|
640
|
+
source: ScalarOrSeries,
|
|
641
|
+
length: number,
|
|
642
|
+
opts?: HighestbarsOpts,
|
|
643
|
+
): Series<number>;
|
|
644
|
+
lowestbars(source: ScalarOrSeries, length: number, opts?: LowestbarsOpts): Series<number>;
|
|
601
645
|
change(source: ScalarOrSeries, opts?: ChangeOpts): Series<number>;
|
|
602
646
|
valuewhen(
|
|
603
647
|
condition: Series<boolean>,
|
|
@@ -778,6 +822,7 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
778
822
|
lineStyle?: LineStyle;
|
|
779
823
|
pane?: "overlay" | "new" | string;
|
|
780
824
|
style?: PlotOptsStyle;
|
|
825
|
+
z?: number;
|
|
781
826
|
}>;
|
|
782
827
|
export type HLineOpts = Readonly<{
|
|
783
828
|
color?: Color;
|
|
@@ -957,6 +1002,7 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
957
1002
|
int(init: number): MutableSlot<number>;
|
|
958
1003
|
bool(init: boolean): MutableSlot<boolean>;
|
|
959
1004
|
string(init: string): MutableSlot<string>;
|
|
1005
|
+
series(init: number): NumberSeriesSlot;
|
|
960
1006
|
tick: Readonly<{
|
|
961
1007
|
float(init: number): MutableSlot<number>;
|
|
962
1008
|
int(init: number): MutableSlot<number>;
|
|
@@ -1021,10 +1067,17 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1021
1067
|
readonly symbol: Series<string>;
|
|
1022
1068
|
readonly interval: Series<string>;
|
|
1023
1069
|
}>;
|
|
1024
|
-
export type
|
|
1070
|
+
export type SecurityExpr = (bar: SecurityBar) => Series<number> | number;
|
|
1071
|
+
// Declared as an interface (not a Readonly object type) so the two
|
|
1072
|
+
// security overloads survive. Readonly is a homomorphic mapped type, and
|
|
1073
|
+
// mapping over a member with multiple call signatures collapses it to a
|
|
1074
|
+
// single signature — which made the expression form fail type-check with
|
|
1075
|
+
// TS2554 ("Expected 1 arguments, but got 2").
|
|
1076
|
+
export interface RequestNamespace {
|
|
1025
1077
|
security(opts: RequestSecurityOpts): SecurityBar;
|
|
1078
|
+
security(opts: RequestSecurityOpts, expr: SecurityExpr): Series<number>;
|
|
1026
1079
|
lowerTf(opts: RequestLowerTfOpts): Series<ReadonlyArray<Bar>>;
|
|
1027
|
-
}
|
|
1080
|
+
}
|
|
1028
1081
|
export const request: RequestNamespace;
|
|
1029
1082
|
export function intervalToSeconds(d: IntervalDescriptor): number;
|
|
1030
1083
|
export type OutputDeclaration = Readonly<{
|
|
@@ -1036,6 +1089,11 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1036
1089
|
readonly kind: PlotKind;
|
|
1037
1090
|
readonly title?: string;
|
|
1038
1091
|
}>;
|
|
1092
|
+
export type SecurityExpressionDescriptor = Readonly<{
|
|
1093
|
+
readonly slotId: string;
|
|
1094
|
+
readonly interval: string;
|
|
1095
|
+
readonly paramName: string;
|
|
1096
|
+
}>;
|
|
1039
1097
|
export type DependencyDeclaration = Readonly<{
|
|
1040
1098
|
readonly localId: string;
|
|
1041
1099
|
readonly producerName: string;
|
|
@@ -1067,6 +1125,7 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1067
1125
|
readonly dependencies?: ReadonlyArray<DependencyDeclaration>;
|
|
1068
1126
|
readonly outputs?: ReadonlyArray<OutputDeclaration>;
|
|
1069
1127
|
readonly plots?: ReadonlyArray<PlotSlotDescriptor>;
|
|
1128
|
+
readonly securityExpressions?: ReadonlyArray<SecurityExpressionDescriptor>;
|
|
1070
1129
|
readonly exportName?: string;
|
|
1071
1130
|
readonly siblings?: ReadonlyArray<ScriptManifest>;
|
|
1072
1131
|
readonly isDrawn?: boolean;
|
|
@@ -1099,29 +1158,35 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1099
1158
|
WorldPoint,
|
|
1100
1159
|
WorldPoint,
|
|
1101
1160
|
];
|
|
1102
|
-
|
|
1161
|
+
// Render-order mixin — intersected into every \`draw.*\` opts bag in
|
|
1162
|
+
// lockstep with core's \`drawingStyle.ts\` \`ZOrdered\`. \`z\` is a
|
|
1163
|
+
// presentation-only render-order key (default 0, higher on top); it is
|
|
1164
|
+
// a type/contract addition only, so the shim just surfaces the optional
|
|
1165
|
+
// field for type-checking.
|
|
1166
|
+
export type ZOrdered = Readonly<{ z?: number }>;
|
|
1167
|
+
export type LineDrawStyle = ZOrdered & Readonly<{
|
|
1103
1168
|
color?: Color;
|
|
1104
1169
|
lineWidth?: number;
|
|
1105
1170
|
lineStyle?: LineStyle;
|
|
1106
1171
|
extendLeft?: boolean;
|
|
1107
1172
|
extendRight?: boolean;
|
|
1108
1173
|
}>;
|
|
1109
|
-
export type ShapeStyle = Readonly<{
|
|
1174
|
+
export type ShapeStyle = ZOrdered & Readonly<{
|
|
1110
1175
|
stroke?: Color;
|
|
1111
1176
|
fill?: Color;
|
|
1112
1177
|
lineWidth?: number;
|
|
1113
1178
|
lineStyle?: LineStyle;
|
|
1114
1179
|
fillAlpha?: number;
|
|
1115
1180
|
}>;
|
|
1116
|
-
export type HighlighterStyle = Readonly<{
|
|
1181
|
+
export type HighlighterStyle = ZOrdered & Readonly<{
|
|
1117
1182
|
color: Color;
|
|
1118
1183
|
alpha: number;
|
|
1119
1184
|
}>;
|
|
1120
|
-
export type BrushStyle = Readonly<{
|
|
1185
|
+
export type BrushStyle = ZOrdered & Readonly<{
|
|
1121
1186
|
stroke: Color;
|
|
1122
1187
|
fill: Color;
|
|
1123
1188
|
}>;
|
|
1124
|
-
export type TextOpts = Readonly<{
|
|
1189
|
+
export type TextOpts = ZOrdered & Readonly<{
|
|
1125
1190
|
color?: Color;
|
|
1126
1191
|
size?: "tiny" | "small" | "normal" | "large" | "huge";
|
|
1127
1192
|
halign?: "left" | "center" | "right";
|
|
@@ -1129,26 +1194,33 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1129
1194
|
bgColor?: Color;
|
|
1130
1195
|
}>;
|
|
1131
1196
|
export type ArrowOpts = LineDrawStyle & Readonly<{ label?: string }>;
|
|
1132
|
-
export type ArrowMarkerOpts = Readonly<{
|
|
1197
|
+
export type ArrowMarkerOpts = ZOrdered & Readonly<{
|
|
1133
1198
|
color?: Color;
|
|
1134
1199
|
text?: string;
|
|
1135
1200
|
}>;
|
|
1136
1201
|
export type PathOpts = LineDrawStyle & Readonly<{ closed?: boolean }>;
|
|
1137
|
-
export type
|
|
1202
|
+
export type FillBetweenStyle = ZOrdered & Readonly<{
|
|
1203
|
+
color?: Color;
|
|
1204
|
+
lineWidth?: number;
|
|
1205
|
+
lineStyle?: LineStyle;
|
|
1206
|
+
fill?: Color;
|
|
1207
|
+
fillAlpha?: number;
|
|
1208
|
+
}>;
|
|
1209
|
+
export type FibOpts = ZOrdered & Readonly<{
|
|
1138
1210
|
levels?: ReadonlyArray<number>;
|
|
1139
1211
|
showLabels?: boolean;
|
|
1140
1212
|
color?: Color;
|
|
1141
1213
|
extendLeft?: boolean;
|
|
1142
1214
|
extendRight?: boolean;
|
|
1143
1215
|
}>;
|
|
1144
|
-
export type RegressionTrendOpts = Readonly<{
|
|
1216
|
+
export type RegressionTrendOpts = ZOrdered & Readonly<{
|
|
1145
1217
|
source?: "close" | "open" | "high" | "low" | "hl2" | "hlc3" | "ohlc4" | "hlcc4";
|
|
1146
1218
|
stdevMultiplier?: number;
|
|
1147
1219
|
showUpperBand?: boolean;
|
|
1148
1220
|
showLowerBand?: boolean;
|
|
1149
1221
|
color?: Color;
|
|
1150
1222
|
}>;
|
|
1151
|
-
export type FrameOpts = Readonly<{
|
|
1223
|
+
export type FrameOpts = ZOrdered & Readonly<{
|
|
1152
1224
|
label?: string;
|
|
1153
1225
|
bgColor?: Color;
|
|
1154
1226
|
}>;
|
|
@@ -1197,6 +1269,11 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1197
1269
|
circle(centre: WorldPoint, radiusAnchor: WorldPoint, opts?: ShapeStyle): DrawingHandle;
|
|
1198
1270
|
ellipse(a: WorldPoint, b: WorldPoint, opts?: ShapeStyle): DrawingHandle;
|
|
1199
1271
|
path(anchors: ReadonlyArray<WorldPoint>, opts?: PathOpts): DrawingHandle;
|
|
1272
|
+
fillBetween(
|
|
1273
|
+
edgeA: ReadonlyArray<WorldPoint>,
|
|
1274
|
+
edgeB: ReadonlyArray<WorldPoint>,
|
|
1275
|
+
opts?: FillBetweenStyle,
|
|
1276
|
+
): DrawingHandle;
|
|
1200
1277
|
marker(
|
|
1201
1278
|
anchor: WorldPoint,
|
|
1202
1279
|
opts?: TextOpts & Readonly<{ text?: string; value?: number }>,
|
|
@@ -1270,7 +1347,7 @@ declare module "@invinite-org/chartlang-core" {
|
|
|
1270
1347
|
};
|
|
1271
1348
|
export const draw: DrawNamespace;
|
|
1272
1349
|
export type ComputeContext = {
|
|
1273
|
-
readonly bar:
|
|
1350
|
+
readonly bar: BarSeries;
|
|
1274
1351
|
readonly inputs: Readonly<Record<string, unknown>>;
|
|
1275
1352
|
readonly ta: TaNamespace;
|
|
1276
1353
|
readonly plot: typeof plot;
|