coveragebook_components 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/app.css +427 -303
  3. data/app/assets/build/coco/app.js +458 -226
  4. data/app/assets/build/coco/book.js +378 -175
  5. data/app/assets/build/coco/icons/armchair.svg +1 -1
  6. data/app/assets/build/coco/icons/folder-archive.svg +1 -1
  7. data/app/assets/build/coco/icons/folder-check.svg +1 -1
  8. data/app/assets/build/coco/icons/folder-clock.svg +1 -1
  9. data/app/assets/build/coco/icons/folder-closed.svg +1 -1
  10. data/app/assets/build/coco/icons/folder-cog.svg +1 -1
  11. data/app/assets/build/coco/icons/folder-down.svg +1 -1
  12. data/app/assets/build/coco/icons/folder-edit.svg +1 -1
  13. data/app/assets/build/coco/icons/folder-git.svg +1 -1
  14. data/app/assets/build/coco/icons/folder-heart.svg +1 -1
  15. data/app/assets/build/coco/icons/folder-input.svg +1 -1
  16. data/app/assets/build/coco/icons/folder-key.svg +1 -1
  17. data/app/assets/build/coco/icons/folder-lock.svg +1 -1
  18. data/app/assets/build/coco/icons/folder-minus.svg +1 -1
  19. data/app/assets/build/coco/icons/folder-open.svg +1 -1
  20. data/app/assets/build/coco/icons/folder-plus.svg +1 -1
  21. data/app/assets/build/coco/icons/folder-search-2.svg +1 -1
  22. data/app/assets/build/coco/icons/folder-search.svg +1 -1
  23. data/app/assets/build/coco/icons/folder-tree.svg +1 -1
  24. data/app/assets/build/coco/icons/folder-up.svg +1 -1
  25. data/app/assets/build/coco/icons/folder-x.svg +1 -1
  26. data/app/assets/build/coco/icons/folder.svg +1 -1
  27. data/app/assets/build/coco/icons/folders.svg +1 -1
  28. data/app/assets/build/coco/icons/git-commit-vertical.svg +1 -0
  29. data/app/assets/build/coco/icons/git-compare-arrows.svg +1 -0
  30. data/app/assets/build/coco/icons/git-fork.svg +1 -1
  31. data/app/assets/build/coco/icons/git-graph.svg +1 -0
  32. data/app/assets/build/coco/icons/git-pull-request-arrow.svg +1 -0
  33. data/app/assets/build/coco/icons/git-pull-request-closed.svg +1 -1
  34. data/app/assets/build/coco/icons/git-pull-request-create-arrow.svg +1 -0
  35. data/app/assets/build/coco/icons/git-pull-request-create.svg +1 -0
  36. data/app/assets/build/coco/icons/power-circle.svg +1 -0
  37. data/app/assets/build/coco/icons/power-square.svg +1 -0
  38. data/app/assets/build/coco/icons/power.svg +1 -1
  39. data/app/components/coco/app/blocks/sidebar_nav/item/item.css +121 -0
  40. data/app/components/coco/app/blocks/sidebar_nav/item/item.html.erb +9 -0
  41. data/app/components/coco/app/blocks/{sidebar_nav_item/sidebar_nav_item.js → sidebar_nav/item/item.js} +12 -5
  42. data/app/components/coco/app/blocks/sidebar_nav/item/item.rb +50 -0
  43. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.css +138 -0
  44. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.html.erb +24 -0
  45. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.js +13 -0
  46. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.rb +48 -0
  47. data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.css +75 -0
  48. data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.html.erb +29 -0
  49. data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.rb +50 -0
  50. data/app/components/coco/base/icon/icon.rb +1 -0
  51. data/app/components/coco/component.rb +2 -2
  52. data/app/helpers/coco/app_helper.rb +5 -1
  53. data/app/helpers/coco/book_helper.rb +4 -4
  54. data/app/helpers/coco/component_helper.rb +2 -2
  55. data/app/helpers/coco/integration_helper.rb +4 -4
  56. data/config/icons.json +9 -1
  57. data/config/tokens.cjs +6 -0
  58. data/lib/coco/options/group.rb +9 -9
  59. data/lib/coco/test_helpers.rb +2 -2
  60. data/lib/coco.rb +1 -1
  61. metadata +23 -11
  62. data/app/components/coco/app/blocks/sidebar_nav/sidebar_nav.css +0 -110
  63. data/app/components/coco/app/blocks/sidebar_nav/sidebar_nav.html.erb +0 -42
  64. data/app/components/coco/app/blocks/sidebar_nav/sidebar_nav.rb +0 -28
  65. data/app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.css +0 -153
  66. data/app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.html.erb +0 -45
  67. data/app/components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.rb +0 -108
  68. /data/app/assets/build/coco/icons/{git-commit.svg → git-commit-horizontal.svg} +0 -0
  69. /data/app/components/coco/app/blocks/sidebar_nav/{sidebar_nav.js → navbar/navbar.js} +0 -0
@@ -6154,6 +6154,12 @@
6154
6154
  xl: "1200px",
6155
6155
  "2xl": "1400px",
6156
6156
  max: "1800px",
6157
+ "max-sm": { max: "576px" },
6158
+ "max-md": { max: "768px" },
6159
+ "max-lg": { max: "992px" },
6160
+ "max-xl": { max: "1200px" },
6161
+ "max-2xl": { max: "1400px" },
6162
+ "max-max": { max: "1800px" },
6157
6163
  letterbox: { raw: "(max-height: 760px) and (min-width: 576px)" },
6158
6164
  print: { raw: "print" }
6159
6165
  // Note: PDFs are rendered at a viewport width of 1280px
@@ -14038,7 +14044,7 @@
14038
14044
  var package_default = {
14039
14045
  name: "coveragebook-components",
14040
14046
  type: "module",
14041
- version: "0.8.2",
14047
+ version: "0.8.3",
14042
14048
  main: "index.js",
14043
14049
  repository: "git@github.com:coveragebook/coco.git",
14044
14050
  author: "Mark Perkins <mark@coveragebook.com>",
@@ -14047,38 +14053,38 @@
14047
14053
  "defaults"
14048
14054
  ],
14049
14055
  dependencies: {
14050
- "@alpinejs/collapse": "^3.11.1",
14051
- "@alpinejs/focus": "^3.11.1",
14052
- "@alpinejs/intersect": "^3.11.1",
14053
- "@alpinejs/mask": "^3.12.0",
14056
+ "@alpinejs/collapse": "^3.13.2",
14057
+ "@alpinejs/focus": "^3.13.2",
14058
+ "@alpinejs/intersect": "^3.13.2",
14059
+ "@alpinejs/mask": "^3.13.2",
14054
14060
  "@alpinejs/morph": "^3.11.1",
14055
14061
  "@jaames/iro": "^5.5.2",
14056
14062
  "@tailwindcss/container-queries": "^0.1.0",
14057
14063
  "@tailwindcss/forms": "^0.5.3",
14058
14064
  alpinejs: "^3.11.1",
14059
14065
  "container-query-polyfill": "^1.0.2",
14060
- del: "^7.0.0",
14066
+ del: "^7.1.0",
14061
14067
  html2canvas: "^1.4.1",
14062
14068
  "js-cookie": "^3.0.5",
14063
14069
  lodash: "^4.17.21",
14064
- "lucide-static": "^0.288.0",
14070
+ "lucide-static": "^0.290.0",
14065
14071
  tailwindcss: "^3.3.0",
14066
14072
  "tippy.js": "^6.3.7"
14067
14073
  },
14068
14074
  devDependencies: {
14069
- "@percy/cli": "^1.26.1",
14075
+ "@percy/cli": "^1.27.3",
14070
14076
  "alias-hq": "^6.1.0",
14071
14077
  "alpinejs-tash": "^1.0.9",
14072
- autoprefixer: "^10.4.13",
14078
+ autoprefixer: "^10.4.16",
14073
14079
  esbuild: "^0.17.10",
14074
14080
  "esbuild-plugin-copy": "^2.0.2",
14075
- "fast-glob": "^3.2.12",
14081
+ "fast-glob": "^3.3.1",
14076
14082
  "fast-sort": "^3.2.1",
14077
14083
  husky: "^8.0.3",
14078
14084
  jest: "^29.4.3",
14079
14085
  "jest-environment-jsdom": "^29.4.3",
14080
14086
  "lint-staged": "^13.1.2",
14081
- postcss: "^8.4.21",
14087
+ postcss: "^8.4.31",
14082
14088
  "postcss-cli": "^10.1.0",
14083
14089
  "postcss-value-parser": "^4.2.0",
14084
14090
  prettier: "^2.8.4",
@@ -19039,7 +19045,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19039
19045
  let evaluate2 = evaluateLater2(expression);
19040
19046
  let options = {
19041
19047
  rootMargin: getRootMargin(modifiers),
19042
- threshold: getThreshhold(modifiers)
19048
+ threshold: getThreshold(modifiers)
19043
19049
  };
19044
19050
  let observer2 = new IntersectionObserver((entries) => {
19045
19051
  entries.forEach((entry) => {
@@ -19055,7 +19061,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19055
19061
  });
19056
19062
  });
19057
19063
  }
19058
- function getThreshhold(modifiers) {
19064
+ function getThreshold(modifiers) {
19059
19065
  if (modifiers.includes("full"))
19060
19066
  return 0.99;
19061
19067
  if (modifiers.includes("half"))
@@ -19103,8 +19109,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19103
19109
  evaluator((value2) => {
19104
19110
  result = typeof value2 === "function" ? value2(input) : value2;
19105
19111
  }, { scope: {
19106
- $input: input,
19107
- $money: formatMoney.bind({ el })
19112
+ // These are "magics" we'll make available to the x-mask:function:
19113
+ "$input": input,
19114
+ "$money": formatMoney.bind({ el })
19108
19115
  } });
19109
19116
  });
19110
19117
  return result;
@@ -19152,7 +19159,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19152
19159
  let unformattedValue = el.value;
19153
19160
  callback();
19154
19161
  let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition);
19155
- let newPosition = buildUp(template, stripDown(template, beforeLeftOfCursorBeforeFormatting)).length;
19162
+ let newPosition = buildUp(
19163
+ template,
19164
+ stripDown(
19165
+ template,
19166
+ beforeLeftOfCursorBeforeFormatting
19167
+ )
19168
+ ).length;
19156
19169
  el.setSelectionRange(newPosition, newPosition);
19157
19170
  }
19158
19171
  function stripDown(template, input) {
@@ -19160,7 +19173,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19160
19173
  let output = "";
19161
19174
  let regexes = {
19162
19175
  "9": /[0-9]/,
19163
- a: /[a-zA-Z]/,
19176
+ "a": /[a-zA-Z]/,
19164
19177
  "*": /[a-zA-Z0-9]/
19165
19178
  };
19166
19179
  let wildcardTemplate = "";
@@ -19210,7 +19223,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19210
19223
  return "-";
19211
19224
  if (/^\D+$/.test(input))
19212
19225
  return "9";
19213
- thousands = thousands != null ? thousands : delimiter === "," ? "." : ",";
19226
+ if (thousands === null || thousands === void 0) {
19227
+ thousands = delimiter === "," ? "." : ",";
19228
+ }
19214
19229
  let addThousands = (input2, thousands2) => {
19215
19230
  let output = "";
19216
19231
  let counter = 0;
@@ -19245,10 +19260,16 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19245
19260
  var module_default5 = src_default5;
19246
19261
 
19247
19262
  // ../../../node_modules/@alpinejs/focus/dist/module.esm.js
19248
- var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
19263
+ var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]:not(slot)", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
19249
19264
  var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
19250
- var matches = typeof Element === "undefined" ? function() {
19265
+ var NoElement = typeof Element === "undefined";
19266
+ var matches = NoElement ? function() {
19251
19267
  } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
19268
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
19269
+ return element.getRootNode();
19270
+ } : function(element) {
19271
+ return element.ownerDocument;
19272
+ };
19252
19273
  var getCandidates = function getCandidates2(el, includeContainer, filter) {
19253
19274
  var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
19254
19275
  if (includeContainer && matches.call(el, candidateSelector)) {
@@ -19257,19 +19278,53 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19257
19278
  candidates = candidates.filter(filter);
19258
19279
  return candidates;
19259
19280
  };
19260
- var isContentEditable = function isContentEditable2(node) {
19261
- return node.contentEditable === "true";
19262
- };
19263
- var getTabindex = function getTabindex2(node) {
19264
- var tabindexAttr = parseInt(node.getAttribute("tabindex"), 10);
19265
- if (!isNaN(tabindexAttr)) {
19266
- return tabindexAttr;
19267
- }
19268
- if (isContentEditable(node)) {
19269
- return 0;
19281
+ var getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {
19282
+ var candidates = [];
19283
+ var elementsToCheck = Array.from(elements);
19284
+ while (elementsToCheck.length) {
19285
+ var element = elementsToCheck.shift();
19286
+ if (element.tagName === "SLOT") {
19287
+ var assigned = element.assignedElements();
19288
+ var content2 = assigned.length ? assigned : element.children;
19289
+ var nestedCandidates = getCandidatesIteratively2(content2, true, options);
19290
+ if (options.flatten) {
19291
+ candidates.push.apply(candidates, nestedCandidates);
19292
+ } else {
19293
+ candidates.push({
19294
+ scope: element,
19295
+ candidates: nestedCandidates
19296
+ });
19297
+ }
19298
+ } else {
19299
+ var validCandidate = matches.call(element, candidateSelector);
19300
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
19301
+ candidates.push(element);
19302
+ }
19303
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
19304
+ typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
19305
+ var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
19306
+ if (shadowRoot && validShadowRoot) {
19307
+ var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);
19308
+ if (options.flatten) {
19309
+ candidates.push.apply(candidates, _nestedCandidates);
19310
+ } else {
19311
+ candidates.push({
19312
+ scope: element,
19313
+ candidates: _nestedCandidates
19314
+ });
19315
+ }
19316
+ } else {
19317
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
19318
+ }
19319
+ }
19270
19320
  }
19271
- if ((node.nodeName === "AUDIO" || node.nodeName === "VIDEO" || node.nodeName === "DETAILS") && node.getAttribute("tabindex") === null) {
19272
- return 0;
19321
+ return candidates;
19322
+ };
19323
+ var getTabindex = function getTabindex2(node, isScope) {
19324
+ if (node.tabIndex < 0) {
19325
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute("tabindex"), 10))) {
19326
+ return 0;
19327
+ }
19273
19328
  }
19274
19329
  return node.tabIndex;
19275
19330
  };
@@ -19299,7 +19354,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19299
19354
  if (!node.name) {
19300
19355
  return true;
19301
19356
  }
19302
- var radioScope = node.form || node.ownerDocument;
19357
+ var radioScope = node.form || getRootNode(node);
19303
19358
  var queryRadios = function queryRadios2(name) {
19304
19359
  return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
19305
19360
  };
@@ -19323,7 +19378,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19323
19378
  var isNonTabbableRadio = function isNonTabbableRadio2(node) {
19324
19379
  return isRadio(node) && !isTabbableRadio(node);
19325
19380
  };
19326
- var isHidden = function isHidden2(node, displayCheck) {
19381
+ var isZeroArea = function isZeroArea2(node) {
19382
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
19383
+ return width === 0 && height === 0;
19384
+ };
19385
+ var isHidden = function isHidden2(node, _ref) {
19386
+ var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
19327
19387
  if (getComputedStyle(node).visibility === "hidden") {
19328
19388
  return true;
19329
19389
  }
@@ -19332,31 +19392,43 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19332
19392
  if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
19333
19393
  return true;
19334
19394
  }
19395
+ var nodeRootHost = getRootNode(node).host;
19396
+ var nodeIsAttached = (nodeRootHost === null || nodeRootHost === void 0 ? void 0 : nodeRootHost.ownerDocument.contains(nodeRootHost)) || node.ownerDocument.contains(node);
19335
19397
  if (!displayCheck || displayCheck === "full") {
19336
- while (node) {
19337
- if (getComputedStyle(node).display === "none") {
19338
- return true;
19398
+ if (typeof getShadowRoot === "function") {
19399
+ var originalNode = node;
19400
+ while (node) {
19401
+ var parentElement = node.parentElement;
19402
+ var rootNode = getRootNode(node);
19403
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
19404
+ return isZeroArea(node);
19405
+ } else if (node.assignedSlot) {
19406
+ node = node.assignedSlot;
19407
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
19408
+ node = rootNode.host;
19409
+ } else {
19410
+ node = parentElement;
19411
+ }
19339
19412
  }
19340
- node = node.parentElement;
19413
+ node = originalNode;
19414
+ }
19415
+ if (nodeIsAttached) {
19416
+ return !node.getClientRects().length;
19341
19417
  }
19342
19418
  } else if (displayCheck === "non-zero-area") {
19343
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
19344
- return width === 0 && height === 0;
19419
+ return isZeroArea(node);
19345
19420
  }
19346
19421
  return false;
19347
19422
  };
19348
19423
  var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
19349
- if (isInput(node) || node.tagName === "SELECT" || node.tagName === "TEXTAREA" || node.tagName === "BUTTON") {
19424
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
19350
19425
  var parentNode = node.parentElement;
19351
19426
  while (parentNode) {
19352
19427
  if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
19353
19428
  for (var i3 = 0; i3 < parentNode.children.length; i3++) {
19354
19429
  var child = parentNode.children.item(i3);
19355
19430
  if (child.tagName === "LEGEND") {
19356
- if (child.contains(node)) {
19357
- return false;
19358
- }
19359
- return true;
19431
+ return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
19360
19432
  }
19361
19433
  }
19362
19434
  return true;
@@ -19367,44 +19439,89 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19367
19439
  return false;
19368
19440
  };
19369
19441
  var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
19370
- if (node.disabled || isHiddenInput(node) || isHidden(node, options.displayCheck) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
19442
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
19443
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
19371
19444
  return false;
19372
19445
  }
19373
19446
  return true;
19374
19447
  };
19375
19448
  var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
19376
- if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
19449
+ if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
19377
19450
  return false;
19378
19451
  }
19379
19452
  return true;
19380
19453
  };
19381
- var tabbable = function tabbable2(el, options) {
19382
- options = options || {};
19454
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {
19455
+ var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
19456
+ if (isNaN(tabIndex) || tabIndex >= 0) {
19457
+ return true;
19458
+ }
19459
+ return false;
19460
+ };
19461
+ var sortByOrder = function sortByOrder2(candidates) {
19383
19462
  var regularTabbables = [];
19384
19463
  var orderedTabbables = [];
19385
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
19386
- candidates.forEach(function(candidate, i3) {
19387
- var candidateTabindex = getTabindex(candidate);
19464
+ candidates.forEach(function(item, i3) {
19465
+ var isScope = !!item.scope;
19466
+ var element = isScope ? item.scope : item;
19467
+ var candidateTabindex = getTabindex(element, isScope);
19468
+ var elements = isScope ? sortByOrder2(item.candidates) : element;
19388
19469
  if (candidateTabindex === 0) {
19389
- regularTabbables.push(candidate);
19470
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
19390
19471
  } else {
19391
19472
  orderedTabbables.push({
19392
19473
  documentOrder: i3,
19393
19474
  tabIndex: candidateTabindex,
19394
- node: candidate
19475
+ item,
19476
+ isScope,
19477
+ content: elements
19395
19478
  });
19396
19479
  }
19397
19480
  });
19398
- var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function(a3) {
19399
- return a3.node;
19400
- }).concat(regularTabbables);
19401
- return tabbableNodes;
19481
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
19482
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
19483
+ return acc;
19484
+ }, []).concat(regularTabbables);
19485
+ };
19486
+ var tabbable = function tabbable2(el, options) {
19487
+ options = options || {};
19488
+ var candidates;
19489
+ if (options.getShadowRoot) {
19490
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
19491
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
19492
+ flatten: false,
19493
+ getShadowRoot: options.getShadowRoot,
19494
+ shadowRootFilter: isValidShadowRootTabbable
19495
+ });
19496
+ } else {
19497
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
19498
+ }
19499
+ return sortByOrder(candidates);
19402
19500
  };
19403
19501
  var focusable = function focusable2(el, options) {
19404
19502
  options = options || {};
19405
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
19503
+ var candidates;
19504
+ if (options.getShadowRoot) {
19505
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
19506
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
19507
+ flatten: true,
19508
+ getShadowRoot: options.getShadowRoot
19509
+ });
19510
+ } else {
19511
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
19512
+ }
19406
19513
  return candidates;
19407
19514
  };
19515
+ var isTabbable = function isTabbable2(node, options) {
19516
+ options = options || {};
19517
+ if (!node) {
19518
+ throw new Error("No node provided");
19519
+ }
19520
+ if (matches.call(node, candidateSelector) === false) {
19521
+ return false;
19522
+ }
19523
+ return isNodeMatchingSelectorTabbable(options, node);
19524
+ };
19408
19525
  var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
19409
19526
  var isFocusable = function isFocusable2(node, options) {
19410
19527
  options = options || {};
@@ -19420,29 +19537,20 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19420
19537
  var keys = Object.keys(object);
19421
19538
  if (Object.getOwnPropertySymbols) {
19422
19539
  var symbols = Object.getOwnPropertySymbols(object);
19423
- if (enumerableOnly) {
19424
- symbols = symbols.filter(function(sym) {
19425
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19426
- });
19427
- }
19428
- keys.push.apply(keys, symbols);
19540
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
19541
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19542
+ })), keys.push.apply(keys, symbols);
19429
19543
  }
19430
19544
  return keys;
19431
19545
  }
19432
19546
  function _objectSpread2(target) {
19433
19547
  for (var i3 = 1; i3 < arguments.length; i3++) {
19434
- var source = arguments[i3] != null ? arguments[i3] : {};
19435
- if (i3 % 2) {
19436
- ownKeys2(Object(source), true).forEach(function(key) {
19437
- _defineProperty(target, key, source[key]);
19438
- });
19439
- } else if (Object.getOwnPropertyDescriptors) {
19440
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
19441
- } else {
19442
- ownKeys2(Object(source)).forEach(function(key) {
19443
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
19444
- });
19445
- }
19548
+ var source = null != arguments[i3] ? arguments[i3] : {};
19549
+ i3 % 2 ? ownKeys2(Object(source), true).forEach(function(key) {
19550
+ _defineProperty(target, key, source[key]);
19551
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys2(Object(source)).forEach(function(key) {
19552
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
19553
+ });
19446
19554
  }
19447
19555
  return target;
19448
19556
  }
@@ -19517,64 +19625,103 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19517
19625
  }
19518
19626
  return typeof value === "function" ? value.apply(void 0, params) : value;
19519
19627
  };
19628
+ var getActualTarget = function getActualTarget2(event) {
19629
+ return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target;
19630
+ };
19520
19631
  var createFocusTrap = function createFocusTrap2(elements, userOptions) {
19521
- var doc = document;
19632
+ var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
19522
19633
  var config = _objectSpread2({
19523
19634
  returnFocusOnDeactivate: true,
19524
19635
  escapeDeactivates: true,
19525
19636
  delayInitialFocus: true
19526
19637
  }, userOptions);
19527
19638
  var state = {
19639
+ // containers given to createFocusTrap()
19640
+ // @type {Array<HTMLElement>}
19528
19641
  containers: [],
19642
+ // list of objects identifying tabbable nodes in `containers` in the trap
19643
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
19644
+ // is active, but the trap should never get to a state where there isn't at least one group
19645
+ // with at least one tabbable node in it (that would lead to an error condition that would
19646
+ // result in an error being thrown)
19647
+ // @type {Array<{
19648
+ // container: HTMLElement,
19649
+ // tabbableNodes: Array<HTMLElement>, // empty if none
19650
+ // focusableNodes: Array<HTMLElement>, // empty if none
19651
+ // firstTabbableNode: HTMLElement|null,
19652
+ // lastTabbableNode: HTMLElement|null,
19653
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
19654
+ // }>}
19655
+ containerGroups: [],
19656
+ // same order/length as `containers` list
19657
+ // references to objects in `containerGroups`, but only those that actually have
19658
+ // tabbable nodes in them
19659
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
19660
+ // the same length
19529
19661
  tabbableGroups: [],
19530
19662
  nodeFocusedBeforeActivation: null,
19531
19663
  mostRecentlyFocusedNode: null,
19532
19664
  active: false,
19533
19665
  paused: false,
19666
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
19667
+ // has been delayed during activation
19534
19668
  delayInitialFocusTimer: void 0
19535
19669
  };
19536
19670
  var trap;
19537
19671
  var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
19538
19672
  return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
19539
19673
  };
19540
- var containersContain = function containersContain2(element) {
19541
- return state.containers.some(function(container) {
19542
- return container.contains(element);
19674
+ var findContainerIndex = function findContainerIndex2(element) {
19675
+ return state.containerGroups.findIndex(function(_ref) {
19676
+ var container = _ref.container, tabbableNodes = _ref.tabbableNodes;
19677
+ return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
19678
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
19679
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
19680
+ // look inside web components even if open)
19681
+ tabbableNodes.find(function(node) {
19682
+ return node === element;
19683
+ });
19543
19684
  });
19544
19685
  };
19545
19686
  var getNodeForOption = function getNodeForOption2(optionName) {
19546
19687
  var optionValue = config[optionName];
19688
+ if (typeof optionValue === "function") {
19689
+ for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
19690
+ params[_key2 - 1] = arguments[_key2];
19691
+ }
19692
+ optionValue = optionValue.apply(void 0, params);
19693
+ }
19694
+ if (optionValue === true) {
19695
+ optionValue = void 0;
19696
+ }
19547
19697
  if (!optionValue) {
19548
- return null;
19698
+ if (optionValue === void 0 || optionValue === false) {
19699
+ return optionValue;
19700
+ }
19701
+ throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
19549
19702
  }
19550
19703
  var node = optionValue;
19551
19704
  if (typeof optionValue === "string") {
19552
19705
  node = doc.querySelector(optionValue);
19553
19706
  if (!node) {
19554
- throw new Error("`".concat(optionName, "` refers to no known node"));
19555
- }
19556
- }
19557
- if (typeof optionValue === "function") {
19558
- node = optionValue();
19559
- if (!node) {
19560
- throw new Error("`".concat(optionName, "` did not return a node"));
19707
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
19561
19708
  }
19562
19709
  }
19563
19710
  return node;
19564
19711
  };
19565
19712
  var getInitialFocusNode = function getInitialFocusNode2() {
19566
- var node;
19567
- if (getOption({}, "initialFocus") === false) {
19713
+ var node = getNodeForOption("initialFocus");
19714
+ if (node === false) {
19568
19715
  return false;
19569
19716
  }
19570
- if (getNodeForOption("initialFocus") !== null) {
19571
- node = getNodeForOption("initialFocus");
19572
- } else if (containersContain(doc.activeElement)) {
19573
- node = doc.activeElement;
19574
- } else {
19575
- var firstTabbableGroup = state.tabbableGroups[0];
19576
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
19577
- node = firstTabbableNode || getNodeForOption("fallbackFocus");
19717
+ if (node === void 0) {
19718
+ if (findContainerIndex(doc.activeElement) >= 0) {
19719
+ node = doc.activeElement;
19720
+ } else {
19721
+ var firstTabbableGroup = state.tabbableGroups[0];
19722
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
19723
+ node = firstTabbableNode || getNodeForOption("fallbackFocus");
19724
+ }
19578
19725
  }
19579
19726
  if (!node) {
19580
19727
  throw new Error("Your focus-trap needs to have at least one focusable element");
@@ -19582,18 +19729,44 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19582
19729
  return node;
19583
19730
  };
19584
19731
  var updateTabbableNodes = function updateTabbableNodes2() {
19585
- state.tabbableGroups = state.containers.map(function(container) {
19586
- var tabbableNodes = tabbable(container);
19587
- if (tabbableNodes.length > 0) {
19588
- return {
19589
- container,
19590
- firstTabbableNode: tabbableNodes[0],
19591
- lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
19592
- };
19593
- }
19594
- return void 0;
19595
- }).filter(function(group) {
19596
- return !!group;
19732
+ state.containerGroups = state.containers.map(function(container) {
19733
+ var tabbableNodes = tabbable(container, config.tabbableOptions);
19734
+ var focusableNodes = focusable(container, config.tabbableOptions);
19735
+ return {
19736
+ container,
19737
+ tabbableNodes,
19738
+ focusableNodes,
19739
+ firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
19740
+ lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
19741
+ /**
19742
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
19743
+ * in this container, if any.
19744
+ * @param {HTMLElement} node
19745
+ * @param {boolean} [forward] True if going in forward tab order; false if going
19746
+ * in reverse.
19747
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
19748
+ */
19749
+ nextTabbableNode: function nextTabbableNode(node) {
19750
+ var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
19751
+ var nodeIdx = focusableNodes.findIndex(function(n3) {
19752
+ return n3 === node;
19753
+ });
19754
+ if (nodeIdx < 0) {
19755
+ return void 0;
19756
+ }
19757
+ if (forward) {
19758
+ return focusableNodes.slice(nodeIdx + 1).find(function(n3) {
19759
+ return isTabbable(n3, config.tabbableOptions);
19760
+ });
19761
+ }
19762
+ return focusableNodes.slice(0, nodeIdx).reverse().find(function(n3) {
19763
+ return isTabbable(n3, config.tabbableOptions);
19764
+ });
19765
+ }
19766
+ };
19767
+ });
19768
+ state.tabbableGroups = state.containerGroups.filter(function(group) {
19769
+ return group.tabbableNodes.length > 0;
19597
19770
  });
19598
19771
  if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
19599
19772
  throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
@@ -19619,16 +19792,28 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19619
19792
  }
19620
19793
  };
19621
19794
  var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
19622
- var node = getNodeForOption("setReturnFocus");
19623
- return node ? node : previousActiveElement;
19795
+ var node = getNodeForOption("setReturnFocus", previousActiveElement);
19796
+ return node ? node : node === false ? false : previousActiveElement;
19624
19797
  };
19625
19798
  var checkPointerDown = function checkPointerDown2(e3) {
19626
- if (containersContain(e3.target)) {
19799
+ var target = getActualTarget(e3);
19800
+ if (findContainerIndex(target) >= 0) {
19627
19801
  return;
19628
19802
  }
19629
19803
  if (valueOrHandler(config.clickOutsideDeactivates, e3)) {
19630
19804
  trap.deactivate({
19631
- returnFocus: config.returnFocusOnDeactivate && !isFocusable(e3.target)
19805
+ // if, on deactivation, we should return focus to the node originally-focused
19806
+ // when the trap was activated (or the configured `setReturnFocus` node),
19807
+ // then assume it's also OK to return focus to the outside node that was
19808
+ // just clicked, causing deactivation, as long as that node is focusable;
19809
+ // if it isn't focusable, then return focus to the original node focused
19810
+ // on activation (or the configured `setReturnFocus` node)
19811
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
19812
+ // which will result in the outside click setting focus to the node
19813
+ // that was clicked, whether it's focusable or not; by setting
19814
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
19815
+ // on activation (or the configured `setReturnFocus` node)
19816
+ returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
19632
19817
  });
19633
19818
  return;
19634
19819
  }
@@ -19638,10 +19823,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19638
19823
  e3.preventDefault();
19639
19824
  };
19640
19825
  var checkFocusIn = function checkFocusIn2(e3) {
19641
- var targetContained = containersContain(e3.target);
19642
- if (targetContained || e3.target instanceof Document) {
19826
+ var target = getActualTarget(e3);
19827
+ var targetContained = findContainerIndex(target) >= 0;
19828
+ if (targetContained || target instanceof Document) {
19643
19829
  if (targetContained) {
19644
- state.mostRecentlyFocusedNode = e3.target;
19830
+ state.mostRecentlyFocusedNode = target;
19645
19831
  }
19646
19832
  } else {
19647
19833
  e3.stopImmediatePropagation();
@@ -19649,13 +19835,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19649
19835
  }
19650
19836
  };
19651
19837
  var checkTab = function checkTab2(e3) {
19838
+ var target = getActualTarget(e3);
19652
19839
  updateTabbableNodes();
19653
19840
  var destinationNode = null;
19654
19841
  if (state.tabbableGroups.length > 0) {
19655
- var containerIndex = findIndex(state.tabbableGroups, function(_ref) {
19656
- var container = _ref.container;
19657
- return container.contains(e3.target);
19658
- });
19842
+ var containerIndex = findContainerIndex(target);
19843
+ var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0;
19659
19844
  if (containerIndex < 0) {
19660
19845
  if (e3.shiftKey) {
19661
19846
  destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
@@ -19665,9 +19850,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19665
19850
  } else if (e3.shiftKey) {
19666
19851
  var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
19667
19852
  var firstTabbableNode = _ref2.firstTabbableNode;
19668
- return e3.target === firstTabbableNode;
19853
+ return target === firstTabbableNode;
19669
19854
  });
19670
- if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e3.target) {
19855
+ if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
19671
19856
  startOfGroupIndex = containerIndex;
19672
19857
  }
19673
19858
  if (startOfGroupIndex >= 0) {
@@ -19678,9 +19863,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19678
19863
  } else {
19679
19864
  var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
19680
19865
  var lastTabbableNode = _ref3.lastTabbableNode;
19681
- return e3.target === lastTabbableNode;
19866
+ return target === lastTabbableNode;
19682
19867
  });
19683
- if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e3.target) {
19868
+ if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
19684
19869
  lastOfGroupIndex = containerIndex;
19685
19870
  }
19686
19871
  if (lastOfGroupIndex >= 0) {
@@ -19698,7 +19883,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19698
19883
  }
19699
19884
  };
19700
19885
  var checkKey = function checkKey2(e3) {
19701
- if (isEscapeEvent(e3) && valueOrHandler(config.escapeDeactivates) !== false) {
19886
+ if (isEscapeEvent(e3) && valueOrHandler(config.escapeDeactivates, e3) !== false) {
19702
19887
  e3.preventDefault();
19703
19888
  trap.deactivate();
19704
19889
  return;
@@ -19709,10 +19894,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19709
19894
  }
19710
19895
  };
19711
19896
  var checkClick = function checkClick2(e3) {
19712
- if (valueOrHandler(config.clickOutsideDeactivates, e3)) {
19897
+ var target = getActualTarget(e3);
19898
+ if (findContainerIndex(target) >= 0) {
19713
19899
  return;
19714
19900
  }
19715
- if (containersContain(e3.target)) {
19901
+ if (valueOrHandler(config.clickOutsideDeactivates, e3)) {
19716
19902
  return;
19717
19903
  }
19718
19904
  if (valueOrHandler(config.allowOutsideClick, e3)) {
@@ -19760,6 +19946,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19760
19946
  return trap;
19761
19947
  };
19762
19948
  trap = {
19949
+ get active() {
19950
+ return state.active;
19951
+ },
19952
+ get paused() {
19953
+ return state.paused;
19954
+ },
19763
19955
  activate: function activate(activateOptions) {
19764
19956
  if (state.active) {
19765
19957
  return this;
@@ -19796,19 +19988,24 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19796
19988
  if (!state.active) {
19797
19989
  return this;
19798
19990
  }
19991
+ var options = _objectSpread2({
19992
+ onDeactivate: config.onDeactivate,
19993
+ onPostDeactivate: config.onPostDeactivate,
19994
+ checkCanReturnFocus: config.checkCanReturnFocus
19995
+ }, deactivateOptions);
19799
19996
  clearTimeout(state.delayInitialFocusTimer);
19800
19997
  state.delayInitialFocusTimer = void 0;
19801
19998
  removeListeners();
19802
19999
  state.active = false;
19803
20000
  state.paused = false;
19804
20001
  activeFocusTraps.deactivateTrap(trap);
19805
- var onDeactivate = getOption(deactivateOptions, "onDeactivate");
19806
- var onPostDeactivate = getOption(deactivateOptions, "onPostDeactivate");
19807
- var checkCanReturnFocus = getOption(deactivateOptions, "checkCanReturnFocus");
20002
+ var onDeactivate = getOption(options, "onDeactivate");
20003
+ var onPostDeactivate = getOption(options, "onPostDeactivate");
20004
+ var checkCanReturnFocus = getOption(options, "checkCanReturnFocus");
20005
+ var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate");
19808
20006
  if (onDeactivate) {
19809
20007
  onDeactivate();
19810
20008
  }
19811
- var returnFocus = getOption(deactivateOptions, "returnFocus", "returnFocusOnDeactivate");
19812
20009
  var finishDeactivation = function finishDeactivation2() {
19813
20010
  delay(function() {
19814
20011
  if (returnFocus) {
@@ -19968,55 +20165,61 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
19968
20165
  }
19969
20166
  };
19970
20167
  });
19971
- Alpine3.directive("trap", Alpine3.skipDuringClone((el, { expression, modifiers }, { effect: effect7, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
19972
- let evaluator = evaluateLater2(expression);
19973
- let oldValue = false;
19974
- let options = {
19975
- escapeDeactivates: false,
19976
- allowOutsideClick: true,
19977
- fallbackFocus: () => el
19978
- };
19979
- let autofocusEl = el.querySelector("[autofocus]");
19980
- if (autofocusEl)
19981
- options.initialFocus = autofocusEl;
19982
- let trap = createFocusTrap(el, options);
19983
- let undoInert = () => {
19984
- };
19985
- let undoDisableScrolling = () => {
19986
- };
19987
- const releaseFocus = () => {
19988
- undoInert();
19989
- undoInert = () => {
19990
- };
19991
- undoDisableScrolling();
19992
- undoDisableScrolling = () => {
19993
- };
19994
- trap.deactivate({
19995
- returnFocus: !modifiers.includes("noreturn")
19996
- });
19997
- };
19998
- effect7(() => evaluator((value) => {
19999
- if (oldValue === value)
20000
- return;
20001
- if (value && !oldValue) {
20002
- setTimeout(() => {
20003
- if (modifiers.includes("inert"))
20004
- undoInert = setInert(el);
20005
- if (modifiers.includes("noscroll"))
20006
- undoDisableScrolling = disableScrolling();
20007
- trap.activate();
20168
+ Alpine3.directive("trap", Alpine3.skipDuringClone(
20169
+ (el, { expression, modifiers }, { effect: effect7, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
20170
+ let evaluator = evaluateLater2(expression);
20171
+ let oldValue = false;
20172
+ let options = {
20173
+ escapeDeactivates: false,
20174
+ allowOutsideClick: true,
20175
+ fallbackFocus: () => el
20176
+ };
20177
+ let autofocusEl = el.querySelector("[autofocus]");
20178
+ if (autofocusEl)
20179
+ options.initialFocus = autofocusEl;
20180
+ let trap = createFocusTrap(el, options);
20181
+ let undoInert = () => {
20182
+ };
20183
+ let undoDisableScrolling = () => {
20184
+ };
20185
+ const releaseFocus = () => {
20186
+ undoInert();
20187
+ undoInert = () => {
20188
+ };
20189
+ undoDisableScrolling();
20190
+ undoDisableScrolling = () => {
20191
+ };
20192
+ trap.deactivate({
20193
+ returnFocus: !modifiers.includes("noreturn")
20008
20194
  });
20009
- }
20010
- if (!value && oldValue) {
20011
- releaseFocus();
20012
- }
20013
- oldValue = !!value;
20014
- }));
20015
- cleanup2(releaseFocus);
20016
- }, (el, { expression, modifiers }, { evaluate: evaluate2 }) => {
20017
- if (modifiers.includes("inert") && evaluate2(expression))
20018
- setInert(el);
20019
- }));
20195
+ };
20196
+ effect7(() => evaluator((value) => {
20197
+ if (oldValue === value)
20198
+ return;
20199
+ if (value && !oldValue) {
20200
+ setTimeout(() => {
20201
+ if (modifiers.includes("inert"))
20202
+ undoInert = setInert(el);
20203
+ if (modifiers.includes("noscroll"))
20204
+ undoDisableScrolling = disableScrolling();
20205
+ trap.activate();
20206
+ });
20207
+ }
20208
+ if (!value && oldValue) {
20209
+ releaseFocus();
20210
+ }
20211
+ oldValue = !!value;
20212
+ }));
20213
+ cleanup2(releaseFocus);
20214
+ },
20215
+ // When cloning, we only want to add aria-hidden attributes to the
20216
+ // DOM and not try to actually trap, as trapping can mess with the
20217
+ // live DOM and isn't just isolated to the cloned DOM.
20218
+ (el, { expression, modifiers }, { evaluate: evaluate2 }) => {
20219
+ if (modifiers.includes("inert") && evaluate2(expression))
20220
+ setInert(el);
20221
+ }
20222
+ ));
20020
20223
  }
20021
20224
  function setInert(el) {
20022
20225
  let undos = [];
@@ -24199,44 +24402,16 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
24199
24402
  };
24200
24403
  });
24201
24404
 
24202
- // ../../components/coco/app/blocks/sidebar_nav/sidebar_nav.js
24203
- var sidebar_nav_exports = {};
24204
- __export(sidebar_nav_exports, {
24205
- default: () => sidebar_nav_default
24405
+ // ../../components/coco/app/blocks/sidebar_nav/item/item.js
24406
+ var item_exports = {};
24407
+ __export(item_exports, {
24408
+ default: () => item_default
24206
24409
  });
24207
- var import_tokens = __toESM(require_tokens(), 1);
24208
- var mobileMaxWidth = parseInt(import_tokens.default.app.screens.sm, 10);
24209
- var sidebar_nav_default = CocoComponent("appSidebarNav", () => {
24210
- return {
24211
- sizeObserver: null,
24212
- mobileLayout: true,
24213
- init() {
24214
- this.sizeObserver = new ResizeObserver(
24215
- Alpine.throttle((entries) => {
24216
- this.$nextTick(() => {
24217
- const bodyWidth = entries[0].contentRect.width;
24218
- this.mobileLayout = bodyWidth < mobileMaxWidth;
24219
- });
24220
- }, 20)
24221
- );
24222
- this.sizeObserver.observe(document.documentElement);
24223
- },
24224
- destroy() {
24225
- this.sizeObserver && this.sizeObserver.disconnect();
24226
- }
24227
- };
24228
- });
24229
-
24230
- // ../../components/coco/app/blocks/sidebar_nav_item/sidebar_nav_item.js
24231
- var sidebar_nav_item_exports = {};
24232
- __export(sidebar_nav_item_exports, {
24233
- default: () => sidebar_nav_item_default
24234
- });
24235
- var sidebar_nav_item_default = CocoComponent("appSidebarNavItem", () => {
24410
+ var item_default = CocoComponent("appSidebarNavItem", () => {
24236
24411
  return {
24237
24412
  menu: null,
24413
+ active: false,
24238
24414
  init() {
24239
- this.navigateTo = navigateTo;
24240
24415
  if (this.$refs.menu) {
24241
24416
  this.menu = tippy_default(this.$el, {
24242
24417
  theme: "coco-naked-dropdown",
@@ -24246,9 +24421,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
24246
24421
  trigger: "click",
24247
24422
  interactive: true,
24248
24423
  maxWidth: null,
24249
- content: () => {
24250
- return this.$refs.menu.innerHTML;
24251
- }
24424
+ onShow: () => {
24425
+ this.active = true;
24426
+ },
24427
+ onHide: () => {
24428
+ this.active = false;
24429
+ },
24430
+ content: () => this.$refs.menu.innerHTML
24252
24431
  });
24253
24432
  }
24254
24433
  this.$watch("mobileLayout", () => {
@@ -24262,12 +24441,59 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
24262
24441
  });
24263
24442
  }
24264
24443
  },
24444
+ root: {
24445
+ "@click": "if (menu) $event.preventDefault()",
24446
+ ":class": "{active}"
24447
+ },
24265
24448
  get menuPlacement() {
24266
24449
  return this.mobileLayout ? "top" : "right-start";
24267
24450
  }
24268
24451
  };
24269
24452
  });
24270
24453
 
24454
+ // ../../components/coco/app/blocks/sidebar_nav/menu/menu.js
24455
+ var menu_exports = {};
24456
+ __export(menu_exports, {
24457
+ default: () => menu_default
24458
+ });
24459
+ var menu_default = CocoComponent("appSidebarNavMenu", () => {
24460
+ return {
24461
+ navigateTo(url) {
24462
+ if (url !== "") {
24463
+ navigateTo(url);
24464
+ }
24465
+ }
24466
+ };
24467
+ });
24468
+
24469
+ // ../../components/coco/app/blocks/sidebar_nav/navbar/navbar.js
24470
+ var navbar_exports = {};
24471
+ __export(navbar_exports, {
24472
+ default: () => navbar_default
24473
+ });
24474
+ var import_tokens = __toESM(require_tokens(), 1);
24475
+ var mobileMaxWidth = parseInt(import_tokens.default.app.screens.sm, 10);
24476
+ var navbar_default = CocoComponent("appSidebarNav", () => {
24477
+ return {
24478
+ sizeObserver: null,
24479
+ mobileLayout: true,
24480
+ init() {
24481
+ this.sizeObserver = new ResizeObserver(
24482
+ Alpine.throttle((entries) => {
24483
+ this.$nextTick(() => {
24484
+ const bodyWidth = entries[0].contentRect.width;
24485
+ this.mobileLayout = bodyWidth < mobileMaxWidth;
24486
+ });
24487
+ }, 20)
24488
+ );
24489
+ this.sizeObserver.observe(document.documentElement);
24490
+ },
24491
+ destroy() {
24492
+ this.sizeObserver && this.sizeObserver.disconnect();
24493
+ }
24494
+ };
24495
+ });
24496
+
24271
24497
  // ../../components/coco/app/blocks/slide_editor/slide_editor.js
24272
24498
  var slide_editor_exports = {};
24273
24499
  __export(slide_editor_exports, {
@@ -26945,7 +27171,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
26945
27171
  });
26946
27172
 
26947
27173
  // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/app|@appComponents/**/*.js
26948
- var modules3 = [header_exports, nav_drawer_exports, sidebar_nav_exports, sidebar_nav_item_exports, slide_editor_exports, alert_exports, button_group_exports, color_picker_exports, color_picker_button_exports, confirm_panel_exports, image_picker_exports, image_picker_button_exports, layout_picker_button_exports, menu_button_exports, notice_exports, seamless_textarea_exports, snackbar_exports, system_banner_exports, toast_exports, toolbar_exports, application_exports];
27174
+ var modules3 = [header_exports, nav_drawer_exports, item_exports, menu_exports, navbar_exports, slide_editor_exports, alert_exports, button_group_exports, color_picker_exports, color_picker_button_exports, confirm_panel_exports, image_picker_exports, image_picker_button_exports, layout_picker_button_exports, menu_button_exports, notice_exports, seamless_textarea_exports, snackbar_exports, system_banner_exports, toast_exports, toolbar_exports, application_exports];
26949
27175
  var __default3 = modules3;
26950
27176
 
26951
27177
  // app/components.js
@@ -26989,13 +27215,19 @@ html2canvas/dist/html2canvas.js:
26989
27215
  ***************************************************************************** *)
26990
27216
 
26991
27217
  @alpinejs/focus/dist/module.esm.js:
26992
- (*!
26993
- * tabbable 5.2.1
26994
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
26995
- *)
26996
- (*!
26997
- * focus-trap 6.6.1
26998
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
27218
+ (*! Bundled license information:
27219
+
27220
+ tabbable/dist/index.esm.js:
27221
+ (*!
27222
+ * tabbable 5.3.3
27223
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
27224
+ *)
27225
+
27226
+ focus-trap/dist/focus-trap.esm.js:
27227
+ (*!
27228
+ * focus-trap 6.9.4
27229
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
27230
+ *)
26999
27231
  *)
27000
27232
 
27001
27233
  @jaames/iro/dist/iro.es.js: