@y14e/portal 1.3.4 → 1.3.5
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 +3 -3
- package/dist/index.bundle.cjs +79 -91
- package/dist/index.bundle.js +79 -91
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +31 -31
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.
|
|
16
|
+
import { createPortal } from 'https://esm.sh/@y14e/portal@1.3.5';
|
|
17
17
|
// or
|
|
18
|
-
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.
|
|
18
|
+
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.5/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.
|
|
20
|
+
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.5';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -39,37 +39,13 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
39
39
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
40
40
|
container = document.body;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
composed
|
|
42
|
+
const {
|
|
43
|
+
composed,
|
|
44
44
|
filter,
|
|
45
45
|
include,
|
|
46
|
-
skipNegativeTabIndexCheck
|
|
47
|
-
skipVisibilityCheck
|
|
48
|
-
} = options;
|
|
49
|
-
if (typeof composed !== "boolean") {
|
|
50
|
-
console.warn("Invalid composed option. Fallback: false.");
|
|
51
|
-
composed = false;
|
|
52
|
-
}
|
|
53
|
-
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
54
|
-
console.warn(
|
|
55
|
-
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
56
|
-
);
|
|
57
|
-
filter = void 0;
|
|
58
|
-
}
|
|
59
|
-
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
60
|
-
console.warn(
|
|
61
|
-
"Invalid include function. Fallback: no include function (undefined)."
|
|
62
|
-
);
|
|
63
|
-
include = void 0;
|
|
64
|
-
}
|
|
65
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
66
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
67
|
-
skipNegativeTabIndexCheck = false;
|
|
68
|
-
}
|
|
69
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
70
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
71
|
-
skipVisibilityCheck = false;
|
|
72
|
-
}
|
|
46
|
+
skipNegativeTabIndexCheck,
|
|
47
|
+
skipVisibilityCheck
|
|
48
|
+
} = resolveOptions(options);
|
|
73
49
|
const candidates = [];
|
|
74
50
|
if (composed || include) {
|
|
75
51
|
let traverse2 = function(node) {
|
|
@@ -119,15 +95,7 @@ function isFocusable(element, options = {}) {
|
|
|
119
95
|
console.warn("Invalid element");
|
|
120
96
|
return false;
|
|
121
97
|
}
|
|
122
|
-
|
|
123
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
124
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
125
|
-
skipNegativeTabIndexCheck = false;
|
|
126
|
-
}
|
|
127
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
128
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
129
|
-
skipVisibilityCheck = false;
|
|
130
|
-
}
|
|
98
|
+
const { skipNegativeTabIndexCheck, skipVisibilityCheck } = resolveOptions(options);
|
|
131
99
|
if (element.hasAttribute("hidden") || isInert(element)) {
|
|
132
100
|
return false;
|
|
133
101
|
}
|
|
@@ -156,65 +124,30 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
156
124
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
157
125
|
container = document.body;
|
|
158
126
|
}
|
|
159
|
-
|
|
160
|
-
anchor
|
|
161
|
-
composed
|
|
127
|
+
const {
|
|
128
|
+
anchor,
|
|
129
|
+
composed,
|
|
162
130
|
filter,
|
|
163
131
|
include,
|
|
164
|
-
skipNegativeTabIndexCheck
|
|
165
|
-
skipVisibilityCheck
|
|
166
|
-
wrap
|
|
167
|
-
} = options;
|
|
132
|
+
skipNegativeTabIndexCheck,
|
|
133
|
+
skipVisibilityCheck,
|
|
134
|
+
wrap
|
|
135
|
+
} = resolveOptions(options);
|
|
168
136
|
if (!(anchor instanceof Element)) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
console.warn("Invalid anchor element. Fallback: active element.");
|
|
172
|
-
anchor = active;
|
|
173
|
-
} else {
|
|
174
|
-
console.warn("Invalid anchor element");
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
137
|
+
console.warn("Invalid anchor element");
|
|
138
|
+
return null;
|
|
177
139
|
}
|
|
178
140
|
if (!containsComposed(container, anchor)) {
|
|
179
141
|
console.warn("Anchor (active) element not within container");
|
|
180
142
|
return null;
|
|
181
143
|
}
|
|
182
|
-
|
|
183
|
-
console.warn("Invalid composed option. Fallback: false.");
|
|
184
|
-
composed = false;
|
|
185
|
-
}
|
|
186
|
-
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
187
|
-
console.warn(
|
|
188
|
-
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
189
|
-
);
|
|
190
|
-
filter = void 0;
|
|
191
|
-
}
|
|
192
|
-
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
193
|
-
console.warn(
|
|
194
|
-
"Invalid include function. Fallback: no include function (undefined)."
|
|
195
|
-
);
|
|
196
|
-
include = void 0;
|
|
197
|
-
}
|
|
198
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
199
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
200
|
-
skipNegativeTabIndexCheck = false;
|
|
201
|
-
}
|
|
202
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
203
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
204
|
-
skipVisibilityCheck = false;
|
|
205
|
-
}
|
|
206
|
-
if (typeof wrap !== "boolean") {
|
|
207
|
-
console.warn("Invalid wrap option. Fallback: false.");
|
|
208
|
-
wrap = false;
|
|
209
|
-
}
|
|
210
|
-
const settings = {
|
|
144
|
+
const focusables = getFocusables(container, {
|
|
211
145
|
composed,
|
|
146
|
+
filter,
|
|
147
|
+
include,
|
|
212
148
|
skipNegativeTabIndexCheck,
|
|
213
149
|
skipVisibilityCheck
|
|
214
|
-
};
|
|
215
|
-
filter && Object.assign(settings, { filter });
|
|
216
|
-
include && Object.assign(settings, { include });
|
|
217
|
-
const focusables = getFocusables(container, settings);
|
|
150
|
+
});
|
|
218
151
|
const { length } = focusables;
|
|
219
152
|
if (!length) {
|
|
220
153
|
return null;
|
|
@@ -391,6 +324,61 @@ function isInert(element) {
|
|
|
391
324
|
function isUngroupedRadio(element) {
|
|
392
325
|
return element.type === "radio" && !!element.name;
|
|
393
326
|
}
|
|
327
|
+
function resolveOptions(options) {
|
|
328
|
+
let {
|
|
329
|
+
anchor = getActiveElement(),
|
|
330
|
+
composed = false,
|
|
331
|
+
filter,
|
|
332
|
+
include,
|
|
333
|
+
skipNegativeTabIndexCheck = false,
|
|
334
|
+
skipVisibilityCheck = false,
|
|
335
|
+
wrap = false
|
|
336
|
+
} = options;
|
|
337
|
+
if (!(anchor instanceof Element)) {
|
|
338
|
+
const active = getActiveElement();
|
|
339
|
+
if (active instanceof Element) {
|
|
340
|
+
console.warn("Invalid anchor element. Fallback: active element.");
|
|
341
|
+
anchor = active;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (typeof composed !== "boolean") {
|
|
345
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
346
|
+
composed = false;
|
|
347
|
+
}
|
|
348
|
+
if (filter !== void 0 && typeof filter !== "function") {
|
|
349
|
+
console.warn(
|
|
350
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
351
|
+
);
|
|
352
|
+
filter = void 0;
|
|
353
|
+
}
|
|
354
|
+
if (include !== void 0 && typeof include !== "function") {
|
|
355
|
+
console.warn(
|
|
356
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
357
|
+
);
|
|
358
|
+
include = void 0;
|
|
359
|
+
}
|
|
360
|
+
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
361
|
+
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
362
|
+
skipNegativeTabIndexCheck = false;
|
|
363
|
+
}
|
|
364
|
+
if (typeof skipVisibilityCheck !== "boolean") {
|
|
365
|
+
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
366
|
+
skipVisibilityCheck = false;
|
|
367
|
+
}
|
|
368
|
+
if (typeof wrap !== "boolean") {
|
|
369
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
370
|
+
wrap = false;
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
anchor,
|
|
374
|
+
composed,
|
|
375
|
+
filter,
|
|
376
|
+
include,
|
|
377
|
+
skipNegativeTabIndexCheck,
|
|
378
|
+
skipVisibilityCheck,
|
|
379
|
+
wrap
|
|
380
|
+
};
|
|
381
|
+
}
|
|
394
382
|
|
|
395
383
|
// src/index.ts
|
|
396
384
|
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;`;
|
|
@@ -429,7 +417,7 @@ var Portal = class {
|
|
|
429
417
|
container = document.body;
|
|
430
418
|
}
|
|
431
419
|
this.#container = container;
|
|
432
|
-
this.#settings =
|
|
420
|
+
this.#settings = resolveOptions2(options);
|
|
433
421
|
this.#entranceSentinel = this.#createSentinel();
|
|
434
422
|
this.#exitSentinel = this.#createSentinel();
|
|
435
423
|
this.#initialize();
|
|
@@ -567,7 +555,7 @@ function containsComposed2(container, element) {
|
|
|
567
555
|
}
|
|
568
556
|
return false;
|
|
569
557
|
}
|
|
570
|
-
function
|
|
558
|
+
function resolveOptions2(options) {
|
|
571
559
|
let { noInlineStyle = false } = options;
|
|
572
560
|
if (typeof noInlineStyle !== "boolean") {
|
|
573
561
|
console.warn("Invalid noInlineStyle option. Fallback: false.");
|
|
@@ -580,7 +568,7 @@ function resolveOptions(options) {
|
|
|
580
568
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
581
569
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
582
570
|
*
|
|
583
|
-
* @version 1.3.
|
|
571
|
+
* @version 1.3.5
|
|
584
572
|
* @author Yusuke Kamiyamane
|
|
585
573
|
* @license MIT
|
|
586
574
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -592,7 +580,7 @@ function resolveOptions(options) {
|
|
|
592
580
|
(**
|
|
593
581
|
* Attribute Utils
|
|
594
582
|
*
|
|
595
|
-
* @version 2.0.
|
|
583
|
+
* @version 2.0.8
|
|
596
584
|
* @author Yusuke Kamiyamane
|
|
597
585
|
* @license MIT
|
|
598
586
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -605,7 +593,7 @@ power-focusable/dist/index.js:
|
|
|
605
593
|
* High-precision focus management utility with full composed tree support.
|
|
606
594
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
607
595
|
*
|
|
608
|
-
* @version 4.3.
|
|
596
|
+
* @version 4.3.29
|
|
609
597
|
* @author Yusuke Kamiyamane
|
|
610
598
|
* @license MIT
|
|
611
599
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -37,37 +37,13 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
37
37
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
38
38
|
container = document.body;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
composed
|
|
40
|
+
const {
|
|
41
|
+
composed,
|
|
42
42
|
filter,
|
|
43
43
|
include,
|
|
44
|
-
skipNegativeTabIndexCheck
|
|
45
|
-
skipVisibilityCheck
|
|
46
|
-
} = options;
|
|
47
|
-
if (typeof composed !== "boolean") {
|
|
48
|
-
console.warn("Invalid composed option. Fallback: false.");
|
|
49
|
-
composed = false;
|
|
50
|
-
}
|
|
51
|
-
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
52
|
-
console.warn(
|
|
53
|
-
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
54
|
-
);
|
|
55
|
-
filter = void 0;
|
|
56
|
-
}
|
|
57
|
-
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
58
|
-
console.warn(
|
|
59
|
-
"Invalid include function. Fallback: no include function (undefined)."
|
|
60
|
-
);
|
|
61
|
-
include = void 0;
|
|
62
|
-
}
|
|
63
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
64
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
65
|
-
skipNegativeTabIndexCheck = false;
|
|
66
|
-
}
|
|
67
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
68
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
69
|
-
skipVisibilityCheck = false;
|
|
70
|
-
}
|
|
44
|
+
skipNegativeTabIndexCheck,
|
|
45
|
+
skipVisibilityCheck
|
|
46
|
+
} = resolveOptions(options);
|
|
71
47
|
const candidates = [];
|
|
72
48
|
if (composed || include) {
|
|
73
49
|
let traverse2 = function(node) {
|
|
@@ -117,15 +93,7 @@ function isFocusable(element, options = {}) {
|
|
|
117
93
|
console.warn("Invalid element");
|
|
118
94
|
return false;
|
|
119
95
|
}
|
|
120
|
-
|
|
121
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
122
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
123
|
-
skipNegativeTabIndexCheck = false;
|
|
124
|
-
}
|
|
125
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
126
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
127
|
-
skipVisibilityCheck = false;
|
|
128
|
-
}
|
|
96
|
+
const { skipNegativeTabIndexCheck, skipVisibilityCheck } = resolveOptions(options);
|
|
129
97
|
if (element.hasAttribute("hidden") || isInert(element)) {
|
|
130
98
|
return false;
|
|
131
99
|
}
|
|
@@ -154,65 +122,30 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
154
122
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
155
123
|
container = document.body;
|
|
156
124
|
}
|
|
157
|
-
|
|
158
|
-
anchor
|
|
159
|
-
composed
|
|
125
|
+
const {
|
|
126
|
+
anchor,
|
|
127
|
+
composed,
|
|
160
128
|
filter,
|
|
161
129
|
include,
|
|
162
|
-
skipNegativeTabIndexCheck
|
|
163
|
-
skipVisibilityCheck
|
|
164
|
-
wrap
|
|
165
|
-
} = options;
|
|
130
|
+
skipNegativeTabIndexCheck,
|
|
131
|
+
skipVisibilityCheck,
|
|
132
|
+
wrap
|
|
133
|
+
} = resolveOptions(options);
|
|
166
134
|
if (!(anchor instanceof Element)) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
console.warn("Invalid anchor element. Fallback: active element.");
|
|
170
|
-
anchor = active;
|
|
171
|
-
} else {
|
|
172
|
-
console.warn("Invalid anchor element");
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
135
|
+
console.warn("Invalid anchor element");
|
|
136
|
+
return null;
|
|
175
137
|
}
|
|
176
138
|
if (!containsComposed(container, anchor)) {
|
|
177
139
|
console.warn("Anchor (active) element not within container");
|
|
178
140
|
return null;
|
|
179
141
|
}
|
|
180
|
-
|
|
181
|
-
console.warn("Invalid composed option. Fallback: false.");
|
|
182
|
-
composed = false;
|
|
183
|
-
}
|
|
184
|
-
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
185
|
-
console.warn(
|
|
186
|
-
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
187
|
-
);
|
|
188
|
-
filter = void 0;
|
|
189
|
-
}
|
|
190
|
-
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
191
|
-
console.warn(
|
|
192
|
-
"Invalid include function. Fallback: no include function (undefined)."
|
|
193
|
-
);
|
|
194
|
-
include = void 0;
|
|
195
|
-
}
|
|
196
|
-
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
197
|
-
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
198
|
-
skipNegativeTabIndexCheck = false;
|
|
199
|
-
}
|
|
200
|
-
if (typeof skipVisibilityCheck !== "boolean") {
|
|
201
|
-
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
202
|
-
skipVisibilityCheck = false;
|
|
203
|
-
}
|
|
204
|
-
if (typeof wrap !== "boolean") {
|
|
205
|
-
console.warn("Invalid wrap option. Fallback: false.");
|
|
206
|
-
wrap = false;
|
|
207
|
-
}
|
|
208
|
-
const settings = {
|
|
142
|
+
const focusables = getFocusables(container, {
|
|
209
143
|
composed,
|
|
144
|
+
filter,
|
|
145
|
+
include,
|
|
210
146
|
skipNegativeTabIndexCheck,
|
|
211
147
|
skipVisibilityCheck
|
|
212
|
-
};
|
|
213
|
-
filter && Object.assign(settings, { filter });
|
|
214
|
-
include && Object.assign(settings, { include });
|
|
215
|
-
const focusables = getFocusables(container, settings);
|
|
148
|
+
});
|
|
216
149
|
const { length } = focusables;
|
|
217
150
|
if (!length) {
|
|
218
151
|
return null;
|
|
@@ -389,6 +322,61 @@ function isInert(element) {
|
|
|
389
322
|
function isUngroupedRadio(element) {
|
|
390
323
|
return element.type === "radio" && !!element.name;
|
|
391
324
|
}
|
|
325
|
+
function resolveOptions(options) {
|
|
326
|
+
let {
|
|
327
|
+
anchor = getActiveElement(),
|
|
328
|
+
composed = false,
|
|
329
|
+
filter,
|
|
330
|
+
include,
|
|
331
|
+
skipNegativeTabIndexCheck = false,
|
|
332
|
+
skipVisibilityCheck = false,
|
|
333
|
+
wrap = false
|
|
334
|
+
} = options;
|
|
335
|
+
if (!(anchor instanceof Element)) {
|
|
336
|
+
const active = getActiveElement();
|
|
337
|
+
if (active instanceof Element) {
|
|
338
|
+
console.warn("Invalid anchor element. Fallback: active element.");
|
|
339
|
+
anchor = active;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (typeof composed !== "boolean") {
|
|
343
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
344
|
+
composed = false;
|
|
345
|
+
}
|
|
346
|
+
if (filter !== void 0 && typeof filter !== "function") {
|
|
347
|
+
console.warn(
|
|
348
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
349
|
+
);
|
|
350
|
+
filter = void 0;
|
|
351
|
+
}
|
|
352
|
+
if (include !== void 0 && typeof include !== "function") {
|
|
353
|
+
console.warn(
|
|
354
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
355
|
+
);
|
|
356
|
+
include = void 0;
|
|
357
|
+
}
|
|
358
|
+
if (typeof skipNegativeTabIndexCheck !== "boolean") {
|
|
359
|
+
console.warn("Invalid skipNegativeTabIndexCheck option. Fallback: false.");
|
|
360
|
+
skipNegativeTabIndexCheck = false;
|
|
361
|
+
}
|
|
362
|
+
if (typeof skipVisibilityCheck !== "boolean") {
|
|
363
|
+
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
364
|
+
skipVisibilityCheck = false;
|
|
365
|
+
}
|
|
366
|
+
if (typeof wrap !== "boolean") {
|
|
367
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
368
|
+
wrap = false;
|
|
369
|
+
}
|
|
370
|
+
return {
|
|
371
|
+
anchor,
|
|
372
|
+
composed,
|
|
373
|
+
filter,
|
|
374
|
+
include,
|
|
375
|
+
skipNegativeTabIndexCheck,
|
|
376
|
+
skipVisibilityCheck,
|
|
377
|
+
wrap
|
|
378
|
+
};
|
|
379
|
+
}
|
|
392
380
|
|
|
393
381
|
// src/index.ts
|
|
394
382
|
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;`;
|
|
@@ -427,7 +415,7 @@ var Portal = class {
|
|
|
427
415
|
container = document.body;
|
|
428
416
|
}
|
|
429
417
|
this.#container = container;
|
|
430
|
-
this.#settings =
|
|
418
|
+
this.#settings = resolveOptions2(options);
|
|
431
419
|
this.#entranceSentinel = this.#createSentinel();
|
|
432
420
|
this.#exitSentinel = this.#createSentinel();
|
|
433
421
|
this.#initialize();
|
|
@@ -565,7 +553,7 @@ function containsComposed2(container, element) {
|
|
|
565
553
|
}
|
|
566
554
|
return false;
|
|
567
555
|
}
|
|
568
|
-
function
|
|
556
|
+
function resolveOptions2(options) {
|
|
569
557
|
let { noInlineStyle = false } = options;
|
|
570
558
|
if (typeof noInlineStyle !== "boolean") {
|
|
571
559
|
console.warn("Invalid noInlineStyle option. Fallback: false.");
|
|
@@ -578,7 +566,7 @@ function resolveOptions(options) {
|
|
|
578
566
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
579
567
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
580
568
|
*
|
|
581
|
-
* @version 1.3.
|
|
569
|
+
* @version 1.3.5
|
|
582
570
|
* @author Yusuke Kamiyamane
|
|
583
571
|
* @license MIT
|
|
584
572
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -590,7 +578,7 @@ function resolveOptions(options) {
|
|
|
590
578
|
(**
|
|
591
579
|
* Attribute Utils
|
|
592
580
|
*
|
|
593
|
-
* @version 2.0.
|
|
581
|
+
* @version 2.0.8
|
|
594
582
|
* @author Yusuke Kamiyamane
|
|
595
583
|
* @license MIT
|
|
596
584
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -603,7 +591,7 @@ power-focusable/dist/index.js:
|
|
|
603
591
|
* High-precision focus management utility with full composed tree support.
|
|
604
592
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
605
593
|
*
|
|
606
|
-
* @version 4.3.
|
|
594
|
+
* @version 4.3.29
|
|
607
595
|
* @author Yusuke Kamiyamane
|
|
608
596
|
* @license MIT
|
|
609
597
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -212,7 +212,7 @@ function resolveOptions(options) {
|
|
|
212
212
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
213
213
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
214
214
|
*
|
|
215
|
-
* @version 1.3.
|
|
215
|
+
* @version 1.3.5
|
|
216
216
|
* @author Yusuke Kamiyamane
|
|
217
217
|
* @license MIT
|
|
218
218
|
* @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.
|
|
6
|
+
* @version 1.3.5
|
|
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.
|
|
6
|
+
* @version 1.3.5
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -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.
|
|
192
|
+
* @version 1.3.5
|
|
193
193
|
* @author Yusuke Kamiyamane
|
|
194
194
|
* @license MIT
|
|
195
195
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/portal",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Lightweight DOM portal (teleport) utility with fully focus management",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js",
|
|
13
|
-
"require": "./dist/index.cjs"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist",
|
|
18
|
-
"LICENSE",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsup",
|
|
23
|
-
"prepublishOnly": "npm run build",
|
|
24
|
-
"lint": "tsc --noEmit"
|
|
25
|
-
},
|
|
26
5
|
"keywords": [
|
|
27
6
|
"a11y",
|
|
28
7
|
"accessibility",
|
|
@@ -36,16 +15,41 @@
|
|
|
36
15
|
"typescript",
|
|
37
16
|
"utility"
|
|
38
17
|
],
|
|
39
|
-
"
|
|
40
|
-
"
|
|
18
|
+
"homepage": "https://github.com/y14e/portal#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/y14e/portal/issues"
|
|
21
|
+
},
|
|
41
22
|
"repository": {
|
|
42
23
|
"type": "git",
|
|
43
24
|
"url": "git+https://github.com/y14e/portal.git"
|
|
44
25
|
},
|
|
45
|
-
"
|
|
46
|
-
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"author": "Yusuke Kamiyamane",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"require": "./dist/index.cjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"main": "./dist/index.cjs",
|
|
37
|
+
"module": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"LICENSE",
|
|
42
|
+
"README.md"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"lint": "tsc --noEmit",
|
|
47
|
+
"prepublishOnly": "npm run build"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@y14e/attribute-utils": "^2.0.8",
|
|
51
|
+
"power-focusable": "^4.3.29"
|
|
47
52
|
},
|
|
48
|
-
"homepage": "https://github.com/y14e/portal#readme",
|
|
49
53
|
"devDependencies": {
|
|
50
54
|
"bun-types": "latest",
|
|
51
55
|
"tsup": "^8.0.0",
|
|
@@ -56,9 +60,5 @@
|
|
|
56
60
|
},
|
|
57
61
|
"allowScripts": {
|
|
58
62
|
"esbuild": true
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"@y14e/attribute-utils": "^2.0.6",
|
|
62
|
-
"power-focusable": "^4.3.28"
|
|
63
63
|
}
|
|
64
64
|
}
|