@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
@@ -143,8 +143,7 @@ useRichTextScrollRegions(rowsRoot, (caption) => caption ?? t('splitContent.richT
143
143
  v-else-if="editing"
144
144
  inline
145
145
  :label="t('splitContent.imageHintLabel')"
146
- :classes="{ root: 'aspect-[4/3] w-full rounded-xl bg-surface-strong' }"
147
- :class="imageOrderClass(index)"
146
+ :class="['bg-surface-strong aspect-[4/3] w-full rounded-xl', imageOrderClass(index)]"
148
147
  />
149
148
 
150
149
  <div
@@ -183,7 +182,7 @@ useRichTextScrollRegions(rowsRoot, (caption) => caption ?? t('splitContent.richT
183
182
  :as="rowLinkAs(row)"
184
183
  variant="standalone"
185
184
  arrow
186
- :classes="{ root: 'mt-1 text-lg' }"
185
+ class="mt-1 text-lg"
187
186
  >
188
187
  {{ row.linkLabel }}
189
188
  </Link>
@@ -67,7 +67,7 @@ describe('split-content block', () => {
67
67
  */
68
68
  it('the block root is a Section (a query container)', () => {
69
69
  const wrapper = mount(Block, mountOptions({ entry: { id: 'e1', data: withImage } }));
70
- expect(wrapper.get('section').classes()).toContain('@container');
70
+ expect(wrapper.get('section').classes()).toContain('eldra:@container');
71
71
  });
72
72
 
73
73
  it('renders rows as an ordered role=list, one h2 heading per row', () => {
@@ -219,7 +219,7 @@ describe('split-content block', () => {
219
219
  it('applies the xl radius to every row image frame', () => {
220
220
  const wrapper = mount(Block, mountOptions({ entry: { id: 'e1', data: withImage } }));
221
221
  for (const frame of wrapper.findAll('[data-part="frame"]')) {
222
- expect(frame.classes()).toContain('rounded-xl');
222
+ expect(frame.classes()).toContain('eldra:rounded-xl');
223
223
  }
224
224
  });
225
225
  });
@@ -72,7 +72,7 @@ describe('stats block', () => {
72
72
  it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
73
73
  const wrapper = mountBlock(mock);
74
74
  const section = wrapper.get('section');
75
- expect(section.classes()).toContain('@container');
75
+ expect(section.classes()).toContain('eldra:@container');
76
76
  expect(section.attributes('aria-labelledby')).toBeTruthy();
77
77
  });
78
78
 
Binary file
@@ -159,10 +159,9 @@ const tabListClasses = {
159
159
  '-mx-[var(--eldra-gutter-mobile)] px-[var(--eldra-gutter-mobile)] ' +
160
160
  'scroll-px-[var(--eldra-gutter-mobile)] @tablet:mx-0 @tablet:px-0 @tablet:scroll-px-0',
161
161
  };
162
- /** Spec → Layout: "Panel: 2rem top padding." `TabPanel`'s own baked-in default is 1.5rem (see that
163
- * component's own doc comment) — overridden through the package's sanctioned per-part `classes`
164
- * prop, never by patching the component itself. */
165
- const tabPanelClasses = { panel: 'pt-8' };
162
+ /** Spec → Layout: "Panel: 2rem top padding." `TabPanel`'s own default is 1.5rem (see that
163
+ * component's own doc comment); a class on it wins by layer, never a patch to the component. */
164
+ const TAB_PANEL_CLASS = 'pt-8';
166
165
 
167
166
  /** Image | copy grid, only when the panel has an image (spec → Layout): stacked below 48rem, two
168
167
  * equal columns 48–64rem, `7fr`/`5fr` from 64rem — the same gap steps `split-content`'s own row
@@ -219,7 +218,7 @@ useRichTextScrollRegions(panelsRoot, (caption) => caption ?? t('tabsBlock.richTe
219
218
  v-for="(tab, index) in tabs"
220
219
  :key="index"
221
220
  :value="tabValue(index)"
222
- :classes="tabPanelClasses"
221
+ :class="TAB_PANEL_CLASS"
223
222
  >
224
223
  <div class="grid" :class="tabHasImage(tab) ? IMAGE_PANEL_GRID : ''">
225
224
  <UiImage
@@ -252,8 +252,8 @@ describe('tabs block', () => {
252
252
  it('carries the mobile bleed and sideways-scroll classes on the tab row', () => {
253
253
  const wrapper = mountBlock(mock);
254
254
  const list = wrapper.get('[role="tablist"]');
255
- expect(list.classes()).toContain('overflow-x-auto');
256
- expect(list.classes()).toContain('eldra-scrollbar-hide');
255
+ expect(list.classes()).toContain('eldra:overflow-x-auto');
256
+ expect(list.classes()).toContain('eldra:eldra-scrollbar-hide');
257
257
  expect(list.classes()).toContain('-mx-[var(--eldra-gutter-mobile)]');
258
258
  expect(list.classes()).toContain('px-[var(--eldra-gutter-mobile)]');
259
259
  expect(list.classes()).toContain('scroll-px-[var(--eldra-gutter-mobile)]');
Binary file
Binary file
@@ -35,13 +35,12 @@
35
35
  * never modelled by this block's fields, only a 1–5 average per item.
36
36
  *
37
37
  * On a `primary` section the head (heading/summary/link) and each review's stars invert through
38
- * `Section`'s own `group-data-[section=primary]/section:` mechanism (`Link`/`RatingStars`'s own
39
- * copy of it) — but the spec also says "cards stay light, with normal colours inside" for
40
- * `grid`/`carousel`, and that mechanism has no idea a card sits in between: it matches the
41
- * *nearest* `.group/section` ancestor, not by DOM distance or intervening background colour. Each
42
- * card is therefore marked `class="group/section"` itself, with no `data-section` — the same
43
- * "mark a surface by hand" tool `cta`'s own accent `banner` panel uses to *start* a new inverted
44
- * scope, used here in reverse to *stop* one, so a card's own `Rating`/product `Link` never read the
38
+ * `Section`'s own `data-section="primary"`, which `Link`/`RatingStars` read through the package's
39
+ * `section-primary:` variant — but the spec also says "cards stay light, with normal colours
40
+ * inside" for `grid`/`carousel`, and that variant has no idea a card sits in between: it stops only
41
+ * at a nearer element with another `data-section`. Each card is therefore marked
42
+ * `data-section="none"` — the same "mark a surface by hand" tool `cta`'s own accent `banner` panel
43
+ * uses to *start* a new inverted scope, used here in reverse to *stop* one, so a card's own `Rating`/product `Link` never read the
45
44
  * outer primary section at all. `single-large` has no such card (the review sits directly on the
46
45
  * section's own ground), so its `Rating` is deliberately left to invert normally — the one place in
47
46
  * this package's whole component set where that on-primary star/link inversion actually renders
@@ -310,7 +309,8 @@ const cardBackgroundClass = computed(() =>
310
309
  -->
311
310
  <div v-for="(item, index) in renderedItems" :key="index" class="h-full">
312
311
  <figure
313
- class="group/section flex h-full flex-col gap-5 rounded-lg p-6"
312
+ data-section="none"
313
+ class="flex h-full flex-col gap-5 rounded-lg p-6"
314
314
  :class="cardBackgroundClass"
315
315
  >
316
316
  <template v-if="isEditing && isItemEmpty(item)">
@@ -362,7 +362,8 @@ const cardBackgroundClass = computed(() =>
362
362
  <figure
363
363
  v-for="(item, index) in renderedItems"
364
364
  :key="index"
365
- class="group/section flex h-full flex-col gap-5 rounded-lg p-6"
365
+ data-section="none"
366
+ class="flex h-full flex-col gap-5 rounded-lg p-6"
366
367
  :class="[cardBackgroundClass, isSingleItem ? 'mx-auto w-full max-w-[36rem]' : '']"
367
368
  >
368
369
  <template v-if="isEditing && isItemEmpty(item)">
@@ -76,7 +76,7 @@ describe('testimonials block', () => {
76
76
  it('the block root is a labelled <section> that measures its own width (@container)', () => {
77
77
  const wrapper = mountBlock(mock);
78
78
  const section = wrapper.get('section');
79
- expect(section.classes()).toContain('@container');
79
+ expect(section.classes()).toContain('eldra:@container');
80
80
  expect(section.attributes('aria-labelledby')).toBeTruthy();
81
81
  });
82
82
 
@@ -101,7 +101,7 @@ describe('timeline block', () => {
101
101
  it('renders the block root as a labelled <section> that measures its own width (@container)', () => {
102
102
  const wrapper = mountBlock(mock);
103
103
  const section = wrapper.get('section');
104
- expect(section.classes()).toContain('@container');
104
+ expect(section.classes()).toContain('eldra:@container');
105
105
  expect(section.attributes('aria-labelledby')).toBeTruthy();
106
106
  });
107
107
 
@@ -126,7 +126,7 @@ describe('timeline block', () => {
126
126
  // The visually hidden prefix and the visible number are two different nodes: the sr-only
127
127
  // text is read once via the h3's own text content, and the visual number is separately
128
128
  // aria-hidden so nothing doubles it up.
129
- expect(firstTitle.findAll('.sr-only')).toHaveLength(1);
129
+ expect(firstTitle.findAll('.eldra\\:sr-only')).toHaveLength(1);
130
130
  const number = wrapper.get('li span[aria-hidden="true"].tabular-nums');
131
131
  expect(number.text()).toBe('1');
132
132
  });
@@ -295,7 +295,7 @@ const showPaymentsRow = computed(() => showPayments.value && paymentMarks.value.
295
295
  :href="itemHref(item)!"
296
296
  :as="itemLinkAs(item)"
297
297
  :aria-label="item.linkLabel || undefined"
298
- :classes="{ root: itemTitleClass }"
298
+ :class="itemTitleClass"
299
299
  >
300
300
  {{ item.title }}
301
301
  </Link>
@@ -121,7 +121,7 @@ describe('trust-strip block', () => {
121
121
  it('labels the section with the hidden h2', () => {
122
122
  const wrapper = mountBlock(mock);
123
123
  const heading = wrapper.get('h2');
124
- expect(heading.classes()).toContain('sr-only');
124
+ expect(heading.classes()).toContain('eldra:sr-only');
125
125
  expect(wrapper.get('section').attributes('aria-labelledby')).toBe(heading.attributes('id'));
126
126
  expect(heading.text()).toBe('Why shop with Northwind');
127
127
  });
@@ -203,7 +203,7 @@ const headerClass = computed(() =>
203
203
  const headingClass =
204
204
  'font-heading text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em] @tablet:text-h2';
205
205
  const frameRadiusClass = computed(() => (isSplit.value ? 'rounded-lg' : 'rounded-xl'));
206
- const emptyStateClasses = { root: 'absolute inset-0 h-full w-full justify-center' };
206
+ const emptyStateClass = 'absolute inset-0 h-full w-full justify-center';
207
207
  </script>
208
208
 
209
209
  <template>
@@ -242,7 +242,7 @@ const emptyStateClasses = { root: 'absolute inset-0 h-full w-full justify-center
242
242
  :icon="UrlHintIcon"
243
243
  :label="t('video.urlHintLabel')"
244
244
  :help="t('video.urlHintHelp')"
245
- :classes="emptyStateClasses"
245
+ :class="emptyStateClass"
246
246
  />
247
247
 
248
248
  <!-- An unrecognised or unsafe videoUrl: never build an <iframe>/<video> from it. -->
@@ -251,7 +251,7 @@ const emptyStateClasses = { root: 'absolute inset-0 h-full w-full justify-center
251
251
  variant="error"
252
252
  :title="t('video.errorTitle')"
253
253
  :text="t('video.errorText')"
254
- :classes="emptyStateClasses"
254
+ :class="emptyStateClass"
255
255
  >
256
256
  <template #actions>
257
257
  <Link
@@ -177,7 +177,7 @@ describe('video-embed block', () => {
177
177
  await flushPromises();
178
178
  const heading = wrapper.get('h2');
179
179
  expect(heading.text()).toBe(mock.videoTitle);
180
- expect(heading.classes()).toContain('sr-only');
180
+ expect(heading.classes()).toContain('eldra:sr-only');
181
181
  const section = wrapper.get('section');
182
182
  expect(section.attributes('aria-labelledby')).toBe(heading.attributes('id'));
183
183
  expect(await axe(wrapper.element)).toHaveNoViolations();
@@ -67,6 +67,7 @@ const storefront = useStorefront();
67
67
  /** Hydrated in `onMounted`, never before — see the module comment. */
68
68
  const wishlist = useWishlist();
69
69
  const money = useMoney();
70
+ const shopperCurrency = useStorefront().currency.active;
70
71
  const resolveLink = useEldraLink();
71
72
 
72
73
  const headingId = `wishlist-heading-${useUiId()}`;
@@ -166,13 +167,15 @@ const products = computed<StorefrontProductListItem[]>(() =>
166
167
  * own doc comment has the reasoning, and it is the same one the gate on the wishlist has. */
167
168
  const { any: cardsRevalidating, refreshing } = useRevalidating({
168
169
  keys: () => result.revalidating.value,
169
- refreshing: () => result.loading.value && result.data.value !== null,
170
+ refreshing: () =>
171
+ (result.loading.value && result.data.value !== null) || storefront.currency.pending.value,
170
172
  });
171
173
 
172
174
  const cards = computed(() =>
173
175
  toProductCardEntries(products.value, {
174
176
  ratio: '4x5',
175
177
  minorUnits: money.minor,
178
+ shopperCurrency: shopperCurrency.value,
176
179
  revalidating: cardsRevalidating.value,
177
180
  })
178
181
  );
@@ -305,6 +308,7 @@ async function removeCard(handle: string): Promise<void> {
305
308
  the product page, and the one control this card owns is the heart. -->
306
309
  <ProductCard
307
310
  :product="entry.product"
311
+ :currency="entry.currency"
308
312
  ratio="4x5"
309
313
  :heading-level="2"
310
314
  :quick-add="false"
@@ -323,7 +327,7 @@ async function removeCard(handle: string): Promise<void> {
323
327
  size="sm"
324
328
  :pressed="true"
325
329
  :label="t('product.removeFromWishlist', { title: entry.product.title })"
326
- :classes="{ container: 'bg-surface' }"
330
+ class="bg-surface"
327
331
  @click="removeCard(entry.item.handle)"
328
332
  >
329
333
  <template #leadingIcon>
@@ -124,7 +124,8 @@
124
124
  "wishlistOne": "Wishlist, 1 item",
125
125
  "wishlistMany": "Wishlist, {count} items",
126
126
  "viewAll": "View all",
127
- "viewAllOf": "View all {label}"
127
+ "viewAllOf": "View all {label}",
128
+ "cart": "Cart"
128
129
  },
129
130
  "editor": {
130
131
  "addLink": "Add a link"
@@ -502,7 +503,9 @@
502
503
  "emptyFallbackTitle": "Your cart is empty",
503
504
  "drawerHintLabel": "The cart drawer opens from the header",
504
505
  "drawerHintHelp": "Shoppers open it with the bag button; nothing shows here until they do.",
505
- "drawerHintHosted": "The theme already opens one on every page, so this block adds nothing and can be removed."
506
+ "drawerHintHosted": "The theme already opens one on every page, so this block adds nothing and can be removed.",
507
+ "loadFailed": "We couldn't load your cart.",
508
+ "tryAgain": "Try again"
506
509
  },
507
510
  "wishlist": {
508
511
  "saved": "Saved to wishlist",
@@ -547,6 +550,18 @@
547
550
  "trackingNumber": "Tracking number",
548
551
  "carrierEta": "Estimated delivery {eta} with {carrier}."
549
552
  },
553
+ "currency": {
554
+ "label": "Currency",
555
+ "notSoldIn": "Not available in {currency}",
556
+ "notSoldInLong": "Not available in {currency}.",
557
+ "shopIn": "Shop in {currency}",
558
+ "cartNotSold": "{items} can't be bought in {currency}.",
559
+ "checkoutWithout": "Remove and check out",
560
+ "cartWillSwitch": "Your cart will switch to {currency}.",
561
+ "notIncludedOne": "1 item not included",
562
+ "notIncludedMany": "{count} items not included",
563
+ "movedTo": "Prices are now in {currency}."
564
+ },
550
565
  "ui": {
551
566
  "clear": "Clear",
552
567
  "close": "Close",
@@ -628,6 +643,7 @@
628
643
  "filterPanelMin": "Min",
629
644
  "filterPanelMax": "Max",
630
645
  "filterPanelOrMore": " or more",
631
- "filterPanelShowProducts": "Show products"
646
+ "filterPanelShowProducts": "Show products",
647
+ "currencyPickerLabel": "Currency"
632
648
  }
633
649
  }
@@ -124,7 +124,8 @@
124
124
  "wishlistOne": "Óskalisti, 1 vara",
125
125
  "wishlistMany": "Óskalisti, {count} vörur",
126
126
  "viewAll": "Sjá allt",
127
- "viewAllOf": "Sjá allt: {label}"
127
+ "viewAllOf": "Sjá allt: {label}",
128
+ "cart": "Karfa"
128
129
  },
129
130
  "editor": {
130
131
  "addLink": "Bæta við tengli"
@@ -502,7 +503,9 @@
502
503
  "emptyFallbackTitle": "Karfan þín er tóm",
503
504
  "drawerHintLabel": "Karfan opnast úr hausnum",
504
505
  "drawerHintHelp": "Kaupendur opna hana með töskuhnappnum; hér sést ekkert fyrr en þeir gera það.",
505
- "drawerHintHosted": "Þemað opnar hana þegar á öllum síðum, svo þessi hluti gerir ekkert og má fjarlægja."
506
+ "drawerHintHosted": "Þemað opnar hana þegar á öllum síðum, svo þessi hluti gerir ekkert og má fjarlægja.",
507
+ "loadFailed": "Ekki tókst að sækja körfuna.",
508
+ "tryAgain": "Reyna aftur"
506
509
  },
507
510
  "wishlist": {
508
511
  "saved": "Vistað á óskalista",
@@ -547,6 +550,18 @@
547
550
  "trackingNumber": "Sendingarnúmer",
548
551
  "carrierEta": "Áætlaður afhendingartími {eta} með {carrier}."
549
552
  },
553
+ "currency": {
554
+ "label": "Gjaldmiðill",
555
+ "notSoldIn": "Ekki til sölu í {currency}",
556
+ "notSoldInLong": "Ekki til sölu í {currency}.",
557
+ "shopIn": "Skipta yfir í {currency}",
558
+ "cartNotSold": "Þetta fæst ekki keypt í {currency}: {items}.",
559
+ "checkoutWithout": "Fjarlægja og ganga frá kaupum",
560
+ "cartWillSwitch": "Karfan færist yfir í {currency}.",
561
+ "notIncludedOne": "1 vara ekki talin með",
562
+ "notIncludedMany": "{count} vörur ekki taldar með",
563
+ "movedTo": "Verð eru nú í {currency}."
564
+ },
550
565
  "ui": {
551
566
  "clear": "Hreinsa",
552
567
  "close": "Loka",
@@ -628,6 +643,7 @@
628
643
  "filterPanelMin": "Lágm.",
629
644
  "filterPanelMax": "Hám.",
630
645
  "filterPanelOrMore": " eða meira",
631
- "filterPanelShowProducts": "Sýna vörur"
646
+ "filterPanelShowProducts": "Sýna vörur",
647
+ "currencyPickerLabel": "Gjaldmiðill"
632
648
  }
633
649
  }
@@ -118,10 +118,11 @@ export default defineNuxtConfig({
118
118
  // entry's `@theme` block is not merged into the Tailwind root defined by
119
119
  // the first — both verified with a real `nuxi generate` run.
120
120
  // main.css is `@import 'tailwindcss'` followed by
121
- // `@import '@eldrajs/ui/tailwind.css'` instead, which that same resolver
122
- // finds in node_modules like any other package file, and which carries the
123
- // whole `--color-<role>: var(--eldra-color-<role>)` mapping — so no colour
124
- // block is generated into the theme any more.
121
+ // `@import '@eldrajs/ui/tailwind.css'` and `@eldrajs/ui/components.css`
122
+ // instead, which that same resolver finds in node_modules like any other
123
+ // package file; the first carries the whole
124
+ // `--color-<role>: var(--eldra-color-<role>)` mapping — so no colour block is
125
+ // generated into the theme any more — and the second the prebuilt components.
125
126
  tailwind: false,
126
127
  // What Core seeds a site with on its first deploy, built from
127
128
  // `pages/*.page.json` — see `app/templates.ts`, and `docs/starter-kit.md`
@@ -23,6 +23,7 @@
23
23
  "@eldrajs/ui": "workspace:*",
24
24
  "@tabler/icons": "^3.34.0",
25
25
  "nuxt": "^4.0.0",
26
+ "tailwind-merge": "^3.0.0",
26
27
  "vue-i18n": "11.4.16"
27
28
  },
28
29
  "devDependencies": {
@@ -29,9 +29,8 @@ const ArticlePage = defineComponent({
29
29
  href: '#main',
30
30
  as: EldraRouterLink,
31
31
  variant: 'standalone',
32
- classes: {
33
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
34
- },
32
+ class:
33
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
35
34
  },
36
35
  { default: () => t('nav.skipToContent') }
37
36
  ),
@@ -34,9 +34,8 @@ const CartPage = defineComponent({
34
34
  href: '#main',
35
35
  as: EldraRouterLink,
36
36
  variant: 'standalone',
37
- classes: {
38
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
39
- },
37
+ class:
38
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
40
39
  },
41
40
  () => t('nav.skipToContent')
42
41
  ),
@@ -34,9 +34,8 @@ const CategoryPage = defineComponent({
34
34
  href: '#main',
35
35
  as: EldraRouterLink,
36
36
  variant: 'standalone',
37
- classes: {
38
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
39
- },
37
+ class:
38
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
40
39
  },
41
40
  { default: () => t('nav.skipToContent') }
42
41
  ),
@@ -29,9 +29,8 @@ const CollectionPage = defineComponent({
29
29
  href: '#main',
30
30
  as: EldraRouterLink,
31
31
  variant: 'standalone',
32
- classes: {
33
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
34
- },
32
+ class:
33
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
35
34
  },
36
35
  { default: () => t('nav.skipToContent') }
37
36
  ),
@@ -29,9 +29,8 @@ const HomePage = defineComponent({
29
29
  href: '#main',
30
30
  as: EldraRouterLink,
31
31
  variant: 'standalone',
32
- classes: {
33
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
34
- },
32
+ class:
33
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
35
34
  },
36
35
  () => t('nav.skipToContent')
37
36
  ),
@@ -17,9 +17,8 @@ import { renderPageFixtureRegions, type PageFixture } from '../support/pageBlock
17
17
 
18
18
  const fixture = productPage as unknown as PageFixture;
19
19
 
20
- const SKIP_LINK_CLASSES = {
21
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
22
- };
20
+ const SKIP_LINK_CLASS =
21
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50';
23
22
 
24
23
  const ProductPage = defineComponent({
25
24
  name: 'ProductPageStory',
@@ -28,7 +27,7 @@ const ProductPage = defineComponent({
28
27
  return () => [
29
28
  h(
30
29
  Link,
31
- { href: '#main', as: EldraRouterLink, variant: 'standalone', classes: SKIP_LINK_CLASSES },
30
+ { href: '#main', as: EldraRouterLink, variant: 'standalone', class: SKIP_LINK_CLASS },
32
31
  { default: () => t('nav.skipToContent') }
33
32
  ),
34
33
  ...renderPageFixtureRegions(fixture, 'Pages/Product story'),
@@ -36,9 +36,8 @@ const ProductsPage = defineComponent({
36
36
  href: '#main',
37
37
  as: EldraRouterLink,
38
38
  variant: 'standalone',
39
- classes: {
40
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
41
- },
39
+ class:
40
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
42
41
  },
43
42
  () => t('nav.skipToContent')
44
43
  ),
@@ -32,9 +32,8 @@ const SearchPage = defineComponent({
32
32
  href: '#main',
33
33
  as: EldraRouterLink,
34
34
  variant: 'standalone',
35
- classes: {
36
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
37
- },
35
+ class:
36
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
38
37
  },
39
38
  () => t('nav.skipToContent')
40
39
  ),
@@ -31,9 +31,8 @@ const WishlistPage = defineComponent({
31
31
  href: '#main',
32
32
  as: EldraRouterLink,
33
33
  variant: 'standalone',
34
- classes: {
35
- root: 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
36
- },
34
+ class:
35
+ 'bg-primary text-primary-contrast rounded-md sr-only px-4 py-2 focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50',
37
36
  },
38
37
  () => t('nav.skipToContent')
39
38
  ),
@@ -219,7 +219,7 @@ describe('hero split-carousel — linked and unlinked slides in one row', () =>
219
219
  // Slide 1 holds no link, so the slide element itself is the stop — with the package's own
220
220
  // focus ring, since it has no control of its own to bring one. Slide 2's link is parked.
221
221
  expect(figures[0]?.getAttribute('tabindex')).toBe('0');
222
- expect(figures[0]?.classList.contains('eldra-focus')).toBe(true);
222
+ expect(figures[0]?.classList.contains('eldra:eldra-focus')).toBe(true);
223
223
  expect(tabbableIn(track(wrapper))).toEqual([figures[0]]);
224
224
 
225
225
  press(figures[0]!, 'ArrowRight');
@@ -229,7 +229,7 @@ describe('hero split-carousel — linked and unlinked slides in one row', () =>
229
229
  const link = figures[1]!.querySelector<HTMLElement>('a[href]')!;
230
230
  expect(document.activeElement).toBe(link);
231
231
  expect(figures[1]?.getAttribute('tabindex')).toBeNull();
232
- expect(figures[1]?.classList.contains('eldra-focus')).toBe(false);
232
+ expect(figures[1]?.classList.contains('eldra:eldra-focus')).toBe(false);
233
233
  expect(figures[0]?.getAttribute('tabindex')).toBe('-1');
234
234
  expect(tabbableIn(track(wrapper))).toEqual([link]);
235
235
  expect(await axe(wrapper.element)).toHaveNoViolations();
@@ -149,14 +149,14 @@ describe('a focused card in the product carousel', () => {
149
149
  }
150
150
  const state = await page.evaluate(() => {
151
151
  const active = document.activeElement as HTMLElement;
152
- const ringed = active.closest('.eldra-focus') as HTMLElement | null;
152
+ const ringed = active.closest('.eldra\\:eldra-focus') as HTMLElement | null;
153
153
  return {
154
154
  focusedTag: active.tagName,
155
155
  focusVisible: active.matches(':focus-visible'),
156
156
  // The ring is on the card, not on the focused link inside it: `eldra-focus-proxy`'s
157
157
  // `:has(:focus-visible)` is what lights it from the link's own focus.
158
158
  ringedPart: ringed?.getAttribute('data-part'),
159
- ringedProxy: ringed?.classList.contains('eldra-focus-proxy'),
159
+ ringedProxy: ringed?.classList.contains('eldra:eldra-focus-proxy'),
160
160
  alpha: ringed
161
161
  ? getComputedStyle(ringed).getPropertyValue('--eldra-focus-alpha').trim()
162
162
  : null,
@@ -70,17 +70,17 @@ describe('a recently-viewed product carousel at 1440px, in a real browser', () =
70
70
 
71
71
  it('shows more than one card, each exactly as wide as its slide, with the track gap kept between them', async () => {
72
72
  const boxes = await page.evaluate(() => {
73
- const track = document.querySelector<HTMLElement>('.eldra-carousel-track');
73
+ const track = document.querySelector<HTMLElement>('.eldra\\:eldra-carousel-track');
74
74
  if (track === null) return null;
75
75
  const gap = Number.parseFloat(getComputedStyle(track).columnGap);
76
- const slides = Array.from(track.querySelectorAll<HTMLElement>('.eldra-carousel-slide')).map(
77
- (slide) => {
78
- const card = slide.querySelector('article');
79
- const s = slide.getBoundingClientRect();
80
- const c = card?.getBoundingClientRect();
81
- return { slide: { x: s.x, width: s.width }, card: c ? { x: c.x, width: c.width } : null };
82
- }
83
- );
76
+ const slides = Array.from(
77
+ track.querySelectorAll<HTMLElement>('.eldra\\:eldra-carousel-slide')
78
+ ).map((slide) => {
79
+ const card = slide.querySelector('article');
80
+ const s = slide.getBoundingClientRect();
81
+ const c = card?.getBoundingClientRect();
82
+ return { slide: { x: s.x, width: s.width }, card: c ? { x: c.x, width: c.width } : null };
83
+ });
84
84
  return { gap, slides };
85
85
  });
86
86
  if (boxes === null) throw new Error('the carousel track never laid out');