jssm 5.162.34 → 5.162.35

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.
@@ -18,10 +18,10 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
18
18
 
19
19
 
20
20
 
21
- * Generated for version 5.162.34 at 7/15/2026, 9:44:19 PM
21
+ * Generated for version 5.162.35 at 7/16/2026, 7:26:02 AM
22
22
 
23
23
  -->
24
- # jssm 5.162.34
24
+ # jssm 5.162.35
25
25
 
26
26
  [**Try the live editor**](https://stonecypher.github.io/jssm-viz-demo/graph_explorer.html) ·
27
27
  [Documentation](https://stonecypher.github.io/jssm/docs/) ·
@@ -1,6 +1,6 @@
1
1
  type StateType = string;
2
2
  import { JssmGenericState, JssmGenericConfig, JssmStateConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
3
- JssmMachineInternalState, JssmAllowsOverride, JssmAllowIslands, JssmEditorConfig, JssmStochasticOptions, JssmStochasticRun, JssmStochasticSummary, JssmDefaultSize, JssmParsedSemver, JssmStateDeclaration, JssmStateStyleKeyList, JssmTransitionConfig, JssmGraphConfig, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, EverythingHookContext, EverythingHookHandler, PostEverythingHookHandler, HookPhase, HookRegistryEntry, HookQuery, JssmEventName, JssmEventFilter, JssmEventHandler, JssmUnsubscribe, JssmGroupRegistry, JssmGroupHooks, JssmStateHooks, JssmRng } from './jssm_types.js';
3
+ JssmMachineInternalState, JssmAllowsOverride, JssmAllowIslands, JssmEditorConfig, JssmStochasticOptions, JssmStochasticRun, JssmStochasticSummary, JssmDefaultSize, JssmParsedSemver, JssmStateDeclaration, JssmStateStyleKeyList, JssmTransitionConfig, JssmGraphConfig, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, EverythingHookContext, EverythingHookHandler, PostEverythingHookHandler, HookPhase, HookRegistryEntry, HookQuery, JssmEventName, JssmEventDetailMap, JssmEventFilter, JssmEventHandler, JssmUnsubscribe, JssmGroupRegistry, JssmGroupHooks, JssmStateHooks, JssmRng } from './jssm_types.js';
4
4
  import { Interner } from './jssm_intern.js';
5
5
  declare const shapes: string[], gviz_shapes: string[], named_colors: string[], state_name_chars: readonly {
6
6
  from: string;
@@ -1493,6 +1493,57 @@ declare class Machine<mDT> {
1493
1493
  * @returns `true` if removed, `false` if no match was registered.
1494
1494
  */
1495
1495
  off<Ev extends JssmEventName>(name: Ev, handler: JssmEventHandler<mDT, Ev>): boolean;
1496
+ /**
1497
+ * Invoke a single event-handler entry, respecting its filter, once-removal
1498
+ * semantics, and the error re-fire / recursion-guard logic. Extracted so
1499
+ * {@link _fire} can share identical behavior between the size-1 fast-path
1500
+ * and the general snapshotted loop.
1501
+ * @param entry - The subscriber descriptor to invoke.
1502
+ * @param set - The live Set that owns `entry`; needed for once-removal.
1503
+ * @param name - The event name being dispatched (used in error re-fires).
1504
+ * @param detail - The event payload forwarded to the handler.
1505
+ * @internal
1506
+ */
1507
+ _fire_one<Ev extends JssmEventName>(entry: JssmEventEntry<mDT, Ev>, set: Set<JssmEventEntry<any, any>>, name: Ev, detail: JssmEventDetailMap<mDT>[Ev]): void;
1508
+ /**
1509
+ * Dispatch an event to every registered subscriber in registration
1510
+ * order. Filters are checked first; non-matching handlers are skipped
1511
+ * without invoking the handler. Exceptions thrown by a handler are
1512
+ * caught and re-emitted as an `error` event so subsequent handlers
1513
+ * still run.
1514
+ *
1515
+ * Re-entry into the `error` event itself is guarded — if an `error`
1516
+ * handler throws, the new exception is swallowed rather than rebroadcast
1517
+ * to avoid an infinite loop.
1518
+ *
1519
+ * When exactly one subscriber is registered the common case avoids the
1520
+ * `Array.from(set)` snapshot allocation by capturing the lone entry into a
1521
+ * local first — equivalent to a 1-element snapshot but allocation-free.
1522
+ * The general path still snapshots for re-entrancy safety.
1523
+ * @internal
1524
+ */
1525
+ /**
1526
+ * Whether at least one live subscriber is registered for `name`. Used by
1527
+ * the transition-commit observation block to skip building a detail
1528
+ * literal that {@link Machine._fire} would immediately discard — a panel
1529
+ * listening only to `'transition'` (fsl-bind, fsl-viz, fsl-info-panel)
1530
+ * previously paid for the exit/entry/data-change detail allocations on
1531
+ * every transition. Read at fire time, so a listener installed by a
1532
+ * pre-hook is still seen (#671).
1533
+ * @param name The event name to probe.
1534
+ * @returns `true` when a subsequent `_fire(name, ...)` would reach at
1535
+ * least one handler.
1536
+ *
1537
+ * ```typescript
1538
+ * machine.on('transition', () => {});
1539
+ * machine._has_subscribers('transition'); // true
1540
+ * machine._has_subscribers('exit'); // false
1541
+ * ```
1542
+ * @see Machine._fire
1543
+ * @internal
1544
+ */
1545
+ _has_subscribers(name: JssmEventName): boolean;
1546
+ _fire<Ev extends JssmEventName>(name: Ev, detail: JssmEventDetailMap<mDT>[Ev]): void;
1496
1547
  set_hook(HookDesc: HookDescription<mDT>): void;
1497
1548
  /**
1498
1549
  * Remove a previously-registered hook described by a
@@ -1833,6 +1884,81 @@ declare class Machine<mDT> {
1833
1884
  *
1834
1885
  */
1835
1886
  override(newState: StateType, newData?: mDT): void;
1887
+ /*********
1888
+ *
1889
+ * Fire a `'rejection'` event caused by a hook vetoing a pending transition.
1890
+ * Extracted from the per-call closures inside {@link transition_impl} so
1891
+ * that it is allocated once at class-definition time rather than on every
1892
+ * hooked transition.
1893
+ *
1894
+ * @param hook_name Name of the hook that rejected (e.g. `'exit'`).
1895
+ * @param fromState State the machine was in when the transition was
1896
+ * attempted; used as the `from` field of the rejection event.
1897
+ * @param newState State that would have been entered had the hook
1898
+ * passed; used as the `to` field of the rejection event.
1899
+ * @param fromAction Action name when the transition was initiated by an
1900
+ * action call; `undefined` for plain state transitions.
1901
+ * @param oldData Machine data at the moment the transition was
1902
+ * attempted, before any hook mutations.
1903
+ * @param newData The `next_data` value passed to the transition call.
1904
+ * @param wasForced Whether the transition was attempted via
1905
+ * `force_transition`.
1906
+ *
1907
+ * @see transition_impl
1908
+ * @see _fire
1909
+ *
1910
+ * @internal
1911
+ *
1912
+ */
1913
+ _fire_hook_rejection(hook_name: string, fromState: StateType, newState: StateType, fromAction: StateType | undefined, oldData: mDT, newData: mDT | undefined, wasForced: boolean): void;
1914
+ /*********
1915
+ *
1916
+ * Fire the FSL boundary-hook actions for a single, already-committed state
1917
+ * change. In FSL, `do` is a synonym for `action`, so `on enter &g do 'X';`
1918
+ * means "when the machine crosses INTO group `g`, dispatch machine action
1919
+ * `X`" — and likewise `on exit` / plain-state subjects. This is the runtime
1920
+ * that fires those parked hooks.
1921
+ *
1922
+ * Crossing semantics (statechart convention — exits before enters):
1923
+ *
1924
+ * 1. `prev_groups` / `next_groups` are the deep (transitive) group sets of
1925
+ * the old and new states, from `_state_to_groups`.
1926
+ * 2. **Exits** fire first: every group in `prev_groups \ next_groups` with an
1927
+ * `onExit`, plus the plain `prev_state`'s `onExit` (when the state name
1928
+ * actually changed).
1929
+ * 3. **Enters** fire next: every group in `next_groups \ prev_groups` with an
1930
+ * `onEnter`, plus the plain `next_state`'s `onEnter` (when the state name
1931
+ * changed).
1932
+ * 4. A group present in BOTH sets is a transition *within* that group and
1933
+ * fires neither of its boundary hooks. `prev_state === next_state` fires
1934
+ * nothing at all.
1935
+ * 5. "Fire its action" is `this.action(label)`. If that action is not valid
1936
+ * from the current state, `action` is a safe no-op (returns `false`) — an
1937
+ * inapplicable boundary action never throws.
1938
+ * 6. Multi-membership and nesting both fan out naturally: a state in groups
1939
+ * A and B fires both; crossing an inner and an outer boundary fires both
1940
+ * levels.
1941
+ *
1942
+ * Because firing an action can drive a further transition (which crosses
1943
+ * more boundaries, which fires more actions), this is a bounded
1944
+ * run-to-completion: `_boundary_depth` tracks the live cascade depth and a
1945
+ * cascade deeper than `_boundary_depth_limit` throws a {@link JssmError}
1946
+ * rather than overflowing the stack or hanging. The limit defaults to 100
1947
+ * and is configurable via the `boundary_depth_limit` constructor option.
1948
+ *
1949
+ * @param prev_state The state the machine was in before this commit.
1950
+ * @param next_state The state the machine is in now (already committed).
1951
+ *
1952
+ * @throws {JssmError} If cascaded boundary firing exceeds `_boundary_depth_limit`
1953
+ * (a probable infinite loop).
1954
+ *
1955
+ * @see action
1956
+ * @see transition_impl
1957
+ *
1958
+ * @internal
1959
+ *
1960
+ */
1961
+ _fire_boundary_actions(prev_state: StateType, next_state: StateType): void;
1836
1962
  /*********
1837
1963
  *
1838
1964
  * Shared transition core used by {@link transition}, {@link force_transition},