@grundyjs/algiviz 0.9.0 → 0.10.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 CHANGED
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## 0.9.0 � 2026-10-27
3
+ ## 0.10.0 — 2026-10-27
4
+
5
+ - Default finalHoldMs to zero for generic and array players.
6
+ - Make stepDurationMs optional for manual nextStep playback; advance(0) redraws,
7
+ while positive timed advancement requires an explicit duration.
8
+ - Allow array players to omit the options object entirely.
9
+ - Simplify the minimal example and both READMEs; refresh the highlighted GIF.
10
+ - Preserve explicit timing behavior and timeline requirements.
11
+
12
+ ## 0.9.0 — 2026-10-27
4
13
 
5
14
  - Add player.nextStep() for exact manual stepping in generic and array players.
6
15
  - Finish an in-progress transition without reading another snapshot; at a boundary,
package/README.md CHANGED
@@ -74,7 +74,6 @@ const renderer = createSceneRenderer({
74
74
  },
75
75
  });
76
76
  const player = createPlayer(steps(), {
77
- stepDurationMs: 1000, finalHoldMs: 0,
78
77
  isTerminal: step => step.event === 'done',
79
78
  render(frame) {
80
79
  ctx.clearRect(0, 0, 600, 160);
@@ -3,8 +3,8 @@ import type { ArrayStep, ArraySnapshot, ArrayEvent } from "./types.js";
3
3
  import type { ArrayFrame } from "./timeline.js";
4
4
  export type ArrayPlayer = Player<ArraySnapshot, ArrayEvent>;
5
5
  /** Array playback adapter for array steps ending in done. */
6
- export declare function createArrayPlayer(steps: Iterable<ArrayStep>, options: {
7
- stepDurationMs: number;
8
- finalHoldMs: number;
6
+ export declare function createArrayPlayer(steps: Iterable<ArrayStep>, options?: {
7
+ stepDurationMs?: number | undefined;
8
+ finalHoldMs?: number | undefined;
9
9
  render?: (frame: ArrayFrame) => void;
10
10
  }): ArrayPlayer;
@@ -1,5 +1,5 @@
1
1
  import { createPlayer } from "../playback/index.js";
2
2
  /** Array playback adapter for array steps ending in done. */
3
- export function createArrayPlayer(steps, options) {
3
+ export function createArrayPlayer(steps, options = {}) {
4
4
  return createPlayer(steps, { ...options, isTerminal: step => step.event.type === "done" });
5
5
  }
@@ -13,8 +13,10 @@ export interface Player<S, E> {
13
13
  }
14
14
  /** Forward-only playback. The source must reach a step accepted by isTerminal. */
15
15
  export declare function createPlayer<S, E>(steps: Iterable<Step<S, E>>, options: {
16
- stepDurationMs: number;
17
- finalHoldMs: number;
16
+ /** Omit for manual playback; positive advance requires a duration. */
17
+ stepDurationMs?: number | undefined;
18
+ /** Final hold duration, default 0. */
19
+ finalHoldMs?: number | undefined;
18
20
  isTerminal: (step: Step<S, E>) => boolean;
19
21
  /** Called initially and on each advance or nextStep, including after completion. */
20
22
  render?: (frame: Frame<S, E>) => void;
@@ -1,6 +1,8 @@
1
1
  /** Forward-only playback. The source must reach a step accepted by isTerminal. */
2
2
  export function createPlayer(steps, options) {
3
- const { stepDurationMs, finalHoldMs } = options;
3
+ const manual = options.stepDurationMs === undefined;
4
+ // Unit endpoint for manual steps; positive timed advancement is disallowed.
5
+ const { stepDurationMs = 1, finalHoldMs = 0 } = options;
4
6
  if (!Number.isFinite(stepDurationMs) || stepDurationMs <= 0 ||
5
7
  !Number.isFinite(finalHoldMs) || finalHoldMs < 0) {
6
8
  throw new RangeError("Expected positive step duration and non-negative final hold");
@@ -97,6 +99,9 @@ export function createPlayer(steps, options) {
97
99
  if (!Number.isFinite(deltaMs) || deltaMs < 0) {
98
100
  throw new RangeError("Expected finite non-negative playback time");
99
101
  }
102
+ if (manual && deltaMs > 0) {
103
+ throw new Error("Set stepDurationMs to use advance with positive time; use nextStep for manual playback");
104
+ }
100
105
  try {
101
106
  let remaining = deltaMs;
102
107
  while (remaining > 0 && !finished) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grundyjs/algiviz",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "TypeScript toolkit for custom algorithm visualizations with step-by-step playback and extensible rendering",
5
5
  "type": "module",
6
6
  "files": [
package/ru/README.md CHANGED
@@ -73,7 +73,6 @@ const renderer = createSceneRenderer({
73
73
  },
74
74
  });
75
75
  const player = createPlayer(steps(), {
76
- stepDurationMs: 1000, finalHoldMs: 0,
77
76
  isTerminal: step => step.event === 'done',
78
77
  render(frame) {
79
78
  ctx.clearRect(0, 0, 600, 160);