@eldrajs/theme-cli 0.2.4 → 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 +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/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/blocks/announcement-bar/Block.vue +3 -2
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +1 -1
- package/template/blocks/article/Block.vue +3 -4
- package/template/blocks/article-list/Block.vue +18 -9
- package/template/blocks/breadcrumbs/Block.vue +1 -1
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +9 -9
- 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/collection-grid/Block.vue +11 -14
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +12 -14
- package/template/blocks/collection-header/Block.vue +5 -5
- package/template/blocks/contact/Block.vue +1 -1
- package/template/blocks/contact/__tests__/Block.spec.ts +2 -2
- package/template/blocks/cta/Block.vue +16 -18
- package/template/blocks/cta/__tests__/Block.spec.ts +8 -12
- package/template/blocks/faq/Block.vue +3 -13
- package/template/blocks/faq/__tests__/Block.spec.ts +2 -2
- package/template/blocks/feature-grid/Block.vue +1 -1
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +1 -1
- package/template/blocks/footer/Block.vue +14 -11
- package/template/blocks/footer/__tests__/Block.spec.ts +5 -5
- package/template/blocks/form/Block.vue +1 -1
- package/template/blocks/gallery/__tests__/Block.spec.ts +1 -1
- package/template/blocks/hero/Block.vue +8 -11
- package/template/blocks/hero/__tests__/Block.spec.ts +9 -7
- package/template/blocks/image/Block.vue +4 -4
- package/template/blocks/image/__tests__/Block.spec.ts +5 -6
- package/template/blocks/logo-cloud/__tests__/Block.spec.ts +1 -1
- package/template/blocks/navigation/Block.vue +16 -26
- package/template/blocks/navigation/__tests__/Block.spec.ts +22 -20
- package/template/blocks/newsletter/__tests__/Block.spec.ts +1 -1
- package/template/blocks/order-status/Block.vue +8 -9
- package/template/blocks/order-status/__tests__/Block.spec.ts +1 -2
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +1 -1
- package/template/blocks/product-carousel/Block.vue +6 -6
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +26 -8
- 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/quote/Block.vue +1 -1
- package/template/blocks/quote/__tests__/Block.spec.ts +7 -4
- package/template/blocks/search/Block.vue +2 -2
- package/template/blocks/search/PopularChips.vue +1 -1
- package/template/blocks/split-content/Block.vue +2 -3
- package/template/blocks/split-content/__tests__/Block.spec.ts +2 -2
- package/template/blocks/stats/__tests__/Block.spec.ts +1 -1
- package/template/blocks/tabs/Block.vue +4 -5
- package/template/blocks/tabs/__tests__/Block.spec.ts +2 -2
- package/template/blocks/testimonials/Block.vue +10 -9
- package/template/blocks/testimonials/__tests__/Block.spec.ts +1 -1
- package/template/blocks/timeline/__tests__/Block.spec.ts +2 -2
- package/template/blocks/trust-strip/Block.vue +1 -1
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +1 -1
- package/template/blocks/video-embed/Block.vue +3 -3
- package/template/blocks/video-embed/__tests__/Block.spec.ts +1 -1
- package/template/blocks/wishlist/Block.vue +1 -1
- 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/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/support/mountPage.ts +2 -3
|
@@ -147,7 +147,7 @@ describe('newsletter block', () => {
|
|
|
147
147
|
it('the block root is the Section component, a width container for its own @content:/@two-col: breakpoints', () => {
|
|
148
148
|
const wrapper = mountNewsletter(mock);
|
|
149
149
|
const section = wrapper.get('section');
|
|
150
|
-
expect(section.classes()).toContain('
|
|
150
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
151
151
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
152
152
|
});
|
|
153
153
|
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* **Badge tone.** `Badge`'s `outline` prop replaces its tone-coloured fill with a fixed
|
|
61
61
|
* `background`/`text-text`/`border-strong` look, independent of `tone` (`Badge.vue`'s own
|
|
62
62
|
* `colorClass`) — so `pill outline` alone renders every status in the same neutral colour. Each
|
|
63
|
-
* non-neutral status (`delivered`/`delayed`/`cancelled`) therefore also passes `
|
|
63
|
+
* non-neutral status (`delivered`/`delayed`/`cancelled`) therefore also passes a `class` with
|
|
64
64
|
* that state's own `text-*`/`border-*` utility pair (`STATUS_BADGE_TONE_CLASS`, always a
|
|
65
65
|
* `--eldra-*`-backed Tailwind colour name, never a literal value) to recolour the icon, word and
|
|
66
66
|
* border together — `neutral` (`processing`/`shipped`) needs no override, since the `outline`
|
|
@@ -231,10 +231,9 @@ const statusTone = computed<BadgeTone>(() =>
|
|
|
231
231
|
order.value ? STATUS_TONE[order.value.status] : 'neutral'
|
|
232
232
|
);
|
|
233
233
|
const statusWord = computed(() => (order.value ? t(STATUS_WORD_KEY[order.value.status]) : ''));
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
234
|
+
const statusBadgeClass = computed(() =>
|
|
235
|
+
order.value ? STATUS_BADGE_TONE_CLASS[order.value.status] : undefined
|
|
236
|
+
);
|
|
238
237
|
|
|
239
238
|
/* ------------------------------------------------------------------------------------------- */
|
|
240
239
|
/* Status panel: title, text, carrier/ETA, alert, call to action */
|
|
@@ -499,8 +498,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
|
|
|
499
498
|
outline
|
|
500
499
|
:tone="statusTone"
|
|
501
500
|
:icon="statusIcon"
|
|
502
|
-
:
|
|
503
|
-
class="shrink-0"
|
|
501
|
+
:class="['shrink-0', statusBadgeClass]"
|
|
504
502
|
>
|
|
505
503
|
<VisuallyHidden>{{ t('order.statusPrefix') }}</VisuallyHidden
|
|
506
504
|
>{{ statusWord }}
|
|
@@ -643,7 +641,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
|
|
|
643
641
|
<Link
|
|
644
642
|
:href="lineHref(line) ?? undefined"
|
|
645
643
|
:as="lineLinkAs(line)"
|
|
646
|
-
|
|
644
|
+
class="text-text font-semibold"
|
|
647
645
|
>
|
|
648
646
|
{{ line.title }}
|
|
649
647
|
</Link>
|
|
@@ -723,7 +721,8 @@ const helpLinks = computed<HelpLinkView[]>(() =>
|
|
|
723
721
|
:as="link.as"
|
|
724
722
|
variant="standalone"
|
|
725
723
|
:underline="false"
|
|
726
|
-
|
|
724
|
+
class="min-h-9"
|
|
725
|
+
:classes="{ label: 'inline-flex items-center gap-2' }"
|
|
727
726
|
>
|
|
728
727
|
<EldraIcon v-if="link.icon" :name="link.icon" size="md" class="text-muted" />{{
|
|
729
728
|
link.label
|
|
@@ -224,7 +224,7 @@ describe('order-status block', () => {
|
|
|
224
224
|
|
|
225
225
|
/** `Badge`'s own `outline` look ignores `tone` entirely (`bg-background text-text
|
|
226
226
|
* border-border-strong` regardless of the prop), so without an explicit override every status
|
|
227
|
-
* would render in the same neutral colour — this pins the per-state `
|
|
227
|
+
* would render in the same neutral colour — this pins the per-state `class` override
|
|
228
228
|
* that recolours the icon/word/border for the three non-neutral states. */
|
|
229
229
|
it.each([
|
|
230
230
|
['delivered', enUS.storefront.orderStatus.delivered, 'success'],
|
|
@@ -237,7 +237,6 @@ describe('order-status block', () => {
|
|
|
237
237
|
const badge = badgeFor(wrapper, word);
|
|
238
238
|
expect(badge.classes()).toContain(`text-${tone}`);
|
|
239
239
|
expect(badge.classes()).toContain(`border-${tone}`);
|
|
240
|
-
expect(badge.classes()).not.toContain('text-text');
|
|
241
240
|
}
|
|
242
241
|
);
|
|
243
242
|
|
|
@@ -106,7 +106,7 @@ describe('pricing-table block', () => {
|
|
|
106
106
|
it('roots the block in a labelled <section> that measures its own width (@container)', () => {
|
|
107
107
|
const wrapper = mountBlock(mock);
|
|
108
108
|
const section = wrapper.get('section');
|
|
109
|
-
expect(section.classes()).toContain('
|
|
109
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
110
110
|
expect(section.attributes('aria-labelledby')).toBe(wrapper.get('h2').attributes('id'));
|
|
111
111
|
});
|
|
112
112
|
|
|
@@ -76,7 +76,7 @@ const { t } = useI18n();
|
|
|
76
76
|
const isEditing = useEditing();
|
|
77
77
|
const headingId = `product-carousel-heading-${useUiId()}`;
|
|
78
78
|
/** The h2 recipe, also applied to the heading's own link so `Link`'s standalone size and weight do
|
|
79
|
-
* not shrink the title (
|
|
79
|
+
* not shrink the title (an app utility outranks the kit's `eldra:` classes by cascade layer). */
|
|
80
80
|
const HEADING_CLASSES =
|
|
81
81
|
'font-heading @tablet:text-h2 text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em]';
|
|
82
82
|
|
|
@@ -279,11 +279,11 @@ const cardRatio = computed(() => (isRecentlyViewed.value ? '1x1' : '4x5'));
|
|
|
279
279
|
* `min-w-56`, which is right in a grid whose columns are sized for it and wrong in a slide whose
|
|
280
280
|
* width is `(track − gaps) / perView`: at six per view on a 1228px track a slide is 189px, so a
|
|
281
281
|
* 224px card ran 35px past its slide, swallowed the 16px gap and overlapped the next card — the
|
|
282
|
-
* operator saw the recently-viewed row drawn with no space between its tiles. `min-w-0`
|
|
283
|
-
* the component's own `min-w-56`
|
|
282
|
+
* operator saw the recently-viewed row drawn with no space between its tiles. `min-w-0` (an app
|
|
283
|
+
* utility) outranks the component's own `eldra:min-w-56` by cascade layer, so the card fills exactly
|
|
284
284
|
* its slide on every variant and at every container width.
|
|
285
285
|
*/
|
|
286
|
-
const
|
|
286
|
+
const CARD_CLASS = 'min-w-0';
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* While pending, `Carousel`'s own accessible name announces the loading state instead of
|
|
@@ -418,7 +418,7 @@ const showBlock = computed(() =>
|
|
|
418
418
|
variant="standalone"
|
|
419
419
|
arrow
|
|
420
420
|
:aria-label="`${heading} — ${data.viewAllLabel}${t('productCarousel.viewAllContext')}`"
|
|
421
|
-
:
|
|
421
|
+
:class="`${HEADING_CLASSES} text-inherit`"
|
|
422
422
|
>
|
|
423
423
|
{{ heading }}
|
|
424
424
|
</Link>
|
|
@@ -440,7 +440,7 @@ const showBlock = computed(() =>
|
|
|
440
440
|
<ProductCard
|
|
441
441
|
:product="entry.product"
|
|
442
442
|
:ratio="cardRatio"
|
|
443
|
-
:
|
|
443
|
+
:class="CARD_CLASS"
|
|
444
444
|
:show-swatches="!isRecentlyViewed && showSwatchesField"
|
|
445
445
|
:show-rating="!isRecentlyViewed"
|
|
446
446
|
:quick-add="false"
|
|
@@ -760,7 +760,7 @@ describe('product-carousel block', () => {
|
|
|
760
760
|
const { storefront, revalidating } = refreshableSource();
|
|
761
761
|
const wrapper = mountBlock(mock, { storefront });
|
|
762
762
|
await flushPromises();
|
|
763
|
-
const region = () => wrapper.get('p.sr-only[role="status"]');
|
|
763
|
+
const region = () => wrapper.get('p.eldra\\:sr-only[role="status"]');
|
|
764
764
|
|
|
765
765
|
// Mounted and empty first: a live region that arrives already holding its message is
|
|
766
766
|
// announced unreliably, which is what a prerendered page would produce if the block read
|
|
@@ -771,7 +771,7 @@ describe('product-carousel block', () => {
|
|
|
771
771
|
await flushPromises();
|
|
772
772
|
|
|
773
773
|
expect(region().text()).toBe(enUS.storefront.updatingValues);
|
|
774
|
-
expect(wrapper.findAll('p.sr-only[role="status"]')).toHaveLength(1);
|
|
774
|
+
expect(wrapper.findAll('p.eldra\\:sr-only[role="status"]')).toHaveLength(1);
|
|
775
775
|
// `announce: false` on every card — the per-value regions are gone, not merely empty.
|
|
776
776
|
expect(wrapper.findAll('[data-part="srStatus"]')).toHaveLength(0);
|
|
777
777
|
expect(
|
|
@@ -794,12 +794,14 @@ describe('product-carousel block', () => {
|
|
|
794
794
|
const wrapper = mountBlock(mock, { storefront });
|
|
795
795
|
|
|
796
796
|
expect(wrapper.find('[data-part="spinner"]').exists()).toBe(false);
|
|
797
|
-
expect(wrapper.get('p.sr-only[role="status"]').text()).toBe('');
|
|
797
|
+
expect(wrapper.get('p.eldra\\:sr-only[role="status"]').text()).toBe('');
|
|
798
798
|
|
|
799
799
|
await flushPromises();
|
|
800
800
|
|
|
801
801
|
expect(wrapper.find('[data-part="spinner"]').exists()).toBe(true);
|
|
802
|
-
expect(wrapper.get('p.sr-only[role="status"]').text()).toBe(
|
|
802
|
+
expect(wrapper.get('p.eldra\\:sr-only[role="status"]').text()).toBe(
|
|
803
|
+
enUS.storefront.updatingValues
|
|
804
|
+
);
|
|
803
805
|
});
|
|
804
806
|
|
|
805
807
|
it('never draws a skeleton over cards the visitor can already see', async () => {
|
|
@@ -848,10 +850,16 @@ describe('product-carousel block', () => {
|
|
|
848
850
|
|
|
849
851
|
/**
|
|
850
852
|
* Every utility rule the build emits, in source order, with the container query it sits under.
|
|
851
|
-
* Only `@layer
|
|
853
|
+
* Only `@layer components` (the package's prebuilt, `eldra:`-prefixed rules) and `@layer
|
|
854
|
+
* utilities` (this theme's own): the same stylesheet carries a preflight `padding: 0` and the
|
|
852
855
|
* rich-text `padding-left` of a blockquote, and neither is on this element.
|
|
853
856
|
*/
|
|
854
|
-
type Rule = {
|
|
857
|
+
type Rule = {
|
|
858
|
+
condition: string;
|
|
859
|
+
layer: string;
|
|
860
|
+
selector: string;
|
|
861
|
+
declarations: Array<[string, string]>;
|
|
862
|
+
};
|
|
855
863
|
|
|
856
864
|
function flatten(css: string, condition: string, layer: string, out: Rule[]): void {
|
|
857
865
|
let i = 0;
|
|
@@ -875,9 +883,11 @@ describe('product-carousel block', () => {
|
|
|
875
883
|
namedLayer ? namedLayer[1]! : layer,
|
|
876
884
|
out
|
|
877
885
|
);
|
|
878
|
-
} else if (layer === 'utilities') {
|
|
886
|
+
} else if (layer === 'utilities' || layer === 'components') {
|
|
879
887
|
out.push({
|
|
880
888
|
condition,
|
|
889
|
+
layer,
|
|
890
|
+
selector: head,
|
|
881
891
|
declarations: body
|
|
882
892
|
.split(';')
|
|
883
893
|
.map((part) => part.trim())
|
|
@@ -915,7 +925,15 @@ describe('product-carousel block', () => {
|
|
|
915
925
|
});
|
|
916
926
|
const rules: Rule[] = [];
|
|
917
927
|
flatten(compiler.build(classes), '', '', rules);
|
|
918
|
-
|
|
928
|
+
// `components.css` ships whole, whatever the candidates, so only its rules for this
|
|
929
|
+
// element's own classes apply; and every utility outranks every component rule by layer.
|
|
930
|
+
const own = new Set(classes.map((name) => `.${name}`));
|
|
931
|
+
return [
|
|
932
|
+
...rules.filter(
|
|
933
|
+
(rule) => rule.layer === 'components' && own.has(rule.selector.replace(/\\(.)/g, '$1'))
|
|
934
|
+
),
|
|
935
|
+
...rules.filter((rule) => rule.layer === 'utilities'),
|
|
936
|
+
];
|
|
919
937
|
}
|
|
920
938
|
|
|
921
939
|
/** `max(bleed, reach)` can only be at least the reach; the bare reach is exactly it. */
|
|
@@ -380,9 +380,9 @@ const isBackorder = computed(() => stockLine.value.state === 'backorder');
|
|
|
380
380
|
|
|
381
381
|
/** Spec States, Back-order row: `warning` with the clock icon. `StockBadge`'s own `preorder` level
|
|
382
382
|
* draws the clock in `muted` (it serves a quieter product-card context too), so the block asks for
|
|
383
|
-
* the spec's colour through
|
|
384
|
-
const
|
|
385
|
-
isBackorder.value ?
|
|
383
|
+
* the spec's colour through its `class`, never by patching it. */
|
|
384
|
+
const stockClass = computed(() =>
|
|
385
|
+
isBackorder.value ? 'text-warning font-semibold' : 'font-semibold'
|
|
386
386
|
);
|
|
387
387
|
|
|
388
388
|
/* ------------------------------------------------------------------------- */
|
|
@@ -613,7 +613,7 @@ function tabValue(index: number): string {
|
|
|
613
613
|
spacing="none"
|
|
614
614
|
:labelled-by="titleId"
|
|
615
615
|
:aria-busy="refreshing ? 'true' : undefined"
|
|
616
|
-
:
|
|
616
|
+
:class="SECTION_SPACING"
|
|
617
617
|
>
|
|
618
618
|
<Container width="content">
|
|
619
619
|
<div
|
|
@@ -726,7 +726,7 @@ function tabValue(index: number): string {
|
|
|
726
726
|
:level="stockLine.level"
|
|
727
727
|
:message="t(stockLine.key, stockLine.params)"
|
|
728
728
|
:revalidating="stockRevalidating"
|
|
729
|
-
:
|
|
729
|
+
:class="stockClass"
|
|
730
730
|
/>
|
|
731
731
|
<span v-if="stockLine.noteKey" class="text-muted mt-1 block pl-6 text-[0.875rem]">{{
|
|
732
732
|
t(stockLine.noteKey)
|
|
@@ -736,7 +736,7 @@ function tabValue(index: number): string {
|
|
|
736
736
|
<FieldWrapper
|
|
737
737
|
v-if="showQuantity && !soldOut"
|
|
738
738
|
:label="t('product.quantity')"
|
|
739
|
-
|
|
739
|
+
class="gap-2"
|
|
740
740
|
>
|
|
741
741
|
<QuantityStepper
|
|
742
742
|
v-model="quantity"
|
|
@@ -861,7 +861,7 @@ function tabValue(index: number): string {
|
|
|
861
861
|
</Container>
|
|
862
862
|
</Section>
|
|
863
863
|
|
|
864
|
-
<Section v-else-if="showStatus" spacing="none" :
|
|
864
|
+
<Section v-else-if="showStatus" spacing="none" :class="SECTION_SPACING">
|
|
865
865
|
<Container width="content">
|
|
866
866
|
<p role="status" class="text-muted">
|
|
867
867
|
{{ productResult.error.value ? t('storefront.error') : t('storefront.loading') }}
|
|
@@ -872,7 +872,7 @@ function tabValue(index: number): string {
|
|
|
872
872
|
<!-- The read answered, and the answer was "there is no such product". Said plainly, before the
|
|
873
873
|
editor hint below, because on a live page this is what a visitor who followed an old link
|
|
874
874
|
sees and the hint is not for them. -->
|
|
875
|
-
<Section v-else-if="notFound" spacing="none" :
|
|
875
|
+
<Section v-else-if="notFound" spacing="none" :class="SECTION_SPACING">
|
|
876
876
|
<Container width="content">
|
|
877
877
|
<p role="status" class="text-muted">{{ t('storefront.notFound') }}</p>
|
|
878
878
|
</Container>
|
|
@@ -1285,7 +1285,7 @@ describe('product-detail block', () => {
|
|
|
1285
1285
|
expect(bar.text()).toContain('Oat / XS · $96.00');
|
|
1286
1286
|
// The quick-add button is the one control that exists only below 48rem, where primary
|
|
1287
1287
|
// actions are at least 2.75rem tall: it takes the package's `lg` size.
|
|
1288
|
-
expect(bar.get('button[type="button"]').classes()).toContain('control-h-lg');
|
|
1288
|
+
expect(bar.get('button[type="button"]').classes()).toContain('eldra:control-h-lg');
|
|
1289
1289
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
1290
1290
|
|
|
1291
1291
|
observers[0]!([{ isIntersecting: true }]);
|
|
@@ -127,7 +127,7 @@ const THUMBNAIL_IDLE =
|
|
|
127
127
|
icon-only
|
|
128
128
|
variant="outline"
|
|
129
129
|
aria-haspopup="dialog"
|
|
130
|
-
|
|
130
|
+
class="size-11 shadow-sm"
|
|
131
131
|
:label="t('product.zoom', { index: current + 1, count })"
|
|
132
132
|
@click="lightboxOpen = true"
|
|
133
133
|
>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* (`text-text` on `none`/`surface`/`surface-strong`, `text-primary-contrast`/`text-accent-contrast`
|
|
33
33
|
* on the two inverting grounds), and that is a normal inherited CSS `color` — so the quote paragraph
|
|
34
34
|
* and the `<cite>` name carry no colour class of their own and simply inherit whichever one is
|
|
35
|
-
* right. `Link` already inverts its own `muted` tone through its `
|
|
35
|
+
* right. `Link` already inverts its own `muted` tone through its `section-primary:`/`section-accent:`
|
|
36
36
|
* classes, so the role line needs no extra handling when it is a link. Only the two parts with no
|
|
37
37
|
* such built-in mechanism branch by hand: the quote mark (`accent` by default, since an `accent`
|
|
38
38
|
* mark would vanish on an `accent` ground) and the plain-text role line for when there is no
|
|
@@ -70,7 +70,7 @@ describe('quote block', () => {
|
|
|
70
70
|
it('the block root is a labelled <section> that measures its own width (@container)', () => {
|
|
71
71
|
const wrapper = mountBlock(mock);
|
|
72
72
|
const section = wrapper.get('section');
|
|
73
|
-
expect(section.classes()).toContain('
|
|
73
|
+
expect(section.classes()).toContain('eldra:@container');
|
|
74
74
|
expect(section.attributes('aria-labelledby')).toBeTruthy();
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -79,7 +79,7 @@ describe('quote block', () => {
|
|
|
79
79
|
const heading = wrapper.get(`#${wrapper.get('section').attributes('aria-labelledby')}`);
|
|
80
80
|
expect(heading.element.tagName).toBe('H2');
|
|
81
81
|
expect(heading.text()).toBe(`Quote from ${mock.name}`);
|
|
82
|
-
expect(heading.classes()).toContain('sr-only');
|
|
82
|
+
expect(heading.classes()).toContain('eldra:sr-only');
|
|
83
83
|
|
|
84
84
|
const figure = wrapper.get('figure');
|
|
85
85
|
const blockquote = figure.get('blockquote');
|
|
@@ -150,7 +150,7 @@ describe('quote block', () => {
|
|
|
150
150
|
expect(link.text()).toBe(mock.role);
|
|
151
151
|
expect(link.attributes('href')).toBe(sourceLinkHref);
|
|
152
152
|
expect(link.attributes('aria-label')).toBe(mock.sourceLinkLabel);
|
|
153
|
-
expect(link.classes()).toContain('eldra-focus');
|
|
153
|
+
expect(link.classes()).toContain('eldra:eldra-focus');
|
|
154
154
|
const focusable = Array.from(wrapper.element.querySelectorAll('a, button, input, [tabindex]'));
|
|
155
155
|
expect(focusable).toContain(link.element);
|
|
156
156
|
});
|
|
@@ -167,7 +167,9 @@ describe('quote block', () => {
|
|
|
167
167
|
it('has no italic class anywhere in the block', () => {
|
|
168
168
|
const wrapper = mountBlock(withMedia);
|
|
169
169
|
for (const element of wrapper.element.querySelectorAll('*')) {
|
|
170
|
-
expect(Array.from(element.classList)).not.toContain(
|
|
170
|
+
expect(Array.from(element.classList, (token) => token.replace(/^eldra:/, ''))).not.toContain(
|
|
171
|
+
'italic'
|
|
172
|
+
);
|
|
171
173
|
}
|
|
172
174
|
});
|
|
173
175
|
|
|
@@ -259,6 +261,7 @@ describe('quote block', () => {
|
|
|
259
261
|
});
|
|
260
262
|
const link = wrapper.get('figcaption a');
|
|
261
263
|
expect(link.classes()).not.toContain('block');
|
|
264
|
+
expect(link.classes()).not.toContain('eldra:block');
|
|
262
265
|
expect(link.element.parentElement?.tagName).toBe('P');
|
|
263
266
|
expect(link.text()).toBe(mock.role);
|
|
264
267
|
});
|
|
@@ -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>
|
|
@@ -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
|
});
|
|
@@ -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
|
|
|
@@ -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)]');
|
|
@@ -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
|
|
|
@@ -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
|
});
|
|
@@ -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
|
});
|
|
@@ -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();
|
|
@@ -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>
|
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`
|