@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.
Files changed (175) hide show
  1. package/README.md +15 -2
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/css/ionic-theme-ios27.css +1 -1
  4. package/dist/css/vertical-bars.css +1 -1
  5. package/dist/focus-controller/index.d.ts +4 -2
  6. package/dist/focus-controller/index.d.ts.map +1 -1
  7. package/dist/focus-controller/index.js +100 -57
  8. package/dist/focus-controller/index.js.map +1 -0
  9. package/dist/index.d.ts +10 -8
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +54 -60
  12. package/dist/index.js.map +1 -0
  13. package/dist/native/components/index.d.ts +13 -10
  14. package/dist/native/components/index.d.ts.map +1 -1
  15. package/dist/native/components/index.js +39 -41
  16. package/dist/native/components/index.js.map +1 -0
  17. package/dist/native/components/ion-back-button.d.ts +6 -1
  18. package/dist/native/components/ion-back-button.d.ts.map +1 -1
  19. package/dist/native/components/ion-back-button.js +19 -13
  20. package/dist/native/components/ion-back-button.js.map +1 -0
  21. package/dist/native/components/ion-button.d.ts +8 -2
  22. package/dist/native/components/ion-button.d.ts.map +1 -1
  23. package/dist/native/components/ion-button.js +22 -17
  24. package/dist/native/components/ion-button.js.map +1 -0
  25. package/dist/native/components/ion-buttons.d.ts +8 -2
  26. package/dist/native/components/ion-buttons.d.ts.map +1 -1
  27. package/dist/native/components/ion-buttons.js +29 -33
  28. package/dist/native/components/ion-buttons.js.map +1 -0
  29. package/dist/native/components/ion-fab.d.ts +6 -1
  30. package/dist/native/components/ion-fab.d.ts.map +1 -1
  31. package/dist/native/components/ion-fab.js +131 -151
  32. package/dist/native/components/ion-fab.js.map +1 -0
  33. package/dist/native/components/ion-menu-button.d.ts +8 -2
  34. package/dist/native/components/ion-menu-button.d.ts.map +1 -1
  35. package/dist/native/components/ion-menu-button.js +29 -19
  36. package/dist/native/components/ion-menu-button.js.map +1 -0
  37. package/dist/native/components/ion-segment.d.ts +6 -1
  38. package/dist/native/components/ion-segment.d.ts.map +1 -1
  39. package/dist/native/components/ion-segment.js +29 -23
  40. package/dist/native/components/ion-segment.js.map +1 -0
  41. package/dist/native/components/ion-tab-bar.d.ts +6 -1
  42. package/dist/native/components/ion-tab-bar.d.ts.map +1 -1
  43. package/dist/native/components/ion-tab-bar.js +49 -40
  44. package/dist/native/components/ion-tab-bar.js.map +1 -0
  45. package/dist/native/components/searchable-tabs.d.ts +17 -15
  46. package/dist/native/components/searchable-tabs.d.ts.map +1 -1
  47. package/dist/native/components/searchable-tabs.js +382 -434
  48. package/dist/native/components/searchable-tabs.js.map +1 -0
  49. package/dist/native/definitions.d.ts +118 -111
  50. package/dist/native/definitions.d.ts.map +1 -1
  51. package/dist/native/definitions.js +0 -1
  52. package/dist/native/foldable/fold-state.d.ts +5 -0
  53. package/dist/native/foldable/fold-state.d.ts.map +1 -0
  54. package/dist/native/foldable/fold-state.js +14 -0
  55. package/dist/native/foldable/fold-state.js.map +1 -0
  56. package/dist/native/foldable/types.d.ts +12 -0
  57. package/dist/native/foldable/types.d.ts.map +1 -0
  58. package/dist/native/foldable/types.js +0 -0
  59. package/dist/native/index.d.ts +6 -3
  60. package/dist/native/index.d.ts.map +1 -1
  61. package/dist/native/index.js +228 -204
  62. package/dist/native/index.js.map +1 -0
  63. package/dist/native/prehide.d.ts +4 -2
  64. package/dist/native/prehide.d.ts.map +1 -1
  65. package/dist/native/prehide.js +220 -242
  66. package/dist/native/prehide.js.map +1 -0
  67. package/dist/native/runtime.d.ts +3 -1
  68. package/dist/native/runtime.d.ts.map +1 -1
  69. package/dist/native/runtime.js +626 -730
  70. package/dist/native/runtime.js.map +1 -0
  71. package/dist/native/shared/candidate.d.ts +16 -11
  72. package/dist/native/shared/candidate.d.ts.map +1 -1
  73. package/dist/native/shared/candidate.js +96 -95
  74. package/dist/native/shared/candidate.js.map +1 -0
  75. package/dist/native/shared/crossfade.d.ts +6 -4
  76. package/dist/native/shared/crossfade.d.ts.map +1 -1
  77. package/dist/native/shared/crossfade.js +49 -45
  78. package/dist/native/shared/crossfade.js.map +1 -0
  79. package/dist/native/shared/dom.d.ts +7 -5
  80. package/dist/native/shared/dom.d.ts.map +1 -1
  81. package/dist/native/shared/dom.js +163 -211
  82. package/dist/native/shared/dom.js.map +1 -0
  83. package/dist/native/shared/events.d.ts +8 -6
  84. package/dist/native/shared/events.d.ts.map +1 -1
  85. package/dist/native/shared/events.js +12 -7
  86. package/dist/native/shared/events.js.map +1 -0
  87. package/dist/native/shared/icons.d.ts +4 -2
  88. package/dist/native/shared/icons.d.ts.map +1 -1
  89. package/dist/native/shared/icons.js +59 -53
  90. package/dist/native/shared/icons.js.map +1 -0
  91. package/dist/native/shared/modal.d.ts +3 -1
  92. package/dist/native/shared/modal.d.ts.map +1 -1
  93. package/dist/native/shared/modal.js +156 -139
  94. package/dist/native/shared/modal.js.map +1 -0
  95. package/dist/native/vertical-bars-web.d.ts +3 -1
  96. package/dist/native/vertical-bars-web.d.ts.map +1 -1
  97. package/dist/native/vertical-bars-web.js +332 -346
  98. package/dist/native/vertical-bars-web.js.map +1 -0
  99. package/dist/native-integration/index.d.ts +10 -8
  100. package/dist/native-integration/index.d.ts.map +1 -1
  101. package/dist/native-integration/index.js +102 -100
  102. package/dist/native-integration/index.js.map +1 -0
  103. package/dist/native-integration/transition.d.ts +3 -1
  104. package/dist/native-integration/transition.d.ts.map +1 -1
  105. package/dist/native-integration/transition.js +15 -6
  106. package/dist/native-integration/transition.js.map +1 -0
  107. package/dist/searchbar/index.d.ts +4 -2
  108. package/dist/searchbar/index.d.ts.map +1 -1
  109. package/dist/searchbar/index.js +64 -56
  110. package/dist/searchbar/index.js.map +1 -0
  111. package/dist/segment/index.d.ts +3 -1
  112. package/dist/segment/index.d.ts.map +1 -1
  113. package/dist/segment/index.js +465 -324
  114. package/dist/segment/index.js.map +1 -0
  115. package/dist/sheets-of-glass/animations.d.ts +13 -12
  116. package/dist/sheets-of-glass/animations.d.ts.map +1 -1
  117. package/dist/sheets-of-glass/animations.js +496 -306
  118. package/dist/sheets-of-glass/animations.js.map +1 -0
  119. package/dist/sheets-of-glass/index.d.ts +3 -1
  120. package/dist/sheets-of-glass/index.d.ts.map +1 -1
  121. package/dist/sheets-of-glass/index.js +294 -357
  122. package/dist/sheets-of-glass/index.js.map +1 -0
  123. package/dist/sheets-of-glass/interfaces.d.ts +11 -9
  124. package/dist/sheets-of-glass/interfaces.d.ts.map +1 -1
  125. package/dist/sheets-of-glass/interfaces.js +0 -1
  126. package/dist/tab-bar-searchable/animations/enter.d.ts +4 -2
  127. package/dist/tab-bar-searchable/animations/enter.d.ts.map +1 -1
  128. package/dist/tab-bar-searchable/animations/enter.js +50 -69
  129. package/dist/tab-bar-searchable/animations/enter.js.map +1 -0
  130. package/dist/tab-bar-searchable/animations/leave.d.ts +4 -2
  131. package/dist/tab-bar-searchable/animations/leave.d.ts.map +1 -1
  132. package/dist/tab-bar-searchable/animations/leave.js +48 -62
  133. package/dist/tab-bar-searchable/animations/leave.js.map +1 -0
  134. package/dist/tab-bar-searchable/index.d.ts +5 -3
  135. package/dist/tab-bar-searchable/index.d.ts.map +1 -1
  136. package/dist/tab-bar-searchable/index.js +123 -135
  137. package/dist/tab-bar-searchable/index.js.map +1 -0
  138. package/dist/transition/index.d.ts +9 -8
  139. package/dist/transition/index.d.ts.map +1 -1
  140. package/dist/transition/index.js +203 -192
  141. package/dist/transition/index.js.map +1 -0
  142. package/dist/transition/ios.transition.d.ts +7 -5
  143. package/dist/transition/ios.transition.d.ts.map +1 -1
  144. package/dist/transition/ios.transition.js +15 -11
  145. package/dist/transition/ios.transition.js.map +1 -0
  146. package/dist/utils.d.ts +10 -8
  147. package/dist/utils.d.ts.map +1 -1
  148. package/dist/utils.js +58 -66
  149. package/dist/utils.js.map +1 -0
  150. package/dist/vertical-bars.d.ts +5 -4
  151. package/dist/vertical-bars.js +4 -2
  152. package/docs/iphone-duo-with-original-theme.md +18 -29
  153. package/docs/iphone-duo.md +44 -204
  154. package/docs/native-ui-shell.md +10 -8
  155. package/docs/special-markup.md +2 -0
  156. package/docs/vertical-bars.md +283 -0
  157. package/ios/Sources/IonicNativeUIShellPlugin/Components/ShellVerticalBars.swift +34 -14
  158. package/ios/Sources/IonicNativeUIShellPlugin/Shared/ShellSnapshot.swift +2 -0
  159. package/ios/Tests/IonicNativeUIShellPluginTests/ShellSnapshotTests.swift +3 -0
  160. package/package.json +9 -6
  161. package/src/native/components/index.ts +3 -2
  162. package/src/native/components/ion-button.ts +3 -2
  163. package/src/native/components/ion-buttons.ts +4 -3
  164. package/src/native/components/ion-menu-button.ts +3 -2
  165. package/src/native/definitions.ts +22 -1
  166. package/src/native/foldable/fold-state.ts +9 -0
  167. package/src/native/foldable/types.ts +4 -0
  168. package/src/native/index.ts +17 -3
  169. package/src/native/prehide.ts +3 -1
  170. package/src/native/runtime.ts +2 -2
  171. package/src/native/shared/candidate.ts +39 -10
  172. package/src/native/shared/dom.ts +4 -4
  173. package/src/styles/vertical-bars.scss +4 -2
  174. package/src/vertical-bars.ts +9 -1
  175. package/dist/vertical-bars.d.ts.map +0 -1
@@ -1,140 +1,128 @@
1
- import { createAnimation } from '@ionic/core';
2
- import { ANIMATION_DELAY_BASE, ANIMATION_DURATION, ANIMATION_EASING, getElementReferences, getElementSizes, throwErrorByFailedClickElement, TabBarSearchableType, } from '@rdlabo/ionic-theme-utils';
3
- import { isNativeUIShell, registerNativeSearch, requestNativeSearch, suspendNativeUIShell } from '../native-integration';
4
- import { createCloseButtonsAnimation, createEffectAnimation, createFabButtonAnimation, createSearchContainerAnimation, createTabBarAnimation, } from './animations/enter';
5
- import { createReverseCloseButtonsAnimation, createReverseEffectAnimation, createReverseFabButtonAnimation, createReverseSearchContainerAnimation, createReverseTabBarAnimation, } from './animations/leave';
6
- export { TabBarSearchableType, } from '@rdlabo/ionic-theme-utils';
7
- export const attachTabBarSearchable = (ionTabBar, ionFabButton, ionFooter) => {
8
- if (!ionTabBar || !ionFabButton || !ionFooter) {
9
- throw new Error('TabBarSearchable should be defined with props');
10
- }
11
- ionFooter.style.pointerEvents = 'none';
12
- ionFooter.style.opacity = '0';
13
- ionFooter.querySelector('ion-buttons[slot=start]')?.classList.add('ios-theme-horizontal-only');
14
- const nativeSearch = registerNativeSearch(ionTabBar, ionFabButton, ionFooter);
15
- let searchableEventCache;
16
- let resumeNative;
17
- let nativeEntry = false;
18
- let nativeRequest = 0;
19
- let verticalSearch = false;
20
- let tabVisibilityObserver;
21
- return async (event, type) => {
22
- const selector = type === TabBarSearchableType.Enter ? 'ion-fab-button' : 'ion-buttons[slot=start] ion-button';
23
- if (!event.target?.closest(selector))
24
- throw throwErrorByFailedClickElement(selector);
25
- if (type === TabBarSearchableType.Leave && !nativeEntry && !searchableEventCache)
26
- throw new Error('TabBarSearchableType.Leave should be run after TabBarSearchableType.Enter');
27
- const hadNativeEntry = nativeEntry;
28
- const request = ++nativeRequest;
29
- if (type === TabBarSearchableType.Enter)
30
- nativeEntry || (nativeEntry = isNativeUIShell(ionFooter));
31
- const accepted = await requestNativeSearch(nativeSearch, type === TabBarSearchableType.Enter);
32
- if (request !== nativeRequest)
33
- return;
34
- if (accepted) {
35
- nativeEntry = type === TabBarSearchableType.Enter;
36
- return;
37
- }
38
- nativeEntry = false;
39
- if (type === TabBarSearchableType.Leave && hadNativeEntry) {
40
- return;
41
- }
42
- if (type === TabBarSearchableType.Enter) {
43
- verticalSearch = !!ionTabBar.closest('ion-app.ios-theme-vertical-bars');
44
- if (verticalSearch) {
45
- const keepTabsVisible = () => {
46
- if (ionTabBar.classList.contains('tab-bar-hidden') && ionTabBar.closest('ion-app.ios-theme-vertical-bars')) {
47
- ionTabBar.classList.remove('tab-bar-hidden');
48
- }
49
- };
50
- tabVisibilityObserver?.disconnect();
51
- tabVisibilityObserver = new MutationObserver(keepTabsVisible);
52
- tabVisibilityObserver.observe(ionTabBar, { attributes: true, attributeFilter: ['class'] });
53
- keepTabsVisible();
54
- }
55
- resumeNative ?? (resumeNative = await suspendNativeUIShell([
56
- ...(verticalSearch ? [] : [ionTabBar]),
57
- ionFooter,
58
- ionFabButton.closest('ion-fab') ?? ionFabButton,
59
- ]));
60
- try {
61
- searchableEventCache = await enterEvent(event, ionTabBar, ionFabButton, ionFooter, verticalSearch);
62
- }
63
- catch (error) {
64
- tabVisibilityObserver?.disconnect();
65
- resumeNative();
66
- resumeNative = undefined;
67
- throw error;
68
- }
69
- }
70
- else if (searchableEventCache !== undefined) {
71
- try {
72
- await leaveEvent(event, searchableEventCache, ionTabBar, ionFabButton, ionFooter, verticalSearch);
73
- searchableEventCache = undefined;
74
- }
75
- finally {
76
- tabVisibilityObserver?.disconnect();
77
- resumeNative?.();
78
- resumeNative = undefined;
79
- }
80
- }
81
- else {
82
- throw new Error('TabBarSearchableType.Leave should be run after TabBarSearchableType.Enter');
83
- }
84
- };
1
+ import { isNativeUIShell, registerNativeSearch, requestNativeSearch, suspendNativeUIShell } from "../native-integration/index.js";
2
+ import { createCloseButtonsAnimation, createEffectAnimation, createFabButtonAnimation, createSearchContainerAnimation, createTabBarAnimation } from "./animations/enter.js";
3
+ import { createReverseCloseButtonsAnimation, createReverseEffectAnimation, createReverseFabButtonAnimation, createReverseSearchContainerAnimation, createReverseTabBarAnimation } from "./animations/leave.js";
4
+ import { createAnimation } from "@ionic/core";
5
+ import { ANIMATION_DELAY_BASE, ANIMATION_DURATION, ANIMATION_EASING, TabBarSearchableType, TabBarSearchableType as TabBarSearchableType$1, getElementReferences, getElementSizes, throwErrorByFailedClickElement } from "@rdlabo/ionic-theme-utils";
6
+ //#region src/tab-bar-searchable/index.ts
7
+ /**
8
+ * <ion-fab vertical="bottom" horizontal="end" slot="fixed">
9
+ * <ion-fab-button (click)="present($event)">
10
+ * <ion-icon name="search"></ion-icon>
11
+ * </ion-fab-button>
12
+ * </ion-fab>
13
+ * <ion-footer [translucent]="true">
14
+ * <ion-toolbar>
15
+ * <ion-buttons slot="start">
16
+ * <!-- ion-icon does not need `name` attribute. -->
17
+ * <ion-button fill="default"><ion-icon slot="icon-only"></ion-icon>
18
+ * </ion-button>
19
+ * </ion-buttons>
20
+ * <!-- User set `ionChange` or other events. -->
21
+ * <ion-searchbar aria-label="Search" (ionChange)="example($event)"></ion-searchbar>
22
+ * </ion-toolbar>
23
+ * </ion-footer>
24
+ **/
25
+ const attachTabBarSearchable = (ionTabBar, ionFabButton, ionFooter) => {
26
+ if (!ionTabBar || !ionFabButton || !ionFooter) throw new Error("TabBarSearchable should be defined with props");
27
+ ionFooter.style.pointerEvents = "none";
28
+ ionFooter.style.opacity = "0";
29
+ ionFooter.querySelector("ion-buttons[slot=start]")?.classList.add("ios-theme-horizontal-only");
30
+ const nativeSearch = registerNativeSearch(ionTabBar, ionFabButton, ionFooter);
31
+ let searchableEventCache;
32
+ let resumeNative;
33
+ let nativeEntry = false;
34
+ let nativeRequest = 0;
35
+ let verticalSearch = false;
36
+ let tabVisibilityObserver;
37
+ return async (event, type) => {
38
+ const selector = type === TabBarSearchableType$1.Enter ? "ion-fab-button" : "ion-buttons[slot=start] ion-button";
39
+ if (!event.target?.closest(selector)) throw throwErrorByFailedClickElement(selector);
40
+ if (type === TabBarSearchableType$1.Leave && !nativeEntry && !searchableEventCache) throw new Error("TabBarSearchableType.Leave should be run after TabBarSearchableType.Enter");
41
+ const hadNativeEntry = nativeEntry;
42
+ const request = ++nativeRequest;
43
+ if (type === TabBarSearchableType$1.Enter) nativeEntry || (nativeEntry = isNativeUIShell(ionFooter));
44
+ const accepted = await requestNativeSearch(nativeSearch, type === TabBarSearchableType$1.Enter);
45
+ if (request !== nativeRequest) return;
46
+ if (accepted) {
47
+ nativeEntry = type === TabBarSearchableType$1.Enter;
48
+ return;
49
+ }
50
+ nativeEntry = false;
51
+ if (type === TabBarSearchableType$1.Leave && hadNativeEntry) return;
52
+ if (type === TabBarSearchableType$1.Enter) {
53
+ verticalSearch = !!ionTabBar.closest("ion-app.ios-theme-vertical-bars");
54
+ if (verticalSearch) {
55
+ const keepTabsVisible = () => {
56
+ if (ionTabBar.classList.contains("tab-bar-hidden") && ionTabBar.closest("ion-app.ios-theme-vertical-bars")) ionTabBar.classList.remove("tab-bar-hidden");
57
+ };
58
+ tabVisibilityObserver?.disconnect();
59
+ tabVisibilityObserver = new MutationObserver(keepTabsVisible);
60
+ tabVisibilityObserver.observe(ionTabBar, {
61
+ attributes: true,
62
+ attributeFilter: ["class"]
63
+ });
64
+ keepTabsVisible();
65
+ }
66
+ resumeNative ?? (resumeNative = await suspendNativeUIShell([
67
+ ...verticalSearch ? [] : [ionTabBar],
68
+ ionFooter,
69
+ ionFabButton.closest("ion-fab") ?? ionFabButton
70
+ ]));
71
+ try {
72
+ searchableEventCache = await enterEvent(event, ionTabBar, ionFabButton, ionFooter, verticalSearch);
73
+ } catch (error) {
74
+ tabVisibilityObserver?.disconnect();
75
+ resumeNative();
76
+ resumeNative = void 0;
77
+ throw error;
78
+ }
79
+ } else if (searchableEventCache !== void 0) try {
80
+ await leaveEvent(event, searchableEventCache, ionTabBar, ionFabButton, ionFooter, verticalSearch);
81
+ searchableEventCache = void 0;
82
+ } finally {
83
+ tabVisibilityObserver?.disconnect();
84
+ resumeNative?.();
85
+ resumeNative = void 0;
86
+ }
87
+ else throw new Error("TabBarSearchableType.Leave should be run after TabBarSearchableType.Enter");
88
+ };
85
89
  };
86
90
  const enterEvent = async (event, ionTabBar, ionFabButton, ionFooter, verticalSearch) => {
87
- if (!event.target?.closest('ion-fab-button')) {
88
- throw throwErrorByFailedClickElement('ion-fab-button');
89
- }
90
- const references = getElementReferences(ionTabBar, ionFooter);
91
- const sizes = getElementSizes(ionTabBar, ionFabButton, references);
92
- const colorSelected = references.selectedTabButton
93
- ? getComputedStyle(references.selectedTabButton).getPropertyValue('--color-selected').trim()
94
- : '';
95
- if (verticalSearch)
96
- references.closeButtonIcon.setAttribute('name', 'close');
97
- const tabAnimations = verticalSearch
98
- ? []
99
- : [createTabBarAnimation(ionTabBar, references, sizes), createEffectAnimation(references, sizes)];
100
- const searchContainerAnimation = createSearchContainerAnimation(references, sizes);
101
- const closeButtonsAnimation = createCloseButtonsAnimation(references);
102
- const fabButtonAnimation = createFabButtonAnimation(ionFabButton);
103
- await createAnimation()
104
- .delay(ANIMATION_DELAY_BASE)
105
- .duration(ANIMATION_DURATION)
106
- .easing(ANIMATION_EASING)
107
- .addElement(ionFooter)
108
- .afterAddWrite(() => (ionFooter.style.pointerEvents = 'auto'))
109
- .fromTo('opacity', '0.8', '1')
110
- .addAnimation([...tabAnimations, fabButtonAnimation, searchContainerAnimation, closeButtonsAnimation])
111
- .play();
112
- return {
113
- elementSizes: sizes,
114
- colorSelected,
115
- };
91
+ if (!event.target?.closest("ion-fab-button")) throw throwErrorByFailedClickElement("ion-fab-button");
92
+ const references = getElementReferences(ionTabBar, ionFooter);
93
+ const sizes = getElementSizes(ionTabBar, ionFabButton, references);
94
+ const colorSelected = references.selectedTabButton ? getComputedStyle(references.selectedTabButton).getPropertyValue("--color-selected").trim() : "";
95
+ if (verticalSearch) references.closeButtonIcon.setAttribute("name", "close");
96
+ const tabAnimations = verticalSearch ? [] : [createTabBarAnimation(ionTabBar, references, sizes), createEffectAnimation(references, sizes)];
97
+ const searchContainerAnimation = createSearchContainerAnimation(references, sizes);
98
+ const closeButtonsAnimation = createCloseButtonsAnimation(references);
99
+ const fabButtonAnimation = createFabButtonAnimation(ionFabButton);
100
+ await createAnimation().delay(ANIMATION_DELAY_BASE).duration(ANIMATION_DURATION).easing(ANIMATION_EASING).addElement(ionFooter).afterAddWrite(() => ionFooter.style.pointerEvents = "auto").fromTo("opacity", "0.8", "1").addAnimation([
101
+ ...tabAnimations,
102
+ fabButtonAnimation,
103
+ searchContainerAnimation,
104
+ closeButtonsAnimation
105
+ ]).play();
106
+ return {
107
+ elementSizes: sizes,
108
+ colorSelected
109
+ };
116
110
  };
117
111
  const leaveEvent = async (event, searchableEventCache, ionTabBar, ionFabButton, ionFooter, verticalSearch) => {
118
- if (!event.target?.closest('ion-buttons[slot=start] ion-button')) {
119
- throw throwErrorByFailedClickElement('ion-buttons[slot=start] ion-button');
120
- }
121
- const references = getElementReferences(ionTabBar, ionFooter);
122
- const tabAnimations = verticalSearch
123
- ? []
124
- : [
125
- createReverseTabBarAnimation(ionTabBar, references, searchableEventCache.elementSizes),
126
- createReverseEffectAnimation(references, searchableEventCache.elementSizes, searchableEventCache.colorSelected),
127
- ];
128
- const searchContainerAnimation = createReverseSearchContainerAnimation(references, searchableEventCache.elementSizes);
129
- const closeButtonsAnimation = createReverseCloseButtonsAnimation(references);
130
- const fabButtonAnimation = createReverseFabButtonAnimation(ionFabButton, searchableEventCache.elementSizes);
131
- await createAnimation()
132
- .delay(ANIMATION_DELAY_BASE)
133
- .duration(ANIMATION_DURATION)
134
- .easing(ANIMATION_EASING)
135
- .addElement(ionFooter)
136
- .afterAddWrite(() => (ionFooter.style.pointerEvents = 'none'))
137
- .fromTo('opacity', '1', '0')
138
- .addAnimation([...tabAnimations, fabButtonAnimation, searchContainerAnimation, closeButtonsAnimation])
139
- .play();
112
+ if (!event.target?.closest("ion-buttons[slot=start] ion-button")) throw throwErrorByFailedClickElement("ion-buttons[slot=start] ion-button");
113
+ const references = getElementReferences(ionTabBar, ionFooter);
114
+ const tabAnimations = verticalSearch ? [] : [createReverseTabBarAnimation(ionTabBar, references, searchableEventCache.elementSizes), createReverseEffectAnimation(references, searchableEventCache.elementSizes, searchableEventCache.colorSelected)];
115
+ const searchContainerAnimation = createReverseSearchContainerAnimation(references, searchableEventCache.elementSizes);
116
+ const closeButtonsAnimation = createReverseCloseButtonsAnimation(references);
117
+ const fabButtonAnimation = createReverseFabButtonAnimation(ionFabButton, searchableEventCache.elementSizes);
118
+ await createAnimation().delay(ANIMATION_DELAY_BASE).duration(ANIMATION_DURATION).easing(ANIMATION_EASING).addElement(ionFooter).afterAddWrite(() => ionFooter.style.pointerEvents = "none").fromTo("opacity", "1", "0").addAnimation([
119
+ ...tabAnimations,
120
+ fabButtonAnimation,
121
+ searchContainerAnimation,
122
+ closeButtonsAnimation
123
+ ]).play();
140
124
  };
125
+ //#endregion
126
+ export { TabBarSearchableType, attachTabBarSearchable };
127
+
128
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["TabBarSearchableType"],"sources":["../../src/tab-bar-searchable/index.ts"],"sourcesContent":["import { createAnimation } from '@ionic/core';\nimport {\n ANIMATION_DELAY_BASE,\n ANIMATION_DURATION,\n ANIMATION_EASING,\n getElementReferences,\n getElementSizes,\n throwErrorByFailedClickElement,\n type SearchableEventCache,\n type TabBarSearchableFunction,\n TabBarSearchableType,\n} from '@rdlabo/ionic-theme-utils';\nimport { isNativeUIShell, registerNativeSearch, requestNativeSearch, suspendNativeUIShell } from '../native-integration';\nimport {\n createCloseButtonsAnimation,\n createEffectAnimation,\n createFabButtonAnimation,\n createSearchContainerAnimation,\n createTabBarAnimation,\n} from './animations/enter';\nimport {\n createReverseCloseButtonsAnimation,\n createReverseEffectAnimation,\n createReverseFabButtonAnimation,\n createReverseSearchContainerAnimation,\n createReverseTabBarAnimation,\n} from './animations/leave';\n\nexport {\n TabBarSearchableType,\n type TabBarSearchableFunction,\n type SearchableEventCache,\n type ElementSizes,\n type ElementReferences,\n} from '@rdlabo/ionic-theme-utils';\n\n/**\n * <ion-fab vertical=\"bottom\" horizontal=\"end\" slot=\"fixed\">\n * <ion-fab-button (click)=\"present($event)\">\n * <ion-icon name=\"search\"></ion-icon>\n * </ion-fab-button>\n * </ion-fab>\n * <ion-footer [translucent]=\"true\">\n * <ion-toolbar>\n * <ion-buttons slot=\"start\">\n * <!-- ion-icon does not need `name` attribute. -->\n * <ion-button fill=\"default\"><ion-icon slot=\"icon-only\"></ion-icon>\n * </ion-button>\n * </ion-buttons>\n * <!-- User set `ionChange` or other events. -->\n * <ion-searchbar aria-label=\"Search\" (ionChange)=\"example($event)\"></ion-searchbar>\n * </ion-toolbar>\n * </ion-footer>\n **/\n\nexport const attachTabBarSearchable = (\n ionTabBar: HTMLElement,\n ionFabButton: HTMLElement,\n ionFooter: HTMLElement,\n): TabBarSearchableFunction => {\n if (!ionTabBar || !ionFabButton || !ionFooter) {\n throw new Error('TabBarSearchable should be defined with props');\n }\n // Initialize\n ionFooter.style.pointerEvents = 'none';\n ionFooter.style.opacity = '0';\n // Search dismissal belongs beside the Web search field, never in the vertical rail.\n ionFooter.querySelector('ion-buttons[slot=start]')?.classList.add('ios-theme-horizontal-only');\n const nativeSearch = registerNativeSearch(ionTabBar, ionFabButton, ionFooter);\n\n // Saved Params\n let searchableEventCache: SearchableEventCache | undefined;\n let resumeNative: (() => void) | undefined;\n // Leave is valid both while native Enter awaits its ack and after it completes.\n let nativeEntry = false;\n let nativeRequest = 0;\n let verticalSearch = false;\n let tabVisibilityObserver: MutationObserver | undefined;\n\n return async (event: Event, type: TabBarSearchableType) => {\n const selector = type === TabBarSearchableType.Enter ? 'ion-fab-button' : 'ion-buttons[slot=start] ion-button';\n if (!(event.target as HTMLElement)?.closest(selector)) throw throwErrorByFailedClickElement(selector);\n if (type === TabBarSearchableType.Leave && !nativeEntry && !searchableEventCache)\n throw new Error('TabBarSearchableType.Leave should be run after TabBarSearchableType.Enter');\n const hadNativeEntry = nativeEntry;\n const request = ++nativeRequest;\n if (type === TabBarSearchableType.Enter) nativeEntry ||= isNativeUIShell(ionFooter);\n const accepted = await requestNativeSearch(nativeSearch, type === TabBarSearchableType.Enter);\n if (request !== nativeRequest) return;\n if (accepted) {\n nativeEntry = type === TabBarSearchableType.Enter;\n return;\n }\n nativeEntry = false;\n if (type === TabBarSearchableType.Leave && hadNativeEntry) {\n // Forced native retirement already restored the closed Web presentation.\n return;\n }\n if (type === TabBarSearchableType.Enter) {\n verticalSearch = !!ionTabBar.closest('ion-app.ios-theme-vertical-bars');\n if (verticalSearch) {\n // Ionic hides horizontal tabs when the keyboard opens; keep this rail available.\n const keepTabsVisible = () => {\n if (ionTabBar.classList.contains('tab-bar-hidden') && ionTabBar.closest('ion-app.ios-theme-vertical-bars')) {\n ionTabBar.classList.remove('tab-bar-hidden');\n }\n };\n tabVisibilityObserver?.disconnect();\n tabVisibilityObserver = new MutationObserver(keepTabsVisible);\n tabVisibilityObserver.observe(ionTabBar, { attributes: true, attributeFilter: ['class'] });\n keepTabsVisible();\n }\n resumeNative ??= await suspendNativeUIShell([\n ...(verticalSearch ? [] : [ionTabBar]),\n ionFooter,\n ionFabButton.closest('ion-fab') ?? ionFabButton,\n ]);\n try {\n searchableEventCache = await enterEvent(event, ionTabBar, ionFabButton, ionFooter, verticalSearch);\n } catch (error) {\n tabVisibilityObserver?.disconnect();\n resumeNative();\n resumeNative = undefined;\n throw error;\n }\n } else if (searchableEventCache !== undefined) {\n try {\n await leaveEvent(event, searchableEventCache, ionTabBar, ionFabButton, ionFooter, verticalSearch);\n searchableEventCache = undefined;\n } finally {\n tabVisibilityObserver?.disconnect();\n resumeNative?.();\n resumeNative = undefined;\n }\n } else {\n throw new Error('TabBarSearchableType.Leave should be run after TabBarSearchableType.Enter');\n }\n };\n};\n\nconst enterEvent = async (\n event: Event,\n ionTabBar: HTMLElement,\n ionFabButton: HTMLElement,\n ionFooter: HTMLElement,\n verticalSearch: boolean,\n): Promise<SearchableEventCache> => {\n if (!(event.target as HTMLElement)?.closest('ion-fab-button')) {\n throw throwErrorByFailedClickElement('ion-fab-button');\n }\n\n const references = getElementReferences(ionTabBar, ionFooter);\n const sizes = getElementSizes(ionTabBar, ionFabButton, references);\n const colorSelected = references.selectedTabButton\n ? getComputedStyle(references.selectedTabButton).getPropertyValue('--color-selected').trim()\n : '';\n\n if (verticalSearch) references.closeButtonIcon.setAttribute('name', 'close');\n const tabAnimations = verticalSearch\n ? []\n : [createTabBarAnimation(ionTabBar, references, sizes), createEffectAnimation(references, sizes)];\n const searchContainerAnimation = createSearchContainerAnimation(references, sizes);\n const closeButtonsAnimation = createCloseButtonsAnimation(references);\n const fabButtonAnimation = createFabButtonAnimation(ionFabButton);\n\n await createAnimation()\n .delay(ANIMATION_DELAY_BASE)\n .duration(ANIMATION_DURATION)\n .easing(ANIMATION_EASING)\n .addElement(ionFooter)\n .afterAddWrite(() => (ionFooter.style.pointerEvents = 'auto'))\n .fromTo('opacity', '0.8', '1')\n .addAnimation([...tabAnimations, fabButtonAnimation, searchContainerAnimation, closeButtonsAnimation])\n .play();\n\n return {\n elementSizes: sizes,\n colorSelected,\n };\n};\n\nconst leaveEvent = async (\n event: Event,\n searchableEventCache: SearchableEventCache,\n ionTabBar: HTMLElement,\n ionFabButton: HTMLElement,\n ionFooter: HTMLElement,\n verticalSearch: boolean,\n): Promise<void> => {\n if (!(event.target as HTMLElement)?.closest('ion-buttons[slot=start] ion-button')) {\n throw throwErrorByFailedClickElement('ion-buttons[slot=start] ion-button');\n }\n\n const references = getElementReferences(ionTabBar, ionFooter);\n\n const tabAnimations = verticalSearch\n ? []\n : [\n createReverseTabBarAnimation(ionTabBar, references, searchableEventCache.elementSizes),\n createReverseEffectAnimation(references, searchableEventCache.elementSizes, searchableEventCache.colorSelected),\n ];\n const searchContainerAnimation = createReverseSearchContainerAnimation(references, searchableEventCache.elementSizes);\n const closeButtonsAnimation = createReverseCloseButtonsAnimation(references);\n const fabButtonAnimation = createReverseFabButtonAnimation(ionFabButton, searchableEventCache.elementSizes);\n\n await createAnimation()\n .delay(ANIMATION_DELAY_BASE)\n .duration(ANIMATION_DURATION)\n .easing(ANIMATION_EASING)\n .addElement(ionFooter)\n .afterAddWrite(() => (ionFooter.style.pointerEvents = 'none'))\n .fromTo('opacity', '1', '0')\n .addAnimation([...tabAnimations, fabButtonAnimation, searchContainerAnimation, closeButtonsAnimation])\n .play();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAa,0BACX,WACA,cACA,cAC6B;CAC7B,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,WAClC,MAAM,IAAI,MAAM,+CAA+C;CAGjE,UAAU,MAA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AO,GAAG,CAAC,CAC7B,aAAa;EAAC,GAAG;EAAe;EAAoB;EAA0B;CAAqB,CAAC,CAAC,CACrG,KAAK;CAER,OAAO;EACL,cAAc;EACd;CACF;AACF;AAEA,MAAM,aAAa,OACjB,OACA,sBACA,WACA,cACA,WACA,mBACkB;CAClB,IAAI,CAAE,MAAM,QAAwB,QAAQ,oCAAoC,GAC9E,MAAM,+BAA+B,oCAAoC;CAG3E,MAAM,aAAa,qBAAqB,WAAW,SAAS;CAE5D,MAAM,gBAAgB,iBAClB,CAAC,IACD,CACE,6BAA6B,WAAW,YAAY,qBAAqB,YAAY,GACrF,6BAA6B,YAAY,qBAAqB,cAAc,qBAAqB,aAAa,CAChH;CACJ,MAAM,2BAA2B,sCAAsC,YAAY,qBAAqB,YAAY;CACpH,MAAM,wBAAwB,mCAAmC,UAAU;CAC3E,MAAM,qBAAqB,gCAAgC,cAAc,qBAAqB,YAAY;CAE1G,MAAM,gBAAgB,CAAC,CACpB,MAAM,oBAAoB,CAAC,CAC3B,SAAS,kBAAkB,CAAC,CAC5B,OAAO,gBAAgB,CAAC,CACxB,WAAW,SAAS,CAAC,CACrB,oBAAqB,UAAU,MAAM,gBAAgB,MAAO,CAAC,CAC7D,OAAO,WAAW,KAAK,GAAG,CAAC,CAC3B,aAAa;EAAC,GAAG;EAAe;EAAoB;EAA0B;CAAqB,CAAC,CAAC,CACrG,KAAK;AACV"}
@@ -1,5 +1,5 @@
1
- import type { NavOptions } from '@ionic/core';
2
- import type { Animation } from '@ionic/core';
1
+ import { Animation, NavOptions } from "@ionic/core";
2
+ //#region src/transition/index.d.ts
3
3
  export declare const transition: (opts: TransitionOptions) => Promise<TransitionResult>;
4
4
  export declare const lifecycle: (el: HTMLElement | undefined, eventName: string) => void;
5
5
  export declare const waitForMount: () => Promise<void>;
@@ -7,13 +7,14 @@ export declare const deepReady: (el: Element | undefined) => Promise<void>;
7
7
  export declare const setPageHidden: (el: HTMLElement, hidden: boolean) => void;
8
8
  export declare const getIonPageElement: (element: HTMLElement) => Element;
9
9
  export interface TransitionOptions extends NavOptions {
10
- progressCallback?: (ani: Animation | undefined) => void;
11
- baseEl: HTMLElement;
12
- enteringEl: HTMLElement;
13
- leavingEl: HTMLElement | undefined;
10
+ progressCallback?: (ani: Animation | undefined) => void;
11
+ baseEl: HTMLElement;
12
+ enteringEl: HTMLElement;
13
+ leavingEl: HTMLElement | undefined;
14
14
  }
15
15
  export interface TransitionResult {
16
- hasCompleted: boolean;
17
- animation?: Animation;
16
+ hasCompleted: boolean;
17
+ animation?: Animation;
18
18
  }
19
+ //#endregion
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transition/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAmB/D,eAAO,MAAM,UAAU,GAAI,MAAM,iBAAiB,KAAG,OAAO,CAAC,gBAAgB,CAyB5E,CAAC;AAkKF,eAAO,MAAM,SAAS,GAAI,IAAI,WAAW,GAAG,SAAS,EAAE,WAAW,MAAM,SAQvE,CAAC;AAeF,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAE3C,CAAC;AAOF,eAAO,MAAM,SAAS,GAAU,IAAI,OAAO,GAAG,SAAS,KAAG,OAAO,CAAC,IAAI,CAyBrE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,IAAI,WAAW,EAAE,QAAQ,OAAO,SAS7D,CAAC;AA6CF,eAAO,MAAM,iBAAiB,GAAI,SAAS,WAAW,YAWrD,CAAC;AA4BF,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IACxD,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,WAAW,CA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