@capgo/capacitor-sheets 8.0.2 → 8.0.3

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/dist/index.mjs CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  applySheetOptions,
25
25
  getSheetFromElement,
26
26
  updateThemeColor
27
- } from "./chunk-YBLI7KN6.mjs";
27
+ } from "./chunk-3DAF3OD7.mjs";
28
28
  import {
29
29
  CSS,
30
30
  injectCapSheetStyles
@@ -32,7 +32,7 @@ import {
32
32
 
33
33
  // src/index.ts
34
34
  function initCapSheets() {
35
- import("./components-4JACDCD4.mjs");
35
+ import("./components-5BW6JNKT.mjs");
36
36
  if (typeof document !== "undefined") {
37
37
  import("./styles-ZKNWSPZR.mjs").then(({ injectCapSheetStyles: injectCapSheetStyles2 }) => injectCapSheetStyles2(document));
38
38
  }
@@ -1299,20 +1299,24 @@ var SheetController = class {
1299
1299
  this.clearInert();
1300
1300
  for (const child of Array.from(body.children)) {
1301
1301
  if (!(child instanceof HTMLElement)) continue;
1302
+ this.inertedElements.set(child, { inert: child.inert, ariaHidden: child.getAttribute("aria-hidden") });
1302
1303
  const isAllowed = Array.from(allowed).some((element) => child === element || child.contains(element));
1303
- if (isAllowed) continue;
1304
- this.inertedElements.set(child, child.getAttribute("aria-hidden"));
1304
+ if (isAllowed) {
1305
+ child.inert = false;
1306
+ child.removeAttribute("aria-hidden");
1307
+ continue;
1308
+ }
1305
1309
  child.inert = true;
1306
1310
  child.setAttribute("aria-hidden", "true");
1307
1311
  }
1308
1312
  }
1309
1313
  clearInert() {
1310
- for (const [element, ariaHidden] of this.inertedElements) {
1311
- element.inert = false;
1312
- if (ariaHidden === null) {
1314
+ for (const [element, state] of this.inertedElements) {
1315
+ element.inert = state.inert;
1316
+ if (state.ariaHidden === null) {
1313
1317
  element.removeAttribute("aria-hidden");
1314
1318
  } else {
1315
- element.setAttribute("aria-hidden", ariaHidden);
1319
+ element.setAttribute("aria-hidden", state.ariaHidden);
1316
1320
  }
1317
1321
  }
1318
1322
  this.inertedElements.clear();
@@ -1477,9 +1481,9 @@ var CapSheet = class extends HTMLElement {
1477
1481
  disconnectedCallback() {
1478
1482
  this.controller.disconnect();
1479
1483
  }
1480
- attributeChangedCallback() {
1484
+ attributeChangedCallback(name) {
1481
1485
  if (this.syncingAttribute) return;
1482
- this.controller.configure({});
1486
+ this.controller.configure(readChangedOptionsFromElement(this, name));
1483
1487
  if (this.isConnected) {
1484
1488
  if (this.hasAttribute("presented") && !this.controller.presented) {
1485
1489
  void this.present({ source: "programmatic" });
@@ -1557,6 +1561,38 @@ function isCapSheetElement(element) {
1557
1561
  const candidate = element;
1558
1562
  return typeof candidate.present === "function" && typeof candidate.dismiss === "function";
1559
1563
  }
1564
+ function readChangedOptionsFromElement(element, name) {
1565
+ const options = readOptionsFromElement(element);
1566
+ const keysByAttribute = {
1567
+ "active-detent": ["activeDetent"],
1568
+ "close-on-escape": ["closeOnEscape"],
1569
+ "close-on-outside-click": ["closeOnOutsideClick"],
1570
+ "content-placement": ["contentPlacement", "tracks"],
1571
+ "default-active-detent": ["defaultActiveDetent"],
1572
+ "default-presented": ["defaultPresented"],
1573
+ detents: ["detents"],
1574
+ "focus-trap": ["focusTrap"],
1575
+ "inert-outside": ["inertOutside"],
1576
+ "native-edge-swipe-prevention": ["nativeEdgeSwipePrevention"],
1577
+ "native-focus-scroll-prevention": ["nativeFocusScrollPrevention"],
1578
+ presented: ["presented"],
1579
+ "restore-focus": ["restoreFocus"],
1580
+ "safe-area": ["safeArea"],
1581
+ "sheet-role": ["sheetRole"],
1582
+ stack: ["stack"],
1583
+ swipe: ["swipe"],
1584
+ "swipe-dismissal": ["swipeDismissal"],
1585
+ "swipe-overshoot": ["swipeOvershoot"],
1586
+ "swipe-trap": ["swipeTrap"],
1587
+ "theme-color-dimming": ["themeColorDimming"],
1588
+ tracks: ["tracks"]
1589
+ };
1590
+ const changed = {};
1591
+ for (const key of keysByAttribute[name] || []) {
1592
+ changed[key] = options[key];
1593
+ }
1594
+ return changed;
1595
+ }
1560
1596
  function applySheetOptions(element, options) {
1561
1597
  if (options.contentPlacement) element.setAttribute("content-placement", options.contentPlacement);
1562
1598
  if (options.detents !== void 0) {