@eldrajs/theme-cli 0.2.3 → 0.2.5
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 +9 -4
- package/dist/index.d.ts +6 -12
- package/dist/index.js +1 -1
- package/dist/{validate-DprFpjV7.js → validate-CC6Mp5i_.js} +11 -19
- package/package.json +3 -3
- package/template/.eldra/previews.json +35 -35
- package/template/README.md +3 -1
- package/template/app/app.vue +1 -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/pages/[...slug].vue +1 -1
- package/template/app/storefront/gateway.ts +0 -3
- package/template/app/storefront/structuredData.ts +2 -2
- package/template/app/storefront/types.ts +0 -5
- package/template/app/utils/seoInput.ts +0 -1
- 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 +1 -1
- package/template/blocks/cart/parts/CartLines.vue +3 -2
- package/template/blocks/cart/parts/ShippingBar.vue +1 -1
- package/template/blocks/cart/parts/Summary.vue +5 -9
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +11 -14
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +12 -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 +14 -11
- 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 +16 -26
- 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 +8 -9
- 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 +6 -6
- 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 +8 -8
- package/template/blocks/product-detail/__tests__/Block.spec.ts +1 -1
- 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 +2 -2
- package/template/blocks/search/PopularChips.vue +1 -1
- package/template/blocks/search/preview.png +0 -0
- 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 +1 -1
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/nuxt.config.ts +5 -4
- package/template/package.json +2 -1
- 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/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 +51 -1
- package/template/test/seoInput.spec.ts +5 -4
- package/template/test/storefront/structuredData.spec.ts +3 -6
- package/template/test/structuredData.generate.spec.ts +1 -1
- package/template/test/support/mockGateway.ts +8 -3
- package/template/test/support/mountPage.ts +2 -3
|
@@ -398,7 +398,7 @@ const sectionAriaLabel = computed(() =>
|
|
|
398
398
|
/** Spec "Search results page" → Container/Section: "2rem top, `section-md` bottom" — the shared
|
|
399
399
|
* `sm`/`md`/`lg` scale is symmetric, so `spacing="none"` on `Section` and the padding is written
|
|
400
400
|
* here, the same pattern `collection-header`'s/`footer`'s own asymmetric padding uses. */
|
|
401
|
-
const
|
|
401
|
+
const sectionClass = 'pt-8 pb-[var(--eldra-section-md)]';
|
|
402
402
|
|
|
403
403
|
const headingClass =
|
|
404
404
|
'font-heading text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em] break-words ' +
|
|
@@ -408,7 +408,7 @@ const headingClass =
|
|
|
408
408
|
<template>
|
|
409
409
|
<Section
|
|
410
410
|
spacing="none"
|
|
411
|
-
:
|
|
411
|
+
:class="sectionClass"
|
|
412
412
|
:labelled-by="sectionLabelledBy"
|
|
413
413
|
:aria-label="sectionAriaLabel"
|
|
414
414
|
>
|
|
@@ -31,7 +31,7 @@ const CHIP_CLASS =
|
|
|
31
31
|
<p class="text-body-sm text-text font-semibold">{{ heading }}</p>
|
|
32
32
|
<ul class="flex flex-wrap gap-2">
|
|
33
33
|
<li v-for="item in items" :key="item.label">
|
|
34
|
-
<Link :href="item.href" :as="linkAs" :underline="false" :
|
|
34
|
+
<Link :href="item.href" :as="linkAs" :underline="false" :class="CHIP_CLASS">
|
|
35
35
|
<EldraIcon name="search" size="sm" />
|
|
36
36
|
{{ item.label }}
|
|
37
37
|
</Link>
|
|
Binary file
|
|
@@ -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
|
|
@@ -323,7 +323,7 @@ async function removeCard(handle: string): Promise<void> {
|
|
|
323
323
|
size="sm"
|
|
324
324
|
:pressed="true"
|
|
325
325
|
:label="t('product.removeFromWishlist', { title: entry.product.title })"
|
|
326
|
-
|
|
326
|
+
class="bg-surface"
|
|
327
327
|
@click="removeCard(entry.item.handle)"
|
|
328
328
|
>
|
|
329
329
|
<template #leadingIcon>
|
|
Binary file
|
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');
|
|
@@ -27,7 +27,7 @@ describe('EldraIcon', () => {
|
|
|
27
27
|
const wrapper = mount(EldraIcon, { props: { name: 'lock' } });
|
|
28
28
|
await flushPromises();
|
|
29
29
|
const svg = wrapper.find('svg');
|
|
30
|
-
expect(svg.classes()).toContain('size-8');
|
|
30
|
+
expect(svg.classes()).toContain('eldra:size-8');
|
|
31
31
|
expect(svg.attributes('stroke-width')).toBe('1.75');
|
|
32
32
|
expect(svg.attributes('aria-hidden')).toBe('true');
|
|
33
33
|
});
|
|
@@ -41,6 +41,13 @@ describe('main.css', () => {
|
|
|
41
41
|
expect(mainCss).toMatch(/^@source\s+'\.\.\/\.\.\/blocks';/m);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
+
it("ships the package's components prebuilt, below this file's own utilities", async () => {
|
|
45
|
+
const css = await build(['w-full']);
|
|
46
|
+
expect(mainCss).toMatch(/^@import '@eldrajs\/ui\/components\.css';$/m);
|
|
47
|
+
expect(css).toMatch(/@layer components\s*\{[^]*\.eldra\\:inline-flex/);
|
|
48
|
+
expect(css).toMatch(/^@layer theme, base, components, utilities;$/m);
|
|
49
|
+
});
|
|
50
|
+
|
|
44
51
|
it('emits the dialog backdrop from the overlay token', async () => {
|
|
45
52
|
const css = await build(['backdrop:bg-overlay']);
|
|
46
53
|
expect(css).toContain('::backdrop');
|
|
@@ -120,11 +120,11 @@ describe('article sample page', () => {
|
|
|
120
120
|
const roots = pageBlockRoots(wrapper);
|
|
121
121
|
const articleEl = roots[2]!;
|
|
122
122
|
|
|
123
|
-
const contentContainers = articleEl.querySelectorAll('.eldra-container-content');
|
|
124
|
-
const narrowContainers = articleEl.querySelectorAll('.eldra-container-narrow');
|
|
123
|
+
const contentContainers = articleEl.querySelectorAll('.eldra\\:eldra-container-content');
|
|
124
|
+
const narrowContainers = articleEl.querySelectorAll('.eldra\\:eldra-container-narrow');
|
|
125
125
|
expect(contentContainers.length).toBeGreaterThan(0);
|
|
126
126
|
expect(narrowContainers.length).toBeGreaterThan(0);
|
|
127
|
-
expect(articleEl.querySelectorAll('.eldra-container-wide')).toHaveLength(0);
|
|
127
|
+
expect(articleEl.querySelectorAll('.eldra\\:eldra-container-wide')).toHaveLength(0);
|
|
128
128
|
|
|
129
129
|
// The content container (header + cover) precedes the narrow one (body + author card).
|
|
130
130
|
const firstContent = contentContainers[0]!;
|
|
@@ -134,8 +134,8 @@ describe('article sample page', () => {
|
|
|
134
134
|
).toBeTruthy();
|
|
135
135
|
|
|
136
136
|
// The header/breadcrumbs stay on the 80rem wide container.
|
|
137
|
-
expect(roots[0]!.querySelector('.eldra-container-wide')).not.toBeNull();
|
|
138
|
-
expect(roots[1]!.querySelector('.eldra-container-wide')).not.toBeNull();
|
|
137
|
+
expect(roots[0]!.querySelector('.eldra\\:eldra-container-wide')).not.toBeNull();
|
|
138
|
+
expect(roots[1]!.querySelector('.eldra\\:eldra-container-wide')).not.toBeNull();
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
it('wraps the body table in a named, focusable region and marks its code block focusable', async () => {
|
|
@@ -125,12 +125,12 @@ describe('collection sample page', () => {
|
|
|
125
125
|
expect(grounds).toEqual([null, null, 'none', 'none', 'surface', 'surface-strong']);
|
|
126
126
|
|
|
127
127
|
// The grid starts directly under the collection header with its own short 1.5rem top padding
|
|
128
|
-
// (`pt-6
|
|
129
|
-
// padding on its `surface`
|
|
130
|
-
//
|
|
131
|
-
//
|
|
128
|
+
// (`pt-6`, hand-rolled rather than read from `Section`'s `spacing` prop — see the block's own
|
|
129
|
+
// top-of-file comment), and the call to action keeps a full band of padding on its `surface`
|
|
130
|
+
// ground (`Section`'s own `eldra:pt-[var(--eldra-section-md)]`), so this is what proves the
|
|
131
|
+
// page actually renders those values.
|
|
132
132
|
expect(gridEl!.classList.contains('pt-6')).toBe(true);
|
|
133
|
-
expect(ctaEl!.classList.contains('pt-[var(--eldra-section-md)]')).toBe(true);
|
|
133
|
+
expect(ctaEl!.classList.contains('eldra:pt-[var(--eldra-section-md)]')).toBe(true);
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
it('has exactly one h1 (the collection title) and one breadcrumb nav on the page', async () => {
|
|
@@ -144,15 +144,15 @@ const SUBJECTS: Subject[] = [
|
|
|
144
144
|
/**
|
|
145
145
|
* `@eldrajs/ui`'s `Carousel` decorates its slides **imperatively after mount** — `useCarousel.ts`
|
|
146
146
|
* `setAttribute`s `data-part="slide"`, `role="group"`, `aria-roledescription="slide"` and an
|
|
147
|
-
* "n of total" label onto whatever children the consumer passed, adds the
|
|
148
|
-
* sizing class, and writes the roving tab stop's `tabindex` (one stop
|
|
149
|
-
* active slide; every other slide's controls parked at `-1`) — precisely
|
|
150
|
-
* plain elements. That is a deliberate progressive enhancement of the
|
|
151
|
-
* server disagreed with (Vue reports no mismatch for any of it), and
|
|
152
|
-
* `product-carousel`'s row both go through it. The `tabindex` pass
|
|
153
|
-
* labelling: the server renders the pre-enhancement shape, the
|
|
154
|
-
* exactly, and the model only moves in `onMounted` afterwards —
|
|
155
|
-
* sides leaves the comparison below an honest one.
|
|
147
|
+
* "n of total" label onto whatever children the consumer passed, adds the
|
|
148
|
+
* `eldra:eldra-carousel-slide` sizing class, and writes the roving tab stop's `tabindex` (one stop
|
|
149
|
+
* for the whole row, on the active slide; every other slide's controls parked at `-1`) — precisely
|
|
150
|
+
* so a block can hand it plain elements. That is a deliberate progressive enhancement of the
|
|
151
|
+
* package's, not a render the server disagreed with (Vue reports no mismatch for any of it), and
|
|
152
|
+
* `product-detail`'s gallery and `product-carousel`'s row both go through it. The `tabindex` pass
|
|
153
|
+
* is the same kind of thing as the labelling: the server renders the pre-enhancement shape, the
|
|
154
|
+
* first client render matches it exactly, and the model only moves in `onMounted` afterwards —
|
|
155
|
+
* which is why removing it from both sides leaves the comparison below an honest one.
|
|
156
156
|
*
|
|
157
157
|
* **The `tabindex` removal is scoped to the carousel's own track**, through a parse rather than the
|
|
158
158
|
* regex the other four tokens use: `tabindex` is an ordinary attribute a block writes for itself —
|
|
@@ -163,7 +163,7 @@ const SUBJECTS: Subject[] = [
|
|
|
163
163
|
* Nothing in `blocks/**` writes any of the other four.
|
|
164
164
|
*/
|
|
165
165
|
const CAROUSEL_ENHANCEMENT =
|
|
166
|
-
/\s(?:data-part="slide"|role="group"|aria-roledescription="slide"|aria-label="\d+ of \d+")|\
|
|
166
|
+
/\s(?:data-part="slide"|role="group"|aria-roledescription="slide"|aria-label="\d+ of \d+")|\s(?:eldra:)?eldra-carousel-slide|(?:eldra:)?eldra-carousel-slide\s/g;
|
|
167
167
|
|
|
168
168
|
function withoutPackageEnhancement(html: string): string {
|
|
169
169
|
// Both halves go through the same parse, so any normalisation the parser does of its own
|