expressive-charts 0.11.0 → 0.12.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 +8 -0
- package/README.md +4 -4
- package/dist/define-DeZLs1h7.js.map +1 -1
- package/dist/expressive-charts.global.js +6 -6
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.cjs.map +1 -1
- package/dist/icons/sport.js +1 -1
- package/dist/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/{path-data-DnEckjY8.js → path-data-Cfjk04X8.js} +5 -5
- package/dist/{path-data-DnEckjY8.js.map → path-data-Cfjk04X8.js.map} +1 -1
- package/dist/testing.cjs +7 -7
- package/dist/testing.js +1 -1
- package/dist/{transition-romki_A6.js → transition-BFd3ktZY.js} +5 -5
- package/dist/{transition-romki_A6.js.map → transition-BFd3ktZY.js.map} +1 -1
- package/package.json +8 -3
|
@@ -56,10 +56,10 @@ function extremes(segment) {
|
|
|
56
56
|
return points;
|
|
57
57
|
}
|
|
58
58
|
function boundsOf(points) {
|
|
59
|
-
let minX =
|
|
60
|
-
let minY =
|
|
61
|
-
let maxX = -
|
|
62
|
-
let maxY = -
|
|
59
|
+
let minX = 1e400;
|
|
60
|
+
let minY = 1e400;
|
|
61
|
+
let maxX = -1e400;
|
|
62
|
+
let maxY = -1e400;
|
|
63
63
|
for (const { x, y } of points) {
|
|
64
64
|
if (x < minX) minX = x;
|
|
65
65
|
if (x > maxX) maxX = x;
|
|
@@ -120,4 +120,4 @@ function pathData(segments, closed = false) {
|
|
|
120
120
|
}
|
|
121
121
|
export { TAU as a, boundsOf as c, normalizeAngle as d, pointOn as f, pathData as i, extremes as l, formatNumber as n, angleOn as o, polar as p, moveTo as r, arc as s, drawTo as t, line as u };
|
|
122
122
|
|
|
123
|
-
//# sourceMappingURL=path-data-
|
|
123
|
+
//# sourceMappingURL=path-data-Cfjk04X8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-data-
|
|
1
|
+
{"version":3,"file":"path-data-Cfjk04X8.js","names":[],"sources":["../src/core/geometry/segment.ts","../src/core/geometry/path-data.ts"],"sourcesContent":["// Path segments: straight lines and circular arcs, with exact lengths.\n//\n// Angles are screen angles: radians, 0 along +x, increasing clockwise on screen (y points down).\n// That is the convention of Math.atan2 in chart pixels, and of the walk's `angle(t)`.\n\nimport type { Point, Rect } from \"../contracts/geometry\";\n\nexport const TAU: number = 2 * Math.PI;\n\nexport interface LineSegment {\n readonly kind: \"line\";\n readonly from: Point;\n readonly to: Point;\n readonly length: number;\n /** Direction from `from` to `to`, or the fallback given to `line()` when they coincide. */\n readonly angle: number;\n}\n\nexport interface ArcSegment {\n readonly kind: \"arc\";\n readonly center: Point;\n readonly radius: number;\n /** Screen angle of the first point. */\n readonly start: number;\n /** Signed: positive is clockwise on screen. */\n readonly sweep: number;\n /** Exact: radius × |sweep|. */\n readonly length: number;\n}\n\nexport type PathSegment = LineSegment | ArcSegment;\n\n/** A straight segment. `fallbackAngle` is its direction if `from` and `to` coincide. */\nexport function line(from: Point, to: Point, fallbackAngle = 0): LineSegment {\n const dx = to.x - from.x;\n const dy = to.y - from.y;\n const length = Math.hypot(dx, dy);\n return { kind: \"line\", from, to, length, angle: length > 0 ? Math.atan2(dy, dx) : normalizeAngle(fallbackAngle) };\n}\n\n/** A circular arc from screen angle `start`, turning `sweep` radians (positive = clockwise on screen). */\nexport function arc(center: Point, radius: number, start: number, sweep: number): ArcSegment {\n return { kind: \"arc\", center, radius, start, sweep, length: radius * Math.abs(sweep) };\n}\n\n/** The point a fraction `u` (0–1) of the way along the segment, by distance. Exact at both ends of a line. */\nexport function pointOn(segment: PathSegment, u: number): Point {\n if (segment.kind === \"line\") {\n const { from, to } = segment;\n return { x: from.x * (1 - u) + to.x * u, y: from.y * (1 - u) + to.y * u };\n }\n return polar(segment.center, segment.radius, segment.start + segment.sweep * u);\n}\n\n/** Direction of travel at fraction `u`, in (-PI, PI]. */\nexport function angleOn(segment: PathSegment, u: number): number {\n if (segment.kind === \"line\") return segment.angle;\n const quarter = segment.sweep < 0 ? -Math.PI / 2 : Math.PI / 2;\n return normalizeAngle(segment.start + segment.sweep * u + quarter);\n}\n\nexport function polar(center: Point, radius: number, angle: number): Point {\n return { x: center.x + radius * Math.cos(angle), y: center.y + radius * Math.sin(angle) };\n}\n\n/** The same angle in (-PI, PI]. */\nexport function normalizeAngle(angle: number): number {\n return angle - TAU * Math.ceil((angle - Math.PI) / TAU);\n}\n\n/** The points that bound a segment: its ends, plus an arc's extremes in x and y. */\nexport function extremes(segment: PathSegment): Point[] {\n if (segment.kind === \"line\") return [segment.from, segment.to];\n const points = [pointOn(segment, 0), pointOn(segment, 1)];\n for (let k = 0; k < 4; k++) {\n const angle = (k * Math.PI) / 2;\n if (sweeps(segment, angle)) points.push(polar(segment.center, segment.radius, angle));\n }\n return points;\n}\n\nexport function boundsOf(points: readonly Point[]): Rect {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (const { x, y } of points) {\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/** True if the arc passes through screen angle `angle`. */\nfunction sweeps(segment: ArcSegment, angle: number): boolean {\n const extent = Math.abs(segment.sweep);\n if (extent >= TAU) return true;\n const turned = segment.sweep >= 0 ? angle - segment.start : segment.start - angle;\n return ((turned % TAU) + TAU) % TAU <= extent;\n}\n","// SVG path data for segments: M, L, A and Z only, with numbers rounded to 0.001 px.\n\nimport type { Point } from \"../contracts/geometry\";\nimport { pointOn, polar, type PathSegment } from \"./segment\";\n\n/** A coordinate for path data: rounded to 0.001, with no \"-0\". */\nexport function formatNumber(value: number): string {\n const rounded = Math.round(value * 1000) / 1000;\n return rounded === 0 ? \"0\" : String(rounded);\n}\n\nexport function moveTo(point: Point): string {\n return `M${formatNumber(point.x)},${formatNumber(point.y)}`;\n}\n\n/**\n * Commands that draw a segment from fraction `u0` to `u1` of its length, assuming the pen is already\n * at the `u0` point. Arcs are split into pieces of at most half a turn, so the large-arc flag is\n * always 0 and a full circle still draws.\n */\nexport function drawTo(segment: PathSegment, u0 = 0, u1 = 1): string {\n if (segment.kind === \"line\") {\n const p = u1 === 1 ? segment.to : pointOn(segment, u1);\n return `L${formatNumber(p.x)},${formatNumber(p.y)}`;\n }\n const from = segment.start + segment.sweep * u0;\n const turn = segment.sweep * (u1 - u0);\n const pieces = Math.max(1, Math.ceil(Math.abs(turn) / Math.PI - 1e-9));\n const r = formatNumber(segment.radius);\n const clockwise = turn >= 0 ? 1 : 0;\n let d = \"\";\n for (let i = 1; i <= pieces; i++) {\n const p = polar(segment.center, segment.radius, from + (turn * i) / pieces);\n d += `A${r},${r} 0 0 ${clockwise} ${formatNumber(p.x)},${formatNumber(p.y)}`;\n }\n return d;\n}\n\n/**\n * Path data for a run of connected segments. Zero-length segments draw nothing. A closed run ends\n * with Z, which also replaces a final straight segment back to the start.\n */\nexport function pathData(segments: readonly PathSegment[], closed = false): string {\n const first = segments[0];\n if (!first) return \"\";\n let count = segments.length;\n if (closed) {\n while (count > 0 && segments[count - 1]!.length <= 0) count--;\n if (count > 0 && segments[count - 1]!.kind === \"line\") count--;\n }\n let d = moveTo(pointOn(first, 0));\n for (let i = 0; i < count; i++) {\n const segment = segments[i]!;\n if (segment.length > 0) d += drawTo(segment);\n }\n return closed ? `${d}Z` : d;\n}\n"],"mappings":";AAOA,MAAa,MAAc,IAAI,KAAK;AA0BpC,SAAgB,KAAK,MAAa,IAAW,gBAAgB,GAAgB;CAC3E,MAAM,KAAK,GAAG,IAAI,KAAK;CACvB,MAAM,KAAK,GAAG,IAAI,KAAK;CACvB,MAAM,SAAS,KAAK,MAAM,IAAI,EAAE;CA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,QAAQ,QAAQ;CAC7C,MAAM,OAAO,QAAQ,SAAS,KAAK;CACnC,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,KAAK,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC;CACrE,MAAM,IAAI,aAAa,QAAQ,MAAM;CACrC,MAAM,YAAY,QAAQ,IAAI,IAAI;CAClC,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,KAAK,QAAQ,KAAK;EAChC,MAAM,IAAI,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,OAAQ,OAAO,IAAK,MAAM;EAC1E,KAAK,IAAI,EAAE,GAAG,EAAE,OAAO,UAAU,GAAG,aAAa,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,CAAC;CAC3E;CACA,OAAO;AACT;AAMA,SAAgB,SAAS,UAAkC,SAAS,OAAe;CACjF,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,QAAQ,SAAS;CACrB,IAAI,QAAQ;EACV,OAAO,QAAQ,KAAK,SAAS,QAAQ,EAAE,CAAE,UAAU,GAAG;EACtD,IAAI,QAAQ,KAAK,SAAS,QAAQ,EAAE,CAAE,SAAS,QAAQ;CACzD;CACA,IAAI,IAAI,OAAO,QAAQ,OAAO,CAAC,CAAC;CAChC,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,MAAM,UAAU,SAAS;EACzB,IAAI,QAAQ,SAAS,GAAG,KAAK,OAAO,OAAO;CAC7C;CACA,OAAO,SAAS,GAAG,EAAE,KAAK;AAC5B"}
|
package/dist/testing.cjs
CHANGED
|
@@ -202,7 +202,7 @@ function createMotion(options = {}) {
|
|
|
202
202
|
function scaleDuration(base, rule) {
|
|
203
203
|
if (!(base > 0)) return 0;
|
|
204
204
|
const floor = Math.min(base, rule.min ?? 0);
|
|
205
|
-
const ceiling = rule.max ??
|
|
205
|
+
const ceiling = rule.max ?? 1e400;
|
|
206
206
|
return Math.min(Math.max(base * rule.factor, floor), ceiling);
|
|
207
207
|
}
|
|
208
208
|
function mediaReducedMotion(query = "(prefers-reduced-motion: reduce)") {
|
|
@@ -724,10 +724,10 @@ function extremes(segment) {
|
|
|
724
724
|
return points;
|
|
725
725
|
}
|
|
726
726
|
function boundsOf(points) {
|
|
727
|
-
let minX =
|
|
728
|
-
let minY =
|
|
729
|
-
let maxX = -
|
|
730
|
-
let maxY = -
|
|
727
|
+
let minX = 1e400;
|
|
728
|
+
let minY = 1e400;
|
|
729
|
+
let maxX = -1e400;
|
|
730
|
+
let maxY = -1e400;
|
|
731
731
|
for (const { x, y } of points) {
|
|
732
732
|
if (x < minX) minX = x;
|
|
733
733
|
if (x > maxX) maxX = x;
|
|
@@ -930,8 +930,8 @@ function reversed(loop) {
|
|
|
930
930
|
function fromUpperLeft(loop) {
|
|
931
931
|
let index = 0;
|
|
932
932
|
let u = 0;
|
|
933
|
-
let key =
|
|
934
|
-
let top =
|
|
933
|
+
let key = 1e400;
|
|
934
|
+
let top = 1e400;
|
|
935
935
|
const consider = (point, i, at) => {
|
|
936
936
|
const k = point.x + point.y;
|
|
937
937
|
if (k < key - 1e-9 || k <= key + 1e-9 && point.y < top) [index, u, key, top] = [
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as manualClock, c as estimatedBox, f as describeValue, h as describe, i as runScope, j as createMotion, l as mergeFields, p as isMarkEffect, t as isTransitionEffect } from "./transition-
|
|
1
|
+
import { H as manualClock, c as estimatedBox, f as describeValue, h as describe, i as runScope, j as createMotion, l as mergeFields, p as isMarkEffect, t as isTransitionEffect } from "./transition-BFd3ktZY.js";
|
|
2
2
|
// src/core/testing/recording.ts
|
|
3
3
|
function recordingLayer() {
|
|
4
4
|
const drawn = /* @__PURE__ */ new Map();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TAU, c as boundsOf, f as pointOn, i as pathData, l as extremes, n as formatNumber, o as angleOn, p as polar, r as moveTo, s as arc, t as drawTo, u as line } from "./path-data-
|
|
1
|
+
import { a as TAU, c as boundsOf, f as pointOn, i as pathData, l as extremes, n as formatNumber, o as angleOn, p as polar, r as moveTo, s as arc, t as drawTo, u as line } from "./path-data-Cfjk04X8.js";
|
|
2
2
|
// src/core/report.ts
|
|
3
3
|
function report(error) {
|
|
4
4
|
const platform = globalThis.reportError;
|
|
@@ -195,7 +195,7 @@ function createMotion(options = {}) {
|
|
|
195
195
|
function scaleDuration(base, rule) {
|
|
196
196
|
if (!(base > 0)) return 0;
|
|
197
197
|
const floor = Math.min(base, rule.min ?? 0);
|
|
198
|
-
const ceiling = rule.max ??
|
|
198
|
+
const ceiling = rule.max ?? 1e400;
|
|
199
199
|
return Math.min(Math.max(base * rule.factor, floor), ceiling);
|
|
200
200
|
}
|
|
201
201
|
function mediaReducedMotion(query = "(prefers-reduced-motion: reduce)") {
|
|
@@ -459,8 +459,8 @@ function reversed(loop) {
|
|
|
459
459
|
function fromUpperLeft(loop) {
|
|
460
460
|
let index = 0;
|
|
461
461
|
let u = 0;
|
|
462
|
-
let key =
|
|
463
|
-
let top =
|
|
462
|
+
let key = 1e400;
|
|
463
|
+
let top = 1e400;
|
|
464
464
|
const consider = (point, i, at) => {
|
|
465
465
|
const k = point.x + point.y;
|
|
466
466
|
if (k < key - 1e-9 || k <= key + 1e-9 && point.y < top) [index, u, key, top] = [
|
|
@@ -2122,4 +2122,4 @@ function describeEffect(value) {
|
|
|
2122
2122
|
}
|
|
2123
2123
|
export { TIMINGS as A, createClock as B, flattenPath as C, describeArc as D, describeBar as E, scaleDuration as F, manualClock as H, easeInOutCubic as I, easeOutCubic as L, defaultScaling as M, mediaReducedMotion as N, loopOutline as O, motion as P, linear as R, cubicPieces as S, describeLine as T, report as U, defaultClock as V, formatPath as _, AVERAGE_WIDTH as a, transformPath as b, estimatedBox as c, createRegistry as d, describeValue as f, describeShape as g, describe as h, runScope as i, createMotion as j, tween as k, mergeFields as l, resolveEffects as m, playTransition as n, TEXT_SIZE as o, isMarkEffect as p, createRunner as r, boxAround as s, isTransitionEffect as t, EFFECT_SLOTS as u, parsePath as v, describePoint as w, FLAT as x, shapeOutline as y, unease as z };
|
|
2124
2124
|
|
|
2125
|
-
//# sourceMappingURL=transition-
|
|
2125
|
+
//# sourceMappingURL=transition-BFd3ktZY.js.map
|