create-abcart-theme 0.10.1 → 1.0.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/CHANGELOG.md +133 -127
- package/LICENSE +202 -202
- package/NOTICE +2 -2
- package/README.md +65 -65
- package/bin/create-abcart-theme.mjs +4 -4
- package/package.json +49 -49
- package/src/args.mjs +113 -113
- package/src/banner.mjs +21 -21
- package/src/cli.mjs +119 -119
- package/src/create.mjs +85 -82
- package/src/package-manager.mjs +32 -32
- package/src/style.mjs +17 -17
- package/templates/default/.agents/skills/{wocart-docs → abcart-docs}/SKILL.md +146 -146
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/SKILL.md +58 -58
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/inputs-and-rights.md +47 -47
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/layout-rtl-and-phone.md +36 -36
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/measure-the-design.md +60 -60
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/tokens-sections-content.md +103 -103
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/verify-and-report.md +102 -102
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/scripts/compare-design.cjs +230 -230
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/scripts/qa-pages.cjs +219 -219
- package/templates/default/.agents/skills/shopify-theme-asset-collector/SKILL.md +125 -125
- package/templates/default/.agents/skills/shopify-theme-asset-collector/scripts/collect_public_assets.py +370 -370
- package/templates/default/.dev.vars.example +12 -12
- package/templates/default/AGENTS.md +240 -240
- package/templates/default/README.md +184 -184
- package/templates/default/_gitignore +11 -11
- package/templates/default/astro.config.mjs +85 -85
- package/templates/default/package.json +36 -36
- package/templates/default/public/fonts/OFL.txt +96 -96
- package/templates/default/src/actions/index.ts +22 -22
- package/templates/default/src/components/cart/AddToCartButton.astro +45 -45
- package/templates/default/src/components/cart/CartDrawer.astro +47 -47
- package/templates/default/src/components/cart/CartSummary.astro +11 -11
- package/templates/default/src/components/cart/FreeShipping.astro +7 -7
- package/templates/default/src/components/checkout/CheckoutMain.astro +29 -29
- package/templates/default/src/components/checkout/OrderForm.astro +280 -280
- package/templates/default/src/components/checkout/ThankYouMain.astro +68 -68
- package/templates/default/src/components/landing/LandingImages.astro +51 -51
- package/templates/default/src/components/landing/LandingOrder.astro +46 -46
- package/templates/default/src/components/landing/LandingProduct.astro +41 -41
- package/templates/default/src/components/listing/ListingMain.astro +93 -93
- package/templates/default/src/components/listing/PageMain.astro +52 -52
- package/templates/default/src/components/listing/Pagination.astro +31 -31
- package/templates/default/src/components/listing/SortControl.astro +35 -35
- package/templates/default/src/components/product/BuyBox.astro +96 -96
- package/templates/default/src/components/product/Description.astro +24 -24
- package/templates/default/src/components/product/Gallery.astro +66 -66
- package/templates/default/src/components/product/MobileBuyBar.astro +29 -29
- package/templates/default/src/components/product/OfferChoice.astro +66 -66
- package/templates/default/src/components/product/ProductMain.astro +40 -40
- package/templates/default/src/components/product/ProductReviews.astro +72 -72
- package/templates/default/src/components/product/RelatedProducts.astro +30 -30
- package/templates/default/src/components/product/blocks/BenefitsBlock.astro +13 -13
- package/templates/default/src/components/product/blocks/CollapsibleBlock.astro +20 -20
- package/templates/default/src/components/product/blocks/DescriptionBlock.astro +19 -19
- package/templates/default/src/components/product/blocks/DetailsBlock.astro +33 -33
- package/templates/default/src/components/product/blocks/GalleryBlock.astro +12 -12
- package/templates/default/src/components/product/blocks/OrderBlock.astro +30 -30
- package/templates/default/src/components/product/blocks/PriceBlock.astro +23 -23
- package/templates/default/src/components/product/blocks/RatingBlock.astro +16 -16
- package/templates/default/src/components/product/blocks/StockBlock.astro +22 -22
- package/templates/default/src/components/product/blocks/TextBlock.astro +11 -11
- package/templates/default/src/components/product/blocks/TitleBlock.astro +20 -20
- package/templates/default/src/components/reviews/ReviewCard.astro +46 -46
- package/templates/default/src/components/reviews/ReviewForm.astro +113 -113
- package/templates/default/src/components/reviews/VoiceNote.astro +60 -60
- package/templates/default/src/components/sections/CollectionCards.astro +65 -65
- package/templates/default/src/components/sections/Countdown.astro +57 -57
- package/templates/default/src/components/sections/Faq.astro +44 -44
- package/templates/default/src/components/sections/FeaturedProduct.astro +71 -71
- package/templates/default/src/components/sections/Hero.astro +99 -99
- package/templates/default/src/components/sections/ImageBanner.astro +46 -46
- package/templates/default/src/components/sections/ProductGrid.astro +47 -47
- package/templates/default/src/components/sections/RichText.astro +35 -35
- package/templates/default/src/components/sections/Steps.astro +46 -46
- package/templates/default/src/components/sections/Testimonials.astro +57 -57
- package/templates/default/src/components/shell/Footer.astro +80 -80
- package/templates/default/src/components/shell/Header.astro +89 -89
- package/templates/default/src/components/shell/LanguageMenu.astro +33 -33
- package/templates/default/src/components/shell/MobileMenu.astro +65 -65
- package/templates/default/src/components/shell/SearchDialog.astro +19 -19
- package/templates/default/src/components/shell/TopBar.astro +54 -54
- package/templates/default/src/components/shell/WhatsAppWidget.astro +111 -111
- package/templates/default/src/components/store/ContactMain.astro +79 -79
- package/templates/default/src/components/store/SearchMain.astro +56 -56
- package/templates/default/src/components/store/TrackOrderMain.astro +161 -161
- package/templates/default/src/components/surface/Area.astro +20 -20
- package/templates/default/src/components/surface/PreviewBridge.astro +24 -24
- package/templates/default/src/components/surface/Sections.astro +35 -35
- package/templates/default/src/components/ui/Breadcrumbs.astro +36 -36
- package/templates/default/src/components/ui/Button.astro +45 -45
- package/templates/default/src/components/ui/EditorPlaceholder.astro +24 -24
- package/templates/default/src/components/ui/Icon.astro +93 -93
- package/templates/default/src/components/ui/Logo.astro +36 -36
- package/templates/default/src/components/ui/Photo.astro +46 -46
- package/templates/default/src/components/ui/Price.astro +24 -24
- package/templates/default/src/components/ui/ProductCard.astro +41 -41
- package/templates/default/src/components/ui/Rating.astro +22 -22
- package/templates/default/src/components/ui/Section.astro +34 -34
- package/templates/default/src/components/ui/SectionHeading.astro +19 -19
- package/templates/default/src/env.d.ts +23 -23
- package/templates/default/src/layouts/StoreLayout.astro +145 -145
- package/templates/default/src/lib/browser-copy.ts +37 -37
- package/templates/default/src/lib/context.ts +89 -89
- package/templates/default/src/lib/coupon-notice.ts +47 -47
- package/templates/default/src/lib/i18n.ts +32 -32
- package/templates/default/src/lib/images.ts +38 -38
- package/templates/default/src/lib/listing-query.ts +41 -41
- package/templates/default/src/lib/money.ts +16 -16
- package/templates/default/src/lib/motion.ts +16 -16
- package/templates/default/src/lib/nav.ts +26 -26
- package/templates/default/src/lib/offer-tiles.ts +105 -105
- package/templates/default/src/lib/order-outcome.ts +66 -66
- package/templates/default/src/lib/otp-message.ts +21 -21
- package/templates/default/src/lib/products.ts +38 -38
- package/templates/default/src/lib/review-refusals.ts +31 -31
- package/templates/default/src/lib/store.ts +31 -31
- package/templates/default/src/lib/whatsapp.ts +29 -29
- package/templates/default/src/middleware.ts +23 -23
- package/templates/default/src/pages/404.astro +22 -22
- package/templates/default/src/pages/{wocart-preview.astro → abcart-preview.astro} +43 -43
- package/templates/default/src/pages/{wocart-revalidate.ts → abcart-revalidate.ts} +10 -10
- package/templates/default/src/pages/{wocart-styles.css.ts → abcart-styles.css.ts} +5 -5
- package/templates/default/src/pages/{wocart-theme.json.ts → abcart-theme.json.ts} +5 -5
- package/templates/default/src/pages/api/abandoned/convert.ts +4 -4
- package/templates/default/src/pages/api/abandoned/upsert.ts +4 -4
- package/templates/default/src/pages/api/cart/validate.ts +4 -4
- package/templates/default/src/pages/api/communes/[wilayaId].ts +4 -4
- package/templates/default/src/pages/api/otp/send.ts +4 -4
- package/templates/default/src/pages/api/otp/verify.ts +4 -4
- package/templates/default/src/pages/api/reviews/[productId].ts +3 -3
- package/templates/default/src/pages/api/reviews/eligibility.ts +3 -3
- package/templates/default/src/pages/api/reviews/submit.ts +3 -3
- package/templates/default/src/pages/api/reviews/upload.ts +3 -3
- package/templates/default/src/pages/category/[slug].astro +20 -20
- package/templates/default/src/pages/checkout.astro +25 -25
- package/templates/default/src/pages/collections/[handle].astro +20 -20
- package/templates/default/src/pages/contact.astro +17 -17
- package/templates/default/src/pages/index.astro +9 -9
- package/templates/default/src/pages/lp/[slug].astro +47 -47
- package/templates/default/src/pages/pages/[slug].astro +16 -16
- package/templates/default/src/pages/products/[handle].astro +37 -37
- package/templates/default/src/pages/products/index.astro +15 -15
- package/templates/default/src/pages/robots.txt.ts +9 -9
- package/templates/default/src/pages/search.astro +19 -19
- package/templates/default/src/pages/sitemap.xml.ts +12 -12
- package/templates/default/src/pages/thank-you.astro +33 -33
- package/templates/default/src/pages/track-order.astro +17 -17
- package/templates/default/src/scripts/cart.ts +371 -371
- package/templates/default/src/scripts/checkout/coupon.ts +96 -96
- package/templates/default/src/scripts/checkout/delivery.ts +86 -86
- package/templates/default/src/scripts/checkout/form.ts +54 -54
- package/templates/default/src/scripts/checkout/otp.ts +106 -106
- package/templates/default/src/scripts/checkout/picker.ts +169 -169
- package/templates/default/src/scripts/checkout/quote.ts +169 -169
- package/templates/default/src/scripts/checkout/submit.ts +113 -113
- package/templates/default/src/scripts/checkout/tracking.ts +74 -74
- package/templates/default/src/scripts/countdown.ts +29 -29
- package/templates/default/src/scripts/events.ts +4 -4
- package/templates/default/src/scripts/hero.ts +49 -49
- package/templates/default/src/scripts/listing.ts +13 -13
- package/templates/default/src/scripts/order-form.ts +100 -100
- package/templates/default/src/scripts/product.ts +306 -306
- package/templates/default/src/scripts/public-config.ts +79 -79
- package/templates/default/src/scripts/reviews.ts +358 -358
- package/templates/default/src/scripts/site.ts +131 -131
- package/templates/default/src/scripts/thank-you.ts +11 -11
- package/templates/default/src/scripts/voice-note.ts +94 -94
- package/templates/default/src/styles/base.css +1030 -1030
- package/templates/default/src/styles/checkout.css +1111 -1111
- package/templates/default/src/styles/global.css +12 -12
- package/templates/default/src/styles/product.css +871 -871
- package/templates/default/src/styles/reviews.css +533 -533
- package/templates/default/src/styles/sections.css +931 -931
- package/templates/default/src/styles/shell.css +970 -970
- package/templates/default/src/styles/tokens.css +583 -583
- package/templates/default/src/theme/api-routes.ts +10 -10
- package/templates/default/src/theme/content/catalog.ts +117 -117
- package/templates/default/src/theme/content/checkout.ts +168 -168
- package/templates/default/src/theme/content/editor.ts +21 -21
- package/templates/default/src/theme/content/index.ts +45 -45
- package/templates/default/src/theme/content/reviews.ts +76 -76
- package/templates/default/src/theme/content/shell.ts +59 -59
- package/templates/default/src/theme/content/types.ts +12 -12
- package/templates/default/src/theme/documents/catalog.json +11 -11
- package/templates/default/src/theme/documents/category.json +11 -11
- package/templates/default/src/theme/documents/checkout.json +11 -11
- package/templates/default/src/theme/documents/collection.json +11 -11
- package/templates/default/src/theme/documents/contact.json +11 -11
- package/templates/default/src/theme/documents/footer.area.json +11 -11
- package/templates/default/src/theme/documents/header.area.json +16 -16
- package/templates/default/src/theme/documents/home.json +313 -313
- package/templates/default/src/theme/documents/landing.json +8 -8
- package/templates/default/src/theme/documents/page.json +11 -11
- package/templates/default/src/theme/documents/product.json +125 -125
- package/templates/default/src/theme/documents/search.json +11 -11
- package/templates/default/src/theme/documents/thank-you.json +11 -11
- package/templates/default/src/theme/documents/track-order.json +11 -11
- package/templates/default/src/theme/fields.ts +61 -61
- package/templates/default/src/theme/key.ts +11 -11
- package/templates/default/src/theme/labels.ts +231 -231
- package/templates/default/src/theme/locales.ts +11 -11
- package/templates/default/src/theme/palette.ts +14 -14
- package/templates/default/src/theme/sections/collection-cards.ts +65 -65
- package/templates/default/src/theme/sections/faq.ts +74 -74
- package/templates/default/src/theme/sections/featured-product.ts +42 -42
- package/templates/default/src/theme/sections/hero.ts +47 -47
- package/templates/default/src/theme/sections/image-banner.ts +25 -25
- package/templates/default/src/theme/sections/index.ts +40 -40
- package/templates/default/src/theme/sections/landing.ts +150 -150
- package/templates/default/src/theme/sections/listing.ts +84 -84
- package/templates/default/src/theme/sections/product-grid.ts +42 -42
- package/templates/default/src/theme/sections/product.ts +297 -297
- package/templates/default/src/theme/sections/rich-text.ts +39 -39
- package/templates/default/src/theme/sections/shared.ts +54 -54
- package/templates/default/src/theme/sections/shell.ts +85 -85
- package/templates/default/src/theme/sections/store-pages.ts +101 -101
- package/templates/default/src/theme/sections/testimonials.ts +61 -61
- package/templates/default/src/theme/sections/thank-you.ts +35 -35
- package/templates/default/src/theme/settings.ts +124 -124
- package/templates/default/src/theme/theme.ts +65 -65
- package/templates/default/tests/fixtures/canvas-tote.json +62 -62
- package/templates/default/tests/fixtures/linen-shirt.json +128 -128
- package/templates/default/tests/unit/checkout.test.ts +241 -241
- package/templates/default/tests/unit/contract.test.ts +170 -169
- package/templates/default/tests/unit/contrast.test.ts +68 -68
- package/templates/default/tests/unit/copy.test.ts +101 -101
- package/templates/default/tests/unit/design-values.test.ts +95 -95
- package/templates/default/tests/unit/editability.test.ts +180 -180
- package/templates/default/tests/unit/fixtures.ts +91 -91
- package/templates/default/tests/unit/footer.test.ts +54 -54
- package/templates/default/tests/unit/guards.test.ts +340 -340
- package/templates/default/tests/unit/images.test.ts +26 -26
- package/templates/default/tests/unit/landing.test.ts +151 -151
- package/templates/default/tests/unit/languages.test.ts +42 -42
- package/templates/default/tests/unit/middleware.test.ts +53 -53
- package/templates/default/tests/unit/offer-tiles.test.ts +75 -75
- package/templates/default/tests/unit/render.ts +38 -38
- package/templates/default/tests/unit/reviews.test.ts +25 -25
- package/templates/default/tests/unit/rules.test.ts +59 -59
- package/templates/default/tests/unit/source.ts +75 -75
- package/templates/default/tests/unit/store-pages.test.ts +147 -147
- package/templates/default/tests/unit/studio.test.ts +202 -202
- package/templates/default/tests/unit/testimonials.test.ts +52 -52
- package/templates/default/tests/unit/thank-you.test.ts +52 -52
- package/templates/default/tests/unit/tracking.test.ts +29 -29
- package/templates/default/tests/unit/voice-note.test.ts +42 -42
- package/templates/default/tsconfig.json +13 -13
- package/templates/default/vitest.config.ts +15 -15
- package/templates/default/wrangler.jsonc +16 -16
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
# Tokens, sections, content and motion
|
|
2
|
-
|
|
3
|
-
## Design values become tokens
|
|
4
|
-
|
|
5
|
-
Every value in the design becomes a named token, in the place the starter keeps it. Layout geometry (gaps, padding, margins, widths, heights, insets, grid tracks) stays in the stylesheets, next to the rules it belongs to.
|
|
6
|
-
|
|
7
|
-
| Value | Where it goes |
|
|
8
|
-
| --- | --- |
|
|
9
|
-
| Colours | Named once in `src/theme/palette.ts`. The colour schemes in `src/theme/settings.ts` (`colorSchemes`) set seven roles each: `background`, `text`, `heading`, `accent`, `button`, `buttonText`, `border`. Keep the four scheme ids; add an id only for a band colour the design needs |
|
|
10
|
-
| Colour-dependent tokens | In the `:root, .
|
|
11
|
-
| Corners | `--r-xs`, `--r-sm`, `--r`, `--r-lg`, `--r-pill`. The `corners` setting picks the set: `soft` is the root set; `round` and `square` are `html[data-corners=…]` |
|
|
12
|
-
| Shadows | `--shadow-sm`, `--shadow`, `--shadow-lg` |
|
|
13
|
-
| Type | Body size and leading (`--body-size`, `--body-leading`), the weights (`--weight-medium` to `--weight-heavy`), headings (`--heading-weight`, `--heading-tracking`), display type (`--display-weight`, `--display-tracking`). The `[dir="rtl"]` block holds Arabic's own values |
|
|
14
|
-
| Any other size, line height, letter-spacing, motion, opacity, border, surface, shape or filter | A new token named for its place (below), in `src/styles/tokens.css` |
|
|
15
|
-
| Buttons and badges | `--btn-*`, `--sale`, `--sale-ink`, `--sticker-*` |
|
|
16
|
-
| Widths and room | The `style` scale in `src/theme/theme.ts` (`widths`, `spacing` `s0` to `s12`). A section's default room is its `styleField(sectionStyle(…))` (`src/theme/fields.ts`) |
|
|
17
|
-
| Product cards | The `cardRatio` and `cardButton` settings; `src/components/ui/ProductCard.astro` |
|
|
18
|
-
|
|
19
|
-
**Naming a new token.** Its name says where it is used: `--<category>-<role>`, with an optional modifier. The category is one of `text`, `leading`, `tracking`, `motion`, `opacity`, `shape`, `border`, `surface`, `shadow`, `radius`, `filter`. The role is the class of the rule (`--text-product-title`). The modifier names the media context: `-narrow` for a phone rule, `-wide` for a wide-screen one, `-touch` for touch screens, `-reduced` for reduced motion.
|
|
20
|
-
|
|
21
|
-
Search `tokens.css` first. A name is never reused for another value, and it never ends in a number: a second value for a role gets a role name, never `-2`. The phone modifier is `-narrow`, never `-phone`.
|
|
22
|
-
|
|
23
|
-
**Photos and their boxes.** A photo's crop ratio and its box's aspect ratio are one value. Crop on the server to the ratio the box shows, and keep the ratio in one place: a token for the box, and the component's ratio read from the same value.
|
|
24
|
-
|
|
25
|
-
The guard `tests/unit/design-values.test.ts` finds every literal design value in a stylesheet, every timer a script sets with a literal, and every inline style that carries a number of its own. Each failure names the file and the line. Run `npx vitest run tests/unit/design-values.test.ts -t "names every design value"`.
|
|
26
|
-
|
|
27
|
-
## Sections
|
|
28
|
-
|
|
29
|
-
Use an existing section when it fits. Restyle its component, or add a field or a `layout` option to it. The starter offers these section types:
|
|
30
|
-
|
|
31
|
-
| Section type | What it holds |
|
|
32
|
-
| --- | --- |
|
|
33
|
-
| `hero` | Up to five slides, each an `image`, a title, an accent word, a subtitle, a button and its link. It is already a slider: a second slide is a second entry, not new code |
|
|
34
|
-
| `collection-cards` | Cards that lead to collections. Layouts: tiles or large. Each card: a `collection`, an optional `image` (else the collection's photo), a custom label |
|
|
35
|
-
| `product-grid` | A collection's products, as a grid or a carousel, with a limit, columns and a "view all" link |
|
|
36
|
-
| `featured-product` | One product, large, with its order button |
|
|
37
|
-
| `image-banner` | One wide `image` with a heading, a subtitle and a button. A call to action is this section with a scheme |
|
|
38
|
-
| `testimonials` | The store's own published reviews only. A review has a customer name, rating, text, date and verified purchase; no city, no photo |
|
|
39
|
-
| `rich-text` | A title, formatted text and an optional button |
|
|
40
|
-
| `faq` | Questions and answers |
|
|
41
|
-
| `steps` | Up to four items, each an icon, a title and a line. An icon row without numbers is a style of this section |
|
|
42
|
-
| `countdown` | A countdown to the end of an offer |
|
|
43
|
-
| `announcement-bar` | The header's top bar: short messages with an icon and a link |
|
|
44
|
-
| `header` | The merchant's menu, logo, search and language menu |
|
|
45
|
-
| `footer` | The merchant's menus, an "about" text, contact details and pages, and social links |
|
|
46
|
-
|
|
47
|
-
The page-specific sections (`product-main`, `listing-main`, `checkout-main` and the others) are in `src/theme/sections/index.ts`.
|
|
48
|
-
|
|
49
|
-
**Never rename** a section type, a field key, an instance id or `THEME_KEY`. Adding is safe. Removing a section, a field or a copy key needs a new major version (`THEME_VERSION` in `src/theme/key.ts` and `version` in `package.json`).
|
|
50
|
-
|
|
51
|
-
**A new section** is needed when nothing above fits. Follow the starter's pattern:
|
|
52
|
-
|
|
53
|
-
1. A definition in `src/theme/sections/<name>.ts` with `defineComponent`: `type`, `component`, `label` and `group` from `src/theme/labels.ts`, `placement: "section"`, `capabilities` (`ANYWHERE` or `WITH_LANDING`, from `src/theme/sections/shared.ts`), and fields ending with `schemeField()` and `styleField()`. Data is read in `load`, through `reads.get(…)`.
|
|
54
|
-
2. Register it in `src/theme/sections/index.ts`.
|
|
55
|
-
3. A component in `src/components/sections/<Name>.astro` that renders through `src/components/ui/Section.astro`. A heading goes through `src/components/ui/SectionHeading.astro`. With nothing to show, it renders nothing for a shopper, and `EditorPlaceholder.astro` with a hint from `src/theme/content/editor.ts` in Studio's preview.
|
|
56
|
-
4. Its editor labels in `src/theme/labels.ts`, in ar, fr and en, and a help text for each choice that is not obvious.
|
|
57
|
-
5. Its place in the page's default document, with a new unique instance id.
|
|
58
|
-
6. Its styles in `src/styles/`, from tokens.
|
|
59
|
-
|
|
60
|
-
Every element of the design becomes a field:
|
|
61
|
-
|
|
62
|
-
| In the design | Field |
|
|
63
|
-
| --- | --- |
|
|
64
|
-
| A heading: title, accent word, line under it | `headingFields(prefix)` from `src/theme/fields.ts` |
|
|
65
|
-
| Any other visible word | A `text` or `textarea` field with a `contentKey`, the key in `src/theme/content/` in ar, fr and en |
|
|
66
|
-
| Prose | `richtext` |
|
|
67
|
-
| A photo | `image`, with no default |
|
|
68
|
-
| A count | `number` with `min` and `max` |
|
|
69
|
-
| A product, collection, category or menu | `product`, `collection`, `category`, `menu` |
|
|
70
|
-
| Repeated items | `list` with a `max` |
|
|
71
|
-
| A choice (layout, height, alignment) | `select` with `options` and `optionLabels` |
|
|
72
|
-
| A link | `url` |
|
|
73
|
-
|
|
74
|
-
The field kinds are the `FieldKind` union in the `@abcart/theme` declarations.
|
|
75
|
-
|
|
76
|
-
A new section passes the editability guard: every field reaches its component, every select has labels, every number and list is bounded, every label and help text is in each language, and every section starts from a preset that renders in each language and in Studio's preview. Run `npx vitest run tests/unit/editability.test.ts`.
|
|
77
|
-
|
|
78
|
-
## Content and claims
|
|
79
|
-
|
|
80
|
-
- **Never copy** brand names, logos, photos, prices, discounts, ratings, reviews, names of people, cities, phone numbers, addresses, guarantees, delivery reach or periods, percentages or payment logos. Write neutral copy that is true of any store, in ar, fr and en. The copy test (`tests/unit/copy.test.ts`) fails on a delivery reach, a period, a percentage, opening hours or a promised phone call.
|
|
81
|
-
- **The store supplies its facts:** products, prices, stock and discount badges (the catalogue), reviews (the `testimonials` section), the logo and name, contact details, the WhatsApp button (`src/lib/whatsapp.ts`), menus, legal pages, and the delivery fee (the order form quotes it). Show them where the design puts them; never write them into the theme.
|
|
82
|
-
- **Words of the store, in every language.** A store's products, categories, collections and menu labels are its own data, translated in the store. A design's language is not a reason to write those words into the theme.
|
|
83
|
-
- **Features the platform does not have.** The storefront has no shopper accounts, no wishlist and no online card payment; orders are cash on delivery. Leave out an account icon, a heart or card logos, and say so in the report.
|
|
84
|
-
|
|
85
|
-
Run `npx vitest run tests/unit/copy.test.ts -t "states no fact about a store"` to check the copy.
|
|
86
|
-
|
|
87
|
-
## Images
|
|
88
|
-
|
|
89
|
-
The starter ships no store photos. An `image` field has no default; the merchant picks the photo in Studio. Until then a section shows its own fallback. Photos are drawn through `src/components/ui/Photo.astro` and `src/lib/images.ts`, which ask the store's media delivery for each size. Never hot-link a photo, and never put a store photo in `public/`.
|
|
90
|
-
|
|
91
|
-
## Fonts
|
|
92
|
-
|
|
93
|
-
The starter has two families, one Arabic and one Latin, each limited to its script with `unicode-range`. The guard expects exactly two `@font-face` families, self-hosted in `public/fonts/` as `.woff2`, and rejects third-party font hosts.
|
|
94
|
-
|
|
95
|
-
- A new font needs its `@font-face` rule in `src/styles/tokens.css`, its licence line in `public/fonts/OFL.txt`, and its preload in `src/layouts/StoreLayout.astro`. The Arabic file's name contains `arabic`, the Latin file's name contains `latin`.
|
|
96
|
-
- When the design pairs a serif heading with a sans text, give the Latin family to `--font-display` (headings) and let body text take the system sans through `--font-body`.
|
|
97
|
-
|
|
98
|
-
## Motion
|
|
99
|
-
|
|
100
|
-
- Each duration, delay, distance, scale and easing is a token. A script reads a timing with `motionMs("--motion-…")` from `src/lib/motion.ts`. A behaviour timer (a debounce, a clock tick) stays literal, and the guard's allowlist names it. Run `npx vitest run tests/unit/design-values.test.ts -t "reads every timing"`.
|
|
101
|
-
- Sections rise into view through one script bound with `bindEach()`. Content is never hidden when the script does not run.
|
|
102
|
-
- Hover effects go under `(hover: hover)`. On touch, a press scale on `:active` takes their place.
|
|
103
|
-
- Everything stops under `prefers-reduced-motion`.
|
|
1
|
+
# Tokens, sections, content and motion
|
|
2
|
+
|
|
3
|
+
## Design values become tokens
|
|
4
|
+
|
|
5
|
+
Every value in the design becomes a named token, in the place the starter keeps it. Layout geometry (gaps, padding, margins, widths, heights, insets, grid tracks) stays in the stylesheets, next to the rules it belongs to.
|
|
6
|
+
|
|
7
|
+
| Value | Where it goes |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Colours | Named once in `src/theme/palette.ts`. The colour schemes in `src/theme/settings.ts` (`colorSchemes`) set seven roles each: `background`, `text`, `heading`, `accent`, `button`, `buttonText`, `border`. Keep the four scheme ids; add an id only for a band colour the design needs |
|
|
10
|
+
| Colour-dependent tokens | In the `:root, .ab-scheme` block of `src/styles/tokens.css`, so they resolve on each section that sets a scheme. A token in the plain `:root` block that reads a scheme colour resolves on the page, not the section |
|
|
11
|
+
| Corners | `--r-xs`, `--r-sm`, `--r`, `--r-lg`, `--r-pill`. The `corners` setting picks the set: `soft` is the root set; `round` and `square` are `html[data-corners=…]` |
|
|
12
|
+
| Shadows | `--shadow-sm`, `--shadow`, `--shadow-lg` |
|
|
13
|
+
| Type | Body size and leading (`--body-size`, `--body-leading`), the weights (`--weight-medium` to `--weight-heavy`), headings (`--heading-weight`, `--heading-tracking`), display type (`--display-weight`, `--display-tracking`). The `[dir="rtl"]` block holds Arabic's own values |
|
|
14
|
+
| Any other size, line height, letter-spacing, motion, opacity, border, surface, shape or filter | A new token named for its place (below), in `src/styles/tokens.css` |
|
|
15
|
+
| Buttons and badges | `--btn-*`, `--sale`, `--sale-ink`, `--sticker-*` |
|
|
16
|
+
| Widths and room | The `style` scale in `src/theme/theme.ts` (`widths`, `spacing` `s0` to `s12`). A section's default room is its `styleField(sectionStyle(…))` (`src/theme/fields.ts`) |
|
|
17
|
+
| Product cards | The `cardRatio` and `cardButton` settings; `src/components/ui/ProductCard.astro` |
|
|
18
|
+
|
|
19
|
+
**Naming a new token.** Its name says where it is used: `--<category>-<role>`, with an optional modifier. The category is one of `text`, `leading`, `tracking`, `motion`, `opacity`, `shape`, `border`, `surface`, `shadow`, `radius`, `filter`. The role is the class of the rule (`--text-product-title`). The modifier names the media context: `-narrow` for a phone rule, `-wide` for a wide-screen one, `-touch` for touch screens, `-reduced` for reduced motion.
|
|
20
|
+
|
|
21
|
+
Search `tokens.css` first. A name is never reused for another value, and it never ends in a number: a second value for a role gets a role name, never `-2`. The phone modifier is `-narrow`, never `-phone`.
|
|
22
|
+
|
|
23
|
+
**Photos and their boxes.** A photo's crop ratio and its box's aspect ratio are one value. Crop on the server to the ratio the box shows, and keep the ratio in one place: a token for the box, and the component's ratio read from the same value.
|
|
24
|
+
|
|
25
|
+
The guard `tests/unit/design-values.test.ts` finds every literal design value in a stylesheet, every timer a script sets with a literal, and every inline style that carries a number of its own. Each failure names the file and the line. Run `npx vitest run tests/unit/design-values.test.ts -t "names every design value"`.
|
|
26
|
+
|
|
27
|
+
## Sections
|
|
28
|
+
|
|
29
|
+
Use an existing section when it fits. Restyle its component, or add a field or a `layout` option to it. The starter offers these section types:
|
|
30
|
+
|
|
31
|
+
| Section type | What it holds |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `hero` | Up to five slides, each an `image`, a title, an accent word, a subtitle, a button and its link. It is already a slider: a second slide is a second entry, not new code |
|
|
34
|
+
| `collection-cards` | Cards that lead to collections. Layouts: tiles or large. Each card: a `collection`, an optional `image` (else the collection's photo), a custom label |
|
|
35
|
+
| `product-grid` | A collection's products, as a grid or a carousel, with a limit, columns and a "view all" link |
|
|
36
|
+
| `featured-product` | One product, large, with its order button |
|
|
37
|
+
| `image-banner` | One wide `image` with a heading, a subtitle and a button. A call to action is this section with a scheme |
|
|
38
|
+
| `testimonials` | The store's own published reviews only. A review has a customer name, rating, text, date and verified purchase; no city, no photo |
|
|
39
|
+
| `rich-text` | A title, formatted text and an optional button |
|
|
40
|
+
| `faq` | Questions and answers |
|
|
41
|
+
| `steps` | Up to four items, each an icon, a title and a line. An icon row without numbers is a style of this section |
|
|
42
|
+
| `countdown` | A countdown to the end of an offer |
|
|
43
|
+
| `announcement-bar` | The header's top bar: short messages with an icon and a link |
|
|
44
|
+
| `header` | The merchant's menu, logo, search and language menu |
|
|
45
|
+
| `footer` | The merchant's menus, an "about" text, contact details and pages, and social links |
|
|
46
|
+
|
|
47
|
+
The page-specific sections (`product-main`, `listing-main`, `checkout-main` and the others) are in `src/theme/sections/index.ts`.
|
|
48
|
+
|
|
49
|
+
**Never rename** a section type, a field key, an instance id or `THEME_KEY`. Adding is safe. Removing a section, a field or a copy key needs a new major version (`THEME_VERSION` in `src/theme/key.ts` and `version` in `package.json`).
|
|
50
|
+
|
|
51
|
+
**A new section** is needed when nothing above fits. Follow the starter's pattern:
|
|
52
|
+
|
|
53
|
+
1. A definition in `src/theme/sections/<name>.ts` with `defineComponent`: `type`, `component`, `label` and `group` from `src/theme/labels.ts`, `placement: "section"`, `capabilities` (`ANYWHERE` or `WITH_LANDING`, from `src/theme/sections/shared.ts`), and fields ending with `schemeField()` and `styleField()`. Data is read in `load`, through `reads.get(…)`.
|
|
54
|
+
2. Register it in `src/theme/sections/index.ts`.
|
|
55
|
+
3. A component in `src/components/sections/<Name>.astro` that renders through `src/components/ui/Section.astro`. A heading goes through `src/components/ui/SectionHeading.astro`. With nothing to show, it renders nothing for a shopper, and `EditorPlaceholder.astro` with a hint from `src/theme/content/editor.ts` in Studio's preview.
|
|
56
|
+
4. Its editor labels in `src/theme/labels.ts`, in ar, fr and en, and a help text for each choice that is not obvious.
|
|
57
|
+
5. Its place in the page's default document, with a new unique instance id.
|
|
58
|
+
6. Its styles in `src/styles/`, from tokens.
|
|
59
|
+
|
|
60
|
+
Every element of the design becomes a field:
|
|
61
|
+
|
|
62
|
+
| In the design | Field |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| A heading: title, accent word, line under it | `headingFields(prefix)` from `src/theme/fields.ts` |
|
|
65
|
+
| Any other visible word | A `text` or `textarea` field with a `contentKey`, the key in `src/theme/content/` in ar, fr and en |
|
|
66
|
+
| Prose | `richtext` |
|
|
67
|
+
| A photo | `image`, with no default |
|
|
68
|
+
| A count | `number` with `min` and `max` |
|
|
69
|
+
| A product, collection, category or menu | `product`, `collection`, `category`, `menu` |
|
|
70
|
+
| Repeated items | `list` with a `max` |
|
|
71
|
+
| A choice (layout, height, alignment) | `select` with `options` and `optionLabels` |
|
|
72
|
+
| A link | `url` |
|
|
73
|
+
|
|
74
|
+
The field kinds are the `FieldKind` union in the `@abcart/theme` declarations.
|
|
75
|
+
|
|
76
|
+
A new section passes the editability guard: every field reaches its component, every select has labels, every number and list is bounded, every label and help text is in each language, and every section starts from a preset that renders in each language and in Studio's preview. Run `npx vitest run tests/unit/editability.test.ts`.
|
|
77
|
+
|
|
78
|
+
## Content and claims
|
|
79
|
+
|
|
80
|
+
- **Never copy** brand names, logos, photos, prices, discounts, ratings, reviews, names of people, cities, phone numbers, addresses, guarantees, delivery reach or periods, percentages or payment logos. Write neutral copy that is true of any store, in ar, fr and en. The copy test (`tests/unit/copy.test.ts`) fails on a delivery reach, a period, a percentage, opening hours or a promised phone call.
|
|
81
|
+
- **The store supplies its facts:** products, prices, stock and discount badges (the catalogue), reviews (the `testimonials` section), the logo and name, contact details, the WhatsApp button (`src/lib/whatsapp.ts`), menus, legal pages, and the delivery fee (the order form quotes it). Show them where the design puts them; never write them into the theme.
|
|
82
|
+
- **Words of the store, in every language.** A store's products, categories, collections and menu labels are its own data, translated in the store. A design's language is not a reason to write those words into the theme.
|
|
83
|
+
- **Features the platform does not have.** The storefront has no shopper accounts, no wishlist and no online card payment; orders are cash on delivery. Leave out an account icon, a heart or card logos, and say so in the report.
|
|
84
|
+
|
|
85
|
+
Run `npx vitest run tests/unit/copy.test.ts -t "states no fact about a store"` to check the copy.
|
|
86
|
+
|
|
87
|
+
## Images
|
|
88
|
+
|
|
89
|
+
The starter ships no store photos. An `image` field has no default; the merchant picks the photo in Studio. Until then a section shows its own fallback. Photos are drawn through `src/components/ui/Photo.astro` and `src/lib/images.ts`, which ask the store's media delivery for each size. Never hot-link a photo, and never put a store photo in `public/`.
|
|
90
|
+
|
|
91
|
+
## Fonts
|
|
92
|
+
|
|
93
|
+
The starter has two families, one Arabic and one Latin, each limited to its script with `unicode-range`. The guard expects exactly two `@font-face` families, self-hosted in `public/fonts/` as `.woff2`, and rejects third-party font hosts.
|
|
94
|
+
|
|
95
|
+
- A new font needs its `@font-face` rule in `src/styles/tokens.css`, its licence line in `public/fonts/OFL.txt`, and its preload in `src/layouts/StoreLayout.astro`. The Arabic file's name contains `arabic`, the Latin file's name contains `latin`.
|
|
96
|
+
- When the design pairs a serif heading with a sans text, give the Latin family to `--font-display` (headings) and let body text take the system sans through `--font-body`.
|
|
97
|
+
|
|
98
|
+
## Motion
|
|
99
|
+
|
|
100
|
+
- Each duration, delay, distance, scale and easing is a token. A script reads a timing with `motionMs("--motion-…")` from `src/lib/motion.ts`. A behaviour timer (a debounce, a clock tick) stays literal, and the guard's allowlist names it. Run `npx vitest run tests/unit/design-values.test.ts -t "reads every timing"`.
|
|
101
|
+
- Sections rise into view through one script bound with `bindEach()`. Content is never hidden when the script does not run.
|
|
102
|
+
- Hover effects go under `(hover: hover)`. On touch, a press scale on `:active` takes their place.
|
|
103
|
+
- Everything stops under `prefers-reduced-motion`.
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
# Build, verify and report
|
|
2
|
-
|
|
3
|
-
## Start the project
|
|
4
|
-
|
|
5
|
-
```sh
|
|
6
|
-
npm create
|
|
7
|
-
cd my-theme
|
|
8
|
-
cp .dev.vars.example .dev.vars
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Choose the key now. `THEME_KEY` in `src/theme/key.ts` names every merchant's saved edits and never changes once a store uses the theme.
|
|
12
|
-
|
|
13
|
-
## The home page document
|
|
14
|
-
|
|
15
|
-
`src/theme/documents/home.json` lists the sections in the design's order. Words go in each section's props in ar, fr and en. Spacing and widths come from the `style` scale in `src/theme/theme.ts`, with the same room between sections. Give each band its colour scheme here, and give the header and footer theirs in the area documents. Put no photo in a document: the merchant picks photos in Studio.
|
|
16
|
-
|
|
17
|
-
Run `npm run check` and `npm test` before you open a browser. They find most mistakes faster.
|
|
18
|
-
|
|
19
|
-
## A store to see it on
|
|
20
|
-
|
|
21
|
-
An empty store shows placeholders. Set `COD_SERVER_URL` and `STORE_API_KEY` in `.dev.vars`: a store on this machine, or your own. Give a new store its own state and port when another store already runs.
|
|
22
|
-
|
|
23
|
-
- **Collections:** one per category or product grid that the home document names.
|
|
24
|
-
- **Products:** about a dozen, with photos, some compare-at prices and stock. A photo must fit its product.
|
|
25
|
-
- **Reviews:** a few approved ones.
|
|
26
|
-
- **Photos** are the store's media. Upload them through the store. A file copied into storage is not media the server serves.
|
|
27
|
-
- **Translations:** each published language needs the store's own translations of its products, categories, collections and menu labels. Without them a locale shows the primary language, and its layout cannot be judged. Add them to the store's data, never to the theme.
|
|
28
|
-
|
|
29
|
-
## Check the page, not the picture
|
|
30
|
-
|
|
31
|
-
Run the store and the theme (`npm run dev`). Then run the page QA script in every language the theme speaks:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
BASE=http://localhost:4321 LANG_CODE=ar node .agents/skills/
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The script visits every page the home page links to, plus the not-found page, checkout and track-order, at 1440 px and at 390 px. It fails on: an element wider than the viewport (outside a swipe row), a broken image, a translation key printed as text, a console error, and text below WCAG AA on the surface it is read from. It warns about a grid whose last row leaves empty columns (an odd count can be right; decide by eye). Set `CHROME` to a Chromium binary and `PLAYWRIGHT` to where Playwright loads from if the defaults do not run. Pass `FRAMES=1` to save a viewport-sized frame per scroll step, and review those frames, not a full-page capture.
|
|
38
|
-
|
|
39
|
-
Then measure the match with the design (`measure-the-design.md`, "Compare the built page with the design").
|
|
40
|
-
|
|
41
|
-
Then check by hand what no script can name:
|
|
42
|
-
|
|
43
|
-
- **Interactions.** Add a product to the cart: one drawer opens and no toast covers its first line. Change a quantity: the total follows. Apply each coupon the store has: the summary changes. A product with reviews shows them, and so does the home page.
|
|
44
|
-
- **Arabic:** the layout mirrors; nothing is cut at the edge; Arabic is never letter-spaced; names and numbers read in the right order.
|
|
45
|
-
- **Images:** a lazy photo can look blank in a full-page capture. Scroll first, or check the photo's `loading` attribute, before you call a photo missing.
|
|
46
|
-
- **Temporary QA pages** are removed before you finish.
|
|
47
|
-
|
|
48
|
-
## Gates
|
|
49
|
-
|
|
50
|
-
Keep a working log: the section table, the measurements, each gate's result. Re-read it at every gate.
|
|
51
|
-
|
|
52
|
-
| After step | Gate |
|
|
53
|
-
| --- | --- |
|
|
54
|
-
| Start | The project installs; `npm run check` and `npm test` pass on the untouched starter |
|
|
55
|
-
| Measure | Every section of the design has a row and a decision; a URL has its measurements |
|
|
56
|
-
| Tokens | The design's values are tokens; `npm test` passes |
|
|
57
|
-
| Sections | `npm run check` and `npm test` pass; a new section renders nothing for a shopper when empty, and shows its hint in Studio |
|
|
58
|
-
| Home document | The home document lists the design's sections in order |
|
|
59
|
-
| Store | The store answers: products, collections, reviews and photos show on the page |
|
|
60
|
-
| Match | `compare-design` is within its limit at the desktop width; the phone and Arabic checks pass |
|
|
61
|
-
| Done | The four commands pass, and their output is in the report |
|
|
62
|
-
|
|
63
|
-
## Verify and report
|
|
64
|
-
|
|
65
|
-
```sh
|
|
66
|
-
npm run check
|
|
67
|
-
npm test
|
|
68
|
-
npm run build
|
|
69
|
-
npm run build:vercel
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Quote the output of all four. The report gives:
|
|
73
|
-
|
|
74
|
-
1. **Matches the design:** each section, and what in it matches, with the `compare-design` percentage for each width.
|
|
75
|
-
2. **Approximate:** colours estimated by eye, a font substituted, spacing rounded to the starter's scale.
|
|
76
|
-
3. **Designed beyond the image:** the phone layout, right to left, hover and empty states, and why.
|
|
77
|
-
4. **Placeholders:** each neutral text that replaced a claim or brand copy.
|
|
78
|
-
5. **Left out:** elements the platform has no feature for, and claims you did not copy.
|
|
79
|
-
6. **Needs the developer or merchant:** exact colours, font files and licences, the logo, photos, contact details, menus and translations.
|
|
80
|
-
7. **Checks:** the output of the four commands, the QA script's counts per language, and the comparison's result.
|
|
81
|
-
8. **Not checked:** what was not run, and why.
|
|
82
|
-
|
|
83
|
-
## Unattended builds
|
|
84
|
-
|
|
85
|
-
When the developer leaves the build to run on its own:
|
|
86
|
-
|
|
87
|
-
- stop only at a hard stop: no design, a rule that cannot be kept, or a case in `
|
|
88
|
-
- commit after each gate, with the step named in the message, so each step can be reviewed on its own;
|
|
89
|
-
- fix a failing check at its cause. After three honest attempts, record the output and leave that part out;
|
|
90
|
-
- finish with the report, whatever happened.
|
|
91
|
-
|
|
92
|
-
A developer starts one with one message:
|
|
93
|
-
|
|
94
|
-
```text
|
|
95
|
-
Build
|
|
96
|
-
Design: <image, URL, or a Shopify theme to measure>
|
|
97
|
-
Folder and key: <name>
|
|
98
|
-
Store: <API address and key, or "local">
|
|
99
|
-
Content rights: <"we own the site's photos and words" or "design only">
|
|
100
|
-
Pages: home page
|
|
101
|
-
Work unattended to the end, and finish with the report.
|
|
102
|
-
```
|
|
1
|
+
# Build, verify and report
|
|
2
|
+
|
|
3
|
+
## Start the project
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm create abcart-theme@latest my-theme -- --key my-theme --git --yes
|
|
7
|
+
cd my-theme
|
|
8
|
+
cp .dev.vars.example .dev.vars
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Choose the key now. `THEME_KEY` in `src/theme/key.ts` names every merchant's saved edits and never changes once a store uses the theme.
|
|
12
|
+
|
|
13
|
+
## The home page document
|
|
14
|
+
|
|
15
|
+
`src/theme/documents/home.json` lists the sections in the design's order. Words go in each section's props in ar, fr and en. Spacing and widths come from the `style` scale in `src/theme/theme.ts`, with the same room between sections. Give each band its colour scheme here, and give the header and footer theirs in the area documents. Put no photo in a document: the merchant picks photos in Studio.
|
|
16
|
+
|
|
17
|
+
Run `npm run check` and `npm test` before you open a browser. They find most mistakes faster.
|
|
18
|
+
|
|
19
|
+
## A store to see it on
|
|
20
|
+
|
|
21
|
+
An empty store shows placeholders. Set `COD_SERVER_URL` and `STORE_API_KEY` in `.dev.vars`: a store on this machine, or your own. Give a new store its own state and port when another store already runs.
|
|
22
|
+
|
|
23
|
+
- **Collections:** one per category or product grid that the home document names.
|
|
24
|
+
- **Products:** about a dozen, with photos, some compare-at prices and stock. A photo must fit its product.
|
|
25
|
+
- **Reviews:** a few approved ones.
|
|
26
|
+
- **Photos** are the store's media. Upload them through the store. A file copied into storage is not media the server serves.
|
|
27
|
+
- **Translations:** each published language needs the store's own translations of its products, categories, collections and menu labels. Without them a locale shows the primary language, and its layout cannot be judged. Add them to the store's data, never to the theme.
|
|
28
|
+
|
|
29
|
+
## Check the page, not the picture
|
|
30
|
+
|
|
31
|
+
Run the store and the theme (`npm run dev`). Then run the page QA script in every language the theme speaks:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
BASE=http://localhost:4321 LANG_CODE=ar node .agents/skills/abcart-theme-from-design/scripts/qa-pages.cjs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The script visits every page the home page links to, plus the not-found page, checkout and track-order, at 1440 px and at 390 px. It fails on: an element wider than the viewport (outside a swipe row), a broken image, a translation key printed as text, a console error, and text below WCAG AA on the surface it is read from. It warns about a grid whose last row leaves empty columns (an odd count can be right; decide by eye). Set `CHROME` to a Chromium binary and `PLAYWRIGHT` to where Playwright loads from if the defaults do not run. Pass `FRAMES=1` to save a viewport-sized frame per scroll step, and review those frames, not a full-page capture.
|
|
38
|
+
|
|
39
|
+
Then measure the match with the design (`measure-the-design.md`, "Compare the built page with the design").
|
|
40
|
+
|
|
41
|
+
Then check by hand what no script can name:
|
|
42
|
+
|
|
43
|
+
- **Interactions.** Add a product to the cart: one drawer opens and no toast covers its first line. Change a quantity: the total follows. Apply each coupon the store has: the summary changes. A product with reviews shows them, and so does the home page.
|
|
44
|
+
- **Arabic:** the layout mirrors; nothing is cut at the edge; Arabic is never letter-spaced; names and numbers read in the right order.
|
|
45
|
+
- **Images:** a lazy photo can look blank in a full-page capture. Scroll first, or check the photo's `loading` attribute, before you call a photo missing.
|
|
46
|
+
- **Temporary QA pages** are removed before you finish.
|
|
47
|
+
|
|
48
|
+
## Gates
|
|
49
|
+
|
|
50
|
+
Keep a working log: the section table, the measurements, each gate's result. Re-read it at every gate.
|
|
51
|
+
|
|
52
|
+
| After step | Gate |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| Start | The project installs; `npm run check` and `npm test` pass on the untouched starter |
|
|
55
|
+
| Measure | Every section of the design has a row and a decision; a URL has its measurements |
|
|
56
|
+
| Tokens | The design's values are tokens; `npm test` passes |
|
|
57
|
+
| Sections | `npm run check` and `npm test` pass; a new section renders nothing for a shopper when empty, and shows its hint in Studio |
|
|
58
|
+
| Home document | The home document lists the design's sections in order |
|
|
59
|
+
| Store | The store answers: products, collections, reviews and photos show on the page |
|
|
60
|
+
| Match | `compare-design` is within its limit at the desktop width; the phone and Arabic checks pass |
|
|
61
|
+
| Done | The four commands pass, and their output is in the report |
|
|
62
|
+
|
|
63
|
+
## Verify and report
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
npm run check
|
|
67
|
+
npm test
|
|
68
|
+
npm run build
|
|
69
|
+
npm run build:vercel
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Quote the output of all four. The report gives:
|
|
73
|
+
|
|
74
|
+
1. **Matches the design:** each section, and what in it matches, with the `compare-design` percentage for each width.
|
|
75
|
+
2. **Approximate:** colours estimated by eye, a font substituted, spacing rounded to the starter's scale.
|
|
76
|
+
3. **Designed beyond the image:** the phone layout, right to left, hover and empty states, and why.
|
|
77
|
+
4. **Placeholders:** each neutral text that replaced a claim or brand copy.
|
|
78
|
+
5. **Left out:** elements the platform has no feature for, and claims you did not copy.
|
|
79
|
+
6. **Needs the developer or merchant:** exact colours, font files and licences, the logo, photos, contact details, menus and translations.
|
|
80
|
+
7. **Checks:** the output of the four commands, the QA script's counts per language, and the comparison's result.
|
|
81
|
+
8. **Not checked:** what was not run, and why.
|
|
82
|
+
|
|
83
|
+
## Unattended builds
|
|
84
|
+
|
|
85
|
+
When the developer leaves the build to run on its own:
|
|
86
|
+
|
|
87
|
+
- stop only at a hard stop: no design, a rule that cannot be kept, or a case in `abcart-docs`;
|
|
88
|
+
- commit after each gate, with the step named in the message, so each step can be reviewed on its own;
|
|
89
|
+
- fix a failing check at its cause. After three honest attempts, record the output and leave that part out;
|
|
90
|
+
- finish with the report, whatever happened.
|
|
91
|
+
|
|
92
|
+
A developer starts one with one message:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
Build an AbCart theme with the abcart-theme-from-design skill.
|
|
96
|
+
Design: <image, URL, or a Shopify theme to measure>
|
|
97
|
+
Folder and key: <name>
|
|
98
|
+
Store: <API address and key, or "local">
|
|
99
|
+
Content rights: <"we own the site's photos and words" or "design only">
|
|
100
|
+
Pages: home page
|
|
101
|
+
Work unattended to the end, and finish with the report.
|
|
102
|
+
```
|