@eldrajs/theme-cli 0.0.0 → 0.1.0
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/CHANGELOG.md +69 -0
- package/LICENSE +21 -0
- package/README.md +26 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +203 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +3 -0
- package/dist/validate-C6jB8_Oc.js +510 -0
- package/package.json +50 -2
- package/template/.eldra/block-types.d.ts +429 -0
- package/template/.eldra/manifest.json +9377 -0
- package/template/.eldra/previews.json +36 -0
- package/template/.github/workflows/eldra-deploy.yml +24 -0
- package/template/.gitlab-ci.yml +16 -0
- package/template/.storybook/eldra.ts +123 -0
- package/template/.storybook/i18n.ts +23 -0
- package/template/.storybook/main.ts +59 -0
- package/template/.storybook/nuxt-link-stub.ts +23 -0
- package/template/.storybook/preview.ts +52 -0
- package/template/.storybook/shims-vue.d.ts +10 -0
- package/template/.storybook/virtual-eldra.d.ts +27 -0
- package/template/README.md +288 -0
- package/template/app/app.vue +126 -0
- package/template/app/assets/main.css +404 -0
- package/template/app/components/EldraIcon.vue +66 -0
- package/template/app/components/EldraRouterLink.vue +62 -0
- package/template/app/components/ui/UiImage.stories.ts +30 -0
- package/template/app/components/ui/UiImage.vue +224 -0
- package/template/app/components/ui/__tests__/UiImage.spec.ts +292 -0
- package/template/app/composables/iconComponent.ts +84 -0
- package/template/app/composables/iconFetcher.ts +14 -0
- package/template/app/composables/useBlockData.ts +30 -0
- package/template/app/composables/useEditing.ts +31 -0
- package/template/app/composables/useEldraIcon.ts +46 -0
- package/template/app/composables/useRevalidating.ts +69 -0
- package/template/app/composables/useRichTextScrollRegions.ts +80 -0
- package/template/app/composables/useStorefront.ts +18 -0
- package/template/app/composables/useStorefrontFeedback.ts +49 -0
- package/template/app/composables/useUiId.ts +18 -0
- package/template/app/composables/useWishlist.ts +42 -0
- package/template/app/i18n.d.ts +28 -0
- package/template/app/icons.ts +185 -0
- package/template/app/pages/[...slug].vue +134 -0
- package/template/app/plugins/eldra-i18n.ts +98 -0
- package/template/app/plugins/eldra-storefront.ts +288 -0
- package/template/app/plugins/eldra-ui-messages.ts +112 -0
- package/template/app/storefront/cart.ts +245 -0
- package/template/app/storefront/categories.ts +283 -0
- package/template/app/storefront/collectionSelector.ts +60 -0
- package/template/app/storefront/commerce.ts +58 -0
- package/template/app/storefront/demo.ts +1313 -0
- package/template/app/storefront/facets.ts +476 -0
- package/template/app/storefront/feedback.ts +122 -0
- package/template/app/storefront/gateway.ts +2256 -0
- package/template/app/storefront/history.ts +233 -0
- package/template/app/storefront/money.ts +247 -0
- package/template/app/storefront/options.ts +71 -0
- package/template/app/storefront/prerender.ts +77 -0
- package/template/app/storefront/refresh.ts +222 -0
- package/template/app/storefront/toProductCard.ts +154 -0
- package/template/app/storefront/types.ts +815 -0
- package/template/app/storefront/volatile.ts +211 -0
- package/template/app/templates.ts +544 -0
- package/template/app/utils/classes.ts +40 -0
- package/template/app/utils/links.ts +70 -0
- package/template/app/utils/pageStructure.ts +77 -0
- package/template/app/utils/pageTitle.ts +37 -0
- package/template/app/virtual-eldra.d.ts +12 -0
- package/template/bitbucket-pipelines.yml +19 -0
- package/template/blocks/announcement-bar/Block.vue +203 -0
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +227 -0
- package/template/blocks/announcement-bar/block.json +45 -0
- package/template/blocks/announcement-bar/mock.json +7 -0
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/Block.vue +317 -0
- package/template/blocks/article/__tests__/Block.spec.ts +229 -0
- package/template/blocks/article/block.json +148 -0
- package/template/blocks/article/mock.json +512 -0
- package/template/blocks/article/preview.json +16 -0
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/Block.vue +343 -0
- package/template/blocks/article-list/__tests__/Block.spec.ts +279 -0
- package/template/blocks/article-list/block.json +181 -0
- package/template/blocks/article-list/mock.json +68 -0
- package/template/blocks/article-list/preview.json +84 -0
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/Block.vue +278 -0
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +461 -0
- package/template/blocks/breadcrumbs/block.json +89 -0
- package/template/blocks/breadcrumbs/mock.json +11 -0
- package/template/blocks/breadcrumbs/preview.json +3 -0
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/Block.vue +372 -0
- package/template/blocks/cart/__tests__/Block.spec.ts +561 -0
- package/template/blocks/cart/__tests__/ShippingBar.spec.ts +78 -0
- package/template/blocks/cart/__tests__/Summary.spec.ts +245 -0
- package/template/blocks/cart/block.json +74 -0
- package/template/blocks/cart/mock.json +11 -0
- package/template/blocks/cart/parts/CartLines.vue +257 -0
- package/template/blocks/cart/parts/ShippingBar.vue +105 -0
- package/template/blocks/cart/parts/Summary.vue +291 -0
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +1832 -0
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +3037 -0
- package/template/blocks/collection-grid/__tests__/groups.spec.ts +731 -0
- package/template/blocks/collection-grid/block.json +187 -0
- package/template/blocks/collection-grid/mock.json +23 -0
- package/template/blocks/collection-grid/parts/groups.ts +861 -0
- package/template/blocks/collection-grid/preview.json +7 -0
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +533 -0
- package/template/blocks/collection-header/__tests__/Block.spec.ts +381 -0
- package/template/blocks/collection-header/block.json +140 -0
- package/template/blocks/collection-header/mock.json +28 -0
- package/template/blocks/collection-header/preview.json +14 -0
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/Block.vue +621 -0
- package/template/blocks/contact/__tests__/Block.spec.ts +347 -0
- package/template/blocks/contact/block.json +174 -0
- package/template/blocks/contact/mock.json +28 -0
- package/template/blocks/contact/preview.json +9 -0
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/Block.vue +383 -0
- package/template/blocks/cta/__tests__/Block.spec.ts +309 -0
- package/template/blocks/cta/block.json +86 -0
- package/template/blocks/cta/mock.json +10 -0
- package/template/blocks/cta/preview.json +9 -0
- package/template/blocks/cta/preview.png +0 -0
- package/template/blocks/faq/Block.vue +254 -0
- package/template/blocks/faq/__tests__/Block.spec.ts +312 -0
- package/template/blocks/faq/block.json +113 -0
- package/template/blocks/faq/mock.json +115 -0
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/Block.vue +241 -0
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +311 -0
- package/template/blocks/feature-grid/block.json +106 -0
- package/template/blocks/feature-grid/mock.json +29 -0
- package/template/blocks/feature-grid/preview.json +45 -0
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +652 -0
- package/template/blocks/footer/__tests__/Block.spec.ts +700 -0
- package/template/blocks/footer/block.json +240 -0
- package/template/blocks/footer/mock.json +161 -0
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/gallery/Block.vue +416 -0
- package/template/blocks/gallery/__tests__/Block.spec.ts +289 -0
- package/template/blocks/gallery/block.json +87 -0
- package/template/blocks/gallery/mock.json +16 -0
- package/template/blocks/gallery/preview.json +64 -0
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +378 -0
- package/template/blocks/hero/__tests__/Block.spec.ts +324 -0
- package/template/blocks/hero/block.json +146 -0
- package/template/blocks/hero/mock.json +11 -0
- package/template/blocks/hero/preview.json +55 -0
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/Block.vue +232 -0
- package/template/blocks/image/__tests__/Block.spec.ts +224 -0
- package/template/blocks/image/block.json +67 -0
- package/template/blocks/image/mock.json +7 -0
- package/template/blocks/image/preview.json +9 -0
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/Block.vue +206 -0
- package/template/blocks/logo-cloud/__tests__/Block.spec.ts +210 -0
- package/template/blocks/logo-cloud/block.json +79 -0
- package/template/blocks/logo-cloud/mock.json +15 -0
- package/template/blocks/logo-cloud/preview.json +92 -0
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +1348 -0
- package/template/blocks/navigation/__tests__/Block.spec.ts +2030 -0
- package/template/blocks/navigation/block.json +167 -0
- package/template/blocks/navigation/mock.json +191 -0
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/navigation/useMegaMenuKeys.ts +276 -0
- package/template/blocks/newsletter/Block.vue +399 -0
- package/template/blocks/newsletter/__tests__/Block.spec.ts +365 -0
- package/template/blocks/newsletter/block.json +105 -0
- package/template/blocks/newsletter/mock.json +31 -0
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/Block.vue +754 -0
- package/template/blocks/order-status/__tests__/Block.spec.ts +515 -0
- package/template/blocks/order-status/block.json +138 -0
- package/template/blocks/order-status/mock.json +19 -0
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/Block.vue +297 -0
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +357 -0
- package/template/blocks/pricing-table/block.json +155 -0
- package/template/blocks/pricing-table/mock.json +47 -0
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +459 -0
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +957 -0
- package/template/blocks/product-carousel/block.json +71 -0
- package/template/blocks/product-carousel/mock.json +9 -0
- package/template/blocks/product-carousel/preview.json +7 -0
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +886 -0
- package/template/blocks/product-detail/__tests__/Block.spec.ts +1495 -0
- package/template/blocks/product-detail/__tests__/stock.spec.ts +119 -0
- package/template/blocks/product-detail/block.json +155 -0
- package/template/blocks/product-detail/mock.json +113 -0
- package/template/blocks/product-detail/parts/Gallery.vue +181 -0
- package/template/blocks/product-detail/parts/StickyBuyBar.vue +99 -0
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/product-detail/stock.ts +150 -0
- package/template/blocks/quote/Block.vue +206 -0
- package/template/blocks/quote/__tests__/Block.spec.ts +265 -0
- package/template/blocks/quote/block.json +76 -0
- package/template/blocks/quote/mock.json +9 -0
- package/template/blocks/quote/preview.json +16 -0
- package/template/blocks/quote/preview.png +0 -0
- package/template/blocks/rich-text/Block.vue +143 -0
- package/template/blocks/rich-text/__tests__/Block.spec.ts +191 -0
- package/template/blocks/rich-text/block.json +57 -0
- package/template/blocks/rich-text/mock.json +87 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +589 -0
- package/template/blocks/search/PopularChips.vue +40 -0
- package/template/blocks/search/TypeSection.vue +148 -0
- package/template/blocks/search/__tests__/Block.spec.ts +718 -0
- package/template/blocks/search/__tests__/results.spec.ts +166 -0
- package/template/blocks/search/block.json +102 -0
- package/template/blocks/search/mock.json +18 -0
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/search/results.ts +85 -0
- package/template/blocks/split-content/Block.vue +195 -0
- package/template/blocks/split-content/__tests__/Block.spec.ts +225 -0
- package/template/blocks/split-content/block.json +70 -0
- package/template/blocks/split-content/mock.json +45 -0
- package/template/blocks/split-content/preview.json +58 -0
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/Block.vue +159 -0
- package/template/blocks/stats/__tests__/Block.spec.ts +194 -0
- package/template/blocks/stats/block.json +73 -0
- package/template/blocks/stats/mock.json +12 -0
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/Block.vue +278 -0
- package/template/blocks/tabs/__tests__/Block.spec.ts +303 -0
- package/template/blocks/tabs/block.json +97 -0
- package/template/blocks/tabs/mock.json +129 -0
- package/template/blocks/tabs/preview.json +153 -0
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/Block.vue +288 -0
- package/template/blocks/team/__tests__/Block.spec.ts +221 -0
- package/template/blocks/team/block.json +125 -0
- package/template/blocks/team/mock.json +39 -0
- package/template/blocks/team/preview.json +62 -0
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/Block.vue +408 -0
- package/template/blocks/testimonials/__tests__/Block.spec.ts +319 -0
- package/template/blocks/testimonials/block.json +121 -0
- package/template/blocks/testimonials/mock.json +46 -0
- package/template/blocks/testimonials/preview.json +68 -0
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/Block.vue +274 -0
- package/template/blocks/timeline/__tests__/Block.spec.ts +310 -0
- package/template/blocks/timeline/block.json +98 -0
- package/template/blocks/timeline/mock.json +27 -0
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +330 -0
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +290 -0
- package/template/blocks/trust-strip/block.json +117 -0
- package/template/blocks/trust-strip/mock.json +37 -0
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/Block.vue +354 -0
- package/template/blocks/video-embed/__tests__/Block.spec.ts +219 -0
- package/template/blocks/video-embed/__tests__/embed.spec.ts +76 -0
- package/template/blocks/video-embed/block.json +94 -0
- package/template/blocks/video-embed/embed.ts +84 -0
- package/template/blocks/video-embed/mock.json +13 -0
- package/template/blocks/video-embed/preview.json +9 -0
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/Block.vue +367 -0
- package/template/blocks/wishlist/__tests__/Block.spec.ts +508 -0
- package/template/blocks/wishlist/block.json +42 -0
- package/template/blocks/wishlist/mock.json +9 -0
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +602 -0
- package/template/i18n/is-IS.json +602 -0
- package/template/nuxt.config.ts +148 -0
- package/template/package.json +55 -0
- package/template/pages/article.page.json +731 -0
- package/template/pages/cart.page.json +85 -0
- package/template/pages/category.page.json +133 -0
- package/template/pages/collection.page.json +194 -0
- package/template/pages/home.page.json +353 -0
- package/template/pages/product.page.json +323 -0
- package/template/pages/products.page.json +144 -0
- package/template/pages/search.page.json +83 -0
- package/template/pages/wishlist.page.json +88 -0
- package/template/public/demo/article-cover.svg +1 -0
- package/template/public/demo/article-figure.svg +1 -0
- package/template/public/demo/avatar-1.svg +3 -0
- package/template/public/demo/avatar-2.svg +3 -0
- package/template/public/demo/avatar-3.svg +3 -0
- package/template/public/demo/avatar-4.svg +3 -0
- package/template/public/demo/avatar-5.svg +3 -0
- package/template/public/demo/avatar-6.svg +3 -0
- package/template/public/demo/avatar-7.svg +3 -0
- package/template/public/demo/avatar-8.svg +3 -0
- package/template/public/demo/collection-1.svg +1 -0
- package/template/public/demo/collection-2.svg +1 -0
- package/template/public/demo/cta-split.svg +1 -0
- package/template/public/demo/feature-1.svg +1 -0
- package/template/public/demo/feature-2.svg +1 -0
- package/template/public/demo/feature-3.svg +1 -0
- package/template/public/demo/feature-4.svg +1 -0
- package/template/public/demo/gallery-1.svg +1 -0
- package/template/public/demo/gallery-2.svg +1 -0
- package/template/public/demo/gallery-3.svg +1 -0
- package/template/public/demo/gallery-4.svg +1 -0
- package/template/public/demo/gallery-5.svg +1 -0
- package/template/public/demo/gallery-6.svg +1 -0
- package/template/public/demo/gallery-7.svg +1 -0
- package/template/public/demo/gallery-8.svg +1 -0
- package/template/public/demo/hero-slide-1.svg +1 -0
- package/template/public/demo/hero-slide-2.svg +1 -0
- package/template/public/demo/hero-slide-3.svg +1 -0
- package/template/public/demo/hero-slide-4.svg +1 -0
- package/template/public/demo/hero-wide.svg +1 -0
- package/template/public/demo/hero.svg +1 -0
- package/template/public/demo/logo-1.svg +4 -0
- package/template/public/demo/logo-2.svg +4 -0
- package/template/public/demo/logo-3.svg +4 -0
- package/template/public/demo/logo-4.svg +4 -0
- package/template/public/demo/logo-5.svg +4 -0
- package/template/public/demo/logo-6.svg +4 -0
- package/template/public/demo/logo-7.svg +4 -0
- package/template/public/demo/logo-8.svg +4 -0
- package/template/public/demo/logo.svg +3 -0
- package/template/public/demo/map.svg +1 -0
- package/template/public/demo/poster.svg +1 -0
- package/template/public/demo/product-1.svg +4 -0
- package/template/public/demo/product-10.svg +4 -0
- package/template/public/demo/product-11.svg +4 -0
- package/template/public/demo/product-12.svg +4 -0
- package/template/public/demo/product-2.svg +4 -0
- package/template/public/demo/product-3.svg +4 -0
- package/template/public/demo/product-4.svg +4 -0
- package/template/public/demo/product-5.svg +4 -0
- package/template/public/demo/product-6.svg +4 -0
- package/template/public/demo/product-7.svg +4 -0
- package/template/public/demo/product-8.svg +4 -0
- package/template/public/demo/product-9.svg +4 -0
- package/template/public/demo/product-square-1.svg +4 -0
- package/template/public/demo/product-square-2.svg +4 -0
- package/template/public/demo/product-square-3.svg +4 -0
- package/template/public/demo/product-square-4.svg +4 -0
- package/template/public/demo/product-square-5.svg +4 -0
- package/template/public/demo/product-square-6.svg +4 -0
- package/template/public/demo/quote-portrait.svg +4 -0
- package/template/public/demo/split-1.svg +1 -0
- package/template/public/demo/split-2.svg +1 -0
- package/template/public/demo/split-3.svg +1 -0
- package/template/public/demo/split-4.svg +1 -0
- package/template/public/demo/team-1.svg +4 -0
- package/template/public/demo/team-2.svg +4 -0
- package/template/public/demo/team-3.svg +4 -0
- package/template/public/demo/team-4.svg +4 -0
- package/template/scripts/demo-images.mjs +393 -0
- package/template/scripts/generate-stories.mjs +156 -0
- package/template/scripts/previewHash.mjs +125 -0
- package/template/scripts/previews.mjs +149 -0
- package/template/stories/generated/announcement-bar.stories.ts +44 -0
- package/template/stories/generated/article-list.stories.ts +87 -0
- package/template/stories/generated/article.stories.ts +27 -0
- package/template/stories/generated/breadcrumbs.stories.ts +39 -0
- package/template/stories/generated/cart.stories.ts +38 -0
- package/template/stories/generated/collection-grid.stories.ts +117 -0
- package/template/stories/generated/collection-header.stories.ts +51 -0
- package/template/stories/generated/contact.stories.ts +45 -0
- package/template/stories/generated/cta.stories.ts +51 -0
- package/template/stories/generated/faq.stories.ts +56 -0
- package/template/stories/generated/feature-grid.stories.ts +69 -0
- package/template/stories/generated/footer.stories.ts +50 -0
- package/template/stories/generated/gallery.stories.ts +81 -0
- package/template/stories/generated/hero.stories.ts +75 -0
- package/template/stories/generated/image.stories.ts +99 -0
- package/template/stories/generated/logo-cloud.stories.ts +57 -0
- package/template/stories/generated/navigation.stories.ts +62 -0
- package/template/stories/generated/newsletter.stories.ts +68 -0
- package/template/stories/generated/order-status.stories.ts +32 -0
- package/template/stories/generated/pricing-table.stories.ts +44 -0
- package/template/stories/generated/product-carousel.stories.ts +75 -0
- package/template/stories/generated/product-detail.stories.ts +62 -0
- package/template/stories/generated/quote.stories.ts +69 -0
- package/template/stories/generated/rich-text.stories.ts +50 -0
- package/template/stories/generated/search.stories.ts +56 -0
- package/template/stories/generated/split-content.stories.ts +39 -0
- package/template/stories/generated/stats.stories.ts +68 -0
- package/template/stories/generated/tabs.stories.ts +45 -0
- package/template/stories/generated/team.stories.ts +45 -0
- package/template/stories/generated/testimonials.stories.ts +69 -0
- package/template/stories/generated/timeline.stories.ts +80 -0
- package/template/stories/generated/trust-strip.stories.ts +62 -0
- package/template/stories/generated/video-embed.stories.ts +63 -0
- package/template/stories/generated/wishlist.stories.ts +26 -0
- package/template/stories/pages/article.stories.ts +51 -0
- package/template/stories/pages/cart.stories.ts +56 -0
- package/template/stories/pages/category.stories.ts +56 -0
- package/template/stories/pages/collection.stories.ts +51 -0
- package/template/stories/pages/home.stories.ts +51 -0
- package/template/stories/pages/product.stories.ts +47 -0
- package/template/stories/pages/products.stories.ts +58 -0
- package/template/stories/pages/search.stories.ts +54 -0
- package/template/stories/pages/wishlist.stories.ts +53 -0
- package/template/stories/support/pageBlocks.ts +115 -0
- package/template/test/blocksEmptyData.spec.ts +52 -0
- package/template/test/carouselKeyboard.spec.ts +272 -0
- package/template/test/carouselRing.browser.spec.ts +193 -0
- package/template/test/carouselSlideWidth.browser.spec.ts +102 -0
- package/template/test/cartDrawer.spec.ts +295 -0
- package/template/test/cartToast.spec.ts +86 -0
- package/template/test/countPill.browser.spec.ts +196 -0
- package/template/test/demoImages.spec.ts +140 -0
- package/template/test/deps.spec.ts +102 -0
- package/template/test/eldraIcon.spec.ts +58 -0
- package/template/test/framing.spec.ts +76 -0
- package/template/test/i18n.spec.ts +200 -0
- package/template/test/iconComponent.spec.ts +91 -0
- package/template/test/inlineEditable.spec.ts +334 -0
- package/template/test/localePrefix.spec.ts +342 -0
- package/template/test/mainCss.spec.ts +107 -0
- package/template/test/mockGatewayContract.spec.ts +122 -0
- package/template/test/mocks/blocks.ts +20 -0
- package/template/test/mocks/breakpoints.ts +7 -0
- package/template/test/mocks/manifest.ts +11 -0
- package/template/test/moneyFormatting.spec.ts +89 -0
- package/template/test/pageTitle.spec.ts +49 -0
- package/template/test/pages/article.spec.ts +231 -0
- package/template/test/pages/category.spec.ts +185 -0
- package/template/test/pages/collection.spec.ts +396 -0
- package/template/test/pages/home.spec.ts +295 -0
- package/template/test/pages/hydration.spec.ts +557 -0
- package/template/test/pages/product.spec.ts +396 -0
- package/template/test/pages/seededPages.spec.ts +190 -0
- package/template/test/pages/ssr.spec.ts +393 -0
- package/template/test/prerenderCommerce.spec.ts +134 -0
- package/template/test/prerenderFailure.spec.ts +130 -0
- package/template/test/prerenderRefresh.browser.spec.ts +1431 -0
- package/template/test/previewsFresh.spec.ts +56 -0
- package/template/test/richText.spec.ts +161 -0
- package/template/test/richTextTypography.spec.ts +182 -0
- package/template/test/setup.ts +21 -0
- package/template/test/slugPage.spec.ts +244 -0
- package/template/test/slugPageTemplate.spec.ts +194 -0
- package/template/test/starter.spec.ts +1416 -0
- package/template/test/storefront/cart.spec.ts +404 -0
- package/template/test/storefront/categories.spec.ts +235 -0
- package/template/test/storefront/collectionSelector.spec.ts +74 -0
- package/template/test/storefront/demo.spec.ts +555 -0
- package/template/test/storefront/facets.spec.ts +425 -0
- package/template/test/storefront/feedback.spec.ts +97 -0
- package/template/test/storefront/gateway.spec.ts +2673 -0
- package/template/test/storefront/gatewayCart.spec.ts +289 -0
- package/template/test/storefront/gatewayPrerender.spec.ts +1037 -0
- package/template/test/storefront/history.spec.ts +341 -0
- package/template/test/storefront/money.spec.ts +171 -0
- package/template/test/storefront/toProductCard.spec.ts +138 -0
- package/template/test/storefront/volatile.spec.ts +284 -0
- package/template/test/support/axe.ts +14 -0
- package/template/test/support/dialog.ts +51 -0
- package/template/test/support/hydrate.ts +118 -0
- package/template/test/support/i18nText.ts +11 -0
- package/template/test/support/mockGateway.ts +1017 -0
- package/template/test/support/mountBlock.ts +194 -0
- package/template/test/support/mountPage.spec.ts +72 -0
- package/template/test/support/mountPage.ts +254 -0
- package/template/test/support/mountProbe.client.ts +69 -0
- package/template/test/support/renderSsr.ts +97 -0
- package/template/test/support/staticServer.ts +96 -0
- package/template/test/themeIcons.spec.ts +140 -0
- package/template/test/toastAnnouncement.spec.ts +133 -0
- package/template/test/tokens.spec.ts +102 -0
- package/template/test/uiMessagesPlugin.spec.ts +104 -0
- package/template/test/useBlockData.spec.ts +46 -0
- package/template/test/useEditing.spec.ts +54 -0
- package/template/test/useEldraIcon.spec.ts +126 -0
- package/template/test/useUiId.spec.ts +40 -0
- package/template/tokens.json +149 -0
- package/template/tsconfig.json +3 -0
- package/template/tsconfig.storybook.json +17 -0
- package/template/vitest-axe.d.ts +13 -0
- package/template/vitest.config.ts +44 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Gallery: a set of photos as a grid, masonry columns or a carousel, every image opening
|
|
4
|
+
* `@eldrajs/ui`'s `Lightbox` at that image with its caption (spec `02-blocks.md` 2720–2845,
|
|
5
|
+
* "Gallery"). `variant`:
|
|
6
|
+
*
|
|
7
|
+
* - `grid`: an even grid of `aspect`-cropped tiles, 2 columns below `@tablet` (48rem), 3 from
|
|
8
|
+
* `@tablet`, `columns` from `@content` (64rem) — `GRID_COLUMN_CLASS` below is the static
|
|
9
|
+
* per-`columns` lookup the `@content` step reads.
|
|
10
|
+
* - `masonry`: CSS multi-column (`columns-2` / `@tablet:columns-3` / `@content:columns-N`,
|
|
11
|
+
* `MASONRY_COLUMN_CLASS`'s own lookup), each image at its own natural ratio (`aspect` ignored —
|
|
12
|
+
* no `aspect` prop reaches `UiImage`, so its frame falls back to `ratio="auto"`) with
|
|
13
|
+
* `break-inside-avoid` on every `<li>` so items never split across columns and read down each
|
|
14
|
+
* column, then the next (DOM order — `columns` is a layout-only CSS property, it never
|
|
15
|
+
* reorders).
|
|
16
|
+
* - `carousel`: `@eldrajs/ui`'s `Carousel`, `controls="header"` so the block head (heading, intro)
|
|
17
|
+
* and the arrows/counter share one row (spec "Carousel" row: "the controls … sit in the block
|
|
18
|
+
* head on the right") — the heading/intro markup is therefore duplicated into the `#header`
|
|
19
|
+
* slot rather than rendered as a separate block head above the component, the same "head moves
|
|
20
|
+
* inside the named-region component" shape `testimonials`'/`hero`'s own carousel variants use.
|
|
21
|
+
*
|
|
22
|
+
* Every tile is a real `<button type="button" aria-haspopup="dialog">` this starter draws itself
|
|
23
|
+
* (`focusRing`, from `app/utils/classes.ts` — the one interactive element left that is not a
|
|
24
|
+
* package component) with a decorative `UiImage` and an always-visible `aria-hidden` zoom badge
|
|
25
|
+
* (`EldraIcon` `zoom-in`), never hover-only (spec Accessibility: "The zoom badge is `aria-hidden`
|
|
26
|
+
* and always visible, so the action is never hover-only"). Clicking (or `Enter`/`Space`, wired
|
|
27
|
+
* explicitly — jsdom's `<button>` has no native key-to-click translation to rely on for the test
|
|
28
|
+
* suite, and a real browser already does this for free either way) opens the one shared `Lightbox`
|
|
29
|
+
* at that image's position; `useDialog` (inside `Lightbox`) captures whatever had focus the instant
|
|
30
|
+
* it opens and restores it on close, which is what returns focus to the tile that opened it with no
|
|
31
|
+
* extra code here — the same mechanism every modal in this package already returns focus through.
|
|
32
|
+
*
|
|
33
|
+
* `items[].image` is optional at the type level even though the field is required in Studio (an
|
|
34
|
+
* item can exist — captions typed in ahead of picking a photo — with no image chosen yet, exactly
|
|
35
|
+
* `mock.json`'s own state: six captioned items, zero real images, since media is never present in
|
|
36
|
+
* Studio's insert seed). Spec States: "Missing image: the item is skipped on the live site. The
|
|
37
|
+
* editor shows the Image placeholder in its place." — so live filters every item down to the ones
|
|
38
|
+
* with a real image (`validItems`); editing renders every item, an per-tile `EditorPlaceholder`
|
|
39
|
+
* standing in for a missing image (the same "Choose an image" hint `feature-grid`'s own image media
|
|
40
|
+
* type uses for the same state). The whole gallery still needs at least two real images to render
|
|
41
|
+
* live at all (spec States, "Empty (freshly inserted)": "Nothing renders on the live site until
|
|
42
|
+
* there are at least 2 images") — `showItems` is that gate; a `0`-item `items` list (never Studio's
|
|
43
|
+
* own seed, but a plausible state after clearing every row) shows the block-level "Add images" hint
|
|
44
|
+
* instead, the spec's own wording at line 2784.
|
|
45
|
+
*/
|
|
46
|
+
import { computed, ref } from 'vue';
|
|
47
|
+
import { Carousel, Container, EditorPlaceholder, Lightbox, Section } from '@eldrajs/ui';
|
|
48
|
+
import type { LightboxImage } from '@eldrajs/ui';
|
|
49
|
+
import { useBlockData } from '../../app/composables/useBlockData';
|
|
50
|
+
import { useEditing } from '../../app/composables/useEditing';
|
|
51
|
+
import { useI18n } from 'vue-i18n';
|
|
52
|
+
import { useUiId } from '../../app/composables/useUiId';
|
|
53
|
+
import EldraIcon from '../../app/components/EldraIcon.vue';
|
|
54
|
+
import UiImage from '../../app/components/ui/UiImage.vue';
|
|
55
|
+
import { focusRing } from '../../app/utils/classes';
|
|
56
|
+
|
|
57
|
+
const FALLBACK_WIDTH = 1600;
|
|
58
|
+
const FALLBACK_HEIGHT = 1000;
|
|
59
|
+
|
|
60
|
+
/** Spec "Gallery" → Fields: `aspect` stores `1x1`/`4x5`/`3x2`; `UiImage`'s own `aspect` prop reads
|
|
61
|
+
* the slash-separated form (see its `ASPECT_TO_RATIO`). */
|
|
62
|
+
const ASPECT_TO_UI_IMAGE: Record<string, string> = { '1x1': '1/1', '4x5': '4/5', '3x2': '3/2' };
|
|
63
|
+
|
|
64
|
+
/** Spec "Gallery" → Layout: "From 64rem: `columns` (3 by default)." A static per-`columns` lookup,
|
|
65
|
+
* not a computed template literal — Tailwind only ships classes it can see written out. */
|
|
66
|
+
const GRID_COLUMN_CLASS: Record<'2' | '3' | '4', string> = {
|
|
67
|
+
'2': '@content:grid-cols-2',
|
|
68
|
+
'3': '@content:grid-cols-3',
|
|
69
|
+
'4': '@content:grid-cols-4',
|
|
70
|
+
};
|
|
71
|
+
const MASONRY_COLUMN_CLASS: Record<'2' | '3' | '4', string> = {
|
|
72
|
+
'2': '@content:columns-2',
|
|
73
|
+
'3': '@content:columns-3',
|
|
74
|
+
'4': '@content:columns-4',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
interface GalleryItem {
|
|
78
|
+
image?: EldraMedia;
|
|
79
|
+
caption?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** One rendered tile: the source item, whether it has a real image, and — only when it does — its
|
|
83
|
+
* position among the images that actually have one (what the Lightbox and every tile's own
|
|
84
|
+
* "image N of total" label count against, never the raw, possibly-placeholder-holding list
|
|
85
|
+
* index). */
|
|
86
|
+
interface GalleryEntry {
|
|
87
|
+
item: GalleryItem;
|
|
88
|
+
hasImage: boolean;
|
|
89
|
+
validIndex: number | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const props = defineProps<{ entry: EldraBlockEntry<'gallery'> }>();
|
|
93
|
+
const { data } = useBlockData(props, 'gallery');
|
|
94
|
+
const { t } = useI18n();
|
|
95
|
+
const isEditing = useEditing();
|
|
96
|
+
const headingId = `gallery-heading-${useUiId()}`;
|
|
97
|
+
|
|
98
|
+
const variant = computed(() => data.value.variant ?? 'grid');
|
|
99
|
+
const isCarousel = computed(() => variant.value === 'carousel');
|
|
100
|
+
const isMasonry = computed(() => variant.value === 'masonry');
|
|
101
|
+
|
|
102
|
+
const heading = computed(() => (data.value.heading ?? '').trim());
|
|
103
|
+
const hasHeading = computed(() => heading.value !== '');
|
|
104
|
+
const showHeadingHint = computed(() => isEditing.value && !hasHeading.value);
|
|
105
|
+
const intro = computed(() => (data.value.intro ?? '').trim());
|
|
106
|
+
const hasIntro = computed(() => intro.value !== '');
|
|
107
|
+
const hasHead = computed(() => hasHeading.value || hasIntro.value || showHeadingHint.value);
|
|
108
|
+
|
|
109
|
+
/** `carousel`'s own `Carousel` already renders a named `role="region"` (see `carouselAriaLabel`
|
|
110
|
+
* below) — labelling the outer `Section` too would give two nested landmarks the same accessible
|
|
111
|
+
* name (axe `landmark-unique`), the same reasoning `testimonials`/`feature-grid` apply to their
|
|
112
|
+
* own carousel variant. */
|
|
113
|
+
const sectionLabelledBy = computed(() =>
|
|
114
|
+
hasHeading.value && !isCarousel.value ? headingId : undefined
|
|
115
|
+
);
|
|
116
|
+
const carouselAriaLabel = computed(() => heading.value || t('gallery.carouselFallback'));
|
|
117
|
+
const viewerAriaLabel = computed(() =>
|
|
118
|
+
hasHeading.value ? t('gallery.viewerHeading', { heading: heading.value }) : t('gallery.viewer')
|
|
119
|
+
);
|
|
120
|
+
/** Both bound below as `:ariaLabel` (camelCase), not `:aria-label` — see `blocks/hero/Block.vue`'s
|
|
121
|
+
* own `carouselAriaLabel` comment: `Carousel.ariaLabel` and `Lightbox.ariaLabel` are both
|
|
122
|
+
* *required* props, and the kebab→camel prop match Vue applies to a bound attribute is a
|
|
123
|
+
* runtime-only behaviour, invisible to `nuxi typecheck`'s template type-checking. */
|
|
124
|
+
|
|
125
|
+
const columns = computed<'2' | '3' | '4'>(() => data.value.columns ?? '3');
|
|
126
|
+
const showCaptions = computed(() => data.value.showCaptions !== false);
|
|
127
|
+
/** Spec "Gallery" → Fields, `aspect` row: default `1:1` for `grid`, `4:5` for `carousel`;
|
|
128
|
+
* `masonry` never reads this (see the module doc comment). */
|
|
129
|
+
const effectiveAspect = computed(() => data.value.aspect ?? (isCarousel.value ? '4x5' : '1x1'));
|
|
130
|
+
const tileAspect = computed(() => ASPECT_TO_UI_IMAGE[effectiveAspect.value] ?? '1/1');
|
|
131
|
+
|
|
132
|
+
const gridClass = computed(() => [
|
|
133
|
+
'grid grid-cols-2 gap-3 @tablet:grid-cols-3 @tablet:gap-4 @content:gap-6',
|
|
134
|
+
GRID_COLUMN_CLASS[columns.value],
|
|
135
|
+
]);
|
|
136
|
+
const masonryClass = computed(() => [
|
|
137
|
+
'columns-2 gap-3 @tablet:columns-3 @tablet:gap-4 @content:gap-6',
|
|
138
|
+
MASONRY_COLUMN_CLASS[columns.value],
|
|
139
|
+
]);
|
|
140
|
+
|
|
141
|
+
function hasImage(item: GalleryItem): item is GalleryItem & { image: EldraMedia } {
|
|
142
|
+
return Boolean(item.image?.url);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const allItems = computed<GalleryItem[]>(() => data.value.items ?? []);
|
|
146
|
+
/** Every item with a real image, in order — what the Lightbox shows and what every tile's own
|
|
147
|
+
* position/count is read against, live or editing alike. */
|
|
148
|
+
const validItems = computed(() => allItems.value.filter(hasImage));
|
|
149
|
+
const total = computed(() => validItems.value.length);
|
|
150
|
+
const hasEnoughImages = computed(() => total.value >= 2);
|
|
151
|
+
|
|
152
|
+
/** Live: only items with a real image render at all (Global Constraints, "Editor vs live"; spec
|
|
153
|
+
* States, "Missing image": "skipped on the live site"). Editing: every item renders, so a
|
|
154
|
+
* still-imageless item shows its own placeholder instead of vanishing. */
|
|
155
|
+
const displayItems = computed<GalleryItem[]>(() =>
|
|
156
|
+
isEditing.value ? allItems.value : validItems.value
|
|
157
|
+
);
|
|
158
|
+
const entries = computed<GalleryEntry[]>(() => {
|
|
159
|
+
let position = 0;
|
|
160
|
+
return displayItems.value.map((item) => {
|
|
161
|
+
const withImage = hasImage(item);
|
|
162
|
+
const entry: GalleryEntry = {
|
|
163
|
+
item,
|
|
164
|
+
hasImage: withImage,
|
|
165
|
+
validIndex: withImage ? position : null,
|
|
166
|
+
};
|
|
167
|
+
if (withImage) position += 1;
|
|
168
|
+
return entry;
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
/** Whether the tiles/carousel (and the Lightbox) mount at all: live needs at least two real images
|
|
173
|
+
* (spec States, "Empty (freshly inserted)": "Nothing renders on the live site until there are at
|
|
174
|
+
* least 2 images"); editing only needs *some* item to edit, real image or not. */
|
|
175
|
+
const showItems = computed(() =>
|
|
176
|
+
isEditing.value ? allItems.value.length > 0 : hasEnoughImages.value
|
|
177
|
+
);
|
|
178
|
+
/** The block-level "no images yet" hint (spec line 2784) — only for a genuinely empty list; an
|
|
179
|
+
* item with a caption but no image yet gets its own per-tile placeholder instead (see
|
|
180
|
+
* `entries`/`hasImage` above), not this one. */
|
|
181
|
+
const showItemsHint = computed(() => isEditing.value && allItems.value.length === 0);
|
|
182
|
+
|
|
183
|
+
function tileLabel(entry: GalleryEntry): string {
|
|
184
|
+
if (!hasImage(entry.item) || entry.validIndex === null) return '';
|
|
185
|
+
return t('gallery.viewLarger', {
|
|
186
|
+
index: entry.validIndex + 1,
|
|
187
|
+
count: total.value,
|
|
188
|
+
alt: entry.item.image.altText ?? '',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const lightboxOpen = ref(false);
|
|
193
|
+
const lightboxIndex = ref(0);
|
|
194
|
+
|
|
195
|
+
function openLightbox(entry: GalleryEntry): void {
|
|
196
|
+
if (entry.validIndex === null) return;
|
|
197
|
+
lightboxIndex.value = entry.validIndex;
|
|
198
|
+
lightboxOpen.value = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Caption always shows in the Lightbox regardless of `showCaptions` (spec "Gallery" → Fields,
|
|
202
|
+
* `showCaptions` row: "Captions always show in the Lightbox"). */
|
|
203
|
+
const lightboxImages = computed<LightboxImage[]>(() =>
|
|
204
|
+
validItems.value.map((item) => {
|
|
205
|
+
const caption = (item.caption ?? '').trim();
|
|
206
|
+
return {
|
|
207
|
+
src: item.image.url,
|
|
208
|
+
alt: item.image.altText ?? '',
|
|
209
|
+
caption: caption === '' ? undefined : caption,
|
|
210
|
+
width: item.image.width ?? FALLBACK_WIDTH,
|
|
211
|
+
height: item.image.height ?? FALLBACK_HEIGHT,
|
|
212
|
+
};
|
|
213
|
+
})
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
/** The scale-on-hover the tile image gets (spec "Gallery" → Layout: "On hover, the image scales to
|
|
217
|
+
* 1.03 over `duration-base` `ease-out`"), gated entirely behind `motion-safe:` (Global
|
|
218
|
+
* Constraints, "Motion is gated behind `motion-safe:`") rather than a plain `transition`/`scale`
|
|
219
|
+
* pair with a `motion-reduce:transition-none` opt-out — the spec's own "Reduced motion: the tile
|
|
220
|
+
* hover zoom is off" needs the scale itself never applied, not merely un-animated. */
|
|
221
|
+
const TILE_MEDIA_CLASS =
|
|
222
|
+
'motion-safe:transition-transform motion-safe:duration-base motion-safe:ease-out ' +
|
|
223
|
+
'motion-safe:group-hover:scale-[1.03]';
|
|
224
|
+
</script>
|
|
225
|
+
|
|
226
|
+
<template>
|
|
227
|
+
<Section spacing="md" :labelled-by="sectionLabelledBy">
|
|
228
|
+
<Container width="content">
|
|
229
|
+
<!-- grid / masonry: a plain head above the tiles. carousel renders the same markup inside
|
|
230
|
+
Carousel's own #header slot instead (see the module doc comment). -->
|
|
231
|
+
<div v-if="hasHead && !isCarousel" class="mb-8">
|
|
232
|
+
<h2
|
|
233
|
+
v-if="hasHeading"
|
|
234
|
+
:id="headingId"
|
|
235
|
+
class="font-heading @tablet:text-h2 text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em]"
|
|
236
|
+
>
|
|
237
|
+
{{ heading }}
|
|
238
|
+
</h2>
|
|
239
|
+
<EditorPlaceholder
|
|
240
|
+
v-else-if="showHeadingHint"
|
|
241
|
+
:id="headingId"
|
|
242
|
+
inline
|
|
243
|
+
:label="t('gallery.headingHintLabel')"
|
|
244
|
+
:help="t('gallery.headingHintHelp')"
|
|
245
|
+
/>
|
|
246
|
+
<p v-if="hasIntro" class="text-muted mt-2 text-base">{{ intro }}</p>
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
<template v-if="showItems">
|
|
250
|
+
<ul v-if="variant === 'grid'" role="list" :class="gridClass">
|
|
251
|
+
<li v-for="(entry, index) in entries" :key="index">
|
|
252
|
+
<figure>
|
|
253
|
+
<button
|
|
254
|
+
v-if="entry.hasImage"
|
|
255
|
+
type="button"
|
|
256
|
+
aria-haspopup="dialog"
|
|
257
|
+
:aria-label="tileLabel(entry)"
|
|
258
|
+
:class="[focusRing, 'group relative block w-full cursor-zoom-in rounded-lg']"
|
|
259
|
+
@click="openLightbox(entry)"
|
|
260
|
+
@keydown.enter.prevent="openLightbox(entry)"
|
|
261
|
+
@keydown.space.prevent="openLightbox(entry)"
|
|
262
|
+
>
|
|
263
|
+
<UiImage
|
|
264
|
+
:src="entry.item.image!.url"
|
|
265
|
+
alt=""
|
|
266
|
+
:framing="entry.item.image!.framing ?? null"
|
|
267
|
+
:aspect="tileAspect"
|
|
268
|
+
rounded="lg"
|
|
269
|
+
class="w-full"
|
|
270
|
+
:classes="{ media: TILE_MEDIA_CLASS }"
|
|
271
|
+
/>
|
|
272
|
+
<span
|
|
273
|
+
aria-hidden="true"
|
|
274
|
+
class="bg-background text-text absolute right-2 bottom-2 flex size-8 items-center justify-center rounded-full shadow-sm"
|
|
275
|
+
>
|
|
276
|
+
<EldraIcon name="zoom-in" size="sm" />
|
|
277
|
+
</span>
|
|
278
|
+
</button>
|
|
279
|
+
<EditorPlaceholder v-else inline :label="t('gallery.imageHintLabel')" />
|
|
280
|
+
<figcaption
|
|
281
|
+
v-if="showCaptions && entry.item.caption"
|
|
282
|
+
class="text-body-sm text-muted mt-2"
|
|
283
|
+
>
|
|
284
|
+
{{ entry.item.caption }}
|
|
285
|
+
</figcaption>
|
|
286
|
+
</figure>
|
|
287
|
+
</li>
|
|
288
|
+
</ul>
|
|
289
|
+
|
|
290
|
+
<ul v-else-if="isMasonry" role="list" :class="masonryClass">
|
|
291
|
+
<li
|
|
292
|
+
v-for="(entry, index) in entries"
|
|
293
|
+
:key="index"
|
|
294
|
+
class="@tablet:mb-4 @content:mb-6 mb-3 break-inside-avoid"
|
|
295
|
+
>
|
|
296
|
+
<figure>
|
|
297
|
+
<button
|
|
298
|
+
v-if="entry.hasImage"
|
|
299
|
+
type="button"
|
|
300
|
+
aria-haspopup="dialog"
|
|
301
|
+
:aria-label="tileLabel(entry)"
|
|
302
|
+
:class="[focusRing, 'group relative block w-full cursor-zoom-in rounded-lg']"
|
|
303
|
+
@click="openLightbox(entry)"
|
|
304
|
+
@keydown.enter.prevent="openLightbox(entry)"
|
|
305
|
+
@keydown.space.prevent="openLightbox(entry)"
|
|
306
|
+
>
|
|
307
|
+
<UiImage
|
|
308
|
+
:src="entry.item.image!.url"
|
|
309
|
+
alt=""
|
|
310
|
+
:framing="entry.item.image!.framing ?? null"
|
|
311
|
+
rounded="lg"
|
|
312
|
+
class="w-full"
|
|
313
|
+
:classes="{ media: TILE_MEDIA_CLASS }"
|
|
314
|
+
/>
|
|
315
|
+
<span
|
|
316
|
+
aria-hidden="true"
|
|
317
|
+
class="bg-background text-text absolute right-2 bottom-2 flex size-8 items-center justify-center rounded-full shadow-sm"
|
|
318
|
+
>
|
|
319
|
+
<EldraIcon name="zoom-in" size="sm" />
|
|
320
|
+
</span>
|
|
321
|
+
</button>
|
|
322
|
+
<EditorPlaceholder v-else inline :label="t('gallery.imageHintLabel')" />
|
|
323
|
+
<figcaption
|
|
324
|
+
v-if="showCaptions && entry.item.caption"
|
|
325
|
+
class="text-body-sm text-muted mt-2"
|
|
326
|
+
>
|
|
327
|
+
{{ entry.item.caption }}
|
|
328
|
+
</figcaption>
|
|
329
|
+
</figure>
|
|
330
|
+
</li>
|
|
331
|
+
</ul>
|
|
332
|
+
|
|
333
|
+
<Carousel
|
|
334
|
+
v-else
|
|
335
|
+
:ariaLabel="carouselAriaLabel"
|
|
336
|
+
controls="header"
|
|
337
|
+
:dots="false"
|
|
338
|
+
draggable
|
|
339
|
+
:per-view="{ base: 1.28, md: 2.25, lg: 3 }"
|
|
340
|
+
>
|
|
341
|
+
<template #header>
|
|
342
|
+
<div v-if="hasHead">
|
|
343
|
+
<h2
|
|
344
|
+
v-if="hasHeading"
|
|
345
|
+
:id="headingId"
|
|
346
|
+
class="font-heading @tablet:text-h2 text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em]"
|
|
347
|
+
>
|
|
348
|
+
{{ heading }}
|
|
349
|
+
</h2>
|
|
350
|
+
<EditorPlaceholder
|
|
351
|
+
v-else-if="showHeadingHint"
|
|
352
|
+
:id="headingId"
|
|
353
|
+
inline
|
|
354
|
+
:label="t('gallery.headingHintLabel')"
|
|
355
|
+
:help="t('gallery.headingHintHelp')"
|
|
356
|
+
/>
|
|
357
|
+
<p v-if="hasIntro" class="text-muted mt-2 text-base">{{ intro }}</p>
|
|
358
|
+
</div>
|
|
359
|
+
</template>
|
|
360
|
+
|
|
361
|
+
<li v-for="(entry, index) in entries" :key="index" class="list-none">
|
|
362
|
+
<figure>
|
|
363
|
+
<button
|
|
364
|
+
v-if="entry.hasImage"
|
|
365
|
+
type="button"
|
|
366
|
+
aria-haspopup="dialog"
|
|
367
|
+
:aria-label="tileLabel(entry)"
|
|
368
|
+
:class="[focusRing, 'group relative block w-full cursor-zoom-in rounded-lg']"
|
|
369
|
+
@click="openLightbox(entry)"
|
|
370
|
+
@keydown.enter.prevent="openLightbox(entry)"
|
|
371
|
+
@keydown.space.prevent="openLightbox(entry)"
|
|
372
|
+
>
|
|
373
|
+
<UiImage
|
|
374
|
+
:src="entry.item.image!.url"
|
|
375
|
+
alt=""
|
|
376
|
+
:framing="entry.item.image!.framing ?? null"
|
|
377
|
+
:aspect="tileAspect"
|
|
378
|
+
rounded="lg"
|
|
379
|
+
class="w-full"
|
|
380
|
+
:classes="{ media: TILE_MEDIA_CLASS }"
|
|
381
|
+
/>
|
|
382
|
+
<span
|
|
383
|
+
aria-hidden="true"
|
|
384
|
+
class="bg-background text-text absolute right-2 bottom-2 flex size-8 items-center justify-center rounded-full shadow-sm"
|
|
385
|
+
>
|
|
386
|
+
<EldraIcon name="zoom-in" size="sm" />
|
|
387
|
+
</span>
|
|
388
|
+
</button>
|
|
389
|
+
<EditorPlaceholder v-else inline :label="t('gallery.imageHintLabel')" />
|
|
390
|
+
<figcaption
|
|
391
|
+
v-if="showCaptions && entry.item.caption"
|
|
392
|
+
class="text-body-sm text-muted mt-2"
|
|
393
|
+
>
|
|
394
|
+
{{ entry.item.caption }}
|
|
395
|
+
</figcaption>
|
|
396
|
+
</figure>
|
|
397
|
+
</li>
|
|
398
|
+
</Carousel>
|
|
399
|
+
</template>
|
|
400
|
+
<EditorPlaceholder
|
|
401
|
+
v-else-if="showItemsHint"
|
|
402
|
+
:label="t('gallery.itemsHintLabel')"
|
|
403
|
+
:help="t('gallery.itemsHintHelp')"
|
|
404
|
+
/>
|
|
405
|
+
|
|
406
|
+
<Lightbox
|
|
407
|
+
v-if="showItems && total > 0"
|
|
408
|
+
v-model="lightboxOpen"
|
|
409
|
+
v-model:index="lightboxIndex"
|
|
410
|
+
:images="lightboxImages"
|
|
411
|
+
:ariaLabel="viewerAriaLabel"
|
|
412
|
+
thumbnails
|
|
413
|
+
/>
|
|
414
|
+
</Container>
|
|
415
|
+
</Section>
|
|
416
|
+
</template>
|