@fusion.dev/helix-headless 0.104.0 → 0.104.1

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.
@@ -12538,6 +12538,13 @@
12538
12538
  "readonly": true,
12539
12539
  "description": "A stop a reader landed on becomes the tab stop, and a card comes into view.\n\nInto view rather than to the middle: a reader walking a row of cards that\nare all on screen should see the focus ring move along it, not the board\nlurch under every press."
12540
12540
  },
12541
+ {
12542
+ "kind": "field",
12543
+ "name": "handleFocusOut",
12544
+ "privacy": "private",
12545
+ "readonly": true,
12546
+ "description": "A connection being made from the keyboard ends when the reader leaves\nthe board, as Escape ends it.\n\nOtherwise the board went on showing every card as somewhere to land, and\na reader who came back and pressed Enter on a card connected something\nthey had long since walked away from. Only for somewhere else on the\npage: a window losing focus names nothing, and the reader switching away\nand back is still in the middle of it. A pointer's connection is its\nown, ended by its release."
12547
+ },
12541
12548
  {
12542
12549
  "kind": "method",
12543
12550
  "name": "reveal",
@@ -700,6 +700,18 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
700
700
  * lurch under every press.
701
701
  */
702
702
  private readonly handleFocusIn;
703
+ /**
704
+ * A connection being made from the keyboard ends when the reader leaves
705
+ * the board, as Escape ends it.
706
+ *
707
+ * Otherwise the board went on showing every card as somewhere to land, and
708
+ * a reader who came back and pressed Enter on a card connected something
709
+ * they had long since walked away from. Only for somewhere else on the
710
+ * page: a window losing focus names nothing, and the reader switching away
711
+ * and back is still in the middle of it. A pointer's connection is its
712
+ * own, ended by its release.
713
+ */
714
+ private readonly handleFocusOut;
703
715
  /** Brings a card into view, where it is not already whole in it. */
704
716
  private reveal;
705
717
  /**
@@ -291,7 +291,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
291
291
  if (this.linking.pressed) {
292
292
  const clicked = this.linking.edge;
293
293
  this.linking = undefined;
294
- if (clicked !== undefined && pointing) {
294
+ if (clicked !== undefined && pointing && event.type !== 'pointercancel') {
295
295
  this.clicked(clicked, event);
296
296
  }
297
297
  return;
@@ -316,7 +316,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
316
316
  return;
317
317
  }
318
318
  this.carrying = undefined;
319
- if (!carry.started && pointing) {
319
+ if (!carry.started && pointing && event.type !== 'pointercancel') {
320
320
  this.clicked(carry.pressed, event);
321
321
  }
322
322
  if (carry.moved) {
@@ -326,7 +326,8 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
326
326
  }
327
327
  if (this.dragging?.pointer === event.pointerId) {
328
328
  const drag = this.dragging;
329
- if (Math.hypot(event.clientX - drag.from.x, event.clientY - drag.from.y) < SLOP) {
329
+ if (event.type !== 'pointercancel' &&
330
+ Math.hypot(event.clientX - drag.from.x, event.clientY - drag.from.y) < SLOP) {
330
331
  if (drag.pressed !== undefined && pointing) {
331
332
  this.clicked(drag.pressed, event);
332
333
  }
@@ -508,6 +509,20 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
508
509
  this.reveal(card.name);
509
510
  }
510
511
  };
512
+ this.handleFocusOut = (event) => {
513
+ const next = event.relatedTarget;
514
+ const linking = this.linking;
515
+ if (!linking ||
516
+ linking.pointer !== undefined ||
517
+ linking.held ||
518
+ !(next instanceof Node) ||
519
+ this.contains(next) ||
520
+ this.renderRoot.contains(next)) {
521
+ return;
522
+ }
523
+ this.linking = undefined;
524
+ this.said = this.stoppedLabel;
525
+ };
511
526
  this.handleDoubleClick = (event) => {
512
527
  const path = event.composedPath();
513
528
  if (path.some((one) => one instanceof Element && one.matches(INTERACTIVE))) {
@@ -1462,6 +1477,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
1462
1477
  this.watchWords();
1463
1478
  this.addEventListener('dblclick', this.handleDoubleClick);
1464
1479
  this.addEventListener('focusin', this.handleFocusIn);
1480
+ this.addEventListener('focusout', this.handleFocusOut);
1465
1481
  this.addEventListener('keydown', this.handleStopKeydown);
1466
1482
  this.addEventListener('pointercancel', this.handlePointerUp);
1467
1483
  this.addEventListener('pointerdown', this.handlePointerDown);
@@ -1478,6 +1494,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
1478
1494
  this.words?.disconnect();
1479
1495
  this.removeEventListener('dblclick', this.handleDoubleClick);
1480
1496
  this.removeEventListener('focusin', this.handleFocusIn);
1497
+ this.removeEventListener('focusout', this.handleFocusOut);
1481
1498
  this.removeEventListener('keydown', this.handleStopKeydown);
1482
1499
  this.removeEventListener('pointercancel', this.handlePointerUp);
1483
1500
  this.removeEventListener('pointerdown', this.handlePointerDown);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-headless",
3
3
  "description": "Headless component tier. Structure, accessibility, state, and form participation. No styling.",
4
- "version": "0.104.0",
4
+ "version": "0.104.1",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -46,13 +46,13 @@
46
46
  },
47
47
  "bugs": "https://github.com/project-fusion/fusion/issues",
48
48
  "dependencies": {
49
- "@fusion.dev/helix-core": "0.104.0",
50
- "@fusion.dev/helix-icons": "0.104.0",
49
+ "@fusion.dev/helix-core": "0.104.1",
50
+ "@fusion.dev/helix-icons": "0.104.1",
51
51
  "uqr": "^0.1.3"
52
52
  },
53
53
  "devDependencies": {
54
- "@fusion.dev/helix-cem": "0.104.0",
55
- "@fusion.dev/helix-testing": "0.104.0",
54
+ "@fusion.dev/helix-cem": "0.104.1",
55
+ "@fusion.dev/helix-testing": "0.104.1",
56
56
  "@fusion.dev/scripts": "0.0.0-dev",
57
57
  "@happy-dom/global-registrator": "^20.0.0",
58
58
  "@lit-labs/ssr": "^4.1.0",