@fusion.dev/helix-core 0.162.1 → 0.164.0

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.
@@ -19665,6 +19665,25 @@
19665
19665
  "privacy": "protected",
19666
19666
  "description": "Where focus lands when a neighbor that held it is removed: the dismiss control.",
19667
19667
  "readonly": true
19668
+ },
19669
+ {
19670
+ "kind": "field",
19671
+ "name": "present",
19672
+ "type": {
19673
+ "text": "boolean"
19674
+ },
19675
+ "privacy": "protected",
19676
+ "readonly": true
19677
+ },
19678
+ {
19679
+ "kind": "method",
19680
+ "name": "handFocusOn",
19681
+ "privacy": "protected",
19682
+ "return": {
19683
+ "type": {
19684
+ "text": "void"
19685
+ }
19686
+ }
19668
19687
  }
19669
19688
  ],
19670
19689
  "helix": {}
@@ -19729,6 +19748,27 @@
19729
19748
  "description": "Where focus lands when a neighbor that held it is removed: this\nelement's dismiss control.\n\nA seam for a member whose focus lives elsewhere: a tag in a Tag Group is\na row the arrows move between, so a removed row hands focus to the next\nrow rather than to its remove button.",
19730
19749
  "readonly": true
19731
19750
  },
19751
+ {
19752
+ "kind": "field",
19753
+ "name": "present",
19754
+ "type": {
19755
+ "text": "boolean"
19756
+ },
19757
+ "privacy": "protected",
19758
+ "description": "Whether the element is still on the page for a reader, which is what\nthe focus hand-off waits on: connected, for a surface the page removes.\nA surface that hides itself says it is gone once hidden, and calls\n`handFocusOn` then.",
19759
+ "readonly": true
19760
+ },
19761
+ {
19762
+ "kind": "method",
19763
+ "name": "handFocusOn",
19764
+ "privacy": "protected",
19765
+ "return": {
19766
+ "type": {
19767
+ "text": "void"
19768
+ }
19769
+ },
19770
+ "description": "Hands focus on now, where a dismissal is waiting for this element to\ngo: for a surface that hides itself, once it has."
19771
+ },
19732
19772
  {
19733
19773
  "kind": "method",
19734
19774
  "name": "dismiss",
@@ -33143,7 +33183,7 @@
33143
33183
  "type": {
33144
33184
  "text": "string"
33145
33185
  },
33146
- "default": "'0.162.1'",
33186
+ "default": "'0.164.0'",
33147
33187
  "description": "The version of the package this file ships in.\n\n**Written by `fusion/scripts/version.mjs`** wherever it writes the package's\n`package.json`, and stamped back into the repository beside it after a\nrelease, so the two never disagree; a spec beside this holds them to it.\nNothing else in the running code knows which release it is."
33148
33188
  }
33149
33189
  ],
@@ -33703,6 +33743,6 @@
33703
33743
  ],
33704
33744
  "helix": {
33705
33745
  "package": "@fusion.dev/helix-core",
33706
- "version": "0.162.1"
33746
+ "version": "0.164.0"
33707
33747
  }
33708
33748
  }
@@ -15,6 +15,8 @@ export declare class DismissibleElement {
15
15
  protected dismissEvent(): HelixDismissEvent;
16
16
  /** Where focus lands when a neighbor that held it is removed: the dismiss control. */
17
17
  protected get returnFocusTo(): HTMLElement | null;
18
+ protected get present(): boolean;
19
+ protected handFocusOn(): void;
18
20
  }
19
21
  /**
20
22
  * Grafts `dismissible`, its label, and the event that says so.
@@ -29,6 +29,16 @@ export const MixinDismissible = (Base) => {
29
29
  get returnFocusTo() {
30
30
  return this.shadowRoot?.querySelector('[part~="dismiss"]') ?? null;
31
31
  }
32
+ get present() {
33
+ return this.isConnected;
34
+ }
35
+ handFocusOn() {
36
+ const settle = this.handOff;
37
+ if (settle) {
38
+ this.forgetFocus?.();
39
+ requestAnimationFrame(() => settle(true));
40
+ }
41
+ }
32
42
  dismiss() {
33
43
  const inside = deepContains(this, deepActiveElement());
34
44
  const neighbors = inside ? this.neighbors() : [];
@@ -70,7 +80,8 @@ export const MixinDismissible = (Base) => {
70
80
  this.forgetFocus?.();
71
81
  const settle = (late) => {
72
82
  const active = document.activeElement;
73
- if (this.isConnected || (active !== null && active !== document.body)) {
83
+ const dropped = active === null || active === document.body || deepContains(this, active);
84
+ if (this.present || !dropped) {
74
85
  return;
75
86
  }
76
87
  for (const neighbor of neighbors) {
@@ -101,11 +112,7 @@ export const MixinDismissible = (Base) => {
101
112
  }
102
113
  disconnectedCallback() {
103
114
  super.disconnectedCallback();
104
- const settle = this.handOff;
105
- if (settle) {
106
- this.forgetFocus?.();
107
- requestAnimationFrame(() => settle(true));
108
- }
115
+ this.handFocusOn();
109
116
  }
110
117
  }
111
118
  __decorate([
package/dist/version.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  * release, so the two never disagree; a spec beside this holds them to it.
7
7
  * Nothing else in the running code knows which release it is.
8
8
  */
9
- export declare const VERSION = "0.162.1";
9
+ export declare const VERSION = "0.164.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.162.1';
1
+ export const VERSION = '0.164.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-core",
3
3
  "description": "Helix element primitives: base classes, mixins, decorators, utilities.",
4
- "version": "0.162.1",
4
+ "version": "0.164.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -56,11 +56,11 @@
56
56
  "bugs": "https://github.com/project-fusion/fusion/issues",
57
57
  "dependencies": {
58
58
  "@floating-ui/dom": "^1.8.0",
59
- "@fusion.dev/helix-icons": "0.162.1"
59
+ "@fusion.dev/helix-icons": "0.164.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@fusion.dev/helix-cem": "0.162.1",
63
- "@fusion.dev/helix-testing": "0.162.1",
62
+ "@fusion.dev/helix-cem": "0.164.0",
63
+ "@fusion.dev/helix-testing": "0.164.0",
64
64
  "@lit-labs/ssr": "^4.1.0",
65
65
  "lit": "^3.2.1"
66
66
  },