@eldrajs/theme-cli 0.2.8 → 0.2.9

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 (163) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/package.json +1 -1
  3. package/template/.eldra/block-types.d.ts +28 -7
  4. package/template/.eldra/manifest.json +1034 -355
  5. package/template/.eldra/previews.json +35 -35
  6. package/template/README.md +32 -0
  7. package/template/app/assets/main.css +23 -0
  8. package/template/app/plugins/eldra-storefront.ts +3 -0
  9. package/template/app/storefront/demo.ts +75 -24
  10. package/template/app/storefront/gateway.ts +16 -2
  11. package/template/blocks/announcement-bar/preview.png +0 -0
  12. package/template/blocks/article/preview.json +4 -4
  13. package/template/blocks/article/preview.png +0 -0
  14. package/template/blocks/article-list/Block.vue +48 -19
  15. package/template/blocks/article-list/__tests__/Block.spec.ts +15 -0
  16. package/template/blocks/article-list/preview.json +43 -43
  17. package/template/blocks/article-list/preview.png +0 -0
  18. package/template/blocks/breadcrumbs/preview.png +0 -0
  19. package/template/blocks/cart/preview.png +0 -0
  20. package/template/blocks/collection-grid/Block.vue +260 -9
  21. package/template/blocks/collection-grid/__tests__/Block.spec.ts +202 -0
  22. package/template/blocks/collection-grid/block.json +3 -3
  23. package/template/blocks/collection-grid/preview.png +0 -0
  24. package/template/blocks/collection-header/Block.vue +65 -52
  25. package/template/blocks/collection-header/preview.json +4 -4
  26. package/template/blocks/collection-header/preview.png +0 -0
  27. package/template/blocks/contact/preview.png +0 -0
  28. package/template/blocks/cta/preview.json +4 -4
  29. package/template/blocks/cta/preview.png +0 -0
  30. package/template/blocks/faq/preview.png +0 -0
  31. package/template/blocks/feature-grid/Block.vue +73 -4
  32. package/template/blocks/feature-grid/__tests__/Block.spec.ts +43 -1
  33. package/template/blocks/feature-grid/block.json +2 -2
  34. package/template/blocks/feature-grid/preview.json +49 -24
  35. package/template/blocks/feature-grid/preview.png +0 -0
  36. package/template/blocks/footer/Block.vue +186 -71
  37. package/template/blocks/footer/__tests__/Block.spec.ts +127 -32
  38. package/template/blocks/footer/block.json +42 -4
  39. package/template/blocks/footer/mock.json +31 -34
  40. package/template/blocks/footer/preview.png +0 -0
  41. package/template/blocks/form/preview.png +0 -0
  42. package/template/blocks/gallery/preview.json +24 -24
  43. package/template/blocks/gallery/preview.png +0 -0
  44. package/template/blocks/hero/Block.vue +117 -19
  45. package/template/blocks/hero/__tests__/Block.spec.ts +46 -0
  46. package/template/blocks/hero/block.json +36 -1
  47. package/template/blocks/hero/preview.json +33 -25
  48. package/template/blocks/hero/preview.png +0 -0
  49. package/template/blocks/image/preview.json +4 -4
  50. package/template/blocks/image/preview.png +0 -0
  51. package/template/blocks/logo-cloud/preview.png +0 -0
  52. package/template/blocks/navigation/Block.vue +622 -184
  53. package/template/blocks/navigation/__tests__/Block.spec.ts +406 -68
  54. package/template/blocks/navigation/__tests__/fixtures/menu.json +182 -0
  55. package/template/blocks/navigation/block.json +102 -6
  56. package/template/blocks/navigation/mock.json +279 -52
  57. package/template/blocks/navigation/preview.json +311 -0
  58. package/template/blocks/navigation/preview.png +0 -0
  59. package/template/blocks/newsletter/Block.vue +248 -144
  60. package/template/blocks/newsletter/__tests__/Block.spec.ts +42 -0
  61. package/template/blocks/newsletter/block.json +61 -2
  62. package/template/blocks/newsletter/preview.json +35 -0
  63. package/template/blocks/newsletter/preview.png +0 -0
  64. package/template/blocks/order-status/preview.png +0 -0
  65. package/template/blocks/pricing-table/preview.png +0 -0
  66. package/template/blocks/product-carousel/Block.vue +272 -26
  67. package/template/blocks/product-carousel/__tests__/Block.spec.ts +90 -0
  68. package/template/blocks/product-carousel/block.json +61 -0
  69. package/template/blocks/product-carousel/preview.json +12 -0
  70. package/template/blocks/product-carousel/preview.png +0 -0
  71. package/template/blocks/product-detail/Block.vue +148 -96
  72. package/template/blocks/product-detail/__tests__/Block.spec.ts +98 -74
  73. package/template/blocks/product-detail/block.json +11 -4
  74. package/template/blocks/product-detail/mock.json +53 -22
  75. package/template/blocks/product-detail/parts/Gallery.vue +52 -103
  76. package/template/blocks/product-detail/preview.png +0 -0
  77. package/template/blocks/quote/preview.png +0 -0
  78. package/template/blocks/rich-text/preview.png +0 -0
  79. package/template/blocks/search/Block.vue +1 -0
  80. package/template/blocks/search/TypeSection.vue +1 -0
  81. package/template/blocks/search/__tests__/Block.spec.ts +23 -0
  82. package/template/blocks/search/preview.png +0 -0
  83. package/template/blocks/split-content/Block.vue +98 -20
  84. package/template/blocks/split-content/__tests__/Block.spec.ts +57 -18
  85. package/template/blocks/split-content/block.json +72 -6
  86. package/template/blocks/split-content/preview.json +34 -13
  87. package/template/blocks/split-content/preview.png +0 -0
  88. package/template/blocks/stats/preview.png +0 -0
  89. package/template/blocks/tabs/preview.json +16 -16
  90. package/template/blocks/tabs/preview.png +0 -0
  91. package/template/blocks/team/preview.png +0 -0
  92. package/template/blocks/testimonials/preview.png +0 -0
  93. package/template/blocks/timeline/preview.png +0 -0
  94. package/template/blocks/trust-strip/Block.vue +67 -1
  95. package/template/blocks/trust-strip/__tests__/Block.spec.ts +30 -1
  96. package/template/blocks/trust-strip/block.json +4 -4
  97. package/template/blocks/trust-strip/preview.json +21 -0
  98. package/template/blocks/trust-strip/preview.png +0 -0
  99. package/template/blocks/video-embed/preview.png +0 -0
  100. package/template/blocks/wishlist/preview.png +0 -0
  101. package/template/i18n/en-US.json +16 -9
  102. package/template/i18n/is-IS.json +16 -9
  103. package/template/pages/article.page.json +19 -18
  104. package/template/pages/cart.page.json +3 -13
  105. package/template/pages/category.page.json +15 -7
  106. package/template/pages/collection.page.json +15 -14
  107. package/template/pages/home.page.json +217 -182
  108. package/template/pages/product.page.json +46 -36
  109. package/template/pages/products.page.json +3 -13
  110. package/template/pages/search.page.json +3 -13
  111. package/template/pages/wishlist.page.json +3 -13
  112. package/template/public/images/CREDITS.md +28 -0
  113. package/template/public/images/clay-hands.webp +0 -0
  114. package/template/public/images/coffee-table.webp +0 -0
  115. package/template/public/images/cup.webp +0 -0
  116. package/template/public/images/enamel-cups.webp +0 -0
  117. package/template/public/images/hero.webp +0 -0
  118. package/template/public/images/kitchen.webp +0 -0
  119. package/template/public/images/mug.webp +0 -0
  120. package/template/public/images/northwind-mark.svg +1 -0
  121. package/template/public/images/planters.webp +0 -0
  122. package/template/public/images/plates.webp +0 -0
  123. package/template/public/images/reading.webp +0 -0
  124. package/template/public/images/sweater.webp +0 -0
  125. package/template/public/images/terracotta.webp +0 -0
  126. package/template/public/images/throws.webp +0 -0
  127. package/template/public/images/vase.webp +0 -0
  128. package/template/public/images/wheel.webp +0 -0
  129. package/template/public/images/yarn-tools.webp +0 -0
  130. package/template/public/images/yarn.webp +0 -0
  131. package/template/stories/generated/collection-grid.stories.ts +6 -0
  132. package/template/stories/generated/feature-grid.stories.ts +6 -0
  133. package/template/stories/generated/footer.stories.ts +4 -4
  134. package/template/stories/generated/hero.stories.ts +6 -0
  135. package/template/stories/generated/navigation.stories.ts +14 -1
  136. package/template/stories/generated/newsletter.stories.ts +2 -1
  137. package/template/stories/generated/product-carousel.stories.ts +12 -0
  138. package/template/stories/generated/split-content.stories.ts +12 -0
  139. package/template/stories/generated/trust-strip.stories.ts +8 -1
  140. package/template/stories/pages/article.stories.ts +2 -1
  141. package/template/stories/pages/cart.stories.ts +2 -1
  142. package/template/stories/pages/category.stories.ts +2 -1
  143. package/template/stories/pages/collection.stories.ts +2 -1
  144. package/template/stories/pages/home.stories.ts +2 -1
  145. package/template/stories/pages/product.stories.ts +2 -1
  146. package/template/stories/pages/products.stories.ts +2 -1
  147. package/template/stories/pages/search.stories.ts +2 -1
  148. package/template/stories/pages/wishlist.stories.ts +2 -1
  149. package/template/stories/support/demoChrome.ts +32 -0
  150. package/template/stories/support/pageBlocks.ts +2 -4
  151. package/template/test/countPill.browser.spec.ts +21 -13
  152. package/template/test/localePrefix.spec.ts +11 -6
  153. package/template/test/pages/article.spec.ts +1 -1
  154. package/template/test/pages/category.spec.ts +34 -11
  155. package/template/test/pages/collection.spec.ts +182 -148
  156. package/template/test/pages/home.spec.ts +35 -40
  157. package/template/test/pages/hydration.spec.ts +4 -4
  158. package/template/test/pages/product.spec.ts +17 -14
  159. package/template/test/pages/seededPages.spec.ts +11 -6
  160. package/template/test/prerenderRefresh.browser.spec.ts +36 -15
  161. package/template/test/starter.spec.ts +31 -15
  162. package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
  163. package/template/tokens.json +13 -13
@@ -1,37 +1,37 @@
1
1
  {
2
- "announcement-bar": "cb5f0c03d3ff5a608408dd73caae60d673528ba57cca559292c0217f5b55371e",
3
- "article": "287384ce10758a8ca3019f0331cb51c392da915886b4ac67cb599c7743bd4e83",
4
- "article-list": "aca0382d44cbd9b3989634bd863fe55e088cf617959e38dda9ee0c0ca17f7b68",
5
- "breadcrumbs": "9537ded283e8a2fbc3ad9ae0d330e6ada4f18bcf59dd8f3f7a495bdbaf3501fc",
6
- "cart": "701e89e63820b14a9fa5e3a2da9e9efd55fc151d5165a278dd9ab4971473dc2a",
7
- "collection-grid": "1182dab25ac153ccc773b858c55264734f24c557c0ca1a70b90337cad17104e1",
8
- "collection-header": "427a6703c5cc6c1a10632034f946f1bc79fd9ff99d107e26dac87d163068f78d",
9
- "contact": "52d9c46ee78b5ad97cb85b063cbee8b878829468a3ec168c74195f18d4ff739e",
10
- "cta": "692e6279827b7def0b4e38451c121059941a6bbf82ac8d75dd2d399abdc81169",
11
- "faq": "eb07354f72cdc53484db949de18d4de609a720dda49169e8f12d4b49ed867060",
12
- "feature-grid": "f80baa8c92a3e54a37683385995bcc2af4d5a8b8ee26fd9f6370b3f2b40b1409",
13
- "footer": "9556050d0adde3ba38ba29a96efb3b381348f6a2447fa81a881663fd0cf6b70a",
14
- "form": "75e0c7c42e701bd0c477df33b6604b318bf14e4ba860e25cf2dc498242a76e81",
15
- "gallery": "aa7603b38a2fc91f362700ff4fc6e6a85095ef9542efcef69cf36e92e6ab9a63",
16
- "hero": "5784dafe38c860aa48f7efaa60829af12cc98fab24eff6afe535742a79e445bb",
17
- "image": "d05e60073be042bd55ed2243efff806e411263e45aea79c20c25318c655d9bf7",
18
- "logo-cloud": "8c08fb404c587f419d8914e29bd520f4f4faedd3c9a23cdd33b31602b75dfce0",
19
- "navigation": "7db1b690f9f9043626e8d917a9d3b602b5facc44e23e301961bd80df15875fd8",
20
- "newsletter": "a1bcec0a512f8fcee3b8e92b1146fdbb99620625cdcc6b4a8715047f8775d892",
21
- "order-status": "cdd505d94b2650d00548dd798fc16d4de466d24b68c18107c88134b96c5d4d5f",
22
- "pricing-table": "e807254da0b2ff76f2a66ba2143f15244998ee911d47c3dc5d27dbdcfc3240ca",
23
- "product-carousel": "3ffe2cb752712b40e2d721b1132c30e0bd5104fc0e1879d38d657bdad40a50cf",
24
- "product-detail": "ef517359eff04b1303d69dffa04e4f06016dd5a06a4a4d39422300b16851a4d0",
25
- "quote": "f5a205b691285faa47981418b5668c6b33f9d6426b8d63c153be209ca2151281",
26
- "rich-text": "b37d0b974a66e417550eccbc3151fd70e7b58c80f62756231fe0c93228f8ffa2",
27
- "search": "530a23a1108914114ed89b41d0153364e3b77c383c4e4900b6704ea007e0868f",
28
- "split-content": "d211565a4765c12d6b99a1988e0494f3276cb00967f72f4f16b2620cd690342a",
29
- "stats": "83bf41b6d029bfbcf662e5d151a4a38847cc7027eb399d722f97aa0eb88fef10",
30
- "tabs": "575f13a6abd1f5e161f2b4ca0789ff8b662f1bf1faff7b1ce32c4731c434a535",
31
- "team": "42ee4e323e80b821c5371d6d04f478de80b14b147bd9d6d854bfcb348c54e613",
32
- "testimonials": "5f974a9b8294389276c4905b92b626b20d5bd561de0b01d0a3fe35970b29312c",
33
- "timeline": "c058a395bb86d9cabb7cb9a40e8ee2f8ca0928b147745e025208197c42a23be3",
34
- "trust-strip": "f2ac93c745c109060209430c8bd8b6b74a53c25eda0d6227057fa801fc1784e8",
35
- "video-embed": "c1c3ee4da01b70aac86d371bcf488e7dea8a08e30d42ffde19904cf48f43dad6",
36
- "wishlist": "aed7dd39c1190c5fb286b2ab2dcded2dff7d3bb21ecd85d5c1e74016c62c6335"
2
+ "announcement-bar": "1f2e6758a1c9700d8a0c7f4db5b97d21b9f310045a936fd6a04d223fb4e831c3",
3
+ "article": "89cdf7dc5008717dab2a041308c58e5e47f001af6e6365656768b702eab91423",
4
+ "article-list": "0fc8bca911eef8ee2b7e2ae6819007b5270463d66d1ab5ecd9b76de79a0bce57",
5
+ "breadcrumbs": "ad1251004a26306ae4056d7fc3b779640d03a69e62e30c8f115c058c7f2a1dfa",
6
+ "cart": "2d27e33d8031ff9b4f1e03afcc558ab592df147c7a87427ff87132af39a7fd32",
7
+ "collection-grid": "d17790921e6f4de207dee35ab214df48b4e0c5fdac3a8b4b8210dda33b206cce",
8
+ "collection-header": "ec25eb2e43ff65a76b6fe875a0d0af2a5b4918719b16e00e8be50a0389600a11",
9
+ "contact": "fb4c763b39a4bb7d503eab10b1e179d90b25dd593c5958b159363923b3b346e7",
10
+ "cta": "6f02a319abacb8a729299300f3f280cc1cb52ecd30d608e716f41d62e6eca33a",
11
+ "faq": "45c9525999b7035e498faa0f74b5ddcdf24891967273c26524611924a70a299d",
12
+ "feature-grid": "e8139b8a18d9a90825d1f9a0d3593e71cde0a797622c3ea3e547fa5bb7bd7497",
13
+ "footer": "3f158a2272cd3094de6d920069d2aa566c1dfa725419478630a35df7a6e923c2",
14
+ "form": "e0d462fbd235eca0b0a20f4049c7d857d8d1203bfccaddf57235e5f2dc94bf54",
15
+ "gallery": "702f6a9dd6f73ac59e356b66cd5ccc07854a96d2428fd83bc27b40d3d0e4f571",
16
+ "hero": "beb85a13610858ccdaadeb1657fa9eac794ab01da3d8ca8631d6462182dd1e04",
17
+ "image": "4bbf1f08357fbd262c8e11da93768d1abac21c94e77f87d4b6e1f4101e0744f9",
18
+ "logo-cloud": "9808f5bd122df6ac3b651e74a5350563ca2c7d55f250c6445c4b26ddf3da5403",
19
+ "navigation": "c56d6e6ad1beae3002fe7ed6c87432c9d0736074765c73016504a7105754f477",
20
+ "newsletter": "c6a03035d81fc5b26d1ceef7200f42018940af992b98bcf7c42afd853aa13541",
21
+ "order-status": "12c69fa1637aafe51050b77d076cac0c9f0e5fb0e823a5ff6677a4564801b110",
22
+ "pricing-table": "d42df872b43e3ce9680b13f998950cdc53d4efd9c5823c19d7d3c566661428cb",
23
+ "product-carousel": "ff102f6a493e59ea5e91966da3b02fee1363395bcb59ed1721ec3e397d11b120",
24
+ "product-detail": "c8d2d7f66b3e8d0a351a20fa88602d7562ba12f30adbea05f4d7575387d8d8a9",
25
+ "quote": "057570dd4cb9338ce89821d0f4c0739f34a0b387bddb2886dd476774b707c161",
26
+ "rich-text": "6911862955b5d7c5c1d1a234115862fb3d04b5eba6dfcf35fd552380f8738d30",
27
+ "search": "4d198b704bd31b1aafbc9ff7ea2c5ab8aa3cf58588dea9f9a4210ba4a423233d",
28
+ "split-content": "99aee570648891a83de676d08cbad2c060c64be1ac6eb23695d71d325e673d8b",
29
+ "stats": "3dbd4970ac6f4b6cec64768cfc130e5b0f809c2ab4dd8c9e967bec76aa0fdd65",
30
+ "tabs": "23128dc5706924de50f68bc471ada356a2123c15116274ea5eb156f539f41277",
31
+ "team": "35a2ff9c8feca259dd0254463e4220472356c08485c1a20b18f8b0505cf19226",
32
+ "testimonials": "cd8c01308cd2459afe8a210ed40fad8dc5d1afd905f4191fa0277d72edf1c4b4",
33
+ "timeline": "3fa6fad9d6c12c08cd89a01c18930c2424e8450a81c193e6dcc19d7df61fa2c7",
34
+ "trust-strip": "4e4fee36968e8b85973a3d96eab45265d9a6059f78973aec8b0f0b27684ded79",
35
+ "video-embed": "2a31c545400245654cee62b484c7cb6e0da8cc4bad797755e9806d8e5272f345",
36
+ "wishlist": "c4f0e421942830fb659daf331cfb19338b7923617a688da84a89a8797eee6f51"
37
37
  }
@@ -124,6 +124,38 @@ skipped heading level, unique ids across every block instance on the page, and t
124
124
  page-level gate `docs/starter-kit.md`'s testing section describes. Use them as a starting point for
125
125
  your own site's pages, or as a reference for how a set of blocks composes.
126
126
 
127
+ The fixtures are also what a first deploy seeds, so their header and footer carry no menu, links or
128
+ store details (`test/starter.spec.ts` holds them to it). The page stories fill those in from the
129
+ header's and footer's own demo data (`stories/support/demoChrome.ts`), so Storybook shows the theme
130
+ as a filled-in store.
131
+
132
+ ## Where each page-builder feature lives
133
+
134
+ Every theme feature the page builder offers has a working example in this starter:
135
+
136
+ | Feature | Where |
137
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
138
+ | Header and footer as reusable components (`@header` / `@footer` regions) | `blocks/navigation`, `blocks/footer`; the roles come from `pages/home.page.json` through `starterTemplateRoles()` in `app/templates.ts`, and every page fixture places them |
139
+ | Menus with sections, product cards, badges and "see all" links | `blocks/navigation/block.json` (`links` declares `tree.sections` and `cards`), drawn by `Block.vue` through `@eldrajs/ui`'s `NavMenu`; demo menu in `blocks/navigation/mock.json` / `preview.json` |
140
+ | Grouped menu children moved to sections (migration step) | `blocks/navigation/block.json`, `migrations` version 5: `groupsToSections` |
141
+ | Phone menu layout the merchant picks | `blocks/navigation` `drawerLayout` (`accordion` / `sections`) |
142
+ | Header info strip, labelled tools, a square mark for small phones | `blocks/navigation` `infoItems`, `brandMark`, `account` |
143
+ | Seeded route templates and static pages | `pages/*.page.json` and `app/templates.ts`; `/cart`, `/wishlist`, `/search`, `/products` are page seeds with their one block `required` |
144
+ | Form seeds | `app/formSeeds.ts`; rendered by `blocks/contact`, `blocks/newsletter`, `blocks/footer` |
145
+ | Design tokens a merchant can override in Studio | `tokens.json`, read by `app/assets/main.css` (the Northwind palette and type) |
146
+ | Theme texts a merchant can override or translate | `i18n/en-US.json`, `i18n/is-IS.json` |
147
+ | Shopping in more than one currency | `CurrencyPicker` in `blocks/navigation` (drawer on phones) and `blocks/footer`; prices through `app/storefront/money.ts` (see [Prices and the store currency](#prices-and-the-store-currency)) |
148
+ | Block slots | `blocks/hero/block.json` `slots` (see [Block slots](#block-slots)) |
149
+ | Variants a merchant switches between | e.g. `hero` `card`, `trust-strip` `numbered`, `feature-grid` `arched`, `collection-grid` `filter-bar`; Storybook draws one story per variant |
150
+ | Image fields with framing | hero, feature-grid, split-content, collection-header and product cards (`app/components/ui/UiImage.vue`) |
151
+ | Lightbox zoom | `blocks/product-detail/parts/Gallery.vue` (`zoom`) |
152
+ | A fixed header that does not widen when a dialog opens | `blocks/navigation/Block.vue`, `padding-right: var(--eldra-scrollbar-width)` on the fixed bar |
153
+ | Draft preview sessions and live/preview parity | runtime behaviour of `@eldrajs/theme-nuxt` (`docs/themes.md`); `test/previewParity.browser.spec.ts` proves a session renders these pages as the live site does. Off until the kit release that declares the capability (WS-1375) |
154
+ | `robots.txt` and `sitemap.xml` from the crawl settings | written by `@eldrajs/theme-nuxt` on a production build; nothing to add in the theme |
155
+
156
+ Not shown here: `Tabs` `size="sm"`/`fill` (meant for compact tool panels, not a storefront), and
157
+ `@eldrajs/nuxt`'s 404 for unbuilt paths, which would add a dependency to the starter.
158
+
127
159
  ## Storefront forms
128
160
 
129
161
  Forms come from the platform: a merchant builds them on Studio's Forms page, and the `form` block
@@ -23,8 +23,31 @@
23
23
  to this file. */
24
24
  @source '../../blocks';
25
25
 
26
+ /* The theme's own look on top of the package defaults: colours come from `tokens.json` (Studio can
27
+ override those per site); type, shape and control size are set here because they are the
28
+ theme's design, not a merchant setting. Every value is one of the package's own `--eldra-*`
29
+ variables, so the prebuilt components pick it up with no class overrides.
30
+
31
+ Type uses system font stacks on purpose: a serif for headings and the platform sans for body
32
+ text. No web font is downloaded, so there is no layout shift and nothing to licence; a theme that
33
+ wants a brand face loads it and names it first in these two stacks. */
26
34
  :root {
27
35
  color-scheme: light;
36
+ --eldra-font-heading:
37
+ 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Charter, 'Bitstream Charter',
38
+ Georgia, serif;
39
+ --eldra-font-body:
40
+ system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
41
+ --eldra-text-display-weight: 500;
42
+ --eldra-text-display-tracking: -0.015em;
43
+ --eldra-text-h1-weight: 500;
44
+ --eldra-text-h1-tracking: -0.015em;
45
+ --eldra-text-h2-weight: 500;
46
+ --eldra-text-h2-tracking: -0.01em;
47
+ --eldra-text-h3-weight: 500;
48
+ --eldra-radius-xl: 1.25rem;
49
+ --eldra-control-height: 2.75rem;
50
+ --eldra-control-height-lg: 3.25rem;
28
51
  }
29
52
 
30
53
  /* Hides the native scrollbar on a scroll-snap carousel track while keeping
@@ -265,6 +265,9 @@ export default defineNuxtPlugin({
265
265
  },
266
266
  // Only the browser refreshes: on the server the read that just ran *is* the live value.
267
267
  register: import.meta.client ? (entry) => refresher.register(entry) : undefined,
268
+ // A draft preview session's veil waits for the loads a draft's render starts
269
+ // (`@eldrajs/theme-nuxt`'s `holdPreviewSession`, a no-op outside a covered session).
270
+ hold: import.meta.client ? (load) => holdPreviewSession(load) : undefined,
268
271
  };
269
272
 
270
273
  source = createGatewayStorefront(client, {
@@ -58,12 +58,59 @@ import type {
58
58
  const FREE_SHIPPING_THRESHOLD = 80; // $80.00
59
59
  const FLAT_SHIPPING = 6; // $6.00, below the free-shipping threshold
60
60
 
61
- function demoImage(index: number, alt: string): StorefrontMedia {
62
- // Only `product-1`..`product-6` exist in `public/demo/` today (scripts/demo-images.mjs) — a
63
- // commerce block that needs more can extend that manifest. Money doesn't come into it, this
64
- // just cycles through what already exists.
65
- const name = `product-${((index - 1) % 6) + 1}`;
66
- return { src: `/demo/${name}.svg`, alt };
61
+ /**
62
+ * The CC0 photos in `public/images/` (sources and authors in `public/images/CREDITS.md`), with
63
+ * their pixel size so an image reserves its box before it loads.
64
+ */
65
+ const DEMO_PHOTOS = {
66
+ bowl: [1120, 1400],
67
+ 'clay-hands': [1400, 933],
68
+ 'coffee-table': [1400, 933],
69
+ cup: [1400, 952],
70
+ 'enamel-cups': [1400, 933],
71
+ hero: [1400, 933],
72
+ kitchen: [1400, 840],
73
+ mug: [1400, 934],
74
+ planters: [932, 1400],
75
+ plates: [1400, 933],
76
+ reading: [1400, 933],
77
+ sweater: [1400, 933],
78
+ terracotta: [1400, 933],
79
+ throws: [1400, 910],
80
+ vase: [835, 1400],
81
+ wheel: [1400, 933],
82
+ 'yarn-tools': [1400, 933],
83
+ yarn: [1400, 933],
84
+ } as const satisfies Record<string, readonly [number, number]>;
85
+
86
+ type DemoPhoto = keyof typeof DEMO_PHOTOS;
87
+
88
+ function demoImage(photo: DemoPhoto, alt: string): StorefrontMedia {
89
+ const [width, height] = DEMO_PHOTOS[photo];
90
+ return { src: `/images/${photo}.webp`, alt, width, height };
91
+ }
92
+
93
+ /**
94
+ * Each product's photo and two more for its gallery. The photos are stock pictures chosen to
95
+ * sit near each product, not pictures of it: a real store's own product images replace them.
96
+ */
97
+ const PRODUCT_PHOTOS: Record<string, readonly [DemoPhoto, DemoPhoto, DemoPhoto]> = {
98
+ 'merino-crew-sweater': ['sweater', 'yarn', 'throws'],
99
+ 'fisherman-rib-cardigan': ['yarn-tools', 'sweater', 'reading'],
100
+ 'lambswool-throw-blanket': ['throws', 'reading', 'sweater'],
101
+ 'ribbed-lambswool-beanie': ['yarn', 'yarn-tools', 'sweater'],
102
+ 'linen-tea-towels-pair': ['enamel-cups', 'kitchen', 'cup'],
103
+ 'speckled-latte-mug': ['mug', 'coffee-table', 'cup'],
104
+ 'stoneware-dinner-plates-set-of-4': ['plates', 'kitchen', 'bowl'],
105
+ 'walnut-serving-board': ['kitchen', 'plates', 'coffee-table'],
106
+ 'hand-thrown-serving-bowl': ['bowl', 'clay-hands', 'wheel'],
107
+ 'glazed-milk-jug': ['hero', 'terracotta', 'vase'],
108
+ 'linen-napkins-set-of-4': ['cup', 'enamel-cups', 'kitchen'],
109
+ 'stonewashed-linen-throw': ['reading', 'throws', 'yarn'],
110
+ };
111
+
112
+ function productPhotos(handle: string): readonly [DemoPhoto, DemoPhoto, DemoPhoto] {
113
+ return PRODUCT_PHOTOS[handle] ?? ['mug', 'plates', 'kitchen'];
67
114
  }
68
115
 
69
116
  // ---------------------------------------------------------------------------------------------
@@ -296,13 +343,13 @@ function registerAttributes(handle: string, def: DemoProductDef): void {
296
343
  });
297
344
  }
298
345
 
299
- function buildListItem(def: DemoProductDef, index: number): StorefrontProductListItem {
346
+ function buildListItem(def: DemoProductDef): StorefrontProductListItem {
300
347
  registerAttributes(def.handle, def);
301
348
  return {
302
349
  handle: def.handle,
303
350
  title: def.title,
304
351
  url: `/products/${def.handle}`,
305
- featuredImage: demoImage(index + 1, def.title),
352
+ featuredImage: demoImage(productPhotos(def.handle)[0], def.title),
306
353
  price: { amount: def.amount, compareAt: def.compareAt ?? null },
307
354
  rating: def.rating ?? null,
308
355
  colours: def.colours,
@@ -360,13 +407,17 @@ const MERINO_OPTIONS: StorefrontProduct['options'] = [
360
407
  }),
361
408
  ];
362
409
 
363
- function buildFullProduct(def: DemoProductDef, index: number): StorefrontProduct {
364
- const listItem = buildListItem(def, index);
410
+ function buildFullProduct(def: DemoProductDef): StorefrontProduct {
411
+ const listItem = buildListItem(def);
365
412
  const isMerino = def.handle === 'merino-crew-sweater';
366
413
  return {
367
414
  ...listItem,
368
415
  variantId: def.variantId,
369
- images: [demoImage(index + 1, def.title), demoImage(index + 7, `${def.title}, alternate view`)],
416
+ images: [
417
+ demoImage(productPhotos(def.handle)[0], def.title),
418
+ demoImage(productPhotos(def.handle)[1], `${def.title}, alternate view`),
419
+ demoImage(productPhotos(def.handle)[2], `${def.title}, in use`),
420
+ ],
370
421
  options: isMerino ? MERINO_OPTIONS : [],
371
422
  // Walked up the fixture's own tree from the product's category, exactly as
372
423
  // `createGatewayStorefront` walks the store's: `Home / Ceramics` for a mug, `Knitwear` for a
@@ -382,7 +433,7 @@ function buildFullProduct(def: DemoProductDef, index: number): StorefrontProduct
382
433
  }
383
434
 
384
435
  const PRODUCTS_FULL: Record<string, StorefrontProduct> = Object.fromEntries(
385
- PRODUCT_DEFS.map((def, index) => [def.handle, buildFullProduct(def, index)])
436
+ PRODUCT_DEFS.map((def) => [def.handle, buildFullProduct(def)])
386
437
  );
387
438
 
388
439
  /** Every fixture product a volatile refresh could be asked about, by the id a card carries. */
@@ -459,7 +510,7 @@ const COLLECTIONS: Record<string, StorefrontCollectionInfo> = {
459
510
  title: 'Winter knitwear',
460
511
  description:
461
512
  'Heavy-gauge knits for the coldest months, from our Portland studio and two family mills in Biella and the Scottish Borders.',
462
- image: demoImage(1, 'Winter knitwear'),
513
+ image: demoImage('sweater', 'Winter knitwear'),
463
514
  productCount: 48,
464
515
  },
465
516
  'the-winter-edit': {
@@ -467,7 +518,7 @@ const COLLECTIONS: Record<string, StorefrontCollectionInfo> = {
467
518
  title: 'The winter edit',
468
519
  description:
469
520
  'Heavy-gauge knits, stoneware for slow breakfasts and kitchen goods for the cold months, from our Portland studio and two family mills in Biella and the Scottish Borders.',
470
- image: demoImage(2, 'The winter edit'),
521
+ image: demoImage('throws', 'The winter edit'),
471
522
  productCount: 48,
472
523
  },
473
524
  /**
@@ -480,7 +531,7 @@ const COLLECTIONS: Record<string, StorefrontCollectionInfo> = {
480
531
  handle: 'best-sellers',
481
532
  title: 'Best sellers',
482
533
  description: 'The Northwind pieces shoppers reach for again and again.',
483
- image: demoImage(6, 'Best sellers'),
534
+ image: demoImage('mug', 'Best sellers'),
484
535
  productCount: BEST_SELLER_HANDLES.length,
485
536
  },
486
537
  };
@@ -645,7 +696,7 @@ const ORDER_LINES: StorefrontCartLine[] = [
645
696
  quantity: 1,
646
697
  unitPrice: 148,
647
698
  lineTotal: 148,
648
- image: demoImage(1, 'Fell crew sweater'),
699
+ image: demoImage('sweater', 'Fell crew sweater'),
649
700
  max: null,
650
701
  },
651
702
  {
@@ -658,7 +709,7 @@ const ORDER_LINES: StorefrontCartLine[] = [
658
709
  quantity: 2,
659
710
  unitPrice: 32,
660
711
  lineTotal: 64,
661
- image: demoImage(2, 'Everyday mug'),
712
+ image: demoImage('cup', 'Everyday mug'),
662
713
  max: null,
663
714
  },
664
715
  {
@@ -671,7 +722,7 @@ const ORDER_LINES: StorefrontCartLine[] = [
671
722
  quantity: 1,
672
723
  unitPrice: 32,
673
724
  lineTotal: 32,
674
- image: demoImage(3, 'Linen tea towels, set of 2'),
725
+ image: demoImage('enamel-cups', 'Linen tea towels, set of 2'),
675
726
  max: null,
676
727
  },
677
728
  ];
@@ -795,21 +846,21 @@ const JOURNAL_ARTICLES: StorefrontSearchResponse['articles'] = [
795
846
  href: '/journal/how-to-wash-and-store-linen',
796
847
  category: 'Care guide',
797
848
  readingTime: '4 min read',
798
- image: demoImage(1, 'How to wash and store linen'),
849
+ image: demoImage('throws', 'How to wash and store linen'),
799
850
  },
800
851
  {
801
852
  title: 'Linen vs. cotton for the kitchen',
802
853
  href: '/journal/linen-vs-cotton-for-the-kitchen',
803
854
  category: 'Journal',
804
855
  readingTime: '6 min read',
805
- image: demoImage(2, 'Linen vs. cotton for the kitchen'),
856
+ image: demoImage('kitchen', 'Linen vs. cotton for the kitchen'),
806
857
  },
807
858
  {
808
859
  title: 'A visit to the Kortrijk flax mill',
809
860
  href: '/journal/a-visit-to-the-kortrijk-flax-mill',
810
861
  category: 'Journal',
811
862
  readingTime: '8 min read',
812
- image: demoImage(3, 'A visit to the Kortrijk flax mill'),
863
+ image: demoImage('yarn-tools', 'A visit to the Kortrijk flax mill'),
813
864
  },
814
865
  ];
815
866
 
@@ -938,7 +989,7 @@ export const DEMO_CART_LINES: StorefrontCartLine[] = [
938
989
  quantity: 1,
939
990
  unitPrice: 96,
940
991
  lineTotal: 96,
941
- image: demoImage(1, 'Merino crew sweater'),
992
+ image: demoImage('sweater', 'Merino crew sweater'),
942
993
  max: null,
943
994
  },
944
995
  {
@@ -951,7 +1002,7 @@ export const DEMO_CART_LINES: StorefrontCartLine[] = [
951
1002
  quantity: 2,
952
1003
  unitPrice: 28,
953
1004
  lineTotal: 56,
954
- image: demoImage(6, 'Speckled latte mug'),
1005
+ image: demoImage('mug', 'Speckled latte mug'),
955
1006
  max: null,
956
1007
  },
957
1008
  {
@@ -964,7 +1015,7 @@ export const DEMO_CART_LINES: StorefrontCartLine[] = [
964
1015
  quantity: 1,
965
1016
  unitPrice: 58,
966
1017
  lineTotal: 58,
967
- image: demoImage(8, 'Walnut serving board'),
1018
+ image: demoImage('kitchen', 'Walnut serving board'),
968
1019
  max: null,
969
1020
  },
970
1021
  ];
@@ -891,6 +891,13 @@ export interface StorefrontRuntime {
891
891
  prerender?<T>(key: string, load: () => Promise<T | null>): StorefrontPrerenderHandle<T> | null;
892
892
  /** Takes the result into the page's one batched volatile refresh (`refresh.ts`). */
893
893
  register?(entry: VolatileRefreshEntry): void;
894
+ /**
895
+ * Hands over every load a result starts, settled once its answer is written. A draft preview
896
+ * session keeps its veil up for the ones started while it is covered (`holdPreviewSession`), so
897
+ * a block whose draft names a collection the pinned build never read is shown with its answer,
898
+ * not with the skeleton it has for the moment that read takes.
899
+ */
900
+ hold?(load: Promise<void>): void;
894
901
  }
895
902
 
896
903
  export interface StorefrontPrerenderHandle<T> {
@@ -1067,7 +1074,14 @@ function createGatewayResult<T>(
1067
1074
  }
1068
1075
  }
1069
1076
 
1070
- watch(options.currency === undefined ? sources : [...sources, options.currency], load, {
1077
+ /** Every load, handed to the runtime as well (`StorefrontRuntime.hold`). */
1078
+ function run(): Promise<void> {
1079
+ const loaded = load();
1080
+ options.runtime?.hold?.(loaded);
1081
+ return loaded;
1082
+ }
1083
+
1084
+ watch(options.currency === undefined ? sources : [...sources, options.currency], run, {
1071
1085
  immediate: true,
1072
1086
  deep: true,
1073
1087
  });
@@ -1092,7 +1106,7 @@ function createGatewayResult<T>(
1092
1106
  options.runtime.register(entry);
1093
1107
  }
1094
1108
 
1095
- return { data, pending, loading, error, revalidating, refresh: load };
1109
+ return { data, pending, loading, error, revalidating, refresh: run };
1096
1110
  }
1097
1111
 
1098
1112
  // ---------------------------------------------------------------------------------------------
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "coverImage": {
3
3
  "assetId": "demo-article-cover",
4
- "url": "/demo/article-cover.svg",
5
- "altText": "Unglazed stoneware bowls stacked on a wooden studio shelf",
6
- "width": 1920,
7
- "height": 1080
4
+ "url": "/images/reading.webp",
5
+ "altText": "Reading under a wool blanket",
6
+ "width": 1400,
7
+ "height": 933
8
8
  },
9
9
  "authorAvatar": {
10
10
  "assetId": "demo-avatar-6",
Binary file
@@ -185,6 +185,12 @@ interface CardView {
185
185
  readingTime: string | null;
186
186
  image: { src: string; alt: string; width?: number; height?: number } | null;
187
187
  featured: boolean;
188
+ /**
189
+ * "At home · 4 min read": the category and the reading time, the small line above the title. Two
190
+ * nodes, each value exactly as stored: Studio finds a field to edit inline by its value, one per
191
+ * text node, so a joined string would leave the reading time uneditable.
192
+ */
193
+ kicker: string[];
188
194
  }
189
195
 
190
196
  const cards = computed<CardView[]>(() =>
@@ -202,38 +208,60 @@ const cards = computed<CardView[]>(() =>
202
208
  readingTime: (item.readingTime ?? '').trim() || null,
203
209
  image: media ? { src: media.url, alt: '', width: media.width, height: media.height } : null,
204
210
  featured: isFeaturedFirst.value && index === 0,
211
+ kicker: [item.categoryLabel, item.readingTime].filter(
212
+ (part): part is string => typeof part === 'string' && part.trim() !== ''
213
+ ),
205
214
  };
206
215
  })
207
216
  );
208
217
 
209
- /** Static, variant-keyed class lookups (Tailwind cannot see a dynamically built class name). */
210
- const GRID_ROOT_CLASS =
211
- 'grid grid-cols-1 gap-y-8 @tablet:grid-cols-2 @tablet:gap-x-6 @tablet:gap-y-12 @content:grid-cols-3 @content:gap-x-8';
218
+ /**
219
+ * The theme's journal card, on every variant (`ContentCard` restyled through `classes`, never
220
+ * forked): the category and reading time as one small muted line *above* the title (the card's
221
+ * `eyebrow` part, its overline look undone), the title in the heading serif at 1.375rem, weight
222
+ * 500, not underlined until hover, and a 0.75rem rhythm. The date, when a story has one, stays in
223
+ * the card's own meta line under the title.
224
+ */
225
+ const NO_UNDERLINE_UNTIL_HOVER =
226
+ 'no-underline group-hover:underline group-hover:decoration-1 group-hover:decoration-current ' +
227
+ 'group-hover:underline-offset-[0.2em]';
228
+ const BASE_CARD_CLASSES: Partial<Record<ContentCardPart, string>> = {
229
+ body: 'gap-1.5',
230
+ eyebrow: 'text-muted text-[0.8125rem] leading-[1.4] font-normal normal-case tracking-[0.04em]',
231
+ title: 'font-heading text-[1.375rem] leading-[1.25] font-medium tracking-normal',
232
+ titleLink: NO_UNDERLINE_UNTIL_HOVER,
233
+ };
234
+
235
+ /** Static, variant-keyed class lookups (Tailwind cannot see a dynamically built class name). One
236
+ * column until 961px of block width, three from there. */
237
+ const GRID_ROOT_CLASS = 'grid grid-cols-1 gap-8 @min-[60.0625rem]:grid-cols-3';
212
238
  const LIST_ROOT_CLASS = 'flex flex-col border-t border-border';
213
239
  const listContainerClass = computed(() => (isList.value ? LIST_ROOT_CLASS : GRID_ROOT_CLASS));
214
240
 
215
241
  const FEATURED_CARD_CLASS =
216
242
  'grid gap-6 @tablet:grid-cols-[7fr_5fr] @tablet:items-center @tablet:gap-8 @content:gap-12';
217
243
  const FEATURED_CARD_CLASSES: Partial<Record<ContentCardPart, string>> = {
218
- title: '@content:text-[2rem] @content:leading-[1.15]',
219
- body: '@content:gap-4',
244
+ ...BASE_CARD_CLASSES,
245
+ title: `${BASE_CARD_CLASSES.title} @content:text-[2rem] @content:leading-[1.15]`,
246
+ body: 'gap-1.5 @content:gap-3',
220
247
  };
221
248
  const LIST_CARD_CLASS =
222
249
  'grid grid-cols-[6.5rem_1fr] items-start gap-4 @tablet:grid-cols-[15rem_1fr] @tablet:items-center @tablet:gap-8';
223
250
  const LIST_CARD_CLASSES: Partial<Record<ContentCardPart, string>> = {
251
+ ...BASE_CARD_CLASSES,
224
252
  excerpt: '@max-tablet:hidden',
225
253
  };
226
254
 
227
- function cardClass(card: CardView): string | undefined {
255
+ function cardClass(card: CardView): string {
228
256
  if (card.featured) return FEATURED_CARD_CLASS;
229
257
  if (isList.value) return LIST_CARD_CLASS;
230
- return undefined;
258
+ return 'gap-3';
231
259
  }
232
260
 
233
- function cardClasses(card: CardView): Partial<Record<ContentCardPart, string>> | undefined {
261
+ function cardClasses(card: CardView): Partial<Record<ContentCardPart, string>> {
234
262
  if (card.featured) return FEATURED_CARD_CLASSES;
235
263
  if (isList.value) return LIST_CARD_CLASSES;
236
- return undefined;
264
+ return BASE_CARD_CLASSES;
237
265
  }
238
266
 
239
267
  function itemWrapperClass(card: CardView): string {
@@ -244,15 +272,12 @@ function itemWrapperClass(card: CardView): string {
244
272
 
245
273
  <template>
246
274
  <Section spacing="md" :labelled-by="hasHeading ? headingId : undefined">
247
- <Container width="content">
248
- <div
249
- v-if="hasHead"
250
- class="@tablet:flex-row @tablet:items-baseline @tablet:justify-between mb-6 flex flex-col items-start gap-2"
251
- >
275
+ <Container width="wide">
276
+ <div v-if="hasHead" class="mb-8 flex flex-wrap items-end justify-between gap-x-8 gap-y-3">
252
277
  <h2
253
278
  v-if="hasHeading"
254
279
  :id="headingId"
255
- class="font-heading text-text @tablet:text-h2 text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em]"
280
+ class="font-heading text-text text-[1.75rem] leading-[1.1] font-medium tracking-[-0.01em] text-balance @min-[47.5625rem]:text-[2.25rem]"
256
281
  >
257
282
  {{ heading }}
258
283
  </h2>
@@ -269,7 +294,7 @@ function itemWrapperClass(card: CardView): string {
269
294
  :as="viewAllLinkAs"
270
295
  variant="standalone"
271
296
  arrow
272
- class="text-control"
297
+ :underline="false"
273
298
  >
274
299
  {{ viewAllLabel }}
275
300
  </Link>
@@ -306,14 +331,18 @@ function itemWrapperClass(card: CardView): string {
306
331
  :link-as="card.linkAs"
307
332
  :image="card.image"
308
333
  ratio="3x2"
309
- :eyebrow="card.categoryLabel"
310
334
  :date="card.publishedAt"
311
- :meta="card.readingTime"
312
335
  :excerpt="card.dek"
313
336
  :heading-level="3"
314
337
  :class="cardClass(card)"
315
338
  :classes="cardClasses(card)"
316
- />
339
+ >
340
+ <template v-if="card.kicker.length > 0" #eyebrow>
341
+ <template v-for="(part, index) in card.kicker" :key="index">
342
+ <span v-if="index > 0" aria-hidden="true"> · </span><span>{{ part }}</span>
343
+ </template>
344
+ </template>
345
+ </ContentCard>
317
346
  </li>
318
347
  </ul>
319
348
  <EditorPlaceholder
@@ -94,6 +94,21 @@ describe('article-list block', () => {
94
94
  });
95
95
  });
96
96
 
97
+ it('puts "category · reading time" on one line above each title, and the date under it', async () => {
98
+ const wrapper = mountBlock(withImages);
99
+ await flushPromises();
100
+ const articles = wrapper.findAll('article');
101
+ articles.forEach((article, index) => {
102
+ const item = withImages.items[index]!;
103
+ const kicker = article.get('[data-part="eyebrow"]');
104
+ expect(kicker.text()).toBe(`${item.categoryLabel} · ${item.readingTime}`);
105
+ const html = article.html();
106
+ expect(html.indexOf('data-part="eyebrow"')).toBeLessThan(html.indexOf('data-part="title"'));
107
+ expect(article.get('[data-part="meta"] time').attributes('datetime')).toBe(item.publishedAt);
108
+ expect(article.get('[data-part="meta"]').text()).not.toContain(item.readingTime);
109
+ });
110
+ });
111
+
97
112
  it('renders card images as decorative (alt="")', async () => {
98
113
  const wrapper = mountBlock(withImages);
99
114
  await flushPromises();