@capgo/capacitor-sheets 8.0.2 → 8.0.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/dist/angular/index.js +48 -10
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/index.mjs +48 -10
- package/dist/angular/index.mjs.map +1 -1
- package/dist/{chunk-YBLI7KN6.mjs → chunk-EYNTXD52.mjs} +49 -11
- package/dist/chunk-EYNTXD52.mjs.map +1 -0
- package/dist/{components-4JACDCD4.mjs → components-BH36ITEV.mjs} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +48 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/react/index.js +48 -10
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +48 -10
- package/dist/react/index.mjs.map +1 -1
- package/dist/solid/index.d.mts +60 -0
- package/dist/solid/index.d.ts +60 -0
- package/dist/solid/index.js +48 -10
- package/dist/solid/index.js.map +1 -1
- package/dist/solid/index.mjs +48 -10
- package/dist/solid/index.mjs.map +1 -1
- package/dist/svelte/index.js +48 -10
- package/dist/svelte/index.js.map +1 -1
- package/dist/svelte/index.mjs +48 -10
- package/dist/svelte/index.mjs.map +1 -1
- package/dist/vue/index.js +48 -10
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/index.mjs +48 -10
- package/dist/vue/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-YBLI7KN6.mjs.map +0 -1
- /package/dist/{components-4JACDCD4.mjs.map → components-BH36ITEV.mjs.map} +0 -0
package/dist/vue/index.js
CHANGED
|
@@ -768,13 +768,15 @@ var SheetController = class {
|
|
|
768
768
|
this.root = root;
|
|
769
769
|
this.options = readOptionsFromElement(root);
|
|
770
770
|
this.id = this.options.componentId || root.id || createId("cap-sheet");
|
|
771
|
-
if (!root.id) root.id = this.id;
|
|
772
771
|
}
|
|
773
772
|
/** Connect the controller to the DOM and initialize current state. */
|
|
774
773
|
connect() {
|
|
775
774
|
if (this.connected) return;
|
|
776
775
|
this.connected = true;
|
|
777
|
-
|
|
776
|
+
const elementOptions = readOptionsFromElement(this.root);
|
|
777
|
+
this.id = elementOptions.componentId || this.root.id || this.id;
|
|
778
|
+
if (!this.root.id) this.root.id = this.id;
|
|
779
|
+
this.configure(elementOptions);
|
|
778
780
|
const nextPresented = this.options.presented ?? this.options.defaultPresented ?? false;
|
|
779
781
|
this.activeDetent = this.resolveInitialDetent();
|
|
780
782
|
this.presented = nextPresented;
|
|
@@ -1297,20 +1299,24 @@ var SheetController = class {
|
|
|
1297
1299
|
this.clearInert();
|
|
1298
1300
|
for (const child of Array.from(body.children)) {
|
|
1299
1301
|
if (!(child instanceof HTMLElement)) continue;
|
|
1302
|
+
this.inertedElements.set(child, { inert: child.inert, ariaHidden: child.getAttribute("aria-hidden") });
|
|
1300
1303
|
const isAllowed = Array.from(allowed).some((element) => child === element || child.contains(element));
|
|
1301
|
-
if (isAllowed)
|
|
1302
|
-
|
|
1304
|
+
if (isAllowed) {
|
|
1305
|
+
child.inert = false;
|
|
1306
|
+
child.removeAttribute("aria-hidden");
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1303
1309
|
child.inert = true;
|
|
1304
1310
|
child.setAttribute("aria-hidden", "true");
|
|
1305
1311
|
}
|
|
1306
1312
|
}
|
|
1307
1313
|
clearInert() {
|
|
1308
|
-
for (const [element,
|
|
1309
|
-
element.inert =
|
|
1310
|
-
if (ariaHidden === null) {
|
|
1314
|
+
for (const [element, state] of this.inertedElements) {
|
|
1315
|
+
element.inert = state.inert;
|
|
1316
|
+
if (state.ariaHidden === null) {
|
|
1311
1317
|
element.removeAttribute("aria-hidden");
|
|
1312
1318
|
} else {
|
|
1313
|
-
element.setAttribute("aria-hidden", ariaHidden);
|
|
1319
|
+
element.setAttribute("aria-hidden", state.ariaHidden);
|
|
1314
1320
|
}
|
|
1315
1321
|
}
|
|
1316
1322
|
this.inertedElements.clear();
|
|
@@ -1475,9 +1481,9 @@ var CapSheet = class extends HTMLElement {
|
|
|
1475
1481
|
disconnectedCallback() {
|
|
1476
1482
|
this.controller.disconnect();
|
|
1477
1483
|
}
|
|
1478
|
-
attributeChangedCallback() {
|
|
1484
|
+
attributeChangedCallback(name) {
|
|
1479
1485
|
if (this.syncingAttribute) return;
|
|
1480
|
-
this.controller.configure(
|
|
1486
|
+
this.controller.configure(readChangedOptionsFromElement(this, name));
|
|
1481
1487
|
if (this.isConnected) {
|
|
1482
1488
|
if (this.hasAttribute("presented") && !this.controller.presented) {
|
|
1483
1489
|
void this.present({ source: "programmatic" });
|
|
@@ -1555,6 +1561,38 @@ function isCapSheetElement(element) {
|
|
|
1555
1561
|
const candidate = element;
|
|
1556
1562
|
return typeof candidate.present === "function" && typeof candidate.dismiss === "function";
|
|
1557
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
|
+
}
|
|
1558
1596
|
function applySheetOptions(element, options) {
|
|
1559
1597
|
if (options.contentPlacement) element.setAttribute("content-placement", options.contentPlacement);
|
|
1560
1598
|
if (options.detents !== void 0) {
|