@rdlabo/capacitor-native-ui 0.0.0-stage → 1.2.1
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/LICENSE +21 -0
- package/Package.swift +23 -0
- package/README.md +53 -2
- package/RdlaboCapacitorNativeUi.podspec +17 -0
- package/android/build.gradle +69 -0
- package/android/proguard-rules.pro +0 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/dev/rdlabo/capacitor/nativeui/NativeUI.kt +51 -0
- package/android/src/main/java/dev/rdlabo/capacitor/nativeui/NativeUIPlugin.kt +192 -0
- package/android/src/main/java/dev/rdlabo/capacitor/nativeui/NativeUISnapshot.kt +57 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/core.d.ts +4 -0
- package/dist/core.js +3 -0
- package/dist/native/activation.d.ts +14 -0
- package/dist/native/activation.d.ts.map +1 -0
- package/dist/native/activation.js +305 -0
- package/dist/native/activation.js.map +1 -0
- package/dist/native/components/index.d.ts +19 -0
- package/dist/native/components/index.d.ts.map +1 -0
- package/dist/native/components/index.js +38 -0
- package/dist/native/components/index.js.map +1 -0
- package/dist/native/components/ion-back-button.d.ts +10 -0
- package/dist/native/components/ion-back-button.d.ts.map +1 -0
- package/dist/native/components/ion-back-button.js +21 -0
- package/dist/native/components/ion-back-button.js.map +1 -0
- package/dist/native/components/ion-button.d.ts +10 -0
- package/dist/native/components/ion-button.d.ts.map +1 -0
- package/dist/native/components/ion-button.js +25 -0
- package/dist/native/components/ion-button.js.map +1 -0
- package/dist/native/components/ion-buttons.d.ts +11 -0
- package/dist/native/components/ion-buttons.d.ts.map +1 -0
- package/dist/native/components/ion-buttons.js +30 -0
- package/dist/native/components/ion-buttons.js.map +1 -0
- package/dist/native/components/ion-fab.d.ts +10 -0
- package/dist/native/components/ion-fab.d.ts.map +1 -0
- package/dist/native/components/ion-fab.js +132 -0
- package/dist/native/components/ion-fab.js.map +1 -0
- package/dist/native/components/ion-menu-button.d.ts +13 -0
- package/dist/native/components/ion-menu-button.d.ts.map +1 -0
- package/dist/native/components/ion-menu-button.js +44 -0
- package/dist/native/components/ion-menu-button.js.map +1 -0
- package/dist/native/components/ion-segment.d.ts +11 -0
- package/dist/native/components/ion-segment.d.ts.map +1 -0
- package/dist/native/components/ion-segment.js +30 -0
- package/dist/native/components/ion-segment.js.map +1 -0
- package/dist/native/components/ion-tab-bar.d.ts +11 -0
- package/dist/native/components/ion-tab-bar.d.ts.map +1 -0
- package/dist/native/components/ion-tab-bar.js +50 -0
- package/dist/native/components/ion-tab-bar.js.map +1 -0
- package/dist/native/components/searchable-tabs.d.ts +20 -0
- package/dist/native/components/searchable-tabs.d.ts.map +1 -0
- package/dist/native/components/searchable-tabs.js +413 -0
- package/dist/native/components/searchable-tabs.js.map +1 -0
- package/dist/native/definitions.d.ts +255 -0
- package/dist/native/definitions.d.ts.map +1 -0
- package/dist/native/definitions.js +0 -0
- package/dist/native/extensions.d.ts +31 -0
- package/dist/native/extensions.d.ts.map +1 -0
- package/dist/native/extensions.js +122 -0
- package/dist/native/extensions.js.map +1 -0
- package/dist/native/foldable/fold-state.d.ts +5 -0
- package/dist/native/foldable/fold-state.d.ts.map +1 -0
- package/dist/native/foldable/fold-state.js +15 -0
- package/dist/native/foldable/fold-state.js.map +1 -0
- package/dist/native/foldable/types.d.ts +12 -0
- package/dist/native/foldable/types.d.ts.map +1 -0
- package/dist/native/foldable/types.js +0 -0
- package/dist/native/html.d.ts +9 -0
- package/dist/native/html.d.ts.map +1 -0
- package/dist/native/html.js +188 -0
- package/dist/native/html.js.map +1 -0
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +28 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/legacy-layout.d.ts +5 -0
- package/dist/native/legacy-layout.d.ts.map +1 -0
- package/dist/native/legacy-layout.js +27 -0
- package/dist/native/legacy-layout.js.map +1 -0
- package/dist/native/overlays/content.d.ts +4 -0
- package/dist/native/overlays/content.d.ts.map +1 -0
- package/dist/native/overlays/content.js +51 -0
- package/dist/native/overlays/content.js.map +1 -0
- package/dist/native/overlays/controller.d.ts +8 -0
- package/dist/native/overlays/controller.d.ts.map +1 -0
- package/dist/native/overlays/controller.js +285 -0
- package/dist/native/overlays/controller.js.map +1 -0
- package/dist/native/overlays/dialog-animation.d.ts +9 -0
- package/dist/native/overlays/dialog-animation.d.ts.map +1 -0
- package/dist/native/overlays/dialog-animation.js +53 -0
- package/dist/native/overlays/dialog-animation.js.map +1 -0
- package/dist/native/overlays/dismiss-animation.d.ts +4 -0
- package/dist/native/overlays/dismiss-animation.d.ts.map +1 -0
- package/dist/native/overlays/dismiss-animation.js +18 -0
- package/dist/native/overlays/dismiss-animation.js.map +1 -0
- package/dist/native/overlays/focus.d.ts +5 -0
- package/dist/native/overlays/focus.d.ts.map +1 -0
- package/dist/native/overlays/focus.js +59 -0
- package/dist/native/overlays/focus.js.map +1 -0
- package/dist/native/overlays/popover.d.ts +12 -0
- package/dist/native/overlays/popover.d.ts.map +1 -0
- package/dist/native/overlays/popover.js +110 -0
- package/dist/native/overlays/popover.js.map +1 -0
- package/dist/native/overlays/styles.d.ts +11 -0
- package/dist/native/overlays/styles.d.ts.map +1 -0
- package/dist/native/overlays/styles.js +167 -0
- package/dist/native/overlays/styles.js.map +1 -0
- package/dist/native/prehide.d.ts +8 -0
- package/dist/native/prehide.d.ts.map +1 -0
- package/dist/native/prehide.js +238 -0
- package/dist/native/prehide.js.map +1 -0
- package/dist/native/runtime.d.ts +7 -0
- package/dist/native/runtime.d.ts.map +1 -0
- package/dist/native/runtime.js +788 -0
- package/dist/native/runtime.js.map +1 -0
- package/dist/native/shared/bridge.d.ts +6 -0
- package/dist/native/shared/bridge.d.ts.map +1 -0
- package/dist/native/shared/bridge.js +18 -0
- package/dist/native/shared/bridge.js.map +1 -0
- package/dist/native/shared/candidate.d.ts +25 -0
- package/dist/native/shared/candidate.d.ts.map +1 -0
- package/dist/native/shared/candidate.js +106 -0
- package/dist/native/shared/candidate.js.map +1 -0
- package/dist/native/shared/clipping.d.ts +5 -0
- package/dist/native/shared/clipping.d.ts.map +1 -0
- package/dist/native/shared/clipping.js +26 -0
- package/dist/native/shared/clipping.js.map +1 -0
- package/dist/native/shared/crossfade.d.ts +12 -0
- package/dist/native/shared/crossfade.d.ts.map +1 -0
- package/dist/native/shared/crossfade.js +67 -0
- package/dist/native/shared/crossfade.js.map +1 -0
- package/dist/native/shared/diagnostics.d.ts +4 -0
- package/dist/native/shared/diagnostics.d.ts.map +1 -0
- package/dist/native/shared/diagnostics.js +18 -0
- package/dist/native/shared/diagnostics.js.map +1 -0
- package/dist/native/shared/dom.d.ts +46 -0
- package/dist/native/shared/dom.d.ts.map +1 -0
- package/dist/native/shared/dom.js +180 -0
- package/dist/native/shared/dom.js.map +1 -0
- package/dist/native/shared/events.d.ts +15 -0
- package/dist/native/shared/events.d.ts.map +1 -0
- package/dist/native/shared/events.js +17 -0
- package/dist/native/shared/events.js.map +1 -0
- package/dist/native/shared/icons.d.ts +8 -0
- package/dist/native/shared/icons.d.ts.map +1 -0
- package/dist/native/shared/icons.js +61 -0
- package/dist/native/shared/icons.js.map +1 -0
- package/dist/native/shared/modal.d.ts +10 -0
- package/dist/native/shared/modal.d.ts.map +1 -0
- package/dist/native/shared/modal.js +160 -0
- package/dist/native/shared/modal.js.map +1 -0
- package/dist/native/shared/projection-id.d.ts +4 -0
- package/dist/native/shared/projection-id.d.ts.map +1 -0
- package/dist/native/shared/projection-id.js +7 -0
- package/dist/native/shared/projection-id.js.map +1 -0
- package/dist/native/shared/toolbar-options.d.ts +9 -0
- package/dist/native/shared/toolbar-options.d.ts.map +1 -0
- package/dist/native/shared/toolbar-options.js +36 -0
- package/dist/native/shared/toolbar-options.js.map +1 -0
- package/dist/native/shared/vertical-bars-geometry.d.ts +10 -0
- package/dist/native/shared/vertical-bars-geometry.d.ts.map +1 -0
- package/dist/native/shared/vertical-bars-geometry.js +85 -0
- package/dist/native/shared/vertical-bars-geometry.js.map +1 -0
- package/dist/native/startup.d.ts +8 -0
- package/dist/native/startup.d.ts.map +1 -0
- package/dist/native/startup.js +86 -0
- package/dist/native/startup.js.map +1 -0
- package/dist/native/vertical-bars-web-search.d.ts +10 -0
- package/dist/native/vertical-bars-web-search.d.ts.map +1 -0
- package/dist/native/vertical-bars-web-search.js +90 -0
- package/dist/native/vertical-bars-web-search.js.map +1 -0
- package/dist/native/vertical-bars-web.d.ts +5 -0
- package/dist/native/vertical-bars-web.d.ts.map +1 -0
- package/dist/native/vertical-bars-web.js +421 -0
- package/dist/native/vertical-bars-web.js.map +1 -0
- package/dist/native-integration/index.d.ts +25 -0
- package/dist/native-integration/index.d.ts.map +1 -0
- package/dist/native-integration/index.js +33 -0
- package/dist/native-integration/index.js.map +1 -0
- package/dist/vertical-bars.d.ts +6 -0
- package/dist/vertical-bars.js +5 -0
- package/docs/configuration.md +187 -0
- package/docs/framework-independent.md +82 -0
- package/docs/migration.md +206 -0
- package/docs/native-mini-player.md +47 -0
- package/docs/native-ui-extensions.md +365 -0
- package/docs/native-ui.md +409 -0
- package/docs/setup.md +205 -0
- package/docs/vertical-bars.md +379 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUIButton.swift +71 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUIButtons.swift +24 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUIComponents.swift +19 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUIFab.swift +80 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUISearchController.swift +439 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUISegment.swift +91 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUITabBar.swift +218 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUIVerticalBars.swift +590 -0
- package/ios/Sources/NativeUIPlugin/Components/NativeUIVerticalSearch.swift +118 -0
- package/ios/Sources/NativeUIPlugin/Extensions/NativeUI.swift +178 -0
- package/ios/Sources/NativeUIPlugin/Extensions/NativeUIRendering.swift +38 -0
- package/ios/Sources/NativeUIPlugin/NativeUIPlugin.swift +615 -0
- package/ios/Sources/NativeUIPlugin/Overlays/NativeUIOverlayController.swift +119 -0
- package/ios/Sources/NativeUIPlugin/Overlays/NativeUIOverlayHost.swift +75 -0
- package/ios/Sources/NativeUIPlugin/Shared/NativeUIControlRendering.swift +21 -0
- package/ios/Sources/NativeUIPlugin/Shared/NativeUICrossfade.swift +35 -0
- package/ios/Sources/NativeUIPlugin/Shared/NativeUIHost.swift +8 -0
- package/ios/Sources/NativeUIPlugin/Shared/NativeUISnapshot.swift +161 -0
- package/ios/Sources/NativeUIPlugin/Shared/NativeUIVerticalBarsGeometry.swift +52 -0
- package/ios/Tests/NativeUIPluginTests/NativeUIExtensionTests.swift +165 -0
- package/ios/Tests/NativeUIPluginTests/NativeUISnapshotTests.swift +805 -0
- package/package.json +89 -4
- package/src/core.ts +15 -0
- package/src/native/activation.ts +394 -0
- package/src/native/components/index.ts +45 -0
- package/src/native/components/ion-back-button.ts +22 -0
- package/src/native/components/ion-button.ts +25 -0
- package/src/native/components/ion-buttons.ts +37 -0
- package/src/native/components/ion-fab.ts +151 -0
- package/src/native/components/ion-menu-button.ts +37 -0
- package/src/native/components/ion-segment.ts +27 -0
- package/src/native/components/ion-tab-bar.ts +50 -0
- package/src/native/components/searchable-tabs.ts +499 -0
- package/src/native/definitions.ts +324 -0
- package/src/native/extensions.ts +176 -0
- package/src/native/foldable/fold-state.ts +10 -0
- package/src/native/foldable/types.ts +4 -0
- package/src/native/html.ts +193 -0
- package/src/native/index.ts +41 -0
- package/src/native/legacy-layout.ts +21 -0
- package/src/native/overlays/content.ts +51 -0
- package/src/native/overlays/controller.ts +349 -0
- package/src/native/overlays/dialog-animation.ts +53 -0
- package/src/native/overlays/dismiss-animation.ts +15 -0
- package/src/native/overlays/focus.ts +64 -0
- package/src/native/overlays/popover.ts +120 -0
- package/src/native/overlays/styles.ts +181 -0
- package/src/native/prehide.ts +285 -0
- package/src/native/runtime.ts +988 -0
- package/src/native/shared/bridge.ts +18 -0
- package/src/native/shared/candidate.ts +162 -0
- package/src/native/shared/clipping.ts +24 -0
- package/src/native/shared/crossfade.ts +67 -0
- package/src/native/shared/diagnostics.ts +13 -0
- package/src/native/shared/dom.ts +304 -0
- package/src/native/shared/events.ts +14 -0
- package/src/native/shared/icons.ts +57 -0
- package/src/native/shared/modal.ts +157 -0
- package/src/native/shared/projection-id.ts +2 -0
- package/src/native/shared/toolbar-options.ts +53 -0
- package/src/native/shared/vertical-bars-geometry.ts +80 -0
- package/src/native/startup.ts +84 -0
- package/src/native/vertical-bars-web-search.ts +86 -0
- package/src/native/vertical-bars-web.ts +498 -0
- package/src/native-integration/index.ts +49 -0
- package/src/vertical-bars.ts +11 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { modalUsesVerticalBars } from "./modal.js";
|
|
2
|
+
import "./crossfade.js";
|
|
3
|
+
//#region src/native/shared/dom.ts
|
|
4
|
+
const marker = "data-native-ui-projected";
|
|
5
|
+
const childNodesGet = typeof Node === "undefined" ? void 0 : Object.getOwnPropertyDescriptor(Node.prototype, "childNodes")?.get;
|
|
6
|
+
const childNodesOf = (element) => childNodesGet ? Array.from(childNodesGet.call(element)) : Array.from(element.childNodes);
|
|
7
|
+
const childElements = (element) => childNodesOf(element).filter((node) => node.nodeType === 1);
|
|
8
|
+
const prehiddenClass = "native-ui-prehidden";
|
|
9
|
+
const prehideRootClass = "native-ui-prehide";
|
|
10
|
+
const rejectedClass = "native-ui-rejected";
|
|
11
|
+
const verticalBarsBackWebClass = "ios-theme-vertical-bars-back-web-owned";
|
|
12
|
+
const prehideClasses = /* @__PURE__ */ new Set([prehiddenClass, prehideRootClass]);
|
|
13
|
+
const prehideOnlyMutation = (record) => {
|
|
14
|
+
if (record.attributeName !== "class" || record.oldValue === null) return false;
|
|
15
|
+
const withoutPrehide = (value) => value.split(/\s+/).filter((name) => name && !prehideClasses.has(name)).join(" ");
|
|
16
|
+
return withoutPrehide(record.oldValue) === withoutPrehide(record.target.getAttribute("class") ?? "");
|
|
17
|
+
};
|
|
18
|
+
const withoutPrehide = (element, read) => {
|
|
19
|
+
const changed = [];
|
|
20
|
+
for (let current = element; current; current = current.parentElement) if (current.classList.contains("native-ui-prehidden")) {
|
|
21
|
+
current.classList.remove(prehiddenClass);
|
|
22
|
+
changed.push(current);
|
|
23
|
+
}
|
|
24
|
+
const root = element.ownerDocument.documentElement;
|
|
25
|
+
if (element.matches("ion-back-button") && root.classList.contains("native-ui-prehide")) {
|
|
26
|
+
root.classList.remove(prehideRootClass);
|
|
27
|
+
changed.push(root);
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return read();
|
|
31
|
+
} finally {
|
|
32
|
+
changed.forEach((current) => current.classList.add(current === root ? prehideRootClass : prehiddenClass));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const isDark = (style) => {
|
|
36
|
+
const themeScheme = style.getPropertyValue("--ios27-color-scheme").trim();
|
|
37
|
+
if (themeScheme) return themeScheme === "dark";
|
|
38
|
+
const background = style.getPropertyValue("--ion-background-color-rgb").match(/\d+/g)?.slice(0, 3).map(Number);
|
|
39
|
+
if (background?.length === 3) return background[0] * .2126 + background[1] * .7152 + background[2] * .0722 < 128;
|
|
40
|
+
const schemes = (style.colorScheme ?? "").split(/\s+/);
|
|
41
|
+
if (schemes.includes("dark") && !schemes.includes("light")) return true;
|
|
42
|
+
if (schemes.includes("light") && !schemes.includes("dark")) return false;
|
|
43
|
+
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches;
|
|
44
|
+
};
|
|
45
|
+
const permanentlyExcluded = ".ios-theme-disabled, .ios26-disabled, .ion-cloned-element, [hidden], [inert]";
|
|
46
|
+
const excluded = `${permanentlyExcluded}, .ion-page-hidden, .ion-page-invisible`;
|
|
47
|
+
const enteringPages = /* @__PURE__ */ new WeakSet();
|
|
48
|
+
const setVerticalBarsEnteringPage = (page, entering) => {
|
|
49
|
+
if (entering) enteringPages.add(page);
|
|
50
|
+
else enteringPages.delete(page);
|
|
51
|
+
};
|
|
52
|
+
const verticalBarsEnteringPage = (element) => {
|
|
53
|
+
const page = element.closest(".ion-page-invisible");
|
|
54
|
+
return page && enteringPages.has(page) && page.closest("ion-app.ios-theme-vertical-bars") ? page : void 0;
|
|
55
|
+
};
|
|
56
|
+
const createVerticalBarsPageState = () => {
|
|
57
|
+
const departed = /* @__PURE__ */ new WeakSet();
|
|
58
|
+
return {
|
|
59
|
+
isDeparted(element) {
|
|
60
|
+
const page = element.closest(".ion-page");
|
|
61
|
+
return !!page && departed.has(page) && !!element.closest("ion-app.ios-theme-vertical-bars");
|
|
62
|
+
},
|
|
63
|
+
lifecycle(event) {
|
|
64
|
+
const page = event.target && event.target.nodeType === 1 ? event.target : void 0;
|
|
65
|
+
if (!page?.matches(".ion-page")) return;
|
|
66
|
+
const entering = event.type === "ionViewWillEnter";
|
|
67
|
+
if (entering || event.type === "ionViewDidEnter") departed.delete(page);
|
|
68
|
+
else if (event.type === "ionViewWillLeave" || event.type === "ionViewDidLeave") departed.add(page);
|
|
69
|
+
setVerticalBarsEnteringPage(page, entering);
|
|
70
|
+
},
|
|
71
|
+
cancel(entering, leaving) {
|
|
72
|
+
if (entering) {
|
|
73
|
+
departed.add(entering);
|
|
74
|
+
setVerticalBarsEnteringPage(entering, false);
|
|
75
|
+
}
|
|
76
|
+
if (leaving) departed.delete(leaving);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const disabledButtonGroup = "ion-buttons:is(.ios-theme-disabled, .ios26-disabled)";
|
|
81
|
+
const nativeUIDisabledSelector = ".native-ui-disabled, [data-native-ui=\"disabled\"]";
|
|
82
|
+
const isDisabledButtonGroupChild = (element) => element.matches("ion-button") && element.parentElement?.matches(disabledButtonGroup) === true;
|
|
83
|
+
const verticalBarsTags = /* @__PURE__ */ new Set([
|
|
84
|
+
"ion-button",
|
|
85
|
+
"ion-back-button",
|
|
86
|
+
"ion-buttons",
|
|
87
|
+
"ion-menu-button",
|
|
88
|
+
"ion-tab-bar"
|
|
89
|
+
]);
|
|
90
|
+
const isVerticalBarsSource = (element) => !element.closest("[data-native-ui-placement=\"element\"]") && (element.matches("[data-native-ui-placement=\"rail\"][data-native-ui=\"button\"], [data-native-ui-placement=\"rail\"][data-native-ui=\"back-button\"]") || verticalBarsTags.has(element.localName) && (element.matches("ion-tab-bar") || verticalBarsOwned(element)) && !element.closest("ion-menu, ion-popover") && modalUsesVerticalBars(element) && !!element.closest("ion-app.ios-theme-vertical-bars"));
|
|
91
|
+
const isVerticalBarsBackPosition = (element) => {
|
|
92
|
+
if (element.closest("ion-header[collapse], ion-footer[collapse]")) return false;
|
|
93
|
+
const page = element.closest(".ion-page");
|
|
94
|
+
if (!page) return true;
|
|
95
|
+
const candidates = Array.from(page.querySelectorAll("ion-back-button")).filter((back) => back.closest(".ion-page") === page && !back.matches(".ion-cloned-element") && !back.closest("ion-header[collapse], ion-footer[collapse], ion-menu, ion-popover") && modalUsesVerticalBars(back));
|
|
96
|
+
const rank = (back) => inFixedToolbar(back) ? 0 : back.closest("ion-header ion-toolbar, ion-footer ion-toolbar") ? 1 : back.closest("ion-toolbar") ? 3 : 2;
|
|
97
|
+
return candidates.reduce((winner, back) => !winner || rank(back) < rank(winner) ? back : winner, void 0) === element;
|
|
98
|
+
};
|
|
99
|
+
const preferredVerticalBarsBack = (elements, doc) => {
|
|
100
|
+
const pages = Array.from(doc.querySelectorAll(".ion-page"));
|
|
101
|
+
const pageOrder = (element) => pages.indexOf(element.closest(".ion-page"));
|
|
102
|
+
return elements.sort((a, b) => pageOrder(b) - pageOrder(a) || Number(!!b.closest("ion-header")) - Number(!!a.closest("ion-header")))[0];
|
|
103
|
+
};
|
|
104
|
+
const excludedBy = (element, selector) => {
|
|
105
|
+
const owner = element.closest(selector);
|
|
106
|
+
return !!owner && !(element.parentElement === owner && isDisabledButtonGroupChild(element));
|
|
107
|
+
};
|
|
108
|
+
const isPermanentlyExcluded = (element) => excludedBy(element, permanentlyExcluded);
|
|
109
|
+
const isExcluded = (element, enteringPage) => excludedBy(element, `${permanentlyExcluded}, .ion-page-hidden`) || !!element.closest(".ion-page-invisible") && !enteringPage;
|
|
110
|
+
const isNativeUIDisabled = (element) => !!element.closest(nativeUIDisabledSelector) || !!element.querySelector(nativeUIDisabledSelector);
|
|
111
|
+
const isVerticalBarsToolbarActionShape = (element) => element.matches("ion-menu-button") || element.matches("ion-button") && !!element.querySelector("ion-icon[slot=\"icon-only\"], svg[slot=\"icon-only\"]");
|
|
112
|
+
const verticalBarsPlacement = /* @__PURE__ */ new WeakMap();
|
|
113
|
+
const setVerticalBarsPlacement = (element, rail) => {
|
|
114
|
+
verticalBarsPlacement.set(element, rail);
|
|
115
|
+
};
|
|
116
|
+
const clearVerticalBarsPlacement = (element) => {
|
|
117
|
+
verticalBarsPlacement.delete(element);
|
|
118
|
+
};
|
|
119
|
+
const verticalBarsOwned = (element) => verticalBarsPlacement.get(element) === true && !element.closest("ion-buttons.ios-theme-horizontal-only, ion-button.ios-theme-horizontal-only");
|
|
120
|
+
const isVerticalBarsToolbarAction = (element) => verticalBarsOwned(element) && !isExcluded(element, verticalBarsEnteringPage(element)) && !isNativeUIDisabled(element);
|
|
121
|
+
const overlays = "ion-menu, ion-popover";
|
|
122
|
+
/** Shared eligibility for a toolbar action candidate, before placement is decided (prehide) or consumed (projection). */
|
|
123
|
+
const verticalBarsActionCandidate = (element) => !element.matches("[data-native-ui=\"button\"], [data-native-ui=\"back-button\"]") && !element.querySelector("[data-native-ui=\"button\"], [data-native-ui=\"back-button\"]") && inFixedToolbar(element) && !element.closest("ion-buttons.ios-theme-horizontal-only, ion-button.ios-theme-horizontal-only") && !isPermanentlyExcluded(element) && !isNativeUIDisabled(element) && !element.closest(overlays) && modalUsesVerticalBars(element);
|
|
124
|
+
/** Shared eligibility for a back-button candidate; the back button may sit outside a fixed toolbar. */
|
|
125
|
+
const verticalBarsBackCandidate = (element) => !element.hasAttribute("data-native-ui") && isVerticalBarsBackPosition(element) && !element.closest("ion-buttons.ios-theme-horizontal-only") && !isPermanentlyExcluded(element) && !isNativeUIDisabled(element) && !element.closest(overlays) && modalUsesVerticalBars(element);
|
|
126
|
+
const verticalBarsToolbarActions = (element) => childElements(element).filter((child) => !child.matches("ion-back-button") && isVerticalBarsToolbarAction(child));
|
|
127
|
+
const isVerticalBarsToolbarGroup = (element) => {
|
|
128
|
+
return element.matches("ion-buttons") && verticalBarsOwned(element) && !element.matches(".ios-theme-disabled, .ios26-disabled") && !isNativeUIDisabled(element);
|
|
129
|
+
};
|
|
130
|
+
const toolbarTextMarker = "data-native-ui-toolbar-text";
|
|
131
|
+
const syncToolbarText = (doc) => {
|
|
132
|
+
for (const toolbar of Array.from(doc.querySelectorAll(`ion-app.ios-theme-vertical-bars ion-toolbar, ion-toolbar[${toolbarTextMarker}]`))) toolbar.toggleAttribute(toolbarTextMarker, !!toolbar.closest("ion-app.ios-theme-vertical-bars") && childNodesOf(toolbar).some((node) => node.nodeType === Node.TEXT_NODE && !!node.textContent?.trim()));
|
|
133
|
+
};
|
|
134
|
+
const activateProjectedElement = (element) => {
|
|
135
|
+
((element.matches("ion-button, ion-back-button, ion-menu-button") ? element.shadowRoot?.querySelector("[part~=\"native\"]") : void 0) ?? element).click();
|
|
136
|
+
};
|
|
137
|
+
const unprojected = (elements, read) => {
|
|
138
|
+
const list = Array.from(elements);
|
|
139
|
+
const hidden = list.filter((element) => element.hasAttribute(marker));
|
|
140
|
+
const webHidden = list.filter((element) => element.hasAttribute("data-native-ui-web-source"));
|
|
141
|
+
hidden.forEach((element) => element.removeAttribute(marker));
|
|
142
|
+
webHidden.forEach((element) => element.removeAttribute("data-native-ui-web-source"));
|
|
143
|
+
try {
|
|
144
|
+
return read();
|
|
145
|
+
} finally {
|
|
146
|
+
hidden.forEach((element) => element.setAttribute(marker, ""));
|
|
147
|
+
webHidden.forEach((element) => element.setAttribute("data-native-ui-web-source", ""));
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const readVisible = (element, allowOutsideViewport) => {
|
|
151
|
+
const enteringPage = isVerticalBarsSource(element) ? verticalBarsEnteringPage(element) : void 0;
|
|
152
|
+
if (!element.isConnected || isExcluded(element, enteringPage) || isNativeUIDisabled(element)) return false;
|
|
153
|
+
for (let current = element; current; current = current.parentElement) {
|
|
154
|
+
const style = getComputedStyle(current);
|
|
155
|
+
if (style.display === "none" || style.visibility !== "visible" || Number(style.opacity) === 0 && !current.hasAttribute("data-native-ui-fading") && current !== enteringPage) return false;
|
|
156
|
+
if (!allowOutsideViewport && style.transform !== "none" && !new DOMMatrixReadOnly(style.transform).isIdentity && current !== element && !current.matches("ion-tab-bar")) return false;
|
|
157
|
+
}
|
|
158
|
+
const rect = element.getBoundingClientRect();
|
|
159
|
+
return rect.width > 0 && rect.height > 0 && (allowOutsideViewport || rect.left >= -1 && rect.top >= -1 && rect.right <= innerWidth + 1 && rect.bottom <= innerHeight + 1);
|
|
160
|
+
};
|
|
161
|
+
const visible = (element, allowOutsideViewport = false) => withoutPrehide(element, () => readVisible(element, allowOutsideViewport));
|
|
162
|
+
const frame = (rect, origin) => ({
|
|
163
|
+
x: rect.x - (origin?.x ?? 0),
|
|
164
|
+
y: rect.y - (origin?.y ?? 0),
|
|
165
|
+
width: rect.width,
|
|
166
|
+
height: rect.height
|
|
167
|
+
});
|
|
168
|
+
const text = (element) => {
|
|
169
|
+
if (element.matches("ion-icon, svg, ion-badge, .ios27-segment-lens, .ion-cloned-element")) return "";
|
|
170
|
+
return childNodesOf(element).map((node) => node.nodeType === 3 ? node.textContent : node.nodeType === 1 ? text(node) : "").join("").replace(/\s+/g, " ").trim();
|
|
171
|
+
};
|
|
172
|
+
const inFixedToolbar = (element) => {
|
|
173
|
+
const edge = element.closest("ion-toolbar")?.parentElement;
|
|
174
|
+
const verticalBars = !!element.closest("ion-app.ios-theme-vertical-bars");
|
|
175
|
+
return !!edge?.matches("ion-header, ion-footer") && !element.closest("ion-content") && !edge.hasAttribute("collapse") && (verticalBars || !edge.matches(".header-collapse-main, .header-collapse-condense"));
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
export { activateProjectedElement, childElements, childNodesOf, clearVerticalBarsPlacement, createVerticalBarsPageState, excluded, frame, inFixedToolbar, isDark, isDisabledButtonGroupChild, isExcluded, isNativeUIDisabled, isPermanentlyExcluded, isVerticalBarsBackPosition, isVerticalBarsSource, isVerticalBarsToolbarAction, isVerticalBarsToolbarActionShape, isVerticalBarsToolbarGroup, marker, preferredVerticalBarsBack, prehiddenClass, prehideOnlyMutation, prehideRootClass, rejectedClass, setVerticalBarsEnteringPage, setVerticalBarsPlacement, syncToolbarText, text, toolbarTextMarker, unprojected, verticalBarsActionCandidate, verticalBarsBackCandidate, verticalBarsBackWebClass, verticalBarsEnteringPage, verticalBarsOwned, verticalBarsToolbarActions, visible, withoutPrehide };
|
|
179
|
+
|
|
180
|
+
//# sourceMappingURL=dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.js","names":[],"sources":["../../../src/native/shared/dom.ts"],"sourcesContent":["import { fadeMarker } from './crossfade';\nimport { modalUsesVerticalBars } from './modal';\n\nimport type { Frame } from '../definitions';\n\nexport const marker = 'data-native-ui-projected';\n// Scoped runtimes (Stencil slot emulation) patch child accessors on upgraded\n// elements and may report none before hydration; the prototype getter still\n// reports the real light DOM.\nconst childNodesGet = typeof Node === 'undefined' ? undefined : Object.getOwnPropertyDescriptor(Node.prototype, 'childNodes')?.get;\nexport const childNodesOf = (element: Element): Node[] =>\n childNodesGet ? Array.from(childNodesGet.call(element)) : Array.from(element.childNodes);\nexport const childElements = (element: Element): HTMLElement[] =>\n childNodesOf(element).filter((node) => node.nodeType === 1) as HTMLElement[];\nexport const prehiddenClass = 'native-ui-prehidden';\nexport const prehideRootClass = 'native-ui-prehide';\nexport const rejectedClass = 'native-ui-rejected';\nexport const verticalBarsBackWebClass = 'ios-theme-vertical-bars-back-web-owned';\nconst prehideClasses = new Set([prehiddenClass, prehideRootClass]);\nexport const prehideOnlyMutation = (record: MutationRecord): boolean => {\n if (record.attributeName !== 'class' || record.oldValue === null) return false;\n const withoutPrehide = (value: string) =>\n value\n .split(/\\s+/)\n .filter((name) => name && !prehideClasses.has(name))\n .join(' ');\n return withoutPrehide(record.oldValue) === withoutPrehide((record.target as Element).getAttribute('class') ?? '');\n};\n\nexport const withoutPrehide = <T>(element: HTMLElement, read: () => T): T => {\n const changed: HTMLElement[] = [];\n for (let current: HTMLElement | null = element; current; current = current.parentElement) {\n if (current.classList.contains(prehiddenClass)) {\n current.classList.remove(prehiddenClass);\n changed.push(current);\n }\n }\n const root = element.ownerDocument.documentElement;\n if (element.matches('ion-back-button') && root.classList.contains(prehideRootClass)) {\n root.classList.remove(prehideRootClass);\n changed.push(root);\n }\n try {\n return read();\n } finally {\n changed.forEach((current) => current.classList.add(current === root ? prehideRootClass : prehiddenClass));\n }\n};\nexport const isDark = (style: CSSStyleDeclaration): boolean => {\n const themeScheme = style.getPropertyValue('--ios27-color-scheme').trim();\n if (themeScheme) return themeScheme === 'dark';\n const background = style.getPropertyValue('--ion-background-color-rgb').match(/\\d+/g)?.slice(0, 3).map(Number);\n if (background?.length === 3) return background[0] * 0.2126 + background[1] * 0.7152 + background[2] * 0.0722 < 128;\n const schemes = (style.colorScheme ?? '').split(/\\s+/);\n if (schemes.includes('dark') && !schemes.includes('light')) return true;\n if (schemes.includes('light') && !schemes.includes('dark')) return false;\n return typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n};\nconst permanentlyExcluded = '.ios-theme-disabled, .ios26-disabled, .ion-cloned-element, [hidden], [inert]';\nexport const excluded = `${permanentlyExcluded}, .ion-page-hidden, .ion-page-invisible`;\nconst enteringPages = new WeakSet<HTMLElement>();\nexport const setVerticalBarsEnteringPage = (page: HTMLElement, entering: boolean): void => {\n if (entering) enteringPages.add(page);\n else enteringPages.delete(page);\n};\nexport const verticalBarsEnteringPage = (element: HTMLElement): HTMLElement | undefined => {\n const page = element.closest<HTMLElement>('.ion-page-invisible');\n return page && enteringPages.has(page) && page.closest('ion-app.ios-theme-vertical-bars') ? page : undefined;\n};\nexport const createVerticalBarsPageState = () => {\n const departed = new WeakSet<HTMLElement>();\n return {\n isDeparted(element: HTMLElement): boolean {\n const page = element.closest<HTMLElement>('.ion-page');\n return !!page && departed.has(page) && !!element.closest('ion-app.ios-theme-vertical-bars');\n },\n lifecycle(event: Event): void {\n // Avoid instanceof so stale listeners stay safe after global teardown.\n const page = event.target && (event.target as Node).nodeType === 1 ? (event.target as HTMLElement) : undefined;\n if (!page?.matches('.ion-page')) return;\n const entering = event.type === 'ionViewWillEnter';\n if (entering || event.type === 'ionViewDidEnter') departed.delete(page);\n else if (event.type === 'ionViewWillLeave' || event.type === 'ionViewDidLeave') departed.add(page);\n setVerticalBarsEnteringPage(page, entering);\n },\n cancel(entering?: HTMLElement, leaving?: HTMLElement): void {\n if (entering) {\n departed.add(entering);\n setVerticalBarsEnteringPage(entering, false);\n }\n if (leaving) departed.delete(leaving);\n },\n };\n};\nconst disabledButtonGroup = 'ion-buttons:is(.ios-theme-disabled, .ios26-disabled)';\nconst nativeUIDisabledSelector = '.native-ui-disabled, [data-native-ui=\"disabled\"]';\n\nexport const isDisabledButtonGroupChild = (element: HTMLElement): boolean =>\n element.matches('ion-button') && element.parentElement?.matches(disabledButtonGroup) === true;\n\nconst verticalBarsTags = new Set(['ion-button', 'ion-back-button', 'ion-buttons', 'ion-menu-button', 'ion-tab-bar']);\n\nexport const isVerticalBarsSource = (element: HTMLElement): boolean =>\n !element.closest('[data-native-ui-placement=\"element\"]') &&\n (element.matches(\n '[data-native-ui-placement=\"rail\"][data-native-ui=\"button\"], [data-native-ui-placement=\"rail\"][data-native-ui=\"back-button\"]',\n ) ||\n (verticalBarsTags.has(element.localName) &&\n (element.matches('ion-tab-bar') || verticalBarsOwned(element)) &&\n !element.closest('ion-menu, ion-popover') &&\n modalUsesVerticalBars(element) &&\n !!element.closest('ion-app.ios-theme-vertical-bars')));\n\nexport const isVerticalBarsBackPosition = (element: HTMLElement): boolean => {\n if (element.closest('ion-header[collapse], ion-footer[collapse]')) return false;\n const page = element.closest('.ion-page');\n if (!page) return true;\n const candidates = Array.from(page.querySelectorAll<HTMLElement>('ion-back-button')).filter(\n (back) =>\n back.closest('.ion-page') === page &&\n !back.matches('.ion-cloned-element') &&\n !back.closest('ion-header[collapse], ion-footer[collapse], ion-menu, ion-popover') &&\n modalUsesVerticalBars(back),\n );\n const rank = (back: HTMLElement) =>\n inFixedToolbar(back) ? 0 : back.closest('ion-header ion-toolbar, ion-footer ion-toolbar') ? 1 : back.closest('ion-toolbar') ? 3 : 2;\n const best = candidates.reduce<HTMLElement | undefined>(\n (winner, back) => (!winner || rank(back) < rank(winner) ? back : winner),\n undefined,\n );\n return best === element;\n};\n\nexport const preferredVerticalBarsBack = <T extends HTMLElement>(elements: T[], doc: Document): T | undefined => {\n const pages = Array.from(doc.querySelectorAll('.ion-page'));\n const pageOrder = (element: Element) => pages.indexOf(element.closest('.ion-page')!);\n return elements.sort((a, b) => pageOrder(b) - pageOrder(a) || Number(!!b.closest('ion-header')) - Number(!!a.closest('ion-header')))[0];\n};\n\nconst excludedBy = (element: HTMLElement, selector: string): boolean => {\n const owner = element.closest<HTMLElement>(selector);\n return !!owner && !(element.parentElement === owner && isDisabledButtonGroupChild(element));\n};\n\nexport const isPermanentlyExcluded = (element: HTMLElement): boolean => excludedBy(element, permanentlyExcluded);\nexport const isExcluded = (element: HTMLElement, enteringPage?: HTMLElement): boolean =>\n excludedBy(element, `${permanentlyExcluded}, .ion-page-hidden`) || (!!element.closest('.ion-page-invisible') && !enteringPage);\n\n// A shared native surface must not cover an opted-out descendant either.\nexport const isNativeUIDisabled = (element: Element): boolean =>\n !!element.closest(nativeUIDisabledSelector) || !!element.querySelector(nativeUIDisabledSelector);\n\nexport const isVerticalBarsToolbarActionShape = (element: HTMLElement): boolean =>\n element.matches('ion-menu-button') ||\n (element.matches('ion-button') && !!element.querySelector('ion-icon[slot=\"icon-only\"], svg[slot=\"icon-only\"]'));\n\n// Placement belongs to the DOM identity for one routed-page epoch. Changes to\n// content/disabled state affect rendering, never its chosen surface.\nconst verticalBarsPlacement = new WeakMap<HTMLElement, boolean>();\nexport const setVerticalBarsPlacement = (element: HTMLElement, rail: boolean): void => {\n verticalBarsPlacement.set(element, rail);\n};\nexport const clearVerticalBarsPlacement = (element: HTMLElement): void => {\n verticalBarsPlacement.delete(element);\n};\n// Explicit Web placement remains authoritative even when added after initial capture.\nexport const verticalBarsOwned = (element: HTMLElement): boolean =>\n verticalBarsPlacement.get(element) === true &&\n !element.closest('ion-buttons.ios-theme-horizontal-only, ion-button.ios-theme-horizontal-only');\n\nexport const isVerticalBarsToolbarAction = (element: HTMLElement): boolean =>\n verticalBarsOwned(element) && !isExcluded(element, verticalBarsEnteringPage(element)) && !isNativeUIDisabled(element);\n\nconst overlays = 'ion-menu, ion-popover';\n\n/** Shared eligibility for a toolbar action candidate, before placement is decided (prehide) or consumed (projection). */\nexport const verticalBarsActionCandidate = (element: HTMLElement): boolean =>\n !element.matches('[data-native-ui=\"button\"], [data-native-ui=\"back-button\"]') &&\n !element.querySelector('[data-native-ui=\"button\"], [data-native-ui=\"back-button\"]') &&\n inFixedToolbar(element) &&\n !element.closest('ion-buttons.ios-theme-horizontal-only, ion-button.ios-theme-horizontal-only') &&\n !isPermanentlyExcluded(element) &&\n !isNativeUIDisabled(element) &&\n !element.closest(overlays) &&\n modalUsesVerticalBars(element);\n\n/** Shared eligibility for a back-button candidate; the back button may sit outside a fixed toolbar. */\nexport const verticalBarsBackCandidate = (element: HTMLElement): boolean =>\n !element.hasAttribute('data-native-ui') &&\n isVerticalBarsBackPosition(element) &&\n !element.closest('ion-buttons.ios-theme-horizontal-only') &&\n !isPermanentlyExcluded(element) &&\n !isNativeUIDisabled(element) &&\n !element.closest(overlays) &&\n modalUsesVerticalBars(element);\n\nexport const verticalBarsToolbarActions = (element: HTMLElement): HTMLElement[] =>\n // Back buttons use the dedicated rail slot; they are never toolbar actions.\n childElements(element).filter((child) => !child.matches('ion-back-button') && isVerticalBarsToolbarAction(child));\n\nexport const isVerticalBarsToolbarGroup = (element: HTMLElement): boolean => {\n return (\n element.matches('ion-buttons') &&\n verticalBarsOwned(element) &&\n !element.matches('.ios-theme-disabled, .ios26-disabled') &&\n !isNativeUIDisabled(element)\n );\n};\n\nexport const toolbarTextMarker = 'data-native-ui-toolbar-text';\n\nexport const syncToolbarText = (doc: Document): void => {\n for (const toolbar of Array.from(\n doc.querySelectorAll<HTMLElement>(`ion-app.ios-theme-vertical-bars ion-toolbar, ion-toolbar[${toolbarTextMarker}]`),\n )) {\n toolbar.toggleAttribute(\n toolbarTextMarker,\n !!toolbar.closest('ion-app.ios-theme-vertical-bars') &&\n childNodesOf(toolbar).some((node) => node.nodeType === Node.TEXT_NODE && !!node.textContent?.trim()),\n );\n }\n};\n\nexport const activateProjectedElement = (element: HTMLElement): void => {\n const target = element.matches('ion-button, ion-back-button, ion-menu-button')\n ? element.shadowRoot?.querySelector<HTMLElement>('[part~=\"native\"]')\n : undefined;\n (target ?? element).click();\n};\n\nexport const unprojected = <T>(elements: Iterable<HTMLElement>, read: () => T): T => {\n const list = Array.from(elements);\n const hidden = list.filter((element) => element.hasAttribute(marker));\n const webHidden = list.filter((element) => element.hasAttribute('data-native-ui-web-source'));\n hidden.forEach((element) => element.removeAttribute(marker));\n webHidden.forEach((element) => element.removeAttribute('data-native-ui-web-source'));\n try {\n return read();\n } finally {\n hidden.forEach((element) => element.setAttribute(marker, ''));\n webHidden.forEach((element) => element.setAttribute('data-native-ui-web-source', ''));\n }\n};\n\nconst readVisible = (element: HTMLElement, allowOutsideViewport: boolean): boolean => {\n const enteringPage = isVerticalBarsSource(element) ? verticalBarsEnteringPage(element) : undefined;\n if (!element.isConnected || isExcluded(element, enteringPage) || isNativeUIDisabled(element)) return false;\n for (let current: HTMLElement | null = element; current; current = current.parentElement) {\n const style = getComputedStyle(current);\n if (\n style.display === 'none' ||\n style.visibility !== 'visible' ||\n (Number(style.opacity) === 0 && !current.hasAttribute(fadeMarker) && current !== enteringPage)\n )\n return false;\n // Ordinary controls on moving/collapsing/custom transformed surfaces stay in Web coordinates.\n // VerticalBars rail controls are placed independently of their Web coordinates and must remain\n // owned while Ionic transforms the content behind an open menu.\n if (\n !allowOutsideViewport &&\n style.transform !== 'none' &&\n !new DOMMatrixReadOnly(style.transform).isIdentity &&\n current !== element &&\n !current.matches('ion-tab-bar')\n )\n return false;\n }\n const rect = element.getBoundingClientRect();\n return (\n rect.width > 0 &&\n rect.height > 0 &&\n (allowOutsideViewport || (rect.left >= -1 && rect.top >= -1 && rect.right <= innerWidth + 1 && rect.bottom <= innerHeight + 1))\n );\n};\n\nexport const visible = (element: HTMLElement, allowOutsideViewport = false): boolean =>\n withoutPrehide(element, () => readVisible(element, allowOutsideViewport));\n\nexport const frame = (rect: DOMRect, origin?: DOMRect): Frame => ({\n x: rect.x - (origin?.x ?? 0),\n y: rect.y - (origin?.y ?? 0),\n width: rect.width,\n height: rect.height,\n});\n\nexport const text = (element: Element): string => {\n if (element.matches('ion-icon, svg, ion-badge, .ios27-segment-lens, .ion-cloned-element')) return '';\n return childNodesOf(element)\n .map((node) => (node.nodeType === 3 ? node.textContent : node.nodeType === 1 ? text(node as Element) : ''))\n .join('')\n .replace(/\\s+/g, ' ')\n .trim();\n};\n\nexport const inFixedToolbar = (element: Element): boolean => {\n const edge = element.closest('ion-toolbar')?.parentElement;\n const verticalBars = !!element.closest('ion-app.ios-theme-vertical-bars');\n return (\n !!edge?.matches('ion-header, ion-footer') &&\n !element.closest('ion-content') &&\n !edge.hasAttribute('collapse') &&\n (verticalBars || !edge.matches('.header-collapse-main, .header-collapse-condense'))\n );\n};\n"],"mappings":";;;AAKA,MAAa,SAAS;AAItB,MAAM,gBAAgB,OAAO,S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QAAQ,QAAQ,aAAa,GAE9B,OAAO;CACX;CACA,MAAM,OAAO,QAAQ,sBAAsB;CAC3C,OACE,KAAK,QAAQ,KACb,KAAK,SAAS,MACb,wBAAyB,KAAK,QAAQ,MAAM,KAAK,OAAO,MAAM,KAAK,SAAS,aAAa,KAAK,KAAK,UAAU,cAAc;AAEhI;AAEA,MAAa,WAAW,SAAsB,uBAAuB,UACnE,eAAe,eAAe,YAAY,SAAS,oBAAoB,CAAC;AAE1E,MAAa,SAAS,MAAe,YAA6B;CAChE,GAAG,KAAK,KAAK,QAAQ,KAAK;CAC1B,GAAG,KAAK,KAAK,QAAQ,KAAK;CAC1B,OAAO,KAAK;CACZ,QAAQ,KAAK;AACf;AAEA,MAAa,QAAQ,YAA6B;CAChD,IAAI,QAAQ,QAAQ,oEAAoE,GAAG,OAAO;CAClG,OAAO,aAAa,OAAO,CAAC,CACzB,KAAK,SAAU,KAAK,aAAa,IAAI,KAAK,cAAc,KAAK,aAAa,IAAI,KAAK,IAAe,IAAI,EAAG,CAAC,CAC1G,KAAK,EAAE,CAAC,CACR,QAAQ,QAAQ,GAAG,CAAC,CACpB,KAAK;AACV;AAEA,MAAa,kBAAkB,YAA8B;CAC3D,MAAM,OAAO,QAAQ,QAAQ,aAAa,CAAC,EAAE;CAC7C,MAAM,eAAe,CAAC,CAAC,QAAQ,QAAQ,iCAAiC;CACxE,OACE,CAAC,CAAC,MAAM,QAAQ,wBAAwB,KACxC,CAAC,QAAQ,QAAQ,aAAa,KAC9B,CAAC,KAAK,aAAa,UAAU,MAC5B,gBAAgB,CAAC,KAAK,QAAQ,kDAAkD;AAErF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/native/shared/events.d.ts
|
|
2
|
+
export declare const CSS_MOTION_EVENTS: {
|
|
3
|
+
readonly transitionRun: "transitionrun";
|
|
4
|
+
readonly transitionEnd: "transitionend";
|
|
5
|
+
readonly transitionCancel: "transitioncancel";
|
|
6
|
+
readonly animationStart: "animationstart";
|
|
7
|
+
readonly animationEnd: "animationend";
|
|
8
|
+
readonly animationCancel: "animationcancel";
|
|
9
|
+
};
|
|
10
|
+
export declare const LIFECYCLE_WILL_ENTER = "ionViewWillEnter";
|
|
11
|
+
export declare const LIFECYCLE_WILL_LEAVE = "ionViewWillLeave";
|
|
12
|
+
export declare const LIFECYCLE_DID_ENTER = "ionViewDidEnter";
|
|
13
|
+
export declare const LIFECYCLE_DID_LEAVE = "ionViewDidLeave";
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","names":[],"sources":["../../../src/native/shared/events.ts"],"mappings":";qBAAa;;;;;;;;qBAUA;qBACA;qBACA;qBACA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/native/shared/events.ts
|
|
2
|
+
const CSS_MOTION_EVENTS = {
|
|
3
|
+
transitionRun: "transitionrun",
|
|
4
|
+
transitionEnd: "transitionend",
|
|
5
|
+
transitionCancel: "transitioncancel",
|
|
6
|
+
animationStart: "animationstart",
|
|
7
|
+
animationEnd: "animationend",
|
|
8
|
+
animationCancel: "animationcancel"
|
|
9
|
+
};
|
|
10
|
+
const LIFECYCLE_WILL_ENTER = "ionViewWillEnter";
|
|
11
|
+
const LIFECYCLE_WILL_LEAVE = "ionViewWillLeave";
|
|
12
|
+
const LIFECYCLE_DID_ENTER = "ionViewDidEnter";
|
|
13
|
+
const LIFECYCLE_DID_LEAVE = "ionViewDidLeave";
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CSS_MOTION_EVENTS, LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../../src/native/shared/events.ts"],"sourcesContent":["export const CSS_MOTION_EVENTS = {\n transitionRun: 'transitionrun',\n transitionEnd: 'transitionend',\n transitionCancel: 'transitioncancel',\n animationStart: 'animationstart',\n animationEnd: 'animationend',\n animationCancel: 'animationcancel',\n} as const;\n\n// Ionic adapter event names. Generic DOM sources do not require this lifecycle.\nexport const LIFECYCLE_WILL_ENTER = 'ionViewWillEnter';\nexport const LIFECYCLE_WILL_LEAVE = 'ionViewWillLeave';\nexport const LIFECYCLE_DID_ENTER = 'ionViewDidEnter';\nexport const LIFECYCLE_DID_LEAVE = 'ionViewDidLeave';\n"],"mappings":";AAAA,MAAa,oBAAoB;CAC/B,eAAe;CACf,eAAe;CACf,kBAAkB;CAClB,gBAAgB;CAChB,cAAc;CACd,iBAAiB;AACnB;AAGA,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,sBAAsB;AACnC,MAAa,sBAAsB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/native/shared/icons.d.ts
|
|
2
|
+
export declare const iconSource: (svg: SVGElement, mirrored?: boolean) => string | undefined;
|
|
3
|
+
export declare const createIconRenderer: () => {
|
|
4
|
+
clear: () => void;
|
|
5
|
+
render(source: string, width: number, height: number): Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","names":[],"sources":["../../../src/native/shared/icons.ts"],"mappings":";qBAAa,aAAc,KAAK,YAAY;qBA6B/B;;EAIY,OAAA,gBAAM,eAAe,iBAAmB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region src/native/shared/icons.ts
|
|
2
|
+
const iconSource = (svg, mirrored) => {
|
|
3
|
+
if (svg.querySelector("script, foreignObject, image, use, animate, animateTransform, set, style, text") || /url\((?!["']?#)/.test(svg.outerHTML)) return void 0;
|
|
4
|
+
if (mirrored === void 0 && svg.parentElement?.matches(".icon-inner")) {
|
|
5
|
+
const transform = new DOMMatrixReadOnly(getComputedStyle(svg.parentElement).transform);
|
|
6
|
+
mirrored = transform.is2D && transform.a === -1 && transform.d === 1 && !transform.b && !transform.c && !transform.e && !transform.f;
|
|
7
|
+
}
|
|
8
|
+
const copy = svg.cloneNode(true);
|
|
9
|
+
const originals = [svg, ...Array.from(svg.querySelectorAll("*"))];
|
|
10
|
+
const copies = [copy, ...Array.from(copy.querySelectorAll("*"))];
|
|
11
|
+
originals.forEach((node, index) => {
|
|
12
|
+
const style = getComputedStyle(node);
|
|
13
|
+
for (const property of [
|
|
14
|
+
"fill",
|
|
15
|
+
"stroke",
|
|
16
|
+
"stroke-width",
|
|
17
|
+
"opacity",
|
|
18
|
+
"fill-opacity",
|
|
19
|
+
"stroke-opacity",
|
|
20
|
+
"color"
|
|
21
|
+
]) copies[index].style.setProperty(property, style.getPropertyValue(property));
|
|
22
|
+
});
|
|
23
|
+
copy.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
24
|
+
if (mirrored) {
|
|
25
|
+
copy.style.transform = "scaleX(-1)";
|
|
26
|
+
copy.style.transformOrigin = "center";
|
|
27
|
+
}
|
|
28
|
+
return new XMLSerializer().serializeToString(copy);
|
|
29
|
+
};
|
|
30
|
+
const createIconRenderer = () => {
|
|
31
|
+
const cache = /* @__PURE__ */ new Map();
|
|
32
|
+
return {
|
|
33
|
+
clear: () => cache.clear(),
|
|
34
|
+
async render(source, width, height) {
|
|
35
|
+
const scale = devicePixelRatio || 1;
|
|
36
|
+
const key = `${width}:${height}:${scale}:${source}`;
|
|
37
|
+
const cached = cache.get(key);
|
|
38
|
+
if (cached) return cached;
|
|
39
|
+
const url = URL.createObjectURL(new Blob([source], { type: "image/svg+xml" }));
|
|
40
|
+
try {
|
|
41
|
+
const image = new Image();
|
|
42
|
+
image.src = url;
|
|
43
|
+
await image.decode();
|
|
44
|
+
const canvas = document.createElement("canvas");
|
|
45
|
+
canvas.width = Math.ceil(width * scale);
|
|
46
|
+
canvas.height = Math.ceil(height * scale);
|
|
47
|
+
canvas.getContext("2d").drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
48
|
+
const data = canvas.toDataURL("image/png").split(",")[1];
|
|
49
|
+
if (cache.size >= 128) cache.delete(cache.keys().next().value);
|
|
50
|
+
cache.set(key, data);
|
|
51
|
+
return data;
|
|
52
|
+
} finally {
|
|
53
|
+
URL.revokeObjectURL(url);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { createIconRenderer, iconSource };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../../../src/native/shared/icons.ts"],"sourcesContent":["export const iconSource = (svg: SVGElement, mirrored?: boolean): string | undefined => {\n // A small, local SVG subset. Never load external content while projecting UI.\n if (\n svg.querySelector('script, foreignObject, image, use, animate, animateTransform, set, style, text') ||\n /url\\((?![\"']?#)/.test(svg.outerHTML)\n )\n return undefined;\n // Ionicons flips the wrapper, not the SVG, for directional icons in RTL.\n if (mirrored === undefined && svg.parentElement?.matches('.icon-inner')) {\n const transform = new DOMMatrixReadOnly(getComputedStyle(svg.parentElement).transform);\n mirrored = transform.is2D && transform.a === -1 && transform.d === 1 && !transform.b && !transform.c && !transform.e && !transform.f;\n }\n const copy = svg.cloneNode(true) as SVGElement;\n const originals = [svg, ...Array.from(svg.querySelectorAll('*'))];\n const copies = [copy, ...Array.from(copy.querySelectorAll('*'))];\n originals.forEach((node, index) => {\n const style = getComputedStyle(node);\n for (const property of ['fill', 'stroke', 'stroke-width', 'opacity', 'fill-opacity', 'stroke-opacity', 'color']) {\n (copies[index] as SVGElement).style.setProperty(property, style.getPropertyValue(property));\n }\n });\n copy.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n if (mirrored) {\n copy.style.transform = 'scaleX(-1)';\n copy.style.transformOrigin = 'center';\n }\n return new XMLSerializer().serializeToString(copy);\n};\n\nexport const createIconRenderer = () => {\n const cache = new Map<string, string>();\n return {\n clear: () => cache.clear(),\n async render(source: string, width: number, height: number): Promise<string> {\n const scale = devicePixelRatio || 1;\n const key = `${width}:${height}:${scale}:${source}`;\n const cached = cache.get(key);\n if (cached) return cached;\n const url = URL.createObjectURL(new Blob([source], { type: 'image/svg+xml' }));\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const canvas = document.createElement('canvas');\n canvas.width = Math.ceil(width * scale);\n canvas.height = Math.ceil(height * scale);\n canvas.getContext('2d')!.drawImage(image, 0, 0, canvas.width, canvas.height);\n const data = canvas.toDataURL('image/png').split(',')[1];\n if (cache.size >= 128) cache.delete(cache.keys().next().value!);\n cache.set(key, data);\n return data;\n } finally {\n URL.revokeObjectURL(url);\n }\n },\n };\n};\n"],"mappings":";AAAA,MAAa,cAAc,KAAiB,aAA2C;CAErF,IACE,IAAI,cAAc,gFAAgF,KAClG,kBAAkB,KAAK,IAAI,SAAS,GAEpC,OAAO,KAAA;CAET,IAAI,aAAa,KAAA,KAAa,IAAI,eAAe,QAAQ,aAAa,GAAG;EACvE,MAAM,YAAY,IAAI,kBAAkB,iBAAiB,IAAI,aAAa,CAAC,CAAC,SAAS;EACrF,WAAW,UAAU,QAAQ,UAAU,MAAM,MAAM,UAAU,MAAM,KAAK,CAAC,UAAU,KAAK,CAAC,UAAU,KAAK,CAAC,UAAU,KAAK,CAAC,UAAU;CACrI;CACA,MAAM,OAAO,IAAI,UAAU,IAAI;CAC/B,MAAM,YAAY,CAAC,KAAK,GAAG,MAAM,KAAK,IAAI,iBAAiB,GAAG,CAAC,CAAC;CAChE,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC,CAAC;CAC/D,UAAU,SAAS,MAAM,UAAU;EACjC,MAAM,QAAQ,iBAAiB,IAAI;EACnC,KAAK,MAAM,YAAY;GAAC;GAAQ;GAAU;G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 +1,10 @@
|
|
|
1
|
+
import { Frame } from "../definitions.js";
|
|
2
|
+
//#region src/native/shared/modal.d.ts
|
|
3
|
+
export declare const modalRailClass = "ios-theme-vertical-bars-modal";
|
|
4
|
+
export declare const topModal: (doc: Document) => HTMLIonModalElement | undefined;
|
|
5
|
+
export declare const modalUsesVerticalBars: (element: Element) => boolean;
|
|
6
|
+
export declare const inVerticalBarsSurface: (element: Element) => boolean;
|
|
7
|
+
export declare const observeVerticalBarsModals: (doc: Document) => (() => void);
|
|
8
|
+
export declare const modalVerticalBarFrame: (modal: Element) => Frame | undefined;
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.ts","names":[],"sources":["../../../src/native/shared/modal.ts"],"mappings":";;qBAGa;qBAGA,WAAY,KAAK,aAAW;qBAC5B,wBAAyB,SAAS;qBAMlC,wBAAyB,SAAS;qBAKlC,4BAA6B,KAAK;qBAmIlC,wBAAyB,OAAO,YAAU"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
//#region src/native/shared/modal.ts
|
|
2
|
+
/** Modal hosts cover the viewport even when their visible dialog is centered. */
|
|
3
|
+
const modalRailClass = "ios-theme-vertical-bars-modal";
|
|
4
|
+
const states = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const topModal = (doc) => states.get(doc)?.top;
|
|
6
|
+
const modalUsesVerticalBars = (element) => {
|
|
7
|
+
const modal = element.closest("ion-modal");
|
|
8
|
+
return !modal || modal.classList.contains("ios-theme-vertical-bars-modal");
|
|
9
|
+
};
|
|
10
|
+
/** Only the foreground modal may contribute controls; never the covered page. */
|
|
11
|
+
const inVerticalBarsSurface = (element) => {
|
|
12
|
+
const modal = topModal(element.ownerDocument);
|
|
13
|
+
return modal ? element.closest("ion-modal") === modal && modalUsesVerticalBars(element) : !element.closest("ion-modal");
|
|
14
|
+
};
|
|
15
|
+
const observeVerticalBarsModals = (doc) => {
|
|
16
|
+
const win = doc.defaultView;
|
|
17
|
+
const state = {};
|
|
18
|
+
states.set(doc, state);
|
|
19
|
+
const presenting = /* @__PURE__ */ new Set();
|
|
20
|
+
const dismissed = /* @__PURE__ */ new WeakSet();
|
|
21
|
+
const observed = /* @__PURE__ */ new Set();
|
|
22
|
+
const listeners = new AbortController();
|
|
23
|
+
let stopped = false;
|
|
24
|
+
let frame = 0;
|
|
25
|
+
let pointerActive = false;
|
|
26
|
+
let bounds = "";
|
|
27
|
+
const toolbarTop = "--ios-theme-vertical-bars-modal-offset-top";
|
|
28
|
+
const refresh = () => {
|
|
29
|
+
win.cancelAnimationFrame(frame);
|
|
30
|
+
frame = 0;
|
|
31
|
+
if (stopped) return;
|
|
32
|
+
const app = doc.querySelector("ion-app.ios-theme-vertical-bars");
|
|
33
|
+
const modals = Array.from(doc.querySelectorAll("ion-modal"));
|
|
34
|
+
const active = modals.filter((modal) => !dismissed.has(modal) && (modal.presented || presenting.has(modal)));
|
|
35
|
+
for (const modal of presenting) if (!modal.isConnected) presenting.delete(modal);
|
|
36
|
+
const top = active.sort((a, b) => a.overlayIndex - b.overlayIndex).slice(-1)[0];
|
|
37
|
+
let changed = state.top !== top;
|
|
38
|
+
state.top = top;
|
|
39
|
+
const nextBounds = top ? JSON.stringify(modalVerticalBarFrame(top)) : "";
|
|
40
|
+
changed || (changed = bounds !== nextBounds);
|
|
41
|
+
bounds = nextBounds;
|
|
42
|
+
const wanted = /* @__PURE__ */ new Set();
|
|
43
|
+
for (const modal of modals) {
|
|
44
|
+
const content = modal.shadowRoot?.querySelector("[part~=\"content\"]");
|
|
45
|
+
if (content) wanted.add(content);
|
|
46
|
+
const fullWidth = !!content && Math.abs(content.offsetWidth - win.innerWidth) <= 1 && Math.abs(content.offsetLeft) <= 1;
|
|
47
|
+
const enabled = !!app?.contains(modal) && active.includes(modal) && fullWidth;
|
|
48
|
+
if (enabled) {
|
|
49
|
+
const offset = `${modalVerticalBarFrame(modal)?.y ?? 0}px`;
|
|
50
|
+
if (modal.style.getPropertyValue(toolbarTop) !== offset) {
|
|
51
|
+
modal.style.setProperty(toolbarTop, offset);
|
|
52
|
+
changed = true;
|
|
53
|
+
}
|
|
54
|
+
} else modal.style.removeProperty(toolbarTop);
|
|
55
|
+
if (modal.classList.contains("ios-theme-vertical-bars-modal") !== enabled) {
|
|
56
|
+
modal.classList.toggle(modalRailClass, enabled);
|
|
57
|
+
changed = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (wanted.size !== observed.size || [...wanted].some((element) => !observed.has(element))) {
|
|
61
|
+
resize?.disconnect();
|
|
62
|
+
observer.disconnect();
|
|
63
|
+
observer.observe(doc.documentElement, observation);
|
|
64
|
+
observed.clear();
|
|
65
|
+
for (const element of wanted) {
|
|
66
|
+
resize?.observe(element);
|
|
67
|
+
observer.observe(element, {
|
|
68
|
+
attributes: true,
|
|
69
|
+
attributeFilter: ["style", "class"]
|
|
70
|
+
});
|
|
71
|
+
observed.add(element);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (changed) win.dispatchEvent(new Event("nativeUIRefresh"));
|
|
75
|
+
if (top && (pointerActive || Array.from(wanted).some((element) => element.getAnimations().some((animation) => animation.playState === "running")))) schedule();
|
|
76
|
+
};
|
|
77
|
+
const schedule = () => {
|
|
78
|
+
if (!stopped && !frame) frame = win.requestAnimationFrame(refresh);
|
|
79
|
+
};
|
|
80
|
+
const resize = win.ResizeObserver ? new win.ResizeObserver(schedule) : void 0;
|
|
81
|
+
const observer = new MutationObserver(schedule);
|
|
82
|
+
const observation = {
|
|
83
|
+
subtree: true,
|
|
84
|
+
childList: true,
|
|
85
|
+
attributes: true,
|
|
86
|
+
attributeFilter: ["class", "style"]
|
|
87
|
+
};
|
|
88
|
+
observer.observe(doc.documentElement, observation);
|
|
89
|
+
for (const name of [
|
|
90
|
+
"ionModalWillPresent",
|
|
91
|
+
"ionModalDidPresent",
|
|
92
|
+
"ionModalWillDismiss",
|
|
93
|
+
"ionModalDidDismiss",
|
|
94
|
+
"ionBreakpointDidChange"
|
|
95
|
+
]) doc.addEventListener(name, (event) => {
|
|
96
|
+
const modal = event.target;
|
|
97
|
+
if (modal.localName !== "ion-modal") return;
|
|
98
|
+
if (name === "ionModalDidDismiss") {
|
|
99
|
+
presenting.delete(modal);
|
|
100
|
+
dismissed.add(modal);
|
|
101
|
+
} else {
|
|
102
|
+
presenting.add(modal);
|
|
103
|
+
dismissed.delete(modal);
|
|
104
|
+
}
|
|
105
|
+
refresh();
|
|
106
|
+
}, {
|
|
107
|
+
capture: true,
|
|
108
|
+
signal: listeners.signal
|
|
109
|
+
});
|
|
110
|
+
doc.addEventListener("pointerdown", (event) => {
|
|
111
|
+
if (event.target.closest("ion-modal")) {
|
|
112
|
+
pointerActive = true;
|
|
113
|
+
schedule();
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
capture: true,
|
|
117
|
+
signal: listeners.signal
|
|
118
|
+
});
|
|
119
|
+
for (const name of ["pointerup", "pointercancel"]) doc.addEventListener(name, () => {
|
|
120
|
+
pointerActive = false;
|
|
121
|
+
schedule();
|
|
122
|
+
}, {
|
|
123
|
+
capture: true,
|
|
124
|
+
signal: listeners.signal
|
|
125
|
+
});
|
|
126
|
+
win.addEventListener("resize", schedule, { signal: listeners.signal });
|
|
127
|
+
win.addEventListener("nativeUIRefresh", schedule, { signal: listeners.signal });
|
|
128
|
+
refresh();
|
|
129
|
+
return () => {
|
|
130
|
+
stopped = true;
|
|
131
|
+
win.cancelAnimationFrame(frame);
|
|
132
|
+
observer.disconnect();
|
|
133
|
+
resize?.disconnect();
|
|
134
|
+
listeners.abort();
|
|
135
|
+
if (states.get(doc) !== state) return;
|
|
136
|
+
states.delete(doc);
|
|
137
|
+
doc.querySelectorAll(`.${modalRailClass}`).forEach((modal) => {
|
|
138
|
+
modal.classList.remove(modalRailClass);
|
|
139
|
+
modal.style.removeProperty(toolbarTop);
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/** Visible modal bounds, clipped at the viewport for Ionic's translated sheets. */
|
|
144
|
+
const modalVerticalBarFrame = (modal) => {
|
|
145
|
+
const rect = modal.shadowRoot?.querySelector("[part~=\"content\"]")?.getBoundingClientRect();
|
|
146
|
+
const win = modal.ownerDocument.defaultView;
|
|
147
|
+
if (!rect) return;
|
|
148
|
+
const y = Math.max(0, rect.top);
|
|
149
|
+
const height = Math.min(win.innerHeight, rect.bottom) - y;
|
|
150
|
+
return height > 0 ? {
|
|
151
|
+
x: 0,
|
|
152
|
+
y,
|
|
153
|
+
width: win.innerWidth,
|
|
154
|
+
height
|
|
155
|
+
} : void 0;
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
export { inVerticalBarsSurface, modalRailClass, modalUsesVerticalBars, modalVerticalBarFrame, observeVerticalBarsModals, topModal };
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.js","names":[],"sources":["../../../src/native/shared/modal.ts"],"sourcesContent":["import type { Frame } from '../definitions';\n\n/** Modal hosts cover the viewport even when their visible dialog is centered. */\nexport const modalRailClass = 'ios-theme-vertical-bars-modal';\nconst states = new WeakMap<Document, { top?: HTMLIonModalElement }>();\n\nexport const topModal = (doc: Document): HTMLIonModalElement | undefined => states.get(doc)?.top;\nexport const modalUsesVerticalBars = (element: Element): boolean => {\n const modal = element.closest('ion-modal');\n return !modal || modal.classList.contains(modalRailClass);\n};\n\n/** Only the foreground modal may contribute controls; never the covered page. */\nexport const inVerticalBarsSurface = (element: Element): boolean => {\n const modal = topModal(element.ownerDocument);\n return modal ? element.closest('ion-modal') === modal && modalUsesVerticalBars(element) : !element.closest('ion-modal');\n};\n\nexport const observeVerticalBarsModals = (doc: Document): (() => void) => {\n const win = doc.defaultView!;\n const state: { top?: HTMLIonModalElement } = {};\n states.set(doc, state);\n const presenting = new Set<HTMLIonModalElement>();\n const dismissed = new WeakSet<HTMLIonModalElement>();\n const observed = new Set<Element>();\n const listeners = new AbortController();\n let stopped = false;\n let frame = 0;\n let pointerActive = false;\n let bounds = '';\n const toolbarTop = '--ios-theme-vertical-bars-modal-offset-top';\n const refresh = () => {\n win.cancelAnimationFrame(frame);\n frame = 0;\n if (stopped) return;\n const app = doc.querySelector('ion-app.ios-theme-vertical-bars');\n const modals = Array.from(doc.querySelectorAll<HTMLIonModalElement>('ion-modal'));\n const active = modals.filter(\n (modal) => !dismissed.has(modal) && ((modal as HTMLIonModalElement & { presented?: boolean }).presented || presenting.has(modal)),\n );\n for (const modal of presenting) if (!modal.isConnected) presenting.delete(modal);\n const top = active.sort((a, b) => a.overlayIndex - b.overlayIndex).slice(-1)[0];\n let changed = state.top !== top;\n state.top = top;\n const nextBounds = top ? JSON.stringify(modalVerticalBarFrame(top)) : '';\n changed ||= bounds !== nextBounds;\n bounds = nextBounds;\n const wanted = new Set<Element>();\n for (const modal of modals) {\n const content = modal.shadowRoot?.querySelector<HTMLElement>('[part~=\"content\"]');\n if (content) wanted.add(content);\n // offsetWidth is unaffected by Ionic's presentation transforms.\n const fullWidth = !!content && Math.abs(content.offsetWidth - win.innerWidth) <= 1 && Math.abs(content.offsetLeft) <= 1;\n const enabled = !!app?.contains(modal) && active.includes(modal) && fullWidth;\n if (enabled) {\n const top = modalVerticalBarFrame(modal)?.y ?? 0;\n const offset = `${top}px`;\n if (modal.style.getPropertyValue(toolbarTop) !== offset) {\n modal.style.setProperty(toolbarTop, offset);\n changed = true;\n }\n } else modal.style.removeProperty(toolbarTop);\n if (modal.classList.contains(modalRailClass) !== enabled) {\n modal.classList.toggle(modalRailClass, enabled);\n changed = true;\n }\n }\n if (wanted.size !== observed.size || [...wanted].some((element) => !observed.has(element))) {\n resize?.disconnect();\n observer.disconnect();\n observer.observe(doc.documentElement, observation);\n observed.clear();\n for (const element of wanted) {\n resize?.observe(element);\n observer.observe(element, { attributes: true, attributeFilter: ['style', 'class'] });\n observed.add(element);\n }\n }\n if (changed) win.dispatchEvent(new Event('nativeUIRefresh'));\n if (\n top &&\n (pointerActive ||\n Array.from(wanted).some((element) => element.getAnimations().some((animation) => animation.playState === 'running')))\n )\n schedule();\n };\n const schedule = () => {\n if (!stopped && !frame) frame = win.requestAnimationFrame(refresh);\n };\n const resize = win.ResizeObserver ? new win.ResizeObserver(schedule) : undefined;\n const observer = new MutationObserver(schedule);\n const observation = { subtree: true, childList: true, attributes: true, attributeFilter: ['class', 'style'] };\n observer.observe(doc.documentElement, observation);\n for (const name of ['ionModalWillPresent', 'ionModalDidPresent', 'ionModalWillDismiss', 'ionModalDidDismiss', 'ionBreakpointDidChange']) {\n doc.addEventListener(\n name,\n (event) => {\n const modal = event.target as HTMLIonModalElement;\n if (modal.localName !== 'ion-modal') return;\n if (name === 'ionModalDidDismiss') {\n presenting.delete(modal);\n dismissed.add(modal);\n } else {\n presenting.add(modal);\n dismissed.delete(modal);\n }\n refresh();\n },\n { capture: true, signal: listeners.signal },\n );\n }\n doc.addEventListener(\n 'pointerdown',\n (event) => {\n if ((event.target as Element).closest('ion-modal')) {\n pointerActive = true;\n schedule();\n }\n },\n { capture: true, signal: listeners.signal },\n );\n for (const name of ['pointerup', 'pointercancel'])\n doc.addEventListener(\n name,\n () => {\n pointerActive = false;\n schedule();\n },\n { capture: true, signal: listeners.signal },\n );\n win.addEventListener('resize', schedule, { signal: listeners.signal });\n win.addEventListener('nativeUIRefresh', schedule, { signal: listeners.signal });\n refresh();\n return () => {\n stopped = true;\n win.cancelAnimationFrame(frame);\n observer.disconnect();\n resize?.disconnect();\n listeners.abort();\n if (states.get(doc) !== state) return;\n states.delete(doc);\n doc.querySelectorAll<HTMLElement>(`.${modalRailClass}`).forEach((modal) => {\n modal.classList.remove(modalRailClass);\n modal.style.removeProperty(toolbarTop);\n });\n };\n};\n\n/** Visible modal bounds, clipped at the viewport for Ionic's translated sheets. */\nexport const modalVerticalBarFrame = (modal: Element): Frame | undefined => {\n const rect = modal.shadowRoot?.querySelector('[part~=\"content\"]')?.getBoundingClientRect();\n const win = modal.ownerDocument.defaultView!;\n if (!rect) return;\n const y = Math.max(0, rect.top);\n const height = Math.min(win.innerHeight, rect.bottom) - y;\n return height > 0 ? { x: 0, y, width: win.innerWidth, height } : undefined;\n};\n"],"mappings":";;AAGA,MAAa,iBAAiB;AAC9B,MAAM,yBAAS,IAAI,QAAiD;AAEpE,MAAa,YAAY,QAAmD,OAAO,IAAI,GAAG,CAAC,EAAE;AAC7F,MAAa,yBAAyB,YAA8B;CAClE,MAAM,QAAQ,QAAQ,QAAQ,WAAW;CACzC,OAAO,CAAC,SAAS,MAAM,UAAU,SAAA,+BAAuB;AAC1D;;AAGA,MAAa,yBAAyB,YAA8B;CAClE,MAAM,QAAQ,SAAS,QAAQ,aAAa;CAC5C,OAAO,QAAQ,QAAQ,QAAQ,WAAW,MAAM,SAAS,sBAAsB,OAAO,IAAI,CAAC,QAAQ,QAAQ,WAAW;AACxH;AAEA,MAAa,6BAA6B,QAAgC;CACxE,MAAM,MAAM,IAAI;CAChB,MAAM,QAAuC,CAAC;CAC9C,OAAO,IAAI,KAAK,KAAK;CACrB,MAAM,6BAAa,IAAI,IAAyB;CAChD,MAAM,4BAAY,IAAI,QAA6B;CACnD,MAAM,2BAAW,IAAI,IAAa;CAClC,MAAM,YAAY,IAAI,gBAAgB;CACtC,IAAI,UAAU;CACd,IAAI,QAAQ;CACZ,IAAI,gBAAgB;CACpB,IAAI,SAAS;CACb,MAAM,aAAa;CACnB,MAAM,gBAAgB;EACpB,IAAI,qBAAqB,KAAK;EAC9B,QAAQ;EACR,IAAI,SAAS;EACb,MAAM,MAAM,IAAI,cAAc,iCAAiC;EAC/D,MAAM,SAAS,MAAM,KAAK,IAAI,iBAAsC,WAAW,CAAC;EAChF,MAAM,SAAS,OAAO,QACnB,UAAU,CAAC,UAAU,IAAI,KAAK,MAAO,MAAwD,aAAa,WAAW,IAAI,KAAK,EACjI;EACA,KAAK,MAAM,SAAS,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iBACF,YACM;EACJ,gBAAgB;EAChB,SAAS;CACX,GACA;EAAE,SAAS;EAAM,QAAQ,UAAU;CAAO,CAC5C;CACF,IAAI,iBAAiB,UAAU,UAAU,EAAE,QAAQ,UAAU,OAAO,CAAC;CACrE,IAAI,iBAAiB,mBAAmB,UAAU,EAAE,QAAQ,UAAU,OAAO,CAAC;CAC9E,QAAQ;CACR,aAAa;EACX,UAAU;EACV,IAAI,qBAAqB,KAAK;EAC9B,SAAS,WAAW;EACpB,QAAQ,WAAW;EACnB,UAAU,MAAM;EAChB,IAAI,OAAO,IAAI,GAAG,MAAM,OAAO;EAC/B,OAAO,OAAO,GAAG;EACjB,IAAI,iBAA8B,IAAI,gBAAgB,CAAC,CAAC,SAAS,UAAU;GACzE,MAAM,UAAU,OAAO,cAAc;GACrC,MAAM,MAAM,eAAe,UAAU;EACvC,CAAC;CACH;AACF;;AAGA,MAAa,yBAAyB,UAAsC;CAC1E,MAAM,OAAO,MAAM,YAAY,cAAc,qBAAmB,CAAC,EAAE,sBAAsB;CACzF,MAAM,MAAM,MAAM,cAAc;CAChC,IAAI,CAAC,MAAM;CACX,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,GAAG;CAC9B,MAAM,SAAS,KAAK,IAAI,IAAI,aAAa,KAAK,MAAM,IAAI;CACxD,OAAO,SAAS,IAAI;EAAE,GAAG;EAAG;EAAG,OAAO,IAAI;EAAY;CAAO,IAAI,KAAA;AACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-id.d.ts","names":[],"sources":["../../../src/native/shared/projection-id.ts"],"mappings":";qBACa,eAAa,QAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-id.js","names":[],"sources":["../../../src/native/shared/projection-id.ts"],"sourcesContent":["/** Internal identity used to anchor overlays to their native control. */\nexport const projectionIds = new WeakMap<Element, string>();\n"],"mappings":";;AACA,MAAa,gCAAgB,IAAI,QAAyB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToolbarProjectionOptions, VerticalControlAreaOptions } from "../definitions.js";
|
|
2
|
+
//#region src/native/shared/toolbar-options.d.ts
|
|
3
|
+
export declare const toolbarOptions: (options: VerticalControlAreaOptions, vertical: boolean) => Required<ToolbarProjectionOptions>;
|
|
4
|
+
export declare const localToolbarOption: (element: HTMLElement, vertical: boolean) => boolean | undefined;
|
|
5
|
+
export declare const horizontalSelected: (element: HTMLElement, options: VerticalControlAreaOptions) => boolean;
|
|
6
|
+
export declare const horizontalToolbarGroup: (element: HTMLElement, options: VerticalControlAreaOptions) => boolean;
|
|
7
|
+
export declare const inVerticalToolbarLayout: (element: HTMLElement) => boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
//# sourceMappingURL=toolbar-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-options.d.ts","names":[],"sources":["../../../src/native/shared/toolbar-options.ts"],"mappings":";;qBAIa,iBAAkB,SAAS,4BAA4B,sBAAoB,SAAS;qBAWpF,qBAAsB,SAAS,aAAa;qBAK5C,qBAAsB,SAAS,aAAa,SAAS;qBAQrD,yBAA0B,SAAS,aAAa,SAAS;qBAuBzD,0BAA2B,SAAS"}
|