@y14e/portal 1.3.7 → 1.4.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.
package/README.md CHANGED
@@ -13,11 +13,11 @@ npm i @y14e/portal
13
13
  import { createPortal } from '@y14e/portal';
14
14
 
15
15
  // CDNs
16
- import { createPortal } from 'https://esm.sh/@y14e/portal@1.3.7';
16
+ import { createPortal } from 'https://esm.sh/@y14e/portal@1.4.0';
17
17
  // or
18
- import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.7/+esm';
18
+ import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.4.0/+esm';
19
19
  // or
20
- import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.7';
20
+ import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.4.0';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -61,13 +61,13 @@ function getFocusables(container = document.body, options = {}) {
61
61
  traverse2
62
62
  );
63
63
  } else {
64
- for (const m of container.querySelectorAll(
64
+ for (const match of container.querySelectorAll(
65
65
  skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
66
66
  )) {
67
- m && isFocusable(m, {
67
+ match && isFocusable(match, {
68
68
  skipNegativeTabIndexCheck,
69
69
  skipVisibilityCheck
70
- }) && candidates.push(m);
70
+ }) && candidates.push(match);
71
71
  }
72
72
  }
73
73
  return normalizeRadioGroup(
@@ -183,58 +183,58 @@ function isDisabledDeep(element) {
183
183
  }
184
184
  function normalizeRadioGroup(elements) {
185
185
  let map = null;
186
- for (const e of elements) {
187
- if (!(e instanceof HTMLInputElement)) {
186
+ for (const element of elements) {
187
+ if (!(element instanceof HTMLInputElement)) {
188
188
  continue;
189
189
  }
190
- if (!isUngroupedRadio(e)) {
190
+ if (!isUngroupedRadio(element)) {
191
191
  continue;
192
192
  }
193
193
  if (!map) {
194
194
  map = /* @__PURE__ */ new Map();
195
195
  }
196
- const root = e.getRootNode();
196
+ const root = element.getRootNode();
197
197
  let groups = map.get(root);
198
198
  if (!groups) {
199
199
  groups = /* @__PURE__ */ new Map();
200
200
  map.set(root, groups);
201
201
  }
202
- let group = groups.get(e.form);
202
+ let group = groups.get(element.form);
203
203
  if (!group) {
204
204
  group = /* @__PURE__ */ new Map();
205
- groups.set(e.form, group);
205
+ groups.set(element.form, group);
206
206
  }
207
- let radios = group.get(e.name);
207
+ let radios = group.get(element.name);
208
208
  if (!radios) {
209
209
  radios = [];
210
- group.set(e.name, radios);
210
+ group.set(element.name, radios);
211
211
  }
212
- radios.push(e);
212
+ radios.push(element);
213
213
  }
214
214
  if (!map) {
215
215
  return elements;
216
216
  }
217
217
  const placeholder = /* @__PURE__ */ new Set();
218
- for (const v of map.values()) {
219
- for (const w of v.values()) {
220
- for (const x of w.values()) {
221
- const radio = x.find((r) => r.checked) ?? x[0];
218
+ for (const groups of map.values()) {
219
+ for (const group of groups.values()) {
220
+ for (const radios of group.values()) {
221
+ const radio = radios.find((r) => r.checked) ?? radios[0];
222
222
  radio && placeholder.add(radio);
223
223
  }
224
224
  }
225
225
  }
226
- return elements.filter((e) => {
227
- if (!(e instanceof HTMLInputElement)) {
226
+ return elements.filter((element) => {
227
+ if (!(element instanceof HTMLInputElement)) {
228
228
  return true;
229
229
  }
230
- return !isUngroupedRadio(e) || placeholder.has(e);
230
+ return !isUngroupedRadio(element) || placeholder.has(element);
231
231
  });
232
232
  }
233
233
  function sortByTabIndex(elements) {
234
234
  const ordered = [];
235
235
  const natural = [];
236
- for (const e of elements) {
237
- (getTabIndex(e) > 0 ? ordered : natural).push(e);
236
+ for (const element of elements) {
237
+ (getTabIndex(element) > 0 ? ordered : natural).push(element);
238
238
  }
239
239
  return ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b)).concat(natural);
240
240
  }
@@ -412,8 +412,8 @@ var Portal = class {
412
412
  this.#update();
413
413
  this.#controller = new AbortController();
414
414
  const { signal } = this.#controller;
415
- for (const s of [this.#entranceSentinel, this.#exitSentinel]) {
416
- s.addEventListener("focus", this.#onFocus, { signal });
415
+ for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
416
+ sentinel.addEventListener("focus", this.#onFocus, { signal });
417
417
  }
418
418
  this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
419
419
  this.#host.setAttribute("data-portaled", "");
@@ -472,17 +472,17 @@ var Portal = class {
472
472
  ...this.#getFocusables(),
473
473
  ...getFocusables(this.#host, { composed: true })
474
474
  ]);
475
- for (const f of this.#focusables) {
476
- if (!current.has(f)) {
477
- restoreAttributes(f);
478
- this.#focusables.delete(f);
475
+ for (const focusable of this.#focusables) {
476
+ if (!current.has(focusable)) {
477
+ restoreAttributes(focusable);
478
+ this.#focusables.delete(focusable);
479
479
  }
480
480
  }
481
- for (const f of current) {
482
- if (!this.#focusables.has(f)) {
483
- this.#focusables.add(f);
484
- saveAttributes(f, "tabindex");
485
- f.setAttribute("tabindex", "-1");
481
+ for (const focusable of current) {
482
+ if (!this.#focusables.has(focusable)) {
483
+ this.#focusables.add(focusable);
484
+ saveAttributes(focusable, "tabindex");
485
+ focusable.setAttribute("tabindex", "-1");
486
486
  }
487
487
  }
488
488
  }
@@ -537,7 +537,7 @@ function resolveOptions2(options) {
537
537
  * Lightweight DOM portal (teleport) utility with fully focus management.
538
538
  * Designed for accessible dialogs, menus, overlays, popovers.
539
539
  *
540
- * @version 1.3.7
540
+ * @version 1.4.0
541
541
  * @author Yusuke Kamiyamane
542
542
  * @license MIT
543
543
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -562,7 +562,7 @@ power-focusable/dist/index.js:
562
562
  * High-precision focus management utility with full composed tree support.
563
563
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
564
564
  *
565
- * @version 4.3.31
565
+ * @version 4.3.33
566
566
  * @author Yusuke Kamiyamane
567
567
  * @license MIT
568
568
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -59,13 +59,13 @@ function getFocusables(container = document.body, options = {}) {
59
59
  traverse2
60
60
  );
61
61
  } else {
62
- for (const m of container.querySelectorAll(
62
+ for (const match of container.querySelectorAll(
63
63
  skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
64
64
  )) {
65
- m && isFocusable(m, {
65
+ match && isFocusable(match, {
66
66
  skipNegativeTabIndexCheck,
67
67
  skipVisibilityCheck
68
- }) && candidates.push(m);
68
+ }) && candidates.push(match);
69
69
  }
70
70
  }
71
71
  return normalizeRadioGroup(
@@ -181,58 +181,58 @@ function isDisabledDeep(element) {
181
181
  }
182
182
  function normalizeRadioGroup(elements) {
183
183
  let map = null;
184
- for (const e of elements) {
185
- if (!(e instanceof HTMLInputElement)) {
184
+ for (const element of elements) {
185
+ if (!(element instanceof HTMLInputElement)) {
186
186
  continue;
187
187
  }
188
- if (!isUngroupedRadio(e)) {
188
+ if (!isUngroupedRadio(element)) {
189
189
  continue;
190
190
  }
191
191
  if (!map) {
192
192
  map = /* @__PURE__ */ new Map();
193
193
  }
194
- const root = e.getRootNode();
194
+ const root = element.getRootNode();
195
195
  let groups = map.get(root);
196
196
  if (!groups) {
197
197
  groups = /* @__PURE__ */ new Map();
198
198
  map.set(root, groups);
199
199
  }
200
- let group = groups.get(e.form);
200
+ let group = groups.get(element.form);
201
201
  if (!group) {
202
202
  group = /* @__PURE__ */ new Map();
203
- groups.set(e.form, group);
203
+ groups.set(element.form, group);
204
204
  }
205
- let radios = group.get(e.name);
205
+ let radios = group.get(element.name);
206
206
  if (!radios) {
207
207
  radios = [];
208
- group.set(e.name, radios);
208
+ group.set(element.name, radios);
209
209
  }
210
- radios.push(e);
210
+ radios.push(element);
211
211
  }
212
212
  if (!map) {
213
213
  return elements;
214
214
  }
215
215
  const placeholder = /* @__PURE__ */ new Set();
216
- for (const v of map.values()) {
217
- for (const w of v.values()) {
218
- for (const x of w.values()) {
219
- const radio = x.find((r) => r.checked) ?? x[0];
216
+ for (const groups of map.values()) {
217
+ for (const group of groups.values()) {
218
+ for (const radios of group.values()) {
219
+ const radio = radios.find((r) => r.checked) ?? radios[0];
220
220
  radio && placeholder.add(radio);
221
221
  }
222
222
  }
223
223
  }
224
- return elements.filter((e) => {
225
- if (!(e instanceof HTMLInputElement)) {
224
+ return elements.filter((element) => {
225
+ if (!(element instanceof HTMLInputElement)) {
226
226
  return true;
227
227
  }
228
- return !isUngroupedRadio(e) || placeholder.has(e);
228
+ return !isUngroupedRadio(element) || placeholder.has(element);
229
229
  });
230
230
  }
231
231
  function sortByTabIndex(elements) {
232
232
  const ordered = [];
233
233
  const natural = [];
234
- for (const e of elements) {
235
- (getTabIndex(e) > 0 ? ordered : natural).push(e);
234
+ for (const element of elements) {
235
+ (getTabIndex(element) > 0 ? ordered : natural).push(element);
236
236
  }
237
237
  return ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b)).concat(natural);
238
238
  }
@@ -410,8 +410,8 @@ var Portal = class {
410
410
  this.#update();
411
411
  this.#controller = new AbortController();
412
412
  const { signal } = this.#controller;
413
- for (const s of [this.#entranceSentinel, this.#exitSentinel]) {
414
- s.addEventListener("focus", this.#onFocus, { signal });
413
+ for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
414
+ sentinel.addEventListener("focus", this.#onFocus, { signal });
415
415
  }
416
416
  this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
417
417
  this.#host.setAttribute("data-portaled", "");
@@ -470,17 +470,17 @@ var Portal = class {
470
470
  ...this.#getFocusables(),
471
471
  ...getFocusables(this.#host, { composed: true })
472
472
  ]);
473
- for (const f of this.#focusables) {
474
- if (!current.has(f)) {
475
- restoreAttributes(f);
476
- this.#focusables.delete(f);
473
+ for (const focusable of this.#focusables) {
474
+ if (!current.has(focusable)) {
475
+ restoreAttributes(focusable);
476
+ this.#focusables.delete(focusable);
477
477
  }
478
478
  }
479
- for (const f of current) {
480
- if (!this.#focusables.has(f)) {
481
- this.#focusables.add(f);
482
- saveAttributes(f, "tabindex");
483
- f.setAttribute("tabindex", "-1");
479
+ for (const focusable of current) {
480
+ if (!this.#focusables.has(focusable)) {
481
+ this.#focusables.add(focusable);
482
+ saveAttributes(focusable, "tabindex");
483
+ focusable.setAttribute("tabindex", "-1");
484
484
  }
485
485
  }
486
486
  }
@@ -535,7 +535,7 @@ function resolveOptions2(options) {
535
535
  * Lightweight DOM portal (teleport) utility with fully focus management.
536
536
  * Designed for accessible dialogs, menus, overlays, popovers.
537
537
  *
538
- * @version 1.3.7
538
+ * @version 1.4.0
539
539
  * @author Yusuke Kamiyamane
540
540
  * @license MIT
541
541
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -560,7 +560,7 @@ power-focusable/dist/index.js:
560
560
  * High-precision focus management utility with full composed tree support.
561
561
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
562
562
  *
563
- * @version 4.3.31
563
+ * @version 4.3.33
564
564
  * @author Yusuke Kamiyamane
565
565
  * @license MIT
566
566
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -1,28 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('@y14e/attribute-utils');
4
- var pf = require('power-focusable');
5
-
6
- function _interopNamespace(e) {
7
- if (e && e.__esModule) return e;
8
- var n = Object.create(null);
9
- if (e) {
10
- Object.keys(e).forEach(function (k) {
11
- if (k !== 'default') {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
-
24
- var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
25
- var pf__namespace = /*#__PURE__*/_interopNamespace(pf);
3
+ var attributeUtils = require('@y14e/attribute-utils');
4
+ var powerFocusable = require('power-focusable');
26
5
 
27
6
  // src/index.ts
28
7
  var VISUALLY_HIDDEN_CSS = "border: 0; clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; user-select: none; white-space: nowrap; width: 1px;";
@@ -73,7 +52,7 @@ var Portal = class {
73
52
  this.#isDestroyed = true;
74
53
  this.#controller?.abort();
75
54
  this.#controller = null;
76
- utils__namespace.restoreAttributes([...this.#focusables]);
55
+ attributeUtils.restoreAttributes([...this.#focusables]);
77
56
  this.#focusables.clear();
78
57
  this.#exitSentinel.after(this.#host);
79
58
  this.#entranceSentinel.remove();
@@ -87,8 +66,8 @@ var Portal = class {
87
66
  this.#update();
88
67
  this.#controller = new AbortController();
89
68
  const { signal } = this.#controller;
90
- for (const s of [this.#entranceSentinel, this.#exitSentinel]) {
91
- s.addEventListener("focus", this.#onFocus, { signal });
69
+ for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
70
+ sentinel.addEventListener("focus", this.#onFocus, { signal });
92
71
  }
93
72
  this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
94
73
  this.#host.setAttribute("data-portaled", "");
@@ -105,7 +84,7 @@ var Portal = class {
105
84
  }
106
85
  this.#update();
107
86
  const first = [...this.#focusables][0];
108
- first ? pf__namespace.focusElement(first) : this.#moveFocus("next");
87
+ first ? powerFocusable.focusElement(first) : this.#moveFocus("next");
109
88
  } else {
110
89
  if (this.#host.contains(previous)) {
111
90
  this.#moveFocus("next");
@@ -113,7 +92,7 @@ var Portal = class {
113
92
  }
114
93
  this.#update();
115
94
  const last = [...this.#focusables].at(-1);
116
- last ? pf__namespace.focusElement(last) : this.#moveFocus("previous");
95
+ last ? powerFocusable.focusElement(last) : this.#moveFocus("previous");
117
96
  }
118
97
  };
119
98
  #onKeyDown = (event) => {
@@ -124,7 +103,7 @@ var Portal = class {
124
103
  if (key !== "Tab" || altKey || ctrlKey || metaKey) {
125
104
  return;
126
105
  }
127
- const active = pf__namespace.getActiveElement();
106
+ const active = powerFocusable.getActiveElement();
128
107
  if (!(active instanceof Element)) {
129
108
  return;
130
109
  }
@@ -135,7 +114,7 @@ var Portal = class {
135
114
  if (index >= 0) {
136
115
  event.preventDefault();
137
116
  const focusable = focusables[index + (shiftKey ? -1 : 1)];
138
- focusable ? pf__namespace.focusElement(focusable) : this.#focusSentinel(shiftKey);
117
+ focusable ? powerFocusable.focusElement(focusable) : this.#focusSentinel(shiftKey);
139
118
  }
140
119
  } else {
141
120
  event.preventDefault();
@@ -145,19 +124,19 @@ var Portal = class {
145
124
  #update() {
146
125
  const current = /* @__PURE__ */ new Set([
147
126
  ...this.#getFocusables(),
148
- ...pf__namespace.getFocusables(this.#host, { composed: true })
127
+ ...powerFocusable.getFocusables(this.#host, { composed: true })
149
128
  ]);
150
- for (const f of this.#focusables) {
151
- if (!current.has(f)) {
152
- utils__namespace.restoreAttributes(f);
153
- this.#focusables.delete(f);
129
+ for (const focusable of this.#focusables) {
130
+ if (!current.has(focusable)) {
131
+ attributeUtils.restoreAttributes(focusable);
132
+ this.#focusables.delete(focusable);
154
133
  }
155
134
  }
156
- for (const f of current) {
157
- if (!this.#focusables.has(f)) {
158
- this.#focusables.add(f);
159
- utils__namespace.saveAttributes(f, "tabindex");
160
- f.setAttribute("tabindex", "-1");
135
+ for (const focusable of current) {
136
+ if (!this.#focusables.has(focusable)) {
137
+ this.#focusables.add(focusable);
138
+ attributeUtils.saveAttributes(focusable, "tabindex");
139
+ focusable.setAttribute("tabindex", "-1");
161
140
  }
162
141
  }
163
142
  }
@@ -175,7 +154,7 @@ var Portal = class {
175
154
  (isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus();
176
155
  }
177
156
  #getFocusables() {
178
- return pf__namespace.getFocusables(this.#host, {
157
+ return powerFocusable.getFocusables(this.#host, {
179
158
  composed: true,
180
159
  include: (element) => this.#focusables.has(element)
181
160
  });
@@ -185,8 +164,8 @@ var Portal = class {
185
164
  anchor: direction === "previous" ? this.#entranceSentinel : this.#exitSentinel,
186
165
  composed: true
187
166
  };
188
- const focusable = direction === "previous" ? pf__namespace.getPreviousFocusable(document.body, options) : pf__namespace.getNextFocusable(document.body, options);
189
- focusable && pf__namespace.focusElement(focusable);
167
+ const focusable = direction === "previous" ? powerFocusable.getPreviousFocusable(document.body, options) : powerFocusable.getNextFocusable(document.body, options);
168
+ focusable && powerFocusable.focusElement(focusable);
190
169
  }
191
170
  };
192
171
  function containsComposed(container, element) {
@@ -212,7 +191,7 @@ function resolveOptions(options) {
212
191
  * Lightweight DOM portal (teleport) utility with fully focus management.
213
192
  * Designed for accessible dialogs, menus, overlays, popovers.
214
193
  *
215
- * @version 1.3.7
194
+ * @version 1.4.0
216
195
  * @author Yusuke Kamiyamane
217
196
  * @license MIT
218
197
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Lightweight DOM portal (teleport) utility with fully focus management.
4
4
  * Designed for accessible dialogs, menus, overlays, popovers.
5
5
  *
6
- * @version 1.3.7
6
+ * @version 1.4.0
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Lightweight DOM portal (teleport) utility with fully focus management.
4
4
  * Designed for accessible dialogs, menus, overlays, popovers.
5
5
  *
6
- * @version 1.3.7
6
+ * @version 1.4.0
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import * as utils from '@y14e/attribute-utils';
2
- import * as pf from 'power-focusable';
1
+ import { restoreAttributes, saveAttributes } from '@y14e/attribute-utils';
2
+ import { focusElement, getActiveElement, getFocusables, getPreviousFocusable, getNextFocusable } from 'power-focusable';
3
3
 
4
4
  // src/index.ts
5
5
  var VISUALLY_HIDDEN_CSS = "border: 0; clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; user-select: none; white-space: nowrap; width: 1px;";
@@ -50,7 +50,7 @@ var Portal = class {
50
50
  this.#isDestroyed = true;
51
51
  this.#controller?.abort();
52
52
  this.#controller = null;
53
- utils.restoreAttributes([...this.#focusables]);
53
+ restoreAttributes([...this.#focusables]);
54
54
  this.#focusables.clear();
55
55
  this.#exitSentinel.after(this.#host);
56
56
  this.#entranceSentinel.remove();
@@ -64,8 +64,8 @@ var Portal = class {
64
64
  this.#update();
65
65
  this.#controller = new AbortController();
66
66
  const { signal } = this.#controller;
67
- for (const s of [this.#entranceSentinel, this.#exitSentinel]) {
68
- s.addEventListener("focus", this.#onFocus, { signal });
67
+ for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
68
+ sentinel.addEventListener("focus", this.#onFocus, { signal });
69
69
  }
70
70
  this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
71
71
  this.#host.setAttribute("data-portaled", "");
@@ -82,7 +82,7 @@ var Portal = class {
82
82
  }
83
83
  this.#update();
84
84
  const first = [...this.#focusables][0];
85
- first ? pf.focusElement(first) : this.#moveFocus("next");
85
+ first ? focusElement(first) : this.#moveFocus("next");
86
86
  } else {
87
87
  if (this.#host.contains(previous)) {
88
88
  this.#moveFocus("next");
@@ -90,7 +90,7 @@ var Portal = class {
90
90
  }
91
91
  this.#update();
92
92
  const last = [...this.#focusables].at(-1);
93
- last ? pf.focusElement(last) : this.#moveFocus("previous");
93
+ last ? focusElement(last) : this.#moveFocus("previous");
94
94
  }
95
95
  };
96
96
  #onKeyDown = (event) => {
@@ -101,7 +101,7 @@ var Portal = class {
101
101
  if (key !== "Tab" || altKey || ctrlKey || metaKey) {
102
102
  return;
103
103
  }
104
- const active = pf.getActiveElement();
104
+ const active = getActiveElement();
105
105
  if (!(active instanceof Element)) {
106
106
  return;
107
107
  }
@@ -112,7 +112,7 @@ var Portal = class {
112
112
  if (index >= 0) {
113
113
  event.preventDefault();
114
114
  const focusable = focusables[index + (shiftKey ? -1 : 1)];
115
- focusable ? pf.focusElement(focusable) : this.#focusSentinel(shiftKey);
115
+ focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
116
116
  }
117
117
  } else {
118
118
  event.preventDefault();
@@ -122,19 +122,19 @@ var Portal = class {
122
122
  #update() {
123
123
  const current = /* @__PURE__ */ new Set([
124
124
  ...this.#getFocusables(),
125
- ...pf.getFocusables(this.#host, { composed: true })
125
+ ...getFocusables(this.#host, { composed: true })
126
126
  ]);
127
- for (const f of this.#focusables) {
128
- if (!current.has(f)) {
129
- utils.restoreAttributes(f);
130
- this.#focusables.delete(f);
127
+ for (const focusable of this.#focusables) {
128
+ if (!current.has(focusable)) {
129
+ restoreAttributes(focusable);
130
+ this.#focusables.delete(focusable);
131
131
  }
132
132
  }
133
- for (const f of current) {
134
- if (!this.#focusables.has(f)) {
135
- this.#focusables.add(f);
136
- utils.saveAttributes(f, "tabindex");
137
- f.setAttribute("tabindex", "-1");
133
+ for (const focusable of current) {
134
+ if (!this.#focusables.has(focusable)) {
135
+ this.#focusables.add(focusable);
136
+ saveAttributes(focusable, "tabindex");
137
+ focusable.setAttribute("tabindex", "-1");
138
138
  }
139
139
  }
140
140
  }
@@ -152,7 +152,7 @@ var Portal = class {
152
152
  (isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus();
153
153
  }
154
154
  #getFocusables() {
155
- return pf.getFocusables(this.#host, {
155
+ return getFocusables(this.#host, {
156
156
  composed: true,
157
157
  include: (element) => this.#focusables.has(element)
158
158
  });
@@ -162,8 +162,8 @@ var Portal = class {
162
162
  anchor: direction === "previous" ? this.#entranceSentinel : this.#exitSentinel,
163
163
  composed: true
164
164
  };
165
- const focusable = direction === "previous" ? pf.getPreviousFocusable(document.body, options) : pf.getNextFocusable(document.body, options);
166
- focusable && pf.focusElement(focusable);
165
+ const focusable = direction === "previous" ? getPreviousFocusable(document.body, options) : getNextFocusable(document.body, options);
166
+ focusable && focusElement(focusable);
167
167
  }
168
168
  };
169
169
  function containsComposed(container, element) {
@@ -189,7 +189,7 @@ function resolveOptions(options) {
189
189
  * Lightweight DOM portal (teleport) utility with fully focus management.
190
190
  * Designed for accessible dialogs, menus, overlays, popovers.
191
191
  *
192
- * @version 1.3.7
192
+ * @version 1.4.0
193
193
  * @author Yusuke Kamiyamane
194
194
  * @license MIT
195
195
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/portal",
3
- "version": "1.3.7",
3
+ "version": "1.4.0",
4
4
  "description": "Lightweight DOM portal (teleport) utility with fully focus management",
5
5
  "keywords": [
6
6
  "a11y",
@@ -59,6 +59,6 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@y14e/attribute-utils": "^2.0.11",
62
- "power-focusable": "^4.3.31"
62
+ "power-focusable": "^4.3.33"
63
63
  }
64
64
  }