@eldrajs/theme-cli 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +6 -0
  3. package/dist/cli.js +8 -2
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.js +1 -1
  6. package/dist/{validate-FjQ-5_ne.js → validate-CC6Mp5i_.js} +2 -1
  7. package/package.json +3 -3
  8. package/template/.eldra/block-types.d.ts +1 -1
  9. package/template/.eldra/manifest.json +30 -2
  10. package/template/.eldra/previews.json +35 -35
  11. package/template/README.md +3 -1
  12. package/template/app/app.vue +16 -3
  13. package/template/app/assets/main.css +13 -15
  14. package/template/app/components/ui/UiImage.vue +29 -17
  15. package/template/app/components/ui/__tests__/UiImage.spec.ts +24 -15
  16. package/template/app/composables/useStorefront.ts +7 -2
  17. package/template/app/pages/[...slug].vue +1 -1
  18. package/template/app/plugins/eldra-storefront.ts +9 -0
  19. package/template/app/storefront/analytics.ts +15 -7
  20. package/template/app/storefront/cart.ts +228 -51
  21. package/template/app/storefront/commerce.ts +8 -2
  22. package/template/app/storefront/currency.ts +205 -0
  23. package/template/app/storefront/demo.ts +10 -2
  24. package/template/app/storefront/feedback.ts +2 -0
  25. package/template/app/storefront/gateway.ts +153 -35
  26. package/template/app/storefront/money.ts +6 -18
  27. package/template/app/storefront/structuredData.ts +16 -5
  28. package/template/app/storefront/toProductCard.ts +14 -14
  29. package/template/app/storefront/types.ts +13 -0
  30. package/template/app/storefront/volatile.ts +4 -0
  31. package/template/app/utils/seoInput.ts +4 -3
  32. package/template/blocks/announcement-bar/Block.vue +3 -2
  33. package/template/blocks/announcement-bar/__tests__/Block.spec.ts +1 -1
  34. package/template/blocks/announcement-bar/preview.png +0 -0
  35. package/template/blocks/article/Block.vue +3 -4
  36. package/template/blocks/article/preview.png +0 -0
  37. package/template/blocks/article-list/Block.vue +18 -9
  38. package/template/blocks/article-list/preview.png +0 -0
  39. package/template/blocks/breadcrumbs/Block.vue +1 -1
  40. package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +9 -9
  41. package/template/blocks/breadcrumbs/preview.png +0 -0
  42. package/template/blocks/cart/Block.vue +42 -23
  43. package/template/blocks/cart/__tests__/Block.spec.ts +2 -3
  44. package/template/blocks/cart/__tests__/loadFailed.spec.ts +135 -0
  45. package/template/blocks/cart/__tests__/notSold.spec.ts +109 -0
  46. package/template/blocks/cart/parts/CartLines.vue +16 -3
  47. package/template/blocks/cart/parts/CheckoutButton.vue +45 -0
  48. package/template/blocks/cart/parts/LoadFailed.vue +37 -0
  49. package/template/blocks/cart/parts/NotSoldNotice.vue +69 -0
  50. package/template/blocks/cart/parts/ShippingBar.vue +1 -1
  51. package/template/blocks/cart/parts/Summary.vue +14 -30
  52. package/template/blocks/cart/parts/notSold.ts +19 -0
  53. package/template/blocks/cart/preview.png +0 -0
  54. package/template/blocks/collection-grid/Block.vue +26 -16
  55. package/template/blocks/collection-grid/__tests__/Block.spec.ts +26 -14
  56. package/template/blocks/collection-grid/preview.png +0 -0
  57. package/template/blocks/collection-header/Block.vue +5 -5
  58. package/template/blocks/collection-header/preview.png +0 -0
  59. package/template/blocks/contact/Block.vue +1 -1
  60. package/template/blocks/contact/__tests__/Block.spec.ts +2 -2
  61. package/template/blocks/contact/preview.png +0 -0
  62. package/template/blocks/cta/Block.vue +16 -18
  63. package/template/blocks/cta/__tests__/Block.spec.ts +8 -12
  64. package/template/blocks/cta/preview.png +0 -0
  65. package/template/blocks/faq/Block.vue +3 -13
  66. package/template/blocks/faq/__tests__/Block.spec.ts +2 -2
  67. package/template/blocks/faq/preview.png +0 -0
  68. package/template/blocks/feature-grid/Block.vue +1 -1
  69. package/template/blocks/feature-grid/__tests__/Block.spec.ts +1 -1
  70. package/template/blocks/feature-grid/preview.png +0 -0
  71. package/template/blocks/footer/Block.vue +33 -55
  72. package/template/blocks/footer/__tests__/Block.spec.ts +5 -5
  73. package/template/blocks/footer/preview.png +0 -0
  74. package/template/blocks/form/Block.vue +1 -1
  75. package/template/blocks/form/preview.png +0 -0
  76. package/template/blocks/gallery/__tests__/Block.spec.ts +1 -1
  77. package/template/blocks/gallery/preview.png +0 -0
  78. package/template/blocks/hero/Block.vue +8 -11
  79. package/template/blocks/hero/__tests__/Block.spec.ts +9 -7
  80. package/template/blocks/hero/preview.png +0 -0
  81. package/template/blocks/image/Block.vue +4 -4
  82. package/template/blocks/image/__tests__/Block.spec.ts +5 -6
  83. package/template/blocks/image/preview.png +0 -0
  84. package/template/blocks/logo-cloud/__tests__/Block.spec.ts +1 -1
  85. package/template/blocks/logo-cloud/preview.png +0 -0
  86. package/template/blocks/navigation/Block.vue +55 -29
  87. package/template/blocks/navigation/__tests__/Block.spec.ts +22 -20
  88. package/template/blocks/navigation/preview.png +0 -0
  89. package/template/blocks/newsletter/__tests__/Block.spec.ts +1 -1
  90. package/template/blocks/newsletter/preview.png +0 -0
  91. package/template/blocks/order-status/Block.vue +23 -15
  92. package/template/blocks/order-status/__tests__/Block.spec.ts +1 -2
  93. package/template/blocks/order-status/preview.png +0 -0
  94. package/template/blocks/pricing-table/__tests__/Block.spec.ts +1 -1
  95. package/template/blocks/pricing-table/preview.png +0 -0
  96. package/template/blocks/product-carousel/Block.vue +11 -8
  97. package/template/blocks/product-carousel/__tests__/Block.spec.ts +26 -8
  98. package/template/blocks/product-carousel/preview.png +0 -0
  99. package/template/blocks/product-detail/Block.vue +54 -18
  100. package/template/blocks/product-detail/__tests__/Block.spec.ts +79 -2
  101. package/template/blocks/product-detail/parts/Gallery.vue +1 -1
  102. package/template/blocks/product-detail/preview.png +0 -0
  103. package/template/blocks/quote/Block.vue +1 -1
  104. package/template/blocks/quote/__tests__/Block.spec.ts +7 -4
  105. package/template/blocks/quote/preview.png +0 -0
  106. package/template/blocks/rich-text/preview.png +0 -0
  107. package/template/blocks/search/Block.vue +10 -4
  108. package/template/blocks/search/PopularChips.vue +1 -1
  109. package/template/blocks/search/TypeSection.vue +8 -2
  110. package/template/blocks/search/preview.png +0 -0
  111. package/template/blocks/search/results.ts +5 -2
  112. package/template/blocks/split-content/Block.vue +2 -3
  113. package/template/blocks/split-content/__tests__/Block.spec.ts +2 -2
  114. package/template/blocks/split-content/preview.png +0 -0
  115. package/template/blocks/stats/__tests__/Block.spec.ts +1 -1
  116. package/template/blocks/stats/preview.png +0 -0
  117. package/template/blocks/tabs/Block.vue +4 -5
  118. package/template/blocks/tabs/__tests__/Block.spec.ts +2 -2
  119. package/template/blocks/tabs/preview.png +0 -0
  120. package/template/blocks/team/preview.png +0 -0
  121. package/template/blocks/testimonials/Block.vue +10 -9
  122. package/template/blocks/testimonials/__tests__/Block.spec.ts +1 -1
  123. package/template/blocks/testimonials/preview.png +0 -0
  124. package/template/blocks/timeline/__tests__/Block.spec.ts +2 -2
  125. package/template/blocks/timeline/preview.png +0 -0
  126. package/template/blocks/trust-strip/Block.vue +1 -1
  127. package/template/blocks/trust-strip/__tests__/Block.spec.ts +1 -1
  128. package/template/blocks/trust-strip/preview.png +0 -0
  129. package/template/blocks/video-embed/Block.vue +3 -3
  130. package/template/blocks/video-embed/__tests__/Block.spec.ts +1 -1
  131. package/template/blocks/video-embed/preview.png +0 -0
  132. package/template/blocks/wishlist/Block.vue +6 -2
  133. package/template/blocks/wishlist/preview.png +0 -0
  134. package/template/i18n/en-US.json +19 -3
  135. package/template/i18n/is-IS.json +19 -3
  136. package/template/nuxt.config.ts +5 -4
  137. package/template/package.json +1 -0
  138. package/template/stories/pages/article.stories.ts +2 -3
  139. package/template/stories/pages/cart.stories.ts +2 -3
  140. package/template/stories/pages/category.stories.ts +2 -3
  141. package/template/stories/pages/collection.stories.ts +2 -3
  142. package/template/stories/pages/home.stories.ts +2 -3
  143. package/template/stories/pages/product.stories.ts +3 -4
  144. package/template/stories/pages/products.stories.ts +2 -3
  145. package/template/stories/pages/search.stories.ts +2 -3
  146. package/template/stories/pages/wishlist.stories.ts +2 -3
  147. package/template/test/carouselKeyboard.spec.ts +2 -2
  148. package/template/test/carouselRing.browser.spec.ts +2 -2
  149. package/template/test/carouselSlideWidth.browser.spec.ts +9 -9
  150. package/template/test/currencyPicker.spec.ts +66 -0
  151. package/template/test/eldraIcon.spec.ts +1 -1
  152. package/template/test/mainCss.spec.ts +7 -0
  153. package/template/test/pages/article.spec.ts +5 -5
  154. package/template/test/pages/collection.spec.ts +5 -5
  155. package/template/test/pages/hydration.spec.ts +10 -10
  156. package/template/test/prerenderRefresh.browser.spec.ts +1 -1
  157. package/template/test/seoInput.spec.ts +22 -0
  158. package/template/test/storefront/analytics.spec.ts +15 -0
  159. package/template/test/storefront/cart.spec.ts +4 -4
  160. package/template/test/storefront/currency.spec.ts +549 -0
  161. package/template/test/storefront/currencyStore.spec.ts +845 -0
  162. package/template/test/storefront/gateway.spec.ts +22 -0
  163. package/template/test/storefront/money.spec.ts +2 -8
  164. package/template/test/storefront/structuredData.spec.ts +45 -0
  165. package/template/test/storefront/toProductCard.spec.ts +1 -1
  166. package/template/test/storefront/volatile.spec.ts +11 -0
  167. 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
 
@@ -45,17 +45,7 @@
45
45
  * or a click (its own contract; arrow keys alone only move the active option), so nothing extra is
46
46
  * needed here to satisfy "prices reload only after Enter or a click" (3.2.2).
47
47
  *
48
- * The currency selector is different: the spec was written for a multi-currency store, but the
49
- * platform supports exactly one currency per store today. So its options are derived from the
50
- * store (`useMoney().currency`, `app/storefront/money.ts`), not from a constant list, and there is
51
- * at most one of them — `currencyLabel()` names it "ISK kr." style (code + the sign
52
- * `@eldrajs/ui` writes the store's prices with in the content locale, falling back to the code
53
- * alone when the locale has no sign distinct from it). With exactly one option
54
- * there is nothing to select, so it renders as plain text with the same leading icon and a visually
55
- * hidden "Currency" label, not a `Select` — a native-looking control a visitor could try to open
56
- * with nothing inside it would be worse than no control at all. With no currency published, the
57
- * slot renders nothing. The `Select` branch stays for the day the derived list carries two or more
58
- * entries; which branch renders is driven by that list's length, not by a separate flag.
48
+ * The currency selector drives the same choice as the header's picker; one currency is plain text.
59
49
  *
60
50
  * The newsletter zone posts through `useStorefront().forms.submit('newsletter', …)` — the platform's
61
51
  * seeded `newsletter` form, the same one the newsletter block defaults to. Email format is validated
@@ -81,6 +71,7 @@ import type { ResolvedLink } from '@eldrajs/theme-vue';
81
71
  import {
82
72
  Button,
83
73
  Container,
74
+ CurrencyPicker,
84
75
  EditorPlaceholder,
85
76
  FieldWrapper,
86
77
  FormLayout,
@@ -256,21 +247,14 @@ const showLocale = computed(
256
247
  );
257
248
  const showCurrency = computed(() => data.value.showCurrency ?? true);
258
249
 
259
- /**
260
- * The currency selector's option list, derived from the store rather than the spec's hard-coded
261
- * USD/CAD/EUR demo list: the platform supports exactly one currency per store today, so this is
262
- * either empty (the store publishes none) or a single entry — the store's currency, named "ISK
263
- * kr." style by `currencyLabel()` (code + the same sign every price on the page is written
264
- * with). Kept as a list, not a single value, so the day the platform supports more than one
265
- * currency, this grows to match and the template's `Select` branch (below) is already there.
266
- */
267
- const currencyOptions = computed<SelectOption[]>(() => {
268
- const code = money.currency.value;
269
- return code === undefined ? [] : [{ value: code, label: currencyLabel(code, uiLocale.value) }];
250
+ const currencyStore = storefront.currency;
251
+ /** The currencies the store offers, or the one `Price` formats in. */
252
+ const currencyCodes = computed<readonly string[]>(() => {
253
+ const offered = currencyStore.offered.value;
254
+ const store = money.currency.value;
255
+ return offered.length > 0 ? offered : store === undefined ? [] : [store];
270
256
  });
271
-
272
- /** Whether the currency slot renders anything: `showCurrency` on *and* a currency to show it. */
273
- const showCurrencySelector = computed(() => showCurrency.value && currencyOptions.value.length > 0);
257
+ const showCurrencySelector = computed(() => showCurrency.value && currencyCodes.value.length > 0);
274
258
 
275
259
  const hasSelectors = computed(() => showLocale.value || showCurrencySelector.value);
276
260
 
@@ -297,8 +281,6 @@ const locale = computed<string>({
297
281
  if (value !== '' && value !== activeLocale.active) activeLocale.select(value);
298
282
  },
299
283
  });
300
- /** Only reached once `currencyOptions` carries two or more entries — see the template. */
301
- const currency = ref<string>(currencyOptions.value[0]?.value ?? '');
302
284
 
303
285
  /* ---------------------------------------------------------------------- */
304
286
  /* Newsletter */
@@ -417,7 +399,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
417
399
  spacing="none"
418
400
  :labelled-by="variant === 'default' ? headingId : undefined"
419
401
  :aria-label="variant === 'minimal' ? t('footer.title') : undefined"
420
- :classes="{ root: paddingClass }"
402
+ :class="paddingClass"
421
403
  >
422
404
  <Container width="wide">
423
405
  <VisuallyHidden v-if="variant === 'default'" :id="headingId" as="h2">{{
@@ -435,8 +417,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
435
417
  :as="EldraRouterLink"
436
418
  variant="standalone"
437
419
  :underline="false"
420
+ class="inline-flex items-center hover:no-underline active:no-underline"
438
421
  :classes="{
439
- root: 'inline-flex items-center hover:no-underline active:no-underline',
440
422
  label: 'font-heading text-text text-xl leading-[1.2] font-bold tracking-[-0.015em]',
441
423
  }"
442
424
  >
@@ -470,7 +452,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
470
452
  target="_blank"
471
453
  rel="noopener"
472
454
  :label="socialLinkName(social.network)"
473
- :classes="{ container: 'size-11' }"
455
+ class="size-11"
474
456
  >
475
457
  <template #leadingIcon>
476
458
  <EldraIcon :name="social.icon" size="md" />
@@ -502,7 +484,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
502
484
  :as="link.as"
503
485
  tone="muted"
504
486
  :underline="false"
505
- :classes="{ root: 'inline-flex min-h-9 items-center text-base' }"
487
+ class="inline-flex min-h-9 items-center text-base"
506
488
  >{{ link.label }}</Link
507
489
  >
508
490
  <span v-else class="text-muted inline-flex min-h-9 items-center text-base">{{
@@ -541,7 +523,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
541
523
  <FieldWrapper
542
524
  :label="emailLabel"
543
525
  :error="emailError ?? undefined"
544
- :classes="{ root: 'block w-full' }"
526
+ class="block w-full"
545
527
  >
546
528
  <Input
547
529
  v-model="email"
@@ -559,6 +541,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
559
541
  <Button
560
542
  type="submit"
561
543
  variant="primary"
544
+ block
562
545
  :label="t('footer.subscribing')"
563
546
  :aria-describedby="consentSentence ? consentSentenceId : undefined"
564
547
  >{{ t('footer.subscribe') }}</Button
@@ -589,8 +572,8 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
589
572
  :as="EldraRouterLink"
590
573
  variant="standalone"
591
574
  :underline="false"
575
+ class="inline-flex items-center hover:no-underline active:no-underline"
592
576
  :classes="{
593
- root: 'inline-flex items-center hover:no-underline active:no-underline',
594
577
  label: 'font-heading text-text text-xl leading-[1.2] font-bold tracking-[-0.015em]',
595
578
  }"
596
579
  >
@@ -614,7 +597,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
614
597
  :as="link.as"
615
598
  tone="muted"
616
599
  :underline="false"
617
- :classes="{ root: 'inline-flex min-h-9 items-center text-base' }"
600
+ class="inline-flex min-h-9 items-center text-base"
618
601
  >{{ link.label }}</Link
619
602
  >
620
603
  <span v-else class="text-muted inline-flex min-h-9 items-center text-base">{{
@@ -634,7 +617,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
634
617
  target="_blank"
635
618
  rel="noopener"
636
619
  :label="socialLinkName(social.network)"
637
- :classes="{ container: 'size-11' }"
620
+ class="size-11"
638
621
  >
639
622
  <template #leadingIcon>
640
623
  <EldraIcon :name="social.icon" size="md" />
@@ -658,7 +641,7 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
658
641
  :href="link.href"
659
642
  :as="link.as"
660
643
  tone="muted"
661
- :classes="{ root: 'inline-flex min-h-6 items-center' }"
644
+ class="inline-flex min-h-6 items-center"
662
645
  >{{ link.label }}</Link
663
646
  >
664
647
  <span v-else class="inline-flex min-h-6 items-center">{{ link.label }}</span>
@@ -670,38 +653,33 @@ async function onNewsletterSubmit(payload: FormLayoutSubmitPayload): Promise<voi
670
653
  <FieldWrapper
671
654
  v-if="showLocale"
672
655
  :label="t('footer.localeLabel')"
673
- :classes="{ root: 'w-full @tablet:w-auto', label: 'sr-only' }"
656
+ class="@tablet:w-auto w-full"
657
+ :classes="{ label: 'sr-only' }"
674
658
  >
675
659
  <!-- Not `searchable`: a store has a handful of content locales, and a search field
676
660
  over three options is one more thing between a visitor and their language. -->
677
661
  <Select v-model="locale" :options="localeOptions" placement="above" />
678
662
  </FieldWrapper>
679
- <!--
680
- With exactly one currency there is nothing to select — see the file doc comment — so
681
- this renders the currency as plain text (same leading icon, a visually hidden
682
- "Currency" label) rather than a `Select` a visitor could open onto an empty list. The
683
- `Select` branch stays for the day `currencyOptions` carries two or more entries.
684
- -->
663
+ <!-- One currency is plain text: there is nothing to pick. -->
685
664
  <p
686
- v-if="showCurrencySelector && currencyOptions.length === 1"
665
+ v-if="showCurrencySelector && currencyCodes.length === 1"
687
666
  class="text-text @tablet:w-auto flex w-full items-center gap-1.5 text-[0.8125rem] font-medium"
688
667
  >
689
668
  <EldraIcon name="credit-card" size="sm" class="text-muted shrink-0" />
690
669
  <VisuallyHidden>{{ t('footer.currencyLabel') }}</VisuallyHidden>
691
- {{ currencyOptions[0]!.label }}
670
+ {{ currencyLabel(currencyCodes[0]!, uiLocale) }}
692
671
  </p>
693
- <FieldWrapper
672
+ <CurrencyPicker
694
673
  v-else-if="showCurrencySelector"
674
+ :currencies="currencyCodes"
675
+ :model-value="currencyStore.active.value"
676
+ :busy="currencyStore.busy.value"
695
677
  :label="t('footer.currencyLabel')"
696
- :classes="{ root: 'w-full @tablet:w-auto', label: 'sr-only' }"
697
- >
698
- <Select
699
- v-model="currency"
700
- :options="currencyOptions"
701
- placement="above"
702
- :searchable="false"
703
- />
704
- </FieldWrapper>
678
+ size="md"
679
+ placement="above"
680
+ class="@tablet:w-auto w-full"
681
+ @update:model-value="currencyStore.choose"
682
+ />
705
683
  </div>
706
684
  </div>
707
685
  </Container>
@@ -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