@y14e/portal 1.3.2 → 1.3.4

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.2';
16
+ import { createPortal } from 'https://esm.sh/@y14e/portal@1.3.4';
17
17
  // or
18
- import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.2/+esm';
18
+ import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.4/+esm';
19
19
  // or
20
- import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.2';
20
+ import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.4';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // node_modules/@y14e/attribute-util/dist/index.js
3
+ // node_modules/@y14e/attribute-utils/dist/index.js
4
4
  var snapshots = /* @__PURE__ */ new WeakMap();
5
5
  function restoreAttributes(element_or_elements) {
6
6
  for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
@@ -209,11 +209,11 @@ function getRelativeFocusable(container, offset, options) {
209
209
  }
210
210
  const settings = {
211
211
  composed,
212
- filter,
213
- include,
214
212
  skipNegativeTabIndexCheck,
215
213
  skipVisibilityCheck
216
214
  };
215
+ filter && Object.assign(settings, { filter });
216
+ include && Object.assign(settings, { include });
217
217
  const focusables = getFocusables(container, settings);
218
218
  const { length } = focusables;
219
219
  if (!length) {
@@ -429,12 +429,7 @@ var Portal = class {
429
429
  container = document.body;
430
430
  }
431
431
  this.#container = container;
432
- let { noInlineStyle = false } = options;
433
- if (typeof noInlineStyle !== "boolean") {
434
- console.warn("Invalid noInlineStyle option. Fallback: false.");
435
- noInlineStyle = false;
436
- }
437
- this.#settings = { noInlineStyle };
432
+ this.#settings = resolveOptions(options);
438
433
  this.#entranceSentinel = this.#createSentinel();
439
434
  this.#exitSentinel = this.#createSentinel();
440
435
  this.#initialize();
@@ -572,12 +567,20 @@ function containsComposed2(container, element) {
572
567
  }
573
568
  return false;
574
569
  }
570
+ function resolveOptions(options) {
571
+ let { noInlineStyle = false } = options;
572
+ if (typeof noInlineStyle !== "boolean") {
573
+ console.warn("Invalid noInlineStyle option. Fallback: false.");
574
+ noInlineStyle = false;
575
+ }
576
+ return { noInlineStyle };
577
+ }
575
578
  /**
576
579
  * Portal
577
580
  * Lightweight DOM portal (teleport) utility with fully focus management.
578
581
  * Designed for accessible dialogs, menus, overlays, popovers.
579
582
  *
580
- * @version 1.3.2
583
+ * @version 1.3.4
581
584
  * @author Yusuke Kamiyamane
582
585
  * @license MIT
583
586
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -585,15 +588,15 @@ function containsComposed2(container, element) {
585
588
  */
586
589
  /*! Bundled license information:
587
590
 
588
- @y14e/attribute-util/dist/index.js:
591
+ @y14e/attribute-utils/dist/index.js:
589
592
  (**
590
- * Attribute Util
593
+ * Attribute Utils
591
594
  *
592
- * @version 2.0.0
595
+ * @version 2.0.6
593
596
  * @author Yusuke Kamiyamane
594
597
  * @license MIT
595
598
  * @copyright Copyright (c) Yusuke Kamiyamane
596
- * @see {@link https://github.com/y14e/attribute-util}
599
+ * @see {@link https://github.com/y14e/attribute-utils}
597
600
  *)
598
601
 
599
602
  power-focusable/dist/index.js:
@@ -602,7 +605,7 @@ power-focusable/dist/index.js:
602
605
  * High-precision focus management utility with full composed tree support.
603
606
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
604
607
  *
605
- * @version 4.3.23
608
+ * @version 4.3.28
606
609
  * @author Yusuke Kamiyamane
607
610
  * @license MIT
608
611
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1,4 +1,4 @@
1
- // node_modules/@y14e/attribute-util/dist/index.js
1
+ // node_modules/@y14e/attribute-utils/dist/index.js
2
2
  var snapshots = /* @__PURE__ */ new WeakMap();
3
3
  function restoreAttributes(element_or_elements) {
4
4
  for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
@@ -207,11 +207,11 @@ function getRelativeFocusable(container, offset, options) {
207
207
  }
208
208
  const settings = {
209
209
  composed,
210
- filter,
211
- include,
212
210
  skipNegativeTabIndexCheck,
213
211
  skipVisibilityCheck
214
212
  };
213
+ filter && Object.assign(settings, { filter });
214
+ include && Object.assign(settings, { include });
215
215
  const focusables = getFocusables(container, settings);
216
216
  const { length } = focusables;
217
217
  if (!length) {
@@ -427,12 +427,7 @@ var Portal = class {
427
427
  container = document.body;
428
428
  }
429
429
  this.#container = container;
430
- let { noInlineStyle = false } = options;
431
- if (typeof noInlineStyle !== "boolean") {
432
- console.warn("Invalid noInlineStyle option. Fallback: false.");
433
- noInlineStyle = false;
434
- }
435
- this.#settings = { noInlineStyle };
430
+ this.#settings = resolveOptions(options);
436
431
  this.#entranceSentinel = this.#createSentinel();
437
432
  this.#exitSentinel = this.#createSentinel();
438
433
  this.#initialize();
@@ -570,12 +565,20 @@ function containsComposed2(container, element) {
570
565
  }
571
566
  return false;
572
567
  }
568
+ function resolveOptions(options) {
569
+ let { noInlineStyle = false } = options;
570
+ if (typeof noInlineStyle !== "boolean") {
571
+ console.warn("Invalid noInlineStyle option. Fallback: false.");
572
+ noInlineStyle = false;
573
+ }
574
+ return { noInlineStyle };
575
+ }
573
576
  /**
574
577
  * Portal
575
578
  * Lightweight DOM portal (teleport) utility with fully focus management.
576
579
  * Designed for accessible dialogs, menus, overlays, popovers.
577
580
  *
578
- * @version 1.3.2
581
+ * @version 1.3.4
579
582
  * @author Yusuke Kamiyamane
580
583
  * @license MIT
581
584
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -583,15 +586,15 @@ function containsComposed2(container, element) {
583
586
  */
584
587
  /*! Bundled license information:
585
588
 
586
- @y14e/attribute-util/dist/index.js:
589
+ @y14e/attribute-utils/dist/index.js:
587
590
  (**
588
- * Attribute Util
591
+ * Attribute Utils
589
592
  *
590
- * @version 2.0.0
593
+ * @version 2.0.6
591
594
  * @author Yusuke Kamiyamane
592
595
  * @license MIT
593
596
  * @copyright Copyright (c) Yusuke Kamiyamane
594
- * @see {@link https://github.com/y14e/attribute-util}
597
+ * @see {@link https://github.com/y14e/attribute-utils}
595
598
  *)
596
599
 
597
600
  power-focusable/dist/index.js:
@@ -600,7 +603,7 @@ power-focusable/dist/index.js:
600
603
  * High-precision focus management utility with full composed tree support.
601
604
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
602
605
  *
603
- * @version 4.3.23
606
+ * @version 4.3.28
604
607
  * @author Yusuke Kamiyamane
605
608
  * @license MIT
606
609
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var util = require('@y14e/attribute-util');
3
+ var utils = require('@y14e/attribute-utils');
4
4
  var pf = require('power-focusable');
5
5
 
6
6
  function _interopNamespace(e) {
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  return Object.freeze(n);
22
22
  }
23
23
 
24
- var util__namespace = /*#__PURE__*/_interopNamespace(util);
24
+ var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
25
25
  var pf__namespace = /*#__PURE__*/_interopNamespace(pf);
26
26
 
27
27
  // src/index.ts
@@ -61,12 +61,7 @@ var Portal = class {
61
61
  container = document.body;
62
62
  }
63
63
  this.#container = container;
64
- let { noInlineStyle = false } = options;
65
- if (typeof noInlineStyle !== "boolean") {
66
- console.warn("Invalid noInlineStyle option. Fallback: false.");
67
- noInlineStyle = false;
68
- }
69
- this.#settings = { noInlineStyle };
64
+ this.#settings = resolveOptions(options);
70
65
  this.#entranceSentinel = this.#createSentinel();
71
66
  this.#exitSentinel = this.#createSentinel();
72
67
  this.#initialize();
@@ -78,7 +73,7 @@ var Portal = class {
78
73
  this.#isDestroyed = true;
79
74
  this.#controller?.abort();
80
75
  this.#controller = null;
81
- util__namespace.restoreAttributes([...this.#focusables]);
76
+ utils__namespace.restoreAttributes([...this.#focusables]);
82
77
  this.#focusables.clear();
83
78
  this.#exitSentinel.after(this.#host);
84
79
  this.#entranceSentinel.remove();
@@ -154,14 +149,14 @@ var Portal = class {
154
149
  ]);
155
150
  for (const focusable of this.#focusables) {
156
151
  if (!current.has(focusable)) {
157
- util__namespace.restoreAttributes(focusable);
152
+ utils__namespace.restoreAttributes(focusable);
158
153
  this.#focusables.delete(focusable);
159
154
  }
160
155
  }
161
156
  for (const focusable of current) {
162
157
  if (!this.#focusables.has(focusable)) {
163
158
  this.#focusables.add(focusable);
164
- util__namespace.saveAttributes(focusable, "tabindex");
159
+ utils__namespace.saveAttributes(focusable, "tabindex");
165
160
  focusable.setAttribute("tabindex", "-1");
166
161
  }
167
162
  }
@@ -204,12 +199,20 @@ function containsComposed(container, element) {
204
199
  }
205
200
  return false;
206
201
  }
202
+ function resolveOptions(options) {
203
+ let { noInlineStyle = false } = options;
204
+ if (typeof noInlineStyle !== "boolean") {
205
+ console.warn("Invalid noInlineStyle option. Fallback: false.");
206
+ noInlineStyle = false;
207
+ }
208
+ return { noInlineStyle };
209
+ }
207
210
  /**
208
211
  * Portal
209
212
  * Lightweight DOM portal (teleport) utility with fully focus management.
210
213
  * Designed for accessible dialogs, menus, overlays, popovers.
211
214
  *
212
- * @version 1.3.2
215
+ * @version 1.3.4
213
216
  * @author Yusuke Kamiyamane
214
217
  * @license MIT
215
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.2
6
+ * @version 1.3.4
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.2
6
+ * @version 1.3.4
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as util from '@y14e/attribute-util';
1
+ import * as utils from '@y14e/attribute-utils';
2
2
  import * as pf from 'power-focusable';
3
3
 
4
4
  // src/index.ts
@@ -38,12 +38,7 @@ var Portal = class {
38
38
  container = document.body;
39
39
  }
40
40
  this.#container = container;
41
- let { noInlineStyle = false } = options;
42
- if (typeof noInlineStyle !== "boolean") {
43
- console.warn("Invalid noInlineStyle option. Fallback: false.");
44
- noInlineStyle = false;
45
- }
46
- this.#settings = { noInlineStyle };
41
+ this.#settings = resolveOptions(options);
47
42
  this.#entranceSentinel = this.#createSentinel();
48
43
  this.#exitSentinel = this.#createSentinel();
49
44
  this.#initialize();
@@ -55,7 +50,7 @@ var Portal = class {
55
50
  this.#isDestroyed = true;
56
51
  this.#controller?.abort();
57
52
  this.#controller = null;
58
- util.restoreAttributes([...this.#focusables]);
53
+ utils.restoreAttributes([...this.#focusables]);
59
54
  this.#focusables.clear();
60
55
  this.#exitSentinel.after(this.#host);
61
56
  this.#entranceSentinel.remove();
@@ -131,14 +126,14 @@ var Portal = class {
131
126
  ]);
132
127
  for (const focusable of this.#focusables) {
133
128
  if (!current.has(focusable)) {
134
- util.restoreAttributes(focusable);
129
+ utils.restoreAttributes(focusable);
135
130
  this.#focusables.delete(focusable);
136
131
  }
137
132
  }
138
133
  for (const focusable of current) {
139
134
  if (!this.#focusables.has(focusable)) {
140
135
  this.#focusables.add(focusable);
141
- util.saveAttributes(focusable, "tabindex");
136
+ utils.saveAttributes(focusable, "tabindex");
142
137
  focusable.setAttribute("tabindex", "-1");
143
138
  }
144
139
  }
@@ -181,12 +176,20 @@ function containsComposed(container, element) {
181
176
  }
182
177
  return false;
183
178
  }
179
+ function resolveOptions(options) {
180
+ let { noInlineStyle = false } = options;
181
+ if (typeof noInlineStyle !== "boolean") {
182
+ console.warn("Invalid noInlineStyle option. Fallback: false.");
183
+ noInlineStyle = false;
184
+ }
185
+ return { noInlineStyle };
186
+ }
184
187
  /**
185
188
  * Portal
186
189
  * Lightweight DOM portal (teleport) utility with fully focus management.
187
190
  * Designed for accessible dialogs, menus, overlays, popovers.
188
191
  *
189
- * @version 1.3.2
192
+ * @version 1.3.4
190
193
  * @author Yusuke Kamiyamane
191
194
  * @license MIT
192
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.2",
3
+ "version": "1.3.4",
4
4
  "description": "Lightweight DOM portal (teleport) utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -54,8 +54,11 @@
54
54
  "engines": {
55
55
  "node": ">=18"
56
56
  },
57
+ "allowScripts": {
58
+ "esbuild": true
59
+ },
57
60
  "dependencies": {
58
- "@y14e/attribute-util": "^2.0.0",
59
- "power-focusable": "^4.3.23"
61
+ "@y14e/attribute-utils": "^2.0.6",
62
+ "power-focusable": "^4.3.28"
60
63
  }
61
64
  }