@ionic/core 9.0.11-dev.11793874002.1c88a1d0 → 9.0.11-dev.11793889755.165fa328

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.
@@ -12,7 +12,7 @@ require('./index-DkNv4J_i.js');
12
12
  require('./focus-visible-DGPRKkcx.js');
13
13
  require('./dir-Bma_9Lqh.js');
14
14
 
15
- const accordionIonicCss = () => `:host{display:block;position:relative;width:100%;overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host{position:relative}:host::after{-webkit-margin-start:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-margin-end:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-end:var(--token-space-400, var(--token-scale-400, 16px));right:0;left:0;bottom:0;display:block;position:absolute;height:var(--token-border-size-025, var(--token-scale-025, 1px));background-color:var(--token-border-default, var(--token-primitives-neutral-400, #d0d7df));content:"";z-index:3}:host(.accordion-last)::after{display:none}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}::slotted(ion-item[slot=header]){--border-radius:inherit;--color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px));--inner-border-width:var(--token-scale-0, 0px);--min-height:var(--token-scale-700, 28px);--padding-top:var(--token-space-300, var(--token-scale-300, 12px));--padding-end:var(--token-space-400, var(--token-scale-400, 16px));--padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));--padding-start:var(--token-space-400, var(--token-scale-400, 16px));--background-activated:var(--token-bg-neutral-subtlest-press, var(--token-primitives-neutral-200, #ebeef2));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-450, 1.125rem);font-weight:var(--token-font-weight-medium, 500);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.555556}#content-wrapper{-webkit-padding-start:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-padding-end:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-end:var(--token-space-400, var(--token-scale-400, 16px));padding-top:var(--token-space-300, var(--token-scale-300, 12px));padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-350, 0.875rem);font-weight:var(--token-font-weight-regular, 400);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.714286;color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528))}:host(.accordion-disabled)::before{border-radius:inherit;right:0;left:0;top:0;bottom:0;position:absolute;background-color:var(--token-state-disabled, rgba(255, 255, 255, 0.6));content:"";pointer-events:none;z-index:2}`;
15
+ const accordionIonicCss = () => `:host{display:block;position:relative;width:100%;overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host{position:relative}:host::after{-webkit-margin-start:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-margin-end:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-end:var(--token-space-400, var(--token-scale-400, 16px));right:0;left:0;bottom:0;display:block;position:absolute;height:var(--token-border-size-025, var(--token-scale-025, 1px));background-color:var(--token-border-default, var(--token-primitives-neutral-400, #d0d7df));content:"";z-index:3}:host(.accordion-last)::after{display:none}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}::slotted(ion-item[slot=header]){--border-radius:inherit;--color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px));--inner-border-width:var(--token-scale-0, 0px);--min-height:var(--token-scale-700, 28px);--padding-top:var(--token-space-300, var(--token-scale-300, 12px));--padding-end:var(--token-space-400, var(--token-scale-400, 16px));--padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));--padding-start:var(--token-space-400, var(--token-scale-400, 16px));--background-activated:var(--token-bg-neutral-subtlest-press, var(--token-primitives-neutral-200, #ebeef2));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-450, 1.125rem);font-weight:var(--token-font-weight-medium, 500);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.555556}#content-wrapper{-webkit-padding-start:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-padding-end:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-end:var(--token-space-400, var(--token-scale-400, 16px));padding-top:var(--token-space-300, var(--token-scale-300, 12px));padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-350, 0.875rem);font-weight:var(--token-font-weight-regular, 400);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.714286;color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528))}:host(.accordion-disabled) ::slotted(ion-item[slot=header]){--color:var(--token-text-disabled, var(--token-primitives-neutral-500, #9fa5ad))}:host(.accordion-disabled) #content-wrapper{color:var(--token-text-disabled, var(--token-primitives-neutral-500, #9fa5ad))}`;
16
16
 
17
17
  const accordionIosCss = () => `:host{display:block;position:relative;width:100%;overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host{background-color:var(--ion-background-color, #ffffff)}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}`;
18
18
 
@@ -1623,7 +1623,6 @@ const Toolbar = class {
1623
1623
  ];
1624
1624
  this.showClasses = ['show-start', 'show-end', 'show-primary', 'show-secondary'];
1625
1625
  this.slotSizeVars = ['--start-end-size', '--primary-secondary-size'];
1626
- this.hasLoaded = false;
1627
1626
  }
1628
1627
  componentWillLoad() {
1629
1628
  const buttons = Array.from(this.el.querySelectorAll('ion-buttons'));
@@ -1642,23 +1641,9 @@ const Toolbar = class {
1642
1641
  }
1643
1642
  this.updateSlotClasses();
1644
1643
  }
1645
- connectedCallback() {
1646
- /**
1647
- * The resize observer is stopped when the toolbar is removed from the DOM.
1648
- * If the toolbar is added back (for example, when it is moved), start it again.
1649
- * On the first connection the toolbar has not rendered yet, so this is left
1650
- * to componentDidLoad.
1651
- */
1652
- if (this.hasLoaded) {
1653
- this.updateSlotClasses();
1654
- }
1655
- }
1656
1644
  componentDidLoad() {
1657
- this.hasLoaded = true;
1658
1645
  this.updateSlotClasses();
1659
- }
1660
- disconnectedCallback() {
1661
- this.stopObservingSlotSizes();
1646
+ this.updateSlotWidths();
1662
1647
  }
1663
1648
  titlePlacementChanged() {
1664
1649
  this.updateSlotClasses();
@@ -1678,67 +1663,26 @@ const Toolbar = class {
1678
1663
  * Updates the CSS custom properties for slot widths
1679
1664
  * This ensures that slots shown by their met conditions
1680
1665
  * have a minimum width matching their required slot
1681
- *
1682
- * The slotted content is watched with a ResizeObserver instead of being
1683
- * measured after a timeout:
1684
- * - The observer callback runs after layout and before paint, so the slot
1685
- * widths are set in the same frame the content is first laid out. The
1686
- * title is already centered when it is first painted and does not move.
1687
- * - The callback runs again whenever the slotted content changes size,
1688
- * for example when a button is added or removed, or when a hidden
1689
- * toolbar becomes visible.
1690
1666
  */
1691
- updateSlotWidths() {
1692
- // Stop watching the previous content before watching the current one.
1693
- this.stopObservingSlotSizes();
1694
- // Browsers without ResizeObserver can only measure once.
1695
- if (typeof ResizeObserver === 'undefined') {
1696
- this.measureAndUpdateSlots();
1697
- return;
1698
- }
1699
- const elementsToObserve = [];
1700
- const slots = ['start', 'end', 'primary', 'secondary'];
1701
- slots.forEach((slot) => {
1702
- if (this.el.classList.contains(`has-${slot}-content`)) {
1703
- elementsToObserve.push(...this.getSlottedElements(slot));
1667
+ updateSlotWidths(tries = 0) {
1668
+ // Set timeout to try to execute after everything is rendered
1669
+ setTimeout(() => {
1670
+ // Attempt to measure and update
1671
+ const success = this.measureAndUpdateSlots();
1672
+ // If not all measurements were successful, try again in 100 ms
1673
+ // cap recursion at 5 tries for safety
1674
+ if (!success && tries < 5) {
1675
+ setTimeout(() => {
1676
+ this.updateSlotWidths(tries + 1);
1677
+ }, 100);
1704
1678
  }
1705
1679
  });
1706
- if (elementsToObserve.length === 0) {
1707
- return;
1708
- }
1709
- /**
1710
- * The observer also calls the callback once right after observing
1711
- * an element, which takes care of the first measurement.
1712
- */
1713
- const observer = new ResizeObserver(() => this.measureAndUpdateSlots());
1714
- elementsToObserve.forEach((element) => observer.observe(element));
1715
- this.slotResizeObserver = observer;
1716
- }
1717
- /**
1718
- * Stops watching the slotted content for size changes.
1719
- */
1720
- stopObservingSlotSizes() {
1721
- if (this.slotResizeObserver) {
1722
- this.slotResizeObserver.disconnect();
1723
- this.slotResizeObserver = undefined;
1724
- }
1725
- }
1726
- /**
1727
- * Returns the elements assigned to the given slot of the toolbar.
1728
- */
1729
- getSlottedElements(slotName) {
1730
- const slotElement = this.el.shadowRoot?.querySelector(`slot[name="${slotName}"]`);
1731
- if (!slotElement) {
1732
- return [];
1733
- }
1734
- return slotElement.assignedElements({ flatten: true });
1735
1680
  }
1736
1681
  /**
1737
1682
  * Measure the widths of the slots and update the CSS custom properties
1738
1683
  * for the minimum width of each pair of slots based on the largest width in each pair.
1739
1684
  * Returns whether we successfully measured all of the slots we expect to have content.
1740
- * If not, the content probably hasn't rendered yet, and the ResizeObserver
1741
- * measures again once it does.
1685
+ * If not, the content probably hasn't rendered yet and we need to try again.
1742
1686
  */
1743
1687
  measureAndUpdateSlots() {
1744
1688
  // Define the relationship between slots based on the conditions array
@@ -1747,13 +1691,6 @@ const Toolbar = class {
1747
1691
  { name: 'start-end', slots: ['start', 'end'] },
1748
1692
  { name: 'primary-secondary', slots: ['primary', 'secondary'] },
1749
1693
  ];
1750
- /**
1751
- * Once a size property is set, the slots cannot be narrower than it.
1752
- * Remove the properties first so each slot is measured at the width of
1753
- * its content, which lets the slots shrink when their content does.
1754
- * This runs before paint, so the slots are never painted without a size.
1755
- */
1756
- this.slotSizeVars.forEach((cssVar) => this.el.style.removeProperty(cssVar));
1757
1694
  // First, measure all slot widths
1758
1695
  const slotWidths = new Map();
1759
1696
  let allMeasurementsSuccessful = true;
@@ -1812,8 +1749,6 @@ const Toolbar = class {
1812
1749
  * Removes all slot visibility classes and slot width CSS variables.
1813
1750
  */
1814
1751
  removeSlotClasses() {
1815
- // The slot widths are no longer used, so there is nothing to watch.
1816
- this.stopObservingSlotSizes();
1817
1752
  this.el.classList.remove(...this.slotClasses, ...this.showClasses);
1818
1753
  this.slotSizeVars.forEach((cssVar) => this.el.style.removeProperty(cssVar));
1819
1754
  }
@@ -1898,14 +1833,14 @@ const Toolbar = class {
1898
1833
  Object.assign(childStyles, style);
1899
1834
  });
1900
1835
  const titlePlacement = this.getTitlePlacement();
1901
- return (index.h(index.Host, { key: '2ee4ee2329ba499bd3fe24eb58f8954c86d39b01', class: {
1836
+ return (index.h(index.Host, { key: '3b97d3de5b1910257170355995eb7a50a2b6dcc4', class: {
1902
1837
  ...theme.createColorClasses(this.color, {
1903
1838
  [theme$1]: true,
1904
1839
  'in-toolbar': theme.hostContext('ion-toolbar', this.el),
1905
1840
  [`toolbar-title-placement-${titlePlacement}`]: true,
1906
1841
  }),
1907
1842
  ...childStyles,
1908
- } }, index.h("div", { key: '68da02a622db1ed136a31700421c5da005ae3884', class: "toolbar-background", part: "background" }), index.h("div", { key: 'cefcad22e28e1468de024a0cbe477464a872dc66', class: "toolbar-container", part: "container" }, index.h("slot", { key: '9ebfc464b5c32c6d2b5c81a0a0c415effa15ce3c', name: "start", onSlotchange: () => this.updateSlotClasses() }), index.h("slot", { key: '55a07aa0000e1b02814f7a01ad1610d1d723f442', name: "secondary", onSlotchange: () => this.updateSlotClasses() }), index.h("div", { key: '51d1e06e0463788b5f794831faadd305aa8bca75', class: "toolbar-content", part: "content" }, index.h("slot", { key: '6982cc6886f76cf43d78e3f0e9243dc05f67d34c' })), index.h("slot", { key: 'b00b9b9b28c1637a04781ef88b5d9474fb5c0647', name: "primary", onSlotchange: () => this.updateSlotClasses() }), index.h("slot", { key: '4fce3b9b17f7775d0ba14cd5185e500753b4976e', name: "end", onSlotchange: () => this.updateSlotClasses() }))));
1843
+ } }, index.h("div", { key: '26f85390aa62f118e585fd8560fba0620b30fd51', class: "toolbar-background", part: "background" }), index.h("div", { key: '57e32773d5642dde7f5d7cca9aaceb41b4d800bd', class: "toolbar-container", part: "container" }, index.h("slot", { key: '5429b3f898703339749a55af6bb28d7e4d969679', name: "start", onSlotchange: () => this.updateSlotClasses }), index.h("slot", { key: 'c5565f7020f52a1f075d9c6908ace042d488642f', name: "secondary", onSlotchange: () => this.updateSlotClasses }), index.h("div", { key: '2d083bcd57512041321a68b43d6b90144eb20166', class: "toolbar-content", part: "content" }, index.h("slot", { key: 'eb8abc0b9b96c699355891fbd0d284094cde7632' })), index.h("slot", { key: 'ca66f2dcce1f5382ed40a120cf32f759597a11ad', name: "primary", onSlotchange: () => this.updateSlotClasses }), index.h("slot", { key: '19e3eb792d45c21404fe48f119d68248b5d7dca7', name: "end", onSlotchange: () => this.updateSlotClasses }))));
1909
1844
  }
1910
1845
  get el() { return index.getElement(this); }
1911
1846
  static get watchers() { return {
@@ -185,15 +185,10 @@
185
185
  color: var(--token-text-default, var(--token-primitives-neutral-1200, #242528));
186
186
  }
187
187
 
188
- :host(.accordion-disabled)::before {
189
- border-radius: inherit;
190
- right: 0;
191
- left: 0;
192
- top: 0;
193
- bottom: 0;
194
- position: absolute;
195
- background-color: var(--token-state-disabled, rgba(255, 255, 255, 0.6));
196
- content: "";
197
- pointer-events: none;
198
- z-index: 2;
188
+ :host(.accordion-disabled) ::slotted(ion-item[slot=header]) {
189
+ --color: var(--token-text-disabled, var(--token-primitives-neutral-500, #9fa5ad));
190
+ }
191
+
192
+ :host(.accordion-disabled) #content-wrapper {
193
+ color: var(--token-text-disabled, var(--token-primitives-neutral-500, #9fa5ad));
199
194
  }
@@ -29,7 +29,6 @@ export class Toolbar {
29
29
  ];
30
30
  this.showClasses = ['show-start', 'show-end', 'show-primary', 'show-secondary'];
31
31
  this.slotSizeVars = ['--start-end-size', '--primary-secondary-size'];
32
- this.hasLoaded = false;
33
32
  }
34
33
  componentWillLoad() {
35
34
  const buttons = Array.from(this.el.querySelectorAll('ion-buttons'));
@@ -48,23 +47,9 @@ export class Toolbar {
48
47
  }
49
48
  this.updateSlotClasses();
50
49
  }
51
- connectedCallback() {
52
- /**
53
- * The resize observer is stopped when the toolbar is removed from the DOM.
54
- * If the toolbar is added back (for example, when it is moved), start it again.
55
- * On the first connection the toolbar has not rendered yet, so this is left
56
- * to componentDidLoad.
57
- */
58
- if (this.hasLoaded) {
59
- this.updateSlotClasses();
60
- }
61
- }
62
50
  componentDidLoad() {
63
- this.hasLoaded = true;
64
51
  this.updateSlotClasses();
65
- }
66
- disconnectedCallback() {
67
- this.stopObservingSlotSizes();
52
+ this.updateSlotWidths();
68
53
  }
69
54
  titlePlacementChanged() {
70
55
  this.updateSlotClasses();
@@ -84,67 +69,26 @@ export class Toolbar {
84
69
  * Updates the CSS custom properties for slot widths
85
70
  * This ensures that slots shown by their met conditions
86
71
  * have a minimum width matching their required slot
87
- *
88
- * The slotted content is watched with a ResizeObserver instead of being
89
- * measured after a timeout:
90
- * - The observer callback runs after layout and before paint, so the slot
91
- * widths are set in the same frame the content is first laid out. The
92
- * title is already centered when it is first painted and does not move.
93
- * - The callback runs again whenever the slotted content changes size,
94
- * for example when a button is added or removed, or when a hidden
95
- * toolbar becomes visible.
96
72
  */
97
- updateSlotWidths() {
98
- // Stop watching the previous content before watching the current one.
99
- this.stopObservingSlotSizes();
100
- // Browsers without ResizeObserver can only measure once.
101
- if (typeof ResizeObserver === 'undefined') {
102
- this.measureAndUpdateSlots();
103
- return;
104
- }
105
- const elementsToObserve = [];
106
- const slots = ['start', 'end', 'primary', 'secondary'];
107
- slots.forEach((slot) => {
108
- if (this.el.classList.contains(`has-${slot}-content`)) {
109
- elementsToObserve.push(...this.getSlottedElements(slot));
73
+ updateSlotWidths(tries = 0) {
74
+ // Set timeout to try to execute after everything is rendered
75
+ setTimeout(() => {
76
+ // Attempt to measure and update
77
+ const success = this.measureAndUpdateSlots();
78
+ // If not all measurements were successful, try again in 100 ms
79
+ // cap recursion at 5 tries for safety
80
+ if (!success && tries < 5) {
81
+ setTimeout(() => {
82
+ this.updateSlotWidths(tries + 1);
83
+ }, 100);
110
84
  }
111
85
  });
112
- if (elementsToObserve.length === 0) {
113
- return;
114
- }
115
- /**
116
- * The observer also calls the callback once right after observing
117
- * an element, which takes care of the first measurement.
118
- */
119
- const observer = new ResizeObserver(() => this.measureAndUpdateSlots());
120
- elementsToObserve.forEach((element) => observer.observe(element));
121
- this.slotResizeObserver = observer;
122
- }
123
- /**
124
- * Stops watching the slotted content for size changes.
125
- */
126
- stopObservingSlotSizes() {
127
- if (this.slotResizeObserver) {
128
- this.slotResizeObserver.disconnect();
129
- this.slotResizeObserver = undefined;
130
- }
131
- }
132
- /**
133
- * Returns the elements assigned to the given slot of the toolbar.
134
- */
135
- getSlottedElements(slotName) {
136
- const slotElement = this.el.shadowRoot?.querySelector(`slot[name="${slotName}"]`);
137
- if (!slotElement) {
138
- return [];
139
- }
140
- return slotElement.assignedElements({ flatten: true });
141
86
  }
142
87
  /**
143
88
  * Measure the widths of the slots and update the CSS custom properties
144
89
  * for the minimum width of each pair of slots based on the largest width in each pair.
145
90
  * Returns whether we successfully measured all of the slots we expect to have content.
146
- * If not, the content probably hasn't rendered yet, and the ResizeObserver
147
- * measures again once it does.
91
+ * If not, the content probably hasn't rendered yet and we need to try again.
148
92
  */
149
93
  measureAndUpdateSlots() {
150
94
  // Define the relationship between slots based on the conditions array
@@ -153,13 +97,6 @@ export class Toolbar {
153
97
  { name: 'start-end', slots: ['start', 'end'] },
154
98
  { name: 'primary-secondary', slots: ['primary', 'secondary'] },
155
99
  ];
156
- /**
157
- * Once a size property is set, the slots cannot be narrower than it.
158
- * Remove the properties first so each slot is measured at the width of
159
- * its content, which lets the slots shrink when their content does.
160
- * This runs before paint, so the slots are never painted without a size.
161
- */
162
- this.slotSizeVars.forEach((cssVar) => this.el.style.removeProperty(cssVar));
163
100
  // First, measure all slot widths
164
101
  const slotWidths = new Map();
165
102
  let allMeasurementsSuccessful = true;
@@ -218,8 +155,6 @@ export class Toolbar {
218
155
  * Removes all slot visibility classes and slot width CSS variables.
219
156
  */
220
157
  removeSlotClasses() {
221
- // The slot widths are no longer used, so there is nothing to watch.
222
- this.stopObservingSlotSizes();
223
158
  this.el.classList.remove(...this.slotClasses, ...this.showClasses);
224
159
  this.slotSizeVars.forEach((cssVar) => this.el.style.removeProperty(cssVar));
225
160
  }
@@ -304,14 +239,14 @@ export class Toolbar {
304
239
  Object.assign(childStyles, style);
305
240
  });
306
241
  const titlePlacement = this.getTitlePlacement();
307
- return (h(Host, { key: '2ee4ee2329ba499bd3fe24eb58f8954c86d39b01', class: {
242
+ return (h(Host, { key: '3b97d3de5b1910257170355995eb7a50a2b6dcc4', class: {
308
243
  ...createColorClasses(this.color, {
309
244
  [theme]: true,
310
245
  'in-toolbar': hostContext('ion-toolbar', this.el),
311
246
  [`toolbar-title-placement-${titlePlacement}`]: true,
312
247
  }),
313
248
  ...childStyles,
314
- } }, h("div", { key: '68da02a622db1ed136a31700421c5da005ae3884', class: "toolbar-background", part: "background" }), h("div", { key: 'cefcad22e28e1468de024a0cbe477464a872dc66', class: "toolbar-container", part: "container" }, h("slot", { key: '9ebfc464b5c32c6d2b5c81a0a0c415effa15ce3c', name: "start", onSlotchange: () => this.updateSlotClasses() }), h("slot", { key: '55a07aa0000e1b02814f7a01ad1610d1d723f442', name: "secondary", onSlotchange: () => this.updateSlotClasses() }), h("div", { key: '51d1e06e0463788b5f794831faadd305aa8bca75', class: "toolbar-content", part: "content" }, h("slot", { key: '6982cc6886f76cf43d78e3f0e9243dc05f67d34c' })), h("slot", { key: 'b00b9b9b28c1637a04781ef88b5d9474fb5c0647', name: "primary", onSlotchange: () => this.updateSlotClasses() }), h("slot", { key: '4fce3b9b17f7775d0ba14cd5185e500753b4976e', name: "end", onSlotchange: () => this.updateSlotClasses() }))));
249
+ } }, h("div", { key: '26f85390aa62f118e585fd8560fba0620b30fd51', class: "toolbar-background", part: "background" }), h("div", { key: '57e32773d5642dde7f5d7cca9aaceb41b4d800bd', class: "toolbar-container", part: "container" }, h("slot", { key: '5429b3f898703339749a55af6bb28d7e4d969679', name: "start", onSlotchange: () => this.updateSlotClasses }), h("slot", { key: 'c5565f7020f52a1f075d9c6908ace042d488642f', name: "secondary", onSlotchange: () => this.updateSlotClasses }), h("div", { key: '2d083bcd57512041321a68b43d6b90144eb20166', class: "toolbar-content", part: "content" }, h("slot", { key: 'eb8abc0b9b96c699355891fbd0d284094cde7632' })), h("slot", { key: 'ca66f2dcce1f5382ed40a120cf32f759597a11ad', name: "primary", onSlotchange: () => this.updateSlotClasses }), h("slot", { key: '19e3eb792d45c21404fe48f119d68248b5d7dca7', name: "end", onSlotchange: () => this.updateSlotClasses }))));
315
250
  }
316
251
  static get is() { return "ion-toolbar"; }
317
252
  static get encapsulation() { return "shadow"; }
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2026-11-05T10:23:02",
2
+ "timestamp": "2026-11-05T14:44:45",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.45.2",
@@ -10,7 +10,7 @@ import './index-ZjP4CjeZ.js';
10
10
  import './focus-visible-BYk20Mf5.js';
11
11
  import './dir-Dj4J3LkD.js';
12
12
 
13
- const accordionIonicCss = () => `:host{display:block;position:relative;width:100%;overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host{position:relative}:host::after{-webkit-margin-start:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-margin-end:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-end:var(--token-space-400, var(--token-scale-400, 16px));right:0;left:0;bottom:0;display:block;position:absolute;height:var(--token-border-size-025, var(--token-scale-025, 1px));background-color:var(--token-border-default, var(--token-primitives-neutral-400, #d0d7df));content:"";z-index:3}:host(.accordion-last)::after{display:none}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}::slotted(ion-item[slot=header]){--border-radius:inherit;--color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px));--inner-border-width:var(--token-scale-0, 0px);--min-height:var(--token-scale-700, 28px);--padding-top:var(--token-space-300, var(--token-scale-300, 12px));--padding-end:var(--token-space-400, var(--token-scale-400, 16px));--padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));--padding-start:var(--token-space-400, var(--token-scale-400, 16px));--background-activated:var(--token-bg-neutral-subtlest-press, var(--token-primitives-neutral-200, #ebeef2));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-450, 1.125rem);font-weight:var(--token-font-weight-medium, 500);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.555556}#content-wrapper{-webkit-padding-start:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-padding-end:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-end:var(--token-space-400, var(--token-scale-400, 16px));padding-top:var(--token-space-300, var(--token-scale-300, 12px));padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-350, 0.875rem);font-weight:var(--token-font-weight-regular, 400);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.714286;color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528))}:host(.accordion-disabled)::before{border-radius:inherit;right:0;left:0;top:0;bottom:0;position:absolute;background-color:var(--token-state-disabled, rgba(255, 255, 255, 0.6));content:"";pointer-events:none;z-index:2}`;
13
+ const accordionIonicCss = () => `:host{display:block;position:relative;width:100%;overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host{position:relative}:host::after{-webkit-margin-start:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-margin-end:var(--token-space-400, var(--token-scale-400, 16px));margin-inline-end:var(--token-space-400, var(--token-scale-400, 16px));right:0;left:0;bottom:0;display:block;position:absolute;height:var(--token-border-size-025, var(--token-scale-025, 1px));background-color:var(--token-border-default, var(--token-primitives-neutral-400, #d0d7df));content:"";z-index:3}:host(.accordion-last)::after{display:none}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}::slotted(ion-item[slot=header]){--border-radius:inherit;--color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px));--inner-border-width:var(--token-scale-0, 0px);--min-height:var(--token-scale-700, 28px);--padding-top:var(--token-space-300, var(--token-scale-300, 12px));--padding-end:var(--token-space-400, var(--token-scale-400, 16px));--padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));--padding-start:var(--token-space-400, var(--token-scale-400, 16px));--background-activated:var(--token-bg-neutral-subtlest-press, var(--token-primitives-neutral-200, #ebeef2));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-450, 1.125rem);font-weight:var(--token-font-weight-medium, 500);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.555556}#content-wrapper{-webkit-padding-start:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-start:var(--token-space-400, var(--token-scale-400, 16px));-webkit-padding-end:var(--token-space-400, var(--token-scale-400, 16px));padding-inline-end:var(--token-space-400, var(--token-scale-400, 16px));padding-top:var(--token-space-300, var(--token-scale-300, 12px));padding-bottom:var(--token-space-300, var(--token-scale-300, 12px));font-family:var(--token-font-family, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");font-size:var(--token-font-size-350, 0.875rem);font-weight:var(--token-font-weight-regular, 400);letter-spacing:var(--token-font-letter-spacing-0, 0);line-height:1.714286;color:var(--token-text-default, var(--token-primitives-neutral-1200, #242528))}:host(.accordion-disabled) ::slotted(ion-item[slot=header]){--color:var(--token-text-disabled, var(--token-primitives-neutral-500, #9fa5ad))}:host(.accordion-disabled) #content-wrapper{color:var(--token-text-disabled, var(--token-primitives-neutral-500, #9fa5ad))}`;
14
14
 
15
15
  const accordionIosCss = () => `:host{display:block;position:relative;width:100%;overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host{background-color:var(--ion-background-color, #ffffff)}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}`;
16
16
 
@@ -1621,7 +1621,6 @@ const Toolbar = class {
1621
1621
  ];
1622
1622
  this.showClasses = ['show-start', 'show-end', 'show-primary', 'show-secondary'];
1623
1623
  this.slotSizeVars = ['--start-end-size', '--primary-secondary-size'];
1624
- this.hasLoaded = false;
1625
1624
  }
1626
1625
  componentWillLoad() {
1627
1626
  const buttons = Array.from(this.el.querySelectorAll('ion-buttons'));
@@ -1640,23 +1639,9 @@ const Toolbar = class {
1640
1639
  }
1641
1640
  this.updateSlotClasses();
1642
1641
  }
1643
- connectedCallback() {
1644
- /**
1645
- * The resize observer is stopped when the toolbar is removed from the DOM.
1646
- * If the toolbar is added back (for example, when it is moved), start it again.
1647
- * On the first connection the toolbar has not rendered yet, so this is left
1648
- * to componentDidLoad.
1649
- */
1650
- if (this.hasLoaded) {
1651
- this.updateSlotClasses();
1652
- }
1653
- }
1654
1642
  componentDidLoad() {
1655
- this.hasLoaded = true;
1656
1643
  this.updateSlotClasses();
1657
- }
1658
- disconnectedCallback() {
1659
- this.stopObservingSlotSizes();
1644
+ this.updateSlotWidths();
1660
1645
  }
1661
1646
  titlePlacementChanged() {
1662
1647
  this.updateSlotClasses();
@@ -1676,67 +1661,26 @@ const Toolbar = class {
1676
1661
  * Updates the CSS custom properties for slot widths
1677
1662
  * This ensures that slots shown by their met conditions
1678
1663
  * have a minimum width matching their required slot
1679
- *
1680
- * The slotted content is watched with a ResizeObserver instead of being
1681
- * measured after a timeout:
1682
- * - The observer callback runs after layout and before paint, so the slot
1683
- * widths are set in the same frame the content is first laid out. The
1684
- * title is already centered when it is first painted and does not move.
1685
- * - The callback runs again whenever the slotted content changes size,
1686
- * for example when a button is added or removed, or when a hidden
1687
- * toolbar becomes visible.
1688
1664
  */
1689
- updateSlotWidths() {
1690
- // Stop watching the previous content before watching the current one.
1691
- this.stopObservingSlotSizes();
1692
- // Browsers without ResizeObserver can only measure once.
1693
- if (typeof ResizeObserver === 'undefined') {
1694
- this.measureAndUpdateSlots();
1695
- return;
1696
- }
1697
- const elementsToObserve = [];
1698
- const slots = ['start', 'end', 'primary', 'secondary'];
1699
- slots.forEach((slot) => {
1700
- if (this.el.classList.contains(`has-${slot}-content`)) {
1701
- elementsToObserve.push(...this.getSlottedElements(slot));
1665
+ updateSlotWidths(tries = 0) {
1666
+ // Set timeout to try to execute after everything is rendered
1667
+ setTimeout(() => {
1668
+ // Attempt to measure and update
1669
+ const success = this.measureAndUpdateSlots();
1670
+ // If not all measurements were successful, try again in 100 ms
1671
+ // cap recursion at 5 tries for safety
1672
+ if (!success && tries < 5) {
1673
+ setTimeout(() => {
1674
+ this.updateSlotWidths(tries + 1);
1675
+ }, 100);
1702
1676
  }
1703
1677
  });
1704
- if (elementsToObserve.length === 0) {
1705
- return;
1706
- }
1707
- /**
1708
- * The observer also calls the callback once right after observing
1709
- * an element, which takes care of the first measurement.
1710
- */
1711
- const observer = new ResizeObserver(() => this.measureAndUpdateSlots());
1712
- elementsToObserve.forEach((element) => observer.observe(element));
1713
- this.slotResizeObserver = observer;
1714
- }
1715
- /**
1716
- * Stops watching the slotted content for size changes.
1717
- */
1718
- stopObservingSlotSizes() {
1719
- if (this.slotResizeObserver) {
1720
- this.slotResizeObserver.disconnect();
1721
- this.slotResizeObserver = undefined;
1722
- }
1723
- }
1724
- /**
1725
- * Returns the elements assigned to the given slot of the toolbar.
1726
- */
1727
- getSlottedElements(slotName) {
1728
- const slotElement = this.el.shadowRoot?.querySelector(`slot[name="${slotName}"]`);
1729
- if (!slotElement) {
1730
- return [];
1731
- }
1732
- return slotElement.assignedElements({ flatten: true });
1733
1678
  }
1734
1679
  /**
1735
1680
  * Measure the widths of the slots and update the CSS custom properties
1736
1681
  * for the minimum width of each pair of slots based on the largest width in each pair.
1737
1682
  * Returns whether we successfully measured all of the slots we expect to have content.
1738
- * If not, the content probably hasn't rendered yet, and the ResizeObserver
1739
- * measures again once it does.
1683
+ * If not, the content probably hasn't rendered yet and we need to try again.
1740
1684
  */
1741
1685
  measureAndUpdateSlots() {
1742
1686
  // Define the relationship between slots based on the conditions array
@@ -1745,13 +1689,6 @@ const Toolbar = class {
1745
1689
  { name: 'start-end', slots: ['start', 'end'] },
1746
1690
  { name: 'primary-secondary', slots: ['primary', 'secondary'] },
1747
1691
  ];
1748
- /**
1749
- * Once a size property is set, the slots cannot be narrower than it.
1750
- * Remove the properties first so each slot is measured at the width of
1751
- * its content, which lets the slots shrink when their content does.
1752
- * This runs before paint, so the slots are never painted without a size.
1753
- */
1754
- this.slotSizeVars.forEach((cssVar) => this.el.style.removeProperty(cssVar));
1755
1692
  // First, measure all slot widths
1756
1693
  const slotWidths = new Map();
1757
1694
  let allMeasurementsSuccessful = true;
@@ -1810,8 +1747,6 @@ const Toolbar = class {
1810
1747
  * Removes all slot visibility classes and slot width CSS variables.
1811
1748
  */
1812
1749
  removeSlotClasses() {
1813
- // The slot widths are no longer used, so there is nothing to watch.
1814
- this.stopObservingSlotSizes();
1815
1750
  this.el.classList.remove(...this.slotClasses, ...this.showClasses);
1816
1751
  this.slotSizeVars.forEach((cssVar) => this.el.style.removeProperty(cssVar));
1817
1752
  }
@@ -1896,14 +1831,14 @@ const Toolbar = class {
1896
1831
  Object.assign(childStyles, style);
1897
1832
  });
1898
1833
  const titlePlacement = this.getTitlePlacement();
1899
- return (h(Host, { key: '2ee4ee2329ba499bd3fe24eb58f8954c86d39b01', class: {
1834
+ return (h(Host, { key: '3b97d3de5b1910257170355995eb7a50a2b6dcc4', class: {
1900
1835
  ...createColorClasses(this.color, {
1901
1836
  [theme]: true,
1902
1837
  'in-toolbar': hostContext('ion-toolbar', this.el),
1903
1838
  [`toolbar-title-placement-${titlePlacement}`]: true,
1904
1839
  }),
1905
1840
  ...childStyles,
1906
- } }, h("div", { key: '68da02a622db1ed136a31700421c5da005ae3884', class: "toolbar-background", part: "background" }), h("div", { key: 'cefcad22e28e1468de024a0cbe477464a872dc66', class: "toolbar-container", part: "container" }, h("slot", { key: '9ebfc464b5c32c6d2b5c81a0a0c415effa15ce3c', name: "start", onSlotchange: () => this.updateSlotClasses() }), h("slot", { key: '55a07aa0000e1b02814f7a01ad1610d1d723f442', name: "secondary", onSlotchange: () => this.updateSlotClasses() }), h("div", { key: '51d1e06e0463788b5f794831faadd305aa8bca75', class: "toolbar-content", part: "content" }, h("slot", { key: '6982cc6886f76cf43d78e3f0e9243dc05f67d34c' })), h("slot", { key: 'b00b9b9b28c1637a04781ef88b5d9474fb5c0647', name: "primary", onSlotchange: () => this.updateSlotClasses() }), h("slot", { key: '4fce3b9b17f7775d0ba14cd5185e500753b4976e', name: "end", onSlotchange: () => this.updateSlotClasses() }))));
1841
+ } }, h("div", { key: '26f85390aa62f118e585fd8560fba0620b30fd51', class: "toolbar-background", part: "background" }), h("div", { key: '57e32773d5642dde7f5d7cca9aaceb41b4d800bd', class: "toolbar-container", part: "container" }, h("slot", { key: '5429b3f898703339749a55af6bb28d7e4d969679', name: "start", onSlotchange: () => this.updateSlotClasses }), h("slot", { key: 'c5565f7020f52a1f075d9c6908ace042d488642f', name: "secondary", onSlotchange: () => this.updateSlotClasses }), h("div", { key: '2d083bcd57512041321a68b43d6b90144eb20166', class: "toolbar-content", part: "content" }, h("slot", { key: 'eb8abc0b9b96c699355891fbd0d284094cde7632' })), h("slot", { key: 'ca66f2dcce1f5382ed40a120cf32f759597a11ad', name: "primary", onSlotchange: () => this.updateSlotClasses }), h("slot", { key: '19e3eb792d45c21404fe48f119d68248b5d7dca7', name: "end", onSlotchange: () => this.updateSlotClasses }))));
1907
1842
  }
1908
1843
  get el() { return getElement(this); }
1909
1844
  static get watchers() { return {