@ai-digital-factory/state-flow 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2026 coupleaddagaming@gmail.com. All rights reserved.
2
+
3
+ State Flow is proprietary software. No license is granted by downloading,
4
+ accessing, or receiving this software or its documentation. All third-party
5
+ use, including personal, noncommercial and commercial use, requires prior
6
+ written permission from the copyright holder. Copying, modifying, distributing,
7
+ sublicensing or incorporating this software into another product also requires
8
+ prior written permission. Request permission at coupleaddagaming@gmail.com.
9
+
10
+ Any permission granted separately is governed by its written terms. This notice
11
+ does not alter the licenses of third-party dependencies or bundled third-party
12
+ materials; their respective licenses continue to apply.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO MERCHANTABILITY, FITNESS FOR A PARTICULAR
16
+ PURPOSE AND NONINFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
17
+ THE COPYRIGHT HOLDER IS NOT LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
18
+ ARISING FROM THE SOFTWARE OR ITS USE.
package/README.md CHANGED
@@ -1,3 +1,25 @@
1
- # Temporary Holding Version
1
+ # @ai-digital-factory/state-flow
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ React library for flow-style state (states, transitions, and related UI). See repository `CONTEXT.md` for domain vocabulary.
4
+
5
+ ## Application chart authoring (TSX, no React app)
6
+
7
+ Chart-only projects declare flows as `.tsx` modules using `Flow`, `State`, and `Transition`. They do not install `react` or `@types/react`.
8
+
9
+ Extend the chart preset (TypeScript requires `jsx` for `.tsx`; the preset supplies it):
10
+
11
+ ```json
12
+ {
13
+ "extends": "@ai-digital-factory/state-flow/tsconfig.charts.json",
14
+ "include": ["src/**/*.tsx"]
15
+ }
16
+ ```
17
+
18
+ Or set the same options yourself, including `"types": ["@ai-digital-factory/state-flow/types"]` and `"jsx": "react-jsx"`.
19
+
20
+ Preview and in-app rendering supply React at runtime via the State Flow CLI or your React consumer.
21
+
22
+ ## License
23
+
24
+ Proprietary software. All third-party use requires prior written permission from
25
+ coupleaddagaming@gmail.com. See LICENSE.
@@ -0,0 +1,106 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { ApplicationChartDefinition } from '@ai-digital-factory/state-flow-chart';
3
+ export { ApplicationHookContext, DEFAULT_TRANSITION_NAME, DefaultTransitionName, STATE_APPLICATION_HOOK_EXPORT_NAMES, TRANSITION_APPLICATION_HOOK_EXPORT_NAMES, TransitionHookContext } from '@ai-digital-factory/state-flow-chart';
4
+
5
+ declare function StateFlowPlaceholder(): ReactElement;
6
+
7
+ type FlowProps = {
8
+ /** Lowercase kebab-case chart identifier (e.g. `visitor-access`). Enforced by chart check. */
9
+ name: string;
10
+ description: string;
11
+ default: string;
12
+ children?: ReactNode;
13
+ };
14
+ declare function Flow({ name, description, default: defaultStateName, children, }: FlowProps): ReactElement;
15
+ declare namespace Flow {
16
+ var displayName: string;
17
+ }
18
+
19
+ type StateProps = {
20
+ id?: string;
21
+ name: string;
22
+ description: string;
23
+ children?: ReactNode;
24
+ };
25
+ /** Declares a flow state; rendered by `Flow`, not directly. */
26
+ declare function State(_props: StateProps): null;
27
+ declare namespace State {
28
+ var displayName: string;
29
+ }
30
+
31
+ type TransitionProps = {
32
+ to: string;
33
+ name: string;
34
+ description: string;
35
+ children?: ReactNode;
36
+ };
37
+ /** Declares an allowed transition; rendered by `Flow`, not directly. */
38
+ declare function Transition(_props: TransitionProps): null;
39
+ declare namespace Transition {
40
+ var displayName: string;
41
+ }
42
+
43
+ type ApplicationChartRendererProps = {
44
+ chart: ApplicationChartDefinition;
45
+ };
46
+ declare function ApplicationChartRenderer({ chart, }: ApplicationChartRendererProps): ReactElement;
47
+
48
+ type ChartPageHeaderProps = {
49
+ title: string;
50
+ description: string;
51
+ /** Lowercase kebab-case chart id; picks a header icon when set. */
52
+ chartId?: string;
53
+ };
54
+ declare function ChartPageHeader({ title, description, chartId, }: ChartPageHeaderProps): ReactElement;
55
+
56
+ declare function ChartHeaderIcon({ chartId, }: {
57
+ chartId?: string;
58
+ }): ReactElement;
59
+ declare function chartNavIcon(chartId: string): string;
60
+
61
+ type ParsedTransition = {
62
+ fromId: string;
63
+ fromName: string;
64
+ toId: string;
65
+ toName: string;
66
+ name: string;
67
+ description: string;
68
+ };
69
+ type ParsedState = {
70
+ id: string;
71
+ name: string;
72
+ description: string;
73
+ };
74
+ type ParsedChart = {
75
+ states: ParsedState[];
76
+ edges: ParsedTransition[];
77
+ initialId: string;
78
+ };
79
+
80
+ type DiagramOverviewProps = {
81
+ svgHtml: string;
82
+ states: ParsedState[];
83
+ edges: ParsedTransition[];
84
+ /** When set, sync zoom, pan, and diagram focus to the page URL query string. */
85
+ viewPersistenceKey?: string;
86
+ /** Highlight a transition edge after a guard blocks (simulate). */
87
+ guardBlockedEdgeIndex?: number | null;
88
+ /** Stack detail below the diagram, or show state/transition aside (tool viewers). */
89
+ detailLayout?: "inline" | "split";
90
+ /** When set with `detailLayout="split"`, pre-select this state in the aside. */
91
+ initialStateId?: string;
92
+ };
93
+ declare function DiagramOverview({ svgHtml, states, edges, viewPersistenceKey, guardBlockedEdgeIndex, detailLayout, initialStateId, }: DiagramOverviewProps): ReactElement;
94
+
95
+ /** Forward edges run above the states; return edges run below them. */
96
+ declare function diagramSvg(chart: ParsedChart, title: string, instanceId: string): string;
97
+
98
+ declare function parseScrollYFromSearch(search: string): number | null;
99
+ declare function mergeScrollYIntoSearch(search: string, scrollY: number): string;
100
+ declare function replaceBrowserUrlSearch(search: string): void;
101
+
102
+ declare function extractApplicationChartDefinition(node: ReactNode): ApplicationChartDefinition;
103
+ type ApplicationChartComponent = () => ReactNode;
104
+ declare function extractApplicationChartDefinitionFromComponent(component: ApplicationChartComponent): ApplicationChartDefinition;
105
+
106
+ export { type ApplicationChartComponent, ApplicationChartRenderer, type ApplicationChartRendererProps, ChartHeaderIcon, ChartPageHeader, type ChartPageHeaderProps, DiagramOverview, type DiagramOverviewProps, Flow, type FlowProps, State, StateFlowPlaceholder, type StateProps, Transition, type TransitionProps, chartNavIcon, diagramSvg, extractApplicationChartDefinition, extractApplicationChartDefinitionFromComponent, mergeScrollYIntoSearch, parseScrollYFromSearch, replaceBrowserUrlSearch };