@soonspacejs/plugin-flow 2.13.6 → 2.13.7

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 (60) hide show
  1. package/README.md +4 -4
  2. package/dist/index.esm.js +1881 -1
  3. package/dist/index.esm.js.map +1 -0
  4. package/package.json +3 -3
  5. package/test/test.ts +118 -118
  6. package/dist/flows/ComponentFlowParser.d.ts +0 -8
  7. package/dist/flows/FlowParser.d.ts +0 -46
  8. package/dist/flows/edges/index.d.ts +0 -9
  9. package/dist/flows/index.d.ts +0 -4
  10. package/dist/flows/nodes/ColorNode.d.ts +0 -8
  11. package/dist/flows/nodes/ConditionNode.d.ts +0 -9
  12. package/dist/flows/nodes/DataExtractionNode.d.ts +0 -8
  13. package/dist/flows/nodes/DataFilterNode.d.ts +0 -8
  14. package/dist/flows/nodes/DelayNode.d.ts +0 -8
  15. package/dist/flows/nodes/EmissiveNode.d.ts +0 -10
  16. package/dist/flows/nodes/FlyToNode.d.ts +0 -8
  17. package/dist/flows/nodes/HideNode.d.ts +0 -10
  18. package/dist/flows/nodes/HighlightNode.d.ts +0 -10
  19. package/dist/flows/nodes/MeshNode.d.ts +0 -8
  20. package/dist/flows/nodes/MeshesNode.d.ts +0 -8
  21. package/dist/flows/nodes/ModelNode.d.ts +0 -8
  22. package/dist/flows/nodes/ModelsNode.d.ts +0 -8
  23. package/dist/flows/nodes/Node.d.ts +0 -48
  24. package/dist/flows/nodes/NumberNode.d.ts +0 -8
  25. package/dist/flows/nodes/OpacityNode.d.ts +0 -10
  26. package/dist/flows/nodes/POINode.d.ts +0 -8
  27. package/dist/flows/nodes/POISNode.d.ts +0 -8
  28. package/dist/flows/nodes/PathNode.d.ts +0 -8
  29. package/dist/flows/nodes/PathsNode.d.ts +0 -8
  30. package/dist/flows/nodes/RotateNode.d.ts +0 -8
  31. package/dist/flows/nodes/ScaleNode.d.ts +0 -8
  32. package/dist/flows/nodes/ShowNode.d.ts +0 -10
  33. package/dist/flows/nodes/SpaceNode.d.ts +0 -8
  34. package/dist/flows/nodes/SpacesNode.d.ts +0 -8
  35. package/dist/flows/nodes/StartNode.d.ts +0 -7
  36. package/dist/flows/nodes/TranslateNode.d.ts +0 -8
  37. package/dist/flows/nodes/UnEmissiveNode.d.ts +0 -10
  38. package/dist/flows/nodes/UnHighlightNode.d.ts +0 -10
  39. package/dist/flows/nodes/UnOpacityNode.d.ts +0 -10
  40. package/dist/flows/nodes/clip-animation/ClipAnimationNode.d.ts +0 -8
  41. package/dist/flows/nodes/clip-animation/UnClipAnimationNode.d.ts +0 -8
  42. package/dist/flows/nodes/clip-animation/index.d.ts +0 -2
  43. package/dist/flows/nodes/component-tween-animation/ComponentTweenAnimationNode.d.ts +0 -8
  44. package/dist/flows/nodes/component-tween-animation/UnComponentTweenAnimationNode.d.ts +0 -8
  45. package/dist/flows/nodes/component-tween-animation/index.d.ts +0 -2
  46. package/dist/flows/nodes/component-tween-animation/utils.d.ts +0 -5
  47. package/dist/flows/nodes/index.d.ts +0 -33
  48. package/dist/flows/nodes/tween-animation/TweenAnimationNode.d.ts +0 -8
  49. package/dist/flows/nodes/tween-animation/UnTweenAnimationNode.d.ts +0 -8
  50. package/dist/flows/nodes/tween-animation/index.d.ts +0 -2
  51. package/dist/flows/nodes/tween-animation/utils.d.ts +0 -5
  52. package/dist/flows/types.d.ts +0 -106
  53. package/dist/flows/utils.d.ts +0 -12
  54. package/dist/index.d.ts +0 -3
  55. package/dist/triggers/ComponentTrigger.d.ts +0 -18
  56. package/dist/triggers/Trigger.d.ts +0 -27
  57. package/dist/triggers/index.d.ts +0 -3
  58. package/dist/triggers/types.d.ts +0 -54
  59. package/dist/triggers/utils.d.ts +0 -2
  60. package/dist/types.d.ts +0 -16
@@ -1,10 +0,0 @@
1
- import { Object3D } from 'three';
2
- import { FlowParser } from '../FlowParser';
3
- import { NodeGlobalType, NodeType } from '../types';
4
- import { Node } from './Node';
5
- declare class UnOpacityNode extends Node {
6
- constructor(parser: FlowParser, node: NodeType);
7
- filterUnOpacityObject(objectsValue: Object3D[] | Object3D): Object3D<import("three").Object3DEventMap>[];
8
- exec(global: NodeGlobalType): Promise<void>;
9
- }
10
- export { UnOpacityNode, };
@@ -1,8 +0,0 @@
1
- import { FlowParser } from '../../FlowParser';
2
- import { NodeGlobalType, NodeType } from '../../types';
3
- import { Node } from '../Node';
4
- declare class ClipAnimationNode extends Node {
5
- constructor(parser: FlowParser, node: NodeType);
6
- exec(global: NodeGlobalType): Promise<void>;
7
- }
8
- export { ClipAnimationNode, };
@@ -1,8 +0,0 @@
1
- import { FlowParser } from '../../FlowParser';
2
- import { NodeGlobalType, NodeType } from '../../types';
3
- import { Node } from '../Node';
4
- declare class UnClipAnimationNode extends Node {
5
- constructor(parser: FlowParser, node: NodeType);
6
- exec(global: NodeGlobalType): Promise<void>;
7
- }
8
- export { UnClipAnimationNode, };
@@ -1,2 +0,0 @@
1
- export { ClipAnimationNode, } from './ClipAnimationNode';
2
- export { UnClipAnimationNode, } from './UnClipAnimationNode';
@@ -1,8 +0,0 @@
1
- import { FlowParser } from '../../FlowParser';
2
- import { NodeType, NodeGlobalType } from '../../types';
3
- import { Node } from '../Node';
4
- declare class ComponentTweenAnimationNode extends Node {
5
- constructor(parser: FlowParser, node: NodeType);
6
- exec(global: NodeGlobalType): Promise<void>;
7
- }
8
- export { ComponentTweenAnimationNode, };
@@ -1,8 +0,0 @@
1
- import { FlowParser } from '../../FlowParser';
2
- import { NodeType } from '../../types';
3
- import { Node } from '../Node';
4
- declare class UnComponentTweenAnimationNode extends Node {
5
- constructor(parser: FlowParser, node: NodeType);
6
- exec(): Promise<void>;
7
- }
8
- export { UnComponentTweenAnimationNode, };
@@ -1,2 +0,0 @@
1
- export { ComponentTweenAnimationNode, } from './ComponentTweenAnimationNode';
2
- export { UnComponentTweenAnimationNode, } from './UnComponentTweenAnimationNode';
@@ -1,5 +0,0 @@
1
- import { Object3D } from 'three';
2
- import SoonSpace from 'soonspacejs';
3
- import { IComponentAnimation } from '../../../types';
4
- export declare function playComponentTweenAnimation(ssp: SoonSpace, object: Object3D, componentAnimation: IComponentAnimation): Promise<void>;
5
- export declare function stopComponentTweenAnimation(animationId: string): void;
@@ -1,33 +0,0 @@
1
- export { Node, } from './Node';
2
- export { StartNode, } from './StartNode';
3
- export { ColorNode, } from './ColorNode';
4
- export { NumberNode, } from './NumberNode';
5
- export { HighlightNode, } from './HighlightNode';
6
- export { UnHighlightNode, } from './UnHighlightNode';
7
- export { OpacityNode, } from './OpacityNode';
8
- export { UnOpacityNode, } from './UnOpacityNode';
9
- export { EmissiveNode, } from './EmissiveNode';
10
- export { UnEmissiveNode, } from './UnEmissiveNode';
11
- export { MeshNode, } from './MeshNode';
12
- export { MeshesNode, } from './MeshesNode';
13
- export { ModelNode, } from './ModelNode';
14
- export { ModelsNode, } from './ModelsNode';
15
- export { DelayNode, } from './DelayNode';
16
- export { ConditionNode, } from './ConditionNode';
17
- export { ShowNode, } from './ShowNode';
18
- export { HideNode, } from './HideNode';
19
- export { TranslateNode, } from './TranslateNode';
20
- export { ScaleNode, } from './ScaleNode';
21
- export { RotateNode, } from './RotateNode';
22
- export { FlyToNode, } from './FlyToNode';
23
- export { SpaceNode, } from './SpaceNode';
24
- export { SpacesNode, } from './SpacesNode';
25
- export { POINode, } from './POINode';
26
- export { POIsNode, } from './POISNode';
27
- export { DataExtractionNode, } from './DataExtractionNode';
28
- export { DataFilterNode, } from './DataFilterNode';
29
- export { PathNode, } from './PathNode';
30
- export { PathsNode, } from './PathsNode';
31
- export { ClipAnimationNode, UnClipAnimationNode, } from './clip-animation';
32
- export { TweenAnimationNode, UnTweenAnimationNode, } from './tween-animation';
33
- export { ComponentTweenAnimationNode, UnComponentTweenAnimationNode, } from './component-tween-animation';
@@ -1,8 +0,0 @@
1
- import { FlowParser } from '../../FlowParser';
2
- import { NodeType, NodeGlobalType } from '../../types';
3
- import { Node } from '../Node';
4
- declare class TweenAnimationNode extends Node {
5
- constructor(parser: FlowParser, node: NodeType);
6
- exec(global: NodeGlobalType): Promise<void>;
7
- }
8
- export { TweenAnimationNode, };
@@ -1,8 +0,0 @@
1
- import { FlowParser } from '../../FlowParser';
2
- import { NodeType } from '../../types';
3
- import { Node } from '../Node';
4
- declare class UnTweenAnimationNode extends Node {
5
- constructor(parser: FlowParser, node: NodeType);
6
- exec(): Promise<void>;
7
- }
8
- export { UnTweenAnimationNode, };
@@ -1,2 +0,0 @@
1
- export { TweenAnimationNode, } from './TweenAnimationNode';
2
- export { UnTweenAnimationNode, } from './UnTweenAnimationNode';
@@ -1,5 +0,0 @@
1
- import { Object3D } from 'three';
2
- import SoonSpace from 'soonspacejs';
3
- import { IAnimation } from '../../../types';
4
- export declare function playTweenAnimation(ssp: SoonSpace, object: Object3D, animation: IAnimation): Promise<void>;
5
- export declare function stopTweenAnimation(animationId: string): void;
@@ -1,106 +0,0 @@
1
- import { Model } from 'soonspacejs';
2
- import { Object3D } from 'three';
3
- import { IAnimation, IComponentAnimation } from '../types';
4
- import { Node } from './nodes';
5
- export declare enum NodePropTypeEnum {
6
- LOCAL = "LOCAL",
7
- READ_CTX = "READ_CTX",
8
- WRITE_CTX = "WRITE_CTX"
9
- }
10
- export declare enum NodeTypeEnum {
11
- START = "START",
12
- COLOR = "COLOR",
13
- NUMBER = "NUMBER",
14
- HIGHLIGHT = "HIGHLIGHT",
15
- UN_HIGHLIGHT = "UN_HIGHLIGHT",
16
- OPACITY = "OPACITY",
17
- UN_OPACITY = "UN_OPACITY",
18
- EMISSIVE = "EMISSIVE",
19
- UN_EMISSIVE = "UN_EMISSIVE",
20
- MESH = "MESH",
21
- MESHES = "MESHES",
22
- MODEL = "MODEL",
23
- MODELS = "MODELS",
24
- SHOW = "SHOW",
25
- HIDE = "HIDE",
26
- CLIP_ANIMATION = "CLIP_ANIMATION",
27
- UN_CLIP_ANIMATION = "UN_CLIP_ANIMATION",
28
- TWEEN_ANIMATION = "TWEEN_ANIMATION",
29
- UN_TWEEN_ANIMATION = "UN_TWEEN_ANIMATION",
30
- COMPONENT_TWEEN_ANIMATION = "COMPONENT_TWEEN_ANIMATION",
31
- UN_COMPONENT_TWEEN_ANIMATION = "UN_COMPONENT_TWEEN_ANIMATION",
32
- SPACE = "SPACE",
33
- SPACES = "SPACES",
34
- PATH = "PATH",
35
- PATHS = "PATHS",
36
- POI = "POI",
37
- POIS = "POIS",
38
- FLY_TO = "FLY_TO",
39
- TRANSLATE = "TRANSLATE",
40
- ROTATE = "ROTATE",
41
- SCALE = "SCALE",
42
- DATA_FILTER = "DATA_FILTER",
43
- DATA_EXTRACTION = "DATA_EXTRACTION",
44
- CONDITION_NODE = "CONDITION_NODE",
45
- DELAY = "DELAY"
46
- }
47
- /**
48
- * 节点 props 数据
49
- */
50
- export type NodePropType = {
51
- name: string;
52
- type: NodePropTypeEnum;
53
- value: string;
54
- valueType: string;
55
- };
56
- /**
57
- * 节点数据
58
- */
59
- export type NodeType = {
60
- id: string;
61
- type: NodeTypeEnum;
62
- props: NodePropType[];
63
- };
64
- /**
65
- * 连接数据
66
- */
67
- export type EdgeType = {
68
- id: string;
69
- source: string;
70
- target: string;
71
- sourceHandle?: string | null;
72
- };
73
- /**
74
- * 流程数据
75
- */
76
- export type FlowType = {
77
- id: string;
78
- sid: string;
79
- name: string;
80
- portal: string;
81
- nodes: NodeType[];
82
- edges: EdgeType[];
83
- };
84
- /**
85
- * 组件流程数据
86
- */
87
- export type ComponentFlowType = FlowType & {
88
- editionId: string;
89
- };
90
- /**
91
- * 节点上下文对象
92
- */
93
- export type NodeCtxType = {
94
- [x: string]: any;
95
- };
96
- /**
97
- * 节点全局对象
98
- * 由运行时动态定义接口
99
- */
100
- export type NodeGlobalType = {
101
- getTarget?: (currentNode: Node) => Promise<Model | null>;
102
- getAnimations?: (currentNode: Node, object: Object3D, animationId: string) => Promise<IAnimation[] | null>;
103
- getComponentAnimations?: (currentNode: Node, object: Object3D, animationId: string) => Promise<IComponentAnimation[] | null>;
104
- [s: symbol]: any;
105
- };
106
- export type FlowParserEventMap = {};
@@ -1,12 +0,0 @@
1
- import { Object3D } from 'three';
2
- import SoonSpace, { BaseObject3D } from 'soonspacejs';
3
- import { FlowParser } from './FlowParser';
4
- import { Node } from './nodes';
5
- import { NodeType } from './types';
6
- export declare function parseNodeByType(parser: FlowParser, node: NodeType): Node;
7
- export declare function parseValue<T = any>(value: string): T;
8
- export declare function waitFor(fn: () => Promise<void>, wait: boolean): Promise<void>;
9
- export declare function getObjectByIds(ssp: SoonSpace, ids: string[]): BaseObject3D[];
10
- export declare function getObjectById(ssp: SoonSpace, id: string, object?: Object3D): Object3D | null;
11
- export declare function getMeshByUserDataUuid(object: Object3D, uuid: string): Object3D | null;
12
- export declare function filterNodes(prevNode: Node, result: Node[]): Node[];
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './flows';
2
- export * from './triggers';
3
- export * from './types';
@@ -1,18 +0,0 @@
1
- import SoonSpace, { ModelEventParams } from 'soonspacejs';
2
- import { Trigger } from './Trigger';
3
- import { Interaction, TriggerOptions } from './types';
4
- import { ComponentFlowType } from '../flows/types';
5
- declare class ComponentTrigger extends Trigger {
6
- #private;
7
- flows: ComponentFlowType[];
8
- flowsMap: Map<string, ComponentFlowType[]>;
9
- constructor(ssp: SoonSpace, interaction: Interaction, flows: ComponentFlowType[], options: TriggerOptions);
10
- modelHandler(params: ModelEventParams): void;
11
- runFlowByIds(flowIds: string[]): void;
12
- execBehavior(): Promise<void>;
13
- initLoaded(): void;
14
- initThingPropChange(): void;
15
- initThingEvent(): void;
16
- onThingPropChange(newProps: string): void;
17
- }
18
- export { ComponentTrigger, };
@@ -1,27 +0,0 @@
1
- import SoonSpace, { Model, ModelEventParams } from 'soonspacejs';
2
- import { FlowType, Interaction, TriggerOptions } from '@soonspacejs/plugin-flow';
3
- declare class Trigger {
4
- #private;
5
- ssp: SoonSpace;
6
- interaction: Interaction;
7
- flows: FlowType[];
8
- flowsMap: Map<string, FlowType[]>;
9
- options: TriggerOptions;
10
- disposables: (() => void)[];
11
- status: 'ready' | 'running' | 'error';
12
- target?: Model;
13
- constructor(ssp: SoonSpace, interaction: Interaction, flows: FlowType[], options: TriggerOptions);
14
- modelHandler(params: ModelEventParams): void;
15
- runFlowByIds(flowIds: string[]): void;
16
- execBehavior(): Promise<void>;
17
- initMouseClick(): void;
18
- initMouseDbClick(): void;
19
- initMouseRightClick(): void;
20
- initLoaded(): void;
21
- modelPropChangeHandler(properties: any): void;
22
- initModelPropChange(): void;
23
- initThingPropChange(): void;
24
- initThingEvent(): void;
25
- dispose(): void;
26
- }
27
- export { Trigger, };
@@ -1,3 +0,0 @@
1
- export { Trigger, } from './Trigger';
2
- export { ComponentTrigger, } from './ComponentTrigger';
3
- export * from './types';
@@ -1,54 +0,0 @@
1
- import { Object3D } from 'three';
2
- import { IAnimation, IComponentAnimation } from '../types';
3
- import { Node } from '../flows';
4
- export declare enum InteractionActionType {
5
- GLOBAL = "GLOBAL",
6
- SELF = "SELF",
7
- OTHER = "OTHER"
8
- }
9
- export declare enum InteractionAction {
10
- FLOW = "FLOW",
11
- ANIMATION = "ANIMATION",
12
- DELAY = "DELAY"
13
- }
14
- export declare enum InteractionObsType {
15
- GLOBAL = "GLOBAL",
16
- INSTANCE = "INSTANCE",
17
- FAMILY = "FAMILY"
18
- }
19
- export declare enum InteractionType {
20
- MOUSE_CLICK = "MOUSE_CLICK",
21
- MOUSE_DB_CLICK = "MOUSE_DB_CLICK",
22
- MOUSE_RIGHT_CLICK = "MOUSE_RIGHT_CLICK",
23
- THING_PROP_CHANGE = "THING_PROP_CHANGE",
24
- THING_EVENT = "THING_EVENT",
25
- LOADED = "LOADED",
26
- MODEL_PROP_CHANGE = "MODEL_PROP_CHANGE"
27
- }
28
- export type InteractionBehavior = {
29
- id: string;
30
- uuid: string;
31
- actionType: InteractionActionType;
32
- action: InteractionAction;
33
- actionTargets: string[] | null;
34
- actionRefs: string[] | null;
35
- };
36
- export type Interaction = {
37
- id: string;
38
- sid: string;
39
- name: string;
40
- modelId: string;
41
- type: InteractionType;
42
- obsType: InteractionObsType;
43
- obsTargets: string[] | null;
44
- obsProps: string[] | null;
45
- behaviors: InteractionBehavior[] | null;
46
- active: boolean;
47
- editionId?: string;
48
- };
49
- export type TriggerOptions = {
50
- onError?: (e: Error) => void;
51
- onTrigger?: (interaction: Interaction) => void;
52
- getAnimations?: (currentNode: Node, object: Object3D, animationId: string) => Promise<IAnimation[] | null>;
53
- getComponentAnimations?: (currentNode: Node, object: Object3D, animationId: string) => Promise<IComponentAnimation[] | null>;
54
- };
@@ -1,2 +0,0 @@
1
- import { Object3D } from 'three';
2
- export declare const findObjectFromTarget: (target: Object3D, key: string) => boolean;
package/dist/types.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { TAnimationFrame } from 'umanager-animation-parser';
2
- export interface IComponentAnimation {
3
- id: string;
4
- sid: string;
5
- name: string;
6
- refId: string;
7
- editionId: string;
8
- keyframes: TAnimationFrame[];
9
- }
10
- export interface IAnimation {
11
- id: string;
12
- sid: string;
13
- modelId: string;
14
- name: string;
15
- keyframes: TAnimationFrame[];
16
- }