@primer/behaviors 0.0.0-20240814142107 → 0.0.0-20240814153017

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.
@@ -20,16 +20,24 @@ function followSignal(signal) {
20
20
  return controller;
21
21
  }
22
22
  function observeFocusTrap(container, sentinels) {
23
+ console.log('Observe Focus Trap Init');
23
24
  const observer = new MutationObserver(mutations => {
25
+ console.log('New mutation');
24
26
  for (const mutation of mutations) {
27
+ console.log('Mutations:', mutations);
25
28
  if (mutation.type === 'childList' && mutation.addedNodes.length) {
29
+ console.log('ChildList Mutation');
26
30
  const firstChild = container.firstElementChild;
27
31
  const lastChild = container.lastElementChild;
28
32
  const [sentinelStart, sentinelEnd] = sentinels;
29
- if (!(firstChild === null || firstChild === void 0 ? void 0 : firstChild.classList.contains('sentinel')))
33
+ if (!(firstChild === null || firstChild === void 0 ? void 0 : firstChild.classList.contains('sentinel'))) {
30
34
  container.insertAdjacentElement('afterbegin', sentinelStart);
31
- if (!(lastChild === null || lastChild === void 0 ? void 0 : lastChild.classList.contains('sentinel')))
35
+ console.log('Adjust sentinel to start');
36
+ }
37
+ if (!(lastChild === null || lastChild === void 0 ? void 0 : lastChild.classList.contains('sentinel'))) {
32
38
  container.insertAdjacentElement('beforeend', sentinelEnd);
39
+ console.log('Adjust sentinel to end');
40
+ }
33
41
  }
34
42
  }
35
43
  });
@@ -18,16 +18,24 @@ function followSignal(signal) {
18
18
  return controller;
19
19
  }
20
20
  function observeFocusTrap(container, sentinels) {
21
+ console.log('Observe Focus Trap Init');
21
22
  const observer = new MutationObserver(mutations => {
23
+ console.log('New mutation');
22
24
  for (const mutation of mutations) {
25
+ console.log('Mutations:', mutations);
23
26
  if (mutation.type === 'childList' && mutation.addedNodes.length) {
27
+ console.log('ChildList Mutation');
24
28
  const firstChild = container.firstElementChild;
25
29
  const lastChild = container.lastElementChild;
26
30
  const [sentinelStart, sentinelEnd] = sentinels;
27
- if (!(firstChild === null || firstChild === void 0 ? void 0 : firstChild.classList.contains('sentinel')))
31
+ if (!(firstChild === null || firstChild === void 0 ? void 0 : firstChild.classList.contains('sentinel'))) {
28
32
  container.insertAdjacentElement('afterbegin', sentinelStart);
29
- if (!(lastChild === null || lastChild === void 0 ? void 0 : lastChild.classList.contains('sentinel')))
33
+ console.log('Adjust sentinel to start');
34
+ }
35
+ if (!(lastChild === null || lastChild === void 0 ? void 0 : lastChild.classList.contains('sentinel'))) {
30
36
  container.insertAdjacentElement('beforeend', sentinelEnd);
37
+ console.log('Adjust sentinel to end');
38
+ }
31
39
  }
32
40
  }
33
41
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/behaviors",
3
- "version": "0.0.0-20240814142107",
3
+ "version": "0.0.0-20240814153017",
4
4
  "description": "Shared behaviors for JavaScript components",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cjs/index.js",