@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
@@ -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', () => {
@@ -6,6 +6,7 @@ import {
6
6
  Badge,
7
7
  Button,
8
8
  Container,
9
+ CurrencyPicker,
9
10
  EditorPlaceholder,
10
11
  Link,
11
12
  NavMenu,
@@ -155,7 +156,10 @@ function toSearchResults(response: StorefrontSearchResponse | null): SearchResul
155
156
  // Optional on `SearchResultItem`, and `null` on a product the storefront could not price: the
156
157
  // row keeps the product and drops the price rather than printing the store's own "$0.00"
157
158
  // (`StorefrontSearchProduct`).
158
- price: product.price === null ? undefined : money.format(product.price.amount),
159
+ price:
160
+ product.price === null || product.price.soldInCurrency === false
161
+ ? undefined
162
+ : money.format(product.price.amount, product.price.currency),
159
163
  image: product.featuredImage?.src,
160
164
  imageAlt: product.featuredImage?.alt,
161
165
  }));
@@ -231,10 +235,8 @@ function openSearch(): void {
231
235
  * rather than two copies that could drift.
232
236
  *
233
237
  * `Badge`'s own root carries `min-h-6` and `text-badge` (1.5rem min height, the package's own
234
- * type-style utility); both are stock Tailwind class groups (`min-h`, `font-size`) that
235
- * `tailwind-merge` already recognises, so passing this through `classes.root` replaces them
236
- * outright — the later class in the merged string always wins a group, with no `!important` and
237
- * no need for a `size` prop (`Badge` has none).
238
+ * type-style utility); passed as the Badge's `class`, these app utilities outrank its `eldra:`
239
+ * classes by cascade layer, with no `!important` and no need for a `size` prop (`Badge` has none).
238
240
  */
239
241
  const COUNT_PILL_CLASSES =
240
242
  'pointer-events-none absolute -top-0.5 -right-0.5 min-h-3.5 min-w-3.5 h-3.5 justify-center ' +
@@ -268,6 +270,8 @@ const cartHref = computed(() => (cartDrawerAvailable.value ? undefined : '/cart'
268
270
  const cartPopupType = computed(() => (cartDrawerAvailable.value ? 'dialog' : undefined));
269
271
  const cartAccessibleName = computed(() => {
270
272
  const count = cartCount.value;
273
+ // A cart that could not be read has no count to say.
274
+ if (mounted.value && storefront.cart.loadFailed.value) return t('header.cart');
271
275
  if (count === 0) return t('header.cartEmpty');
272
276
  if (count === 1) return t('header.cartOne');
273
277
  return t('header.cartMany', { count });
@@ -549,13 +553,8 @@ const barSurfaceStyle = { [HEADER_SURFACE_VAR]: 'var(--color-background)' };
549
553
 
550
554
  /**
551
555
  * `@eldrajs/ui`'s `classes` prop takes a plain string per part (`Partial<Record<Part, string>>`),
552
- * never an array — `Section`'s own `partClass`/`cx` treats a non-string, non-falsy value as the
553
- * `Record<string, boolean>` branch of its `ClassValue` union, which for a plain array reads its
554
- * numeric indices as "class names" and their truthy values as "on": an empty-string entry at index
555
- * 3 (falsy) got dropped and the three truthy entries before it came back out as the class string
556
- * `"0 1 2"` — every real utility class silently lost. Every conditional class list handed to a
557
- * `classes` prop in this file is therefore joined into one string with `[...].filter(Boolean).join(' ')`,
558
- * never left as an array.
556
+ * never an array, so every conditional class list handed to a `classes` prop in this file is
557
+ * joined into one string with `[...].filter(Boolean).join(' ')`.
559
558
  */
560
559
  /**
561
560
  * Spec "Header" → Container/Section line: "Section background default `background` … Section
@@ -565,7 +564,7 @@ const barSurfaceStyle = { [HEADER_SURFACE_VAR]: 'var(--color-background)' };
565
564
  * top padding, and the header must never trigger that rule against the block that follows it (a
566
565
  * Hero, most often) — the header is fixed chrome that always sits at the page's own ground, not a
567
566
  * coloured band the padding-collapse rule is meant to read as one continuous band with its
568
- * neighbour. It also never needs `Section`'s `group/section` colour-inversion machinery: `background`
567
+ * neighbour. It also never needs `Section`'s `data-section` colour-inversion machinery: `background`
569
568
  * is always `none` here, and transparent-over-hero mode is handled entirely by `barRootClasses`
570
569
  * above, not by `Section`'s `primary`/`accent` invert. `@container` is kept directly on this root so
571
570
  * `Container` and every `@content:`/`@tablet:` variant below still measure the header's own width.
@@ -620,6 +619,12 @@ const hairlineClass = computed(() =>
620
619
 
621
620
  /** The drawer holds the links and the call to action; with neither there is no Menu button either. */
622
621
  const drawerHasContent = computed(() => links.value.length > 0 || hasCta.value);
622
+ /** More than one currency to shop in. On a phone the picker sits in the menu when there is one. */
623
+ const currency = storefront.currency;
624
+ const hasCurrencies = computed(() => currency.offered.value.length > 1);
625
+ const barPickerClass = computed(() =>
626
+ drawerHasContent.value ? '@content:block ml-1 hidden' : 'ml-1'
627
+ );
623
628
  const showLinksPlaceholder = computed(
624
629
  () => isEditing.value && variant.value !== 'minimal' && links.value.length === 0
625
630
  );
@@ -652,8 +657,6 @@ const actionsPositionClass = computed(() =>
652
657
 
653
658
  /** What this header draws differently from `NavMenu`'s own look, part by part. */
654
659
  const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
655
- // `contents`: the bar and the Menu button become cells of the grid, which then positions panels.
656
- root: 'static contents',
657
660
  nav: `self-stretch ${linksPositionClass.value}`,
658
661
  list: variant.value === 'centered' ? 'h-full flex-nowrap justify-center' : 'h-full flex-nowrap',
659
662
  link: 'text-sm',
@@ -698,9 +701,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
698
701
  variant="standalone"
699
702
  :underline="false"
700
703
  data-eldra-header-focus
701
- :classes="{
702
- root: `flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1 font-heading text-lg font-bold tracking-tight ${brandPositionClass}`,
703
- }"
704
+ :class="`font-heading flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1 text-lg font-bold tracking-tight ${brandPositionClass}`"
704
705
  >
705
706
  <img
706
707
  v-if="brandLogoUrl"
@@ -730,6 +731,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
730
731
  open-on-hover
731
732
  :link-as="MenuLink"
732
733
  :messages="navMenuMessages"
734
+ class="static contents"
733
735
  :classes="navMenuClasses"
734
736
  >
735
737
  <template #toggle>
@@ -745,13 +747,30 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
745
747
  arrow
746
748
  data-eldra-mega-view-all
747
749
  :aria-label="t('header.viewAllOf', { label: item.label ?? '' })"
748
- :classes="{ root: 'text-sm' }"
750
+ class="text-sm"
749
751
  >
750
752
  {{ t('header.viewAll') }}
751
753
  </Link>
752
754
  </template>
753
- <template v-if="hasCta" #drawerFooter="{ close }">
754
- <Button variant="primary" block :href="ctaHref" :as="ctaLinkAs" @click="close">
755
+ <template v-if="hasCta || hasCurrencies" #drawerFooter="{ close }">
756
+ <CurrencyPicker
757
+ :currencies="currency.offered.value"
758
+ :model-value="currency.active.value"
759
+ :busy="currency.busy.value"
760
+ show-label
761
+ size="md"
762
+ placement="above"
763
+ class="w-full"
764
+ @update:model-value="currency.choose"
765
+ />
766
+ <Button
767
+ v-if="hasCta"
768
+ variant="primary"
769
+ block
770
+ :href="ctaHref"
771
+ :as="ctaLinkAs"
772
+ @click="close"
773
+ >
755
774
  {{ ctaLabel }}
756
775
  </Button>
757
776
  </template>
@@ -760,7 +779,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
760
779
  v-if="showLinksPlaceholder"
761
780
  inline
762
781
  :label="t('editor.addLink')"
763
- :classes="{ root: `hidden @content:flex ${linksPositionClass}` }"
782
+ :class="`@content:flex hidden ${linksPositionClass}`"
764
783
  />
765
784
 
766
785
  <!-- `justify-end` matters in exactly one case and is inert in every other: with no Menu
@@ -788,7 +807,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
788
807
  variant="outline"
789
808
  size="sm"
790
809
  aria-haspopup="dialog"
791
- :classes="{ container: 'hidden rounded-full @content:inline-flex' }"
810
+ class="@content:inline-flex hidden rounded-full"
792
811
  @click="openSearch"
793
812
  >
794
813
  {{ t('header.searchField') }}
@@ -800,7 +819,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
800
819
  icon-only
801
820
  :label="t('header.search')"
802
821
  aria-haspopup="dialog"
803
- :classes="{ container: '@content:hidden' }"
822
+ class="@content:hidden"
804
823
  @click="openSearch"
805
824
  >
806
825
  <template #leadingIcon>
@@ -817,7 +836,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
817
836
  :label="t('header.searchField')"
818
837
  :results="searchResults"
819
838
  :loading="searchLoading"
820
- :classes="{ root: 'hidden w-64 @content:block' }"
839
+ class="@content:block hidden w-64"
821
840
  />
822
841
  <Button
823
842
  variant="ghost"
@@ -825,7 +844,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
825
844
  icon-only
826
845
  :label="t('header.search')"
827
846
  aria-haspopup="dialog"
828
- :classes="{ container: '@content:hidden' }"
847
+ class="@content:hidden"
829
848
  @click="openSearch"
830
849
  >
831
850
  <template #leadingIcon>
@@ -862,7 +881,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
862
881
  tone="primary"
863
882
  pill
864
883
  :label="wishlistBadgeLabel"
865
- :classes="{ root: COUNT_PILL_CLASSES }"
884
+ :class="COUNT_PILL_CLASSES"
866
885
  />
867
886
  </span>
868
887
 
@@ -887,20 +906,27 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
887
906
  tone="primary"
888
907
  pill
889
908
  :label="cartBadgeLabel"
890
- :classes="{ root: COUNT_PILL_CLASSES }"
909
+ :class="COUNT_PILL_CLASSES"
891
910
  />
892
911
  </span>
893
912
 
894
913
  <!-- Spec Header -> Layout, From 64rem: the call to action sits 0.75rem after the cart.
895
914
  0.25rem of that is already the actions row's own gap-1; @content:ml-2 (0.5rem) makes
896
915
  up the rest, so it reads as its own button rather than a fourth icon in the row. -->
916
+ <CurrencyPicker
917
+ :currencies="currency.offered.value"
918
+ :model-value="currency.active.value"
919
+ :busy="currency.busy.value"
920
+ :class="barPickerClass"
921
+ @update:model-value="currency.choose"
922
+ />
897
923
  <Button
898
924
  v-if="hasCta && variant !== 'minimal'"
899
925
  variant="primary"
900
926
  size="sm"
901
927
  :href="ctaHref"
902
928
  :as="ctaLinkAs"
903
- :classes="{ container: 'hidden @content:inline-flex @content:ml-2' }"
929
+ class="@content:inline-flex @content:ml-2 hidden"
904
930
  >
905
931
  {{ ctaLabel }}
906
932
  </Button>
@@ -1412,12 +1412,14 @@ describe('header block (navigation apiId)', () => {
1412
1412
  });
1413
1413
  const trigger = wrapper.findAll('button').find((b) => b.text().includes('Workshop'))!;
1414
1414
  // Ungrouped children still make a sheet across the header, not a dropdown under the trigger.
1415
- expect(wrapper.get(`#${trigger.attributes('aria-controls')}`).classes()).toContain('inset-x-0');
1415
+ expect(wrapper.get(`#${trigger.attributes('aria-controls')}`).classes()).toContain(
1416
+ 'eldra:inset-x-0'
1417
+ );
1416
1418
  const footer = wrapper.get(`#${trigger.attributes('aria-controls')} [data-part="footer"]`);
1417
1419
  // `:empty` as a browser reads it (jsdom counts Vue's empty anchors; `@eldrajs/ui`'s browser spec proves it).
1418
1420
  expect(footer.element.children).toHaveLength(0);
1419
1421
  expect(footer.element.textContent).toBe('');
1420
- expect(footer.classes()).toContain('empty:hidden');
1422
+ expect(footer.classes()).toContain('eldra:empty:hidden');
1421
1423
  });
1422
1424
 
1423
1425
  it('is axe-clean in every variant with the drawer open, and with a mega-menu open where the bar has one', async () => {
@@ -1447,7 +1449,7 @@ describe('header block (navigation apiId)', () => {
1447
1449
  expect(toggle.classes().some((token) => token.endsWith(':hidden'))).toBe(false);
1448
1450
  // The default variant hides it once the bar has room for its links.
1449
1451
  const bar = mountBlock(resolved.data).get('[data-part="toggle"]');
1450
- expect(bar.classes()).toContain('@content:hidden');
1452
+ expect(bar.classes()).toContain('eldra:@content:hidden');
1451
1453
  });
1452
1454
 
1453
1455
  it('renders 8 links with no overflow markup errors', async () => {
@@ -1486,33 +1488,34 @@ describe('header block (navigation apiId)', () => {
1486
1488
  // The bar's grid is the panel's positioning box; the menu's own root takes no box at all.
1487
1489
  expect(wrapper.get('[data-eldra-header-bar]').classes()).toContain('relative');
1488
1490
  const root = [...menuRoot(wrapper).classList];
1491
+ expect(root).toContain('static');
1489
1492
  expect(root).toContain('contents');
1490
- expect(root).not.toContain('relative');
1491
1493
  // …and no row of the bar may reclaim it, or the panel would hang under its own item again.
1492
1494
  for (const row of wrapper.findAll('[data-part="item"]')) {
1493
- expect(row.classes()).not.toContain('relative');
1495
+ expect(row.classes()).not.toContain('eldra:relative');
1494
1496
  }
1495
1497
 
1496
1498
  const knitwear = wrapper.findAll('button').find((b) => b.text().includes('Knitwear'))!;
1497
1499
  await knitwear.trigger('click');
1498
1500
  const panel = wrapper.get(`#${knitwear.attributes('aria-controls')}`);
1499
1501
  // Flush under the bar: no offset of its own.
1500
- for (const token of ['absolute', 'top-full', 'inset-x-0', 'pt-0']) {
1502
+ for (const token of ['eldra:absolute', 'eldra:top-full', 'eldra:inset-x-0', 'pt-0']) {
1501
1503
  expect(panel.classes()).toContain(token);
1502
1504
  }
1503
1505
  // A width of its own is exactly what the old panel had, and what made it feel arbitrary.
1504
- expect(panel.classes()).not.toContain('w-screen');
1505
- expect(panel.classes().some((token) => token.startsWith('max-w-'))).toBe(false);
1506
+ const panelTokens = panel.classes().map((token) => token.replace(/^eldra:/, ''));
1507
+ expect(panelTokens).not.toContain('w-screen');
1508
+ expect(panelTokens.some((token) => token.startsWith('max-w-'))).toBe(false);
1506
1509
  // The bar's own bottom border is the sheet's top edge, so only the other three sides and corners are drawn.
1507
1510
  const sheet = panel.get('[data-part="content"]').classes();
1508
1511
  for (const token of [
1509
- 'border',
1512
+ 'eldra:border',
1510
1513
  'border-t-0',
1511
- 'border-border',
1514
+ 'eldra:border-border',
1512
1515
  'rounded-none',
1513
1516
  'rounded-b-lg',
1514
1517
  'shadow-(--eldra-shadow-float)',
1515
- 'p-6',
1518
+ 'eldra:p-6',
1516
1519
  '@wide:p-8',
1517
1520
  ]) {
1518
1521
  expect(sheet).toContain(token);
@@ -1522,9 +1525,10 @@ describe('header block (navigation apiId)', () => {
1522
1525
  // the panel's own edges — 24px, 32px once the container passes `wide`. The browser case
1523
1526
  // measures what this produces; here it is only the arrangement.
1524
1527
  const columns = panel.get('[data-part="columns"]').classes();
1525
- for (const token of ['grid', 'grid-cols-12', 'gap-6']) {
1528
+ for (const token of ['eldra:grid', 'grid-cols-12', 'gap-6']) {
1526
1529
  expect(columns).toContain(token);
1527
1530
  }
1531
+ expect(sheet).not.toContain('eldra:py-8');
1528
1532
  expect(sheet).not.toContain('py-8');
1529
1533
  wrapper.unmount();
1530
1534
  });
@@ -1557,7 +1561,7 @@ describe('header block (navigation apiId)', () => {
1557
1561
  expect(viewAll.attributes('aria-label')).toBe('View all Knitwear');
1558
1562
  // Right-aligned under a rule across the content width: it follows the columns, outside their grid.
1559
1563
  const row = viewAll.element.parentElement!;
1560
- for (const token of ['justify-end', 'border-t', 'border-border', 'pt-4']) {
1564
+ for (const token of ['justify-end', 'eldra:border-t', 'eldra:border-border', 'eldra:pt-4']) {
1561
1565
  expect([...row.classList]).toContain(token);
1562
1566
  }
1563
1567
  expect(row.previousElementSibling?.getAttribute('data-part')).toBe('columns');
@@ -1583,8 +1587,6 @@ describe('header block (navigation apiId)', () => {
1583
1587
  await knitwear.trigger('click');
1584
1588
  const sheet = wrapper.get(`#${knitwear.attributes('aria-controls')} [data-part="content"]`);
1585
1589
  expect(sheet.classes()).toContain('bg-(--eldra-header-surface)');
1586
- // And no ground token of its own left behind to drift away from the bar's.
1587
- expect(sheet.classes()).not.toContain('bg-background');
1588
1590
  wrapper.unmount();
1589
1591
  });
1590
1592
 
@@ -1611,7 +1613,7 @@ describe('header block (navigation apiId)', () => {
1611
1613
  await knitwear.trigger('click');
1612
1614
  expect(knitwear.attributes('aria-expanded')).toBe('true');
1613
1615
  expect(panel().get('[data-part="content"]').classes(), 'enter').toContain(
1614
- 'animate-eldra-popover-in'
1616
+ 'eldra:animate-eldra-popover-in'
1615
1617
  );
1616
1618
 
1617
1619
  await knitwear.trigger('click');
@@ -1619,10 +1621,10 @@ describe('header block (navigation apiId)', () => {
1619
1621
  // of a `<Transition>` over a bare `v-show` — but a click on the fading sheet goes through it.
1620
1622
  expect(knitwear.attributes('aria-expanded')).toBe('false');
1621
1623
  for (const token of [
1622
- 'pointer-events-none',
1623
- 'transition-opacity',
1624
- 'duration-fast',
1625
- 'ease-in',
1624
+ 'eldra:pointer-events-none',
1625
+ 'eldra:transition-opacity',
1626
+ 'eldra:duration-fast',
1627
+ 'eldra:ease-in',
1626
1628
  ]) {
1627
1629
  expect(panel().classes(), 'leave').toContain(token);
1628
1630
  }
@@ -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('@container');
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 `classes.root` with
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`
@@ -82,9 +82,10 @@
82
82
  * truth this block renders, so a delivered order's last step shows the done check, not the
83
83
  * ring.
84
84
  */
85
- import { computed, defineComponent, h, ref, type Component } from 'vue';
85
+ import { computed, defineComponent, h, provide, ref, type Component } from 'vue';
86
86
  import {
87
87
  Badge,
88
+ CURRENCY_KEY,
88
89
  Button,
89
90
  Container,
90
91
  EmptyState,
@@ -156,6 +157,10 @@ const order = computed<StorefrontOrder | null>(() => {
156
157
  return editing.value ? buildOrder('shipped') : null;
157
158
  });
158
159
 
160
+ const orderCurrency = computed(() => order.value?.currency ?? money.currency.value);
161
+ // The order's amounts are in its own currency, which can differ from the store's.
162
+ provide(CURRENCY_KEY, () => orderCurrency.value);
163
+
159
164
  /** See the module doc comment's "Loading / error" section — a real token in the URL, but the
160
165
  * fetch it drives is still in flight or failed (never true while `order` already has a value,
161
166
  * which includes the editor's own demo-order fallback above). */
@@ -231,10 +236,9 @@ const statusTone = computed<BadgeTone>(() =>
231
236
  order.value ? STATUS_TONE[order.value.status] : 'neutral'
232
237
  );
233
238
  const statusWord = computed(() => (order.value ? t(STATUS_WORD_KEY[order.value.status]) : ''));
234
- const statusBadgeClasses = computed(() => {
235
- const override = order.value ? STATUS_BADGE_TONE_CLASS[order.value.status] : undefined;
236
- return override ? { root: override } : undefined;
237
- });
239
+ const statusBadgeClass = computed(() =>
240
+ order.value ? STATUS_BADGE_TONE_CLASS[order.value.status] : undefined
241
+ );
238
242
 
239
243
  /* ------------------------------------------------------------------------------------------- */
240
244
  /* Status panel: title, text, carrier/ETA, alert, call to action */
@@ -499,8 +503,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
499
503
  outline
500
504
  :tone="statusTone"
501
505
  :icon="statusIcon"
502
- :classes="statusBadgeClasses"
503
- class="shrink-0"
506
+ :class="['shrink-0', statusBadgeClass]"
504
507
  >
505
508
  <VisuallyHidden>{{ t('order.statusPrefix') }}</VisuallyHidden
506
509
  >{{ statusWord }}
@@ -643,13 +646,17 @@ const helpLinks = computed<HelpLinkView[]>(() =>
643
646
  <Link
644
647
  :href="lineHref(line) ?? undefined"
645
648
  :as="lineLinkAs(line)"
646
- :classes="{ root: 'font-semibold text-text' }"
649
+ class="text-text font-semibold"
647
650
  >
648
651
  {{ line.title }}
649
652
  </Link>
650
653
  <p class="text-muted text-body-sm">{{ lineMeta(line) }}</p>
651
654
  </div>
652
- <Price :amount="money.minor(line.lineTotal)" size="sm" class="justify-self-end" />
655
+ <Price
656
+ :amount="money.minor(line.lineTotal, orderCurrency)"
657
+ size="sm"
658
+ class="justify-self-end"
659
+ />
653
660
  </li>
654
661
  </ul>
655
662
  <Button
@@ -669,7 +676,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
669
676
  <div class="flex items-baseline justify-between gap-4">
670
677
  <dt class="text-muted text-body-sm">{{ t('order.subtotal') }}</dt>
671
678
  <dd class="text-text text-base tabular-nums">
672
- <Price :amount="money.minor(totals.subtotal)" size="sm" />
679
+ <Price :amount="money.minor(totals.subtotal, orderCurrency)" size="sm" />
673
680
  </dd>
674
681
  </div>
675
682
  <div class="flex items-baseline justify-between gap-4">
@@ -678,7 +685,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
678
685
  <span v-if="isShippingFree">{{ t('order.shippingFree') }}</span>
679
686
  <Price
680
687
  v-else-if="totals.shipping != null"
681
- :amount="money.minor(totals.shipping)"
688
+ :amount="money.minor(totals.shipping, orderCurrency)"
682
689
  size="sm"
683
690
  />
684
691
  </dd>
@@ -686,13 +693,13 @@ const helpLinks = computed<HelpLinkView[]>(() =>
686
693
  <div v-if="hasTax" class="flex items-baseline justify-between gap-4">
687
694
  <dt class="text-muted text-body-sm">{{ t('order.tax') }}</dt>
688
695
  <dd class="text-text text-base tabular-nums">
689
- <Price :amount="money.minor(totals.tax!)" size="sm" />
696
+ <Price :amount="money.minor(totals.tax!, orderCurrency)" size="sm" />
690
697
  </dd>
691
698
  </div>
692
699
  <div class="border-border flex items-baseline justify-between gap-4 border-t pt-3">
693
700
  <dt class="text-h4 font-bold">{{ t('order.total') }}</dt>
694
701
  <dd class="text-h4 font-bold tabular-nums">
695
- <Price :amount="money.minor(totals.total)" size="md" />
702
+ <Price :amount="money.minor(totals.total, orderCurrency)" size="md" />
696
703
  </dd>
697
704
  </div>
698
705
  </dl>
@@ -723,7 +730,8 @@ const helpLinks = computed<HelpLinkView[]>(() =>
723
730
  :as="link.as"
724
731
  variant="standalone"
725
732
  :underline="false"
726
- :classes="{ root: 'min-h-9', label: 'inline-flex items-center gap-2' }"
733
+ class="min-h-9"
734
+ :classes="{ label: 'inline-flex items-center gap-2' }"
727
735
  >
728
736
  <EldraIcon v-if="link.icon" :name="link.icon" size="md" class="text-muted" />{{
729
737
  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 `classes.root` override
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('@container');
109
+ expect(section.classes()).toContain('eldra:@container');
110
110
  expect(section.attributes('aria-labelledby')).toBe(wrapper.get('h2').attributes('id'));
111
111
  });
112
112