jssm 5.152.0 → 5.153.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/README.md +7 -7
- package/custom-elements.json +11 -11
- package/dist/cdn/instance.js +205 -11
- package/dist/cdn/viz.js +229 -16
- package/dist/cli/fsl-export-system-prompt.cjs +1 -1
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/cli/lib.cjs +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/deno/README.md +7 -7
- package/dist/deno/jssm.d.ts +6 -4
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_types.d.ts +2 -0
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/jssm.es5.d.cts +8 -4
- package/jssm.es6.d.ts +8 -4
- package/jssm_viz.es5.d.cts +8 -4
- package/jssm_viz.es6.d.ts +8 -4
- package/package.json +1 -1
package/dist/cdn/viz.js
CHANGED
|
@@ -913,7 +913,19 @@ function peg$parse(input, options) {
|
|
|
913
913
|
node.loc = location();
|
|
914
914
|
}
|
|
915
915
|
return node;
|
|
916
|
-
}, peg$c1573 = peg$otherExpectation("
|
|
916
|
+
}, peg$c1573 = peg$otherExpectation("oarrange declaration"), peg$c1574 = "oarrange", peg$c1575 = peg$literalExpectation("oarrange", false), peg$c1576 = function (value) {
|
|
917
|
+
const node = { key: 'oarrange_declaration', value };
|
|
918
|
+
if (options.locations) {
|
|
919
|
+
node.loc = location();
|
|
920
|
+
}
|
|
921
|
+
return node;
|
|
922
|
+
}, peg$c1577 = peg$otherExpectation("farrange declaration"), peg$c1578 = "farrange", peg$c1579 = peg$literalExpectation("farrange", false), peg$c1580 = function (value) {
|
|
923
|
+
const node = { key: 'farrange_declaration', value };
|
|
924
|
+
if (options.locations) {
|
|
925
|
+
node.loc = location();
|
|
926
|
+
}
|
|
927
|
+
return node;
|
|
928
|
+
}, peg$c1581 = peg$otherExpectation("arrange declaration"), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;
|
|
917
929
|
if ("startRule" in options) {
|
|
918
930
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
919
931
|
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
@@ -20481,6 +20493,176 @@ function peg$parse(input, options) {
|
|
|
20481
20493
|
}
|
|
20482
20494
|
return s0;
|
|
20483
20495
|
}
|
|
20496
|
+
function peg$parseOArrangeDeclaration() {
|
|
20497
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
|
20498
|
+
peg$silentFails++;
|
|
20499
|
+
s0 = peg$currPos;
|
|
20500
|
+
if (input.substr(peg$currPos, 8) === peg$c1574) {
|
|
20501
|
+
s1 = peg$c1574;
|
|
20502
|
+
peg$currPos += 8;
|
|
20503
|
+
}
|
|
20504
|
+
else {
|
|
20505
|
+
s1 = peg$FAILED;
|
|
20506
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20507
|
+
peg$fail(peg$c1575);
|
|
20508
|
+
}
|
|
20509
|
+
}
|
|
20510
|
+
if (s1 !== peg$FAILED) {
|
|
20511
|
+
s2 = peg$parseWS();
|
|
20512
|
+
if (s2 === peg$FAILED) {
|
|
20513
|
+
s2 = null;
|
|
20514
|
+
}
|
|
20515
|
+
if (s2 !== peg$FAILED) {
|
|
20516
|
+
s3 = peg$parseLabelOrLabelList();
|
|
20517
|
+
if (s3 !== peg$FAILED) {
|
|
20518
|
+
s4 = peg$parseWS();
|
|
20519
|
+
if (s4 === peg$FAILED) {
|
|
20520
|
+
s4 = null;
|
|
20521
|
+
}
|
|
20522
|
+
if (s4 !== peg$FAILED) {
|
|
20523
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
20524
|
+
s5 = peg$c1213;
|
|
20525
|
+
peg$currPos++;
|
|
20526
|
+
}
|
|
20527
|
+
else {
|
|
20528
|
+
s5 = peg$FAILED;
|
|
20529
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20530
|
+
peg$fail(peg$c1214);
|
|
20531
|
+
}
|
|
20532
|
+
}
|
|
20533
|
+
if (s5 !== peg$FAILED) {
|
|
20534
|
+
s6 = peg$parseWS();
|
|
20535
|
+
if (s6 === peg$FAILED) {
|
|
20536
|
+
s6 = null;
|
|
20537
|
+
}
|
|
20538
|
+
if (s6 !== peg$FAILED) {
|
|
20539
|
+
peg$savedPos = s0;
|
|
20540
|
+
s1 = peg$c1576(s3);
|
|
20541
|
+
s0 = s1;
|
|
20542
|
+
}
|
|
20543
|
+
else {
|
|
20544
|
+
peg$currPos = s0;
|
|
20545
|
+
s0 = peg$FAILED;
|
|
20546
|
+
}
|
|
20547
|
+
}
|
|
20548
|
+
else {
|
|
20549
|
+
peg$currPos = s0;
|
|
20550
|
+
s0 = peg$FAILED;
|
|
20551
|
+
}
|
|
20552
|
+
}
|
|
20553
|
+
else {
|
|
20554
|
+
peg$currPos = s0;
|
|
20555
|
+
s0 = peg$FAILED;
|
|
20556
|
+
}
|
|
20557
|
+
}
|
|
20558
|
+
else {
|
|
20559
|
+
peg$currPos = s0;
|
|
20560
|
+
s0 = peg$FAILED;
|
|
20561
|
+
}
|
|
20562
|
+
}
|
|
20563
|
+
else {
|
|
20564
|
+
peg$currPos = s0;
|
|
20565
|
+
s0 = peg$FAILED;
|
|
20566
|
+
}
|
|
20567
|
+
}
|
|
20568
|
+
else {
|
|
20569
|
+
peg$currPos = s0;
|
|
20570
|
+
s0 = peg$FAILED;
|
|
20571
|
+
}
|
|
20572
|
+
peg$silentFails--;
|
|
20573
|
+
if (s0 === peg$FAILED) {
|
|
20574
|
+
s1 = peg$FAILED;
|
|
20575
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20576
|
+
peg$fail(peg$c1573);
|
|
20577
|
+
}
|
|
20578
|
+
}
|
|
20579
|
+
return s0;
|
|
20580
|
+
}
|
|
20581
|
+
function peg$parseFArrangeDeclaration() {
|
|
20582
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
|
20583
|
+
peg$silentFails++;
|
|
20584
|
+
s0 = peg$currPos;
|
|
20585
|
+
if (input.substr(peg$currPos, 8) === peg$c1578) {
|
|
20586
|
+
s1 = peg$c1578;
|
|
20587
|
+
peg$currPos += 8;
|
|
20588
|
+
}
|
|
20589
|
+
else {
|
|
20590
|
+
s1 = peg$FAILED;
|
|
20591
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20592
|
+
peg$fail(peg$c1579);
|
|
20593
|
+
}
|
|
20594
|
+
}
|
|
20595
|
+
if (s1 !== peg$FAILED) {
|
|
20596
|
+
s2 = peg$parseWS();
|
|
20597
|
+
if (s2 === peg$FAILED) {
|
|
20598
|
+
s2 = null;
|
|
20599
|
+
}
|
|
20600
|
+
if (s2 !== peg$FAILED) {
|
|
20601
|
+
s3 = peg$parseLabelOrLabelList();
|
|
20602
|
+
if (s3 !== peg$FAILED) {
|
|
20603
|
+
s4 = peg$parseWS();
|
|
20604
|
+
if (s4 === peg$FAILED) {
|
|
20605
|
+
s4 = null;
|
|
20606
|
+
}
|
|
20607
|
+
if (s4 !== peg$FAILED) {
|
|
20608
|
+
if (input.charCodeAt(peg$currPos) === 59) {
|
|
20609
|
+
s5 = peg$c1213;
|
|
20610
|
+
peg$currPos++;
|
|
20611
|
+
}
|
|
20612
|
+
else {
|
|
20613
|
+
s5 = peg$FAILED;
|
|
20614
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20615
|
+
peg$fail(peg$c1214);
|
|
20616
|
+
}
|
|
20617
|
+
}
|
|
20618
|
+
if (s5 !== peg$FAILED) {
|
|
20619
|
+
s6 = peg$parseWS();
|
|
20620
|
+
if (s6 === peg$FAILED) {
|
|
20621
|
+
s6 = null;
|
|
20622
|
+
}
|
|
20623
|
+
if (s6 !== peg$FAILED) {
|
|
20624
|
+
peg$savedPos = s0;
|
|
20625
|
+
s1 = peg$c1580(s3);
|
|
20626
|
+
s0 = s1;
|
|
20627
|
+
}
|
|
20628
|
+
else {
|
|
20629
|
+
peg$currPos = s0;
|
|
20630
|
+
s0 = peg$FAILED;
|
|
20631
|
+
}
|
|
20632
|
+
}
|
|
20633
|
+
else {
|
|
20634
|
+
peg$currPos = s0;
|
|
20635
|
+
s0 = peg$FAILED;
|
|
20636
|
+
}
|
|
20637
|
+
}
|
|
20638
|
+
else {
|
|
20639
|
+
peg$currPos = s0;
|
|
20640
|
+
s0 = peg$FAILED;
|
|
20641
|
+
}
|
|
20642
|
+
}
|
|
20643
|
+
else {
|
|
20644
|
+
peg$currPos = s0;
|
|
20645
|
+
s0 = peg$FAILED;
|
|
20646
|
+
}
|
|
20647
|
+
}
|
|
20648
|
+
else {
|
|
20649
|
+
peg$currPos = s0;
|
|
20650
|
+
s0 = peg$FAILED;
|
|
20651
|
+
}
|
|
20652
|
+
}
|
|
20653
|
+
else {
|
|
20654
|
+
peg$currPos = s0;
|
|
20655
|
+
s0 = peg$FAILED;
|
|
20656
|
+
}
|
|
20657
|
+
peg$silentFails--;
|
|
20658
|
+
if (s0 === peg$FAILED) {
|
|
20659
|
+
s1 = peg$FAILED;
|
|
20660
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20661
|
+
peg$fail(peg$c1577);
|
|
20662
|
+
}
|
|
20663
|
+
}
|
|
20664
|
+
return s0;
|
|
20665
|
+
}
|
|
20484
20666
|
function peg$parseArrangeDeclaration() {
|
|
20485
20667
|
var s0;
|
|
20486
20668
|
peg$silentFails++;
|
|
@@ -20488,13 +20670,19 @@ function peg$parse(input, options) {
|
|
|
20488
20670
|
if (s0 === peg$FAILED) {
|
|
20489
20671
|
s0 = peg$parseArrangeEndDeclaration();
|
|
20490
20672
|
if (s0 === peg$FAILED) {
|
|
20491
|
-
s0 = peg$
|
|
20673
|
+
s0 = peg$parseOArrangeDeclaration();
|
|
20674
|
+
if (s0 === peg$FAILED) {
|
|
20675
|
+
s0 = peg$parseFArrangeDeclaration();
|
|
20676
|
+
if (s0 === peg$FAILED) {
|
|
20677
|
+
s0 = peg$parseRegularArrangeDeclaration();
|
|
20678
|
+
}
|
|
20679
|
+
}
|
|
20492
20680
|
}
|
|
20493
20681
|
}
|
|
20494
20682
|
peg$silentFails--;
|
|
20495
20683
|
if (s0 === peg$FAILED) {
|
|
20496
20684
|
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
20497
|
-
peg$fail(peg$
|
|
20685
|
+
peg$fail(peg$c1581);
|
|
20498
20686
|
}
|
|
20499
20687
|
}
|
|
20500
20688
|
return s0;
|
|
@@ -22395,7 +22583,8 @@ function compile_rule_handler(rule) {
|
|
|
22395
22583
|
return { agg_as: 'state_declaration', val: { state: rule.name, declarations: rule.value } };
|
|
22396
22584
|
}
|
|
22397
22585
|
if (['arrange_declaration', 'arrange_start_declaration',
|
|
22398
|
-
'arrange_end_declaration'
|
|
22586
|
+
'arrange_end_declaration', 'oarrange_declaration',
|
|
22587
|
+
'farrange_declaration'].includes(rule.key)) {
|
|
22399
22588
|
return { agg_as: rule.key, val: [rule.value] };
|
|
22400
22589
|
}
|
|
22401
22590
|
// things that can only exist once and are just a value under their own name
|
|
@@ -22601,6 +22790,8 @@ function compile(tree) {
|
|
|
22601
22790
|
arrange_declaration: [],
|
|
22602
22791
|
arrange_start_declaration: [],
|
|
22603
22792
|
arrange_end_declaration: [],
|
|
22793
|
+
oarrange_declaration: [],
|
|
22794
|
+
farrange_declaration: [],
|
|
22604
22795
|
machine_version: [],
|
|
22605
22796
|
default_state_config: [],
|
|
22606
22797
|
default_active_state_config: [],
|
|
@@ -22726,6 +22917,7 @@ function compile(tree) {
|
|
|
22726
22917
|
}
|
|
22727
22918
|
});
|
|
22728
22919
|
['arrange_declaration', 'arrange_start_declaration', 'arrange_end_declaration',
|
|
22920
|
+
'oarrange_declaration', 'farrange_declaration',
|
|
22729
22921
|
'machine_author', 'machine_contributor', 'machine_reference', 'theme',
|
|
22730
22922
|
'state_declaration', 'property_definition', 'default_state_config',
|
|
22731
22923
|
'default_start_state_config', 'default_end_state_config',
|
|
@@ -23396,7 +23588,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
23396
23588
|
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
23397
23589
|
* snapshots so that deserializers can detect version-skew.
|
|
23398
23590
|
*/
|
|
23399
|
-
const version = "5.
|
|
23591
|
+
const version = "5.153.0";
|
|
23400
23592
|
|
|
23401
23593
|
// whargarbl lots of these return arrays could/should be sets
|
|
23402
23594
|
const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
|
|
@@ -23713,7 +23905,7 @@ function find_connected_components(states, edges) {
|
|
|
23713
23905
|
}
|
|
23714
23906
|
class Machine {
|
|
23715
23907
|
// whargarbl this badly needs to be broken up, monolith master
|
|
23716
|
-
constructor({ start_states, end_states = [], failed_outputs = [], initial_state, start_states_no_enforce, complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, default_size, state_declaration, property_definition, state_property, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = ['default'], flow = 'down', graph_layout = 'dot', instance_name, history, boundary_depth_limit, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, default_transition_config, default_graph_config, group_registry, group_metadata, group_hooks, state_hooks, allows_override, config_allows_override, allow_islands, editor_config, rng_seed, time_source, timeout_source, clear_timeout_source }) {
|
|
23908
|
+
constructor({ start_states, end_states = [], failed_outputs = [], initial_state, start_states_no_enforce, complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, default_size, state_declaration, property_definition, state_property, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], oarrange_declaration = [], farrange_declaration = [], theme = ['default'], flow = 'down', graph_layout = 'dot', instance_name, history, boundary_depth_limit, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, default_transition_config, default_graph_config, group_registry, group_metadata, group_hooks, state_hooks, allows_override, config_allows_override, allow_islands, editor_config, rng_seed, time_source, timeout_source, clear_timeout_source }) {
|
|
23717
23909
|
this._time_source = time_source !== null && time_source !== void 0 ? time_source : (() => new Date().getTime());
|
|
23718
23910
|
this._create_started = this._time_source();
|
|
23719
23911
|
this._instance_name = instance_name;
|
|
@@ -23750,6 +23942,8 @@ class Machine {
|
|
|
23750
23942
|
this._arrange_declaration = arrange_declaration;
|
|
23751
23943
|
this._arrange_start_declaration = arrange_start_declaration;
|
|
23752
23944
|
this._arrange_end_declaration = arrange_end_declaration;
|
|
23945
|
+
this._oarrange_declaration = oarrange_declaration;
|
|
23946
|
+
this._farrange_declaration = farrange_declaration;
|
|
23753
23947
|
this._dot_preamble = dot_preamble;
|
|
23754
23948
|
this._themes = theme;
|
|
23755
23949
|
this._flow = flow;
|
|
@@ -24162,11 +24356,11 @@ class Machine {
|
|
|
24162
24356
|
}
|
|
24163
24357
|
this._created = this._time_source();
|
|
24164
24358
|
this.auto_set_state_timeout();
|
|
24165
|
-
this._arrange_declaration.forEach((arrange_pair) => arrange_pair.forEach((possibleState) => {
|
|
24359
|
+
[this._arrange_declaration, this._oarrange_declaration, this._farrange_declaration].forEach((declaration) => declaration.forEach((arrange_pair) => arrange_pair.forEach((possibleState) => {
|
|
24166
24360
|
if (!(this._states.has(possibleState))) {
|
|
24167
24361
|
throw new JssmError(this, `Cannot arrange state that does not exist "${possibleState}"`);
|
|
24168
24362
|
}
|
|
24169
|
-
}));
|
|
24363
|
+
})));
|
|
24170
24364
|
}
|
|
24171
24365
|
/********
|
|
24172
24366
|
*
|
|
@@ -24371,13 +24565,13 @@ class Machine {
|
|
|
24371
24565
|
* `;
|
|
24372
24566
|
*
|
|
24373
24567
|
* traffic_light.state(); // Off
|
|
24374
|
-
* traffic_light.props(); // { can_go: true, hesitate: true, stop_first: true
|
|
24568
|
+
* traffic_light.props(); // { can_go: true, hesitate: true, stop_first: true }
|
|
24375
24569
|
*
|
|
24376
24570
|
* traffic_light.go('Red');
|
|
24377
|
-
* traffic_light.props(); // { can_go: false, hesitate: true, stop_first: true
|
|
24571
|
+
* traffic_light.props(); // { can_go: false, hesitate: true, stop_first: true }
|
|
24378
24572
|
*
|
|
24379
24573
|
* traffic_light.go('Green');
|
|
24380
|
-
* traffic_light.props(); // { can_go: true, hesitate: false, stop_first: false
|
|
24574
|
+
* traffic_light.props(); // { can_go: true, hesitate: false, stop_first: false }
|
|
24381
24575
|
* ```
|
|
24382
24576
|
*
|
|
24383
24577
|
* @returns An object mapping every known property name to its current value
|
|
@@ -29164,6 +29358,11 @@ function colored_label(tr, which, color) {
|
|
|
29164
29358
|
function states_to_edges_string(u_jssm, l_states, state_index, state_kinds) {
|
|
29165
29359
|
const strike = new Set();
|
|
29166
29360
|
const kind_of = (s) => { var _a; return (_a = state_kinds.get(s)) !== null && _a !== void 0 ? _a : 'base'; };
|
|
29361
|
+
// `farrange` forces its members' left-to-right order by relaxing the rank
|
|
29362
|
+
// constraint of every real edge incident to a member, so the invisible
|
|
29363
|
+
// ordering chain (emitted in arranges_for) wins over the members' own edges.
|
|
29364
|
+
const farrange_members = new Set((u_jssm._farrange_declaration || []).flat().map(String));
|
|
29365
|
+
const cf = (s, ex) => (farrange_members.has(String(s)) || farrange_members.has(String(ex))) ? 'constraint=false;' : '';
|
|
29167
29366
|
// Render one solo directed edge `s -> ex` for transition `tr`.
|
|
29168
29367
|
const solo_edge = (s, ex, tr) => {
|
|
29169
29368
|
const ex_kind = kind_of(ex);
|
|
@@ -29173,7 +29372,7 @@ function states_to_edges_string(u_jssm, l_states, state_index, state_kinds) {
|
|
|
29173
29372
|
const maybeLabel = label ? `taillabel="${doublequote(label)}";` : '';
|
|
29174
29373
|
const arrowHead = arrow_for(tr);
|
|
29175
29374
|
const edgeInline = `${maybeLabel}arrowhead=${arrowHead};color="${line_color(ex_kind, tr.kind, '_solo')}"`;
|
|
29176
|
-
return `${node_of(s, state_index)}->${node_of(ex, state_index)} [${labelInline}${edgeInline}];`;
|
|
29375
|
+
return `${node_of(s, state_index)}->${node_of(ex, state_index)} [${cf(s, ex)}${labelInline}${edgeInline}];`;
|
|
29177
29376
|
};
|
|
29178
29377
|
return l_states.map((s) => u_jssm.list_exits(s).map((ex) => {
|
|
29179
29378
|
if (strike.has(`${s}|${ex}`)) {
|
|
@@ -29207,7 +29406,7 @@ function states_to_edges_string(u_jssm, l_states, state_index, state_kinds) {
|
|
|
29207
29406
|
const arrowTail = arrow_for(pair_tr);
|
|
29208
29407
|
const edgeInline = `${maybeLabel}${maybeRLabel}arrowhead=${arrowHead};arrowtail=${arrowTail};dir=both;color="${line_color(ex_kind, edge_tr.kind, '_1')}:${line_color(s_kind, pair_tr.kind, '_2')}"`;
|
|
29209
29408
|
strike.add(`${ex}|${s}`);
|
|
29210
|
-
return `${node_of(s, state_index)}->${node_of(ex, state_index)} [${labelInline}${edgeInline}];`;
|
|
29409
|
+
return `${node_of(s, state_index)}->${node_of(ex, state_index)} [${cf(s, ex)}${labelInline}${edgeInline}];`;
|
|
29211
29410
|
}
|
|
29212
29411
|
// one directed line per forward edge — parallel action edges (#325) and
|
|
29213
29412
|
// self-loops (#531) draw each transition separately. The reverse edges,
|
|
@@ -29216,8 +29415,15 @@ function states_to_edges_string(u_jssm, l_states, state_index, state_kinds) {
|
|
|
29216
29415
|
}).join(' ')).join(' ');
|
|
29217
29416
|
}
|
|
29218
29417
|
/**
|
|
29219
|
-
* Render `arrange`, `arrange_start`,
|
|
29220
|
-
* rank-grouped subgraphs (`rank=same`/`rank=min`/`rank=max`).
|
|
29418
|
+
* Render `arrange`, `arrange_start`, `arrange_end`, `oarrange`, and `farrange`
|
|
29419
|
+
* declarations to rank-grouped subgraphs (`rank=same`/`rank=min`/`rank=max`).
|
|
29420
|
+
*
|
|
29421
|
+
* `arrange*` emit only a rank group. `oarrange`/`farrange` additionally emit an
|
|
29422
|
+
* invisible left-to-right ordering chain (`a->b->c [style=invis]`) so the listed
|
|
29423
|
+
* states keep their written order on the rank. `oarrange` is best-effort (it
|
|
29424
|
+
* yields to hard rank constraints, never reshaping the graph); `farrange`'s
|
|
29425
|
+
* ordering is forced by also relaxing its members' real edges via
|
|
29426
|
+
* `constraint=false`, emitted in {@link states_to_edges_string}.
|
|
29221
29427
|
*
|
|
29222
29428
|
* @internal
|
|
29223
29429
|
*/
|
|
@@ -29225,9 +29431,16 @@ function arranges_for(u_jssm, state_index) {
|
|
|
29225
29431
|
const group = (decls, rank) => decls
|
|
29226
29432
|
? decls.map(d => `{rank=${rank}; ${d.map(di => node_of(di, state_index)).join('; ')};};`).join('\n')
|
|
29227
29433
|
: '';
|
|
29434
|
+
// For each group, an invisible chain pinning left-to-right order: one
|
|
29435
|
+
// `prev->cur [style=invis]` edge per adjacent pair (empty for <2 members).
|
|
29436
|
+
const order_chain = (decls) => decls
|
|
29437
|
+
? decls.map(d => d.slice(1).map((di, i) => `${node_of(d[i], state_index)}->${node_of(di, state_index)} [style=invis];`).join(' ')).join('\n')
|
|
29438
|
+
: '';
|
|
29228
29439
|
return group(u_jssm._arrange_declaration, 'same')
|
|
29229
29440
|
+ group(u_jssm._arrange_start_declaration, 'min')
|
|
29230
|
-
+ group(u_jssm._arrange_end_declaration, 'max')
|
|
29441
|
+
+ group(u_jssm._arrange_end_declaration, 'max')
|
|
29442
|
+
+ group(u_jssm._oarrange_declaration, 'same') + order_chain(u_jssm._oarrange_declaration)
|
|
29443
|
+
+ group(u_jssm._farrange_declaration, 'same') + order_chain(u_jssm._farrange_declaration);
|
|
29231
29444
|
}
|
|
29232
29445
|
/**
|
|
29233
29446
|
* Slugify a group name into the body of a Graphviz `cluster_…` subgraph
|