-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtypes.ts
More file actions
90 lines (79 loc) · 2.43 KB
/
Copy pathtypes.ts
File metadata and controls
90 lines (79 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
export const RETRIGGER_TYPES = ['repeat', 'alternate', 'state'];
export type Severity = 'error' | 'warning' | 'info';
export type Path = (string | number)[];
export type SemanticIssue = {
code: 'custom';
path: Path;
message: string;
params: { domainCode: string };
severity?: Severity;
};
export type ValidationError = {
code: string;
message: string;
path: Path;
severity: Severity;
hint?: string;
};
export type ValidationResult = {
valid: boolean;
errors: ValidationError[];
};
export type ValidateOptions = {
strict?: boolean;
max?: number;
severityOverrides?: Record<string, Severity | 'off'>;
};
export type AnyEffect = {
key?: string;
effectId?: string;
selector?: string;
listContainer?: string;
listItemSelector?: string;
triggerType?: string;
stateAction?: string;
fill?: string;
namedEffect?: { type?: string; range?: unknown; [k: string]: unknown };
keyframeEffect?: { name?: string; keyframes?: Array<Record<string, unknown>> };
customEffect?: (element: Element, progress: number | { x: number; y: number }) => void;
transition?: { styleProperties?: unknown[] };
transitionProperties?: unknown[];
rangeStart?: { offset?: { value?: number; unit?: string } };
rangeEnd?: { offset?: { value?: number; unit?: string } };
conditions?: string[];
};
export type AnySequence = {
triggerType?: string;
sequenceId?: string;
effects?: AnyEffect[];
conditions?: string[];
};
export type AnyInteraction = {
key?: string;
trigger?: string;
selector?: string;
listContainer?: string;
listItemSelector?: string;
params?: { hitArea?: string; axis?: string; inset?: string; effectId?: string };
effects?: AnyEffect[];
sequences?: AnySequence[];
conditions?: string[];
};
export type AnyConfig = {
effects?: Record<string, AnyEffect>;
sequences?: Record<string, AnySequence>;
interactions: AnyInteraction[];
};
export type Visitors = {
onInteraction?: (path: Path, interaction: AnyInteraction) => void;
// `owner` is the parent interaction (carrying trigger/key/selector/params), or
// `undefined` for top-level registry effects/sequences whose trigger context is
// unknown until their reference site. Trigger-aware checks skip `owner === undefined`.
onEffect: (path: Path, effect: AnyEffect, isTopLevel: boolean, owner?: AnyInteraction) => void;
onSequence: (
path: Path,
sequence: AnySequence,
isTopLevel: boolean,
owner?: AnyInteraction,
) => void;
};