@rdlabo/ionic-theme-ios27 1.2.0-3 → 1.2.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/README.md +15 -2
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/css/ionic-theme-ios27.css +1 -1
- package/dist/css/vertical-bars.css +1 -1
- package/dist/focus-controller/index.d.ts +4 -2
- package/dist/focus-controller/index.d.ts.map +1 -1
- package/dist/focus-controller/index.js +100 -57
- package/dist/focus-controller/index.js.map +1 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -60
- package/dist/index.js.map +1 -0
- package/dist/native/components/index.d.ts +13 -10
- package/dist/native/components/index.d.ts.map +1 -1
- package/dist/native/components/index.js +39 -41
- package/dist/native/components/index.js.map +1 -0
- package/dist/native/components/ion-back-button.d.ts +6 -1
- package/dist/native/components/ion-back-button.d.ts.map +1 -1
- package/dist/native/components/ion-back-button.js +19 -13
- package/dist/native/components/ion-back-button.js.map +1 -0
- package/dist/native/components/ion-button.d.ts +8 -2
- package/dist/native/components/ion-button.d.ts.map +1 -1
- package/dist/native/components/ion-button.js +22 -17
- package/dist/native/components/ion-button.js.map +1 -0
- package/dist/native/components/ion-buttons.d.ts +8 -2
- package/dist/native/components/ion-buttons.d.ts.map +1 -1
- package/dist/native/components/ion-buttons.js +29 -33
- package/dist/native/components/ion-buttons.js.map +1 -0
- package/dist/native/components/ion-fab.d.ts +6 -1
- package/dist/native/components/ion-fab.d.ts.map +1 -1
- package/dist/native/components/ion-fab.js +131 -151
- package/dist/native/components/ion-fab.js.map +1 -0
- package/dist/native/components/ion-menu-button.d.ts +8 -2
- package/dist/native/components/ion-menu-button.d.ts.map +1 -1
- package/dist/native/components/ion-menu-button.js +29 -19
- package/dist/native/components/ion-menu-button.js.map +1 -0
- package/dist/native/components/ion-segment.d.ts +6 -1
- package/dist/native/components/ion-segment.d.ts.map +1 -1
- package/dist/native/components/ion-segment.js +29 -23
- package/dist/native/components/ion-segment.js.map +1 -0
- package/dist/native/components/ion-tab-bar.d.ts +6 -1
- package/dist/native/components/ion-tab-bar.d.ts.map +1 -1
- package/dist/native/components/ion-tab-bar.js +49 -40
- package/dist/native/components/ion-tab-bar.js.map +1 -0
- package/dist/native/components/searchable-tabs.d.ts +17 -15
- package/dist/native/components/searchable-tabs.d.ts.map +1 -1
- package/dist/native/components/searchable-tabs.js +382 -434
- package/dist/native/components/searchable-tabs.js.map +1 -0
- package/dist/native/definitions.d.ts +118 -111
- package/dist/native/definitions.d.ts.map +1 -1
- package/dist/native/definitions.js +0 -1
- 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 +14 -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/index.d.ts +6 -3
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js +228 -204
- package/dist/native/index.js.map +1 -0
- package/dist/native/prehide.d.ts +4 -2
- package/dist/native/prehide.d.ts.map +1 -1
- package/dist/native/prehide.js +220 -242
- package/dist/native/prehide.js.map +1 -0
- package/dist/native/runtime.d.ts +3 -1
- package/dist/native/runtime.d.ts.map +1 -1
- package/dist/native/runtime.js +626 -730
- package/dist/native/runtime.js.map +1 -0
- package/dist/native/shared/candidate.d.ts +16 -11
- package/dist/native/shared/candidate.d.ts.map +1 -1
- package/dist/native/shared/candidate.js +96 -95
- package/dist/native/shared/candidate.js.map +1 -0
- package/dist/native/shared/crossfade.d.ts +6 -4
- package/dist/native/shared/crossfade.d.ts.map +1 -1
- package/dist/native/shared/crossfade.js +49 -45
- package/dist/native/shared/crossfade.js.map +1 -0
- package/dist/native/shared/dom.d.ts +7 -5
- package/dist/native/shared/dom.d.ts.map +1 -1
- package/dist/native/shared/dom.js +163 -211
- package/dist/native/shared/dom.js.map +1 -0
- package/dist/native/shared/events.d.ts +8 -6
- package/dist/native/shared/events.d.ts.map +1 -1
- package/dist/native/shared/events.js +12 -7
- package/dist/native/shared/events.js.map +1 -0
- package/dist/native/shared/icons.d.ts +4 -2
- package/dist/native/shared/icons.d.ts.map +1 -1
- package/dist/native/shared/icons.js +59 -53
- package/dist/native/shared/icons.js.map +1 -0
- package/dist/native/shared/modal.d.ts +3 -1
- package/dist/native/shared/modal.d.ts.map +1 -1
- package/dist/native/shared/modal.js +156 -139
- package/dist/native/shared/modal.js.map +1 -0
- package/dist/native/vertical-bars-web.d.ts +3 -1
- package/dist/native/vertical-bars-web.d.ts.map +1 -1
- package/dist/native/vertical-bars-web.js +332 -346
- package/dist/native/vertical-bars-web.js.map +1 -0
- package/dist/native-integration/index.d.ts +10 -8
- package/dist/native-integration/index.d.ts.map +1 -1
- package/dist/native-integration/index.js +102 -100
- package/dist/native-integration/index.js.map +1 -0
- package/dist/native-integration/transition.d.ts +3 -1
- package/dist/native-integration/transition.d.ts.map +1 -1
- package/dist/native-integration/transition.js +15 -6
- package/dist/native-integration/transition.js.map +1 -0
- package/dist/searchbar/index.d.ts +4 -2
- package/dist/searchbar/index.d.ts.map +1 -1
- package/dist/searchbar/index.js +64 -56
- package/dist/searchbar/index.js.map +1 -0
- package/dist/segment/index.d.ts +3 -1
- package/dist/segment/index.d.ts.map +1 -1
- package/dist/segment/index.js +465 -324
- package/dist/segment/index.js.map +1 -0
- package/dist/sheets-of-glass/animations.d.ts +13 -12
- package/dist/sheets-of-glass/animations.d.ts.map +1 -1
- package/dist/sheets-of-glass/animations.js +496 -306
- package/dist/sheets-of-glass/animations.js.map +1 -0
- package/dist/sheets-of-glass/index.d.ts +3 -1
- package/dist/sheets-of-glass/index.d.ts.map +1 -1
- package/dist/sheets-of-glass/index.js +294 -357
- package/dist/sheets-of-glass/index.js.map +1 -0
- package/dist/sheets-of-glass/interfaces.d.ts +11 -9
- package/dist/sheets-of-glass/interfaces.d.ts.map +1 -1
- package/dist/sheets-of-glass/interfaces.js +0 -1
- package/dist/tab-bar-searchable/animations/enter.d.ts +4 -2
- package/dist/tab-bar-searchable/animations/enter.d.ts.map +1 -1
- package/dist/tab-bar-searchable/animations/enter.js +50 -69
- package/dist/tab-bar-searchable/animations/enter.js.map +1 -0
- package/dist/tab-bar-searchable/animations/leave.d.ts +4 -2
- package/dist/tab-bar-searchable/animations/leave.d.ts.map +1 -1
- package/dist/tab-bar-searchable/animations/leave.js +48 -62
- package/dist/tab-bar-searchable/animations/leave.js.map +1 -0
- package/dist/tab-bar-searchable/index.d.ts +5 -3
- package/dist/tab-bar-searchable/index.d.ts.map +1 -1
- package/dist/tab-bar-searchable/index.js +123 -135
- package/dist/tab-bar-searchable/index.js.map +1 -0
- package/dist/transition/index.d.ts +9 -8
- package/dist/transition/index.d.ts.map +1 -1
- package/dist/transition/index.js +203 -192
- package/dist/transition/index.js.map +1 -0
- package/dist/transition/ios.transition.d.ts +7 -5
- package/dist/transition/ios.transition.d.ts.map +1 -1
- package/dist/transition/ios.transition.js +15 -11
- package/dist/transition/ios.transition.js.map +1 -0
- package/dist/utils.d.ts +10 -8
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +58 -66
- package/dist/utils.js.map +1 -0
- package/dist/vertical-bars.d.ts +5 -4
- package/dist/vertical-bars.js +4 -2
- package/docs/iphone-duo-with-original-theme.md +18 -29
- package/docs/iphone-duo.md +44 -204
- package/docs/native-ui-shell.md +10 -8
- package/docs/special-markup.md +2 -0
- package/docs/vertical-bars.md +283 -0
- package/ios/Sources/IonicNativeUIShellPlugin/Components/ShellVerticalBars.swift +34 -14
- package/ios/Sources/IonicNativeUIShellPlugin/Shared/ShellSnapshot.swift +2 -0
- package/ios/Tests/IonicNativeUIShellPluginTests/ShellSnapshotTests.swift +3 -0
- package/package.json +9 -6
- package/src/native/components/index.ts +3 -2
- package/src/native/components/ion-button.ts +3 -2
- package/src/native/components/ion-buttons.ts +4 -3
- package/src/native/components/ion-menu-button.ts +3 -2
- package/src/native/definitions.ts +22 -1
- package/src/native/foldable/fold-state.ts +9 -0
- package/src/native/foldable/types.ts +4 -0
- package/src/native/index.ts +17 -3
- package/src/native/prehide.ts +3 -1
- package/src/native/runtime.ts +2 -2
- package/src/native/shared/candidate.ts +39 -10
- package/src/native/shared/dom.ts +4 -4
- package/src/styles/vertical-bars.scss +4 -2
- package/src/vertical-bars.ts +9 -1
- package/dist/vertical-bars.d.ts.map +0 -1
package/dist/transition/index.js
CHANGED
|
@@ -1,219 +1,230 @@
|
|
|
1
|
-
import { config } from
|
|
2
|
-
import {
|
|
3
|
-
import { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const iosTransitionAnimation = () => import(
|
|
1
|
+
import { config, raf } from "../utils.js";
|
|
2
|
+
import { createFocusController } from "../focus-controller/index.js";
|
|
3
|
+
import { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from "@ionic/core";
|
|
4
|
+
import { Build, writeTask } from "@stencil/core";
|
|
5
|
+
//#region src/transition/index.ts
|
|
6
|
+
const iosTransitionAnimation = () => import("./ios.transition.js");
|
|
7
7
|
const focusController = createFocusController();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Executes the main page transition.
|
|
10
|
+
* It also manages the lifecycle of header visibility (if any)
|
|
11
|
+
* to prevent visual flickering in iOS. The flickering only
|
|
12
|
+
* occurs for a condensed header that is placed above the content.
|
|
13
|
+
*
|
|
14
|
+
* @param opts Options for the transition.
|
|
15
|
+
* @returns A promise that resolves when the transition is complete.
|
|
16
|
+
*/
|
|
17
|
+
const transition = (opts) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
writeTask(() => {
|
|
20
|
+
const transitioningInactiveHeader = getIosIonHeader(opts);
|
|
21
|
+
beforeTransition(opts, transitioningInactiveHeader);
|
|
22
|
+
runTransition(opts).then((result) => {
|
|
23
|
+
if (result.animation) result.animation.destroy();
|
|
24
|
+
afterTransition(opts);
|
|
25
|
+
resolve(result);
|
|
26
|
+
}, (error) => {
|
|
27
|
+
afterTransition(opts);
|
|
28
|
+
reject(error);
|
|
29
|
+
}).finally(() => {
|
|
30
|
+
setHeaderTransitionClass(transitioningInactiveHeader, false);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
29
34
|
};
|
|
30
35
|
const beforeTransition = (opts, transitioningInactiveHeader) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
const enteringEl = opts.enteringEl;
|
|
37
|
+
const leavingEl = opts.leavingEl;
|
|
38
|
+
focusController.saveViewFocus(leavingEl);
|
|
39
|
+
setZIndex(enteringEl, leavingEl, opts.direction);
|
|
40
|
+
setHeaderTransitionClass(transitioningInactiveHeader, true);
|
|
41
|
+
if (opts.showGoBack) enteringEl.classList.add("can-go-back");
|
|
42
|
+
else enteringEl.classList.remove("can-go-back");
|
|
43
|
+
setPageHidden(enteringEl, false);
|
|
44
|
+
/**
|
|
45
|
+
* When transitioning, the page should not
|
|
46
|
+
* respond to click events. This resolves small
|
|
47
|
+
* issues like users double tapping the ion-back-button.
|
|
48
|
+
* These pointer events are removed in `afterTransition`.
|
|
49
|
+
*/
|
|
50
|
+
enteringEl.style.setProperty("pointer-events", "none");
|
|
51
|
+
if (leavingEl) {
|
|
52
|
+
setPageHidden(leavingEl, false);
|
|
53
|
+
leavingEl.style.setProperty("pointer-events", "none");
|
|
54
|
+
}
|
|
48
55
|
};
|
|
49
56
|
const runTransition = async (opts) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return ani;
|
|
57
|
+
const animationBuilder = await getAnimationBuilder(opts);
|
|
58
|
+
return animationBuilder && Build.isBrowser ? animation(animationBuilder, opts) : noAnimation(opts);
|
|
53
59
|
};
|
|
54
60
|
const afterTransition = (opts) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const enteringEl = opts.enteringEl;
|
|
62
|
+
const leavingEl = opts.leavingEl;
|
|
63
|
+
enteringEl.classList.remove("ion-page-invisible");
|
|
64
|
+
enteringEl.style.removeProperty("pointer-events");
|
|
65
|
+
if (leavingEl !== void 0) {
|
|
66
|
+
leavingEl.classList.remove("ion-page-invisible");
|
|
67
|
+
leavingEl.style.removeProperty("pointer-events");
|
|
68
|
+
}
|
|
69
|
+
focusController.setViewFocus(enteringEl);
|
|
64
70
|
};
|
|
65
71
|
const getAnimationBuilder = async (opts) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (opts.animationBuilder) {
|
|
70
|
-
return opts.animationBuilder;
|
|
71
|
-
}
|
|
72
|
-
const getAnimation = (await iosTransitionAnimation()).iosTransitionAnimation;
|
|
73
|
-
return getAnimation;
|
|
72
|
+
if (!opts.leavingEl || !opts.animated || opts.duration === 0) return;
|
|
73
|
+
if (opts.animationBuilder) return opts.animationBuilder;
|
|
74
|
+
return (await iosTransitionAnimation()).iosTransitionAnimation;
|
|
74
75
|
};
|
|
75
76
|
const animation = async (animationBuilder, opts) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
hasCompleted: didComplete,
|
|
88
|
-
animation: trans,
|
|
89
|
-
};
|
|
77
|
+
await waitForReady(opts, true);
|
|
78
|
+
const trans = animationBuilder(opts.baseEl, opts);
|
|
79
|
+
fireWillEvents(opts.enteringEl, opts.leavingEl);
|
|
80
|
+
const didComplete = await playTransition(trans, opts);
|
|
81
|
+
if (opts.progressCallback) opts.progressCallback(void 0);
|
|
82
|
+
if (didComplete) fireDidEvents(opts.enteringEl, opts.leavingEl);
|
|
83
|
+
return {
|
|
84
|
+
hasCompleted: didComplete,
|
|
85
|
+
animation: trans
|
|
86
|
+
};
|
|
90
87
|
};
|
|
91
88
|
const noAnimation = async (opts) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
const enteringEl = opts.enteringEl;
|
|
90
|
+
const leavingEl = opts.leavingEl;
|
|
91
|
+
const focusManagerEnabled = config.get("focusManagerPriority", false);
|
|
92
|
+
/**
|
|
93
|
+
* If the focus manager is enabled then we need to wait for Ionic components to be
|
|
94
|
+
* rendered otherwise the component to focus may not be focused because it is hidden.
|
|
95
|
+
*/
|
|
96
|
+
await waitForReady(opts, focusManagerEnabled);
|
|
97
|
+
fireWillEvents(enteringEl, leavingEl);
|
|
98
|
+
fireDidEvents(enteringEl, leavingEl);
|
|
99
|
+
return { hasCompleted: true };
|
|
101
100
|
};
|
|
102
101
|
const waitForReady = async (opts, defaultDeep) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);
|
|
106
|
-
}
|
|
107
|
-
await notifyViewReady(opts.viewIsReady, opts.enteringEl);
|
|
102
|
+
if (opts.deepWait !== void 0 ? opts.deepWait : defaultDeep) await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);
|
|
103
|
+
await notifyViewReady(opts.viewIsReady, opts.enteringEl);
|
|
108
104
|
};
|
|
109
105
|
const notifyViewReady = async (viewIsReady, enteringEl) => {
|
|
110
|
-
|
|
111
|
-
await viewIsReady(enteringEl);
|
|
112
|
-
}
|
|
106
|
+
if (viewIsReady) await viewIsReady(enteringEl);
|
|
113
107
|
};
|
|
114
108
|
const playTransition = (trans, opts) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
trans.play();
|
|
125
|
-
}
|
|
126
|
-
return promise;
|
|
109
|
+
const progressCallback = opts.progressCallback;
|
|
110
|
+
const promise = new Promise((resolve) => {
|
|
111
|
+
trans.onFinish((currentStep) => resolve(currentStep === 1));
|
|
112
|
+
});
|
|
113
|
+
if (progressCallback) {
|
|
114
|
+
trans.progressStart(true);
|
|
115
|
+
progressCallback(trans);
|
|
116
|
+
} else trans.play();
|
|
117
|
+
return promise;
|
|
127
118
|
};
|
|
128
119
|
const fireWillEvents = (enteringEl, leavingEl) => {
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
lifecycle(leavingEl, LIFECYCLE_WILL_LEAVE);
|
|
121
|
+
lifecycle(enteringEl, LIFECYCLE_WILL_ENTER);
|
|
131
122
|
};
|
|
132
123
|
const fireDidEvents = (enteringEl, leavingEl) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
124
|
+
lifecycle(enteringEl, LIFECYCLE_DID_ENTER);
|
|
125
|
+
lifecycle(leavingEl, LIFECYCLE_DID_LEAVE);
|
|
126
|
+
};
|
|
127
|
+
const lifecycle = (el, eventName) => {
|
|
128
|
+
if (el) {
|
|
129
|
+
const ev = new CustomEvent(eventName, {
|
|
130
|
+
bubbles: false,
|
|
131
|
+
cancelable: false
|
|
132
|
+
});
|
|
133
|
+
el.dispatchEvent(ev);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Wait two request animation frame loops.
|
|
138
|
+
* This allows the framework implementations enough time to mount
|
|
139
|
+
* the user-defined contents. This is often needed when using inline
|
|
140
|
+
* modals and popovers that accept user components. For popover,
|
|
141
|
+
* the contents must be mounted for the popover to be sized correctly.
|
|
142
|
+
* For modals, the contents must be mounted for iOS to run the
|
|
143
|
+
* transition correctly.
|
|
144
|
+
*
|
|
145
|
+
* On Angular and React, a single raf is enough time, but for Vue
|
|
146
|
+
* we need to wait two rafs. As a result we are using two rafs for
|
|
147
|
+
* all frameworks to ensure contents are mounted.
|
|
148
|
+
*/
|
|
149
|
+
const waitForMount = () => {
|
|
150
|
+
return new Promise((resolve) => raf(() => raf(() => resolve())));
|
|
151
|
+
};
|
|
152
|
+
const deepReady = async (el) => {
|
|
153
|
+
const element = el;
|
|
154
|
+
if (element) {
|
|
155
|
+
if (element.componentOnReady != null) {
|
|
156
|
+
if (await element.componentOnReady() != null) return;
|
|
157
|
+
} else if (element.__registerHost != null) {
|
|
158
|
+
await new Promise((resolve) => raf(resolve));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
await Promise.all(Array.from(element.children).map((child) => deepReady(child)));
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const setPageHidden = (el, hidden) => {
|
|
165
|
+
if (hidden) {
|
|
166
|
+
el.setAttribute("aria-hidden", "true");
|
|
167
|
+
el.classList.add("ion-page-hidden");
|
|
168
|
+
} else {
|
|
169
|
+
el.hidden = false;
|
|
170
|
+
el.removeAttribute("aria-hidden");
|
|
171
|
+
el.classList.remove("ion-page-hidden");
|
|
172
|
+
}
|
|
175
173
|
};
|
|
176
174
|
const setZIndex = (enteringEl, leavingEl, direction) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
if (enteringEl !== void 0) enteringEl.style.zIndex = direction === "back" ? "99" : "101";
|
|
176
|
+
if (leavingEl !== void 0) leavingEl.style.zIndex = "100";
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Add a class to ensure that the header (if any)
|
|
180
|
+
* does not flicker during the transition. By adding the
|
|
181
|
+
* transitioning class, we ensure that the header has
|
|
182
|
+
* the necessary styles to prevent the following flickers:
|
|
183
|
+
* 1. When entering a page with a condensed header, the
|
|
184
|
+
* header should never be visible. However,
|
|
185
|
+
* it briefly renders the background color while
|
|
186
|
+
* the transition is occurring.
|
|
187
|
+
* 2. When leaving a page with a condensed header, the
|
|
188
|
+
* header has an opacity of 0 and the pages
|
|
189
|
+
* have a z-index which causes the entering page to
|
|
190
|
+
* briefly show it's content underneath the leaving page.
|
|
191
|
+
* 3. When entering a page or leaving a page with a fade
|
|
192
|
+
* header, the header should not have a background color.
|
|
193
|
+
* However, it briefly shows the background color while
|
|
194
|
+
* the transition is occurring.
|
|
195
|
+
*
|
|
196
|
+
* @param header The header element to modify.
|
|
197
|
+
* @param isTransitioning Whether the transition is occurring.
|
|
198
|
+
*/
|
|
184
199
|
const setHeaderTransitionClass = (header, isTransitioning) => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
return element;
|
|
205
|
-
};
|
|
200
|
+
if (!header) return;
|
|
201
|
+
const transitionClass = "header-transitioning";
|
|
202
|
+
if (isTransitioning) header.classList.add(transitionClass);
|
|
203
|
+
else header.classList.remove(transitionClass);
|
|
204
|
+
};
|
|
205
|
+
const getIonPageElement = (element) => {
|
|
206
|
+
if (element.classList.contains("ion-page")) return element;
|
|
207
|
+
const ionPage = element.querySelector(":scope > .ion-page, :scope > ion-nav, :scope > ion-tabs");
|
|
208
|
+
if (ionPage) return ionPage;
|
|
209
|
+
return element;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Retrieves the ion-header element from a page based on the
|
|
213
|
+
* direction of the transition.
|
|
214
|
+
*
|
|
215
|
+
* @param opts Options for the transition.
|
|
216
|
+
* @returns The ion-header element or null if not found or not in 'ios' mode.
|
|
217
|
+
*/
|
|
206
218
|
const getIosIonHeader = (opts) => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
219
|
+
const enteringEl = opts.enteringEl;
|
|
220
|
+
const leavingEl = opts.leavingEl;
|
|
221
|
+
const direction = opts.direction;
|
|
222
|
+
if (opts.mode !== "ios") return null;
|
|
223
|
+
const element = direction === "back" ? leavingEl : enteringEl;
|
|
224
|
+
if (!element) return null;
|
|
225
|
+
return element.querySelector("ion-header");
|
|
226
|
+
};
|
|
227
|
+
//#endregion
|
|
228
|
+
export { deepReady, getIonPageElement, lifecycle, setPageHidden, transition, waitForMount };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/transition/index.ts"],"sourcesContent":["import { config } from '../utils';\nimport { Build, writeTask } from '@stencil/core';\n\nimport { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from '@ionic/core';\nimport type { NavOptions, NavDirection } from '@ionic/core';\nimport type { Animation, AnimationBuilder } from '@ionic/core';\nimport { createFocusController } from '../focus-controller';\nimport { raf } from '../utils';\n\nconst iosTransitionAnimation = () => import('./ios.transition');\n// const mdTransitionAnimation = () => import('./md.transition');\nconst focusController = createFocusController();\n\n// TODO(FW-2832): types\n\n/**\n * Executes the main page transition.\n * It also manages the lifecycle of header visibility (if any)\n * to prevent visual flickering in iOS. The flickering only\n * occurs for a condensed header that is placed above the content.\n *\n * @param opts Options for the transition.\n * @returns A promise that resolves when the transition is complete.\n */\nexport const transition = (opts: TransitionOptions): Promise<TransitionResult> => {\n return new Promise((resolve, reject) => {\n writeTask(() => {\n const transitioningInactiveHeader = getIosIonHeader(opts);\n beforeTransition(opts, transitioningInactiveHeader);\n runTransition(opts)\n .then(\n (result) => {\n if (result.animation) {\n result.animation.destroy();\n }\n afterTransition(opts);\n resolve(result);\n },\n (error) => {\n afterTransition(opts);\n reject(error);\n },\n )\n .finally(() => {\n // Ensure that the header is restored to its original state.\n setHeaderTransitionClass(transitioningInactiveHeader, false);\n });\n });\n });\n};\n\nconst beforeTransition = (opts: TransitionOptions, transitioningInactiveHeader: HTMLElement | null) => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n\n focusController.saveViewFocus(leavingEl);\n\n setZIndex(enteringEl, leavingEl, opts.direction);\n // Prevent flickering of the header by adding a class.\n setHeaderTransitionClass(transitioningInactiveHeader, true);\n\n if (opts.showGoBack) {\n enteringEl.classList.add('can-go-back');\n } else {\n enteringEl.classList.remove('can-go-back');\n }\n setPageHidden(enteringEl, false);\n\n /**\n * When transitioning, the page should not\n * respond to click events. This resolves small\n * issues like users double tapping the ion-back-button.\n * These pointer events are removed in `afterTransition`.\n */\n enteringEl.style.setProperty('pointer-events', 'none');\n\n if (leavingEl) {\n setPageHidden(leavingEl, false);\n leavingEl.style.setProperty('pointer-events', 'none');\n }\n};\n\nconst runTransition = async (opts: TransitionOptions): Promise<TransitionResult> => {\n const animationBuilder = await getAnimationBuilder(opts);\n\n const ani = animationBuilder && Build.isBrowser ? animation(animationBuilder, opts) : noAnimation(opts); // fast path for no animation\n\n return ani;\n};\n\nconst afterTransition = (opts: TransitionOptions) => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n enteringEl.classList.remove('ion-page-invisible');\n enteringEl.style.removeProperty('pointer-events');\n if (leavingEl !== undefined) {\n leavingEl.classList.remove('ion-page-invisible');\n leavingEl.style.removeProperty('pointer-events');\n }\n\n focusController.setViewFocus(enteringEl);\n};\n\nconst getAnimationBuilder = async (opts: TransitionOptions): Promise<AnimationBuilder | undefined> => {\n if (!opts.leavingEl || !opts.animated || opts.duration === 0) {\n return undefined;\n }\n\n if (opts.animationBuilder) {\n return opts.animationBuilder;\n }\n\n const getAnimation =\n // opts.mode === 'ios'\n (await iosTransitionAnimation()).iosTransitionAnimation;\n // : (await mdTransitionAnimation()).mdTransitionAnimation;\n\n return getAnimation;\n};\n\nconst animation = async (animationBuilder: AnimationBuilder, opts: TransitionOptions): Promise<TransitionResult> => {\n await waitForReady(opts, true);\n\n const trans = animationBuilder(opts.baseEl, opts);\n\n fireWillEvents(opts.enteringEl, opts.leavingEl);\n\n const didComplete = await playTransition(trans, opts);\n\n if (opts.progressCallback) {\n opts.progressCallback(undefined);\n }\n\n if (didComplete) {\n fireDidEvents(opts.enteringEl, opts.leavingEl);\n }\n\n return {\n hasCompleted: didComplete,\n animation: trans,\n };\n};\n\nconst noAnimation = async (opts: TransitionOptions): Promise<TransitionResult> => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n const focusManagerEnabled = config.get('focusManagerPriority', false);\n\n /**\n * If the focus manager is enabled then we need to wait for Ionic components to be\n * rendered otherwise the component to focus may not be focused because it is hidden.\n */\n await waitForReady(opts, focusManagerEnabled);\n\n fireWillEvents(enteringEl, leavingEl);\n fireDidEvents(enteringEl, leavingEl);\n\n return {\n hasCompleted: true,\n };\n};\n\nconst waitForReady = async (opts: TransitionOptions, defaultDeep: boolean) => {\n const deep = opts.deepWait !== undefined ? opts.deepWait : defaultDeep;\n\n if (deep) {\n await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);\n }\n\n await notifyViewReady(opts.viewIsReady, opts.enteringEl);\n};\n\nconst notifyViewReady = async (viewIsReady: undefined | ((enteringEl: HTMLElement) => Promise<unknown>), enteringEl: HTMLElement) => {\n if (viewIsReady) {\n await viewIsReady(enteringEl);\n }\n};\n\nconst playTransition = (trans: Animation, opts: TransitionOptions): Promise<boolean> => {\n const progressCallback = opts.progressCallback;\n\n const promise = new Promise<boolean>((resolve) => {\n trans.onFinish((currentStep) => resolve(currentStep === 1));\n });\n\n // cool, let's do this, start the transition\n if (progressCallback) {\n // this is a swipe to go back, just get the transition progress ready\n // kick off the swipe animation start\n trans.progressStart(true);\n progressCallback(trans);\n } else {\n // only the top level transition should actually start \"play\"\n // kick it off and let it play through\n // ******** DOM WRITE ****************\n trans.play();\n }\n // create a callback for when the animation is done\n return promise;\n};\n\nconst fireWillEvents = (enteringEl: HTMLElement | undefined, leavingEl: HTMLElement | undefined) => {\n lifecycle(leavingEl, LIFECYCLE_WILL_LEAVE);\n lifecycle(enteringEl, LIFECYCLE_WILL_ENTER);\n};\n\nconst fireDidEvents = (enteringEl: HTMLElement | undefined, leavingEl: HTMLElement | undefined) => {\n lifecycle(enteringEl, LIFECYCLE_DID_ENTER);\n lifecycle(leavingEl, LIFECYCLE_DID_LEAVE);\n};\n\nexport const lifecycle = (el: HTMLElement | undefined, eventName: string) => {\n if (el) {\n const ev = new CustomEvent(eventName, {\n bubbles: false,\n cancelable: false,\n });\n el.dispatchEvent(ev);\n }\n};\n\n/**\n * Wait two request animation frame loops.\n * This allows the framework implementations enough time to mount\n * the user-defined contents. This is often needed when using inline\n * modals and popovers that accept user components. For popover,\n * the contents must be mounted for the popover to be sized correctly.\n * For modals, the contents must be mounted for iOS to run the\n * transition correctly.\n *\n * On Angular and React, a single raf is enough time, but for Vue\n * we need to wait two rafs. As a result we are using two rafs for\n * all frameworks to ensure contents are mounted.\n */\nexport const waitForMount = (): Promise<void> => {\n return new Promise((resolve) => raf(() => raf(() => resolve())));\n};\n\ntype LazyLoadedElement = Element & {\n componentOnReady?: () => Promise<unknown>;\n __registerHost?: unknown;\n};\n\nexport const deepReady = async (el: Element | undefined): Promise<void> => {\n const element = el as LazyLoadedElement | undefined;\n if (element) {\n if (element.componentOnReady != null) {\n // eslint-disable-next-line custom-rules/no-component-on-ready-method\n const stencilEl = await element.componentOnReady();\n if (stencilEl != null) {\n return;\n }\n\n /**\n * Custom elements in Stencil will have __registerHost.\n */\n } else if (element.__registerHost != null) {\n /**\n * Non-lazy loaded custom elements need to wait\n * one frame for component to be loaded.\n */\n const waitForCustomElement = new Promise((resolve) => raf(resolve));\n await waitForCustomElement;\n\n return;\n }\n await Promise.all(Array.from(element.children).map((child) => deepReady(child)));\n }\n};\n\nexport const setPageHidden = (el: HTMLElement, hidden: boolean) => {\n if (hidden) {\n el.setAttribute('aria-hidden', 'true');\n el.classList.add('ion-page-hidden');\n } else {\n el.hidden = false;\n el.removeAttribute('aria-hidden');\n el.classList.remove('ion-page-hidden');\n }\n};\n\nconst setZIndex = (enteringEl: HTMLElement | undefined, leavingEl: HTMLElement | undefined, direction: NavDirection | undefined) => {\n if (enteringEl !== undefined) {\n enteringEl.style.zIndex = direction === 'back' ? '99' : '101';\n }\n if (leavingEl !== undefined) {\n leavingEl.style.zIndex = '100';\n }\n};\n\n/**\n * Add a class to ensure that the header (if any)\n * does not flicker during the transition. By adding the\n * transitioning class, we ensure that the header has\n * the necessary styles to prevent the following flickers:\n * 1. When entering a page with a condensed header, the\n * header should never be visible. However,\n * it briefly renders the background color while\n * the transition is occurring.\n * 2. When leaving a page with a condensed header, the\n * header has an opacity of 0 and the pages\n * have a z-index which causes the entering page to\n * briefly show it's content underneath the leaving page.\n * 3. When entering a page or leaving a page with a fade\n * header, the header should not have a background color.\n * However, it briefly shows the background color while\n * the transition is occurring.\n *\n * @param header The header element to modify.\n * @param isTransitioning Whether the transition is occurring.\n */\nconst setHeaderTransitionClass = (header: HTMLElement | null, isTransitioning: boolean) => {\n if (!header) {\n return;\n }\n\n const transitionClass = 'header-transitioning';\n if (isTransitioning) {\n header.classList.add(transitionClass);\n } else {\n header.classList.remove(transitionClass);\n }\n};\n\nexport const getIonPageElement = (element: HTMLElement) => {\n if (element.classList.contains('ion-page')) {\n return element;\n }\n\n const ionPage = element.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs');\n if (ionPage) {\n return ionPage;\n }\n // idk, return the original element so at least something animates and we don't have a null pointer\n return element;\n};\n\n/**\n * Retrieves the ion-header element from a page based on the\n * direction of the transition.\n *\n * @param opts Options for the transition.\n * @returns The ion-header element or null if not found or not in 'ios' mode.\n */\nconst getIosIonHeader = (opts: TransitionOptions): HTMLElement | null => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n const direction = opts.direction;\n const mode = opts.mode;\n\n if (mode !== 'ios') {\n return null;\n }\n\n const element = direction === 'back' ? leavingEl : enteringEl;\n\n if (!element) {\n return null;\n }\n\n return element.querySelector('ion-header');\n};\n\nexport interface TransitionOptions extends NavOptions {\n progressCallback?: (ani: Animation | undefined) => void;\n baseEl: HTMLElement;\n enteringEl: HTMLElement;\n leavingEl: HTMLElement | undefined;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L,GAAG,SAAS;EACZ,GAAG,gBAAgB,aAAa;EAChC,GAAG,UAAU,OAAO,iBAAiB;CACvC;AACF;AAEA,MAAM,aAAa,YAAqC,WAAoC,cAAwC;CAClI,IAAI,eAAe,KAAA,GACjB,WAAW,MAAM,SAAS,cAAc,SAAS,OAAO;CAE1D,IAAI,cAAc,KAAA,GAChB,UAAU,MAAM,SAAS;AAE7B;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,4BAA4B,QAA4B,oBAA6B;CACzF,IAAI,CAAC,QACH;CAGF,MAAM,kBAAkB;CACxB,IAAI,iBACF,OAAO,UAAU,IAAI,eAAe;MAEpC,OAAO,UAAU,OAAO,eAAe;AAE3C;AAEA,MAAa,qBAAqB,YAAyB;CACzD,IAAI,QAAQ,UAAU,SAAS,UAAU,GACvC,OAAO;CAGT,MAAM,UAAU,QAAQ,cAAc,yDAAyD;CAC/F,IAAI,SACF,OAAO;CAGT,OAAO;AACT;;;;;;;;AASA,MAAM,mBAAmB,SAAgD;CACvE,MAAM,aAAa,KAAK;CACxB,MAAM,YAAY,KAAK;CACvB,MAAM,YAAY,KAAK;CAGvB,IAFa,KAAK,SAEL,OACX,OAAO;CAGT,MAAM,UAAU,cAAc,SAAS,YAAY;CAEnD,IAAI,CAAC,SACH,OAAO;CAGT,OAAO,QAAQ,cAAc,YAAY;AAC3C"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { TransitionOptions } from "./index.js";
|
|
2
|
+
import { Animation } from "@ionic/core";
|
|
3
|
+
import { shadow } from "@rdlabo/ionic-theme-utils";
|
|
4
|
+
//#region src/transition/ios.transition.d.ts
|
|
5
5
|
export interface IosTransitionConfig {
|
|
6
|
-
|
|
6
|
+
radius: number;
|
|
7
7
|
}
|
|
8
8
|
export declare const setConfig: (config: Partial<IosTransitionConfig>) => void;
|
|
9
9
|
export declare const iosTransitionAnimation: (navEl: HTMLElement, opts: TransitionOptions) => Animation;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { shadow };
|
|
10
12
|
//# sourceMappingURL=ios.transition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.transition.d.ts","
|
|
1
|
+
{"version":3,"file":"ios.transition.d.ts","names":[],"sources":["../../src/transition/ios.transition.ts"],"mappings":";;;;iBAQiB;EACf;;qBAUW,YAAa,QAAQ,QAAQ;qBAI7B,yBAAyB,OAAO,aAAa,MAAM,sBAAsB"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { getIonPageElement } from "./index.js";
|
|
2
|
+
import { withNativeUIShellTransition } from "../native-integration/transition.js";
|
|
3
|
+
import { createIosTransitionAnimation, shadow } from "@rdlabo/ionic-theme-utils";
|
|
4
|
+
//#region src/transition/ios.transition.ts
|
|
5
5
|
const transitionConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
offLeftPercent: 30,
|
|
7
|
+
getIonPageElement,
|
|
8
|
+
shouldAnimateFixedBackButton: (navEl) => !navEl.closest("ion-app.ios-theme-vertical-bars"),
|
|
9
|
+
radius: 0
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const setConfig = (config) => {
|
|
12
|
+
Object.assign(transitionConfig, config);
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
const iosTransitionAnimation = withNativeUIShellTransition(createIosTransitionAnimation(transitionConfig));
|
|
15
|
+
//#endregion
|
|
16
|
+
export { iosTransitionAnimation, setConfig, shadow };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ios.transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ios.transition.js","names":[],"sources":["../../src/transition/ios.transition.ts"],"sourcesContent":["import { createIosTransitionAnimation, shadow } from '@rdlabo/ionic-theme-utils';\nimport type { Animation } from '@ionic/core';\nimport type { TransitionOptions } from './index';\nimport { getIonPageElement } from './index';\nimport { withNativeUIShellTransition } from '../native-integration/transition';\n\nexport { shadow };\n\nexport interface IosTransitionConfig {\n radius: number;\n}\n\nconst transitionConfig = {\n offLeftPercent: 30,\n getIonPageElement,\n shouldAnimateFixedBackButton: (navEl: HTMLElement) => !navEl.closest('ion-app.ios-theme-vertical-bars'),\n radius: 0,\n};\n\nexport const setConfig = (config: Partial<IosTransitionConfig>): void => {\n Object.assign(transitionConfig, config);\n};\n\nexport const iosTransitionAnimation: (navEl: HTMLElement, opts: TransitionOptions) => Animation = withNativeUIShellTransition(\n createIosTransitionAnimation<TransitionOptions>(transitionConfig),\n);\n"],"mappings":";;;;AAYA,MAAM,mBAAmB;CACvB,gBAAgB;CAChB;CACA,+BAA+B,UAAuB,CAAC,MAAM,QAAQ,iCAAiC;CACtG,QAAQ;AACV;AAEA,MAAa,aAAa,WAA+C;CACvE,OAAO,OAAO,kBAAkB,MAAM;AACxC;AAEA,MAAa,yBAAqF,4BAChG,6BAAgD,gBAAgB,CAClE"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { AnimationPosition } from
|
|
2
|
-
import { IonicConfig } from
|
|
1
|
+
import { AnimationPosition } from "./sheets-of-glass/interfaces.js";
|
|
2
|
+
import { IonicConfig } from "@ionic/core";
|
|
3
|
+
//#region src/utils.d.ts
|
|
3
4
|
export declare const getElementRoot: (el: HTMLElement, fallback?: HTMLElement) => HTMLElement | ShadowRoot;
|
|
4
5
|
export declare const raf: (h: FrameRequestCallback) => number;
|
|
5
6
|
export declare const cloneElement: (tagName: string, useCache?: boolean) => HTMLElement;
|
|
6
7
|
export declare const getStep: (targetX: number, animationPosition: AnimationPosition) => number;
|
|
7
8
|
export declare const changeSelectedElement: (targetElement: HTMLElement, selectedElement: HTMLElement, effectTagName: string, selectedClassName: string) => void;
|
|
8
9
|
export declare class Config {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
private m;
|
|
11
|
+
reset(configObj: IonicConfig): void;
|
|
12
|
+
get<T>(key: keyof IonicConfig, fallback?: T): T;
|
|
13
|
+
getBoolean(key: keyof IonicConfig, fallback?: boolean): boolean;
|
|
14
|
+
getNumber(key: keyof IonicConfig, fallback?: number): number;
|
|
15
|
+
set(key: keyof IonicConfig, value: unknown): void;
|
|
15
16
|
}
|
|
16
17
|
export declare const config: Config;
|
|
18
|
+
//#endregion
|
|
17
19
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"mappings":";;;qBAMa,iBAAkB,IAAI,aAAa,WAAU,gBAAgB,cAAA;qBAI7D,MAAO,GAAG;qBAUV,eAAgB,iBAAiB,uBAA2B;qBAgB5D,UAAW,iBAAiB,mBAAmB;qBAU/C,wBACX,eAAe,aACf,iBAAiB,aACjB,uBACA;qBASW;UACH;EAER,MAAM,WAAW;EAIjB,IAAI,GAAG,WAAW,aAAa,WAAW,IAAI;EAK9C,WAAW,WAAW,aAAa;EAWnC,UAAU,WAAW,aAAa;EAKlC,IAAI,WAAW,aAAa;;qBAKjB,QAAM"}
|