@invinite-org/chartlang-core 1.1.0 → 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 (75) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/alert/alert.d.ts +1 -1
  3. package/dist/alert/alert.js +1 -1
  4. package/dist/alert/alert.js.map +1 -1
  5. package/dist/alert/index.js.map +1 -1
  6. package/dist/color/colorHelpers.js.map +1 -1
  7. package/dist/color/index.js.map +1 -1
  8. package/dist/color/parseColor.js.map +1 -1
  9. package/dist/define/defineAlert.js.map +1 -1
  10. package/dist/define/defineAlertCondition.js.map +1 -1
  11. package/dist/define/defineDrawing.d.ts +2 -2
  12. package/dist/define/defineDrawing.js +2 -2
  13. package/dist/define/defineDrawing.js.map +1 -1
  14. package/dist/define/defineIndicator.js.map +1 -1
  15. package/dist/define/depAccessorSentinel.js.map +1 -1
  16. package/dist/define/dependency.js.map +1 -1
  17. package/dist/define/index.js.map +1 -1
  18. package/dist/define/overrides.js.map +1 -1
  19. package/dist/draw/buckets.js.map +1 -1
  20. package/dist/draw/draw.d.ts +2 -3
  21. package/dist/draw/draw.d.ts.map +1 -1
  22. package/dist/draw/draw.js +1 -2
  23. package/dist/draw/draw.js.map +1 -1
  24. package/dist/draw/drawingKind.d.ts +1 -1
  25. package/dist/draw/drawingKind.js.map +1 -1
  26. package/dist/draw/drawingState.d.ts +5 -5
  27. package/dist/draw/drawingState.js.map +1 -1
  28. package/dist/draw/drawingStyle.d.ts +1 -1
  29. package/dist/draw/drawingStyle.js.map +1 -1
  30. package/dist/draw/handle.js.map +1 -1
  31. package/dist/draw/index.js.map +1 -1
  32. package/dist/draw/table.d.ts +1 -1
  33. package/dist/draw/table.js.map +1 -1
  34. package/dist/draw/worldPoint.js.map +1 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/input/index.js.map +1 -1
  37. package/dist/input/input.js.map +1 -1
  38. package/dist/input/inputDescriptor.js.map +1 -1
  39. package/dist/interval/intervalToSeconds.js.map +1 -1
  40. package/dist/plot/index.js.map +1 -1
  41. package/dist/plot/plot.d.ts +1 -1
  42. package/dist/plot/plot.js +1 -1
  43. package/dist/plot/plot.js.map +1 -1
  44. package/dist/request/index.js.map +1 -1
  45. package/dist/request/request.js.map +1 -1
  46. package/dist/runtime/index.js.map +1 -1
  47. package/dist/runtime/runtime.js.map +1 -1
  48. package/dist/state/index.js.map +1 -1
  49. package/dist/state/mutableSlot.js.map +1 -1
  50. package/dist/state/snapshot.d.ts +5 -5
  51. package/dist/state/snapshot.js.map +1 -1
  52. package/dist/state/state.js.map +1 -1
  53. package/dist/statefulPrimitives.d.ts +1 -1
  54. package/dist/statefulPrimitives.js +1 -1
  55. package/dist/statefulPrimitives.js.map +1 -1
  56. package/dist/ta/index.js.map +1 -1
  57. package/dist/ta/ta.d.ts +41 -41
  58. package/dist/ta/ta.js.map +1 -1
  59. package/dist/time/_lib/dateTimeFormatCache.js.map +1 -1
  60. package/dist/time/index.js.map +1 -1
  61. package/dist/time/nyDayKey.js +2 -2
  62. package/dist/time/nyDayKey.js.map +1 -1
  63. package/dist/time/session.js.map +1 -1
  64. package/dist/time/sessionBoundaries.js +2 -2
  65. package/dist/time/sessionBoundaries.js.map +1 -1
  66. package/dist/time/types.js.map +1 -1
  67. package/dist/time/weekKey.js.map +1 -1
  68. package/dist/time/weekday.js.map +1 -1
  69. package/dist/types.d.ts +1 -1
  70. package/dist/types.js.map +1 -1
  71. package/dist/views/barstate.js.map +1 -1
  72. package/dist/views/index.js.map +1 -1
  73. package/dist/views/syminfo.js.map +1 -1
  74. package/dist/views/timeframe.js.map +1 -1
  75. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/time/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/time/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAG/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport type { SessionBounds, SessionType, Weekday } from \"./types.js\";\nexport { nyDayKey } from \"./nyDayKey.js\";\nexport { nySessionBounds } from \"./sessionBoundaries.js\";\nexport { session } from \"./session.js\";\nexport { weekday } from \"./weekday.js\";\nexport { weekKey } from \"./weekKey.js\";\n"]}
@@ -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,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AA+D;AAC/D,EAAE;AACF,iFAAiF;AACjF,mEAAmE;AACnE,qEAAqE;AACrE,gBAAgB;AAGhB,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC,IAAI,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,mEAA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,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACnF,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;AACtE,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,MAA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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,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
@@ -204,7 +204,7 @@ export type CapabilityId = "indicators" | "drawings" | "alerts" | "alertConditio
204
204
  * `drawing-budget-exceeded` once a bucket is full. Mirrors Pine's
205
205
  * `max_*_count` family. The runtime enforces
206
206
  * `min(scriptManifest.maxDrawings, adapter.capabilities.maxDrawingsPerScript)`
207
- * per bucket per PLAN.md §10 / §4.1.
207
+ * per bucket.
208
208
  *
209
209
  * Canonical declaration lives here in core so both
210
210
  * `ScriptManifest.maxDrawings?` and the adapter-kit re-export pin the
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;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"}
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.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Types and primitives for chartlang scripts",