@invinite-org/chartlang-core 1.0.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 (208) hide show
  1. package/CHANGELOG.md +1694 -0
  2. package/LICENSE +21 -0
  3. package/README.md +53 -0
  4. package/dist/alert/alert.d.ts +32 -0
  5. package/dist/alert/alert.d.ts.map +1 -0
  6. package/dist/alert/alert.js +19 -0
  7. package/dist/alert/alert.js.map +1 -0
  8. package/dist/alert/index.d.ts +2 -0
  9. package/dist/alert/index.d.ts.map +1 -0
  10. package/dist/alert/index.js +4 -0
  11. package/dist/alert/index.js.map +1 -0
  12. package/dist/color/colorHelpers.d.ts +65 -0
  13. package/dist/color/colorHelpers.d.ts.map +1 -0
  14. package/dist/color/colorHelpers.js +137 -0
  15. package/dist/color/colorHelpers.js.map +1 -0
  16. package/dist/color/index.d.ts +37 -0
  17. package/dist/color/index.d.ts.map +1 -0
  18. package/dist/color/index.js +23 -0
  19. package/dist/color/index.js.map +1 -0
  20. package/dist/color/parseColor.d.ts +48 -0
  21. package/dist/color/parseColor.d.ts.map +1 -0
  22. package/dist/color/parseColor.js +141 -0
  23. package/dist/color/parseColor.js.map +1 -0
  24. package/dist/define/defineAlert.d.ts +43 -0
  25. package/dist/define/defineAlert.d.ts.map +1 -0
  26. package/dist/define/defineAlert.js +49 -0
  27. package/dist/define/defineAlert.js.map +1 -0
  28. package/dist/define/defineAlertCondition.d.ts +65 -0
  29. package/dist/define/defineAlertCondition.d.ts.map +1 -0
  30. package/dist/define/defineAlertCondition.js +64 -0
  31. package/dist/define/defineAlertCondition.js.map +1 -0
  32. package/dist/define/defineDrawing.d.ts +62 -0
  33. package/dist/define/defineDrawing.d.ts.map +1 -0
  34. package/dist/define/defineDrawing.js +67 -0
  35. package/dist/define/defineDrawing.js.map +1 -0
  36. package/dist/define/defineIndicator.d.ts +48 -0
  37. package/dist/define/defineIndicator.d.ts.map +1 -0
  38. package/dist/define/defineIndicator.js +54 -0
  39. package/dist/define/defineIndicator.js.map +1 -0
  40. package/dist/define/index.d.ts +6 -0
  41. package/dist/define/index.d.ts.map +1 -0
  42. package/dist/define/index.js +7 -0
  43. package/dist/define/index.js.map +1 -0
  44. package/dist/define/overrides.d.ts +102 -0
  45. package/dist/define/overrides.d.ts.map +1 -0
  46. package/dist/define/overrides.js +4 -0
  47. package/dist/define/overrides.js.map +1 -0
  48. package/dist/draw/buckets.d.ts +57 -0
  49. package/dist/draw/buckets.d.ts.map +1 -0
  50. package/dist/draw/buckets.js +110 -0
  51. package/dist/draw/buckets.js.map +1 -0
  52. package/dist/draw/draw.d.ts +128 -0
  53. package/dist/draw/draw.d.ts.map +1 -0
  54. package/dist/draw/draw.js +40 -0
  55. package/dist/draw/draw.js.map +1 -0
  56. package/dist/draw/drawingKind.d.ts +80 -0
  57. package/dist/draw/drawingKind.d.ts.map +1 -0
  58. package/dist/draw/drawingKind.js +177 -0
  59. package/dist/draw/drawingKind.js.map +1 -0
  60. package/dist/draw/drawingState.d.ts +1420 -0
  61. package/dist/draw/drawingState.d.ts.map +1 -0
  62. package/dist/draw/drawingState.js +4 -0
  63. package/dist/draw/drawingState.js.map +1 -0
  64. package/dist/draw/drawingStyle.d.ts +219 -0
  65. package/dist/draw/drawingStyle.d.ts.map +1 -0
  66. package/dist/draw/drawingStyle.js +4 -0
  67. package/dist/draw/drawingStyle.js.map +1 -0
  68. package/dist/draw/handle.d.ts +32 -0
  69. package/dist/draw/handle.d.ts.map +1 -0
  70. package/dist/draw/handle.js +4 -0
  71. package/dist/draw/handle.js.map +1 -0
  72. package/dist/draw/index.d.ts +13 -0
  73. package/dist/draw/index.d.ts.map +1 -0
  74. package/dist/draw/index.js +7 -0
  75. package/dist/draw/index.js.map +1 -0
  76. package/dist/draw/table.d.ts +84 -0
  77. package/dist/draw/table.d.ts.map +1 -0
  78. package/dist/draw/table.js +22 -0
  79. package/dist/draw/table.js.map +1 -0
  80. package/dist/draw/worldPoint.d.ts +114 -0
  81. package/dist/draw/worldPoint.d.ts.map +1 -0
  82. package/dist/draw/worldPoint.js +4 -0
  83. package/dist/draw/worldPoint.js.map +1 -0
  84. package/dist/index.d.ts +28 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +16 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/input/index.d.ts +3 -0
  89. package/dist/input/index.d.ts.map +1 -0
  90. package/dist/input/index.js +4 -0
  91. package/dist/input/index.js.map +1 -0
  92. package/dist/input/input.d.ts +174 -0
  93. package/dist/input/input.d.ts.map +1 -0
  94. package/dist/input/input.js +174 -0
  95. package/dist/input/input.js.map +1 -0
  96. package/dist/input/inputDescriptor.d.ts +204 -0
  97. package/dist/input/inputDescriptor.d.ts.map +1 -0
  98. package/dist/input/inputDescriptor.js +4 -0
  99. package/dist/input/inputDescriptor.js.map +1 -0
  100. package/dist/interval/intervalToSeconds.d.ts +20 -0
  101. package/dist/interval/intervalToSeconds.d.ts.map +1 -0
  102. package/dist/interval/intervalToSeconds.js +50 -0
  103. package/dist/interval/intervalToSeconds.js.map +1 -0
  104. package/dist/plot/index.d.ts +2 -0
  105. package/dist/plot/index.d.ts.map +1 -0
  106. package/dist/plot/index.js +4 -0
  107. package/dist/plot/index.js.map +1 -0
  108. package/dist/plot/plot.d.ts +277 -0
  109. package/dist/plot/plot.d.ts.map +1 -0
  110. package/dist/plot/plot.js +37 -0
  111. package/dist/plot/plot.js.map +1 -0
  112. package/dist/request/index.d.ts +2 -0
  113. package/dist/request/index.d.ts.map +1 -0
  114. package/dist/request/index.js +4 -0
  115. package/dist/request/index.js.map +1 -0
  116. package/dist/request/request.d.ts +106 -0
  117. package/dist/request/request.d.ts.map +1 -0
  118. package/dist/request/request.js +44 -0
  119. package/dist/request/request.js.map +1 -0
  120. package/dist/runtime/index.d.ts +3 -0
  121. package/dist/runtime/index.d.ts.map +1 -0
  122. package/dist/runtime/index.js +4 -0
  123. package/dist/runtime/index.js.map +1 -0
  124. package/dist/runtime/runtime.d.ts +84 -0
  125. package/dist/runtime/runtime.d.ts.map +1 -0
  126. package/dist/runtime/runtime.js +72 -0
  127. package/dist/runtime/runtime.js.map +1 -0
  128. package/dist/state/index.d.ts +5 -0
  129. package/dist/state/index.d.ts.map +1 -0
  130. package/dist/state/index.js +4 -0
  131. package/dist/state/index.js.map +1 -0
  132. package/dist/state/mutableSlot.d.ts +25 -0
  133. package/dist/state/mutableSlot.d.ts.map +1 -0
  134. package/dist/state/mutableSlot.js +4 -0
  135. package/dist/state/mutableSlot.js.map +1 -0
  136. package/dist/state/snapshot.d.ts +108 -0
  137. package/dist/state/snapshot.d.ts.map +1 -0
  138. package/dist/state/snapshot.js +4 -0
  139. package/dist/state/snapshot.js.map +1 -0
  140. package/dist/state/state.d.ts +86 -0
  141. package/dist/state/state.d.ts.map +1 -0
  142. package/dist/state/state.js +95 -0
  143. package/dist/state/state.js.map +1 -0
  144. package/dist/statefulPrimitives.d.ts +71 -0
  145. package/dist/statefulPrimitives.d.ts.map +1 -0
  146. package/dist/statefulPrimitives.js +234 -0
  147. package/dist/statefulPrimitives.js.map +1 -0
  148. package/dist/ta/index.d.ts +2 -0
  149. package/dist/ta/index.d.ts.map +1 -0
  150. package/dist/ta/index.js +4 -0
  151. package/dist/ta/index.js.map +1 -0
  152. package/dist/ta/ta.d.ts +2476 -0
  153. package/dist/ta/ta.d.ts.map +1 -0
  154. package/dist/ta/ta.js +312 -0
  155. package/dist/ta/ta.js.map +1 -0
  156. package/dist/time/_lib/dateTimeFormatCache.d.ts +11 -0
  157. package/dist/time/_lib/dateTimeFormatCache.d.ts.map +1 -0
  158. package/dist/time/_lib/dateTimeFormatCache.js +22 -0
  159. package/dist/time/_lib/dateTimeFormatCache.js.map +1 -0
  160. package/dist/time/index.d.ts +7 -0
  161. package/dist/time/index.d.ts.map +1 -0
  162. package/dist/time/index.js +8 -0
  163. package/dist/time/index.js.map +1 -0
  164. package/dist/time/nyDayKey.d.ts +24 -0
  165. package/dist/time/nyDayKey.d.ts.map +1 -0
  166. package/dist/time/nyDayKey.js +49 -0
  167. package/dist/time/nyDayKey.js.map +1 -0
  168. package/dist/time/session.d.ts +16 -0
  169. package/dist/time/session.d.ts.map +1 -0
  170. package/dist/time/session.js +18 -0
  171. package/dist/time/session.js.map +1 -0
  172. package/dist/time/sessionBoundaries.d.ts +40 -0
  173. package/dist/time/sessionBoundaries.d.ts.map +1 -0
  174. package/dist/time/sessionBoundaries.js +102 -0
  175. package/dist/time/sessionBoundaries.js.map +1 -0
  176. package/dist/time/types.d.ts +34 -0
  177. package/dist/time/types.d.ts.map +1 -0
  178. package/dist/time/types.js +4 -0
  179. package/dist/time/types.js.map +1 -0
  180. package/dist/time/weekKey.d.ts +11 -0
  181. package/dist/time/weekKey.d.ts.map +1 -0
  182. package/dist/time/weekKey.js +25 -0
  183. package/dist/time/weekKey.js.map +1 -0
  184. package/dist/time/weekday.d.ts +12 -0
  185. package/dist/time/weekday.d.ts.map +1 -0
  186. package/dist/time/weekday.js +22 -0
  187. package/dist/time/weekday.js.map +1 -0
  188. package/dist/types.d.ts +464 -0
  189. package/dist/types.d.ts.map +1 -0
  190. package/dist/types.js +4 -0
  191. package/dist/types.js.map +1 -0
  192. package/dist/views/barstate.d.ts +40 -0
  193. package/dist/views/barstate.d.ts.map +1 -0
  194. package/dist/views/barstate.js +22 -0
  195. package/dist/views/barstate.js.map +1 -0
  196. package/dist/views/index.d.ts +4 -0
  197. package/dist/views/index.d.ts.map +1 -0
  198. package/dist/views/index.js +4 -0
  199. package/dist/views/index.js.map +1 -0
  200. package/dist/views/syminfo.d.ts +46 -0
  201. package/dist/views/syminfo.d.ts.map +1 -0
  202. package/dist/views/syminfo.js +25 -0
  203. package/dist/views/syminfo.js.map +1 -0
  204. package/dist/views/timeframe.d.ts +40 -0
  205. package/dist/views/timeframe.d.ts.map +1 -0
  206. package/dist/views/timeframe.js +21 -0
  207. package/dist/views/timeframe.js.map +1 -0
  208. package/package.json +45 -0
@@ -0,0 +1,1420 @@
1
+ import type { Color, JsonValue, Price, Time } from "../types.js";
2
+ import type { ArrowMarkerOpts, ArrowOpts, BrushStyle, FibOpts, FrameOpts, HighlighterStyle, LineDrawStyle, PathOpts, RegressionTrendOpts, ShapeStyle, TextOpts } from "./drawingStyle.js";
3
+ import type { TableCell, TablePosition } from "./table.js";
4
+ import type { AnchorHept, AnchorPair, AnchorQuad, AnchorQuint, AnchorTriple, WorldPoint } from "./worldPoint.js";
5
+ /**
6
+ * Script-mutable metadata fields every {@link DrawingState} variant
7
+ * carries. `name` surfaces in the editor layer; `visible: false` hides
8
+ * the drawing without removing it. See PLAN.md §10.0 for the contract.
9
+ *
10
+ * @formula N/A — metadata only, no geometry
11
+ * @anchors N/A — script-author metadata
12
+ * @since 0.3
13
+ * @stable
14
+ * @example
15
+ * const m: DrawingMeta = { name: "Support", visible: true };
16
+ * void m;
17
+ */
18
+ export type DrawingMeta = {
19
+ readonly name?: string;
20
+ readonly visible?: boolean;
21
+ };
22
+ /**
23
+ * `line` — two-anchor straight line. Carries `extendLeft` /
24
+ * `extendRight` flags so the invinite `ray` / `extended-line` tools
25
+ * collapse into this single kind per PLAN.md §3.1.
26
+ *
27
+ * @formula identity — segment between `anchors[0]` and `anchors[1]`
28
+ * @anchors anchors: [from, to]
29
+ * @since 0.3
30
+ * @stable
31
+ * @example
32
+ * const s: LineState = {
33
+ * kind: "line",
34
+ * anchors: [{ time: 1, price: 1 }, { time: 2, price: 2 }],
35
+ * style: {},
36
+ * };
37
+ * void s;
38
+ */
39
+ export type LineState = DrawingMeta & {
40
+ readonly kind: "line";
41
+ readonly anchors: AnchorPair;
42
+ readonly style: LineDrawStyle;
43
+ };
44
+ /**
45
+ * `horizontal-line` — single-price line extending across the chart.
46
+ *
47
+ * @formula identity — horizontal line at `price`
48
+ * @anchors price
49
+ * @since 0.3
50
+ * @stable
51
+ * @example
52
+ * const s: HorizontalLineState = {
53
+ * kind: "horizontal-line",
54
+ * price: 100,
55
+ * style: { color: "#3b82f6" },
56
+ * };
57
+ * void s;
58
+ */
59
+ export type HorizontalLineState = DrawingMeta & {
60
+ readonly kind: "horizontal-line";
61
+ readonly price: Price;
62
+ readonly style: LineDrawStyle;
63
+ };
64
+ /**
65
+ * `horizontal-ray` — single-price ray anchored at a starting time.
66
+ *
67
+ * @formula identity — ray from `anchor` extending right at constant price
68
+ * @anchors anchor
69
+ * @since 0.3
70
+ * @stable
71
+ * @example
72
+ * const s: HorizontalRayState = {
73
+ * kind: "horizontal-ray",
74
+ * anchor: { time: 1, price: 100 },
75
+ * style: {},
76
+ * };
77
+ * void s;
78
+ */
79
+ export type HorizontalRayState = DrawingMeta & {
80
+ readonly kind: "horizontal-ray";
81
+ readonly anchor: WorldPoint;
82
+ readonly style: LineDrawStyle;
83
+ };
84
+ /**
85
+ * `vertical-line` — single-time line extending across the price axis.
86
+ *
87
+ * @formula identity — vertical line at `time`
88
+ * @anchors time
89
+ * @since 0.3
90
+ * @stable
91
+ * @example
92
+ * const s: VerticalLineState = {
93
+ * kind: "vertical-line",
94
+ * time: 1_700_000_000_000,
95
+ * style: {},
96
+ * };
97
+ * void s;
98
+ */
99
+ export type VerticalLineState = DrawingMeta & {
100
+ readonly kind: "vertical-line";
101
+ readonly time: Time;
102
+ readonly style: LineDrawStyle;
103
+ };
104
+ /**
105
+ * `cross-line` — orthogonal horizontal + vertical pair through one anchor.
106
+ *
107
+ * @formula identity — crosshair through `anchor`
108
+ * @anchors anchor
109
+ * @since 0.3
110
+ * @stable
111
+ * @example
112
+ * const s: CrossLineState = {
113
+ * kind: "cross-line",
114
+ * anchor: { time: 1, price: 1 },
115
+ * style: {},
116
+ * };
117
+ * void s;
118
+ */
119
+ export type CrossLineState = DrawingMeta & {
120
+ readonly kind: "cross-line";
121
+ readonly anchor: WorldPoint;
122
+ readonly style: LineDrawStyle;
123
+ };
124
+ /**
125
+ * `trend-angle` — line with an angle annotation read off the two anchors.
126
+ *
127
+ * @formula angle = atan2(Δprice, Δtime)
128
+ * @anchors anchors: [from, to]
129
+ * @since 0.3
130
+ * @stable
131
+ * @example
132
+ * const s: TrendAngleState = {
133
+ * kind: "trend-angle",
134
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
135
+ * style: {},
136
+ * };
137
+ * void s;
138
+ */
139
+ export type TrendAngleState = DrawingMeta & {
140
+ readonly kind: "trend-angle";
141
+ readonly anchors: AnchorPair;
142
+ readonly style: LineDrawStyle;
143
+ };
144
+ /**
145
+ * `rectangle` — axis-aligned filled rectangle defined by two corners.
146
+ *
147
+ * @formula identity — axis-aligned bounding box of `anchors`
148
+ * @anchors anchors: [topLeft, bottomRight] (or any opposite-corner pair)
149
+ * @since 0.3
150
+ * @stable
151
+ * @example
152
+ * const s: RectangleState = {
153
+ * kind: "rectangle",
154
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
155
+ * style: {},
156
+ * };
157
+ * void s;
158
+ */
159
+ export type RectangleState = DrawingMeta & {
160
+ readonly kind: "rectangle";
161
+ readonly anchors: AnchorPair;
162
+ readonly style: ShapeStyle;
163
+ };
164
+ /**
165
+ * `rotated-rectangle` — four-corner rectangle, supports arbitrary rotation.
166
+ *
167
+ * @formula identity — polygon through the four anchor corners
168
+ * @anchors anchors: [c1, c2, c3, c4] (CW or CCW)
169
+ * @since 0.3
170
+ * @stable
171
+ * @example
172
+ * const s: RotatedRectangleState = {
173
+ * kind: "rotated-rectangle",
174
+ * anchors: [
175
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
176
+ * { time: 2, price: 0 }, { time: 1, price: -1 },
177
+ * ],
178
+ * style: {},
179
+ * };
180
+ * void s;
181
+ */
182
+ export type RotatedRectangleState = DrawingMeta & {
183
+ readonly kind: "rotated-rectangle";
184
+ readonly anchors: AnchorQuad;
185
+ readonly style: ShapeStyle;
186
+ };
187
+ /**
188
+ * `triangle` — three-vertex polygon.
189
+ *
190
+ * @formula identity — closed polygon through the three anchors
191
+ * @anchors anchors: [v1, v2, v3]
192
+ * @since 0.3
193
+ * @stable
194
+ * @example
195
+ * const s: TriangleState = {
196
+ * kind: "triangle",
197
+ * anchors: [
198
+ * { time: 0, price: 0 },
199
+ * { time: 1, price: 1 },
200
+ * { time: 2, price: 0 },
201
+ * ],
202
+ * style: {},
203
+ * };
204
+ * void s;
205
+ */
206
+ export type TriangleState = DrawingMeta & {
207
+ readonly kind: "triangle";
208
+ readonly anchors: AnchorTriple;
209
+ readonly style: ShapeStyle;
210
+ };
211
+ /**
212
+ * `polyline` — open polyline of N anchors.
213
+ *
214
+ * @formula identity — N-anchor open polyline
215
+ * @anchors anchors: ReadonlyArray<WorldPoint>
216
+ * @since 0.3
217
+ * @stable
218
+ * @example
219
+ * const s: PolylineState = {
220
+ * kind: "polyline",
221
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
222
+ * style: {},
223
+ * };
224
+ * void s;
225
+ */
226
+ export type PolylineState = DrawingMeta & {
227
+ readonly kind: "polyline";
228
+ readonly anchors: ReadonlyArray<WorldPoint>;
229
+ readonly style: LineDrawStyle;
230
+ };
231
+ /**
232
+ * `circle` — defined by centre + a radius anchor.
233
+ *
234
+ * @formula r = distance(anchors[0], anchors[1])
235
+ * @anchors anchors: [centre, radiusPoint]
236
+ * @since 0.3
237
+ * @stable
238
+ * @example
239
+ * const s: CircleState = {
240
+ * kind: "circle",
241
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 0 }],
242
+ * style: {},
243
+ * };
244
+ * void s;
245
+ */
246
+ export type CircleState = DrawingMeta & {
247
+ readonly kind: "circle";
248
+ readonly anchors: AnchorPair;
249
+ readonly style: ShapeStyle;
250
+ };
251
+ /**
252
+ * `ellipse` — bounding-box anchor pair.
253
+ *
254
+ * @formula ellipse inscribed in the bounding box of `anchors`
255
+ * @anchors anchors: [bboxA, bboxB]
256
+ * @since 0.3
257
+ * @stable
258
+ * @example
259
+ * const s: EllipseState = {
260
+ * kind: "ellipse",
261
+ * anchors: [{ time: 0, price: 0 }, { time: 2, price: 1 }],
262
+ * style: {},
263
+ * };
264
+ * void s;
265
+ */
266
+ export type EllipseState = DrawingMeta & {
267
+ readonly kind: "ellipse";
268
+ readonly anchors: AnchorPair;
269
+ readonly style: ShapeStyle;
270
+ };
271
+ /**
272
+ * `path` — open or closed polyline with arbitrary anchor count.
273
+ *
274
+ * @formula identity — N-anchor path (closed = `style.closed`)
275
+ * @anchors anchors: ReadonlyArray<WorldPoint>
276
+ * @since 0.3
277
+ * @stable
278
+ * @example
279
+ * const s: PathState = {
280
+ * kind: "path",
281
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
282
+ * style: { closed: true },
283
+ * };
284
+ * void s;
285
+ */
286
+ export type PathState = DrawingMeta & {
287
+ readonly kind: "path";
288
+ readonly anchors: ReadonlyArray<WorldPoint>;
289
+ readonly style: PathOpts;
290
+ };
291
+ /**
292
+ * `marker` — single-anchor glyph with optional value label.
293
+ *
294
+ * @formula identity — marker placed at `anchor`
295
+ * @anchors anchor
296
+ * @since 0.3
297
+ * @stable
298
+ * @example
299
+ * const s: MarkerState = {
300
+ * kind: "marker",
301
+ * anchor: { time: 1, price: 1 },
302
+ * text: "B",
303
+ * style: {},
304
+ * };
305
+ * void s;
306
+ */
307
+ export type MarkerState = DrawingMeta & {
308
+ readonly kind: "marker";
309
+ readonly anchor: WorldPoint;
310
+ readonly text?: string;
311
+ readonly value?: number;
312
+ readonly style: TextOpts;
313
+ };
314
+ /**
315
+ * `arc` — three-anchor arc (start / control / end).
316
+ *
317
+ * @formula quadratic Bezier through `anchors`
318
+ * @anchors anchors: [start, control, end]
319
+ * @since 0.3
320
+ * @stable
321
+ * @example
322
+ * const s: ArcState = {
323
+ * kind: "arc",
324
+ * anchors: [
325
+ * { time: 0, price: 0 },
326
+ * { time: 1, price: 2 },
327
+ * { time: 2, price: 0 },
328
+ * ],
329
+ * style: {},
330
+ * };
331
+ * void s;
332
+ */
333
+ export type ArcState = DrawingMeta & {
334
+ readonly kind: "arc";
335
+ readonly anchors: AnchorTriple;
336
+ readonly style: LineDrawStyle;
337
+ };
338
+ /**
339
+ * `curve` — three-anchor quadratic Bezier.
340
+ *
341
+ * @formula B(t) = (1−t)²·P0 + 2(1−t)t·P1 + t²·P2
342
+ * @anchors anchors: [P0, P1, P2]
343
+ * @since 0.3
344
+ * @stable
345
+ * @example
346
+ * const s: CurveState = {
347
+ * kind: "curve",
348
+ * anchors: [
349
+ * { time: 0, price: 0 },
350
+ * { time: 1, price: 2 },
351
+ * { time: 2, price: 0 },
352
+ * ],
353
+ * style: {},
354
+ * };
355
+ * void s;
356
+ */
357
+ export type CurveState = DrawingMeta & {
358
+ readonly kind: "curve";
359
+ readonly anchors: AnchorTriple;
360
+ readonly style: LineDrawStyle;
361
+ };
362
+ /**
363
+ * `double-curve` — five-anchor cubic Bezier pair (two stitched curves).
364
+ *
365
+ * @formula two cubic Beziers stitched at `anchors[2]`
366
+ * @anchors anchors: [P0, P1, mid, P3, P4]
367
+ * @since 0.3
368
+ * @stable
369
+ * @example
370
+ * const s: DoubleCurveState = {
371
+ * kind: "double-curve",
372
+ * anchors: [
373
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
374
+ * { time: 2, price: 0 }, { time: 3, price: -1 },
375
+ * { time: 4, price: 0 },
376
+ * ],
377
+ * style: {},
378
+ * };
379
+ * void s;
380
+ */
381
+ export type DoubleCurveState = DrawingMeta & {
382
+ readonly kind: "double-curve";
383
+ readonly anchors: AnchorQuint;
384
+ readonly style: LineDrawStyle;
385
+ };
386
+ /**
387
+ * `pen` — freehand polyline.
388
+ *
389
+ * @formula identity — sampled freehand polyline
390
+ * @anchors anchors: ReadonlyArray<WorldPoint>
391
+ * @since 0.3
392
+ * @stable
393
+ * @example
394
+ * const s: PenState = {
395
+ * kind: "pen",
396
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
397
+ * style: {},
398
+ * };
399
+ * void s;
400
+ */
401
+ export type PenState = DrawingMeta & {
402
+ readonly kind: "pen";
403
+ readonly anchors: ReadonlyArray<WorldPoint>;
404
+ readonly style: LineDrawStyle;
405
+ };
406
+ /**
407
+ * `highlighter` — freehand thick translucent stroke.
408
+ *
409
+ * @formula identity — sampled freehand polyline rendered translucent
410
+ * @anchors anchors: ReadonlyArray<WorldPoint>
411
+ * @since 0.3
412
+ * @stable
413
+ * @example
414
+ * const s: HighlighterState = {
415
+ * kind: "highlighter",
416
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
417
+ * style: { color: "#facc15", alpha: 0.3 },
418
+ * };
419
+ * void s;
420
+ */
421
+ export type HighlighterState = DrawingMeta & {
422
+ readonly kind: "highlighter";
423
+ readonly anchors: ReadonlyArray<WorldPoint>;
424
+ readonly style: HighlighterStyle;
425
+ };
426
+ /**
427
+ * `brush` — freehand stroked-and-filled stroke.
428
+ *
429
+ * @formula identity — sampled freehand polyline rendered stroked + filled
430
+ * @anchors anchors: ReadonlyArray<WorldPoint>
431
+ * @since 0.3
432
+ * @stable
433
+ * @example
434
+ * const s: BrushState = {
435
+ * kind: "brush",
436
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
437
+ * style: { stroke: "#000", fill: "#fff" },
438
+ * };
439
+ * void s;
440
+ */
441
+ export type BrushState = DrawingMeta & {
442
+ readonly kind: "brush";
443
+ readonly anchors: ReadonlyArray<WorldPoint>;
444
+ readonly style: BrushStyle;
445
+ };
446
+ /**
447
+ * `text` — single-anchor text label.
448
+ *
449
+ * @formula identity — `body` rendered at `anchor`
450
+ * @anchors anchor
451
+ * @since 0.3
452
+ * @stable
453
+ * @example
454
+ * const s: TextState = {
455
+ * kind: "text",
456
+ * anchor: { time: 1, price: 1 },
457
+ * body: "Note",
458
+ * style: {},
459
+ * };
460
+ * void s;
461
+ */
462
+ export type TextState = DrawingMeta & {
463
+ readonly kind: "text";
464
+ readonly anchor: WorldPoint;
465
+ readonly body: string;
466
+ readonly style: TextOpts;
467
+ };
468
+ /**
469
+ * `arrow` — two-anchor arrow with optional label.
470
+ *
471
+ * @formula identity — directional arrow from `anchors[0]` → `anchors[1]`
472
+ * @anchors anchors: [tail, head]
473
+ * @since 0.3
474
+ * @stable
475
+ * @example
476
+ * const s: ArrowState = {
477
+ * kind: "arrow",
478
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
479
+ * style: {},
480
+ * };
481
+ * void s;
482
+ */
483
+ export type ArrowState = DrawingMeta & {
484
+ readonly kind: "arrow";
485
+ readonly anchors: AnchorPair;
486
+ readonly style: ArrowOpts;
487
+ };
488
+ /**
489
+ * `arrow-marker` — single-anchor compact arrow + label glyph.
490
+ *
491
+ * @formula identity — arrow glyph at `anchor` with optional text
492
+ * @anchors anchor
493
+ * @since 0.3
494
+ * @stable
495
+ * @example
496
+ * const s: ArrowMarkerState = {
497
+ * kind: "arrow-marker",
498
+ * anchor: { time: 1, price: 1 },
499
+ * style: { text: "B" },
500
+ * };
501
+ * void s;
502
+ */
503
+ export type ArrowMarkerState = DrawingMeta & {
504
+ readonly kind: "arrow-marker";
505
+ readonly anchor: WorldPoint;
506
+ readonly style: ArrowMarkerOpts;
507
+ };
508
+ /**
509
+ * `arrow-mark-up` — bullish marker (typically below the bar).
510
+ *
511
+ * @formula identity — upward marker glyph at `anchor`
512
+ * @anchors anchor
513
+ * @since 0.3
514
+ * @stable
515
+ * @example
516
+ * const s: ArrowMarkUpState = {
517
+ * kind: "arrow-mark-up",
518
+ * anchor: { time: 1, price: 1 },
519
+ * style: {},
520
+ * };
521
+ * void s;
522
+ */
523
+ export type ArrowMarkUpState = DrawingMeta & {
524
+ readonly kind: "arrow-mark-up";
525
+ readonly anchor: WorldPoint;
526
+ readonly style: ArrowMarkerOpts;
527
+ };
528
+ /**
529
+ * `arrow-mark-down` — bearish marker (typically above the bar).
530
+ *
531
+ * @formula identity — downward marker glyph at `anchor`
532
+ * @anchors anchor
533
+ * @since 0.3
534
+ * @stable
535
+ * @example
536
+ * const s: ArrowMarkDownState = {
537
+ * kind: "arrow-mark-down",
538
+ * anchor: { time: 1, price: 1 },
539
+ * style: {},
540
+ * };
541
+ * void s;
542
+ */
543
+ export type ArrowMarkDownState = DrawingMeta & {
544
+ readonly kind: "arrow-mark-down";
545
+ readonly anchor: WorldPoint;
546
+ readonly style: ArrowMarkerOpts;
547
+ };
548
+ /**
549
+ * `trend-channel` — two parallel lines defined by three anchors.
550
+ *
551
+ * @formula parallel pair: line(`anchors[0]`, `anchors[1]`) and its
552
+ * translate through `anchors[2]`
553
+ * @anchors anchors: [primaryA, primaryB, parallelHook]
554
+ * @since 0.3
555
+ * @stable
556
+ * @example
557
+ * const s: TrendChannelState = {
558
+ * kind: "trend-channel",
559
+ * anchors: [
560
+ * { time: 0, price: 0 },
561
+ * { time: 1, price: 1 },
562
+ * { time: 0, price: 1 },
563
+ * ],
564
+ * style: {},
565
+ * };
566
+ * void s;
567
+ */
568
+ export type TrendChannelState = DrawingMeta & {
569
+ readonly kind: "trend-channel";
570
+ readonly anchors: AnchorTriple;
571
+ readonly style: LineDrawStyle;
572
+ };
573
+ /**
574
+ * `flat-top-bottom` — horizontal channel of two parallel flat edges.
575
+ *
576
+ * @formula two horizontal lines at min/max prices from anchors
577
+ * @anchors anchors: [leftEdge, rightEdge, oppositeHook]
578
+ * @since 0.3
579
+ * @stable
580
+ * @example
581
+ * const s: FlatTopBottomState = {
582
+ * kind: "flat-top-bottom",
583
+ * anchors: [
584
+ * { time: 0, price: 1 },
585
+ * { time: 1, price: 1 },
586
+ * { time: 0, price: 0 },
587
+ * ],
588
+ * style: {},
589
+ * };
590
+ * void s;
591
+ */
592
+ export type FlatTopBottomState = DrawingMeta & {
593
+ readonly kind: "flat-top-bottom";
594
+ readonly anchors: AnchorTriple;
595
+ readonly style: LineDrawStyle;
596
+ };
597
+ /**
598
+ * `disjoint-channel` — two non-parallel channel edges.
599
+ *
600
+ * @formula two independent line segments — line(A,B) + line(C,D)
601
+ * @anchors anchors: [A, B, C, D]
602
+ * @since 0.3
603
+ * @stable
604
+ * @example
605
+ * const s: DisjointChannelState = {
606
+ * kind: "disjoint-channel",
607
+ * anchors: [
608
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
609
+ * { time: 0, price: 2 }, { time: 1, price: 3 },
610
+ * ],
611
+ * style: {},
612
+ * };
613
+ * void s;
614
+ */
615
+ export type DisjointChannelState = DrawingMeta & {
616
+ readonly kind: "disjoint-channel";
617
+ readonly anchors: AnchorQuad;
618
+ readonly style: LineDrawStyle;
619
+ };
620
+ /**
621
+ * `regression-trend` — least-squares fit ± bands across an anchor range.
622
+ *
623
+ * @formula fit = OLS(close[start..end]); bands = fit ± σ·stdevMultiplier
624
+ * @anchors anchors: [start, end]
625
+ * @since 0.3
626
+ * @stable
627
+ * @example
628
+ * const s: RegressionTrendState = {
629
+ * kind: "regression-trend",
630
+ * anchors: [{ time: 0, price: 0 }, { time: 100, price: 1 }],
631
+ * style: { source: "close", stdevMultiplier: 2 },
632
+ * };
633
+ * void s;
634
+ */
635
+ export type RegressionTrendState = DrawingMeta & {
636
+ readonly kind: "regression-trend";
637
+ readonly anchors: AnchorPair;
638
+ readonly style: RegressionTrendOpts;
639
+ };
640
+ /**
641
+ * `fib-retracement` — fib level lines between two pivot anchors.
642
+ *
643
+ * @formula for each level r in `style.levels`: y(r) = A.price + r·(B.price − A.price)
644
+ * @anchors anchors: [swingA, swingB]
645
+ * @since 0.3
646
+ * @stable
647
+ * @example
648
+ * const s: FibRetracementState = {
649
+ * kind: "fib-retracement",
650
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
651
+ * style: { levels: [0.382, 0.5, 0.618] },
652
+ * };
653
+ * void s;
654
+ */
655
+ export type FibRetracementState = DrawingMeta & {
656
+ readonly kind: "fib-retracement";
657
+ readonly anchors: AnchorPair;
658
+ readonly style: FibOpts;
659
+ };
660
+ /**
661
+ * `fib-trend-extension` — three-anchor fib extension projection.
662
+ *
663
+ * @formula range r = B−A; projection = C + r·level for level in style.levels
664
+ * @anchors anchors: [A, B, C]
665
+ * @since 0.3
666
+ * @stable
667
+ * @example
668
+ * const s: FibTrendExtensionState = {
669
+ * kind: "fib-trend-extension",
670
+ * anchors: [
671
+ * { time: 0, price: 0 },
672
+ * { time: 1, price: 1 },
673
+ * { time: 2, price: 0.5 },
674
+ * ],
675
+ * style: {},
676
+ * };
677
+ * void s;
678
+ */
679
+ export type FibTrendExtensionState = DrawingMeta & {
680
+ readonly kind: "fib-trend-extension";
681
+ readonly anchors: AnchorTriple;
682
+ readonly style: FibOpts;
683
+ };
684
+ /**
685
+ * `fib-channel` — fib levels projected as parallel channel lines.
686
+ *
687
+ * @formula parallel translates of line(A,B) at fib-ratio offsets through C
688
+ * @anchors anchors: [A, B, C]
689
+ * @since 0.3
690
+ * @stable
691
+ * @example
692
+ * const s: FibChannelState = {
693
+ * kind: "fib-channel",
694
+ * anchors: [
695
+ * { time: 0, price: 0 },
696
+ * { time: 1, price: 1 },
697
+ * { time: 0, price: 1 },
698
+ * ],
699
+ * style: {},
700
+ * };
701
+ * void s;
702
+ */
703
+ export type FibChannelState = DrawingMeta & {
704
+ readonly kind: "fib-channel";
705
+ readonly anchors: AnchorTriple;
706
+ readonly style: FibOpts;
707
+ };
708
+ /**
709
+ * `fib-time-zone` — vertical fib zones along the time axis.
710
+ *
711
+ * @formula vertical lines at t = A.time + ratio·(B.time − A.time)
712
+ * @anchors anchors: [A, B]
713
+ * @since 0.3
714
+ * @stable
715
+ * @example
716
+ * const s: FibTimeZoneState = {
717
+ * kind: "fib-time-zone",
718
+ * anchors: [{ time: 0, price: 0 }, { time: 100, price: 0 }],
719
+ * style: {},
720
+ * };
721
+ * void s;
722
+ */
723
+ export type FibTimeZoneState = DrawingMeta & {
724
+ readonly kind: "fib-time-zone";
725
+ readonly anchors: AnchorPair;
726
+ readonly style: FibOpts;
727
+ };
728
+ /**
729
+ * `fib-wedge` — fib-spaced lines fanned from a single anchor.
730
+ *
731
+ * @formula rays from `anchors[0]` at angles derived from fib ratios
732
+ * @anchors anchors: [pivot, range1, range2]
733
+ * @since 0.3
734
+ * @stable
735
+ * @example
736
+ * const s: FibWedgeState = {
737
+ * kind: "fib-wedge",
738
+ * anchors: [
739
+ * { time: 0, price: 0 },
740
+ * { time: 1, price: 1 },
741
+ * { time: 1, price: -1 },
742
+ * ],
743
+ * style: {},
744
+ * };
745
+ * void s;
746
+ */
747
+ export type FibWedgeState = DrawingMeta & {
748
+ readonly kind: "fib-wedge";
749
+ readonly anchors: AnchorTriple;
750
+ readonly style: FibOpts;
751
+ };
752
+ /**
753
+ * `fib-speed-fan` — fan of fib-ratio speed lines from a pivot.
754
+ *
755
+ * @formula rays from A with slopes = fib-ratio · slope(line(A,B))
756
+ * @anchors anchors: [A, B]
757
+ * @since 0.3
758
+ * @stable
759
+ * @example
760
+ * const s: FibSpeedFanState = {
761
+ * kind: "fib-speed-fan",
762
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
763
+ * style: {},
764
+ * };
765
+ * void s;
766
+ */
767
+ export type FibSpeedFanState = DrawingMeta & {
768
+ readonly kind: "fib-speed-fan";
769
+ readonly anchors: AnchorPair;
770
+ readonly style: FibOpts;
771
+ };
772
+ /**
773
+ * `fib-speed-arcs` — concentric arcs at fib radii.
774
+ *
775
+ * @formula for each level r in `style.levels`: arc of radius r·|AB| centred at A
776
+ * @anchors anchors: [centre, edge]
777
+ * @since 0.3
778
+ * @stable
779
+ * @example
780
+ * const s: FibSpeedArcsState = {
781
+ * kind: "fib-speed-arcs",
782
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 0 }],
783
+ * style: {},
784
+ * };
785
+ * void s;
786
+ */
787
+ export type FibSpeedArcsState = DrawingMeta & {
788
+ readonly kind: "fib-speed-arcs";
789
+ readonly anchors: AnchorPair;
790
+ readonly style: FibOpts;
791
+ };
792
+ /**
793
+ * `fib-spiral` — fib-ratio logarithmic spiral.
794
+ *
795
+ * @formula r(θ) = a · φ^(θ/π/2) where φ = (1+√5)/2
796
+ * @anchors anchors: [centre, edge]
797
+ * @since 0.3
798
+ * @stable
799
+ * @example
800
+ * const s: FibSpiralState = {
801
+ * kind: "fib-spiral",
802
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 0 }],
803
+ * style: {},
804
+ * };
805
+ * void s;
806
+ */
807
+ export type FibSpiralState = DrawingMeta & {
808
+ readonly kind: "fib-spiral";
809
+ readonly anchors: AnchorPair;
810
+ readonly style: FibOpts;
811
+ };
812
+ /**
813
+ * `fib-circles` — concentric circles at fib radii.
814
+ *
815
+ * @formula for each level r in `style.levels`: circle of radius r·|AB| centred at A
816
+ * @anchors anchors: [centre, edge]
817
+ * @since 0.3
818
+ * @stable
819
+ * @example
820
+ * const s: FibCirclesState = {
821
+ * kind: "fib-circles",
822
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 0 }],
823
+ * style: {},
824
+ * };
825
+ * void s;
826
+ */
827
+ export type FibCirclesState = DrawingMeta & {
828
+ readonly kind: "fib-circles";
829
+ readonly anchors: AnchorPair;
830
+ readonly style: FibOpts;
831
+ };
832
+ /**
833
+ * `fib-trend-time` — fib-spaced vertical time projections from a swing.
834
+ *
835
+ * @formula vertical lines at t = C.time + ratio·(B.time − A.time)
836
+ * @anchors anchors: [A, B, C]
837
+ * @since 0.3
838
+ * @stable
839
+ * @example
840
+ * const s: FibTrendTimeState = {
841
+ * kind: "fib-trend-time",
842
+ * anchors: [
843
+ * { time: 0, price: 0 },
844
+ * { time: 1, price: 1 },
845
+ * { time: 2, price: 0.5 },
846
+ * ],
847
+ * style: {},
848
+ * };
849
+ * void s;
850
+ */
851
+ export type FibTrendTimeState = DrawingMeta & {
852
+ readonly kind: "fib-trend-time";
853
+ readonly anchors: AnchorTriple;
854
+ readonly style: FibOpts;
855
+ };
856
+ /**
857
+ * `gann-box` — gann ratio grid inside an anchor pair.
858
+ *
859
+ * @formula grid of horizontal + vertical lines at 1/8, 2/8, …, 7/8 of |AB|
860
+ * @anchors anchors: [A, B]
861
+ * @since 0.3
862
+ * @stable
863
+ * @example
864
+ * const s: GannBoxState = {
865
+ * kind: "gann-box",
866
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
867
+ * style: {},
868
+ * };
869
+ * void s;
870
+ */
871
+ export type GannBoxState = DrawingMeta & {
872
+ readonly kind: "gann-box";
873
+ readonly anchors: AnchorPair;
874
+ readonly style: LineDrawStyle;
875
+ };
876
+ /**
877
+ * `gann-square-fixed` — square-of-nine fixed-size grid at an anchor.
878
+ *
879
+ * @formula 9×9 grid centred at `anchor` with fixed step
880
+ * @anchors anchor
881
+ * @since 0.3
882
+ * @stable
883
+ * @example
884
+ * const s: GannSquareFixedState = {
885
+ * kind: "gann-square-fixed",
886
+ * anchor: { time: 0, price: 0 },
887
+ * style: {},
888
+ * };
889
+ * void s;
890
+ */
891
+ export type GannSquareFixedState = DrawingMeta & {
892
+ readonly kind: "gann-square-fixed";
893
+ readonly anchor: WorldPoint;
894
+ readonly style: LineDrawStyle;
895
+ };
896
+ /**
897
+ * `gann-square` — square-of-nine sized by two anchors.
898
+ *
899
+ * @formula 9×9 grid spanning bbox of `anchors`
900
+ * @anchors anchors: [A, B]
901
+ * @since 0.3
902
+ * @stable
903
+ * @example
904
+ * const s: GannSquareState = {
905
+ * kind: "gann-square",
906
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
907
+ * style: {},
908
+ * };
909
+ * void s;
910
+ */
911
+ export type GannSquareState = DrawingMeta & {
912
+ readonly kind: "gann-square";
913
+ readonly anchors: AnchorPair;
914
+ readonly style: LineDrawStyle;
915
+ };
916
+ /**
917
+ * `gann-fan` — fan of gann-angle lines from a pivot.
918
+ *
919
+ * @formula rays from A at slopes 1×1, 1×2, 2×1, 1×3, 3×1, 1×4, 4×1, 1×8, 8×1
920
+ * @anchors anchors: [pivot, reference]
921
+ * @since 0.3
922
+ * @stable
923
+ * @example
924
+ * const s: GannFanState = {
925
+ * kind: "gann-fan",
926
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
927
+ * style: {},
928
+ * };
929
+ * void s;
930
+ */
931
+ export type GannFanState = DrawingMeta & {
932
+ readonly kind: "gann-fan";
933
+ readonly anchors: AnchorPair;
934
+ readonly style: LineDrawStyle;
935
+ };
936
+ /**
937
+ * `pitchfork` — Andrews pitchfork. The `variant` discriminator collapses
938
+ * the four invinite tools (`standard` / `schiff` / `modifiedSchiff` /
939
+ * `inside`) into one kind per PLAN.md §3.1.
940
+ *
941
+ * @formula median + two parallels through `anchors[1]` / `anchors[2]`
942
+ * @anchors anchors: [pivot, high, low]; variant: "standard"|"schiff"|"modifiedSchiff"|"inside"
943
+ * @since 0.3
944
+ * @stable
945
+ * @example
946
+ * const s: PitchforkState = {
947
+ * kind: "pitchfork",
948
+ * variant: "modifiedSchiff",
949
+ * anchors: [
950
+ * { time: 0, price: 0 },
951
+ * { time: 1, price: 1 },
952
+ * { time: 2, price: 0.5 },
953
+ * ],
954
+ * style: {},
955
+ * };
956
+ * void s;
957
+ */
958
+ export type PitchforkState = DrawingMeta & {
959
+ readonly kind: "pitchfork";
960
+ readonly anchors: AnchorTriple;
961
+ readonly variant: "standard" | "schiff" | "modifiedSchiff" | "inside";
962
+ readonly style: LineDrawStyle;
963
+ };
964
+ /**
965
+ * `pitchfan` — fan-variant pitchfork (no median line).
966
+ *
967
+ * @formula rays from `anchors[0]` through `anchors[1]` / `anchors[2]`
968
+ * @anchors anchors: [pivot, high, low]
969
+ * @since 0.3
970
+ * @stable
971
+ * @example
972
+ * const s: PitchfanState = {
973
+ * kind: "pitchfan",
974
+ * anchors: [
975
+ * { time: 0, price: 0 },
976
+ * { time: 1, price: 1 },
977
+ * { time: 2, price: 0.5 },
978
+ * ],
979
+ * style: {},
980
+ * };
981
+ * void s;
982
+ */
983
+ export type PitchfanState = DrawingMeta & {
984
+ readonly kind: "pitchfan";
985
+ readonly anchors: AnchorTriple;
986
+ readonly style: LineDrawStyle;
987
+ };
988
+ /**
989
+ * `xabcd-pattern` — harmonic pattern over five anchor pivots.
990
+ *
991
+ * @formula five-leg pattern with fib-ratio retracements between adjacent legs
992
+ * @anchors anchors: [X, A, B, C, D]
993
+ * @since 0.3
994
+ * @stable
995
+ * @example
996
+ * const s: XabcdPatternState = {
997
+ * kind: "xabcd-pattern",
998
+ * anchors: [
999
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1000
+ * { time: 2, price: 0.5 }, { time: 3, price: 1.5 },
1001
+ * { time: 4, price: 1 },
1002
+ * ],
1003
+ * style: {},
1004
+ * };
1005
+ * void s;
1006
+ */
1007
+ export type XabcdPatternState = DrawingMeta & {
1008
+ readonly kind: "xabcd-pattern";
1009
+ readonly anchors: AnchorQuint;
1010
+ readonly style: LineDrawStyle;
1011
+ };
1012
+ /**
1013
+ * `cypher-pattern` — five-anchor harmonic pattern. Has no standalone
1014
+ * invinite tool (Task 20's `defineDrawing` is the only emit path).
1015
+ *
1016
+ * @formula Cypher: XB at 0.382-0.618 of XA, XC at 1.272-1.414 of XA, XD at 0.786 of XC
1017
+ * @anchors anchors: [X, A, B, C, D]
1018
+ * @since 0.3
1019
+ * @stable
1020
+ * @example
1021
+ * const s: CypherPatternState = {
1022
+ * kind: "cypher-pattern",
1023
+ * anchors: [
1024
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1025
+ * { time: 2, price: 0.4 }, { time: 3, price: 1.3 },
1026
+ * { time: 4, price: 0.6 },
1027
+ * ],
1028
+ * style: {},
1029
+ * };
1030
+ * void s;
1031
+ */
1032
+ export type CypherPatternState = DrawingMeta & {
1033
+ readonly kind: "cypher-pattern";
1034
+ readonly anchors: AnchorQuint;
1035
+ readonly style: LineDrawStyle;
1036
+ };
1037
+ /**
1038
+ * `head-and-shoulders` — five-pivot reversal pattern.
1039
+ *
1040
+ * @formula identity — pivot polyline with neckline at min(anchors[0].price, anchors[4].price)
1041
+ * @anchors anchors: [leftShoulderHigh, leftLow, headHigh, rightLow, rightShoulderHigh]
1042
+ * @since 0.3
1043
+ * @stable
1044
+ * @example
1045
+ * const s: HeadAndShouldersState = {
1046
+ * kind: "head-and-shoulders",
1047
+ * anchors: [
1048
+ * { time: 0, price: 1 }, { time: 1, price: 0 },
1049
+ * { time: 2, price: 2 }, { time: 3, price: 0 },
1050
+ * { time: 4, price: 1 },
1051
+ * ],
1052
+ * style: {},
1053
+ * };
1054
+ * void s;
1055
+ */
1056
+ export type HeadAndShouldersState = DrawingMeta & {
1057
+ readonly kind: "head-and-shoulders";
1058
+ readonly anchors: AnchorQuint;
1059
+ readonly style: LineDrawStyle;
1060
+ };
1061
+ /**
1062
+ * `abcd-pattern` — four-anchor measured-move pattern.
1063
+ *
1064
+ * @formula CD = AB projected from C (fib ratio 1.0 default)
1065
+ * @anchors anchors: [A, B, C, D]
1066
+ * @since 0.3
1067
+ * @stable
1068
+ * @example
1069
+ * const s: AbcdPatternState = {
1070
+ * kind: "abcd-pattern",
1071
+ * anchors: [
1072
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1073
+ * { time: 2, price: 0.5 }, { time: 3, price: 1.5 },
1074
+ * ],
1075
+ * style: {},
1076
+ * };
1077
+ * void s;
1078
+ */
1079
+ export type AbcdPatternState = DrawingMeta & {
1080
+ readonly kind: "abcd-pattern";
1081
+ readonly anchors: AnchorQuad;
1082
+ readonly style: LineDrawStyle;
1083
+ };
1084
+ /**
1085
+ * `triangle-pattern` — three-anchor triangle pattern (ascending /
1086
+ * descending / symmetrical).
1087
+ *
1088
+ * @formula identity — three-vertex pattern outline
1089
+ * @anchors anchors: [apex, baseHigh, baseLow]
1090
+ * @since 0.3
1091
+ * @stable
1092
+ * @example
1093
+ * const s: TrianglePatternState = {
1094
+ * kind: "triangle-pattern",
1095
+ * anchors: [
1096
+ * { time: 2, price: 0.5 },
1097
+ * { time: 0, price: 1 },
1098
+ * { time: 0, price: 0 },
1099
+ * ],
1100
+ * style: {},
1101
+ * };
1102
+ * void s;
1103
+ */
1104
+ export type TrianglePatternState = DrawingMeta & {
1105
+ readonly kind: "triangle-pattern";
1106
+ readonly anchors: AnchorTriple;
1107
+ readonly style: LineDrawStyle;
1108
+ };
1109
+ /**
1110
+ * `three-drives-pattern` — six-leg three-drives reversal pattern.
1111
+ *
1112
+ * @formula three fib-ratio drives + two corrective retracements
1113
+ * @anchors anchors: [start, drive1, retr1, drive2, retr2, drive3, end]
1114
+ * @since 0.3
1115
+ * @stable
1116
+ * @example
1117
+ * const s: ThreeDrivesPatternState = {
1118
+ * kind: "three-drives-pattern",
1119
+ * anchors: [
1120
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1121
+ * { time: 2, price: 0.5 }, { time: 3, price: 1.5 },
1122
+ * { time: 4, price: 1 }, { time: 5, price: 2 },
1123
+ * { time: 6, price: 1.5 },
1124
+ * ],
1125
+ * style: {},
1126
+ * };
1127
+ * void s;
1128
+ */
1129
+ export type ThreeDrivesPatternState = DrawingMeta & {
1130
+ readonly kind: "three-drives-pattern";
1131
+ readonly anchors: AnchorHept;
1132
+ readonly style: LineDrawStyle;
1133
+ };
1134
+ /**
1135
+ * `elliott-impulse-wave` — five-wave impulse (1-2-3-4-5).
1136
+ *
1137
+ * @formula identity — five-pivot polyline; per-leg fib invariants validated
1138
+ * in the per-category port (Task 16)
1139
+ * @anchors anchors: [wave1End, wave2End, wave3End, wave4End, wave5End]; labels?
1140
+ * @since 0.3
1141
+ * @stable
1142
+ * @example
1143
+ * const s: ElliottImpulseWaveState = {
1144
+ * kind: "elliott-impulse-wave",
1145
+ * anchors: [
1146
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1147
+ * { time: 2, price: 0.5 }, { time: 3, price: 1.5 },
1148
+ * { time: 4, price: 1 },
1149
+ * ],
1150
+ * labels: ["1", "2", "3", "4", "5"],
1151
+ * style: {},
1152
+ * };
1153
+ * void s;
1154
+ */
1155
+ export type ElliottImpulseWaveState = DrawingMeta & {
1156
+ readonly kind: "elliott-impulse-wave";
1157
+ readonly anchors: AnchorQuint;
1158
+ readonly labels?: ReadonlyArray<string>;
1159
+ readonly style: LineDrawStyle;
1160
+ };
1161
+ /**
1162
+ * `elliott-correction-wave` — three-wave A-B-C correction.
1163
+ *
1164
+ * @formula identity — three-pivot polyline
1165
+ * @anchors anchors: [A, B, C]; labels?
1166
+ * @since 0.3
1167
+ * @stable
1168
+ * @example
1169
+ * const s: ElliottCorrectionWaveState = {
1170
+ * kind: "elliott-correction-wave",
1171
+ * anchors: [
1172
+ * { time: 0, price: 1 },
1173
+ * { time: 1, price: 0 },
1174
+ * { time: 2, price: 0.5 },
1175
+ * ],
1176
+ * labels: ["A", "B", "C"],
1177
+ * style: {},
1178
+ * };
1179
+ * void s;
1180
+ */
1181
+ export type ElliottCorrectionWaveState = DrawingMeta & {
1182
+ readonly kind: "elliott-correction-wave";
1183
+ readonly anchors: AnchorTriple;
1184
+ readonly labels?: ReadonlyArray<string>;
1185
+ readonly style: LineDrawStyle;
1186
+ };
1187
+ /**
1188
+ * `elliott-triangle-wave` — five-wave triangle correction.
1189
+ *
1190
+ * @formula identity — five-pivot polyline matching triangle invariants
1191
+ * @anchors anchors: [a, b, c, d, e]; labels?
1192
+ * @since 0.3
1193
+ * @stable
1194
+ * @example
1195
+ * const s: ElliottTriangleWaveState = {
1196
+ * kind: "elliott-triangle-wave",
1197
+ * anchors: [
1198
+ * { time: 0, price: 1 }, { time: 1, price: 0 },
1199
+ * { time: 2, price: 0.8 }, { time: 3, price: 0.2 },
1200
+ * { time: 4, price: 0.5 },
1201
+ * ],
1202
+ * labels: ["a", "b", "c", "d", "e"],
1203
+ * style: {},
1204
+ * };
1205
+ * void s;
1206
+ */
1207
+ export type ElliottTriangleWaveState = DrawingMeta & {
1208
+ readonly kind: "elliott-triangle-wave";
1209
+ readonly anchors: AnchorQuint;
1210
+ readonly labels?: ReadonlyArray<string>;
1211
+ readonly style: LineDrawStyle;
1212
+ };
1213
+ /**
1214
+ * `elliott-double-combo` — seven-anchor W-X-Y double-three.
1215
+ *
1216
+ * @formula identity — seven-pivot polyline: W three-wave + X + Y three-wave
1217
+ * @anchors anchors: [start, W-end, x1, X-end, x2, Y-mid, Y-end]; labels?
1218
+ * @since 0.3
1219
+ * @stable
1220
+ * @example
1221
+ * const s: ElliottDoubleComboState = {
1222
+ * kind: "elliott-double-combo",
1223
+ * anchors: [
1224
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1225
+ * { time: 2, price: 0.5 }, { time: 3, price: 1.5 },
1226
+ * { time: 4, price: 1 }, { time: 5, price: 2 },
1227
+ * { time: 6, price: 1.5 },
1228
+ * ],
1229
+ * style: {},
1230
+ * };
1231
+ * void s;
1232
+ */
1233
+ export type ElliottDoubleComboState = DrawingMeta & {
1234
+ readonly kind: "elliott-double-combo";
1235
+ readonly anchors: AnchorHept;
1236
+ readonly labels?: ReadonlyArray<string>;
1237
+ readonly style: LineDrawStyle;
1238
+ };
1239
+ /**
1240
+ * `elliott-triple-combo` — seven-anchor W-X-Y-X-Z triple-three.
1241
+ *
1242
+ * @formula identity — seven-pivot polyline: three corrective patterns joined by X waves
1243
+ * @anchors anchors: [start, W-end, X1-end, Y-end, X2-end, Z-mid, Z-end]; labels?
1244
+ * @since 0.3
1245
+ * @stable
1246
+ * @example
1247
+ * const s: ElliottTripleComboState = {
1248
+ * kind: "elliott-triple-combo",
1249
+ * anchors: [
1250
+ * { time: 0, price: 0 }, { time: 1, price: 1 },
1251
+ * { time: 2, price: 0.5 }, { time: 3, price: 1.5 },
1252
+ * { time: 4, price: 1 }, { time: 5, price: 2 },
1253
+ * { time: 6, price: 1.5 },
1254
+ * ],
1255
+ * style: {},
1256
+ * };
1257
+ * void s;
1258
+ */
1259
+ export type ElliottTripleComboState = DrawingMeta & {
1260
+ readonly kind: "elliott-triple-combo";
1261
+ readonly anchors: AnchorHept;
1262
+ readonly labels?: ReadonlyArray<string>;
1263
+ readonly style: LineDrawStyle;
1264
+ };
1265
+ /**
1266
+ * `cyclic-lines` — equally spaced vertical lines marking cycle periods.
1267
+ *
1268
+ * @formula vertical lines at t = A.time + n·(B.time − A.time) for n ∈ ℕ
1269
+ * @anchors anchors: [cycleStart, cycleEnd]
1270
+ * @since 0.3
1271
+ * @stable
1272
+ * @example
1273
+ * const s: CyclicLinesState = {
1274
+ * kind: "cyclic-lines",
1275
+ * anchors: [{ time: 0, price: 0 }, { time: 100, price: 0 }],
1276
+ * style: {},
1277
+ * };
1278
+ * void s;
1279
+ */
1280
+ export type CyclicLinesState = DrawingMeta & {
1281
+ readonly kind: "cyclic-lines";
1282
+ readonly anchors: AnchorPair;
1283
+ readonly style: LineDrawStyle;
1284
+ };
1285
+ /**
1286
+ * `time-cycles` — concentric semicircles measuring time cycles.
1287
+ *
1288
+ * @formula semicircles of radius n·|AB| centred at A for n ∈ ℕ
1289
+ * @anchors anchors: [centre, edge]
1290
+ * @since 0.3
1291
+ * @stable
1292
+ * @example
1293
+ * const s: TimeCyclesState = {
1294
+ * kind: "time-cycles",
1295
+ * anchors: [{ time: 0, price: 0 }, { time: 100, price: 0 }],
1296
+ * style: {},
1297
+ * };
1298
+ * void s;
1299
+ */
1300
+ export type TimeCyclesState = DrawingMeta & {
1301
+ readonly kind: "time-cycles";
1302
+ readonly anchors: AnchorPair;
1303
+ readonly style: LineDrawStyle;
1304
+ };
1305
+ /**
1306
+ * `sine-line` — sinusoidal projection fitted between two anchors.
1307
+ *
1308
+ * @formula y(t) = (A.price + B.price)/2 + ((B.price − A.price)/2)·sin(2π·(t − A.time)/(B.time − A.time))
1309
+ * @anchors anchors: [periodStart, periodEnd]
1310
+ * @since 0.3
1311
+ * @stable
1312
+ * @example
1313
+ * const s: SineLineState = {
1314
+ * kind: "sine-line",
1315
+ * anchors: [{ time: 0, price: 0 }, { time: 100, price: 1 }],
1316
+ * style: {},
1317
+ * };
1318
+ * void s;
1319
+ */
1320
+ export type SineLineState = DrawingMeta & {
1321
+ readonly kind: "sine-line";
1322
+ readonly anchors: AnchorPair;
1323
+ readonly style: LineDrawStyle;
1324
+ };
1325
+ /**
1326
+ * `group` — logical container for child drawings. Children are
1327
+ * referenced by handle id; rendering is delegated to the children.
1328
+ *
1329
+ * @formula N/A — pure container; rendering passes through to children
1330
+ * @anchors N/A — group carries no geometry, only child references
1331
+ * @since 0.3
1332
+ * @stable
1333
+ * @example
1334
+ * const s: GroupState = {
1335
+ * kind: "group",
1336
+ * childHandleIds: ["h1", "h2"],
1337
+ * };
1338
+ * void s;
1339
+ */
1340
+ export type GroupState = DrawingMeta & {
1341
+ readonly kind: "group";
1342
+ readonly childHandleIds: ReadonlyArray<string>;
1343
+ readonly meta?: Readonly<Record<string, JsonValue>>;
1344
+ };
1345
+ /**
1346
+ * `frame` — labelled rectangle container around child drawings. Carries
1347
+ * a background colour + label per {@link FrameOpts}.
1348
+ *
1349
+ * @formula identity — labelled bounding rectangle around `childHandleIds`
1350
+ * @anchors anchors: [topLeft, bottomRight]
1351
+ * @since 0.3
1352
+ * @stable
1353
+ * @example
1354
+ * const s: FrameState = {
1355
+ * kind: "frame",
1356
+ * anchors: [{ time: 0, price: 0 }, { time: 1, price: 1 }],
1357
+ * childHandleIds: [],
1358
+ * style: { label: "Idea" },
1359
+ * };
1360
+ * void s;
1361
+ */
1362
+ export type FrameState = DrawingMeta & {
1363
+ readonly kind: "frame";
1364
+ readonly anchors: AnchorPair;
1365
+ readonly childHandleIds: ReadonlyArray<string>;
1366
+ readonly style: FrameOpts;
1367
+ };
1368
+ /**
1369
+ * `table` — CSS-pixel viewport-anchored dashboard/status panel. It
1370
+ * deliberately carries no world-space anchors; adapters resolve
1371
+ * `position` against the current viewport per PLAN.md §10.2.
1372
+ *
1373
+ * @formula N/A — table layout resolved in CSS pixels by adapter
1374
+ * @anchors position: CSS viewport anchor
1375
+ * @since 0.5
1376
+ * @stable
1377
+ * @example
1378
+ * const s: TableState = {
1379
+ * kind: "table",
1380
+ * position: "top-right",
1381
+ * cells: [[{ text: "P&L" }, { text: "+12.5%", textColor: "#16a34a" }]],
1382
+ * };
1383
+ * void s;
1384
+ */
1385
+ export type TableState = DrawingMeta & {
1386
+ readonly kind: "table";
1387
+ readonly position: TablePosition;
1388
+ readonly cells: ReadonlyArray<ReadonlyArray<TableCell>>;
1389
+ readonly borderColor?: Color;
1390
+ readonly borderWidth?: number;
1391
+ readonly frame?: Readonly<{
1392
+ color: Color;
1393
+ width: number;
1394
+ }>;
1395
+ };
1396
+ /**
1397
+ * Per-kind state union — every {@link DrawingKind} maps to exactly one
1398
+ * variant. Collab-only fields (Yjs `id`, `layerId`, `createdAt`,
1399
+ * `authorId`, `parentGroupId`, `parentFrameId`, `visibleIntervals`)
1400
+ * from the invinite source are stripped per PLAN.md §10.4.
1401
+ *
1402
+ * The 62 variants here are intentionally minimal shells. Tasks 5–18
1403
+ * (per-category ports) refine each variant's geometry + style payload
1404
+ * against the invinite source-of-truth. Exhaustiveness is asserted via
1405
+ * the `(k satisfies never)` switch in `drawingState.types.test.ts`.
1406
+ *
1407
+ * @formula discriminated union — switch on `state.kind` to read variant
1408
+ * @anchors per-variant — see the individual `*State` declarations above
1409
+ * @since 0.3
1410
+ * @stable
1411
+ * @example
1412
+ * const s: DrawingState = {
1413
+ * kind: "horizontal-line",
1414
+ * price: 100,
1415
+ * style: { color: "#3b82f6" },
1416
+ * };
1417
+ * void s;
1418
+ */
1419
+ export type DrawingState = LineState | HorizontalLineState | HorizontalRayState | VerticalLineState | CrossLineState | TrendAngleState | RectangleState | RotatedRectangleState | TriangleState | PolylineState | CircleState | EllipseState | PathState | MarkerState | ArcState | CurveState | DoubleCurveState | PenState | HighlighterState | BrushState | TextState | ArrowState | ArrowMarkerState | ArrowMarkUpState | ArrowMarkDownState | TrendChannelState | FlatTopBottomState | DisjointChannelState | RegressionTrendState | FibRetracementState | FibTrendExtensionState | FibChannelState | FibTimeZoneState | FibWedgeState | FibSpeedFanState | FibSpeedArcsState | FibSpiralState | FibCirclesState | FibTrendTimeState | GannBoxState | GannSquareFixedState | GannSquareState | GannFanState | PitchforkState | PitchfanState | XabcdPatternState | CypherPatternState | HeadAndShouldersState | AbcdPatternState | TrianglePatternState | ThreeDrivesPatternState | ElliottImpulseWaveState | ElliottCorrectionWaveState | ElliottTriangleWaveState | ElliottDoubleComboState | ElliottTripleComboState | CyclicLinesState | TimeCyclesState | SineLineState | GroupState | FrameState | TableState;
1420
+ //# sourceMappingURL=drawingState.d.ts.map