@invinite-org/chartlang-adapter-kit 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +7 -0
  3. package/dist/canvas/index.d.ts +5 -0
  4. package/dist/canvas/index.d.ts.map +1 -0
  5. package/dist/canvas/index.js +5 -0
  6. package/dist/canvas/index.js.map +1 -0
  7. package/dist/canvas/mockContext.d.ts +168 -0
  8. package/dist/canvas/mockContext.d.ts.map +1 -0
  9. package/dist/canvas/mockContext.js +198 -0
  10. package/dist/canvas/mockContext.js.map +1 -0
  11. package/dist/canvas/paintPrimitive.d.ts +35 -0
  12. package/dist/canvas/paintPrimitive.d.ts.map +1 -0
  13. package/dist/canvas/paintPrimitive.js +171 -0
  14. package/dist/canvas/paintPrimitive.js.map +1 -0
  15. package/dist/canvas/renderCtx.d.ts +40 -0
  16. package/dist/canvas/renderCtx.d.ts.map +1 -0
  17. package/dist/canvas/renderCtx.js +4 -0
  18. package/dist/canvas/renderCtx.js.map +1 -0
  19. package/dist/geometry/_lib/arrowhead.d.ts +18 -0
  20. package/dist/geometry/_lib/arrowhead.d.ts.map +1 -0
  21. package/dist/geometry/_lib/arrowhead.js +38 -0
  22. package/dist/geometry/_lib/arrowhead.js.map +1 -0
  23. package/dist/geometry/_lib/bezier.d.ts +57 -0
  24. package/dist/geometry/_lib/bezier.d.ts.map +1 -0
  25. package/dist/geometry/_lib/bezier.js +84 -0
  26. package/dist/geometry/_lib/bezier.js.map +1 -0
  27. package/dist/geometry/_lib/chevron.d.ts +29 -0
  28. package/dist/geometry/_lib/chevron.d.ts.map +1 -0
  29. package/dist/geometry/_lib/chevron.js +37 -0
  30. package/dist/geometry/_lib/chevron.js.map +1 -0
  31. package/dist/geometry/_lib/dash.d.ts +30 -0
  32. package/dist/geometry/_lib/dash.d.ts.map +1 -0
  33. package/dist/geometry/_lib/dash.js +40 -0
  34. package/dist/geometry/_lib/dash.js.map +1 -0
  35. package/dist/geometry/_lib/fibLevels.d.ts +36 -0
  36. package/dist/geometry/_lib/fibLevels.d.ts.map +1 -0
  37. package/dist/geometry/_lib/fibLevels.js +44 -0
  38. package/dist/geometry/_lib/fibLevels.js.map +1 -0
  39. package/dist/geometry/_lib/gannLevels.d.ts +54 -0
  40. package/dist/geometry/_lib/gannLevels.d.ts.map +1 -0
  41. package/dist/geometry/_lib/gannLevels.js +88 -0
  42. package/dist/geometry/_lib/gannLevels.js.map +1 -0
  43. package/dist/geometry/_lib/lineExtend.d.ts +31 -0
  44. package/dist/geometry/_lib/lineExtend.d.ts.map +1 -0
  45. package/dist/geometry/_lib/lineExtend.js +48 -0
  46. package/dist/geometry/_lib/lineExtend.js.map +1 -0
  47. package/dist/geometry/_lib/namedPolyline.d.ts +25 -0
  48. package/dist/geometry/_lib/namedPolyline.d.ts.map +1 -0
  49. package/dist/geometry/_lib/namedPolyline.js +64 -0
  50. package/dist/geometry/_lib/namedPolyline.js.map +1 -0
  51. package/dist/geometry/_lib/pitchforkGeom.d.ts +46 -0
  52. package/dist/geometry/_lib/pitchforkGeom.d.ts.map +1 -0
  53. package/dist/geometry/_lib/pitchforkGeom.js +70 -0
  54. package/dist/geometry/_lib/pitchforkGeom.js.map +1 -0
  55. package/dist/geometry/_lib/shapeStyle.d.ts +21 -0
  56. package/dist/geometry/_lib/shapeStyle.d.ts.map +1 -0
  57. package/dist/geometry/_lib/shapeStyle.js +41 -0
  58. package/dist/geometry/_lib/shapeStyle.js.map +1 -0
  59. package/dist/geometry/_lib/strokeStyle.d.ts +34 -0
  60. package/dist/geometry/_lib/strokeStyle.d.ts.map +1 -0
  61. package/dist/geometry/_lib/strokeStyle.js +26 -0
  62. package/dist/geometry/_lib/strokeStyle.js.map +1 -0
  63. package/dist/geometry/_lib/textStyle.d.ts +70 -0
  64. package/dist/geometry/_lib/textStyle.d.ts.map +1 -0
  65. package/dist/geometry/_lib/textStyle.js +78 -0
  66. package/dist/geometry/_lib/textStyle.js.map +1 -0
  67. package/dist/geometry/decompose.d.ts +28 -0
  68. package/dist/geometry/decompose.d.ts.map +1 -0
  69. package/dist/geometry/decompose.js +176 -0
  70. package/dist/geometry/decompose.js.map +1 -0
  71. package/dist/geometry/index.d.ts +4 -0
  72. package/dist/geometry/index.d.ts.map +1 -0
  73. package/dist/geometry/index.js +5 -0
  74. package/dist/geometry/index.js.map +1 -0
  75. package/dist/geometry/kinds/annotations.d.ts +77 -0
  76. package/dist/geometry/kinds/annotations.d.ts.map +1 -0
  77. package/dist/geometry/kinds/annotations.js +219 -0
  78. package/dist/geometry/kinds/annotations.js.map +1 -0
  79. package/dist/geometry/kinds/boxes.d.ts +116 -0
  80. package/dist/geometry/kinds/boxes.d.ts.map +1 -0
  81. package/dist/geometry/kinds/boxes.js +285 -0
  82. package/dist/geometry/kinds/boxes.js.map +1 -0
  83. package/dist/geometry/kinds/channels.d.ts +72 -0
  84. package/dist/geometry/kinds/channels.d.ts.map +1 -0
  85. package/dist/geometry/kinds/channels.js +148 -0
  86. package/dist/geometry/kinds/channels.js.map +1 -0
  87. package/dist/geometry/kinds/containers.d.ts +54 -0
  88. package/dist/geometry/kinds/containers.d.ts.map +1 -0
  89. package/dist/geometry/kinds/containers.js +268 -0
  90. package/dist/geometry/kinds/containers.js.map +1 -0
  91. package/dist/geometry/kinds/curves.d.ts +53 -0
  92. package/dist/geometry/kinds/curves.d.ts.map +1 -0
  93. package/dist/geometry/kinds/curves.js +110 -0
  94. package/dist/geometry/kinds/curves.js.map +1 -0
  95. package/dist/geometry/kinds/cycles.d.ts +52 -0
  96. package/dist/geometry/kinds/cycles.d.ts.map +1 -0
  97. package/dist/geometry/kinds/cycles.js +158 -0
  98. package/dist/geometry/kinds/cycles.js.map +1 -0
  99. package/dist/geometry/kinds/elliott.d.ts +73 -0
  100. package/dist/geometry/kinds/elliott.d.ts.map +1 -0
  101. package/dist/geometry/kinds/elliott.js +116 -0
  102. package/dist/geometry/kinds/elliott.js.map +1 -0
  103. package/dist/geometry/kinds/fibonacci.d.ts +166 -0
  104. package/dist/geometry/kinds/fibonacci.d.ts.map +1 -0
  105. package/dist/geometry/kinds/fibonacci.js +458 -0
  106. package/dist/geometry/kinds/fibonacci.js.map +1 -0
  107. package/dist/geometry/kinds/freehand.d.ts +53 -0
  108. package/dist/geometry/kinds/freehand.d.ts.map +1 -0
  109. package/dist/geometry/kinds/freehand.js +115 -0
  110. package/dist/geometry/kinds/freehand.js.map +1 -0
  111. package/dist/geometry/kinds/gann.d.ts +63 -0
  112. package/dist/geometry/kinds/gann.d.ts.map +1 -0
  113. package/dist/geometry/kinds/gann.js +153 -0
  114. package/dist/geometry/kinds/gann.js.map +1 -0
  115. package/dist/geometry/kinds/lines.d.ts +90 -0
  116. package/dist/geometry/kinds/lines.d.ts.map +1 -0
  117. package/dist/geometry/kinds/lines.js +201 -0
  118. package/dist/geometry/kinds/lines.js.map +1 -0
  119. package/dist/geometry/kinds/marker.d.ts +21 -0
  120. package/dist/geometry/kinds/marker.d.ts.map +1 -0
  121. package/dist/geometry/kinds/marker.js +47 -0
  122. package/dist/geometry/kinds/marker.js.map +1 -0
  123. package/dist/geometry/kinds/patterns.d.ts +85 -0
  124. package/dist/geometry/kinds/patterns.d.ts.map +1 -0
  125. package/dist/geometry/kinds/patterns.js +133 -0
  126. package/dist/geometry/kinds/patterns.js.map +1 -0
  127. package/dist/geometry/kinds/pitchforks.d.ts +36 -0
  128. package/dist/geometry/kinds/pitchforks.d.ts.map +1 -0
  129. package/dist/geometry/kinds/pitchforks.js +109 -0
  130. package/dist/geometry/kinds/pitchforks.js.map +1 -0
  131. package/dist/geometry/project.d.ts +50 -0
  132. package/dist/geometry/project.d.ts.map +1 -0
  133. package/dist/geometry/project.js +62 -0
  134. package/dist/geometry/project.js.map +1 -0
  135. package/dist/geometry/types.d.ts +146 -0
  136. package/dist/geometry/types.d.ts.map +1 -0
  137. package/dist/geometry/types.js +4 -0
  138. package/dist/geometry/types.js.map +1 -0
  139. package/dist/index.d.ts +2 -0
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +1 -0
  142. package/dist/index.js.map +1 -1
  143. package/package.json +8 -1
@@ -0,0 +1,146 @@
1
+ /**
2
+ * A 2D point in renderer pixel space — the structural type every
3
+ * projection helper returns and every {@link DrawPrimitive} consumes.
4
+ * Read-only so decomposers can't mutate vertices they don't own.
5
+ *
6
+ * @since 1.3
7
+ * @stable
8
+ * @example
9
+ * const p: Point2 = { x: 100, y: 50 };
10
+ * void p;
11
+ */
12
+ export type Point2 = {
13
+ readonly x: number;
14
+ readonly y: number;
15
+ };
16
+ /**
17
+ * Visible window into world coordinates. `xMin`/`xMax` are bar times in
18
+ * UTC milliseconds; `yMin`/`yMax` are prices in the quote currency.
19
+ * `pxWidth`/`pxHeight` are the renderer's drawable size in CSS pixels.
20
+ * Ported verbatim from the canvas2d adapter's `render/coords.ts` so all
21
+ * adapters share one projection contract.
22
+ *
23
+ * @since 1.3
24
+ * @stable
25
+ * @example
26
+ * const vp: Viewport = {
27
+ * xMin: 0, xMax: 9, yMin: 100, yMax: 110,
28
+ * pxWidth: 800, pxHeight: 400,
29
+ * };
30
+ * void vp;
31
+ */
32
+ export type Viewport = {
33
+ readonly xMin: number;
34
+ readonly xMax: number;
35
+ readonly yMin: number;
36
+ readonly yMax: number;
37
+ readonly pxWidth: number;
38
+ readonly pxHeight: number;
39
+ };
40
+ /**
41
+ * Resolved stroke styling for a {@link DrawPrimitive}. `dash` is the
42
+ * `setLineDash` segment array — `[]` is a solid stroke. Decomposers map
43
+ * a `LineStyle` to `dash` via the `_lib/dash` helper.
44
+ *
45
+ * `alpha ∈ [0, 1]` is the optional stroke opacity the painter brackets
46
+ * around the `stroke()` call (the `highlighter` freehand kind sets it).
47
+ * When omitted the stroke is fully opaque and the painter emits no
48
+ * `globalAlpha` mutation — so a stroke without `alpha` is byte-identical
49
+ * to a Task-1 stroke.
50
+ *
51
+ * @since 1.3
52
+ * @stable
53
+ * @example
54
+ * const s: StrokeStyle = { color: "#000000", width: 1, dash: [] };
55
+ * void s;
56
+ */
57
+ export type StrokeStyle = {
58
+ readonly color: string;
59
+ readonly width: number;
60
+ readonly dash: ReadonlyArray<number>;
61
+ readonly alpha?: number;
62
+ };
63
+ /**
64
+ * Resolved fill styling for a {@link DrawPrimitive}. `alpha ∈ [0, 1]`
65
+ * is applied around the fill so a subsequent stroke draws at full
66
+ * opacity.
67
+ *
68
+ * @since 1.3
69
+ * @stable
70
+ * @example
71
+ * const f: FillStyle = { color: "#dbeafe", alpha: 0.4 };
72
+ * void f;
73
+ */
74
+ export type FillStyle = {
75
+ readonly color: string;
76
+ readonly alpha: number;
77
+ };
78
+ /**
79
+ * Renderer-agnostic intermediate representation every drawing reduces
80
+ * to. {@link decomposeDrawing} returns a flat `DrawPrimitive[]`; each
81
+ * adapter paints the list with its own sink (canvas `paintPrimitive`,
82
+ * Konva nodes, ECharts `graphic`, …). The four shapes — `polyline`,
83
+ * `arc`, `text`, `marker` — are the smallest set all the target chart
84
+ * libraries can consume.
85
+ *
86
+ * - `polyline` — an open or `closed` path with optional `stroke` / `fill`.
87
+ * - `arc` — a circular arc centred on `(cx, cy)` from `start` to `end`
88
+ * radians, with optional `stroke` / `fill`.
89
+ * - `text` — a single label at `(x, y)` with explicit `align` / `baseline`.
90
+ * - `marker` — a sized glyph at `(x, y)` (reserved for adapter / future
91
+ * kinds; no basic kind emits it).
92
+ *
93
+ * @since 1.3
94
+ * @stable
95
+ * @example
96
+ * const seg: DrawPrimitive = {
97
+ * kind: "polyline",
98
+ * points: [{ x: 0, y: 0 }, { x: 10, y: 10 }],
99
+ * closed: false,
100
+ * stroke: { color: "#000000", width: 1, dash: [] },
101
+ * };
102
+ * void seg;
103
+ */
104
+ export type DrawPrimitive = {
105
+ readonly kind: "polyline";
106
+ readonly points: ReadonlyArray<Point2>;
107
+ readonly closed: boolean;
108
+ readonly stroke?: StrokeStyle;
109
+ readonly fill?: FillStyle;
110
+ } | {
111
+ readonly kind: "arc";
112
+ readonly cx: number;
113
+ readonly cy: number;
114
+ readonly r: number;
115
+ readonly start: number;
116
+ readonly end: number;
117
+ /**
118
+ * Whether the painter issues `closePath()` after the arc —
119
+ * drawing the chord back to the arc's start. `true` only for a
120
+ * full-circle shape (e.g. `circle`); partial arcs (the
121
+ * `trend-angle` indicator, `time-cycles`) MUST be `false`, else
122
+ * the chord renders as a spurious diameter line.
123
+ */
124
+ readonly closed: boolean;
125
+ readonly stroke?: StrokeStyle;
126
+ readonly fill?: FillStyle;
127
+ } | {
128
+ readonly kind: "text";
129
+ readonly x: number;
130
+ readonly y: number;
131
+ readonly text: string;
132
+ readonly color: string;
133
+ readonly font: string;
134
+ readonly align: "left" | "center" | "right";
135
+ readonly baseline: "top" | "middle" | "bottom";
136
+ readonly bgColor?: string;
137
+ } | {
138
+ readonly kind: "marker";
139
+ readonly shape: "circle" | "square" | "diamond" | "triangle-up" | "triangle-down";
140
+ readonly x: number;
141
+ readonly y: number;
142
+ readonly size: number;
143
+ readonly stroke?: StrokeStyle;
144
+ readonly fill?: FillStyle;
145
+ };
146
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/geometry/types.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC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AC7B,GACD;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC7B,GACD;IACI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,eAAe,CAAC;IAClF,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
+ // See the LICENSE file in the repo root for full license text.
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/geometry/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 * A 2D point in renderer pixel space — the structural type every\n * projection helper returns and every {@link DrawPrimitive} consumes.\n * Read-only so decomposers can't mutate vertices they don't own.\n *\n * @since 1.3\n * @stable\n * @example\n * const p: Point2 = { x: 100, y: 50 };\n * void p;\n */\nexport type Point2 = { readonly x: number; readonly y: number };\n\n/**\n * Visible window into world coordinates. `xMin`/`xMax` are bar times in\n * UTC milliseconds; `yMin`/`yMax` are prices in the quote currency.\n * `pxWidth`/`pxHeight` are the renderer's drawable size in CSS pixels.\n * Ported verbatim from the canvas2d adapter's `render/coords.ts` so all\n * adapters share one projection contract.\n *\n * @since 1.3\n * @stable\n * @example\n * const vp: Viewport = {\n * xMin: 0, xMax: 9, yMin: 100, yMax: 110,\n * pxWidth: 800, pxHeight: 400,\n * };\n * void vp;\n */\nexport type Viewport = {\n readonly xMin: number;\n readonly xMax: number;\n readonly yMin: number;\n readonly yMax: number;\n readonly pxWidth: number;\n readonly pxHeight: number;\n};\n\n/**\n * Resolved stroke styling for a {@link DrawPrimitive}. `dash` is the\n * `setLineDash` segment array — `[]` is a solid stroke. Decomposers map\n * a `LineStyle` to `dash` via the `_lib/dash` helper.\n *\n * `alpha ∈ [0, 1]` is the optional stroke opacity the painter brackets\n * around the `stroke()` call (the `highlighter` freehand kind sets it).\n * When omitted the stroke is fully opaque and the painter emits no\n * `globalAlpha` mutation — so a stroke without `alpha` is byte-identical\n * to a Task-1 stroke.\n *\n * @since 1.3\n * @stable\n * @example\n * const s: StrokeStyle = { color: \"#000000\", width: 1, dash: [] };\n * void s;\n */\nexport type StrokeStyle = {\n readonly color: string;\n readonly width: number;\n readonly dash: ReadonlyArray<number>;\n readonly alpha?: number;\n};\n\n/**\n * Resolved fill styling for a {@link DrawPrimitive}. `alpha ∈ [0, 1]`\n * is applied around the fill so a subsequent stroke draws at full\n * opacity.\n *\n * @since 1.3\n * @stable\n * @example\n * const f: FillStyle = { color: \"#dbeafe\", alpha: 0.4 };\n * void f;\n */\nexport type FillStyle = { readonly color: string; readonly alpha: number };\n\n/**\n * Renderer-agnostic intermediate representation every drawing reduces\n * to. {@link decomposeDrawing} returns a flat `DrawPrimitive[]`; each\n * adapter paints the list with its own sink (canvas `paintPrimitive`,\n * Konva nodes, ECharts `graphic`, …). The four shapes — `polyline`,\n * `arc`, `text`, `marker` — are the smallest set all the target chart\n * libraries can consume.\n *\n * - `polyline` — an open or `closed` path with optional `stroke` / `fill`.\n * - `arc` — a circular arc centred on `(cx, cy)` from `start` to `end`\n * radians, with optional `stroke` / `fill`.\n * - `text` — a single label at `(x, y)` with explicit `align` / `baseline`.\n * - `marker` — a sized glyph at `(x, y)` (reserved for adapter / future\n * kinds; no basic kind emits it).\n *\n * @since 1.3\n * @stable\n * @example\n * const seg: DrawPrimitive = {\n * kind: \"polyline\",\n * points: [{ x: 0, y: 0 }, { x: 10, y: 10 }],\n * closed: false,\n * stroke: { color: \"#000000\", width: 1, dash: [] },\n * };\n * void seg;\n */\nexport type DrawPrimitive =\n | {\n readonly kind: \"polyline\";\n readonly points: ReadonlyArray<Point2>;\n readonly closed: boolean;\n readonly stroke?: StrokeStyle;\n readonly fill?: FillStyle;\n }\n | {\n readonly kind: \"arc\";\n readonly cx: number;\n readonly cy: number;\n readonly r: number;\n readonly start: number;\n readonly end: number;\n /**\n * Whether the painter issues `closePath()` after the arc —\n * drawing the chord back to the arc's start. `true` only for a\n * full-circle shape (e.g. `circle`); partial arcs (the\n * `trend-angle` indicator, `time-cycles`) MUST be `false`, else\n * the chord renders as a spurious diameter line.\n */\n readonly closed: boolean;\n readonly stroke?: StrokeStyle;\n readonly fill?: FillStyle;\n }\n | {\n readonly kind: \"text\";\n readonly x: number;\n readonly y: number;\n readonly text: string;\n readonly color: string;\n readonly font: string;\n readonly align: \"left\" | \"center\" | \"right\";\n readonly baseline: \"top\" | \"middle\" | \"bottom\";\n readonly bgColor?: string;\n }\n | {\n readonly kind: \"marker\";\n readonly shape: \"circle\" | \"square\" | \"diamond\" | \"triangle-up\" | \"triangle-down\";\n readonly x: number;\n readonly y: number;\n readonly size: number;\n readonly stroke?: StrokeStyle;\n readonly fill?: FillStyle;\n };\n"]}
package/dist/index.d.ts CHANGED
@@ -8,5 +8,7 @@ export type { ValidationFail, ValidationOk, ValidationResult } from "./validatio
8
8
  export { mockCandleSource } from "./mocks/index.js";
9
9
  export type { MockCandleSourceMode, MockCandleSourceOpts } from "./mocks/index.js";
10
10
  export { BufferingAdapter, PassThroughAdapter } from "./base/index.js";
11
+ export { decomposeDrawing, priceToY, timeToX, worldPointToPixel } from "./geometry/index.js";
12
+ export type { DrawPrimitive, FillStyle, Point2, StrokeStyle, Viewport, } from "./geometry/index.js";
11
13
  export type { Adapter, AdapterSymInfo, AlertChannel, AlertConditionEmission, AlertEmission, Capabilities, CandleEvent, DiagnosticCode, DrawingCounts, DrawingEmission, DrawingKind, InputKind, LogEmission, PlotEmission, PlotKind, PlotOverride, PlotSlotDescriptor, PlotStyle, RunnerEmissions, RuntimeDiagnostic, SymInfoField, } from "./types.js";
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACxE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAA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ACR,OAAO,EACP,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,YAAY,GACf,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ export { PHASE_5_PLOT_KINDS, capabilities } from "./capabilities/index.js";
6
6
  export { decodeDrawing, validateEmission } from "./validation/index.js";
7
7
  export { mockCandleSource } from "./mocks/index.js";
8
8
  export { BufferingAdapter, PassThroughAdapter } from "./base/index.js";
9
+ export { decomposeDrawing, priceToY, timeToX, worldPointToPixel } from "./geometry/index.js";
9
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,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 { KIND_BUCKET, bucketFor } from \"@invinite-org/chartlang-core\";\nexport type { DrawingBucket, DrawingState } from \"@invinite-org/chartlang-core\";\nexport { defineAdapter } from \"./defineAdapter.js\";\nexport type { DefineAdapterOpts } from \"./defineAdapter.js\";\nexport { PHASE_5_PLOT_KINDS, capabilities } from \"./capabilities/index.js\";\nexport { decodeDrawing, validateEmission } from \"./validation/index.js\";\nexport type { ValidationFail, ValidationOk, ValidationResult } from \"./validation/index.js\";\nexport { mockCandleSource } from \"./mocks/index.js\";\nexport type { MockCandleSourceMode, MockCandleSourceOpts } from \"./mocks/index.js\";\nexport { BufferingAdapter, PassThroughAdapter } from \"./base/index.js\";\nexport type {\n Adapter,\n AdapterSymInfo,\n AlertChannel,\n AlertConditionEmission,\n AlertEmission,\n Capabilities,\n CandleEvent,\n DiagnosticCode,\n DrawingCounts,\n DrawingEmission,\n DrawingKind,\n InputKind,\n LogEmission,\n PlotEmission,\n PlotKind,\n PlotOverride,\n PlotSlotDescriptor,\n PlotStyle,\n RunnerEmissions,\n RuntimeDiagnostic,\n SymInfoField,\n} from \"./types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,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 { KIND_BUCKET, bucketFor } from \"@invinite-org/chartlang-core\";\nexport type { DrawingBucket, DrawingState } from \"@invinite-org/chartlang-core\";\nexport { defineAdapter } from \"./defineAdapter.js\";\nexport type { DefineAdapterOpts } from \"./defineAdapter.js\";\nexport { PHASE_5_PLOT_KINDS, capabilities } from \"./capabilities/index.js\";\nexport { decodeDrawing, validateEmission } from \"./validation/index.js\";\nexport type { ValidationFail, ValidationOk, ValidationResult } from \"./validation/index.js\";\nexport { mockCandleSource } from \"./mocks/index.js\";\nexport type { MockCandleSourceMode, MockCandleSourceOpts } from \"./mocks/index.js\";\nexport { BufferingAdapter, PassThroughAdapter } from \"./base/index.js\";\nexport { decomposeDrawing, priceToY, timeToX, worldPointToPixel } from \"./geometry/index.js\";\nexport type {\n DrawPrimitive,\n FillStyle,\n Point2,\n StrokeStyle,\n Viewport,\n} from \"./geometry/index.js\";\nexport type {\n Adapter,\n AdapterSymInfo,\n AlertChannel,\n AlertConditionEmission,\n AlertEmission,\n Capabilities,\n CandleEvent,\n DiagnosticCode,\n DrawingCounts,\n DrawingEmission,\n DrawingKind,\n InputKind,\n LogEmission,\n PlotEmission,\n PlotKind,\n PlotOverride,\n PlotSlotDescriptor,\n PlotStyle,\n RunnerEmissions,\n RuntimeDiagnostic,\n SymInfoField,\n} from \"./types.js\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invinite-org/chartlang-adapter-kit",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "SDK for writing chartlang adapters in consumer repos",
@@ -10,6 +10,10 @@
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js"
13
+ },
14
+ "./canvas": {
15
+ "types": "./dist/canvas/index.d.ts",
16
+ "import": "./dist/canvas/index.js"
13
17
  }
14
18
  },
15
19
  "files": [
@@ -21,6 +25,9 @@
21
25
  "dependencies": {
22
26
  "@invinite-org/chartlang-core": "^1.2.0"
23
27
  },
28
+ "devDependencies": {
29
+ "@types/node": "^20.0.0"
30
+ },
24
31
  "publishConfig": {
25
32
  "access": "public",
26
33
  "provenance": true