@ionic/core 8.8.7-dev.11778599050.191a48e3 → 8.8.7-dev.11778680417.1f9234bd
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/ion-action-sheet.js +1 -1
- package/components/ion-alert.js +1 -1
- package/components/ion-back-button.js +1 -1
- package/components/ion-button.js +1 -1
- package/components/ion-card.js +1 -1
- package/components/ion-chip.js +1 -1
- package/components/ion-col.js +1 -1
- package/components/ion-datetime-button.js +1 -1
- package/components/ion-datetime.js +1 -1
- package/components/ion-fab-button.js +1 -1
- package/components/ion-gallery.d.ts +11 -0
- package/components/ion-gallery.js +4 -0
- package/components/ion-grid.js +1 -1
- package/components/ion-header.js +1 -1
- package/components/ion-img.js +1 -1
- package/components/ion-infinite-scroll-content.js +1 -1
- package/components/ion-infinite-scroll.js +1 -1
- package/components/ion-input-otp.js +1 -1
- package/components/ion-input-password-toggle.js +1 -1
- package/components/ion-input.js +1 -1
- package/components/ion-item-divider.js +1 -1
- package/components/ion-item-group.js +1 -1
- package/components/ion-item-option.js +1 -1
- package/components/ion-item-options.js +1 -1
- package/components/ion-item-sliding.js +1 -1
- package/components/ion-item.js +1 -1
- package/components/ion-label.js +1 -1
- package/components/ion-list-header.js +1 -1
- package/components/ion-list.js +1 -1
- package/components/ion-loading.js +1 -1
- package/components/ion-menu-button.js +1 -1
- package/components/ion-menu-toggle.js +1 -1
- package/components/ion-menu.js +1 -1
- package/components/ion-modal.js +1 -1
- package/components/ion-nav-link.js +1 -1
- package/components/ion-nav.js +1 -1
- package/components/ion-note.js +1 -1
- package/components/ion-picker-column-option.js +1 -1
- package/components/ion-picker-legacy-column.js +1 -1
- package/components/ion-picker-legacy.js +1 -1
- package/components/ion-popover.js +1 -1
- package/components/ion-progress-bar.js +1 -1
- package/components/ion-radio-group.js +1 -1
- package/components/ion-radio.js +1 -1
- package/components/ion-range.js +1 -1
- package/components/ion-refresher-content.js +1 -1
- package/components/ion-refresher.js +1 -1
- package/components/ion-reorder-group.js +1 -1
- package/components/ion-reorder.js +1 -1
- package/components/ion-ripple-effect.js +1 -1
- package/components/ion-router-link.js +1 -1
- package/components/ion-router-outlet.js +1 -1
- package/components/ion-row.js +1 -1
- package/components/ion-searchbar.js +1 -1
- package/components/ion-segment-button.js +1 -1
- package/components/ion-segment-content.js +1 -1
- package/components/ion-segment-view.js +1 -1
- package/components/ion-segment.js +1 -1
- package/components/ion-select-modal.js +1 -1
- package/components/ion-select-option.js +1 -1
- package/components/ion-select-popover.js +1 -1
- package/components/ion-select.js +1 -1
- package/components/ion-skeleton-text.js +1 -1
- package/components/ion-spinner.js +1 -1
- package/components/ion-split-pane.js +1 -1
- package/components/ion-tab-bar.js +1 -1
- package/components/ion-tab-button.js +1 -1
- package/components/ion-tab.js +1 -1
- package/components/ion-tabs.js +1 -1
- package/components/ion-text.js +1 -1
- package/components/ion-textarea.js +1 -1
- package/components/ion-thumbnail.js +1 -1
- package/components/ion-title.js +1 -1
- package/components/ion-toast.js +1 -1
- package/components/ion-toggle.js +1 -1
- package/components/ion-toolbar.js +1 -1
- package/components/p-B2rpt1JV.js +4 -0
- package/components/p-B6zr9RZN.js +4 -0
- package/components/{p-Brxa0j7O.js → p-B71c6yUH.js} +1 -1
- package/components/{p-C2cZvGcF.js → p-BFbsici0.js} +1 -1
- package/components/{p-CoarhFWH.js → p-BLCuPAtN.js} +1 -1
- package/components/{p-GnGGIfCd.js → p-BRWWcnBq.js} +1 -1
- package/components/{p-BfHB6wX_.js → p-BXcCGjEc.js} +1 -1
- package/components/{p-BU8N7ZrK.js → p-BqImG3uk.js} +1 -1
- package/components/{p-D5lMX0xt.js → p-C8ktKu9j.js} +1 -1
- package/components/{p-BhfW3d9j.js → p-CIoAIKEr.js} +1 -1
- package/components/p-CN-WzkJE.js +4 -0
- package/components/{p-CnwZE7CW.js → p-CoFqDNc5.js} +1 -1
- package/components/{p-TpZHKDyk.js → p-DAv9P_LE.js} +1 -1
- package/components/{p-CeYwuysM.js → p-DH_9VCbD.js} +1 -1
- package/components/{p-CdYTq34D.js → p-DTtRWhIZ.js} +1 -1
- package/components/{p-C-_EGKki.js → p-DXUyXgVL.js} +1 -1
- package/components/{p-BTYqyHph.js → p-Di5rHO3q.js} +1 -1
- package/components/{p-D39cV-un.js → p-Dmuy6xyk.js} +1 -1
- package/components/{p-BtAlyZ0b.js → p-IMXp2Inn.js} +1 -1
- package/components/{p-DAeMHNER.js → p-TR4ubkPu.js} +1 -1
- package/dist/cjs/ion-app_8.cjs.entry.js +7 -7
- package/dist/cjs/ion-avatar_3.cjs.entry.js +2 -2
- package/dist/cjs/ion-col_3.cjs.entry.js +8 -6
- package/dist/cjs/ion-datetime_3.cjs.entry.js +4 -4
- package/dist/cjs/ion-gallery.cjs.entry.js +490 -0
- package/dist/cjs/ion-img.cjs.entry.js +2 -2
- package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-input-otp.cjs.entry.js +3 -3
- package/dist/cjs/ion-input-password-toggle.cjs.entry.js +3 -3
- package/dist/cjs/ion-input.cjs.entry.js +4 -4
- package/dist/cjs/ion-item-option_3.cjs.entry.js +4 -4
- package/dist/cjs/ion-item_8.cjs.entry.js +12 -12
- package/dist/cjs/ion-loading.cjs.entry.js +2 -2
- package/dist/cjs/ion-menu_3.cjs.entry.js +6 -6
- package/dist/cjs/ion-modal.cjs.entry.js +4 -4
- package/dist/cjs/ion-nav_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-picker-column-option.cjs.entry.js +2 -2
- package/dist/cjs/ion-popover.cjs.entry.js +2 -2
- package/dist/cjs/ion-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/ion-radio_2.cjs.entry.js +5 -5
- package/dist/cjs/ion-range.cjs.entry.js +3 -3
- package/dist/cjs/ion-refresher_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-reorder_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-ripple-effect.cjs.entry.js +1 -1
- package/dist/cjs/ion-route_4.cjs.entry.js +2 -2
- package/dist/cjs/ion-searchbar.cjs.entry.js +4 -4
- package/dist/cjs/ion-segment-content.cjs.entry.js +1 -1
- package/dist/cjs/ion-segment-view.cjs.entry.js +2 -2
- package/dist/cjs/ion-segment_2.cjs.entry.js +4 -4
- package/dist/cjs/ion-select-modal.cjs.entry.js +1 -1
- package/dist/cjs/ion-select_3.cjs.entry.js +6 -6
- package/dist/cjs/ion-spinner.cjs.entry.js +1 -1
- package/dist/cjs/ion-split-pane.cjs.entry.js +3 -2
- package/dist/cjs/ion-tab-bar_2.cjs.entry.js +4 -4
- package/dist/cjs/ion-tab_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-text.cjs.entry.js +2 -2
- package/dist/cjs/ion-textarea.cjs.entry.js +3 -3
- package/dist/cjs/ion-toast.cjs.entry.js +2 -2
- package/dist/cjs/ion-toggle.cjs.entry.js +3 -3
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/col/col.js +3 -2
- package/dist/collection/components/gallery/gallery-constants.js +12 -0
- package/dist/collection/components/gallery/gallery-interface.js +1 -0
- package/dist/collection/components/gallery/gallery.css +100 -0
- package/dist/collection/components/gallery/gallery.js +575 -0
- package/dist/collection/components/gallery/test/utils.js +100 -0
- package/dist/collection/components/grid/grid.js +2 -2
- package/dist/collection/components/header/header.js +2 -2
- package/dist/collection/components/img/img.js +2 -2
- package/dist/collection/components/infinite-scroll/infinite-scroll.js +1 -1
- package/dist/collection/components/infinite-scroll-content/infinite-scroll-content.js +2 -2
- package/dist/collection/components/input/input.js +4 -4
- package/dist/collection/components/input-otp/input-otp.js +3 -3
- package/dist/collection/components/input-password-toggle/input-password-toggle.js +3 -3
- package/dist/collection/components/item-divider/item-divider.js +2 -2
- package/dist/collection/components/item-group/item-group.js +1 -1
- package/dist/collection/components/item-option/item-option.js +2 -2
- package/dist/collection/components/item-options/item-options.js +1 -1
- package/dist/collection/components/item-sliding/item-sliding.js +1 -1
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/list/list.js +1 -1
- package/dist/collection/components/list-header/list-header.js +2 -2
- package/dist/collection/components/loading/loading.js +2 -2
- package/dist/collection/components/menu/menu.js +2 -2
- package/dist/collection/components/menu-button/menu-button.js +2 -2
- package/dist/collection/components/menu-toggle/menu-toggle.js +2 -2
- package/dist/collection/components/modal/modal.js +4 -4
- package/dist/collection/components/nav/nav.js +1 -1
- package/dist/collection/components/nav-link/nav-link.js +1 -1
- package/dist/collection/components/note/note.js +2 -2
- package/dist/collection/components/picker-column-option/picker-column-option.js +2 -2
- package/dist/collection/components/picker-legacy/picker.js +2 -2
- package/dist/collection/components/picker-legacy-column/picker-column.js +2 -2
- package/dist/collection/components/popover/popover.js +2 -2
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/radio/radio.js +3 -3
- package/dist/collection/components/radio-group/radio-group.js +2 -2
- package/dist/collection/components/range/range.js +3 -3
- package/dist/collection/components/refresher/refresher.js +1 -1
- package/dist/collection/components/refresher-content/refresher-content.js +2 -2
- package/dist/collection/components/reorder/reorder.js +2 -2
- package/dist/collection/components/reorder-group/reorder-group.js +1 -1
- package/dist/collection/components/ripple-effect/ripple-effect.js +1 -1
- package/dist/collection/components/router-link/router-link.js +2 -2
- package/dist/collection/components/router-outlet/router-outlet.js +1 -1
- package/dist/collection/components/row/row.js +2 -2
- package/dist/collection/components/searchbar/searchbar.js +4 -4
- package/dist/collection/components/segment/segment.js +2 -2
- package/dist/collection/components/segment-button/segment-button.js +2 -2
- package/dist/collection/components/segment-content/segment-content.js +1 -1
- package/dist/collection/components/segment-view/segment-view.js +2 -2
- package/dist/collection/components/select/select.js +3 -3
- package/dist/collection/components/select-modal/select-modal.js +1 -1
- package/dist/collection/components/select-option/select-option.js +1 -1
- package/dist/collection/components/select-popover/select-popover.js +2 -2
- package/dist/collection/components/skeleton-text/skeleton-text.js +2 -2
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/split-pane/split-pane.js +3 -2
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-bar/tab-bar.js +2 -2
- package/dist/collection/components/tab-button/tab-button.js +2 -2
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/text/text.js +2 -2
- package/dist/collection/components/textarea/textarea.js +3 -3
- package/dist/collection/components/thumbnail/thumbnail.js +2 -2
- package/dist/collection/components/title/title.js +2 -2
- package/dist/collection/components/toast/toast.js +2 -2
- package/dist/collection/components/toggle/toggle.js +3 -3
- package/dist/collection/components/toolbar/toolbar.js +2 -2
- package/dist/collection/utils/css-value-validation.js +25 -0
- package/dist/collection/utils/media.js +1 -0
- package/dist/docs.json +256 -1
- package/dist/esm/ion-app_8.entry.js +7 -7
- package/dist/esm/ion-avatar_3.entry.js +2 -2
- package/dist/esm/ion-col_3.entry.js +8 -6
- package/dist/esm/ion-datetime_3.entry.js +4 -4
- package/dist/esm/ion-gallery.entry.js +488 -0
- package/dist/esm/ion-img.entry.js +2 -2
- package/dist/esm/ion-infinite-scroll_2.entry.js +3 -3
- package/dist/esm/ion-input-otp.entry.js +3 -3
- package/dist/esm/ion-input-password-toggle.entry.js +3 -3
- package/dist/esm/ion-input.entry.js +4 -4
- package/dist/esm/ion-item-option_3.entry.js +4 -4
- package/dist/esm/ion-item_8.entry.js +12 -12
- package/dist/esm/ion-loading.entry.js +2 -2
- package/dist/esm/ion-menu_3.entry.js +6 -6
- package/dist/esm/ion-modal.entry.js +4 -4
- package/dist/esm/ion-nav_2.entry.js +2 -2
- package/dist/esm/ion-picker-column-option.entry.js +2 -2
- package/dist/esm/ion-popover.entry.js +2 -2
- package/dist/esm/ion-progress-bar.entry.js +1 -1
- package/dist/esm/ion-radio_2.entry.js +5 -5
- package/dist/esm/ion-range.entry.js +3 -3
- package/dist/esm/ion-refresher_2.entry.js +3 -3
- package/dist/esm/ion-reorder_2.entry.js +3 -3
- package/dist/esm/ion-ripple-effect.entry.js +1 -1
- package/dist/esm/ion-route_4.entry.js +2 -2
- package/dist/esm/ion-searchbar.entry.js +4 -4
- package/dist/esm/ion-segment-content.entry.js +1 -1
- package/dist/esm/ion-segment-view.entry.js +2 -2
- package/dist/esm/ion-segment_2.entry.js +4 -4
- package/dist/esm/ion-select-modal.entry.js +1 -1
- package/dist/esm/ion-select_3.entry.js +6 -6
- package/dist/esm/ion-spinner.entry.js +1 -1
- package/dist/esm/ion-split-pane.entry.js +3 -2
- package/dist/esm/ion-tab-bar_2.entry.js +4 -4
- package/dist/esm/ion-tab_2.entry.js +3 -3
- package/dist/esm/ion-text.entry.js +2 -2
- package/dist/esm/ion-textarea.entry.js +3 -3
- package/dist/esm/ion-toast.entry.js +2 -2
- package/dist/esm/ion-toggle.entry.js +3 -3
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/html.html-data.json +74 -0
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-96549175.entry.js → p-00c0bd38.entry.js} +1 -1
- package/dist/ionic/{p-192e7509.entry.js → p-15e3e8f5.entry.js} +1 -1
- package/dist/ionic/{p-5ac21be2.entry.js → p-1709b0aa.entry.js} +1 -1
- package/dist/ionic/{p-2bf931ae.entry.js → p-1c2c1869.entry.js} +1 -1
- package/dist/ionic/{p-3bf01c2c.entry.js → p-1c4de46b.entry.js} +1 -1
- package/dist/ionic/p-1e1c8d61.entry.js +4 -0
- package/dist/ionic/p-2aa7567e.entry.js +4 -0
- package/dist/ionic/{p-bc5713f7.entry.js → p-2ad79c23.entry.js} +1 -1
- package/dist/ionic/{p-5a3fc28e.entry.js → p-2f0073af.entry.js} +1 -1
- package/dist/ionic/{p-833910ae.entry.js → p-35b144f5.entry.js} +1 -1
- package/dist/ionic/{p-59b4f8d0.entry.js → p-3f79f594.entry.js} +1 -1
- package/dist/ionic/p-4079cee3.entry.js +4 -0
- package/dist/ionic/{p-f061fcb7.entry.js → p-48026d15.entry.js} +1 -1
- package/dist/ionic/{p-4091ad21.entry.js → p-50b61fab.entry.js} +1 -1
- package/dist/ionic/{p-8516eb69.entry.js → p-50cd2d57.entry.js} +1 -1
- package/dist/ionic/{p-50d90690.entry.js → p-5274f999.entry.js} +1 -1
- package/dist/ionic/{p-3093958a.entry.js → p-586d4270.entry.js} +1 -1
- package/dist/ionic/{p-6991ffa2.entry.js → p-7054a1b9.entry.js} +1 -1
- package/dist/ionic/{p-b8b20b7e.entry.js → p-71b6014c.entry.js} +1 -1
- package/dist/ionic/{p-9b9b1450.entry.js → p-72491468.entry.js} +1 -1
- package/dist/ionic/{p-c2894f9e.entry.js → p-76307d10.entry.js} +1 -1
- package/dist/ionic/{p-f740c359.entry.js → p-7d5057c4.entry.js} +1 -1
- package/dist/ionic/{p-091a95ea.entry.js → p-83c693c4.entry.js} +1 -1
- package/dist/ionic/{p-2aa44c65.entry.js → p-8537b2fb.entry.js} +1 -1
- package/dist/ionic/{p-02ecc684.entry.js → p-90e653e3.entry.js} +1 -1
- package/dist/ionic/p-96001281.entry.js +4 -0
- package/dist/ionic/{p-98c34fd7.entry.js → p-9d789053.entry.js} +1 -1
- package/dist/ionic/{p-1faf270d.entry.js → p-a9fb086b.entry.js} +1 -1
- package/dist/ionic/{p-e7f216ae.entry.js → p-ae667493.entry.js} +1 -1
- package/dist/ionic/{p-edb0b0c8.entry.js → p-b2fe6c1c.entry.js} +1 -1
- package/dist/ionic/{p-2effd05d.entry.js → p-b3c9f19c.entry.js} +1 -1
- package/dist/ionic/{p-6c8c37c2.entry.js → p-b653f4c2.entry.js} +1 -1
- package/dist/ionic/{p-4e46439d.entry.js → p-bd71a4a7.entry.js} +1 -1
- package/dist/ionic/p-bf972309.entry.js +4 -0
- package/dist/ionic/{p-8180abe5.entry.js → p-c10fa162.entry.js} +1 -1
- package/dist/ionic/{p-d954cd19.entry.js → p-d4ed5710.entry.js} +1 -1
- package/dist/ionic/{p-228b6a9c.entry.js → p-d6299c37.entry.js} +1 -1
- package/dist/ionic/{p-4610e447.entry.js → p-e18d3fdb.entry.js} +1 -1
- package/dist/ionic/{p-4c864eb2.entry.js → p-fad05840.entry.js} +1 -1
- package/dist/types/components/gallery/gallery-constants.d.ts +9 -0
- package/dist/types/components/gallery/gallery-interface.d.ts +10 -0
- package/dist/types/components/gallery/gallery.d.ts +171 -0
- package/dist/types/components/gallery/test/utils.d.ts +2 -0
- package/dist/types/components.d.ts +75 -0
- package/dist/types/utils/css-value-validation.d.ts +12 -0
- package/hydrate/index.js +628 -126
- package/hydrate/index.mjs +628 -126
- package/package.json +1 -1
- package/components/p-CnOTQxHB.js +0 -4
- package/components/p-XFUFdPrc.js +0 -4
- package/components/p-tYh73xQe.js +0 -4
- package/dist/ionic/p-308beb71.entry.js +0 -4
- package/dist/ionic/p-64341e32.entry.js +0 -4
- package/dist/ionic/p-76d0e7ef.entry.js +0 -4
- package/dist/ionic/p-ae4ea663.entry.js +0 -4
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
var index = require('./index-CzcLEdQ5.js');
|
|
7
|
+
var helpers = require('./helpers-DJYxKN5U.js');
|
|
8
|
+
var ionicGlobal = require('./ionic-global-CSEbHD_F.js');
|
|
9
|
+
require('./focus-visible-BIj-I3-C.js');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Helpers for validating user-supplied CSS values using regular expressions, without
|
|
13
|
+
* relying on browser CSS APIs.
|
|
14
|
+
*/
|
|
15
|
+
// Matches `<length>` (`<number>` + unit identifier) or `<percentage>` (`<number>%`).
|
|
16
|
+
const LENGTH_PERCENTAGE_PATTERN = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:%|[a-z]+)$/i;
|
|
17
|
+
// Matches simple `calc` / `min` / `max` / `clamp(...)` functions.
|
|
18
|
+
const MATH_FUNCTION_PATTERN = /^(calc|min|max|clamp)\s*\(.+\)$/i;
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether `value` matches the [length-percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/length-percentage)
|
|
21
|
+
* syntax. Accepts `<length>` (`<number>` + unit identifier) or `<percentage>` (`<number>%`).
|
|
22
|
+
* Also supports simple `calc` / `min` / `max` / `clamp(...)` functions.
|
|
23
|
+
*
|
|
24
|
+
* @param value String value to validate.
|
|
25
|
+
*/
|
|
26
|
+
function isValidLengthPercentage(value) {
|
|
27
|
+
const v = value.trim();
|
|
28
|
+
if (!v) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return MATH_FUNCTION_PATTERN.test(v) || LENGTH_PERCENTAGE_PATTERN.test(v);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DEFAULT_COLUMNS = {
|
|
35
|
+
xs: 2,
|
|
36
|
+
sm: 3,
|
|
37
|
+
md: 4,
|
|
38
|
+
lg: 6,
|
|
39
|
+
xl: 8,
|
|
40
|
+
xxl: 10,
|
|
41
|
+
};
|
|
42
|
+
const DEFAULT_GAP = '16px';
|
|
43
|
+
|
|
44
|
+
const galleryCss = () => `:host{display:grid;grid-template-columns:repeat(var(--internal-gallery-columns, 2), minmax(0, 1fr))}:host(.gallery-layout-uniform){gap:var(--internal-gallery-gap, 16px)}:host(.gallery-layout-uniform) ::slotted(*){aspect-ratio:1/1}:host(.gallery-layout-masonry){-ms-flex-align:start;align-items:start;-webkit-column-gap:var(--internal-gallery-gap, 16px);-moz-column-gap:var(--internal-gallery-gap, 16px);column-gap:var(--internal-gallery-gap, 16px);row-gap:0;grid-auto-rows:2px}:host(.gallery-layout-masonry) ::slotted(*){display:block;min-height:unset;margin-bottom:var(--internal-gallery-gap, 16px)}::slotted(*){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;width:100%}::slotted(img){display:block;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center}`;
|
|
45
|
+
|
|
46
|
+
// TODO(FW-7285): Replace with global breakpoints
|
|
47
|
+
const BREAKPOINTS = {
|
|
48
|
+
xs: 0,
|
|
49
|
+
sm: 576,
|
|
50
|
+
md: 768,
|
|
51
|
+
lg: 992,
|
|
52
|
+
xl: 1200,
|
|
53
|
+
xxl: 1400,
|
|
54
|
+
};
|
|
55
|
+
const BREAKPOINT_ORDER = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
56
|
+
const Gallery = class {
|
|
57
|
+
constructor(hostRef) {
|
|
58
|
+
index.registerInstance(this, hostRef);
|
|
59
|
+
// Keep track of whether we've warned about invalid columns, invalid gap,
|
|
60
|
+
// and unused order properties to avoid duplicate warnings on screen resize.
|
|
61
|
+
this.hasWarnedInvalidColumns = false;
|
|
62
|
+
this.hasWarnedInvalidGap = false;
|
|
63
|
+
this.hasWarnedUnusedOrder = false;
|
|
64
|
+
/**
|
|
65
|
+
* The visual layout of the gallery. When `uniform`, rows take up the height
|
|
66
|
+
* of the tallest item and are spaced evenly across the gallery. Additionally,
|
|
67
|
+
* items will have an aspect ratio of 1/1, forcing them to be square unless a
|
|
68
|
+
* height is explicitly set. When `masonry`, items will be positioned under each
|
|
69
|
+
* other with only the specified gap between them.
|
|
70
|
+
*/
|
|
71
|
+
this.layout = 'uniform';
|
|
72
|
+
/**
|
|
73
|
+
* The number of columns to display. Can be set as a number or an object of
|
|
74
|
+
* breakpoint values (e.g. `{ xs: 2, sm: 3, md: 4 }`).
|
|
75
|
+
*/
|
|
76
|
+
this.columns = DEFAULT_COLUMNS;
|
|
77
|
+
/**
|
|
78
|
+
* The space between gallery items. Accepts valid CSS [length-percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/length-percentage)
|
|
79
|
+
* values like `16px`, `1rem`, `20%`, math functions like `calc(10px + 20%)`,
|
|
80
|
+
* or numbers (treated as pixel values). Can also be set as a breakpoint map
|
|
81
|
+
* (e.g. `{ xs: '8px', sm: '1rem', md: '24px' }`). Does not accept
|
|
82
|
+
* space-separated values or CSS keyword values like `inherit`, `auto`, etc.
|
|
83
|
+
*/
|
|
84
|
+
this.gap = DEFAULT_GAP;
|
|
85
|
+
/**
|
|
86
|
+
* Listen for the slotchange event on the slot.
|
|
87
|
+
* When the layout is `masonry`, this listener is used to schedule a resize
|
|
88
|
+
* of the masonry grid when the slot changes. This is useful for when items
|
|
89
|
+
* are added or removed from the gallery.
|
|
90
|
+
*/
|
|
91
|
+
this.onSlotChange = () => {
|
|
92
|
+
this.scheduleMasonryResize();
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Measure the host and children, then compute masonry placement.
|
|
96
|
+
*/
|
|
97
|
+
this.resizeMasonryGrid = () => {
|
|
98
|
+
this.masonryRaf = undefined;
|
|
99
|
+
if (this.layout !== 'masonry') {
|
|
100
|
+
this.clearMasonryStyles();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const width = this.el.getBoundingClientRect().width;
|
|
104
|
+
const columns = this.getColumnsForWidth(width);
|
|
105
|
+
// Skip masonry placement when width/columns does not resolve
|
|
106
|
+
// to a valid breakpoint column count.
|
|
107
|
+
if (columns === undefined) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const styles = getComputedStyle(this.el);
|
|
111
|
+
const rowHeight = parseFloat(styles.getPropertyValue('grid-auto-rows')) || 0;
|
|
112
|
+
const rowGap = parseFloat(styles.getPropertyValue('row-gap')) || parseFloat(styles.getPropertyValue('gap')) || 0;
|
|
113
|
+
const items = this.getItems();
|
|
114
|
+
this.layoutMasonry(items, rowHeight, rowGap, columns);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
propertiesChanged() {
|
|
118
|
+
this.updateResponsiveStyles(true);
|
|
119
|
+
this.scheduleMasonryResize();
|
|
120
|
+
// Wait until the next animation frame to warn about unused order
|
|
121
|
+
// to avoid erroneous warnings when the layout and order are updated
|
|
122
|
+
// in the same frame.
|
|
123
|
+
helpers.raf(() => {
|
|
124
|
+
this.warnUnusedOrder();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
componentDidLoad() {
|
|
128
|
+
this.updateResponsiveStyles(true);
|
|
129
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
130
|
+
this.updateResponsiveStyles();
|
|
131
|
+
this.scheduleMasonryResize();
|
|
132
|
+
});
|
|
133
|
+
this.resizeObserver.observe(this.el);
|
|
134
|
+
this.scheduleMasonryResize();
|
|
135
|
+
this.warnUnusedOrder();
|
|
136
|
+
}
|
|
137
|
+
disconnectedCallback() {
|
|
138
|
+
var _a;
|
|
139
|
+
if (this.masonryRaf !== undefined) {
|
|
140
|
+
cancelAnimationFrame(this.masonryRaf);
|
|
141
|
+
this.masonryRaf = undefined;
|
|
142
|
+
}
|
|
143
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
144
|
+
this.resizeObserver = undefined;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Listen for the load event on child elements.
|
|
148
|
+
* When the layout is `masonry`, this listener is used to schedule a resize
|
|
149
|
+
* of the masonry grid when the child elements load. This is useful for when
|
|
150
|
+
* images take time to load.
|
|
151
|
+
*/
|
|
152
|
+
onChildLoad(ev) {
|
|
153
|
+
if (this.layout !== 'masonry') {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const target = ev.target;
|
|
157
|
+
if (target !== null && this.el.contains(target)) {
|
|
158
|
+
this.scheduleMasonryResize();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Batch masonry measurements to a single animation frame.
|
|
163
|
+
* This avoids repeated sync layouts during rapid resize/load/slot changes.
|
|
164
|
+
*/
|
|
165
|
+
scheduleMasonryResize() {
|
|
166
|
+
if (this.layout !== 'masonry') {
|
|
167
|
+
this.clearMasonryStyles();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (this.masonryRaf !== undefined) {
|
|
171
|
+
cancelAnimationFrame(this.masonryRaf);
|
|
172
|
+
}
|
|
173
|
+
this.masonryRaf = requestAnimationFrame(this.resizeMasonryGrid);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Normalize a single column value (`columns` as a number, string, or one entry from
|
|
177
|
+
* a `columns` breakpoint map) to a positive integer. Returns `undefined` when
|
|
178
|
+
* the input cannot be interpreted as a finite number.
|
|
179
|
+
*/
|
|
180
|
+
sanitizeColumns(columns) {
|
|
181
|
+
if (columns === undefined) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
const numericColumns = typeof columns === 'number' ? columns : Number(columns);
|
|
185
|
+
if (!Number.isFinite(numericColumns) || !Number.isInteger(numericColumns) || numericColumns <= 0) {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
return numericColumns;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Normalize a single gap value (`gap` as a number, string, or one entry from
|
|
192
|
+
* a `gap` breakpoint map) to a CSS length string. Returns `undefined` when
|
|
193
|
+
* the input cannot be interpreted as a valid CSS length.
|
|
194
|
+
*/
|
|
195
|
+
sanitizeGap(gap) {
|
|
196
|
+
if (gap === undefined) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
const normalizedGap = typeof gap === 'string' ? gap.trim() : gap;
|
|
200
|
+
if (normalizedGap === '' || typeof normalizedGap === 'object') {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const numericGap = Number(normalizedGap);
|
|
204
|
+
if (Number.isFinite(numericGap)) {
|
|
205
|
+
return numericGap < 0 ? undefined : `${numericGap}px`;
|
|
206
|
+
}
|
|
207
|
+
if (typeof normalizedGap !== 'string') {
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
const isValidCssLength = isValidLengthPercentage(normalizedGap);
|
|
211
|
+
return isValidCssLength ? normalizedGap : undefined;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Check if the value is a breakpoint map object.
|
|
215
|
+
*/
|
|
216
|
+
isBreakpointMap(value) {
|
|
217
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Check if the breakpoint map has any invalid values for the provided sanitizer.
|
|
221
|
+
*/
|
|
222
|
+
hasInvalidBreakpointMap(breakpointMap, sanitizeValue) {
|
|
223
|
+
for (const breakpoint of BREAKPOINT_ORDER) {
|
|
224
|
+
const value = breakpointMap[breakpoint];
|
|
225
|
+
if (value !== undefined && sanitizeValue(value) === undefined) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Resolve a responsive value from a breakpoint map.
|
|
233
|
+
* Uses a breakpoint-specific default when custom values are missing/invalid.
|
|
234
|
+
*/
|
|
235
|
+
resolveFromBreakpoints(width, breakpointMap, sanitizeProvided, getSanitizedDefault) {
|
|
236
|
+
let resolvedValue;
|
|
237
|
+
for (const bp of BREAKPOINT_ORDER) {
|
|
238
|
+
const providedValue = breakpointMap[bp];
|
|
239
|
+
const sanitizedProvided = sanitizeProvided(providedValue);
|
|
240
|
+
const sanitizedDefault = getSanitizedDefault(bp);
|
|
241
|
+
const resolved = providedValue === undefined || sanitizedProvided === undefined ? sanitizedDefault : sanitizedProvided;
|
|
242
|
+
if (resolved !== undefined && width >= BREAKPOINTS[bp]) {
|
|
243
|
+
resolvedValue = resolved;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return resolvedValue;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get the columns from a responsive breakpoint map.
|
|
250
|
+
* Returns the columns for the last matching breakpoint.
|
|
251
|
+
*/
|
|
252
|
+
getColumnsFromBreakpointMap(width, breakpointMap) {
|
|
253
|
+
return this.resolveFromBreakpoints(width, breakpointMap, (value) => this.sanitizeColumns(value), (bp) => this.sanitizeColumns(DEFAULT_COLUMNS[bp]));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Get the gap from a responsive breakpoint map.
|
|
257
|
+
* Returns the gap for the last matching breakpoint.
|
|
258
|
+
*/
|
|
259
|
+
getGapFromBreakpointMap(width, breakpointMap) {
|
|
260
|
+
return this.resolveFromBreakpoints(width, breakpointMap, (value) => this.sanitizeGap(value), () => this.sanitizeGap(DEFAULT_GAP));
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Warn about an invalid columns value when it is set to a non-positive
|
|
264
|
+
* integer or a breakpoint map object with invalid values.
|
|
265
|
+
*/
|
|
266
|
+
warnInvalidColumns(columns) {
|
|
267
|
+
if (this.hasWarnedInvalidColumns) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
index.printIonWarning(`[ion-gallery] - Invalid "columns" value (${JSON.stringify(columns)}). Expected a positive integer or breakpoint map object (e.g. { xs: 2, md: 4 }). Falling back to default responsive columns.`, this.el);
|
|
271
|
+
this.hasWarnedInvalidColumns = true;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Warn about an invalid gap value when it is set to a negative number
|
|
275
|
+
* or a breakpoint map object with invalid values.
|
|
276
|
+
*/
|
|
277
|
+
warnInvalidGap(gap) {
|
|
278
|
+
if (this.hasWarnedInvalidGap) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
index.printIonWarning(`[ion-gallery] - Invalid "gap" value (${JSON.stringify(gap)}). Expected a non-negative number, CSS length string, or breakpoint map object (e.g. { xs: 8, md: "1rem" }).`, this.el);
|
|
282
|
+
this.hasWarnedInvalidGap = true;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Warn when `order` is explicitly set while layout is `uniform`.
|
|
286
|
+
*/
|
|
287
|
+
warnUnusedOrder() {
|
|
288
|
+
const { layout } = this;
|
|
289
|
+
const order = this.order == null ? undefined : this.order;
|
|
290
|
+
if (this.hasWarnedUnusedOrder || layout !== 'uniform' || order === undefined) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
index.printIonWarning(`[ion-gallery] - "order" has no effect when "layout" is "uniform". Set "layout" to "masonry" for "order" to apply.`, this.el);
|
|
294
|
+
this.hasWarnedUnusedOrder = true;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Resolve the active columns value for the current width. Falls back to
|
|
298
|
+
* the default responsive columns when the provided prop is invalid.
|
|
299
|
+
*/
|
|
300
|
+
getColumnsForWidth(width) {
|
|
301
|
+
const { columns } = this;
|
|
302
|
+
const isBreakpointColumns = this.isBreakpointMap(columns);
|
|
303
|
+
const hasInvalidBreakpointColumns = isBreakpointColumns && this.hasInvalidBreakpointMap(columns, (value) => this.sanitizeColumns(value));
|
|
304
|
+
const sanitizedColumns = isBreakpointColumns
|
|
305
|
+
? this.getColumnsFromBreakpointMap(width, columns)
|
|
306
|
+
: this.sanitizeColumns(columns);
|
|
307
|
+
if (hasInvalidBreakpointColumns || (!isBreakpointColumns && sanitizedColumns === undefined)) {
|
|
308
|
+
this.warnInvalidColumns(columns);
|
|
309
|
+
}
|
|
310
|
+
if (sanitizedColumns !== undefined) {
|
|
311
|
+
return sanitizedColumns;
|
|
312
|
+
}
|
|
313
|
+
return this.getColumnsFromBreakpointMap(width, DEFAULT_COLUMNS);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Resolve the active gap value for the current width.
|
|
317
|
+
*/
|
|
318
|
+
getGapForWidth(width) {
|
|
319
|
+
const { gap } = this;
|
|
320
|
+
const providedGap = gap !== null && gap !== void 0 ? gap : DEFAULT_GAP;
|
|
321
|
+
const isBreakpointGap = this.isBreakpointMap(providedGap);
|
|
322
|
+
const hasInvalidBreakpointGap = isBreakpointGap && this.hasInvalidBreakpointMap(providedGap, (value) => this.sanitizeGap(value));
|
|
323
|
+
const sanitizedGap = isBreakpointGap
|
|
324
|
+
? this.getGapFromBreakpointMap(width, providedGap)
|
|
325
|
+
: this.sanitizeGap(providedGap);
|
|
326
|
+
if (hasInvalidBreakpointGap || (!isBreakpointGap && sanitizedGap === undefined)) {
|
|
327
|
+
this.warnInvalidGap(providedGap);
|
|
328
|
+
}
|
|
329
|
+
if (sanitizedGap !== undefined) {
|
|
330
|
+
return sanitizedGap;
|
|
331
|
+
}
|
|
332
|
+
return this.sanitizeGap(DEFAULT_GAP);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Update the responsive styles for the gallery. This is used to update
|
|
336
|
+
* the columns and gap when the component width changes.
|
|
337
|
+
*/
|
|
338
|
+
updateResponsiveStyles(force = false) {
|
|
339
|
+
const width = this.el.getBoundingClientRect().width;
|
|
340
|
+
// Only update the columns if the component width has changed by more than
|
|
341
|
+
// 1px or if the force flag is true. This prevents unnecessary re-renders
|
|
342
|
+
// when the component width has not changed.
|
|
343
|
+
if (!width || (!force && this.lastWidth !== undefined && Math.abs(this.lastWidth - width) < 1)) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this.lastWidth = width;
|
|
347
|
+
const columns = this.getColumnsForWidth(width);
|
|
348
|
+
this.el.style.setProperty('--internal-gallery-columns', `${columns}`);
|
|
349
|
+
const gap = this.getGapForWidth(width);
|
|
350
|
+
this.el.style.setProperty('--internal-gallery-gap', `${gap}`);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Return all directly slotted HTMLElement children of the gallery.
|
|
354
|
+
*/
|
|
355
|
+
getItems() {
|
|
356
|
+
return Array.from(this.el.children).filter((child) => child instanceof HTMLElement);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Clear the item styles for the given item element.
|
|
360
|
+
* This is used to switch between uniform and masonry layouts.
|
|
361
|
+
*/
|
|
362
|
+
clearItemStyles(itemEl) {
|
|
363
|
+
itemEl.style.gridRowStart = '';
|
|
364
|
+
itemEl.style.gridRowEnd = '';
|
|
365
|
+
itemEl.style.gridColumn = '';
|
|
366
|
+
itemEl.style.marginBottom = '';
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Clear placement styles for all items when leaving masonry mode.
|
|
370
|
+
*/
|
|
371
|
+
clearMasonryStyles() {
|
|
372
|
+
this.getItems().forEach((itemEl) => this.clearItemStyles(itemEl));
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Convert a rendered item height to the number of grid rows it should span.
|
|
376
|
+
* Returns undefined for images that are not fully loaded yet.
|
|
377
|
+
*/
|
|
378
|
+
calculateRowSpan(itemEl, rowHeight, rowGap) {
|
|
379
|
+
if (itemEl instanceof HTMLImageElement && (!itemEl.complete || itemEl.naturalHeight === 0)) {
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
const height = itemEl.getBoundingClientRect().height;
|
|
383
|
+
const itemStyles = getComputedStyle(itemEl);
|
|
384
|
+
const marginBottom = parseFloat(itemStyles.getPropertyValue('margin-bottom')) || 0;
|
|
385
|
+
const denominator = rowHeight + rowGap;
|
|
386
|
+
if (!denominator || !Number.isFinite(denominator)) {
|
|
387
|
+
return 1;
|
|
388
|
+
}
|
|
389
|
+
return Math.ceil((height + marginBottom + rowGap) / denominator) || 1;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Get the index of the column to position the item in.
|
|
393
|
+
* When the order is `best-fit`, the column with the shortest height is
|
|
394
|
+
* returned. Otherwise, items are placed in the column that matches their
|
|
395
|
+
* natural DOM order.
|
|
396
|
+
*/
|
|
397
|
+
getColumnIndex(index, columnHeights, columns) {
|
|
398
|
+
const order = this.getOrder();
|
|
399
|
+
if (order === 'best-fit') {
|
|
400
|
+
let columnIndex = 0;
|
|
401
|
+
for (let i = 1; i < columns; i++) {
|
|
402
|
+
if (columnHeights[i] < columnHeights[columnIndex]) {
|
|
403
|
+
columnIndex = i;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return columnIndex;
|
|
407
|
+
}
|
|
408
|
+
return index % columns;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Apply masonry placement by assigning each item a column and row span.
|
|
412
|
+
*/
|
|
413
|
+
layoutMasonry(items, rowHeight, rowGap, columns) {
|
|
414
|
+
const columnHeights = new Array(columns).fill(0);
|
|
415
|
+
const lastItemsByColumn = new Array(columns).fill(undefined);
|
|
416
|
+
items.forEach((itemEl, i) => {
|
|
417
|
+
itemEl.style.marginBottom = '';
|
|
418
|
+
const span = this.calculateRowSpan(itemEl, rowHeight, rowGap);
|
|
419
|
+
if (span === undefined) {
|
|
420
|
+
this.clearItemStyles(itemEl);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const columnIndex = this.getColumnIndex(i, columnHeights, columns);
|
|
424
|
+
const start = columnHeights[columnIndex] + 1;
|
|
425
|
+
itemEl.style.gridColumn = `${columnIndex + 1}`;
|
|
426
|
+
itemEl.style.gridRowStart = `${start}`;
|
|
427
|
+
itemEl.style.gridRowEnd = `span ${span}`;
|
|
428
|
+
columnHeights[columnIndex] = start + span - 1;
|
|
429
|
+
lastItemsByColumn[columnIndex] = itemEl;
|
|
430
|
+
});
|
|
431
|
+
// Remove trailing space from the final item in each column while preserving
|
|
432
|
+
// spacing between all non-final items.
|
|
433
|
+
lastItemsByColumn.forEach((itemEl) => {
|
|
434
|
+
if (itemEl === undefined) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
itemEl.style.marginBottom = '0px';
|
|
438
|
+
const spanWithoutTrailingGap = this.calculateRowSpan(itemEl, rowHeight, rowGap);
|
|
439
|
+
if (spanWithoutTrailingGap === undefined) {
|
|
440
|
+
this.clearItemStyles(itemEl);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
itemEl.style.gridRowEnd = `span ${spanWithoutTrailingGap}`;
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Resolved order for layout and CSS. Order should be `undefined` for
|
|
448
|
+
* the uniform layout. When order is not set, it should be `"sequential"`
|
|
449
|
+
* for the masonry layout.
|
|
450
|
+
*/
|
|
451
|
+
getOrder() {
|
|
452
|
+
const { layout } = this;
|
|
453
|
+
const order = this.order == null ? undefined : this.order;
|
|
454
|
+
if (layout === 'uniform') {
|
|
455
|
+
return undefined;
|
|
456
|
+
}
|
|
457
|
+
if (layout === 'masonry' && order === undefined) {
|
|
458
|
+
return 'sequential';
|
|
459
|
+
}
|
|
460
|
+
return order;
|
|
461
|
+
}
|
|
462
|
+
render() {
|
|
463
|
+
const { layout } = this;
|
|
464
|
+
const order = this.getOrder();
|
|
465
|
+
const theme = ionicGlobal.getIonTheme(this);
|
|
466
|
+
return (index.h(index.Host, { key: '8a8266626f1ba8beb7e382c89ae7905372fe23a9', class: {
|
|
467
|
+
[theme]: true,
|
|
468
|
+
[`gallery-layout-${layout}`]: true,
|
|
469
|
+
[`gallery-order-${order}`]: layout === 'masonry' && order !== undefined,
|
|
470
|
+
} }, index.h("slot", { key: '7758e89bda53a91d593b9ece0cbe60a4bce0a0fa', onSlotchange: this.onSlotChange })));
|
|
471
|
+
}
|
|
472
|
+
get el() { return index.getElement(this); }
|
|
473
|
+
static get watchers() { return {
|
|
474
|
+
"columns": [{
|
|
475
|
+
"propertiesChanged": 0
|
|
476
|
+
}],
|
|
477
|
+
"gap": [{
|
|
478
|
+
"propertiesChanged": 0
|
|
479
|
+
}],
|
|
480
|
+
"layout": [{
|
|
481
|
+
"propertiesChanged": 0
|
|
482
|
+
}],
|
|
483
|
+
"order": [{
|
|
484
|
+
"propertiesChanged": 0
|
|
485
|
+
}]
|
|
486
|
+
}; }
|
|
487
|
+
};
|
|
488
|
+
Gallery.style = galleryCss();
|
|
489
|
+
|
|
490
|
+
exports.ion_gallery = Gallery;
|
|
@@ -84,9 +84,9 @@ const Img = class {
|
|
|
84
84
|
const { loadSrc, alt, onLoad, loadError, inheritedAttributes } = this;
|
|
85
85
|
const { draggable } = inheritedAttributes;
|
|
86
86
|
const theme = ionicGlobal.getIonTheme(this);
|
|
87
|
-
return (index.h(index.Host, { key: '
|
|
87
|
+
return (index.h(index.Host, { key: '91de170493b31d6260e975b440beceb6906b6d5a', class: {
|
|
88
88
|
[theme]: true,
|
|
89
|
-
} }, index.h("img", { key: '
|
|
89
|
+
} }, index.h("img", { key: 'ac1f41afbece34a3e38e656733f3e55cce385b4c', decoding: "async", src: loadSrc, alt: alt, onLoad: onLoad, onError: loadError, part: "image", draggable: isDraggable(draggable) })));
|
|
90
90
|
}
|
|
91
91
|
get el() { return index.getElement(this); }
|
|
92
92
|
static get watchers() { return {
|
|
@@ -271,7 +271,7 @@ const InfiniteScroll = class {
|
|
|
271
271
|
render() {
|
|
272
272
|
const theme = ionicGlobal.getIonTheme(this);
|
|
273
273
|
const disabled = this.disabled;
|
|
274
|
-
return (index.h(index.Host, { key: '
|
|
274
|
+
return (index.h(index.Host, { key: '02beca21d668e4e605532ad5ca5a67a08c71eebb', class: {
|
|
275
275
|
[theme]: true,
|
|
276
276
|
'infinite-scroll-loading': this.isLoading,
|
|
277
277
|
'infinite-scroll-enabled': !disabled,
|
|
@@ -315,11 +315,11 @@ const InfiniteScrollContent = class {
|
|
|
315
315
|
}
|
|
316
316
|
render() {
|
|
317
317
|
const theme = ionicGlobal.getIonTheme(this);
|
|
318
|
-
return (index.h(index.Host, { key: '
|
|
318
|
+
return (index.h(index.Host, { key: 'b51954f829eeafd5ec304b3e66e330776485ffc8', class: {
|
|
319
319
|
[theme]: true,
|
|
320
320
|
// Used internally for styling
|
|
321
321
|
[`infinite-scroll-content-${theme}`]: true,
|
|
322
|
-
} }, index.h("div", { key: '
|
|
322
|
+
} }, index.h("div", { key: '047da7f15fe38deed592dd66d1c97e12da4545bb', class: "infinite-loading" }, this.loadingSpinner && (index.h("div", { key: '1c05820f091052b8ee9e9ca20054495a676c21aa', class: "infinite-loading-spinner" }, index.h("ion-spinner", { key: 'ff801e3486f3c1a4605d2a2de9b47bd7bd536698', name: this.loadingSpinner }))), this.loadingText !== undefined && this.renderLoadingText())));
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
325
|
InfiniteScrollContent.style = {
|
|
@@ -692,7 +692,7 @@ const InputOTP = class {
|
|
|
692
692
|
const tabbableIndex = this.getTabbableIndex();
|
|
693
693
|
const pattern = this.getPattern();
|
|
694
694
|
const hasDescription = ((_b = (_a = el.querySelector('.input-otp-description')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== '';
|
|
695
|
-
return (index.h(index.Host, { key: '
|
|
695
|
+
return (index.h(index.Host, { key: '7a5c5dbb7e1880bd94d4b00e579af941366b1cb2', class: theme.createColorClasses(color, {
|
|
696
696
|
[mode]: true,
|
|
697
697
|
'has-focus': hasFocus,
|
|
698
698
|
[`input-otp-size-${size}`]: true,
|
|
@@ -700,10 +700,10 @@ const InputOTP = class {
|
|
|
700
700
|
[`input-otp-fill-${fill}`]: true,
|
|
701
701
|
'input-otp-disabled': disabled,
|
|
702
702
|
'input-otp-readonly': readonly,
|
|
703
|
-
}) }, index.h("div", Object.assign({ key: '
|
|
703
|
+
}) }, index.h("div", Object.assign({ key: 'a4427602ea1894d53e4d0f502dbb972c93a86bff', role: "group", "aria-label": "One-time password input", class: "input-otp-group", part: "group" }, inheritedAttributes), Array.from({ length }).map((_, index$1) => (index.h(index.Fragment, null, index.h("div", { class: "native-wrapper", part: "container" }, index.h("input", { class: "native-input", part: "native", id: `${inputId}-${index$1}`, "aria-label": `Input ${index$1 + 1} of ${length}`, type: "text", autoCapitalize: autocapitalize, inputmode: inputmode, pattern: pattern, disabled: disabled, readOnly: readonly, tabIndex: index$1 === tabbableIndex ? 0 : -1, value: inputValues[index$1] || '', autocomplete: "one-time-code", ref: (el) => (inputRefs[index$1] = el), onInput: this.onInput(index$1), onBlur: this.onBlur, onFocus: this.onFocus(index$1), onKeyDown: this.onKeyDown(index$1), onPaste: this.onPaste })), this.showSeparator(index$1) && index.h("div", { class: "input-otp-separator", part: "separator" }))))), index.h("div", { key: '7ee9d8dfd2e52875f1bfe3e3dea0494c18c12f4a', class: {
|
|
704
704
|
'input-otp-description': true,
|
|
705
705
|
'input-otp-description-hidden': !hasDescription,
|
|
706
|
-
}, part: "description" }, index.h("slot", { key: '
|
|
706
|
+
}, part: "description" }, index.h("slot", { key: '163c374e7ae5dbdb1dc12483161e5aca919a50d5' }))));
|
|
707
707
|
}
|
|
708
708
|
static get formAssociated() { return true; }
|
|
709
709
|
get el() { return index.getElement(this); }
|
|
@@ -101,16 +101,16 @@ const InputPasswordToggle = class {
|
|
|
101
101
|
const { color, inputPasswordHideIcon, inputPasswordShowIcon, type } = this;
|
|
102
102
|
const mode = ionicGlobal.getIonMode(this);
|
|
103
103
|
const isPasswordVisible = type === 'text';
|
|
104
|
-
return (index.h(index.Host, { key: '
|
|
104
|
+
return (index.h(index.Host, { key: 'c7f0805958b284005806a0cb3ed0b5cba42cecd1', class: theme.createColorClasses(color, {
|
|
105
105
|
[mode]: true,
|
|
106
|
-
}) }, index.h("ion-button", { key: '
|
|
106
|
+
}) }, index.h("ion-button", { key: 'dee2bdeb169d1fa4943c9a8b0164b8fbb4cdfe06', mode: mode, color: color, fill: "clear", shape: "round", "aria-label": isPasswordVisible ? 'Hide password' : 'Show password', "aria-pressed": isPasswordVisible ? 'true' : 'false', type: "button", onPointerDown: (ev) => {
|
|
107
107
|
/**
|
|
108
108
|
* This prevents mobile browsers from
|
|
109
109
|
* blurring the input when the password toggle
|
|
110
110
|
* button is activated.
|
|
111
111
|
*/
|
|
112
112
|
ev.preventDefault();
|
|
113
|
-
}, onClick: this.togglePasswordVisibility }, index.h("ion-icon", { key: '
|
|
113
|
+
}, onClick: this.togglePasswordVisibility }, index.h("ion-icon", { key: 'be752db7186a7cd6fc033c7002fcb1683d93c162', slot: "icon-only", "aria-hidden": "true", icon: isPasswordVisible ? inputPasswordHideIcon : inputPasswordShowIcon }))));
|
|
114
114
|
}
|
|
115
115
|
get el() { return index.getElement(this); }
|
|
116
116
|
static get watchers() { return {
|
|
@@ -622,7 +622,7 @@ const Input = class {
|
|
|
622
622
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
623
623
|
*/
|
|
624
624
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
|
|
625
|
-
return (index.h(index.Host, { key: '
|
|
625
|
+
return (index.h(index.Host, { key: 'beeeca9939e7e416783425f67d3c9e2be6bbae99', class: theme.createColorClasses(this.color, {
|
|
626
626
|
[theme$1]: true,
|
|
627
627
|
'has-value': hasValue,
|
|
628
628
|
'has-focus': hasFocus,
|
|
@@ -635,7 +635,7 @@ const Input = class {
|
|
|
635
635
|
'in-item-color': theme.hostContext('ion-item.ion-color', this.el),
|
|
636
636
|
'input-disabled': disabled,
|
|
637
637
|
'input-readonly': readonly,
|
|
638
|
-
}) }, index.h("label", { key: '
|
|
638
|
+
}) }, index.h("label", { key: 'f227df52a6ad60344f16261a82c0d0566bb8cd5b', class: "input-wrapper", htmlFor: inputId, onClick: this.onLabelClick }, this.renderLabelContainer(), index.h("div", { key: 'ae6da554ce21f805361a7704139b776a9344dcb2', class: "native-wrapper", onClick: this.onLabelClick },
|
|
639
639
|
/**
|
|
640
640
|
* For the ionic theme, we render the outline container here
|
|
641
641
|
* instead of higher up, so it can be positioned relative to
|
|
@@ -645,14 +645,14 @@ const Input = class {
|
|
|
645
645
|
* <label> element, ensuring that clicking the label text
|
|
646
646
|
* focuses the input.
|
|
647
647
|
*/
|
|
648
|
-
theme$1 === 'ionic' && index.h("div", { key: '
|
|
648
|
+
theme$1 === 'ionic' && index.h("div", { key: '83aa5e7ad97b0c964e31966c1d2b8771d1ecfc53', class: "input-outline" }), index.h("slot", { key: '1931003f2b0d19508acaaffab58fee644d1f6158', name: "start" }), index.h("input", Object.assign({ key: '33a06efb4ce0b6e67c12e77f131effb113fba73f', class: "native-input", ref: (input) => (this.nativeInput = input), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd, "aria-describedby": this.getHintTextID(), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-labelledby": this.getLabelledById() }, this.inheritedAttributes)), clearInput && !readonly && !disabled && (index.h("button", { key: 'd350f26cf6927ee089373ea8903db2479a0a404c', "aria-label": "reset", type: "button", class: "input-clear-icon", onPointerDown: (ev) => {
|
|
649
649
|
/**
|
|
650
650
|
* This prevents mobile browsers from
|
|
651
651
|
* blurring the input when the clear
|
|
652
652
|
* button is activated.
|
|
653
653
|
*/
|
|
654
654
|
ev.preventDefault();
|
|
655
|
-
}, onClick: this.clearTextInput }, index.h("ion-icon", { key: '
|
|
655
|
+
}, onClick: this.clearTextInput }, index.h("ion-icon", { key: '972a2d94dcf599e63aac1d73e34873a9c3d0bf94', "aria-hidden": "true", icon: inputClearIcon }))), index.h("slot", { key: 'fac4dcaabb02f647e46276e92e3f341557170aec', name: "end" })), shouldRenderHighlight && index.h("div", { key: 'a10e519d8d1f0dcd81ffc43b8e4086797476f753', class: "input-highlight" })), this.renderBottomContent()));
|
|
656
656
|
}
|
|
657
657
|
get el() { return index.getElement(this); }
|
|
658
658
|
static get watchers() { return {
|
|
@@ -70,14 +70,14 @@ const ItemOption = class {
|
|
|
70
70
|
href: this.href,
|
|
71
71
|
target: this.target,
|
|
72
72
|
};
|
|
73
|
-
return (index.h(index.Host, { key: '
|
|
73
|
+
return (index.h(index.Host, { key: 'bfade0042108ff525077dfbdfd45169ccfd6b920', onClick: this.onClick, class: theme.createColorClasses(this.color, {
|
|
74
74
|
[theme$1]: true,
|
|
75
75
|
[`item-option-${shape}`]: shape !== undefined,
|
|
76
76
|
[`item-option-${hue}`]: hue !== undefined,
|
|
77
77
|
'item-option-disabled': disabled,
|
|
78
78
|
'item-option-expandable': expandable,
|
|
79
79
|
'ion-activatable': true,
|
|
80
|
-
}) }, index.h(TagType, Object.assign({ key: '
|
|
80
|
+
}) }, index.h(TagType, Object.assign({ key: '38466b511f4a20a3728f37dbf6779b852eba531a' }, attrs, { class: "button-native", part: "native", disabled: disabled }), index.h("span", { key: 'bb8f1b332afa2f575bcc69b340bd8f1faa5ca925', class: "button-inner", part: "inner" }, index.h("slot", { key: '41d627511e1615283956712e1b9519bae92460f6', name: "top" }), index.h("div", { key: 'bb949a43a586a8996933ee7528e5491beb647aa5', class: "horizontal-wrapper", part: "container" }, index.h("slot", { key: 'c0d6a73ef49082bfbdf0f542f7465d044ccb6521', name: "start" }), index.h("slot", { key: '79c6103e680983b2c1a17f1f11dbc41224cd4016', name: "icon-only" }), index.h("slot", { key: '6c7f17723544d3f6e8b9689b84ddf6196f1897a5' }), index.h("slot", { key: 'e15d0e02fde71bad8ff7bab0eded7d49508a926e', name: "end" })), index.h("slot", { key: 'c509d54d44ce33f5a34597b9d0ec29960bbcff62', name: "bottom" })), theme$1 === 'md' && index.h("ion-ripple-effect", { key: '412d4dc645c941d0b4356cf982be3d5bc2686f13' }))));
|
|
81
81
|
}
|
|
82
82
|
get el() { return index.getElement(this); }
|
|
83
83
|
};
|
|
@@ -112,7 +112,7 @@ const ItemOptions = class {
|
|
|
112
112
|
render() {
|
|
113
113
|
const theme = ionicGlobal.getIonTheme(this);
|
|
114
114
|
const isEnd = helpers.isEndSide(this.side);
|
|
115
|
-
return (index.h(index.Host, { key: '
|
|
115
|
+
return (index.h(index.Host, { key: 'f3bb726a28c571101791d33d946df9017f47e5ec', class: {
|
|
116
116
|
[theme]: true,
|
|
117
117
|
// Used internally for styling
|
|
118
118
|
[`item-options-${theme}`]: true,
|
|
@@ -906,7 +906,7 @@ const ItemSliding = class {
|
|
|
906
906
|
}
|
|
907
907
|
render() {
|
|
908
908
|
const theme = ionicGlobal.getIonTheme(this);
|
|
909
|
-
return (index.h(index.Host, { key: '
|
|
909
|
+
return (index.h(index.Host, { key: 'e6890a1b14faaf9121a07912b1c2f46e06148202', class: {
|
|
910
910
|
[theme]: true,
|
|
911
911
|
'item-sliding-active-slide': this.state !== 2 /* SlidingState.Disabled */,
|
|
912
912
|
'item-sliding-active-options-end': (this.state & 8 /* SlidingState.End */) !== 0,
|