@invinite-org/chartlang-core 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +6 -1
  3. package/dist/alert/alert.d.ts +1 -1
  4. package/dist/alert/alert.js +1 -1
  5. package/dist/alert/alert.js.map +1 -1
  6. package/dist/alert/index.js.map +1 -1
  7. package/dist/color/colorHelpers.js.map +1 -1
  8. package/dist/color/index.js.map +1 -1
  9. package/dist/color/parseColor.js.map +1 -1
  10. package/dist/define/defineAlert.d.ts.map +1 -1
  11. package/dist/define/defineAlert.js +3 -2
  12. package/dist/define/defineAlert.js.map +1 -1
  13. package/dist/define/defineAlertCondition.d.ts.map +1 -1
  14. package/dist/define/defineAlertCondition.js +2 -1
  15. package/dist/define/defineAlertCondition.js.map +1 -1
  16. package/dist/define/defineDrawing.d.ts +2 -2
  17. package/dist/define/defineDrawing.d.ts.map +1 -1
  18. package/dist/define/defineDrawing.js +5 -4
  19. package/dist/define/defineDrawing.js.map +1 -1
  20. package/dist/define/defineIndicator.d.ts +11 -0
  21. package/dist/define/defineIndicator.d.ts.map +1 -1
  22. package/dist/define/defineIndicator.js +5 -2
  23. package/dist/define/defineIndicator.js.map +1 -1
  24. package/dist/define/depAccessorSentinel.d.ts +46 -0
  25. package/dist/define/depAccessorSentinel.d.ts.map +1 -0
  26. package/dist/define/depAccessorSentinel.js +51 -0
  27. package/dist/define/depAccessorSentinel.js.map +1 -0
  28. package/dist/define/dependency.d.ts +63 -0
  29. package/dist/define/dependency.d.ts.map +1 -0
  30. package/dist/define/dependency.js +4 -0
  31. package/dist/define/dependency.js.map +1 -0
  32. package/dist/define/index.d.ts +1 -0
  33. package/dist/define/index.d.ts.map +1 -1
  34. package/dist/define/index.js.map +1 -1
  35. package/dist/define/overrides.js.map +1 -1
  36. package/dist/draw/buckets.js.map +1 -1
  37. package/dist/draw/draw.d.ts +2 -3
  38. package/dist/draw/draw.d.ts.map +1 -1
  39. package/dist/draw/draw.js +1 -2
  40. package/dist/draw/draw.js.map +1 -1
  41. package/dist/draw/drawingKind.d.ts +1 -1
  42. package/dist/draw/drawingKind.js.map +1 -1
  43. package/dist/draw/drawingState.d.ts +5 -5
  44. package/dist/draw/drawingState.js.map +1 -1
  45. package/dist/draw/drawingStyle.d.ts +1 -1
  46. package/dist/draw/drawingStyle.js.map +1 -1
  47. package/dist/draw/handle.js.map +1 -1
  48. package/dist/draw/index.js.map +1 -1
  49. package/dist/draw/table.d.ts +1 -1
  50. package/dist/draw/table.js.map +1 -1
  51. package/dist/draw/worldPoint.js.map +1 -1
  52. package/dist/index.d.ts +4 -3
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +1 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/input/index.js.map +1 -1
  57. package/dist/input/input.js.map +1 -1
  58. package/dist/input/inputDescriptor.js.map +1 -1
  59. package/dist/interval/intervalToSeconds.js.map +1 -1
  60. package/dist/plot/index.js.map +1 -1
  61. package/dist/plot/plot.d.ts +25 -7
  62. package/dist/plot/plot.d.ts.map +1 -1
  63. package/dist/plot/plot.js +1 -1
  64. package/dist/plot/plot.js.map +1 -1
  65. package/dist/request/index.js.map +1 -1
  66. package/dist/request/request.js.map +1 -1
  67. package/dist/runtime/index.js.map +1 -1
  68. package/dist/runtime/runtime.js.map +1 -1
  69. package/dist/state/index.d.ts +1 -1
  70. package/dist/state/index.d.ts.map +1 -1
  71. package/dist/state/index.js.map +1 -1
  72. package/dist/state/mutableSlot.js.map +1 -1
  73. package/dist/state/snapshot.d.ts +39 -12
  74. package/dist/state/snapshot.d.ts.map +1 -1
  75. package/dist/state/snapshot.js.map +1 -1
  76. package/dist/state/state.js.map +1 -1
  77. package/dist/statefulPrimitives.d.ts +1 -1
  78. package/dist/statefulPrimitives.js +1 -1
  79. package/dist/statefulPrimitives.js.map +1 -1
  80. package/dist/ta/index.js.map +1 -1
  81. package/dist/ta/ta.d.ts +41 -41
  82. package/dist/ta/ta.js.map +1 -1
  83. package/dist/time/_lib/dateTimeFormatCache.js.map +1 -1
  84. package/dist/time/index.js.map +1 -1
  85. package/dist/time/nyDayKey.js +2 -2
  86. package/dist/time/nyDayKey.js.map +1 -1
  87. package/dist/time/session.js.map +1 -1
  88. package/dist/time/sessionBoundaries.js +2 -2
  89. package/dist/time/sessionBoundaries.js.map +1 -1
  90. package/dist/time/types.js.map +1 -1
  91. package/dist/time/weekKey.js.map +1 -1
  92. package/dist/time/weekday.js.map +1 -1
  93. package/dist/types.d.ts +246 -1
  94. package/dist/types.d.ts.map +1 -1
  95. package/dist/types.js +17 -1
  96. package/dist/types.js.map +1 -1
  97. package/dist/views/barstate.js.map +1 -1
  98. package/dist/views/index.js.map +1 -1
  99. package/dist/views/syminfo.js.map +1 -1
  100. package/dist/views/timeframe.js.map +1 -1
  101. package/package.json +1 -1
@@ -3,8 +3,8 @@
3
3
  //
4
4
  // Ported from invinite/src/components/trading-chart/indicators/lib/ny-day-key.ts
5
5
  // (commit fb882a97e018ea0cc9a451fb7d839dc8d894c08b, © Invinite).
6
- // Re-licensed MIT for chartlang. See PLAN.md §3.1 for the
7
- // provenance contract; the math is the reference, the code style is not.
6
+ // Re-licensed MIT for chartlang. The math is the reference, the code
7
+ // style is not.
8
8
  import { getFormatter } from "./_lib/dateTimeFormatCache.js";
9
9
  const NY_DAY_FIELDS = Object.freeze({
10
10
  year: "numeric",
@@ -1 +1 @@
1
- {"version":3,"file":"nyDayKey.js","sourceRoot":"","sources":["../../src/time/nyDayKey.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,iFAAiF;AACjF,mEAAmE;AACnE,0DAA0D;AAC1D,yEAAyE;AAGzE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,SAAS;IACf,KAA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I,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;CACoB,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC1B,EAAU,EACV,CAAO;IAEP,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/D,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;aACvC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;YAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC9C,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK;YAAE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAO;IAC5B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;AACrC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n//\n// Ported from invinite/src/components/trading-chart/indicators/lib/ny-day-key.ts\n// (commit fb882a97e018ea0cc9a451fb7d839dc8d894c08b, © Invinite).\n// Re-licensed MIT for chartlang. The math is the reference, the code\n// style is not.\n\nimport type { Time } from \"../types.js\";\nimport { getFormatter } from \"./_lib/dateTimeFormatCache.js\";\n\nconst NY_DAY_FIELDS = Object.freeze({\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n} satisfies Intl.DateTimeFormatOptions);\n\n/**\n * Return local year-month-day parts for `t` in `tz`.\n *\n * @since 0.6\n * @stable\n * @example\n * localDateParts(\"UTC\", 1_704_067_200_000);\n */\nexport function localDateParts(\n tz: string,\n t: Time,\n): { readonly year: string; readonly month: string; readonly day: string } {\n const parts = getFormatter(tz, NY_DAY_FIELDS).formatToParts(t);\n let year = \"\";\n let month = \"\";\n let day = \"\";\n for (const part of parts) {\n if (part.type === \"year\") year = part.value;\n else if (part.type === \"month\") month = part.value;\n else if (part.type === \"day\") day = part.value;\n }\n return { year, month, day };\n}\n\n/**\n * Return the `YYYY-MM-DD` key for `t` in `America/New_York`.\n *\n * @since 0.6\n * @stable\n * @example\n * nyDayKey(1_709_251_200_000);\n */\nexport function nyDayKey(t: Time): string {\n const { year, month, day } = localDateParts(\"America/New_York\", t);\n return `${year}-${month}-${day}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/time/session.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGjF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,cAAc;IACvB,QAAQ,EAAE,eAAe;IACzB,MAAM;CACT,CAIA,CAAC"}
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/time/session.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGjF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,cAAc;IACvB,QAAQ,EAAE,eAAe;IACzB,MAAM;CACT,CAIA,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Time } from \"../types.js\";\nimport { extendedSession, isOpen, regularSession } from \"./sessionBoundaries.js\";\nimport type { SessionBounds, SessionType } from \"./types.js\";\n\n/**\n * Frozen session helper namespace.\n *\n * @since 0.6\n * @stable\n * @example\n * const open = session.isOpen(\"America/New_York\", 1_709_251_200_000, \"regular\");\n * void open;\n */\nexport const session = Object.freeze({\n regular: regularSession,\n extended: extendedSession,\n isOpen,\n}) satisfies {\n readonly regular: (tz: string, t: Time) => SessionBounds | null;\n readonly extended: (tz: string, t: Time) => SessionBounds | null;\n readonly isOpen: (tz: string, t: Time, type: SessionType) => boolean;\n};\n"]}
@@ -3,8 +3,8 @@
3
3
  //
4
4
  // Ported from invinite/src/components/trading-chart/indicators/lib/session-boundaries.ts
5
5
  // (commit fb882a97e018ea0cc9a451fb7d839dc8d894c08b, © Invinite).
6
- // Re-licensed MIT for chartlang. See PLAN.md §3.1 for the
7
- // provenance contract; the math is the reference, the code style is not.
6
+ // Re-licensed MIT for chartlang. The math is the reference, the code
7
+ // style is not.
8
8
  import { getFormatter } from "./_lib/dateTimeFormatCache.js";
9
9
  import { localDateParts } from "./nyDayKey.js";
10
10
  import { weekday } from "./weekday.js";
@@ -1 +1 @@
1
- {"version":3,"file":"sessionBoundaries.js","sourceRoot":"","sources":["../../src/time/sessionBoundaries.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,yFAAyF;AACzF,mEAAmE;AACnE,0DAA0D;AAC1D,yEAAyE;AAGzE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA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,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n//\n// Ported from invinite/src/components/trading-chart/indicators/lib/session-boundaries.ts\n// (commit fb882a97e018ea0cc9a451fb7d839dc8d894c08b, © Invinite).\n// Re-licensed MIT for chartlang. The math is the reference, the code\n// style is not.\n\nimport type { Time } from \"../types.js\";\nimport { getFormatter } from \"./_lib/dateTimeFormatCache.js\";\nimport { localDateParts } from \"./nyDayKey.js\";\nimport type { SessionBounds, SessionType } from \"./types.js\";\nimport { weekday } from \"./weekday.js\";\n\nconst MINUTE_MS = 60_000;\n\nconst OFFSET_FIELDS = Object.freeze({\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hourCycle: \"h23\",\n} satisfies Intl.DateTimeFormatOptions);\n\nfunction offsetMs(tz: string, instantMs: number): number {\n const parts = getFormatter(tz, OFFSET_FIELDS).formatToParts(instantMs);\n const fields: Record<string, string> = {};\n for (const part of parts) {\n fields[part.type] = part.value;\n }\n const asUtc = Date.UTC(\n Number(fields.year),\n Number(fields.month) - 1,\n Number(fields.day),\n Number(fields.hour),\n Number(fields.minute),\n Number(fields.second),\n );\n return asUtc - instantMs;\n}\n\nfunction zonedTimeToUtcMs(\n tz: string,\n year: number,\n month: number,\n day: number,\n hour: number,\n minute: number,\n): number {\n const guess = Date.UTC(year, month - 1, day, hour, minute);\n const first = guess - offsetMs(tz, guess);\n const second = guess - offsetMs(tz, first);\n return second;\n}\n\nfunction sessionFor(\n tz: string,\n t: Time,\n startMinutes: number,\n endMinutes: number,\n): SessionBounds | null {\n const dow = weekday(tz, t);\n if (dow === 0 || dow === 6) return null;\n const parts = localDateParts(tz, t);\n const year = Number(parts.year);\n const month = Number(parts.month);\n const day = Number(parts.day);\n const startMs = zonedTimeToUtcMs(tz, year, month, day, 0, startMinutes);\n const endMs = zonedTimeToUtcMs(tz, year, month, day, 0, endMinutes);\n return Object.freeze({ startMs, endMs });\n}\n\n/**\n * Return the regular 09:30-16:00 session bounds for the New York day\n * containing `t`.\n *\n * @since 0.6\n * @stable\n * @example\n * nySessionBounds(1_709_251_200_000);\n */\nexport function nySessionBounds(t: Time): SessionBounds {\n const bounds = sessionFor(\"America/New_York\", t, 9 * 60 + 30, 16 * 60);\n if (bounds !== null) return bounds;\n const parts = localDateParts(\"America/New_York\", t);\n const noon = zonedTimeToUtcMs(\n \"America/New_York\",\n Number(parts.year),\n Number(parts.month),\n Number(parts.day),\n 12,\n 0,\n );\n return {\n startMs: noon - 150 * MINUTE_MS,\n endMs: noon + 240 * MINUTE_MS,\n };\n}\n\n/**\n * Return regular 09:30-16:00 session bounds in `tz`, or `null` on weekends.\n *\n * @since 0.6\n * @stable\n * @example\n * regularSession(\"America/New_York\", 1_709_251_200_000);\n */\nexport function regularSession(tz: string, t: Time): SessionBounds | null {\n return sessionFor(tz, t, 9 * 60 + 30, 16 * 60);\n}\n\n/**\n * Return extended 04:00-20:00 session bounds in `tz`, or `null` on weekends.\n *\n * @since 0.6\n * @stable\n * @example\n * extendedSession(\"America/New_York\", 1_709_251_200_000);\n */\nexport function extendedSession(tz: string, t: Time): SessionBounds | null {\n return sessionFor(tz, t, 4 * 60, 20 * 60);\n}\n\n/**\n * Test whether `t` falls inside the selected half-open session in `tz`.\n *\n * @since 0.6\n * @stable\n * @example\n * isOpen(\"America/New_York\", 1_709_251_200_000, \"regular\");\n */\nexport function isOpen(tz: string, t: Time, type: SessionType): boolean {\n const bounds = type === \"regular\" ? regularSession(tz, t) : extendedSession(tz, t);\n return bounds !== null && bounds.startMs <= t && t < bounds.endMs;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/time/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/time/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Supported market-session boundary families.\n *\n * @since 0.6\n * @stable\n * @example\n * const type: SessionType = \"regular\";\n * void type;\n */\nexport type SessionType = \"regular\" | \"extended\";\n\n/**\n * Day-of-week index where Sunday is 0 and Saturday is 6.\n *\n * @since 0.6\n * @stable\n * @example\n * const day: Weekday = 1;\n * void day;\n */\nexport type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Half-open UTC millisecond session bounds.\n *\n * @since 0.6\n * @stable\n * @example\n * const bounds: SessionBounds = { startMs: 0, endMs: 1 };\n * void bounds;\n */\nexport type SessionBounds = {\n readonly startMs: number;\n readonly endMs: number;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"weekKey.js","sourceRoot":"","sources":["../../src/time/weekKey.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,SAAS,OAAO,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW;IACrD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACtD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EA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C,CAAC,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,EAAU,EAAE,CAAO;IACvC,MAAM,KAAK,GAAG,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,OAAO,GAAG,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACvD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Time } from \"../types.js\";\nimport { localDateParts } from \"./nyDayKey.js\";\n\nfunction isoWeek(year: number, month: number, day: number): { year: number; week: number } {\n const date = new Date(Date.UTC(year, month - 1, day));\n date.setUTCDate(date.getUTCDate() + 4 - (date.getUTCDay() || 7));\n const weekYear = date.getUTCFullYear();\n const yearStart = new Date(Date.UTC(weekYear, 0, 1));\n const week = Math.ceil(((date.getTime() - yearStart.getTime()) / 86_400_000 + 1) / 7);\n return { year: weekYear, week };\n}\n\n/**\n * Return the ISO week key (`GGGG-Www`) for `t` in `tz`.\n *\n * @since 0.6\n * @stable\n * @example\n * weekKey(\"UTC\", 1_704_067_200_000);\n */\nexport function weekKey(tz: string, t: Time): string {\n const parts = localDateParts(tz, t);\n const { year, week } = isoWeek(Number(parts.year), Number(parts.month), Number(parts.day));\n return `${year}-W${String(week).padStart(2, \"0\")}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"weekday.js","sourceRoot":"","sources":["../../src/time/weekday.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,EAAU,EAAE,CAAO;IACvC,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;SAC9C,aAAa,CAAC,CAAC,CAAC;SAChB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAClD,IAAI,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,EAAE,KAAK,IAAI,QAAQ,EAAE,CAAC,CAAC;IAC/F,OAAO,KAAgB,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"file":"weekday.js","sourceRoot":"","sources":["../../src/time/weekday.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,EAAU,EAAE,CAAO;IACvC,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;SAC9C,aAAa,CAAC,CAAC,CAAC;SAChB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAClD,IAAI,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,EAAE,KAAK,IAAI,QAAQ,EAAE,CAAC,CAAC;IAC/F,OAAO,KAAgB,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Time } from \"../types.js\";\nimport { getFormatter } from \"./_lib/dateTimeFormatCache.js\";\nimport type { Weekday } from \"./types.js\";\n\nconst WEEKDAYS = Object.freeze([\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"]);\n\n/**\n * Return the local weekday in `tz`, where Sunday is 0.\n *\n * @since 0.6\n * @stable\n * @example\n * weekday(\"UTC\", 1_704_067_200_000);\n */\nexport function weekday(tz: string, t: Time): Weekday {\n const part = getFormatter(tz, { weekday: \"short\" })\n .formatToParts(t)\n .find((p) => p.type === \"weekday\");\n const index = WEEKDAYS.indexOf(part?.value ?? \"\");\n if (index < 0) throw new Error(`weekday: unsupported Intl weekday ${part?.value ?? \"<none>\"}`);\n return index as Weekday;\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import type { DependencyDeclaration, OutputDeclaration } from "./define/dependency.js";
1
2
  import type { ScaleAxis, ValueFormat } from "./define/overrides.js";
2
3
  import type { DrawNamespace } from "./draw/draw.js";
3
4
  import type { InputDescriptor } from "./input/inputDescriptor.js";
5
+ import type { PlotKind } from "./plot/plot.js";
4
6
  import type { RequestNamespace } from "./request/index.js";
5
7
  import type { RuntimeNamespace } from "./runtime/index.js";
6
8
  import type { StateNamespace } from "./state/state.js";
@@ -202,7 +204,7 @@ export type CapabilityId = "indicators" | "drawings" | "alerts" | "alertConditio
202
204
  * `drawing-budget-exceeded` once a bucket is full. Mirrors Pine's
203
205
  * `max_*_count` family. The runtime enforces
204
206
  * `min(scriptManifest.maxDrawings, adapter.capabilities.maxDrawingsPerScript)`
205
- * per bucket per PLAN.md §10 / §4.1.
207
+ * per bucket.
206
208
  *
207
209
  * Canonical declaration lives here in core so both
208
210
  * `ScriptManifest.maxDrawings?` and the adapter-kit re-export pin the
@@ -223,6 +225,52 @@ export type DrawingCounts = {
223
225
  readonly polylines: number;
224
226
  readonly other: number;
225
227
  };
228
+ /**
229
+ * One plotted-slot descriptor in `ScriptManifest.plots`. The compiler
230
+ * emits one entry per `plot()` / `plot.*()` / `hline()` callsite so an
231
+ * embedder can build a style/visibility UI keyed by the stable `slotId`
232
+ * before the first emission. `title` is present only when the call's
233
+ * opts carries a string-literal `title`.
234
+ *
235
+ * @since 0.8
236
+ * @stable
237
+ * @example
238
+ * const slot: PlotSlotDescriptor = {
239
+ * slotId: "ema.ts:12:5#0",
240
+ * kind: "line",
241
+ * title: "EMA",
242
+ * };
243
+ * void slot;
244
+ */
245
+ export type PlotSlotDescriptor = {
246
+ readonly slotId: string;
247
+ readonly kind: PlotKind;
248
+ readonly title?: string;
249
+ };
250
+ /**
251
+ * Host-supplied presentation override for a single plot slot, keyed by
252
+ * `PlotEmission.slotId`. Applied by the runtime at emit time; never
253
+ * affects `compute`. `lineWidth` / `lineStyle` apply only to the
254
+ * line-family plot kinds (`line`, `step-line`, `horizontal-line`,
255
+ * `area`); ignored as a silent no-op on other kinds.
256
+ *
257
+ * @since 0.8
258
+ * @stable
259
+ * @example
260
+ * const override: PlotOverride = {
261
+ * visible: false,
262
+ * color: "#ff0000",
263
+ * lineWidth: 2,
264
+ * lineStyle: "dashed",
265
+ * };
266
+ * void override;
267
+ */
268
+ export type PlotOverride = {
269
+ readonly visible?: boolean;
270
+ readonly color?: string;
271
+ readonly lineWidth?: number;
272
+ readonly lineStyle?: LineStyle;
273
+ };
226
274
  /**
227
275
  * The metadata sidecar the compiler emits next to a compiled script. The
228
276
  * runtime reads this to size ring buffers, gate against adapter capabilities,
@@ -254,6 +302,20 @@ export type ScriptManifest = {
254
302
  readonly userPickableInterval: boolean;
255
303
  readonly seriesCapacities: Readonly<Record<string, number>>;
256
304
  readonly maxLookback: number;
305
+ /**
306
+ * `overlay: false` on `defineIndicator(...)` is persisted here as the
307
+ * script-level default pane signal. Absent / `true` means the script
308
+ * defaults to the price overlay pane; `false` means the runtime
309
+ * routes every `plot()` / `hline()` call without an explicit `pane`
310
+ * opt into a per-script subpane key.
311
+ *
312
+ * @since 0.2
313
+ * @stable
314
+ * @example
315
+ * const m: Pick<ScriptManifest, "overlay"> = { overlay: false };
316
+ * void m;
317
+ */
318
+ readonly overlay?: boolean;
257
319
  /**
258
320
  * Per-bucket cap on `draw.*` emissions the script intends to
259
321
  * produce per bar. The runtime enforces
@@ -334,6 +396,91 @@ export type ScriptManifest = {
334
396
  * void defs;
335
397
  */
336
398
  readonly alertConditions?: ReadonlyArray<AlertConditionDefinition>;
399
+ /**
400
+ * Statically-resolved dependency graph nodes consumed by this
401
+ * script. Empty / omitted for scripts with no
402
+ * `<binding>.output(...)` calls. Each entry is one consumer-side
403
+ * `const` binding pointing at another `defineIndicator(...)`
404
+ * result.
405
+ *
406
+ * @since 0.7
407
+ * @stable
408
+ * @example
409
+ * const v: ScriptManifest["dependencies"] = [];
410
+ * void v;
411
+ */
412
+ readonly dependencies?: ReadonlyArray<DependencyDeclaration>;
413
+ /**
414
+ * Titled outputs this script exposes for consumption by other
415
+ * indicators. Derived from `plot(value, { title })` calls in
416
+ * this script's compute body. Empty / omitted when the script
417
+ * has no titled plots.
418
+ *
419
+ * @since 0.7
420
+ * @stable
421
+ * @example
422
+ * const v: ScriptManifest["outputs"] = [
423
+ * { title: "line", kind: "series-number" },
424
+ * ];
425
+ * void v;
426
+ */
427
+ readonly outputs?: ReadonlyArray<OutputDeclaration>;
428
+ /**
429
+ * Static plot-slot descriptors — one per `plot()` / `hline()` callsite,
430
+ * in callsite order. Lets an embedder enumerate plottable slots (and
431
+ * key per-slot style/visibility overrides) without waiting for the
432
+ * first emission. Absent on scripts that issue no plot/hline calls.
433
+ *
434
+ * @since 0.8
435
+ * @stable
436
+ * @example
437
+ * const v: ScriptManifest["plots"] = [
438
+ * { slotId: "ema.ts:12:5#0", kind: "line", title: "EMA" },
439
+ * ];
440
+ * void v;
441
+ */
442
+ readonly plots?: ReadonlyArray<PlotSlotDescriptor>;
443
+ /**
444
+ * The ES-module binding name this manifest was reached through.
445
+ * `"default"` for `export default defineIndicator(...)`; the
446
+ * named-binding identifier otherwise. Always present when the
447
+ * source file has more than one drawn indicator; omitted on
448
+ * single-script files for back-compat.
449
+ *
450
+ * @since 0.7
451
+ * @stable
452
+ * @example
453
+ * const v: ScriptManifest["exportName"] = "default";
454
+ * void v;
455
+ */
456
+ readonly exportName?: string;
457
+ /**
458
+ * Other drawn manifests in the same compiled file. Present
459
+ * only when this manifest is the file's default export and the
460
+ * file has additional named-exported drawn indicators. Omitted
461
+ * for single-script files and for non-default-export entries
462
+ * in the array-form manifest sidecar.
463
+ *
464
+ * @since 0.7
465
+ * @stable
466
+ * @example
467
+ * const v: ScriptManifest["siblings"] = [];
468
+ * void v;
469
+ */
470
+ readonly siblings?: ReadonlyArray<ScriptManifest>;
471
+ /**
472
+ * `true` when this manifest belongs to a drawn (exported)
473
+ * indicator — the host should mount it. `false` when this
474
+ * manifest belongs to a private dep — emissions are dropped.
475
+ * Defaults to `true` for back-compat.
476
+ *
477
+ * @since 0.7
478
+ * @stable
479
+ * @example
480
+ * const v: ScriptManifest["isDrawn"] = true;
481
+ * void v;
482
+ */
483
+ readonly isDrawn?: boolean;
337
484
  };
338
485
  /**
339
486
  * Per-condition descriptor authored under
@@ -438,6 +585,13 @@ export type ComputeFn = (ctx: ComputeContext) => void;
438
585
  * The compiler rewrites `manifest` fields at build time; the runtime invokes
439
586
  * `compute` per bar.
440
587
  *
588
+ * The `output` / `withInputs` accessors (Phase 7) are compiler-rewritten
589
+ * sentinels — the indicator-composition compiler pass statically replaces
590
+ * every consumer-side call site before bundling, so the runtime never
591
+ * executes the throwing bodies. Direct invocation from an un-compiled
592
+ * script (e.g. a unit test that imports the module directly) hits the
593
+ * sentinel and throws, which is the desired failure.
594
+ *
441
595
  * @since 0.1
442
596
  * @example
443
597
  * const cs: CompiledScriptObject = defineIndicator({
@@ -449,7 +603,98 @@ export type ComputeFn = (ctx: ComputeContext) => void;
449
603
  export type CompiledScriptObject = {
450
604
  readonly manifest: ScriptManifest;
451
605
  readonly compute: ComputeFn;
606
+ /**
607
+ * Read the named output of this indicator inside another
608
+ * indicator's compute body. Output names come from the
609
+ * producer's `plot(value, { title })` calls. The compiler
610
+ * rewrites every consumer-side call site before bundling;
611
+ * direct invocation throws the dep-accessor sentinel.
612
+ *
613
+ * @since 0.7
614
+ * @stable
615
+ * @example
616
+ * declare const baseTrend: CompiledScriptObject;
617
+ * const line: Series<number> = baseTrend.output("line");
618
+ * void line;
619
+ */
620
+ readonly output: (name: string) => Series<number>;
621
+ /**
622
+ * Return a new `CompiledScriptObject` whose dependency-binding
623
+ * effective inputs are the merge of the producer's defaults with
624
+ * the supplied overrides. Static — the compiler folds the
625
+ * override into the inlined dep manifest at bundle time.
626
+ *
627
+ * @since 0.7
628
+ * @stable
629
+ * @example
630
+ * declare const baseTrend: CompiledScriptObject;
631
+ * const trend = baseTrend.withInputs({ length: 50 });
632
+ * void trend;
633
+ */
634
+ readonly withInputs: (overrides: Readonly<Record<string, unknown>>) => CompiledScriptObject;
452
635
  };
636
+ /**
637
+ * The compiled artefact for a `.chart.ts` file when it contains
638
+ * multiple drawn indicators or any dependency graph. The Phase-7
639
+ * runtime accepts either this shape or the legacy
640
+ * `CompiledScriptObject` (single-script files).
641
+ *
642
+ * `primary` is the default-exported drawn script. `siblings` are
643
+ * every other drawn export (named consts). `dependencies` is every
644
+ * private-dep compiled object — keyed by `localId` so the runtime
645
+ * can look them up by the `DependencyDeclaration.localId` it sees
646
+ * on each consumer's manifest.
647
+ *
648
+ * @since 0.7
649
+ * @stable
650
+ * @example
651
+ * declare const primary: CompiledScriptObject;
652
+ * const bundle: CompiledScriptBundle = {
653
+ * primary,
654
+ * siblings: [],
655
+ * dependencies: [],
656
+ * };
657
+ * void bundle;
658
+ */
659
+ export type CompiledScriptBundle = Readonly<{
660
+ readonly primary: CompiledScriptObject;
661
+ readonly siblings: ReadonlyArray<{
662
+ readonly exportName: string;
663
+ readonly compiled: CompiledScriptObject;
664
+ }>;
665
+ readonly dependencies: ReadonlyArray<{
666
+ readonly localId: string;
667
+ readonly compiled: CompiledScriptObject;
668
+ /**
669
+ * Merged `.withInputs({...})` overrides the consumer applied
670
+ * to its alias binding. Forwarded into the `DepRunner` as the
671
+ * dep's input overrides so the producer's `compute` reads the
672
+ * consumer-supplied values instead of the producer's manifest
673
+ * defaults. Omitted for direct private deps that don't apply
674
+ * overrides.
675
+ *
676
+ * @since 0.7
677
+ */
678
+ readonly inputOverrides?: Readonly<Record<string, unknown>>;
679
+ }>;
680
+ }>;
681
+ /**
682
+ * Narrowing helper that distinguishes the new
683
+ * {@link CompiledScriptBundle} envelope from the legacy single-script
684
+ * {@link CompiledScriptObject}. The runner uses it to pick the
685
+ * multi-script execution path without re-parsing manifests.
686
+ *
687
+ * @since 0.7
688
+ * @stable
689
+ * @example
690
+ * declare const v: CompiledScriptObject | CompiledScriptBundle;
691
+ * if (isCompiledScriptBundle(v)) {
692
+ * void v.primary;
693
+ * } else {
694
+ * void v.manifest;
695
+ * }
696
+ */
697
+ export declare const isCompiledScriptBundle: (v: CompiledScriptObject | CompiledScriptBundle) => v is CompiledScriptBundle;
453
698
  /**
454
699
  * JSON-compatible payload type for `alert(...).meta` and other places the
455
700
  * runtime serialises script-supplied data across worker / host boundaries.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,GAAG,GAAG;IACd,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAA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AAC,QAAQ,EAAE,oBAAoB,CAAC;KAC3C,CAAC,CAAC;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;QACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;QACxC;;;;;;;;;WASG;QACH,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KAC/D,CAAC,CAAC;CACN,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAC/B,GAAG,oBAAoB,GAAG,oBAAoB,KAC/C,CAAC,IAAI,oBAA0E,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACf,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,aAAa,CAAC,SAAS,CAAC,GACxB;IAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
package/dist/types.js CHANGED
@@ -1,4 +1,20 @@
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
- export {};
3
+ /**
4
+ * Narrowing helper that distinguishes the new
5
+ * {@link CompiledScriptBundle} envelope from the legacy single-script
6
+ * {@link CompiledScriptObject}. The runner uses it to pick the
7
+ * multi-script execution path without re-parsing manifests.
8
+ *
9
+ * @since 0.7
10
+ * @stable
11
+ * @example
12
+ * declare const v: CompiledScriptObject | CompiledScriptBundle;
13
+ * if (isCompiledScriptBundle(v)) {
14
+ * void v.primary;
15
+ * } else {
16
+ * void v.manifest;
17
+ * }
18
+ */
19
+ export const isCompiledScriptBundle = (v) => Object.prototype.hasOwnProperty.call(v, "primary");
4
20
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAmsB/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,CAA8C,EACrB,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { DependencyDeclaration, OutputDeclaration } from \"./define/dependency.js\";\nimport type { ScaleAxis, ValueFormat } from \"./define/overrides.js\";\nimport type { DrawNamespace } from \"./draw/draw.js\";\nimport type { InputDescriptor } from \"./input/inputDescriptor.js\";\nimport type { PlotKind } from \"./plot/plot.js\";\nimport type { RequestNamespace } from \"./request/index.js\";\nimport type { RuntimeNamespace } from \"./runtime/index.js\";\nimport type { StateNamespace } from \"./state/state.js\";\nimport type { TaNamespace } from \"./ta/ta.js\";\nimport type { BarStateView, SymInfoView, TimeframeView } from \"./views/index.js\";\n\n/**\n * UTC milliseconds since epoch — the only time representation the runtime\n * speaks. Display-side timezones are the adapter's responsibility.\n *\n * @since 0.1\n * @example\n * const t: Time = 1_700_000_000_000;\n */\nexport type Time = number;\n\n/**\n * A price quote in the symbol's quote currency, finite or NaN. NaN marks an\n * unwarmed series slot.\n *\n * @since 0.1\n * @example\n * const last: Price = 42.31;\n */\nexport type Price = number;\n\n/**\n * Traded volume for the bar, in the symbol's native unit (shares, contracts,\n * coins, …).\n *\n * @since 0.1\n * @example\n * const v: Volume = 1_250_000;\n */\nexport type Volume = number;\n\n/**\n * Visible chart range in UTC milliseconds. Phase 5's OSS runtime\n * supplies a fallback range spanning the latest 100 bars ending at the\n * current head; adapters with a real viewport can replace this view in\n * later phases.\n *\n * @since 0.5\n * @stable\n * @example\n * const viewport: BarViewport = {\n * fromTime: 1_700_000_000_000,\n * toTime: 1_700_006_000_000,\n * };\n */\nexport type BarViewport = Readonly<{\n readonly fromTime: Time;\n readonly toTime: Time;\n}>;\n\n/**\n * The OHLCV record the runtime hands to `compute` for the current bar. Every\n * field is `readonly`; scripts must not mutate it.\n *\n * Phase 2 surfaces the four pre-computed derived sources (`hl2` / `hlc3` /\n * `ohlc4` / `hlcc4`) the runtime's `BarView`\n * (`packages/runtime/src/streamState.ts`) already populates on every close.\n * Script authors can write `ta.cci(bar.hlc3, 20)` directly — matching Pine's\n * canonical `bar.hlc3` / `bar.ohlc4` access pattern — without re-computing\n * the derived source per lookup.\n *\n * @since 0.1\n * @example\n * function tick(bar: Bar): void {\n * console.log(bar.close, bar.symbol, bar.interval);\n * // Phase 2 — Pine-style derived sources:\n * console.log(bar.hl2, bar.hlc3, bar.ohlc4, bar.hlcc4);\n * // Phase 5 — visible-range fallback:\n * console.log(bar.viewport.fromTime, bar.viewport.toTime);\n * }\n */\nexport type Bar = {\n readonly time: Time;\n readonly open: Price;\n readonly high: Price;\n readonly low: Price;\n readonly close: Price;\n readonly volume: Volume;\n readonly symbol: string;\n readonly interval: string;\n /** `(high + low) / 2`. @since 0.2 */\n readonly hl2: Price;\n /** `(high + low + close) / 3`. @since 0.2 */\n readonly hlc3: Price;\n /** `(open + high + low + close) / 4`. @since 0.2 */\n readonly ohlc4: Price;\n /** `(high + low + close + close) / 4` (Pine's `hlcc4`). @since 0.2 */\n readonly hlcc4: Price;\n /** Visible-range fallback used by viewport-aware primitives. @since 0.5 */\n readonly viewport?: BarViewport;\n};\n\n/**\n * Read-only view over a ring-buffered history of values. `current` is bar 0,\n * numeric indices look back N bars. The runtime owns the storage; scripts see\n * only this shape.\n *\n * @since 0.1\n * @example\n * function delta(close: Series<number>): number {\n * return close.current - close[1];\n * }\n */\nexport type Series<T> = {\n readonly current: T;\n readonly [n: number]: T;\n readonly length: number;\n};\n\n/**\n * CSS color string — `\"#rrggbb\"`, `\"rgb(...)\"`, `\"hsl(...)\"`, etc. Adapters\n * round-trip the string verbatim.\n *\n * @since 0.1\n * @example\n * const blue: Color = \"#3b82f6\";\n */\nexport type Color = string;\n\n/**\n * Stroke style for `plot` and `hline` lines. Adapters that cannot render a\n * style fall back to `\"solid\"` and emit `\"line-style-unsupported\"`.\n *\n * @since 0.1\n * @example\n * const ls: LineStyle = \"dashed\";\n */\nexport type LineStyle = \"solid\" | \"dashed\" | \"dotted\";\n\n/**\n * The rendered shape an adapter requests for a `plot` emission. Maps to\n * `Capabilities.plotKinds`.\n *\n * @since 0.1\n * @example\n * const k: PlotLineStyle = \"step\";\n */\nexport type PlotLineStyle = \"line\" | \"step\" | \"dashed\" | \"circles\" | \"cross\";\n\n/**\n * Alert severity used by `alert(...)` and downstream alert channels. Defaults\n * to `\"info\"` when callers omit `opts.severity`.\n *\n * @since 0.1\n * @example\n * const sev: AlertSeverity = \"warning\";\n */\nexport type AlertSeverity = \"info\" | \"warning\" | \"critical\";\n\n/**\n * Adapter-declared timeframe entry surfaced in the script-settings UI. The\n * optional `intervalSeconds` override lets exotic intervals declare their\n * effective duration without extending the standard parser grammar.\n *\n * @since 0.1\n * @example\n * const d: IntervalDescriptor = {\n * value: \"1D\",\n * label: \"1 day\",\n * group: \"Days\",\n * };\n */\nexport type IntervalDescriptor = {\n readonly value: string;\n readonly label: string;\n readonly group: string;\n /**\n * Optional positive finite second-count override used by interval\n * ordering helpers before parsing `value`.\n *\n * @since 0.6\n * @stable\n */\n readonly intervalSeconds?: number;\n};\n\n/**\n * Script-author-declared input schema attached to `defineIndicator` /\n * `defineAlert` / `defineDrawing`. Each key carries an `InputDescriptor<T>`\n * returned by an `input.*` builder. The compiler serialises this schema into\n * `manifest.inputs`; the runtime resolves user overrides against defaults.\n *\n * @since 0.1 — widened in 0.4 from opaque `Readonly<Record<string, unknown>>`\n * to the typed `InputDescriptor<unknown>` shape returned by `input.*`\n * builders. Existing scripts stay source-compatible because the previous\n * opaque record subsumes the new typed shape.\n * @example\n * import { input } from \"@invinite-org/chartlang-core\";\n * const inputs: InputSchema = { length: input.int(20) };\n * void inputs;\n */\nexport type InputSchema = Readonly<Record<string, InputDescriptor<unknown>>>;\n\n/**\n * Discriminator for the Phase-1 adapter capability subset the script-side\n * surface references. The full `Capabilities` type lives in\n * `@invinite-org/chartlang-adapter-kit` (Task 4); only the id strings appear\n * here.\n *\n * @since 0.1\n * @example\n * const caps: ReadonlyArray<CapabilityId> = [\"indicators\", \"alerts\"];\n */\nexport type CapabilityId = \"indicators\" | \"drawings\" | \"alerts\" | \"alertConditions\";\n\n/**\n * Per-script drawing-emission budget. Excess `draw.*` calls drop with\n * `drawing-budget-exceeded` once a bucket is full. Mirrors Pine's\n * `max_*_count` family. The runtime enforces\n * `min(scriptManifest.maxDrawings, adapter.capabilities.maxDrawingsPerScript)`\n * per bucket.\n *\n * Canonical declaration lives here in core so both\n * `ScriptManifest.maxDrawings?` and the adapter-kit re-export pin the\n * same shape — preserving the adapter-kit → core dependency direction.\n *\n * @since 0.3\n * @stable\n * @example\n * const c: DrawingCounts = {\n * lines: 50, labels: 50, boxes: 50, polylines: 50, other: 50,\n * };\n * void c;\n */\nexport type DrawingCounts = {\n readonly lines: number;\n readonly labels: number;\n readonly boxes: number;\n readonly polylines: number;\n readonly other: number;\n};\n\n/**\n * One plotted-slot descriptor in `ScriptManifest.plots`. The compiler\n * emits one entry per `plot()` / `plot.*()` / `hline()` callsite so an\n * embedder can build a style/visibility UI keyed by the stable `slotId`\n * before the first emission. `title` is present only when the call's\n * opts carries a string-literal `title`.\n *\n * @since 0.8\n * @stable\n * @example\n * const slot: PlotSlotDescriptor = {\n * slotId: \"ema.ts:12:5#0\",\n * kind: \"line\",\n * title: \"EMA\",\n * };\n * void slot;\n */\nexport type PlotSlotDescriptor = {\n readonly slotId: string;\n readonly kind: PlotKind;\n readonly title?: string;\n};\n\n/**\n * Host-supplied presentation override for a single plot slot, keyed by\n * `PlotEmission.slotId`. Applied by the runtime at emit time; never\n * affects `compute`. `lineWidth` / `lineStyle` apply only to the\n * line-family plot kinds (`line`, `step-line`, `horizontal-line`,\n * `area`); ignored as a silent no-op on other kinds.\n *\n * @since 0.8\n * @stable\n * @example\n * const override: PlotOverride = {\n * visible: false,\n * color: \"#ff0000\",\n * lineWidth: 2,\n * lineStyle: \"dashed\",\n * };\n * void override;\n */\nexport type PlotOverride = {\n readonly visible?: boolean;\n readonly color?: string;\n readonly lineWidth?: number;\n readonly lineStyle?: LineStyle;\n};\n\n/**\n * The metadata sidecar the compiler emits next to a compiled script. The\n * runtime reads this to size ring buffers, gate against adapter capabilities,\n * and pick secondary candle streams.\n *\n * @since 0.1\n * @example\n * const m: ScriptManifest = {\n * apiVersion: 1,\n * kind: \"indicator\",\n * name: \"demo\",\n * inputs: {},\n * capabilities: [\"indicators\"],\n * requestedIntervals: [],\n * userPickableInterval: false,\n * seriesCapacities: {},\n * maxLookback: 0,\n * shortName: \"demo\",\n * format: \"compact\",\n * };\n */\nexport type ScriptManifest = {\n readonly apiVersion: 1;\n readonly kind: \"indicator\" | \"drawing\" | \"alert\" | \"alertCondition\";\n readonly name: string;\n readonly inputs: InputSchema;\n readonly capabilities: ReadonlyArray<CapabilityId>;\n readonly requestedIntervals: ReadonlyArray<string>;\n readonly userPickableInterval: boolean;\n readonly seriesCapacities: Readonly<Record<string, number>>;\n readonly maxLookback: number;\n /**\n * `overlay: false` on `defineIndicator(...)` is persisted here as the\n * script-level default pane signal. Absent / `true` means the script\n * defaults to the price overlay pane; `false` means the runtime\n * routes every `plot()` / `hline()` call without an explicit `pane`\n * opt into a per-script subpane key.\n *\n * @since 0.2\n * @stable\n * @example\n * const m: Pick<ScriptManifest, \"overlay\"> = { overlay: false };\n * void m;\n */\n readonly overlay?: boolean;\n /**\n * Per-bucket cap on `draw.*` emissions the script intends to\n * produce per bar. The runtime enforces\n * `min(this, adapter.capabilities.maxDrawingsPerScript)` per\n * bucket. Omit to default to the adapter's cap.\n *\n * @since 0.3\n */\n readonly maxDrawings?: DrawingCounts;\n /**\n * Max bars of historical lookback the script declares it needs.\n *\n * @since 0.4\n * @example\n * const v: ScriptManifest[\"maxBarsBack\"] = 100;\n * void v;\n */\n readonly maxBarsBack?: number;\n /**\n * Value-formatting hint for axis labels + cursor read-out.\n *\n * @since 0.4\n * @example\n * const v: ScriptManifest[\"format\"] = \"price\";\n * void v;\n */\n readonly format?: ValueFormat;\n /**\n * Decimal precision the adapter renders the script at.\n *\n * @since 0.4\n * @example\n * const v: ScriptManifest[\"precision\"] = 2;\n * void v;\n */\n readonly precision?: number;\n /**\n * Scale-axis binding requested by the script.\n *\n * @since 0.4\n * @example\n * const v: ScriptManifest[\"scale\"] = \"right\";\n * void v;\n */\n readonly scale?: ScaleAxis;\n /**\n * Compact display label for legend chips.\n *\n * @since 0.4\n * @example\n * const v: ScriptManifest[\"shortName\"] = \"EMA\";\n * void v;\n */\n readonly shortName?: string;\n /**\n * Static set of intervals the script requires the target adapter to ship\n * in `Capabilities.intervals`. The compiler unions this with the static\n * set extracted from `request.security` calls in Task 8. `input.interval`\n * is user-pickable and does not contribute to this author-declared hard\n * requirement set.\n *\n * @since 0.4\n * @example\n * const v: ScriptManifest[\"requiresIntervals\"] = [\"1D\"];\n * void v;\n */\n readonly requiresIntervals?: ReadonlyArray<string>;\n /**\n * Static list of user-wireable alert conditions declared by\n * `defineAlertCondition({ conditions })`.\n *\n * @since 0.5\n * @stable\n * @example\n * const defs: ScriptManifest[\"alertConditions\"] = [\n * { id: \"up\", title: \"Up\", description: \"Close > EMA\", defaultMessage: \"{{ticker}} up\" },\n * ];\n * void defs;\n */\n readonly alertConditions?: ReadonlyArray<AlertConditionDefinition>;\n /**\n * Statically-resolved dependency graph nodes consumed by this\n * script. Empty / omitted for scripts with no\n * `<binding>.output(...)` calls. Each entry is one consumer-side\n * `const` binding pointing at another `defineIndicator(...)`\n * result.\n *\n * @since 0.7\n * @stable\n * @example\n * const v: ScriptManifest[\"dependencies\"] = [];\n * void v;\n */\n readonly dependencies?: ReadonlyArray<DependencyDeclaration>;\n /**\n * Titled outputs this script exposes for consumption by other\n * indicators. Derived from `plot(value, { title })` calls in\n * this script's compute body. Empty / omitted when the script\n * has no titled plots.\n *\n * @since 0.7\n * @stable\n * @example\n * const v: ScriptManifest[\"outputs\"] = [\n * { title: \"line\", kind: \"series-number\" },\n * ];\n * void v;\n */\n readonly outputs?: ReadonlyArray<OutputDeclaration>;\n /**\n * Static plot-slot descriptors — one per `plot()` / `hline()` callsite,\n * in callsite order. Lets an embedder enumerate plottable slots (and\n * key per-slot style/visibility overrides) without waiting for the\n * first emission. Absent on scripts that issue no plot/hline calls.\n *\n * @since 0.8\n * @stable\n * @example\n * const v: ScriptManifest[\"plots\"] = [\n * { slotId: \"ema.ts:12:5#0\", kind: \"line\", title: \"EMA\" },\n * ];\n * void v;\n */\n readonly plots?: ReadonlyArray<PlotSlotDescriptor>;\n /**\n * The ES-module binding name this manifest was reached through.\n * `\"default\"` for `export default defineIndicator(...)`; the\n * named-binding identifier otherwise. Always present when the\n * source file has more than one drawn indicator; omitted on\n * single-script files for back-compat.\n *\n * @since 0.7\n * @stable\n * @example\n * const v: ScriptManifest[\"exportName\"] = \"default\";\n * void v;\n */\n readonly exportName?: string;\n /**\n * Other drawn manifests in the same compiled file. Present\n * only when this manifest is the file's default export and the\n * file has additional named-exported drawn indicators. Omitted\n * for single-script files and for non-default-export entries\n * in the array-form manifest sidecar.\n *\n * @since 0.7\n * @stable\n * @example\n * const v: ScriptManifest[\"siblings\"] = [];\n * void v;\n */\n readonly siblings?: ReadonlyArray<ScriptManifest>;\n /**\n * `true` when this manifest belongs to a drawn (exported)\n * indicator — the host should mount it. `false` when this\n * manifest belongs to a private dep — emissions are dropped.\n * Defaults to `true` for back-compat.\n *\n * @since 0.7\n * @stable\n * @example\n * const v: ScriptManifest[\"isDrawn\"] = true;\n * void v;\n */\n readonly isDrawn?: boolean;\n};\n\n/**\n * Per-condition descriptor authored under\n * `DefineAlertConditionOpts.conditions`.\n *\n * @since 0.5\n * @stable\n * @example\n * const d: AlertConditionDescriptor = {\n * title: \"Up\",\n * description: \"Close crossed up\",\n * defaultMessage: \"{{ticker}} crossed up\",\n * };\n * void d;\n */\nexport type AlertConditionDescriptor = Readonly<{\n title: string;\n description: string;\n defaultMessage: string;\n}>;\n\n/**\n * Manifest-ready alert-condition descriptor with the author map key\n * normalised into `id`.\n *\n * @since 0.5\n * @stable\n * @example\n * const d: AlertConditionDefinition = {\n * id: \"up\",\n * title: \"Up\",\n * description: \"Close crossed up\",\n * defaultMessage: \"{{ticker}} crossed up\",\n * };\n * void d;\n */\nexport type AlertConditionDefinition = AlertConditionDescriptor &\n Readonly<{\n id: string;\n }>;\n\n/**\n * The argument the runtime hands a script's `compute` function each bar. The\n * `ta` / `plot` / `hline` / `alert` slots are the runtime's implementations,\n * not the compile-time callable holes from `@invinite-org/chartlang-core`.\n *\n * @since 0.1\n * @example\n * const fn: ComputeFn = ({ bar, plot }) => { plot(bar.close); };\n */\nexport type ComputeContext = {\n readonly bar: Bar;\n readonly inputs: Readonly<Record<string, unknown>>;\n readonly ta: TaNamespace;\n readonly plot: typeof import(\"./plot/plot.js\").plot;\n readonly hline: typeof import(\"./plot/plot.js\").hline;\n readonly alert: typeof import(\"./alert/alert.js\").alert;\n /** Pine `var` / `varip` state slots. @since 0.4 */\n readonly state: StateNamespace;\n /** Bar-state view derived for the active step. @since 0.4 */\n readonly barstate: BarStateView;\n /** Symbol metadata view for the active script mount. @since 0.4 */\n readonly syminfo: SymInfoView;\n /** Timeframe helper view derived for the active step. @since 0.4 */\n readonly timeframe: TimeframeView;\n /** Secondary timeframe request namespace. @since 0.4 */\n readonly request: RequestNamespace;\n /** Runtime logging and fatal halt namespace. @since 0.5 */\n readonly runtime: RuntimeNamespace;\n /**\n * Signal a named condition declared by `defineAlertCondition`. Present\n * only for scripts whose manifest kind is `\"alertCondition\"`.\n *\n * @since 0.5\n * @stable\n * @example\n * const fn: NonNullable<ComputeContext[\"signal\"]> = (id, fired) => {\n * void id;\n * void fired;\n * };\n * void fn;\n */\n readonly signal?: (conditionId: string, fired: boolean) => void;\n /**\n * Imperative drawing namespace. Each method returns a\n * {@link DrawingHandle} the script can `update(...)` or\n * `remove()` within the same `compute` run, and across bars.\n * The Phase-3 runtime impl lives in\n * `@invinite-org/chartlang-runtime/emit/draw`. @since 0.3\n */\n readonly draw: DrawNamespace;\n};\n\n/**\n * The per-bar compute function a script exports via `defineIndicator` /\n * `defineAlert`. Pure with respect to its arguments — no `this`, no closures\n * over host state.\n *\n * @since 0.1\n * @example\n * const fn: ComputeFn = (ctx) => { ctx.plot(ctx.bar.close); };\n */\nexport type ComputeFn = (ctx: ComputeContext) => void;\n\n/**\n * The frozen object the `defineIndicator` / `defineAlert` constructors return.\n * The compiler rewrites `manifest` fields at build time; the runtime invokes\n * `compute` per bar.\n *\n * The `output` / `withInputs` accessors (Phase 7) are compiler-rewritten\n * sentinels — the indicator-composition compiler pass statically replaces\n * every consumer-side call site before bundling, so the runtime never\n * executes the throwing bodies. Direct invocation from an un-compiled\n * script (e.g. a unit test that imports the module directly) hits the\n * sentinel and throws, which is the desired failure.\n *\n * @since 0.1\n * @example\n * const cs: CompiledScriptObject = defineIndicator({\n * name: \"demo\",\n * apiVersion: 1,\n * compute: () => {},\n * });\n */\nexport type CompiledScriptObject = {\n readonly manifest: ScriptManifest;\n readonly compute: ComputeFn;\n /**\n * Read the named output of this indicator inside another\n * indicator's compute body. Output names come from the\n * producer's `plot(value, { title })` calls. The compiler\n * rewrites every consumer-side call site before bundling;\n * direct invocation throws the dep-accessor sentinel.\n *\n * @since 0.7\n * @stable\n * @example\n * declare const baseTrend: CompiledScriptObject;\n * const line: Series<number> = baseTrend.output(\"line\");\n * void line;\n */\n readonly output: (name: string) => Series<number>;\n /**\n * Return a new `CompiledScriptObject` whose dependency-binding\n * effective inputs are the merge of the producer's defaults with\n * the supplied overrides. Static — the compiler folds the\n * override into the inlined dep manifest at bundle time.\n *\n * @since 0.7\n * @stable\n * @example\n * declare const baseTrend: CompiledScriptObject;\n * const trend = baseTrend.withInputs({ length: 50 });\n * void trend;\n */\n readonly withInputs: (overrides: Readonly<Record<string, unknown>>) => CompiledScriptObject;\n};\n\n/**\n * The compiled artefact for a `.chart.ts` file when it contains\n * multiple drawn indicators or any dependency graph. The Phase-7\n * runtime accepts either this shape or the legacy\n * `CompiledScriptObject` (single-script files).\n *\n * `primary` is the default-exported drawn script. `siblings` are\n * every other drawn export (named consts). `dependencies` is every\n * private-dep compiled object — keyed by `localId` so the runtime\n * can look them up by the `DependencyDeclaration.localId` it sees\n * on each consumer's manifest.\n *\n * @since 0.7\n * @stable\n * @example\n * declare const primary: CompiledScriptObject;\n * const bundle: CompiledScriptBundle = {\n * primary,\n * siblings: [],\n * dependencies: [],\n * };\n * void bundle;\n */\nexport type CompiledScriptBundle = Readonly<{\n readonly primary: CompiledScriptObject;\n readonly siblings: ReadonlyArray<{\n readonly exportName: string;\n readonly compiled: CompiledScriptObject;\n }>;\n readonly dependencies: ReadonlyArray<{\n readonly localId: string;\n readonly compiled: CompiledScriptObject;\n /**\n * Merged `.withInputs({...})` overrides the consumer applied\n * to its alias binding. Forwarded into the `DepRunner` as the\n * dep's input overrides so the producer's `compute` reads the\n * consumer-supplied values instead of the producer's manifest\n * defaults. Omitted for direct private deps that don't apply\n * overrides.\n *\n * @since 0.7\n */\n readonly inputOverrides?: Readonly<Record<string, unknown>>;\n }>;\n}>;\n\n/**\n * Narrowing helper that distinguishes the new\n * {@link CompiledScriptBundle} envelope from the legacy single-script\n * {@link CompiledScriptObject}. The runner uses it to pick the\n * multi-script execution path without re-parsing manifests.\n *\n * @since 0.7\n * @stable\n * @example\n * declare const v: CompiledScriptObject | CompiledScriptBundle;\n * if (isCompiledScriptBundle(v)) {\n * void v.primary;\n * } else {\n * void v.manifest;\n * }\n */\nexport const isCompiledScriptBundle = (\n v: CompiledScriptObject | CompiledScriptBundle,\n): v is CompiledScriptBundle => Object.prototype.hasOwnProperty.call(v, \"primary\");\n\n/**\n * JSON-compatible payload type for `alert(...).meta` and other places the\n * runtime serialises script-supplied data across worker / host boundaries.\n *\n * @since 0.1\n * @example\n * const meta: JsonValue = { reason: \"crossover\", strength: 0.42 };\n */\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | ReadonlyArray<JsonValue>\n | { readonly [k: string]: JsonValue };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"barstate.js","sourceRoot":"","sources":["../../src/views/barstate.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AA8B/D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiB,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;CACrB,CAAC,CAAC"}
1
+ {"version":3,"file":"barstate.js","sourceRoot":"","sources":["../../src/views/barstate.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AA8B/D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiB,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;CACrB,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Bar-state view. Mirrors Pine's `barstate.*`; all fields are derived per\n * step from runtime event type and bar-index bookkeeping.\n *\n * The exported module-scope value is only the default fallback. Runtime\n * implementations supply per-step snapshots through `ComputeContext`.\n *\n * @since 0.4\n * @stable\n * @example\n * const view: BarStateView = barstate;\n * void view;\n */\nexport type BarStateView = {\n /** True on the first historical bar of this script mount. */\n readonly isfirst: boolean;\n /** True on the most recent bar, live or replay. */\n readonly islast: boolean;\n /** True if a new bar opened on this step; false on ticks within a bar. */\n readonly isnew: boolean;\n /** True if the runtime is in the historical-replay phase. */\n readonly ishistory: boolean;\n /** True if the runtime is processing a realtime feed. */\n readonly isrealtime: boolean;\n /** True if this step is a `kind: \"close\"` event; false on ticks. */\n readonly isconfirmed: boolean;\n};\n\n/**\n * Module-scope `barstate` fallback. Outside a script step, every field is\n * `false`; the runtime supplies the active per-step snapshot on\n * `ComputeContext.barstate`.\n *\n * @since 0.4\n * @stable\n * @example\n * import { barstate } from \"@invinite-org/chartlang-core\";\n * void barstate;\n */\nexport const barstate: BarStateView = Object.freeze({\n isfirst: false,\n islast: false,\n isnew: false,\n ishistory: false,\n isrealtime: false,\n isconfirmed: false,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAqC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAqC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC","sourcesContent":["export { barstate, type BarStateView } from \"./barstate.js\";\nexport { syminfo, type SymbolType, type SymInfoView } from \"./syminfo.js\";\nexport { timeframe, type TimeframeView } from \"./timeframe.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"syminfo.js","sourceRoot":"","sources":["../../src/views/syminfo.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AA+C/D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,MAAM,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,MAAM,CAAC,GAAG;IACnB,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;CAC1B,CAAC,CAAC"}
1
+ {"version":3,"file":"syminfo.js","sourceRoot":"","sources":["../../src/views/syminfo.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AA+C/D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,MAAM,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,MAAM,CAAC,GAAG;IACnB,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;CAC1B,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { JsonValue } from \"../types.js\";\n\n/**\n * Symbol-type union. Adapters that cannot map a symbol to a canonical type\n * return `\"custom\"`.\n *\n * @since 0.4\n * @stable\n * @example\n * const t: SymbolType = \"equity\";\n * void t;\n */\nexport type SymbolType =\n | \"equity\"\n | \"futures\"\n | \"forex\"\n | \"crypto\"\n | \"index\"\n | \"fund\"\n | \"bond\"\n | \"commodity\"\n | \"custom\";\n\n/**\n * Symbol-metadata view. Fields not populated by the adapter evaluate to\n * their empty sentinel: `\"\"`, `NaN`, or `{}`.\n *\n * @since 0.4\n * @stable\n * @example\n * const view: SymInfoView = syminfo;\n * void view;\n */\nexport type SymInfoView = {\n readonly ticker: string;\n readonly type: SymbolType;\n readonly mintick: number;\n readonly currency: string;\n readonly basecurrency: string;\n readonly exchange: string;\n readonly timezone: string;\n readonly session: string;\n readonly meta: Readonly<Record<string, JsonValue>>;\n};\n\n/**\n * Module-scope `syminfo` fallback. Outside a script step, every field\n * evaluates to its empty sentinel; the runtime supplies the active per-mount\n * snapshot on `ComputeContext.syminfo`.\n *\n * @since 0.4\n * @stable\n * @example\n * import { syminfo } from \"@invinite-org/chartlang-core\";\n * void syminfo;\n */\nexport const syminfo: SymInfoView = Object.freeze({\n ticker: \"\",\n type: \"custom\",\n mintick: Number.NaN,\n currency: \"\",\n basecurrency: \"\",\n exchange: \"\",\n timezone: \"\",\n session: \"\",\n meta: Object.freeze({}),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timeframe.js","sourceRoot":"","sources":["../../src/views/timeframe.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AA+B/D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB,MAAM,CAAC,MAAM,CAAC;IAClD,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,MAAM,CAAC,GAAG;CACxB,CAAC,CAAC"}
1
+ {"version":3,"file":"timeframe.js","sourceRoot":"","sources":["../../src/views/timeframe.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AA+B/D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB,MAAM,CAAC,MAAM,CAAC;IAClD,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,MAAM,CAAC,GAAG;CACxB,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Timeframe-derived helpers. Runtime implementations derive the booleans from\n * `bar.interval` and the active adapter's `IntervalDescriptor.group`.\n *\n * Canonical groups are `\"second\"`, `\"minute\"`, `\"hour\"`, `\"daily\"`,\n * `\"weekly\"`, `\"monthly\"`, `\"quarterly\"`, and `\"yearly\"`. Custom groups do\n * not trigger helper booleans.\n *\n * @since 0.4\n * @stable\n * @example\n * const view: TimeframeView = timeframe;\n * void view;\n */\nexport type TimeframeView = {\n /** Same as `bar.interval`. */\n readonly period: string;\n /** True iff `IntervalDescriptor.group` is `\"second\"`, `\"minute\"`, or `\"hour\"`. */\n readonly isintraday: boolean;\n /** True iff `IntervalDescriptor.group` is `\"daily\"`. */\n readonly isdaily: boolean;\n /** True iff `IntervalDescriptor.group` is `\"weekly\"`. */\n readonly isweekly: boolean;\n /** True iff `IntervalDescriptor.group` is `\"monthly\"` or longer. */\n readonly ismonthly: boolean;\n /** Approximate seconds per bar at this interval; `NaN` if unknown. */\n readonly inSeconds: number;\n};\n\n/**\n * Module-scope `timeframe` fallback. Outside a script step, the period is\n * empty, every helper boolean is `false`, and `inSeconds` is `NaN`.\n *\n * @since 0.4\n * @stable\n * @example\n * import { timeframe } from \"@invinite-org/chartlang-core\";\n * void timeframe;\n */\nexport const timeframe: TimeframeView = Object.freeze({\n period: \"\",\n isintraday: false,\n isdaily: false,\n isweekly: false,\n ismonthly: false,\n inSeconds: Number.NaN,\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invinite-org/chartlang-core",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Types and primitives for chartlang scripts",