create-tanqory-theme 0.0.0-stage → 0.2.2
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/LICENSE +21 -0
- package/README.md +55 -2
- package/bin/create-tanqory-theme.mjs +13 -0
- package/lib/agents.mjs +118 -0
- package/lib/create.mjs +245 -0
- package/package.json +39 -4
- package/templates/blank/README.md +13 -0
- package/templates/blank/config/settings.json +3 -0
- package/templates/blank/locales/en.json +22 -0
- package/templates/blank/locales/th.json +22 -0
- package/templates/blank/package.json +34 -0
- package/templates/blank/regions/footer.json +35 -0
- package/templates/blank/regions/header.json +13 -0
- package/templates/blank/scripts/build.mjs +193 -0
- package/templates/blank/scripts/probe.ts +4 -0
- package/templates/blank/src/bundle.ts +15 -0
- package/templates/blank/src/components/parts.tsx +32 -0
- package/templates/blank/src/entry.client.tsx +6 -0
- package/templates/blank/src/entry.server.tsx +13 -0
- package/templates/blank/src/sections/chrome.tsx +132 -0
- package/templates/blank/src/sections/commerce.tsx +242 -0
- package/templates/blank/src/sections/content.tsx +111 -0
- package/templates/blank/src/sections/editorial.tsx +107 -0
- package/templates/blank/src/settings.ts +15 -0
- package/templates/blank/src/styles/theme.css +195 -0
- package/templates/blank/src/templates.ts +14 -0
- package/templates/blank/src/theme.tsx +76 -0
- package/templates/blank/template.json +24 -0
- package/templates/blank/templates/404.json +14 -0
- package/templates/blank/templates/account.json +14 -0
- package/templates/blank/templates/article.json +14 -0
- package/templates/blank/templates/blog.json +14 -0
- package/templates/blank/templates/cart.json +14 -0
- package/templates/blank/templates/collection.json +14 -0
- package/templates/blank/templates/index.json +36 -0
- package/templates/blank/templates/page.contact.json +18 -0
- package/templates/blank/templates/page.json +14 -0
- package/templates/blank/templates/product.json +18 -0
- package/templates/blank/templates/search.json +14 -0
- package/templates/blank/tests/theme.test.ts +49 -0
- package/templates/blank/tsconfig.json +17 -0
- package/templates/blank/vite.client.config.ts +17 -0
- package/templates/blank/vite.probe.config.ts +16 -0
- package/templates/blank/vite.server.config.ts +32 -0
- package/templates/blank/vitest.config.ts +9 -0
- package/templates/common/.claude/settings.json +8 -0
- package/templates/common/.codex/config.toml +4 -0
- package/templates/common/.gemini/settings.json +12 -0
- package/templates/common/.github/workflows/theme-check.yml +44 -0
- package/templates/common/.mcp.json +12 -0
- package/templates/common/.vscode/mcp.json +9 -0
- package/templates/common/_gitignore +9 -0
- package/templates/common/scripts/check.mjs +44 -0
- package/templates/common/scripts/dev.mjs +30 -0
- package/templates/common/tanqory.config.json +6 -0
- package/templates/nova/.gitattributes +3 -0
- package/templates/nova/.tanqory/contracts/LOCK.json +66 -0
- package/templates/nova/.tanqory/contracts/nova-01.json +1092 -0
- package/templates/nova/.tanqory/contracts/nova-12A.json +2674 -0
- package/templates/nova/.tanqory/contracts/nova-12B.json +2285 -0
- package/templates/nova/.tanqory/contracts/nova-12C.json +2848 -0
- package/templates/nova/.tanqory/contracts/nova-12D.json +3039 -0
- package/templates/nova/.tanqory/contracts/nova-12E.json +1473 -0
- package/templates/nova/.tanqory/contracts/nova-12F.json +1670 -0
- package/templates/nova/.tanqory/contracts/nova-12G.json +1661 -0
- package/templates/nova/.tanqory/contracts/nova-13.json +301 -0
- package/templates/nova/.tanqory/contracts/nova-14.json +172 -0
- package/templates/nova/.tanqory/legacy-settings.json +1121 -0
- package/templates/nova/README.md +150 -0
- package/templates/nova/_gitignore +28 -0
- package/templates/nova/assets/ai-tokens.css +6 -0
- package/templates/nova/assets/starter/starter-art-1200x800-0b773ac4.svg +1 -0
- package/templates/nova/assets/starter/starter-art-1200x900-59600290.svg +1 -0
- package/templates/nova/assets/starter/starter-art-1200x900-c549d496.svg +1 -0
- package/templates/nova/assets/starter/starter-art-1600x900-8f979fcb.svg +1 -0
- package/templates/nova/assets/starter/starter-art-2100x900-cbb71bfd.svg +1 -0
- package/templates/nova/config/legacy-settings.json +438 -0
- package/templates/nova/config/promotion-popup.schema.ts +29 -0
- package/templates/nova/config/settings.json +23 -0
- package/templates/nova/config/settings.schema.ts +231 -0
- package/templates/nova/entry.abi.tsx +27 -0
- package/templates/nova/groups/footer.json +39 -0
- package/templates/nova/groups/header.json +11 -0
- package/templates/nova/lib/abi/abi.css +41 -0
- package/templates/nova/lib/bundle-core.ts +35 -0
- package/templates/nova/lib/bundle.client.ts +15 -0
- package/templates/nova/lib/bundle.ts +15 -0
- package/templates/nova/lib/legacy-settings.ts +104 -0
- package/templates/nova/locales/ar.json +590 -0
- package/templates/nova/locales/en.json +590 -0
- package/templates/nova/locales/th.json +590 -0
- package/templates/nova/main.abi.tsx +12 -0
- package/templates/nova/package.json +44 -0
- package/templates/nova/scripts/abi/build.mjs +145 -0
- package/templates/nova/scripts/abi/check-content.mjs +99 -0
- package/templates/nova/scripts/abi/jcs.mjs +27 -0
- package/templates/nova/scripts/abi/local-host.mjs +294 -0
- package/templates/nova/scripts/abi/manifest.mjs +392 -0
- package/templates/nova/scripts/abi/starter-assets.mjs +32 -0
- package/templates/nova/scripts/compiler/checks/check-a11y.mjs +88 -0
- package/templates/nova/scripts/compiler/checks/check-layout-sanity.mjs +169 -0
- package/templates/nova/scripts/compiler/checks/check-page-headings.mjs +67 -0
- package/templates/nova/scripts/compiler/checks/check-product-jsonld.mjs +80 -0
- package/templates/nova/scripts/compiler/checks/theme-spec/check.mjs +88 -0
- package/templates/nova/scripts/compiler/contracts/extract.mjs +188 -0
- package/templates/nova/scripts/compiler/contracts/index.ts +125 -0
- package/templates/nova/scripts/compiler/contracts/validate.ts +347 -0
- package/templates/nova/scripts/compiler/manifest/gen-manifest.mjs +156 -0
- package/templates/nova/scripts/compiler/manifest/manifest-entry.ts +386 -0
- package/templates/nova/scripts/compiler/manifest/manifest-sections.ts +247 -0
- package/templates/nova/scripts/compiler/migrate/migrate-content.mjs +171 -0
- package/templates/nova/scripts/compiler/migrate/migrate-groups.mjs +159 -0
- package/templates/nova/scripts/parity/case-shim.ts +14 -0
- package/templates/nova/scripts/parity/emit.ts +206 -0
- package/templates/nova/scripts/parity/index.html +12 -0
- package/templates/nova/scripts/parity/main.tsx +23 -0
- package/templates/nova/scripts/parity/pages.tsx +123 -0
- package/templates/nova/scripts/parity/vite.config.ts +29 -0
- package/templates/nova/src/components/base/Accordion.css +20 -0
- package/templates/nova/src/components/base/Accordion.tsx +50 -0
- package/templates/nova/src/components/base/Badge.css +17 -0
- package/templates/nova/src/components/base/Badge.tsx +26 -0
- package/templates/nova/src/components/base/Button.css +73 -0
- package/templates/nova/src/components/base/Button.tsx +64 -0
- package/templates/nova/src/components/base/Checkbox.tsx +18 -0
- package/templates/nova/src/components/base/Chip.css +20 -0
- package/templates/nova/src/components/base/Chip.tsx +33 -0
- package/templates/nova/src/components/base/Divider.css +6 -0
- package/templates/nova/src/components/base/Divider.tsx +28 -0
- package/templates/nova/src/components/base/IconButton.css +34 -0
- package/templates/nova/src/components/base/IconButton.tsx +41 -0
- package/templates/nova/src/components/base/Input.css +21 -0
- package/templates/nova/src/components/base/Input.tsx +24 -0
- package/templates/nova/src/components/base/Link.css +15 -0
- package/templates/nova/src/components/base/Link.tsx +23 -0
- package/templates/nova/src/components/base/Radio.tsx +13 -0
- package/templates/nova/src/components/base/Select.css +18 -0
- package/templates/nova/src/components/base/Select.tsx +34 -0
- package/templates/nova/src/components/base/Skeleton.css +17 -0
- package/templates/nova/src/components/base/Skeleton.tsx +23 -0
- package/templates/nova/src/components/base/Spinner.css +13 -0
- package/templates/nova/src/components/base/Spinner.tsx +8 -0
- package/templates/nova/src/components/base/Switch.tsx +16 -0
- package/templates/nova/src/components/base/Tabs.css +24 -0
- package/templates/nova/src/components/base/Tabs.tsx +61 -0
- package/templates/nova/src/components/base/Textarea.css +1 -0
- package/templates/nova/src/components/base/Textarea.tsx +8 -0
- package/templates/nova/src/components/base/choice-props.ts +9 -0
- package/templates/nova/src/components/base/choice.css +69 -0
- package/templates/nova/src/components/commerce/AddToCart.css +4 -0
- package/templates/nova/src/components/commerce/AddToCart.tsx +77 -0
- package/templates/nova/src/components/commerce/CartLine.css +26 -0
- package/templates/nova/src/components/commerce/CartLine.tsx +82 -0
- package/templates/nova/src/components/commerce/CartSummary.css +23 -0
- package/templates/nova/src/components/commerce/CartSummary.tsx +120 -0
- package/templates/nova/src/components/commerce/CollectionCard.css +66 -0
- package/templates/nova/src/components/commerce/CollectionCard.tsx +57 -0
- package/templates/nova/src/components/commerce/ComparisonTable.css +33 -0
- package/templates/nova/src/components/commerce/ComparisonTable.tsx +113 -0
- package/templates/nova/src/components/commerce/EarnHint.css +3 -0
- package/templates/nova/src/components/commerce/EarnHint.tsx +31 -0
- package/templates/nova/src/components/commerce/Hotspot.css +16 -0
- package/templates/nova/src/components/commerce/Hotspot.tsx +64 -0
- package/templates/nova/src/components/commerce/ListingParts.css +79 -0
- package/templates/nova/src/components/commerce/ListingParts.tsx +211 -0
- package/templates/nova/src/components/commerce/LookItem.css +19 -0
- package/templates/nova/src/components/commerce/LookItem.tsx +41 -0
- package/templates/nova/src/components/commerce/MiniCartLine.css +20 -0
- package/templates/nova/src/components/commerce/MiniCartLine.tsx +93 -0
- package/templates/nova/src/components/commerce/PaymentMark.css +2 -0
- package/templates/nova/src/components/commerce/PaymentMark.tsx +55 -0
- package/templates/nova/src/components/commerce/Price.css +27 -0
- package/templates/nova/src/components/commerce/Price.tsx +55 -0
- package/templates/nova/src/components/commerce/ProductCard.css +66 -0
- package/templates/nova/src/components/commerce/ProductCard.tsx +117 -0
- package/templates/nova/src/components/commerce/ProductGallery.css +72 -0
- package/templates/nova/src/components/commerce/ProductGallery.tsx +98 -0
- package/templates/nova/src/components/commerce/QuantitySelector.css +23 -0
- package/templates/nova/src/components/commerce/QuantitySelector.tsx +45 -0
- package/templates/nova/src/components/commerce/Reviews.css +34 -0
- package/templates/nova/src/components/commerce/Reviews.tsx +112 -0
- package/templates/nova/src/components/commerce/Stars.css +7 -0
- package/templates/nova/src/components/commerce/Stars.tsx +38 -0
- package/templates/nova/src/components/commerce/VariantPicker.css +31 -0
- package/templates/nova/src/components/commerce/VariantPicker.tsx +122 -0
- package/templates/nova/src/components/commerce/blocks/Badge.css +6 -0
- package/templates/nova/src/components/commerce/blocks/Badge.tsx +33 -0
- package/templates/nova/src/components/commerce/blocks/PaymentIcons.tsx +43 -0
- package/templates/nova/src/components/commerce/blocks/Swatches.tsx +17 -0
- package/templates/nova/src/components/commerce/blocks/payment.css +2 -0
- package/templates/nova/src/components/commerce/cart-limit.ts +11 -0
- package/templates/nova/src/components/commerce/money.ts +34 -0
- package/templates/nova/src/components/commerce/swatch.ts +54 -0
- package/templates/nova/src/components/content/ArticleCard.css +22 -0
- package/templates/nova/src/components/content/ArticleCard.tsx +53 -0
- package/templates/nova/src/components/content/BeforeAfterSlider.css +38 -0
- package/templates/nova/src/components/content/BeforeAfterSlider.tsx +87 -0
- package/templates/nova/src/components/content/CardRow.css +80 -0
- package/templates/nova/src/components/content/CardRow.tsx +140 -0
- package/templates/nova/src/components/content/CarouselControls.css +61 -0
- package/templates/nova/src/components/content/CarouselControls.tsx +90 -0
- package/templates/nova/src/components/content/ContentsNav.css +16 -0
- package/templates/nova/src/components/content/ContentsNav.tsx +55 -0
- package/templates/nova/src/components/content/Countdown.css +24 -0
- package/templates/nova/src/components/content/Countdown.tsx +115 -0
- package/templates/nova/src/components/content/HeroCopy.css +92 -0
- package/templates/nova/src/components/content/HeroCopy.tsx +148 -0
- package/templates/nova/src/components/content/HeroFrame.css +75 -0
- package/templates/nova/src/components/content/HeroFrame.tsx +49 -0
- package/templates/nova/src/components/content/HeroMedia.css +40 -0
- package/templates/nova/src/components/content/HeroMedia.tsx +170 -0
- package/templates/nova/src/components/content/LongForm.css +40 -0
- package/templates/nova/src/components/content/LongForm.tsx +56 -0
- package/templates/nova/src/components/content/MediaFrame.css +5 -0
- package/templates/nova/src/components/content/MediaFrame.tsx +52 -0
- package/templates/nova/src/components/content/RichText.tsx +30 -0
- package/templates/nova/src/components/content/SectionHead.css +8 -0
- package/templates/nova/src/components/content/SectionHead.tsx +34 -0
- package/templates/nova/src/components/content/ShareButtons.css +2 -0
- package/templates/nova/src/components/content/ShareButtons.tsx +40 -0
- package/templates/nova/src/components/content/StoreCard.css +14 -0
- package/templates/nova/src/components/content/StoreCard.tsx +60 -0
- package/templates/nova/src/components/content/TestimonialCard.css +36 -0
- package/templates/nova/src/components/content/TestimonialCard.tsx +102 -0
- package/templates/nova/src/components/content/UgcTile.css +8 -0
- package/templates/nova/src/components/content/UgcTile.tsx +33 -0
- package/templates/nova/src/components/content/blocks/Button.tsx +36 -0
- package/templates/nova/src/components/content/blocks/Column.tsx +30 -0
- package/templates/nova/src/components/content/blocks/Heading.tsx +31 -0
- package/templates/nova/src/components/content/blocks/Icon.tsx +25 -0
- package/templates/nova/src/components/content/blocks/Image.tsx +42 -0
- package/templates/nova/src/components/content/blocks/Text.tsx +26 -0
- package/templates/nova/src/components/content/blocks/Video.tsx +44 -0
- package/templates/nova/src/components/content/blocks/content.css +25 -0
- package/templates/nova/src/components/content/blocks/shared.ts +5 -0
- package/templates/nova/src/components/forms/ContactForm.css +19 -0
- package/templates/nova/src/components/forms/ContactForm.tsx +139 -0
- package/templates/nova/src/components/forms/FormField.css +15 -0
- package/templates/nova/src/components/forms/FormField.tsx +77 -0
- package/templates/nova/src/components/forms/GatewayFields.tsx +79 -0
- package/templates/nova/src/components/forms/NewsletterForm.css +9 -0
- package/templates/nova/src/components/forms/NewsletterForm.tsx +141 -0
- package/templates/nova/src/components/forms/SearchField.css +7 -0
- package/templates/nova/src/components/forms/SearchField.tsx +68 -0
- package/templates/nova/src/components/forms/blocks/Newsletter.css +5 -0
- package/templates/nova/src/components/forms/blocks/Newsletter.tsx +71 -0
- package/templates/nova/src/components/forms/validate.ts +4 -0
- package/templates/nova/src/components/listing/ProductListing.tsx +200 -0
- package/templates/nova/src/components/navigation/BrandLogo.tsx +35 -0
- package/templates/nova/src/components/navigation/Breadcrumb.css +16 -0
- package/templates/nova/src/components/navigation/Breadcrumb.tsx +59 -0
- package/templates/nova/src/components/navigation/LineAddFriend.css +5 -0
- package/templates/nova/src/components/navigation/LineAddFriend.tsx +42 -0
- package/templates/nova/src/components/navigation/LocaleSelector.css +33 -0
- package/templates/nova/src/components/navigation/LocaleSelector.tsx +64 -0
- package/templates/nova/src/components/navigation/Menu.tsx +26 -0
- package/templates/nova/src/components/navigation/Pagination.css +24 -0
- package/templates/nova/src/components/navigation/Pagination.tsx +74 -0
- package/templates/nova/src/components/navigation/RecoveryLinks.css +8 -0
- package/templates/nova/src/components/navigation/RecoveryLinks.tsx +23 -0
- package/templates/nova/src/components/navigation/SocialLinks.css +5 -0
- package/templates/nova/src/components/navigation/SocialLinks.tsx +51 -0
- package/templates/nova/src/components/navigation/blocks/SocialLinks.tsx +23 -0
- package/templates/nova/src/components/overlays/AccountMenu.css +11 -0
- package/templates/nova/src/components/overlays/AccountMenu.tsx +91 -0
- package/templates/nova/src/components/overlays/CartDrawer.css +17 -0
- package/templates/nova/src/components/overlays/CartDrawer.tsx +118 -0
- package/templates/nova/src/components/overlays/ConfirmationDialog.tsx +49 -0
- package/templates/nova/src/components/overlays/CookieConsent.css +56 -0
- package/templates/nova/src/components/overlays/CookieConsent.tsx +170 -0
- package/templates/nova/src/components/overlays/Drawer.css +38 -0
- package/templates/nova/src/components/overlays/Drawer.tsx +66 -0
- package/templates/nova/src/components/overlays/FriendOfferPanel.tsx +79 -0
- package/templates/nova/src/components/overlays/MarketSelector.css +111 -0
- package/templates/nova/src/components/overlays/MarketSelector.tsx +450 -0
- package/templates/nova/src/components/overlays/Menu.css +9 -0
- package/templates/nova/src/components/overlays/Menu.tsx +124 -0
- package/templates/nova/src/components/overlays/MobileNavDrawer.css +28 -0
- package/templates/nova/src/components/overlays/MobileNavDrawer.tsx +166 -0
- package/templates/nova/src/components/overlays/Modal.css +52 -0
- package/templates/nova/src/components/overlays/Modal.tsx +88 -0
- package/templates/nova/src/components/overlays/Popover.css +4 -0
- package/templates/nova/src/components/overlays/Popover.tsx +115 -0
- package/templates/nova/src/components/overlays/ProductLightbox.css +20 -0
- package/templates/nova/src/components/overlays/ProductLightbox.tsx +70 -0
- package/templates/nova/src/components/overlays/PromoPopup.css +32 -0
- package/templates/nova/src/components/overlays/PromoPopup.tsx +198 -0
- package/templates/nova/src/components/overlays/QuickView.css +31 -0
- package/templates/nova/src/components/overlays/QuickView.tsx +127 -0
- package/templates/nova/src/components/overlays/ReferralPanel.css +16 -0
- package/templates/nova/src/components/overlays/ReferralPanel.tsx +138 -0
- package/templates/nova/src/components/overlays/RewardsLauncher.css +22 -0
- package/templates/nova/src/components/overlays/RewardsLauncher.tsx +270 -0
- package/templates/nova/src/components/overlays/SearchModal.css +48 -0
- package/templates/nova/src/components/overlays/SearchModal.tsx +302 -0
- package/templates/nova/src/components/overlays/Sheet.css +16 -0
- package/templates/nova/src/components/overlays/Sheet.tsx +48 -0
- package/templates/nova/src/components/overlays/SizeGuide.css +8 -0
- package/templates/nova/src/components/overlays/SizeGuide.tsx +74 -0
- package/templates/nova/src/components/overlays/Toast.css +20 -0
- package/templates/nova/src/components/overlays/Toast.tsx +164 -0
- package/templates/nova/src/components/overlays/Tooltip.css +6 -0
- package/templates/nova/src/components/overlays/Tooltip.tsx +59 -0
- package/templates/nova/src/components/overlays/use-dialog.ts +74 -0
- package/templates/nova/src/components/section/shared.css +42 -0
- package/templates/nova/src/components/section/shared.ts +120 -0
- package/templates/nova/src/components/section/shell.tsx +29 -0
- package/templates/nova/src/components/states/Alert.css +10 -0
- package/templates/nova/src/components/states/Alert.tsx +50 -0
- package/templates/nova/src/components/states/EditorFrame.css +31 -0
- package/templates/nova/src/components/states/EditorFrame.tsx +43 -0
- package/templates/nova/src/components/states/MediaState.css +1 -0
- package/templates/nova/src/components/states/MediaState.tsx +49 -0
- package/templates/nova/src/components/states/OfflineNotice.css +4 -0
- package/templates/nova/src/components/states/OfflineNotice.tsx +24 -0
- package/templates/nova/src/components/states/SkeletonLayout.css +22 -0
- package/templates/nova/src/components/states/SkeletonLayout.tsx +104 -0
- package/templates/nova/src/components/states/StateBlock.css +22 -0
- package/templates/nova/src/components/states/StateBlock.tsx +39 -0
- package/templates/nova/src/components/states/media/MediaError.css +6 -0
- package/templates/nova/src/components/states/media/MediaError.tsx +49 -0
- package/templates/nova/src/components/states/media/MediaPlaceholder.css +24 -0
- package/templates/nova/src/components/states/media/MediaPlaceholder.tsx +101 -0
- package/templates/nova/src/components/states/media/placeholder-art.ts +142 -0
- package/templates/nova/src/layouts/Main.tsx +80 -0
- package/templates/nova/src/sections/Account/Account.tsx +109 -0
- package/templates/nova/src/sections/Account/index.ts +22 -0
- package/templates/nova/src/sections/Account/presets.ts +6 -0
- package/templates/nova/src/sections/Account/schema.ts +29 -0
- package/templates/nova/src/sections/AnnouncementBar/AnnouncementBar.css +37 -0
- package/templates/nova/src/sections/AnnouncementBar/AnnouncementBar.tsx +151 -0
- package/templates/nova/src/sections/AnnouncementBar/index.ts +20 -0
- package/templates/nova/src/sections/AnnouncementBar/presets.ts +10 -0
- package/templates/nova/src/sections/AnnouncementBar/schema.ts +26 -0
- package/templates/nova/src/sections/ArticleBody/ArticleBody.tsx +129 -0
- package/templates/nova/src/sections/ArticleBody/index.ts +21 -0
- package/templates/nova/src/sections/ArticleBody/presets.ts +10 -0
- package/templates/nova/src/sections/ArticleBody/schema.ts +40 -0
- package/templates/nova/src/sections/BeforeAfter/BeforeAfter.tsx +47 -0
- package/templates/nova/src/sections/BeforeAfter/blocks/Comparison.tsx +20 -0
- package/templates/nova/src/sections/BeforeAfter/index.ts +28 -0
- package/templates/nova/src/sections/BeforeAfter/presets.ts +10 -0
- package/templates/nova/src/sections/BeforeAfter/schema.ts +34 -0
- package/templates/nova/src/sections/BlogPosts/BlogPosts.tsx +106 -0
- package/templates/nova/src/sections/BlogPosts/index.ts +30 -0
- package/templates/nova/src/sections/BlogPosts/presets.ts +10 -0
- package/templates/nova/src/sections/BlogPosts/schema.ts +42 -0
- package/templates/nova/src/sections/Breadcrumbs/Breadcrumbs.css +10 -0
- package/templates/nova/src/sections/Breadcrumbs/Breadcrumbs.tsx +41 -0
- package/templates/nova/src/sections/Breadcrumbs/index.ts +20 -0
- package/templates/nova/src/sections/Breadcrumbs/presets.ts +6 -0
- package/templates/nova/src/sections/Breadcrumbs/schema.ts +24 -0
- package/templates/nova/src/sections/CartItems/CartItems.tsx +170 -0
- package/templates/nova/src/sections/CartItems/blocks/CartBadge.tsx +14 -0
- package/templates/nova/src/sections/CartItems/index.ts +37 -0
- package/templates/nova/src/sections/CartItems/presets.ts +8 -0
- package/templates/nova/src/sections/CartItems/schema.ts +34 -0
- package/templates/nova/src/sections/CollectionBanner/CollectionBanner.tsx +120 -0
- package/templates/nova/src/sections/CollectionBanner/index.ts +25 -0
- package/templates/nova/src/sections/CollectionBanner/presets.ts +10 -0
- package/templates/nova/src/sections/CollectionBanner/schema.ts +37 -0
- package/templates/nova/src/sections/CollectionLinks/CollectionLinks.tsx +47 -0
- package/templates/nova/src/sections/CollectionLinks/index.ts +20 -0
- package/templates/nova/src/sections/CollectionLinks/presets.ts +8 -0
- package/templates/nova/src/sections/CollectionLinks/schema.ts +33 -0
- package/templates/nova/src/sections/CollectionList/CollectionList.tsx +89 -0
- package/templates/nova/src/sections/CollectionList/blocks/CollectionItem.tsx +25 -0
- package/templates/nova/src/sections/CollectionList/index.ts +33 -0
- package/templates/nova/src/sections/CollectionList/presets.ts +10 -0
- package/templates/nova/src/sections/CollectionList/schema.ts +41 -0
- package/templates/nova/src/sections/ComparisonTable/ComparisonTable.tsx +52 -0
- package/templates/nova/src/sections/ComparisonTable/blocks/CompareItem.tsx +26 -0
- package/templates/nova/src/sections/ComparisonTable/index.ts +31 -0
- package/templates/nova/src/sections/ComparisonTable/presets.ts +8 -0
- package/templates/nova/src/sections/ComparisonTable/schema.ts +31 -0
- package/templates/nova/src/sections/ContactForm/ContactForm.tsx +83 -0
- package/templates/nova/src/sections/ContactForm/blocks/ContactDetail.tsx +13 -0
- package/templates/nova/src/sections/ContactForm/index.ts +29 -0
- package/templates/nova/src/sections/ContactForm/presets.ts +8 -0
- package/templates/nova/src/sections/ContactForm/schema.ts +34 -0
- package/templates/nova/src/sections/Divider/Divider.css +17 -0
- package/templates/nova/src/sections/Divider/Divider.tsx +21 -0
- package/templates/nova/src/sections/Divider/index.ts +20 -0
- package/templates/nova/src/sections/Divider/presets.ts +10 -0
- package/templates/nova/src/sections/Divider/schema.ts +24 -0
- package/templates/nova/src/sections/Faq/Faq.tsx +51 -0
- package/templates/nova/src/sections/Faq/blocks/FaqItem.tsx +13 -0
- package/templates/nova/src/sections/Faq/index.ts +28 -0
- package/templates/nova/src/sections/Faq/presets.ts +8 -0
- package/templates/nova/src/sections/Faq/schema.ts +32 -0
- package/templates/nova/src/sections/FeatureGridBlocks/FeatureGridBlocks.tsx +90 -0
- package/templates/nova/src/sections/FeatureGridBlocks/index.ts +35 -0
- package/templates/nova/src/sections/FeatureGridBlocks/presets.ts +8 -0
- package/templates/nova/src/sections/FeatureGridBlocks/schema.ts +35 -0
- package/templates/nova/src/sections/FeatureHighlights/FeatureHighlights.tsx +56 -0
- package/templates/nova/src/sections/FeatureHighlights/index.ts +20 -0
- package/templates/nova/src/sections/FeatureHighlights/presets.ts +6 -0
- package/templates/nova/src/sections/FeatureHighlights/schema.ts +27 -0
- package/templates/nova/src/sections/FeaturedCollection/FeaturedCollection.tsx +67 -0
- package/templates/nova/src/sections/FeaturedCollection/index.ts +21 -0
- package/templates/nova/src/sections/FeaturedCollection/presets.ts +10 -0
- package/templates/nova/src/sections/FeaturedCollection/schema.ts +39 -0
- package/templates/nova/src/sections/FeaturedProduct/FeaturedProduct.tsx +107 -0
- package/templates/nova/src/sections/FeaturedProduct/index.ts +23 -0
- package/templates/nova/src/sections/FeaturedProduct/presets.ts +8 -0
- package/templates/nova/src/sections/FeaturedProduct/schema.ts +35 -0
- package/templates/nova/src/sections/Footer/Footer.css +81 -0
- package/templates/nova/src/sections/Footer/Footer.tsx +256 -0
- package/templates/nova/src/sections/Footer/blocks/FooterBrand.tsx +40 -0
- package/templates/nova/src/sections/Footer/blocks/FooterLine.tsx +11 -0
- package/templates/nova/src/sections/Footer/blocks/FooterMenu.tsx +14 -0
- package/templates/nova/src/sections/Footer/blocks/FooterText.tsx +8 -0
- package/templates/nova/src/sections/Footer/blocks/footer.css +7 -0
- package/templates/nova/src/sections/Footer/index.ts +38 -0
- package/templates/nova/src/sections/Footer/presets.ts +10 -0
- package/templates/nova/src/sections/Footer/schema.ts +27 -0
- package/templates/nova/src/sections/Group/Group.css +59 -0
- package/templates/nova/src/sections/Group/Group.tsx +167 -0
- package/templates/nova/src/sections/Group/blocks/Accordion.tsx +26 -0
- package/templates/nova/src/sections/Group/blocks/JumboText.tsx +20 -0
- package/templates/nova/src/sections/Group/blocks/Spacer.tsx +16 -0
- package/templates/nova/src/sections/Group/index.ts +36 -0
- package/templates/nova/src/sections/Group/presets.ts +12 -0
- package/templates/nova/src/sections/Group/schema.ts +35 -0
- package/templates/nova/src/sections/Header/Header.css +185 -0
- package/templates/nova/src/sections/Header/Header.tsx +478 -0
- package/templates/nova/src/sections/Header/index.ts +32 -0
- package/templates/nova/src/sections/Header/presets.ts +10 -0
- package/templates/nova/src/sections/Header/schema.ts +32 -0
- package/templates/nova/src/sections/Hero/Hero.tsx +128 -0
- package/templates/nova/src/sections/Hero/index.ts +24 -0
- package/templates/nova/src/sections/Hero/presets.ts +16 -0
- package/templates/nova/src/sections/Hero/schema.ts +56 -0
- package/templates/nova/src/sections/ImageGallery/ImageGallery.tsx +86 -0
- package/templates/nova/src/sections/ImageGallery/index.ts +28 -0
- package/templates/nova/src/sections/ImageGallery/presets.ts +10 -0
- package/templates/nova/src/sections/ImageGallery/schema.ts +34 -0
- package/templates/nova/src/sections/ImageWithText/ImageWithText.tsx +62 -0
- package/templates/nova/src/sections/ImageWithText/index.ts +23 -0
- package/templates/nova/src/sections/ImageWithText/presets.ts +12 -0
- package/templates/nova/src/sections/ImageWithText/schema.ts +45 -0
- package/templates/nova/src/sections/LineAddFriend/LineAddFriend.tsx +25 -0
- package/templates/nova/src/sections/LineAddFriend/index.ts +20 -0
- package/templates/nova/src/sections/LineAddFriend/presets.ts +3 -0
- package/templates/nova/src/sections/LineAddFriend/schema.ts +25 -0
- package/templates/nova/src/sections/LogoList/LogoList.tsx +40 -0
- package/templates/nova/src/sections/LogoList/blocks/Logo.tsx +18 -0
- package/templates/nova/src/sections/LogoList/index.ts +29 -0
- package/templates/nova/src/sections/LogoList/presets.ts +8 -0
- package/templates/nova/src/sections/LogoList/schema.ts +29 -0
- package/templates/nova/src/sections/MainCollection/MainCollection.tsx +51 -0
- package/templates/nova/src/sections/MainCollection/index.ts +26 -0
- package/templates/nova/src/sections/MainCollection/presets.ts +10 -0
- package/templates/nova/src/sections/MainCollection/schema.ts +29 -0
- package/templates/nova/src/sections/Marquee/Marquee.tsx +114 -0
- package/templates/nova/src/sections/Marquee/index.ts +20 -0
- package/templates/nova/src/sections/Marquee/presets.ts +10 -0
- package/templates/nova/src/sections/Marquee/schema.ts +23 -0
- package/templates/nova/src/sections/Multicolumn/Multicolumn.tsx +56 -0
- package/templates/nova/src/sections/Multicolumn/index.ts +25 -0
- package/templates/nova/src/sections/Multicolumn/presets.ts +8 -0
- package/templates/nova/src/sections/Multicolumn/schema.ts +34 -0
- package/templates/nova/src/sections/Newsletter/Newsletter.tsx +64 -0
- package/templates/nova/src/sections/Newsletter/index.ts +20 -0
- package/templates/nova/src/sections/Newsletter/presets.ts +10 -0
- package/templates/nova/src/sections/Newsletter/schema.ts +36 -0
- package/templates/nova/src/sections/NotFound/NotFound.tsx +41 -0
- package/templates/nova/src/sections/NotFound/index.ts +20 -0
- package/templates/nova/src/sections/NotFound/presets.ts +6 -0
- package/templates/nova/src/sections/NotFound/schema.ts +30 -0
- package/templates/nova/src/sections/PageBody/PageBody.tsx +35 -0
- package/templates/nova/src/sections/PageBody/index.ts +21 -0
- package/templates/nova/src/sections/PageBody/presets.ts +6 -0
- package/templates/nova/src/sections/PageBody/schema.ts +29 -0
- package/templates/nova/src/sections/PolicyPage/PolicyPage.tsx +62 -0
- package/templates/nova/src/sections/PolicyPage/index.ts +23 -0
- package/templates/nova/src/sections/PolicyPage/presets.ts +6 -0
- package/templates/nova/src/sections/PolicyPage/schema.ts +27 -0
- package/templates/nova/src/sections/ProductDetails/ProductDetails.tsx +269 -0
- package/templates/nova/src/sections/ProductDetails/blocks/AddToCartBlock.tsx +15 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductDescription.tsx +15 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductInventory.tsx +38 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductPrice.tsx +19 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductSku.tsx +15 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductTitle.tsx +17 -0
- package/templates/nova/src/sections/ProductDetails/blocks/Quantity.tsx +14 -0
- package/templates/nova/src/sections/ProductDetails/blocks/Tab.tsx +23 -0
- package/templates/nova/src/sections/ProductDetails/blocks/VariantPickerBlock.tsx +44 -0
- package/templates/nova/src/sections/ProductDetails/blocks/commerce-blocks.css +13 -0
- package/templates/nova/src/sections/ProductDetails/index.ts +44 -0
- package/templates/nova/src/sections/ProductDetails/presets.ts +10 -0
- package/templates/nova/src/sections/ProductDetails/schema.ts +44 -0
- package/templates/nova/src/sections/ProductGrid/ProductGrid.tsx +38 -0
- package/templates/nova/src/sections/ProductGrid/index.ts +25 -0
- package/templates/nova/src/sections/ProductGrid/presets.ts +6 -0
- package/templates/nova/src/sections/ProductGrid/schema.ts +37 -0
- package/templates/nova/src/sections/ProductRecommendations/ProductRecommendations.tsx +45 -0
- package/templates/nova/src/sections/ProductRecommendations/index.ts +20 -0
- package/templates/nova/src/sections/ProductRecommendations/presets.ts +8 -0
- package/templates/nova/src/sections/ProductRecommendations/schema.ts +28 -0
- package/templates/nova/src/sections/ProductReviews/ProductReviews.tsx +136 -0
- package/templates/nova/src/sections/ProductReviews/index.ts +22 -0
- package/templates/nova/src/sections/ProductReviews/presets.ts +6 -0
- package/templates/nova/src/sections/ProductReviews/schema.ts +31 -0
- package/templates/nova/src/sections/PromoBanner/PromoBanner.tsx +78 -0
- package/templates/nova/src/sections/PromoBanner/index.ts +20 -0
- package/templates/nova/src/sections/PromoBanner/presets.ts +10 -0
- package/templates/nova/src/sections/PromoBanner/schema.ts +38 -0
- package/templates/nova/src/sections/RecentlyViewed/RecentlyViewed.tsx +53 -0
- package/templates/nova/src/sections/RecentlyViewed/index.ts +20 -0
- package/templates/nova/src/sections/RecentlyViewed/presets.ts +6 -0
- package/templates/nova/src/sections/RecentlyViewed/schema.ts +26 -0
- package/templates/nova/src/sections/RichText/RichText.tsx +38 -0
- package/templates/nova/src/sections/RichText/index.ts +20 -0
- package/templates/nova/src/sections/RichText/presets.ts +10 -0
- package/templates/nova/src/sections/RichText/schema.ts +37 -0
- package/templates/nova/src/sections/SearchResults/SearchResults.tsx +112 -0
- package/templates/nova/src/sections/SearchResults/index.ts +26 -0
- package/templates/nova/src/sections/SearchResults/presets.ts +8 -0
- package/templates/nova/src/sections/SearchResults/schema.ts +30 -0
- package/templates/nova/src/sections/ShopTheLook/ShopTheLook.tsx +112 -0
- package/templates/nova/src/sections/ShopTheLook/blocks/Hotspot.tsx +22 -0
- package/templates/nova/src/sections/ShopTheLook/index.ts +33 -0
- package/templates/nova/src/sections/ShopTheLook/presets.ts +8 -0
- package/templates/nova/src/sections/ShopTheLook/schema.ts +31 -0
- package/templates/nova/src/sections/Slideshow/Slideshow.tsx +199 -0
- package/templates/nova/src/sections/Slideshow/blocks/Slide.tsx +93 -0
- package/templates/nova/src/sections/Slideshow/index.ts +30 -0
- package/templates/nova/src/sections/Slideshow/presets.ts +10 -0
- package/templates/nova/src/sections/Slideshow/schema.ts +36 -0
- package/templates/nova/src/sections/StoreLocator/StoreLocator.tsx +66 -0
- package/templates/nova/src/sections/StoreLocator/index.ts +20 -0
- package/templates/nova/src/sections/StoreLocator/presets.ts +6 -0
- package/templates/nova/src/sections/StoreLocator/schema.ts +34 -0
- package/templates/nova/src/sections/TeamFounders/TeamFounders.tsx +74 -0
- package/templates/nova/src/sections/TeamFounders/blocks/Person.tsx +28 -0
- package/templates/nova/src/sections/TeamFounders/index.ts +28 -0
- package/templates/nova/src/sections/TeamFounders/presets.ts +10 -0
- package/templates/nova/src/sections/TeamFounders/schema.ts +36 -0
- package/templates/nova/src/sections/Testimonials/Testimonials.tsx +83 -0
- package/templates/nova/src/sections/Testimonials/blocks/Testimonial.tsx +30 -0
- package/templates/nova/src/sections/Testimonials/index.ts +29 -0
- package/templates/nova/src/sections/Testimonials/presets.ts +10 -0
- package/templates/nova/src/sections/Testimonials/schema.ts +35 -0
- package/templates/nova/src/sections/Timeline/Timeline.tsx +43 -0
- package/templates/nova/src/sections/Timeline/blocks/Step.tsx +19 -0
- package/templates/nova/src/sections/Timeline/index.ts +28 -0
- package/templates/nova/src/sections/Timeline/presets.ts +8 -0
- package/templates/nova/src/sections/Timeline/schema.ts +31 -0
- package/templates/nova/src/sections/TrustBadges/TrustBadges.tsx +42 -0
- package/templates/nova/src/sections/TrustBadges/index.ts +29 -0
- package/templates/nova/src/sections/TrustBadges/presets.ts +8 -0
- package/templates/nova/src/sections/TrustBadges/schema.ts +29 -0
- package/templates/nova/src/sections/UgcGallery/UgcGallery.tsx +58 -0
- package/templates/nova/src/sections/UgcGallery/blocks/UgcImage.tsx +27 -0
- package/templates/nova/src/sections/UgcGallery/index.ts +31 -0
- package/templates/nova/src/sections/UgcGallery/presets.ts +8 -0
- package/templates/nova/src/sections/UgcGallery/schema.ts +35 -0
- package/templates/nova/src/sections/VideoHero/VideoHero.tsx +75 -0
- package/templates/nova/src/sections/VideoHero/index.ts +22 -0
- package/templates/nova/src/sections/VideoHero/presets.ts +8 -0
- package/templates/nova/src/sections/VideoHero/schema.ts +43 -0
- package/templates/nova/src/sections/data.ts +115 -0
- package/templates/nova/src/sections/shipped-copy.ts +25 -0
- package/templates/nova/src/sections/starter.ts +49 -0
- package/templates/nova/src/styles/Container.css +6 -0
- package/templates/nova/src/styles/Container.tsx +13 -0
- package/templates/nova/src/styles/Icon.css +2 -0
- package/templates/nova/src/styles/Icon.tsx +101 -0
- package/templates/nova/src/styles/NovaProvider.tsx +91 -0
- package/templates/nova/src/styles/base.css +142 -0
- package/templates/nova/src/styles/blocks.css +6 -0
- package/templates/nova/src/styles/fonts/OFL.txt +93 -0
- package/templates/nova/src/styles/fonts/geist-cyrillic-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-cyrillic.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-latin-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-latin.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-cyrillic-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-cyrillic.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-latin-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-latin.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-vietnamese.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-vietnamese.woff2 +0 -0
- package/templates/nova/src/styles/fonts.css +95 -0
- package/templates/nova/src/styles/global-settings.css +88 -0
- package/templates/nova/src/styles/index.css +6 -0
- package/templates/nova/src/styles/motion.ts +53 -0
- package/templates/nova/src/styles/scroll.ts +24 -0
- package/templates/nova/src/styles/sections/commerce.css +147 -0
- package/templates/nova/src/styles/sections/content.css +304 -0
- package/templates/nova/src/styles/sections/editorial.css +131 -0
- package/templates/nova/src/styles/sections/promotion.css +336 -0
- package/templates/nova/src/styles/sections/trust.css +117 -0
- package/templates/nova/src/styles/sections/utility.css +190 -0
- package/templates/nova/src/styles/strings.ts +492 -0
- package/templates/nova/src/styles/text.ts +4 -0
- package/templates/nova/src/styles/theme.ts +171 -0
- package/templates/nova/src/styles/tokens.css +600 -0
- package/templates/nova/src/styles/viewport.ts +23 -0
- package/templates/nova/template.json +94 -0
- package/templates/nova/templates/404.json +30 -0
- package/templates/nova/templates/account.json +15 -0
- package/templates/nova/templates/article.json +41 -0
- package/templates/nova/templates/article.longform.json +17 -0
- package/templates/nova/templates/blog.featured.json +22 -0
- package/templates/nova/templates/blog.json +29 -0
- package/templates/nova/templates/cart.json +67 -0
- package/templates/nova/templates/collection.featured.json +43 -0
- package/templates/nova/templates/collection.json +30 -0
- package/templates/nova/templates/contact.json +65 -0
- package/templates/nova/templates/index.json +167 -0
- package/templates/nova/templates/list-collections.json +19 -0
- package/templates/nova/templates/page.about.json +134 -0
- package/templates/nova/templates/page.contact.json +27 -0
- package/templates/nova/templates/page.json +27 -0
- package/templates/nova/templates/policy.json +23 -0
- package/templates/nova/templates/product.bundle.json +145 -0
- package/templates/nova/templates/product.json +119 -0
- package/templates/nova/templates/search.json +17 -0
- package/templates/nova/tests/abi-ai-contract.test.ts +99 -0
- package/templates/nova/tests/abi-forms.test.tsx +269 -0
- package/templates/nova/tests/abi-inventory.test.tsx +197 -0
- package/templates/nova/tests/abi-legacy-settings.test.tsx +105 -0
- package/templates/nova/tests/abi-opt-in.test.tsx +100 -0
- package/templates/nova/tests/abi-parity.test.tsx +95 -0
- package/templates/nova/tests/abi-r5-store-settings.test.tsx +337 -0
- package/templates/nova/tests/abi-render.test.tsx +178 -0
- package/templates/nova/tests/abi-shop-links.test.tsx +141 -0
- package/templates/nova/tests/abi-storefront-basics.test.tsx +233 -0
- package/templates/nova/tests/abi-variant-url.test.tsx +73 -0
- package/templates/nova/tests/add-refused-no-success.test.tsx +193 -0
- package/templates/nova/tests/architecture.test.ts +63 -0
- package/templates/nova/tests/architecture.ts +160 -0
- package/templates/nova/tests/audit-guards.test.ts +31 -0
- package/templates/nova/tests/bundle-split.test.ts +29 -0
- package/templates/nova/tests/cart-limit-message.test.tsx +212 -0
- package/templates/nova/tests/cart-link-message.test.tsx +98 -0
- package/templates/nova/tests/cases/components/Overview.cases.tsx +8 -0
- package/templates/nova/tests/cases/components/base/Accordion.cases.tsx +40 -0
- package/templates/nova/tests/cases/components/base/Badge.cases.tsx +30 -0
- package/templates/nova/tests/cases/components/base/Button.cases.tsx +73 -0
- package/templates/nova/tests/cases/components/base/Checkbox.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/base/Chip.cases.tsx +37 -0
- package/templates/nova/tests/cases/components/base/Divider.cases.tsx +26 -0
- package/templates/nova/tests/cases/components/base/IconButton.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/base/Input.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/base/Link.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/base/Radio.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/base/Select.cases.tsx +26 -0
- package/templates/nova/tests/cases/components/base/Skeleton.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/base/Spinner.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/base/Switch.cases.tsx +26 -0
- package/templates/nova/tests/cases/components/base/Tabs.cases.tsx +39 -0
- package/templates/nova/tests/cases/components/base/Textarea.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/commerce/AddToCart.cases.tsx +36 -0
- package/templates/nova/tests/cases/components/commerce/CartLine.cases.tsx +20 -0
- package/templates/nova/tests/cases/components/commerce/CartSummary.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/commerce/CollectionCard.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/commerce/ComparisonTable.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/commerce/Hotspot.cases.tsx +25 -0
- package/templates/nova/tests/cases/components/commerce/LookItem.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/commerce/PaymentMark.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/commerce/Price.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/commerce/ProductCard.cases.tsx +67 -0
- package/templates/nova/tests/cases/components/commerce/ProductGallery.cases.tsx +39 -0
- package/templates/nova/tests/cases/components/commerce/QuantitySelector.cases.tsx +31 -0
- package/templates/nova/tests/cases/components/commerce/Reviews.cases.tsx +35 -0
- package/templates/nova/tests/cases/components/commerce/Stars.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/commerce/VariantPicker.cases.tsx +38 -0
- package/templates/nova/tests/cases/components/commerce/blocks/Badge.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/commerce/blocks/PaymentIcons.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/commerce/blocks/Swatches.cases.tsx +22 -0
- package/templates/nova/tests/cases/components/content/ArticleCard.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/BeforeAfterSlider.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/CardRow.cases.tsx +23 -0
- package/templates/nova/tests/cases/components/content/CarouselControls.cases.tsx +48 -0
- package/templates/nova/tests/cases/components/content/ContentsNav.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/Countdown.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/content/HeroCopy.cases.tsx +42 -0
- package/templates/nova/tests/cases/components/content/HeroFrame.cases.tsx +22 -0
- package/templates/nova/tests/cases/components/content/HeroMedia.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/LongForm.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/MediaFrame.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/content/RichText.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/content/SectionHead.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/content/ShareButtons.cases.tsx +24 -0
- package/templates/nova/tests/cases/components/content/StoreCard.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/TestimonialCard.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/content/UgcTile.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/blocks/Button.cases.tsx +20 -0
- package/templates/nova/tests/cases/components/content/blocks/Column.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/blocks/Heading.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/blocks/Icon.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/blocks/Image.cases.tsx +22 -0
- package/templates/nova/tests/cases/components/content/blocks/Text.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/blocks/Video.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/forms/ContactForm.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/forms/FormField.cases.tsx +61 -0
- package/templates/nova/tests/cases/components/forms/NewsletterForm.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/forms/SearchField.cases.tsx +25 -0
- package/templates/nova/tests/cases/components/forms/blocks/Newsletter.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/navigation/BrandLogo.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/navigation/Breadcrumb.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/navigation/LocaleSelector.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/navigation/Menu.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/navigation/Pagination.cases.tsx +25 -0
- package/templates/nova/tests/cases/components/navigation/RecoveryLinks.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/navigation/SocialLinks.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/navigation/blocks/SocialLinks.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/overlays/AccountMenu.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/overlays/CartDrawer.cases.tsx +30 -0
- package/templates/nova/tests/cases/components/overlays/ConfirmationDialog.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/overlays/CookieConsent.cases.tsx +23 -0
- package/templates/nova/tests/cases/components/overlays/CookiePreferences.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/overlays/Drawer.cases.tsx +52 -0
- package/templates/nova/tests/cases/components/overlays/MarketSelector.cases.tsx +82 -0
- package/templates/nova/tests/cases/components/overlays/Menu.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/overlays/MobileNavDrawer.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/overlays/Modal.cases.tsx +71 -0
- package/templates/nova/tests/cases/components/overlays/Popover.cases.tsx +50 -0
- package/templates/nova/tests/cases/components/overlays/PromoPopup.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/overlays/QuickView.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/overlays/SearchModal.cases.tsx +60 -0
- package/templates/nova/tests/cases/components/overlays/Sheet.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/overlays/SizeGuide.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/overlays/Toast.cases.tsx +48 -0
- package/templates/nova/tests/cases/components/overlays/Tooltip.cases.tsx +33 -0
- package/templates/nova/tests/cases/components/states/Alert.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/states/EditorFrame.cases.tsx +36 -0
- package/templates/nova/tests/cases/components/states/Empty.cases.tsx +30 -0
- package/templates/nova/tests/cases/components/states/Error.cases.tsx +38 -0
- package/templates/nova/tests/cases/components/states/Loading.cases.tsx +15 -0
- package/templates/nova/tests/cases/components/states/MediaState.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/states/SkeletonLayout.cases.tsx +20 -0
- package/templates/nova/tests/cases/components/states/Unavailable.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/states/media/MediaError.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/states/media/MediaPlaceholder.cases.tsx +87 -0
- package/templates/nova/tests/cases/sections/Overview.cases.tsx +8 -0
- package/templates/nova/tests/cases/sections/commerce/collection-list/CollectionList.cases.tsx +46 -0
- package/templates/nova/tests/cases/sections/commerce/collection-list/blocks/CollectionItem.cases.tsx +18 -0
- package/templates/nova/tests/cases/sections/commerce/featured-collection/FeaturedCollection.cases.tsx +46 -0
- package/templates/nova/tests/cases/sections/commerce/featured-product/FeaturedProduct.cases.tsx +40 -0
- package/templates/nova/tests/cases/sections/commerce/main-collection/MainCollection.cases.tsx +81 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/ProductDetails.cases.tsx +110 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/AddToCartBlock.cases.tsx +21 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductDescription.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductInventory.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductPrice.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductSku.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductTitle.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/Quantity.cases.tsx +20 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/Tab.cases.tsx +29 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/VariantPickerBlock.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/commerce/product-grid/ProductGrid.cases.tsx +48 -0
- package/templates/nova/tests/cases/sections/commerce/product-recommendations/ProductRecommendations.cases.tsx +27 -0
- package/templates/nova/tests/cases/sections/commerce/recently-viewed/RecentlyViewed.cases.tsx +36 -0
- package/templates/nova/tests/cases/sections/content/article-body/ArticleBody.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/content/before-after/BeforeAfter.cases.tsx +40 -0
- package/templates/nova/tests/cases/sections/content/before-after/blocks/Comparison.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/content/blog-posts/BlogPosts.cases.tsx +47 -0
- package/templates/nova/tests/cases/sections/content/collection-links/CollectionLinks.cases.tsx +36 -0
- package/templates/nova/tests/cases/sections/content/faq/Faq.cases.tsx +38 -0
- package/templates/nova/tests/cases/sections/content/faq/blocks/FaqItem.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/content/feature-grid-blocks/FeatureGridBlocks.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/feature-highlights/FeatureHighlights.cases.tsx +26 -0
- package/templates/nova/tests/cases/sections/content/image-gallery/ImageGallery.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/image-with-text/ImageWithText.cases.tsx +35 -0
- package/templates/nova/tests/cases/sections/content/multicolumn/Multicolumn.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/content/page-body/PageBody.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/rich-text/RichTextSection.cases.tsx +33 -0
- package/templates/nova/tests/cases/sections/content/team-founders/TeamFounders.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/team-founders/blocks/Person.cases.tsx +18 -0
- package/templates/nova/tests/cases/sections/content/timeline/Timeline.cases.tsx +27 -0
- package/templates/nova/tests/cases/sections/content/timeline/blocks/Step.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/layout/announcement-bar/AnnouncementBar.cases.tsx +119 -0
- package/templates/nova/tests/cases/sections/layout/breadcrumbs/Breadcrumbs.cases.tsx +73 -0
- package/templates/nova/tests/cases/sections/layout/divider/Divider.cases.tsx +81 -0
- package/templates/nova/tests/cases/sections/layout/footer/Footer.cases.tsx +116 -0
- package/templates/nova/tests/cases/sections/layout/footer/blocks/FooterBrand.cases.tsx +27 -0
- package/templates/nova/tests/cases/sections/layout/footer/blocks/FooterMenu.cases.tsx +22 -0
- package/templates/nova/tests/cases/sections/layout/footer/blocks/FooterText.cases.tsx +20 -0
- package/templates/nova/tests/cases/sections/layout/group/Group.cases.tsx +185 -0
- package/templates/nova/tests/cases/sections/layout/group/blocks/Accordion.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/layout/group/blocks/JumboText.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/layout/group/blocks/Spacer.cases.tsx +33 -0
- package/templates/nova/tests/cases/sections/layout/header/Header.cases.tsx +277 -0
- package/templates/nova/tests/cases/sections/marketing/collection-banner/CollectionBanner.cases.tsx +62 -0
- package/templates/nova/tests/cases/sections/marketing/hero/Hero.cases.tsx +138 -0
- package/templates/nova/tests/cases/sections/marketing/marquee/Marquee.cases.tsx +63 -0
- package/templates/nova/tests/cases/sections/marketing/promo-banner/PromoBanner.cases.tsx +87 -0
- package/templates/nova/tests/cases/sections/marketing/slideshow/Slideshow.cases.tsx +113 -0
- package/templates/nova/tests/cases/sections/marketing/slideshow/blocks/Slide.cases.tsx +26 -0
- package/templates/nova/tests/cases/sections/marketing/video-hero/VideoHero.cases.tsx +72 -0
- package/templates/nova/tests/cases/sections/trust/comparison-table/ComparisonTableSection.cases.tsx +42 -0
- package/templates/nova/tests/cases/sections/trust/comparison-table/blocks/CompareItem.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/logo-list/LogoList.cases.tsx +29 -0
- package/templates/nova/tests/cases/sections/trust/logo-list/blocks/Logo.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/product-reviews/ProductReviews.cases.tsx +51 -0
- package/templates/nova/tests/cases/sections/trust/shop-the-look/ShopTheLook.cases.tsx +51 -0
- package/templates/nova/tests/cases/sections/trust/shop-the-look/blocks/Hotspot.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/testimonials/Testimonials.cases.tsx +61 -0
- package/templates/nova/tests/cases/sections/trust/testimonials/blocks/Testimonial.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/trust-badges/TrustBadges.cases.tsx +30 -0
- package/templates/nova/tests/cases/sections/trust/ugc-gallery/UgcGallery.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/trust/ugc-gallery/blocks/UgcImage.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/utility/account/Account.cases.tsx +44 -0
- package/templates/nova/tests/cases/sections/utility/cart-items/CartItems.cases.tsx +43 -0
- package/templates/nova/tests/cases/sections/utility/cart-items/blocks/CartBadge.cases.tsx +16 -0
- package/templates/nova/tests/cases/sections/utility/contact-form/ContactFormSection.cases.tsx +52 -0
- package/templates/nova/tests/cases/sections/utility/contact-form/blocks/ContactDetail.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/utility/newsletter/NewsletterSection.cases.tsx +109 -0
- package/templates/nova/tests/cases/sections/utility/not-found/NotFound.cases.tsx +28 -0
- package/templates/nova/tests/cases/sections/utility/policy-page/PolicyPage.cases.tsx +29 -0
- package/templates/nova/tests/cases/sections/utility/search-results/SearchResultsSection.cases.tsx +39 -0
- package/templates/nova/tests/cases/sections/utility/store-locator/StoreLocator.cases.tsx +40 -0
- package/templates/nova/tests/cases/styles/Borders.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Breakpoints.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Colors.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Elevation.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Icon.cases.tsx +23 -0
- package/templates/nova/tests/cases/styles/Layout.cases.tsx +8 -0
- package/templates/nova/tests/cases/styles/Motion.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Overview.cases.tsx +8 -0
- package/templates/nova/tests/cases/styles/Radius.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/SharedThemeSettings.cases.tsx +19 -0
- package/templates/nova/tests/cases/styles/Spacing.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Typography.cases.tsx +10 -0
- package/templates/nova/tests/cases.test.tsx +38 -0
- package/templates/nova/tests/components/PromoPopup.test.ts +21 -0
- package/templates/nova/tests/components/RichText.test.tsx +65 -0
- package/templates/nova/tests/components/formatDate.test.ts +10 -0
- package/templates/nova/tests/contract-locks.test.ts +23 -0
- package/templates/nova/tests/contracts.test.ts +153 -0
- package/templates/nova/tests/cookie-consent-privacy.test.tsx +128 -0
- package/templates/nova/tests/empty-store.test.tsx +81 -0
- package/templates/nova/tests/fixtures/commerce.ts +128 -0
- package/templates/nova/tests/fixtures/content.ts +58 -0
- package/templates/nova/tests/fixtures/index.ts +8 -0
- package/templates/nova/tests/fixtures/merch.ts +161 -0
- package/templates/nova/tests/fixtures/navigation.ts +125 -0
- package/templates/nova/tests/fixtures/promotion.ts +43 -0
- package/templates/nova/tests/fixtures/sample-store.json +1674 -0
- package/templates/nova/tests/fixtures/shop.ts +88 -0
- package/templates/nova/tests/fixtures/stress.ts +21 -0
- package/templates/nova/tests/inert.test.tsx +285 -0
- package/templates/nova/tests/line-add-friend.test.tsx +108 -0
- package/templates/nova/tests/localized-copy.test.ts +330 -0
- package/templates/nova/tests/product-template-blocks.test.ts +28 -0
- package/templates/nova/tests/rewards-launcher.test.tsx +401 -0
- package/templates/nova/tests/schema.test.ts +65 -0
- package/templates/nova/tests/schema.typetest.ts +7 -0
- package/templates/nova/tests/section-groups.test.ts +189 -0
- package/templates/nova/tests/sections/Group.test.tsx +37 -0
- package/templates/nova/tests/setup.ts +30 -0
- package/templates/nova/tests/starter.test.ts +56 -0
- package/templates/nova/tests/storefront-click-path.test.tsx +157 -0
- package/templates/nova/tests/styles/button-brand.test.ts +24 -0
- package/templates/nova/tests/styles/theme.test.ts +43 -0
- package/templates/nova/tests/styles/tokens.test.ts +35 -0
- package/templates/nova/tests/support/abi-ctx.ts +136 -0
- package/templates/nova/tests/support/block-stories.tsx +13 -0
- package/templates/nova/tests/support/case.tsx +102 -0
- package/templates/nova/tests/support/contracts.ts +30 -0
- package/templates/nova/tests/support/foundation-pages.tsx +260 -0
- package/templates/nova/tests/support/ia-pages.tsx +154 -0
- package/templates/nova/tests/support/listing-demo.tsx +29 -0
- package/templates/nova/tests/support/presets.ts +14 -0
- package/templates/nova/tests/support/sections.ts +36 -0
- package/templates/nova/tests/support/story-content.ts +321 -0
- package/templates/nova/tests/support/story-helpers.tsx +37 -0
- package/templates/nova/tests/support/with-nova.tsx +26 -0
- package/templates/nova/tests/theme-config.test.ts +82 -0
- package/templates/nova/tests/theme-integrity.test.ts +315 -0
- package/templates/nova/theme.config.ts +134 -0
- package/templates/nova/theme.manifest.json +17495 -0
- package/templates/nova/tsconfig.json +19 -0
- package/templates/nova/vite.abi-ssr.config.ts +37 -0
- package/templates/nova/vite.abi.config.ts +26 -0
- package/templates/nova/vitest.config.ts +20 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { sx, sxJoin } from '@tanqory/theme-kit'
|
|
2
|
+
import type { CSSProperties } from 'react'
|
|
3
|
+
import { Button } from '../base/Button'
|
|
4
|
+
import { RichText } from './RichText'
|
|
5
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
6
|
+
import './HeroCopy.css'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 12B · shared hero copy — eyebrow (13/500) → display heading → body (46ch)
|
|
10
|
+
* → at most two actions. Used by hero, slide, video-hero and collection-banner
|
|
11
|
+
* so every loud section speaks with one voice.
|
|
12
|
+
*
|
|
13
|
+
* headerSize small 48 · medium 72 · large 80 (390: 32 · 40 · 44), balanced,
|
|
14
|
+
* never truncated; a heading over 12 words steps down one size.
|
|
15
|
+
* onMedia white text; primary becomes white, secondary a white outline.
|
|
16
|
+
* secondary 'outline' on page layouts, 'link' on split / minimal and at 390
|
|
17
|
+
* on media ('responsive').
|
|
18
|
+
*/
|
|
19
|
+
export type HeroHeaderSize = 'small' | 'medium' | 'large'
|
|
20
|
+
export type HeroAlign = 'left' | 'center' | 'right'
|
|
21
|
+
export type HeroTextWidth = 'narrow' | 'medium' | 'wide'
|
|
22
|
+
|
|
23
|
+
export interface HeroAction {
|
|
24
|
+
label: string
|
|
25
|
+
link?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HeroCopyProps {
|
|
29
|
+
eyebrow?: string
|
|
30
|
+
heading?: string
|
|
31
|
+
/** Merchant rich text (sanitised by the adapter). */
|
|
32
|
+
body?: string
|
|
33
|
+
primary?: HeroAction
|
|
34
|
+
secondary?: HeroAction
|
|
35
|
+
/** How the second action renders. */
|
|
36
|
+
secondaryStyle?: 'outline' | 'link' | 'responsive'
|
|
37
|
+
/** Primary goes full width at 390 (image layouts). */
|
|
38
|
+
blockOnPhone?: boolean
|
|
39
|
+
/** Two outline-weight buttons share one row at equal width at 390 (text-first). */
|
|
40
|
+
pairOnPhone?: boolean
|
|
41
|
+
headerSize?: HeroHeaderSize
|
|
42
|
+
/** Element level — one h1 per page; the page decides. */
|
|
43
|
+
level?: 1 | 2 | 3
|
|
44
|
+
align?: HeroAlign
|
|
45
|
+
textWidth?: HeroTextWidth
|
|
46
|
+
onMedia?: boolean
|
|
47
|
+
/** 'split': heading beside body + actions (text-first, left-aligned, from 1024). */
|
|
48
|
+
arrange?: 'stack' | 'split'
|
|
49
|
+
className?: string
|
|
50
|
+
style?: CSSProperties
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const STEP_DOWN: Record<HeroHeaderSize, HeroHeaderSize> = { large: 'medium', medium: 'small', small: 'small' }
|
|
54
|
+
|
|
55
|
+
/** Words in a heading — Thai has no spaces, so a long run counts by length. */
|
|
56
|
+
function wordCount(s: string): number {
|
|
57
|
+
return s.trim().split(/\s+/).reduce((n, w) => n + Math.max(1, Math.ceil(w.length / 12)), 0)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function heroHasBody(eyebrow?: string, body?: string): boolean {
|
|
61
|
+
return Boolean(eyebrow?.trim() || body?.replace(/<[^>]*>/g, '').trim())
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function HeroCopy({
|
|
65
|
+
eyebrow,
|
|
66
|
+
heading,
|
|
67
|
+
body,
|
|
68
|
+
primary,
|
|
69
|
+
secondary,
|
|
70
|
+
secondaryStyle = 'outline',
|
|
71
|
+
blockOnPhone,
|
|
72
|
+
pairOnPhone,
|
|
73
|
+
headerSize = 'medium',
|
|
74
|
+
level = 2,
|
|
75
|
+
align = 'left',
|
|
76
|
+
textWidth,
|
|
77
|
+
onMedia,
|
|
78
|
+
arrange = 'stack',
|
|
79
|
+
className,
|
|
80
|
+
style,
|
|
81
|
+
}: HeroCopyProps): JSX.Element | null {
|
|
82
|
+
const { mode } = useNova()
|
|
83
|
+
const editor = mode === 'editor'
|
|
84
|
+
const H = `h${level}` as 'h2'
|
|
85
|
+
const size = heading && wordCount(heading) > 12 ? STEP_DOWN[headerSize] : headerSize
|
|
86
|
+
// An action needs a label AND a link: the storefront never renders a dead link.
|
|
87
|
+
// The editor keeps a labelled action without a link visible (disabled) so it can be finished.
|
|
88
|
+
const usable = (a?: HeroAction) => Boolean(a?.label.trim() && (a.link?.trim() || editor))
|
|
89
|
+
const hasPrimary = usable(primary)
|
|
90
|
+
const hasSecondary = usable(secondary)
|
|
91
|
+
if (!heading?.trim() && !eyebrow?.trim() && !body?.trim() && !hasPrimary && !hasSecondary) return null
|
|
92
|
+
return (
|
|
93
|
+
<div
|
|
94
|
+
className={sxJoin(['nv-hero-copy', className].filter(Boolean).join(' '), sx(style))}
|
|
95
|
+
data-align={align}
|
|
96
|
+
data-width={textWidth}
|
|
97
|
+
data-on-media={onMedia ? '' : undefined}
|
|
98
|
+
data-arrange={arrange === 'split' ? 'split' : undefined}
|
|
99
|
+
data-nv-surface={onMedia ? 'inverse' : undefined}
|
|
100
|
+
>
|
|
101
|
+
{eyebrow?.trim() && <p className="nv-hero-copy__eyebrow"><bdi>{eyebrow}</bdi></p>}
|
|
102
|
+
{heading?.trim() && (
|
|
103
|
+
<H className="nv-hero-copy__heading" data-size={size}>
|
|
104
|
+
<bdi>{heading}</bdi>
|
|
105
|
+
</H>
|
|
106
|
+
)}
|
|
107
|
+
{body?.trim() && <RichText html={body} className="nv-hero-copy__body" />}
|
|
108
|
+
{(hasPrimary || hasSecondary) && (
|
|
109
|
+
<div className="nv-hero-copy__actions" data-block-phone={blockOnPhone ? '' : undefined} data-pair-phone={pairOnPhone && hasPrimary && hasSecondary ? '' : undefined}>
|
|
110
|
+
{hasPrimary && (
|
|
111
|
+
<Action action={primary!} variant="primary" className="nv-hero-copy__primary" />
|
|
112
|
+
)}
|
|
113
|
+
{hasSecondary && (
|
|
114
|
+
<Action action={secondary!} variant={secondaryStyle === 'link' ? 'tertiary' : 'secondary'} className="nv-hero-copy__secondary" data-style={secondaryStyle} />
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** A link when it has a destination; in the editor, a disabled button until it does. */
|
|
123
|
+
function Action({ action, ...rest }: { action: HeroAction; variant: 'primary' | 'secondary' | 'tertiary'; className: string; 'data-style'?: string }): JSX.Element {
|
|
124
|
+
const link = action.link?.trim()
|
|
125
|
+
return link ? (
|
|
126
|
+
<Button href={link} size="lg" {...rest}>
|
|
127
|
+
<bdi>{action.label}</bdi>
|
|
128
|
+
</Button>
|
|
129
|
+
) : (
|
|
130
|
+
<Button size="lg" disabled {...rest}>
|
|
131
|
+
<bdi>{action.label}</bdi>
|
|
132
|
+
</Button>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The overlay floor (Nova 11 · B6, 12B · 00): the merchant picks a strength,
|
|
138
|
+
* the theme enforces a minimum wherever text sits on media — 45% for large
|
|
139
|
+
* text + buttons only, 62% once eyebrow or body text is on the image.
|
|
140
|
+
* `strength` is an overlay ID or a percentage (overlayOpacity).
|
|
141
|
+
*/
|
|
142
|
+
export const OVERLAY_STRENGTH = { none: 0, light: 0.3, medium: 0.45, strong: 0.62 } as const
|
|
143
|
+
export type OverlayId = keyof typeof OVERLAY_STRENGTH
|
|
144
|
+
|
|
145
|
+
export function scrimAlpha(strength: OverlayId | number, hasBody: boolean): number {
|
|
146
|
+
const chosen = typeof strength === 'number' ? strength / 100 : OVERLAY_STRENGTH[strength]
|
|
147
|
+
return Math.max(chosen, hasBody ? 0.62 : 0.45)
|
|
148
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* 12B · 00 a frame of media with hero copy anchored on it — hero
|
|
2
|
+
(image-background / contained), slide, video-hero, collection-banner.
|
|
3
|
+
Height comes from the owner's --nv-hero-h (the one ladder). */
|
|
4
|
+
/* A frame of media with copy anchored on it (hero image-background / contained,
|
|
5
|
+
slide, video-hero, collection-banner with image). */
|
|
6
|
+
.nv-media-frame {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: grid;
|
|
9
|
+
min-height: var(--nv-hero-h);
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
isolation: isolate;
|
|
12
|
+
background: var(--color-media-bg);
|
|
13
|
+
color: var(--color-fg-inverse);
|
|
14
|
+
}
|
|
15
|
+
.nv-media-frame__scrim { position: absolute; inset: 0; z-index: var(--z-raised); pointer-events: none; }
|
|
16
|
+
/* Centred copy: a flat overlay (text is mid-image). */
|
|
17
|
+
.nv-media-frame[data-position='middle'] .nv-media-frame__scrim,
|
|
18
|
+
.nv-media-frame[data-position='center'] .nv-media-frame__scrim { background: rgb(0 0 0 / var(--nv-scrim, 0.45)); }
|
|
19
|
+
/* Moving video: an 18% base wash across the whole frame, plus the floor at the text. */
|
|
20
|
+
.nv-media-frame[data-has-video]:not([data-position='middle'], [data-position='center']) .nv-media-frame__scrim { background: rgb(0 0 0 / var(--hero-video-wash)); }
|
|
21
|
+
|
|
22
|
+
.nv-media-frame__anchor {
|
|
23
|
+
position: relative;
|
|
24
|
+
z-index: var(--z-raised);
|
|
25
|
+
display: grid;
|
|
26
|
+
align-content: end;
|
|
27
|
+
justify-items: start;
|
|
28
|
+
padding: var(--hero-inset-block) var(--hero-inset-inline);
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
.nv-media-frame__anchor > * { pointer-events: auto; }
|
|
32
|
+
.nv-media-frame[data-position='top'] .nv-media-frame__anchor { align-content: start; }
|
|
33
|
+
.nv-media-frame:is([data-position='middle'], [data-position='center']) .nv-media-frame__anchor { align-content: center; }
|
|
34
|
+
.nv-media-frame[data-align='center'] .nv-media-frame__anchor,
|
|
35
|
+
.nv-media-frame[data-position='center'] .nv-media-frame__anchor { justify-items: center; }
|
|
36
|
+
.nv-media-frame[data-align='right'] .nv-media-frame__anchor { justify-items: end; }
|
|
37
|
+
|
|
38
|
+
/* The floor gradient starts at the text edge and grows with the text height. */
|
|
39
|
+
.nv-media-frame__copy { position: relative; }
|
|
40
|
+
.nv-media-frame:not([data-position='middle'], [data-position='center']) .nv-media-frame__copy::before {
|
|
41
|
+
content: '';
|
|
42
|
+
position: absolute;
|
|
43
|
+
z-index: -1;
|
|
44
|
+
inset-inline: -200vw;
|
|
45
|
+
inset-block-start: calc(-1 * var(--space-10));
|
|
46
|
+
inset-block-end: calc(-1 * var(--hero-inset-block));
|
|
47
|
+
background: linear-gradient(to top, rgb(0 0 0 / var(--nv-scrim, 0.45)) 0%, rgb(0 0 0 / var(--nv-scrim, 0.45)) calc(100% - var(--space-10)), rgb(0 0 0 / 0) 100%);
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
}
|
|
50
|
+
.nv-media-frame[data-position='top'] .nv-media-frame__copy::before {
|
|
51
|
+
inset-block-start: calc(-1 * var(--hero-inset-block));
|
|
52
|
+
inset-block-end: calc(-1 * var(--space-10));
|
|
53
|
+
background: linear-gradient(to bottom, rgb(0 0 0 / var(--nv-scrim, 0.45)) 0%, rgb(0 0 0 / var(--nv-scrim, 0.45)) calc(100% - var(--space-10)), rgb(0 0 0 / 0) 100%);
|
|
54
|
+
}
|
|
55
|
+
/* A pause button sits beside the copy, never over it. */
|
|
56
|
+
.nv-media-frame[data-has-video][data-align='right'] .nv-media-frame__anchor {
|
|
57
|
+
padding-inline-end: calc(var(--hero-inset-inline) + var(--touch-target) + var(--space-3));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* 390: media is 4:5; copy anchors bottom unless middle; a video's pause sits beside the copy. */
|
|
61
|
+
@media (max-width: 639.98px) {
|
|
62
|
+
.nv-media-frame { min-height: 0; aspect-ratio: 4 / 5; }
|
|
63
|
+
.nv-media-frame[data-position='top'] .nv-media-frame__anchor { align-content: end; }
|
|
64
|
+
.nv-media-frame[data-position='top'] .nv-media-frame__copy::before {
|
|
65
|
+
inset-block-start: calc(-1 * var(--space-10));
|
|
66
|
+
inset-block-end: calc(-1 * var(--hero-inset-block));
|
|
67
|
+
background: linear-gradient(to top, rgb(0 0 0 / var(--nv-scrim, 0.45)) 0%, rgb(0 0 0 / var(--nv-scrim, 0.45)) calc(100% - var(--space-10)), rgb(0 0 0 / 0) 100%);
|
|
68
|
+
}
|
|
69
|
+
.nv-media-frame[data-has-video] .nv-media-frame__anchor { padding-inline-end: calc(var(--hero-inset-inline) + var(--touch-target) + var(--space-3)); }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* No media (a slide without image): the muted surface with ink text. */
|
|
73
|
+
.nv-media-frame[data-empty] { background: var(--color-bg-muted); color: var(--color-fg); }
|
|
74
|
+
/* Controls never overlap copy: reserve their row when they share the copy's edge. */
|
|
75
|
+
.nv-media-frame[data-reserve] .nv-media-frame__anchor { padding-block-end: calc(var(--hero-inset-block) + var(--touch-target) + var(--space-5)); }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { sx, sxJoin } from '@tanqory/theme-kit'
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react'
|
|
3
|
+
import './HeroFrame.css'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 12B · 00 the shared "copy on media" frame: media layer → scrim → anchored
|
|
7
|
+
* copy. The anchor grid is position × alignment (hero / slide store
|
|
8
|
+
* top · middle · bottom × left · center · right; video-hero and
|
|
9
|
+
* collection-banner store bottom-start · center — same labels). Height is the
|
|
10
|
+
* owner's --nv-hero-h; 4:5 at 390.
|
|
11
|
+
*
|
|
12
|
+
* scrim the effective overlay (after the 45 / 62 floor), 0–1
|
|
13
|
+
* middle / center → a flat overlay; otherwise a gradient from the text edge
|
|
14
|
+
* that grows with the text height; moving video adds an 18% base wash.
|
|
15
|
+
*/
|
|
16
|
+
export interface HeroFrameProps {
|
|
17
|
+
position: 'top' | 'middle' | 'bottom' | 'bottom-start' | 'center'
|
|
18
|
+
align?: 'left' | 'center' | 'right'
|
|
19
|
+
scrim: number
|
|
20
|
+
media?: ReactNode
|
|
21
|
+
hasVideo?: boolean
|
|
22
|
+
/** No media: muted surface, ink text, no scrim. */
|
|
23
|
+
empty?: boolean
|
|
24
|
+
/** Reserve the control row under the copy. */
|
|
25
|
+
reserveControls?: boolean
|
|
26
|
+
/** The copy (render it with className="nv-media-frame__copy"). */
|
|
27
|
+
children?: ReactNode
|
|
28
|
+
/** Layers above the copy (slideshow controls). */
|
|
29
|
+
overlay?: ReactNode
|
|
30
|
+
className?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function HeroFrame({ position, align = 'left', scrim, media, hasVideo, empty, reserveControls, children, overlay, className }: HeroFrameProps): JSX.Element {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
className={sxJoin(['nv-media-frame', className].filter(Boolean).join(' '), sx({ '--nv-scrim': scrim } as CSSProperties))}
|
|
37
|
+
data-position={position}
|
|
38
|
+
data-align={align}
|
|
39
|
+
data-has-video={hasVideo ? '' : undefined}
|
|
40
|
+
data-empty={empty ? '' : undefined}
|
|
41
|
+
data-reserve={reserveControls ? '' : undefined}
|
|
42
|
+
>
|
|
43
|
+
{media}
|
|
44
|
+
{!empty && <div className="nv-media-frame__scrim" aria-hidden />}
|
|
45
|
+
<div className="nv-media-frame__anchor">{children}</div>
|
|
46
|
+
{overlay}
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* 12B · shared hero media — fills its positioned parent. */
|
|
2
|
+
.nv-hero-media {
|
|
3
|
+
position: absolute;
|
|
4
|
+
inset: 0;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background: var(--color-media-bg);
|
|
7
|
+
}
|
|
8
|
+
.nv-hero-media picture { display: contents; }
|
|
9
|
+
.nv-hero-media__img,
|
|
10
|
+
.nv-hero-media__video {
|
|
11
|
+
position: absolute;
|
|
12
|
+
inset: 0;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
object-fit: cover;
|
|
16
|
+
object-position: var(--nv-focal, 50% 50%);
|
|
17
|
+
}
|
|
18
|
+
.nv-hero-media__img { transition: opacity var(--duration-base) var(--ease-standard); }
|
|
19
|
+
.nv-hero-media[aria-busy='true'] .nv-hero-media__img { opacity: 0; }
|
|
20
|
+
.nv-hero-media[data-fit='contain'] { background: var(--color-bg-muted); }
|
|
21
|
+
.nv-hero-media[data-fit='contain'] :is(.nv-hero-media__img, .nv-hero-media__video) { object-fit: contain; }
|
|
22
|
+
.nv-hero-media[data-focal='top'] { --nv-focal: 50% 0%; }
|
|
23
|
+
.nv-hero-media[data-focal='bottom'] { --nv-focal: 50% 100%; }
|
|
24
|
+
.nv-hero-media[data-focal='left'] { --nv-focal: 0% 50%; }
|
|
25
|
+
.nv-hero-media[data-focal='right'] { --nv-focal: 100% 50%; }
|
|
26
|
+
|
|
27
|
+
/* The poster is the first paint; the video fades in only once it plays. */
|
|
28
|
+
.nv-hero-media__video { opacity: 0; transition: opacity var(--duration-hero) var(--ease-standard); }
|
|
29
|
+
.nv-hero-media[data-video='playing'] .nv-hero-media__video { opacity: 1; }
|
|
30
|
+
|
|
31
|
+
/* Pause / play: 44px, bottom inline-end, above the scrim and the copy layer. */
|
|
32
|
+
.nv-hero-media__control.nv-icon-btn {
|
|
33
|
+
position: absolute;
|
|
34
|
+
z-index: var(--z-raised);
|
|
35
|
+
inset-block-end: var(--nv-media-control-block, var(--hero-inset-block));
|
|
36
|
+
inset-inline-end: var(--nv-media-control-inline, var(--hero-inset-inline));
|
|
37
|
+
background: var(--color-media-control);
|
|
38
|
+
color: var(--color-fg-inverse);
|
|
39
|
+
}
|
|
40
|
+
.nv-hero-media__control.nv-icon-btn:hover { background: var(--color-media-control-hover); }
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import type { NovaImage, NovaVideo } from '@tanqory/theme-kit'
|
|
3
|
+
import { IconButton } from '../base/IconButton'
|
|
4
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
5
|
+
import { prefersLightMedia, useInView, useReducedMotion } from '../../styles/motion'
|
|
6
|
+
import './HeroMedia.css'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 12B · shared hero media — the picture behind or beside hero copy, used by
|
|
10
|
+
* hero, slide, video-hero and collection-banner.
|
|
11
|
+
*
|
|
12
|
+
* image + mobileImage (<640) · cover | contain · focal point (object-position)
|
|
13
|
+
* optional background video: muted, looped, playsinline; the image is the
|
|
14
|
+
* POSTER and the first paint. The video fades in once it plays. Reduced
|
|
15
|
+
* motion → poster + play button (never autoplays). Save-Data / 2G → poster
|
|
16
|
+
* only. Failure → poster, controls hide. Out of view → paused.
|
|
17
|
+
* A pause button (44px) is ALWAYS shown while a video can play (WCAG 2.2.2).
|
|
18
|
+
*
|
|
19
|
+
* Fills its positioned parent. Never fetches; the adapter resolves media.
|
|
20
|
+
*/
|
|
21
|
+
export type FocalPoint = 'center' | 'top' | 'bottom' | 'left' | 'right'
|
|
22
|
+
|
|
23
|
+
export interface HeroMediaProps {
|
|
24
|
+
image?: NovaImage | null
|
|
25
|
+
/** Replaces `image` below 640px; falls back to it. */
|
|
26
|
+
mobileImage?: NovaImage | null
|
|
27
|
+
video?: NovaVideo | null
|
|
28
|
+
/** Replaces `video` below 640px; falls back to it. */
|
|
29
|
+
mobileVideo?: NovaVideo | null
|
|
30
|
+
fit?: 'cover' | 'contain'
|
|
31
|
+
focal?: FocalPoint
|
|
32
|
+
/** The first hero on the page loads eagerly; later slides lazily. */
|
|
33
|
+
priority?: boolean
|
|
34
|
+
/** Controlled pause — a slideshow's one pause button drives its video too. */
|
|
35
|
+
paused?: boolean
|
|
36
|
+
/** Render the pause / play button (default true). A slideshow renders its own. */
|
|
37
|
+
control?: boolean
|
|
38
|
+
onTogglePause?: (paused: boolean) => void
|
|
39
|
+
/** Fired each time the video completes a loop (slide timer waits for it). */
|
|
40
|
+
onLoop?: () => void
|
|
41
|
+
/** The image failed to load — the section falls back (hero → text only). */
|
|
42
|
+
onImageError?: () => void
|
|
43
|
+
className?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const PHONE = '(max-width: 639.98px)'
|
|
47
|
+
|
|
48
|
+
export function HeroMedia({ image, mobileImage, video, mobileVideo, fit = 'cover', focal = 'center', priority, paused: controlled, control = true, onTogglePause, onLoop, onImageError, className }: HeroMediaProps): JSX.Element | null {
|
|
49
|
+
const { strings } = useNova()
|
|
50
|
+
const root = useRef<HTMLDivElement>(null)
|
|
51
|
+
const el = useRef<HTMLVideoElement>(null)
|
|
52
|
+
const reduced = useReducedMotion(root)
|
|
53
|
+
const inView = useInView(root)
|
|
54
|
+
const [light, setLight] = useState(false)
|
|
55
|
+
const [phone, setPhone] = useState(false)
|
|
56
|
+
// Keyed by src: a new image starts loading without an effect racing its load event.
|
|
57
|
+
const [img, setImg] = useState<{ src: string; state: 'loaded' | 'error' } | null>(null)
|
|
58
|
+
const [videoState, setVideoState] = useState<'idle' | 'playing' | 'failed'>('idle')
|
|
59
|
+
// The shopper's own choice; reduced motion starts paused (play is offered).
|
|
60
|
+
const [userPaused, setUserPaused] = useState<boolean | null>(null)
|
|
61
|
+
const lastTime = useRef(0)
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
setLight(prefersLightMedia())
|
|
65
|
+
const mq = window.matchMedia?.(PHONE)
|
|
66
|
+
const read = () => setPhone(Boolean(mq?.matches))
|
|
67
|
+
read()
|
|
68
|
+
mq?.addEventListener?.('change', read)
|
|
69
|
+
return () => mq?.removeEventListener?.('change', read)
|
|
70
|
+
}, [])
|
|
71
|
+
|
|
72
|
+
const poster = image ?? video?.poster ?? null
|
|
73
|
+
const mobilePoster = mobileImage ?? (mobileVideo ? mobileVideo.poster : null) ?? null
|
|
74
|
+
// The phone file is chosen declaratively (<source media>), at load.
|
|
75
|
+
const clip = video ?? mobileVideo ?? null
|
|
76
|
+
const phoneClip = mobileVideo && mobileVideo.src !== clip?.src ? mobileVideo : null
|
|
77
|
+
const canPlay = Boolean(clip) && !light && videoState !== 'failed'
|
|
78
|
+
const paused = controlled ?? userPaused ?? reduced
|
|
79
|
+
const shouldPlay = canPlay && !paused && inView
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const v = el.current
|
|
83
|
+
if (!v) return
|
|
84
|
+
if (shouldPlay) {
|
|
85
|
+
const p = v.play?.()
|
|
86
|
+
if (p && typeof p.catch === 'function') p.catch(() => {})
|
|
87
|
+
} else v.pause?.()
|
|
88
|
+
}, [shouldPlay, clip?.src, phoneClip?.src])
|
|
89
|
+
|
|
90
|
+
useEffect(() => setVideoState('idle'), [clip?.src, phoneClip?.src])
|
|
91
|
+
|
|
92
|
+
if (!poster && !clip) return null
|
|
93
|
+
const imgState = img && img.src === poster?.src ? img.state : 'loading'
|
|
94
|
+
const setImgState = (state: 'loaded' | 'error') => poster && setImg({ src: poster.src, state })
|
|
95
|
+
|
|
96
|
+
const toggle = () => {
|
|
97
|
+
const next = !paused
|
|
98
|
+
if (controlled === undefined) setUserPaused(next)
|
|
99
|
+
onTogglePause?.(next)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<div ref={root} className={['nv-hero-media', className].filter(Boolean).join(' ')} data-fit={fit} data-focal={focal} aria-busy={imgState === 'loading' ? true : undefined} data-video={videoState === 'playing' ? 'playing' : undefined}>
|
|
104
|
+
{poster && imgState !== 'error' && (
|
|
105
|
+
<picture>
|
|
106
|
+
{mobilePoster && <source media={PHONE} srcSet={mobilePoster.srcSet ?? mobilePoster.src} />}
|
|
107
|
+
<img
|
|
108
|
+
className="nv-hero-media__img"
|
|
109
|
+
src={poster.src}
|
|
110
|
+
srcSet={poster.srcSet}
|
|
111
|
+
sizes={poster.srcSet ? '100vw' : undefined}
|
|
112
|
+
alt={poster.alt ?? ''}
|
|
113
|
+
width={poster.width}
|
|
114
|
+
height={poster.height}
|
|
115
|
+
loading={priority ? 'eager' : 'lazy'}
|
|
116
|
+
// React 18 passes the lowercase attribute through.
|
|
117
|
+
{...({ fetchpriority: priority ? 'high' : undefined } as object)}
|
|
118
|
+
decoding="async"
|
|
119
|
+
onLoad={() => setImgState('loaded')}
|
|
120
|
+
onError={() => {
|
|
121
|
+
setImgState('error')
|
|
122
|
+
onImageError?.()
|
|
123
|
+
}}
|
|
124
|
+
ref={(el) => {
|
|
125
|
+
if (el?.complete && el.naturalWidth > 0 && imgState === 'loading') setImgState('loaded')
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</picture>
|
|
129
|
+
)}
|
|
130
|
+
{canPlay && clip && (
|
|
131
|
+
<video
|
|
132
|
+
ref={el}
|
|
133
|
+
key={`${phoneClip?.src ?? ''}|${clip.src}`}
|
|
134
|
+
className="nv-hero-media__video"
|
|
135
|
+
poster={(phone ? mobilePoster : null)?.src ?? poster?.src}
|
|
136
|
+
muted
|
|
137
|
+
loop
|
|
138
|
+
playsInline
|
|
139
|
+
autoPlay={shouldPlay}
|
|
140
|
+
preload={priority ? 'auto' : 'metadata'}
|
|
141
|
+
aria-hidden
|
|
142
|
+
tabIndex={-1}
|
|
143
|
+
onPlaying={() => setVideoState('playing')}
|
|
144
|
+
// A <source> whose media does not match fires "error" by spec, and React
|
|
145
|
+
// forwards it here: only a video with NO usable source has failed.
|
|
146
|
+
onError={() => window.setTimeout(() => {
|
|
147
|
+
const v = el.current
|
|
148
|
+
if (v && (v.error || v.networkState === 3 /* HTMLMediaElement.NETWORK_NO_SOURCE */)) setVideoState('failed')
|
|
149
|
+
}, 50)}
|
|
150
|
+
onTimeUpdate={(e) => {
|
|
151
|
+
const t = e.currentTarget.currentTime
|
|
152
|
+
if (t + 0.25 < lastTime.current) onLoop?.()
|
|
153
|
+
lastTime.current = t
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
{phoneClip && <source src={phoneClip.src} media={PHONE} />}
|
|
157
|
+
<source src={clip.src} />
|
|
158
|
+
</video>
|
|
159
|
+
)}
|
|
160
|
+
{canPlay && control && (
|
|
161
|
+
<IconButton
|
|
162
|
+
className="nv-hero-media__control"
|
|
163
|
+
icon={paused ? 'play' : 'pause'}
|
|
164
|
+
label={paused ? strings.playVideo : strings.pauseVideo}
|
|
165
|
+
onClick={toggle}
|
|
166
|
+
/>
|
|
167
|
+
)}
|
|
168
|
+
</div>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* 12E · 00 prose system. Text stays at the narrow measure; figures, tables and embeds break out to 960. */
|
|
2
|
+
.nv-longform {
|
|
3
|
+
--nv-lf-text: var(--container-narrow);
|
|
4
|
+
--nv-lf-wide: var(--container-content);
|
|
5
|
+
display: grid;
|
|
6
|
+
grid-template-columns: minmax(0, 1fr);
|
|
7
|
+
justify-items: center;
|
|
8
|
+
font-size: var(--text-body-lg);
|
|
9
|
+
line-height: var(--leading-loose);
|
|
10
|
+
color: var(--color-fg);
|
|
11
|
+
}
|
|
12
|
+
.nv-longform[data-measure='content'] { --nv-lf-text: var(--container-content); }
|
|
13
|
+
.nv-longform[data-measure='standard'] { --nv-lf-text: var(--container-standard); --nv-lf-wide: var(--container-standard); }
|
|
14
|
+
.nv-longform > * { width: 100%; max-width: var(--nv-lf-text); margin: 0; }
|
|
15
|
+
.nv-longform > :is(figure, .nv-longform__table, iframe, video, img) { max-width: var(--nv-lf-wide); }
|
|
16
|
+
.nv-longform > * + * { margin-block-start: 1.25rem; }
|
|
17
|
+
.nv-longform h2 { font-size: 1.75rem; line-height: 1.2; letter-spacing: var(--tracking-h2); font-weight: var(--weight-heading); margin-block-start: 2.5rem; scroll-margin-top: var(--space-8); }
|
|
18
|
+
.nv-longform h3 { font-size: 1.3125rem; line-height: 1.3; font-weight: var(--weight-heading); margin-block-start: 1.75rem; }
|
|
19
|
+
.nv-longform h4 { font-size: 0.9375rem; line-height: 1.4; font-weight: var(--weight-strong); margin-block-start: 1.25rem; }
|
|
20
|
+
.nv-longform :is(h2, h3, h4) + * { margin-block-start: 0.75rem; }
|
|
21
|
+
.nv-longform a { color: var(--color-fg); text-decoration: underline; text-decoration-color: var(--color-border-emphasis); text-underline-offset: var(--underline-offset-lg); }
|
|
22
|
+
.nv-longform a:hover { text-decoration-color: currentColor; }
|
|
23
|
+
.nv-longform :is(ul, ol) { padding-inline-start: 1.5rem; }
|
|
24
|
+
.nv-longform ul { list-style: disc; }
|
|
25
|
+
.nv-longform ol { list-style: decimal; }
|
|
26
|
+
.nv-longform li::marker { color: var(--color-fg-muted); }
|
|
27
|
+
.nv-longform li + li { margin-block-start: 0.375rem; }
|
|
28
|
+
.nv-longform ol { font-variant-numeric: tabular-nums; }
|
|
29
|
+
.nv-longform blockquote { padding-inline-start: 1.25rem; border-inline-start: 2px solid var(--color-fg); font-size: 1.375rem; line-height: 1.45; font-weight: var(--weight-medium); }
|
|
30
|
+
.nv-longform figure img, .nv-longform > img { display: block; width: 100%; height: auto; border-radius: var(--radius-media); }
|
|
31
|
+
.nv-longform figcaption { margin-block-start: var(--space-2); font-size: var(--type-caption); color: var(--color-fg-muted); }
|
|
32
|
+
.nv-longform__table { overflow-x: auto; }
|
|
33
|
+
.nv-longform table { width: 100%; border-collapse: collapse; font-size: 0.90625rem; }
|
|
34
|
+
.nv-longform th { text-align: start; font-weight: var(--weight-medium); padding: var(--space-3) var(--space-3) var(--space-3) 0; border-block-end: 1px solid var(--color-fg); }
|
|
35
|
+
.nv-longform td { padding: var(--space-3) var(--space-3) var(--space-3) 0; border-block-end: var(--border-subtle); }
|
|
36
|
+
.nv-longform hr { height: 1px; border: 0; background: var(--color-border); margin-block: 1.5rem; }
|
|
37
|
+
.nv-longform code { padding: 0.1em 0.35em; border-radius: var(--radius-sm); background: var(--color-bg-muted); font-family: var(--font-mono); font-size: 0.875rem; }
|
|
38
|
+
.nv-longform iframe, .nv-longform video { aspect-ratio: 16 / 9; width: 100%; height: auto; border: 0; border-radius: var(--radius-media); }
|
|
39
|
+
.nv-root:lang(th) .nv-longform, .nv-root :lang(th) .nv-longform { line-height: 1.85; }
|
|
40
|
+
.nv-root[dir='rtl'] .nv-longform { line-height: 1.8; }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import './LongForm.css'
|
|
3
|
+
import { isolateParagraphs } from './RichText'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 12E · 00 the prose system — every richtext element, one measure. Any
|
|
7
|
+
* merchant text looks typeset: body 17 / 1.75 at a 640 measure (960 for
|
|
8
|
+
* figures and tables), h2 · h3 · h4 28 / 21 / 15, lists, blockquote, figure,
|
|
9
|
+
* table (scrolls at 390), hr, code, embeds 16:9. The page / article title is
|
|
10
|
+
* the only h1: an h1 inside the richtext becomes an h2.
|
|
11
|
+
* Used by page-body, article-body, policy-page (12G) and any long richtext.
|
|
12
|
+
* The adapter sanitises the HTML; this only renders it.
|
|
13
|
+
*/
|
|
14
|
+
export interface LongFormProps {
|
|
15
|
+
html: string
|
|
16
|
+
/** narrow 640 · content 960 · standard 1280 (text never wider than 640 unless standard). */
|
|
17
|
+
measure?: 'narrow' | 'content' | 'standard'
|
|
18
|
+
/** Give each h2 an id (article contents). */
|
|
19
|
+
headingIds?: boolean
|
|
20
|
+
className?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function slug(text: string): string {
|
|
24
|
+
return text.toLowerCase().replace(/<[^>]*>/g, '').replace(/[^\p{L}\p{N}]+/gu, '-').replace(/^-|-$/g, '') || 'section'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The article's h2 headings (text + id), for a contents list. */
|
|
28
|
+
export function headingsOf(html: string): { id: string; text: string }[] {
|
|
29
|
+
return [...html.matchAll(/<h[12][^>]*>([\s\S]*?)<\/h[12]>/gi)].map((m) => {
|
|
30
|
+
const text = m[1].replace(/<[^>]*>/g, '').trim()
|
|
31
|
+
return { id: slug(text), text }
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function prepare(html: string, ids: boolean): string {
|
|
36
|
+
let out = html.replace(/<h1(\s|>)/gi, '<h2$1').replace(/<\/h1>/gi, '</h2>')
|
|
37
|
+
if (ids) out = out.replace(/<h2([^>]*)>([\s\S]*?)<\/h2>/gi, (_, attrs: string, inner: string) => (/\sid=/.test(attrs) ? `<h2${attrs}>${inner}</h2>` : `<h2${attrs} id="${slug(inner)}">${inner}</h2>`))
|
|
38
|
+
// Tables scroll inside their own wrapper at 390, never the page.
|
|
39
|
+
out = out.replace(/<table/gi, '<div class="nv-longform__table"><table').replace(/<\/table>/gi, '</table></div>')
|
|
40
|
+
return out
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function LongForm({ html, measure = 'narrow', headingIds, className }: LongFormProps): JSX.Element | null {
|
|
44
|
+
// Heading ids first (they read the raw headings), then each paragraph's merchant text in <bdi>.
|
|
45
|
+
const prepared = useMemo(() => isolateParagraphs(prepare(html, Boolean(headingIds))), [html, headingIds])
|
|
46
|
+
if (!html.replace(/<[^>]*>/g, '').trim()) return null
|
|
47
|
+
return <div className={['nv-longform', className].filter(Boolean).join(' ')} data-measure={measure} dangerouslySetInnerHTML={{ __html: prepared }} />
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Reading time: ≈ 230 words a minute; Thai (no spaces) by character count. */
|
|
51
|
+
export function readingMinutes(html: string): number {
|
|
52
|
+
const text = html.replace(/<[^>]*>/g, ' ')
|
|
53
|
+
const thai = (text.match(/[-]/g) ?? []).length
|
|
54
|
+
const words = text.replace(/[-]/g, ' ').split(/\s+/).filter(Boolean).length
|
|
55
|
+
return Math.max(1, Math.round(words / 230 + thai / 900))
|
|
56
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
.nv-image { position: relative; display: grid; place-items: center; width: 100%; overflow: hidden; background: var(--color-media-bg); color: var(--color-fg-subtle); }
|
|
2
|
+
.nv-image[data-rounded] { border-radius: var(--radius-media); }
|
|
3
|
+
.nv-image img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--duration-base) var(--ease-standard); }
|
|
4
|
+
.nv-image[data-fit='contain'] img { object-fit: contain; }
|
|
5
|
+
.nv-image[aria-busy='true'] img { opacity: 0; }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { sx, sxJoin } from '@tanqory/theme-kit'
|
|
2
|
+
import { useState, type CSSProperties } from 'react'
|
|
3
|
+
import type { NovaImage } from '@tanqory/theme-kit'
|
|
4
|
+
import { MediaError } from '../states/media/MediaError'
|
|
5
|
+
import './MediaFrame.css'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Nova 02 · MediaFrame — loaded (cover) · contain on media-bg · loading
|
|
9
|
+
* (LQIP fade, `aria-busy` while loading — the one attribute the hydrated page may change, theme ABI
|
|
10
|
+
* §10.5) · missing / error (icon on the media tile). ALWAYS reserves its
|
|
11
|
+
* ratio, so there is no layout shift. `ratio` 'natural' uses the image's own.
|
|
12
|
+
*/
|
|
13
|
+
export interface MediaFrameProps {
|
|
14
|
+
image?: NovaImage | null
|
|
15
|
+
/** CSS aspect-ratio, e.g. '4 / 5'; 'natural' = the image's own. */
|
|
16
|
+
ratio?: string
|
|
17
|
+
fit?: 'cover' | 'contain'
|
|
18
|
+
sizes?: string
|
|
19
|
+
/** Decorative inside a link that already names the destination. */
|
|
20
|
+
decorative?: boolean
|
|
21
|
+
priority?: boolean
|
|
22
|
+
rounded?: boolean
|
|
23
|
+
className?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function MediaFrame({ image, ratio = 'natural', fit = 'cover', sizes = '100vw', decorative, priority, rounded = true, className }: MediaFrameProps): JSX.Element {
|
|
27
|
+
const [state, setState] = useState<'loading' | 'loaded' | 'error'>('loading')
|
|
28
|
+
const aspect = ratio === 'natural' ? (image ? `${image.width} / ${image.height}` : '4 / 3') : ratio
|
|
29
|
+
const style = { aspectRatio: aspect } as CSSProperties
|
|
30
|
+
const failed = !image || state === 'error'
|
|
31
|
+
if (failed) return <MediaError reason={image ? 'failed' : 'missing'} ratio={aspect} rounded={rounded} className={className} />
|
|
32
|
+
return (
|
|
33
|
+
<span className={sxJoin(['nv-image', className].filter(Boolean).join(' '), sx(style))} data-fit={fit} aria-busy={state === 'loading' ? true : undefined} data-rounded={rounded ? '' : undefined}>
|
|
34
|
+
<img
|
|
35
|
+
src={image.src}
|
|
36
|
+
srcSet={image.srcSet}
|
|
37
|
+
sizes={image.srcSet ? sizes : undefined}
|
|
38
|
+
alt={decorative ? '' : (image.alt ?? '')}
|
|
39
|
+
width={image.width}
|
|
40
|
+
height={image.height}
|
|
41
|
+
loading={priority ? 'eager' : 'lazy'}
|
|
42
|
+
decoding="async"
|
|
43
|
+
onLoad={() => setState('loaded')}
|
|
44
|
+
onError={() => setState('error')}
|
|
45
|
+
ref={(el) => {
|
|
46
|
+
// A cached image can finish before React attaches onLoad.
|
|
47
|
+
if (el?.complete && el.naturalWidth > 0 && state === 'loading') setState('loaded')
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
</span>
|
|
51
|
+
)
|
|
52
|
+
}
|