@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
|
@@ -1,349 +1,335 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { activateProjectedElement, createVerticalBarsPageState,
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
1
|
+
import { VERTICAL_BARS_TRANSITION_CANCELED } from "../native-integration/index.js";
|
|
2
|
+
import { inVerticalBarsSurface, topModal } from "./shared/modal.js";
|
|
3
|
+
import { activateProjectedElement, createVerticalBarsPageState, isExcluded, isVerticalBarsToolbarGroup, marker, preferredVerticalBarsBack, prehiddenClass, prehideOnlyMutation, unprojected, verticalBarsActionCandidate, verticalBarsBackCandidate, verticalBarsEnteringPage, verticalBarsOwned, verticalBarsToolbarActions, withoutPrehide } from "./shared/dom.js";
|
|
4
|
+
//#region src/native/vertical-bars-web.ts
|
|
5
|
+
const backProjectionClass = "ios-theme-vertical-bars-back-button-projection";
|
|
6
|
+
const toolbarProjectionClass = "ios-theme-vertical-bars-toolbar-projection";
|
|
7
|
+
const readyClass = "ios-theme-vertical-bars-toolbar-ready";
|
|
7
8
|
const toolbarControlSize = 46;
|
|
8
9
|
const toolbarControlGap = 10;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (!suspended)
|
|
331
|
-
await schedule();
|
|
332
|
-
},
|
|
333
|
-
};
|
|
334
|
-
},
|
|
335
|
-
async destroy() {
|
|
336
|
-
if (stopped)
|
|
337
|
-
return;
|
|
338
|
-
stopped = true;
|
|
339
|
-
win.cancelAnimationFrame(frame);
|
|
340
|
-
frame = 0;
|
|
341
|
-
waiters.forEach((resolve) => resolve());
|
|
342
|
-
waiters = [];
|
|
343
|
-
observer.disconnect();
|
|
344
|
-
sourceObserver?.disconnect();
|
|
345
|
-
listeners.abort();
|
|
346
|
-
restore();
|
|
347
|
-
},
|
|
348
|
-
};
|
|
10
|
+
const createVerticalBarsWebProjection = (doc, options, enabled = () => true) => {
|
|
11
|
+
const win = doc.defaultView;
|
|
12
|
+
if (options.controls !== void 0 && options.controls.toolbar !== true) return {
|
|
13
|
+
getStatus: () => ({
|
|
14
|
+
state: "web",
|
|
15
|
+
projected: 0,
|
|
16
|
+
updates: 0
|
|
17
|
+
}),
|
|
18
|
+
suspend: async () => ({ resume: async () => {} }),
|
|
19
|
+
destroy: async () => {}
|
|
20
|
+
};
|
|
21
|
+
let root;
|
|
22
|
+
let backSource;
|
|
23
|
+
let backProjection;
|
|
24
|
+
let previousBackAriaHidden = null;
|
|
25
|
+
let toolbarProjections = [];
|
|
26
|
+
let suspended = 0;
|
|
27
|
+
let stopped = false;
|
|
28
|
+
let frame = 0;
|
|
29
|
+
let updates = 0;
|
|
30
|
+
let observingVerticalBars = false;
|
|
31
|
+
const verticalBarsPages = createVerticalBarsPageState();
|
|
32
|
+
let sourceObserver;
|
|
33
|
+
let waiters = [];
|
|
34
|
+
const listeners = new AbortController();
|
|
35
|
+
const verticalBarsRoot = () => doc.querySelector("ion-app.ios-theme-vertical-bars");
|
|
36
|
+
const projectedSources = () => [backSource, ...toolbarProjections.flatMap(({ actions }) => actions.map(({ source }) => source))].filter((source) => !!source);
|
|
37
|
+
const isRendered = (element) => withoutPrehide(element, () => {
|
|
38
|
+
const style = getComputedStyle(element);
|
|
39
|
+
const rect = element.getBoundingClientRect();
|
|
40
|
+
return element.isConnected && style.display !== "none" && style.visibility === "visible" && rect.width > 0 && rect.height > 0;
|
|
41
|
+
});
|
|
42
|
+
const inEligibleToolbar = (element) => !!verticalBarsRoot()?.contains(element) && inVerticalBarsSurface(element) && verticalBarsActionCandidate(element) && !isExcluded(element, verticalBarsEnteringPage(element)) && !verticalBarsPages.isDeparted(element);
|
|
43
|
+
const isEligibleBack = (element) => !!verticalBarsRoot()?.contains(element) && inVerticalBarsSurface(element) && verticalBarsOwned(element) && verticalBarsBackCandidate(element) && !isExcluded(element, verticalBarsEnteringPage(element)) && !verticalBarsPages.isDeparted(element) && unprojected(projectedSources(), () => isRendered(element));
|
|
44
|
+
const pageOrder = (element) => Array.from(doc.querySelectorAll(".ion-page")).indexOf(element.closest(".ion-page"));
|
|
45
|
+
const findBack = () => {
|
|
46
|
+
const candidates = Array.from(doc.querySelectorAll(`ion-back-button:not(.${backProjectionClass})`)).filter(isEligibleBack);
|
|
47
|
+
return preferredVerticalBarsBack(candidates, doc);
|
|
48
|
+
};
|
|
49
|
+
const findToolbarGroups = () => {
|
|
50
|
+
const candidates = Array.from(doc.querySelectorAll(`ion-buttons:not(.${toolbarProjectionClass})`)).flatMap((group) => {
|
|
51
|
+
const actions = verticalBarsToolbarActions(group).filter((action) => unprojected(projectedSources(), () => isRendered(action)));
|
|
52
|
+
if (!actions.length) return [];
|
|
53
|
+
if (!isVerticalBarsToolbarGroup(group)) return actions.filter(inEligibleToolbar).map((action) => ({
|
|
54
|
+
group,
|
|
55
|
+
actions: [action]
|
|
56
|
+
}));
|
|
57
|
+
return inEligibleToolbar(group) && unprojected(projectedSources(), () => isRendered(group)) ? [{
|
|
58
|
+
group,
|
|
59
|
+
actions
|
|
60
|
+
}] : [];
|
|
61
|
+
});
|
|
62
|
+
const highestPage = Math.max(...candidates.map(({ group }) => pageOrder(group)));
|
|
63
|
+
return candidates.filter(({ group }) => pageOrder(group) === highestPage);
|
|
64
|
+
};
|
|
65
|
+
const isCurrentToolbarAction = (source) => findToolbarGroups().some(({ actions }) => actions.includes(source));
|
|
66
|
+
const restore = () => {
|
|
67
|
+
backProjection?.remove();
|
|
68
|
+
backProjection = void 0;
|
|
69
|
+
if (backSource) {
|
|
70
|
+
backSource.removeAttribute(marker);
|
|
71
|
+
if (previousBackAriaHidden === null) backSource.removeAttribute("aria-hidden");
|
|
72
|
+
else backSource.setAttribute("aria-hidden", previousBackAriaHidden);
|
|
73
|
+
backSource.dispatchEvent(new CustomEvent("nativeUIShellChange"));
|
|
74
|
+
}
|
|
75
|
+
backSource = void 0;
|
|
76
|
+
previousBackAriaHidden = null;
|
|
77
|
+
for (const { projection, actions } of toolbarProjections) {
|
|
78
|
+
projection.remove();
|
|
79
|
+
for (const { source, previousAriaHidden } of actions) {
|
|
80
|
+
source.removeAttribute(marker);
|
|
81
|
+
if (previousAriaHidden === null) source.removeAttribute("aria-hidden");
|
|
82
|
+
else source.setAttribute("aria-hidden", previousAriaHidden);
|
|
83
|
+
source.dispatchEvent(new CustomEvent("nativeUIShellChange"));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
toolbarProjections = [];
|
|
87
|
+
sourceObserver?.disconnect();
|
|
88
|
+
sourceObserver = void 0;
|
|
89
|
+
root?.classList.remove(readyClass);
|
|
90
|
+
root = void 0;
|
|
91
|
+
};
|
|
92
|
+
const copyAttributes = (target, original) => {
|
|
93
|
+
for (const name of [
|
|
94
|
+
"id",
|
|
95
|
+
"slot",
|
|
96
|
+
marker,
|
|
97
|
+
"aria-hidden"
|
|
98
|
+
]) target.removeAttribute(name);
|
|
99
|
+
for (const attribute of Array.from(target.attributes)) if (!["class", "data-native-ui-shell"].includes(attribute.name) && !original.hasAttribute(attribute.name)) target.removeAttribute(attribute.name);
|
|
100
|
+
for (const attribute of Array.from(original.attributes)) if (![
|
|
101
|
+
"id",
|
|
102
|
+
"slot",
|
|
103
|
+
"data-native-ui-shell",
|
|
104
|
+
"aria-hidden"
|
|
105
|
+
].includes(attribute.name)) target.setAttribute(attribute.name, attribute.value);
|
|
106
|
+
target.classList.remove(prehiddenClass);
|
|
107
|
+
};
|
|
108
|
+
const syncBack = (target, original) => {
|
|
109
|
+
copyAttributes(target, original);
|
|
110
|
+
target.classList.add(backProjectionClass, "ion-cloned-element");
|
|
111
|
+
target.disabled = original.disabled;
|
|
112
|
+
target.defaultHref = original.defaultHref;
|
|
113
|
+
target.icon = original.icon;
|
|
114
|
+
target.color = original.color;
|
|
115
|
+
target.mode = original.mode;
|
|
116
|
+
target.text = "";
|
|
117
|
+
};
|
|
118
|
+
const syncAction = (target, original) => {
|
|
119
|
+
copyAttributes(target, original);
|
|
120
|
+
target.classList.add("ios-theme-vertical-bars-toolbar-action", "ion-cloned-element");
|
|
121
|
+
const label = original.getAttribute("aria-label") ?? original.shadowRoot?.querySelector("[part~=native]")?.getAttribute("aria-label") ?? original.textContent?.trim();
|
|
122
|
+
if (label) target.setAttribute("aria-label", label);
|
|
123
|
+
if ("disabled" in original) target.disabled = original.disabled;
|
|
124
|
+
if (original.matches("ion-button")) {
|
|
125
|
+
const clonedIcon = original.querySelector("ion-icon, svg")?.cloneNode(true);
|
|
126
|
+
clonedIcon?.setAttribute("slot", "icon-only");
|
|
127
|
+
target.replaceChildren(...clonedIcon ? [clonedIcon] : []);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const sameSources = (back, groups) => back === backSource && groups.length === toolbarProjections.length && groups.every(({ group, actions }, index) => {
|
|
131
|
+
const current = toolbarProjections[index];
|
|
132
|
+
return group === current.source && actions.length === current.actions.length && actions.every((action, actionIndex) => action === current.actions[actionIndex].source);
|
|
133
|
+
});
|
|
134
|
+
const syncExisting = () => {
|
|
135
|
+
if (backSource && backProjection) syncBack(backProjection, backSource);
|
|
136
|
+
let topOffset = backSource ? 56 : 0;
|
|
137
|
+
for (const { projection, source, actions } of toolbarProjections) {
|
|
138
|
+
if (actions.length === 1 && !projection.matches("ion-buttons")) syncAction(projection, actions[0].source);
|
|
139
|
+
else copyAttributes(projection, source);
|
|
140
|
+
projection.classList.add(toolbarProjectionClass, "ion-cloned-element");
|
|
141
|
+
projection.style.setProperty("--ios-theme-vertical-bars-toolbar-offset", `${topOffset}px`);
|
|
142
|
+
if (projection.matches("ion-buttons")) actions.forEach(({ source: action, projection: clone }) => syncAction(clone, action));
|
|
143
|
+
topOffset += actions.length * toolbarControlSize + toolbarControlGap;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const project = (nextBack, groups) => {
|
|
147
|
+
root = topModal(doc) ?? verticalBarsRoot();
|
|
148
|
+
let topOffset = 0;
|
|
149
|
+
if (nextBack) {
|
|
150
|
+
backSource = nextBack;
|
|
151
|
+
previousBackAriaHidden = nextBack.getAttribute("aria-hidden");
|
|
152
|
+
backProjection = nextBack.cloneNode(false);
|
|
153
|
+
syncBack(backProjection, nextBack);
|
|
154
|
+
backProjection.addEventListener("click", (event) => {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
event.stopImmediatePropagation();
|
|
157
|
+
if (backSource && backSource === findBack()) activateProjectedElement(backSource);
|
|
158
|
+
}, { capture: true });
|
|
159
|
+
root.append(backProjection);
|
|
160
|
+
nextBack.setAttribute(marker, "");
|
|
161
|
+
nextBack.setAttribute("aria-hidden", "true");
|
|
162
|
+
nextBack.dispatchEvent(new CustomEvent("nativeUIShellChange"));
|
|
163
|
+
topOffset = 56;
|
|
164
|
+
}
|
|
165
|
+
for (const { group, actions: sources } of groups) {
|
|
166
|
+
const projection = (sources.length === 1 ? sources[0] : group).cloneNode(false);
|
|
167
|
+
if (sources.length === 1) syncAction(projection, sources[0]);
|
|
168
|
+
else copyAttributes(projection, group);
|
|
169
|
+
projection.classList.add(toolbarProjectionClass, "ion-cloned-element");
|
|
170
|
+
projection.style.setProperty("--ios-theme-vertical-bars-toolbar-offset", `${topOffset}px`);
|
|
171
|
+
const actions = sources.map((source) => {
|
|
172
|
+
const clone = sources.length === 1 ? projection : source.cloneNode(false);
|
|
173
|
+
if (sources.length > 1) syncAction(clone, source);
|
|
174
|
+
clone.addEventListener("click", (event) => {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
event.stopImmediatePropagation();
|
|
177
|
+
if (isCurrentToolbarAction(source)) activateProjectedElement(source);
|
|
178
|
+
}, { capture: true });
|
|
179
|
+
if (sources.length > 1) projection.append(clone);
|
|
180
|
+
const previousAriaHidden = source.getAttribute("aria-hidden");
|
|
181
|
+
source.setAttribute(marker, "");
|
|
182
|
+
source.setAttribute("aria-hidden", "true");
|
|
183
|
+
source.dispatchEvent(new CustomEvent("nativeUIShellChange"));
|
|
184
|
+
return {
|
|
185
|
+
source,
|
|
186
|
+
projection: clone,
|
|
187
|
+
previousAriaHidden
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
root.append(projection);
|
|
191
|
+
toolbarProjections.push({
|
|
192
|
+
source: group,
|
|
193
|
+
projection,
|
|
194
|
+
actions
|
|
195
|
+
});
|
|
196
|
+
topOffset += actions.length * toolbarControlSize + toolbarControlGap;
|
|
197
|
+
}
|
|
198
|
+
if (nextBack || toolbarProjections.length) root.classList.add(readyClass);
|
|
199
|
+
sourceObserver = new MutationObserver((records) => {
|
|
200
|
+
if (records.some((record) => record.type !== "attributes" || !["data-native-ui-shell", "aria-hidden"].includes(record.attributeName ?? "") && !prehideOnlyMutation(record))) schedule();
|
|
201
|
+
});
|
|
202
|
+
if (nextBack?.shadowRoot) sourceObserver.observe(nextBack.shadowRoot, {
|
|
203
|
+
subtree: true,
|
|
204
|
+
childList: true,
|
|
205
|
+
attributes: true,
|
|
206
|
+
attributeOldValue: true
|
|
207
|
+
});
|
|
208
|
+
for (const { group } of groups) sourceObserver.observe(group, {
|
|
209
|
+
subtree: true,
|
|
210
|
+
childList: true,
|
|
211
|
+
attributes: true,
|
|
212
|
+
attributeOldValue: true
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
const performUpdate = () => {
|
|
216
|
+
frame = 0;
|
|
217
|
+
const currentRoot = verticalBarsRoot();
|
|
218
|
+
if (observingVerticalBars !== !!currentRoot) {
|
|
219
|
+
observingVerticalBars = !!currentRoot;
|
|
220
|
+
observer.disconnect();
|
|
221
|
+
observer.observe(doc.documentElement, {
|
|
222
|
+
subtree: true,
|
|
223
|
+
childList: true,
|
|
224
|
+
attributes: true,
|
|
225
|
+
attributeOldValue: true,
|
|
226
|
+
attributeFilter: observingVerticalBars ? void 0 : ["class"]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (stopped || suspended || !currentRoot || !enabled()) return restore();
|
|
230
|
+
const nextBack = findBack();
|
|
231
|
+
const groups = findToolbarGroups();
|
|
232
|
+
if (!nextBack && !groups.length) return restore();
|
|
233
|
+
if (root === (topModal(doc) ?? currentRoot) && sameSources(nextBack, groups)) return syncExisting();
|
|
234
|
+
restore();
|
|
235
|
+
project(nextBack, groups);
|
|
236
|
+
updates++;
|
|
237
|
+
};
|
|
238
|
+
const update = () => {
|
|
239
|
+
try {
|
|
240
|
+
performUpdate();
|
|
241
|
+
} catch {
|
|
242
|
+
restore();
|
|
243
|
+
} finally {
|
|
244
|
+
const pending = waiters;
|
|
245
|
+
waiters = [];
|
|
246
|
+
pending.forEach((resolve) => resolve());
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
const schedule = () => {
|
|
250
|
+
if (stopped) return Promise.resolve();
|
|
251
|
+
if (!enabled()) restore();
|
|
252
|
+
const done = new Promise((resolve) => waiters.push(resolve));
|
|
253
|
+
if (!frame) frame = win.requestAnimationFrame(update);
|
|
254
|
+
return done;
|
|
255
|
+
};
|
|
256
|
+
const observer = new MutationObserver((records) => {
|
|
257
|
+
const insideProjection = (target) => {
|
|
258
|
+
const element = target instanceof Element ? target : target.parentNode instanceof Element ? target.parentNode : void 0;
|
|
259
|
+
const rootNode = target.getRootNode();
|
|
260
|
+
return !![element, rootNode instanceof ShadowRoot ? rootNode.host : void 0].some((candidate) => candidate?.closest(`.${backProjectionClass}, .${toolbarProjectionClass}`));
|
|
261
|
+
};
|
|
262
|
+
const verticalBarsChanged = records.some((record) => record.type === "attributes" && record.target.matches("ion-app") || record.type === "childList" && Array.from(record.addedNodes).some((node) => node instanceof Element && (node.matches("ion-app.ios-theme-vertical-bars") || !!node.querySelector("ion-app.ios-theme-vertical-bars"))));
|
|
263
|
+
if (observingVerticalBars && records.some((record) => record.attributeName !== "data-native-ui-shell" && !prehideOnlyMutation(record) && !insideProjection(record.target)) || !observingVerticalBars && verticalBarsChanged && records.some((record) => !prehideOnlyMutation(record))) schedule();
|
|
264
|
+
});
|
|
265
|
+
observer.observe(doc.documentElement, {
|
|
266
|
+
subtree: true,
|
|
267
|
+
childList: true,
|
|
268
|
+
attributes: true,
|
|
269
|
+
attributeOldValue: true,
|
|
270
|
+
attributeFilter: ["class"]
|
|
271
|
+
});
|
|
272
|
+
const pageLifecycle = (event) => {
|
|
273
|
+
const page = event.target;
|
|
274
|
+
if (!(page instanceof HTMLElement) || !page.matches(".ion-page")) return;
|
|
275
|
+
if (event.type === "iosThemeVerticalBarsTransitionCanceled") {
|
|
276
|
+
const entering = event.detail?.entering;
|
|
277
|
+
verticalBarsPages.cancel(entering, page);
|
|
278
|
+
} else verticalBarsPages.lifecycle(event);
|
|
279
|
+
if (verticalBarsRoot()) schedule();
|
|
280
|
+
};
|
|
281
|
+
for (const name of [
|
|
282
|
+
"ionViewWillEnter",
|
|
283
|
+
"ionViewWillLeave",
|
|
284
|
+
"ionViewDidEnter",
|
|
285
|
+
"ionViewDidLeave"
|
|
286
|
+
]) doc.addEventListener(name, pageLifecycle, {
|
|
287
|
+
capture: true,
|
|
288
|
+
signal: listeners.signal
|
|
289
|
+
});
|
|
290
|
+
doc.addEventListener(VERTICAL_BARS_TRANSITION_CANCELED, pageLifecycle, {
|
|
291
|
+
capture: true,
|
|
292
|
+
signal: listeners.signal
|
|
293
|
+
});
|
|
294
|
+
for (const name of ["ionModalWillPresent", "ionModalDidDismiss"]) doc.addEventListener(name, schedule, {
|
|
295
|
+
capture: true,
|
|
296
|
+
signal: listeners.signal
|
|
297
|
+
});
|
|
298
|
+
win.addEventListener("resize", schedule, { signal: listeners.signal });
|
|
299
|
+
win.addEventListener("nativeUIShellRefresh", schedule, { signal: listeners.signal });
|
|
300
|
+
schedule();
|
|
301
|
+
return {
|
|
302
|
+
getStatus: () => ({
|
|
303
|
+
state: stopped ? "stopped" : "web",
|
|
304
|
+
projected: Number(!!backSource) + toolbarProjections.reduce((count, group) => count + group.actions.length, 0),
|
|
305
|
+
updates
|
|
306
|
+
}),
|
|
307
|
+
async suspend() {
|
|
308
|
+
suspended++;
|
|
309
|
+
restore();
|
|
310
|
+
let resumed = false;
|
|
311
|
+
return { async resume() {
|
|
312
|
+
if (resumed) return;
|
|
313
|
+
resumed = true;
|
|
314
|
+
suspended = Math.max(0, suspended - 1);
|
|
315
|
+
if (!suspended) await schedule();
|
|
316
|
+
} };
|
|
317
|
+
},
|
|
318
|
+
async destroy() {
|
|
319
|
+
if (stopped) return;
|
|
320
|
+
stopped = true;
|
|
321
|
+
win.cancelAnimationFrame(frame);
|
|
322
|
+
frame = 0;
|
|
323
|
+
waiters.forEach((resolve) => resolve());
|
|
324
|
+
waiters = [];
|
|
325
|
+
observer.disconnect();
|
|
326
|
+
sourceObserver?.disconnect();
|
|
327
|
+
listeners.abort();
|
|
328
|
+
restore();
|
|
329
|
+
}
|
|
330
|
+
};
|
|
349
331
|
};
|
|
332
|
+
//#endregion
|
|
333
|
+
export { createVerticalBarsWebProjection };
|
|
334
|
+
|
|
335
|
+
//# sourceMappingURL=vertical-bars-web.js.map
|