@tansy/theme-storefront 0.0.0-stage → 0.1.0

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/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@tansy/theme-storefront",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "A storefront look for the shop plugin: soft rounded product cards, a product stage with a size picker and quantity stepper, and a two-column cart.",
5
+ "keywords": [
6
+ "tansy-theme"
7
+ ],
8
+ "license": "MIT",
9
+ "author": "Mohamed Salah <mohamedsalahsebai@gmail.com>",
10
+ "homepage": "https://github.com/mhmdsalahsebai/tansy",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/mhmdsalahsebai/tansy.git",
14
+ "directory": "themes/storefront"
15
+ },
16
+ "bugs": "https://github.com/mhmdsalahsebai/tansy/issues",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./index.d.ts",
20
+ "default": "./index.js"
21
+ },
22
+ "./render": {
23
+ "types": "./render.d.ts",
24
+ "default": "./render.js"
25
+ }
26
+ },
27
+ "peerDependencies": {
28
+ "@tansy/shop": "^0.1.0",
29
+ "next": "^16.4.6",
30
+ "react": "^19.3.0",
31
+ "tansy": "^0.1.0"
32
+ },
33
+ "dependencies": {
34
+ "zod": "^4.6.7"
35
+ }
36
+ }
package/render.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { StorefrontOptions } from "./index";
2
+ import "./theme.css";
3
+ declare const _default: import("tansy/theme").ThemeComponents<StorefrontOptions>;
4
+ export default _default;
package/render.js ADDED
@@ -0,0 +1,175 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import localFont from "next/font/local";
3
+ import Link from "next/link";
4
+ import { Cart as ShopCart, CartLink, OrderReturn } from "@tansy/shop/react";
5
+ import { OrderList } from "@tansy/shop/render";
6
+ import { Menu, Pager, pickWords, RichText, StreamField } from "tansy/react";
7
+ import { defineThemeComponents } from "tansy/theme";
8
+ import { BuyBox, ProductGallery, ProductSearch, ShareButton } from "./client";
9
+ import { ArrowUpRight, Bag, Bars, ChevronLeft, Globe, User } from "./icons";
10
+ import { cx, fileIds, ids, money, num, text } from "./lib";
11
+ import { messages } from "./messages";
12
+ import "./theme.css";
13
+ // Served from the site's own origin, as font-src 'self' requires.
14
+ const font = localFont({ src: "./fonts/GeistVF.woff", variable: "--storefront-font", weight: "100 900" });
15
+ const items = (list) => list?.items ?? [];
16
+ const byId = (list) => new Map(items(list).map((record) => [record.id, record]));
17
+ /** An address in the page's language: "/shop" is "/ar/shop" on an Arabic page. */
18
+ const inLanguage = (props, path) => props.language?.href(path) ?? path;
19
+ /** From the collection's URL pattern, so links follow whatever the owner sets. */
20
+ const hrefOf = (record, props) => (record && text(record.recordPath) ? inLanguage(props, text(record.recordPath)) : undefined);
21
+ /** The shop's currency and front page, from the `store` list every template here reads. */
22
+ const storeOf = (data) => items(data.store)[0];
23
+ const currencyOf = (data) => text(storeOf(data)?.currency) || "usd";
24
+ const shopHref = (props) => hrefOf(storeOf(props.data), props) ?? inLanguage(props, "/shop");
25
+ const forClient = (words) => (words ? pickWords(words, "storefront") : undefined);
26
+ /* ------------------------------------------------------------------ shared */
27
+ const container = "sf:mx-auto sf:w-full sf:max-w-wide sf:px-gutter";
28
+ const iconButton = "sf:relative sf:grid sf:size-11 sf:shrink-0 sf:place-items-center sf:rounded-full sf:border sf:border-line sf:bg-page sf:text-ink sf:no-underline sf:transition sf:hover:border-ink sf:focus-visible:outline-2 sf:focus-visible:outline-offset-2 sf:focus-visible:outline-accent";
29
+ const pill = "sf:inline-flex sf:h-10 sf:items-center sf:rounded-full sf:border sf:px-5 sf:text-sm sf:font-medium sf:no-underline sf:transition";
30
+ function SectionHeading({ id, title, aside }) {
31
+ return (_jsxs("div", { className: "sf:mb-8 sf:flex sf:flex-wrap sf:items-end sf:justify-between sf:gap-4", children: [_jsx("h2", { id: id, className: "sf:text-3xl sf:font-semibold sf:tracking-tight sf:text-ink sf:sm:text-4xl", children: title }), aside && _jsx("p", { className: "sf:text-sm sf:text-muted", children: aside })] }));
32
+ }
33
+ /* ------------------------------------------------------------------ layout */
34
+ function Brand({ branding, language }) {
35
+ return (_jsxs(Link, { href: inLanguage({ language }, "/"), prefetch: false, className: "sf:flex sf:shrink-0 sf:items-center sf:gap-2.5 sf:text-2xl sf:font-bold sf:tracking-tight sf:text-ink sf:no-underline", children: [branding.logoUrl && _jsx("img", { src: branding.logoUrl, alt: "", width: 32, height: 32, className: "sf:size-8 sf:rounded-full sf:object-cover" }), _jsx("span", { children: branding.name })] }));
36
+ }
37
+ /** The same page in each language it's published in, as one button however many languages the site adds. */
38
+ function LanguageSwitcher({ language, t }) {
39
+ if (!language)
40
+ return null;
41
+ const available = language.locales.filter((locale) => language.alternates[locale.code]);
42
+ if (available.length < 2)
43
+ return null;
44
+ return (_jsx("nav", { "aria-label": t("storefront.language"), children: _jsxs("details", { className: "sf-popover sf:relative", children: [_jsxs("summary", { className: iconButton, children: [_jsx(Globe, {}), _jsx("span", { className: "sf:sr-only", children: t("storefront.language") })] }), _jsx("ul", { className: "sf:absolute sf:end-0 sf:top-full sf:z-40 sf:mt-2 sf:min-w-48 sf:rounded-3xl sf:border sf:border-line sf:bg-page sf:p-2 sf:shadow-card", children: available.map((locale) => (_jsx("li", { children: _jsxs("a", { href: language.alternates[locale.code], hrefLang: locale.code, lang: locale.code, "aria-current": locale.code === language.locale ? "true" : undefined, className: "sf:flex sf:items-center sf:justify-between sf:gap-4 sf:rounded-2xl sf:px-3 sf:py-2 sf:text-ink sf:no-underline sf:hover:bg-surface sf:aria-[current]:font-semibold sf:aria-[current]:text-accent", children: [_jsx("span", { children: locale.label }), _jsx("span", { className: "sf:text-xs sf:text-muted sf:uppercase", children: locale.code })] }) }, locale.code))) })] }) }));
45
+ }
46
+ function Layout(props) {
47
+ const { branding, globals, options, children, language, t, words } = props;
48
+ const menu = globals["site-menu"]?.items;
49
+ const hasMenu = Array.isArray(menu) && menu.length > 0;
50
+ return (_jsxs("div", { className: "sf-shell sf:flex sf:min-h-screen sf:flex-col sf:bg-page sf:font-sans sf:text-ink sf:antialiased", "data-scheme": options.colorScheme, children: [_jsx("a", { href: "#sf-content", className: "sf:sr-only sf:focus:not-sr-only sf:focus:fixed sf:focus:start-4 sf:focus:top-4 sf:focus:z-50 sf:focus:rounded-full sf:focus:bg-ink sf:focus:px-5 sf:focus:py-3 sf:focus:text-page", children: t("storefront.skip") }), _jsx("header", { className: "sf:sticky sf:top-0 sf:z-30 sf:border-b sf:border-line/70 sf:bg-page/85 sf:backdrop-blur-xl", children: _jsxs("div", { className: cx(container, "sf:flex sf:h-20 sf:items-center sf:gap-8"), children: [_jsx(Brand, { branding: branding, language: language }), hasMenu && _jsx("nav", { className: "sf-menu sf:hidden sf:lg:block", "aria-label": t("storefront.menu"), children: _jsx(Menu, { items: menu }) }), _jsxs("div", { className: "sf:ms-auto sf:flex sf:items-center sf:gap-2", children: [_jsx(LanguageSwitcher, { language: language, t: t }), options.accountLinks && (_jsxs("a", { href: inLanguage({ language }, "/orders"), className: iconButton, children: [_jsx(User, {}), _jsx("span", { className: "sf:sr-only", children: t("storefront.orders") })] })), _jsx(CartLink, { className: cx("sf-cart-button", iconButton), label: _jsxs(_Fragment, { children: [_jsx(Bag, {}), _jsx("span", { className: "sf:sr-only", children: t("storefront.cart") })] }), words: words ? pickWords(words, "shop") : undefined }), hasMenu && (_jsxs("details", { className: "sf-popover sf:lg:hidden", children: [_jsxs("summary", { className: iconButton, children: [_jsx(Bars, {}), _jsx("span", { className: "sf:sr-only", children: t("storefront.openMenu") })] }), _jsx("nav", { "aria-label": t("storefront.menu"), className: "sf-menu sf-menu-stacked sf:absolute sf:inset-x-gutter sf:top-full sf:z-40 sf:mt-2 sf:rounded-3xl sf:border sf:border-line sf:bg-page sf:p-3 sf:shadow-card", children: _jsx(Menu, { items: menu }) })] }))] })] }) }), _jsx("div", { id: "sf-content", className: "sf:flex-1", children: children }), _jsx("footer", { className: "sf:mt-24 sf:rounded-t-[3rem] sf:bg-surface", children: _jsxs("div", { className: cx(container, "sf:grid sf:gap-10 sf:py-14 sf:md:grid-cols-[1fr_auto]"), children: [_jsxs("div", { className: "sf:flex sf:max-w-sm sf:flex-col sf:gap-3", children: [_jsx(Brand, { branding: branding, language: language }), _jsx("p", { className: "sf:text-muted", children: options.tagline || t("storefront.heroIntro") })] }), hasMenu && _jsx("nav", { className: "sf-menu sf-menu-footer", "aria-label": t("storefront.footerMenu"), children: _jsx(Menu, { items: menu }) }), _jsxs("p", { className: "sf:border-t sf:border-line sf:pt-6 sf:text-sm sf:text-muted sf:md:col-span-2", children: ["\u00A9 ", new Date().getFullYear(), " ", branding.name, ". ", t("storefront.rights")] })] }) })] }));
51
+ }
52
+ /* -------------------------------------------------------------- products */
53
+ /** A product as a tall soft card: its picture with an arrow over it, then price and name. The whole card is one link. */
54
+ function ProductCard({ product, categories, props, eager = false }) {
55
+ const href = hrefOf(product, props);
56
+ const image = fileIds(product.images)[0];
57
+ const price = num(product.price);
58
+ const was = num(product.compareAtPrice);
59
+ const onSale = price !== null && was !== null && was > price;
60
+ const soldOut = product.stock === 0;
61
+ const category = categories.get(ids(product.categories)[0] ?? -1);
62
+ const subtitle = text(category?.name) || text(product.summary);
63
+ const currency = currencyOf(props.data);
64
+ return (_jsxs("article", { className: "sf:group sf:relative sf:flex sf:flex-col sf:gap-4", lang: typeof product.locale === "string" ? product.locale : undefined, children: [_jsxs("div", { className: "sf:relative sf:isolate sf:grid sf:aspect-[4/5] sf:place-items-center sf:overflow-hidden sf:rounded-[3rem] sf:bg-surface sf:transition-shadow sf:duration-300 sf:group-hover:shadow-card", children: [_jsx("span", { "aria-hidden": "true", className: "sf:absolute sf:inset-x-[12%] sf:top-[14%] sf:-z-10 sf:aspect-square sf:rounded-full sf:bg-page/60 sf:blur-xl" }), image
65
+ // eslint-disable-next-line @next/next/no-img-element -- an access-checked API address that redirects to a signed URL, which next/image can't optimize
66
+ ? _jsx("img", { src: props.fileUrl(image, "800x0"), alt: props.fileText(image).alt, loading: eager ? "eager" : "lazy", className: cx("sf:size-[80%] sf:object-contain sf:drop-shadow-[0_18px_22px_rgba(0,0,0,0.16)] sf:transition-transform sf:duration-500 sf:ease-out sf:group-hover:scale-105 sf:group-hover:-rotate-2 sf:motion-reduce:transition-none", soldOut && "sf:opacity-60 sf:grayscale") })
67
+ : _jsx(Bag, { className: "sf:size-12 sf:text-muted/50", strokeWidth: 1 }), _jsx("span", { "aria-hidden": "true", className: "sf:absolute sf:top-1/2 sf:left-1/2 sf:grid sf:size-14 sf:-translate-1/2 sf:place-items-center sf:rounded-full sf:border sf:border-page/60 sf:bg-page/40 sf:text-ink sf:backdrop-blur-md sf:transition sf:duration-300 sf:group-hover:scale-110 sf:group-hover:border-accent sf:group-hover:bg-accent sf:group-hover:text-on-accent", children: _jsx(ArrowUpRight, { className: "sf:size-5 sf:rtl:-scale-x-100" }) }), (onSale || soldOut) && (_jsx("span", { className: cx("sf:absolute sf:start-5 sf:top-5 sf:rounded-full sf:px-3 sf:py-1 sf:text-xs sf:font-semibold", soldOut ? "sf:bg-ink sf:text-page" : "sf:bg-accent sf:text-on-accent"), children: soldOut ? props.t("storefront.soldOut") : props.t("storefront.sale") }))] }), _jsxs("div", { className: "sf:flex sf:flex-col sf:gap-1 sf:px-2", children: [price !== null && (_jsxs("p", { className: "sf:flex sf:items-baseline sf:gap-2 sf:text-xl sf:font-semibold sf:tracking-tight sf:text-ink sf:tabular-nums", children: [money(props.formatNumber, price, currency), onSale && _jsx("s", { className: "sf:text-sm sf:font-normal sf:text-muted", children: money(props.formatNumber, was, currency) })] })), _jsx("h3", { className: "sf:text-base sf:font-medium sf:text-ink", children: href
68
+ ? _jsx("a", { href: href, className: "sf:text-inherit sf:no-underline sf:outline-none sf:after:absolute sf:after:inset-0 sf:after:rounded-[3rem] sf:focus-visible:after:outline-2 sf:focus-visible:after:outline-offset-4 sf:focus-visible:after:outline-accent", children: text(product.title) })
69
+ : text(product.title) }), subtitle && _jsx("p", { className: "sf:line-clamp-1 sf:text-sm sf:text-muted", children: subtitle })] })] }));
70
+ }
71
+ function ProductGrid({ products, props, empty }) {
72
+ if (!products.length) {
73
+ return (_jsxs("div", { className: "sf:grid sf:place-items-center sf:gap-3 sf:rounded-card sf:border sf:border-dashed sf:border-line sf:px-6 sf:py-20 sf:text-center sf:text-muted", children: [_jsx(Bag, { className: "sf:size-10", strokeWidth: 1.25 }), _jsx("p", { children: empty })] }));
74
+ }
75
+ const categories = byId(props.data.categories);
76
+ return (_jsx("ul", { className: "sf:grid sf:grid-cols-2 sf:gap-x-4 sf:gap-y-10 sf:sm:gap-x-6 sf:md:grid-cols-3 sf:xl:grid-cols-4", children: products.map((product, index) => _jsx("li", { children: _jsx(ProductCard, { product: product, categories: categories, props: props, eager: index < 4 }) }, product.id)) }));
77
+ }
78
+ /** Every category as a chip, the current one filled. "All" is the shop's own page. */
79
+ function CategoryChips({ props, current }) {
80
+ const categories = items(props.data.categories);
81
+ if (!categories.length)
82
+ return null;
83
+ const chip = (active) => cx(pill, active ? "sf:border-ink sf:bg-ink sf:text-page" : "sf:border-line sf:bg-page sf:text-ink sf:hover:border-ink");
84
+ return (_jsx("nav", { "aria-label": props.t("storefront.categories"), className: "sf:-mx-gutter sf:mb-10 sf:overflow-x-auto sf:px-gutter", children: _jsxs("ul", { className: "sf:flex sf:w-max sf:gap-2", children: [_jsx("li", { children: _jsx("a", { href: shopHref(props), className: chip(current === "all"), "aria-current": current === "all" ? "page" : undefined, children: props.t("storefront.all") }) }), categories.map((category) => {
85
+ const href = hrefOf(category, props);
86
+ const active = current === category.id;
87
+ return _jsx("li", { children: href ? _jsx("a", { href: href, className: chip(active), "aria-current": active ? "page" : undefined, children: text(category.name) }) : _jsx("span", { className: chip(active), children: text(category.name) }) }, category.id);
88
+ })] }) }));
89
+ }
90
+ function ProductPager({ props, list }) {
91
+ return _jsx(Pager, { list: list, path: props.path, previous: props.t("storefront.previousPage"), next: props.t("storefront.nextPage"), className: "sf-pager", words: props.words });
92
+ }
93
+ /** The newest product, large, beside the front page's heading. */
94
+ function Spotlight({ product, props }) {
95
+ const image = fileIds(product.images)[0];
96
+ const href = hrefOf(product, props);
97
+ const price = num(product.price);
98
+ return (_jsxs("div", { className: "sf:relative sf:isolate sf:mx-auto sf:hidden sf:aspect-square sf:w-full sf:max-w-[34rem] sf:place-items-center sf:lg:grid", children: [_jsx("span", { "aria-hidden": "true", className: "sf:absolute sf:inset-[6%] sf:-z-20 sf:rounded-full sf:bg-surface" }), _jsx("span", { "aria-hidden": "true", className: "sf:absolute sf:top-[56%] sf:left-1/2 sf:-z-10 sf:h-[24%] sf:w-[112%] sf:-translate-x-1/2 sf:-rotate-6 sf:rounded-[50%] sf:border sf:border-ink/15" }), image ? _jsx("img", { src: props.fileUrl(image, "800x0"), alt: props.fileText(image).alt, className: "sf:size-[74%] sf:object-contain sf:drop-shadow-[0_30px_36px_rgba(0,0,0,0.2)]" }) : _jsx(Bag, { className: "sf:size-20 sf:text-muted/40", strokeWidth: 1 }), _jsxs("div", { className: "sf:absolute sf:start-0 sf:bottom-[8%] sf:flex sf:max-w-[18rem] sf:items-center sf:gap-4 sf:rounded-3xl sf:border sf:border-line sf:bg-page/90 sf:p-4 sf:pe-5 sf:shadow-card sf:backdrop-blur", children: [_jsxs("div", { className: "sf:min-w-0", children: [_jsx("p", { className: "sf:text-xs sf:font-medium sf:tracking-wide sf:text-accent sf:uppercase", children: props.t("storefront.featured") }), _jsx("p", { className: "sf:truncate sf:font-semibold sf:text-ink", children: href ? _jsx("a", { href: href, className: "sf:text-inherit sf:no-underline sf:after:absolute sf:after:inset-0 sf:after:rounded-3xl", children: text(product.title) }) : text(product.title) }), price !== null && _jsx("p", { className: "sf:text-sm sf:text-muted sf:tabular-nums", children: money(props.formatNumber, price, currencyOf(props.data)) })] }), _jsx("span", { "aria-hidden": "true", className: "sf:grid sf:size-10 sf:shrink-0 sf:place-items-center sf:rounded-full sf:bg-accent sf:text-on-accent", children: _jsx(ArrowUpRight, { className: "sf:size-4 sf:rtl:-scale-x-100" }) })] })] }));
99
+ }
100
+ /* --------------------------------------------------------------- templates */
101
+ /**
102
+ * The front page, at the site's root and at the shop's address. On the shop's address, its
103
+ * heading and introduction come from the Shop page record.
104
+ */
105
+ function Front(props) {
106
+ const { record, data, options, t, words } = props;
107
+ const products = items(data.products);
108
+ const firstPage = (data.products?.page ?? 1) === 1;
109
+ const intro = record?.intro !== undefined && record?.intro !== null
110
+ ? _jsx("div", { className: "sf-prose sf:max-w-lg sf:text-lg sf:text-muted", children: _jsx(RichText, { doc: record.intro }) })
111
+ : _jsx("p", { className: "sf:max-w-lg sf:text-lg sf:text-muted", children: options.tagline || t("storefront.heroIntro") });
112
+ return (_jsxs("main", { children: [firstPage && (_jsxs("section", { className: cx(container, "sf:grid sf:items-center sf:gap-10 sf:pt-10 sf:pb-14 sf:lg:grid-cols-[1.1fr_1fr] sf:lg:pt-16"), children: [_jsxs("div", { className: "sf:flex sf:flex-col sf:items-start sf:gap-6", children: [_jsx("p", { className: "sf:rounded-full sf:bg-accent/10 sf:px-4 sf:py-1.5 sf:text-sm sf:font-medium sf:text-accent", children: t("storefront.kicker") }), _jsx("h1", { className: "sf:max-w-[12ch] sf:text-5xl sf:leading-[1.02] sf:font-semibold sf:tracking-tight sf:text-balance sf:text-ink sf:sm:text-6xl sf:xl:text-7xl", children: text(record?.title) || t("storefront.heroTitle") }), intro, options.search && _jsx(ProductSearch, { words: forClient(words), currency: currencyOf(data) })] }), products[0] && _jsx(Spotlight, { product: products[0], props: props })] })), _jsxs("section", { "aria-labelledby": "sf-products", className: cx(container, !firstPage && "sf:pt-12"), children: [_jsx(CategoryChips, { props: props, current: record ? "all" : null }), _jsx(SectionHeading, { id: "sf-products", title: firstPage ? t("storefront.newArrivals") : t("storefront.pageOf", { page: data.products?.page ?? 1 }), aside: data.products?.totalItems ? t("storefront.products", { count: data.products.totalItems }) : undefined }), _jsx(ProductGrid, { products: products, props: props, empty: t("storefront.noProducts") }), _jsx(ProductPager, { props: props, list: data.products })] })] }));
113
+ }
114
+ function Category(props) {
115
+ const { record, data, t } = props;
116
+ if (!record)
117
+ return null;
118
+ return (_jsxs("main", { children: [_jsxs("header", { className: cx(container, "sf:flex sf:flex-col sf:items-start sf:gap-4 sf:pt-10 sf:pb-10 sf:lg:pt-14"), children: [_jsxs("a", { href: shopHref(props), className: "sf:inline-flex sf:items-center sf:gap-1 sf:text-sm sf:font-medium sf:text-muted sf:no-underline sf:hover:text-ink", children: [_jsx(ChevronLeft, { className: "sf:size-4 sf:rtl:-scale-x-100" }), t("storefront.back")] }), _jsx("h1", { className: "sf:text-5xl sf:font-semibold sf:tracking-tight sf:text-ink sf:sm:text-6xl", children: text(record.name) }), text(record.description) && _jsx("p", { className: "sf:max-w-2xl sf:text-lg sf:text-muted", children: text(record.description) })] }), _jsxs("section", { "aria-label": text(record.name), className: container, children: [_jsx(CategoryChips, { props: props, current: record.id }), (data.products?.totalItems ?? 0) > 0 && _jsx("p", { className: "sf:mb-6 sf:text-sm sf:text-muted", children: t("storefront.products", { count: data.products.totalItems }) }), _jsx(ProductGrid, { products: items(data.products), props: props, empty: t("storefront.emptyCategory") }), _jsx(ProductPager, { props: props, list: data.products })] })] }));
119
+ }
120
+ /**
121
+ * A product: its pictures on a stage, and beside them a panel with the price, options and two
122
+ * ways to buy. Below, its description and products like it.
123
+ */
124
+ function Product(props) {
125
+ const { record, data, fileUrl, fileText, stream, t, words } = props;
126
+ if (!record)
127
+ return null;
128
+ const currency = currencyOf(data);
129
+ const categories = byId(data.categories);
130
+ const category = categories.get(ids(record.categories)[0] ?? -1);
131
+ const images = fileIds(record.images).map((id) => ({ src: fileUrl(id, "800x0"), thumb: fileUrl(id, "100x100"), alt: fileText(id).alt }));
132
+ const variants = items(data.variants).map((variant) => ({ id: variant.id, title: text(variant.title), price: num(variant.price), stock: num(variant.stock) }));
133
+ const more = (items(data.related).length ? items(data.related) : items(data.latest)).filter((product) => product.id !== record.id).slice(0, 4);
134
+ const description = Array.isArray(record.description) && record.description.length > 0;
135
+ return (_jsxs("main", { className: cx(container, "sf:pt-6 sf:lg:pt-10"), children: [_jsxs("div", { className: "sf:mb-6 sf:flex sf:items-center sf:justify-between sf:gap-4", children: [_jsxs("nav", { "aria-label": t("storefront.back"), className: "sf:flex sf:min-w-0 sf:items-center sf:gap-3", children: [_jsxs("a", { href: shopHref(props), className: iconButton, children: [_jsx(ChevronLeft, { className: "sf:size-5 sf:rtl:-scale-x-100" }), _jsx("span", { className: "sf:sr-only", children: t("storefront.back") })] }), category && hrefOf(category, props) && _jsx("a", { href: hrefOf(category, props), className: "sf:hidden sf:truncate sf:text-sm sf:font-medium sf:text-muted sf:no-underline sf:hover:text-ink sf:sm:inline", children: text(category.name) })] }), _jsx(ShareButton, { title: text(record.title), words: forClient(words), className: iconButton })] }), _jsxs("div", { className: "sf:grid sf:items-start sf:gap-8 sf:lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)] sf:lg:gap-14", children: [_jsx(ProductGallery, { images: images, words: forClient(words) }), _jsxs("div", { className: "sf:flex sf:flex-col sf:gap-7 sf:rounded-card sf:border sf:border-line sf:bg-page sf:p-6 sf:shadow-card sf:sm:p-10 sf:lg:sticky sf:lg:top-28", children: [_jsx("span", { "aria-hidden": "true", className: "sf:mx-auto sf:-mt-2 sf:h-1 sf:w-12 sf:rounded-full sf:bg-line sf:lg:hidden" }), _jsxs("div", { className: "sf:flex sf:flex-col sf:gap-2", children: [category && _jsx("p", { className: "sf:text-sm sf:font-medium sf:text-accent", children: text(category.name) }), _jsx("h1", { className: "sf:text-3xl sf:font-semibold sf:tracking-tight sf:text-balance sf:text-ink sf:sm:text-4xl", children: text(record.title) }), text(record.summary) && _jsx("p", { className: "sf:text-muted", children: text(record.summary) })] }), _jsx(BuyBox, { product: record.id, price: num(record.price), compareAt: num(record.compareAtPrice), stock: num(record.stock), variants: variants, currency: currency, words: forClient(words) }), text(record.sku) && _jsx("p", { className: "sf:border-t sf:border-line sf:pt-5 sf:text-xs sf:text-muted", children: t("shop.sku", { sku: text(record.sku) }) })] })] }), description && (_jsxs("section", { "aria-labelledby": "sf-details", className: "sf:mt-20 sf:grid sf:gap-6 sf:border-t sf:border-line sf:pt-12 sf:lg:grid-cols-[16rem_minmax(0,1fr)] sf:lg:gap-14", children: [_jsx("h2", { id: "sf-details", className: "sf:text-2xl sf:font-semibold sf:tracking-tight sf:text-ink", children: t("storefront.details") }), _jsx("div", { className: "sf-prose sf:max-w-measure", children: _jsx(StreamField, { blocks: record.description, ...stream }) })] })), more.length > 0 && (_jsxs("section", { "aria-labelledby": "sf-more", className: "sf:mt-20", children: [_jsx(SectionHeading, { id: "sf-more", title: t("storefront.youMayLike") }), _jsx(ProductGrid, { products: more, props: props, empty: "" })] }))] }));
136
+ }
137
+ function PageHeading({ title, record, back }) {
138
+ return (_jsxs("header", { className: "sf:mb-10 sf:flex sf:flex-col sf:items-start sf:gap-4", children: [back, _jsx("h1", { className: "sf:text-4xl sf:font-semibold sf:tracking-tight sf:text-ink sf:sm:text-5xl", children: title }), record?.intro !== undefined && record?.intro !== null && _jsx("div", { className: "sf-prose sf:max-w-2xl sf:text-muted", children: _jsx(RichText, { doc: record.intro }) })] }));
139
+ }
140
+ /** The cart is the shop plugin's, laid out in two columns by theme.css: lines, then where it goes and the total. */
141
+ function CartPage(props) {
142
+ const { record, t, words } = props;
143
+ return (_jsxs("main", { className: cx(container, "sf:pt-10 sf:lg:pt-14"), children: [_jsx(PageHeading, { title: text(record?.title) || t("shop.yourCart"), record: record, back: _jsxs("a", { href: shopHref(props), className: "sf:inline-flex sf:items-center sf:gap-1 sf:text-sm sf:font-medium sf:text-muted sf:no-underline sf:hover:text-ink", children: [_jsx(ChevronLeft, { className: "sf:size-4 sf:rtl:-scale-x-100" }), t("storefront.back")] }) }), _jsx("div", { className: "sf-cart", children: _jsx(ShopCart, { words: words ? pickWords(words, "shop") : undefined }) })] }));
144
+ }
145
+ /** The signed-in customer's orders, read as them, as the shop plugin lists them. */
146
+ function OrdersPage(props) {
147
+ const { record, data, fileUrl, t, words } = props;
148
+ return (_jsxs("main", { className: cx(container, "sf:max-w-4xl sf:pt-10 sf:lg:pt-14"), children: [_jsx(PageHeading, { title: text(record?.title) || t("shop.yourOrders"), record: record }), _jsxs("div", { className: "sf-orders", children: [_jsx(OrderReturn, { words: words ? pickWords(words, "shop") : undefined }), _jsx(OrderList, { orders: items(data.orders), fileUrl: fileUrl, words: words })] })] }));
149
+ }
150
+ /** Any other page, such as About. */
151
+ function Page({ record, stream }) {
152
+ if (!record)
153
+ return null;
154
+ return (_jsx("main", { className: cx(container, "sf:max-w-3xl sf:pt-12 sf:lg:pt-16"), children: _jsxs("article", { children: [_jsx("h1", { className: "sf:mb-8 sf:text-4xl sf:font-semibold sf:tracking-tight sf:text-ink sf:sm:text-5xl", children: text(record.title) || text(record.name) }), _jsx("div", { className: "sf-prose", children: _jsx(StreamField, { blocks: record.body, ...stream }) })] }) }));
155
+ }
156
+ /**
157
+ * Categories have a name rather than a title. Only fills what the CMS's defaults (seo_title,
158
+ * title, seo_description, summary) would leave empty.
159
+ */
160
+ function metadata({ record }) {
161
+ if (!record)
162
+ return {};
163
+ return {
164
+ title: !text(record.seo_title) && !text(record.title) ? text(record.name) || undefined : undefined,
165
+ description: !text(record.seo_description) && !text(record.summary) ? text(record.description) || undefined : undefined,
166
+ };
167
+ }
168
+ export default defineThemeComponents({
169
+ // The shop's blocks (product grids, add to cart) come from the plugin and are restyled in theme.css.
170
+ templates: { home: Front, "shop-store": Front, "shop-categories": Category, "shop-products": Product, "shop-cart": CartPage, "shop-account": OrdersPage, default: Page },
171
+ layouts: { default: Layout },
172
+ metadata,
173
+ fontClassName: font.variable,
174
+ messages,
175
+ });
package/schema.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "version": 1,
3
+ "collections": [
4
+ {
5
+ "slug": "site-menu",
6
+ "name": "Menu",
7
+ "description": "Links shown at the top of every page.",
8
+ "type": "singleton",
9
+ "urlPattern": null,
10
+ "rules": {
11
+ "listRule": "",
12
+ "viewRule": "",
13
+ "createRule": null,
14
+ "updateRule": null,
15
+ "deleteRule": null
16
+ },
17
+ "fields": [
18
+ {
19
+ "name": "items",
20
+ "type": "stream",
21
+ "config": {
22
+ "allowedBlocks": [
23
+ "menu_item"
24
+ ]
25
+ }
26
+ }
27
+ ]
28
+ }
29
+ ],
30
+ "blocks": []
31
+ }
package/styles.css ADDED
@@ -0,0 +1,308 @@
1
+ /*
2
+ * Storefront theme. The source of theme.css: run `npm run build -w @tansy/theme-storefront`
3
+ * after changing a class name in a .tsx file or anything here. The site loads the built
4
+ * theme.css, so a site using the theme needs no Tailwind of its own.
5
+ *
6
+ * Every utility starts with `sf:` and there is no global reset, so nothing here reaches the
7
+ * dashboard or another plugin's page. Colours, radii and sizes are the --site-* tokens from
8
+ * index.ts, so the accent under Settings, or a site's own tokens, restyle the theme.
9
+ */
10
+
11
+ @layer theme, base, components, utilities;
12
+ @import "tailwindcss/theme.css" layer(theme) prefix(sf);
13
+ @import "tailwindcss/utilities.css" layer(utilities) source(none);
14
+
15
+ @source "./render.tsx";
16
+ @source "./client.tsx";
17
+ @source "./icons.tsx";
18
+
19
+ @theme inline {
20
+ --color-page: var(--site-color-page);
21
+ --color-surface: var(--site-color-surface);
22
+ --color-ink: var(--site-color-text);
23
+ --color-muted: var(--site-color-muted);
24
+ --color-line: var(--site-color-border);
25
+ --color-accent: var(--site-color-accent);
26
+ --color-on-accent: var(--site-color-on-accent);
27
+ --font-sans: var(--site-font-body);
28
+ --container-wide: var(--site-size-wide);
29
+ --container-measure: var(--site-size-measure);
30
+ --spacing-gutter: var(--site-space-gutter);
31
+ --radius-card: var(--site-radius-card);
32
+ --shadow-card: var(--site-shadow-card);
33
+ }
34
+
35
+ /* ------------------------------------------------------------ foundations */
36
+
37
+ /* The header runs edge to edge, so drop the browser's body margin, on this theme's pages only. */
38
+ body:has(.site-root[data-theme="storefront"]) { margin: 0; }
39
+
40
+ .sf-shell {
41
+ line-height: 1.5;
42
+ text-rendering: optimizeLegibility;
43
+ color-scheme: light;
44
+ }
45
+
46
+ @media (min-width: 64rem) {
47
+ .sf-shell { --site-space-gutter: 2.5rem; }
48
+ }
49
+
50
+ /* Dark colours, unless the site chose "light". Neutrals only: the accent stays the owner's. */
51
+ @media (prefers-color-scheme: dark) {
52
+ .sf-shell[data-scheme="auto"] {
53
+ --site-color-page: #0d0f0e;
54
+ --site-color-surface: #181b1a;
55
+ --site-color-text: #f1f3f2;
56
+ --site-color-muted: #9aa19e;
57
+ --site-color-border: #262b29;
58
+ --site-shadow-card: 0 18px 48px rgba(0, 0, 0, 0.45);
59
+ color-scheme: dark;
60
+ }
61
+ }
62
+
63
+ /* A reset for the theme's own markup, with no specificity, so any utility or plugin style wins. */
64
+ @layer base {
65
+ :where(.sf-shell) *, :where(.sf-shell) ::before, :where(.sf-shell) ::after { box-sizing: border-box; }
66
+ :where(.sf-shell) :where(h1, h2, h3, h4, p, figure, blockquote, dl, dd) { margin: 0; }
67
+ :where(.sf-shell) :where(h1, h2, h3, h4) { font-size: inherit; font-weight: inherit; }
68
+ :where(.sf-shell) :where(ul, ol) { list-style: none; margin: 0; padding: 0; }
69
+ :where(.sf-shell) :where(a) { color: inherit; text-decoration: inherit; }
70
+ :where(.sf-shell) :where(img, svg, video) { display: block; max-width: 100%; }
71
+ :where(.sf-shell) :where(button, input, select, textarea) { font: inherit; color: inherit; background: transparent; border: 0; margin: 0; padding: 0; }
72
+ :where(.sf-shell) :where(button, summary, [role="button"]) { cursor: pointer; }
73
+ :where(.sf-shell) :where(fieldset) { margin: 0; padding: 0; border: 0; min-width: 0; }
74
+ :where(.sf-shell) :where(summary) { list-style: none; }
75
+ :where(.sf-shell) :where(summary)::-webkit-details-marker { display: none; }
76
+ :where(.sf-shell) :where([hidden]:not([hidden="until-found"])) { display: none !important; }
77
+ }
78
+
79
+ /* ------------------------------------------------------------- components */
80
+
81
+ @layer components {
82
+ /* The site menu. Its markup is the CMS's <Menu>: nested lists of links. */
83
+ .sf-menu > ul { display: flex; align-items: center; gap: 0.25rem; }
84
+ .sf-menu li { position: relative; }
85
+ .sf-menu a {
86
+ display: inline-flex;
87
+ align-items: center;
88
+ padding: 0.5rem 1rem;
89
+ border-radius: 999px;
90
+ font-size: 0.9375rem;
91
+ font-weight: 500;
92
+ color: var(--site-color-muted);
93
+ transition: color 0.15s, background-color 0.15s;
94
+ }
95
+ .sf-menu a:hover, .sf-menu a:focus-visible { color: var(--site-color-text); background: var(--site-color-surface); outline: none; }
96
+ .sf-menu a[aria-current="page"] { color: var(--site-color-text); }
97
+ .sf-menu li > ul {
98
+ position: absolute;
99
+ inset-block-start: 100%;
100
+ inset-inline-start: 0;
101
+ z-index: 40;
102
+ display: grid;
103
+ min-width: 13rem;
104
+ margin-top: 0.5rem;
105
+ padding: 0.5rem;
106
+ border: 1px solid var(--site-color-border);
107
+ border-radius: 1.5rem;
108
+ background: var(--site-color-page);
109
+ box-shadow: var(--site-shadow-card);
110
+ opacity: 0;
111
+ visibility: hidden;
112
+ translate: 0 0.25rem;
113
+ transition: opacity 0.15s, translate 0.15s, visibility 0.15s;
114
+ }
115
+ /* Bridges the gap, so the pointer can reach the dropdown. */
116
+ .sf-menu li > ul::before { content: ""; position: absolute; inset: -0.75rem 0 auto; height: 0.75rem; }
117
+ .sf-menu li:hover > ul, .sf-menu li:focus-within > ul { opacity: 1; visibility: visible; translate: 0; }
118
+ .sf-menu li > ul a { display: flex; width: 100%; border-radius: 1rem; }
119
+
120
+ .sf-menu-stacked > ul { flex-direction: column; align-items: stretch; }
121
+ .sf-menu-stacked a { display: flex; font-size: 1rem; }
122
+ .sf-menu-stacked li > ul,
123
+ .sf-menu-footer li > ul { position: static; margin: 0; padding: 0 0 0 1rem; border: 0; box-shadow: none; background: none; opacity: 1; visibility: visible; translate: 0; }
124
+ .sf-menu-footer > ul { flex-wrap: wrap; align-items: flex-start; gap: 0.25rem 0.5rem; }
125
+ .sf-menu-footer a { padding-inline: 0.75rem; }
126
+
127
+ /* Icon buttons that open a panel, such as the language menu. */
128
+ .sf-popover > summary { list-style: none; }
129
+ .sf-popover[open] > summary { border-color: var(--site-color-text); }
130
+
131
+ .sf-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 3.5rem; color: var(--site-color-muted); font-size: 0.875rem; }
132
+ .sf-pager a {
133
+ display: inline-flex;
134
+ align-items: center;
135
+ height: 2.75rem;
136
+ padding: 0 1.25rem;
137
+ border: 1px solid var(--site-color-border);
138
+ border-radius: 999px;
139
+ color: var(--site-color-text);
140
+ font-weight: 500;
141
+ transition: border-color 0.15s;
142
+ }
143
+ .sf-pager a:hover { border-color: var(--site-color-text); }
144
+
145
+ /* Owners' writing: page bodies, product descriptions and the shop page's introduction. */
146
+ .sf-prose { color: var(--site-color-text); line-height: 1.75; }
147
+ .sf-prose > * + * { margin-top: 1.25em; }
148
+ .sf-prose :where(h2) { margin-top: 2em; font-size: 1.5rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
149
+ .sf-prose :where(h3) { margin-top: 1.75em; font-size: 1.25rem; font-weight: 600; }
150
+ .sf-prose :where(a) { color: var(--site-color-accent); text-decoration: underline; text-underline-offset: 0.2em; }
151
+ .sf-prose :where(ul) { list-style: disc; padding-inline-start: 1.25em; }
152
+ .sf-prose :where(ol) { list-style: decimal; padding-inline-start: 1.25em; }
153
+ .sf-prose :where(li + li) { margin-top: 0.375em; }
154
+ .sf-prose :where(blockquote) { padding-inline-start: 1.25em; border-inline-start: 3px solid var(--site-color-accent); color: var(--site-color-muted); font-size: 1.125em; }
155
+ .sf-prose :where(img) { border-radius: var(--site-radius-card); }
156
+ .sf-prose :where(code) { padding: 0.15em 0.4em; border-radius: 0.375rem; background: var(--site-color-surface); font-size: 0.9em; }
157
+ .sf-prose :where(pre) { overflow-x: auto; padding: 1.25rem; border-radius: 1.25rem; background: var(--site-color-surface); }
158
+ .sf-prose :where(pre code) { padding: 0; background: none; }
159
+ .sf-prose :where(hr) { border: 0; border-top: 1px solid var(--site-color-border); }
160
+ }
161
+
162
+ /* ------------------------------------------------------- the shop's parts */
163
+
164
+ /*
165
+ * The cart, orders and the shop's blocks are the shop plugin's components, styled by its
166
+ * shop.css. These rules sit outside any layer, as shop.css does, and start at .sf-shell so
167
+ * they win over it whichever file loads first.
168
+ */
169
+
170
+ .sf-shell .shop-count {
171
+ position: absolute;
172
+ inset-block-start: -0.3rem;
173
+ inset-inline-end: -0.3rem;
174
+ display: grid;
175
+ place-items: center;
176
+ min-width: 1.375rem;
177
+ height: 1.375rem;
178
+ padding: 0 0.3rem;
179
+ border: 2px solid var(--site-color-page);
180
+ border-radius: 999px;
181
+ background: var(--site-color-accent);
182
+ color: var(--site-color-on-accent);
183
+ font-size: 0.6875rem;
184
+ font-weight: 600;
185
+ line-height: 1;
186
+ }
187
+
188
+ .sf-shell .shop-button {
189
+ display: inline-flex;
190
+ align-items: center;
191
+ justify-content: center;
192
+ height: 3.5rem;
193
+ padding: 0 2rem;
194
+ border-radius: 999px;
195
+ font-weight: 600;
196
+ transition: filter 0.15s, transform 0.15s;
197
+ }
198
+ .sf-shell .shop-button:not(:disabled):hover { filter: brightness(1.1); }
199
+ .sf-shell .shop-button:not(:disabled):active { transform: scale(0.98); }
200
+ .sf-shell .shop-button:focus-visible { outline: 2px solid var(--site-color-accent); outline-offset: 2px; }
201
+ .sf-shell .shop-link-button { font-size: 0.875rem; color: var(--site-color-muted); text-underline-offset: 0.2em; }
202
+ .sf-shell .shop-link-button:hover { color: var(--site-color-text); }
203
+ .sf-shell .shop-muted { color: var(--site-color-muted); }
204
+ .sf-shell .shop-notice { padding: 1rem 1.25rem; border-radius: 1.25rem; border-color: var(--site-color-border); }
205
+ .sf-shell .shop-field input,
206
+ .sf-shell .shop-field select {
207
+ height: 3rem;
208
+ padding: 0 1rem;
209
+ border: 1px solid var(--site-color-border);
210
+ border-radius: 1rem;
211
+ background: var(--site-color-page);
212
+ }
213
+ .sf-shell .shop-field input:focus,
214
+ .sf-shell .shop-field select:focus,
215
+ .sf-shell .shop-qty input:focus { outline: none; border-color: var(--site-color-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--site-color-accent) 15%, transparent); }
216
+ .sf-shell .shop-field > span { font-size: 0.875rem; font-weight: 500; color: var(--site-color-muted); }
217
+
218
+ /* The cart: lines on the left, and on wide screens a panel on the right with where it goes and the total. */
219
+ .sf-cart .shop-cart { position: relative; isolation: isolate; gap: 1.5rem; }
220
+ .sf-cart .shop-lines { border-top: 1px solid var(--site-color-border); }
221
+ .sf-cart .shop-line {
222
+ grid-template-columns: 6rem minmax(0, 1fr) auto;
223
+ grid-template-areas: "thumb main total" "thumb qty remove";
224
+ gap: 0.75rem 1.5rem;
225
+ padding: 1.5rem 0;
226
+ border-color: var(--site-color-border);
227
+ }
228
+ .sf-cart .shop-line .shop-thumb {
229
+ width: 6rem;
230
+ height: 7.5rem;
231
+ padding: 0.5rem;
232
+ border-radius: 999px;
233
+ object-fit: contain;
234
+ background: var(--site-color-surface);
235
+ }
236
+ .sf-cart .shop-line-main { align-self: end; }
237
+ .sf-cart .shop-line-main a { color: var(--site-color-text); font-size: 1.125rem; font-weight: 600; text-decoration: none; }
238
+ .sf-cart .shop-line-main a:hover { color: var(--site-color-accent); }
239
+ .sf-cart .shop-line-total { align-self: end; font-size: 1.25rem; font-weight: 600; }
240
+ .sf-cart .shop-qty { align-self: start; }
241
+ .sf-cart .shop-qty input {
242
+ width: 5.5rem;
243
+ height: 2.75rem;
244
+ padding: 0 0.75rem;
245
+ border: 1px solid transparent;
246
+ border-radius: 999px;
247
+ background: var(--site-color-surface);
248
+ text-align: center;
249
+ font-weight: 600;
250
+ }
251
+ .sf-cart .shop-line .shop-link-button { align-self: start; padding-top: 0.6rem; }
252
+ .sf-cart .shop-address { gap: 1rem; }
253
+ .sf-cart .shop-address legend { margin-bottom: 1rem; font-size: 1.125rem; font-weight: 600; }
254
+ .sf-cart .shop-totals { gap: 0.625rem; }
255
+ .sf-cart .shop-totals dt { color: var(--site-color-muted); }
256
+ .sf-cart .shop-grand { margin-top: 0.5rem; padding-top: 1rem; border-color: var(--site-color-border); font-size: 1.375rem; }
257
+ .sf-cart .shop-grand dt { color: var(--site-color-text); }
258
+ .sf-cart .shop-cart > .shop-button { width: 100%; }
259
+
260
+ @media (min-width: 64rem) {
261
+ /* No row gap: the lines span every row, and empty rows would each add one. */
262
+ .sf-cart .shop-cart { grid-template-columns: minmax(0, 1fr) 26rem; column-gap: 4rem; row-gap: 0; align-items: start; }
263
+ .sf-cart .shop-cart > .shop-lines { grid-column: 1; grid-row: 1 / span 12; }
264
+ .sf-cart .shop-cart > :not(.shop-lines) { grid-column: 2; margin: 1.25rem 2rem 0; }
265
+ .sf-cart .shop-cart > .shop-lines + * { margin-top: 2rem; }
266
+ .sf-cart .shop-cart > :last-child { margin-bottom: 2rem; }
267
+ .sf-cart .shop-cart > .shop-button { width: auto; }
268
+ /* The panel behind the right-hand column. Positioned, so it takes no grid cell. */
269
+ .sf-cart .shop-cart::before {
270
+ content: "";
271
+ position: absolute;
272
+ grid-column: 2;
273
+ inset: 0;
274
+ z-index: -1;
275
+ border-radius: var(--site-radius-card);
276
+ background: var(--site-color-surface);
277
+ }
278
+ .sf-cart .shop-cart .shop-field input,
279
+ .sf-cart .shop-cart .shop-field select { background: var(--site-color-page); }
280
+ }
281
+
282
+ @media (max-width: 560px) {
283
+ .sf-cart .shop-line { grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: 0.5rem 1rem; }
284
+ .sf-cart .shop-line .shop-thumb { width: 4.5rem; height: 5.5rem; }
285
+ }
286
+
287
+ /* Orders. */
288
+ .sf-orders .shop-orders { gap: 1.25rem; }
289
+ .sf-orders .shop-order {
290
+ gap: 1rem;
291
+ padding: 1.75rem;
292
+ border-color: var(--site-color-border);
293
+ border-radius: var(--site-radius-card);
294
+ background: var(--site-color-page);
295
+ }
296
+ .sf-orders .shop-order h2 { font-size: 1.25rem; font-weight: 600; }
297
+ .sf-orders .shop-state { padding: 0.125rem 0.75rem; font-weight: 500; }
298
+ .sf-orders .shop-order-lines li { padding: 0.375rem 0; border-bottom: 1px dashed var(--site-color-border); }
299
+ .sf-orders .shop-grand { border-color: var(--site-color-border); }
300
+ .sf-orders .shop-downloads a { color: var(--site-color-accent); font-weight: 500; }
301
+
302
+ /* The shop's product grid block, on any page. */
303
+ .sf-shell .shop-block h2 { margin-bottom: 1.5rem; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; }
304
+ .sf-shell .shop-grid { gap: 2.5rem 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); list-style: none; padding: 0; }
305
+ .sf-shell .shop-card a { gap: 1rem; text-decoration: none; }
306
+ .sf-shell .shop-card-image { aspect-ratio: 4 / 5; padding: 12%; border-radius: 3rem; object-fit: contain; background: var(--site-color-surface); }
307
+ .sf-shell .shop-card-title { font-weight: 500; }
308
+ .sf-shell .shop-card .shop-price { font-size: 1.125rem; font-weight: 600; }