@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/solid/index.mjs
CHANGED
|
@@ -742,13 +742,15 @@ var SheetController = class {
|
|
|
742
742
|
this.root = root;
|
|
743
743
|
this.options = readOptionsFromElement(root);
|
|
744
744
|
this.id = this.options.componentId || root.id || createId("cap-sheet");
|
|
745
|
-
if (!root.id) root.id = this.id;
|
|
746
745
|
}
|
|
747
746
|
/** Connect the controller to the DOM and initialize current state. */
|
|
748
747
|
connect() {
|
|
749
748
|
if (this.connected) return;
|
|
750
749
|
this.connected = true;
|
|
751
|
-
|
|
750
|
+
const elementOptions = readOptionsFromElement(this.root);
|
|
751
|
+
this.id = elementOptions.componentId || this.root.id || this.id;
|
|
752
|
+
if (!this.root.id) this.root.id = this.id;
|
|
753
|
+
this.configure(elementOptions);
|
|
752
754
|
const nextPresented = this.options.presented ?? this.options.defaultPresented ?? false;
|
|
753
755
|
this.activeDetent = this.resolveInitialDetent();
|
|
754
756
|
this.presented = nextPresented;
|
|
@@ -1271,20 +1273,24 @@ var SheetController = class {
|
|
|
1271
1273
|
this.clearInert();
|
|
1272
1274
|
for (const child of Array.from(body.children)) {
|
|
1273
1275
|
if (!(child instanceof HTMLElement)) continue;
|
|
1276
|
+
this.inertedElements.set(child, { inert: child.inert, ariaHidden: child.getAttribute("aria-hidden") });
|
|
1274
1277
|
const isAllowed = Array.from(allowed).some((element) => child === element || child.contains(element));
|
|
1275
|
-
if (isAllowed)
|
|
1276
|
-
|
|
1278
|
+
if (isAllowed) {
|
|
1279
|
+
child.inert = false;
|
|
1280
|
+
child.removeAttribute("aria-hidden");
|
|
1281
|
+
continue;
|
|
1282
|
+
}
|
|
1277
1283
|
child.inert = true;
|
|
1278
1284
|
child.setAttribute("aria-hidden", "true");
|
|
1279
1285
|
}
|
|
1280
1286
|
}
|
|
1281
1287
|
clearInert() {
|
|
1282
|
-
for (const [element,
|
|
1283
|
-
element.inert =
|
|
1284
|
-
if (ariaHidden === null) {
|
|
1288
|
+
for (const [element, state] of this.inertedElements) {
|
|
1289
|
+
element.inert = state.inert;
|
|
1290
|
+
if (state.ariaHidden === null) {
|
|
1285
1291
|
element.removeAttribute("aria-hidden");
|
|
1286
1292
|
} else {
|
|
1287
|
-
element.setAttribute("aria-hidden", ariaHidden);
|
|
1293
|
+
element.setAttribute("aria-hidden", state.ariaHidden);
|
|
1288
1294
|
}
|
|
1289
1295
|
}
|
|
1290
1296
|
this.inertedElements.clear();
|
|
@@ -1449,9 +1455,9 @@ var CapSheet = class extends HTMLElement {
|
|
|
1449
1455
|
disconnectedCallback() {
|
|
1450
1456
|
this.controller.disconnect();
|
|
1451
1457
|
}
|
|
1452
|
-
attributeChangedCallback() {
|
|
1458
|
+
attributeChangedCallback(name) {
|
|
1453
1459
|
if (this.syncingAttribute) return;
|
|
1454
|
-
this.controller.configure(
|
|
1460
|
+
this.controller.configure(readChangedOptionsFromElement(this, name));
|
|
1455
1461
|
if (this.isConnected) {
|
|
1456
1462
|
if (this.hasAttribute("presented") && !this.controller.presented) {
|
|
1457
1463
|
void this.present({ source: "programmatic" });
|
|
@@ -1529,6 +1535,38 @@ function isCapSheetElement(element) {
|
|
|
1529
1535
|
const candidate = element;
|
|
1530
1536
|
return typeof candidate.present === "function" && typeof candidate.dismiss === "function";
|
|
1531
1537
|
}
|
|
1538
|
+
function readChangedOptionsFromElement(element, name) {
|
|
1539
|
+
const options = readOptionsFromElement(element);
|
|
1540
|
+
const keysByAttribute = {
|
|
1541
|
+
"active-detent": ["activeDetent"],
|
|
1542
|
+
"close-on-escape": ["closeOnEscape"],
|
|
1543
|
+
"close-on-outside-click": ["closeOnOutsideClick"],
|
|
1544
|
+
"content-placement": ["contentPlacement", "tracks"],
|
|
1545
|
+
"default-active-detent": ["defaultActiveDetent"],
|
|
1546
|
+
"default-presented": ["defaultPresented"],
|
|
1547
|
+
detents: ["detents"],
|
|
1548
|
+
"focus-trap": ["focusTrap"],
|
|
1549
|
+
"inert-outside": ["inertOutside"],
|
|
1550
|
+
"native-edge-swipe-prevention": ["nativeEdgeSwipePrevention"],
|
|
1551
|
+
"native-focus-scroll-prevention": ["nativeFocusScrollPrevention"],
|
|
1552
|
+
presented: ["presented"],
|
|
1553
|
+
"restore-focus": ["restoreFocus"],
|
|
1554
|
+
"safe-area": ["safeArea"],
|
|
1555
|
+
"sheet-role": ["sheetRole"],
|
|
1556
|
+
stack: ["stack"],
|
|
1557
|
+
swipe: ["swipe"],
|
|
1558
|
+
"swipe-dismissal": ["swipeDismissal"],
|
|
1559
|
+
"swipe-overshoot": ["swipeOvershoot"],
|
|
1560
|
+
"swipe-trap": ["swipeTrap"],
|
|
1561
|
+
"theme-color-dimming": ["themeColorDimming"],
|
|
1562
|
+
tracks: ["tracks"]
|
|
1563
|
+
};
|
|
1564
|
+
const changed = {};
|
|
1565
|
+
for (const key of keysByAttribute[name] || []) {
|
|
1566
|
+
changed[key] = options[key];
|
|
1567
|
+
}
|
|
1568
|
+
return changed;
|
|
1569
|
+
}
|
|
1532
1570
|
function applySheetOptions(element, options) {
|
|
1533
1571
|
if (options.contentPlacement) element.setAttribute("content-placement", options.contentPlacement);
|
|
1534
1572
|
if (options.detents !== void 0) {
|