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.
@@ -1 +1 @@
1
- {"version":3,"file":"sport.cjs","names":["n"],"sources":["../../src/core/geometry/path-data.ts","../../src/icons/define.ts","../../src/icons/sport/index.ts"],"sourcesContent":["// 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","// defineIcon: fills an icon's defaults and checks every field, so effects can rely on all of them.\n\nimport type { Icon, IconShape, Point, Rect } from \"../core\";\n\n/** What defineIcon takes: an Icon whose pivot, footprint and size are optional. */\nexport type IconSpec = Omit<Icon, \"footprint\" | \"pivot\" | \"size\"> & Partial<Pick<Icon, \"footprint\" | \"pivot\" | \"size\">>;\n\nconst GAITS: readonly string[] = [\"roll\", \"step\", \"slide\"];\nconst LINECAPS: readonly string[] = [\"butt\", \"round\"];\nconst LINEJOINS: readonly string[] = [\"miter\", \"round\"];\nconst FILL_RULES: readonly string[] = [\"nonzero\", \"evenodd\"];\n/** Path data: commands, numbers, separators. Anything else (markup, url(), quotes) is a mistake. */\nconst PATH_DATA = /^\\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\\-\\s]*$/;\n\n/**\n * Makes an icon from its parts. Shapes are drawn facing +x, up towards −y, in px at the icon's\n * natural size. Defaults: `pivot` is the anchor, `footprint` reaches from the anchor to the box's\n * edges, `size` is the box's width and `radius` half its height. Bad input throws a RangeError\n * naming the field. The icon and its parts are frozen, since one icon is shared by every run.\n */\nexport function defineIcon(spec: IconSpec): Icon {\n const name = spec?.name;\n if (typeof name !== \"string\" || name === \"\") throw new TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(name)}.`);\n const fail = (field: string, problem: string): never => {\n throw new RangeError(`defineIcon: \"${name}\" ${field} ${problem}.`);\n };\n const finite = (field: string, value: unknown): number =>\n typeof value === \"number\" && Number.isFinite(value) ? value : fail(field, `must be a finite number, got ${String(value)}`);\n const positive = (field: string, value: unknown): number => (finite(field, value) > 0 ? (value as number) : fail(field, `must be more than 0, got ${String(value)}`));\n const point = (field: string, value: Point | undefined): Point =>\n value && typeof value === \"object\" ? freeze({ x: finite(`${field}.x`, value.x), y: finite(`${field}.y`, value.y) }) : fail(field, \"must be a point { x, y }\");\n\n if (!Array.isArray(spec.shapes) || spec.shapes.length === 0) fail(\"shapes\", \"must be a non-empty array\");\n const shapes = spec.shapes.map((shape, i) => checkShape(shape, `shapes[${i}]`, fail, finite));\n\n const b = spec.box;\n if (!b || typeof b !== \"object\") fail(\"box\", \"must be a rectangle { x, y, width, height }\");\n const box: Rect = freeze({ x: finite(\"box.x\", b.x), y: finite(\"box.y\", b.y), width: positive(\"box.width\", b.width), height: positive(\"box.height\", b.height) });\n\n const anchor = point(\"anchor\", spec.anchor);\n const pivot = spec.pivot === undefined ? anchor : point(\"pivot\", spec.pivot);\n const footprint = spec.footprint ?? [Math.max(0, anchor.x - box.x), Math.max(0, box.x + box.width - anchor.x)];\n if (!Array.isArray(footprint) || footprint.length !== 2) fail(\"footprint\", \"must be [behind, ahead]\");\n footprint.forEach((reach, i) => {\n if (finite(`footprint[${i}]`, reach) < 0) fail(`footprint[${i}]`, `can't be negative, got ${reach}`);\n });\n const size = spec.size === undefined ? box.width : positive(\"size\", spec.size);\n const radius = spec.radius === undefined ? box.height / 2 : positive(\"radius\", spec.radius);\n if (spec.gait !== undefined && !GAITS.includes(spec.gait)) fail(\"gait\", `must be roll, step or slide, got ${String(spec.gait)}`);\n if (spec.upright !== undefined && typeof spec.upright !== \"boolean\") fail(\"upright\", `must be true or false, got ${String(spec.upright)}`);\n\n return freeze({\n name,\n shapes: freeze(shapes),\n box,\n size,\n anchor,\n pivot,\n footprint: freeze([footprint[0], footprint[1]] as const),\n ...(spec.gait !== undefined ? { gait: spec.gait } : {}),\n radius,\n ...(spec.upright !== undefined ? { upright: spec.upright } : {})\n });\n}\n\nfunction checkShape(\n shape: IconShape,\n field: string,\n fail: (field: string, problem: string) => never,\n finite: (field: string, value: unknown) => number\n): IconShape {\n if (!shape || typeof shape !== \"object\") fail(field, \"must be a shape { d, fill?, stroke?, … }\");\n if (typeof shape.d !== \"string\" || !PATH_DATA.test(shape.d)) fail(`${field}.d`, \"must be path data starting with a move\");\n if (shape.clip !== undefined && (typeof shape.clip !== \"string\" || !PATH_DATA.test(shape.clip))) fail(`${field}.clip`, \"must be path data starting with a move\");\n for (const paint of [\"fill\", \"stroke\"] as const) {\n const value = shape[paint];\n if (value !== undefined && (typeof value !== \"string\" || value === \"\")) fail(`${field}.${paint}`, `must be a colour, got ${String(value)}`);\n }\n if (shape.width !== undefined && finite(`${field}.width`, shape.width) < 0) fail(`${field}.width`, `can't be negative, got ${shape.width}`);\n if (shape.linecap !== undefined && !LINECAPS.includes(shape.linecap)) fail(`${field}.linecap`, `must be butt or round, got ${String(shape.linecap)}`);\n if (shape.linejoin !== undefined && !LINEJOINS.includes(shape.linejoin)) fail(`${field}.linejoin`, `must be miter or round, got ${String(shape.linejoin)}`);\n if (shape.fillRule !== undefined && !FILL_RULES.includes(shape.fillRule)) fail(`${field}.fillRule`, `must be nonzero or evenodd, got ${String(shape.fillRule)}`);\n for (const key of [\"opacity\", \"fillOpacity\", \"strokeOpacity\"] as const) {\n const opacity = shape[key] === undefined ? 1 : finite(`${field}.${key}`, shape[key]);\n if (opacity < 0 || opacity > 1) fail(`${field}.${key}`, `must be from 0 to 1, got ${opacity}`);\n }\n const copy: { -readonly [K in keyof IconShape]: IconShape[K] } = { d: shape.d };\n for (const key of [\"fill\", \"stroke\", \"width\", \"linecap\", \"linejoin\", \"clip\", \"fillRule\", \"opacity\", \"fillOpacity\", \"strokeOpacity\"] as const) {\n if (shape[key] !== undefined) (copy as Record<string, unknown>)[key] = shape[key];\n }\n return freeze(copy);\n}\n\nconst freeze = <T>(value: T): T => Object.freeze(value);\n","// The sport icon pack, an optional entry point: import { sport } from \"expressive-charts/icons/sport\",\n// then registerIcons(sport), or pass soccerBall and cleat to travel() directly. Both are converted\n// from the prototype in demo/lab.html and drawn in fixed colours (a white ball is white in any theme).\n\nimport type { Icon } from \"../../core\";\n// From its own file, not the geometry's index, so this entry doesn't carry the builders.\nimport { formatNumber as n } from \"../../core/geometry/path-data\";\nimport { defineIcon } from \"../define\";\n\nconst BALL_R = 8.5;\nconst INK = \"#1d1c1a\";\n\nconst circle = (r: number): string => `M${r},0A${r},${r} 0 0 1 ${-r},0A${r},${r} 0 0 1 ${r},0Z`;\nconst polar = (r: number, a: number): string => `${n(r * Math.sin(a))},${n(-r * Math.cos(a))}`;\n\n/** A regular pentagon around (cx, cy), its first corner `rotation` radians clockwise from 12 o'clock. */\nfunction pentagon(cx: number, cy: number, r: number, rotation: number): string {\n let d = \"\";\n for (let i = 0; i < 5; i++) {\n const a = rotation + (i * 2 * Math.PI) / 5;\n d += `${i ? \"L\" : \"M\"}${n(cx + r * Math.sin(a))},${n(cy - r * Math.cos(a))}`;\n }\n return `${d}Z`;\n}\n\n/** The five seams and five outer panels, one per spoke. */\nfunction panels(): { seams: string; patches: string } {\n let seams = \"\";\n let patches = pentagon(0, 0, 3.3, 0);\n for (let i = 0; i < 5; i++) {\n const a = (i * 2 * Math.PI) / 5;\n seams += `M${polar(3.3, a)}L${polar(8.8 * 0.78, a)}`;\n patches += pentagon(8.8 * 1.08 * Math.sin(a), -8.8 * 1.08 * Math.cos(a), 3.1, a + Math.PI);\n }\n return { seams, patches };\n}\n\n/** Centred on the walk; rolls about its centre. */\nexport const soccerBall: Icon = /* @__PURE__ */ (() => {\n const { seams, patches } = panels();\n return defineIcon({\n name: \"soccer-ball\",\n shapes: [\n { d: circle(BALL_R), fill: \"#ffffff\" },\n // The outer panels hang over the edge, so they're clipped to the ball.\n { d: patches, fill: INK, clip: circle(BALL_R) },\n { d: seams, stroke: INK, width: 1 },\n { d: circle(BALL_R - 0.5), stroke: INK, width: 1 }\n ],\n box: { x: -BALL_R, y: -BALL_R, width: 2 * BALL_R, height: 2 * BALL_R },\n anchor: { x: 0, y: 0 },\n pivot: { x: 0, y: 0 },\n footprint: [BALL_R, BALL_R],\n gait: \"roll\",\n radius: BALL_R\n });\n})();\n\nconst STUDS = [4, 9, 16.5, 21.5]\n .map((x) => `M${n(x + 0.6)},0L${n(x + 1.6)},0A0.6,0.6 0 0 1 ${n(x + 2.2)},0.6L${n(x + 2.2)},2A0.6,0.6 0 0 1 ${n(x + 1.6)},2.6L${n(x + 0.6)},2.6A0.6,0.6 0 0 1 ${x},2L${x},0.6A0.6,0.6 0 0 1 ${n(x + 0.6)},0Z`)\n .join(\"\");\n\n/**\n * A boot with its toe pointing +x. Its heel sits at the start of the walk, raised 6 px so the boot is\n * centred in a bar; it tilts about the ball of the foot. Upright: on a walk heading left it's\n * mirrored, so the sole stays down.\n */\nexport const cleat: Icon = /* @__PURE__ */ defineIcon({\n name: \"cleat\",\n shapes: [\n {\n d: \"M1.5,-1.5L1.5,-11Q1.5,-14 4.5,-14L9.5,-14Q11.5,-14 12.5,-11.5L14.5,-8Q21.5,-7.2 24.5,-4.4Q26.6,-2.2 24.6,0L3,0Q1.5,0 1.5,-1.5Z\",\n fill: \"#24221f\",\n stroke: \"#ffffff\",\n width: 0.9,\n linejoin: \"round\"\n },\n { d: \"M7,-3L12,-9.5M10,-3L15,-8.3\", stroke: \"#ffffff\", width: 1.4, linecap: \"round\" },\n { d: \"M12.3,-11L14.7,-11.6M13.3,-9.6L15.7,-10.1\", stroke: \"#bdbab2\", width: 0.8, linecap: \"round\" },\n { d: STUDS, fill: \"#24221f\", stroke: \"#ffffff\", width: 0.6 }\n ],\n box: { x: 0, y: -14.5, width: 26, height: 17.5 },\n size: 26,\n anchor: { x: 0, y: -6 },\n pivot: { x: 13, y: -4 },\n footprint: [0, 26],\n gait: \"step\",\n upright: true\n});\n\n/** Both icons, for registerIcons(sport). */\nexport const sport: readonly Icon[] = /* @__PURE__ */ Object.freeze([soccerBall, cleat]);\n"],"mappings":";;;AAMA,SAAgB,aAAa,OAAuB;CAClD,MAAM,UAAU,KAAK,MAAM,QAAQ,GAAI,IAAI;CAC3C,OAAO,YAAY,IAAI,MAAM,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AAI,EAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,qBAAqBA,aAAE,IAAI,EAAG,EAAE,IAAI,CAAC,CAC7M,KAAK,EAmBC;GAAO,MAAM;GAAW,QAAQ;GAAW,OAAO;EAAI;CAC7D;CACA,KAAK;EAAE,GAAG;EAAG,GAAG;EAAO,OAAO;EAAI,QAAQ;CAAK;CAC/C,MAAM;CACN,QAAQ;EAAE,GAAG;EAAG,GAAG;CAAG;CACtB,OAAO;EAAE,GAAG;EAAI,GAAG;CAAG;CACtB,WAAW,CAAC,GAAG,EAAE;CACjB,MAAM;CACN,SAAS;AACX,CAAC;AAGD,MAAa,QAAyC,uBAAO,OAAO,CAAC,YAAY,KAAK,CAAC"}
1
+ {"version":3,"file":"sport.cjs","names":["n"],"sources":["../../src/core/geometry/path-data.ts","../../src/icons/define.ts","../../src/icons/sport/index.ts"],"sourcesContent":["// 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","// defineIcon: fills an icon's defaults and checks every field, so effects can rely on all of them.\n\nimport type { Icon, IconShape, Point, Rect } from \"../core\";\n\n/** What defineIcon takes: an Icon whose pivot, footprint and size are optional. */\nexport type IconSpec = Omit<Icon, \"footprint\" | \"pivot\" | \"size\"> & Partial<Pick<Icon, \"footprint\" | \"pivot\" | \"size\">>;\n\nconst GAITS: readonly string[] = [\"roll\", \"step\", \"slide\"];\nconst LINECAPS: readonly string[] = [\"butt\", \"round\"];\nconst LINEJOINS: readonly string[] = [\"miter\", \"round\"];\nconst FILL_RULES: readonly string[] = [\"nonzero\", \"evenodd\"];\n/** Path data: commands, numbers, separators. Anything else (markup, url(), quotes) is a mistake. */\nconst PATH_DATA = /^\\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\\-\\s]*$/;\n\n/**\n * Makes an icon from its parts. Shapes are drawn facing +x, up towards −y, in px at the icon's\n * natural size. Defaults: `pivot` is the anchor, `footprint` reaches from the anchor to the box's\n * edges, `size` is the box's width and `radius` half its height. Bad input throws a RangeError\n * naming the field. The icon and its parts are frozen, since one icon is shared by every run.\n */\nexport function defineIcon(spec: IconSpec): Icon {\n const name = spec?.name;\n if (typeof name !== \"string\" || name === \"\") throw new TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(name)}.`);\n const fail = (field: string, problem: string): never => {\n throw new RangeError(`defineIcon: \"${name}\" ${field} ${problem}.`);\n };\n const finite = (field: string, value: unknown): number =>\n typeof value === \"number\" && Number.isFinite(value) ? value : fail(field, `must be a finite number, got ${String(value)}`);\n const positive = (field: string, value: unknown): number => (finite(field, value) > 0 ? (value as number) : fail(field, `must be more than 0, got ${String(value)}`));\n const point = (field: string, value: Point | undefined): Point =>\n value && typeof value === \"object\" ? freeze({ x: finite(`${field}.x`, value.x), y: finite(`${field}.y`, value.y) }) : fail(field, \"must be a point { x, y }\");\n\n if (!Array.isArray(spec.shapes) || spec.shapes.length === 0) fail(\"shapes\", \"must be a non-empty array\");\n const shapes = spec.shapes.map((shape, i) => checkShape(shape, `shapes[${i}]`, fail, finite));\n\n const b = spec.box;\n if (!b || typeof b !== \"object\") fail(\"box\", \"must be a rectangle { x, y, width, height }\");\n const box: Rect = freeze({ x: finite(\"box.x\", b.x), y: finite(\"box.y\", b.y), width: positive(\"box.width\", b.width), height: positive(\"box.height\", b.height) });\n\n const anchor = point(\"anchor\", spec.anchor);\n const pivot = spec.pivot === undefined ? anchor : point(\"pivot\", spec.pivot);\n const footprint = spec.footprint ?? [Math.max(0, anchor.x - box.x), Math.max(0, box.x + box.width - anchor.x)];\n if (!Array.isArray(footprint) || footprint.length !== 2) fail(\"footprint\", \"must be [behind, ahead]\");\n footprint.forEach((reach, i) => {\n if (finite(`footprint[${i}]`, reach) < 0) fail(`footprint[${i}]`, `can't be negative, got ${reach}`);\n });\n const size = spec.size === undefined ? box.width : positive(\"size\", spec.size);\n const radius = spec.radius === undefined ? box.height / 2 : positive(\"radius\", spec.radius);\n if (spec.gait !== undefined && !GAITS.includes(spec.gait)) fail(\"gait\", `must be roll, step or slide, got ${String(spec.gait)}`);\n if (spec.upright !== undefined && typeof spec.upright !== \"boolean\") fail(\"upright\", `must be true or false, got ${String(spec.upright)}`);\n\n return freeze({\n name,\n shapes: freeze(shapes),\n box,\n size,\n anchor,\n pivot,\n footprint: freeze([footprint[0], footprint[1]] as const),\n ...(spec.gait !== undefined ? { gait: spec.gait } : {}),\n radius,\n ...(spec.upright !== undefined ? { upright: spec.upright } : {})\n });\n}\n\nfunction checkShape(\n shape: IconShape,\n field: string,\n fail: (field: string, problem: string) => never,\n finite: (field: string, value: unknown) => number\n): IconShape {\n if (!shape || typeof shape !== \"object\") fail(field, \"must be a shape { d, fill?, stroke?, … }\");\n if (typeof shape.d !== \"string\" || !PATH_DATA.test(shape.d)) fail(`${field}.d`, \"must be path data starting with a move\");\n if (shape.clip !== undefined && (typeof shape.clip !== \"string\" || !PATH_DATA.test(shape.clip))) fail(`${field}.clip`, \"must be path data starting with a move\");\n for (const paint of [\"fill\", \"stroke\"] as const) {\n const value = shape[paint];\n if (value !== undefined && (typeof value !== \"string\" || value === \"\")) fail(`${field}.${paint}`, `must be a colour, got ${String(value)}`);\n }\n if (shape.width !== undefined && finite(`${field}.width`, shape.width) < 0) fail(`${field}.width`, `can't be negative, got ${shape.width}`);\n if (shape.linecap !== undefined && !LINECAPS.includes(shape.linecap)) fail(`${field}.linecap`, `must be butt or round, got ${String(shape.linecap)}`);\n if (shape.linejoin !== undefined && !LINEJOINS.includes(shape.linejoin)) fail(`${field}.linejoin`, `must be miter or round, got ${String(shape.linejoin)}`);\n if (shape.fillRule !== undefined && !FILL_RULES.includes(shape.fillRule)) fail(`${field}.fillRule`, `must be nonzero or evenodd, got ${String(shape.fillRule)}`);\n for (const key of [\"opacity\", \"fillOpacity\", \"strokeOpacity\"] as const) {\n const opacity = shape[key] === undefined ? 1 : finite(`${field}.${key}`, shape[key]);\n if (opacity < 0 || opacity > 1) fail(`${field}.${key}`, `must be from 0 to 1, got ${opacity}`);\n }\n const copy: { -readonly [K in keyof IconShape]: IconShape[K] } = { d: shape.d };\n for (const key of [\"fill\", \"stroke\", \"width\", \"linecap\", \"linejoin\", \"clip\", \"fillRule\", \"opacity\", \"fillOpacity\", \"strokeOpacity\"] as const) {\n if (shape[key] !== undefined) (copy as Record<string, unknown>)[key] = shape[key];\n }\n return freeze(copy);\n}\n\nconst freeze = <T>(value: T): T => Object.freeze(value);\n","// The sport icon pack, an optional entry point: import { sport } from \"expressive-charts/icons/sport\",\n// then registerIcons(sport), or pass soccerBall and cleat to travel() directly. Both are converted\n// from the prototype in demo/lab.html and drawn in fixed colours (a white ball is white in any theme).\n\nimport type { Icon } from \"../../core\";\n// From its own file, not the geometry's index, so this entry doesn't carry the builders.\nimport { formatNumber as n } from \"../../core/geometry/path-data\";\nimport { defineIcon } from \"../define\";\n\nconst BALL_R = 8.5;\nconst INK = \"#1d1c1a\";\n\nconst circle = (r: number): string => `M${r},0A${r},${r} 0 0 1 ${-r},0A${r},${r} 0 0 1 ${r},0Z`;\nconst polar = (r: number, a: number): string => `${n(r * Math.sin(a))},${n(-r * Math.cos(a))}`;\n\n/** A regular pentagon around (cx, cy), its first corner `rotation` radians clockwise from 12 o'clock. */\nfunction pentagon(cx: number, cy: number, r: number, rotation: number): string {\n let d = \"\";\n for (let i = 0; i < 5; i++) {\n const a = rotation + (i * 2 * Math.PI) / 5;\n d += `${i ? \"L\" : \"M\"}${n(cx + r * Math.sin(a))},${n(cy - r * Math.cos(a))}`;\n }\n return `${d}Z`;\n}\n\n/** The five seams and five outer panels, one per spoke. */\nfunction panels(): { seams: string; patches: string } {\n let seams = \"\";\n let patches = pentagon(0, 0, 3.3, 0);\n for (let i = 0; i < 5; i++) {\n const a = (i * 2 * Math.PI) / 5;\n seams += `M${polar(3.3, a)}L${polar(8.8 * 0.78, a)}`;\n patches += pentagon(8.8 * 1.08 * Math.sin(a), -8.8 * 1.08 * Math.cos(a), 3.1, a + Math.PI);\n }\n return { seams, patches };\n}\n\n/** Centred on the walk; rolls about its centre. */\nexport const soccerBall: Icon = /* @__PURE__ */ (() => {\n const { seams, patches } = panels();\n return defineIcon({\n name: \"soccer-ball\",\n shapes: [\n { d: circle(BALL_R), fill: \"#ffffff\" },\n // The outer panels hang over the edge, so they're clipped to the ball.\n { d: patches, fill: INK, clip: circle(BALL_R) },\n { d: seams, stroke: INK, width: 1 },\n { d: circle(BALL_R - 0.5), stroke: INK, width: 1 }\n ],\n box: { x: -BALL_R, y: -BALL_R, width: 2 * BALL_R, height: 2 * BALL_R },\n anchor: { x: 0, y: 0 },\n pivot: { x: 0, y: 0 },\n footprint: [BALL_R, BALL_R],\n gait: \"roll\",\n radius: BALL_R\n });\n})();\n\nconst STUDS = [4, 9, 16.5, 21.5]\n .map((x) => `M${n(x + 0.6)},0L${n(x + 1.6)},0A0.6,0.6 0 0 1 ${n(x + 2.2)},0.6L${n(x + 2.2)},2A0.6,0.6 0 0 1 ${n(x + 1.6)},2.6L${n(x + 0.6)},2.6A0.6,0.6 0 0 1 ${x},2L${x},0.6A0.6,0.6 0 0 1 ${n(x + 0.6)},0Z`)\n .join(\"\");\n\n/**\n * A boot with its toe pointing +x. Its heel sits at the start of the walk, raised 6 px so the boot is\n * centred in a bar; it tilts about the ball of the foot. Upright: on a walk heading left it's\n * mirrored, so the sole stays down.\n */\nexport const cleat: Icon = /* @__PURE__ */ defineIcon({\n name: \"cleat\",\n shapes: [\n {\n d: \"M1.5,-1.5L1.5,-11Q1.5,-14 4.5,-14L9.5,-14Q11.5,-14 12.5,-11.5L14.5,-8Q21.5,-7.2 24.5,-4.4Q26.6,-2.2 24.6,0L3,0Q1.5,0 1.5,-1.5Z\",\n fill: \"#24221f\",\n stroke: \"#ffffff\",\n width: 0.9,\n linejoin: \"round\"\n },\n { d: \"M7,-3L12,-9.5M10,-3L15,-8.3\", stroke: \"#ffffff\", width: 1.4, linecap: \"round\" },\n { d: \"M12.3,-11L14.7,-11.6M13.3,-9.6L15.7,-10.1\", stroke: \"#bdbab2\", width: 0.8, linecap: \"round\" },\n { d: STUDS, fill: \"#24221f\", stroke: \"#ffffff\", width: 0.6 }\n ],\n box: { x: 0, y: -14.5, width: 26, height: 17.5 },\n size: 26,\n anchor: { x: 0, y: -6 },\n pivot: { x: 13, y: -4 },\n footprint: [0, 26],\n gait: \"step\",\n upright: true\n});\n\n/** Both icons, for registerIcons(sport). */\nexport const sport: readonly Icon[] = /* @__PURE__ */ Object.freeze([soccerBall, cleat]);\n"],"mappings":";;;AAMA,SAAgB,aAAa,OAAuB;CAClD,MAAM,UAAU,KAAK,MAAM,QAAQ,GAAI,IAAI;CAC3C,OAAO,YAAY,IAAI,MAAM,OAAO,OAAO;AAC7C;;ACFA,MAAM,QAA2B;CAAC;CAAQ;CAAQ;AAAO;AACzD,MAAM,WAA8B,CAAC,QAAQ,OAAO;AACpD,MAAM,YAA+B,CAAC,SAAS,OAAO;AACtD,MAAM,aAAgC,CAAC,WAAW,SAAS;AAE3D,MAAM,YAAY;AAQlB,SAAgB,WAAW,MAAsB;CAC/C,MAAM,OAAO,MAAM;CACnB,IAAI,OAAO,SAAS,YAAY,SAAS,IAAI,MAAM,IAAI,UAAU,iDAAiD,KAAK,UAAU,IAAI,EAAE,EAAE;CACzI,MAAM,QAAQ,OAAe,YAA2B;EACtD,MAAM,IAAI,WAAW,gBAAgB,KAAK,IAAI,MAAM,GAAG,QAAQ,EAAE;CACnE;CACA,MAAM,UAAU,OAAe,UAC7B,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAK,OAAO,gCAAgC,OAAO,KAAK,GAAG;CAC3H,MAAM,YAAY,OAAe,UAA4B,OAAO,OAAO,KAAK,IAAI,IAAK,QAAmB,KAAK,OAAO,4BAA4B,OAAO,KAAK,GAAG;CACnK,MAAM,SAAS,OAAe,UAC5B,SAAS,OAAO,UAAU,WAAW,OAAO;EAAE,GAAG,OAAO,GAAG,MAAM,KAAK,MAAM,CAAC;EAAG,GAAG,OAAO,GAAG,MAAM,KAAK,MAAM,CAAC;CAAE,CAAC,IAAI,KAAK,OAAO,0BAA0B;CAE9J,IAAI,CAAC,MAAM,Q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AS;EAAQ;EACpF;GAAE,GAAG;GAA6C,QAAQ;GAAW,OAAO;GAAK,SAAS;EAAQ;EAClG;GAAE,GArBQ;IAAC;IAAG;IAAG;IAAM;GAAI,CAAC,CAC7B,KAAK,MAAM,IAAIA,aAAE,IAAI,EAAG,EAAE,KAAKA,aAAE,IAAI,GAAG,EAAE,mBAAmBA,aAAE,IAAI,GAAG,EAAE,OAAOA,aAAE,IAAI,GAAG,EAAE,mBAAmBA,aAAE,IAAI,GAAG,EAAE,OAAOA,aAAE,IAAI,EAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,qBAAqBA,aAAE,IAAI,EAAG,EAAE,IAAI,CAAC,CAC7M,KAAK,EAmBC;GAAO,MAAM;GAAW,QAAQ;GAAW,OAAO;EAAI;CAC7D;CACA,KAAK;EAAE,GAAG;EAAG,GAAG;EAAO,OAAO;EAAI,QAAQ;CAAK;CAC/C,MAAM;CACN,QAAQ;EAAE,GAAG;EAAG,GAAG;CAAG;CACtB,OAAO;EAAE,GAAG;EAAI,GAAG;CAAG;CACtB,WAAW,CAAC,GAAG,EAAE;CACjB,MAAM;CACN,SAAS;AACX,CAAC;AAGD,MAAa,QAAyC,uBAAO,OAAO,CAAC,YAAY,KAAK,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as formatNumber } from "../path-data-DnEckjY8.js";
1
+ import { n as formatNumber } from "../path-data-Cfjk04X8.js";
2
2
  import { t as defineIcon } from "../define-DeZLs1h7.js";
3
3
  // src/icons/sport/index.ts
4
4
  const BALL_R = 8.5;
package/dist/index.cjs CHANGED
@@ -196,7 +196,7 @@ function createMotion(options = {}) {
196
196
  function scaleDuration(base, rule) {
197
197
  if (!(base > 0)) return 0;
198
198
  const floor = Math.min(base, rule.min ?? 0);
199
- const ceiling = rule.max ?? Infinity;
199
+ const ceiling = rule.max ?? 1e400;
200
200
  return Math.min(Math.max(base * rule.factor, floor), ceiling);
201
201
  }
202
202
  function mediaReducedMotion(query = "(prefers-reduced-motion: reduce)") {
@@ -613,10 +613,10 @@ function extremes(segment) {
613
613
  return points;
614
614
  }
615
615
  function boundsOf(points) {
616
- let minX = Infinity;
617
- let minY = Infinity;
618
- let maxX = -Infinity;
619
- let maxY = -Infinity;
616
+ let minX = 1e400;
617
+ let minY = 1e400;
618
+ let maxX = -1e400;
619
+ let maxY = -1e400;
620
620
  for (const { x, y } of points) {
621
621
  if (x < minX) minX = x;
622
622
  if (x > maxX) maxX = x;
@@ -819,8 +819,8 @@ function reversed(loop) {
819
819
  function fromUpperLeft(loop) {
820
820
  let index = 0;
821
821
  let u = 0;
822
- let key = Infinity;
823
- let top = Infinity;
822
+ let key = 1e400;
823
+ let top = 1e400;
824
824
  const consider = (point, i, at) => {
825
825
  const k = point.x + point.y;
826
826
  if (k < key - 1e-9 || k <= key + 1e-9 && point.y < top) [index, u, key, top] = [
@@ -1973,7 +1973,7 @@ function nearest$1(mark, grid, p) {
1973
1973
  const n = grid.length;
1974
1974
  if (n === 1) return 0;
1975
1975
  let best = 0;
1976
- let bestDistance = Infinity;
1976
+ let bestDistance = 1e400;
1977
1977
  grid.forEach((q, i) => {
1978
1978
  const d = squared(q, p);
1979
1979
  if (d < bestDistance) {
@@ -3896,7 +3896,7 @@ function svgSurface(options) {
3896
3896
  }, overlay);
3897
3897
  setStyles(group, markColorStyles(options.colors(key)));
3898
3898
  orders.set(group, order);
3899
- const above = Array.from(overlay.children).find((child) => (orders.get(child) ?? -Infinity) > order);
3899
+ const above = Array.from(overlay.children).find((child) => (orders.get(child) ?? -1e400) > order);
3900
3900
  overlay.insertBefore(group, above ?? null);
3901
3901
  let live = groups.get(key);
3902
3902
  if (!live) groups.set(key, live = /* @__PURE__ */ new Set());
@@ -7348,7 +7348,7 @@ function lineCurve(xs, values, amount, scales, presence) {
7348
7348
  ];
7349
7349
  };
7350
7350
  return {
7351
- between(from, to, through = Infinity) {
7351
+ between(from, to, through = 1e400) {
7352
7352
  const p = piece(from, to);
7353
7353
  if (!p || !tangents) return [];
7354
7354
  const [v0, c1, c2, v1, k] = p;
@@ -7619,7 +7619,7 @@ function boundaries(lo, hi, step, zone) {
7619
7619
  return out;
7620
7620
  }
7621
7621
  const nth = unit === "day" ? (i) => midnight(zone, start.year, start.month, start.date + i) : unit === "week" ? (i) => midnight(zone, start.year, start.month, start.date - (start.weekday + 6) % 7 + 7 * i) : unit === "month" ? (i) => midnight(zone, start.year, Math.floor(start.month / count) * count + count * i, 1) : (i) => midnight(zone, Math.floor(start.year / count) * count + count * i, 0, 1);
7622
- let previous = -Infinity;
7622
+ let previous = -1e400;
7623
7623
  for (let i = 0;; i++) {
7624
7624
  const t = nth(i);
7625
7625
  if (t >= hi || t <= previous) break;
@@ -8360,7 +8360,7 @@ function lineChart$1(target, options, env) {
8360
8360
  const events = chartEvents("lineChart");
8361
8361
  let measuredWidth = containerWidth(container);
8362
8362
  let destroyed = false;
8363
- let through = Infinity;
8363
+ let through = 1e400;
8364
8364
  const labelFailures = /* @__PURE__ */ new WeakSet();
8365
8365
  let laidOut;
8366
8366
  let firstTable;
@@ -8506,7 +8506,7 @@ function lineChart$1(target, options, env) {
8506
8506
  }
8507
8507
  function drawnThrough(next) {
8508
8508
  const last = next.rows[next.rows.length - 1];
8509
- return last && through < last.x ? revealedIn(next) : Infinity;
8509
+ return last && through < last.x ? revealedIn(next) : 1e400;
8510
8510
  }
8511
8511
  const revealed = (record) => !record.leaving && record.row.x <= revealedIn(laidOut);
8512
8512
  function createRow(row, entering) {
@@ -8985,8 +8985,8 @@ function lineChart$1(target, options, env) {
8985
8985
  function nearestPoint(at) {
8986
8986
  const shown = rowOrder.filter(revealed).flatMap(livePoints);
8987
8987
  let best;
8988
- let far = Infinity;
8989
- let rank = Infinity;
8988
+ let far = 1e400;
8989
+ let rank = 1e400;
8990
8990
  for (const point of shown) {
8991
8991
  const d = apart(point.shown.geometry.center, at);
8992
8992
  const r = laidOut.series.indexOf(point.series);
@@ -9006,7 +9006,7 @@ function lineChart$1(target, options, env) {
9006
9006
  }
9007
9007
  if (on.size < 2) return best;
9008
9008
  let pick = best;
9009
- let near = Infinity;
9009
+ let near = 1e400;
9010
9010
  for (const series of laidOut.series) {
9011
9011
  const point = on.get(series);
9012
9012
  if (!point) continue;
@@ -9739,7 +9739,7 @@ function strokeNear({ geometry, data: { samples } }, x, from, at, reach) {
9739
9739
  if (!next || (way > 0 ? next : samples[j]).gapBefore) break;
9740
9740
  const to = way > 0 ? Math.min(next.t, t + span) : Math.max(next.t, t - span);
9741
9741
  const b = geometry.path(to);
9742
- near = Math.min(near ?? Infinity, toSegment(at, a, b));
9742
+ near = Math.min(near ?? 1e400, toSegment(at, a, b));
9743
9743
  if (to !== next.t) break;
9744
9744
  a = b;
9745
9745
  }
@@ -9863,7 +9863,7 @@ function describeRects(key, parts, baseline) {
9863
9863
  ...span(part.box)
9864
9864
  })).sort((a, b) => a.near - b.near || a.far - b.far || a.index - b.index);
9865
9865
  let reached = 0;
9866
- let gap = Infinity;
9866
+ let gap = 1e400;
9867
9867
  const segments = order.map(({ index, near, far }) => {
9868
9868
  if (reached > 0 && far > near) gap = Math.min(gap, near - reached);
9869
9869
  const size = Math.max(0, far - reached);
@@ -10259,7 +10259,7 @@ function hostMarkHandle(parts, edits, halos) {
10259
10259
  };
10260
10260
  }
10261
10261
  function hostColors(element, root) {
10262
- const fill = paintOf$1(element, root, "fill");
10262
+ const fill = element.localName === "line" ? NONE : paintOf$1(element, root, "fill");
10263
10263
  const paint = fill === NONE ? "stroke" : "fill";
10264
10264
  const color = paint === "fill" ? fill : paintOf$1(element, root, "stroke");
10265
10265
  if (color === void 0 || color === NONE) return void 0;
@@ -12536,7 +12536,7 @@ function chartSwitch$1(target, options, env) {
12536
12536
  }, runsLayer);
12537
12537
  setStyles(group, tokensOf(paints[order] ?? { color: key }));
12538
12538
  orders.set(group, order);
12539
- const above = Array.from(runsLayer.children).find((child) => (orders.get(child) ?? -Infinity) > order);
12539
+ const above = Array.from(runsLayer.children).find((child) => (orders.get(child) ?? -1e400) > order);
12540
12540
  runsLayer.insertBefore(group, above ?? null);
12541
12541
  const layer = svgLayer(group);
12542
12542
  return {
@@ -14057,9 +14057,9 @@ function captionPlace(mark, text) {
14057
14057
  return past(mark.end, heading, PAST_END, own, boxes, text);
14058
14058
  }
14059
14059
  function past(from, toward, least, own, boxes, text) {
14060
- if (!text) return placed$1(from, toward, Math.max(least, farthest(from, toward, boxes) ?? -Infinity));
14060
+ if (!text) return placed$1(from, toward, Math.max(least, farthest(from, toward, boxes) ?? -1e400));
14061
14061
  const { x, y, width, height } = text.box(placed$1(from, toward, 0));
14062
- return placed$1(from, toward, clearOf(from, toward, Math.max(least, farthest(from, toward, own) ?? -Infinity), boxes, {
14062
+ return placed$1(from, toward, clearOf(from, toward, Math.max(least, farthest(from, toward, own) ?? -1e400), boxes, {
14063
14063
  x: x - from.x,
14064
14064
  y: y - from.y,
14065
14065
  width,
@@ -14083,7 +14083,7 @@ function clearOf(from, toward, distance, boxes, reach, held) {
14083
14083
  const within = meets(near);
14084
14084
  if (!band || !within) return within;
14085
14085
  const leaving = across ? Math.max(band[1], ((sin > 0 ? near.y + near.height : near.y) - from.y) / sin) : band[1];
14086
- return [within[0], Math.max(leaving, meets(box)?.[1] ?? -Infinity)];
14086
+ return [within[0], Math.max(leaving, meets(box)?.[1] ?? -1e400)];
14087
14087
  });
14088
14088
  let at = distance;
14089
14089
  for (let moved = true; moved;) {
@@ -14137,7 +14137,7 @@ function leaves(from, cos, sin, box) {
14137
14137
  }
14138
14138
  function span(from, cos, sin, box) {
14139
14139
  let near = 0;
14140
- let far = Infinity;
14140
+ let far = 1e400;
14141
14141
  for (const [origin, step, lo, hi] of [[
14142
14142
  from.x,
14143
14143
  cos,
@@ -14729,8 +14729,8 @@ function bandOf(outline) {
14729
14729
  ring.push(segment.to);
14730
14730
  }
14731
14731
  if (areaOf(ring) < 0) ring.reverse();
14732
- const left = ring.reduce((x, point) => Math.min(x, point.x), Infinity);
14733
- const right = ring.reduce((x, point) => Math.max(x, point.x), -Infinity);
14732
+ const left = ring.reduce((x, point) => Math.min(x, point.x), 1e400);
14733
+ const right = ring.reduce((x, point) => Math.max(x, point.x), -1e400);
14734
14734
  if (!(right - left > 2 * SAME_X)) return void 0;
14735
14735
  const atLeft = (point) => point.x - left <= SAME_X;
14736
14736
  const atRight = (point) => right - point.x <= SAME_X;
@@ -14847,7 +14847,7 @@ function landing(hole, own, other, area) {
14847
14847
  }
14848
14848
  function depth(point, area) {
14849
14849
  if (windingAt(point, area) === 0) return 0;
14850
- let nearest = Infinity;
14850
+ let nearest = 1e400;
14851
14851
  for (const ring of area) ring.forEach((p, i) => {
14852
14852
  const q = ring[(i + 1) % ring.length];
14853
14853
  const dx = q.x - p.x;
@@ -15556,7 +15556,7 @@ function configure(options) {
15556
15556
  }
15557
15557
  }
15558
15558
  // src/index.ts
15559
- const VERSION = "0.11.0";
15559
+ const VERSION = "0.12.0";
15560
15560
  const env = {
15561
15561
  presets: presetRegistry,
15562
15562
  icons: iconRegistry,