JSSM, a JavaScript state machine - the FSM for FSL
    Preparing search index...

    Function state_svg_label_texts

    • The exact text graphviz places in each state's SVG <text> element(s) when a machine is rendered via machine_to_dot / fsl_to_svg_string: the state's display text plus any group chips the node builder appends, with DOT's \" escaping undone (SVG carries the literal character). A label that wraps across lines becomes several <text> elements; this returns the lines joined by \n, exactly how extract_state_fills reads them back — so the derived key and the extracted key meet at the same string.

      This is the single source of truth the static fence renderer keys its highlight and recolor lookups against, so those lookups can never drift from what was actually drawn — plain labels, group chips, and multi-line wraps alike. It is built by running the node builder's own label_with_chips(doublequote(display_text), chips) and inverting the one escaping step, so it follows any change to the label format for free.

      Type Parameters

      • T

      Parameters

      • u_jssm: Machine<T>

        The machine being rendered.

      • opts: VizRenderOpts = {}

        Render flags; only render_groups affects the label text (default 'cluster', matching fsl_to_svg_string).

      Returns Map<string, string>

      A map from each state name to its rendered SVG label text.

      import { sm } from 'jssm';
      import { state_svg_label_texts } from 'jssm/viz';

      // a state in two groups renders a chip suffix in its node label
      state_svg_label_texts(sm`&g1 : [a b]; &g2 : [a]; a -> b;`).get('a'); // 'a [g1]'
      state_svg_label_texts(sm`a -> b;`).get('a'); // 'a'

      extract_state_fills