@y14e/tabs 2.0.10 → 2.0.11

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/tabs
13
13
  import Tabs from "@y14e/tabs";
14
14
 
15
15
  // CDNs
16
- import Tabs from "https://esm.sh/@y14e/tabs@2.0.10";
16
+ import Tabs from "https://esm.sh/@y14e/tabs@2.0.11";
17
17
  // or
18
- import Tabs from "https://cdn.jsdelivr.net/npm/@y14e/tabs@2.0.10/+esm";
18
+ import Tabs from "https://cdn.jsdelivr.net/npm/@y14e/tabs@2.0.11/+esm";
19
19
  // or
20
- import Tabs from "https://esm.unpkg.com/@y14e/tabs@2.0.10";
20
+ import Tabs from "https://esm.unpkg.com/@y14e/tabs@2.0.11";
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -36,26 +36,26 @@ new Tabs(root, options);
36
36
  interface TabsOptions {
37
37
  animation: {
38
38
  content: {
39
- crossFade: boolean; // default: true
40
- duration: number; // ms (default: 300)
41
- easing: string; // <easing-function> (default: 'ease')
42
- fade: boolean; // default: true
39
+ crossFade: boolean; // default: true
40
+ duration: number; // ms (default: 300)
41
+ easing: string; // <easing-function> (default: 'ease')
42
+ fade: boolean; // default: true
43
43
  };
44
44
  indicator: {
45
- duration: number; // ms (default: 300)
46
- easing: string; // <easing-function> (default: 'ease')
45
+ duration: number; // ms (default: 300)
46
+ easing: string; // <easing-function> (default: 'ease')
47
47
  };
48
48
  };
49
49
  avoidDuplicates: boolean; // default: false
50
- manual: boolean; // default: false
50
+ manual: boolean; // default: false
51
51
  selector: {
52
- content: string; // default: '[role="tablist"] + *'
53
- indicator: string; // default: '[data-tabs-indicator]'
54
- list: string; // default: '[role="tablist"]'
55
- panel: string; // default: '[role="tabpanel"]'
56
- tab: string; // default: '[role="tab"]'
52
+ content: string; // default: '[role="tablist"] + *'
53
+ indicator: string; // default: '[data-tabs-indicator]'
54
+ list: string; // default: '[role="tablist"]'
55
+ panel: string; // default: '[role="tabpanel"]'
56
+ tab: string; // default: '[role="tab"]'
57
57
  };
58
- vertical: boolean; // default: false
58
+ vertical: boolean; // default: false
59
59
  }
60
60
  ```
61
61
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // node_modules/@y14e/attributes-utils/dist/index.js
3
+ // node_modules/@y14e/attribute-util/dist/index.js
4
4
  var DEFAULT_PARSER = (value) => value.split(/\s+/);
5
5
  var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
6
6
  function addAttributeToken(element, name, token, options = {}) {
@@ -49,7 +49,6 @@ function saveAttributes(element_or_elements, name_or_names) {
49
49
  });
50
50
  });
51
51
  }
52
- var addTokenToAttribute = addAttributeToken;
53
52
 
54
53
  // node_modules/power-focusable/dist/index.js
55
54
  var FOCUSABLE_SELECTOR = `:is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])`;
@@ -369,10 +368,10 @@ var Button = class {
369
368
  };
370
369
  };
371
370
 
372
- // node_modules/@y14e/roving-tabindex/node_modules/@y14e/attributes-utils/dist/index.js
371
+ // node_modules/@y14e/attributes-utils/dist/index.js
373
372
  var DEFAULT_PARSER2 = (value) => value.split(/\s+/);
374
373
  var DEFAULT_SERIALIZER2 = (tokens) => tokens.join(" ");
375
- function addTokenToAttribute2(element, name, token, options = {}) {
374
+ function addTokenToAttribute(element, name, token, options = {}) {
376
375
  const value = element.getAttribute(name)?.trim();
377
376
  const {
378
377
  caseInsensitive = false,
@@ -651,7 +650,7 @@ var RovingTabIndex = class _RovingTabIndex {
651
650
  if (char) {
652
651
  keys.add(char);
653
652
  saveAttributes2(focusable, "aria-keyshortcuts");
654
- addTokenToAttribute2(focusable, "aria-keyshortcuts", char, {
653
+ addTokenToAttribute(focusable, "aria-keyshortcuts", char, {
655
654
  caseInsensitive: true
656
655
  });
657
656
  }
@@ -1009,7 +1008,7 @@ var Tabs = class _Tabs {
1009
1008
  return;
1010
1009
  }
1011
1010
  panel.id ||= `tabs-panel-${id}`;
1012
- addTokenToAttribute(tab, "aria-controls", panel.id);
1011
+ addAttributeToken(tab, "aria-controls", panel.id);
1013
1012
  !tab.hasAttribute("aria-selected") && tab.setAttribute("aria-selected", "false");
1014
1013
  const isAvoided = this.#isAvoidedTab(tab);
1015
1014
  if (!isAvoided) {
@@ -1017,7 +1016,7 @@ var Tabs = class _Tabs {
1017
1016
  }
1018
1017
  tab.setAttribute("role", "tab");
1019
1018
  !this.#isFocusable(tab) && tab.style.setProperty("pointer-events", "none");
1020
- addTokenToAttribute(panel, "aria-labelledby", tab.id);
1019
+ addAttributeToken(panel, "aria-labelledby", tab.id);
1021
1020
  tab.addEventListener("click", this.#onTabClick, { signal });
1022
1021
  tab.addEventListener("focus", this.#onTabFocus, { signal });
1023
1022
  this.#buttons.push(new Button(tab));
@@ -1206,7 +1205,7 @@ var TabsIndicator = class {
1206
1205
  * Tabs
1207
1206
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
1208
1207
  *
1209
- * @version 2.0.10
1208
+ * @version 2.0.11
1210
1209
  * @author Yusuke Kamiyamane
1211
1210
  * @license MIT
1212
1211
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1214,15 +1213,15 @@ var TabsIndicator = class {
1214
1213
  */
1215
1214
  /*! Bundled license information:
1216
1215
 
1217
- @y14e/attributes-utils/dist/index.js:
1216
+ @y14e/attribute-util/dist/index.js:
1218
1217
  (**
1219
- * Attributes Utils
1218
+ * Attribute Util
1220
1219
  *
1221
1220
  * @version 2.0.0
1222
1221
  * @author Yusuke Kamiyamane
1223
1222
  * @license MIT
1224
1223
  * @copyright Copyright (c) Yusuke Kamiyamane
1225
- * @see {@link https://github.com/y14e/attributes-utils}
1224
+ * @see {@link https://github.com/y14e/attribute-util}
1226
1225
  *)
1227
1226
 
1228
1227
  power-focusable/dist/index.js:
@@ -1,4 +1,4 @@
1
- // node_modules/@y14e/attributes-utils/dist/index.js
1
+ // node_modules/@y14e/attribute-util/dist/index.js
2
2
  var DEFAULT_PARSER = (value) => value.split(/\s+/);
3
3
  var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
4
4
  function addAttributeToken(element, name, token, options = {}) {
@@ -47,7 +47,6 @@ function saveAttributes(element_or_elements, name_or_names) {
47
47
  });
48
48
  });
49
49
  }
50
- var addTokenToAttribute = addAttributeToken;
51
50
 
52
51
  // node_modules/power-focusable/dist/index.js
53
52
  var FOCUSABLE_SELECTOR = `:is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])`;
@@ -367,10 +366,10 @@ var Button = class {
367
366
  };
368
367
  };
369
368
 
370
- // node_modules/@y14e/roving-tabindex/node_modules/@y14e/attributes-utils/dist/index.js
369
+ // node_modules/@y14e/attributes-utils/dist/index.js
371
370
  var DEFAULT_PARSER2 = (value) => value.split(/\s+/);
372
371
  var DEFAULT_SERIALIZER2 = (tokens) => tokens.join(" ");
373
- function addTokenToAttribute2(element, name, token, options = {}) {
372
+ function addTokenToAttribute(element, name, token, options = {}) {
374
373
  const value = element.getAttribute(name)?.trim();
375
374
  const {
376
375
  caseInsensitive = false,
@@ -649,7 +648,7 @@ var RovingTabIndex = class _RovingTabIndex {
649
648
  if (char) {
650
649
  keys.add(char);
651
650
  saveAttributes2(focusable, "aria-keyshortcuts");
652
- addTokenToAttribute2(focusable, "aria-keyshortcuts", char, {
651
+ addTokenToAttribute(focusable, "aria-keyshortcuts", char, {
653
652
  caseInsensitive: true
654
653
  });
655
654
  }
@@ -1007,7 +1006,7 @@ var Tabs = class _Tabs {
1007
1006
  return;
1008
1007
  }
1009
1008
  panel.id ||= `tabs-panel-${id}`;
1010
- addTokenToAttribute(tab, "aria-controls", panel.id);
1009
+ addAttributeToken(tab, "aria-controls", panel.id);
1011
1010
  !tab.hasAttribute("aria-selected") && tab.setAttribute("aria-selected", "false");
1012
1011
  const isAvoided = this.#isAvoidedTab(tab);
1013
1012
  if (!isAvoided) {
@@ -1015,7 +1014,7 @@ var Tabs = class _Tabs {
1015
1014
  }
1016
1015
  tab.setAttribute("role", "tab");
1017
1016
  !this.#isFocusable(tab) && tab.style.setProperty("pointer-events", "none");
1018
- addTokenToAttribute(panel, "aria-labelledby", tab.id);
1017
+ addAttributeToken(panel, "aria-labelledby", tab.id);
1019
1018
  tab.addEventListener("click", this.#onTabClick, { signal });
1020
1019
  tab.addEventListener("focus", this.#onTabFocus, { signal });
1021
1020
  this.#buttons.push(new Button(tab));
@@ -1204,7 +1203,7 @@ var TabsIndicator = class {
1204
1203
  * Tabs
1205
1204
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
1206
1205
  *
1207
- * @version 2.0.10
1206
+ * @version 2.0.11
1208
1207
  * @author Yusuke Kamiyamane
1209
1208
  * @license MIT
1210
1209
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -1212,15 +1211,15 @@ var TabsIndicator = class {
1212
1211
  */
1213
1212
  /*! Bundled license information:
1214
1213
 
1215
- @y14e/attributes-utils/dist/index.js:
1214
+ @y14e/attribute-util/dist/index.js:
1216
1215
  (**
1217
- * Attributes Utils
1216
+ * Attribute Util
1218
1217
  *
1219
1218
  * @version 2.0.0
1220
1219
  * @author Yusuke Kamiyamane
1221
1220
  * @license MIT
1222
1221
  * @copyright Copyright (c) Yusuke Kamiyamane
1223
- * @see {@link https://github.com/y14e/attributes-utils}
1222
+ * @see {@link https://github.com/y14e/attribute-util}
1224
1223
  *)
1225
1224
 
1226
1225
  power-focusable/dist/index.js:
package/dist/index.cjs CHANGED
@@ -1,11 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var attributesUtils = require('@y14e/attributes-utils');
3
+ var util = require('@y14e/attribute-util');
4
4
  var Button = require('@y14e/button');
5
5
  var rovingTabindex = require('@y14e/roving-tabindex');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var util__namespace = /*#__PURE__*/_interopNamespace(util);
9
28
  var Button__default = /*#__PURE__*/_interopDefault(Button);
10
29
 
11
30
  // src/index.ts
@@ -279,13 +298,13 @@ var Tabs = class _Tabs {
279
298
  this.#onContentAnimationFinish();
280
299
  this.#animationController?.abort();
281
300
  this.#animationController = null;
282
- attributesUtils.restoreAttributes([
301
+ util__namespace.restoreAttributes([
283
302
  ...this.#listElements,
284
303
  ...this.#tabElements,
285
304
  ...this.#indicatorElements,
286
305
  ...this.#panelElements
287
306
  ]);
288
- this.#contentElement && attributesUtils.restoreAttributes(this.#contentElement);
307
+ this.#contentElement && util__namespace.restoreAttributes(this.#contentElement);
289
308
  this.#listElements.length = 0;
290
309
  this.#tabElements.length = 0;
291
310
  this.#contentElement = null;
@@ -293,22 +312,22 @@ var Tabs = class _Tabs {
293
312
  this.#rootElement.removeAttribute("data-tabs-initialized");
294
313
  }
295
314
  #initialize() {
296
- attributesUtils.saveAttributes(this.#listElements, [
315
+ util__namespace.saveAttributes(this.#listElements, [
297
316
  "aria-hidden",
298
317
  "aria-orientation",
299
318
  "role",
300
319
  "style"
301
320
  ]);
302
- attributesUtils.saveAttributes(this.#tabElements, [
321
+ util__namespace.saveAttributes(this.#tabElements, [
303
322
  "aria-controls",
304
323
  "id",
305
324
  "role",
306
325
  "style",
307
326
  "tabindex"
308
327
  ]);
309
- attributesUtils.saveAttributes(this.#indicatorElements, "style");
310
- this.#contentElement && attributesUtils.saveAttributes(this.#contentElement, "style");
311
- attributesUtils.saveAttributes(this.#panelElements, [
328
+ util__namespace.saveAttributes(this.#indicatorElements, "style");
329
+ this.#contentElement && util__namespace.saveAttributes(this.#contentElement, "style");
330
+ util__namespace.saveAttributes(this.#panelElements, [
312
331
  "aria-controls",
313
332
  "aria-labelledby",
314
333
  "id",
@@ -330,7 +349,7 @@ var Tabs = class _Tabs {
330
349
  return;
331
350
  }
332
351
  panel.id ||= `tabs-panel-${id}`;
333
- attributesUtils.addTokenToAttribute(tab, "aria-controls", panel.id);
352
+ util__namespace.addAttributeToken(tab, "aria-controls", panel.id);
334
353
  !tab.hasAttribute("aria-selected") && tab.setAttribute("aria-selected", "false");
335
354
  const isAvoided = this.#isAvoidedTab(tab);
336
355
  if (!isAvoided) {
@@ -338,7 +357,7 @@ var Tabs = class _Tabs {
338
357
  }
339
358
  tab.setAttribute("role", "tab");
340
359
  !this.#isFocusable(tab) && tab.style.setProperty("pointer-events", "none");
341
- attributesUtils.addTokenToAttribute(panel, "aria-labelledby", tab.id);
360
+ util__namespace.addAttributeToken(panel, "aria-labelledby", tab.id);
342
361
  tab.addEventListener("click", this.#onTabClick, { signal });
343
362
  tab.addEventListener("focus", this.#onTabFocus, { signal });
344
363
  this.#buttons.push(new Button__default.default(tab));
@@ -527,7 +546,7 @@ var TabsIndicator = class {
527
546
  * Tabs
528
547
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
529
548
  *
530
- * @version 2.0.10
549
+ * @version 2.0.11
531
550
  * @author Yusuke Kamiyamane
532
551
  * @license MIT
533
552
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Tabs
3
3
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
4
4
  *
5
- * @version 2.0.10
5
+ * @version 2.0.11
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Tabs
3
3
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
4
4
  *
5
- * @version 2.0.10
5
+ * @version 2.0.11
6
6
  * @author Yusuke Kamiyamane
7
7
  * @license MIT
8
8
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { restoreAttributes, saveAttributes, addTokenToAttribute } from '@y14e/attributes-utils';
1
+ import * as util from '@y14e/attribute-util';
2
2
  import Button from '@y14e/button';
3
3
  import { createRovingTabIndex } from '@y14e/roving-tabindex';
4
4
 
@@ -273,13 +273,13 @@ var Tabs = class _Tabs {
273
273
  this.#onContentAnimationFinish();
274
274
  this.#animationController?.abort();
275
275
  this.#animationController = null;
276
- restoreAttributes([
276
+ util.restoreAttributes([
277
277
  ...this.#listElements,
278
278
  ...this.#tabElements,
279
279
  ...this.#indicatorElements,
280
280
  ...this.#panelElements
281
281
  ]);
282
- this.#contentElement && restoreAttributes(this.#contentElement);
282
+ this.#contentElement && util.restoreAttributes(this.#contentElement);
283
283
  this.#listElements.length = 0;
284
284
  this.#tabElements.length = 0;
285
285
  this.#contentElement = null;
@@ -287,22 +287,22 @@ var Tabs = class _Tabs {
287
287
  this.#rootElement.removeAttribute("data-tabs-initialized");
288
288
  }
289
289
  #initialize() {
290
- saveAttributes(this.#listElements, [
290
+ util.saveAttributes(this.#listElements, [
291
291
  "aria-hidden",
292
292
  "aria-orientation",
293
293
  "role",
294
294
  "style"
295
295
  ]);
296
- saveAttributes(this.#tabElements, [
296
+ util.saveAttributes(this.#tabElements, [
297
297
  "aria-controls",
298
298
  "id",
299
299
  "role",
300
300
  "style",
301
301
  "tabindex"
302
302
  ]);
303
- saveAttributes(this.#indicatorElements, "style");
304
- this.#contentElement && saveAttributes(this.#contentElement, "style");
305
- saveAttributes(this.#panelElements, [
303
+ util.saveAttributes(this.#indicatorElements, "style");
304
+ this.#contentElement && util.saveAttributes(this.#contentElement, "style");
305
+ util.saveAttributes(this.#panelElements, [
306
306
  "aria-controls",
307
307
  "aria-labelledby",
308
308
  "id",
@@ -324,7 +324,7 @@ var Tabs = class _Tabs {
324
324
  return;
325
325
  }
326
326
  panel.id ||= `tabs-panel-${id}`;
327
- addTokenToAttribute(tab, "aria-controls", panel.id);
327
+ util.addAttributeToken(tab, "aria-controls", panel.id);
328
328
  !tab.hasAttribute("aria-selected") && tab.setAttribute("aria-selected", "false");
329
329
  const isAvoided = this.#isAvoidedTab(tab);
330
330
  if (!isAvoided) {
@@ -332,7 +332,7 @@ var Tabs = class _Tabs {
332
332
  }
333
333
  tab.setAttribute("role", "tab");
334
334
  !this.#isFocusable(tab) && tab.style.setProperty("pointer-events", "none");
335
- addTokenToAttribute(panel, "aria-labelledby", tab.id);
335
+ util.addAttributeToken(panel, "aria-labelledby", tab.id);
336
336
  tab.addEventListener("click", this.#onTabClick, { signal });
337
337
  tab.addEventListener("focus", this.#onTabFocus, { signal });
338
338
  this.#buttons.push(new Button(tab));
@@ -521,7 +521,7 @@ var TabsIndicator = class {
521
521
  * Tabs
522
522
  * WAI-ARIA compliant tabs pattern implementation in TypeScript.
523
523
  *
524
- * @version 2.0.10
524
+ * @version 2.0.11
525
525
  * @author Yusuke Kamiyamane
526
526
  * @license MIT
527
527
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/tabs",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "WAI-ARIA compliant tabs pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  "node": ">=18"
51
51
  },
52
52
  "dependencies": {
53
- "@y14e/attributes-utils": "^2.0.0",
53
+ "@y14e/attribute-util": "^2.0.0",
54
54
  "@y14e/button": "^1.0.6",
55
55
  "@y14e/roving-tabindex": "^3.1.20"
56
56
  }