@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.
Files changed (136) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +6 -0
  3. package/dist/cli.js +9 -4
  4. package/dist/index.d.ts +6 -12
  5. package/dist/index.js +1 -1
  6. package/dist/{validate-DprFpjV7.js → validate-CC6Mp5i_.js} +11 -19
  7. package/package.json +3 -3
  8. package/template/.eldra/previews.json +35 -35
  9. package/template/README.md +3 -1
  10. package/template/app/app.vue +1 -3
  11. package/template/app/assets/main.css +13 -15
  12. package/template/app/components/ui/UiImage.vue +29 -17
  13. package/template/app/components/ui/__tests__/UiImage.spec.ts +24 -15
  14. package/template/app/pages/[...slug].vue +1 -1
  15. package/template/app/storefront/gateway.ts +0 -3
  16. package/template/app/storefront/structuredData.ts +2 -2
  17. package/template/app/storefront/types.ts +0 -5
  18. package/template/app/utils/seoInput.ts +0 -1
  19. package/template/blocks/announcement-bar/Block.vue +3 -2
  20. package/template/blocks/announcement-bar/__tests__/Block.spec.ts +1 -1
  21. package/template/blocks/announcement-bar/preview.png +0 -0
  22. package/template/blocks/article/Block.vue +3 -4
  23. package/template/blocks/article/preview.png +0 -0
  24. package/template/blocks/article-list/Block.vue +18 -9
  25. package/template/blocks/article-list/preview.png +0 -0
  26. package/template/blocks/breadcrumbs/Block.vue +1 -1
  27. package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +9 -9
  28. package/template/blocks/breadcrumbs/preview.png +0 -0
  29. package/template/blocks/cart/Block.vue +1 -1
  30. package/template/blocks/cart/parts/CartLines.vue +3 -2
  31. package/template/blocks/cart/parts/ShippingBar.vue +1 -1
  32. package/template/blocks/cart/parts/Summary.vue +5 -9
  33. package/template/blocks/cart/preview.png +0 -0
  34. package/template/blocks/collection-grid/Block.vue +11 -14
  35. package/template/blocks/collection-grid/__tests__/Block.spec.ts +12 -14
  36. package/template/blocks/collection-grid/preview.png +0 -0
  37. package/template/blocks/collection-header/Block.vue +5 -5
  38. package/template/blocks/collection-header/preview.png +0 -0
  39. package/template/blocks/contact/Block.vue +1 -1
  40. package/template/blocks/contact/__tests__/Block.spec.ts +2 -2
  41. package/template/blocks/contact/preview.png +0 -0
  42. package/template/blocks/cta/Block.vue +16 -18
  43. package/template/blocks/cta/__tests__/Block.spec.ts +8 -12
  44. package/template/blocks/cta/preview.png +0 -0
  45. package/template/blocks/faq/Block.vue +3 -13
  46. package/template/blocks/faq/__tests__/Block.spec.ts +2 -2
  47. package/template/blocks/faq/preview.png +0 -0
  48. package/template/blocks/feature-grid/Block.vue +1 -1
  49. package/template/blocks/feature-grid/__tests__/Block.spec.ts +1 -1
  50. package/template/blocks/feature-grid/preview.png +0 -0
  51. package/template/blocks/footer/Block.vue +14 -11
  52. package/template/blocks/footer/__tests__/Block.spec.ts +5 -5
  53. package/template/blocks/footer/preview.png +0 -0
  54. package/template/blocks/form/Block.vue +1 -1
  55. package/template/blocks/form/preview.png +0 -0
  56. package/template/blocks/gallery/__tests__/Block.spec.ts +1 -1
  57. package/template/blocks/gallery/preview.png +0 -0
  58. package/template/blocks/hero/Block.vue +8 -11
  59. package/template/blocks/hero/__tests__/Block.spec.ts +9 -7
  60. package/template/blocks/hero/preview.png +0 -0
  61. package/template/blocks/image/Block.vue +4 -4
  62. package/template/blocks/image/__tests__/Block.spec.ts +5 -6
  63. package/template/blocks/image/preview.png +0 -0
  64. package/template/blocks/logo-cloud/__tests__/Block.spec.ts +1 -1
  65. package/template/blocks/logo-cloud/preview.png +0 -0
  66. package/template/blocks/navigation/Block.vue +16 -26
  67. package/template/blocks/navigation/__tests__/Block.spec.ts +22 -20
  68. package/template/blocks/navigation/preview.png +0 -0
  69. package/template/blocks/newsletter/__tests__/Block.spec.ts +1 -1
  70. package/template/blocks/newsletter/preview.png +0 -0
  71. package/template/blocks/order-status/Block.vue +8 -9
  72. package/template/blocks/order-status/__tests__/Block.spec.ts +1 -2
  73. package/template/blocks/order-status/preview.png +0 -0
  74. package/template/blocks/pricing-table/__tests__/Block.spec.ts +1 -1
  75. package/template/blocks/pricing-table/preview.png +0 -0
  76. package/template/blocks/product-carousel/Block.vue +6 -6
  77. package/template/blocks/product-carousel/__tests__/Block.spec.ts +26 -8
  78. package/template/blocks/product-carousel/preview.png +0 -0
  79. package/template/blocks/product-detail/Block.vue +8 -8
  80. package/template/blocks/product-detail/__tests__/Block.spec.ts +1 -1
  81. package/template/blocks/product-detail/parts/Gallery.vue +1 -1
  82. package/template/blocks/product-detail/preview.png +0 -0
  83. package/template/blocks/quote/Block.vue +1 -1
  84. package/template/blocks/quote/__tests__/Block.spec.ts +7 -4
  85. package/template/blocks/quote/preview.png +0 -0
  86. package/template/blocks/rich-text/preview.png +0 -0
  87. package/template/blocks/search/Block.vue +2 -2
  88. package/template/blocks/search/PopularChips.vue +1 -1
  89. package/template/blocks/search/preview.png +0 -0
  90. package/template/blocks/split-content/Block.vue +2 -3
  91. package/template/blocks/split-content/__tests__/Block.spec.ts +2 -2
  92. package/template/blocks/split-content/preview.png +0 -0
  93. package/template/blocks/stats/__tests__/Block.spec.ts +1 -1
  94. package/template/blocks/stats/preview.png +0 -0
  95. package/template/blocks/tabs/Block.vue +4 -5
  96. package/template/blocks/tabs/__tests__/Block.spec.ts +2 -2
  97. package/template/blocks/tabs/preview.png +0 -0
  98. package/template/blocks/team/preview.png +0 -0
  99. package/template/blocks/testimonials/Block.vue +10 -9
  100. package/template/blocks/testimonials/__tests__/Block.spec.ts +1 -1
  101. package/template/blocks/testimonials/preview.png +0 -0
  102. package/template/blocks/timeline/__tests__/Block.spec.ts +2 -2
  103. package/template/blocks/timeline/preview.png +0 -0
  104. package/template/blocks/trust-strip/Block.vue +1 -1
  105. package/template/blocks/trust-strip/__tests__/Block.spec.ts +1 -1
  106. package/template/blocks/trust-strip/preview.png +0 -0
  107. package/template/blocks/video-embed/Block.vue +3 -3
  108. package/template/blocks/video-embed/__tests__/Block.spec.ts +1 -1
  109. package/template/blocks/video-embed/preview.png +0 -0
  110. package/template/blocks/wishlist/Block.vue +1 -1
  111. package/template/blocks/wishlist/preview.png +0 -0
  112. package/template/nuxt.config.ts +5 -4
  113. package/template/package.json +2 -1
  114. package/template/stories/pages/article.stories.ts +2 -3
  115. package/template/stories/pages/cart.stories.ts +2 -3
  116. package/template/stories/pages/category.stories.ts +2 -3
  117. package/template/stories/pages/collection.stories.ts +2 -3
  118. package/template/stories/pages/home.stories.ts +2 -3
  119. package/template/stories/pages/product.stories.ts +3 -4
  120. package/template/stories/pages/products.stories.ts +2 -3
  121. package/template/stories/pages/search.stories.ts +2 -3
  122. package/template/stories/pages/wishlist.stories.ts +2 -3
  123. package/template/test/carouselKeyboard.spec.ts +2 -2
  124. package/template/test/carouselRing.browser.spec.ts +2 -2
  125. package/template/test/carouselSlideWidth.browser.spec.ts +9 -9
  126. package/template/test/eldraIcon.spec.ts +1 -1
  127. package/template/test/mainCss.spec.ts +7 -0
  128. package/template/test/pages/article.spec.ts +5 -5
  129. package/template/test/pages/collection.spec.ts +5 -5
  130. package/template/test/pages/hydration.spec.ts +10 -10
  131. package/template/test/prerenderRefresh.browser.spec.ts +51 -1
  132. package/template/test/seoInput.spec.ts +5 -4
  133. package/template/test/storefront/structuredData.spec.ts +3 -6
  134. package/template/test/structuredData.generate.spec.ts +1 -1
  135. package/template/test/support/mockGateway.ts +8 -3
  136. package/template/test/support/mountPage.ts +2 -3
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * A focused band asking the visitor to do one thing (spec `02-blocks.md` 745–856). `variant`:
4
4
  * - `primary`: full-width `primary` band, centred copy — `Section background="primary"` already
5
- * marks `class="group/section" data-section="primary"` on its own root, which is the package's
5
+ * marks `data-section="primary"` on its own root, which is the package's
6
6
  * own signal that inverts `Button` (a `primary-contrast` fill with `primary` text; `outline`
7
7
  * becomes a transparent `currentColor` box) with no hand-written colour in this block.
8
8
  * - `subtle`: the same centred layout on `Section background="surface"` (no inversion — only
@@ -13,7 +13,7 @@
13
13
  * inverts, so this panel carries no `data-section` at all. With no image it falls back to the
14
14
  * same centred `subtle`-style copy, inside the panel.
15
15
  * - `banner`: a compact `accent` panel the block marks **by hand**
16
- * (`class="group/section" data-section="accent"` on the panel `<div>`, not the `Section`, whose
16
+ * (`data-section="accent"` on the panel `<div>`, not the `Section`, whose
17
17
  * own `background` stays `none` here per the design spec's Section table) — that hand-written
18
18
  * marker is what inverts the one button the same way `Section`'s own `data-section` does
19
19
  * elsewhere. No eyebrow, no secondary action; heading keeps the `h2` tag but is styled at the
@@ -24,18 +24,16 @@
24
24
  * switches its own control height with the block's width (spec: "Buttons are 3rem tall (the
25
25
  * `banner` button is 2.75rem below 48rem)"): `size="lg"` keeps its `lg` padding/gap/text sizing at
26
26
  * every width — the package has no separate size preset for one block's own in-between height, and
27
- * forking `Button` for it is out of scope (Global Constraints) — while `classes.container:
28
- * 'control-h @tablet:control-h-lg'` swaps only the height utility itself: `control-h` (the
27
+ * forking `Button` for it is out of scope (Global Constraints) — while `class="control-h
28
+ * @tablet:control-h-lg"` swaps only the height utility itself: `control-h` (the
29
29
  * package's own `md`, 2.5rem — the closest token-backed height to the spec's 2.75rem, since there
30
30
  * is no `--eldra-control-height-*` step at exactly 2.75rem either) below `@tablet` (48rem of the
31
- * block's own width), `control-h-lg` (3rem) from `@tablet` on. `cx`'s custom `twMerge` config
32
- * registers `control-h`/`control-h-sm`/`control-h-lg` as one conflicting group
33
- * (`packages/ui/src/utils/cx.ts`), so the override cleanly replaces `size="lg"`'s own base
34
- * `control-h-lg` at the unprefixed (mobile) level without touching its `@tablet:`-scoped one.
31
+ * block's own width), `control-h-lg` (3rem) from `@tablet` on. An app utility outranks every
32
+ * `eldra:` class by cascade layer, so it beats `size="lg"`'s own `eldra:control-h-lg` at every width.
35
33
  *
36
34
  * Full-width-below-`@tablet` buttons elsewhere use the same base/`@tablet:` class pair every other
37
- * rebuilt block's own container-query classes use (`w-full @tablet:w-auto` on `Button`'s own
38
- * `container` part) rather than the static `block` prop, since the width itself has to flip at the
35
+ * rebuilt block's own container-query classes use (`w-full @tablet:w-auto` as `Button`'s own
36
+ * `class`) rather than the static `block` prop, since the width itself has to flip at the
39
37
  * breakpoint, not stay fixed.
40
38
  *
41
39
  * The three per-field editor hints spec line 815 lists ("Add a heading", "Add supporting text
@@ -141,7 +139,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
141
139
  <!-- banner: compact accent row, hand-marked so the package inverts its one button -->
142
140
  <div
143
141
  v-if="isBanner"
144
- class="group/section bg-accent text-accent-contrast @tablet:flex-row @tablet:flex-wrap @tablet:items-center @tablet:justify-between @tablet:gap-x-8 @tablet:gap-y-5 @tablet:px-12 @tablet:py-8 flex flex-col gap-4 rounded-xl p-6"
142
+ class="bg-accent text-accent-contrast @tablet:flex-row @tablet:flex-wrap @tablet:items-center @tablet:justify-between @tablet:gap-x-8 @tablet:gap-y-5 @tablet:px-12 @tablet:py-8 flex flex-col gap-4 rounded-xl p-6"
145
143
  data-section="accent"
146
144
  >
147
145
  <div class="grid max-w-[40rem] gap-2 text-left">
@@ -168,7 +166,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
168
166
  size="lg"
169
167
  :href="primaryHref!"
170
168
  :as="primaryAs"
171
- :classes="{ container: 'control-h @tablet:control-h-lg w-full @tablet:w-auto' }"
169
+ class="control-h @tablet:control-h-lg @tablet:w-auto w-full"
172
170
  >
173
171
  {{ data.primaryCtaLabel }}
174
172
  </Button>
@@ -224,7 +222,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
224
222
  size="lg"
225
223
  :href="primaryHref!"
226
224
  :as="primaryAs"
227
- :classes="{ container: 'w-full @tablet:w-auto' }"
225
+ class="@tablet:w-auto w-full"
228
226
  >
229
227
  {{ data.primaryCtaLabel }}
230
228
  </Button>
@@ -239,7 +237,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
239
237
  size="lg"
240
238
  :href="secondaryHref!"
241
239
  :as="secondaryAs"
242
- :classes="{ container: 'w-full @tablet:w-auto' }"
240
+ class="@tablet:w-auto w-full"
243
241
  >
244
242
  {{ data.secondaryCtaLabel }}
245
243
  </Button>
@@ -289,7 +287,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
289
287
  size="lg"
290
288
  :href="primaryHref!"
291
289
  :as="primaryAs"
292
- :classes="{ container: 'w-full @tablet:w-auto' }"
290
+ class="@tablet:w-auto w-full"
293
291
  >
294
292
  {{ data.primaryCtaLabel }}
295
293
  </Button>
@@ -304,7 +302,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
304
302
  size="lg"
305
303
  :href="secondaryHref!"
306
304
  :as="secondaryAs"
307
- :classes="{ container: 'w-full @tablet:w-auto' }"
305
+ class="@tablet:w-auto w-full"
308
306
  >
309
307
  {{ data.secondaryCtaLabel }}
310
308
  </Button>
@@ -361,7 +359,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
361
359
  size="lg"
362
360
  :href="primaryHref!"
363
361
  :as="primaryAs"
364
- :classes="{ container: 'w-full @tablet:w-auto' }"
362
+ class="@tablet:w-auto w-full"
365
363
  >
366
364
  {{ data.primaryCtaLabel }}
367
365
  </Button>
@@ -372,7 +370,7 @@ const showButtonHint = computed(() => isEditing.value && !hasPrimaryCta.value);
372
370
  size="lg"
373
371
  :href="secondaryHref!"
374
372
  :as="secondaryAs"
375
- :classes="{ container: 'w-full @tablet:w-auto' }"
373
+ class="@tablet:w-auto w-full"
376
374
  >
377
375
  {{ data.secondaryCtaLabel }}
378
376
  </Button>
@@ -37,7 +37,7 @@ describe('cta block', () => {
37
37
  // `Container` or `div` (a `Container` never sets `@container` on its own).
38
38
  for (const variant of ['primary', 'subtle', 'split', 'banner'] as const) {
39
39
  const wrapper = mountBlock({ ...withImage, variant });
40
- expect(wrapper.get('section').classes()).toContain('@container');
40
+ expect(wrapper.get('section').classes()).toContain('eldra:@container');
41
41
  }
42
42
  });
43
43
 
@@ -141,26 +141,22 @@ describe('cta block', () => {
141
141
  const classes = button.classes();
142
142
  // `control-h` (the package's regular control height, closest token-backed step to the spec's
143
143
  // 2.75rem) below `@tablet` (48rem of the block's own width); `@tablet:control-h-lg` (3rem)
144
- // from 48rem on — see `Block.vue`'s own doc comment on the banner Button's `classes.container`.
144
+ // from 48rem on — see `Block.vue`'s own doc comment on the banner Button's `class`.
145
145
  expect(classes).toContain('control-h');
146
146
  expect(classes).toContain('@tablet:control-h-lg');
147
- // `size="lg"`'s own *unprefixed* `control-h-lg` must be gone — `cx`'s custom `twMerge` config
148
- // treats `control-h`/`control-h-lg` as one conflicting group, so the override replaces it
149
- // rather than sitting beside it (which would let the bare `control-h-lg` win the cascade at
150
- // every width, silently keeping the button at 3rem below 48rem too). Its `lg` padding/text
151
- // sizing (`px-6`, `text-button-lg`) stay untouched — a different, non-conflicting class group.
152
- expect(classes).not.toContain('control-h-lg');
153
- expect(classes).toContain('px-6');
154
- expect(classes).toContain('text-button-lg');
147
+ // `size="lg"`'s own `eldra:control-h-lg` stays beside them and loses by cascade layer: an app
148
+ // utility outranks every `eldra:` class. Its `lg` padding/text sizing stay as they are.
149
+ expect(classes).toContain('eldra:px-6');
150
+ expect(classes).toContain('eldra:text-button-lg');
155
151
  });
156
152
 
157
153
  it('marks the banner panel data-section="accent" — the attribute that inverts the button, not a colour class', () => {
158
154
  const wrapper = mountBlock({ ...mock, variant: 'banner' });
159
155
  const panel = wrapper.get('[data-section="accent"]');
160
- expect(panel.classes()).toContain('group/section');
156
+ expect(panel.classes()).toContain('bg-accent');
161
157
  // Mutation check (manual): removing `data-section="accent"` from the panel while keeping
162
158
  // `bg-accent` leaves the button unstyled by the package's own inversion rules (its classes are
163
- // `group-data-[section=accent]/section:*`) — confirmed by temporarily dropping the attribute
159
+ // `eldra:section-accent:*`) — confirmed by temporarily dropping the attribute
164
160
  // here and observing the assertion above fail (`get()` throws, no such element).
165
161
  });
166
162
 
Binary file
@@ -33,7 +33,7 @@
33
33
  * `rows[].text` for the identical reasoning).
34
34
  *
35
35
  * Answers cap at 65ch: that comes for free from `AccordionItem`'s own panel class
36
- * (`max-w-[65ch]`, see that component's source) — nothing here repeats it.
36
+ * (`eldra:max-w-[65ch]`, see that component's source) — nothing here repeats it.
37
37
  *
38
38
  * `variant`:
39
39
  * - `one-column` (default): a centred head (heading, intro) inside a `narrow` (40rem) container —
@@ -154,12 +154,7 @@ useRichTextScrollRegions(accordionRoot, (caption) => caption ?? t('faq.richTextT
154
154
  <EditorPlaceholder v-else-if="showIntroHint" inline :label="t('faq.introHintLabel')" />
155
155
  <p v-if="hasContactLink" class="text-muted text-base">
156
156
  {{ contactText }}
157
- <Link
158
- :href="contactHref!"
159
- :as="contactLinkAs"
160
- variant="inline"
161
- :classes="{ root: 'font-semibold' }"
162
- >
157
+ <Link :href="contactHref!" :as="contactLinkAs" variant="inline" class="font-semibold">
163
158
  {{ contactLinkLabel }}
164
159
  </Link>
165
160
  </p>
@@ -239,12 +234,7 @@ useRichTextScrollRegions(accordionRoot, (caption) => caption ?? t('faq.richTextT
239
234
 
240
235
  <p v-if="hasContactLink" class="text-muted mt-8 text-center text-base">
241
236
  {{ contactText }}
242
- <Link
243
- :href="contactHref!"
244
- :as="contactLinkAs"
245
- variant="inline"
246
- :classes="{ root: 'font-semibold' }"
247
- >
237
+ <Link :href="contactHref!" :as="contactLinkAs" variant="inline" class="font-semibold">
248
238
  {{ contactLinkLabel }}
249
239
  </Link>
250
240
  </p>
@@ -114,14 +114,14 @@ describe('faq block', () => {
114
114
  it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
115
115
  const wrapper = mountBlock(mock);
116
116
  const section = wrapper.get('section');
117
- expect(section.classes()).toContain('@container');
117
+ expect(section.classes()).toContain('eldra:@container');
118
118
  expect(section.attributes('aria-labelledby')).toBeTruthy();
119
119
  });
120
120
 
121
121
  it('answers cap at 65ch — the package panel class, not repeated here', () => {
122
122
  const wrapper = mountBlock(mock);
123
123
  for (const panel of wrapper.findAll('[data-part="panel"]')) {
124
- expect(panel.classes()).toContain('max-w-[65ch]');
124
+ expect(panel.classes()).toContain('eldra:max-w-[65ch]');
125
125
  }
126
126
  });
127
127
 
Binary file
@@ -226,8 +226,8 @@ const items = computed(() =>
226
226
  :link-as="item.linkAs"
227
227
  :variant="featureCardVariant"
228
228
  :heading-level="3"
229
+ class="h-full"
229
230
  :classes="{
230
- root: 'h-full',
231
231
  iconTile: item.showIconTile ? undefined : 'hidden',
232
232
  titleLink: NO_UNDERLINE_UNTIL_HOVER,
233
233
  cue: 'mt-auto',
@@ -101,7 +101,7 @@ describe('feature-grid 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('@container');
104
+ expect(section.classes()).toContain('eldra:@container');
105
105
  expect(section.attributes('aria-labelledby')).toBeTruthy();
106
106
  });
107
107
 
@@ -417,7 +417,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
417
417
  spacing="none"
418
418
  :labelled-by="variant === 'default' ? headingId : undefined"
419
419
  :aria-label="variant === 'minimal' ? t('footer.title') : undefined"
420
- :classes="{ root: paddingClass }"
420
+ :class="paddingClass"
421
421
  >
422
422
  <Container width="wide">
423
423
  <VisuallyHidden v-if="variant === 'default'" :id="headingId" as="h2">{{
@@ -435,8 +435,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
435
435
  :as="EldraRouterLink"
436
436
  variant="standalone"
437
437
  :underline="false"
438
+ class="inline-flex items-center hover:no-underline active:no-underline"
438
439
  :classes="{
439
- root: 'inline-flex items-center hover:no-underline active:no-underline',
440
440
  label: 'font-heading text-text text-xl leading-[1.2] font-bold tracking-[-0.015em]',
441
441
  }"
442
442
  >
@@ -470,7 +470,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
470
470
  target="_blank"
471
471
  rel="noopener"
472
472
  :label="socialLinkName(social.network)"
473
- :classes="{ container: 'size-11' }"
473
+ class="size-11"
474
474
  >
475
475
  <template #leadingIcon>
476
476
  <EldraIcon :name="social.icon" size="md" />
@@ -502,7 +502,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
502
502
  :as="link.as"
503
503
  tone="muted"
504
504
  :underline="false"
505
- :classes="{ root: 'inline-flex min-h-9 items-center text-base' }"
505
+ class="inline-flex min-h-9 items-center text-base"
506
506
  >{{ link.label }}</Link
507
507
  >
508
508
  <span v-else class="text-muted inline-flex min-h-9 items-center text-base">{{
@@ -541,7 +541,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
541
541
  <FieldWrapper
542
542
  :label="emailLabel"
543
543
  :error="emailError ?? undefined"
544
- :classes="{ root: 'block w-full' }"
544
+ class="block w-full"
545
545
  >
546
546
  <Input
547
547
  v-model="email"
@@ -559,6 +559,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
559
559
  <Button
560
560
  type="submit"
561
561
  variant="primary"
562
+ block
562
563
  :label="t('footer.subscribing')"
563
564
  :aria-describedby="consentSentence ? consentSentenceId : undefined"
564
565
  >{{ t('footer.subscribe') }}</Button
@@ -589,8 +590,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
589
590
  :as="EldraRouterLink"
590
591
  variant="standalone"
591
592
  :underline="false"
593
+ class="inline-flex items-center hover:no-underline active:no-underline"
592
594
  :classes="{
593
- root: 'inline-flex items-center hover:no-underline active:no-underline',
594
595
  label: 'font-heading text-text text-xl leading-[1.2] font-bold tracking-[-0.015em]',
595
596
  }"
596
597
  >
@@ -614,7 +615,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
614
615
  :as="link.as"
615
616
  tone="muted"
616
617
  :underline="false"
617
- :classes="{ root: 'inline-flex min-h-9 items-center text-base' }"
618
+ class="inline-flex min-h-9 items-center text-base"
618
619
  >{{ link.label }}</Link
619
620
  >
620
621
  <span v-else class="text-muted inline-flex min-h-9 items-center text-base">{{
@@ -634,7 +635,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
634
635
  target="_blank"
635
636
  rel="noopener"
636
637
  :label="socialLinkName(social.network)"
637
- :classes="{ container: 'size-11' }"
638
+ class="size-11"
638
639
  >
639
640
  <template #leadingIcon>
640
641
  <EldraIcon :name="social.icon" size="md" />
@@ -658,7 +659,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
658
659
  :href="link.href"
659
660
  :as="link.as"
660
661
  tone="muted"
661
- :classes="{ root: 'inline-flex min-h-6 items-center' }"
662
+ class="inline-flex min-h-6 items-center"
662
663
  >{{ link.label }}</Link
663
664
  >
664
665
  <span v-else class="inline-flex min-h-6 items-center">{{ link.label }}</span>
@@ -670,7 +671,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
670
671
  <FieldWrapper
671
672
  v-if="showLocale"
672
673
  :label="t('footer.localeLabel')"
673
- :classes="{ root: 'w-full @tablet:w-auto', label: 'sr-only' }"
674
+ class="@tablet:w-auto w-full"
675
+ :classes="{ label: 'sr-only' }"
674
676
  >
675
677
  <!-- Not `searchable`: a store has a handful of content locales, and a search field
676
678
  over three options is one more thing between a visitor and their language. -->
@@ -693,7 +695,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
693
695
  <FieldWrapper
694
696
  v-else-if="showCurrencySelector"
695
697
  :label="t('footer.currencyLabel')"
696
- :classes="{ root: 'w-full @tablet:w-auto', label: 'sr-only' }"
698
+ class="@tablet:w-auto w-full"
699
+ :classes="{ label: 'sr-only' }"
697
700
  >
698
701
  <Select
699
702
  v-model="currency"
@@ -279,7 +279,7 @@ describe('footer block', () => {
279
279
  const heading = wrapper.find(`#${labelledBy}`);
280
280
  expect(heading.element.tagName).toBe('H2');
281
281
  expect(heading.text()).toBe(enUS.footer.title);
282
- expect(heading.classes()).toContain('sr-only');
282
+ expect(heading.classes()).toContain('eldra:sr-only');
283
283
  });
284
284
 
285
285
  it('names the <footer> landmark with aria-label directly in the minimal variant (no hidden <h2>)', () => {
@@ -301,7 +301,7 @@ describe('footer block', () => {
301
301
  const wrapper = mountFooter(mock);
302
302
  const footer = wrapper.find('footer');
303
303
  expect(footer.exists()).toBe(true);
304
- expect(footer.classes()).toContain('@container');
304
+ expect(footer.classes()).toContain('eldra:@container');
305
305
  });
306
306
 
307
307
  it('labels the link-groups nav', () => {
@@ -367,7 +367,7 @@ describe('footer block', () => {
367
367
  await flushPromises();
368
368
  // The field wrapper is `display: contents` by default, which turns its error into a flex item of
369
369
  // its own that lands after the button row; a real block keeps the two together.
370
- const cell = wrapper.get('input[type="email"]').element.closest('.content-start');
370
+ const cell = wrapper.get('input[type="email"]').element.closest('.eldra\\:content-start');
371
371
  expect(cell?.parentElement?.classList.contains('block')).toBe(true);
372
372
  });
373
373
 
@@ -655,7 +655,7 @@ describe('footer block', () => {
655
655
 
656
656
  // The content locale is Icelandic here (`locale: 'is-IS'`), so the visually hidden label
657
657
  // is `isIS`'s, not `enUS`'s.
658
- const hiddenLabels = wrapper.findAll('.sr-only').map((el) => el.text());
658
+ const hiddenLabels = wrapper.findAll('.eldra\\:sr-only').map((el) => el.text());
659
659
  expect(hiddenLabels).toContain(isIS.footer.currencyLabel);
660
660
 
661
661
  expect(await axe(wrapper.element)).toHaveNoViolations();
@@ -666,7 +666,7 @@ describe('footer block', () => {
666
666
 
667
667
  // No currency text and no combobox of either kind.
668
668
  expect(selectTriggers(wrapper)).toHaveLength(0);
669
- const hiddenLabels = wrapper.findAll('.sr-only').map((el) => el.text());
669
+ const hiddenLabels = wrapper.findAll('.eldra\\:sr-only').map((el) => el.text());
670
670
  expect(hiddenLabels).not.toContain(enUS.footer.currencyLabel);
671
671
 
672
672
  expect(await axe(wrapper.element)).toHaveNoViolations();
Binary file
@@ -552,7 +552,7 @@ const successTitle = computed(
552
552
  type="submit"
553
553
  variant="primary"
554
554
  size="lg"
555
- class="@two-col:justify-self-end"
555
+ class="@two-col:w-fit @two-col:justify-self-end w-full"
556
556
  :label="t('form.submitting')"
557
557
  :aria-describedby="consentSentenceId"
558
558
  >
Binary file
@@ -81,7 +81,7 @@ describe('gallery block', () => {
81
81
  await flushPromises();
82
82
  const frames = wrapper.findAll('[data-part="frame"]');
83
83
  expect(frames.length).toBe(withImages.items.length);
84
- for (const frame of frames) expect(frame.classes()).toContain('rounded-lg');
84
+ for (const frame of frames) expect(frame.classes()).toContain('eldra:rounded-lg');
85
85
  }
86
86
  });
87
87
 
Binary file
@@ -7,7 +7,7 @@
7
7
  * with the image first below that.
8
8
  * - `image-background`: a full-bleed image behind a full `overlay` scrim, copy bottom-left. The
9
9
  * `Section` itself takes `background="primary"` once there is an image — `@eldrajs/ui`'s own
10
- * `group-data-[section=primary]/section:` mechanism is what inverts `Button` (and, via
10
+ * `data-section="primary"` inversion is what inverts `Button` (and, via
11
11
  * `Section`'s base `text-primary-contrast`, the plain copy text) onto the scrim, so nothing
12
12
  * here hand-rolls the inversion. With no image yet (`mock.json` never seeds media — see
13
13
  * `docs/starter-kit.md`) there is nothing to scrim, so the ground falls back to
@@ -198,7 +198,7 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
198
198
  :background="sectionBackground"
199
199
  :spacing="sectionSpacing"
200
200
  :labelled-by="sectionLabelledBy"
201
- :classes="{ root: sectionRootClass }"
201
+ :class="sectionRootClass"
202
202
  >
203
203
  <UiImage
204
204
  v-if="hasScrimImage"
@@ -293,10 +293,10 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
293
293
  v-else-if="editing"
294
294
  inline
295
295
  :label="t('hero.imageHintLabel')"
296
- :classes="{
297
- root: 'aspect-[4/3] @tablet:aspect-[3/2] @content:aspect-[1/1] w-full rounded-xl bg-surface-strong',
298
- }"
299
- :class="imageOrderClass"
296
+ :class="[
297
+ '@tablet:aspect-[3/2] @content:aspect-[1/1] bg-surface-strong aspect-[4/3] w-full rounded-xl',
298
+ imageOrderClass,
299
+ ]"
300
300
  />
301
301
  </template>
302
302
 
@@ -317,10 +317,7 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
317
317
  v-else-if="editing"
318
318
  inline
319
319
  :label="t('hero.imageHintLabel')"
320
- :classes="{
321
- root: 'aspect-[4/3] @tablet:aspect-[21/9] @content:aspect-[3/1] w-full rounded-xl bg-surface-strong',
322
- }"
323
- class="@content:mt-12 mt-8"
320
+ class="@content:mt-12 @tablet:aspect-[21/9] @content:aspect-[3/1] bg-surface-strong mt-8 aspect-[4/3] w-full rounded-xl"
324
321
  />
325
322
  </template>
326
323
 
@@ -369,7 +366,7 @@ function slideAlt(slide: { alt?: string; image?: { altText?: string | null } }):
369
366
  v-else-if="editing"
370
367
  inline
371
368
  :label="t('hero.imageHintLabel')"
372
- :classes="{ root: 'aspect-[4/5] w-full rounded-xl bg-surface-strong' }"
369
+ class="bg-surface-strong aspect-[4/5] w-full rounded-xl"
373
370
  />
374
371
  </template>
375
372
  </div>
@@ -33,12 +33,12 @@ describe('hero block', () => {
33
33
  * ancestor — `Container` (the block's other wrapper) declares none of its own, so the block's
34
34
  * `@content:grid-cols-2`/`@tablet:flex-row`/etc. only ever take effect because `Section`'s own
35
35
  * root already carries `@container` (see `Section.vue`). Asserted directly so a future change
36
- * that swaps the root away from `Section` (or a `classes.root` override that drops the class)
36
+ * that swaps the root away from `Section` (or a root `class` that drops it)
37
37
  * fails loudly instead of silently keeping every block at its mobile layout at every width.
38
38
  */
39
39
  it('the block root carries @container, so its @tablet:/@content: classes have something to measure against', () => {
40
40
  const wrapper = mount(Block, mountOptions({ entry: { id: 'e1', data: mock } }));
41
- expect(wrapper.get('section').classes()).toContain('@container');
41
+ expect(wrapper.get('section').classes()).toContain('eldra:@container');
42
42
  });
43
43
 
44
44
  it.each(VARIANTS)(
@@ -60,8 +60,8 @@ describe('hero block', () => {
60
60
  mountOptions({ entry: { id: 'e1', data: { ...mock, variant: 'image-background' } } })
61
61
  );
62
62
  const section = wrapper.get('section');
63
- expect(section.classes()).toContain('bg-surface-strong');
64
- expect(section.classes()).not.toContain('text-primary-contrast');
63
+ expect(section.classes()).toContain('eldra:bg-surface-strong');
64
+ expect(section.classes()).not.toContain('eldra:text-primary-contrast');
65
65
  });
66
66
 
67
67
  it.each(VARIANTS)(
@@ -104,7 +104,7 @@ describe('hero block', () => {
104
104
  Block,
105
105
  mountOptions({ entry: { id: 'e1', data: { ...withImage, variant: 'image-right' } } })
106
106
  );
107
- expect(wrapper.get('[data-part="frame"]').classes()).toContain('rounded-xl');
107
+ expect(wrapper.get('[data-part="frame"]').classes()).toContain('eldra:rounded-xl');
108
108
  });
109
109
 
110
110
  /**
@@ -130,7 +130,9 @@ describe('hero block', () => {
130
130
  expect(frame.classes()).toEqual(expect.arrayContaining(['h-full', 'w-full']));
131
131
  expect(frame.attributes('style')).toContain('aspect-ratio: auto');
132
132
  const media = wrapper.get('[data-part="media"]');
133
- expect(media.classes()).toEqual(expect.arrayContaining(['object-cover', 'h-full', 'w-full']));
133
+ expect(media.classes()).toEqual(
134
+ expect.arrayContaining(['eldra:object-cover', 'eldra:h-full', 'eldra:w-full'])
135
+ );
134
136
  });
135
137
 
136
138
  it('renders no built-in CTAs — the seeded state carries no destination for either', () => {
@@ -206,7 +208,7 @@ describe('hero block', () => {
206
208
  expect(figure.attributes('aria-roledescription')).toBe('slide');
207
209
  expect(figure.attributes('aria-label')).toBe(`${index + 1} of ${withImage.slides.length}`);
208
210
  });
209
- expect(wrapper.findAll('[data-part="frame"]')[0]?.classes()).toContain('rounded-xl');
211
+ expect(wrapper.findAll('[data-part="frame"]')[0]?.classes()).toContain('eldra:rounded-xl');
210
212
  });
211
213
 
212
214
  it('wraps a slide with a same-site link in the router, and leaves an unlinked slide plain', () => {
Binary file
@@ -139,7 +139,7 @@ const linkRootClass = computed(() =>
139
139
  :as="linkAs"
140
140
  :underline="false"
141
141
  :aria-label="linkAriaLabel"
142
- :classes="{ root: linkRootClass }"
142
+ :class="linkRootClass"
143
143
  >
144
144
  <UiImage
145
145
  :src="data.image!.url"
@@ -172,7 +172,7 @@ const linkRootClass = computed(() =>
172
172
  :icon="PhotoIcon"
173
173
  :label="t('imageBlock.hintLabel')"
174
174
  :help="t('imageBlock.hintHelp')"
175
- :classes="{ root: 'aspect-[3/2] w-full rounded-none' }"
175
+ class="aspect-[3/2] w-full rounded-none"
176
176
  />
177
177
  <Container width="content" class="mt-3">
178
178
  <p class="text-muted text-body-sm">{{ t('imageBlock.captionHintLabel') }}</p>
@@ -188,7 +188,7 @@ const linkRootClass = computed(() =>
188
188
  :as="linkAs"
189
189
  :underline="false"
190
190
  :aria-label="linkAriaLabel"
191
- :classes="{ root: linkRootClass }"
191
+ :class="linkRootClass"
192
192
  >
193
193
  <UiImage
194
194
  :src="data.image!.url"
@@ -223,7 +223,7 @@ const linkRootClass = computed(() =>
223
223
  :icon="PhotoIcon"
224
224
  :label="t('imageBlock.hintLabel')"
225
225
  :help="t('imageBlock.hintHelp')"
226
- :classes="{ root: 'aspect-[3/2] w-full' }"
226
+ class="aspect-[3/2] w-full"
227
227
  />
228
228
  <p class="text-muted text-body-sm mt-3">{{ t('imageBlock.captionHintLabel') }}</p>
229
229
  </template>
@@ -144,7 +144,6 @@ describe('image block', () => {
144
144
  it('gives the inset ring class at width: full, and the outer ring elsewhere', () => {
145
145
  const full = mountImage({ ...linked, width: 'full' });
146
146
  expect(full.get('a').classes()).toContain('eldra-focus-inset');
147
- expect(full.get('a').classes()).not.toContain('eldra-focus');
148
147
 
149
148
  const content = mountImage({ ...linked, width: 'content' });
150
149
  expect(content.get('a').classes()).not.toContain('eldra-focus-inset');
@@ -159,26 +158,26 @@ describe('image block', () => {
159
158
  describe('width: full', () => {
160
159
  it('renders no Container around the image (edge to edge, no radius)', () => {
161
160
  const wrapper = mountImage({ ...withImage, width: 'full' });
162
- expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('rounded-lg');
163
- expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('rounded-xl');
161
+ expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('eldra:rounded-lg');
162
+ expect(wrapper.get('[data-part="frame"]').classes()).not.toContain('eldra:rounded-xl');
164
163
  });
165
164
 
166
165
  it('sits the caption inside a content-width grid, not against the screen edge', () => {
167
166
  const wrapper = mountImage({ ...withImage, width: 'full' });
168
- expect(wrapper.get('figcaption').classes()).toContain('eldra-container-content');
167
+ expect(wrapper.get('figcaption').classes()).toContain('eldra:eldra-container-content');
169
168
  });
170
169
  });
171
170
 
172
171
  it('applies the lg radius at every width for narrow', () => {
173
172
  const wrapper = mountImage({ ...withImage, width: 'narrow' });
174
- expect(wrapper.get('[data-part="frame"]').classes()).toContain('rounded-lg');
173
+ expect(wrapper.get('[data-part="frame"]').classes()).toContain('eldra:rounded-lg');
175
174
  });
176
175
 
177
176
  it('switches content/wide to the xl radius from 48rem', () => {
178
177
  for (const width of ['content', 'wide'] as const) {
179
178
  const wrapper = mountImage({ ...withImage, width });
180
179
  const frame = wrapper.get('[data-part="frame"]').classes();
181
- expect(frame).toContain('rounded-lg');
180
+ expect(frame).toContain('eldra:rounded-lg');
182
181
  expect(frame).toContain('@tablet:rounded-xl');
183
182
  }
184
183
  });
Binary file
@@ -120,7 +120,7 @@ describe('logo-cloud block', () => {
120
120
  for (const link of grid.findAll('a')) expect(link.classes()).toContain('h-full');
121
121
 
122
122
  const row = mountBlock({ ...mock, logos, variant: 'row' });
123
- for (const link of row.findAll('a')) expect(link.classes()).toContain('min-h-16');
123
+ for (const link of row.findAll('a')) expect(link.classes()).toContain('eldra:min-h-16');
124
124
  });
125
125
 
126
126
  it('renders a real <a> for every href — hover is never the only cue that a logo is a link', () => {