@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,575 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { Host, h } from "@stencil/core";
|
|
5
|
+
import { isValidLengthPercentage } from "../../utils/css-value-validation";
|
|
6
|
+
import { raf } from "../../utils/helpers";
|
|
7
|
+
import { printIonWarning } from "../../utils/logging/index";
|
|
8
|
+
import { getIonTheme } from "../../global/ionic-global";
|
|
9
|
+
import { DEFAULT_COLUMNS, DEFAULT_GAP } from "./gallery-constants";
|
|
10
|
+
// TODO(FW-7285): Replace with global breakpoints
|
|
11
|
+
const BREAKPOINTS = {
|
|
12
|
+
xs: 0,
|
|
13
|
+
sm: 576,
|
|
14
|
+
md: 768,
|
|
15
|
+
lg: 992,
|
|
16
|
+
xl: 1200,
|
|
17
|
+
xxl: 1400,
|
|
18
|
+
};
|
|
19
|
+
const BREAKPOINT_ORDER = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
20
|
+
/**
|
|
21
|
+
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
|
|
22
|
+
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
|
|
23
|
+
*
|
|
24
|
+
* @slot - Content is placed in a responsive gallery layout.
|
|
25
|
+
*/
|
|
26
|
+
export class Gallery {
|
|
27
|
+
constructor() {
|
|
28
|
+
// Keep track of whether we've warned about invalid columns, invalid gap,
|
|
29
|
+
// and unused order properties to avoid duplicate warnings on screen resize.
|
|
30
|
+
this.hasWarnedInvalidColumns = false;
|
|
31
|
+
this.hasWarnedInvalidGap = false;
|
|
32
|
+
this.hasWarnedUnusedOrder = false;
|
|
33
|
+
/**
|
|
34
|
+
* The visual layout of the gallery. When `uniform`, rows take up the height
|
|
35
|
+
* of the tallest item and are spaced evenly across the gallery. Additionally,
|
|
36
|
+
* items will have an aspect ratio of 1/1, forcing them to be square unless a
|
|
37
|
+
* height is explicitly set. When `masonry`, items will be positioned under each
|
|
38
|
+
* other with only the specified gap between them.
|
|
39
|
+
*/
|
|
40
|
+
this.layout = 'uniform';
|
|
41
|
+
/**
|
|
42
|
+
* The number of columns to display. Can be set as a number or an object of
|
|
43
|
+
* breakpoint values (e.g. `{ xs: 2, sm: 3, md: 4 }`).
|
|
44
|
+
*/
|
|
45
|
+
this.columns = DEFAULT_COLUMNS;
|
|
46
|
+
/**
|
|
47
|
+
* The space between gallery items. Accepts valid CSS [length-percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/length-percentage)
|
|
48
|
+
* values like `16px`, `1rem`, `20%`, math functions like `calc(10px + 20%)`,
|
|
49
|
+
* or numbers (treated as pixel values). Can also be set as a breakpoint map
|
|
50
|
+
* (e.g. `{ xs: '8px', sm: '1rem', md: '24px' }`). Does not accept
|
|
51
|
+
* space-separated values or CSS keyword values like `inherit`, `auto`, etc.
|
|
52
|
+
*/
|
|
53
|
+
this.gap = DEFAULT_GAP;
|
|
54
|
+
/**
|
|
55
|
+
* Listen for the slotchange event on the slot.
|
|
56
|
+
* When the layout is `masonry`, this listener is used to schedule a resize
|
|
57
|
+
* of the masonry grid when the slot changes. This is useful for when items
|
|
58
|
+
* are added or removed from the gallery.
|
|
59
|
+
*/
|
|
60
|
+
this.onSlotChange = () => {
|
|
61
|
+
this.scheduleMasonryResize();
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Measure the host and children, then compute masonry placement.
|
|
65
|
+
*/
|
|
66
|
+
this.resizeMasonryGrid = () => {
|
|
67
|
+
this.masonryRaf = undefined;
|
|
68
|
+
if (this.layout !== 'masonry') {
|
|
69
|
+
this.clearMasonryStyles();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const width = this.el.getBoundingClientRect().width;
|
|
73
|
+
const columns = this.getColumnsForWidth(width);
|
|
74
|
+
// Skip masonry placement when width/columns does not resolve
|
|
75
|
+
// to a valid breakpoint column count.
|
|
76
|
+
if (columns === undefined) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const styles = getComputedStyle(this.el);
|
|
80
|
+
const rowHeight = parseFloat(styles.getPropertyValue('grid-auto-rows')) || 0;
|
|
81
|
+
const rowGap = parseFloat(styles.getPropertyValue('row-gap')) || parseFloat(styles.getPropertyValue('gap')) || 0;
|
|
82
|
+
const items = this.getItems();
|
|
83
|
+
this.layoutMasonry(items, rowHeight, rowGap, columns);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
propertiesChanged() {
|
|
87
|
+
this.updateResponsiveStyles(true);
|
|
88
|
+
this.scheduleMasonryResize();
|
|
89
|
+
// Wait until the next animation frame to warn about unused order
|
|
90
|
+
// to avoid erroneous warnings when the layout and order are updated
|
|
91
|
+
// in the same frame.
|
|
92
|
+
raf(() => {
|
|
93
|
+
this.warnUnusedOrder();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
componentDidLoad() {
|
|
97
|
+
this.updateResponsiveStyles(true);
|
|
98
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
99
|
+
this.updateResponsiveStyles();
|
|
100
|
+
this.scheduleMasonryResize();
|
|
101
|
+
});
|
|
102
|
+
this.resizeObserver.observe(this.el);
|
|
103
|
+
this.scheduleMasonryResize();
|
|
104
|
+
this.warnUnusedOrder();
|
|
105
|
+
}
|
|
106
|
+
disconnectedCallback() {
|
|
107
|
+
var _a;
|
|
108
|
+
if (this.masonryRaf !== undefined) {
|
|
109
|
+
cancelAnimationFrame(this.masonryRaf);
|
|
110
|
+
this.masonryRaf = undefined;
|
|
111
|
+
}
|
|
112
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
113
|
+
this.resizeObserver = undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Listen for the load event on child elements.
|
|
117
|
+
* When the layout is `masonry`, this listener is used to schedule a resize
|
|
118
|
+
* of the masonry grid when the child elements load. This is useful for when
|
|
119
|
+
* images take time to load.
|
|
120
|
+
*/
|
|
121
|
+
onChildLoad(ev) {
|
|
122
|
+
if (this.layout !== 'masonry') {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const target = ev.target;
|
|
126
|
+
if (target !== null && this.el.contains(target)) {
|
|
127
|
+
this.scheduleMasonryResize();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Batch masonry measurements to a single animation frame.
|
|
132
|
+
* This avoids repeated sync layouts during rapid resize/load/slot changes.
|
|
133
|
+
*/
|
|
134
|
+
scheduleMasonryResize() {
|
|
135
|
+
if (this.layout !== 'masonry') {
|
|
136
|
+
this.clearMasonryStyles();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (this.masonryRaf !== undefined) {
|
|
140
|
+
cancelAnimationFrame(this.masonryRaf);
|
|
141
|
+
}
|
|
142
|
+
this.masonryRaf = requestAnimationFrame(this.resizeMasonryGrid);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Normalize a single column value (`columns` as a number, string, or one entry from
|
|
146
|
+
* a `columns` breakpoint map) to a positive integer. Returns `undefined` when
|
|
147
|
+
* the input cannot be interpreted as a finite number.
|
|
148
|
+
*/
|
|
149
|
+
sanitizeColumns(columns) {
|
|
150
|
+
if (columns === undefined) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
const numericColumns = typeof columns === 'number' ? columns : Number(columns);
|
|
154
|
+
if (!Number.isFinite(numericColumns) || !Number.isInteger(numericColumns) || numericColumns <= 0) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
return numericColumns;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Normalize a single gap value (`gap` as a number, string, or one entry from
|
|
161
|
+
* a `gap` breakpoint map) to a CSS length string. Returns `undefined` when
|
|
162
|
+
* the input cannot be interpreted as a valid CSS length.
|
|
163
|
+
*/
|
|
164
|
+
sanitizeGap(gap) {
|
|
165
|
+
if (gap === undefined) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const normalizedGap = typeof gap === 'string' ? gap.trim() : gap;
|
|
169
|
+
if (normalizedGap === '' || typeof normalizedGap === 'object') {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
const numericGap = Number(normalizedGap);
|
|
173
|
+
if (Number.isFinite(numericGap)) {
|
|
174
|
+
return numericGap < 0 ? undefined : `${numericGap}px`;
|
|
175
|
+
}
|
|
176
|
+
if (typeof normalizedGap !== 'string') {
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
const isValidCssLength = isValidLengthPercentage(normalizedGap);
|
|
180
|
+
return isValidCssLength ? normalizedGap : undefined;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Check if the value is a breakpoint map object.
|
|
184
|
+
*/
|
|
185
|
+
isBreakpointMap(value) {
|
|
186
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Check if the breakpoint map has any invalid values for the provided sanitizer.
|
|
190
|
+
*/
|
|
191
|
+
hasInvalidBreakpointMap(breakpointMap, sanitizeValue) {
|
|
192
|
+
for (const breakpoint of BREAKPOINT_ORDER) {
|
|
193
|
+
const value = breakpointMap[breakpoint];
|
|
194
|
+
if (value !== undefined && sanitizeValue(value) === undefined) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Resolve a responsive value from a breakpoint map.
|
|
202
|
+
* Uses a breakpoint-specific default when custom values are missing/invalid.
|
|
203
|
+
*/
|
|
204
|
+
resolveFromBreakpoints(width, breakpointMap, sanitizeProvided, getSanitizedDefault) {
|
|
205
|
+
let resolvedValue;
|
|
206
|
+
for (const bp of BREAKPOINT_ORDER) {
|
|
207
|
+
const providedValue = breakpointMap[bp];
|
|
208
|
+
const sanitizedProvided = sanitizeProvided(providedValue);
|
|
209
|
+
const sanitizedDefault = getSanitizedDefault(bp);
|
|
210
|
+
const resolved = providedValue === undefined || sanitizedProvided === undefined ? sanitizedDefault : sanitizedProvided;
|
|
211
|
+
if (resolved !== undefined && width >= BREAKPOINTS[bp]) {
|
|
212
|
+
resolvedValue = resolved;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return resolvedValue;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get the columns from a responsive breakpoint map.
|
|
219
|
+
* Returns the columns for the last matching breakpoint.
|
|
220
|
+
*/
|
|
221
|
+
getColumnsFromBreakpointMap(width, breakpointMap) {
|
|
222
|
+
return this.resolveFromBreakpoints(width, breakpointMap, (value) => this.sanitizeColumns(value), (bp) => this.sanitizeColumns(DEFAULT_COLUMNS[bp]));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get the gap from a responsive breakpoint map.
|
|
226
|
+
* Returns the gap for the last matching breakpoint.
|
|
227
|
+
*/
|
|
228
|
+
getGapFromBreakpointMap(width, breakpointMap) {
|
|
229
|
+
return this.resolveFromBreakpoints(width, breakpointMap, (value) => this.sanitizeGap(value), () => this.sanitizeGap(DEFAULT_GAP));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Warn about an invalid columns value when it is set to a non-positive
|
|
233
|
+
* integer or a breakpoint map object with invalid values.
|
|
234
|
+
*/
|
|
235
|
+
warnInvalidColumns(columns) {
|
|
236
|
+
if (this.hasWarnedInvalidColumns) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
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);
|
|
240
|
+
this.hasWarnedInvalidColumns = true;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Warn about an invalid gap value when it is set to a negative number
|
|
244
|
+
* or a breakpoint map object with invalid values.
|
|
245
|
+
*/
|
|
246
|
+
warnInvalidGap(gap) {
|
|
247
|
+
if (this.hasWarnedInvalidGap) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
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);
|
|
251
|
+
this.hasWarnedInvalidGap = true;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Warn when `order` is explicitly set while layout is `uniform`.
|
|
255
|
+
*/
|
|
256
|
+
warnUnusedOrder() {
|
|
257
|
+
const { layout } = this;
|
|
258
|
+
const order = this.order == null ? undefined : this.order;
|
|
259
|
+
if (this.hasWarnedUnusedOrder || layout !== 'uniform' || order === undefined) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
printIonWarning(`[ion-gallery] - "order" has no effect when "layout" is "uniform". Set "layout" to "masonry" for "order" to apply.`, this.el);
|
|
263
|
+
this.hasWarnedUnusedOrder = true;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Resolve the active columns value for the current width. Falls back to
|
|
267
|
+
* the default responsive columns when the provided prop is invalid.
|
|
268
|
+
*/
|
|
269
|
+
getColumnsForWidth(width) {
|
|
270
|
+
const { columns } = this;
|
|
271
|
+
const isBreakpointColumns = this.isBreakpointMap(columns);
|
|
272
|
+
const hasInvalidBreakpointColumns = isBreakpointColumns && this.hasInvalidBreakpointMap(columns, (value) => this.sanitizeColumns(value));
|
|
273
|
+
const sanitizedColumns = isBreakpointColumns
|
|
274
|
+
? this.getColumnsFromBreakpointMap(width, columns)
|
|
275
|
+
: this.sanitizeColumns(columns);
|
|
276
|
+
if (hasInvalidBreakpointColumns || (!isBreakpointColumns && sanitizedColumns === undefined)) {
|
|
277
|
+
this.warnInvalidColumns(columns);
|
|
278
|
+
}
|
|
279
|
+
if (sanitizedColumns !== undefined) {
|
|
280
|
+
return sanitizedColumns;
|
|
281
|
+
}
|
|
282
|
+
return this.getColumnsFromBreakpointMap(width, DEFAULT_COLUMNS);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Resolve the active gap value for the current width.
|
|
286
|
+
*/
|
|
287
|
+
getGapForWidth(width) {
|
|
288
|
+
const { gap } = this;
|
|
289
|
+
const providedGap = gap !== null && gap !== void 0 ? gap : DEFAULT_GAP;
|
|
290
|
+
const isBreakpointGap = this.isBreakpointMap(providedGap);
|
|
291
|
+
const hasInvalidBreakpointGap = isBreakpointGap && this.hasInvalidBreakpointMap(providedGap, (value) => this.sanitizeGap(value));
|
|
292
|
+
const sanitizedGap = isBreakpointGap
|
|
293
|
+
? this.getGapFromBreakpointMap(width, providedGap)
|
|
294
|
+
: this.sanitizeGap(providedGap);
|
|
295
|
+
if (hasInvalidBreakpointGap || (!isBreakpointGap && sanitizedGap === undefined)) {
|
|
296
|
+
this.warnInvalidGap(providedGap);
|
|
297
|
+
}
|
|
298
|
+
if (sanitizedGap !== undefined) {
|
|
299
|
+
return sanitizedGap;
|
|
300
|
+
}
|
|
301
|
+
return this.sanitizeGap(DEFAULT_GAP);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Update the responsive styles for the gallery. This is used to update
|
|
305
|
+
* the columns and gap when the component width changes.
|
|
306
|
+
*/
|
|
307
|
+
updateResponsiveStyles(force = false) {
|
|
308
|
+
const width = this.el.getBoundingClientRect().width;
|
|
309
|
+
// Only update the columns if the component width has changed by more than
|
|
310
|
+
// 1px or if the force flag is true. This prevents unnecessary re-renders
|
|
311
|
+
// when the component width has not changed.
|
|
312
|
+
if (!width || (!force && this.lastWidth !== undefined && Math.abs(this.lastWidth - width) < 1)) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
this.lastWidth = width;
|
|
316
|
+
const columns = this.getColumnsForWidth(width);
|
|
317
|
+
this.el.style.setProperty('--internal-gallery-columns', `${columns}`);
|
|
318
|
+
const gap = this.getGapForWidth(width);
|
|
319
|
+
this.el.style.setProperty('--internal-gallery-gap', `${gap}`);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Return all directly slotted HTMLElement children of the gallery.
|
|
323
|
+
*/
|
|
324
|
+
getItems() {
|
|
325
|
+
return Array.from(this.el.children).filter((child) => child instanceof HTMLElement);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Clear the item styles for the given item element.
|
|
329
|
+
* This is used to switch between uniform and masonry layouts.
|
|
330
|
+
*/
|
|
331
|
+
clearItemStyles(itemEl) {
|
|
332
|
+
itemEl.style.gridRowStart = '';
|
|
333
|
+
itemEl.style.gridRowEnd = '';
|
|
334
|
+
itemEl.style.gridColumn = '';
|
|
335
|
+
itemEl.style.marginBottom = '';
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Clear placement styles for all items when leaving masonry mode.
|
|
339
|
+
*/
|
|
340
|
+
clearMasonryStyles() {
|
|
341
|
+
this.getItems().forEach((itemEl) => this.clearItemStyles(itemEl));
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Convert a rendered item height to the number of grid rows it should span.
|
|
345
|
+
* Returns undefined for images that are not fully loaded yet.
|
|
346
|
+
*/
|
|
347
|
+
calculateRowSpan(itemEl, rowHeight, rowGap) {
|
|
348
|
+
if (itemEl instanceof HTMLImageElement && (!itemEl.complete || itemEl.naturalHeight === 0)) {
|
|
349
|
+
return undefined;
|
|
350
|
+
}
|
|
351
|
+
const height = itemEl.getBoundingClientRect().height;
|
|
352
|
+
const itemStyles = getComputedStyle(itemEl);
|
|
353
|
+
const marginBottom = parseFloat(itemStyles.getPropertyValue('margin-bottom')) || 0;
|
|
354
|
+
const denominator = rowHeight + rowGap;
|
|
355
|
+
if (!denominator || !Number.isFinite(denominator)) {
|
|
356
|
+
return 1;
|
|
357
|
+
}
|
|
358
|
+
return Math.ceil((height + marginBottom + rowGap) / denominator) || 1;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Get the index of the column to position the item in.
|
|
362
|
+
* When the order is `best-fit`, the column with the shortest height is
|
|
363
|
+
* returned. Otherwise, items are placed in the column that matches their
|
|
364
|
+
* natural DOM order.
|
|
365
|
+
*/
|
|
366
|
+
getColumnIndex(index, columnHeights, columns) {
|
|
367
|
+
const order = this.getOrder();
|
|
368
|
+
if (order === 'best-fit') {
|
|
369
|
+
let columnIndex = 0;
|
|
370
|
+
for (let i = 1; i < columns; i++) {
|
|
371
|
+
if (columnHeights[i] < columnHeights[columnIndex]) {
|
|
372
|
+
columnIndex = i;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return columnIndex;
|
|
376
|
+
}
|
|
377
|
+
return index % columns;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Apply masonry placement by assigning each item a column and row span.
|
|
381
|
+
*/
|
|
382
|
+
layoutMasonry(items, rowHeight, rowGap, columns) {
|
|
383
|
+
const columnHeights = new Array(columns).fill(0);
|
|
384
|
+
const lastItemsByColumn = new Array(columns).fill(undefined);
|
|
385
|
+
items.forEach((itemEl, i) => {
|
|
386
|
+
itemEl.style.marginBottom = '';
|
|
387
|
+
const span = this.calculateRowSpan(itemEl, rowHeight, rowGap);
|
|
388
|
+
if (span === undefined) {
|
|
389
|
+
this.clearItemStyles(itemEl);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const columnIndex = this.getColumnIndex(i, columnHeights, columns);
|
|
393
|
+
const start = columnHeights[columnIndex] + 1;
|
|
394
|
+
itemEl.style.gridColumn = `${columnIndex + 1}`;
|
|
395
|
+
itemEl.style.gridRowStart = `${start}`;
|
|
396
|
+
itemEl.style.gridRowEnd = `span ${span}`;
|
|
397
|
+
columnHeights[columnIndex] = start + span - 1;
|
|
398
|
+
lastItemsByColumn[columnIndex] = itemEl;
|
|
399
|
+
});
|
|
400
|
+
// Remove trailing space from the final item in each column while preserving
|
|
401
|
+
// spacing between all non-final items.
|
|
402
|
+
lastItemsByColumn.forEach((itemEl) => {
|
|
403
|
+
if (itemEl === undefined) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
itemEl.style.marginBottom = '0px';
|
|
407
|
+
const spanWithoutTrailingGap = this.calculateRowSpan(itemEl, rowHeight, rowGap);
|
|
408
|
+
if (spanWithoutTrailingGap === undefined) {
|
|
409
|
+
this.clearItemStyles(itemEl);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
itemEl.style.gridRowEnd = `span ${spanWithoutTrailingGap}`;
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Resolved order for layout and CSS. Order should be `undefined` for
|
|
417
|
+
* the uniform layout. When order is not set, it should be `"sequential"`
|
|
418
|
+
* for the masonry layout.
|
|
419
|
+
*/
|
|
420
|
+
getOrder() {
|
|
421
|
+
const { layout } = this;
|
|
422
|
+
const order = this.order == null ? undefined : this.order;
|
|
423
|
+
if (layout === 'uniform') {
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
if (layout === 'masonry' && order === undefined) {
|
|
427
|
+
return 'sequential';
|
|
428
|
+
}
|
|
429
|
+
return order;
|
|
430
|
+
}
|
|
431
|
+
render() {
|
|
432
|
+
const { layout } = this;
|
|
433
|
+
const order = this.getOrder();
|
|
434
|
+
const theme = getIonTheme(this);
|
|
435
|
+
return (h(Host, { key: '8a8266626f1ba8beb7e382c89ae7905372fe23a9', class: {
|
|
436
|
+
[theme]: true,
|
|
437
|
+
[`gallery-layout-${layout}`]: true,
|
|
438
|
+
[`gallery-order-${order}`]: layout === 'masonry' && order !== undefined,
|
|
439
|
+
} }, h("slot", { key: '7758e89bda53a91d593b9ece0cbe60a4bce0a0fa', onSlotchange: this.onSlotChange })));
|
|
440
|
+
}
|
|
441
|
+
static get is() { return "ion-gallery"; }
|
|
442
|
+
static get encapsulation() { return "shadow"; }
|
|
443
|
+
static get originalStyleUrls() {
|
|
444
|
+
return {
|
|
445
|
+
"$": ["gallery.scss"]
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
static get styleUrls() {
|
|
449
|
+
return {
|
|
450
|
+
"$": ["gallery.css"]
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
static get properties() {
|
|
454
|
+
return {
|
|
455
|
+
"layout": {
|
|
456
|
+
"type": "string",
|
|
457
|
+
"mutable": false,
|
|
458
|
+
"complexType": {
|
|
459
|
+
"original": "'uniform' | 'masonry'",
|
|
460
|
+
"resolved": "\"masonry\" | \"uniform\"",
|
|
461
|
+
"references": {}
|
|
462
|
+
},
|
|
463
|
+
"required": false,
|
|
464
|
+
"optional": false,
|
|
465
|
+
"docs": {
|
|
466
|
+
"tags": [],
|
|
467
|
+
"text": "The visual layout of the gallery. When `uniform`, rows take up the height\nof the tallest item and are spaced evenly across the gallery. Additionally,\nitems will have an aspect ratio of 1/1, forcing them to be square unless a\nheight is explicitly set. When `masonry`, items will be positioned under each\nother with only the specified gap between them."
|
|
468
|
+
},
|
|
469
|
+
"getter": false,
|
|
470
|
+
"setter": false,
|
|
471
|
+
"reflect": false,
|
|
472
|
+
"attribute": "layout",
|
|
473
|
+
"defaultValue": "'uniform'"
|
|
474
|
+
},
|
|
475
|
+
"order": {
|
|
476
|
+
"type": "string",
|
|
477
|
+
"mutable": false,
|
|
478
|
+
"complexType": {
|
|
479
|
+
"original": "'sequential' | 'best-fit'",
|
|
480
|
+
"resolved": "\"best-fit\" | \"sequential\" | undefined",
|
|
481
|
+
"references": {}
|
|
482
|
+
},
|
|
483
|
+
"required": false,
|
|
484
|
+
"optional": true,
|
|
485
|
+
"docs": {
|
|
486
|
+
"tags": [],
|
|
487
|
+
"text": "The order in which items are positioned. Only applies when layout is\n`masonry`. When `sequential`, items are positioned in the order they are\nplaced in the DOM. When `best-fit`, items are positioned under the column\nwith the most available space. Defaults to `sequential` when layout is\n`masonry` and `order` is not explicitly set."
|
|
488
|
+
},
|
|
489
|
+
"getter": false,
|
|
490
|
+
"setter": false,
|
|
491
|
+
"reflect": false,
|
|
492
|
+
"attribute": "order"
|
|
493
|
+
},
|
|
494
|
+
"columns": {
|
|
495
|
+
"type": "any",
|
|
496
|
+
"mutable": false,
|
|
497
|
+
"complexType": {
|
|
498
|
+
"original": "GalleryColumns",
|
|
499
|
+
"resolved": "GalleryBreakpoints<string | number> | number | string",
|
|
500
|
+
"references": {
|
|
501
|
+
"GalleryColumns": {
|
|
502
|
+
"location": "import",
|
|
503
|
+
"path": "./gallery-interface",
|
|
504
|
+
"id": "src/components/gallery/gallery-interface.ts::GalleryColumns",
|
|
505
|
+
"referenceLocation": "GalleryColumns"
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
"required": false,
|
|
510
|
+
"optional": false,
|
|
511
|
+
"docs": {
|
|
512
|
+
"tags": [],
|
|
513
|
+
"text": "The number of columns to display. Can be set as a number or an object of\nbreakpoint values (e.g. `{ xs: 2, sm: 3, md: 4 }`)."
|
|
514
|
+
},
|
|
515
|
+
"getter": false,
|
|
516
|
+
"setter": false,
|
|
517
|
+
"reflect": false,
|
|
518
|
+
"attribute": "columns",
|
|
519
|
+
"defaultValue": "DEFAULT_COLUMNS"
|
|
520
|
+
},
|
|
521
|
+
"gap": {
|
|
522
|
+
"type": "any",
|
|
523
|
+
"mutable": false,
|
|
524
|
+
"complexType": {
|
|
525
|
+
"original": "GalleryGap",
|
|
526
|
+
"resolved": "GalleryBreakpoints<string | number> | number | string",
|
|
527
|
+
"references": {
|
|
528
|
+
"GalleryGap": {
|
|
529
|
+
"location": "import",
|
|
530
|
+
"path": "./gallery-interface",
|
|
531
|
+
"id": "src/components/gallery/gallery-interface.ts::GalleryGap",
|
|
532
|
+
"referenceLocation": "GalleryGap"
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"required": false,
|
|
537
|
+
"optional": false,
|
|
538
|
+
"docs": {
|
|
539
|
+
"tags": [],
|
|
540
|
+
"text": "The space between gallery items. Accepts valid CSS [length-percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/length-percentage)\nvalues like `16px`, `1rem`, `20%`, math functions like `calc(10px + 20%)`,\nor numbers (treated as pixel values). Can also be set as a breakpoint map\n(e.g. `{ xs: '8px', sm: '1rem', md: '24px' }`). Does not accept\nspace-separated values or CSS keyword values like `inherit`, `auto`, etc."
|
|
541
|
+
},
|
|
542
|
+
"getter": false,
|
|
543
|
+
"setter": false,
|
|
544
|
+
"reflect": false,
|
|
545
|
+
"attribute": "gap",
|
|
546
|
+
"defaultValue": "DEFAULT_GAP"
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
static get elementRef() { return "el"; }
|
|
551
|
+
static get watchers() {
|
|
552
|
+
return [{
|
|
553
|
+
"propName": "columns",
|
|
554
|
+
"methodName": "propertiesChanged"
|
|
555
|
+
}, {
|
|
556
|
+
"propName": "gap",
|
|
557
|
+
"methodName": "propertiesChanged"
|
|
558
|
+
}, {
|
|
559
|
+
"propName": "layout",
|
|
560
|
+
"methodName": "propertiesChanged"
|
|
561
|
+
}, {
|
|
562
|
+
"propName": "order",
|
|
563
|
+
"methodName": "propertiesChanged"
|
|
564
|
+
}];
|
|
565
|
+
}
|
|
566
|
+
static get listeners() {
|
|
567
|
+
return [{
|
|
568
|
+
"name": "load",
|
|
569
|
+
"method": "onChildLoad",
|
|
570
|
+
"target": undefined,
|
|
571
|
+
"capture": true,
|
|
572
|
+
"passive": false
|
|
573
|
+
}];
|
|
574
|
+
}
|
|
575
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
export const sharedStyles = `
|
|
5
|
+
ion-gallery {
|
|
6
|
+
width: 343px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
div {
|
|
10
|
+
color: #fff;
|
|
11
|
+
height: 150px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
div:nth-child(1) {
|
|
15
|
+
background: #ff6b6b;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
div:nth-child(2) {
|
|
19
|
+
background: #4ecdc4;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
div:nth-child(3) {
|
|
23
|
+
background: #ffe66d;
|
|
24
|
+
color: #333;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div:nth-child(4) {
|
|
28
|
+
background: #5f27cd;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
div:nth-child(5) {
|
|
32
|
+
background: #7f8c8d;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
div:nth-child(6) {
|
|
36
|
+
background: #ff9f43;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
div:nth-child(7) {
|
|
40
|
+
background: #ff3f34;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
div:nth-child(8) {
|
|
44
|
+
background: #2ecc71;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
div:nth-child(9) {
|
|
48
|
+
background: #34495e;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
div:nth-child(10) {
|
|
52
|
+
background: #1abc9c;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
div:nth-child(11) {
|
|
56
|
+
background: #e67e22;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
div:nth-child(12) {
|
|
60
|
+
background: #9b59b6;
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
export const numberToWords = (value) => {
|
|
64
|
+
const ones = [
|
|
65
|
+
'zero',
|
|
66
|
+
'one',
|
|
67
|
+
'two',
|
|
68
|
+
'three',
|
|
69
|
+
'four',
|
|
70
|
+
'five',
|
|
71
|
+
'six',
|
|
72
|
+
'seven',
|
|
73
|
+
'eight',
|
|
74
|
+
'nine',
|
|
75
|
+
'ten',
|
|
76
|
+
'eleven',
|
|
77
|
+
'twelve',
|
|
78
|
+
'thirteen',
|
|
79
|
+
'fourteen',
|
|
80
|
+
'fifteen',
|
|
81
|
+
'sixteen',
|
|
82
|
+
'seventeen',
|
|
83
|
+
'eighteen',
|
|
84
|
+
'nineteen',
|
|
85
|
+
];
|
|
86
|
+
const tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
|
|
87
|
+
if (!Number.isInteger(value) || value < 0 || value >= 100) {
|
|
88
|
+
return `${value}`;
|
|
89
|
+
}
|
|
90
|
+
let word = '';
|
|
91
|
+
if (value < 20) {
|
|
92
|
+
word = ones[value];
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const tensValue = Math.floor(value / 10);
|
|
96
|
+
const onesValue = value % 10;
|
|
97
|
+
word = onesValue === 0 ? tens[tensValue] : `${tens[tensValue]}-${ones[onesValue]}`;
|
|
98
|
+
}
|
|
99
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
100
|
+
};
|
|
@@ -16,10 +16,10 @@ export class Grid {
|
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
18
|
const theme = getIonTheme(this);
|
|
19
|
-
return (h(Host, { key: '
|
|
19
|
+
return (h(Host, { key: '43b4e05ef076160d901c70dc37e177f19b524349', class: {
|
|
20
20
|
[theme]: true,
|
|
21
21
|
'grid-fixed': this.fixed,
|
|
22
|
-
} }, h("slot", { key: '
|
|
22
|
+
} }, h("slot", { key: 'f3805936034708e6783223ded72c0ecfd40e5fb0' })));
|
|
23
23
|
}
|
|
24
24
|
static get is() { return "ion-grid"; }
|
|
25
25
|
static get encapsulation() { return "shadow"; }
|