@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.
- package/CHANGELOG.md +52 -0
- package/README.md +7 -0
- package/dist/canvas/index.d.ts +5 -0
- package/dist/canvas/index.d.ts.map +1 -0
- package/dist/canvas/index.js +5 -0
- package/dist/canvas/index.js.map +1 -0
- package/dist/canvas/mockContext.d.ts +168 -0
- package/dist/canvas/mockContext.d.ts.map +1 -0
- package/dist/canvas/mockContext.js +198 -0
- package/dist/canvas/mockContext.js.map +1 -0
- package/dist/canvas/paintPrimitive.d.ts +35 -0
- package/dist/canvas/paintPrimitive.d.ts.map +1 -0
- package/dist/canvas/paintPrimitive.js +171 -0
- package/dist/canvas/paintPrimitive.js.map +1 -0
- package/dist/canvas/renderCtx.d.ts +40 -0
- package/dist/canvas/renderCtx.d.ts.map +1 -0
- package/dist/canvas/renderCtx.js +4 -0
- package/dist/canvas/renderCtx.js.map +1 -0
- package/dist/geometry/_lib/arrowhead.d.ts +18 -0
- package/dist/geometry/_lib/arrowhead.d.ts.map +1 -0
- package/dist/geometry/_lib/arrowhead.js +38 -0
- package/dist/geometry/_lib/arrowhead.js.map +1 -0
- package/dist/geometry/_lib/bezier.d.ts +57 -0
- package/dist/geometry/_lib/bezier.d.ts.map +1 -0
- package/dist/geometry/_lib/bezier.js +84 -0
- package/dist/geometry/_lib/bezier.js.map +1 -0
- package/dist/geometry/_lib/chevron.d.ts +29 -0
- package/dist/geometry/_lib/chevron.d.ts.map +1 -0
- package/dist/geometry/_lib/chevron.js +37 -0
- package/dist/geometry/_lib/chevron.js.map +1 -0
- package/dist/geometry/_lib/dash.d.ts +30 -0
- package/dist/geometry/_lib/dash.d.ts.map +1 -0
- package/dist/geometry/_lib/dash.js +40 -0
- package/dist/geometry/_lib/dash.js.map +1 -0
- package/dist/geometry/_lib/fibLevels.d.ts +36 -0
- package/dist/geometry/_lib/fibLevels.d.ts.map +1 -0
- package/dist/geometry/_lib/fibLevels.js +44 -0
- package/dist/geometry/_lib/fibLevels.js.map +1 -0
- package/dist/geometry/_lib/gannLevels.d.ts +54 -0
- package/dist/geometry/_lib/gannLevels.d.ts.map +1 -0
- package/dist/geometry/_lib/gannLevels.js +88 -0
- package/dist/geometry/_lib/gannLevels.js.map +1 -0
- package/dist/geometry/_lib/lineExtend.d.ts +31 -0
- package/dist/geometry/_lib/lineExtend.d.ts.map +1 -0
- package/dist/geometry/_lib/lineExtend.js +48 -0
- package/dist/geometry/_lib/lineExtend.js.map +1 -0
- package/dist/geometry/_lib/namedPolyline.d.ts +25 -0
- package/dist/geometry/_lib/namedPolyline.d.ts.map +1 -0
- package/dist/geometry/_lib/namedPolyline.js +64 -0
- package/dist/geometry/_lib/namedPolyline.js.map +1 -0
- package/dist/geometry/_lib/pitchforkGeom.d.ts +46 -0
- package/dist/geometry/_lib/pitchforkGeom.d.ts.map +1 -0
- package/dist/geometry/_lib/pitchforkGeom.js +70 -0
- package/dist/geometry/_lib/pitchforkGeom.js.map +1 -0
- package/dist/geometry/_lib/shapeStyle.d.ts +21 -0
- package/dist/geometry/_lib/shapeStyle.d.ts.map +1 -0
- package/dist/geometry/_lib/shapeStyle.js +41 -0
- package/dist/geometry/_lib/shapeStyle.js.map +1 -0
- package/dist/geometry/_lib/strokeStyle.d.ts +34 -0
- package/dist/geometry/_lib/strokeStyle.d.ts.map +1 -0
- package/dist/geometry/_lib/strokeStyle.js +26 -0
- package/dist/geometry/_lib/strokeStyle.js.map +1 -0
- package/dist/geometry/_lib/textStyle.d.ts +70 -0
- package/dist/geometry/_lib/textStyle.d.ts.map +1 -0
- package/dist/geometry/_lib/textStyle.js +78 -0
- package/dist/geometry/_lib/textStyle.js.map +1 -0
- package/dist/geometry/decompose.d.ts +28 -0
- package/dist/geometry/decompose.d.ts.map +1 -0
- package/dist/geometry/decompose.js +176 -0
- package/dist/geometry/decompose.js.map +1 -0
- package/dist/geometry/index.d.ts +4 -0
- package/dist/geometry/index.d.ts.map +1 -0
- package/dist/geometry/index.js +5 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/kinds/annotations.d.ts +77 -0
- package/dist/geometry/kinds/annotations.d.ts.map +1 -0
- package/dist/geometry/kinds/annotations.js +219 -0
- package/dist/geometry/kinds/annotations.js.map +1 -0
- package/dist/geometry/kinds/boxes.d.ts +116 -0
- package/dist/geometry/kinds/boxes.d.ts.map +1 -0
- package/dist/geometry/kinds/boxes.js +285 -0
- package/dist/geometry/kinds/boxes.js.map +1 -0
- package/dist/geometry/kinds/channels.d.ts +72 -0
- package/dist/geometry/kinds/channels.d.ts.map +1 -0
- package/dist/geometry/kinds/channels.js +148 -0
- package/dist/geometry/kinds/channels.js.map +1 -0
- package/dist/geometry/kinds/containers.d.ts +54 -0
- package/dist/geometry/kinds/containers.d.ts.map +1 -0
- package/dist/geometry/kinds/containers.js +268 -0
- package/dist/geometry/kinds/containers.js.map +1 -0
- package/dist/geometry/kinds/curves.d.ts +53 -0
- package/dist/geometry/kinds/curves.d.ts.map +1 -0
- package/dist/geometry/kinds/curves.js +110 -0
- package/dist/geometry/kinds/curves.js.map +1 -0
- package/dist/geometry/kinds/cycles.d.ts +52 -0
- package/dist/geometry/kinds/cycles.d.ts.map +1 -0
- package/dist/geometry/kinds/cycles.js +158 -0
- package/dist/geometry/kinds/cycles.js.map +1 -0
- package/dist/geometry/kinds/elliott.d.ts +73 -0
- package/dist/geometry/kinds/elliott.d.ts.map +1 -0
- package/dist/geometry/kinds/elliott.js +116 -0
- package/dist/geometry/kinds/elliott.js.map +1 -0
- package/dist/geometry/kinds/fibonacci.d.ts +166 -0
- package/dist/geometry/kinds/fibonacci.d.ts.map +1 -0
- package/dist/geometry/kinds/fibonacci.js +458 -0
- package/dist/geometry/kinds/fibonacci.js.map +1 -0
- package/dist/geometry/kinds/freehand.d.ts +53 -0
- package/dist/geometry/kinds/freehand.d.ts.map +1 -0
- package/dist/geometry/kinds/freehand.js +115 -0
- package/dist/geometry/kinds/freehand.js.map +1 -0
- package/dist/geometry/kinds/gann.d.ts +63 -0
- package/dist/geometry/kinds/gann.d.ts.map +1 -0
- package/dist/geometry/kinds/gann.js +153 -0
- package/dist/geometry/kinds/gann.js.map +1 -0
- package/dist/geometry/kinds/lines.d.ts +90 -0
- package/dist/geometry/kinds/lines.d.ts.map +1 -0
- package/dist/geometry/kinds/lines.js +201 -0
- package/dist/geometry/kinds/lines.js.map +1 -0
- package/dist/geometry/kinds/marker.d.ts +21 -0
- package/dist/geometry/kinds/marker.d.ts.map +1 -0
- package/dist/geometry/kinds/marker.js +47 -0
- package/dist/geometry/kinds/marker.js.map +1 -0
- package/dist/geometry/kinds/patterns.d.ts +85 -0
- package/dist/geometry/kinds/patterns.d.ts.map +1 -0
- package/dist/geometry/kinds/patterns.js +133 -0
- package/dist/geometry/kinds/patterns.js.map +1 -0
- package/dist/geometry/kinds/pitchforks.d.ts +36 -0
- package/dist/geometry/kinds/pitchforks.d.ts.map +1 -0
- package/dist/geometry/kinds/pitchforks.js +109 -0
- package/dist/geometry/kinds/pitchforks.js.map +1 -0
- package/dist/geometry/project.d.ts +50 -0
- package/dist/geometry/project.d.ts.map +1 -0
- package/dist/geometry/project.js +62 -0
- package/dist/geometry/project.js.map +1 -0
- package/dist/geometry/types.d.ts +146 -0
- package/dist/geometry/types.d.ts.map +1 -0
- package/dist/geometry/types.js +4 -0
- package/dist/geometry/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../../src/geometry/kinds/containers.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,wEAAwE;AACxE,YAAY;AACZ,sEAAsE;AACtE,kEAAkE;AAClE,iEAAiE;AACjE,+DAA+D;AA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AC;gBACtB,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC;aAC/B,CAAC,CAAC;YACH,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACrE,GAAG,CAAC,IAAI,CACJ,YAAY,CACR,CAAC,EACD,CAAC,EACD,KAAK,EACL,MAAM,EACN;oBACI,KAAK,EAAE,KAAK,CAAC,WAAW;oBACxB,KAAK,EAAE,KAAK,CAAC,WAAW;oBACxB,IAAI,EAAE,UAAU;iBACnB,EACD,SAAS,CACZ,CACJ,CAAC;YACN,CAAC;YACD,CAAC,IAAI,KAAK,CAAC;QACf,CAAC;QACD,CAAC,IAAI,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5B,GAAG,CAAC,IAAI,CACJ,YAAY,CACR,MAAM,CAAC,CAAC,EACR,MAAM,CAAC,CAAC,EACR,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,MAAM,EACb,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,EACxE,SAAS,CACZ,CACJ,CAAC;IACN,CAAC;IACD,OAAO,GAAG,CAAC;AACf,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// Container + table geometry moved from the canvas2d adapter's per-kind\n// renderers\n// examples/canvas2d-adapter/src/render/draw/{group,frame,table}.ts.\n// `group` / `frame` state shapes originate from invinite's collab\n// y-doc-bridge (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02,\n// © Invinite); the frame envelope + table layout are chartlang\n// additions. Re-licensed MIT for chartlang.\n\nimport type {\n FrameState,\n GroupState,\n TableCell,\n TablePosition,\n TableState,\n} from \"@invinite-org/chartlang-core\";\n\nimport { SOLID_DASH } from \"../_lib/dash.js\";\nimport { worldPointToPixel } from \"../project.js\";\nimport type { DrawPrimitive, FillStyle, StrokeStyle, Viewport } from \"../types.js\";\n\nconst FILL_OPAQUE = 1;\n\n// --- group ---------------------------------------------------------------\n\n/**\n * Decompose a `group` drawing — a no-op container. Groups are\n * metadata-only on the wire: `childHandleIds` reference drawings that\n * decompose through their own arms, and the `Viewport` exposes no\n * child-state side-channel, so a group emits nothing.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: GroupState;\n * declare const v: Viewport;\n * const prims = decomposeGroup(s, v);\n * // prims.length === 0\n * void prims;\n */\nexport function decomposeGroup(state: GroupState, view: Viewport): ReadonlyArray<DrawPrimitive> {\n void state;\n void view;\n return [];\n}\n\n// --- frame ---------------------------------------------------------------\n\nconst FRAME_STROKE = \"#64748b\";\nconst FRAME_LABEL_COLOR = \"#1e293b\";\nconst FRAME_LINE_WIDTH = 1;\nconst FRAME_LABEL_FONT = \"12px sans-serif\";\nconst FRAME_LABEL_INSET_X = 6;\nconst FRAME_LABEL_INSET_Y = 14;\n\n/**\n * Decompose a `frame` drawing — a stroked rectangle between the two\n * world anchors `[topLeft, bottomRight]`. An optional `style.bgColor`\n * adds a background `fill` (alpha 1) on the border polyline; an optional\n * `style.label` adds a `text` primitive at the top-left corner.\n * Degenerate anchors (zero width/height, or non-finite) emit `[]`.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: FrameState;\n * declare const v: Viewport;\n * const prims = decomposeFrame(s, v);\n * void prims;\n */\nexport function decomposeFrame(state: FrameState, view: Viewport): ReadonlyArray<DrawPrimitive> {\n const a = worldPointToPixel(state.anchors[0], view);\n const b = worldPointToPixel(state.anchors[1], view);\n const xMin = Math.min(a.x, b.x);\n const xMax = Math.max(a.x, b.x);\n const yMin = Math.min(a.y, b.y);\n const yMax = Math.max(a.y, b.y);\n const width = xMax - xMin;\n const height = yMax - yMin;\n if (width === 0 || height === 0) return [];\n if (!Number.isFinite(width) || !Number.isFinite(height)) return [];\n const fill: FillStyle | undefined =\n state.style.bgColor !== undefined\n ? { color: state.style.bgColor, alpha: FILL_OPAQUE }\n : undefined;\n const border: DrawPrimitive = {\n kind: \"polyline\",\n points: [\n { x: xMin, y: yMin },\n { x: xMax, y: yMin },\n { x: xMax, y: yMax },\n { x: xMin, y: yMax },\n ],\n closed: true,\n stroke: { color: FRAME_STROKE, width: FRAME_LINE_WIDTH, dash: SOLID_DASH },\n ...(fill !== undefined ? { fill } : {}),\n };\n const out: DrawPrimitive[] = [border];\n if (state.style.label !== undefined) {\n out.push({\n kind: \"text\",\n x: xMin + FRAME_LABEL_INSET_X,\n y: yMin + FRAME_LABEL_INSET_Y,\n text: state.style.label,\n color: FRAME_LABEL_COLOR,\n font: FRAME_LABEL_FONT,\n align: \"left\",\n baseline: \"bottom\",\n });\n }\n return out;\n}\n\n// --- table ---------------------------------------------------------------\n\nconst TABLE_VIEWPORT_PADDING_PX = 8;\nconst TABLE_CELL_PAD_X_PX = 6;\nconst TABLE_CELL_PAD_Y_PX = 4;\nconst TABLE_DEFAULT_TEXT_COLOR = \"#0f172a\";\nconst TABLE_DEFAULT_BG_COLOR = \"#ffffff\";\nconst TABLE_FONT_FAMILY = \"sans-serif\";\n\nconst TABLE_TEXT_SIZE_PX: Readonly<Record<NonNullable<TableCell[\"textSize\"]>, number>> = {\n tiny: 8,\n small: 10,\n normal: 12,\n large: 16,\n huge: 24,\n};\n\ntype TableLayout = {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly columnWidths: ReadonlyArray<number>;\n readonly rowHeights: ReadonlyArray<number>;\n};\n\nfunction tableTextSizePx(cell: TableCell): number {\n return TABLE_TEXT_SIZE_PX[cell.textSize ?? \"normal\"];\n}\n\nfunction estimateTextWidth(text: string, fontPx: number): number {\n return text.length * fontPx * 0.6;\n}\n\nfunction columnCount(rows: ReadonlyArray<ReadonlyArray<TableCell>>): number {\n let count = 0;\n for (const row of rows) {\n if (row.length > count) count = row.length;\n }\n return count;\n}\n\nfunction resolveTableX(position: TablePosition, tableWidth: number, view: Viewport): number {\n if (position.endsWith(\"-center\")) return view.pxWidth / 2 - tableWidth / 2;\n if (position.endsWith(\"-right\")) return view.pxWidth - tableWidth - TABLE_VIEWPORT_PADDING_PX;\n return TABLE_VIEWPORT_PADDING_PX;\n}\n\nfunction resolveTableY(position: TablePosition, tableHeight: number, view: Viewport): number {\n if (position.startsWith(\"middle-\")) return view.pxHeight / 2 - tableHeight / 2;\n if (position.startsWith(\"bottom-\"))\n return view.pxHeight - tableHeight - TABLE_VIEWPORT_PADDING_PX;\n return TABLE_VIEWPORT_PADDING_PX;\n}\n\nfunction layoutTable(state: TableState, view: Viewport): TableLayout {\n const columns = columnCount(state.cells);\n const columnWidths = Array.from({ length: columns }, () => 0);\n const rowHeights = state.cells.map((row) => {\n let maxFont = TABLE_TEXT_SIZE_PX.normal;\n for (let column = 0; column < row.length; column++) {\n const cell = row[column];\n const fontPx = tableTextSizePx(cell);\n if (fontPx > maxFont) maxFont = fontPx;\n const width = estimateTextWidth(cell.text, fontPx) + TABLE_CELL_PAD_X_PX * 2;\n if (width > columnWidths[column]) columnWidths[column] = width;\n }\n return maxFont + TABLE_CELL_PAD_Y_PX * 2;\n });\n const width = columnWidths.reduce((sum, widthPx) => sum + widthPx, 0);\n const height = rowHeights.reduce((sum, heightPx) => sum + heightPx, 0);\n return {\n x: resolveTableX(state.position, width, view),\n y: resolveTableY(state.position, height, view),\n width,\n height,\n columnWidths,\n rowHeights,\n };\n}\n\nfunction rectPolyline(\n x: number,\n y: number,\n width: number,\n height: number,\n stroke: StrokeStyle | undefined,\n fill: FillStyle | undefined,\n): DrawPrimitive {\n return {\n kind: \"polyline\",\n points: [\n { x, y },\n { x: x + width, y },\n { x: x + width, y: y + height },\n { x, y: y + height },\n ],\n closed: true,\n ...(stroke !== undefined ? { stroke } : {}),\n ...(fill !== undefined ? { fill } : {}),\n };\n}\n\nfunction cellTextX(cell: TableCell, x: number, width: number): number {\n switch (cell.textHalign ?? \"left\") {\n case \"center\":\n return x + width / 2;\n case \"right\":\n return x + width - TABLE_CELL_PAD_X_PX;\n case \"left\":\n return x + TABLE_CELL_PAD_X_PX;\n }\n}\n\nfunction cellTextY(cell: TableCell, y: number, height: number): number {\n switch (cell.textValign ?? \"middle\") {\n case \"top\":\n return y + TABLE_CELL_PAD_Y_PX;\n case \"bottom\":\n return y + height - TABLE_CELL_PAD_Y_PX;\n case \"middle\":\n return y + height / 2;\n }\n}\n\nfunction cellAlign(cell: TableCell): \"left\" | \"center\" | \"right\" {\n return cell.textHalign ?? \"left\";\n}\n\nfunction cellBaseline(cell: TableCell): \"top\" | \"middle\" | \"bottom\" {\n return cell.textValign ?? \"middle\";\n}\n\n/**\n * Decompose a `draw.table` emission as a CSS-pixel viewport overlay.\n * Unlike every other kind, `table` ignores world-coordinate transforms:\n * `state.position` resolves directly against `Viewport.pxWidth` /\n * `Viewport.pxHeight`. Each cell emits a background-fill polyline + a\n * `text` primitive (+ an optional per-cell border polyline when both\n * `borderColor` and `borderWidth` are set); an optional outer `frame`\n * polyline wraps the whole grid. Zero rows/columns yields a degenerate\n * (possibly empty) grid without throwing.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: TableState;\n * declare const v: Viewport;\n * const prims = decomposeTable(s, v);\n * void prims;\n */\nexport function decomposeTable(state: TableState, view: Viewport): ReadonlyArray<DrawPrimitive> {\n const layout = layoutTable(state, view);\n const out: DrawPrimitive[] = [];\n let y = layout.y;\n for (let rowIndex = 0; rowIndex < state.cells.length; rowIndex++) {\n const row = state.cells[rowIndex];\n const height = layout.rowHeights[rowIndex];\n let x = layout.x;\n for (let columnIndex = 0; columnIndex < layout.columnWidths.length; columnIndex++) {\n const width = layout.columnWidths[columnIndex];\n const cell = row[columnIndex] ?? { text: \"\" };\n out.push(\n rectPolyline(x, y, width, height, undefined, {\n color: cell.bgColor ?? TABLE_DEFAULT_BG_COLOR,\n alpha: FILL_OPAQUE,\n }),\n );\n out.push({\n kind: \"text\",\n x: cellTextX(cell, x, width),\n y: cellTextY(cell, y, height),\n text: cell.text,\n color: cell.textColor ?? TABLE_DEFAULT_TEXT_COLOR,\n font: `${tableTextSizePx(cell)}px ${TABLE_FONT_FAMILY}`,\n align: cellAlign(cell),\n baseline: cellBaseline(cell),\n });\n if (state.borderColor !== undefined && state.borderWidth !== undefined) {\n out.push(\n rectPolyline(\n x,\n y,\n width,\n height,\n {\n color: state.borderColor,\n width: state.borderWidth,\n dash: SOLID_DASH,\n },\n undefined,\n ),\n );\n }\n x += width;\n }\n y += height;\n }\n if (state.frame !== undefined) {\n out.push(\n rectPolyline(\n layout.x,\n layout.y,\n layout.width,\n layout.height,\n { color: state.frame.color, width: state.frame.width, dash: SOLID_DASH },\n undefined,\n ),\n );\n }\n return out;\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ArcState, CurveState, DoubleCurveState } from "@invinite-org/chartlang-core";
|
|
2
|
+
import type { DrawPrimitive, Viewport } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Decompose an `arc` drawing — a quadratic Bezier whose middle anchor
|
|
5
|
+
* (the apex) lies ON the curve at `t = 0.5`. The off-curve control point
|
|
6
|
+
* is derived by inverse-quadratic interpolation
|
|
7
|
+
* (`2·apex − 0.5·(from + to)`) so the sampled curve passes through the
|
|
8
|
+
* apex, then sampled into one open {@link CURVE_SAMPLES}-segment
|
|
9
|
+
* polyline.
|
|
10
|
+
*
|
|
11
|
+
* @since 1.3
|
|
12
|
+
* @stable
|
|
13
|
+
* @example
|
|
14
|
+
* declare const s: ArcState;
|
|
15
|
+
* declare const v: Viewport;
|
|
16
|
+
* const prims = decomposeArc(s, v);
|
|
17
|
+
* // prims[0].kind === "polyline"; prims[0].closed === false
|
|
18
|
+
* void prims;
|
|
19
|
+
*/
|
|
20
|
+
export declare function decomposeArc(state: ArcState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
21
|
+
/**
|
|
22
|
+
* Decompose a `curve` drawing — a quadratic Bezier whose middle anchor
|
|
23
|
+
* IS the off-curve control point (distinct from `arc`, whose apex lies
|
|
24
|
+
* on the curve). Sampled into one open {@link CURVE_SAMPLES}-segment
|
|
25
|
+
* polyline.
|
|
26
|
+
*
|
|
27
|
+
* @since 1.3
|
|
28
|
+
* @stable
|
|
29
|
+
* @example
|
|
30
|
+
* declare const s: CurveState;
|
|
31
|
+
* declare const v: Viewport;
|
|
32
|
+
* const prims = decomposeCurve(s, v);
|
|
33
|
+
* void prims;
|
|
34
|
+
*/
|
|
35
|
+
export declare function decomposeCurve(state: CurveState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
36
|
+
/**
|
|
37
|
+
* Decompose a `double-curve` drawing — a single cubic Bezier from
|
|
38
|
+
* `anchors[0]` to `anchors[4]` with off-curve controls `anchors[1]` and
|
|
39
|
+
* `anchors[3]`. The middle stitch anchor `anchors[2]` is preserved in
|
|
40
|
+
* state but unused by the current single-cubic render path (matching the
|
|
41
|
+
* canvas2d source). Sampled into one open {@link CURVE_SAMPLES}-segment
|
|
42
|
+
* polyline.
|
|
43
|
+
*
|
|
44
|
+
* @since 1.3
|
|
45
|
+
* @stable
|
|
46
|
+
* @example
|
|
47
|
+
* declare const s: DoubleCurveState;
|
|
48
|
+
* declare const v: Viewport;
|
|
49
|
+
* const prims = decomposeDoubleCurve(s, v);
|
|
50
|
+
* void prims;
|
|
51
|
+
*/
|
|
52
|
+
export declare function decomposeDoubleCurve(state: DoubleCurveState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
53
|
+
//# sourceMappingURL=curves.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curves.d.ts","sourceRoot":"","sources":["../../../src/geometry/kinds/curves.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAK3F,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAU3D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,CAgB1F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,CAY9F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAChC,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAa9B"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
//
|
|
4
|
+
// Curve geometry moved from the canvas2d adapter's per-kind renderers
|
|
5
|
+
// examples/canvas2d-adapter/src/render/draw/{arc,curve,doubleCurve}.ts.
|
|
6
|
+
// The originating math is invinite's arc / curve / double-curve tools
|
|
7
|
+
// (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02, © Invinite);
|
|
8
|
+
// re-licensed MIT for chartlang.
|
|
9
|
+
import { sampleCubic, sampleQuadratic } from "../_lib/bezier.js";
|
|
10
|
+
import { strokeOf } from "../_lib/strokeStyle.js";
|
|
11
|
+
import { worldPointToPixel } from "../project.js";
|
|
12
|
+
/**
|
|
13
|
+
* Number of polyline segments each curve is sampled into — matching the
|
|
14
|
+
* canvas2d source renderers exactly (the structural `RenderCtx` exposes
|
|
15
|
+
* no `quadraticCurveTo` / `bezierCurveTo`, so every curve is stroked as
|
|
16
|
+
* a sampled polyline).
|
|
17
|
+
*/
|
|
18
|
+
const CURVE_SAMPLES = 32;
|
|
19
|
+
/**
|
|
20
|
+
* Decompose an `arc` drawing — a quadratic Bezier whose middle anchor
|
|
21
|
+
* (the apex) lies ON the curve at `t = 0.5`. The off-curve control point
|
|
22
|
+
* is derived by inverse-quadratic interpolation
|
|
23
|
+
* (`2·apex − 0.5·(from + to)`) so the sampled curve passes through the
|
|
24
|
+
* apex, then sampled into one open {@link CURVE_SAMPLES}-segment
|
|
25
|
+
* polyline.
|
|
26
|
+
*
|
|
27
|
+
* @since 1.3
|
|
28
|
+
* @stable
|
|
29
|
+
* @example
|
|
30
|
+
* declare const s: ArcState;
|
|
31
|
+
* declare const v: Viewport;
|
|
32
|
+
* const prims = decomposeArc(s, v);
|
|
33
|
+
* // prims[0].kind === "polyline"; prims[0].closed === false
|
|
34
|
+
* void prims;
|
|
35
|
+
*/
|
|
36
|
+
export function decomposeArc(state, view) {
|
|
37
|
+
const from = worldPointToPixel(state.anchors[0], view);
|
|
38
|
+
const apex = worldPointToPixel(state.anchors[1], view);
|
|
39
|
+
const to = worldPointToPixel(state.anchors[2], view);
|
|
40
|
+
const control = {
|
|
41
|
+
x: 2 * apex.x - 0.5 * (from.x + to.x),
|
|
42
|
+
y: 2 * apex.y - 0.5 * (from.y + to.y),
|
|
43
|
+
};
|
|
44
|
+
return [
|
|
45
|
+
{
|
|
46
|
+
kind: "polyline",
|
|
47
|
+
points: sampleQuadratic(from, control, to, CURVE_SAMPLES),
|
|
48
|
+
closed: false,
|
|
49
|
+
stroke: strokeOf(state.style),
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Decompose a `curve` drawing — a quadratic Bezier whose middle anchor
|
|
55
|
+
* IS the off-curve control point (distinct from `arc`, whose apex lies
|
|
56
|
+
* on the curve). Sampled into one open {@link CURVE_SAMPLES}-segment
|
|
57
|
+
* polyline.
|
|
58
|
+
*
|
|
59
|
+
* @since 1.3
|
|
60
|
+
* @stable
|
|
61
|
+
* @example
|
|
62
|
+
* declare const s: CurveState;
|
|
63
|
+
* declare const v: Viewport;
|
|
64
|
+
* const prims = decomposeCurve(s, v);
|
|
65
|
+
* void prims;
|
|
66
|
+
*/
|
|
67
|
+
export function decomposeCurve(state, view) {
|
|
68
|
+
const from = worldPointToPixel(state.anchors[0], view);
|
|
69
|
+
const control = worldPointToPixel(state.anchors[1], view);
|
|
70
|
+
const to = worldPointToPixel(state.anchors[2], view);
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
kind: "polyline",
|
|
74
|
+
points: sampleQuadratic(from, control, to, CURVE_SAMPLES),
|
|
75
|
+
closed: false,
|
|
76
|
+
stroke: strokeOf(state.style),
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Decompose a `double-curve` drawing — a single cubic Bezier from
|
|
82
|
+
* `anchors[0]` to `anchors[4]` with off-curve controls `anchors[1]` and
|
|
83
|
+
* `anchors[3]`. The middle stitch anchor `anchors[2]` is preserved in
|
|
84
|
+
* state but unused by the current single-cubic render path (matching the
|
|
85
|
+
* canvas2d source). Sampled into one open {@link CURVE_SAMPLES}-segment
|
|
86
|
+
* polyline.
|
|
87
|
+
*
|
|
88
|
+
* @since 1.3
|
|
89
|
+
* @stable
|
|
90
|
+
* @example
|
|
91
|
+
* declare const s: DoubleCurveState;
|
|
92
|
+
* declare const v: Viewport;
|
|
93
|
+
* const prims = decomposeDoubleCurve(s, v);
|
|
94
|
+
* void prims;
|
|
95
|
+
*/
|
|
96
|
+
export function decomposeDoubleCurve(state, view) {
|
|
97
|
+
const p0 = worldPointToPixel(state.anchors[0], view);
|
|
98
|
+
const p1 = worldPointToPixel(state.anchors[1], view);
|
|
99
|
+
const p3 = worldPointToPixel(state.anchors[3], view);
|
|
100
|
+
const p4 = worldPointToPixel(state.anchors[4], view);
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
kind: "polyline",
|
|
104
|
+
points: sampleCubic(p0, p1, p3, p4, CURVE_SAMPLES),
|
|
105
|
+
closed: false,
|
|
106
|
+
stroke: strokeOf(state.style),
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=curves.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curves.js","sourceRoot":"","sources":["../../../src/geometry/kinds/curves.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,sEAAsE;AACtE,0EAA0E;AAC1E,sEAAsE;AACtE,iEAAiE;AACjE,iCAAiC;AAIjC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD;;;;;GAKG;AACH,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,KAAe,EAAE,IAAc;IACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG;QACZ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;KACxC,CAAC;IACF,OAAO;QACH;YACI,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,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I,EAAE,UAAU;YAChB,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,CAAC;YAClD,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;SAChC;KACJ,CAAC;AACN,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// Curve geometry moved from the canvas2d adapter's per-kind renderers\n// examples/canvas2d-adapter/src/render/draw/{arc,curve,doubleCurve}.ts.\n// The originating math is invinite's arc / curve / double-curve tools\n// (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02, © Invinite);\n// re-licensed MIT for chartlang.\n\nimport type { ArcState, CurveState, DoubleCurveState } from \"@invinite-org/chartlang-core\";\n\nimport { sampleCubic, sampleQuadratic } from \"../_lib/bezier.js\";\nimport { strokeOf } from \"../_lib/strokeStyle.js\";\nimport { worldPointToPixel } from \"../project.js\";\nimport type { DrawPrimitive, Viewport } from \"../types.js\";\n\n/**\n * Number of polyline segments each curve is sampled into — matching the\n * canvas2d source renderers exactly (the structural `RenderCtx` exposes\n * no `quadraticCurveTo` / `bezierCurveTo`, so every curve is stroked as\n * a sampled polyline).\n */\nconst CURVE_SAMPLES = 32;\n\n/**\n * Decompose an `arc` drawing — a quadratic Bezier whose middle anchor\n * (the apex) lies ON the curve at `t = 0.5`. The off-curve control point\n * is derived by inverse-quadratic interpolation\n * (`2·apex − 0.5·(from + to)`) so the sampled curve passes through the\n * apex, then sampled into one open {@link CURVE_SAMPLES}-segment\n * polyline.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: ArcState;\n * declare const v: Viewport;\n * const prims = decomposeArc(s, v);\n * // prims[0].kind === \"polyline\"; prims[0].closed === false\n * void prims;\n */\nexport function decomposeArc(state: ArcState, view: Viewport): ReadonlyArray<DrawPrimitive> {\n const from = worldPointToPixel(state.anchors[0], view);\n const apex = worldPointToPixel(state.anchors[1], view);\n const to = worldPointToPixel(state.anchors[2], view);\n const control = {\n x: 2 * apex.x - 0.5 * (from.x + to.x),\n y: 2 * apex.y - 0.5 * (from.y + to.y),\n };\n return [\n {\n kind: \"polyline\",\n points: sampleQuadratic(from, control, to, CURVE_SAMPLES),\n closed: false,\n stroke: strokeOf(state.style),\n },\n ];\n}\n\n/**\n * Decompose a `curve` drawing — a quadratic Bezier whose middle anchor\n * IS the off-curve control point (distinct from `arc`, whose apex lies\n * on the curve). Sampled into one open {@link CURVE_SAMPLES}-segment\n * polyline.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: CurveState;\n * declare const v: Viewport;\n * const prims = decomposeCurve(s, v);\n * void prims;\n */\nexport function decomposeCurve(state: CurveState, view: Viewport): ReadonlyArray<DrawPrimitive> {\n const from = worldPointToPixel(state.anchors[0], view);\n const control = worldPointToPixel(state.anchors[1], view);\n const to = worldPointToPixel(state.anchors[2], view);\n return [\n {\n kind: \"polyline\",\n points: sampleQuadratic(from, control, to, CURVE_SAMPLES),\n closed: false,\n stroke: strokeOf(state.style),\n },\n ];\n}\n\n/**\n * Decompose a `double-curve` drawing — a single cubic Bezier from\n * `anchors[0]` to `anchors[4]` with off-curve controls `anchors[1]` and\n * `anchors[3]`. The middle stitch anchor `anchors[2]` is preserved in\n * state but unused by the current single-cubic render path (matching the\n * canvas2d source). Sampled into one open {@link CURVE_SAMPLES}-segment\n * polyline.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: DoubleCurveState;\n * declare const v: Viewport;\n * const prims = decomposeDoubleCurve(s, v);\n * void prims;\n */\nexport function decomposeDoubleCurve(\n state: DoubleCurveState,\n view: Viewport,\n): ReadonlyArray<DrawPrimitive> {\n const p0 = worldPointToPixel(state.anchors[0], view);\n const p1 = worldPointToPixel(state.anchors[1], view);\n const p3 = worldPointToPixel(state.anchors[3], view);\n const p4 = worldPointToPixel(state.anchors[4], view);\n return [\n {\n kind: \"polyline\",\n points: sampleCubic(p0, p1, p3, p4, CURVE_SAMPLES),\n closed: false,\n stroke: strokeOf(state.style),\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CyclicLinesState, SineLineState, TimeCyclesState } from "@invinite-org/chartlang-core";
|
|
2
|
+
import type { DrawPrimitive, Viewport } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Decompose a `cyclic-lines` drawing — repeated full-height vertical
|
|
5
|
+
* lines spaced at `periodPx = |toX − fromX|` to the right of the `from`
|
|
6
|
+
* anchor. Returns `[]` when the period is non-positive or non-finite;
|
|
7
|
+
* caps at 256 repeats, breaking past the right edge and skipping strokes
|
|
8
|
+
* left of the viewport (matching the source).
|
|
9
|
+
*
|
|
10
|
+
* @since 1.3
|
|
11
|
+
* @stable
|
|
12
|
+
* @example
|
|
13
|
+
* declare const s: CyclicLinesState;
|
|
14
|
+
* declare const v: Viewport;
|
|
15
|
+
* const prims = decomposeCyclicLines(s, v);
|
|
16
|
+
* void prims;
|
|
17
|
+
*/
|
|
18
|
+
export declare function decomposeCyclicLines(state: CyclicLinesState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
19
|
+
/**
|
|
20
|
+
* Decompose a `time-cycles` drawing — concentric upper-half arcs centred
|
|
21
|
+
* at the midpoint of `(from, to)` on the `from.price` baseline, radius
|
|
22
|
+
* `|toX − fromX| / 2`, tiled across the viewport at multiples of the
|
|
23
|
+
* diameter. Returns `[]` when the diameter is non-positive or non-finite.
|
|
24
|
+
* Each arc spans `[π, 2π]` (upper half).
|
|
25
|
+
*
|
|
26
|
+
* @since 1.3
|
|
27
|
+
* @stable
|
|
28
|
+
* @example
|
|
29
|
+
* declare const s: TimeCyclesState;
|
|
30
|
+
* declare const v: Viewport;
|
|
31
|
+
* const prims = decomposeTimeCycles(s, v);
|
|
32
|
+
* void prims;
|
|
33
|
+
*/
|
|
34
|
+
export declare function decomposeTimeCycles(state: TimeCyclesState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
35
|
+
/**
|
|
36
|
+
* Decompose a `sine-line` drawing — one sampled sinusoidal polyline. The
|
|
37
|
+
* half-period is `|toX − fromX|`; baseline is the midpoint of
|
|
38
|
+
* `(fromY, toY)`; amplitude is half the y-distance between anchors. The
|
|
39
|
+
* wave starts at the extreme nearest `from` (sign `peakAtFrom`), sampled
|
|
40
|
+
* 32 points per full period across the padded viewport. Returns `[]`
|
|
41
|
+
* when the half-period is non-positive or non-finite.
|
|
42
|
+
*
|
|
43
|
+
* @since 1.3
|
|
44
|
+
* @stable
|
|
45
|
+
* @example
|
|
46
|
+
* declare const s: SineLineState;
|
|
47
|
+
* declare const v: Viewport;
|
|
48
|
+
* const prims = decomposeSineLine(s, v);
|
|
49
|
+
* void prims;
|
|
50
|
+
*/
|
|
51
|
+
export declare function decomposeSineLine(state: SineLineState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
52
|
+
//# sourceMappingURL=cycles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cycles.d.ts","sourceRoot":"","sources":["../../../src/geometry/kinds/cycles.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACR,gBAAgB,EAChB,aAAa,EACb,eAAe,EAClB,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ3D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAChC,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAsB9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAwC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAyB9B"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
//
|
|
4
|
+
// Cycle geometry moved from the canvas2d adapter's per-kind renderers
|
|
5
|
+
// examples/canvas2d-adapter/src/render/draw/{cyclicLines,timeCycles,
|
|
6
|
+
// sineLine}.ts.
|
|
7
|
+
// The originating math is invinite's cyclic-lines / time-cycles /
|
|
8
|
+
// sine-line tools (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02,
|
|
9
|
+
// © Invinite); re-licensed MIT for chartlang.
|
|
10
|
+
import { strokeOf } from "../_lib/strokeStyle.js";
|
|
11
|
+
import { worldPointToPixel } from "../project.js";
|
|
12
|
+
const DEFAULT_COLOR = "#0ea5e9";
|
|
13
|
+
const CYCLIC_MAX_REPEATS = 256;
|
|
14
|
+
const TIME_CYCLES_MAX_REPEATS_PER_SIDE = 64;
|
|
15
|
+
const SINE_SAMPLES_PER_PERIOD = 32;
|
|
16
|
+
const VIEWPORT_PAD_PX = 16;
|
|
17
|
+
/**
|
|
18
|
+
* Decompose a `cyclic-lines` drawing — repeated full-height vertical
|
|
19
|
+
* lines spaced at `periodPx = |toX − fromX|` to the right of the `from`
|
|
20
|
+
* anchor. Returns `[]` when the period is non-positive or non-finite;
|
|
21
|
+
* caps at 256 repeats, breaking past the right edge and skipping strokes
|
|
22
|
+
* left of the viewport (matching the source).
|
|
23
|
+
*
|
|
24
|
+
* @since 1.3
|
|
25
|
+
* @stable
|
|
26
|
+
* @example
|
|
27
|
+
* declare const s: CyclicLinesState;
|
|
28
|
+
* declare const v: Viewport;
|
|
29
|
+
* const prims = decomposeCyclicLines(s, v);
|
|
30
|
+
* void prims;
|
|
31
|
+
*/
|
|
32
|
+
export function decomposeCyclicLines(state, view) {
|
|
33
|
+
const fromPx = worldPointToPixel(state.anchors[0], view);
|
|
34
|
+
const toPx = worldPointToPixel(state.anchors[1], view);
|
|
35
|
+
const periodPx = Math.abs(toPx.x - fromPx.x);
|
|
36
|
+
if (!Number.isFinite(periodPx) || periodPx <= 0)
|
|
37
|
+
return [];
|
|
38
|
+
const stroke = strokeOf(state.style, DEFAULT_COLOR);
|
|
39
|
+
const out = [];
|
|
40
|
+
for (let k = 0; k < CYCLIC_MAX_REPEATS; k++) {
|
|
41
|
+
const x = fromPx.x + k * periodPx;
|
|
42
|
+
if (x > view.pxWidth + 16)
|
|
43
|
+
break;
|
|
44
|
+
if (x < -16)
|
|
45
|
+
continue;
|
|
46
|
+
out.push({
|
|
47
|
+
kind: "polyline",
|
|
48
|
+
points: [
|
|
49
|
+
{ x, y: 0 },
|
|
50
|
+
{ x, y: view.pxHeight },
|
|
51
|
+
],
|
|
52
|
+
closed: false,
|
|
53
|
+
stroke,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Decompose a `time-cycles` drawing — concentric upper-half arcs centred
|
|
60
|
+
* at the midpoint of `(from, to)` on the `from.price` baseline, radius
|
|
61
|
+
* `|toX − fromX| / 2`, tiled across the viewport at multiples of the
|
|
62
|
+
* diameter. Returns `[]` when the diameter is non-positive or non-finite.
|
|
63
|
+
* Each arc spans `[π, 2π]` (upper half).
|
|
64
|
+
*
|
|
65
|
+
* @since 1.3
|
|
66
|
+
* @stable
|
|
67
|
+
* @example
|
|
68
|
+
* declare const s: TimeCyclesState;
|
|
69
|
+
* declare const v: Viewport;
|
|
70
|
+
* const prims = decomposeTimeCycles(s, v);
|
|
71
|
+
* void prims;
|
|
72
|
+
*/
|
|
73
|
+
export function decomposeTimeCycles(state, view) {
|
|
74
|
+
const fromPx = worldPointToPixel(state.anchors[0], view);
|
|
75
|
+
const toPx = worldPointToPixel(state.anchors[1], view);
|
|
76
|
+
const diameter = Math.abs(toPx.x - fromPx.x);
|
|
77
|
+
if (!Number.isFinite(diameter) || diameter <= 0)
|
|
78
|
+
return [];
|
|
79
|
+
const radius = diameter / 2;
|
|
80
|
+
const baselineY = fromPx.y;
|
|
81
|
+
const primaryCx = (fromPx.x + toPx.x) / 2;
|
|
82
|
+
const stroke = strokeOf(state.style, DEFAULT_COLOR);
|
|
83
|
+
const out = [];
|
|
84
|
+
const pushArc = (cx) => {
|
|
85
|
+
out.push({
|
|
86
|
+
kind: "arc",
|
|
87
|
+
cx,
|
|
88
|
+
cy: baselineY,
|
|
89
|
+
r: radius,
|
|
90
|
+
start: Math.PI,
|
|
91
|
+
end: 2 * Math.PI,
|
|
92
|
+
closed: false,
|
|
93
|
+
stroke,
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
pushArc(primaryCx);
|
|
97
|
+
for (let k = 1; k < TIME_CYCLES_MAX_REPEATS_PER_SIDE; k++) {
|
|
98
|
+
const cx = primaryCx + k * diameter;
|
|
99
|
+
if (cx - radius > view.pxWidth + 16) {
|
|
100
|
+
pushArc(cx);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
pushArc(cx);
|
|
104
|
+
}
|
|
105
|
+
for (let k = 1; k < TIME_CYCLES_MAX_REPEATS_PER_SIDE; k++) {
|
|
106
|
+
const cx = primaryCx - k * diameter;
|
|
107
|
+
if (cx + radius < -16) {
|
|
108
|
+
pushArc(cx);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
pushArc(cx);
|
|
112
|
+
}
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Decompose a `sine-line` drawing — one sampled sinusoidal polyline. The
|
|
117
|
+
* half-period is `|toX − fromX|`; baseline is the midpoint of
|
|
118
|
+
* `(fromY, toY)`; amplitude is half the y-distance between anchors. The
|
|
119
|
+
* wave starts at the extreme nearest `from` (sign `peakAtFrom`), sampled
|
|
120
|
+
* 32 points per full period across the padded viewport. Returns `[]`
|
|
121
|
+
* when the half-period is non-positive or non-finite.
|
|
122
|
+
*
|
|
123
|
+
* @since 1.3
|
|
124
|
+
* @stable
|
|
125
|
+
* @example
|
|
126
|
+
* declare const s: SineLineState;
|
|
127
|
+
* declare const v: Viewport;
|
|
128
|
+
* const prims = decomposeSineLine(s, v);
|
|
129
|
+
* void prims;
|
|
130
|
+
*/
|
|
131
|
+
export function decomposeSineLine(state, view) {
|
|
132
|
+
const fromPx = worldPointToPixel(state.anchors[0], view);
|
|
133
|
+
const toPx = worldPointToPixel(state.anchors[1], view);
|
|
134
|
+
const halfPeriodPx = Math.abs(toPx.x - fromPx.x);
|
|
135
|
+
if (!Number.isFinite(halfPeriodPx) || halfPeriodPx <= 0)
|
|
136
|
+
return [];
|
|
137
|
+
const fullPeriodPx = 2 * halfPeriodPx;
|
|
138
|
+
const baselineY = (fromPx.y + toPx.y) / 2;
|
|
139
|
+
const amplitudePx = Math.abs(fromPx.y - toPx.y) / 2;
|
|
140
|
+
const peakAtFrom = fromPx.y < toPx.y ? 1 : -1;
|
|
141
|
+
const sampleY = (x) => {
|
|
142
|
+
const phase = (2 * Math.PI * (x - fromPx.x)) / fullPeriodPx;
|
|
143
|
+
return baselineY - peakAtFrom * amplitudePx * Math.cos(phase);
|
|
144
|
+
};
|
|
145
|
+
const xMin = -VIEWPORT_PAD_PX;
|
|
146
|
+
const xMax = view.pxWidth + VIEWPORT_PAD_PX;
|
|
147
|
+
const stepPx = fullPeriodPx / SINE_SAMPLES_PER_PERIOD;
|
|
148
|
+
const sampleCount = Math.max(2, Math.ceil((xMax - xMin) / stepPx) + 1);
|
|
149
|
+
const points = [{ x: xMin, y: sampleY(xMin) }];
|
|
150
|
+
for (let i = 1; i < sampleCount; i++) {
|
|
151
|
+
const x = xMin + i * stepPx;
|
|
152
|
+
points.push({ x, y: sampleY(x) });
|
|
153
|
+
}
|
|
154
|
+
return [
|
|
155
|
+
{ kind: "polyline", points, closed: false, stroke: strokeOf(state.style, DEFAULT_COLOR) },
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
//# s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EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,OAAO;QACH,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE;KAC5F,CAAC;AACN,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// Cycle geometry moved from the canvas2d adapter's per-kind renderers\n// examples/canvas2d-adapter/src/render/draw/{cyclicLines,timeCycles,\n// sineLine}.ts.\n// The originating math is invinite's cyclic-lines / time-cycles /\n// sine-line tools (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02,\n// © Invinite); re-licensed MIT for chartlang.\n\nimport type {\n CyclicLinesState,\n SineLineState,\n TimeCyclesState,\n} from \"@invinite-org/chartlang-core\";\n\nimport { strokeOf } from \"../_lib/strokeStyle.js\";\nimport { worldPointToPixel } from \"../project.js\";\nimport type { DrawPrimitive, Viewport } from \"../types.js\";\n\nconst DEFAULT_COLOR = \"#0ea5e9\";\nconst CYCLIC_MAX_REPEATS = 256;\nconst TIME_CYCLES_MAX_REPEATS_PER_SIDE = 64;\nconst SINE_SAMPLES_PER_PERIOD = 32;\nconst VIEWPORT_PAD_PX = 16;\n\n/**\n * Decompose a `cyclic-lines` drawing — repeated full-height vertical\n * lines spaced at `periodPx = |toX − fromX|` to the right of the `from`\n * anchor. Returns `[]` when the period is non-positive or non-finite;\n * caps at 256 repeats, breaking past the right edge and skipping strokes\n * left of the viewport (matching the source).\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: CyclicLinesState;\n * declare const v: Viewport;\n * const prims = decomposeCyclicLines(s, v);\n * void prims;\n */\nexport function decomposeCyclicLines(\n state: CyclicLinesState,\n view: Viewport,\n): ReadonlyArray<DrawPrimitive> {\n const fromPx = worldPointToPixel(state.anchors[0], view);\n const toPx = worldPointToPixel(state.anchors[1], view);\n const periodPx = Math.abs(toPx.x - fromPx.x);\n if (!Number.isFinite(periodPx) || periodPx <= 0) return [];\n const stroke = strokeOf(state.style, DEFAULT_COLOR);\n const out: DrawPrimitive[] = [];\n for (let k = 0; k < CYCLIC_MAX_REPEATS; k++) {\n const x = fromPx.x + k * periodPx;\n if (x > view.pxWidth + 16) break;\n if (x < -16) continue;\n out.push({\n kind: \"polyline\",\n points: [\n { x, y: 0 },\n { x, y: view.pxHeight },\n ],\n closed: false,\n stroke,\n });\n }\n return out;\n}\n\n/**\n * Decompose a `time-cycles` drawing — concentric upper-half arcs centred\n * at the midpoint of `(from, to)` on the `from.price` baseline, radius\n * `|toX − fromX| / 2`, tiled across the viewport at multiples of the\n * diameter. Returns `[]` when the diameter is non-positive or non-finite.\n * Each arc spans `[π, 2π]` (upper half).\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: TimeCyclesState;\n * declare const v: Viewport;\n * const prims = decomposeTimeCycles(s, v);\n * void prims;\n */\nexport function decomposeTimeCycles(\n state: TimeCyclesState,\n view: Viewport,\n): ReadonlyArray<DrawPrimitive> {\n const fromPx = worldPointToPixel(state.anchors[0], view);\n const toPx = worldPointToPixel(state.anchors[1], view);\n const diameter = Math.abs(toPx.x - fromPx.x);\n if (!Number.isFinite(diameter) || diameter <= 0) return [];\n const radius = diameter / 2;\n const baselineY = fromPx.y;\n const primaryCx = (fromPx.x + toPx.x) / 2;\n const stroke = strokeOf(state.style, DEFAULT_COLOR);\n const out: DrawPrimitive[] = [];\n const pushArc = (cx: number): void => {\n out.push({\n kind: \"arc\",\n cx,\n cy: baselineY,\n r: radius,\n start: Math.PI,\n end: 2 * Math.PI,\n closed: false,\n stroke,\n });\n };\n pushArc(primaryCx);\n for (let k = 1; k < TIME_CYCLES_MAX_REPEATS_PER_SIDE; k++) {\n const cx = primaryCx + k * diameter;\n if (cx - radius > view.pxWidth + 16) {\n pushArc(cx);\n break;\n }\n pushArc(cx);\n }\n for (let k = 1; k < TIME_CYCLES_MAX_REPEATS_PER_SIDE; k++) {\n const cx = primaryCx - k * diameter;\n if (cx + radius < -16) {\n pushArc(cx);\n break;\n }\n pushArc(cx);\n }\n return out;\n}\n\n/**\n * Decompose a `sine-line` drawing — one sampled sinusoidal polyline. The\n * half-period is `|toX − fromX|`; baseline is the midpoint of\n * `(fromY, toY)`; amplitude is half the y-distance between anchors. The\n * wave starts at the extreme nearest `from` (sign `peakAtFrom`), sampled\n * 32 points per full period across the padded viewport. Returns `[]`\n * when the half-period is non-positive or non-finite.\n *\n * @since 1.3\n * @stable\n * @example\n * declare const s: SineLineState;\n * declare const v: Viewport;\n * const prims = decomposeSineLine(s, v);\n * void prims;\n */\nexport function decomposeSineLine(\n state: SineLineState,\n view: Viewport,\n): ReadonlyArray<DrawPrimitive> {\n const fromPx = worldPointToPixel(state.anchors[0], view);\n const toPx = worldPointToPixel(state.anchors[1], view);\n const halfPeriodPx = Math.abs(toPx.x - fromPx.x);\n if (!Number.isFinite(halfPeriodPx) || halfPeriodPx <= 0) return [];\n const fullPeriodPx = 2 * halfPeriodPx;\n const baselineY = (fromPx.y + toPx.y) / 2;\n const amplitudePx = Math.abs(fromPx.y - toPx.y) / 2;\n const peakAtFrom = fromPx.y < toPx.y ? 1 : -1;\n const sampleY = (x: number): number => {\n const phase = (2 * Math.PI * (x - fromPx.x)) / fullPeriodPx;\n return baselineY - peakAtFrom * amplitudePx * Math.cos(phase);\n };\n const xMin = -VIEWPORT_PAD_PX;\n const xMax = view.pxWidth + VIEWPORT_PAD_PX;\n const stepPx = fullPeriodPx / SINE_SAMPLES_PER_PERIOD;\n const sampleCount = Math.max(2, Math.ceil((xMax - xMin) / stepPx) + 1);\n const points = [{ x: xMin, y: sampleY(xMin) }];\n for (let i = 1; i < sampleCount; i++) {\n const x = xMin + i * stepPx;\n points.push({ x, y: sampleY(x) });\n }\n return [\n { kind: \"polyline\", points, closed: false, stroke: strokeOf(state.style, DEFAULT_COLOR) },\n ];\n}\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ElliottCorrectionWaveState, ElliottDoubleComboState, ElliottImpulseWaveState, ElliottTriangleWaveState, ElliottTripleComboState } from "@invinite-org/chartlang-core";
|
|
2
|
+
import type { DrawPrimitive, Viewport } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Decompose an `elliott-impulse-wave` drawing — a 4-leg labelled open
|
|
5
|
+
* polyline through the 5 anchors (1-2-3-4-5). `state.labels` overrides
|
|
6
|
+
* the default `["1","2","3","4","5"]` when present and length-matching.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.3
|
|
9
|
+
* @stable
|
|
10
|
+
* @example
|
|
11
|
+
* declare const s: ElliottImpulseWaveState;
|
|
12
|
+
* declare const v: Viewport;
|
|
13
|
+
* const prims = decomposeElliottImpulseWave(s, v);
|
|
14
|
+
* void prims;
|
|
15
|
+
*/
|
|
16
|
+
export declare function decomposeElliottImpulseWave(state: ElliottImpulseWaveState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
17
|
+
/**
|
|
18
|
+
* Decompose an `elliott-correction-wave` drawing — a 2-leg labelled open
|
|
19
|
+
* polyline through the 3 anchors (A-B-C). `state.labels` overrides the
|
|
20
|
+
* default `["A","B","C"]` when present and length-matching.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.3
|
|
23
|
+
* @stable
|
|
24
|
+
* @example
|
|
25
|
+
* declare const s: ElliottCorrectionWaveState;
|
|
26
|
+
* declare const v: Viewport;
|
|
27
|
+
* const prims = decomposeElliottCorrectionWave(s, v);
|
|
28
|
+
* void prims;
|
|
29
|
+
*/
|
|
30
|
+
export declare function decomposeElliottCorrectionWave(state: ElliottCorrectionWaveState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
31
|
+
/**
|
|
32
|
+
* Decompose an `elliott-triangle-wave` drawing — a 4-leg labelled open
|
|
33
|
+
* polyline through the 5 anchors (a-b-c-d-e). `state.labels` overrides
|
|
34
|
+
* the default `["a","b","c","d","e"]` when present and length-matching.
|
|
35
|
+
*
|
|
36
|
+
* @since 1.3
|
|
37
|
+
* @stable
|
|
38
|
+
* @example
|
|
39
|
+
* declare const s: ElliottTriangleWaveState;
|
|
40
|
+
* declare const v: Viewport;
|
|
41
|
+
* const prims = decomposeElliottTriangleWave(s, v);
|
|
42
|
+
* void prims;
|
|
43
|
+
*/
|
|
44
|
+
export declare function decomposeElliottTriangleWave(state: ElliottTriangleWaveState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
45
|
+
/**
|
|
46
|
+
* Decompose an `elliott-double-combo` drawing — a 6-leg labelled open
|
|
47
|
+
* polyline through the 7 anchors. `state.labels` overrides the default
|
|
48
|
+
* `["S","W","x1","X","x2","Yi","Y"]` when present and length-matching.
|
|
49
|
+
*
|
|
50
|
+
* @since 1.3
|
|
51
|
+
* @stable
|
|
52
|
+
* @example
|
|
53
|
+
* declare const s: ElliottDoubleComboState;
|
|
54
|
+
* declare const v: Viewport;
|
|
55
|
+
* const prims = decomposeElliottDoubleCombo(s, v);
|
|
56
|
+
* void prims;
|
|
57
|
+
*/
|
|
58
|
+
export declare function decomposeElliottDoubleCombo(state: ElliottDoubleComboState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
59
|
+
/**
|
|
60
|
+
* Decompose an `elliott-triple-combo` drawing — a 6-leg labelled open
|
|
61
|
+
* polyline through the 7 anchors. `state.labels` overrides the default
|
|
62
|
+
* `["S","W","X1","Y","X2","Zi","Z"]` when present and length-matching.
|
|
63
|
+
*
|
|
64
|
+
* @since 1.3
|
|
65
|
+
* @stable
|
|
66
|
+
* @example
|
|
67
|
+
* declare const s: ElliottTripleComboState;
|
|
68
|
+
* declare const v: Viewport;
|
|
69
|
+
* const prims = decomposeElliottTripleCombo(s, v);
|
|
70
|
+
* void prims;
|
|
71
|
+
*/
|
|
72
|
+
export declare function decomposeElliottTripleCombo(state: ElliottTripleComboState, view: Viewport): ReadonlyArray<DrawPrimitive>;
|
|
73
|
+
//# sourceMappingURL=elliott.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elliott.d.ts","sourceRoot":"","sources":["../../../src/geometry/kinds/elliott.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACR,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EAE1B,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAE,aAAa,EAAU,QAAQ,EAAE,MAAM,aAAa,CAAC;AA2BnE;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,uBAAuB,EAC9B,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAG9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC1C,KAAK,EAAE,0BAA0B,EACjC,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAG9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CACxC,KAAK,EAAE,wBAAwB,EAC/B,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAG9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,uBAAuB,EAC9B,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAG9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,uBAAuB,EAC9B,IAAI,EAAE,QAAQ,GACf,aAAa,CAAC,aAAa,CAAC,CAG9B"}
|