@eldrajs/theme-cli 0.2.4 → 0.2.6
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 +4 -0
- package/README.md +6 -0
- package/dist/cli.js +8 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/{validate-FjQ-5_ne.js → validate-CC6Mp5i_.js} +2 -1
- package/package.json +3 -3
- package/template/.eldra/block-types.d.ts +1 -1
- package/template/.eldra/manifest.json +30 -2
- package/template/.eldra/previews.json +35 -35
- package/template/README.md +3 -1
- package/template/app/app.vue +16 -3
- package/template/app/assets/main.css +13 -15
- package/template/app/components/ui/UiImage.vue +29 -17
- package/template/app/components/ui/__tests__/UiImage.spec.ts +24 -15
- package/template/app/composables/useStorefront.ts +7 -2
- package/template/app/pages/[...slug].vue +1 -1
- package/template/app/plugins/eldra-storefront.ts +9 -0
- package/template/app/storefront/analytics.ts +15 -7
- package/template/app/storefront/cart.ts +228 -51
- package/template/app/storefront/commerce.ts +8 -2
- package/template/app/storefront/currency.ts +205 -0
- package/template/app/storefront/demo.ts +10 -2
- package/template/app/storefront/feedback.ts +2 -0
- package/template/app/storefront/gateway.ts +153 -35
- package/template/app/storefront/money.ts +6 -18
- package/template/app/storefront/structuredData.ts +16 -5
- package/template/app/storefront/toProductCard.ts +14 -14
- package/template/app/storefront/types.ts +13 -0
- package/template/app/storefront/volatile.ts +4 -0
- package/template/app/utils/seoInput.ts +4 -3
- package/template/blocks/announcement-bar/Block.vue +3 -2
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +1 -1
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/Block.vue +3 -4
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/Block.vue +18 -9
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/Block.vue +1 -1
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +9 -9
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/Block.vue +42 -23
- package/template/blocks/cart/__tests__/Block.spec.ts +2 -3
- package/template/blocks/cart/__tests__/loadFailed.spec.ts +135 -0
- package/template/blocks/cart/__tests__/notSold.spec.ts +109 -0
- package/template/blocks/cart/parts/CartLines.vue +16 -3
- package/template/blocks/cart/parts/CheckoutButton.vue +45 -0
- package/template/blocks/cart/parts/LoadFailed.vue +37 -0
- package/template/blocks/cart/parts/NotSoldNotice.vue +69 -0
- package/template/blocks/cart/parts/ShippingBar.vue +1 -1
- package/template/blocks/cart/parts/Summary.vue +14 -30
- package/template/blocks/cart/parts/notSold.ts +19 -0
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +26 -16
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +26 -14
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +5 -5
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/Block.vue +1 -1
- package/template/blocks/contact/__tests__/Block.spec.ts +2 -2
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/Block.vue +16 -18
- package/template/blocks/cta/__tests__/Block.spec.ts +8 -12
- package/template/blocks/cta/preview.png +0 -0
- package/template/blocks/faq/Block.vue +3 -13
- package/template/blocks/faq/__tests__/Block.spec.ts +2 -2
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/Block.vue +1 -1
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +1 -1
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +33 -55
- package/template/blocks/footer/__tests__/Block.spec.ts +5 -5
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/form/Block.vue +1 -1
- package/template/blocks/form/preview.png +0 -0
- package/template/blocks/gallery/__tests__/Block.spec.ts +1 -1
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +8 -11
- package/template/blocks/hero/__tests__/Block.spec.ts +9 -7
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/Block.vue +4 -4
- package/template/blocks/image/__tests__/Block.spec.ts +5 -6
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/__tests__/Block.spec.ts +1 -1
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +55 -29
- package/template/blocks/navigation/__tests__/Block.spec.ts +22 -20
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/newsletter/__tests__/Block.spec.ts +1 -1
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/Block.vue +23 -15
- package/template/blocks/order-status/__tests__/Block.spec.ts +1 -2
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +1 -1
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +11 -8
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +26 -8
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +54 -18
- package/template/blocks/product-detail/__tests__/Block.spec.ts +79 -2
- package/template/blocks/product-detail/parts/Gallery.vue +1 -1
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/quote/Block.vue +1 -1
- package/template/blocks/quote/__tests__/Block.spec.ts +7 -4
- package/template/blocks/quote/preview.png +0 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +10 -4
- package/template/blocks/search/PopularChips.vue +1 -1
- package/template/blocks/search/TypeSection.vue +8 -2
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/search/results.ts +5 -2
- package/template/blocks/split-content/Block.vue +2 -3
- package/template/blocks/split-content/__tests__/Block.spec.ts +2 -2
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/__tests__/Block.spec.ts +1 -1
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/Block.vue +4 -5
- package/template/blocks/tabs/__tests__/Block.spec.ts +2 -2
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/Block.vue +10 -9
- package/template/blocks/testimonials/__tests__/Block.spec.ts +1 -1
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/__tests__/Block.spec.ts +2 -2
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +1 -1
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +1 -1
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/Block.vue +3 -3
- package/template/blocks/video-embed/__tests__/Block.spec.ts +1 -1
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/Block.vue +6 -2
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +19 -3
- package/template/i18n/is-IS.json +19 -3
- package/template/nuxt.config.ts +5 -4
- package/template/package.json +1 -0
- package/template/stories/pages/article.stories.ts +2 -3
- package/template/stories/pages/cart.stories.ts +2 -3
- package/template/stories/pages/category.stories.ts +2 -3
- package/template/stories/pages/collection.stories.ts +2 -3
- package/template/stories/pages/home.stories.ts +2 -3
- package/template/stories/pages/product.stories.ts +3 -4
- package/template/stories/pages/products.stories.ts +2 -3
- package/template/stories/pages/search.stories.ts +2 -3
- package/template/stories/pages/wishlist.stories.ts +2 -3
- package/template/test/carouselKeyboard.spec.ts +2 -2
- package/template/test/carouselRing.browser.spec.ts +2 -2
- package/template/test/carouselSlideWidth.browser.spec.ts +9 -9
- package/template/test/currencyPicker.spec.ts +66 -0
- package/template/test/eldraIcon.spec.ts +1 -1
- package/template/test/mainCss.spec.ts +7 -0
- package/template/test/pages/article.spec.ts +5 -5
- package/template/test/pages/collection.spec.ts +5 -5
- package/template/test/pages/hydration.spec.ts +10 -10
- package/template/test/prerenderRefresh.browser.spec.ts +1 -1
- package/template/test/seoInput.spec.ts +22 -0
- package/template/test/storefront/analytics.spec.ts +15 -0
- package/template/test/storefront/cart.spec.ts +4 -4
- package/template/test/storefront/currency.spec.ts +549 -0
- package/template/test/storefront/currencyStore.spec.ts +845 -0
- package/template/test/storefront/gateway.spec.ts +22 -0
- package/template/test/storefront/money.spec.ts +2 -8
- package/template/test/storefront/structuredData.spec.ts +45 -0
- package/template/test/storefront/toProductCard.spec.ts +1 -1
- package/template/test/storefront/volatile.spec.ts +11 -0
- package/template/test/support/mountPage.ts +2 -3
|
@@ -143,8 +143,7 @@ useRichTextScrollRegions(rowsRoot, (caption) => caption ?? t('splitContent.richT
|
|
|
143
143
|
v-else-if="editing"
|
|
144
144
|
inline
|
|
145
145
|
:label="t('splitContent.imageHintLabel')"
|
|
146
|
-
:
|
|
147
|
-
:class="imageOrderClass(index)"
|
|
146
|
+
:class="['bg-surface-strong aspect-[4/3] w-full rounded-xl', imageOrderClass(index)]"
|
|
148
147
|
/>
|
|
149
148
|
|
|
150
149
|
<div
|
|
@@ -183,7 +182,7 @@ useRichTextScrollRegions(rowsRoot, (caption) => caption ?? t('splitContent.richT
|
|
|
183
182
|
:as="rowLinkAs(row)"
|
|
184
183
|
variant="standalone"
|
|
185
184
|
arrow
|
|
186
|
-
|
|
185
|
+
class="mt-1 text-lg"
|
|
187
186
|
>
|
|
188
187
|
{{ row.linkLabel }}
|
|
189
188
|
</Link>
|
|
@@ -67,7 +67,7 @@ describe('split-content block', () => {
|
|
|
67
67
|
*/
|
|
68
68
|
it('the block root is a Section (a query container)', () => {
|
|
69
69
|
const wrapper = mount(Block, mountOptions({ entry: { id: 'e1', data: withImage } }));
|
|
70
|
-
expect(wrapper.get('section').classes()).toContain('
|
|
70
|
+
expect(wrapper.get('section').classes()).toContain('eldra:@container');
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it('renders rows as an ordered role=list, one h2 heading per row', () => {
|
|
@@ -219,7 +219,7 @@ describe('split-content block', () => {
|
|
|
219
219
|
it('applies the xl radius to every row image frame', () => {
|
|
220
220
|
const wrapper = mount(Block, mountOptions({ entry: { id: 'e1', data: withImage } }));
|
|
221
221
|
for (const frame of wrapper.findAll('[data-part="frame"]')) {
|
|
222
|
-
expect(frame.classes()).toContain('rounded-xl');
|
|
222
|
+
expect(frame.classes()).toContain('eldra:rounded-xl');
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
});
|
|
Binary file
|
|
@@ -72,7 +72,7 @@ describe('stats block', () => {
|
|
|
72
72
|
it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
|
|
73
73
|
const wrapper = mountBlock(mock);
|
|
74
74
|
const section = wrapper.get('section');
|
|
75
|
-
expect(section.classes()).toContain('
|
|
75
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
76
76
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
77
77
|
});
|
|
78
78
|
|
|
Binary file
|
|
@@ -159,10 +159,9 @@ const tabListClasses = {
|
|
|
159
159
|
'-mx-[var(--eldra-gutter-mobile)] px-[var(--eldra-gutter-mobile)] ' +
|
|
160
160
|
'scroll-px-[var(--eldra-gutter-mobile)] @tablet:mx-0 @tablet:px-0 @tablet:scroll-px-0',
|
|
161
161
|
};
|
|
162
|
-
/** Spec → Layout: "Panel: 2rem top padding." `TabPanel`'s own
|
|
163
|
-
* component's own doc comment)
|
|
164
|
-
|
|
165
|
-
const tabPanelClasses = { panel: 'pt-8' };
|
|
162
|
+
/** Spec → Layout: "Panel: 2rem top padding." `TabPanel`'s own default is 1.5rem (see that
|
|
163
|
+
* component's own doc comment); a class on it wins by layer, never a patch to the component. */
|
|
164
|
+
const TAB_PANEL_CLASS = 'pt-8';
|
|
166
165
|
|
|
167
166
|
/** Image | copy grid, only when the panel has an image (spec → Layout): stacked below 48rem, two
|
|
168
167
|
* equal columns 48–64rem, `7fr`/`5fr` from 64rem — the same gap steps `split-content`'s own row
|
|
@@ -219,7 +218,7 @@ useRichTextScrollRegions(panelsRoot, (caption) => caption ?? t('tabsBlock.richTe
|
|
|
219
218
|
v-for="(tab, index) in tabs"
|
|
220
219
|
:key="index"
|
|
221
220
|
:value="tabValue(index)"
|
|
222
|
-
:
|
|
221
|
+
:class="TAB_PANEL_CLASS"
|
|
223
222
|
>
|
|
224
223
|
<div class="grid" :class="tabHasImage(tab) ? IMAGE_PANEL_GRID : ''">
|
|
225
224
|
<UiImage
|
|
@@ -252,8 +252,8 @@ describe('tabs block', () => {
|
|
|
252
252
|
it('carries the mobile bleed and sideways-scroll classes on the tab row', () => {
|
|
253
253
|
const wrapper = mountBlock(mock);
|
|
254
254
|
const list = wrapper.get('[role="tablist"]');
|
|
255
|
-
expect(list.classes()).toContain('overflow-x-auto');
|
|
256
|
-
expect(list.classes()).toContain('eldra-scrollbar-hide');
|
|
255
|
+
expect(list.classes()).toContain('eldra:overflow-x-auto');
|
|
256
|
+
expect(list.classes()).toContain('eldra:eldra-scrollbar-hide');
|
|
257
257
|
expect(list.classes()).toContain('-mx-[var(--eldra-gutter-mobile)]');
|
|
258
258
|
expect(list.classes()).toContain('px-[var(--eldra-gutter-mobile)]');
|
|
259
259
|
expect(list.classes()).toContain('scroll-px-[var(--eldra-gutter-mobile)]');
|
|
Binary file
|
|
Binary file
|
|
@@ -35,13 +35,12 @@
|
|
|
35
35
|
* never modelled by this block's fields, only a 1–5 average per item.
|
|
36
36
|
*
|
|
37
37
|
* On a `primary` section the head (heading/summary/link) and each review's stars invert through
|
|
38
|
-
* `Section`'s own `
|
|
39
|
-
*
|
|
40
|
-
* `grid`/`carousel`, and that
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* scope, used here in reverse to *stop* one, so a card's own `Rating`/product `Link` never read the
|
|
38
|
+
* `Section`'s own `data-section="primary"`, which `Link`/`RatingStars` read through the package's
|
|
39
|
+
* `section-primary:` variant — but the spec also says "cards stay light, with normal colours
|
|
40
|
+
* inside" for `grid`/`carousel`, and that variant has no idea a card sits in between: it stops only
|
|
41
|
+
* at a nearer element with another `data-section`. Each card is therefore marked
|
|
42
|
+
* `data-section="none"` — the same "mark a surface by hand" tool `cta`'s own accent `banner` panel
|
|
43
|
+
* uses to *start* a new inverted scope, used here in reverse to *stop* one, so a card's own `Rating`/product `Link` never read the
|
|
45
44
|
* outer primary section at all. `single-large` has no such card (the review sits directly on the
|
|
46
45
|
* section's own ground), so its `Rating` is deliberately left to invert normally — the one place in
|
|
47
46
|
* this package's whole component set where that on-primary star/link inversion actually renders
|
|
@@ -310,7 +309,8 @@ const cardBackgroundClass = computed(() =>
|
|
|
310
309
|
-->
|
|
311
310
|
<div v-for="(item, index) in renderedItems" :key="index" class="h-full">
|
|
312
311
|
<figure
|
|
313
|
-
|
|
312
|
+
data-section="none"
|
|
313
|
+
class="flex h-full flex-col gap-5 rounded-lg p-6"
|
|
314
314
|
:class="cardBackgroundClass"
|
|
315
315
|
>
|
|
316
316
|
<template v-if="isEditing && isItemEmpty(item)">
|
|
@@ -362,7 +362,8 @@ const cardBackgroundClass = computed(() =>
|
|
|
362
362
|
<figure
|
|
363
363
|
v-for="(item, index) in renderedItems"
|
|
364
364
|
:key="index"
|
|
365
|
-
|
|
365
|
+
data-section="none"
|
|
366
|
+
class="flex h-full flex-col gap-5 rounded-lg p-6"
|
|
366
367
|
:class="[cardBackgroundClass, isSingleItem ? 'mx-auto w-full max-w-[36rem]' : '']"
|
|
367
368
|
>
|
|
368
369
|
<template v-if="isEditing && isItemEmpty(item)">
|
|
@@ -76,7 +76,7 @@ describe('testimonials block', () => {
|
|
|
76
76
|
it('the block root is a labelled <section> that measures its own width (@container)', () => {
|
|
77
77
|
const wrapper = mountBlock(mock);
|
|
78
78
|
const section = wrapper.get('section');
|
|
79
|
-
expect(section.classes()).toContain('
|
|
79
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
80
80
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
81
81
|
});
|
|
82
82
|
|
|
Binary file
|
|
@@ -101,7 +101,7 @@ describe('timeline block', () => {
|
|
|
101
101
|
it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
|
|
102
102
|
const wrapper = mountBlock(mock);
|
|
103
103
|
const section = wrapper.get('section');
|
|
104
|
-
expect(section.classes()).toContain('
|
|
104
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
105
105
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
106
106
|
});
|
|
107
107
|
|
|
@@ -126,7 +126,7 @@ describe('timeline block', () => {
|
|
|
126
126
|
// The visually hidden prefix and the visible number are two different nodes: the sr-only
|
|
127
127
|
// text is read once via the h3's own text content, and the visual number is separately
|
|
128
128
|
// aria-hidden so nothing doubles it up.
|
|
129
|
-
expect(firstTitle.findAll('.sr-only')).toHaveLength(1);
|
|
129
|
+
expect(firstTitle.findAll('.eldra\\:sr-only')).toHaveLength(1);
|
|
130
130
|
const number = wrapper.get('li span[aria-hidden="true"].tabular-nums');
|
|
131
131
|
expect(number.text()).toBe('1');
|
|
132
132
|
});
|
|
Binary file
|
|
@@ -295,7 +295,7 @@ const showPaymentsRow = computed(() => showPayments.value && paymentMarks.value.
|
|
|
295
295
|
:href="itemHref(item)!"
|
|
296
296
|
:as="itemLinkAs(item)"
|
|
297
297
|
:aria-label="item.linkLabel || undefined"
|
|
298
|
-
:
|
|
298
|
+
:class="itemTitleClass"
|
|
299
299
|
>
|
|
300
300
|
{{ item.title }}
|
|
301
301
|
</Link>
|
|
@@ -121,7 +121,7 @@ describe('trust-strip block', () => {
|
|
|
121
121
|
it('labels the section with the hidden h2', () => {
|
|
122
122
|
const wrapper = mountBlock(mock);
|
|
123
123
|
const heading = wrapper.get('h2');
|
|
124
|
-
expect(heading.classes()).toContain('sr-only');
|
|
124
|
+
expect(heading.classes()).toContain('eldra:sr-only');
|
|
125
125
|
expect(wrapper.get('section').attributes('aria-labelledby')).toBe(heading.attributes('id'));
|
|
126
126
|
expect(heading.text()).toBe('Why shop with Northwind');
|
|
127
127
|
});
|
|
Binary file
|
|
@@ -203,7 +203,7 @@ const headerClass = computed(() =>
|
|
|
203
203
|
const headingClass =
|
|
204
204
|
'font-heading text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em] @tablet:text-h2';
|
|
205
205
|
const frameRadiusClass = computed(() => (isSplit.value ? 'rounded-lg' : 'rounded-xl'));
|
|
206
|
-
const
|
|
206
|
+
const emptyStateClass = 'absolute inset-0 h-full w-full justify-center';
|
|
207
207
|
</script>
|
|
208
208
|
|
|
209
209
|
<template>
|
|
@@ -242,7 +242,7 @@ const emptyStateClasses = { root: 'absolute inset-0 h-full w-full justify-center
|
|
|
242
242
|
:icon="UrlHintIcon"
|
|
243
243
|
:label="t('video.urlHintLabel')"
|
|
244
244
|
:help="t('video.urlHintHelp')"
|
|
245
|
-
:
|
|
245
|
+
:class="emptyStateClass"
|
|
246
246
|
/>
|
|
247
247
|
|
|
248
248
|
<!-- An unrecognised or unsafe videoUrl: never build an <iframe>/<video> from it. -->
|
|
@@ -251,7 +251,7 @@ const emptyStateClasses = { root: 'absolute inset-0 h-full w-full justify-center
|
|
|
251
251
|
variant="error"
|
|
252
252
|
:title="t('video.errorTitle')"
|
|
253
253
|
:text="t('video.errorText')"
|
|
254
|
-
:
|
|
254
|
+
:class="emptyStateClass"
|
|
255
255
|
>
|
|
256
256
|
<template #actions>
|
|
257
257
|
<Link
|
|
@@ -177,7 +177,7 @@ describe('video-embed block', () => {
|
|
|
177
177
|
await flushPromises();
|
|
178
178
|
const heading = wrapper.get('h2');
|
|
179
179
|
expect(heading.text()).toBe(mock.videoTitle);
|
|
180
|
-
expect(heading.classes()).toContain('sr-only');
|
|
180
|
+
expect(heading.classes()).toContain('eldra:sr-only');
|
|
181
181
|
const section = wrapper.get('section');
|
|
182
182
|
expect(section.attributes('aria-labelledby')).toBe(heading.attributes('id'));
|
|
183
183
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
Binary file
|
|
@@ -67,6 +67,7 @@ const storefront = useStorefront();
|
|
|
67
67
|
/** Hydrated in `onMounted`, never before — see the module comment. */
|
|
68
68
|
const wishlist = useWishlist();
|
|
69
69
|
const money = useMoney();
|
|
70
|
+
const shopperCurrency = useStorefront().currency.active;
|
|
70
71
|
const resolveLink = useEldraLink();
|
|
71
72
|
|
|
72
73
|
const headingId = `wishlist-heading-${useUiId()}`;
|
|
@@ -166,13 +167,15 @@ const products = computed<StorefrontProductListItem[]>(() =>
|
|
|
166
167
|
* own doc comment has the reasoning, and it is the same one the gate on the wishlist has. */
|
|
167
168
|
const { any: cardsRevalidating, refreshing } = useRevalidating({
|
|
168
169
|
keys: () => result.revalidating.value,
|
|
169
|
-
refreshing: () =>
|
|
170
|
+
refreshing: () =>
|
|
171
|
+
(result.loading.value && result.data.value !== null) || storefront.currency.pending.value,
|
|
170
172
|
});
|
|
171
173
|
|
|
172
174
|
const cards = computed(() =>
|
|
173
175
|
toProductCardEntries(products.value, {
|
|
174
176
|
ratio: '4x5',
|
|
175
177
|
minorUnits: money.minor,
|
|
178
|
+
shopperCurrency: shopperCurrency.value,
|
|
176
179
|
revalidating: cardsRevalidating.value,
|
|
177
180
|
})
|
|
178
181
|
);
|
|
@@ -305,6 +308,7 @@ async function removeCard(handle: string): Promise<void> {
|
|
|
305
308
|
the product page, and the one control this card owns is the heart. -->
|
|
306
309
|
<ProductCard
|
|
307
310
|
:product="entry.product"
|
|
311
|
+
:currency="entry.currency"
|
|
308
312
|
ratio="4x5"
|
|
309
313
|
:heading-level="2"
|
|
310
314
|
:quick-add="false"
|
|
@@ -323,7 +327,7 @@ async function removeCard(handle: string): Promise<void> {
|
|
|
323
327
|
size="sm"
|
|
324
328
|
:pressed="true"
|
|
325
329
|
:label="t('product.removeFromWishlist', { title: entry.product.title })"
|
|
326
|
-
|
|
330
|
+
class="bg-surface"
|
|
327
331
|
@click="removeCard(entry.item.handle)"
|
|
328
332
|
>
|
|
329
333
|
<template #leadingIcon>
|
|
Binary file
|
package/template/i18n/en-US.json
CHANGED
|
@@ -124,7 +124,8 @@
|
|
|
124
124
|
"wishlistOne": "Wishlist, 1 item",
|
|
125
125
|
"wishlistMany": "Wishlist, {count} items",
|
|
126
126
|
"viewAll": "View all",
|
|
127
|
-
"viewAllOf": "View all {label}"
|
|
127
|
+
"viewAllOf": "View all {label}",
|
|
128
|
+
"cart": "Cart"
|
|
128
129
|
},
|
|
129
130
|
"editor": {
|
|
130
131
|
"addLink": "Add a link"
|
|
@@ -502,7 +503,9 @@
|
|
|
502
503
|
"emptyFallbackTitle": "Your cart is empty",
|
|
503
504
|
"drawerHintLabel": "The cart drawer opens from the header",
|
|
504
505
|
"drawerHintHelp": "Shoppers open it with the bag button; nothing shows here until they do.",
|
|
505
|
-
"drawerHintHosted": "The theme already opens one on every page, so this block adds nothing and can be removed."
|
|
506
|
+
"drawerHintHosted": "The theme already opens one on every page, so this block adds nothing and can be removed.",
|
|
507
|
+
"loadFailed": "We couldn't load your cart.",
|
|
508
|
+
"tryAgain": "Try again"
|
|
506
509
|
},
|
|
507
510
|
"wishlist": {
|
|
508
511
|
"saved": "Saved to wishlist",
|
|
@@ -547,6 +550,18 @@
|
|
|
547
550
|
"trackingNumber": "Tracking number",
|
|
548
551
|
"carrierEta": "Estimated delivery {eta} with {carrier}."
|
|
549
552
|
},
|
|
553
|
+
"currency": {
|
|
554
|
+
"label": "Currency",
|
|
555
|
+
"notSoldIn": "Not available in {currency}",
|
|
556
|
+
"notSoldInLong": "Not available in {currency}.",
|
|
557
|
+
"shopIn": "Shop in {currency}",
|
|
558
|
+
"cartNotSold": "{items} can't be bought in {currency}.",
|
|
559
|
+
"checkoutWithout": "Remove and check out",
|
|
560
|
+
"cartWillSwitch": "Your cart will switch to {currency}.",
|
|
561
|
+
"notIncludedOne": "1 item not included",
|
|
562
|
+
"notIncludedMany": "{count} items not included",
|
|
563
|
+
"movedTo": "Prices are now in {currency}."
|
|
564
|
+
},
|
|
550
565
|
"ui": {
|
|
551
566
|
"clear": "Clear",
|
|
552
567
|
"close": "Close",
|
|
@@ -628,6 +643,7 @@
|
|
|
628
643
|
"filterPanelMin": "Min",
|
|
629
644
|
"filterPanelMax": "Max",
|
|
630
645
|
"filterPanelOrMore": " or more",
|
|
631
|
-
"filterPanelShowProducts": "Show products"
|
|
646
|
+
"filterPanelShowProducts": "Show products",
|
|
647
|
+
"currencyPickerLabel": "Currency"
|
|
632
648
|
}
|
|
633
649
|
}
|
package/template/i18n/is-IS.json
CHANGED
|
@@ -124,7 +124,8 @@
|
|
|
124
124
|
"wishlistOne": "Óskalisti, 1 vara",
|
|
125
125
|
"wishlistMany": "Óskalisti, {count} vörur",
|
|
126
126
|
"viewAll": "Sjá allt",
|
|
127
|
-
"viewAllOf": "Sjá allt: {label}"
|
|
127
|
+
"viewAllOf": "Sjá allt: {label}",
|
|
128
|
+
"cart": "Karfa"
|
|
128
129
|
},
|
|
129
130
|
"editor": {
|
|
130
131
|
"addLink": "Bæta við tengli"
|
|
@@ -502,7 +503,9 @@
|
|
|
502
503
|
"emptyFallbackTitle": "Karfan þín er tóm",
|
|
503
504
|
"drawerHintLabel": "Karfan opnast úr hausnum",
|
|
504
505
|
"drawerHintHelp": "Kaupendur opna hana með töskuhnappnum; hér sést ekkert fyrr en þeir gera það.",
|
|
505
|
-
"drawerHintHosted": "Þemað opnar hana þegar á öllum síðum, svo þessi hluti gerir ekkert og má fjarlægja."
|
|
506
|
+
"drawerHintHosted": "Þemað opnar hana þegar á öllum síðum, svo þessi hluti gerir ekkert og má fjarlægja.",
|
|
507
|
+
"loadFailed": "Ekki tókst að sækja körfuna.",
|
|
508
|
+
"tryAgain": "Reyna aftur"
|
|
506
509
|
},
|
|
507
510
|
"wishlist": {
|
|
508
511
|
"saved": "Vistað á óskalista",
|
|
@@ -547,6 +550,18 @@
|
|
|
547
550
|
"trackingNumber": "Sendingarnúmer",
|
|
548
551
|
"carrierEta": "Áætlaður afhendingartími {eta} með {carrier}."
|
|
549
552
|
},
|
|
553
|
+
"currency": {
|
|
554
|
+
"label": "Gjaldmiðill",
|
|
555
|
+
"notSoldIn": "Ekki til sölu í {currency}",
|
|
556
|
+
"notSoldInLong": "Ekki til sölu í {currency}.",
|
|
557
|
+
"shopIn": "Skipta yfir í {currency}",
|
|
558
|
+
"cartNotSold": "Þetta fæst ekki keypt í {currency}: {items}.",
|
|
559
|
+
"checkoutWithout": "Fjarlægja og ganga frá kaupum",
|
|
560
|
+
"cartWillSwitch": "Karfan færist yfir í {currency}.",
|
|
561
|
+
"notIncludedOne": "1 vara ekki talin með",
|
|
562
|
+
"notIncludedMany": "{count} vörur ekki taldar með",
|
|
563
|
+
"movedTo": "Verð eru nú í {currency}."
|
|
564
|
+
},
|
|
550
565
|
"ui": {
|
|
551
566
|
"clear": "Hreinsa",
|
|
552
567
|
"close": "Loka",
|
|
@@ -628,6 +643,7 @@
|
|
|
628
643
|
"filterPanelMin": "Lágm.",
|
|
629
644
|
"filterPanelMax": "Hám.",
|
|
630
645
|
"filterPanelOrMore": " eða meira",
|
|
631
|
-
"filterPanelShowProducts": "Sýna vörur"
|
|
646
|
+
"filterPanelShowProducts": "Sýna vörur",
|
|
647
|
+
"currencyPickerLabel": "Gjaldmiðill"
|
|
632
648
|
}
|
|
633
649
|
}
|
package/template/nuxt.config.ts
CHANGED
|
@@ -118,10 +118,11 @@ export default defineNuxtConfig({
|
|
|
118
118
|
// entry's `@theme` block is not merged into the Tailwind root defined by
|
|
119
119
|
// the first — both verified with a real `nuxi generate` run.
|
|
120
120
|
// main.css is `@import 'tailwindcss'` followed by
|
|
121
|
-
// `@import '@eldrajs/ui/tailwind.css'`
|
|
122
|
-
// finds in node_modules like any other
|
|
123
|
-
//
|
|
124
|
-
//
|
|
121
|
+
// `@import '@eldrajs/ui/tailwind.css'` and `@eldrajs/ui/components.css`
|
|
122
|
+
// instead, which that same resolver finds in node_modules like any other
|
|
123
|
+
// package file; the first carries the whole
|
|
124
|
+
// `--color-<role>: var(--eldra-color-<role>)` mapping — so no colour block is
|
|
125
|
+
// generated into the theme any more — and the second the prebuilt components.
|
|
125
126
|
tailwind: false,
|
|
126
127
|
// What Core seeds a site with on its first deploy, built from
|
|
127
128
|
// `pages/*.page.json` — see `app/templates.ts`, and `docs/starter-kit.md`
|
package/template/package.json
CHANGED
|
@@ -29,9 +29,8 @@ const ArticlePage = defineComponent({
|
|
|
29
29
|
href: '#main',
|
|
30
30
|
as: EldraRouterLink,
|
|
31
31
|
variant: 'standalone',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
32
|
+
class:
|
|
33
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
35
34
|
},
|
|
36
35
|
{ default: () => t('nav.skipToContent') }
|
|
37
36
|
),
|
|
@@ -34,9 +34,8 @@ const CartPage = defineComponent({
|
|
|
34
34
|
href: '#main',
|
|
35
35
|
as: EldraRouterLink,
|
|
36
36
|
variant: 'standalone',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
37
|
+
class:
|
|
38
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
40
39
|
},
|
|
41
40
|
() => t('nav.skipToContent')
|
|
42
41
|
),
|
|
@@ -34,9 +34,8 @@ const CategoryPage = defineComponent({
|
|
|
34
34
|
href: '#main',
|
|
35
35
|
as: EldraRouterLink,
|
|
36
36
|
variant: 'standalone',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
37
|
+
class:
|
|
38
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
40
39
|
},
|
|
41
40
|
{ default: () => t('nav.skipToContent') }
|
|
42
41
|
),
|
|
@@ -29,9 +29,8 @@ const CollectionPage = defineComponent({
|
|
|
29
29
|
href: '#main',
|
|
30
30
|
as: EldraRouterLink,
|
|
31
31
|
variant: 'standalone',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
32
|
+
class:
|
|
33
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
35
34
|
},
|
|
36
35
|
{ default: () => t('nav.skipToContent') }
|
|
37
36
|
),
|
|
@@ -29,9 +29,8 @@ const HomePage = defineComponent({
|
|
|
29
29
|
href: '#main',
|
|
30
30
|
as: EldraRouterLink,
|
|
31
31
|
variant: 'standalone',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
32
|
+
class:
|
|
33
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
35
34
|
},
|
|
36
35
|
() => t('nav.skipToContent')
|
|
37
36
|
),
|
|
@@ -17,9 +17,8 @@ import { renderPageFixtureRegions, type PageFixture } from '../support/pageBlock
|
|
|
17
17
|
|
|
18
18
|
const fixture = productPage as unknown as PageFixture;
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
};
|
|
20
|
+
const SKIP_LINK_CLASS =
|
|
21
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50';
|
|
23
22
|
|
|
24
23
|
const ProductPage = defineComponent({
|
|
25
24
|
name: 'ProductPageStory',
|
|
@@ -28,7 +27,7 @@ const ProductPage = defineComponent({
|
|
|
28
27
|
return () => [
|
|
29
28
|
h(
|
|
30
29
|
Link,
|
|
31
|
-
{ href: '#main', as: EldraRouterLink, variant: 'standalone',
|
|
30
|
+
{ href: '#main', as: EldraRouterLink, variant: 'standalone', class: SKIP_LINK_CLASS },
|
|
32
31
|
{ default: () => t('nav.skipToContent') }
|
|
33
32
|
),
|
|
34
33
|
...renderPageFixtureRegions(fixture, 'Pages/Product story'),
|
|
@@ -36,9 +36,8 @@ const ProductsPage = defineComponent({
|
|
|
36
36
|
href: '#main',
|
|
37
37
|
as: EldraRouterLink,
|
|
38
38
|
variant: 'standalone',
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
39
|
+
class:
|
|
40
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
42
41
|
},
|
|
43
42
|
() => t('nav.skipToContent')
|
|
44
43
|
),
|
|
@@ -32,9 +32,8 @@ const SearchPage = defineComponent({
|
|
|
32
32
|
href: '#main',
|
|
33
33
|
as: EldraRouterLink,
|
|
34
34
|
variant: 'standalone',
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
35
|
+
class:
|
|
36
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
38
37
|
},
|
|
39
38
|
() => t('nav.skipToContent')
|
|
40
39
|
),
|
|
@@ -31,9 +31,8 @@ const WishlistPage = defineComponent({
|
|
|
31
31
|
href: '#main',
|
|
32
32
|
as: EldraRouterLink,
|
|
33
33
|
variant: 'standalone',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
34
|
+
class:
|
|
35
|
+
'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
|
|
37
36
|
},
|
|
38
37
|
() => t('nav.skipToContent')
|
|
39
38
|
),
|
|
@@ -219,7 +219,7 @@ describe('hero split-carousel — linked and unlinked slides in one row', () =>
|
|
|
219
219
|
// Slide 1 holds no link, so the slide element itself is the stop — with the package's own
|
|
220
220
|
// focus ring, since it has no control of its own to bring one. Slide 2's link is parked.
|
|
221
221
|
expect(figures[0]?.getAttribute('tabindex')).toBe('0');
|
|
222
|
-
expect(figures[0]?.classList.contains('eldra-focus')).toBe(true);
|
|
222
|
+
expect(figures[0]?.classList.contains('eldra:eldra-focus')).toBe(true);
|
|
223
223
|
expect(tabbableIn(track(wrapper))).toEqual([figures[0]]);
|
|
224
224
|
|
|
225
225
|
press(figures[0]!, 'ArrowRight');
|
|
@@ -229,7 +229,7 @@ describe('hero split-carousel — linked and unlinked slides in one row', () =>
|
|
|
229
229
|
const link = figures[1]!.querySelector<HTMLElement>('a[href]')!;
|
|
230
230
|
expect(document.activeElement).toBe(link);
|
|
231
231
|
expect(figures[1]?.getAttribute('tabindex')).toBeNull();
|
|
232
|
-
expect(figures[1]?.classList.contains('eldra-focus')).toBe(false);
|
|
232
|
+
expect(figures[1]?.classList.contains('eldra:eldra-focus')).toBe(false);
|
|
233
233
|
expect(figures[0]?.getAttribute('tabindex')).toBe('-1');
|
|
234
234
|
expect(tabbableIn(track(wrapper))).toEqual([link]);
|
|
235
235
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
@@ -149,14 +149,14 @@ describe('a focused card in the product carousel', () => {
|
|
|
149
149
|
}
|
|
150
150
|
const state = await page.evaluate(() => {
|
|
151
151
|
const active = document.activeElement as HTMLElement;
|
|
152
|
-
const ringed = active.closest('.eldra-focus') as HTMLElement | null;
|
|
152
|
+
const ringed = active.closest('.eldra\\:eldra-focus') as HTMLElement | null;
|
|
153
153
|
return {
|
|
154
154
|
focusedTag: active.tagName,
|
|
155
155
|
focusVisible: active.matches(':focus-visible'),
|
|
156
156
|
// The ring is on the card, not on the focused link inside it: `eldra-focus-proxy`'s
|
|
157
157
|
// `:has(:focus-visible)` is what lights it from the link's own focus.
|
|
158
158
|
ringedPart: ringed?.getAttribute('data-part'),
|
|
159
|
-
ringedProxy: ringed?.classList.contains('eldra-focus-proxy'),
|
|
159
|
+
ringedProxy: ringed?.classList.contains('eldra:eldra-focus-proxy'),
|
|
160
160
|
alpha: ringed
|
|
161
161
|
? getComputedStyle(ringed).getPropertyValue('--eldra-focus-alpha').trim()
|
|
162
162
|
: null,
|
|
@@ -70,17 +70,17 @@ describe('a recently-viewed product carousel at 1440px, in a real browser', () =
|
|
|
70
70
|
|
|
71
71
|
it('shows more than one card, each exactly as wide as its slide, with the track gap kept between them', async () => {
|
|
72
72
|
const boxes = await page.evaluate(() => {
|
|
73
|
-
const track = document.querySelector<HTMLElement>('.eldra-carousel-track');
|
|
73
|
+
const track = document.querySelector<HTMLElement>('.eldra\\:eldra-carousel-track');
|
|
74
74
|
if (track === null) return null;
|
|
75
75
|
const gap = Number.parseFloat(getComputedStyle(track).columnGap);
|
|
76
|
-
const slides = Array.from(
|
|
77
|
-
(slide)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
);
|
|
76
|
+
const slides = Array.from(
|
|
77
|
+
track.querySelectorAll<HTMLElement>('.eldra\\:eldra-carousel-slide')
|
|
78
|
+
).map((slide) => {
|
|
79
|
+
const card = slide.querySelector('article');
|
|
80
|
+
const s = slide.getBoundingClientRect();
|
|
81
|
+
const c = card?.getBoundingClientRect();
|
|
82
|
+
return { slide: { x: s.x, width: s.width }, card: c ? { x: c.x, width: c.width } : null };
|
|
83
|
+
});
|
|
84
84
|
return { gap, slides };
|
|
85
85
|
});
|
|
86
86
|
if (boxes === null) throw new Error('the carousel track never laid out');
|