@usequeek/theme-kit 0.5.6 → 0.5.8

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.
package/apps/apps.css CHANGED
@@ -587,27 +587,50 @@ form button.core-subscribe__button:disabled { opacity: 0.6; cursor: default; }
587
587
  .core-consent-banner .core-consent-banner__decline:hover,
588
588
  .core-consent-banner .core-consent-banner__accept:hover { opacity: 0.85; }
589
589
 
590
- /* The footer attribution slot: the cookie preferences link, then "Powered by Queek". No positioning, so a footer row keeps its layout. */
590
+ /* The footer attribution slot: the cookie preferences link, a middle dot, then "Powered by Queek". No positioning, so a footer row keeps its layout. */
591
591
  .core-powered-by-group {
592
592
  display: inline-flex;
593
593
  align-items: baseline;
594
594
  flex-wrap: wrap;
595
- gap: 0.75em;
595
+ gap: 0.6em;
596
596
  }
597
597
 
598
- /* Inherits size and colour from the footer row around it, not from the credit link: a theme whose credit has its own rule for them restyles this in its own theme.css. */
598
+ /* Reads as one of the footer's small links (Dawn's policy links): same size and colour as the row around it, no underline at rest, underline on hover.
599
+ A theme whose `.core-powered-by` has its own size or colour must give `.core-consent-link` the same values in one selector list. */
599
600
  .core-consent-link {
601
+ appearance: none;
600
602
  background: none;
601
603
  border: 0;
602
604
  padding: 0;
603
605
  margin: 0;
604
606
  font: inherit;
605
607
  color: inherit;
608
+ letter-spacing: inherit;
609
+ text-transform: inherit;
610
+ line-height: inherit;
606
611
  text-align: start;
607
- text-decoration: underline;
612
+ text-decoration: none;
608
613
  cursor: pointer;
609
614
  }
610
615
 
616
+ .core-consent-link:hover {
617
+ text-decoration: underline;
618
+ text-underline-offset: 0.2em;
619
+ }
620
+
621
+ .core-consent-link:focus-visible {
622
+ outline: 2px solid currentColor;
623
+ outline-offset: 2px;
624
+ }
625
+
626
+ /* Dawn's middle dot between the link and the credit. The empty alt text keeps it silent for screen readers; with the credit hidden the bare link has no group, so no dot. */
627
+ .core-powered-by-group > .core-consent-link::after {
628
+ content: "\00B7" / "";
629
+ display: inline-block;
630
+ margin-inline-start: 0.6em;
631
+ text-decoration: none;
632
+ }
633
+
611
634
  @media (max-width: 600px) {
612
635
  .core-consent-banner {
613
636
  flex-direction: column;
@@ -18,7 +18,9 @@ function ConsentPreferencesButton({ onReset }: { onReset: () => void }): JSX.Ele
18
18
  /**
19
19
  * The shopper's way back into their cookie choice, rendered by
20
20
  * `PoweredByQueek` in every theme footer (withdrawing consent must be as easy
21
- * as giving it). A plain inline button, never a floating one.
21
+ * as giving it). A plain inline button, never a floating one, that reads as one
22
+ * of the footer's small links: a theme that sizes or colours `.core-powered-by`
23
+ * must give `.core-consent-link` the same values.
22
24
  *
23
25
  * Shown only when the store uses analytics or an ad pixel, the shopper has
24
26
  * answered every question it asks, and the browser is not sending Global
@@ -123,7 +123,7 @@ export function DefaultCartShell({
123
123
  return (
124
124
  <li key={`${item.shop_id}-${item.id}`} className="core-cart-page__item">
125
125
  {item.image ? (
126
- <Image src={item.image} alt={item.title} className="core-cart-page__item-img" />
126
+ <Image src={item.image} variants={item.image_variants} intent="card" sizes="150px" alt={item.title} className="core-cart-page__item-img" />
127
127
  ) : (
128
128
  <div className="core-cart-page__item-img core-cart-page__item-img--placeholder" />
129
129
  )}
@@ -42,9 +42,11 @@ export interface PoweredByQueekProps {
42
42
  * keeps its child count, and the preferences link sits directly before the
43
43
  * attribution. The link renders only when the store uses analytics or an ad
44
44
  * pixel and the shopper has chosen; otherwise the group holds just the
45
- * attribution. A footer needs no extra markup, and a theme may restyle
46
- * `core-consent-link` in its own `theme.css` (the kit gives it a neutral
47
- * look).
45
+ * attribution. A footer needs no extra markup. The link reads as one of the
46
+ * footer's small links (inherited size and colour, no underline at rest, a
47
+ * middle dot before the credit), so a theme that sizes or colours
48
+ * `.core-powered-by` must give `.core-consent-link` the same values in one
49
+ * selector list.
48
50
  */
49
51
  export function PoweredByQueek({ className, hidden = false }: PoweredByQueekProps): JSX.Element | null {
50
52
  const store = useContext(StorefrontContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usequeek/theme-kit",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "The runtime a Queek storefront theme is built on: hooks, stores, page renderer, navigation, shared blocks and locale strings.",
@@ -187,7 +187,11 @@ export const useCartStore = create<CartState>()(
187
187
  // A variant's own price/stock override the base product's — the same
188
188
  // precedence the quick-add flow uses.
189
189
  const unitPrice = (variant?.pricing.sale_amount ?? product.pricing.sale_amount) + addonTotal;
190
- const itemImage = variant?.media.thumbnail ?? variant?.media.image ?? product.media.thumbnail ?? product.media.image ?? null;
190
+ const itemMedia = [variant?.media, product.media].find((media) => media && (media.thumbnail ?? media.image) != null);
191
+ const itemImage = itemMedia ? (itemMedia.thumbnail ?? itemMedia.image) : null;
192
+ // The tier map belongs to `media.image`: when the picked url IS that image (the API's thumbnail falls back to it) the line can
193
+ // render a small copy; a separate thumbnail file is small already.
194
+ const itemImageVariants = itemMedia && itemImage === itemMedia.image ? (itemMedia.image_variants ?? null) : null;
191
195
 
192
196
  // Confirm the add with a global toast (works across every theme) —
193
197
  // except on QR, which has its own persistent cart bar (QrCartBar)
@@ -235,6 +239,7 @@ export const useCartStore = create<CartState>()(
235
239
  title: product.title,
236
240
  slug: product.slug,
237
241
  image: itemImage,
242
+ ...(itemImageVariants ? { image_variants: itemImageVariants } : {}),
238
243
  unit_price: unitPrice,
239
244
  quantity: Math.max(1, quantity),
240
245
  addons,
package/types/cart.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { ImageVariants } from './media';
2
+
1
3
  export interface CartAddon {
2
4
  addon_id: string;
3
5
  item_id: string;
@@ -12,6 +14,12 @@ export interface CartItem {
12
14
  title: string;
13
15
  slug?: string | null;
14
16
  image: string | null;
17
+ /**
18
+ * The tier map of `image` (the API's `image_variants`), kept so a cart thumbnail renders a small WebP copy: the line's `image` is
19
+ * the product's thumbnail, which the API sets to the full image unless the merchant chose another. Null when `image` is a separate,
20
+ * explicit thumbnail file (already small) or is not Media-backed; absent on a line saved before the kit kept it.
21
+ */
22
+ image_variants?: ImageVariants | null;
15
23
  unit_price: number;
16
24
  quantity: number;
17
25
  addons: CartAddon[];
package/types/vendor.ts CHANGED
@@ -209,6 +209,8 @@ export interface StorefrontConfig {
209
209
  default_variants?: Record<string, string>;
210
210
  pages?: Record<string, {
211
211
  banner?: string;
212
+ /** The tier map of `banner` (the API's `image_variants` contract); null when the banner is not Media-backed, absent without a banner. */
213
+ banner_variants?: ImageVariants | null;
212
214
  title?: string;
213
215
  subtitle?: string;
214
216
  /** QR-only header overrides, each falling back to the vendor's own
@@ -1,5 +1,5 @@
1
1
  import type { ImageVariants } from '../types/media';
2
- import type { Product, ProductImage } from '../types/product';
2
+ import type { Product, ProductImage, ProductMedia } from '../types/product';
3
3
 
4
4
  export interface MediaFrame {
5
5
  id: string;
@@ -37,6 +37,19 @@ export function getSlideshowImages(product: Product): ProductImage[] {
37
37
  );
38
38
  }
39
39
 
40
+ /**
41
+ * The tier map to pass to `<Image variants>` for a product picture: `media.image_variants` only when `src` IS the main image.
42
+ * A card or thumb often renders `media.thumbnail ?? media.image`; the API sets the thumbnail to the main image unless the merchant chose
43
+ * a separate thumbnail file, and `<Image>` renders the variants' url ahead of `src`, so the main photo's copies would replace the
44
+ * merchant's own thumbnail. Null for any other src (the thumbnail file is small already), for no src and for no media.
45
+ */
46
+ export function mainImageVariants(
47
+ src: string | null | undefined,
48
+ media: Pick<ProductMedia, 'image' | 'image_variants'> | null | undefined,
49
+ ): ImageVariants | null {
50
+ return src && media && media.image === src ? (media.image_variants ?? null) : null;
51
+ }
52
+
40
53
  /**
41
54
  * The card hover-swap source: the second ordered image. Null unless the
42
55
  * product carries at least two images — callers render the primary alone.