@zag-js/tabs 2.0.0-next.2 → 2.0.0-next.4

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.
@@ -1,207 +1,252 @@
1
- // src/tabs.connect.ts
2
- import {
3
- contains,
4
- dataAttr,
5
- getEventKey,
6
- getEventTarget,
7
- isComposingEvent,
8
- isOpeningInNewTab,
9
- isSafari
10
- } from "@zag-js/dom-query";
11
- import { toPx } from "@zag-js/utils";
12
1
  import { parts } from "./tabs.anatomy.mjs";
13
- import * as dom from "./tabs.dom.mjs";
2
+ import { getContentId, getListEl, getTriggerEl, getTriggerId } from "./tabs.dom.mjs";
3
+ import { contains, dataAttr, getEventKey, getEventTarget, isAnchorElement, isComposingEvent, isDownloadingEvent, isModifierKey, isOpeningInNewTab, isSafari } from "@zag-js/dom-query";
4
+ import { toPx } from "@zag-js/utils";
5
+ // src/tabs.connect.ts
14
6
  function connect(service, normalize) {
15
- const { state, send, context, prop, scope } = service;
16
- const translations = prop("translations");
17
- const focused = state.matches("focused");
18
- const isVertical = prop("orientation") === "vertical";
19
- const isHorizontal = prop("orientation") === "horizontal";
20
- const virtualFocus = prop("virtualFocus");
21
- function getTriggerState(props) {
22
- return {
23
- selected: context.get("value") === props.value,
24
- focused: context.get("focusedValue") === props.value,
25
- disabled: !!props.disabled
26
- };
27
- }
28
- function getContentState(props) {
29
- return { selected: context.get("value") === props.value };
30
- }
31
- return {
32
- value: context.get("value"),
33
- focusedValue: context.get("focusedValue"),
34
- setValue(value) {
35
- send({ type: "SET_VALUE", value });
36
- },
37
- clearValue() {
38
- send({ type: "CLEAR_VALUE" });
39
- },
40
- setIndicatorRect(value) {
41
- const id = dom.getTriggerId(scope, value);
42
- send({ type: "SET_INDICATOR_RECT", id });
43
- },
44
- syncTabIndex() {
45
- send({ type: "SYNC_TAB_INDEX" });
46
- },
47
- selectNext(fromValue) {
48
- send({ type: "TAB_FOCUS", value: fromValue, src: "selectNext" });
49
- send({ type: "ARROW_NEXT", src: "selectNext" });
50
- },
51
- selectPrev(fromValue) {
52
- send({ type: "TAB_FOCUS", value: fromValue, src: "selectPrev" });
53
- send({ type: "ARROW_PREV", src: "selectPrev" });
54
- },
55
- focus() {
56
- const value = context.get("value");
57
- if (!value) return;
58
- dom.getTriggerEl(scope, value)?.focus();
59
- },
60
- getRootProps() {
61
- return normalize.element({
62
- ...parts.root.attrs(scope.id),
63
- "data-orientation": prop("orientation"),
64
- "data-focus": dataAttr(focused),
65
- dir: prop("dir")
66
- });
67
- },
68
- getListProps() {
69
- return normalize.element({
70
- ...parts.list.attrs(scope.id),
71
- role: "tablist",
72
- dir: prop("dir"),
73
- "data-focus": dataAttr(focused),
74
- "aria-orientation": prop("orientation"),
75
- "data-orientation": prop("orientation"),
76
- "aria-label": translations?.listLabel,
77
- onKeyDown(event) {
78
- if (event.defaultPrevented) return;
79
- if (isComposingEvent(event)) return;
80
- if (!contains(event.currentTarget, getEventTarget(event))) return;
81
- const keyMap = {
82
- ArrowDown() {
83
- if (isHorizontal) return;
84
- send({ type: "ARROW_NEXT", key: "ArrowDown" });
85
- },
86
- ArrowUp() {
87
- if (isHorizontal) return;
88
- send({ type: "ARROW_PREV", key: "ArrowUp" });
89
- },
90
- ArrowLeft() {
91
- if (isVertical) return;
92
- send({ type: "ARROW_PREV", key: "ArrowLeft" });
93
- },
94
- ArrowRight() {
95
- if (isVertical) return;
96
- send({ type: "ARROW_NEXT", key: "ArrowRight" });
97
- },
98
- Home() {
99
- send({ type: "HOME" });
100
- },
101
- End() {
102
- send({ type: "END" });
103
- }
104
- };
105
- let key = getEventKey(event, {
106
- dir: prop("dir"),
107
- orientation: prop("orientation")
108
- });
109
- const exec = keyMap[key];
110
- if (exec) {
111
- event.preventDefault();
112
- exec(event);
113
- return;
114
- }
115
- }
116
- });
117
- },
118
- getTriggerState,
119
- getTriggerProps(props) {
120
- const { value, disabled } = props;
121
- const triggerState = getTriggerState(props);
122
- return normalize.button({
123
- ...parts.trigger.attrs(scope.id),
124
- role: "tab",
125
- type: "button",
126
- disabled,
127
- dir: prop("dir"),
128
- "data-orientation": prop("orientation"),
129
- "data-disabled": dataAttr(disabled),
130
- "aria-disabled": disabled,
131
- "data-value": value,
132
- "aria-selected": triggerState.selected,
133
- "data-selected": dataAttr(triggerState.selected),
134
- "data-focus": dataAttr(triggerState.focused),
135
- "aria-controls": triggerState.selected ? dom.getContentId(scope, value) : void 0,
136
- "data-ssr": dataAttr(context.get("ssr")),
137
- id: dom.getTriggerId(scope, value),
138
- tabIndex: triggerState.selected && !virtualFocus ? 0 : -1,
139
- onFocus() {
140
- send({ type: "TAB_FOCUS", value });
141
- },
142
- onBlur(event) {
143
- const target = event.relatedTarget;
144
- if (target?.getAttribute("role") !== "tab") {
145
- send({ type: "TAB_BLUR" });
146
- }
147
- },
148
- onClick(event) {
149
- if (event.defaultPrevented) return;
150
- if (isOpeningInNewTab(event)) return;
151
- if (disabled) return;
152
- if (isSafari()) {
153
- event.currentTarget.focus();
154
- }
155
- send({ type: "TAB_CLICK", value });
156
- }
157
- });
158
- },
159
- getContentState,
160
- getContentProps(props) {
161
- const { value } = props;
162
- const contentState = getContentState(props);
163
- return normalize.element({
164
- ...parts.content.attrs(scope.id),
165
- dir: prop("dir"),
166
- id: dom.getContentId(scope, value),
167
- tabIndex: !virtualFocus ? 0 : -1,
168
- "aria-labelledby": dom.getTriggerId(scope, value),
169
- role: "tabpanel",
170
- "data-selected": dataAttr(contentState.selected),
171
- "data-orientation": prop("orientation"),
172
- hidden: !contentState.selected
173
- });
174
- },
175
- getIndicatorProps() {
176
- const rect = context.get("indicatorRect");
177
- const animateIndicator = context.get("animateIndicator");
178
- return normalize.element({
179
- ...parts.indicator.attrs(scope.id),
180
- dir: prop("dir"),
181
- "data-orientation": prop("orientation"),
182
- hidden: isRectEmpty(rect),
183
- onTransitionEnd(event) {
184
- if (getEventTarget(event) !== event.currentTarget) return;
185
- send({ type: "INDICATOR_TRANSITION_END" });
186
- },
187
- style: {
188
- "--transition-property": "left, right, top, bottom, width, height",
189
- "--left": toPx(rect?.x),
190
- "--top": toPx(rect?.y),
191
- "--width": toPx(rect?.width),
192
- "--height": toPx(rect?.height),
193
- position: "absolute",
194
- willChange: animateIndicator ? "var(--transition-property)" : "auto",
195
- transitionProperty: animateIndicator ? "var(--transition-property)" : "none",
196
- transitionDuration: animateIndicator ? "var(--transition-duration, 150ms)" : "0ms",
197
- transitionTimingFunction: "var(--transition-timing-function)",
198
- [isHorizontal ? "left" : "top"]: isHorizontal ? "var(--left)" : "var(--top)"
199
- }
200
- });
201
- }
202
- };
7
+ const { state, send, context, prop, scope, computed } = service;
8
+ const translations = prop("translations");
9
+ const focused = state.matches("focused");
10
+ const isVertical = prop("orientation") === "vertical";
11
+ const isHorizontal = prop("orientation") === "horizontal";
12
+ const virtualFocus = prop("virtualFocus");
13
+ const tabStopValue = context.get("tabStopValue") ?? context.get("value");
14
+ const activationDirection = computed("activationDirection");
15
+ const indicatorRect = context.get("indicatorRect");
16
+ const indicatorPending = context.get("ssr") || indicatorRect != null && isRectEmpty(indicatorRect);
17
+ function moveFocus(to) {
18
+ send({
19
+ type: "FOCUS.MOVE",
20
+ to,
21
+ src: "keyboard"
22
+ });
23
+ }
24
+ function getRootState() {
25
+ return {
26
+ focused,
27
+ orientation: prop("orientation"),
28
+ activationDirection
29
+ };
30
+ }
31
+ function getTriggerState(props) {
32
+ return {
33
+ selected: context.get("value") === props.value,
34
+ focused: context.get("focusedValue") === props.value,
35
+ disabled: !!props.disabled
36
+ };
37
+ }
38
+ function getContentState(props) {
39
+ return {
40
+ ...getRootState(),
41
+ selected: context.get("value") === props.value
42
+ };
43
+ }
44
+ function getIndicatorState() {
45
+ const rect = context.get("indicatorRect");
46
+ return {
47
+ ...getRootState(),
48
+ visible: !isRectEmpty(rect),
49
+ instant: context.get("indicatorInstant")
50
+ };
51
+ }
52
+ return {
53
+ value: context.get("value"),
54
+ focusedValue: context.get("focusedValue"),
55
+ activationDirection,
56
+ setValue(value, reason = "script") {
57
+ send({
58
+ type: "VALUE.SET",
59
+ value,
60
+ src: reason
61
+ });
62
+ },
63
+ clearValue() {
64
+ send({
65
+ type: "VALUE.SET",
66
+ value: null,
67
+ src: "script"
68
+ });
69
+ },
70
+ setIndicatorRect(value) {
71
+ send({
72
+ type: "INDICATOR.SET",
73
+ value
74
+ });
75
+ },
76
+ syncTabIndex() {
77
+ send({ type: "CONTENT.SYNC" });
78
+ },
79
+ selectNext(fromValue) {
80
+ send({
81
+ type: "VALUE.STEP",
82
+ step: 1,
83
+ from: fromValue,
84
+ src: "script"
85
+ });
86
+ },
87
+ selectPrevious(fromValue) {
88
+ send({
89
+ type: "VALUE.STEP",
90
+ step: -1,
91
+ from: fromValue,
92
+ src: "script"
93
+ });
94
+ },
95
+ focus() {
96
+ const value = context.get("value");
97
+ if (!value) return;
98
+ getTriggerEl(scope, value)?.focus();
99
+ },
100
+ getRootState,
101
+ getRootProps() {
102
+ const rootState = getRootState();
103
+ return normalize.element({
104
+ ...parts.root.attrs(scope.id),
105
+ "data-orientation": rootState.orientation,
106
+ "data-focus": dataAttr(rootState.focused),
107
+ "data-activation-direction": rootState.activationDirection,
108
+ dir: prop("dir")
109
+ });
110
+ },
111
+ getListProps() {
112
+ const rootState = getRootState();
113
+ return normalize.element({
114
+ ...parts.list.attrs(scope.id),
115
+ role: "tablist",
116
+ dir: prop("dir"),
117
+ "data-focus": dataAttr(rootState.focused),
118
+ "aria-orientation": rootState.orientation,
119
+ "data-orientation": rootState.orientation,
120
+ "data-activation-direction": rootState.activationDirection,
121
+ "aria-label": translations?.listLabel,
122
+ onKeyDown(event) {
123
+ if (event.defaultPrevented) return;
124
+ if (isComposingEvent(event)) return;
125
+ if (isModifierKey(event) || event.shiftKey) return;
126
+ if (!contains(event.currentTarget, getEventTarget(event))) return;
127
+ const exec = {
128
+ ArrowDown() {
129
+ if (isHorizontal) return;
130
+ moveFocus("next");
131
+ },
132
+ ArrowUp() {
133
+ if (isHorizontal) return;
134
+ moveFocus("prev");
135
+ },
136
+ ArrowLeft() {
137
+ if (isVertical) return;
138
+ moveFocus("prev");
139
+ },
140
+ ArrowRight() {
141
+ if (isVertical) return;
142
+ moveFocus("next");
143
+ },
144
+ Home() {
145
+ moveFocus("first");
146
+ },
147
+ End() {
148
+ moveFocus("last");
149
+ }
150
+ }[getEventKey(event, {
151
+ dir: prop("dir"),
152
+ orientation: prop("orientation")
153
+ })];
154
+ if (exec) {
155
+ event.preventDefault();
156
+ exec(event);
157
+ return;
158
+ }
159
+ }
160
+ });
161
+ },
162
+ getTriggerState,
163
+ getTriggerProps(props) {
164
+ const { value, disabled } = props;
165
+ const triggerState = getTriggerState(props);
166
+ return normalize.button({
167
+ ...parts.trigger.attrs(scope.id),
168
+ role: "tab",
169
+ type: "button",
170
+ disabled,
171
+ dir: prop("dir"),
172
+ "data-orientation": prop("orientation"),
173
+ "data-disabled": dataAttr(disabled),
174
+ "aria-disabled": disabled,
175
+ "data-value": value,
176
+ "aria-selected": triggerState.selected,
177
+ "data-selected": dataAttr(triggerState.selected),
178
+ "data-focus": dataAttr(triggerState.focused),
179
+ "aria-controls": triggerState.selected ? getContentId(scope, value) : void 0,
180
+ "data-indicator-pending": dataAttr(indicatorPending),
181
+ "data-activation-direction": activationDirection,
182
+ id: getTriggerId(scope, value),
183
+ tabIndex: !virtualFocus && tabStopValue === value ? 0 : -1,
184
+ onFocus() {
185
+ send({
186
+ type: "TRIGGER.FOCUS",
187
+ value
188
+ });
189
+ },
190
+ onBlur(event) {
191
+ if (contains(getListEl(scope), event.relatedTarget)) return;
192
+ send({ type: "TRIGGER.BLUR" });
193
+ },
194
+ onClick(event) {
195
+ if (event.defaultPrevented) return;
196
+ if (isDownloadingEvent(event)) return;
197
+ if (isOpeningInNewTab(event)) return;
198
+ if (event.shiftKey && isAnchorElement(event.currentTarget)) return;
199
+ if (disabled) return;
200
+ if (isSafari()) event.currentTarget.focus();
201
+ const node = event.currentTarget;
202
+ if (prop("navigate") != null && isAnchorElement(node)) event.preventDefault();
203
+ send({
204
+ type: "TRIGGER.CLICK",
205
+ value,
206
+ src: "trigger-click"
207
+ });
208
+ }
209
+ });
210
+ },
211
+ getContentState,
212
+ getContentProps(props) {
213
+ const { value } = props;
214
+ const contentState = getContentState(props);
215
+ return normalize.element({
216
+ ...parts.content.attrs(scope.id),
217
+ dir: prop("dir"),
218
+ id: getContentId(scope, value),
219
+ tabIndex: virtualFocus ? -1 : contentState.selected && context.get("hasFocusableContent") ? void 0 : 0,
220
+ "aria-labelledby": getTriggerId(scope, value),
221
+ role: "tabpanel",
222
+ "data-selected": dataAttr(contentState.selected),
223
+ "data-orientation": contentState.orientation,
224
+ "data-activation-direction": contentState.activationDirection,
225
+ hidden: !contentState.selected
226
+ });
227
+ },
228
+ getIndicatorState,
229
+ getIndicatorProps() {
230
+ const indicatorState = getIndicatorState();
231
+ const rect = context.get("indicatorRect");
232
+ return normalize.element({
233
+ ...parts.indicator.attrs(scope.id),
234
+ dir: prop("dir"),
235
+ "data-orientation": indicatorState.orientation,
236
+ "data-instant": dataAttr(indicatorState.instant),
237
+ "data-activation-direction": indicatorState.activationDirection,
238
+ hidden: !indicatorState.visible,
239
+ style: {
240
+ "--left": toPx(rect?.x),
241
+ "--top": toPx(rect?.y),
242
+ "--width": toPx(rect?.width),
243
+ "--height": toPx(rect?.height),
244
+ position: "absolute",
245
+ [isHorizontal ? "left" : "top"]: isHorizontal ? "var(--left)" : "var(--top)"
246
+ }
247
+ });
248
+ }
249
+ };
203
250
  }
204
- var isRectEmpty = (rect) => rect == null || rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;
205
- export {
206
- connect
207
- };
251
+ const isRectEmpty = (rect) => rect == null || rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;
252
+ export { connect };
@@ -1,36 +1,30 @@
1
- import { Scope } from '@zag-js/core';
2
-
3
- declare const getRootId: (ctx: Scope) => any;
4
- declare const getListId: (ctx: Scope) => any;
5
- declare const getContentId: (ctx: Scope, value: string) => any;
6
- declare const getTriggerId: (ctx: Scope, value: string) => any;
7
- declare const getIndicatorId: (ctx: Scope) => any;
8
- declare const getListEl: (ctx: Scope) => HTMLElement | null;
9
- declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
10
- declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
11
- declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
12
- declare const getElements: (ctx: Scope) => HTMLElement[];
13
- declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
14
- declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
15
- declare const getNextTriggerEl: (ctx: Scope, opts: {
16
- value: string;
17
- loopFocus?: boolean | undefined;
1
+ import { Scope } from "@zag-js/core";
2
+ import { ActivationDirection, Orientation } from "@zag-js/types";
3
+ export declare const getRootId: (ctx: Scope) => any;
4
+ export declare const getListId: (ctx: Scope) => any;
5
+ export declare const getContentId: (ctx: Scope, value: string) => any;
6
+ export declare const getTriggerId: (ctx: Scope, value: string) => any;
7
+ export declare const getIndicatorId: (ctx: Scope) => any;
8
+ export declare const getListEl: (ctx: Scope) => HTMLElement | null;
9
+ export declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
10
+ export declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
11
+ export declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
12
+ export declare const getElements: (ctx: Scope) => HTMLElement[];
13
+ export declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
14
+ export declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
15
+ export declare const getNextTriggerEl: (ctx: Scope, opts: {
16
+ value: string;
17
+ loopFocus?: boolean | undefined;
18
18
  }) => HTMLElement;
19
- declare const getPrevTriggerEl: (ctx: Scope, opts: {
20
- value: string;
21
- loopFocus?: boolean | undefined;
19
+ export declare const getPrevTriggerEl: (ctx: Scope, opts: {
20
+ value: string;
21
+ loopFocus?: boolean | undefined;
22
22
  }) => HTMLElement | null;
23
- declare const getOffsetRect: (el: HTMLElement | undefined) => {
24
- x: number;
25
- y: number;
26
- width: number;
27
- height: number;
23
+ export declare const getSiblingTriggerEl: (ctx: Scope, value: string | null, step: number, loopFocus?: boolean) => HTMLElement | null | undefined;
24
+ export declare const getTriggerRect: (ctx: Scope, triggerEl: HTMLElement) => {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
28
29
  };
29
- declare const getRectByValue: (ctx: Scope, value: string) => {
30
- x: number;
31
- y: number;
32
- width: number;
33
- height: number;
34
- };
35
-
36
- export { getContentEl, getContentId, getElements, getFirstTriggerEl, getIndicatorEl, getIndicatorId, getLastTriggerEl, getListEl, getListId, getNextTriggerEl, getOffsetRect, getPrevTriggerEl, getRectByValue, getRootId, getTriggerEl, getTriggerId };
30
+ export declare const getActivationDirection: (ctx: Scope, prevValue: string | null, value: string | null, orientation: Orientation) => ActivationDirection;
@@ -1,36 +1,30 @@
1
- import { Scope } from '@zag-js/core';
2
-
3
- declare const getRootId: (ctx: Scope) => any;
4
- declare const getListId: (ctx: Scope) => any;
5
- declare const getContentId: (ctx: Scope, value: string) => any;
6
- declare const getTriggerId: (ctx: Scope, value: string) => any;
7
- declare const getIndicatorId: (ctx: Scope) => any;
8
- declare const getListEl: (ctx: Scope) => HTMLElement | null;
9
- declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
10
- declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
11
- declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
12
- declare const getElements: (ctx: Scope) => HTMLElement[];
13
- declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
14
- declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
15
- declare const getNextTriggerEl: (ctx: Scope, opts: {
16
- value: string;
17
- loopFocus?: boolean | undefined;
1
+ import { Scope } from "@zag-js/core";
2
+ import { ActivationDirection, Orientation } from "@zag-js/types";
3
+ export declare const getRootId: (ctx: Scope) => any;
4
+ export declare const getListId: (ctx: Scope) => any;
5
+ export declare const getContentId: (ctx: Scope, value: string) => any;
6
+ export declare const getTriggerId: (ctx: Scope, value: string) => any;
7
+ export declare const getIndicatorId: (ctx: Scope) => any;
8
+ export declare const getListEl: (ctx: Scope) => HTMLElement | null;
9
+ export declare const getContentEl: (ctx: Scope, value: string) => HTMLElement | null;
10
+ export declare const getTriggerEl: (ctx: Scope, value: string | null) => HTMLElement | null;
11
+ export declare const getIndicatorEl: (ctx: Scope) => HTMLElement | null;
12
+ export declare const getElements: (ctx: Scope) => HTMLElement[];
13
+ export declare const getFirstTriggerEl: (ctx: Scope) => HTMLElement | undefined;
14
+ export declare const getLastTriggerEl: (ctx: Scope) => HTMLElement | undefined;
15
+ export declare const getNextTriggerEl: (ctx: Scope, opts: {
16
+ value: string;
17
+ loopFocus?: boolean | undefined;
18
18
  }) => HTMLElement;
19
- declare const getPrevTriggerEl: (ctx: Scope, opts: {
20
- value: string;
21
- loopFocus?: boolean | undefined;
19
+ export declare const getPrevTriggerEl: (ctx: Scope, opts: {
20
+ value: string;
21
+ loopFocus?: boolean | undefined;
22
22
  }) => HTMLElement | null;
23
- declare const getOffsetRect: (el: HTMLElement | undefined) => {
24
- x: number;
25
- y: number;
26
- width: number;
27
- height: number;
23
+ export declare const getSiblingTriggerEl: (ctx: Scope, value: string | null, step: number, loopFocus?: boolean) => HTMLElement | null | undefined;
24
+ export declare const getTriggerRect: (ctx: Scope, triggerEl: HTMLElement) => {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
28
29
  };
29
- declare const getRectByValue: (ctx: Scope, value: string) => {
30
- x: number;
31
- y: number;
32
- width: number;
33
- height: number;
34
- };
35
-
36
- export { getContentEl, getContentId, getElements, getFirstTriggerEl, getIndicatorEl, getIndicatorId, getLastTriggerEl, getListEl, getListId, getNextTriggerEl, getOffsetRect, getPrevTriggerEl, getRectByValue, getRootId, getTriggerEl, getTriggerId };
30
+ export declare const getActivationDirection: (ctx: Scope, prevValue: string | null, value: string | null, orientation: Orientation) => ActivationDirection;