@statewalker/fsm-charts 0.2.4 → 0.2.6

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.
Files changed (155) hide show
  1. package/README.md +206 -1
  2. package/dist/StateChart-cXyVRcs-.d.ts +94 -0
  3. package/dist/StateChart-cXyVRcs-.d.ts.map +1 -0
  4. package/dist/StateChartIndex-BK2315qj.d.ts +142 -0
  5. package/dist/StateChartIndex-BK2315qj.d.ts.map +1 -0
  6. package/dist/StateChartIndex-BOIrc_nq.js +355 -0
  7. package/dist/StateChartIndex-BOIrc_nq.js.map +1 -0
  8. package/dist/buildStatechartsPanel-CxQlIwTh.js +494 -0
  9. package/dist/buildStatechartsPanel-CxQlIwTh.js.map +1 -0
  10. package/dist/buildStatechartsPanel-hCtZbdiF.d.ts +79 -0
  11. package/dist/buildStatechartsPanel-hCtZbdiF.d.ts.map +1 -0
  12. package/dist/defineProperty-C0rC37pP.js +39 -0
  13. package/dist/description-panels-DI2MNlbK.js +184 -0
  14. package/dist/description-panels-DI2MNlbK.js.map +1 -0
  15. package/dist/getLabelDimensions-BY0q7j3D.d.ts +79 -0
  16. package/dist/getLabelDimensions-BY0q7j3D.d.ts.map +1 -0
  17. package/dist/getPadding-Cw0e7G2v.js +25 -0
  18. package/dist/getPadding-Cw0e7G2v.js.map +1 -0
  19. package/dist/index-config.d.ts +3 -12
  20. package/dist/index-config.js +2 -1
  21. package/dist/index-dom.d.ts +2 -49
  22. package/dist/index-dom.js +2 -1
  23. package/dist/index-html.d.ts +3 -2
  24. package/dist/index-html.js +2 -2
  25. package/dist/index-layout.d.ts +3 -77
  26. package/dist/index-layout.js +2 -2
  27. package/dist/index-runtime.d.ts +3 -141
  28. package/dist/index-runtime.js +2 -1
  29. package/dist/index.d.ts +11 -10
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +6 -6
  32. package/dist/layout-Dp671N6q.js +2465 -0
  33. package/dist/layout-Dp671N6q.js.map +1 -0
  34. package/dist/newTreeBuilder-CvtLDjGj.d.ts +54 -0
  35. package/dist/newTreeBuilder-CvtLDjGj.d.ts.map +1 -0
  36. package/dist/toFsmStateConfig-DlJkyZni.js +135 -0
  37. package/dist/toFsmStateConfig-DlJkyZni.js.map +1 -0
  38. package/dist/toFsmStateConfig-DmOlTRjv.d.ts +15 -0
  39. package/dist/toFsmStateConfig-DmOlTRjv.d.ts.map +1 -0
  40. package/package.json +54 -28
  41. package/src/config/concatTransitionsToString.ts +4 -4
  42. package/src/config/index.ts +4 -4
  43. package/src/config/serializeProcessConfig.ts +3 -3
  44. package/src/config/splitTransitionString.ts +2 -4
  45. package/src/config/toFsmStateConfig.ts +5 -12
  46. package/src/dagre/acyclic.js +9 -10
  47. package/src/dagre/add-border-segments.js +11 -7
  48. package/src/dagre/coordinate-system.js +12 -12
  49. package/src/dagre/data/list.js +2 -2
  50. package/src/dagre/debug.d.ts +1 -1
  51. package/src/dagre/debug.js +11 -11
  52. package/src/dagre/greedy-fas.js +17 -21
  53. package/src/dagre/index.d.ts +4 -4
  54. package/src/dagre/index.js +4 -4
  55. package/src/dagre/layout.js +107 -96
  56. package/src/dagre/nesting-graph.js +13 -19
  57. package/src/dagre/normalize.js +7 -7
  58. package/src/dagre/order/add-subgraph-constraints.js +2 -2
  59. package/src/dagre/order/barycenter.d.ts +1 -1
  60. package/src/dagre/order/barycenter.js +4 -4
  61. package/src/dagre/order/build-layer-graph.d.ts +1 -1
  62. package/src/dagre/order/build-layer-graph.js +7 -9
  63. package/src/dagre/order/cross-count.js +14 -17
  64. package/src/dagre/order/index.js +19 -17
  65. package/src/dagre/order/init-order.js +5 -15
  66. package/src/dagre/order/resolve-conflicts.js +10 -14
  67. package/src/dagre/order/sort-subgraph.d.ts +1 -1
  68. package/src/dagre/order/sort-subgraph.js +13 -14
  69. package/src/dagre/order/sort.d.ts +1 -1
  70. package/src/dagre/order/sort.js +6 -10
  71. package/src/dagre/parent-dummy-chains.js +10 -4
  72. package/src/dagre/position/bk.d.ts +3 -3
  73. package/src/dagre/position/bk.js +84 -65
  74. package/src/dagre/position/index.js +7 -11
  75. package/src/dagre/rank/feasible-tree.d.ts +1 -1
  76. package/src/dagre/rank/feasible-tree.js +6 -6
  77. package/src/dagre/rank/index.js +6 -6
  78. package/src/dagre/rank/network-simplex.d.ts +0 -1
  79. package/src/dagre/rank/network-simplex.js +20 -25
  80. package/src/dagre/rank/util.js +2 -6
  81. package/src/dagre/util.d.ts +12 -6
  82. package/src/dagre/util.js +31 -37
  83. package/src/dom/buildSections.ts +15 -19
  84. package/src/dom/description-panels.ts +5 -7
  85. package/src/dom/getStatesDescriptions.ts +4 -10
  86. package/src/full/index.ts +1 -1
  87. package/src/full/toFsmStateCharts.ts +11 -11
  88. package/src/graphlib/alg/components.js +2 -2
  89. package/src/graphlib/alg/dfs.js +5 -5
  90. package/src/graphlib/alg/dijkstra-all.js +4 -4
  91. package/src/graphlib/alg/dijkstra.js +9 -12
  92. package/src/graphlib/alg/find-cycles.js +7 -5
  93. package/src/graphlib/alg/floyd-warshall.js +8 -11
  94. package/src/graphlib/alg/index.d.ts +11 -11
  95. package/src/graphlib/alg/index.js +11 -11
  96. package/src/graphlib/alg/is-acyclic.js +1 -1
  97. package/src/graphlib/alg/postorder.js +2 -2
  98. package/src/graphlib/alg/preorder.js +2 -2
  99. package/src/graphlib/alg/prim.d.ts +1 -1
  100. package/src/graphlib/alg/prim.js +5 -5
  101. package/src/graphlib/alg/tarjan.js +3 -3
  102. package/src/graphlib/alg/topsort.js +1 -1
  103. package/src/graphlib/data/priority-queue.js +8 -10
  104. package/src/graphlib/graph.js +53 -52
  105. package/src/graphlib/index.d.ts +2 -2
  106. package/src/graphlib/index.js +2 -2
  107. package/src/graphlib/json.d.ts +1 -1
  108. package/src/graphlib/json.js +6 -6
  109. package/src/html/buildStatechartCss.ts +2 -2
  110. package/src/html/buildStatechartStyles.ts +5 -15
  111. package/src/html/buildStatechartSvg.ts +8 -20
  112. package/src/html/buildStatechartsPanel.ts +3 -5
  113. package/src/html/index.ts +4 -4
  114. package/src/index-config.ts +2 -2
  115. package/src/index-dom.ts +1 -1
  116. package/src/index-html.ts +2 -2
  117. package/src/index-layout.ts +2 -2
  118. package/src/index-runtime.ts +2 -2
  119. package/src/index.ts +8 -8
  120. package/src/layout/buildCharts.ts +6 -7
  121. package/src/layout/buildFlatCharts.ts +17 -21
  122. package/src/layout/getGraphParamsProvider.ts +7 -19
  123. package/src/layout/getLabelDimensions.ts +5 -5
  124. package/src/layout/index.ts +5 -4
  125. package/src/lodash-es/index.ts +2 -2
  126. package/src/lodash-es/types.ts +37 -35
  127. package/src/runtime/RuntimeStatechartApi.ts +13 -46
  128. package/src/runtime/StateChartIndex.ts +7 -24
  129. package/src/runtime/index.ts +2 -2
  130. package/src/types/FsmStateConfig.ts +1 -1
  131. package/src/types/GraphParamsProvider.ts +3 -6
  132. package/src/types/Position.ts +1 -1
  133. package/src/types/StateChart.ts +2 -2
  134. package/src/types/StateGraphEdge.ts +2 -2
  135. package/src/types/StateGraphNode.ts +2 -2
  136. package/src/types/TransitionsGraph.ts +4 -4
  137. package/src/types/index.ts +11 -11
  138. package/src/utils/BasisCurve.ts +6 -15
  139. package/src/utils/domToText.ts +3 -7
  140. package/src/utils/getPadding.ts +2 -3
  141. package/src/utils/newId.ts +2 -1
  142. package/src/utils/newRegistry.ts +13 -13
  143. package/src/utils/serializeAttrs.ts +6 -14
  144. package/src/utils/serializeCss.ts +3 -7
  145. package/src/utils/serializeStyle.ts +2 -5
  146. package/src/utils/toKebabCase.ts +1 -4
  147. package/CHANGELOG.md +0 -1
  148. package/dist/StateChart-BYBjTmC2.d.ts +0 -82
  149. package/dist/chunk-36ZLXJVD.js +0 -606
  150. package/dist/chunk-AZBRQNTU.js +0 -2739
  151. package/dist/chunk-FIQDLBWD.js +0 -9
  152. package/dist/chunk-SVKVQY7B.js +0 -133
  153. package/dist/chunk-TZHCBZVP.js +0 -422
  154. package/dist/chunk-VILLJJJD.js +0 -231
  155. package/dist/index-html-DgSCNHkR.d.ts +0 -75
@@ -0,0 +1,39 @@
1
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/typeof.js
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5
+ return typeof o;
6
+ } : function(o) {
7
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8
+ }, _typeof(o);
9
+ }
10
+ //#endregion
11
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPrimitive.js
12
+ function toPrimitive(t, r) {
13
+ if ("object" != _typeof(t) || !t) return t;
14
+ var e = t[Symbol.toPrimitive];
15
+ if (void 0 !== e) {
16
+ var i = e.call(t, r || "default");
17
+ if ("object" != _typeof(i)) return i;
18
+ throw new TypeError("@@toPrimitive must return a primitive value.");
19
+ }
20
+ return ("string" === r ? String : Number)(t);
21
+ }
22
+ //#endregion
23
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPropertyKey.js
24
+ function toPropertyKey(t) {
25
+ var i = toPrimitive(t, "string");
26
+ return "symbol" == _typeof(i) ? i : i + "";
27
+ }
28
+ //#endregion
29
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/defineProperty.js
30
+ function _defineProperty(e, r, t) {
31
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
32
+ value: t,
33
+ enumerable: !0,
34
+ configurable: !0,
35
+ writable: !0
36
+ }) : e[r] = t, e;
37
+ }
38
+ //#endregion
39
+ export { _defineProperty as t };
@@ -0,0 +1,184 @@
1
+ //#region src/dom/newTreeBuilder.ts
2
+ function newTreeBuilder(context) {
3
+ let level = -1;
4
+ return (newLevel, ...params) => {
5
+ while (level >= 0 && level >= newLevel) context.exit(level--, ...params);
6
+ while (level < newLevel) context.enter(++level, ...params);
7
+ };
8
+ }
9
+ //#endregion
10
+ //#region src/dom/buildSections.ts
11
+ function buildSections(root) {
12
+ const nodes = toDomNodesIterator(root);
13
+ let top = null;
14
+ let peek = null;
15
+ const stack = [];
16
+ const aligner = newTreeBuilder({
17
+ enter(_level, header) {
18
+ const section = {
19
+ header,
20
+ content: [],
21
+ children: []
22
+ };
23
+ top = top || section;
24
+ peek?.children.push(section);
25
+ peek = section;
26
+ stack.push(section);
27
+ },
28
+ exit() {
29
+ stack.pop();
30
+ peek = stack[stack.length - 1];
31
+ }
32
+ });
33
+ aligner(0);
34
+ const headerLevels = [];
35
+ for (const node of nodes) if (isDomElement(node)) {
36
+ if (/^H[1-6]$/i.test(node.tagName)) {
37
+ const headerLevel = +node.tagName.replace(/^H/, "");
38
+ while (headerLevels.length > 0 && headerLevels[headerLevels.length - 1] >= headerLevel) headerLevels.pop();
39
+ headerLevels.push(headerLevel);
40
+ aligner(headerLevels.length, node);
41
+ } else peek.content.push(node);
42
+ } else peek.content.push(node);
43
+ return top.content.length === 0 && top.children.length === 1 && !top.header ? top.children[0] : top;
44
+ }
45
+ function* visitSectionNodes(section) {
46
+ if (section.header) yield section.header;
47
+ yield* section.content;
48
+ for (const s of vistSections(section, true)) yield* visitSectionNodes(s);
49
+ }
50
+ function* vistSections(root, ignoreRoot = false) {
51
+ !ignoreRoot && (yield root);
52
+ for (const child of root.children) yield* vistSections(child, false);
53
+ }
54
+ function findSection(section, accept) {
55
+ for (const s of vistSections(section)) if (accept(s) === true) return s;
56
+ }
57
+ function isDomElement(node) {
58
+ return node.nodeType === Node.ELEMENT_NODE;
59
+ }
60
+ function* toDomNodesIterator(root) {
61
+ yield* root instanceof Node ? visitDom(root) : root;
62
+ }
63
+ function* visitDom(elm) {
64
+ if (isDomElement(elm) && elm.tagName === "TEMPLATE") elm = elm.content;
65
+ for (let node = elm.firstChild; node; node = node.nextSibling) if (isDomElement(node)) {
66
+ if (node.tagName === "DIV" || node.tagName === "TEMPLATE") yield* visitDom(node);
67
+ else yield node;
68
+ } else yield node;
69
+ }
70
+ //#endregion
71
+ //#region src/dom/getStatesDescriptions.ts
72
+ function* visitStateDescriptions({ element, rootStateKey, removeFromDom = true, splitHeader = (header) => {
73
+ if (!header) return [void 0, ""];
74
+ const text = header.innerText.trim();
75
+ let key;
76
+ let label = text;
77
+ text.replace(/^\s*\[(.*)\]\s*(.*)$/, (_, k, l) => {
78
+ key = k.trim();
79
+ label = l.trim() || key;
80
+ return "";
81
+ });
82
+ return [key, label];
83
+ } }) {
84
+ const rootDescription = findSection(buildSections(element), (section) => {
85
+ if (!section.header) return false;
86
+ const [key] = splitHeader(section.header);
87
+ return key === rootStateKey;
88
+ });
89
+ if (!rootDescription) return;
90
+ if (removeFromDom) for (const node of visitSectionNodes(rootDescription)) {
91
+ if (node.nodeName[0] === "#") continue;
92
+ node.parentElement?.removeChild(node);
93
+ }
94
+ for (const section of vistSections(rootDescription, false)) {
95
+ if (!section.header) continue;
96
+ const [state, title] = splitHeader(section.header);
97
+ if (state) yield {
98
+ state,
99
+ title,
100
+ ...section
101
+ };
102
+ }
103
+ }
104
+ function getStatesDescriptions(options) {
105
+ const index = {};
106
+ for (const description of visitStateDescriptions(options)) index[description.state] = description;
107
+ return index;
108
+ }
109
+ //#endregion
110
+ //#region src/dom/description-panels.ts
111
+ function getStateDescriptionRenderer(options) {
112
+ const descriptionsIndex = getStatesDescriptions(options);
113
+ return (statesStack) => {
114
+ const stateKey = [...statesStack].pop();
115
+ if (!stateKey) return;
116
+ const section = descriptionsIndex[stateKey];
117
+ if (!section) return;
118
+ const elm = renderSections({
119
+ section,
120
+ deep: (_section) => false,
121
+ header: (section) => {
122
+ if (section.state === stateKey) return section.title || section.state;
123
+ }
124
+ });
125
+ const details = elm?.querySelector("details");
126
+ if (details) details.open = true;
127
+ return elm;
128
+ };
129
+ }
130
+ function renderSections({ section, deep = (_s) => true, header = (section) => section.header?.cloneNode(true) }) {
131
+ const container = document.createElement("div");
132
+ const id = `id-${String(Math.random()).split(".")[1]}-${Date.now()}`;
133
+ container.setAttribute("id", id);
134
+ if (!section) return container;
135
+ const sectionView = renderSection(section);
136
+ container.append(sectionView);
137
+ const style = renderSectionStyles(id);
138
+ container.append(style);
139
+ return container;
140
+ function renderSectionStyles(id) {
141
+ const prefix = id ? `#${id}` : "";
142
+ const style = document.createElement("style");
143
+ container.appendChild(style);
144
+ style.innerHTML = `
145
+ ${prefix} details {
146
+ border: 1px solid #aaa;
147
+ border-radius: 4px;
148
+ padding: 0.5em 0.5em 0;
149
+ margin-bottom: 0.5em;
150
+ }
151
+
152
+ ${prefix} details > summary {
153
+ font-weight: bold;
154
+ margin: -0.5em -0.5em 0;
155
+ padding: 0.5em;
156
+ cursor: pointer;
157
+ }
158
+
159
+ ${prefix} details[open] {
160
+ padding: 0.5em;
161
+ }
162
+ `;
163
+ return style;
164
+ }
165
+ function renderSection(section) {
166
+ const details = document.createElement("details");
167
+ const summary = document.createElement("summary");
168
+ details.appendChild(summary);
169
+ const content = document.createElement("div");
170
+ details.appendChild(content);
171
+ const headerElm = header(section);
172
+ headerElm && summary.append(headerElm);
173
+ for (const node of section.content) {
174
+ if (node.nodeName[0] === "#") continue;
175
+ content.append(node.cloneNode(true));
176
+ }
177
+ if (deep(section)) for (const child of section.children) content.append(renderSection(child));
178
+ return details;
179
+ }
180
+ }
181
+ //#endregion
182
+ export { buildSections as a, toDomNodesIterator as c, vistSections as d, newTreeBuilder as f, visitStateDescriptions as i, visitDom as l, renderSections as n, findSection as o, getStatesDescriptions as r, isDomElement as s, getStateDescriptionRenderer as t, visitSectionNodes as u };
183
+
184
+ //# sourceMappingURL=description-panels-DI2MNlbK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"description-panels-DI2MNlbK.js","names":[],"sources":["../src/dom/newTreeBuilder.ts","../src/dom/buildSections.ts","../src/dom/getStatesDescriptions.ts","../src/dom/description-panels.ts"],"sourcesContent":["export function newTreeBuilder<T extends unknown[] = []>(context: {\n enter: (level: number, ...params: T) => void;\n exit: (level: number, ...params: T) => void;\n}) {\n let level = -1;\n return (newLevel: number, ...params: T) => {\n while (level >= 0 && level >= newLevel) {\n context.exit(level--, ...params);\n }\n while (level < newLevel) {\n context.enter(++level, ...params);\n }\n };\n}\n","import { newTreeBuilder } from \"./newTreeBuilder.js\";\n\nexport type DomSection = {\n header?: HTMLElement;\n content: Node[];\n children: DomSection[];\n};\n\nexport function buildSections(root: HTMLElement | Iterable<Node>): DomSection {\n const nodes = toDomNodesIterator(root);\n let top: DomSection = null!;\n let peek: DomSection = null!;\n const stack: DomSection[] = [];\n const aligner = newTreeBuilder<[HTMLElement?]>({\n enter(_level, header) {\n const section: DomSection = {\n header,\n content: [],\n children: [],\n };\n top = top || section;\n peek?.children.push(section);\n peek = section;\n stack.push(section);\n },\n exit() {\n stack.pop();\n peek = stack[stack.length - 1];\n },\n });\n aligner(0);\n // Track the actual header magnitudes of the open ancestor sections. A header of\n // level L closes every open header at its level or deeper, then opens at the\n // resulting depth. Deriving depth from the real magnitudes (not a ±1 delta) keeps\n // nesting correct for any header sequence and never goes negative.\n const headerLevels: number[] = [];\n for (const node of nodes) {\n if (isDomElement(node)) {\n if (/^H[1-6]$/i.test(node.tagName)) {\n const headerLevel = +node.tagName.replace(/^H/, \"\");\n while (headerLevels.length > 0 && headerLevels[headerLevels.length - 1] >= headerLevel) {\n headerLevels.pop();\n }\n headerLevels.push(headerLevel);\n aligner(headerLevels.length, node);\n } else {\n peek.content.push(node);\n }\n } else {\n peek.content.push(node);\n }\n }\n return top.content.length === 0 && top.children.length === 1 && !top.header\n ? top.children[0]\n : top;\n}\n\nexport function* visitSectionNodes(section: DomSection): Iterable<Node> {\n if (section.header) yield section.header;\n yield* section.content;\n for (const s of vistSections(section, true)) {\n yield* visitSectionNodes(s);\n }\n}\n\nexport function* vistSections(\n root: DomSection,\n ignoreRoot: boolean = false,\n): Generator<DomSection> {\n !ignoreRoot && (yield root);\n for (const child of root.children) {\n yield* vistSections(child, false);\n }\n}\n\nexport function findSection(section: DomSection, accept: (section: DomSection) => boolean) {\n for (const s of vistSections(section)) {\n if (accept(s) === true) return s;\n }\n return undefined;\n}\n\n// --------------------------------------------\n// DOM Iterator utilities\n\nexport function isDomElement(node: Node): node is HTMLElement {\n return node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport function* toDomNodesIterator(root: Node | Iterable<Node>): Iterable<Node> {\n yield* root instanceof Node ? visitDom(root) : root;\n}\n\nexport function* visitDom(elm: Node): Iterable<Node> {\n if (isDomElement(elm) && elm.tagName === \"TEMPLATE\") {\n elm = (elm as HTMLTemplateElement).content;\n }\n for (let node = elm.firstChild; node; node = node.nextSibling) {\n if (isDomElement(node)) {\n if (node.tagName === \"DIV\" || node.tagName === \"TEMPLATE\") {\n yield* visitDom(node);\n } else {\n yield node;\n }\n } else {\n yield node;\n }\n }\n}\n","import {\n buildSections,\n type DomSection,\n findSection,\n visitSectionNodes,\n vistSections,\n} from \"./buildSections.js\";\n\nexport type StateDescriptionSection = DomSection & {\n state: string;\n title?: string;\n};\nexport function* visitStateDescriptions({\n element,\n rootStateKey,\n removeFromDom = true,\n splitHeader = (header?: HTMLElement): [stateKey: undefined | string, label: string] => {\n if (!header) return [undefined, \"\"];\n const text = header.innerText.trim();\n let key: string | undefined;\n let label: string = text;\n text.replace(/^\\s*\\[(.*)\\]\\s*(.*)$/, (_, k, l) => {\n key = k.trim();\n label = l.trim() || key;\n return \"\";\n });\n return [key, label];\n },\n}: {\n element: HTMLElement;\n rootStateKey: string;\n removeFromDom?: boolean; // If true - removes state description nodes from the DOM\n splitHeader?: (header?: HTMLElement) => [stateKey: undefined | string, label: string];\n}): Generator<StateDescriptionSection> {\n const docSections = buildSections(element);\n const rootDescription = findSection(docSections, (section: DomSection) => {\n if (!section.header) return false;\n const [key] = splitHeader(section.header);\n return key === rootStateKey;\n });\n if (!rootDescription) return;\n\n // Remove description nodes from DOM\n if (removeFromDom) {\n for (const node of visitSectionNodes(rootDescription)) {\n if (node.nodeName[0] === \"#\") continue;\n node.parentElement?.removeChild(node);\n }\n }\n\n for (const section of vistSections(rootDescription, false)) {\n if (!section.header) continue;\n const [state, title] = splitHeader(section.header);\n if (state)\n yield {\n state,\n title,\n ...section,\n };\n }\n}\n\nexport function getStatesDescriptions(options: {\n element: HTMLElement;\n rootStateKey: string;\n removeFromDom?: boolean; // If true - removes state description nodes from the DOM\n splitHeader?: (header?: HTMLElement) => [stateKey: undefined | string, label: string];\n}): { [state: string]: StateDescriptionSection } {\n const index: { [state: string]: StateDescriptionSection } = {};\n for (const description of visitStateDescriptions(options)) {\n index[description.state] = description;\n }\n return index;\n}\n","import type { DomSection } from \"./buildSections.js\";\nimport { getStatesDescriptions } from \"./getStatesDescriptions.js\";\n\nexport function getStateDescriptionRenderer(options: {\n element: HTMLElement;\n rootStateKey: string;\n splitHeader?: (header?: HTMLElement) => [stateKey: undefined | string, label: string];\n}) {\n const descriptionsIndex = getStatesDescriptions(options);\n\n return (statesStack: string[]) => {\n const stateKey: string | undefined = [...statesStack].pop();\n if (!stateKey) return;\n\n const section = descriptionsIndex[stateKey];\n if (!section) return;\n\n const elm = renderSections({\n section,\n deep: (_section) => false, // section.state !== options.rootStateKey, // ???\n header: (section) => {\n if (section.state === stateKey) {\n return section.title || section.state;\n }\n return;\n },\n });\n const details = elm?.querySelector(\"details\");\n if (details) details.open = true;\n return elm;\n };\n}\n\nexport function renderSections<T extends DomSection>({\n section,\n deep = (_s) => true,\n header = (section) => section.header?.cloneNode(true) as Node,\n}: {\n section: T;\n deep?: (s: T) => boolean;\n header?: (section: T) => undefined | string | Node;\n}) {\n const container = document.createElement(\"div\");\n const id = `id-${String(Math.random()).split(\".\")[1]}-${Date.now()}`;\n container.setAttribute(\"id\", id);\n if (!section) return container;\n\n const sectionView = renderSection(section);\n container.append(sectionView);\n const style = renderSectionStyles(id);\n container.append(style);\n return container;\n\n function renderSectionStyles(id?: string) {\n const prefix = id ? `#${id}` : \"\";\n const style = document.createElement(\"style\");\n container.appendChild(style);\n style.innerHTML = `\n ${prefix} details {\n border: 1px solid #aaa;\n border-radius: 4px;\n padding: 0.5em 0.5em 0;\n margin-bottom: 0.5em;\n }\n \n ${prefix} details > summary {\n font-weight: bold;\n margin: -0.5em -0.5em 0;\n padding: 0.5em;\n cursor: pointer;\n }\n \n ${prefix} details[open] {\n padding: 0.5em;\n }\n `;\n return style;\n }\n function renderSection(section: T) {\n const details = document.createElement(\"details\");\n const summary = document.createElement(\"summary\");\n details.appendChild(summary);\n const content = document.createElement(\"div\");\n details.appendChild(content);\n const headerElm = header(section);\n headerElm && summary.append(headerElm);\n for (const node of section.content) {\n if (node.nodeName[0] === \"#\") continue;\n content.append(node.cloneNode(true));\n }\n if (deep(section)) {\n for (const child of section.children) {\n content.append(renderSection(child as T));\n }\n }\n return details;\n }\n}\n"],"mappings":";AAAA,SAAgB,eAAyC,SAGtD;CACD,IAAI,QAAQ;CACZ,QAAQ,UAAkB,GAAG,WAAc;EACzC,OAAO,SAAS,KAAK,SAAS,UAC5B,QAAQ,KAAK,SAAS,GAAG,MAAM;EAEjC,OAAO,QAAQ,UACb,QAAQ,MAAM,EAAE,OAAO,GAAG,MAAM;CAEpC;AACF;;;ACLA,SAAgB,cAAc,MAAgD;CAC5E,MAAM,QAAQ,mBAAmB,IAAI;CACrC,IAAI,MAAkB;CACtB,IAAI,OAAmB;CACvB,MAAM,QAAsB,CAAC;CAC7B,MAAM,UAAU,eAA+B;EAC7C,MAAM,QAAQ,QAAQ;GACpB,MAAM,UAAsB;IAC1B;IACA,SAAS,CAAC;IACV,UAAU,CAAC;GACb;GACA,MAAM,OAAO;GACb,MAAM,SAAS,KAAK,OAAO;GAC3B,OAAO;GACP,MAAM,KAAK,OAAO;EACpB;EACA,OAAO;GACL,MAAM,IAAI;GACV,OAAO,MAAM,MAAM,SAAS;EAC9B;CACF,CAAC;CACD,QAAQ,CAAC;CAKT,MAAM,eAAyB,CAAC;CAChC,KAAK,MAAM,QAAQ,OACjB,IAAI,aAAa,IAAI,GAAG;EACtB,IAAI,YAAY,KAAK,KAAK,OAAO,GAAG;GAClC,MAAM,cA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AQ,UAC1B,QAAQ,OAAO,cAAc,KAAU,CAAC;EAG5C,OAAO;CACT;AACF"}
@@ -0,0 +1,79 @@
1
+ import { l as FsmStateConfig, n as TransitionsGraph, o as Padding, s as GraphParamsProvider, t as StateChart, u as Transition } from "./StateChart-cXyVRcs-.js";
2
+ //#region src/layout/buildCharts.d.ts
3
+ /**
4
+ * Build graphs corresponding to the specified transitions.
5
+ * @param config - State configuration with transitions and sub-states.
6
+ * @param newId - A function that generates unique ids for nodes and edges.
7
+ * @param getStateParams - A function that returns the dimensions of a state node.
8
+ * @param getTransitionParams - A function that returns the dimensions of a transition edge.
9
+ * @param initialStateKey - The key for the initial state.
10
+ * @param finalStateKey - The key for the final state.
11
+ * @returns {StateChart} - The graph with nodes and edges.
12
+ */
13
+ declare function buildCharts({ lodash, config, newId, getStateParams, getStateLabel, getTransitionParams, padding, vertical, initialStateKey, finalStateKey, direction }: {
14
+ config: FsmStateConfig;
15
+ lodash: any;
16
+ newId: (prefix: string) => string;
17
+ initialStateKey?: string;
18
+ finalStateKey?: string;
19
+ padding?: Padding;
20
+ vertical?: boolean;
21
+ direction?: "tb" | "bt" | "lr" | "rl";
22
+ getStateLabel?: (stateKey: string) => string | undefined;
23
+ } & GraphParamsProvider): StateChart;
24
+ //#endregion
25
+ //#region src/layout/buildFlatCharts.d.ts
26
+ /**
27
+ * Build graphs corresponding to the specified transitions.
28
+ * @param transitions - The transitions between states.
29
+ * @param newId - A function that generates unique ids for nodes and edges.
30
+ * @param getStateParams - A function that returns the dimensions of a state node.
31
+ * @param getTransitionParams - A function that returns the dimensions of a transition edge.
32
+ * @param initialStateKey - The key for the initial state.
33
+ * @param finalStateKey - The key for the final state.
34
+ * @param vertical - Whether the graph should be vertical.
35
+ * @returns {TransitionsGraph} - The graph with nodes and edges.
36
+ */
37
+ declare function buildFlatCharts({ lodash, transitions, newId, getStateParams, getTransitionParams, padding, initialStateKey, finalStateKey, vertical, direction }: {
38
+ transitions?: Transition[];
39
+ lodash: any;
40
+ newId: (prefix: string) => string;
41
+ initialStateKey?: string;
42
+ finalStateKey?: string;
43
+ vertical?: boolean;
44
+ padding?: Padding;
45
+ direction?: "tb" | "bt" | "lr" | "rl";
46
+ } & GraphParamsProvider): TransitionsGraph;
47
+ //#endregion
48
+ //#region src/layout/getGraphParamsProvider.d.ts
49
+ /**
50
+ * Provides default functions measuring dimensions for state nodes and transition edges in the graph.
51
+ * @param fontSize - The font size for the state and transition labels.
52
+ * @param stateFontSize - The font size for the state labels.
53
+ * @param stateTextPadding - The padding around the state labels.
54
+ * @param transitionsFontSize - The font size for the transition labels.
55
+ * @param transitionsTextPadding - The padding around the transition labels.
56
+ */
57
+ declare function getGraphParamsProvider({ fontSize, stateFontSize, stateTextPadding, transitionsFontSize, transitionsTextPadding, getStateLabel, getTransitionLabel }?: {
58
+ fontSize?: number;
59
+ stateFontSize?: number;
60
+ stateTextPadding?: Padding;
61
+ transitionsFontSize?: number;
62
+ transitionsTextPadding?: Padding;
63
+ getStateLabel?: (state: string) => string;
64
+ getTransitionLabel?: (fromState: string, event: string, toState: string) => string;
65
+ }): GraphParamsProvider;
66
+ //#endregion
67
+ //#region src/layout/getLabelDimensions.d.ts
68
+ declare function getLabelDimensions(label: string, { padding, fontSize, getCharWidth, lineGap }?: {
69
+ padding?: Padding;
70
+ fontSize?: number;
71
+ getCharWidth?: (char: string) => number;
72
+ lineGap?: number;
73
+ }): {
74
+ width: number;
75
+ height: number;
76
+ };
77
+ //#endregion
78
+ export { buildCharts as i, getGraphParamsProvider as n, buildFlatCharts as r, getLabelDimensions as t };
79
+ //# sourceMappingURL=getLabelDimensions-BY0q7j3D.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLabelDimensions-BY0q7j3D.d.ts","names":[],"sources":["../src/layout/buildCharts.ts","../src/layout/buildFlatCharts.ts","../src/layout/getGraphParamsProvider.ts","../src/layout/getLabelDimensions.ts"],"mappings":";;;;;;;;;;;;iBAgBgB,cACd,QACA,QACA,OACA,gBACA,eACA,qBACA,SACA,UACA,iBACA,eACA;EAEA,QAAQ;EACR;EACA,QAAQ;EACR;EACA;EACA,UAAU;EACV;EACA;EACA,iBAAiB;IACf,sBAAsB;;;;;;;;;;;;;;iBCbV,kBACd,QACA,aACA,OACA,gBACA,qBACA,SACA,iBACA,eACA,UACA;EAEA,cAAc;EACd;EACA,QAAQ;EACR;EACA;EACA;EACA,UAAU;EACV;IACE,sBAAsB;;;;;;;;;;;iBChCV,yBACd,UACA,eACA,kBACA,qBACA,wBACA,eACA;EAEA;EACA;EACA,mBAAmB;EACnB;EACA,yBAAyB;EACzB,iBAAiB;EACjB,sBAAsB,mBAAmB,eAAe;IACjD;;;iBCzBO,mBACd,iBAEE,SACA,UACA,cACA;EAEA,UAAU;EACV;EACA,gBAAgB;EAChB;;EAmBA;EACA"}
@@ -0,0 +1,25 @@
1
+ //#region src/utils/getPadding.ts
2
+ /**
3
+ * Expands a padding value to a 4-element array: [top, right, bottom, left].
4
+ * @param padding padding value to expand
5
+ * @returns a 4-element array representing the padding
6
+ */
7
+ function getPadding(padding) {
8
+ if (typeof padding === "number") return [
9
+ padding,
10
+ padding,
11
+ padding,
12
+ padding
13
+ ];
14
+ if (padding.length === 2) return [
15
+ padding[0],
16
+ padding[1],
17
+ padding[0],
18
+ padding[1]
19
+ ];
20
+ return padding;
21
+ }
22
+ //#endregion
23
+ export { getPadding as t };
24
+
25
+ //# sourceMappingURL=getPadding-Cw0e7G2v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPadding-Cw0e7G2v.js","names":[],"sources":["../src/utils/getPadding.ts"],"sourcesContent":["import type { Padding } from \"../types/Padding.js\";\n\n/**\n * Expands a padding value to a 4-element array: [top, right, bottom, left].\n * @param padding padding value to expand\n * @returns a 4-element array representing the padding\n */\nexport function getPadding(padding: Padding): [number, number, number, number] {\n if (typeof padding === \"number\") return [padding, padding, padding, padding];\n if (padding.length === 2) return [padding[0], padding[1], padding[0], padding[1]];\n return padding;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,WAAW,SAAoD;CAC7E,IAAI,OAAO,YAAY,UAAU,OAAO;EAAC;EAAS;EAAS;EAAS;CAAO;CAC3E,IAAI,QAAQ,WAAW,GAAG,OAAO;EAAC,QAAQ;EAAI,QAAQ;EAAI,QAAQ;EAAI,QAAQ;CAAE;CAChF,OAAO;AACT"}
@@ -1,12 +1,3 @@
1
- import { T as Transition, F as FsmStateConfig } from './StateChart-BYBjTmC2.js';
2
- export { D as Dimensions, G as GraphParamsProvider, L as Label, P as Padding, a as Position, S as StateChart, b as StateGraphEdge, c as StateGraphNode, d as TransitionsGraph } from './StateChart-BYBjTmC2.js';
3
-
4
- declare function concatTransitionsToString(transitions: Transition[]): string[];
5
-
6
- declare function serializeProcessConfig(config: FsmStateConfig | undefined): string;
7
-
8
- declare function splitTransitionString(str: string): Transition[];
9
-
10
- declare function toFsmStateConfig(json: any): FsmStateConfig | undefined;
11
-
12
- export { FsmStateConfig, Transition, concatTransitionsToString, serializeProcessConfig, splitTransitionString, toFsmStateConfig };
1
+ import { a as Position, c as Label, d as Dimensions, i as StateGraphNode, l as FsmStateConfig, n as TransitionsGraph, o as Padding, r as StateGraphEdge, s as GraphParamsProvider, t as StateChart, u as Transition } from "./StateChart-cXyVRcs-.js";
2
+ import { i as concatTransitionsToString, n as splitTransitionString, r as serializeProcessConfig, t as toFsmStateConfig } from "./toFsmStateConfig-DmOlTRjv.js";
3
+ export { type Dimensions, type FsmStateConfig, type GraphParamsProvider, type Label, type Padding, type Position, type StateChart, type StateGraphEdge, type StateGraphNode, type Transition, type TransitionsGraph, concatTransitionsToString, serializeProcessConfig, splitTransitionString, toFsmStateConfig };
@@ -1 +1,2 @@
1
- export { concatTransitionsToString, serializeProcessConfig, splitTransitionString, toFsmStateConfig } from './chunk-SVKVQY7B.js';
1
+ import { i as concatTransitionsToString, n as splitTransitionString, r as serializeProcessConfig, t as toFsmStateConfig } from "./toFsmStateConfig-DlJkyZni.js";
2
+ export { concatTransitionsToString, serializeProcessConfig, splitTransitionString, toFsmStateConfig };
@@ -1,49 +1,2 @@
1
- type DomSection = {
2
- header?: HTMLElement;
3
- content: Node[];
4
- children: DomSection[];
5
- };
6
- declare function buildSections(root: HTMLElement | Iterable<Node>): DomSection;
7
- declare function visitSectionNodes(section: DomSection): Iterable<Node>;
8
- declare function vistSections(root: DomSection, ignoreRoot?: boolean): Generator<DomSection>;
9
- declare function findSection(section: DomSection, accept: (section: DomSection) => boolean): DomSection | undefined;
10
- declare function isDomElement(node: Node): node is HTMLElement;
11
- declare function toDomNodesIterator(root: Node | Iterable<Node>): Iterable<Node>;
12
- declare function visitDom(elm: Node): Iterable<Node>;
13
-
14
- declare function getStateDescriptionRenderer(options: {
15
- element: HTMLElement;
16
- rootStateKey: string;
17
- splitHeader?: (header?: HTMLElement) => [stateKey: undefined | string, label: string];
18
- }): (statesStack: string[]) => HTMLDivElement | undefined;
19
- declare function renderSections<T extends DomSection>({ section, deep, header, }: {
20
- section: T;
21
- deep?: (s: T) => boolean;
22
- header?: (section: T) => undefined | string | Node;
23
- }): HTMLDivElement;
24
-
25
- type StateDescriptionSection = DomSection & {
26
- state: string;
27
- title?: string;
28
- };
29
- declare function visitStateDescriptions({ element, rootStateKey, removeFromDom, splitHeader, }: {
30
- element: HTMLElement;
31
- rootStateKey: string;
32
- removeFromDom?: boolean;
33
- splitHeader?: (header?: HTMLElement) => [stateKey: undefined | string, label: string];
34
- }): Generator<StateDescriptionSection>;
35
- declare function getStatesDescriptions(options: {
36
- element: HTMLElement;
37
- rootStateKey: string;
38
- removeFromDom?: boolean;
39
- splitHeader?: (header?: HTMLElement) => [stateKey: undefined | string, label: string];
40
- }): {
41
- [state: string]: StateDescriptionSection;
42
- };
43
-
44
- declare function newTreeBuilder<T extends unknown[] = []>(context: {
45
- enter: (level: number, ...params: T) => void;
46
- exit: (level: number, ...params: T) => void;
47
- }): (newLevel: number, ...params: T) => void;
48
-
49
- export { type DomSection, type StateDescriptionSection, buildSections, findSection, getStateDescriptionRenderer, getStatesDescriptions, isDomElement, newTreeBuilder, renderSections, toDomNodesIterator, visitDom, visitSectionNodes, visitStateDescriptions, vistSections };
1
+ import { a as getStateDescriptionRenderer, c as buildSections, d as toDomNodesIterator, f as visitDom, i as visitStateDescriptions, l as findSection, m as vistSections, n as StateDescriptionSection, o as renderSections, p as visitSectionNodes, r as getStatesDescriptions, s as DomSection, t as newTreeBuilder, u as isDomElement } from "./newTreeBuilder-CvtLDjGj.js";
2
+ export { DomSection, StateDescriptionSection, buildSections, findSection, getStateDescriptionRenderer, getStatesDescriptions, isDomElement, newTreeBuilder, renderSections, toDomNodesIterator, visitDom, visitSectionNodes, visitStateDescriptions, vistSections };
package/dist/index-dom.js CHANGED
@@ -1 +1,2 @@
1
- export { buildSections, findSection, getStateDescriptionRenderer, getStatesDescriptions, isDomElement, newTreeBuilder, renderSections, toDomNodesIterator, visitDom, visitSectionNodes, visitStateDescriptions, vistSections } from './chunk-VILLJJJD.js';
1
+ import { a as buildSections, c as toDomNodesIterator, d as vistSections, f as newTreeBuilder, i as visitStateDescriptions, l as visitDom, n as renderSections, o as findSection, r as getStatesDescriptions, s as isDomElement, t as getStateDescriptionRenderer, u as visitSectionNodes } from "./description-panels-DI2MNlbK.js";
2
+ export { buildSections, findSection, getStateDescriptionRenderer, getStatesDescriptions, isDomElement, newTreeBuilder, renderSections, toDomNodesIterator, visitDom, visitSectionNodes, visitStateDescriptions, vistSections };
@@ -1,2 +1,3 @@
1
- export { D as Dimensions, F as FsmStateConfig, G as GraphParamsProvider, L as Label, P as Padding, a as Position, S as StateChart, b as StateGraphEdge, c as StateGraphNode, T as Transition, d as TransitionsGraph } from './StateChart-BYBjTmC2.js';
2
- export { c as activeStatesStyle, d as activeTransitionsStyle, f as buildStateDetailsStyle, g as buildStateDetailsStyleWithModifier, b as buildStatechartCss, i as buildStatechartStyles, h as buildStatechartStylesWithModifier, j as buildStatechartSvg, a as buildStatechartsPanel, s as selectedStatesStyle, e as selectedTransitionsStyle } from './index-html-DgSCNHkR.js';
1
+ import { a as Position, c as Label, d as Dimensions, i as StateGraphNode, l as FsmStateConfig, n as TransitionsGraph, o as Padding, r as StateGraphEdge, s as GraphParamsProvider, t as StateChart, u as Transition } from "./StateChart-cXyVRcs-.js";
2
+ import { a as buildStateDetailsStyle, c as buildStatechartStylesWithModifier, i as activeTransitionsStyle, l as selectedStatesStyle, n as buildStatechartSvg, o as buildStateDetailsStyleWithModifier, p as buildStatechartCss, r as activeStatesStyle, s as buildStatechartStyles, t as buildStatechartsPanel, u as selectedTransitionsStyle } from "./buildStatechartsPanel-hCtZbdiF.js";
3
+ export { type Dimensions, type FsmStateConfig, type GraphParamsProvider, type Label, type Padding, type Position, type StateChart, type StateGraphEdge, type StateGraphNode, type Transition, type TransitionsGraph, activeStatesStyle, activeTransitionsStyle, buildStateDetailsStyle, buildStateDetailsStyleWithModifier, buildStatechartCss, buildStatechartStyles, buildStatechartStylesWithModifier, buildStatechartSvg, buildStatechartsPanel, selectedStatesStyle, selectedTransitionsStyle };
@@ -1,2 +1,2 @@
1
- export { activeStatesStyle, activeTransitionsStyle, buildStateDetailsStyle, buildStateDetailsStyleWithModifier, buildStatechartCss, buildStatechartStyles, buildStatechartStylesWithModifier, buildStatechartSvg, buildStatechartsPanel, selectedStatesStyle, selectedTransitionsStyle } from './chunk-36ZLXJVD.js';
2
- import './chunk-FIQDLBWD.js';
1
+ import { a as activeTransitionsStyle, c as buildStatechartStyles, d as selectedTransitionsStyle, i as activeStatesStyle, l as buildStatechartStylesWithModifier, n as buildStatechartSvg, o as buildStateDetailsStyle, r as buildStatechartCss, s as buildStateDetailsStyleWithModifier, t as buildStatechartsPanel, u as selectedStatesStyle } from "./buildStatechartsPanel-CxQlIwTh.js";
2
+ export { activeStatesStyle, activeTransitionsStyle, buildStateDetailsStyle, buildStateDetailsStyleWithModifier, buildStatechartCss, buildStatechartStyles, buildStatechartStylesWithModifier, buildStatechartSvg, buildStatechartsPanel, selectedStatesStyle, selectedTransitionsStyle };
@@ -1,77 +1,3 @@
1
- import { T as Transition, P as Padding, G as GraphParamsProvider, d as TransitionsGraph, F as FsmStateConfig, S as StateChart } from './StateChart-BYBjTmC2.js';
2
- export { D as Dimensions, L as Label, a as Position, b as StateGraphEdge, c as StateGraphNode } from './StateChart-BYBjTmC2.js';
3
-
4
- /**
5
- * Build graphs corresponding to the specified transitions.
6
- * @param transitions - The transitions between states.
7
- * @param newId - A function that generates unique ids for nodes and edges.
8
- * @param getStateParams - A function that returns the dimensions of a state node.
9
- * @param getTransitionParams - A function that returns the dimensions of a transition edge.
10
- * @param initialStateKey - The key for the initial state.
11
- * @param finalStateKey - The key for the final state.
12
- * @param vertical - Whether the graph should be vertical.
13
- * @returns {TransitionsGraph} - The graph with nodes and edges.
14
- */
15
- declare function buildFlatCharts({ lodash, transitions, newId, getStateParams, getTransitionParams, padding, initialStateKey, finalStateKey, vertical, direction, }: {
16
- transitions?: Transition[];
17
- lodash: any;
18
- newId: (prefix: string) => string;
19
- initialStateKey?: string;
20
- finalStateKey?: string;
21
- vertical?: boolean;
22
- padding?: Padding;
23
- direction?: "tb" | "bt" | "lr" | "rl";
24
- } & GraphParamsProvider): TransitionsGraph;
25
-
26
- /**
27
- * Build graphs corresponding to the specified transitions.
28
- * @param config - State configuration with transitions and sub-states.
29
- * @param newId - A function that generates unique ids for nodes and edges.
30
- * @param getStateParams - A function that returns the dimensions of a state node.
31
- * @param getTransitionParams - A function that returns the dimensions of a transition edge.
32
- * @param initialStateKey - The key for the initial state.
33
- * @param finalStateKey - The key for the final state.
34
- * @returns {StateChart} - The graph with nodes and edges.
35
- */
36
- declare function buildCharts({ lodash, config, newId, getStateParams, getStateLabel, getTransitionParams, padding, vertical, initialStateKey, finalStateKey, direction, }: {
37
- config: FsmStateConfig;
38
- lodash: any;
39
- newId: (prefix: string) => string;
40
- initialStateKey?: string;
41
- finalStateKey?: string;
42
- padding?: Padding;
43
- vertical?: boolean;
44
- direction?: "tb" | "bt" | "lr" | "rl";
45
- getStateLabel?: (stateKey: string) => string | undefined;
46
- } & GraphParamsProvider): StateChart;
47
-
48
- /**
49
- * Provides default functions measuring dimensions for state nodes and transition edges in the graph.
50
- * @param fontSize - The font size for the state and transition labels.
51
- * @param stateFontSize - The font size for the state labels.
52
- * @param stateTextPadding - The padding around the state labels.
53
- * @param transitionsFontSize - The font size for the transition labels.
54
- * @param transitionsTextPadding - The padding around the transition labels.
55
- */
56
- declare function getGraphParamsProvider({ fontSize, stateFontSize, stateTextPadding, transitionsFontSize, transitionsTextPadding, getStateLabel, getTransitionLabel, }?: {
57
- fontSize?: number;
58
- stateFontSize?: number;
59
- stateTextPadding?: Padding;
60
- transitionsFontSize?: number;
61
- transitionsTextPadding?: Padding;
62
- getStateLabel?: (state: string) => string;
63
- getTransitionLabel?: (fromState: string, event: string, toState: string) => string;
64
- }): GraphParamsProvider;
65
-
66
- declare function getLabelDimensions(label: string, { padding, fontSize, getCharWidth, // Golden ratio and all that jazz :-)
67
- lineGap, }?: {
68
- padding?: Padding;
69
- fontSize?: number;
70
- getCharWidth?: (char: string) => number;
71
- lineGap?: number;
72
- }): {
73
- width: number;
74
- height: number;
75
- };
76
-
77
- export { FsmStateConfig, GraphParamsProvider, Padding, StateChart, Transition, TransitionsGraph, buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions };
1
+ import { a as Position, c as Label, d as Dimensions, i as StateGraphNode, l as FsmStateConfig, n as TransitionsGraph, o as Padding, r as StateGraphEdge, s as GraphParamsProvider, t as StateChart, u as Transition } from "./StateChart-cXyVRcs-.js";
2
+ import { i as buildCharts, n as getGraphParamsProvider, r as buildFlatCharts, t as getLabelDimensions } from "./getLabelDimensions-BY0q7j3D.js";
3
+ export { type Dimensions, type FsmStateConfig, type GraphParamsProvider, type Label, type Padding, type Position, type StateChart, type StateGraphEdge, type StateGraphNode, type Transition, type TransitionsGraph, buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions };
@@ -1,2 +1,2 @@
1
- export { buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions } from './chunk-AZBRQNTU.js';
2
- import './chunk-FIQDLBWD.js';
1
+ import { i as buildFlatCharts, n as getLabelDimensions, r as buildCharts, t as getGraphParamsProvider } from "./layout-Dp671N6q.js";
2
+ export { buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions };