@eldrajs/theme-cli 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +6 -0
  3. package/dist/cli.js +9 -4
  4. package/dist/index.d.ts +6 -12
  5. package/dist/index.js +1 -1
  6. package/dist/{validate-DprFpjV7.js → validate-CC6Mp5i_.js} +11 -19
  7. package/package.json +3 -3
  8. package/template/.eldra/previews.json +35 -35
  9. package/template/README.md +3 -1
  10. package/template/app/app.vue +1 -3
  11. package/template/app/assets/main.css +13 -15
  12. package/template/app/components/ui/UiImage.vue +29 -17
  13. package/template/app/components/ui/__tests__/UiImage.spec.ts +24 -15
  14. package/template/app/pages/[...slug].vue +1 -1
  15. package/template/app/storefront/gateway.ts +0 -3
  16. package/template/app/storefront/structuredData.ts +2 -2
  17. package/template/app/storefront/types.ts +0 -5
  18. package/template/app/utils/seoInput.ts +0 -1
  19. package/template/blocks/announcement-bar/Block.vue +3 -2
  20. package/template/blocks/announcement-bar/__tests__/Block.spec.ts +1 -1
  21. package/template/blocks/announcement-bar/preview.png +0 -0
  22. package/template/blocks/article/Block.vue +3 -4
  23. package/template/blocks/article/preview.png +0 -0
  24. package/template/blocks/article-list/Block.vue +18 -9
  25. package/template/blocks/article-list/preview.png +0 -0
  26. package/template/blocks/breadcrumbs/Block.vue +1 -1
  27. package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +9 -9
  28. package/template/blocks/breadcrumbs/preview.png +0 -0
  29. package/template/blocks/cart/Block.vue +1 -1
  30. package/template/blocks/cart/parts/CartLines.vue +3 -2
  31. package/template/blocks/cart/parts/ShippingBar.vue +1 -1
  32. package/template/blocks/cart/parts/Summary.vue +5 -9
  33. package/template/blocks/cart/preview.png +0 -0
  34. package/template/blocks/collection-grid/Block.vue +11 -14
  35. package/template/blocks/collection-grid/__tests__/Block.spec.ts +12 -14
  36. package/template/blocks/collection-grid/preview.png +0 -0
  37. package/template/blocks/collection-header/Block.vue +5 -5
  38. package/template/blocks/collection-header/preview.png +0 -0
  39. package/template/blocks/contact/Block.vue +1 -1
  40. package/template/blocks/contact/__tests__/Block.spec.ts +2 -2
  41. package/template/blocks/contact/preview.png +0 -0
  42. package/template/blocks/cta/Block.vue +16 -18
  43. package/template/blocks/cta/__tests__/Block.spec.ts +8 -12
  44. package/template/blocks/cta/preview.png +0 -0
  45. package/template/blocks/faq/Block.vue +3 -13
  46. package/template/blocks/faq/__tests__/Block.spec.ts +2 -2
  47. package/template/blocks/faq/preview.png +0 -0
  48. package/template/blocks/feature-grid/Block.vue +1 -1
  49. package/template/blocks/feature-grid/__tests__/Block.spec.ts +1 -1
  50. package/template/blocks/feature-grid/preview.png +0 -0
  51. package/template/blocks/footer/Block.vue +14 -11
  52. package/template/blocks/footer/__tests__/Block.spec.ts +5 -5
  53. package/template/blocks/footer/preview.png +0 -0
  54. package/template/blocks/form/Block.vue +1 -1
  55. package/template/blocks/form/preview.png +0 -0
  56. package/template/blocks/gallery/__tests__/Block.spec.ts +1 -1
  57. package/template/blocks/gallery/preview.png +0 -0
  58. package/template/blocks/hero/Block.vue +8 -11
  59. package/template/blocks/hero/__tests__/Block.spec.ts +9 -7
  60. package/template/blocks/hero/preview.png +0 -0
  61. package/template/blocks/image/Block.vue +4 -4
  62. package/template/blocks/image/__tests__/Block.spec.ts +5 -6
  63. package/template/blocks/image/preview.png +0 -0
  64. package/template/blocks/logo-cloud/__tests__/Block.spec.ts +1 -1
  65. package/template/blocks/logo-cloud/preview.png +0 -0
  66. package/template/blocks/navigation/Block.vue +16 -26
  67. package/template/blocks/navigation/__tests__/Block.spec.ts +22 -20
  68. package/template/blocks/navigation/preview.png +0 -0
  69. package/template/blocks/newsletter/__tests__/Block.spec.ts +1 -1
  70. package/template/blocks/newsletter/preview.png +0 -0
  71. package/template/blocks/order-status/Block.vue +8 -9
  72. package/template/blocks/order-status/__tests__/Block.spec.ts +1 -2
  73. package/template/blocks/order-status/preview.png +0 -0
  74. package/template/blocks/pricing-table/__tests__/Block.spec.ts +1 -1
  75. package/template/blocks/pricing-table/preview.png +0 -0
  76. package/template/blocks/product-carousel/Block.vue +6 -6
  77. package/template/blocks/product-carousel/__tests__/Block.spec.ts +26 -8
  78. package/template/blocks/product-carousel/preview.png +0 -0
  79. package/template/blocks/product-detail/Block.vue +8 -8
  80. package/template/blocks/product-detail/__tests__/Block.spec.ts +1 -1
  81. package/template/blocks/product-detail/parts/Gallery.vue +1 -1
  82. package/template/blocks/product-detail/preview.png +0 -0
  83. package/template/blocks/quote/Block.vue +1 -1
  84. package/template/blocks/quote/__tests__/Block.spec.ts +7 -4
  85. package/template/blocks/quote/preview.png +0 -0
  86. package/template/blocks/rich-text/preview.png +0 -0
  87. package/template/blocks/search/Block.vue +2 -2
  88. package/template/blocks/search/PopularChips.vue +1 -1
  89. package/template/blocks/search/preview.png +0 -0
  90. package/template/blocks/split-content/Block.vue +2 -3
  91. package/template/blocks/split-content/__tests__/Block.spec.ts +2 -2
  92. package/template/blocks/split-content/preview.png +0 -0
  93. package/template/blocks/stats/__tests__/Block.spec.ts +1 -1
  94. package/template/blocks/stats/preview.png +0 -0
  95. package/template/blocks/tabs/Block.vue +4 -5
  96. package/template/blocks/tabs/__tests__/Block.spec.ts +2 -2
  97. package/template/blocks/tabs/preview.png +0 -0
  98. package/template/blocks/team/preview.png +0 -0
  99. package/template/blocks/testimonials/Block.vue +10 -9
  100. package/template/blocks/testimonials/__tests__/Block.spec.ts +1 -1
  101. package/template/blocks/testimonials/preview.png +0 -0
  102. package/template/blocks/timeline/__tests__/Block.spec.ts +2 -2
  103. package/template/blocks/timeline/preview.png +0 -0
  104. package/template/blocks/trust-strip/Block.vue +1 -1
  105. package/template/blocks/trust-strip/__tests__/Block.spec.ts +1 -1
  106. package/template/blocks/trust-strip/preview.png +0 -0
  107. package/template/blocks/video-embed/Block.vue +3 -3
  108. package/template/blocks/video-embed/__tests__/Block.spec.ts +1 -1
  109. package/template/blocks/video-embed/preview.png +0 -0
  110. package/template/blocks/wishlist/Block.vue +1 -1
  111. package/template/blocks/wishlist/preview.png +0 -0
  112. package/template/nuxt.config.ts +5 -4
  113. package/template/package.json +2 -1
  114. package/template/stories/pages/article.stories.ts +2 -3
  115. package/template/stories/pages/cart.stories.ts +2 -3
  116. package/template/stories/pages/category.stories.ts +2 -3
  117. package/template/stories/pages/collection.stories.ts +2 -3
  118. package/template/stories/pages/home.stories.ts +2 -3
  119. package/template/stories/pages/product.stories.ts +3 -4
  120. package/template/stories/pages/products.stories.ts +2 -3
  121. package/template/stories/pages/search.stories.ts +2 -3
  122. package/template/stories/pages/wishlist.stories.ts +2 -3
  123. package/template/test/carouselKeyboard.spec.ts +2 -2
  124. package/template/test/carouselRing.browser.spec.ts +2 -2
  125. package/template/test/carouselSlideWidth.browser.spec.ts +9 -9
  126. package/template/test/eldraIcon.spec.ts +1 -1
  127. package/template/test/mainCss.spec.ts +7 -0
  128. package/template/test/pages/article.spec.ts +5 -5
  129. package/template/test/pages/collection.spec.ts +5 -5
  130. package/template/test/pages/hydration.spec.ts +10 -10
  131. package/template/test/prerenderRefresh.browser.spec.ts +51 -1
  132. package/template/test/seoInput.spec.ts +5 -4
  133. package/template/test/storefront/structuredData.spec.ts +3 -6
  134. package/template/test/structuredData.generate.spec.ts +1 -1
  135. package/template/test/support/mockGateway.ts +8 -3
  136. package/template/test/support/mountPage.ts +2 -3
@@ -231,10 +231,8 @@ function openSearch(): void {
231
231
  * rather than two copies that could drift.
232
232
  *
233
233
  * `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).
234
+ * type-style utility); passed as the Badge's `class`, these app utilities outrank its `eldra:`
235
+ * classes by cascade layer, with no `!important` and no need for a `size` prop (`Badge` has none).
238
236
  */
239
237
  const COUNT_PILL_CLASSES =
240
238
  'pointer-events-none absolute -top-0.5 -right-0.5 min-h-3.5 min-w-3.5 h-3.5 justify-center ' +
@@ -549,13 +547,8 @@ const barSurfaceStyle = { [HEADER_SURFACE_VAR]: 'var(--color-background)' };
549
547
 
550
548
  /**
551
549
  * `@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.
550
+ * never an array, so every conditional class list handed to a `classes` prop in this file is
551
+ * joined into one string with `[...].filter(Boolean).join(' ')`.
559
552
  */
560
553
  /**
561
554
  * Spec "Header" → Container/Section line: "Section background default `background` … Section
@@ -565,7 +558,7 @@ const barSurfaceStyle = { [HEADER_SURFACE_VAR]: 'var(--color-background)' };
565
558
  * top padding, and the header must never trigger that rule against the block that follows it (a
566
559
  * Hero, most often) — the header is fixed chrome that always sits at the page's own ground, not a
567
560
  * 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`
561
+ * neighbour. It also never needs `Section`'s `data-section` colour-inversion machinery: `background`
569
562
  * is always `none` here, and transparent-over-hero mode is handled entirely by `barRootClasses`
570
563
  * above, not by `Section`'s `primary`/`accent` invert. `@container` is kept directly on this root so
571
564
  * `Container` and every `@content:`/`@tablet:` variant below still measure the header's own width.
@@ -652,8 +645,6 @@ const actionsPositionClass = computed(() =>
652
645
 
653
646
  /** What this header draws differently from `NavMenu`'s own look, part by part. */
654
647
  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
648
  nav: `self-stretch ${linksPositionClass.value}`,
658
649
  list: variant.value === 'centered' ? 'h-full flex-nowrap justify-center' : 'h-full flex-nowrap',
659
650
  link: 'text-sm',
@@ -698,9 +689,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
698
689
  variant="standalone"
699
690
  :underline="false"
700
691
  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
- }"
692
+ :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
693
  >
705
694
  <img
706
695
  v-if="brandLogoUrl"
@@ -730,6 +719,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
730
719
  open-on-hover
731
720
  :link-as="MenuLink"
732
721
  :messages="navMenuMessages"
722
+ class="static contents"
733
723
  :classes="navMenuClasses"
734
724
  >
735
725
  <template #toggle>
@@ -745,7 +735,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
745
735
  arrow
746
736
  data-eldra-mega-view-all
747
737
  :aria-label="t('header.viewAllOf', { label: item.label ?? '' })"
748
- :classes="{ root: 'text-sm' }"
738
+ class="text-sm"
749
739
  >
750
740
  {{ t('header.viewAll') }}
751
741
  </Link>
@@ -760,7 +750,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
760
750
  v-if="showLinksPlaceholder"
761
751
  inline
762
752
  :label="t('editor.addLink')"
763
- :classes="{ root: `hidden @content:flex ${linksPositionClass}` }"
753
+ :class="`@content:flex hidden ${linksPositionClass}`"
764
754
  />
765
755
 
766
756
  <!-- `justify-end` matters in exactly one case and is inert in every other: with no Menu
@@ -788,7 +778,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
788
778
  variant="outline"
789
779
  size="sm"
790
780
  aria-haspopup="dialog"
791
- :classes="{ container: 'hidden rounded-full @content:inline-flex' }"
781
+ class="@content:inline-flex hidden rounded-full"
792
782
  @click="openSearch"
793
783
  >
794
784
  {{ t('header.searchField') }}
@@ -800,7 +790,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
800
790
  icon-only
801
791
  :label="t('header.search')"
802
792
  aria-haspopup="dialog"
803
- :classes="{ container: '@content:hidden' }"
793
+ class="@content:hidden"
804
794
  @click="openSearch"
805
795
  >
806
796
  <template #leadingIcon>
@@ -817,7 +807,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
817
807
  :label="t('header.searchField')"
818
808
  :results="searchResults"
819
809
  :loading="searchLoading"
820
- :classes="{ root: 'hidden w-64 @content:block' }"
810
+ class="@content:block hidden w-64"
821
811
  />
822
812
  <Button
823
813
  variant="ghost"
@@ -825,7 +815,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
825
815
  icon-only
826
816
  :label="t('header.search')"
827
817
  aria-haspopup="dialog"
828
- :classes="{ container: '@content:hidden' }"
818
+ class="@content:hidden"
829
819
  @click="openSearch"
830
820
  >
831
821
  <template #leadingIcon>
@@ -862,7 +852,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
862
852
  tone="primary"
863
853
  pill
864
854
  :label="wishlistBadgeLabel"
865
- :classes="{ root: COUNT_PILL_CLASSES }"
855
+ :class="COUNT_PILL_CLASSES"
866
856
  />
867
857
  </span>
868
858
 
@@ -887,7 +877,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
887
877
  tone="primary"
888
878
  pill
889
879
  :label="cartBadgeLabel"
890
- :classes="{ root: COUNT_PILL_CLASSES }"
880
+ :class="COUNT_PILL_CLASSES"
891
881
  />
892
882
  </span>
893
883
 
@@ -900,7 +890,7 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
900
890
  size="sm"
901
891
  :href="ctaHref"
902
892
  :as="ctaLinkAs"
903
- :classes="{ container: 'hidden @content:inline-flex @content:ml-2' }"
893
+ class="@content:inline-flex @content:ml-2 hidden"
904
894
  >
905
895
  {{ ctaLabel }}
906
896
  </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`
@@ -231,10 +231,9 @@ const statusTone = computed<BadgeTone>(() =>
231
231
  order.value ? STATUS_TONE[order.value.status] : 'neutral'
232
232
  );
233
233
  const statusWord = computed(() => (order.value ? t(STATUS_WORD_KEY[order.value.status]) : ''));
234
- const statusBadgeClasses = computed(() => {
235
- const override = order.value ? STATUS_BADGE_TONE_CLASS[order.value.status] : undefined;
236
- return override ? { root: override } : undefined;
237
- });
234
+ const statusBadgeClass = computed(() =>
235
+ order.value ? STATUS_BADGE_TONE_CLASS[order.value.status] : undefined
236
+ );
238
237
 
239
238
  /* ------------------------------------------------------------------------------------------- */
240
239
  /* Status panel: title, text, carrier/ETA, alert, call to action */
@@ -499,8 +498,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
499
498
  outline
500
499
  :tone="statusTone"
501
500
  :icon="statusIcon"
502
- :classes="statusBadgeClasses"
503
- class="shrink-0"
501
+ :class="['shrink-0', statusBadgeClass]"
504
502
  >
505
503
  <VisuallyHidden>{{ t('order.statusPrefix') }}</VisuallyHidden
506
504
  >{{ statusWord }}
@@ -643,7 +641,7 @@ const helpLinks = computed<HelpLinkView[]>(() =>
643
641
  <Link
644
642
  :href="lineHref(line) ?? undefined"
645
643
  :as="lineLinkAs(line)"
646
- :classes="{ root: 'font-semibold text-text' }"
644
+ class="text-text font-semibold"
647
645
  >
648
646
  {{ line.title }}
649
647
  </Link>
@@ -723,7 +721,8 @@ const helpLinks = computed<HelpLinkView[]>(() =>
723
721
  :as="link.as"
724
722
  variant="standalone"
725
723
  :underline="false"
726
- :classes="{ root: 'min-h-9', label: 'inline-flex items-center gap-2' }"
724
+ class="min-h-9"
725
+ :classes="{ label: 'inline-flex items-center gap-2' }"
727
726
  >
728
727
  <EldraIcon v-if="link.icon" :name="link.icon" size="md" class="text-muted" />{{
729
728
  link.label
@@ -224,7 +224,7 @@ describe('order-status block', () => {
224
224
 
225
225
  /** `Badge`'s own `outline` look ignores `tone` entirely (`bg-background text-text
226
226
  * border-border-strong` regardless of the prop), so without an explicit override every status
227
- * would render in the same neutral colour — this pins the per-state `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
 
@@ -76,7 +76,7 @@ const { t } = useI18n();
76
76
  const isEditing = useEditing();
77
77
  const headingId = `product-carousel-heading-${useUiId()}`;
78
78
  /** The h2 recipe, also applied to the heading's own link so `Link`'s standalone size and weight do
79
- * not shrink the title (tailwind-merge keeps the later font-size/weight). */
79
+ * not shrink the title (an app utility outranks the kit's `eldra:` classes by cascade layer). */
80
80
  const HEADING_CLASSES =
81
81
  'font-heading @tablet:text-h2 text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em]';
82
82
 
@@ -279,11 +279,11 @@ const cardRatio = computed(() => (isRecentlyViewed.value ? '1x1' : '4x5'));
279
279
  * `min-w-56`, which is right in a grid whose columns are sized for it and wrong in a slide whose
280
280
  * width is `(track − gaps) / perView`: at six per view on a 1228px track a slide is 189px, so a
281
281
  * 224px card ran 35px past its slide, swallowed the 16px gap and overlapped the next card — the
282
- * operator saw the recently-viewed row drawn with no space between its tiles. `min-w-0` wins over
283
- * the component's own `min-w-56` through `partClass`'s tailwind-merge, so the card fills exactly
282
+ * operator saw the recently-viewed row drawn with no space between its tiles. `min-w-0` (an app
283
+ * utility) outranks the component's own `eldra:min-w-56` by cascade layer, so the card fills exactly
284
284
  * its slide on every variant and at every container width.
285
285
  */
286
- const CARD_CLASSES = { root: 'min-w-0' } as const;
286
+ const CARD_CLASS = 'min-w-0';
287
287
 
288
288
  /**
289
289
  * While pending, `Carousel`'s own accessible name announces the loading state instead of
@@ -418,7 +418,7 @@ const showBlock = computed(() =>
418
418
  variant="standalone"
419
419
  arrow
420
420
  :aria-label="`${heading} — ${data.viewAllLabel}${t('productCarousel.viewAllContext')}`"
421
- :classes="{ root: `${HEADING_CLASSES} text-inherit` }"
421
+ :class="`${HEADING_CLASSES} text-inherit`"
422
422
  >
423
423
  {{ heading }}
424
424
  </Link>
@@ -440,7 +440,7 @@ const showBlock = computed(() =>
440
440
  <ProductCard
441
441
  :product="entry.product"
442
442
  :ratio="cardRatio"
443
- :classes="CARD_CLASSES"
443
+ :class="CARD_CLASS"
444
444
  :show-swatches="!isRecentlyViewed && showSwatchesField"
445
445
  :show-rating="!isRecentlyViewed"
446
446
  :quick-add="false"
@@ -760,7 +760,7 @@ describe('product-carousel block', () => {
760
760
  const { storefront, revalidating } = refreshableSource();
761
761
  const wrapper = mountBlock(mock, { storefront });
762
762
  await flushPromises();
763
- const region = () => wrapper.get('p.sr-only[role="status"]');
763
+ const region = () => wrapper.get('p.eldra\\:sr-only[role="status"]');
764
764
 
765
765
  // Mounted and empty first: a live region that arrives already holding its message is
766
766
  // announced unreliably, which is what a prerendered page would produce if the block read
@@ -771,7 +771,7 @@ describe('product-carousel block', () => {
771
771
  await flushPromises();
772
772
 
773
773
  expect(region().text()).toBe(enUS.storefront.updatingValues);
774
- expect(wrapper.findAll('p.sr-only[role="status"]')).toHaveLength(1);
774
+ expect(wrapper.findAll('p.eldra\\:sr-only[role="status"]')).toHaveLength(1);
775
775
  // `announce: false` on every card — the per-value regions are gone, not merely empty.
776
776
  expect(wrapper.findAll('[data-part="srStatus"]')).toHaveLength(0);
777
777
  expect(
@@ -794,12 +794,14 @@ describe('product-carousel block', () => {
794
794
  const wrapper = mountBlock(mock, { storefront });
795
795
 
796
796
  expect(wrapper.find('[data-part="spinner"]').exists()).toBe(false);
797
- expect(wrapper.get('p.sr-only[role="status"]').text()).toBe('');
797
+ expect(wrapper.get('p.eldra\\:sr-only[role="status"]').text()).toBe('');
798
798
 
799
799
  await flushPromises();
800
800
 
801
801
  expect(wrapper.find('[data-part="spinner"]').exists()).toBe(true);
802
- expect(wrapper.get('p.sr-only[role="status"]').text()).toBe(enUS.storefront.updatingValues);
802
+ expect(wrapper.get('p.eldra\\:sr-only[role="status"]').text()).toBe(
803
+ enUS.storefront.updatingValues
804
+ );
803
805
  });
804
806
 
805
807
  it('never draws a skeleton over cards the visitor can already see', async () => {
@@ -848,10 +850,16 @@ describe('product-carousel block', () => {
848
850
 
849
851
  /**
850
852
  * Every utility rule the build emits, in source order, with the container query it sits under.
851
- * Only `@layer utilities`: the same stylesheet carries a preflight `padding: 0` and the
853
+ * Only `@layer components` (the package's prebuilt, `eldra:`-prefixed rules) and `@layer
854
+ * utilities` (this theme's own): the same stylesheet carries a preflight `padding: 0` and the
852
855
  * rich-text `padding-left` of a blockquote, and neither is on this element.
853
856
  */
854
- type Rule = { condition: string; declarations: Array<[string, string]> };
857
+ type Rule = {
858
+ condition: string;
859
+ layer: string;
860
+ selector: string;
861
+ declarations: Array<[string, string]>;
862
+ };
855
863
 
856
864
  function flatten(css: string, condition: string, layer: string, out: Rule[]): void {
857
865
  let i = 0;
@@ -875,9 +883,11 @@ describe('product-carousel block', () => {
875
883
  namedLayer ? namedLayer[1]! : layer,
876
884
  out
877
885
  );
878
- } else if (layer === 'utilities') {
886
+ } else if (layer === 'utilities' || layer === 'components') {
879
887
  out.push({
880
888
  condition,
889
+ layer,
890
+ selector: head,
881
891
  declarations: body
882
892
  .split(';')
883
893
  .map((part) => part.trim())
@@ -915,7 +925,15 @@ describe('product-carousel block', () => {
915
925
  });
916
926
  const rules: Rule[] = [];
917
927
  flatten(compiler.build(classes), '', '', rules);
918
- return rules;
928
+ // `components.css` ships whole, whatever the candidates, so only its rules for this
929
+ // element's own classes apply; and every utility outranks every component rule by layer.
930
+ const own = new Set(classes.map((name) => `.${name}`));
931
+ return [
932
+ ...rules.filter(
933
+ (rule) => rule.layer === 'components' && own.has(rule.selector.replace(/\\(.)/g, '$1'))
934
+ ),
935
+ ...rules.filter((rule) => rule.layer === 'utilities'),
936
+ ];
919
937
  }
920
938
 
921
939
  /** `max(bleed, reach)` can only be at least the reach; the bare reach is exactly it. */
@@ -380,9 +380,9 @@ const isBackorder = computed(() => stockLine.value.state === 'backorder');
380
380
 
381
381
  /** Spec States, Back-order row: `warning` with the clock icon. `StockBadge`'s own `preorder` level
382
382
  * draws the clock in `muted` (it serves a quieter product-card context too), so the block asks for
383
- * the spec's colour through the component's sanctioned per-part `classes`, never by patching it. */
384
- const stockClasses = computed(() =>
385
- isBackorder.value ? { root: 'text-warning font-semibold' } : { root: 'font-semibold' }
383
+ * the spec's colour through its `class`, never by patching it. */
384
+ const stockClass = computed(() =>
385
+ isBackorder.value ? 'text-warning font-semibold' : 'font-semibold'
386
386
  );
387
387
 
388
388
  /* ------------------------------------------------------------------------- */
@@ -613,7 +613,7 @@ function tabValue(index: number): string {
613
613
  spacing="none"
614
614
  :labelled-by="titleId"
615
615
  :aria-busy="refreshing ? 'true' : undefined"
616
- :classes="{ root: SECTION_SPACING }"
616
+ :class="SECTION_SPACING"
617
617
  >
618
618
  <Container width="content">
619
619
  <div
@@ -726,7 +726,7 @@ function tabValue(index: number): string {
726
726
  :level="stockLine.level"
727
727
  :message="t(stockLine.key, stockLine.params)"
728
728
  :revalidating="stockRevalidating"
729
- :classes="stockClasses"
729
+ :class="stockClass"
730
730
  />
731
731
  <span v-if="stockLine.noteKey" class="text-muted mt-1 block pl-6 text-[0.875rem]">{{
732
732
  t(stockLine.noteKey)
@@ -736,7 +736,7 @@ function tabValue(index: number): string {
736
736
  <FieldWrapper
737
737
  v-if="showQuantity && !soldOut"
738
738
  :label="t('product.quantity')"
739
- :classes="{ root: 'gap-2' }"
739
+ class="gap-2"
740
740
  >
741
741
  <QuantityStepper
742
742
  v-model="quantity"
@@ -861,7 +861,7 @@ function tabValue(index: number): string {
861
861
  </Container>
862
862
  </Section>
863
863
 
864
- <Section v-else-if="showStatus" spacing="none" :classes="{ root: SECTION_SPACING }">
864
+ <Section v-else-if="showStatus" spacing="none" :class="SECTION_SPACING">
865
865
  <Container width="content">
866
866
  <p role="status" class="text-muted">
867
867
  {{ productResult.error.value ? t('storefront.error') : t('storefront.loading') }}
@@ -872,7 +872,7 @@ function tabValue(index: number): string {
872
872
  <!-- The read answered, and the answer was "there is no such product". Said plainly, before the
873
873
  editor hint below, because on a live page this is what a visitor who followed an old link
874
874
  sees and the hint is not for them. -->
875
- <Section v-else-if="notFound" spacing="none" :classes="{ root: SECTION_SPACING }">
875
+ <Section v-else-if="notFound" spacing="none" :class="SECTION_SPACING">
876
876
  <Container width="content">
877
877
  <p role="status" class="text-muted">{{ t('storefront.notFound') }}</p>
878
878
  </Container>
@@ -1285,7 +1285,7 @@ describe('product-detail block', () => {
1285
1285
  expect(bar.text()).toContain('Oat / XS · $96.00');
1286
1286
  // The quick-add button is the one control that exists only below 48rem, where primary
1287
1287
  // actions are at least 2.75rem tall: it takes the package's `lg` size.
1288
- expect(bar.get('button[type="button"]').classes()).toContain('control-h-lg');
1288
+ expect(bar.get('button[type="button"]').classes()).toContain('eldra:control-h-lg');
1289
1289
  expect(await axe(wrapper.element)).toHaveNoViolations();
1290
1290
 
1291
1291
  observers[0]!([{ isIntersecting: true }]);
@@ -127,7 +127,7 @@ const THUMBNAIL_IDLE =
127
127
  icon-only
128
128
  variant="outline"
129
129
  aria-haspopup="dialog"
130
- :classes="{ container: 'size-11 shadow-sm' }"
130
+ class="size-11 shadow-sm"
131
131
  :label="t('product.zoom', { index: current + 1, count })"
132
132
  @click="lightboxOpen = true"
133
133
  >
@@ -32,7 +32,7 @@
32
32
  * (`text-text` on `none`/`surface`/`surface-strong`, `text-primary-contrast`/`text-accent-contrast`
33
33
  * on the two inverting grounds), and that is a normal inherited CSS `color` — so the quote paragraph
34
34
  * and the `<cite>` name carry no colour class of their own and simply inherit whichever one is
35
- * right. `Link` already inverts its own `muted` tone through its `group-data-[section=…]/section:`
35
+ * right. `Link` already inverts its own `muted` tone through its `section-primary:`/`section-accent:`
36
36
  * classes, so the role line needs no extra handling when it is a link. Only the two parts with no
37
37
  * such built-in mechanism branch by hand: the quote mark (`accent` by default, since an `accent`
38
38
  * mark would vanish on an `accent` ground) and the plain-text role line for when there is no
@@ -70,7 +70,7 @@ describe('quote block', () => {
70
70
  it('the block root is a labelled <section> that measures its own width (@container)', () => {
71
71
  const wrapper = mountBlock(mock);
72
72
  const section = wrapper.get('section');
73
- expect(section.classes()).toContain('@container');
73
+ expect(section.classes()).toContain('eldra:@container');
74
74
  expect(section.attributes('aria-labelledby')).toBeTruthy();
75
75
  });
76
76
 
@@ -79,7 +79,7 @@ describe('quote block', () => {
79
79
  const heading = wrapper.get(`#${wrapper.get('section').attributes('aria-labelledby')}`);
80
80
  expect(heading.element.tagName).toBe('H2');
81
81
  expect(heading.text()).toBe(`Quote from ${mock.name}`);
82
- expect(heading.classes()).toContain('sr-only');
82
+ expect(heading.classes()).toContain('eldra:sr-only');
83
83
 
84
84
  const figure = wrapper.get('figure');
85
85
  const blockquote = figure.get('blockquote');
@@ -150,7 +150,7 @@ describe('quote block', () => {
150
150
  expect(link.text()).toBe(mock.role);
151
151
  expect(link.attributes('href')).toBe(sourceLinkHref);
152
152
  expect(link.attributes('aria-label')).toBe(mock.sourceLinkLabel);
153
- expect(link.classes()).toContain('eldra-focus');
153
+ expect(link.classes()).toContain('eldra:eldra-focus');
154
154
  const focusable = Array.from(wrapper.element.querySelectorAll('a, button, input, [tabindex]'));
155
155
  expect(focusable).toContain(link.element);
156
156
  });
@@ -167,7 +167,9 @@ describe('quote block', () => {
167
167
  it('has no italic class anywhere in the block', () => {
168
168
  const wrapper = mountBlock(withMedia);
169
169
  for (const element of wrapper.element.querySelectorAll('*')) {
170
- expect(Array.from(element.classList)).not.toContain('italic');
170
+ expect(Array.from(element.classList, (token) => token.replace(/^eldra:/, ''))).not.toContain(
171
+ 'italic'
172
+ );
171
173
  }
172
174
  });
173
175
 
@@ -259,6 +261,7 @@ describe('quote block', () => {
259
261
  });
260
262
  const link = wrapper.get('figcaption a');
261
263
  expect(link.classes()).not.toContain('block');
264
+ expect(link.classes()).not.toContain('eldra:block');
262
265
  expect(link.element.parentElement?.tagName).toBe('P');
263
266
  expect(link.text()).toBe(mock.role);
264
267
  });
Binary file