@invinite-org/chartlang-runtime 1.0.2 → 1.1.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +9 -0
  3. package/dist/createScriptRunner.d.ts +55 -4
  4. package/dist/createScriptRunner.d.ts.map +1 -1
  5. package/dist/createScriptRunner.js +103 -35
  6. package/dist/createScriptRunner.js.map +1 -1
  7. package/dist/dep/DepOutputStore.d.ts +92 -0
  8. package/dist/dep/DepOutputStore.d.ts.map +1 -0
  9. package/dist/dep/DepOutputStore.js +0 -0
  10. package/dist/dep/DepOutputStore.js.map +1 -0
  11. package/dist/dep/DepRunner.d.ts +146 -0
  12. package/dist/dep/DepRunner.d.ts.map +1 -0
  13. package/dist/dep/DepRunner.js +243 -0
  14. package/dist/dep/DepRunner.js.map +1 -0
  15. package/dist/dep/depOutput.d.ts +50 -0
  16. package/dist/dep/depOutput.d.ts.map +1 -0
  17. package/dist/dep/depOutput.js +92 -0
  18. package/dist/dep/depOutput.js.map +1 -0
  19. package/dist/dep/emissionFilter.d.ts +70 -0
  20. package/dist/dep/emissionFilter.d.ts.map +1 -0
  21. package/dist/dep/emissionFilter.js +105 -0
  22. package/dist/dep/emissionFilter.js.map +1 -0
  23. package/dist/dep/index.d.ts +8 -0
  24. package/dist/dep/index.d.ts.map +1 -0
  25. package/dist/dep/index.js +7 -0
  26. package/dist/dep/index.js.map +1 -0
  27. package/dist/emit/applyPlotOverride.d.ts +24 -0
  28. package/dist/emit/applyPlotOverride.d.ts.map +1 -0
  29. package/dist/emit/applyPlotOverride.js +48 -0
  30. package/dist/emit/applyPlotOverride.js.map +1 -0
  31. package/dist/emit/hline.d.ts +6 -4
  32. package/dist/emit/hline.d.ts.map +1 -1
  33. package/dist/emit/hline.js +5 -2
  34. package/dist/emit/hline.js.map +1 -1
  35. package/dist/emit/index.d.ts +2 -1
  36. package/dist/emit/index.d.ts.map +1 -1
  37. package/dist/emit/index.js +2 -1
  38. package/dist/emit/index.js.map +1 -1
  39. package/dist/emit/paneResolver.d.ts +52 -11
  40. package/dist/emit/paneResolver.d.ts.map +1 -1
  41. package/dist/emit/paneResolver.js +69 -26
  42. package/dist/emit/paneResolver.js.map +1 -1
  43. package/dist/emit/plot.d.ts.map +1 -1
  44. package/dist/emit/plot.js +2 -1
  45. package/dist/emit/plot.js.map +1 -1
  46. package/dist/execution/dispose.d.ts.map +1 -1
  47. package/dist/execution/dispose.js +7 -0
  48. package/dist/execution/dispose.js.map +1 -1
  49. package/dist/execution/onBarClose.d.ts +9 -13
  50. package/dist/execution/onBarClose.d.ts.map +1 -1
  51. package/dist/execution/onBarClose.js +28 -59
  52. package/dist/execution/onBarClose.js.map +1 -1
  53. package/dist/execution/onBarTick.d.ts +4 -10
  54. package/dist/execution/onBarTick.d.ts.map +1 -1
  55. package/dist/execution/onBarTick.js +24 -57
  56. package/dist/execution/onBarTick.js.map +1 -1
  57. package/dist/execution/runComputeStep.d.ts +68 -0
  58. package/dist/execution/runComputeStep.d.ts.map +1 -0
  59. package/dist/execution/runComputeStep.js +96 -0
  60. package/dist/execution/runComputeStep.js.map +1 -0
  61. package/dist/index.d.ts +3 -1
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +2 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal.d.ts +12 -0
  66. package/dist/internal.d.ts.map +1 -0
  67. package/dist/internal.js +14 -0
  68. package/dist/internal.js.map +1 -0
  69. package/dist/persistentStateStore.runtime.d.ts +18 -4
  70. package/dist/persistentStateStore.runtime.d.ts.map +1 -1
  71. package/dist/persistentStateStore.runtime.js +111 -18
  72. package/dist/persistentStateStore.runtime.js.map +1 -1
  73. package/dist/persistentStateStore.validate.d.ts +11 -1
  74. package/dist/persistentStateStore.validate.d.ts.map +1 -1
  75. package/dist/persistentStateStore.validate.js +32 -3
  76. package/dist/persistentStateStore.validate.js.map +1 -1
  77. package/dist/runtimeContext.d.ts +62 -4
  78. package/dist/runtimeContext.d.ts.map +1 -1
  79. package/dist/runtimeContext.js.map +1 -1
  80. package/dist/state/stateNamespace.d.ts.map +1 -1
  81. package/dist/state/stateNamespace.js +13 -2
  82. package/dist/state/stateNamespace.js.map +1 -1
  83. package/dist/stateStore.d.ts +6 -3
  84. package/dist/stateStore.d.ts.map +1 -1
  85. package/dist/stateStore.js.map +1 -1
  86. package/package.json +7 -3
@@ -0,0 +1,105 @@
1
+ // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
+ // See the LICENSE file in the repo root for full license text.
3
+ function prefixSlotId(slotId, prefix) {
4
+ return `${prefix}${slotId}`;
5
+ }
6
+ function prefixNullableSlotId(slotId, prefix) {
7
+ return slotId === null ? null : prefixSlotId(slotId, prefix);
8
+ }
9
+ function resetEmissions(emissions) {
10
+ emissions.plots = [];
11
+ emissions.drawings = [];
12
+ emissions.alerts = [];
13
+ emissions.alertConditions = [];
14
+ emissions.logs = [];
15
+ emissions.diagnostics = [];
16
+ }
17
+ function producerIdOf(runner) {
18
+ return runner.kind === "dep" ? runner.localId : runner.exportName;
19
+ }
20
+ /**
21
+ * Apply the dep / sibling emission policy. Captures titled plots into
22
+ * the shared {@link DepOutputStore}, drops private-dep visuals, prefixes
23
+ * sibling emissions with `export:<exportName>/`, and namespaces every
24
+ * diagnostic with the runner's slot-id prefix. Always resets the
25
+ * runner's queue at the end so the next bar starts clean.
26
+ *
27
+ * Per-bar NaN padding: for every declared output that the runner did
28
+ * NOT call `plot(value, { title: "<output>" })` on this bar, the
29
+ * filter appends a NaN to the store so the consumer's series stays
30
+ * continuous (NaN gaps where the producer skipped).
31
+ *
32
+ * @since 0.7
33
+ * @stable
34
+ * @example
35
+ * // import { applyDepEmissionPolicy } from "@invinite-org/chartlang-runtime";
36
+ * // applyDepEmissionPolicy(dep, parentEmissions, depOutputStore);
37
+ */
38
+ export function applyDepEmissionPolicy(runner, parentEmissions, depOutputStore) {
39
+ const producerId = producerIdOf(runner);
40
+ const declared = new Set(runner.declaredOutputs);
41
+ const pushedTitles = new Set();
42
+ for (const plot of runner.emissions.plots) {
43
+ const title = plot.title;
44
+ if (declared.has(title)) {
45
+ depOutputStore.push(producerId, title, plot.value ?? Number.NaN);
46
+ pushedTitles.add(title);
47
+ }
48
+ else if (runner.kind === "dep") {
49
+ // Untitled / unknown-title plot in a private dep — surface as
50
+ // a diagnostic; the visual is still dropped.
51
+ const diag = {
52
+ kind: "diagnostic",
53
+ severity: "warning",
54
+ code: "dep-output-not-titled",
55
+ message: title === ""
56
+ ? `dep "${runner.localId}" emitted an untitled plot`
57
+ : `dep "${runner.localId}" emitted plot with undeclared title "${title}"`,
58
+ slotId: prefixSlotId(plot.slotId, runner.slotIdPrefix),
59
+ bar: plot.bar,
60
+ };
61
+ parentEmissions.diagnostics.push(diag);
62
+ }
63
+ if (runner.kind === "sibling") {
64
+ parentEmissions.plots.push({
65
+ ...plot,
66
+ slotId: prefixSlotId(plot.slotId, runner.slotIdPrefix),
67
+ });
68
+ }
69
+ }
70
+ if (runner.kind === "sibling") {
71
+ for (const drawing of runner.emissions.drawings) {
72
+ parentEmissions.drawings.push(drawing);
73
+ }
74
+ for (const alert of runner.emissions.alerts) {
75
+ parentEmissions.alerts.push({
76
+ ...alert,
77
+ slotId: prefixSlotId(alert.slotId, runner.slotIdPrefix),
78
+ });
79
+ }
80
+ const siblingConditions = runner.emissions.alertConditions ?? [];
81
+ if (siblingConditions.length > 0) {
82
+ const target = parentEmissions.alertConditions ?? [];
83
+ parentEmissions.alertConditions = target;
84
+ for (const condition of siblingConditions) {
85
+ target.push(condition);
86
+ }
87
+ }
88
+ for (const log of runner.emissions.logs) {
89
+ parentEmissions.logs.push(log);
90
+ }
91
+ }
92
+ for (const diag of runner.emissions.diagnostics) {
93
+ parentEmissions.diagnostics.push({
94
+ ...diag,
95
+ slotId: prefixNullableSlotId(diag.slotId, runner.slotIdPrefix),
96
+ });
97
+ }
98
+ for (const title of declared) {
99
+ if (!pushedTitles.has(title)) {
100
+ depOutputStore.push(producerId, title, Number.NaN);
101
+ }
102
+ }
103
+ resetEmissions(runner.emissions);
104
+ }
105
+ //# sourceMappingURL=emissionFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emissionFilter.js","sourceRoot":"","sources":["../../src/dep/emissionFilter.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAyD/D,SAAS,YAAY,CAAC,MAAc,EAAE,MAAc;IAChD,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAChC,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAqB,EAAE,MAAc;IAC/D,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,cAAc,CAAC,SAAiC;IACrD,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC;IACrB,SAAS,CAAC,QAAQ,GAAG,EAAE,CAAC;IACxB,SAAS,CAAC,MAAM,GAAG,EAAE,CAAC;IACtB,SAAS,CAAC,eAAe,GAAG,EAAE,CAAC;IAC/B,SAAS,CAAC,IAAI,GAAG,EAAE,CAAC;IACpB,SAAS,CAAC,WAAW,GAAG,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,YAAY,CAAC,MAAyC;IAC3D,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB,CAClC,MAAyC,EACzC,eAAuC,EACvC,cAA8B;IAE9B,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,I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CAAC;YAC3B,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QACvD,CAAC;IACL,CAAC;IAED,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type { DepOutputDeclaration, DepOutputStore } from "./DepOutputStore.js";
2
+ export { createDepOutputStore } from "./DepOutputStore.js";
3
+ export type { CreateDepRunnerArgs, DepRunner, SiblingRunner, } from "./DepRunner.js";
4
+ export { createDepRunner, createSiblingRunner, runDepStep, runSiblingStep, } from "./DepRunner.js";
5
+ export type { DepRunnerLike, SiblingRunnerLike, } from "./emissionFilter.js";
6
+ export { applyDepEmissionPolicy } from "./emissionFilter.js";
7
+ export { DEP_OUTPUT_GLOBAL_KEY, __chartlang_depOutput, installDepOutputGlobal, } from "./depOutput.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dep/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EACR,mBAAmB,EACnB,SAAS,EACT,aAAa,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,cAAc,GACjB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACR,aAAa,EACb,iBAAiB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
+ // See the LICENSE file in the repo root for full license text.
3
+ export { createDepOutputStore } from "./DepOutputStore.js";
4
+ export { createDepRunner, createSiblingRunner, runDepStep, runSiblingStep, } from "./DepRunner.js";
5
+ export { applyDepEmissionPolicy } from "./emissionFilter.js";
6
+ export { DEP_OUTPUT_GLOBAL_KEY, __chartlang_depOutput, installDepOutputGlobal, } from "./depOutput.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dep/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAM3D,OAAO,EACH,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,cAAc,GACjB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { PlotEmission, PlotOverride } from "@invinite-org/chartlang-adapter-kit";
2
+ /**
3
+ * Apply a `PlotOverride` to a built `PlotEmission`. Pure / immutable —
4
+ * returns the input unchanged when `override` is `undefined`, sets
5
+ * `visible: false` only when `override.visible === false`, overwrites
6
+ * `color`, and merges `lineWidth` / `lineStyle` into `style` only
7
+ * when the emission's `style.kind` is line-family
8
+ * (`line | step-line | horizontal-line | area`). Non-line kinds
9
+ * ignore width/style silently (no diagnostic). `visible` is only ever
10
+ * written as `false` (never `true`), so no-override and visible-override
11
+ * emissions stay byte-identical to today.
12
+ *
13
+ * @since 0.8
14
+ * @stable
15
+ * @example
16
+ * const emission: PlotEmission = {
17
+ * kind: "plot", slotId: "s", title: "", style: { kind: "line", lineWidth: 1, lineStyle: "solid" },
18
+ * bar: 0, time: 0, value: 1, color: null, meta: {}, pane: "overlay",
19
+ * };
20
+ * const next = applyPlotOverride(emission, { color: "#f00" });
21
+ * void next;
22
+ */
23
+ export declare function applyPlotOverride(emission: PlotEmission, override: PlotOverride | undefined): PlotEmission;
24
+ //# sourceMappingURL=applyPlotOverride.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyPlotOverride.d.ts","sourceRoot":"","sources":["../../src/emit/applyPlotOverride.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAQtF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,GAAG,SAAS,GACnC,YAAY,CAmBd"}
@@ -0,0 +1,48 @@
1
+ // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
+ // See the LICENSE file in the repo root for full license text.
3
+ function isLineFamily(kind) {
4
+ return kind === "line" || kind === "step-line" || kind === "horizontal-line" || kind === "area";
5
+ }
6
+ /**
7
+ * Apply a `PlotOverride` to a built `PlotEmission`. Pure / immutable —
8
+ * returns the input unchanged when `override` is `undefined`, sets
9
+ * `visible: false` only when `override.visible === false`, overwrites
10
+ * `color`, and merges `lineWidth` / `lineStyle` into `style` only
11
+ * when the emission's `style.kind` is line-family
12
+ * (`line | step-line | horizontal-line | area`). Non-line kinds
13
+ * ignore width/style silently (no diagnostic). `visible` is only ever
14
+ * written as `false` (never `true`), so no-override and visible-override
15
+ * emissions stay byte-identical to today.
16
+ *
17
+ * @since 0.8
18
+ * @stable
19
+ * @example
20
+ * const emission: PlotEmission = {
21
+ * kind: "plot", slotId: "s", title: "", style: { kind: "line", lineWidth: 1, lineStyle: "solid" },
22
+ * bar: 0, time: 0, value: 1, color: null, meta: {}, pane: "overlay",
23
+ * };
24
+ * const next = applyPlotOverride(emission, { color: "#f00" });
25
+ * void next;
26
+ */
27
+ export function applyPlotOverride(emission, override) {
28
+ if (override === undefined)
29
+ return emission;
30
+ let next = emission;
31
+ if (override.visible === false)
32
+ next = { ...next, visible: false };
33
+ if (override.color !== undefined)
34
+ next = { ...next, color: override.color };
35
+ if ((override.lineWidth !== undefined || override.lineStyle !== undefined) &&
36
+ isLineFamily(next.style.kind)) {
37
+ next = {
38
+ ...next,
39
+ style: {
40
+ ...next.style,
41
+ ...(override.lineWidth !== undefined ? { lineWidth: override.lineWidth } : {}),
42
+ ...(override.lineStyle !== undefined ? { lineStyle: override.lineStyle } : {}),
43
+ },
44
+ };
45
+ }
46
+ return next;
47
+ }
48
+ //# sourceMappingURL=applyPlotOverride.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyPlotOverride.js","sourceRoot":"","sources":["../../src/emit/applyPlotOverride.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAI/D,SAAS,YAAY,CACjB,IAAmC;IAEnC,OAAO,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,iBAAiB,IAAI,IAAI,KAAK,MAAM,CAAC;AACpG,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAC7B,QAAsB,EACtB,QAAkC;IAElC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC5C,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,QAAQ,CAAC,OAAO,KAAK,KAAK;QAAE,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACnE,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS;QAAE,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC5E,IACI,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,IAAI,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC;QACtE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAC/B,CAAC;QACC,IAAI,GAAG;YACH,GAAG,IAAI;YACP,KAAK,EAAE;gBACH,GAAG,IAAI,CAAC,KAAK;gBACb,GAAG,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9E,GAAG,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACjF;SACJ,CAAC;IACN,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -9,10 +9,12 @@ import type { HLineOpts } from "@invinite-org/chartlang-core";
9
9
  * overload). Direct invocation without a slot id throws the sentinel
10
10
  * error.
11
11
  *
12
- * `hline` is fixed to `pane: "overlay"` horizontal lines never
13
- * route to a sub-pane in any phase. The `kind` discriminator is
14
- * always `"horizontal-line"`; adapters that don't declare the
15
- * capability drop with `unsupported-plot-kind`.
12
+ * `hline` follows the same pane router as {@link plot} — see
13
+ * {@link resolvePane}: `opts.pane` defaults to the script's
14
+ * manifest-resolved pane, `"new"` joins the per-script subpane, and a
15
+ * named pane folds to overlay on `subPanes: 0` adapters. The `kind`
16
+ * discriminator is always `"horizontal-line"`; adapters that don't
17
+ * declare the capability drop with `unsupported-plot-kind`.
16
18
  *
17
19
  * @since 0.1
18
20
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"hline.d.ts","sourceRoot":"","sources":["../../src/emit/hline.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA2C9D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;AAC7D;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"hline.d.ts","sourceRoot":"","sources":["../../src/emit/hline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA8C9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;AAC7D;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC"}
@@ -1,7 +1,9 @@
1
1
  // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
2
  // See the LICENSE file in the repo root for full license text.
3
3
  import { ACTIVE_RUNTIME_CONTEXT } from "../runtimeContext.js";
4
+ import { applyPlotOverride } from "./applyPlotOverride.js";
4
5
  import { pushDiagnostic, pushPlot } from "./emissionsQueue.js";
6
+ import { resolvePane } from "./paneResolver.js";
5
7
  const OUTSIDE_CTX_MESSAGE = "hline called outside an active script step";
6
8
  function hlineImpl(ctx, slotId, price, opts) {
7
9
  const style = {
@@ -20,6 +22,7 @@ function hlineImpl(ctx, slotId, price, opts) {
20
22
  });
21
23
  return;
22
24
  }
25
+ const pane = resolvePane(opts.pane, ctx, slotId);
23
26
  const emission = {
24
27
  kind: "plot",
25
28
  slotId,
@@ -30,9 +33,9 @@ function hlineImpl(ctx, slotId, price, opts) {
30
33
  value: Number.isFinite(price) ? price : null,
31
34
  color: opts.color ?? null,
32
35
  meta: {},
33
- pane: "overlay",
36
+ pane,
34
37
  };
35
- pushPlot(ctx.emissions, emission);
38
+ pushPlot(ctx.emissions, applyPlotOverride(emission, ctx.plotOverrides[slotId]));
36
39
  }
37
40
  /**
38
41
  * Implementation signature for {@link hline}. Branches on
@@ -1 +1 @@
1
- {"version":3,"file":"hline.js","sourceRoot":"","sources":["../../src/emit/hline.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAK/D,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,mBAAmB,GAAG,4CAA4C,CAAC;AAEzE,SAAS,SAAS,CAAC,GAAmB,EAAE,MAAc,EAAE,KAAa,EAAE,IAAe;IAClF,MAAM,KAAK,GAAc;QACrB,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,CAAC;QAC9B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,OAAO;KACvC,CAAC;IAEF,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACjD,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE;YAC1B,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,oDAAoD;YAC7D,MAAM;YACN,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;SACtB,CAAC,CAAC;QACH,OAAO;IACX,CAAC;IAED,MAAM,QAAQ,GAAiB;QAC3B,IAAI,EAAE,MAAM;QACZ,MAAM;QACN,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;QACvB,KAAK;QACL,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;QACnB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI;QACzB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QAC5C,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,I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AG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IACD,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,11 +1,12 @@
1
1
  export { alert } from "./alert.js";
2
2
  export { emitAlertCondition } from "./alertConditionEmission.js";
3
+ export { applyPlotOverride } from "./applyPlotOverride.js";
3
4
  export { createDrawingHandle, draw, nextSubId, pushDrawing, resetSubIdCounters, } from "./draw/index.js";
4
5
  export { pushAlert, pushAlertCondition, pushDiagnostic, pushLog, pushPlot, } from "./emissionsQueue.js";
5
6
  export { hashStringStable } from "./hash.js";
6
7
  export { hline } from "./hline.js";
7
8
  export { buildRuntimeNamespace, emitLog } from "./logEmission.js";
8
- export { resolvePane } from "./paneResolver.js";
9
+ export { resolveDefaultPane, resolvePane, resolveScriptPane } from "./paneResolver.js";
9
10
  export { plot } from "./plot.js";
10
11
  export { isRuntimeErrorHalt, makeRuntimeErrorHalt } from "./runtimeError.js";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emit/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emit/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACH,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -2,12 +2,13 @@
2
2
  // See the LICENSE file in the repo root for full license text.
3
3
  export { alert } from "./alert.js";
4
4
  export { emitAlertCondition } from "./alertConditionEmission.js";
5
+ export { applyPlotOverride } from "./applyPlotOverride.js";
5
6
  export { createDrawingHandle, draw, nextSubId, pushDrawing, resetSubIdCounters, } from "./draw/index.js";
6
7
  export { pushAlert, pushAlertCondition, pushDiagnostic, pushLog, pushPlot, } from "./emissionsQueue.js";
7
8
  export { hashStringStable } from "./hash.js";
8
9
  export { hline } from "./hline.js";
9
10
  export { buildRuntimeNamespace, emitLog } from "./logEmission.js";
10
- export { resolvePane } from "./paneResolver.js";
11
+ export { resolveDefaultPane, resolvePane, resolveScriptPane } from "./paneResolver.js";
11
12
  export { plot } from "./plot.js";
12
13
  export { isRuntimeErrorHalt, makeRuntimeErrorHalt } from "./runtimeError.js";
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/emit/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/emit/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACH,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,19 +1,60 @@
1
+ import type { ScriptManifest } from "@invinite-org/chartlang-core";
1
2
  import type { RuntimeContext } from "../runtimeContext.js";
2
3
  /**
3
- * Resolve the pane requested by a `plot()` call against the Phase-1
4
- * runtime contract: every non-`"overlay"` pane folds back to
5
- * `"overlay"` and a `unsupported-pane` diagnostic is pushed.
4
+ * Derive the stable non-overlay pane key for a script from its
5
+ * manifest name. The name is sanitised (`/[^a-zA-Z0-9_-]/g` `-`) so
6
+ * it fits the `string` shape on `PlotEmission.pane` and cannot collide
7
+ * with the `script:` prefix structure (e.g. a `:` in the name becomes
8
+ * `-`); an empty name falls back to `"script:default"`. Both the
9
+ * primary runner and every dep / sibling sub-runner key off this so a
10
+ * script's distinct name yields a distinct subpane.
6
11
  *
7
- * Phase 1's canvas2d adapter declares `subPanes: 0`; even adapters
8
- * that grow `subPanes >= 1` later get the runtime fold until Phase 2
9
- * lights up sub-pane routing. The two branches differ only in the
10
- * diagnostic `message` both still return `"overlay"`.
12
+ * @since 0.2
13
+ * @stable
14
+ * @example
15
+ * // resolveScriptPane({ name: "RSI Cross", ... }) === "script:RSI-Cross"
16
+ * // resolveScriptPane({ name: "", ... }) === "script:default"
17
+ */
18
+ export declare function resolveScriptPane(manifest: ScriptManifest): string;
19
+ /**
20
+ * Resolve a script's mount-time default pane from `manifest.overlay`.
21
+ * `overlay` absent / `true` → `"overlay"` (the price pane); `overlay
22
+ * === false` → the script-owned subpane key from
23
+ * {@link resolveScriptPane}. The runner sets `RuntimeContext.defaultPane`
24
+ * to this once at mount; {@link resolvePane} reads it for any `plot()` /
25
+ * `hline()` call with no explicit `pane`.
26
+ *
27
+ * @since 0.2
28
+ * @stable
29
+ * @example
30
+ * // resolveDefaultPane({ name: "x", overlay: false, ... }) === "script:x"
31
+ * // resolveDefaultPane({ name: "x", ... }) === "overlay"
32
+ */
33
+ export declare function resolveDefaultPane(manifest: ScriptManifest): string;
34
+ /**
35
+ * Resolve the pane a `plot()` / `hline()` call routes to. Four
36
+ * branches:
37
+ * - `"overlay"` → `"overlay"` (the price pane; never folds).
38
+ * - `undefined` → `ctx.defaultPane` (the script's mount-time default
39
+ * from `manifest.overlay`).
40
+ * - `"new"` → `ctx.scriptPane` (one stable subpane per script, so
41
+ * every `"new"` callsite in a script joins the same subpane).
42
+ * - any other string → returned unchanged when
43
+ * `capabilities.subPanes >= 1`; otherwise folded to `"overlay"`
44
+ * with an `unsupported-pane` diagnostic (the bare-bones adapter
45
+ * compat path).
46
+ *
47
+ * The Phase-1 signature returned the literal `"overlay"` and folded every
48
+ * non-overlay request; the four-branch router widens the return type to
49
+ * `string` and the new `undefined` / `"new"` / named-pass-through
50
+ * branches arrive at `@since 0.2`.
11
51
  *
12
- * @since 0.1
52
+ * @since 0.2
53
+ * @stable
13
54
  * @example
14
55
  * // import { resolvePane } from "@invinite-org/chartlang-runtime/emit";
15
- * // const pane = resolvePane(undefined, ctx, "demo.ts:1:1#0");
16
- * // pane === "overlay"
56
+ * // const pane = resolvePane("rsi", ctx, "demo.ts:1:1#0");
57
+ * // pane === "rsi" // when ctx.capabilities.subPanes >= 1
17
58
  */
18
- export declare function resolvePane(requested: string | undefined, ctx: RuntimeContext, slotId: string): "overlay";
59
+ export declare function resolvePane(requested: string | undefined, ctx: RuntimeContext, slotId: string): string;
19
60
  //# sourceMappingURL=paneResolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paneResolver.d.ts","sourceRoot":"","sources":["../../src/emit/paneResolver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACvB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,GACf,SAAS,CAuBX"}
1
+ {"version":3,"file":"paneResolver.d.ts","sourceRoot":"","sources":["../../src/emit/paneResolver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAGlE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAEnE;AAeD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CACvB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,GACf,MAAM,CAKR"}
@@ -1,37 +1,46 @@
1
1
  // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
2
  // See the LICENSE file in the repo root for full license text.
3
3
  import { pushDiagnostic } from "./emissionsQueue.js";
4
+ const SANITISE_PANE_KEY = /[^a-zA-Z0-9_-]/g;
4
5
  /**
5
- * Resolve the pane requested by a `plot()` call against the Phase-1
6
- * runtime contract: every non-`"overlay"` pane folds back to
7
- * `"overlay"` and a `unsupported-pane` diagnostic is pushed.
6
+ * Derive the stable non-overlay pane key for a script from its
7
+ * manifest name. The name is sanitised (`/[^a-zA-Z0-9_-]/g` `-`) so
8
+ * it fits the `string` shape on `PlotEmission.pane` and cannot collide
9
+ * with the `script:` prefix structure (e.g. a `:` in the name becomes
10
+ * `-`); an empty name falls back to `"script:default"`. Both the
11
+ * primary runner and every dep / sibling sub-runner key off this so a
12
+ * script's distinct name yields a distinct subpane.
8
13
  *
9
- * Phase 1's canvas2d adapter declares `subPanes: 0`; even adapters
10
- * that grow `subPanes >= 1` later get the runtime fold until Phase 2
11
- * lights up sub-pane routing. The two branches differ only in the
12
- * diagnostic `message` both still return `"overlay"`.
14
+ * @since 0.2
15
+ * @stable
16
+ * @example
17
+ * // resolveScriptPane({ name: "RSI Cross", ... }) === "script:RSI-Cross"
18
+ * // resolveScriptPane({ name: "", ... }) === "script:default"
19
+ */
20
+ export function resolveScriptPane(manifest) {
21
+ const sanitised = manifest.name.replace(SANITISE_PANE_KEY, "-");
22
+ return `script:${sanitised === "" ? "default" : sanitised}`;
23
+ }
24
+ /**
25
+ * Resolve a script's mount-time default pane from `manifest.overlay`.
26
+ * `overlay` absent / `true` → `"overlay"` (the price pane); `overlay
27
+ * === false` → the script-owned subpane key from
28
+ * {@link resolveScriptPane}. The runner sets `RuntimeContext.defaultPane`
29
+ * to this once at mount; {@link resolvePane} reads it for any `plot()` /
30
+ * `hline()` call with no explicit `pane`.
13
31
  *
14
- * @since 0.1
32
+ * @since 0.2
33
+ * @stable
15
34
  * @example
16
- * // import { resolvePane } from "@invinite-org/chartlang-runtime/emit";
17
- * // const pane = resolvePane(undefined, ctx, "demo.ts:1:1#0");
18
- * // pane === "overlay"
35
+ * // resolveDefaultPane({ name: "x", overlay: false, ... }) === "script:x"
36
+ * // resolveDefaultPane({ name: "x", ... }) === "overlay"
19
37
  */
20
- export function resolvePane(requested, ctx, slotId) {
21
- const pane = requested ?? "overlay";
22
- if (pane === "overlay")
23
- return "overlay";
24
- if (ctx.capabilities.subPanes >= 1) {
25
- pushDiagnostic(ctx.emissions, {
26
- kind: "diagnostic",
27
- severity: "warning",
28
- code: "unsupported-pane",
29
- message: `Pane "${pane}" requested but Phase-1 runtime flattens to overlay.`,
30
- slotId,
31
- bar: ctx.barIndex(),
32
- });
33
- return "overlay";
34
- }
38
+ export function resolveDefaultPane(manifest) {
39
+ return manifest.overlay === false ? resolveScriptPane(manifest) : "overlay";
40
+ }
41
+ function resolveNamedPane(pane, ctx, slotId) {
42
+ if (ctx.capabilities.subPanes >= 1)
43
+ return pane;
35
44
  pushDiagnostic(ctx.emissions, {
36
45
  kind: "diagnostic",
37
46
  severity: "warning",
@@ -42,4 +51,38 @@ export function resolvePane(requested, ctx, slotId) {
42
51
  });
43
52
  return "overlay";
44
53
  }
54
+ /**
55
+ * Resolve the pane a `plot()` / `hline()` call routes to. Four
56
+ * branches:
57
+ * - `"overlay"` → `"overlay"` (the price pane; never folds).
58
+ * - `undefined` → `ctx.defaultPane` (the script's mount-time default
59
+ * from `manifest.overlay`).
60
+ * - `"new"` → `ctx.scriptPane` (one stable subpane per script, so
61
+ * every `"new"` callsite in a script joins the same subpane).
62
+ * - any other string → returned unchanged when
63
+ * `capabilities.subPanes >= 1`; otherwise folded to `"overlay"`
64
+ * with an `unsupported-pane` diagnostic (the bare-bones adapter
65
+ * compat path).
66
+ *
67
+ * The Phase-1 signature returned the literal `"overlay"` and folded every
68
+ * non-overlay request; the four-branch router widens the return type to
69
+ * `string` and the new `undefined` / `"new"` / named-pass-through
70
+ * branches arrive at `@since 0.2`.
71
+ *
72
+ * @since 0.2
73
+ * @stable
74
+ * @example
75
+ * // import { resolvePane } from "@invinite-org/chartlang-runtime/emit";
76
+ * // const pane = resolvePane("rsi", ctx, "demo.ts:1:1#0");
77
+ * // pane === "rsi" // when ctx.capabilities.subPanes >= 1
78
+ */
79
+ export function resolvePane(requested, ctx, slotId) {
80
+ if (requested === "overlay")
81
+ return "overlay";
82
+ if (requested === undefined)
83
+ return ctx.defaultPane;
84
+ if (requested === "new")
85
+ return resolveNamedPane(ctx.scriptPane, ctx, slotId);
86
+ return resolveNamedPane(requested, ctx, slotId);
87
+ }
45
88
  //# sourceMappingURL=paneResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"paneResolver.js","sourceRoot":"","sources":["../../src/emit/paneResolver.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CACvB,SAA6B,EAC7B,GAAmB,EACnB,MAAc;IAEd,MAAM,IAAI,GAAG,SAAS,IAAI,SAAS,CAAC;IACpC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,IAAI,GAAG,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC;QACjC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE;YAC1B,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,SAAS,IAAI,sDAAsD;YAC5E,MAAM;YACN,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;SACtB,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE;QAC1B,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAA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;;;GAwBG;AACH,MAAM,UAAU,WAAW,CACvB,SAA6B,EAC7B,GAAmB,EACnB,MAAc;IAEd,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,WAAW,CAAC;IACpD,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,gBAAgB,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9E,OAAO,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/emit/plot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAwHrE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;AAC5E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/emit/plot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAwHrE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;AAC5E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC"}
package/dist/emit/plot.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
2
  // See the LICENSE file in the repo root for full license text.
3
3
  import { ACTIVE_RUNTIME_CONTEXT } from "../runtimeContext.js";
4
+ import { applyPlotOverride } from "./applyPlotOverride.js";
4
5
  import { pushDiagnostic, pushPlot } from "./emissionsQueue.js";
5
6
  import { resolvePane } from "./paneResolver.js";
6
7
  const OUTSIDE_CTX_MESSAGE = "plot called outside an active script step";
@@ -99,7 +100,7 @@ function plotImpl(ctx, slotId, value, opts) {
99
100
  meta: {},
100
101
  pane,
101
102
  };
102
- pushPlot(ctx.emissions, emission);
103
+ pushPlot(ctx.emissions, applyPlotOverride(emission, ctx.plotOverrides[slotId]));
103
104
  }
104
105
  /**
105
106
  * Implementation signature for {@link plot}. Branches on
@@ -1 +1 @@
1
- {"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/emit/plot.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAK/D,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,mBAAmB,GAAG,2CAA2C,CAAC;AAExE,SAAS,cAAc,CAAC,CAAU;IAC9B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,SAAS,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAU;IAChC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC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AO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IACD,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;AAC1C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"dispose.d.ts","sourceRoot":"","sources":["../../src/execution/dispose.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAgChD"}
1
+ {"version":3,"file":"dispose.d.ts","sourceRoot":"","sources":["../../src/execution/dispose.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAuChD"}
@@ -22,6 +22,13 @@ import { flushStateSlots } from "../state/index.js";
22
22
  * // dispose(state);
23
23
  */
24
24
  export function dispose(state) {
25
+ for (const dep of state.depRunners) {
26
+ dispose(dep.state);
27
+ }
28
+ for (const sibling of state.siblingRunners) {
29
+ dispose(sibling.state);
30
+ }
31
+ state.depOutputStore?.dispose();
25
32
  flushStateSlots(state.runtimeContext);
26
33
  for (const buf of Object.values(state.mainStream.ohlcv)) {
27
34
  buf.reset();
@@ -1 +1 @@
1
- {"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