@ionic/core 8.5.5-dev.11746028401.1b2f6b8c → 8.5.5-dev.11747137265.184b7749
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/components/button.js +4 -8
- package/components/ion-badge.js +3 -3
- package/components/title.js +1 -1
- package/components/toolbar.js +130 -5
- package/css/ionic/bundle.ionic.css +1 -1
- package/css/ionic/bundle.ionic.css.map +1 -1
- package/css/ionic/core.ionic.css +1 -1
- package/css/ionic/core.ionic.css.map +1 -1
- package/dist/cjs/ion-app_8.cjs.entry.js +131 -6
- package/dist/cjs/ion-avatar_3.cjs.entry.js +3 -3
- package/dist/cjs/ion-button_2.cjs.entry.js +4 -8
- package/dist/collection/components/badge/badge.ionic.css +12 -76
- package/dist/collection/components/badge/badge.js +5 -5
- package/dist/collection/components/button/button.ionic.css +23 -45
- package/dist/collection/components/button/button.js +5 -9
- package/dist/collection/components/title/title.ionic.css +0 -16
- package/dist/collection/components/toolbar/toolbar.ionic.css +27 -22
- package/dist/collection/components/toolbar/toolbar.js +130 -5
- package/dist/docs.json +8 -28
- package/dist/esm/ion-app_8.entry.js +131 -6
- package/dist/esm/ion-avatar_3.entry.js +3 -3
- package/dist/esm/ion-button_2.entry.js +4 -8
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-avatar_3.entry.js +1 -1
- package/dist/esm-es5/ion-button_2.entry.js +1 -1
- package/dist/html.html-data.json +1 -16
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-16fd70b2.entry.js +4 -0
- package/dist/ionic/p-67cded2a.system.entry.js +4 -0
- package/dist/ionic/{p-f3deab52.system.entry.js → p-ad3f30b4.system.entry.js} +1 -1
- package/dist/ionic/p-d6662277.entry.js +4 -0
- package/dist/ionic/p-db8ffacb.system.js +1 -1
- package/dist/ionic/{p-2d8cc8b4.entry.js → p-dbbfcd15.entry.js} +1 -1
- package/dist/ionic/{p-a569fc14.system.entry.js → p-ed4cf0aa.system.entry.js} +1 -1
- package/dist/types/components/badge/badge.d.ts +3 -6
- package/dist/types/components/button/button.d.ts +2 -2
- package/dist/types/components/toolbar/toolbar.d.ts +16 -0
- package/dist/types/components.d.ts +6 -6
- package/hydrate/index.js +138 -17
- package/hydrate/index.mjs +138 -17
- package/package.json +1 -1
- package/dist/ionic/p-246e6dc5.entry.js +0 -4
- package/dist/ionic/p-350e4850.system.entry.js +0 -4
- package/dist/ionic/p-f10dba92.entry.js +0 -4
|
@@ -355,10 +355,14 @@ ion-ripple-effect {
|
|
|
355
355
|
--padding-top: var(--ion-space-0, 0px);
|
|
356
356
|
--focus-ring-color: var(--ion-border-focus-default, #b5c0f7);
|
|
357
357
|
--focus-ring-width: var(--ion-border-size-050, 2px);
|
|
358
|
+
font-size: var(--ion-font-size-400, 1rem);
|
|
359
|
+
font-weight: var(--ion-font-weight-medium, 500);
|
|
360
|
+
letter-spacing: var(--ion-font-letter-spacing-1, 1%);
|
|
361
|
+
line-height: var(--ion-font-line-height-600, 24px);
|
|
362
|
+
text-decoration: none;
|
|
363
|
+
text-transform: none;
|
|
358
364
|
position: relative;
|
|
359
|
-
min-height: var(--ion-scale-
|
|
360
|
-
font-family: var(--ion-font-family, "Inter", sans-serif);
|
|
361
|
-
font-size: var(--ion-font-size-350, 0.875rem);
|
|
365
|
+
min-height: var(--ion-scale-1200, 48px);
|
|
362
366
|
}
|
|
363
367
|
:host::after {
|
|
364
368
|
right: 0;
|
|
@@ -420,36 +424,30 @@ ion-ripple-effect {
|
|
|
420
424
|
color: var(--ion-primitives-neutral-200, #efefef);
|
|
421
425
|
}
|
|
422
426
|
|
|
423
|
-
/* Extra Small Button */
|
|
424
|
-
:host(.button-xsmall) {
|
|
425
|
-
--padding-top: var(--ion-space-100, 4px);
|
|
426
|
-
--padding-end: var(--ion-space-300, 12px);
|
|
427
|
-
min-height: var(--ion-space-600, 24px);
|
|
428
|
-
font-size: var(--ion-font-size-300, 0.75rem);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
427
|
/* Small Button */
|
|
432
428
|
:host(.button-small) {
|
|
433
429
|
--padding-top: var(--ion-space-200, 8px);
|
|
434
430
|
--padding-end: var(--ion-space-400, 16px);
|
|
435
|
-
|
|
436
|
-
font-
|
|
431
|
+
font-size: var(--ion-font-size-350, 0.875rem);
|
|
432
|
+
font-weight: var(--ion-font-weight-medium, 500);
|
|
433
|
+
letter-spacing: var(--ion-font-letter-spacing-1, 1%);
|
|
434
|
+
line-height: var(--ion-font-line-height-500, 20px);
|
|
435
|
+
text-decoration: none;
|
|
436
|
+
text-transform: none;
|
|
437
|
+
min-height: var(--ion-scale-1000, 40px);
|
|
437
438
|
}
|
|
438
439
|
|
|
439
440
|
/* Large Button */
|
|
440
441
|
:host(.button-large) {
|
|
441
442
|
--padding-top: var(--ion-space-400, 16px);
|
|
442
443
|
--padding-end: var(--ion-space-600, 24px);
|
|
443
|
-
min-height: var(--ion-scale-1200, 48px);
|
|
444
|
-
font-size: var(--ion-font-size-400, 1rem);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/* Extra Large Button */
|
|
448
|
-
:host(.button-xlarge) {
|
|
449
|
-
--padding-top: var(--ion-space-400, 16px);
|
|
450
|
-
--padding-end: var(--ion-space-800, 32px);
|
|
451
|
-
min-height: var(--ion-scale-1400, 56px);
|
|
452
444
|
font-size: var(--ion-font-size-500, 1.25rem);
|
|
445
|
+
font-weight: var(--ion-font-weight-medium, 500);
|
|
446
|
+
letter-spacing: var(--ion-font-letter-spacing-1, 1%);
|
|
447
|
+
line-height: var(--ion-font-line-height-600, 24px);
|
|
448
|
+
text-decoration: none;
|
|
449
|
+
text-transform: none;
|
|
450
|
+
min-height: var(--ion-scale-1400, 56px);
|
|
453
451
|
}
|
|
454
452
|
|
|
455
453
|
/* Button containing only an icon */
|
|
@@ -459,18 +457,12 @@ ion-ripple-effect {
|
|
|
459
457
|
font-size: var(--ion-font-size-400, 1rem);
|
|
460
458
|
}
|
|
461
459
|
|
|
462
|
-
:host(.button-xsmall) ::slotted(ion-icon[slot=start]),
|
|
463
|
-
:host(.button-xsmall) ::slotted(ion-icon[slot=end]),
|
|
464
|
-
:host(.button-xsmall) ::slotted(ion-icon[slot=icon-only]),
|
|
465
460
|
:host(.button-small) ::slotted(ion-icon[slot=start]),
|
|
466
461
|
:host(.button-small) ::slotted(ion-icon[slot=end]),
|
|
467
462
|
:host(.button-small) ::slotted(ion-icon[slot=icon-only]),
|
|
468
463
|
:host(.button-large) ::slotted(ion-icon[slot=start]),
|
|
469
464
|
:host(.button-large) ::slotted(ion-icon[slot=end]),
|
|
470
|
-
:host(.button-large) ::slotted(ion-icon[slot=icon-only])
|
|
471
|
-
:host(.button-xlarge) ::slotted(ion-icon[slot=start]),
|
|
472
|
-
:host(.button-xlarge) ::slotted(ion-icon[slot=end]),
|
|
473
|
-
:host(.button-xlarge) ::slotted(ion-icon[slot=icon-only]) {
|
|
465
|
+
:host(.button-large) ::slotted(ion-icon[slot=icon-only]) {
|
|
474
466
|
font-size: inherit;
|
|
475
467
|
}
|
|
476
468
|
|
|
@@ -491,16 +483,10 @@ ion-ripple-effect {
|
|
|
491
483
|
height: var(--ion-space-500, 20px);
|
|
492
484
|
}
|
|
493
485
|
|
|
494
|
-
:host(.button-xlarge) ::slotted(ion-spinner) {
|
|
495
|
-
width: var(--ion-space-600, 24px);
|
|
496
|
-
height: var(--ion-space-600, 24px);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
486
|
:host(.button-soft) {
|
|
500
487
|
--border-radius: var(--ion-border-radius-200, 8px);
|
|
501
488
|
}
|
|
502
489
|
|
|
503
|
-
:host(.button-soft.button-xsmall),
|
|
504
490
|
:host(.button-soft.button-small) {
|
|
505
491
|
--border-radius: var(--ion-border-radius-100, 4px);
|
|
506
492
|
}
|
|
@@ -549,8 +535,6 @@ ion-ripple-effect {
|
|
|
549
535
|
font-size: var(--ion-font-size-500, 1.25rem);
|
|
550
536
|
}
|
|
551
537
|
|
|
552
|
-
:host(.button-xsmall) ::slotted(ion-icon[slot=start]),
|
|
553
|
-
:host(.button-xsmall) ::slotted(ion-spinner[slot=start]),
|
|
554
538
|
:host(.button-small) ::slotted(ion-icon[slot=start]),
|
|
555
539
|
:host(.button-small) ::slotted(ion-spinner[slot=start]) {
|
|
556
540
|
-webkit-margin-end: var(--ion-space-200, 8px);
|
|
@@ -564,15 +548,11 @@ ion-ripple-effect {
|
|
|
564
548
|
}
|
|
565
549
|
|
|
566
550
|
:host(.button-large) ::slotted(ion-icon[slot=start]),
|
|
567
|
-
:host(.button-large) ::slotted(ion-spinner[slot=start])
|
|
568
|
-
:host(.button-xlarge) ::slotted(ion-icon[slot=start]),
|
|
569
|
-
:host(.button-xlarge) ::slotted(ion-spinner[slot=start]) {
|
|
551
|
+
:host(.button-large) ::slotted(ion-spinner[slot=start]) {
|
|
570
552
|
-webkit-margin-end: var(--ion-space-300, 12px);
|
|
571
553
|
margin-inline-end: var(--ion-space-300, 12px);
|
|
572
554
|
}
|
|
573
555
|
|
|
574
|
-
:host(.button-xsmall) ::slotted(ion-icon[slot=end]),
|
|
575
|
-
:host(.button-xsmall) ::slotted(ion-spinner[slot=end]),
|
|
576
556
|
:host(.button-small) ::slotted(ion-icon[slot=end]),
|
|
577
557
|
:host(.button-small) ::slotted(ion-spinner[slot=end]) {
|
|
578
558
|
-webkit-margin-start: var(--ion-space-200, 8px);
|
|
@@ -586,9 +566,7 @@ ion-ripple-effect {
|
|
|
586
566
|
}
|
|
587
567
|
|
|
588
568
|
:host(.button-large) ::slotted(ion-icon[slot=end]),
|
|
589
|
-
:host(.button-large) ::slotted(ion-spinner[slot=end])
|
|
590
|
-
:host(.button-xlarge) ::slotted(ion-icon[slot=end]),
|
|
591
|
-
:host(.button-xlarge) ::slotted(ion-spinner[slot=end]) {
|
|
569
|
+
:host(.button-large) ::slotted(ion-spinner[slot=end]) {
|
|
592
570
|
-webkit-margin-start: var(--ion-space-300, 12px);
|
|
593
571
|
margin-inline-start: var(--ion-space-300, 12px);
|
|
594
572
|
}
|
|
@@ -134,17 +134,13 @@ export class Button {
|
|
|
134
134
|
return shape;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
*
|
|
137
|
+
* Set the size based if the button is inside of an item, the default size is "small"
|
|
138
138
|
*/
|
|
139
139
|
getSize() {
|
|
140
|
-
const theme = getIonTheme(this);
|
|
141
140
|
const { size } = this;
|
|
142
141
|
if (size === undefined && this.inItem) {
|
|
143
142
|
return 'small';
|
|
144
143
|
}
|
|
145
|
-
if ((theme === 'ios' || theme === 'md') && (size === 'xsmall' || size === 'xlarge')) {
|
|
146
|
-
return undefined;
|
|
147
|
-
}
|
|
148
144
|
return size;
|
|
149
145
|
}
|
|
150
146
|
/**
|
|
@@ -239,7 +235,7 @@ export class Button {
|
|
|
239
235
|
{
|
|
240
236
|
type !== 'button' && this.renderHiddenButton();
|
|
241
237
|
}
|
|
242
|
-
return (h(Host, { key: '
|
|
238
|
+
return (h(Host, { key: '0bf1e71eaa0c83463f8e3fff957e2c0075118682', onClick: this.handleClick, "aria-disabled": disabled ? 'true' : null, class: createColorClasses(color, {
|
|
243
239
|
[theme]: true,
|
|
244
240
|
[buttonType]: true,
|
|
245
241
|
[`${buttonType}-${expand}`]: expand !== undefined,
|
|
@@ -254,7 +250,7 @@ export class Button {
|
|
|
254
250
|
'button-disabled': disabled,
|
|
255
251
|
'ion-activatable': true,
|
|
256
252
|
'ion-focusable': true,
|
|
257
|
-
}) }, h(TagType, Object.assign({ key: '
|
|
253
|
+
}) }, h(TagType, Object.assign({ key: 'e1604d905028ce0f27d4e6f85561f584571a56c8' }, attrs, { class: "button-native", part: "native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur }, inheritedAttributes), h("span", { key: '8b214709be527a06060466bc975f2d9a86ca41a4', class: "button-inner" }, h("slot", { key: '5da7b52ab234de43493c0bcda7631681368a30b8', name: "icon-only", onSlotchange: this.slotChanged }), h("slot", { key: 'ef9edc0381cf2255f99437678d350e178f516850', name: "start" }), h("slot", { key: '1b45c07d88aa1a91af63570bf533e607c61edb00' }), h("slot", { key: '1c3bcba3c81ee9a97d5ee5c888b19e9bdcd4ba75', name: "end" })), mode === 'md' && h("ion-ripple-effect", { key: 'c225e2919d973775d1e1c2434a3660cb01fce42c', type: this.rippleType }))));
|
|
258
254
|
}
|
|
259
255
|
static get is() { return "ion-button"; }
|
|
260
256
|
static get encapsulation() { return "shadow"; }
|
|
@@ -484,8 +480,8 @@ export class Button {
|
|
|
484
480
|
"type": "string",
|
|
485
481
|
"mutable": false,
|
|
486
482
|
"complexType": {
|
|
487
|
-
"original": "'
|
|
488
|
-
"resolved": "\"default\" | \"large\" | \"small\" |
|
|
483
|
+
"original": "'small' | 'default' | 'large'",
|
|
484
|
+
"resolved": "\"default\" | \"large\" | \"small\" | undefined",
|
|
489
485
|
"references": {}
|
|
490
486
|
},
|
|
491
487
|
"required": false,
|
|
@@ -115,26 +115,10 @@ Do not edit directly, this file was auto-generated.
|
|
|
115
115
|
line-height: var(--ion-font-line-height-700, 28px);
|
|
116
116
|
text-decoration: none;
|
|
117
117
|
text-transform: none;
|
|
118
|
-
padding-left: 0;
|
|
119
|
-
padding-right: 0;
|
|
120
|
-
padding-top: var(--padding-top);
|
|
121
|
-
padding-bottom: var(--padding-bottom);
|
|
122
118
|
box-sizing: border-box;
|
|
123
119
|
pointer-events: none;
|
|
124
120
|
}
|
|
125
121
|
|
|
126
|
-
:host-context(ion-toolbar) {
|
|
127
|
-
top: 0;
|
|
128
|
-
position: absolute;
|
|
129
|
-
width: 100%;
|
|
130
|
-
height: 100%;
|
|
131
|
-
transform: translateZ(0);
|
|
132
|
-
z-index: -1;
|
|
133
|
-
}
|
|
134
|
-
:host-context(ion-toolbar) {
|
|
135
|
-
inset-inline-start: 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
122
|
:host(.title-large) {
|
|
139
123
|
font-size: var(--ion-font-size-700, 1.75rem);
|
|
140
124
|
font-weight: var(--ion-font-weight-medium, 500);
|
|
@@ -176,8 +176,7 @@ Do not edit directly, this file was auto-generated.
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
.toolbar-content {
|
|
179
|
-
flex:
|
|
180
|
-
order: 3;
|
|
179
|
+
flex: 1 1 auto;
|
|
181
180
|
min-width: 0;
|
|
182
181
|
}
|
|
183
182
|
|
|
@@ -188,11 +187,15 @@ Do not edit directly, this file was auto-generated.
|
|
|
188
187
|
padding-bottom: 0;
|
|
189
188
|
}
|
|
190
189
|
|
|
190
|
+
::slotted(ion-buttons) {
|
|
191
|
+
gap: var(--ion-space-200, 8px);
|
|
192
|
+
}
|
|
193
|
+
|
|
191
194
|
::slotted(ion-title) {
|
|
192
|
-
-webkit-padding-start: var(--
|
|
193
|
-
padding-inline-start: var(--
|
|
194
|
-
-webkit-padding-end: var(--
|
|
195
|
-
padding-inline-end: var(--
|
|
195
|
+
-webkit-padding-start: var(--ion-space-200, 8px);
|
|
196
|
+
padding-inline-start: var(--ion-space-200, 8px);
|
|
197
|
+
-webkit-padding-end: var(--ion-space-200, 8px);
|
|
198
|
+
padding-inline-end: var(--ion-space-200, 8px);
|
|
196
199
|
}
|
|
197
200
|
|
|
198
201
|
:host(.toolbar-title-default) ::slotted(ion-title) {
|
|
@@ -206,28 +209,30 @@ Do not edit directly, this file was auto-generated.
|
|
|
206
209
|
padding-inline-end: var(--ion-space-400, 16px);
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
order: 4;
|
|
212
|
+
:host(.has-end-content) slot[name=end],
|
|
213
|
+
:host(.show-end) slot[name=end] {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex: 0 0 var(--start-end-size, 0);
|
|
216
|
+
justify-content: flex-end;
|
|
215
217
|
text-align: end;
|
|
216
218
|
}
|
|
217
219
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
:host(.has-start-content) slot[name=start],
|
|
221
|
+
:host(.show-start) slot[name=start] {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex: 0 0 var(--start-end-size, 0);
|
|
220
224
|
}
|
|
221
225
|
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
:host(.has-primary-content) slot[name=primary],
|
|
227
|
+
:host(.show-primary) slot[name=primary] {
|
|
224
228
|
display: flex;
|
|
225
|
-
flex:
|
|
226
|
-
|
|
229
|
+
flex: 0 0 var(--primary-secondary-size, 0);
|
|
230
|
+
justify-content: flex-end;
|
|
231
|
+
text-align: end;
|
|
227
232
|
}
|
|
228
233
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
:host(.has-secondary-content) slot[name=secondary],
|
|
235
|
+
:host(.show-secondary) slot[name=secondary] {
|
|
236
|
+
display: flex;
|
|
237
|
+
flex: 0 0 var(--primary-secondary-size, 0);
|
|
233
238
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { forceUpdate, h, Host } from "@stencil/core";
|
|
5
5
|
import { createColorClasses, hostContext } from "../../utils/theme";
|
|
6
6
|
import { getIonTheme } from "../../global/ionic-global";
|
|
7
7
|
/**
|
|
@@ -38,6 +38,131 @@ export class Toolbar {
|
|
|
38
38
|
if (lastButtons) {
|
|
39
39
|
lastButtons.classList.add('buttons-last-slot');
|
|
40
40
|
}
|
|
41
|
+
this.updateSlotClasses();
|
|
42
|
+
}
|
|
43
|
+
componentDidLoad() {
|
|
44
|
+
this.updateSlotClasses();
|
|
45
|
+
this.updateSlotWidths();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Updates the CSS custom properties for slot widths
|
|
49
|
+
* This ensures that slots shown by their met conditions
|
|
50
|
+
* have a minimum width matching their required slot
|
|
51
|
+
*/
|
|
52
|
+
updateSlotWidths(tries = 0) {
|
|
53
|
+
// Set timeout to try to execute after everything is rendered
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
// Attempt to measure and update
|
|
56
|
+
const success = this.measureAndUpdateSlots();
|
|
57
|
+
// If not all measurements were successful, try again in 100 ms
|
|
58
|
+
// cap recursion at 5 tries for safety
|
|
59
|
+
if (!success && tries < 5) {
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
this.updateSlotWidths(tries + 1);
|
|
62
|
+
}, 100);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Measure the widths of the slots and update the CSS custom properties
|
|
68
|
+
* for the minimum width of each pair of slots based on the largest width in each pair.
|
|
69
|
+
* Returns whether we successfully measured all of the slots we expect to have content.
|
|
70
|
+
* If not, the content probably hasn't rendered yet and we need to try again.
|
|
71
|
+
*/
|
|
72
|
+
measureAndUpdateSlots() {
|
|
73
|
+
// Define the relationship between slots based on the conditions array
|
|
74
|
+
// Group slots that should have the same width
|
|
75
|
+
const slotPairs = [
|
|
76
|
+
{ name: 'start-end', slots: ['start', 'end'] },
|
|
77
|
+
{ name: 'primary-secondary', slots: ['primary', 'secondary'] },
|
|
78
|
+
];
|
|
79
|
+
// First, measure all slot widths
|
|
80
|
+
const slotWidths = new Map();
|
|
81
|
+
let allMeasurementsSuccessful = true;
|
|
82
|
+
// Measure all slots with content
|
|
83
|
+
const slots = ['start', 'end', 'primary', 'secondary'];
|
|
84
|
+
slots.forEach((slot) => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (this.el.classList.contains(`has-${slot}-content`)) {
|
|
87
|
+
const slotElement = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`slot[name="${slot}"]`);
|
|
88
|
+
if (slotElement) {
|
|
89
|
+
const width = slotElement.offsetWidth;
|
|
90
|
+
if (width > 0) {
|
|
91
|
+
slotWidths.set(slot, width);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
allMeasurementsSuccessful = false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
// Then set the CSS custom properties based on the largest width in each pair
|
|
100
|
+
slotPairs.forEach(({ name, slots }) => {
|
|
101
|
+
// Find the maximum width among the slots in this pair
|
|
102
|
+
let maxWidth = 0;
|
|
103
|
+
let hasAnyContent = false;
|
|
104
|
+
slots.forEach((slot) => {
|
|
105
|
+
var _a;
|
|
106
|
+
if (slotWidths.has(slot)) {
|
|
107
|
+
hasAnyContent = true;
|
|
108
|
+
maxWidth = Math.max(maxWidth, (_a = slotWidths.get(slot)) !== null && _a !== void 0 ? _a : 0);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
// If at least one slot in the pair has content, set the min-width for the pair
|
|
112
|
+
if (hasAnyContent && maxWidth > 0) {
|
|
113
|
+
// Set a single CSS variable for the pair
|
|
114
|
+
this.el.style.setProperty(`--${name}-size`, `${maxWidth}px`);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return allMeasurementsSuccessful;
|
|
118
|
+
}
|
|
119
|
+
updateSlotClasses() {
|
|
120
|
+
// Check if slots have content
|
|
121
|
+
const slots = ['start', 'end', 'primary', 'secondary'];
|
|
122
|
+
const classesToAdd = [];
|
|
123
|
+
const classesToRemove = [];
|
|
124
|
+
slots.forEach((slot) => {
|
|
125
|
+
const slotHasContent = this.hasSlotContent(slot);
|
|
126
|
+
const slotClass = `has-${slot}-content`;
|
|
127
|
+
if (slotHasContent) {
|
|
128
|
+
classesToAdd.push(slotClass);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
classesToRemove.push(slotClass);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
// Force visibilities in certain conditions. This works by adding a class to the toolbar
|
|
135
|
+
// named `show-{slot}`. This class will be added if the toolbar has the required slots
|
|
136
|
+
// and does not have any of the excluded slots, otherwise it will be removed.
|
|
137
|
+
// This is useful to enforce centering of the toolbar content when there are different amounts
|
|
138
|
+
// of slots on either side of the toolbar.
|
|
139
|
+
const conditions = [
|
|
140
|
+
{ name: 'end', requiredSlots: ['start'], excludeSlots: ['end', 'primary'] },
|
|
141
|
+
{ name: 'start', requiredSlots: ['end'], excludeSlots: ['start', 'secondary'] },
|
|
142
|
+
{ name: 'secondary', requiredSlots: ['primary'], excludeSlots: ['secondary', 'start'] },
|
|
143
|
+
{ name: 'primary', requiredSlots: ['secondary'], excludeSlots: ['primary', 'end'] },
|
|
144
|
+
];
|
|
145
|
+
conditions.forEach((condition) => {
|
|
146
|
+
const hasRequiredSlots = condition.requiredSlots.every((slot) => classesToAdd.includes(`has-${slot}-content`));
|
|
147
|
+
const hasExcludedSlots = condition.excludeSlots.some((slot) => classesToAdd.includes(`has-${slot}-content`));
|
|
148
|
+
const className = `show-${condition.name}`;
|
|
149
|
+
if (hasRequiredSlots && !hasExcludedSlots) {
|
|
150
|
+
classesToAdd.push(className);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
classesToRemove.push(className);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// Add classes to the toolbar element
|
|
157
|
+
this.el.classList.add(...classesToAdd);
|
|
158
|
+
this.el.classList.remove(...classesToRemove);
|
|
159
|
+
// Update slot widths after classes have been updated
|
|
160
|
+
this.updateSlotWidths();
|
|
161
|
+
}
|
|
162
|
+
hasSlotContent(slotName) {
|
|
163
|
+
var _a;
|
|
164
|
+
const slotNode = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`slot[name="${slotName}"]`);
|
|
165
|
+
return !!slotNode && slotNode.assignedNodes().length > 0;
|
|
41
166
|
}
|
|
42
167
|
childrenStyle(ev) {
|
|
43
168
|
ev.stopPropagation();
|
|
@@ -64,13 +189,13 @@ export class Toolbar {
|
|
|
64
189
|
render() {
|
|
65
190
|
const theme = getIonTheme(this);
|
|
66
191
|
const childStyles = {};
|
|
67
|
-
this.childrenStyles.forEach((
|
|
68
|
-
Object.assign(childStyles,
|
|
192
|
+
this.childrenStyles.forEach((style) => {
|
|
193
|
+
Object.assign(childStyles, style);
|
|
69
194
|
});
|
|
70
|
-
return (h(Host, { key: '
|
|
195
|
+
return (h(Host, { key: '9cf12f7133f19ef24ec4818e5334850b7315b602', class: Object.assign(Object.assign({}, createColorClasses(this.color, {
|
|
71
196
|
[theme]: true,
|
|
72
197
|
'in-toolbar': hostContext('ion-toolbar', this.el),
|
|
73
|
-
})) }, h("div", { key: '
|
|
198
|
+
})), childStyles) }, h("div", { key: 'ba137a3b6cc68902ec93b469968885de6746a7e6', class: "toolbar-background", part: "background" }), h("div", { key: 'd3a278f4d7e50a1b3c93a8e9412df81e6e6387bc', class: "toolbar-container", part: "container" }, h("slot", { key: '7ac00536a8fe5ecbf695d21a51f62079ff0262e0', name: "start", onSlotchange: () => this.updateSlotClasses }), h("slot", { key: 'f641e8b71125023f7dd71f4080c6b37ef33f9639', name: "secondary", onSlotchange: () => this.updateSlotClasses }), h("div", { key: 'a785319051166ac161069df114387ccc3e499822', class: "toolbar-content", part: "content" }, h("slot", { key: '4930bfc6a5425f923f4f23c27f9312d506463b0c' })), h("slot", { key: 'd0e78019181ff220bfb54110bdbe0d12be330374', name: "primary", onSlotchange: () => this.updateSlotClasses }), h("slot", { key: '5c4a39a0764001ca90e96ccb9a9b7eba158fe5e6', name: "end", onSlotchange: () => this.updateSlotClasses }))));
|
|
74
199
|
}
|
|
75
200
|
static get is() { return "ion-toolbar"; }
|
|
76
201
|
static get encapsulation() { return "shadow"; }
|
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2025-
|
|
2
|
+
"timestamp": "2025-05-13T11:56:47",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.20.0",
|
|
@@ -4119,16 +4119,16 @@
|
|
|
4119
4119
|
},
|
|
4120
4120
|
{
|
|
4121
4121
|
"name": "size",
|
|
4122
|
-
"type": "\"large\" | \"medium\" | \"small\" |
|
|
4122
|
+
"type": "\"large\" | \"medium\" | \"small\" | undefined",
|
|
4123
4123
|
"complexType": {
|
|
4124
|
-
"original": "'
|
|
4125
|
-
"resolved": "\"large\" | \"medium\" | \"small\" |
|
|
4124
|
+
"original": "'small' | 'medium' | 'large'",
|
|
4125
|
+
"resolved": "\"large\" | \"medium\" | \"small\" | undefined",
|
|
4126
4126
|
"references": {}
|
|
4127
4127
|
},
|
|
4128
4128
|
"mutable": false,
|
|
4129
4129
|
"attr": "size",
|
|
4130
4130
|
"reflectToAttr": false,
|
|
4131
|
-
"docs": "Set to `\"
|
|
4131
|
+
"docs": "Set to `\"small\"` for a small badge.\nSet to `\"medium\"` for a medium badge.\nSet to `\"large\"` for a large badge, when it is empty (no text or icon).\n\nDefaults to `\"small\"` for the `ionic` theme, undefined for all other themes.",
|
|
4132
4132
|
"docsTags": [],
|
|
4133
4133
|
"values": [
|
|
4134
4134
|
{
|
|
@@ -4143,18 +4143,6 @@
|
|
|
4143
4143
|
"value": "small",
|
|
4144
4144
|
"type": "string"
|
|
4145
4145
|
},
|
|
4146
|
-
{
|
|
4147
|
-
"value": "xlarge",
|
|
4148
|
-
"type": "string"
|
|
4149
|
-
},
|
|
4150
|
-
{
|
|
4151
|
-
"value": "xsmall",
|
|
4152
|
-
"type": "string"
|
|
4153
|
-
},
|
|
4154
|
-
{
|
|
4155
|
-
"value": "xxsmall",
|
|
4156
|
-
"type": "string"
|
|
4157
|
-
},
|
|
4158
4146
|
{
|
|
4159
4147
|
"type": "undefined"
|
|
4160
4148
|
}
|
|
@@ -5531,10 +5519,10 @@
|
|
|
5531
5519
|
},
|
|
5532
5520
|
{
|
|
5533
5521
|
"name": "size",
|
|
5534
|
-
"type": "\"default\" | \"large\" | \"small\" |
|
|
5522
|
+
"type": "\"default\" | \"large\" | \"small\" | undefined",
|
|
5535
5523
|
"complexType": {
|
|
5536
|
-
"original": "'
|
|
5537
|
-
"resolved": "\"default\" | \"large\" | \"small\" |
|
|
5524
|
+
"original": "'small' | 'default' | 'large'",
|
|
5525
|
+
"resolved": "\"default\" | \"large\" | \"small\" | undefined",
|
|
5538
5526
|
"references": {}
|
|
5539
5527
|
},
|
|
5540
5528
|
"mutable": false,
|
|
@@ -5555,14 +5543,6 @@
|
|
|
5555
5543
|
"value": "small",
|
|
5556
5544
|
"type": "string"
|
|
5557
5545
|
},
|
|
5558
|
-
{
|
|
5559
|
-
"value": "xlarge",
|
|
5560
|
-
"type": "string"
|
|
5561
|
-
},
|
|
5562
|
-
{
|
|
5563
|
-
"value": "xsmall",
|
|
5564
|
-
"type": "string"
|
|
5565
|
-
},
|
|
5566
5546
|
{
|
|
5567
5547
|
"type": "undefined"
|
|
5568
5548
|
}
|