openalgo-script 0.1.0-alpha.1 → 0.4.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 +1469 -0
- package/README.md +85 -30
- package/dist/adapters/charts/alerts.d.ts +70 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -0
- package/dist/adapters/charts/alerts.js +52 -0
- package/dist/adapters/charts/alerts.js.map +1 -0
- package/dist/adapters/charts/bars.d.ts +39 -0
- package/dist/adapters/charts/bars.d.ts.map +1 -0
- package/dist/adapters/charts/bars.js +32 -0
- package/dist/adapters/charts/bars.js.map +1 -0
- package/dist/adapters/charts/candles.d.ts +40 -0
- package/dist/adapters/charts/candles.d.ts.map +1 -0
- package/dist/adapters/charts/candles.js +85 -0
- package/dist/adapters/charts/candles.js.map +1 -0
- package/dist/adapters/charts/colours.d.ts +47 -0
- package/dist/adapters/charts/colours.d.ts.map +1 -0
- package/dist/adapters/charts/colours.js +80 -0
- package/dist/adapters/charts/colours.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +37 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -0
- package/dist/adapters/charts/columns.js +56 -0
- package/dist/adapters/charts/columns.js.map +1 -0
- package/dist/adapters/charts/contract.d.ts +278 -0
- package/dist/adapters/charts/contract.d.ts.map +1 -0
- package/dist/adapters/charts/contract.js +2 -0
- package/dist/adapters/charts/contract.js.map +1 -0
- package/dist/adapters/charts/descriptor.d.ts +48 -0
- package/dist/adapters/charts/descriptor.d.ts.map +1 -0
- package/dist/adapters/charts/descriptor.js +111 -0
- package/dist/adapters/charts/descriptor.js.map +1 -0
- package/dist/adapters/charts/drawings.d.ts +43 -0
- package/dist/adapters/charts/drawings.d.ts.map +1 -0
- package/dist/adapters/charts/drawings.js +172 -0
- package/dist/adapters/charts/drawings.js.map +1 -0
- package/dist/adapters/charts/errors.d.ts +28 -0
- package/dist/adapters/charts/errors.d.ts.map +1 -0
- package/dist/adapters/charts/errors.js +21 -0
- package/dist/adapters/charts/errors.js.map +1 -0
- package/dist/adapters/charts/fields.d.ts +33 -0
- package/dist/adapters/charts/fields.d.ts.map +1 -0
- package/dist/adapters/charts/fields.js +51 -0
- package/dist/adapters/charts/fields.js.map +1 -0
- package/dist/adapters/charts/fills.d.ts +23 -0
- package/dist/adapters/charts/fills.d.ts.map +1 -0
- package/dist/adapters/charts/fills.js +48 -0
- package/dist/adapters/charts/fills.js.map +1 -0
- package/dist/adapters/charts/index.d.ts +37 -0
- package/dist/adapters/charts/index.d.ts.map +1 -0
- package/dist/adapters/charts/index.js +33 -0
- package/dist/adapters/charts/index.js.map +1 -0
- package/dist/adapters/charts/levels.d.ts +39 -0
- package/dist/adapters/charts/levels.d.ts.map +1 -0
- package/dist/adapters/charts/levels.js +61 -0
- package/dist/adapters/charts/levels.js.map +1 -0
- package/dist/adapters/charts/markers.d.ts +41 -0
- package/dist/adapters/charts/markers.d.ts.map +1 -0
- package/dist/adapters/charts/markers.js +75 -0
- package/dist/adapters/charts/markers.js.map +1 -0
- package/dist/adapters/charts/paint.d.ts +61 -0
- package/dist/adapters/charts/paint.d.ts.map +1 -0
- package/dist/adapters/charts/paint.js +47 -0
- package/dist/adapters/charts/paint.js.map +1 -0
- package/dist/adapters/charts/plots.d.ts +39 -0
- package/dist/adapters/charts/plots.d.ts.map +1 -0
- package/dist/adapters/charts/plots.js +117 -0
- package/dist/adapters/charts/plots.js.map +1 -0
- package/dist/adapters/charts/produced.d.ts +57 -0
- package/dist/adapters/charts/produced.d.ts.map +1 -0
- package/dist/adapters/charts/produced.js +11 -0
- package/dist/adapters/charts/produced.js.map +1 -0
- package/dist/adapters/charts/requests.d.ts +114 -0
- package/dist/adapters/charts/requests.d.ts.map +1 -0
- package/dist/adapters/charts/requests.js +277 -0
- package/dist/adapters/charts/requests.js.map +1 -0
- package/dist/adapters/charts/run.d.ts +147 -0
- package/dist/adapters/charts/run.d.ts.map +1 -0
- package/dist/adapters/charts/run.js +148 -0
- package/dist/adapters/charts/run.js.map +1 -0
- package/dist/adapters/charts/settings.d.ts +78 -0
- package/dist/adapters/charts/settings.d.ts.map +1 -0
- package/dist/adapters/charts/settings.js +225 -0
- package/dist/adapters/charts/settings.js.map +1 -0
- package/dist/adapters/charts/surfaces.d.ts +221 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -0
- package/dist/adapters/charts/surfaces.js +2 -0
- package/dist/adapters/charts/surfaces.js.map +1 -0
- package/dist/adapters/charts/tables.d.ts +65 -0
- package/dist/adapters/charts/tables.d.ts.map +1 -0
- package/dist/adapters/charts/tables.js +166 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/adapters/codemirror/commands.d.ts +14 -0
- package/dist/adapters/codemirror/commands.d.ts.map +1 -0
- package/dist/adapters/codemirror/commands.js +52 -0
- package/dist/adapters/codemirror/commands.js.map +1 -0
- package/dist/adapters/codemirror/completion.d.ts +15 -0
- package/dist/adapters/codemirror/completion.d.ts.map +1 -0
- package/dist/adapters/codemirror/completion.js +64 -0
- package/dist/adapters/codemirror/completion.js.map +1 -0
- package/dist/adapters/codemirror/contract.d.ts +156 -0
- package/dist/adapters/codemirror/contract.d.ts.map +1 -0
- package/dist/adapters/codemirror/contract.js +42 -0
- package/dist/adapters/codemirror/contract.js.map +1 -0
- package/dist/adapters/codemirror/index.d.ts +43 -0
- package/dist/adapters/codemirror/index.d.ts.map +1 -0
- package/dist/adapters/codemirror/index.js +8 -0
- package/dist/adapters/codemirror/index.js.map +1 -0
- package/dist/adapters/codemirror/lint.d.ts +17 -0
- package/dist/adapters/codemirror/lint.d.ts.map +1 -0
- package/dist/adapters/codemirror/lint.js +62 -0
- package/dist/adapters/codemirror/lint.js.map +1 -0
- package/dist/adapters/codemirror/positions.d.ts +16 -0
- package/dist/adapters/codemirror/positions.d.ts.map +1 -0
- package/dist/adapters/codemirror/positions.js +65 -0
- package/dist/adapters/codemirror/positions.js.map +1 -0
- package/dist/adapters/codemirror/stream.d.ts +23 -0
- package/dist/adapters/codemirror/stream.d.ts.map +1 -0
- package/dist/adapters/codemirror/stream.js +70 -0
- package/dist/adapters/codemirror/stream.js.map +1 -0
- package/dist/adapters/codemirror/tokens.d.ts +44 -0
- package/dist/adapters/codemirror/tokens.d.ts.map +1 -0
- package/dist/adapters/codemirror/tokens.js +34 -0
- package/dist/adapters/codemirror/tokens.js.map +1 -0
- package/dist/adapters/codemirror/tooltips.d.ts +35 -0
- package/dist/adapters/codemirror/tooltips.d.ts.map +1 -0
- package/dist/adapters/codemirror/tooltips.js +108 -0
- package/dist/adapters/codemirror/tooltips.js.map +1 -0
- package/dist/core/accounting/charges.d.ts +136 -0
- package/dist/core/accounting/charges.d.ts.map +1 -0
- package/dist/core/accounting/charges.js +362 -0
- package/dist/core/accounting/charges.js.map +1 -0
- package/dist/core/accounting/equity.d.ts +158 -0
- package/dist/core/accounting/equity.d.ts.map +1 -0
- package/dist/core/accounting/equity.js +155 -0
- package/dist/core/accounting/equity.js.map +1 -0
- package/dist/core/accounting/index.d.ts +44 -0
- package/dist/core/accounting/index.d.ts.map +1 -0
- package/dist/core/accounting/index.js +36 -0
- package/dist/core/accounting/index.js.map +1 -0
- package/dist/core/accounting/markers.d.ts +43 -0
- package/dist/core/accounting/markers.d.ts.map +1 -0
- package/dist/core/accounting/markers.js +64 -0
- package/dist/core/accounting/markers.js.map +1 -0
- package/dist/core/accounting/monthly.d.ts +52 -0
- package/dist/core/accounting/monthly.d.ts.map +1 -0
- package/dist/core/accounting/monthly.js +99 -0
- package/dist/core/accounting/monthly.js.map +1 -0
- package/dist/core/accounting/report.d.ts +38 -0
- package/dist/core/accounting/report.d.ts.map +1 -0
- package/dist/core/accounting/report.js +63 -0
- package/dist/core/accounting/report.js.map +1 -0
- package/dist/core/accounting/shapes.d.ts +70 -0
- package/dist/core/accounting/shapes.d.ts.map +1 -0
- package/dist/core/accounting/shapes.js +21 -0
- package/dist/core/accounting/shapes.js.map +1 -0
- package/dist/core/accounting/statistics.d.ts +75 -0
- package/dist/core/accounting/statistics.d.ts.map +1 -0
- package/dist/core/accounting/statistics.js +246 -0
- package/dist/core/accounting/statistics.js.map +1 -0
- package/dist/core/accounting/trades.d.ts +118 -0
- package/dist/core/accounting/trades.d.ts.map +1 -0
- package/dist/core/accounting/trades.js +186 -0
- package/dist/core/accounting/trades.js.map +1 -0
- package/dist/core/backtest/compare.d.ts +38 -0
- package/dist/core/backtest/compare.d.ts.map +1 -0
- package/dist/core/backtest/compare.js +189 -0
- package/dist/core/backtest/compare.js.map +1 -0
- package/dist/core/backtest/declaration.d.ts +52 -0
- package/dist/core/backtest/declaration.d.ts.map +1 -0
- package/dist/core/backtest/declaration.js +48 -0
- package/dist/core/backtest/declaration.js.map +1 -0
- package/dist/core/backtest/drive.d.ts +29 -0
- package/dist/core/backtest/drive.d.ts.map +1 -0
- package/dist/core/backtest/drive.js +262 -0
- package/dist/core/backtest/drive.js.map +1 -0
- package/dist/core/backtest/index.d.ts +46 -0
- package/dist/core/backtest/index.d.ts.map +1 -0
- package/dist/core/backtest/index.js +36 -0
- package/dist/core/backtest/index.js.map +1 -0
- package/dist/core/backtest/range.d.ts +84 -0
- package/dist/core/backtest/range.d.ts.map +1 -0
- package/dist/core/backtest/range.js +90 -0
- package/dist/core/backtest/range.js.map +1 -0
- package/dist/core/backtest/record.d.ts +238 -0
- package/dist/core/backtest/record.d.ts.map +1 -0
- package/dist/core/backtest/record.js +176 -0
- package/dist/core/backtest/record.js.map +1 -0
- package/dist/core/backtest/replay.d.ts +48 -0
- package/dist/core/backtest/replay.d.ts.map +1 -0
- package/dist/core/backtest/replay.js +127 -0
- package/dist/core/backtest/replay.js.map +1 -0
- package/dist/core/backtest/resting.d.ts +62 -0
- package/dist/core/backtest/resting.d.ts.map +1 -0
- package/dist/core/backtest/resting.js +59 -0
- package/dist/core/backtest/resting.js.map +1 -0
- package/dist/core/backtest/settings.d.ts +117 -0
- package/dist/core/backtest/settings.d.ts.map +1 -0
- package/dist/core/backtest/settings.js +207 -0
- package/dist/core/backtest/settings.js.map +1 -0
- package/dist/core/backtest/simulate.d.ts +146 -0
- package/dist/core/backtest/simulate.d.ts.map +1 -0
- package/dist/core/backtest/simulate.js +217 -0
- package/dist/core/backtest/simulate.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +164 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +23 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +49 -0
- package/dist/core/catalogue/values.generated.d.ts.map +1 -1
- package/dist/core/check/arguments.d.ts +41 -0
- package/dist/core/check/arguments.d.ts.map +1 -0
- package/dist/core/check/arguments.js +84 -0
- package/dist/core/check/arguments.js.map +1 -0
- package/dist/core/check/call-sites.d.ts +22 -0
- package/dist/core/check/call-sites.d.ts.map +1 -0
- package/dist/core/check/call-sites.js +329 -0
- package/dist/core/check/call-sites.js.map +1 -0
- package/dist/core/check/call-warmup.d.ts +37 -0
- package/dist/core/check/call-warmup.d.ts.map +1 -0
- package/dist/core/check/call-warmup.js +97 -0
- package/dist/core/check/call-warmup.js.map +1 -0
- package/dist/core/check/calls.d.ts +33 -0
- package/dist/core/check/calls.d.ts.map +1 -0
- package/dist/core/check/calls.js +348 -0
- package/dist/core/check/calls.js.map +1 -0
- package/dist/core/check/check.d.ts +23 -0
- package/dist/core/check/check.d.ts.map +1 -0
- package/dist/core/check/check.js +163 -0
- package/dist/core/check/check.js.map +1 -0
- package/dist/core/check/checked.d.ts +198 -0
- package/dist/core/check/checked.d.ts.map +1 -0
- package/dist/core/check/checked.js +19 -0
- package/dist/core/check/checked.js.map +1 -0
- package/dist/core/check/checker.d.ts +182 -0
- package/dist/core/check/checker.d.ts.map +1 -0
- package/dist/core/check/checker.js +280 -0
- package/dist/core/check/checker.js.map +1 -0
- package/dist/core/check/conditional.d.ts +35 -0
- package/dist/core/check/conditional.d.ts.map +1 -0
- package/dist/core/check/conditional.js +100 -0
- package/dist/core/check/conditional.js.map +1 -0
- package/dist/core/check/constant.d.ts +47 -0
- package/dist/core/check/constant.d.ts.map +1 -0
- package/dist/core/check/constant.js +101 -0
- package/dist/core/check/constant.js.map +1 -0
- package/dist/core/check/declaration.d.ts +33 -0
- package/dist/core/check/declaration.d.ts.map +1 -0
- package/dist/core/check/declaration.js +181 -0
- package/dist/core/check/declaration.js.map +1 -0
- package/dist/core/check/expressions.d.ts +36 -0
- package/dist/core/check/expressions.d.ts.map +1 -0
- package/dist/core/check/expressions.js +398 -0
- package/dist/core/check/expressions.js.map +1 -0
- package/dist/core/check/functions.d.ts +31 -0
- package/dist/core/check/functions.d.ts.map +1 -0
- package/dist/core/check/functions.js +238 -0
- package/dist/core/check/functions.js.map +1 -0
- package/dist/core/check/handles.d.ts +48 -0
- package/dist/core/check/handles.d.ts.map +1 -0
- package/dist/core/check/handles.js +43 -0
- package/dist/core/check/handles.js.map +1 -0
- package/dist/core/check/index.d.ts +31 -0
- package/dist/core/check/index.d.ts.map +1 -0
- package/dist/core/check/index.js +26 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/library-bars.d.ts +7 -0
- package/dist/core/check/library-bars.d.ts.map +1 -0
- package/dist/core/check/library-bars.js +181 -0
- package/dist/core/check/library-bars.js.map +1 -0
- package/dist/core/check/library-orders.d.ts +5 -0
- package/dist/core/check/library-orders.d.ts.map +1 -0
- package/dist/core/check/library-orders.js +250 -0
- package/dist/core/check/library-orders.js.map +1 -0
- package/dist/core/check/library-output.d.ts +7 -0
- package/dist/core/check/library-output.d.ts.map +1 -0
- package/dist/core/check/library-output.js +195 -0
- package/dist/core/check/library-output.js.map +1 -0
- package/dist/core/check/library-prose.generated.d.ts +16 -0
- package/dist/core/check/library-prose.generated.d.ts.map +1 -0
- package/dist/core/check/library-prose.generated.js +353 -0
- package/dist/core/check/library-prose.generated.js.map +1 -0
- package/dist/core/check/library-series.d.ts +3 -0
- package/dist/core/check/library-series.d.ts.map +1 -0
- package/dist/core/check/library-series.js +415 -0
- package/dist/core/check/library-series.js.map +1 -0
- package/dist/core/check/library.d.ts +204 -0
- package/dist/core/check/library.d.ts.map +1 -0
- package/dist/core/check/library.js +198 -0
- package/dist/core/check/library.js.map +1 -0
- package/dist/core/check/literals.d.ts +19 -0
- package/dist/core/check/literals.d.ts.map +1 -0
- package/dist/core/check/literals.js +22 -0
- package/dist/core/check/literals.js.map +1 -0
- package/dist/core/check/outputs.d.ts +31 -0
- package/dist/core/check/outputs.d.ts.map +1 -0
- package/dist/core/check/outputs.js +113 -0
- package/dist/core/check/outputs.js.map +1 -0
- package/dist/core/check/statements.d.ts +25 -0
- package/dist/core/check/statements.d.ts.map +1 -0
- package/dist/core/check/statements.js +377 -0
- package/dist/core/check/statements.js.map +1 -0
- package/dist/core/check/suggest.d.ts +25 -0
- package/dist/core/check/suggest.d.ts.map +1 -0
- package/dist/core/check/suggest.js +61 -0
- package/dist/core/check/suggest.js.map +1 -0
- package/dist/core/check/surface.d.ts +62 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +129 -0
- package/dist/core/check/surface.js.map +1 -0
- package/dist/core/check/tags.d.ts +4 -0
- package/dist/core/check/tags.d.ts.map +1 -0
- package/dist/core/check/tags.js +54 -0
- package/dist/core/check/tags.js.map +1 -0
- package/dist/core/check/types.d.ts +153 -0
- package/dist/core/check/types.d.ts.map +1 -0
- package/dist/core/check/types.js +221 -0
- package/dist/core/check/types.js.map +1 -0
- package/dist/core/check/warmup.d.ts +73 -0
- package/dist/core/check/warmup.d.ts.map +1 -0
- package/dist/core/check/warmup.js +62 -0
- package/dist/core/check/warmup.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +12 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -1
- package/dist/core/diagnostics/collector.js +27 -1
- package/dist/core/diagnostics/collector.js.map +1 -1
- package/dist/core/emit/calls.d.ts +38 -0
- package/dist/core/emit/calls.d.ts.map +1 -0
- package/dist/core/emit/calls.js +347 -0
- package/dist/core/emit/calls.js.map +1 -0
- package/dist/core/emit/canonical.d.ts +39 -0
- package/dist/core/emit/canonical.d.ts.map +1 -0
- package/dist/core/emit/canonical.js +71 -0
- package/dist/core/emit/canonical.js.map +1 -0
- package/dist/core/emit/channels.d.ts +28 -0
- package/dist/core/emit/channels.d.ts.map +1 -0
- package/dist/core/emit/channels.js +110 -0
- package/dist/core/emit/channels.js.map +1 -0
- package/dist/core/emit/code.d.ts +75 -0
- package/dist/core/emit/code.d.ts.map +1 -0
- package/dist/core/emit/code.js +104 -0
- package/dist/core/emit/code.js.map +1 -0
- package/dist/core/emit/colours.d.ts +35 -0
- package/dist/core/emit/colours.d.ts.map +1 -0
- package/dist/core/emit/colours.js +50 -0
- package/dist/core/emit/colours.js.map +1 -0
- package/dist/core/emit/context.d.ts +271 -0
- package/dist/core/emit/context.d.ts.map +1 -0
- package/dist/core/emit/context.js +358 -0
- package/dist/core/emit/context.js.map +1 -0
- package/dist/core/emit/defaults.d.ts +64 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +182 -0
- package/dist/core/emit/defaults.js.map +1 -0
- package/dist/core/emit/emit.d.ts +13 -0
- package/dist/core/emit/emit.d.ts.map +1 -0
- package/dist/core/emit/emit.js +281 -0
- package/dist/core/emit/emit.js.map +1 -0
- package/dist/core/emit/events.d.ts +21 -0
- package/dist/core/emit/events.d.ts.map +1 -0
- package/dist/core/emit/events.js +112 -0
- package/dist/core/emit/events.js.map +1 -0
- package/dist/core/emit/expressions.d.ts +23 -0
- package/dist/core/emit/expressions.d.ts.map +1 -0
- package/dist/core/emit/expressions.js +253 -0
- package/dist/core/emit/expressions.js.map +1 -0
- package/dist/core/emit/functions.d.ts +30 -0
- package/dist/core/emit/functions.d.ts.map +1 -0
- package/dist/core/emit/functions.js +171 -0
- package/dist/core/emit/functions.js.map +1 -0
- package/dist/core/emit/gaps.d.ts +34 -0
- package/dist/core/emit/gaps.d.ts.map +1 -0
- package/dist/core/emit/gaps.js +16 -0
- package/dist/core/emit/gaps.js.map +1 -0
- package/dist/core/emit/index.d.ts +31 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +25 -0
- package/dist/core/emit/index.js.map +1 -0
- package/dist/core/emit/inputs.d.ts +47 -0
- package/dist/core/emit/inputs.d.ts.map +1 -0
- package/dist/core/emit/inputs.js +150 -0
- package/dist/core/emit/inputs.js.map +1 -0
- package/dist/core/emit/layout.d.ts +73 -0
- package/dist/core/emit/layout.d.ts.map +1 -0
- package/dist/core/emit/layout.js +126 -0
- package/dist/core/emit/layout.js.map +1 -0
- package/dist/core/emit/meta.d.ts +14 -0
- package/dist/core/emit/meta.d.ts.map +1 -0
- package/dist/core/emit/meta.js +68 -0
- package/dist/core/emit/meta.js.map +1 -0
- package/dist/core/emit/opcodes.d.ts +28 -0
- package/dist/core/emit/opcodes.d.ts.map +1 -0
- package/dist/core/emit/opcodes.js +137 -0
- package/dist/core/emit/opcodes.js.map +1 -0
- package/dist/core/emit/outputs.d.ts +67 -0
- package/dist/core/emit/outputs.d.ts.map +1 -0
- package/dist/core/emit/outputs.js +293 -0
- package/dist/core/emit/outputs.js.map +1 -0
- package/dist/core/emit/pool.d.ts +33 -0
- package/dist/core/emit/pool.d.ts.map +1 -0
- package/dist/core/emit/pool.js +79 -0
- package/dist/core/emit/pool.js.map +1 -0
- package/dist/core/emit/program.d.ts +333 -0
- package/dist/core/emit/program.d.ts.map +1 -0
- package/dist/core/emit/program.js +15 -0
- package/dist/core/emit/program.js.map +1 -0
- package/dist/core/emit/registers.d.ts +35 -0
- package/dist/core/emit/registers.d.ts.map +1 -0
- package/dist/core/emit/registers.js +170 -0
- package/dist/core/emit/registers.js.map +1 -0
- package/dist/core/emit/request-scope.d.ts +36 -0
- package/dist/core/emit/request-scope.d.ts.map +1 -0
- package/dist/core/emit/request-scope.js +41 -0
- package/dist/core/emit/request-scope.js.map +1 -0
- package/dist/core/emit/requests.d.ts +69 -0
- package/dist/core/emit/requests.d.ts.map +1 -0
- package/dist/core/emit/requests.js +230 -0
- package/dist/core/emit/requests.js.map +1 -0
- package/dist/core/emit/requires.d.ts +4 -0
- package/dist/core/emit/requires.d.ts.map +1 -0
- package/dist/core/emit/requires.js +71 -0
- package/dist/core/emit/requires.js.map +1 -0
- package/dist/core/emit/sha256.d.ts +24 -0
- package/dist/core/emit/sha256.d.ts.map +1 -0
- package/dist/core/emit/sha256.js +109 -0
- package/dist/core/emit/sha256.js.map +1 -0
- package/dist/core/emit/statements.d.ts +20 -0
- package/dist/core/emit/statements.d.ts.map +1 -0
- package/dist/core/emit/statements.js +393 -0
- package/dist/core/emit/statements.js.map +1 -0
- package/dist/core/emit/values.d.ts +80 -0
- package/dist/core/emit/values.d.ts.map +1 -0
- package/dist/core/emit/values.js +242 -0
- package/dist/core/emit/values.js.map +1 -0
- package/dist/core/engine/alerts.d.ts +66 -0
- package/dist/core/engine/alerts.d.ts.map +1 -0
- package/dist/core/engine/alerts.js +119 -0
- package/dist/core/engine/alerts.js.map +1 -0
- package/dist/core/engine/arithmetic.d.ts +82 -0
- package/dist/core/engine/arithmetic.d.ts.map +1 -0
- package/dist/core/engine/arithmetic.js +141 -0
- package/dist/core/engine/arithmetic.js.map +1 -0
- package/dist/core/engine/bars.d.ts +95 -0
- package/dist/core/engine/bars.d.ts.map +1 -0
- package/dist/core/engine/bars.js +133 -0
- package/dist/core/engine/bars.js.map +1 -0
- package/dist/core/engine/budget.d.ts +162 -0
- package/dist/core/engine/budget.d.ts.map +1 -0
- package/dist/core/engine/budget.js +188 -0
- package/dist/core/engine/budget.js.map +1 -0
- package/dist/core/engine/channels.d.ts +106 -0
- package/dist/core/engine/channels.d.ts.map +1 -0
- package/dist/core/engine/channels.js +99 -0
- package/dist/core/engine/channels.js.map +1 -0
- package/dist/core/engine/drawings.d.ts +64 -0
- package/dist/core/engine/drawings.d.ts.map +1 -0
- package/dist/core/engine/drawings.js +67 -0
- package/dist/core/engine/drawings.js.map +1 -0
- package/dist/core/engine/engine.d.ts +140 -0
- package/dist/core/engine/engine.d.ts.map +1 -0
- package/dist/core/engine/engine.js +405 -0
- package/dist/core/engine/engine.js.map +1 -0
- package/dist/core/engine/errors.d.ts +64 -0
- package/dist/core/engine/errors.d.ts.map +1 -0
- package/dist/core/engine/errors.js +63 -0
- package/dist/core/engine/errors.js.map +1 -0
- package/dist/core/engine/frames.d.ts +48 -0
- package/dist/core/engine/frames.d.ts.map +1 -0
- package/dist/core/engine/frames.js +41 -0
- package/dist/core/engine/frames.js.map +1 -0
- package/dist/core/engine/grids.d.ts +25 -0
- package/dist/core/engine/grids.d.ts.map +1 -0
- package/dist/core/engine/grids.js +77 -0
- package/dist/core/engine/grids.js.map +1 -0
- package/dist/core/engine/guard.d.ts +4 -0
- package/dist/core/engine/guard.d.ts.map +1 -0
- package/dist/core/engine/guard.js +46 -0
- package/dist/core/engine/guard.js.map +1 -0
- package/dist/core/engine/host.d.ts +219 -0
- package/dist/core/engine/host.d.ts.map +1 -0
- package/dist/core/engine/host.js +38 -0
- package/dist/core/engine/host.js.map +1 -0
- package/dist/core/engine/index.d.ts +49 -0
- package/dist/core/engine/index.d.ts.map +1 -0
- package/dist/core/engine/index.js +33 -0
- package/dist/core/engine/index.js.map +1 -0
- package/dist/core/engine/inputs.d.ts +77 -0
- package/dist/core/engine/inputs.d.ts.map +1 -0
- package/dist/core/engine/inputs.js +205 -0
- package/dist/core/engine/inputs.js.map +1 -0
- package/dist/core/engine/ledger/call.d.ts +63 -0
- package/dist/core/engine/ledger/call.d.ts.map +1 -0
- package/dist/core/engine/ledger/call.js +136 -0
- package/dist/core/engine/ledger/call.js.map +1 -0
- package/dist/core/engine/ledger/closable.d.ts +155 -0
- package/dist/core/engine/ledger/closable.d.ts.map +1 -0
- package/dist/core/engine/ledger/closable.js +173 -0
- package/dist/core/engine/ledger/closable.js.map +1 -0
- package/dist/core/engine/ledger/holdings.d.ts +194 -0
- package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
- package/dist/core/engine/ledger/holdings.js +237 -0
- package/dist/core/engine/ledger/holdings.js.map +1 -0
- package/dist/core/engine/ledger/index.d.ts +19 -0
- package/dist/core/engine/ledger/index.d.ts.map +1 -0
- package/dist/core/engine/ledger/index.js +2 -0
- package/dist/core/engine/ledger/index.js.map +1 -0
- package/dist/core/engine/ledger/intent.d.ts +106 -0
- package/dist/core/engine/ledger/intent.d.ts.map +1 -0
- package/dist/core/engine/ledger/intent.js +21 -0
- package/dist/core/engine/ledger/intent.js.map +1 -0
- package/dist/core/engine/ledger/ledger.d.ts +143 -0
- package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
- package/dist/core/engine/ledger/ledger.js +237 -0
- package/dist/core/engine/ledger/ledger.js.map +1 -0
- package/dist/core/engine/ledger/place.d.ts +75 -0
- package/dist/core/engine/ledger/place.d.ts.map +1 -0
- package/dist/core/engine/ledger/place.js +174 -0
- package/dist/core/engine/ledger/place.js.map +1 -0
- package/dist/core/engine/ledger/positions.d.ts +68 -0
- package/dist/core/engine/ledger/positions.d.ts.map +1 -0
- package/dist/core/engine/ledger/positions.js +114 -0
- package/dist/core/engine/ledger/positions.js.map +1 -0
- package/dist/core/engine/ledger/refuse.d.ts +43 -0
- package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
- package/dist/core/engine/ledger/refuse.js +329 -0
- package/dist/core/engine/ledger/refuse.js.map +1 -0
- package/dist/core/engine/ledger/row.d.ts +176 -0
- package/dist/core/engine/ledger/row.d.ts.map +1 -0
- package/dist/core/engine/ledger/row.js +169 -0
- package/dist/core/engine/ledger/row.js.map +1 -0
- package/dist/core/engine/ledger/sizing.d.ts +142 -0
- package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
- package/dist/core/engine/ledger/sizing.js +223 -0
- package/dist/core/engine/ledger/sizing.js.map +1 -0
- package/dist/core/engine/library/arrays.d.ts +14 -0
- package/dist/core/engine/library/arrays.d.ts.map +1 -0
- package/dist/core/engine/library/arrays.js +285 -0
- package/dist/core/engine/library/arrays.js.map +1 -0
- package/dist/core/engine/library/averages.d.ts +9 -0
- package/dist/core/engine/library/averages.d.ts.map +1 -0
- package/dist/core/engine/library/averages.js +41 -0
- package/dist/core/engine/library/averages.js.map +1 -0
- package/dist/core/engine/library/binding.d.ts +230 -0
- package/dist/core/engine/library/binding.d.ts.map +1 -0
- package/dist/core/engine/library/binding.js +109 -0
- package/dist/core/engine/library/binding.js.map +1 -0
- package/dist/core/engine/library/chart.d.ts +3 -0
- package/dist/core/engine/library/chart.d.ts.map +1 -0
- package/dist/core/engine/library/chart.js +83 -0
- package/dist/core/engine/library/chart.js.map +1 -0
- package/dist/core/engine/library/colours.d.ts +26 -0
- package/dist/core/engine/library/colours.d.ts.map +1 -0
- package/dist/core/engine/library/colours.js +81 -0
- package/dist/core/engine/library/colours.js.map +1 -0
- package/dist/core/engine/library/dates.d.ts +3 -0
- package/dist/core/engine/library/dates.d.ts.map +1 -0
- package/dist/core/engine/library/dates.js +75 -0
- package/dist/core/engine/library/dates.js.map +1 -0
- package/dist/core/engine/library/index.d.ts +13 -0
- package/dist/core/engine/library/index.d.ts.map +1 -0
- package/dist/core/engine/library/index.js +86 -0
- package/dist/core/engine/library/index.js.map +1 -0
- package/dist/core/engine/library/maths.d.ts +3 -0
- package/dist/core/engine/library/maths.d.ts.map +1 -0
- package/dist/core/engine/library/maths.js +89 -0
- package/dist/core/engine/library/maths.js.map +1 -0
- package/dist/core/engine/library/objects.d.ts +3 -0
- package/dist/core/engine/library/objects.d.ts.map +1 -0
- package/dist/core/engine/library/objects.js +199 -0
- package/dist/core/engine/library/objects.js.map +1 -0
- package/dist/core/engine/library/oscillators.d.ts +3 -0
- package/dist/core/engine/library/oscillators.d.ts.map +1 -0
- package/dist/core/engine/library/oscillators.js +29 -0
- package/dist/core/engine/library/oscillators.js.map +1 -0
- package/dist/core/engine/library/ranges.d.ts +3 -0
- package/dist/core/engine/library/ranges.d.ts.map +1 -0
- package/dist/core/engine/library/ranges.js +23 -0
- package/dist/core/engine/library/ranges.js.map +1 -0
- package/dist/core/engine/library/series.d.ts +3 -0
- package/dist/core/engine/library/series.d.ts.map +1 -0
- package/dist/core/engine/library/series.js +46 -0
- package/dist/core/engine/library/series.js.map +1 -0
- package/dist/core/engine/library/state.d.ts +35 -0
- package/dist/core/engine/library/state.d.ts.map +1 -0
- package/dist/core/engine/library/state.js +19 -0
- package/dist/core/engine/library/state.js.map +1 -0
- package/dist/core/engine/library/studies.d.ts +3 -0
- package/dist/core/engine/library/studies.d.ts.map +1 -0
- package/dist/core/engine/library/studies.js +35 -0
- package/dist/core/engine/library/studies.js.map +1 -0
- package/dist/core/engine/library/text.d.ts +6 -0
- package/dist/core/engine/library/text.d.ts.map +1 -0
- package/dist/core/engine/library/text.js +280 -0
- package/dist/core/engine/library/text.js.map +1 -0
- package/dist/core/engine/library/trend.d.ts +3 -0
- package/dist/core/engine/library/trend.d.ts.map +1 -0
- package/dist/core/engine/library/trend.js +29 -0
- package/dist/core/engine/library/trend.js.map +1 -0
- package/dist/core/engine/library/volume.d.ts +3 -0
- package/dist/core/engine/library/volume.d.ts.map +1 -0
- package/dist/core/engine/library/volume.js +51 -0
- package/dist/core/engine/library/volume.js.map +1 -0
- package/dist/core/engine/load.d.ts +59 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +61 -0
- package/dist/core/engine/load.js.map +1 -0
- package/dist/core/engine/machine.d.ts +107 -0
- package/dist/core/engine/machine.d.ts.map +1 -0
- package/dist/core/engine/machine.js +337 -0
- package/dist/core/engine/machine.js.map +1 -0
- package/dist/core/engine/memory.d.ts +60 -0
- package/dist/core/engine/memory.d.ts.map +1 -0
- package/dist/core/engine/memory.js +92 -0
- package/dist/core/engine/memory.js.map +1 -0
- package/dist/core/engine/operations.d.ts +62 -0
- package/dist/core/engine/operations.d.ts.map +1 -0
- package/dist/core/engine/operations.js +149 -0
- package/dist/core/engine/operations.js.map +1 -0
- package/dist/core/engine/orders.d.ts +56 -0
- package/dist/core/engine/orders.d.ts.map +1 -0
- package/dist/core/engine/orders.js +83 -0
- package/dist/core/engine/orders.js.map +1 -0
- package/dist/core/engine/registers.d.ts +50 -0
- package/dist/core/engine/registers.d.ts.map +1 -0
- package/dist/core/engine/registers.js +85 -0
- package/dist/core/engine/registers.js.map +1 -0
- package/dist/core/engine/request-body.d.ts +138 -0
- package/dist/core/engine/request-body.d.ts.map +1 -0
- package/dist/core/engine/request-body.js +227 -0
- package/dist/core/engine/request-body.js.map +1 -0
- package/dist/core/engine/request-plan.d.ts +79 -0
- package/dist/core/engine/request-plan.d.ts.map +1 -0
- package/dist/core/engine/request-plan.js +228 -0
- package/dist/core/engine/request-plan.js.map +1 -0
- package/dist/core/engine/requests.d.ts +105 -0
- package/dist/core/engine/requests.d.ts.map +1 -0
- package/dist/core/engine/requests.js +260 -0
- package/dist/core/engine/requests.js.map +1 -0
- package/dist/core/engine/results.d.ts +40 -0
- package/dist/core/engine/results.d.ts.map +1 -0
- package/dist/core/engine/results.js +2 -0
- package/dist/core/engine/results.js.map +1 -0
- package/dist/core/engine/series.d.ts +61 -0
- package/dist/core/engine/series.d.ts.map +1 -0
- package/dist/core/engine/series.js +41 -0
- package/dist/core/engine/series.js.map +1 -0
- package/dist/core/engine/session/hours.d.ts +49 -0
- package/dist/core/engine/session/hours.d.ts.map +1 -0
- package/dist/core/engine/session/hours.js +31 -0
- package/dist/core/engine/session/hours.js.map +1 -0
- package/dist/core/engine/session/index.d.ts +17 -0
- package/dist/core/engine/session/index.d.ts.map +1 -0
- package/dist/core/engine/session/index.js +3 -0
- package/dist/core/engine/session/index.js.map +1 -0
- package/dist/core/engine/session/record.d.ts +56 -0
- package/dist/core/engine/session/record.d.ts.map +1 -0
- package/dist/core/engine/session/record.js +165 -0
- package/dist/core/engine/session/record.js.map +1 -0
- package/dist/core/engine/session/spec.d.ts +19 -0
- package/dist/core/engine/session/spec.d.ts.map +1 -0
- package/dist/core/engine/session/spec.js +31 -0
- package/dist/core/engine/session/spec.js.map +1 -0
- package/dist/core/engine/timeframe.d.ts +59 -0
- package/dist/core/engine/timeframe.d.ts.map +1 -0
- package/dist/core/engine/timeframe.js +140 -0
- package/dist/core/engine/timeframe.js.map +1 -0
- package/dist/core/engine/types.d.ts +15 -0
- package/dist/core/engine/types.d.ts.map +1 -0
- package/dist/core/engine/types.js +2 -0
- package/dist/core/engine/types.js.map +1 -0
- package/dist/core/engine/values/heap.d.ts +134 -0
- package/dist/core/engine/values/heap.d.ts.map +1 -0
- package/dist/core/engine/values/heap.js +230 -0
- package/dist/core/engine/values/heap.js.map +1 -0
- package/dist/core/engine/values/index.d.ts +13 -0
- package/dist/core/engine/values/index.d.ts.map +1 -0
- package/dist/core/engine/values/index.js +3 -0
- package/dist/core/engine/values/index.js.map +1 -0
- package/dist/core/engine/values/value.d.ts +82 -0
- package/dist/core/engine/values/value.d.ts.map +1 -0
- package/dist/core/engine/values/value.js +134 -0
- package/dist/core/engine/values/value.js.map +1 -0
- package/dist/core/engine/verify-budgets.d.ts +35 -0
- package/dist/core/engine/verify-budgets.d.ts.map +1 -0
- package/dist/core/engine/verify-budgets.js +172 -0
- package/dist/core/engine/verify-budgets.js.map +1 -0
- package/dist/core/engine/verify-code.d.ts +32 -0
- package/dist/core/engine/verify-code.d.ts.map +1 -0
- package/dist/core/engine/verify-code.js +278 -0
- package/dist/core/engine/verify-code.js.map +1 -0
- package/dist/core/engine/verify-requests.d.ts +44 -0
- package/dist/core/engine/verify-requests.d.ts.map +1 -0
- package/dist/core/engine/verify-requests.js +220 -0
- package/dist/core/engine/verify-requests.js.map +1 -0
- package/dist/core/engine/verify-shape.d.ts +46 -0
- package/dist/core/engine/verify-shape.d.ts.map +1 -0
- package/dist/core/engine/verify-shape.js +147 -0
- package/dist/core/engine/verify-shape.js.map +1 -0
- package/dist/core/engine/verify-tables.d.ts +19 -0
- package/dist/core/engine/verify-tables.d.ts.map +1 -0
- package/dist/core/engine/verify-tables.js +171 -0
- package/dist/core/engine/verify-tables.js.map +1 -0
- package/dist/core/engine/verify.d.ts +19 -0
- package/dist/core/engine/verify.d.ts.map +1 -0
- package/dist/core/engine/verify.js +309 -0
- package/dist/core/engine/verify.js.map +1 -0
- package/dist/core/index.d.ts +95 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +64 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/parse/expressions.js +1 -1
- package/dist/core/parse/expressions.js.map +1 -1
- package/dist/core/parse/names.d.ts +7 -1
- package/dist/core/parse/names.d.ts.map +1 -1
- package/dist/core/parse/names.js +28 -2
- package/dist/core/parse/names.js.map +1 -1
- package/dist/core/stdlib/averages/exponential.d.ts +51 -0
- package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
- package/dist/core/stdlib/averages/exponential.js +72 -0
- package/dist/core/stdlib/averages/exponential.js.map +1 -0
- package/dist/core/stdlib/averages/index.d.ts +7 -0
- package/dist/core/stdlib/averages/index.d.ts.map +1 -0
- package/dist/core/stdlib/averages/index.js +5 -0
- package/dist/core/stdlib/averages/index.js.map +1 -0
- package/dist/core/stdlib/averages/select.d.ts +35 -0
- package/dist/core/stdlib/averages/select.d.ts.map +1 -0
- package/dist/core/stdlib/averages/select.js +43 -0
- package/dist/core/stdlib/averages/select.js.map +1 -0
- package/dist/core/stdlib/averages/shaped.d.ts +61 -0
- package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
- package/dist/core/stdlib/averages/shaped.js +126 -0
- package/dist/core/stdlib/averages/shaped.js.map +1 -0
- package/dist/core/stdlib/averages/simple.d.ts +58 -0
- package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
- package/dist/core/stdlib/averages/simple.js +92 -0
- package/dist/core/stdlib/averages/simple.js.map +1 -0
- package/dist/core/stdlib/calendar/civil.d.ts +56 -0
- package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/civil.js +70 -0
- package/dist/core/stdlib/calendar/civil.js.map +1 -0
- package/dist/core/stdlib/calendar/fields.d.ts +36 -0
- package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/fields.js +93 -0
- package/dist/core/stdlib/calendar/fields.js.map +1 -0
- package/dist/core/stdlib/calendar/format.d.ts +19 -0
- package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/format.js +51 -0
- package/dist/core/stdlib/calendar/format.js.map +1 -0
- package/dist/core/stdlib/calendar/index.d.ts +7 -0
- package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/index.js +5 -0
- package/dist/core/stdlib/calendar/index.js.map +1 -0
- package/dist/core/stdlib/calendar/zone.d.ts +53 -0
- package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/zone.js +138 -0
- package/dist/core/stdlib/calendar/zone.js.map +1 -0
- package/dist/core/stdlib/index.d.ts +57 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/index.js +51 -0
- package/dist/core/stdlib/index.js.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.js +66 -0
- package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
- package/dist/core/stdlib/maths/elementary.d.ts +65 -0
- package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
- package/dist/core/stdlib/maths/elementary.js +93 -0
- package/dist/core/stdlib/maths/elementary.js.map +1 -0
- package/dist/core/stdlib/maths/index.d.ts +4 -0
- package/dist/core/stdlib/maths/index.d.ts.map +1 -0
- package/dist/core/stdlib/maths/index.js +4 -0
- package/dist/core/stdlib/maths/index.js.map +1 -0
- package/dist/core/stdlib/maths/rounding.d.ts +43 -0
- package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
- package/dist/core/stdlib/maths/rounding.js +62 -0
- package/dist/core/stdlib/maths/rounding.js.map +1 -0
- package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
- package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/convergence.js +48 -0
- package/dist/core/stdlib/momentum/convergence.js.map +1 -0
- package/dist/core/stdlib/momentum/index.d.ts +6 -0
- package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/index.js +6 -0
- package/dist/core/stdlib/momentum/index.js.map +1 -0
- package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
- package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/pressure.js +103 -0
- package/dist/core/stdlib/momentum/pressure.js.map +1 -0
- package/dist/core/stdlib/momentum/rates.d.ts +74 -0
- package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rates.js +134 -0
- package/dist/core/stdlib/momentum/rates.js.map +1 -0
- package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
- package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rsi.js +30 -0
- package/dist/core/stdlib/momentum/rsi.js.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.js +97 -0
- package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
- package/dist/core/stdlib/series/changes.d.ts +59 -0
- package/dist/core/stdlib/series/changes.d.ts.map +1 -0
- package/dist/core/stdlib/series/changes.js +129 -0
- package/dist/core/stdlib/series/changes.js.map +1 -0
- package/dist/core/stdlib/series/conditions.d.ts +34 -0
- package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
- package/dist/core/stdlib/series/conditions.js +52 -0
- package/dist/core/stdlib/series/conditions.js.map +1 -0
- package/dist/core/stdlib/series/extremes.d.ts +29 -0
- package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
- package/dist/core/stdlib/series/extremes.js +62 -0
- package/dist/core/stdlib/series/extremes.js.map +1 -0
- package/dist/core/stdlib/series/index.d.ts +9 -0
- package/dist/core/stdlib/series/index.d.ts.map +1 -0
- package/dist/core/stdlib/series/index.js +7 -0
- package/dist/core/stdlib/series/index.js.map +1 -0
- package/dist/core/stdlib/series/pivots.d.ts +25 -0
- package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
- package/dist/core/stdlib/series/pivots.js +42 -0
- package/dist/core/stdlib/series/pivots.js.map +1 -0
- package/dist/core/stdlib/series/statistics.d.ts +64 -0
- package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
- package/dist/core/stdlib/series/statistics.js +148 -0
- package/dist/core/stdlib/series/statistics.js.map +1 -0
- package/dist/core/stdlib/series/totals.d.ts +68 -0
- package/dist/core/stdlib/series/totals.d.ts.map +1 -0
- package/dist/core/stdlib/series/totals.js +115 -0
- package/dist/core/stdlib/series/totals.js.map +1 -0
- package/dist/core/stdlib/trend/directional.d.ts +69 -0
- package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
- package/dist/core/stdlib/trend/directional.js +151 -0
- package/dist/core/stdlib/trend/directional.js.map +1 -0
- package/dist/core/stdlib/trend/index.d.ts +4 -0
- package/dist/core/stdlib/trend/index.d.ts.map +1 -0
- package/dist/core/stdlib/trend/index.js +4 -0
- package/dist/core/stdlib/trend/index.js.map +1 -0
- package/dist/core/stdlib/trend/psar.d.ts +33 -0
- package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
- package/dist/core/stdlib/trend/psar.js +86 -0
- package/dist/core/stdlib/trend/psar.js.map +1 -0
- package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
- package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
- package/dist/core/stdlib/trend/supertrend.js +65 -0
- package/dist/core/stdlib/trend/supertrend.js.map +1 -0
- package/dist/core/stdlib/values/bar.d.ts +39 -0
- package/dist/core/stdlib/values/bar.d.ts.map +1 -0
- package/dist/core/stdlib/values/bar.js +33 -0
- package/dist/core/stdlib/values/bar.js.map +1 -0
- package/dist/core/stdlib/values/index.d.ts +11 -0
- package/dist/core/stdlib/values/index.d.ts.map +1 -0
- package/dist/core/stdlib/values/index.js +6 -0
- package/dist/core/stdlib/values/index.js.map +1 -0
- package/dist/core/stdlib/values/lookback.d.ts +83 -0
- package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
- package/dist/core/stdlib/values/lookback.js +134 -0
- package/dist/core/stdlib/values/lookback.js.map +1 -0
- package/dist/core/stdlib/values/region.d.ts +55 -0
- package/dist/core/stdlib/values/region.d.ts.map +1 -0
- package/dist/core/stdlib/values/region.js +73 -0
- package/dist/core/stdlib/values/region.js.map +1 -0
- package/dist/core/stdlib/values/tail.d.ts +44 -0
- package/dist/core/stdlib/values/tail.d.ts.map +1 -0
- package/dist/core/stdlib/values/tail.js +23 -0
- package/dist/core/stdlib/values/tail.js.map +1 -0
- package/dist/core/stdlib/values/value.d.ts +64 -0
- package/dist/core/stdlib/values/value.d.ts.map +1 -0
- package/dist/core/stdlib/values/value.js +61 -0
- package/dist/core/stdlib/values/value.js.map +1 -0
- package/dist/core/stdlib/volatility/bands.d.ts +50 -0
- package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/bands.js +101 -0
- package/dist/core/stdlib/volatility/bands.js.map +1 -0
- package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
- package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/deviation.js +75 -0
- package/dist/core/stdlib/volatility/deviation.js.map +1 -0
- package/dist/core/stdlib/volatility/index.d.ts +6 -0
- package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/index.js +5 -0
- package/dist/core/stdlib/volatility/index.js.map +1 -0
- package/dist/core/stdlib/volatility/measures.d.ts +48 -0
- package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/measures.js +73 -0
- package/dist/core/stdlib/volatility/measures.js.map +1 -0
- package/dist/core/stdlib/volatility/range.d.ts +69 -0
- package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/range.js +86 -0
- package/dist/core/stdlib/volatility/range.js.map +1 -0
- package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
- package/dist/core/stdlib/volume/accumulation.js +127 -0
- package/dist/core/stdlib/volume/accumulation.js.map +1 -0
- package/dist/core/stdlib/volume/flow.d.ts +60 -0
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
- package/dist/core/stdlib/volume/flow.js +125 -0
- package/dist/core/stdlib/volume/flow.js.map +1 -0
- package/dist/core/stdlib/volume/index.d.ts +5 -0
- package/dist/core/stdlib/volume/index.d.ts.map +1 -0
- package/dist/core/stdlib/volume/index.js +4 -0
- package/dist/core/stdlib/volume/index.js.map +1 -0
- package/dist/core/stdlib/volume/weighted.d.ts +52 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
- package/dist/core/stdlib/volume/weighted.js +64 -0
- package/dist/core/stdlib/volume/weighted.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +2 -2
- package/dist/core/version/version.generated.d.ts.map +1 -1
- package/dist/core/version/version.generated.js +2 -2
- package/dist/core/version/version.generated.js.map +1 -1
- package/dist/editor/complete.d.ts +40 -0
- package/dist/editor/complete.d.ts.map +1 -0
- package/dist/editor/complete.js +206 -0
- package/dist/editor/complete.js.map +1 -0
- package/dist/editor/diagnose.d.ts +18 -0
- package/dist/editor/diagnose.d.ts.map +1 -0
- package/dist/editor/diagnose.js +70 -0
- package/dist/editor/diagnose.js.map +1 -0
- package/dist/editor/format.d.ts +11 -0
- package/dist/editor/format.d.ts.map +1 -0
- package/dist/editor/format.js +50 -0
- package/dist/editor/format.js.map +1 -0
- package/dist/editor/highlight.d.ts +28 -0
- package/dist/editor/highlight.d.ts.map +1 -0
- package/dist/editor/highlight.js +65 -0
- package/dist/editor/highlight.js.map +1 -0
- package/dist/editor/hover.d.ts +40 -0
- package/dist/editor/hover.d.ts.map +1 -0
- package/dist/editor/hover.js +147 -0
- package/dist/editor/hover.js.map +1 -0
- package/dist/editor/index.d.ts +60 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +7 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/kinds.d.ts +27 -0
- package/dist/editor/kinds.d.ts.map +1 -0
- package/dist/editor/kinds.js +118 -0
- package/dist/editor/kinds.js.map +1 -0
- package/dist/editor/layout.d.ts +47 -0
- package/dist/editor/layout.d.ts.map +1 -0
- package/dist/editor/layout.js +135 -0
- package/dist/editor/layout.js.map +1 -0
- package/dist/editor/manifest.d.ts +47 -0
- package/dist/editor/manifest.d.ts.map +1 -0
- package/dist/editor/manifest.js +93 -0
- package/dist/editor/manifest.js.map +1 -0
- package/dist/editor/reading.d.ts +41 -0
- package/dist/editor/reading.d.ts.map +1 -0
- package/dist/editor/reading.js +51 -0
- package/dist/editor/reading.js.map +1 -0
- package/dist/editor/scan.d.ts +26 -0
- package/dist/editor/scan.d.ts.map +1 -0
- package/dist/editor/scan.js +139 -0
- package/dist/editor/scan.js.map +1 -0
- package/dist/editor/scope.d.ts +19 -0
- package/dist/editor/scope.d.ts.map +1 -0
- package/dist/editor/scope.js +99 -0
- package/dist/editor/scope.js.map +1 -0
- package/dist/editor/signature.d.ts +38 -0
- package/dist/editor/signature.d.ts.map +1 -0
- package/dist/editor/signature.js +112 -0
- package/dist/editor/signature.js.map +1 -0
- package/dist/editor/site.d.ts +46 -0
- package/dist/editor/site.d.ts.map +1 -0
- package/dist/editor/site.js +184 -0
- package/dist/editor/site.js.map +1 -0
- package/dist/editor/spacing.d.ts +29 -0
- package/dist/editor/spacing.d.ts.map +1 -0
- package/dist/editor/spacing.js +116 -0
- package/dist/editor/spacing.js.map +1 -0
- package/package.json +66 -15
- package/spec/errors.json +522 -183
- package/src/adapters/charts/alerts.ts +116 -0
- package/src/adapters/charts/bars.ts +63 -0
- package/src/adapters/charts/candles.ts +137 -0
- package/src/adapters/charts/colours.ts +113 -0
- package/src/adapters/charts/columns.ts +99 -0
- package/src/adapters/charts/contract.ts +320 -0
- package/src/adapters/charts/descriptor.ts +199 -0
- package/src/adapters/charts/drawings.ts +213 -0
- package/src/adapters/charts/errors.ts +45 -0
- package/src/adapters/charts/fields.ts +74 -0
- package/src/adapters/charts/fills.ts +71 -0
- package/src/adapters/charts/index.ts +78 -0
- package/src/adapters/charts/levels.ts +92 -0
- package/src/adapters/charts/markers.ts +119 -0
- package/src/adapters/charts/paint.ts +101 -0
- package/src/adapters/charts/plots.ts +185 -0
- package/src/adapters/charts/produced.ts +68 -0
- package/src/adapters/charts/requests.ts +357 -0
- package/src/adapters/charts/run.ts +327 -0
- package/src/adapters/charts/settings.ts +273 -0
- package/src/adapters/charts/surfaces.ts +255 -0
- package/src/adapters/charts/tables.ts +243 -0
- package/src/adapters/codemirror/commands.ts +53 -0
- package/src/adapters/codemirror/completion.ts +74 -0
- package/src/adapters/codemirror/contract.ts +156 -0
- package/src/adapters/codemirror/index.ts +66 -0
- package/src/adapters/codemirror/lint.ts +66 -0
- package/src/adapters/codemirror/positions.ts +79 -0
- package/src/adapters/codemirror/stream.ts +87 -0
- package/src/adapters/codemirror/tokens.ts +64 -0
- package/src/adapters/codemirror/tooltips.ts +113 -0
- package/src/core/accounting/charges.ts +452 -0
- package/src/core/accounting/equity.ts +276 -0
- package/src/core/accounting/index.ts +49 -0
- package/src/core/accounting/markers.ts +95 -0
- package/src/core/accounting/monthly.ts +137 -0
- package/src/core/accounting/report.ts +89 -0
- package/src/core/accounting/shapes.ts +73 -0
- package/src/core/accounting/statistics.ts +350 -0
- package/src/core/accounting/trades.ts +313 -0
- package/src/core/backtest/compare.ts +244 -0
- package/src/core/backtest/declaration.ts +97 -0
- package/src/core/backtest/drive.ts +364 -0
- package/src/core/backtest/index.ts +52 -0
- package/src/core/backtest/range.ts +137 -0
- package/src/core/backtest/record.ts +341 -0
- package/src/core/backtest/replay.ts +158 -0
- package/src/core/backtest/resting.ts +125 -0
- package/src/core/backtest/settings.ts +280 -0
- package/src/core/backtest/simulate.ts +304 -0
- package/src/core/catalogue/catalogue.generated.ts +23 -9
- package/src/core/catalogue/values.generated.ts +14 -0
- package/src/core/check/arguments.ts +126 -0
- package/src/core/check/call-sites.ts +385 -0
- package/src/core/check/call-warmup.ts +121 -0
- package/src/core/check/calls.ts +412 -0
- package/src/core/check/check.ts +183 -0
- package/src/core/check/checked.ts +228 -0
- package/src/core/check/checker.ts +393 -0
- package/src/core/check/conditional.ts +143 -0
- package/src/core/check/constant.ts +127 -0
- package/src/core/check/declaration.ts +230 -0
- package/src/core/check/expressions.ts +471 -0
- package/src/core/check/functions.ts +283 -0
- package/src/core/check/handles.ts +75 -0
- package/src/core/check/index.ts +70 -0
- package/src/core/check/library-bars.ts +194 -0
- package/src/core/check/library-orders.ts +290 -0
- package/src/core/check/library-output.ts +241 -0
- package/src/core/check/library-prose.generated.ts +367 -0
- package/src/core/check/library-series.ts +457 -0
- package/src/core/check/library.ts +374 -0
- package/src/core/check/literals.ts +35 -0
- package/src/core/check/outputs.ts +152 -0
- package/src/core/check/statements.ts +465 -0
- package/src/core/check/suggest.ts +63 -0
- package/src/core/check/surface.ts +149 -0
- package/src/core/check/tags.ts +94 -0
- package/src/core/check/types.ts +260 -0
- package/src/core/check/warmup.ts +100 -0
- package/src/core/diagnostics/collector.ts +27 -1
- package/src/core/emit/calls.ts +415 -0
- package/src/core/emit/canonical.ts +81 -0
- package/src/core/emit/channels.ts +144 -0
- package/src/core/emit/code.ts +155 -0
- package/src/core/emit/colours.ts +75 -0
- package/src/core/emit/context.ts +461 -0
- package/src/core/emit/defaults.ts +220 -0
- package/src/core/emit/emit.ts +313 -0
- package/src/core/emit/events.ts +141 -0
- package/src/core/emit/expressions.ts +292 -0
- package/src/core/emit/functions.ts +195 -0
- package/src/core/emit/gaps.ts +44 -0
- package/src/core/emit/index.ts +76 -0
- package/src/core/emit/inputs.ts +179 -0
- package/src/core/emit/layout.ts +165 -0
- package/src/core/emit/meta.ts +104 -0
- package/src/core/emit/opcodes.ts +160 -0
- package/src/core/emit/outputs.ts +357 -0
- package/src/core/emit/pool.ts +102 -0
- package/src/core/emit/program.ts +385 -0
- package/src/core/emit/registers.ts +179 -0
- package/src/core/emit/request-scope.ts +52 -0
- package/src/core/emit/requests.ts +258 -0
- package/src/core/emit/requires.ts +91 -0
- package/src/core/emit/sha256.ts +119 -0
- package/src/core/emit/statements.ts +438 -0
- package/src/core/emit/values.ts +284 -0
- package/src/core/engine/alerts.ts +152 -0
- package/src/core/engine/arithmetic.ts +165 -0
- package/src/core/engine/bars.ts +224 -0
- package/src/core/engine/budget.ts +284 -0
- package/src/core/engine/channels.ts +171 -0
- package/src/core/engine/drawings.ts +127 -0
- package/src/core/engine/engine.ts +498 -0
- package/src/core/engine/errors.ts +100 -0
- package/src/core/engine/frames.ts +85 -0
- package/src/core/engine/grids.ts +98 -0
- package/src/core/engine/guard.ts +71 -0
- package/src/core/engine/host.ts +251 -0
- package/src/core/engine/index.ts +93 -0
- package/src/core/engine/inputs.ts +263 -0
- package/src/core/engine/ledger/call.ts +218 -0
- package/src/core/engine/ledger/closable.ts +269 -0
- package/src/core/engine/ledger/holdings.ts +354 -0
- package/src/core/engine/ledger/index.ts +28 -0
- package/src/core/engine/ledger/intent.ts +112 -0
- package/src/core/engine/ledger/ledger.ts +314 -0
- package/src/core/engine/ledger/place.ts +277 -0
- package/src/core/engine/ledger/positions.ts +123 -0
- package/src/core/engine/ledger/refuse.ts +378 -0
- package/src/core/engine/ledger/row.ts +318 -0
- package/src/core/engine/ledger/sizing.ts +292 -0
- package/src/core/engine/library/arrays.ts +316 -0
- package/src/core/engine/library/averages.ts +97 -0
- package/src/core/engine/library/binding.ts +325 -0
- package/src/core/engine/library/chart.ts +115 -0
- package/src/core/engine/library/colours.ts +111 -0
- package/src/core/engine/library/dates.ts +109 -0
- package/src/core/engine/library/index.ts +103 -0
- package/src/core/engine/library/maths.ts +134 -0
- package/src/core/engine/library/objects.ts +265 -0
- package/src/core/engine/library/oscillators.ts +124 -0
- package/src/core/engine/library/ranges.ts +51 -0
- package/src/core/engine/library/series.ts +236 -0
- package/src/core/engine/library/state.ts +47 -0
- package/src/core/engine/library/studies.ts +150 -0
- package/src/core/engine/library/text.ts +303 -0
- package/src/core/engine/library/trend.ts +79 -0
- package/src/core/engine/library/volume.ts +101 -0
- package/src/core/engine/load.ts +118 -0
- package/src/core/engine/machine.ts +446 -0
- package/src/core/engine/memory.ts +129 -0
- package/src/core/engine/operations.ts +171 -0
- package/src/core/engine/orders.ts +121 -0
- package/src/core/engine/registers.ts +104 -0
- package/src/core/engine/request-body.ts +328 -0
- package/src/core/engine/request-plan.ts +270 -0
- package/src/core/engine/requests.ts +382 -0
- package/src/core/engine/results.ts +41 -0
- package/src/core/engine/series.ts +82 -0
- package/src/core/engine/session/hours.ts +86 -0
- package/src/core/engine/session/index.ts +17 -0
- package/src/core/engine/session/record.ts +191 -0
- package/src/core/engine/session/spec.ts +45 -0
- package/src/core/engine/timeframe.ts +161 -0
- package/src/core/engine/types.ts +47 -0
- package/src/core/engine/values/heap.ts +295 -0
- package/src/core/engine/values/index.ts +34 -0
- package/src/core/engine/values/value.ts +158 -0
- package/src/core/engine/verify-budgets.ts +202 -0
- package/src/core/engine/verify-code.ts +332 -0
- package/src/core/engine/verify-requests.ts +255 -0
- package/src/core/engine/verify-shape.ts +164 -0
- package/src/core/engine/verify-tables.ts +176 -0
- package/src/core/engine/verify.ts +341 -0
- package/src/core/index.ts +212 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/names.ts +29 -2
- package/src/core/stdlib/averages/exponential.ts +119 -0
- package/src/core/stdlib/averages/index.ts +45 -0
- package/src/core/stdlib/averages/select.ts +71 -0
- package/src/core/stdlib/averages/shaped.ts +161 -0
- package/src/core/stdlib/averages/simple.ts +139 -0
- package/src/core/stdlib/calendar/civil.ts +89 -0
- package/src/core/stdlib/calendar/fields.ts +124 -0
- package/src/core/stdlib/calendar/format.ts +71 -0
- package/src/core/stdlib/calendar/index.ts +15 -0
- package/src/core/stdlib/calendar/zone.ts +161 -0
- package/src/core/stdlib/index.ts +400 -0
- package/src/core/stdlib/maths/arithmetic.ts +74 -0
- package/src/core/stdlib/maths/elementary.ts +124 -0
- package/src/core/stdlib/maths/index.ts +43 -0
- package/src/core/stdlib/maths/rounding.ts +78 -0
- package/src/core/stdlib/momentum/convergence.ts +82 -0
- package/src/core/stdlib/momentum/index.ts +47 -0
- package/src/core/stdlib/momentum/pressure.ts +141 -0
- package/src/core/stdlib/momentum/rates.ts +188 -0
- package/src/core/stdlib/momentum/rsi.ts +49 -0
- package/src/core/stdlib/momentum/stochastic.ts +147 -0
- package/src/core/stdlib/series/changes.ts +177 -0
- package/src/core/stdlib/series/conditions.ts +74 -0
- package/src/core/stdlib/series/extremes.ts +92 -0
- package/src/core/stdlib/series/index.ts +83 -0
- package/src/core/stdlib/series/pivots.ts +63 -0
- package/src/core/stdlib/series/statistics.ts +207 -0
- package/src/core/stdlib/series/totals.ts +164 -0
- package/src/core/stdlib/trend/directional.ts +196 -0
- package/src/core/stdlib/trend/index.ts +13 -0
- package/src/core/stdlib/trend/psar.ts +131 -0
- package/src/core/stdlib/trend/supertrend.ts +100 -0
- package/src/core/stdlib/values/bar.ts +54 -0
- package/src/core/stdlib/values/index.ts +14 -0
- package/src/core/stdlib/values/lookback.ts +198 -0
- package/src/core/stdlib/values/region.ts +86 -0
- package/src/core/stdlib/values/tail.ts +58 -0
- package/src/core/stdlib/values/value.ts +82 -0
- package/src/core/stdlib/volatility/bands.ts +178 -0
- package/src/core/stdlib/volatility/deviation.ts +111 -0
- package/src/core/stdlib/volatility/index.ts +48 -0
- package/src/core/stdlib/volatility/measures.ts +96 -0
- package/src/core/stdlib/volatility/range.ts +143 -0
- package/src/core/stdlib/volume/accumulation.ts +152 -0
- package/src/core/stdlib/volume/flow.ts +173 -0
- package/src/core/stdlib/volume/index.ts +43 -0
- package/src/core/stdlib/volume/weighted.ts +101 -0
- package/src/core/version/version.generated.ts +2 -2
- package/src/editor/complete.ts +266 -0
- package/src/editor/diagnose.ts +71 -0
- package/src/editor/format.ts +85 -0
- package/src/editor/highlight.ts +110 -0
- package/src/editor/hover.ts +199 -0
- package/src/editor/index.ts +65 -0
- package/src/editor/kinds.ts +157 -0
- package/src/editor/layout.ts +189 -0
- package/src/editor/manifest.ts +119 -0
- package/src/editor/reading.ts +69 -0
- package/src/editor/scan.ts +162 -0
- package/src/editor/scope.ts +122 -0
- package/src/editor/signature.ts +150 -0
- package/src/editor/site.ts +233 -0
- package/src/editor/spacing.ts +132 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declared grids into the chart's summary grid.
|
|
3
|
+
*
|
|
4
|
+
* **A table is written, not plotted.** It is the one output that is not a value
|
|
5
|
+
* per bar: its cells are written by library calls against a handle, into a
|
|
6
|
+
* buffer the engine empties at the start of every execution of a bar
|
|
7
|
+
* (`compiled-program.md` 2.8 and 5.1). What survives is what the last executed
|
|
8
|
+
* bar wrote, which is what a grid pinned to a corner of a pane shows.
|
|
9
|
+
*
|
|
10
|
+
* **So it is read once, after the run, and never per bar.** The obvious way to
|
|
11
|
+
* get this wrong is to collect a grid for every bar of a long history in order
|
|
12
|
+
* to display the last one, which costs the length of the history and throws all
|
|
13
|
+
* of it away. The engine holds one buffer per grid rather than one per bar, and
|
|
14
|
+
* this reads it exactly once per calculation, so a hundred thousand bars cost
|
|
15
|
+
* the same as ten.
|
|
16
|
+
*
|
|
17
|
+
* A script pays the other half of that bill for itself: `cell()` on every bar of
|
|
18
|
+
* a long history does the work of writing a grid that only the last bar's copy
|
|
19
|
+
* is kept from, and the documentation says to guard it with `bar.isLast`. That
|
|
20
|
+
* is a script's decision and not one this can make for it, because the buffer is
|
|
21
|
+
* cleared per bar and an engine cannot know which execution is the last one
|
|
22
|
+
* until it is.
|
|
23
|
+
*
|
|
24
|
+
* **The engine's cells are sparse and the chart's grid is dense.** A script
|
|
25
|
+
* writes the cells it has something to say about; the chart draws rows of cells.
|
|
26
|
+
* So the declared size is filled with blank cells and the written ones are
|
|
27
|
+
* placed into it, which is what `language.md` 6.7 asks for from the other
|
|
28
|
+
* direction: a cell nothing was written into is blank, never a zero.
|
|
29
|
+
*
|
|
30
|
+
* **A chart pane holds one grid and the language declares as many as it likes.**
|
|
31
|
+
* The descriptor has one `table` hook, so the first declared grid is the one
|
|
32
|
+
* drawn and any after it are not. That is a gap in the chart's own contract
|
|
33
|
+
* rather than a choice worth making here: there is no second hook to write to,
|
|
34
|
+
* and merging two grids into one would put cells somewhere the script never
|
|
35
|
+
* asked for.
|
|
36
|
+
*
|
|
37
|
+
* **What ought to happen is a refusal, and it cannot be written yet.** A study
|
|
38
|
+
* whose second grid never appears is a study with no explanation, so the second
|
|
39
|
+
* `table()` should be refused where it is written, naming the limit. Every
|
|
40
|
+
* diagnostic in this project carries a catalogue code and the catalogue has
|
|
41
|
+
* none for "the chart cannot draw something this study declares"; inventing one
|
|
42
|
+
* here is the one thing that is not allowed, so the gap is reported instead, in
|
|
43
|
+
* `issues/0011-a-second-declared-grid-is-dropped-with-nothing-said.md`, with the
|
|
44
|
+
* sentence it should carry.
|
|
45
|
+
*
|
|
46
|
+
* Until it lands, the drop is at least no longer silent inside this repository:
|
|
47
|
+
* it is recorded in `spec/chart-narrowings.json` with its reason, and
|
|
48
|
+
* `scripts/check-chart-surface.mjs` fails the build if this adapter ever drops
|
|
49
|
+
* anything else a compiled program declares without recording it there.
|
|
50
|
+
*/
|
|
51
|
+
import type { CompiledProgram, Grid as DeclaredGrid } from '../../core/emit/index.js';
|
|
52
|
+
import type { Grid, GridCell } from '../../core/engine/index.js';
|
|
53
|
+
import { cssColour, cssOf } from './colours.js';
|
|
54
|
+
import { colourField, numberField, stringField } from './fields.js';
|
|
55
|
+
import type { InputLookup } from './fields.js';
|
|
56
|
+
import type {
|
|
57
|
+
ChartCell,
|
|
58
|
+
ChartCellAlign,
|
|
59
|
+
ChartGrid,
|
|
60
|
+
ChartTablePosition,
|
|
61
|
+
} from './surfaces.js';
|
|
62
|
+
|
|
63
|
+
/** The language's four corners, in the chart's own words. */
|
|
64
|
+
const CORNERS: Readonly<Record<string, ChartTablePosition>> = {
|
|
65
|
+
topLeft: 'top-left',
|
|
66
|
+
topRight: 'top-right',
|
|
67
|
+
bottomLeft: 'bottom-left',
|
|
68
|
+
bottomRight: 'bottom-right',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const ALIGNMENTS: readonly string[] = ['left', 'center', 'right'];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The grid a chart draws, from the declaration and the engine's buffer.
|
|
75
|
+
*
|
|
76
|
+
* The buffer is paired with the declaration by the key both of them carry
|
|
77
|
+
* rather than by position. The engine reads its grids in declaration order, so
|
|
78
|
+
* the two agree today, and a pairing by position is one reordering away from
|
|
79
|
+
* drawing one grid's cells into another grid's shape, which would be a wrong
|
|
80
|
+
* table that looks like a right one.
|
|
81
|
+
*/
|
|
82
|
+
export function buildTable(
|
|
83
|
+
program: CompiledProgram,
|
|
84
|
+
lookup: InputLookup,
|
|
85
|
+
written: readonly Grid[],
|
|
86
|
+
): ChartGrid | null {
|
|
87
|
+
const declared = program.outputs.tables[0];
|
|
88
|
+
if (declared === undefined) return null;
|
|
89
|
+
return oneTable(declared, lookup, written.find((one) => one.key === declared.key));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function oneTable(
|
|
93
|
+
declared: DeclaredGrid,
|
|
94
|
+
lookup: InputLookup,
|
|
95
|
+
written: Grid | undefined,
|
|
96
|
+
): ChartGrid {
|
|
97
|
+
const position = stringField(declared.position, lookup, 'topRight');
|
|
98
|
+
const textColour = colourField(declared.options.textColor, lookup);
|
|
99
|
+
const bgColour = colourField(declared.options.bgColor, lookup);
|
|
100
|
+
const rows = whole(numberField(declared.rows, lookup, 0));
|
|
101
|
+
const cols = whole(numberField(declared.cols, lookup, 0));
|
|
102
|
+
const fallback = textColour === undefined ? undefined : cssColour(textColour);
|
|
103
|
+
|
|
104
|
+
const grid: ChartCell[][] = [];
|
|
105
|
+
for (let row = 0; row < rows; row += 1) {
|
|
106
|
+
grid.push(new Array<ChartCell>(cols).fill({ text: '' }));
|
|
107
|
+
}
|
|
108
|
+
for (const cell of written?.cells ?? []) {
|
|
109
|
+
const built = oneCell(cell, fallback);
|
|
110
|
+
const line = grid[cell.row];
|
|
111
|
+
if (built === undefined || line === undefined || cell.col >= cols) continue;
|
|
112
|
+
line[cell.col] = built;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
rows: grid,
|
|
117
|
+
options: {
|
|
118
|
+
position: CORNERS[position] ?? 'top-right',
|
|
119
|
+
borderWidth: numberField(declared.options.borderWidth, lookup, 0),
|
|
120
|
+
...(bgColour === undefined ? {} : { background: cssColour(bgColour) }),
|
|
121
|
+
...(cols > 0 ? { cellWidth: columnWidths(grid, cols) } : {}),
|
|
122
|
+
// The chart measures the text it is about to draw and shrinks it to fit,
|
|
123
|
+
// which is the half of this that cannot be done from here.
|
|
124
|
+
fontSize: 'auto',
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* How wide each column has to be, in media pixels.
|
|
131
|
+
*
|
|
132
|
+
* The chart's default is one width for every column, chosen without seeing the
|
|
133
|
+
* text, and a grid whose header says "Moving averages" over cells saying
|
|
134
|
+
* "RSI: 27.22" has one column bleeding into the next. Nothing downstream can
|
|
135
|
+
* choose better, because by the time the chart has the grid it has lost which
|
|
136
|
+
* cells belong together; and nothing upstream can, because the script declares
|
|
137
|
+
* a size and writes text, not a layout.
|
|
138
|
+
*
|
|
139
|
+
* **This is an estimate, and it is allowed to be.** A real width needs the font
|
|
140
|
+
* the chart will draw with, and only the chart has it. So the width is counted
|
|
141
|
+
* off the characters and the chart's own `fontSize: 'auto'` corrects whatever
|
|
142
|
+
* this gets wrong: too narrow and the type shrinks a little, too wide and the
|
|
143
|
+
* column is a little loose. Either is a table that reads. The failure this
|
|
144
|
+
* replaces was neither.
|
|
145
|
+
*
|
|
146
|
+
* Delete it when the chart can size a column from its own measurements. It
|
|
147
|
+
* exists because that is not a thing it can be asked to do yet.
|
|
148
|
+
*/
|
|
149
|
+
function columnWidths(grid: readonly (readonly ChartCell[])[], cols: number): number[] {
|
|
150
|
+
const widths: number[] = [];
|
|
151
|
+
for (let col = 0; col < cols; col += 1) {
|
|
152
|
+
let widest = 0;
|
|
153
|
+
for (const row of grid) {
|
|
154
|
+
const text = row[col]?.text ?? '';
|
|
155
|
+
if (text.length > 0) widest = Math.max(widest, textWidth(text));
|
|
156
|
+
}
|
|
157
|
+
widths.push(Math.min(MAX_COLUMN, Math.max(MIN_COLUMN, Math.ceil(widest) + CELL_PADDING * 2)));
|
|
158
|
+
}
|
|
159
|
+
return widths;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Roughly how wide a string is at the type size the chart starts from.
|
|
164
|
+
*
|
|
165
|
+
* Counted rather than measured, and counted in two weights rather than one: a
|
|
166
|
+
* column of "Histogram: -7.01" is half punctuation and narrow digits, and
|
|
167
|
+
* treating every character as an em-and-a-bit makes that column half again as
|
|
168
|
+
* wide as it needs to be while "Moving averages" stays too narrow. Two weights
|
|
169
|
+
* is not typography, but it is enough to tell those two apart.
|
|
170
|
+
*/
|
|
171
|
+
function textWidth(text: string): number {
|
|
172
|
+
let width = 0;
|
|
173
|
+
for (const character of text) {
|
|
174
|
+
width += NARROW.has(character) ? BASE_SIZE * NARROW_EM : BASE_SIZE * WIDE_EM;
|
|
175
|
+
}
|
|
176
|
+
return width;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** The characters that take noticeably less than an average advance. */
|
|
180
|
+
const NARROW = new Set([...' .,:;!|ijlt1IJfr()[]{}-']);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The type size the widths are counted at.
|
|
184
|
+
*
|
|
185
|
+
* The chart's own default row is 18 media pixels and it draws at 62% of the
|
|
186
|
+
* row, so this is the size a cell gets before anything shrinks it. Counting at
|
|
187
|
+
* a larger size would reserve room the text never uses.
|
|
188
|
+
*/
|
|
189
|
+
const BASE_SIZE = 11;
|
|
190
|
+
const NARROW_EM = 0.32;
|
|
191
|
+
const WIDE_EM = 0.56;
|
|
192
|
+
|
|
193
|
+
/** What the chart insets a cell's text by, on each side. */
|
|
194
|
+
const CELL_PADDING = 4;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The narrowest a column is drawn.
|
|
198
|
+
*
|
|
199
|
+
* A column of one-character cells sized to its content is a sliver, and a grid
|
|
200
|
+
* of slivers reads as a rendering fault rather than as a narrow column.
|
|
201
|
+
*/
|
|
202
|
+
const MIN_COLUMN = 56;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The widest a column is drawn.
|
|
206
|
+
*
|
|
207
|
+
* A cell holding a sentence would otherwise push the grid past the pane it is
|
|
208
|
+
* pinned inside, taking the chart with it. Past this the type shrinks instead,
|
|
209
|
+
* which is the chart's job and it is better at it.
|
|
210
|
+
*/
|
|
211
|
+
const MAX_COLUMN = 220;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* One written cell, or none.
|
|
215
|
+
*
|
|
216
|
+
* A cell whose text is absent is dropped rather than drawn, which leaves the
|
|
217
|
+
* blank cell that was already in its place: absence reaching a drawing surface
|
|
218
|
+
* is a gap, and a blank cell is what a grid draws where nothing was written
|
|
219
|
+
* (`language.md` 6.7).
|
|
220
|
+
*
|
|
221
|
+
* The grid's own text colour is written into each cell that named none, because
|
|
222
|
+
* the chart carries a text colour per cell and the language declares one for the
|
|
223
|
+
* whole grid as well.
|
|
224
|
+
*/
|
|
225
|
+
function oneCell(cell: GridCell, fallback: string | undefined): ChartCell | undefined {
|
|
226
|
+
if (typeof cell.text !== 'string') return undefined;
|
|
227
|
+
const align = typeof cell.align === 'string' && ALIGNMENTS.includes(cell.align)
|
|
228
|
+
? (cell.align as ChartCellAlign)
|
|
229
|
+
: 'left';
|
|
230
|
+
const textColour = cssOf(cell.textColor) ?? fallback;
|
|
231
|
+
const bgColour = cssOf(cell.bgColor);
|
|
232
|
+
return {
|
|
233
|
+
text: cell.text,
|
|
234
|
+
...(textColour === undefined ? {} : { textColor: textColour }),
|
|
235
|
+
...(bgColour === undefined ? {} : { bgColor: bgColour }),
|
|
236
|
+
align,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** A declared size, as a count of rows or columns a grid can be built with. */
|
|
241
|
+
function whole(size: number): number {
|
|
242
|
+
return size > 0 ? Math.floor(size) : 0;
|
|
243
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Laying a script out again, as an editor command.
|
|
3
|
+
*
|
|
4
|
+
* `format` is the tier's, and the guarantee it carries is the one that makes a
|
|
5
|
+
* format button safe to put in front of somebody holding a position: laying a
|
|
6
|
+
* script out again cannot change what it computes. Every example and every gate
|
|
7
|
+
* script in the repository is formatted, both texts compiled, and the compiled
|
|
8
|
+
* programs compared field for field; and every call checks itself against the
|
|
9
|
+
* lexer, so a rule that is wrong returns the source untouched rather than a
|
|
10
|
+
* changed program.
|
|
11
|
+
*
|
|
12
|
+
* The whole document is replaced rather than a minimal edit computed. It is the
|
|
13
|
+
* honest version: a diff would have to be trusted to be equivalent to the
|
|
14
|
+
* replacement, and a formatter that moved a line somewhere unintended would do
|
|
15
|
+
* it silently. The cursor is kept where it was in the new text, clamped, because
|
|
16
|
+
* a format that sends the caret to the top of the file is a format nobody
|
|
17
|
+
* presses twice.
|
|
18
|
+
*
|
|
19
|
+
* **A document with two character line endings comes back with one character
|
|
20
|
+
* ones**, because that is what `language.md` 3.1 normalises a file to before
|
|
21
|
+
* anything reads it and what every offset in this tier indexes. It is the one
|
|
22
|
+
* change to a file's bytes that formatting makes without being asked, and it is
|
|
23
|
+
* recorded in `spec/editor-narrowings.json`.
|
|
24
|
+
*/
|
|
25
|
+
import { format } from '../../editor/index.js';
|
|
26
|
+
import type { EditorView } from './contract.js';
|
|
27
|
+
import { documentOf, normalisedOffset } from './positions.js';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Lays the document out again, and says whether anything changed.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* keymap.of([{ key: "Shift-Alt-f", run: formatDocument }])
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* False where the document is already laid out, which is what an editor command
|
|
37
|
+
* returns when it has nothing to do: the key press then falls through to
|
|
38
|
+
* whatever else is bound to it rather than being swallowed.
|
|
39
|
+
*/
|
|
40
|
+
export function formatDocument(view: EditorView): boolean {
|
|
41
|
+
const raw = view.state.doc.toString();
|
|
42
|
+
const held = documentOf(raw);
|
|
43
|
+
const laid = format(held.text);
|
|
44
|
+
if (laid === raw) return false;
|
|
45
|
+
|
|
46
|
+
const at = normalisedOffset(held, view.state.selection.main.head);
|
|
47
|
+
view.dispatch({
|
|
48
|
+
changes: { from: 0, to: view.state.doc.length, insert: laid },
|
|
49
|
+
selection: { anchor: Math.min(at, laid.length) },
|
|
50
|
+
scrollIntoView: true,
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completions, as the editor's completion source.
|
|
3
|
+
*
|
|
4
|
+
* The whole of the work is done by `complete`, which reads the standard library
|
|
5
|
+
* manifest, the checker's bindings and the error catalogue. What is here is the
|
|
6
|
+
* translation: the editor wants a range to replace, a list of rows, and a note
|
|
7
|
+
* about whether the list is already filtered.
|
|
8
|
+
*
|
|
9
|
+
* **The list is already filtered**, by the word the writer has typed, compared
|
|
10
|
+
* exactly, because the language's names are case sensitive. So `filter` is false
|
|
11
|
+
* and the editor is told not to filter it again: its own matcher is fuzzy and
|
|
12
|
+
* case insensitive, and running it over a list that has already answered the
|
|
13
|
+
* question would put `EMA` in front of somebody as though it compiled.
|
|
14
|
+
*
|
|
15
|
+
* **A planned call is shown and marked.** `complete` carries the catalogue's own
|
|
16
|
+
* OS2020 sentence on a planned row, so that is what goes in the row's expanded
|
|
17
|
+
* note, and the row is pushed to the bottom of the list with the editor's own
|
|
18
|
+
* boost. A host that would rather not show them at all drops them with one
|
|
19
|
+
* field, which is why they are marked rather than filtered here.
|
|
20
|
+
*/
|
|
21
|
+
import { complete } from '../../editor/index.js';
|
|
22
|
+
import type { Completion } from '../../editor/index.js';
|
|
23
|
+
import type {
|
|
24
|
+
EditorCompletion,
|
|
25
|
+
EditorCompletionContext,
|
|
26
|
+
EditorCompletionResult,
|
|
27
|
+
} from './contract.js';
|
|
28
|
+
import { COMPLETION_TYPES } from './tokens.js';
|
|
29
|
+
|
|
30
|
+
/** As far down the list as the editor will move a row. */
|
|
31
|
+
const PLANNED_BOOST = -99;
|
|
32
|
+
|
|
33
|
+
function rowOf(one: Completion): EditorCompletion {
|
|
34
|
+
const info = one.refusal ?? one.summary;
|
|
35
|
+
const type = COMPLETION_TYPES[one.kind];
|
|
36
|
+
return {
|
|
37
|
+
label: one.label,
|
|
38
|
+
...(type === undefined ? {} : { type }),
|
|
39
|
+
detail: one.detail,
|
|
40
|
+
...(info === undefined ? {} : { info }),
|
|
41
|
+
...(one.insert === one.label ? {} : { apply: one.insert }),
|
|
42
|
+
...(one.planned ? { boost: PLANNED_BOOST } : {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Every completion for the position the editor is asking about.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* autocompletion({ override: [openscriptCompletion] })
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Nothing comes back for an empty list rather than an empty list, because the
|
|
54
|
+
* editor reads the two differently: an empty result closes the panel and null
|
|
55
|
+
* lets another source answer, and a host with a snippet source of its own should
|
|
56
|
+
* keep it.
|
|
57
|
+
*/
|
|
58
|
+
export function openscriptCompletion(
|
|
59
|
+
context: EditorCompletionContext,
|
|
60
|
+
): EditorCompletionResult | null {
|
|
61
|
+
const rows = complete(context.state.doc.toString(), context.pos);
|
|
62
|
+
// The first row carries the range every row replaces, so an empty list and a
|
|
63
|
+
// list whose first row is missing are one answer: nothing. Two guards for that
|
|
64
|
+
// would be one guard and a line no test can reach.
|
|
65
|
+
const first = rows[0];
|
|
66
|
+
if (first === undefined) return null;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
from: first.replace.offset,
|
|
70
|
+
to: first.replace.offset + first.replace.length,
|
|
71
|
+
options: rows.map(rowOf),
|
|
72
|
+
filter: false,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The editor component's own shapes, as this adapter targets them.
|
|
3
|
+
*
|
|
4
|
+
* **Why they are declared here rather than imported.** The editor component is a
|
|
5
|
+
* peer dependency: a host that wants a text area installs it, and a host that
|
|
6
|
+
* wants only the language must not be made to. This repository therefore does
|
|
7
|
+
* not install it, cannot type check against it, and would fail its own layering
|
|
8
|
+
* check the moment a file here imported it. It is the same decision the chart
|
|
9
|
+
* adapter took, for the same reason, and `src/adapters/charts/contract.ts` says
|
|
10
|
+
* it at length.
|
|
11
|
+
*
|
|
12
|
+
* So the shapes this produces values for are declared below and the host's own
|
|
13
|
+
* build is where the two meet. Each one is a one line check that costs a host
|
|
14
|
+
* nothing and fails to compile if this file has drifted:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import type { StreamParser } from "<the editor's language package>";
|
|
18
|
+
* import type { CompletionSource } from "<the editor's completion package>";
|
|
19
|
+
* import type { Diagnostic } from "<the editor's lint package>";
|
|
20
|
+
*
|
|
21
|
+
* const parser: StreamParser<unknown> = openscriptStream;
|
|
22
|
+
* const source: CompletionSource = openscriptCompletion;
|
|
23
|
+
* const linter: (view: EditorView) => Diagnostic[] = openscriptLint;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* **That line catches a value of the wrong shape and not an argument of the
|
|
27
|
+
* wrong shape.** A method's parameters are compared in both directions, so a
|
|
28
|
+
* hook declared here as taking something the editor never passes still assigns.
|
|
29
|
+
* That is the failure the chart adapter has actually made, so every member below
|
|
30
|
+
* takes the editor's own argument, spelled as the editor spells it, and every
|
|
31
|
+
* test drives each one with the argument the editor passes rather than with one
|
|
32
|
+
* of its own.
|
|
33
|
+
*
|
|
34
|
+
* **A style name is not checked by any of those lines.** The names this adapter
|
|
35
|
+
* returns from `token` are looked up by the editor in its own table of
|
|
36
|
+
* highlighting tags at run time, and an unknown one is a warning on a console
|
|
37
|
+
* rather than a compile error. That is why the whole mapping is one exported
|
|
38
|
+
* record a host can replace in a line, and why it is recorded in
|
|
39
|
+
* `spec/editor-narrowings.json` as the one thing here a type cannot hold.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* One line of the document, as the editor's tokenizer sees it.
|
|
44
|
+
*
|
|
45
|
+
* The editor hands a tokenizer a line at a time and expects `pos` to have moved
|
|
46
|
+
* forward when `token` returns. Only the members this adapter reads are
|
|
47
|
+
* declared: a narrower shape is still assignable from the editor's wider one.
|
|
48
|
+
*/
|
|
49
|
+
export interface EditorStringStream {
|
|
50
|
+
/** The line's text, without its line ending. */
|
|
51
|
+
readonly string: string;
|
|
52
|
+
/** Where the tokenizer has got to, which this adapter moves. */
|
|
53
|
+
pos: number;
|
|
54
|
+
/** Where the current token began. */
|
|
55
|
+
readonly start: number;
|
|
56
|
+
/** Whether `pos` is at the end of the line. */
|
|
57
|
+
eol(): boolean;
|
|
58
|
+
/** Whether `pos` is at the start of the line. */
|
|
59
|
+
sol(): boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A tokenizer the editor drives one line at a time.
|
|
64
|
+
*
|
|
65
|
+
* `token` returns a style name, or null for text with no style of its own. The
|
|
66
|
+
* state is the tokenizer's to define, and the editor copies it at line
|
|
67
|
+
* boundaries so that it can restart mid document, which is why `copyState` is
|
|
68
|
+
* here.
|
|
69
|
+
*/
|
|
70
|
+
export interface EditorStreamParser<State> {
|
|
71
|
+
readonly name?: string;
|
|
72
|
+
startState?(indentUnit: number): State;
|
|
73
|
+
token(stream: EditorStringStream, state: State): string | null;
|
|
74
|
+
copyState?(state: State): State;
|
|
75
|
+
blankLine?(state: State, indentUnit: number): void;
|
|
76
|
+
readonly languageData?: Readonly<Record<string, unknown>>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The document, which the editor holds as a rope rather than as a string. */
|
|
80
|
+
export interface EditorText {
|
|
81
|
+
readonly length: number;
|
|
82
|
+
toString(): string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The part of the editor's state this adapter reads. */
|
|
86
|
+
export interface EditorState {
|
|
87
|
+
readonly doc: EditorText;
|
|
88
|
+
readonly selection: {
|
|
89
|
+
readonly main: { readonly head: number; readonly from: number; readonly to: number };
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The part of the editor's view this adapter reads and dispatches to. */
|
|
94
|
+
export interface EditorView {
|
|
95
|
+
readonly state: EditorState;
|
|
96
|
+
dispatch(transaction: {
|
|
97
|
+
readonly changes: { readonly from: number; readonly to: number; readonly insert: string };
|
|
98
|
+
readonly selection?: { readonly anchor: number };
|
|
99
|
+
readonly scrollIntoView?: boolean;
|
|
100
|
+
}): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** What the editor hands a completion source. */
|
|
104
|
+
export interface EditorCompletionContext {
|
|
105
|
+
readonly state: EditorState;
|
|
106
|
+
readonly pos: number;
|
|
107
|
+
/** Whether the writer asked for completions rather than merely typing. */
|
|
108
|
+
readonly explicit: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** One row of the editor's completion list. */
|
|
112
|
+
export interface EditorCompletion {
|
|
113
|
+
readonly label: string;
|
|
114
|
+
/** The editor's own name for the icon beside a row. */
|
|
115
|
+
readonly type?: string;
|
|
116
|
+
readonly detail?: string;
|
|
117
|
+
readonly info?: string;
|
|
118
|
+
/** The text to insert, where it differs from the label. */
|
|
119
|
+
readonly apply?: string;
|
|
120
|
+
/** Moves a row up or down the list, from -99 to 99. */
|
|
121
|
+
readonly boost?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface EditorCompletionResult {
|
|
125
|
+
readonly from: number;
|
|
126
|
+
readonly to?: number;
|
|
127
|
+
readonly options: readonly EditorCompletion[];
|
|
128
|
+
/** False when the list is already filtered, which this adapter's is. */
|
|
129
|
+
readonly filter?: boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** One squiggle in the editor's lint panel and gutter. */
|
|
133
|
+
export interface EditorDiagnostic {
|
|
134
|
+
readonly from: number;
|
|
135
|
+
readonly to: number;
|
|
136
|
+
readonly severity: 'hint' | 'info' | 'warning' | 'error';
|
|
137
|
+
readonly message: string;
|
|
138
|
+
/** Where the diagnostic came from, shown beside the message. */
|
|
139
|
+
readonly source?: string;
|
|
140
|
+
readonly actions?: readonly {
|
|
141
|
+
readonly name: string;
|
|
142
|
+
apply(view: EditorView, from: number, to: number): void;
|
|
143
|
+
}[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** What the editor shows over the text, and the element it shows. */
|
|
147
|
+
export interface EditorTooltipView {
|
|
148
|
+
readonly dom: unknown;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface EditorTooltip {
|
|
152
|
+
readonly pos: number;
|
|
153
|
+
readonly end?: number;
|
|
154
|
+
readonly above?: boolean;
|
|
155
|
+
create(view: EditorView): EditorTooltipView;
|
|
156
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The editor adapter: the language intelligence, wired into a text component.
|
|
3
|
+
*
|
|
4
|
+
* This and the chart adapter are the only modules in the repository allowed to
|
|
5
|
+
* know two worlds at once, and it is the piece a platform with its own editor
|
|
6
|
+
* replaces rather than the piece it patches. Everything under `src/editor` stays
|
|
7
|
+
* ignorant of any component, and the layering check is what keeps it that way.
|
|
8
|
+
*
|
|
9
|
+
* **The editor component is a peer dependency, and nothing here imports it.** A
|
|
10
|
+
* package that pulled a text component into everyone's install would defeat the
|
|
11
|
+
* point of a language a platform can take on its own, so the shapes this
|
|
12
|
+
* produces are declared in `contract.ts` and the host's own build is where the
|
|
13
|
+
* two are compared, in one line per piece. See that file for the lines. The
|
|
14
|
+
* entry point resolves and every function here runs in an install that holds no
|
|
15
|
+
* editor at all, which `scripts/check-entry-points.mjs` proves on every build.
|
|
16
|
+
*
|
|
17
|
+
* Six functions in, five pieces out:
|
|
18
|
+
*
|
|
19
|
+
* openscriptStream highlighting, a line at a time
|
|
20
|
+
* openscriptCompletion the completion list
|
|
21
|
+
* openscriptLint errors as you type, with their fixes
|
|
22
|
+
* openscriptHoverTooltip what the thing under the pointer is
|
|
23
|
+
* openscriptSignatureTooltip the call being written
|
|
24
|
+
* formatDocument lay the script out again
|
|
25
|
+
*
|
|
26
|
+
* The two tooltips take the markup as a parameter and have no default for it, so
|
|
27
|
+
* nothing in this package names a browser global at any tier. A host that wants
|
|
28
|
+
* none of this calls the six functions itself and draws its own. That is not the fallback, it is the supported path: what a host gives up
|
|
29
|
+
* by taking these instead is recorded in `spec/editor-narrowings.json`, which is
|
|
30
|
+
* three lines long and worth reading before choosing.
|
|
31
|
+
*/
|
|
32
|
+
export type {
|
|
33
|
+
EditorCompletion,
|
|
34
|
+
EditorCompletionContext,
|
|
35
|
+
EditorCompletionResult,
|
|
36
|
+
EditorDiagnostic,
|
|
37
|
+
EditorState,
|
|
38
|
+
EditorStreamParser,
|
|
39
|
+
EditorStringStream,
|
|
40
|
+
EditorText,
|
|
41
|
+
EditorTooltip,
|
|
42
|
+
EditorTooltipView,
|
|
43
|
+
EditorView,
|
|
44
|
+
} from './contract.js';
|
|
45
|
+
|
|
46
|
+
export { COMPLETION_TYPES, HIGHLIGHT_TOKENS } from './tokens.js';
|
|
47
|
+
|
|
48
|
+
export type { StreamState } from './stream.js';
|
|
49
|
+
export { openscriptStream } from './stream.js';
|
|
50
|
+
|
|
51
|
+
export { openscriptCompletion } from './completion.js';
|
|
52
|
+
|
|
53
|
+
export { diagnosticsFor, openscriptLint } from './lint.js';
|
|
54
|
+
|
|
55
|
+
export type { Renderer } from './tooltips.js';
|
|
56
|
+
export {
|
|
57
|
+
hoverLines,
|
|
58
|
+
openscriptHoverTooltip,
|
|
59
|
+
openscriptSignatureTooltip,
|
|
60
|
+
signatureLines,
|
|
61
|
+
} from './tooltips.js';
|
|
62
|
+
|
|
63
|
+
export { formatDocument } from './commands.js';
|
|
64
|
+
|
|
65
|
+
export type { Document } from './positions.js';
|
|
66
|
+
export { documentOf, normalisedOffset } from './positions.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Errors as you type, as the editor's linter.
|
|
3
|
+
*
|
|
4
|
+
* The diagnostics are the compiler's own, whole: `diagnose` runs the lexer, the
|
|
5
|
+
* parser, the checker and the emitter, so what a writer sees beside their line
|
|
6
|
+
* is exactly what a compile produces and nothing new can appear when they press
|
|
7
|
+
* apply. Every message and every fix came from the error catalogue that the
|
|
8
|
+
* documentation site is generated from.
|
|
9
|
+
*
|
|
10
|
+
* Three decisions worth stating, because each one is visible to a trader.
|
|
11
|
+
*
|
|
12
|
+
* **The fix is shown.** A `Diagnostic` carries a message saying what is wrong and
|
|
13
|
+
* a fix saying what to do, and the fix is the half that is worth reading. The
|
|
14
|
+
* editor's panel shows one string, so the two are joined with a line break
|
|
15
|
+
* rather than the fix being dropped.
|
|
16
|
+
*
|
|
17
|
+
* **The code is the source.** The editor shows a diagnostic's source beside its
|
|
18
|
+
* message, and a code is the one part of a diagnostic this project promises never
|
|
19
|
+
* to change, so it is what a trader quotes and what a support page is indexed by.
|
|
20
|
+
*
|
|
21
|
+
* **A zero width span is widened by one character.** The compiler points at a
|
|
22
|
+
* position for a mistake that is an absence, a missing bracket among them, and a
|
|
23
|
+
* squiggle of no width is a squiggle nobody sees.
|
|
24
|
+
*/
|
|
25
|
+
import { endOffset } from '../../core/index.js';
|
|
26
|
+
import type { Diagnostic } from '../../core/index.js';
|
|
27
|
+
import { diagnose } from '../../editor/index.js';
|
|
28
|
+
import type { EditorDiagnostic, EditorView } from './contract.js';
|
|
29
|
+
import { documentOf } from './positions.js';
|
|
30
|
+
|
|
31
|
+
/** What the editor prints beside a message, which is the code and nothing else. */
|
|
32
|
+
function sourceOf(one: Diagnostic): string {
|
|
33
|
+
return one.code;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Every diagnostic of a document, in the editor's own shape. */
|
|
37
|
+
export function diagnosticsFor(raw: string): readonly EditorDiagnostic[] {
|
|
38
|
+
const held = documentOf(raw);
|
|
39
|
+
return diagnose(held.text).map((one) => {
|
|
40
|
+
const from = held.at(one.span.offset);
|
|
41
|
+
const to = held.at(endOffset(one.span));
|
|
42
|
+
return {
|
|
43
|
+
from,
|
|
44
|
+
to: to > from ? to : from + 1,
|
|
45
|
+
severity: one.severity,
|
|
46
|
+
message: `${one.message}\n${one.fix}`,
|
|
47
|
+
source: sourceOf(one),
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The linter a host wires in one line.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* linter(openscriptLint)
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* It is synchronous because it is fast enough to be: a finished ninety line
|
|
60
|
+
* study compiles in a third of a millisecond and the same file with a bracket
|
|
61
|
+
* left open in about a millisecond, both with a budget in the benchmark suite.
|
|
62
|
+
* The editor's own linter already debounces, so nothing here does it twice.
|
|
63
|
+
*/
|
|
64
|
+
export function openscriptLint(view: EditorView): readonly EditorDiagnostic[] {
|
|
65
|
+
return diagnosticsFor(view.state.doc.toString());
|
|
66
|
+
}
|