jssm 5.133.0 → 5.134.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/dist/cdn/viz.js +421 -2
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/deno/README.md +7 -7
- package/dist/deno/jssm.d.ts +131 -1
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_types.d.ts +208 -1
- 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 +337 -0
- package/jssm.es6.d.ts +337 -0
- package/jssm_viz.es5.d.cts +337 -0
- package/jssm_viz.es6.d.ts +337 -0
- package/package.json +1 -1
|
@@ -699,4 +699,211 @@ declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
|
|
|
699
699
|
* made reproducible.
|
|
700
700
|
*/
|
|
701
701
|
declare type JssmRng = () => number;
|
|
702
|
-
|
|
702
|
+
/**
|
|
703
|
+
* All event names that {@link Machine.on} accepts. These are observation
|
|
704
|
+
* events fired by the machine in addition to (not in place of) the hook
|
|
705
|
+
* system. Hooks intercept; events observe.
|
|
706
|
+
*
|
|
707
|
+
* @see Machine.on
|
|
708
|
+
*/
|
|
709
|
+
declare type JssmEventName = 'transition' | 'rejection' | 'action' | 'entry' | 'exit' | 'terminal' | 'complete' | 'error' | 'data-change' | 'override' | 'timeout' | 'hook-registration' | 'hook-removal';
|
|
710
|
+
/**
|
|
711
|
+
* Detail payload fired with a `transition` event. Carries the resolved
|
|
712
|
+
* source and target, the action name (if the transition was driven by an
|
|
713
|
+
* action), the data observed before and after the change, the edge kind,
|
|
714
|
+
* and whether the call was a forced transition.
|
|
715
|
+
*/
|
|
716
|
+
declare type JssmTransitionEventDetail<mDT> = {
|
|
717
|
+
from: StateType;
|
|
718
|
+
to: StateType;
|
|
719
|
+
action?: StateType;
|
|
720
|
+
data: mDT;
|
|
721
|
+
next_data?: mDT;
|
|
722
|
+
trans_type: string | undefined;
|
|
723
|
+
forced: boolean;
|
|
724
|
+
};
|
|
725
|
+
/**
|
|
726
|
+
* Detail payload fired with a `rejection` event. Carries the resolved
|
|
727
|
+
* source and target plus an indication of who rejected the transition
|
|
728
|
+
* and why. `reason` is `'invalid'` when no edge existed, `'hook'` when
|
|
729
|
+
* a hook handler vetoed; `hook_name` is set when `reason` is `'hook'`.
|
|
730
|
+
*/
|
|
731
|
+
declare type JssmRejectionEventDetail<mDT> = {
|
|
732
|
+
from: StateType;
|
|
733
|
+
to: StateType;
|
|
734
|
+
action?: StateType;
|
|
735
|
+
data: mDT;
|
|
736
|
+
next_data?: mDT;
|
|
737
|
+
reason: 'invalid' | 'hook';
|
|
738
|
+
hook_name?: string;
|
|
739
|
+
forced: boolean;
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* Detail payload fired with an `action` event. Fires when an action is
|
|
743
|
+
* attempted, before transition validation runs.
|
|
744
|
+
*/
|
|
745
|
+
declare type JssmActionEventDetail<mDT> = {
|
|
746
|
+
action: StateType;
|
|
747
|
+
from: StateType;
|
|
748
|
+
to?: StateType;
|
|
749
|
+
data: mDT;
|
|
750
|
+
next_data?: mDT;
|
|
751
|
+
};
|
|
752
|
+
/**
|
|
753
|
+
* Detail payload fired with an `entry` event. `state` is the entered
|
|
754
|
+
* state. `from` is the predecessor state, if any. `action` is the
|
|
755
|
+
* action that drove the entry, if any.
|
|
756
|
+
*/
|
|
757
|
+
declare type JssmEntryEventDetail<mDT> = {
|
|
758
|
+
state: StateType;
|
|
759
|
+
from?: StateType;
|
|
760
|
+
action?: StateType;
|
|
761
|
+
data: mDT;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* Detail payload fired with an `exit` event. `state` is the exited
|
|
765
|
+
* state. `to` is the next state, if any. `action` is the action that
|
|
766
|
+
* drove the exit, if any.
|
|
767
|
+
*/
|
|
768
|
+
declare type JssmExitEventDetail<mDT> = {
|
|
769
|
+
state: StateType;
|
|
770
|
+
to?: StateType;
|
|
771
|
+
action?: StateType;
|
|
772
|
+
data: mDT;
|
|
773
|
+
};
|
|
774
|
+
/**
|
|
775
|
+
* Detail payload fired with a `terminal` event. Indicates that the
|
|
776
|
+
* machine has reached a state with no outgoing edges.
|
|
777
|
+
*/
|
|
778
|
+
declare type JssmTerminalEventDetail<mDT> = {
|
|
779
|
+
state: StateType;
|
|
780
|
+
data: mDT;
|
|
781
|
+
};
|
|
782
|
+
/**
|
|
783
|
+
* Detail payload fired with a `complete` event. Indicates that the
|
|
784
|
+
* machine has reached a FSL `complete` state.
|
|
785
|
+
*/
|
|
786
|
+
declare type JssmCompleteEventDetail<mDT> = {
|
|
787
|
+
state: StateType;
|
|
788
|
+
data: mDT;
|
|
789
|
+
};
|
|
790
|
+
/**
|
|
791
|
+
* Detail payload fired with an `error` event. Wraps an exception caught
|
|
792
|
+
* while running an event handler; `source_event` and `source_detail`
|
|
793
|
+
* identify the event whose handler threw, and `handler` is the offending
|
|
794
|
+
* function so consumers can correlate / blame.
|
|
795
|
+
*/
|
|
796
|
+
declare type JssmErrorEventDetail = {
|
|
797
|
+
error: unknown;
|
|
798
|
+
source_event: JssmEventName;
|
|
799
|
+
source_detail: unknown;
|
|
800
|
+
handler: Function;
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* Detail payload fired with a `data-change` event. Fires whenever the
|
|
804
|
+
* machine's data payload is replaced. `old_data` is the value before the
|
|
805
|
+
* change; `new_data` is the value after.
|
|
806
|
+
*/
|
|
807
|
+
declare type JssmDataChangeEventDetail<mDT> = {
|
|
808
|
+
from?: StateType;
|
|
809
|
+
to?: StateType;
|
|
810
|
+
action?: StateType;
|
|
811
|
+
old_data: mDT;
|
|
812
|
+
new_data: mDT;
|
|
813
|
+
cause: 'transition' | 'override';
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Detail payload fired with an `override` event. Distinguishes a forced
|
|
817
|
+
* state replacement from a normal transition.
|
|
818
|
+
*/
|
|
819
|
+
declare type JssmOverrideEventDetail<mDT> = {
|
|
820
|
+
from: StateType;
|
|
821
|
+
to: StateType;
|
|
822
|
+
old_data: mDT;
|
|
823
|
+
new_data?: mDT;
|
|
824
|
+
};
|
|
825
|
+
/**
|
|
826
|
+
* Detail payload fired with a `timeout` event. Fires when a configured
|
|
827
|
+
* `after` clause causes an automatic transition.
|
|
828
|
+
*/
|
|
829
|
+
declare type JssmTimeoutEventDetail = {
|
|
830
|
+
from: StateType;
|
|
831
|
+
to: StateType;
|
|
832
|
+
after_time: number;
|
|
833
|
+
};
|
|
834
|
+
/**
|
|
835
|
+
* Detail payload fired with `hook-registration` and `hook-removal` events.
|
|
836
|
+
* Mirrors the {@link HookDescription} so inspector tools can mirror the
|
|
837
|
+
* current hook set.
|
|
838
|
+
*/
|
|
839
|
+
declare type JssmHookLifecycleEventDetail<mDT> = {
|
|
840
|
+
description: HookDescription<mDT>;
|
|
841
|
+
};
|
|
842
|
+
/**
|
|
843
|
+
* Mapped type from {@link JssmEventName} to the corresponding detail
|
|
844
|
+
* payload. Drives the discriminated-union typing of {@link Machine.on},
|
|
845
|
+
* so `e.action` and friends only exist where they're meaningful.
|
|
846
|
+
*/
|
|
847
|
+
declare type JssmEventDetailMap<mDT> = {
|
|
848
|
+
'transition': JssmTransitionEventDetail<mDT>;
|
|
849
|
+
'rejection': JssmRejectionEventDetail<mDT>;
|
|
850
|
+
'action': JssmActionEventDetail<mDT>;
|
|
851
|
+
'entry': JssmEntryEventDetail<mDT>;
|
|
852
|
+
'exit': JssmExitEventDetail<mDT>;
|
|
853
|
+
'terminal': JssmTerminalEventDetail<mDT>;
|
|
854
|
+
'complete': JssmCompleteEventDetail<mDT>;
|
|
855
|
+
'error': JssmErrorEventDetail;
|
|
856
|
+
'data-change': JssmDataChangeEventDetail<mDT>;
|
|
857
|
+
'override': JssmOverrideEventDetail<mDT>;
|
|
858
|
+
'timeout': JssmTimeoutEventDetail;
|
|
859
|
+
'hook-registration': JssmHookLifecycleEventDetail<mDT>;
|
|
860
|
+
'hook-removal': JssmHookLifecycleEventDetail<mDT>;
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* Filter accepted by {@link Machine.on} / {@link Machine.once} for an
|
|
864
|
+
* individual event name. Only events whose detail key matches every
|
|
865
|
+
* filter entry fire the handler. Events that don't list a filter key in
|
|
866
|
+
* v1 take no filter properties.
|
|
867
|
+
*/
|
|
868
|
+
declare type JssmEventFilterMap<mDT> = {
|
|
869
|
+
'transition': {
|
|
870
|
+
from?: StateType;
|
|
871
|
+
to?: StateType;
|
|
872
|
+
};
|
|
873
|
+
'rejection': Record<string, never>;
|
|
874
|
+
'action': Record<string, never>;
|
|
875
|
+
'entry': {
|
|
876
|
+
state?: StateType;
|
|
877
|
+
};
|
|
878
|
+
'exit': {
|
|
879
|
+
state?: StateType;
|
|
880
|
+
};
|
|
881
|
+
'terminal': Record<string, never>;
|
|
882
|
+
'complete': Record<string, never>;
|
|
883
|
+
'error': Record<string, never>;
|
|
884
|
+
'data-change': Record<string, never>;
|
|
885
|
+
'override': Record<string, never>;
|
|
886
|
+
'timeout': Record<string, never>;
|
|
887
|
+
'hook-registration': Record<string, never>;
|
|
888
|
+
'hook-removal': Record<string, never>;
|
|
889
|
+
};
|
|
890
|
+
/**
|
|
891
|
+
* Per-event filter object (as passed to {@link Machine.on}). Use
|
|
892
|
+
* `JssmEventDetailMap<mDT>[Ev]` to find the matching detail type.
|
|
893
|
+
* @typeparam mDT The type of the machine data member.
|
|
894
|
+
* @typeparam Ev The event name.
|
|
895
|
+
*/
|
|
896
|
+
declare type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev];
|
|
897
|
+
/**
|
|
898
|
+
* Per-event handler signature. Receives a detail object typed by event
|
|
899
|
+
* name, so `e.action` (etc.) only exist where they're meaningful.
|
|
900
|
+
* @typeparam mDT The type of the machine data member.
|
|
901
|
+
* @typeparam Ev The event name.
|
|
902
|
+
*/
|
|
903
|
+
declare type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
904
|
+
/**
|
|
905
|
+
* Function returned by {@link Machine.on} and {@link Machine.once} that
|
|
906
|
+
* removes the subscription. Calling it more than once is a no-op.
|
|
907
|
+
*/
|
|
908
|
+
declare type JssmUnsubscribe = () => void;
|
|
909
|
+
export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmAllowsOverride, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, EverythingHookContext, EverythingHookHandler, PostEverythingHookHandler, JssmEventName, JssmEventDetailMap, JssmEventFilterMap, JssmEventFilter, JssmEventHandler, JssmUnsubscribe, JssmTransitionEventDetail, JssmRejectionEventDetail, JssmActionEventDetail, JssmEntryEventDetail, JssmExitEventDetail, JssmTerminalEventDetail, JssmCompleteEventDetail, JssmErrorEventDetail, JssmDataChangeEventDetail, JssmOverrideEventDetail, JssmTimeoutEventDetail, JssmHookLifecycleEventDetail, JssmRng };
|