@flighthq/interaction 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787

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 CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/interaction`. The `@
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/interaction@0.5.1-next.903.f434bc2](https://github.com/flighthq/flight/tree/f434bc233778d75aeea61995df3a8cfaec459a85/packages/interaction)
17
- - [License](https://github.com/flighthq/flight/blob/f434bc233778d75aeea61995df3a8cfaec459a85/LICENSE.md)
16
+ - [Source for @flighthq/interaction@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/interaction)
17
+ - [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/interaction",
3
- "version": "0.5.1-next.903.f434bc2",
3
+ "version": "0.5.1-next.905.5fbf787",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,20 +38,20 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/bitmap": "0.5.1-next.903.f434bc2",
42
- "@flighthq/entity": "0.5.1-next.903.f434bc2",
43
- "@flighthq/geometry": "0.5.1-next.903.f434bc2",
44
- "@flighthq/log": "0.5.1-next.903.f434bc2",
45
- "@flighthq/node": "0.5.1-next.903.f434bc2",
46
- "@flighthq/path": "0.5.1-next.903.f434bc2",
47
- "@flighthq/registry": "0.5.1-next.903.f434bc2",
48
- "@flighthq/scene2d": "0.5.1-next.903.f434bc2",
49
- "@flighthq/shape": "0.5.1-next.903.f434bc2",
50
- "@flighthq/signals": "0.5.1-next.903.f434bc2",
51
- "@flighthq/spatial": "0.5.1-next.903.f434bc2",
52
- "@flighthq/text": "0.5.1-next.903.f434bc2",
53
- "@flighthq/textlayout": "0.5.1-next.903.f434bc2",
54
- "@flighthq/types": "0.5.1-next.903.f434bc2"
41
+ "@flighthq/bitmap": "0.5.1-next.905.5fbf787",
42
+ "@flighthq/entity": "0.5.1-next.905.5fbf787",
43
+ "@flighthq/geometry": "0.5.1-next.905.5fbf787",
44
+ "@flighthq/log": "0.5.1-next.905.5fbf787",
45
+ "@flighthq/node": "0.5.1-next.905.5fbf787",
46
+ "@flighthq/path": "0.5.1-next.905.5fbf787",
47
+ "@flighthq/registry": "0.5.1-next.905.5fbf787",
48
+ "@flighthq/scene2d": "0.5.1-next.905.5fbf787",
49
+ "@flighthq/shape": "0.5.1-next.905.5fbf787",
50
+ "@flighthq/signals": "0.5.1-next.905.5fbf787",
51
+ "@flighthq/spatial": "0.5.1-next.905.5fbf787",
52
+ "@flighthq/text": "0.5.1-next.905.5fbf787",
53
+ "@flighthq/textlayout": "0.5.1-next.905.5fbf787",
54
+ "@flighthq/types": "0.5.1-next.905.5fbf787"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@flighthq/quadbatch": "*",
@@ -13,6 +13,7 @@ import {
13
13
  focusPreviousNode,
14
14
  getFocusOrder,
15
15
  getFocusedNode,
16
+ initializeFocusManager,
16
17
  isNodeFocused,
17
18
  setFocusedNode,
18
19
  } from './focusManager';
@@ -237,6 +238,12 @@ describe('getFocusOrder', () => {
237
238
  });
238
239
  });
239
240
 
241
+ describe('initializeFocusManager', () => {
242
+ it('is the construction initializer of createFocusManager', () => {
243
+ expect(typeof initializeFocusManager).toBe('function');
244
+ });
245
+ });
246
+
240
247
  describe('isNodeFocused', () => {
241
248
  it('is true only for the focused node', () => {
242
249
  const a = focusable();
@@ -248,7 +255,6 @@ describe('isNodeFocused', () => {
248
255
  expect(isNodeFocused(manager, b)).toBe(false);
249
256
  });
250
257
  });
251
-
252
258
  describe('setFocusedNode', () => {
253
259
  it('rejects a non-focusable node without changing focus', () => {
254
260
  const plain = createDisplayObject();
@@ -37,6 +37,8 @@ import {
37
37
  dispatchInteractionWheel,
38
38
  enableInteractionSignals,
39
39
  getInteractionSignals,
40
+ initializeInteractionManager,
41
+ initializeInteractionSignals,
40
42
  invalidateInteractionCursor,
41
43
  releaseInteractionPointer,
42
44
  setInteractionConnectGuard,
@@ -956,6 +958,18 @@ describe('getInteractionSignals', () => {
956
958
  });
957
959
  });
958
960
 
961
+ describe('initializeInteractionManager', () => {
962
+ it('is the construction initializer of createInteractionManager', () => {
963
+ expect(typeof initializeInteractionManager).toBe('function');
964
+ });
965
+ });
966
+
967
+ describe('initializeInteractionSignals', () => {
968
+ it('is the construction initializer of createInteractionSignals', () => {
969
+ expect(typeof initializeInteractionSignals).toBe('function');
970
+ });
971
+ });
972
+
959
973
  describe('invalidateInteractionCursor', () => {
960
974
  it('applies a cursor written to the current rollover target only when explicitly invalidated', () => {
961
975
  const { applied, child, manager } = createCursorScene();
@@ -1005,47 +1019,6 @@ describe('invalidateInteractionCursor', () => {
1005
1019
  });
1006
1020
  });
1007
1021
 
1008
- describe('releaseInteractionPointer', () => {
1009
- it('stops routing pointer events to the captured target', () => {
1010
- const { child, manager } = createHitScene3D();
1011
- let fired = 0;
1012
- connectSignal(enableInteractionSignals(child).onPointerMove, () => fired++);
1013
-
1014
- captureInteractionPointer(manager, 3, child);
1015
- releaseInteractionPointer(manager, 3);
1016
- dispatchInteractionPointerMove(manager, 500, 500, 0, { pointerId: 3 });
1017
- expect(fired).toBe(0);
1018
- });
1019
-
1020
- it('resets a pending pointer double click', () => {
1021
- const { child, manager } = createHitScene3D();
1022
- let fired = 0;
1023
- setNodePointerDoubleClickEnabled(child, true);
1024
- connectSignal(enableInteractionSignals(child).onPointerDoubleClick, () => fired++);
1025
-
1026
- dispatchClick(manager, 50, 50, 1000);
1027
- releaseInteractionPointer(manager, 0);
1028
- dispatchClick(manager, 50, 50, 1100);
1029
- expect(fired).toBe(0);
1030
- });
1031
- });
1032
-
1033
- describe('setInteractionConnectGuard', () => {
1034
- it('invokes the installed guard when a signal is connected, and stops after null', () => {
1035
- const root = createDisplayObject();
1036
- const manager = createInteractionManager(root);
1037
- const seen: string[] = [];
1038
- setInteractionConnectGuard((target, name) => {
1039
- void target;
1040
- seen.push(name);
1041
- });
1042
- connectInteractionSignal(manager, root, 'onPointerDown', () => {});
1043
- setInteractionConnectGuard(null);
1044
- connectInteractionSignal(manager, root, 'onPointerUp', () => {});
1045
- expect(seen).toEqual(['onPointerDown']);
1046
- });
1047
- });
1048
-
1049
1022
  function createHitScene3D(options: Readonly<InteractionManagerOptions> = {}) {
1050
1023
  const root = createDisplayObject();
1051
1024
  const child = createDisplayObject();
@@ -1160,3 +1133,43 @@ function createInputSource(): InputSignals {
1160
1133
  onWheel: createSignal(),
1161
1134
  };
1162
1135
  }
1136
+ describe('releaseInteractionPointer', () => {
1137
+ it('stops routing pointer events to the captured target', () => {
1138
+ const { child, manager } = createHitScene3D();
1139
+ let fired = 0;
1140
+ connectSignal(enableInteractionSignals(child).onPointerMove, () => fired++);
1141
+
1142
+ captureInteractionPointer(manager, 3, child);
1143
+ releaseInteractionPointer(manager, 3);
1144
+ dispatchInteractionPointerMove(manager, 500, 500, 0, { pointerId: 3 });
1145
+ expect(fired).toBe(0);
1146
+ });
1147
+
1148
+ it('resets a pending pointer double click', () => {
1149
+ const { child, manager } = createHitScene3D();
1150
+ let fired = 0;
1151
+ setNodePointerDoubleClickEnabled(child, true);
1152
+ connectSignal(enableInteractionSignals(child).onPointerDoubleClick, () => fired++);
1153
+
1154
+ dispatchClick(manager, 50, 50, 1000);
1155
+ releaseInteractionPointer(manager, 0);
1156
+ dispatchClick(manager, 50, 50, 1100);
1157
+ expect(fired).toBe(0);
1158
+ });
1159
+ });
1160
+
1161
+ describe('setInteractionConnectGuard', () => {
1162
+ it('invokes the installed guard when a signal is connected, and stops after null', () => {
1163
+ const root = createDisplayObject();
1164
+ const manager = createInteractionManager(root);
1165
+ const seen: string[] = [];
1166
+ setInteractionConnectGuard((target, name) => {
1167
+ void target;
1168
+ seen.push(name);
1169
+ });
1170
+ connectInteractionSignal(manager, root, 'onPointerDown', () => {});
1171
+ setInteractionConnectGuard(null);
1172
+ connectInteractionSignal(manager, root, 'onPointerUp', () => {});
1173
+ expect(seen).toEqual(['onPointerDown']);
1174
+ });
1175
+ });
@@ -8,6 +8,7 @@ import {
8
8
  getNodeHitArea,
9
9
  getNodeInteractionState,
10
10
  getNodeTabIndex,
11
+ initializeNodeInteractionState,
11
12
  isNodeFocusable,
12
13
  isNodeHitTestEnabled,
13
14
  isNodePointerDoubleClickEnabled,
@@ -78,6 +79,12 @@ describe('getNodeTabIndex', () => {
78
79
  });
79
80
  });
80
81
 
82
+ describe('initializeNodeInteractionState', () => {
83
+ it('is the construction initializer of createNodeInteractionState', () => {
84
+ expect(typeof initializeNodeInteractionState).toBe('function');
85
+ });
86
+ });
87
+
81
88
  describe('isNodeFocusable', () => {
82
89
  it('defaults to false and reflects the setter', () => {
83
90
  const obj = createDisplayObject();
@@ -153,7 +160,6 @@ describe('setNodePointerDoubleClickEnabled', () => {
153
160
  expect(isNodePointerDoubleClickEnabled(obj)).toBe(false);
154
161
  });
155
162
  });
156
-
157
163
  describe('setNodeTabIndex', () => {
158
164
  it('assigns the focus-order key', () => {
159
165
  const obj = createDisplayObject();