@shopbite-de/storefront 1.31.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yaml +54 -0
- package/CLAUDE.md +23 -8
- package/app/app.vue +10 -6
- package/app/assets/css/main.css +100 -61
- package/app/components/AddToWishlist.vue +15 -25
- package/app/components/Address/Card.vue +6 -11
- package/app/components/Address/Detail.vue +23 -23
- package/app/components/Address/Fields.vue +175 -73
- package/app/components/Address/Form.vue +107 -106
- package/app/components/Cart/Bar.vue +6 -9
- package/app/components/Cart/Item.vue +48 -63
- package/app/components/Cart/QuickView.vue +38 -25
- package/app/components/Cart/Upsell.vue +24 -62
- package/app/components/Category/Breadcrumb.vue +29 -3
- package/app/components/Category/FilterGroup.vue +20 -41
- package/app/components/Category/Listing.vue +100 -130
- package/app/components/Category/SearchInput.vue +22 -19
- package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
- package/app/components/Checkout/LoginOrRegister.vue +28 -29
- package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
- package/app/components/Checkout/Summary.vue +90 -60
- package/app/components/Checkout/VoucherInput.vue +40 -27
- package/app/components/Contact/Form.vue +164 -192
- package/app/components/DemoBanner.vue +5 -5
- package/app/components/Footer/StoreStatus.vue +2 -2
- package/app/components/Footer.vue +125 -57
- package/app/components/Header.vue +283 -18
- package/app/components/Home/Categories.vue +116 -0
- package/app/components/Home/Facts.vue +71 -0
- package/app/components/Home/Faq.vue +34 -16
- package/app/components/Home/Hero.vue +172 -0
- package/app/components/Home/Highlights.vue +29 -37
- package/app/components/Home/Restaurant.vue +102 -0
- package/app/components/Menu/BonCard.vue +180 -0
- package/app/components/Menu/CartPanel.vue +24 -0
- package/app/components/Menu/CategoryIndex.vue +54 -0
- package/app/components/Menu/OrderMode.vue +20 -0
- package/app/components/Menu/SectionHeader.vue +38 -0
- package/app/components/Navigation/MobileTop.vue +23 -15
- package/app/components/Order/Confirmation.vue +119 -0
- package/app/components/Order/Detail.vue +80 -88
- package/app/components/Product/CardSkeleton.vue +8 -12
- package/app/components/Product/Configurator.vue +8 -16
- package/app/components/Product/CrossSelling.vue +75 -83
- package/app/components/Product/DeselectIngredient.vue +17 -22
- package/app/components/Product/Detail.vue +35 -27
- package/app/components/Product/QuickView.vue +80 -51
- package/app/components/SalesChannelSwitch.vue +14 -28
- package/app/components/Sb/Button.vue +70 -0
- package/app/components/Sb/Checkbox.vue +73 -0
- package/app/components/Sb/Chip.vue +51 -0
- package/app/components/Sb/ChoiceGroup.vue +82 -0
- package/app/components/Sb/ConfirmDialog.vue +60 -0
- package/app/components/Sb/Field.vue +77 -0
- package/app/components/Sb/Icon.vue +66 -0
- package/app/components/Sb/IconButton.vue +55 -0
- package/app/components/Sb/Input.vue +23 -0
- package/app/components/Sb/SegmentedControl.vue +34 -0
- package/app/components/Sb/Select.vue +49 -0
- package/app/components/Sb/Sheet.vue +83 -0
- package/app/components/Sb/Stars.vue +60 -0
- package/app/components/Sb/StatusPill.vue +38 -0
- package/app/components/Sb/Stepper.vue +72 -0
- package/app/components/User/AccountHeader.vue +16 -0
- package/app/components/User/AuthPanel.vue +41 -0
- package/app/components/User/Detail.vue +32 -29
- package/app/components/User/LoginForm.vue +92 -98
- package/app/components/User/RegistrationForm.vue +285 -249
- package/app/components/Wishlist.vue +55 -155
- package/app/composables/useCartMutations.ts +9 -27
- package/app/composables/useCheckoutMethodGuard.ts +2 -24
- package/app/composables/useContactForm.ts +66 -0
- package/app/composables/useHomeMenuCategories.ts +41 -0
- package/app/composables/useNavigation.ts +10 -2
- package/app/composables/useOrderMode.ts +65 -0
- package/app/composables/useRegistrationForm.ts +161 -0
- package/app/composables/useRestaurantSchema.ts +1 -1
- package/app/composables/useShareLink.ts +3 -13
- package/app/composables/useSortingSelection.ts +13 -0
- package/app/composables/useThemePreset.ts +15 -0
- package/app/composables/useVoucherCode.ts +7 -16
- package/app/composables/useWishlistActions.ts +0 -51
- package/app/error.vue +31 -9
- package/app/layouts/account.vue +45 -50
- package/app/layouts/default.vue +2 -3
- package/app/layouts/listing.vue +3 -5
- package/app/pages/[...all].vue +8 -4
- package/app/pages/account/recover/password/index.vue +113 -80
- package/app/pages/anmelden.vue +11 -10
- package/app/pages/bestellung/[id]/erfolg.vue +1 -15
- package/app/pages/bestellung/[id]/fehler.vue +63 -51
- package/app/pages/bestellung/[id]/index.vue +3 -85
- package/app/pages/bestellung/kasse.vue +29 -0
- package/app/pages/bestellung.vue +8 -60
- package/app/pages/index.vue +12 -52
- package/app/pages/kontakt.vue +27 -7
- package/app/pages/konto/adressen.vue +106 -102
- package/app/pages/konto/bestellung/[id].vue +9 -43
- package/app/pages/konto/bestellungen.vue +55 -33
- package/app/pages/konto/index.vue +47 -62
- package/app/pages/konto/profil.vue +162 -100
- package/app/pages/maintenance.vue +8 -6
- package/app/pages/merkliste.vue +7 -8
- package/app/pages/passwort-vergessen.vue +92 -75
- package/app/pages/registrierung/bestaetigen.vue +20 -48
- package/app/pages/registrierung/index.vue +16 -7
- package/app/pages/suche.vue +94 -95
- package/app/plugins/theme-preset.ts +9 -0
- package/app/utils/highlight.ts +25 -0
- package/app/utils/product.ts +9 -0
- package/app/validation/registrationSchema.ts +1 -1
- package/modules/theme.ts +115 -0
- package/nuxt.config.ts +27 -15
- package/package.json +6 -8
- package/playwright.config.ts +11 -0
- package/server/api/listing/[categoryId].get.ts +3 -0
- package/shared/theme/presets.ts +303 -0
- package/test/a11y/presets.test.ts +225 -0
- package/test/nuxt/AccountPagesPreset.test.ts +191 -0
- package/test/nuxt/AuthPagesPreset.test.ts +87 -0
- package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
- package/test/nuxt/CartItem.test.ts +18 -3
- package/test/nuxt/CartUpsell.test.ts +1 -2
- package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
- package/test/nuxt/CheckoutOnePage.test.ts +115 -0
- package/test/nuxt/CheckoutSummary.test.ts +6 -6
- package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
- package/test/nuxt/ContactFormPreset.test.ts +115 -0
- package/test/nuxt/FooterStoreStatus.test.ts +2 -2
- package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
- package/test/nuxt/HomeFaq.test.ts +3 -2
- package/test/nuxt/MenuBonCard.test.ts +122 -0
- package/test/nuxt/OrderPagesPreset.test.ts +132 -0
- package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
- package/test/nuxt/ProductCrossSelling.test.ts +2 -1
- package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
- package/test/nuxt/ProductSheetPreset.test.ts +105 -0
- package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
- package/test/nuxt/RegistrationForm.test.ts +89 -270
- package/test/nuxt/SbBaseComponents.test.ts +170 -0
- package/test/nuxt/SbStars.test.ts +25 -0
- package/test/nuxt/useCartMutations.test.ts +3 -17
- package/test/nuxt/useCartUpsell.test.ts +1 -1
- package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
- package/test/nuxt/useShareLink.test.ts +1 -9
- package/test/nuxt/useWishlistActions.test.ts +3 -26
- package/test/unit/highlight.spec.ts +31 -0
- package/test/unit/product.spec.ts +12 -0
- package/test/unit/themePresets.spec.ts +61 -0
- package/app/app.config.ts +0 -19
- package/app/components/AnimatedSection.vue +0 -74
- package/app/components/BottomNavi.vue +0 -70
- package/app/components/Category/Header.vue +0 -48
- package/app/components/Checkout/PaymentMethod.vue +0 -30
- package/app/components/Checkout/ShippingMethod.vue +0 -30
- package/app/components/Cta.vue +0 -30
- package/app/components/Feature/Card.vue +0 -121
- package/app/components/Features.vue +0 -42
- package/app/components/Footer/Contact.vue +0 -82
- package/app/components/Header/Body.vue +0 -82
- package/app/components/Header/Right.vue +0 -187
- package/app/components/Header/Title.vue +0 -10
- package/app/components/Hero.vue +0 -233
- package/app/components/Home/MenuCategories.vue +0 -148
- package/app/components/ImageGallery.vue +0 -63
- package/app/components/Loading.vue +0 -29
- package/app/components/Navigation/DesktopLeft.vue +0 -39
- package/app/components/Product/Card.vue +0 -177
- package/app/components/Product/CardCompact.vue +0 -72
- package/app/components/Product/CardDietBadges.vue +0 -43
- package/app/components/Product/CardIngredients.vue +0 -35
- package/app/components/Product/CardKitchen.vue +0 -34
- package/app/components/Product/SearchBar.vue +0 -95
- package/app/components/PublicAnnouncement.vue +0 -17
- package/app/pages/bestellung/bestaetigen.vue +0 -16
- package/app/pages/bestellung/warenkorb.vue +0 -49
- package/app/pages/bestellung/zahlung-versand.vue +0 -25
- package/test/nuxt/AddressFields.test.ts +0 -222
- package/test/nuxt/AnimatedSection.test.ts +0 -67
- package/test/nuxt/ContactForm.test.ts +0 -207
- package/test/nuxt/FooterContact.test.ts +0 -102
- package/test/nuxt/HeaderRight.test.ts +0 -142
- package/test/nuxt/Hero.test.ts +0 -126
- package/test/nuxt/HomeMenuCategories.test.ts +0 -94
- package/test/nuxt/LoginForm.test.ts +0 -159
package/app/pages/suche.vue
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Schemas } from "#shopware";
|
|
3
3
|
import type { NitroFetchRequest } from "nitropack";
|
|
4
|
-
import
|
|
4
|
+
import MenuBonCard from "~/components/Menu/BonCard.vue";
|
|
5
5
|
|
|
6
6
|
// Cards hydrate as they scroll into view, see Category/Listing.vue (#314).
|
|
7
|
-
const
|
|
7
|
+
const MenuBonCardWhenVisible = hydrateWhenVisible(MenuBonCard);
|
|
8
8
|
|
|
9
9
|
definePageMeta({
|
|
10
10
|
layout: "listing",
|
|
@@ -87,6 +87,15 @@ watch(currentSorting, async (val) => {
|
|
|
87
87
|
|
|
88
88
|
const searchInput = ref(searchQuery.value);
|
|
89
89
|
|
|
90
|
+
// Presets (#445): bon cards, a labelled search form and a native select.
|
|
91
|
+
const { menuView } = useThemePreset();
|
|
92
|
+
const sortingOptions = computed(() => toSortingOptions(sortingOrders.value));
|
|
93
|
+
const resultLabel = computed(() =>
|
|
94
|
+
elements.value.length === 1
|
|
95
|
+
? "1 Gericht gefunden"
|
|
96
|
+
: `${elements.value.length} Gerichte gefunden`,
|
|
97
|
+
);
|
|
98
|
+
|
|
90
99
|
function submitSearch() {
|
|
91
100
|
const term = searchInput.value.trim();
|
|
92
101
|
if (!term) return;
|
|
@@ -95,99 +104,89 @@ function submitSearch() {
|
|
|
95
104
|
</script>
|
|
96
105
|
|
|
97
106
|
<template>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
<div
|
|
108
|
+
class="mx-auto flex w-full max-w-(--sb-container) flex-col gap-6 px-4 pt-8 pb-16 font-body text-sb-ink sm:px-6 sm:pt-12 lg:px-8"
|
|
109
|
+
>
|
|
110
|
+
<LazyProductQuickView
|
|
111
|
+
v-if="quickView.mounted.value"
|
|
112
|
+
v-model:open="quickView.open.value"
|
|
113
|
+
:product="quickView.product.value"
|
|
114
|
+
/>
|
|
115
|
+
<h1 class="font-display text-4xl leading-tight sm:text-5xl">Suche</h1>
|
|
116
|
+
<form
|
|
117
|
+
role="search"
|
|
118
|
+
class="flex max-w-2xl flex-col gap-3 sm:flex-row sm:items-end"
|
|
119
|
+
@submit.prevent="submitSearch"
|
|
120
|
+
>
|
|
121
|
+
<SbField
|
|
122
|
+
v-slot="{ id, describedBy }"
|
|
123
|
+
label="Gericht oder Zutat"
|
|
124
|
+
class="flex-1"
|
|
125
|
+
>
|
|
126
|
+
<SbInput
|
|
127
|
+
:id="id"
|
|
128
|
+
v-model="searchInput"
|
|
129
|
+
name="search"
|
|
130
|
+
type="search"
|
|
131
|
+
enterkeyhint="search"
|
|
132
|
+
:aria-describedby="describedBy"
|
|
105
133
|
/>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
v-else-if="elements.length > 0"
|
|
158
|
-
class="grid grid-cols-1 gap-4 transition-opacity duration-200 xl:grid-cols-2"
|
|
159
|
-
:class="{ 'opacity-40 pointer-events-none': loading }"
|
|
160
|
-
>
|
|
161
|
-
<ProductCardWhenVisible
|
|
162
|
-
v-for="product in elements"
|
|
163
|
-
:key="product.id"
|
|
164
|
-
:product="product"
|
|
165
|
-
:with-favorite-button="true"
|
|
166
|
-
:selectable="true"
|
|
167
|
-
@select="quickView.show"
|
|
168
|
-
/>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<template v-else-if="searchQuery && !showSkeleton && !loading">
|
|
172
|
-
<p class="text-muted">
|
|
173
|
-
Keine Produkte für „{{ searchQuery }}" gefunden.
|
|
174
|
-
</p>
|
|
175
|
-
<template v-if="showFallback && fallbackProducts?.length">
|
|
176
|
-
<p class="text-sm font-medium mt-2">Das könnte dir gefallen:</p>
|
|
177
|
-
<div class="grid grid-cols-1 gap-4 xl:grid-cols-2">
|
|
178
|
-
<ProductCardWhenVisible
|
|
179
|
-
v-for="product in fallbackProducts"
|
|
180
|
-
:key="product.id"
|
|
181
|
-
:product="product"
|
|
182
|
-
:with-favorite-button="true"
|
|
183
|
-
:selectable="true"
|
|
184
|
-
@select="quickView.show"
|
|
185
|
-
/>
|
|
186
|
-
</div>
|
|
187
|
-
</template>
|
|
188
|
-
</template>
|
|
134
|
+
</SbField>
|
|
135
|
+
<SbButton type="submit" size="lg">
|
|
136
|
+
<SbIcon name="search" />
|
|
137
|
+
Suchen
|
|
138
|
+
</SbButton>
|
|
139
|
+
</form>
|
|
140
|
+
|
|
141
|
+
<div
|
|
142
|
+
v-if="searchQuery"
|
|
143
|
+
class="flex max-w-2xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"
|
|
144
|
+
>
|
|
145
|
+
<p role="status" class="text-sb-ink-muted">
|
|
146
|
+
<template v-if="showSkeleton || loading">Suche läuft …</template>
|
|
147
|
+
<template v-else>{{ resultLabel }} für „{{ searchQuery }}“</template>
|
|
148
|
+
</p>
|
|
149
|
+
<SbSelect
|
|
150
|
+
v-if="sortingOptions.length > 1 && elements.length > 1"
|
|
151
|
+
v-model="currentSorting"
|
|
152
|
+
label="Sortierung"
|
|
153
|
+
placeholder="Bitte wählen"
|
|
154
|
+
:options="sortingOptions"
|
|
155
|
+
class="sm:w-72"
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div
|
|
160
|
+
v-if="elements.length > 0"
|
|
161
|
+
class="grid max-w-3xl grid-cols-1 gap-3"
|
|
162
|
+
:class="{ 'pointer-events-none opacity-40': loading }"
|
|
163
|
+
>
|
|
164
|
+
<MenuBonCardWhenVisible
|
|
165
|
+
v-for="product in elements"
|
|
166
|
+
:key="product.id"
|
|
167
|
+
:product="product"
|
|
168
|
+
:photo="menuView === 'bonPhoto'"
|
|
169
|
+
:href="productDeepLink(product)"
|
|
170
|
+
@select="quickView.show"
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
<template v-else-if="searchQuery && !showSkeleton && !loading">
|
|
174
|
+
<template v-if="showFallback && fallbackProducts?.length">
|
|
175
|
+
<h2 class="font-display text-2xl">Vielleicht schmeckt Ihnen das</h2>
|
|
176
|
+
<div class="grid max-w-3xl grid-cols-1 gap-3">
|
|
177
|
+
<MenuBonCardWhenVisible
|
|
178
|
+
v-for="product in fallbackProducts"
|
|
179
|
+
:key="product.id"
|
|
180
|
+
:product="product"
|
|
181
|
+
:photo="menuView === 'bonPhoto'"
|
|
182
|
+
:href="productDeepLink(product)"
|
|
183
|
+
@select="quickView.show"
|
|
184
|
+
/>
|
|
189
185
|
</div>
|
|
190
|
-
</
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
</template>
|
|
187
|
+
<SbButton v-else variant="secondary" to="/" class="self-start"
|
|
188
|
+
>Zur Startseite</SbButton
|
|
189
|
+
>
|
|
190
|
+
</template>
|
|
191
|
+
</div>
|
|
193
192
|
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks `<html>` with the active style preset (#445), which scopes the
|
|
3
|
+
* preset stylesheet; the preset comes from runtime config, so one build
|
|
4
|
+
* serves every preset.
|
|
5
|
+
*/
|
|
6
|
+
export default defineNuxtPlugin(() => {
|
|
7
|
+
const { preset } = useThemePreset();
|
|
8
|
+
useHead({ htmlAttrs: { "data-preset": preset } });
|
|
9
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type HighlightPart = { text: string; highlight: boolean };
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Splits a content title with the MDC highlight syntax used in
|
|
5
|
+
* content/index.yml, "Alle [Informationen]{.text-primary} auf einen Blick",
|
|
6
|
+
* into plain and highlighted parts (#444). Text without the syntax is one
|
|
7
|
+
* plain part.
|
|
8
|
+
*/
|
|
9
|
+
export function splitHighlight(text: string): HighlightPart[] {
|
|
10
|
+
const parts: HighlightPart[] = [];
|
|
11
|
+
const pattern = /\[([^\]]+)\]\{[^}]*\}/g;
|
|
12
|
+
let last = 0;
|
|
13
|
+
for (const match of text.matchAll(pattern)) {
|
|
14
|
+
const index = match.index ?? 0;
|
|
15
|
+
if (index > last) {
|
|
16
|
+
parts.push({ text: text.slice(last, index), highlight: false });
|
|
17
|
+
}
|
|
18
|
+
parts.push({ text: match[1] ?? "", highlight: true });
|
|
19
|
+
last = index + match[0].length;
|
|
20
|
+
}
|
|
21
|
+
if (last < text.length) {
|
|
22
|
+
parts.push({ text: text.slice(last), highlight: false });
|
|
23
|
+
}
|
|
24
|
+
return parts;
|
|
25
|
+
}
|
package/app/utils/product.ts
CHANGED
|
@@ -12,6 +12,15 @@ export function productIsAvailable(product: Schemas["Product"]): boolean {
|
|
|
12
12
|
return product.available !== false;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Whether the product needs a choice before it can go into the cart: a
|
|
17
|
+
* parent with variants (#441). Extras and deselected ingredients are
|
|
18
|
+
* optional, so a product without variants can be added from the menu.
|
|
19
|
+
*/
|
|
20
|
+
export function productNeedsChoice(product: Schemas["Product"]): boolean {
|
|
21
|
+
return (product.childCount ?? 0) > 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
/**
|
|
16
25
|
* Whether a cart line item holds the product, as a plain line item or as a
|
|
17
26
|
* container item carrying extras (the product is the first child, #325).
|
package/modules/theme.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { addTemplate, defineNuxtModule, useLogger } from "nuxt/kit";
|
|
2
|
+
import type { Nuxt } from "nuxt/schema";
|
|
3
|
+
import {
|
|
4
|
+
contrastFailures,
|
|
5
|
+
isThemePresetName,
|
|
6
|
+
presetCss,
|
|
7
|
+
resolvePreset,
|
|
8
|
+
THEME_PRESETS,
|
|
9
|
+
type ThemeColors,
|
|
10
|
+
type ThemePreset,
|
|
11
|
+
type ThemePresetName,
|
|
12
|
+
} from "../shared/theme/presets";
|
|
13
|
+
|
|
14
|
+
export interface ShopBiteThemeOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Style preset of the shop (#439): "trattoria" (default), "grill" or
|
|
17
|
+
* "asia". The `NUXT_SHOPBITE_PRESET` build environment variable takes
|
|
18
|
+
* precedence.
|
|
19
|
+
*/
|
|
20
|
+
preset?: ThemePresetName;
|
|
21
|
+
/** Colour tokens the shop overrides, e.g. `{ primary: "#3F7D20" }`. */
|
|
22
|
+
colors?: Partial<ThemeColors>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const logger = useLogger("shopbite:theme");
|
|
26
|
+
|
|
27
|
+
type FontFamilyOption = {
|
|
28
|
+
name: string;
|
|
29
|
+
provider: string;
|
|
30
|
+
weights: number[];
|
|
31
|
+
preload: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function registerFonts(preset: ThemePreset, nuxt: Nuxt) {
|
|
35
|
+
const weights = new Map<string, Set<number>>();
|
|
36
|
+
for (const font of [preset.fonts.display, preset.fonts.body]) {
|
|
37
|
+
const set = weights.get(font.family) ?? new Set<number>();
|
|
38
|
+
font.weights.forEach((weight) => set.add(weight));
|
|
39
|
+
weights.set(font.family, set);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const options = nuxt.options as unknown as {
|
|
43
|
+
fonts?: { families?: FontFamilyOption[] };
|
|
44
|
+
};
|
|
45
|
+
options.fonts ??= {};
|
|
46
|
+
options.fonts.families ??= [];
|
|
47
|
+
for (const [name, set] of weights) {
|
|
48
|
+
if (options.fonts.families.some((family) => family.name === name)) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
// @nuxt/fonts finds the families in the `--font-sb-*` properties; the
|
|
52
|
+
// entry only pins the weights. No preload: the module would preload one
|
|
53
|
+
// weight only, and on phones a preload delays the first paint (#431).
|
|
54
|
+
options.fonts.families.push({
|
|
55
|
+
name,
|
|
56
|
+
provider: "google",
|
|
57
|
+
weights: [...set].sort((a, b) => a - b),
|
|
58
|
+
preload: false,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Style presets (#439, #445): writes the stylesheets of all presets into the
|
|
65
|
+
* build (each scoped to `:root[data-preset=…]`, the `shopBite.colors`
|
|
66
|
+
* overrides only on the configured one), registers their fonts with
|
|
67
|
+
* @nuxt/fonts (so nuxt.config.ts lists this module before "@nuxt/fonts";
|
|
68
|
+
* browsers download only the faces the active preset uses) and makes the
|
|
69
|
+
* configured preset the default of `runtimeConfig.public.shopBite.themePreset`.
|
|
70
|
+
* One build can so serve every preset: `NUXT_PUBLIC_SHOP_BITE_THEME_PRESET`
|
|
71
|
+
* switches it at runtime (the lead demos run one image for all restaurants),
|
|
72
|
+
* plugins/theme-preset.ts sets `data-preset` on `<html>`.
|
|
73
|
+
*/
|
|
74
|
+
export default defineNuxtModule<ShopBiteThemeOptions>({
|
|
75
|
+
meta: { name: "shopbite-theme", configKey: "shopBite" },
|
|
76
|
+
defaults: { preset: "trattoria", colors: {} },
|
|
77
|
+
setup(options, nuxt) {
|
|
78
|
+
const name =
|
|
79
|
+
process.env.NUXT_SHOPBITE_PRESET || options.preset || "trattoria";
|
|
80
|
+
if (!isThemePresetName(name)) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`[shopbite:theme] Unknown preset "${name}". Available: ${Object.keys(THEME_PRESETS).join(", ")}`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const presets = (Object.keys(THEME_PRESETS) as ThemePresetName[]).map(
|
|
87
|
+
(key) => resolvePreset(key, key === name ? options.colors : {}),
|
|
88
|
+
);
|
|
89
|
+
for (const failure of contrastFailures(
|
|
90
|
+
resolvePreset(name, options.colors).colors,
|
|
91
|
+
)) {
|
|
92
|
+
logger.warn(
|
|
93
|
+
`Preset "${name}": ${failure.fg} on ${failure.bg} has a contrast of ${failure.ratio.toFixed(2)}:1, WCAG AA needs ${failure.min}:1. Check the colour overrides in shopBite.colors.`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const publicConfig = nuxt.options.runtimeConfig.public as Record<
|
|
98
|
+
string,
|
|
99
|
+
unknown
|
|
100
|
+
>;
|
|
101
|
+
const shopBite = (publicConfig.shopBite ??= {}) as Record<string, unknown>;
|
|
102
|
+
shopBite.themePreset = name;
|
|
103
|
+
// optional logo URL instead of public/light|dark/Logo.png
|
|
104
|
+
shopBite.logoUrl ??= "";
|
|
105
|
+
|
|
106
|
+
const template = addTemplate({
|
|
107
|
+
filename: "shopbite-theme.css",
|
|
108
|
+
getContents: () => presets.map((preset) => presetCss(preset)).join("\n"),
|
|
109
|
+
write: true,
|
|
110
|
+
});
|
|
111
|
+
nuxt.options.css.push(template.dst);
|
|
112
|
+
|
|
113
|
+
for (const preset of presets) registerFonts(preset, nuxt);
|
|
114
|
+
},
|
|
115
|
+
});
|
package/nuxt.config.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// https://v3.nuxtjs.org/api/configuration/nuxt.config
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
4
|
+
|
|
2
5
|
const storeName = process.env.NUXT_STORE_NAME || "ShopBite";
|
|
3
6
|
const storeDescription =
|
|
4
7
|
process.env.NUXT_STORE_DESCRIPTION ||
|
|
@@ -30,9 +33,6 @@ export default defineNuxtConfig({
|
|
|
30
33
|
link: [{ rel: "icon", href: "/favicon.ico", type: "image/png" }],
|
|
31
34
|
},
|
|
32
35
|
},
|
|
33
|
-
colorMode: {
|
|
34
|
-
preference: "light",
|
|
35
|
-
},
|
|
36
36
|
robots: {
|
|
37
37
|
disallow: [
|
|
38
38
|
"/merkliste",
|
|
@@ -152,11 +152,26 @@ export default defineNuxtConfig({
|
|
|
152
152
|
"/registrierung/bestaetigen": {
|
|
153
153
|
ssr: false,
|
|
154
154
|
},
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
// One-page checkout (#443): the old step routes lead there.
|
|
156
|
+
"/bestellung": { redirect: { to: "/bestellung/kasse", statusCode: 301 } },
|
|
157
|
+
"/bestellung/warenkorb": {
|
|
158
|
+
redirect: { to: "/bestellung/kasse", statusCode: 301 },
|
|
159
|
+
},
|
|
160
|
+
"/bestellung/zahlung-versand": {
|
|
161
|
+
redirect: { to: "/bestellung/kasse", statusCode: 301 },
|
|
162
|
+
},
|
|
163
|
+
"/bestellung/bestaetigen": {
|
|
164
|
+
redirect: { to: "/bestellung/kasse", statusCode: 301 },
|
|
157
165
|
},
|
|
158
166
|
},
|
|
159
167
|
|
|
168
|
+
// Style preset of the shop (#439, modules/theme.ts): "trattoria" (the
|
|
169
|
+
// default), "grill" or "asia", optionally with colour overrides
|
|
170
|
+
// (`colors: { primary: … }`). NUXT_SHOPBITE_PRESET overrides it.
|
|
171
|
+
shopBite: {
|
|
172
|
+
preset: "trattoria",
|
|
173
|
+
},
|
|
174
|
+
|
|
160
175
|
css: ["~/assets/css/main.css"],
|
|
161
176
|
|
|
162
177
|
fonts: {
|
|
@@ -172,14 +187,6 @@ export default defineNuxtConfig({
|
|
|
172
187
|
},
|
|
173
188
|
},
|
|
174
189
|
|
|
175
|
-
ui: {
|
|
176
|
-
experimental: {
|
|
177
|
-
// Only the theme files of the Nuxt UI components the layers render
|
|
178
|
-
// become Tailwind sources (instead of all 120 components), see #319.
|
|
179
|
-
componentDetection: true,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
|
|
183
190
|
image: {
|
|
184
191
|
// Logos resized by IPX: 30 days like the files in public/
|
|
185
192
|
// (modules/public-cache.ts, #273) instead of IPX's 60 seconds.
|
|
@@ -201,7 +208,10 @@ export default defineNuxtConfig({
|
|
|
201
208
|
"@nuxt/content",
|
|
202
209
|
"@nuxtjs/robots",
|
|
203
210
|
"@vite-pwa/nuxt",
|
|
204
|
-
|
|
211
|
+
// Style presets (#439); registers the preset fonts, so it comes before
|
|
212
|
+
// @nuxt/fonts. The same path in modules/ is not registered a second time.
|
|
213
|
+
fileURLToPath(new URL("./modules/theme.ts", import.meta.url)),
|
|
214
|
+
"@nuxt/fonts",
|
|
205
215
|
"@nuxt/scripts",
|
|
206
216
|
"nuxt-vitalizer",
|
|
207
217
|
// @nuxt/eslint, @nuxt/hints and @nuxt/test-utils: modules/dev-tooling.ts
|
|
@@ -293,6 +303,8 @@ export default defineNuxtConfig({
|
|
|
293
303
|
compatibilityDate: "2025-07-15",
|
|
294
304
|
|
|
295
305
|
vite: {
|
|
306
|
+
// Tailwind CSS v4 (came with @nuxt/ui before #445)
|
|
307
|
+
plugins: [tailwindcss()],
|
|
296
308
|
build: {
|
|
297
309
|
// Vite 8 bundles with Rolldown; `rollupOptions` would drop this key.
|
|
298
310
|
rolldownOptions: {
|
|
@@ -310,7 +322,7 @@ export default defineNuxtConfig({
|
|
|
310
322
|
},
|
|
311
323
|
{
|
|
312
324
|
name: "ui",
|
|
313
|
-
test: /node_modules\/(\.pnpm\/)?(reka-ui|@
|
|
325
|
+
test: /node_modules\/(\.pnpm\/)?(reka-ui|@floating-ui|@vueuse|@internationalized)[@/]/,
|
|
314
326
|
minShareCount: 2,
|
|
315
327
|
priority: 10,
|
|
316
328
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopbite-de/storefront",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "nuxt.config.ts",
|
|
5
5
|
"description": "Shopware storefront for food delivery shops",
|
|
6
6
|
"keywords": [
|
|
@@ -18,14 +18,10 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@headlessui/vue": "^1.7.23",
|
|
22
|
-
"@heroicons/vue": "^2.2.0",
|
|
23
|
-
"@iconify-json/lucide": "^1.2.136",
|
|
24
|
-
"@iconify-json/simple-icons": "^1.2.97",
|
|
25
21
|
"@nuxt/content": "3.16.1",
|
|
22
|
+
"@nuxt/fonts": "^0.14.0",
|
|
26
23
|
"@nuxt/image": "^2.1.0",
|
|
27
24
|
"@nuxt/scripts": "1.3.12",
|
|
28
|
-
"@nuxt/ui": "^4.11.2",
|
|
29
25
|
"@nuxtjs/robots": "^6.2.3",
|
|
30
26
|
"@nuxtjs/sitemap": "^8.5.1",
|
|
31
27
|
"@shopware/api-client": "^1.6.0",
|
|
@@ -33,6 +29,7 @@
|
|
|
33
29
|
"@shopware/composables": "^1.13.0",
|
|
34
30
|
"@shopware/helpers": "^1.8.0",
|
|
35
31
|
"@shopware/nuxt-module": "^1.5.2",
|
|
32
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
36
33
|
"@unhead/vue": "^3.4.1",
|
|
37
34
|
"@vite-pwa/nuxt": "^1.1.1",
|
|
38
35
|
"@vueuse/core": "^15.0.0",
|
|
@@ -40,11 +37,11 @@
|
|
|
40
37
|
"fflate": "^0.8.3",
|
|
41
38
|
"nuxt": "^4.5.2",
|
|
42
39
|
"nuxt-vitalizer": "3.0.0",
|
|
40
|
+
"reka-ui": "^2.10.5",
|
|
43
41
|
"uuid": "^14.0.2"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@iconify-json/hugeicons": "^1.2.35",
|
|
44
|
+
"@axe-core/playwright": "^4.13.0",
|
|
48
45
|
"@nuxt/devtools-kit": "^3.4.2",
|
|
49
46
|
"@nuxt/eslint": "^1.17.0",
|
|
50
47
|
"@nuxt/hints": "1.1.4",
|
|
@@ -80,6 +77,7 @@
|
|
|
80
77
|
"test:unit": "vitest run",
|
|
81
78
|
"test:ui": "vitest --ui",
|
|
82
79
|
"test:e2e": "playwright test --project=chromium",
|
|
80
|
+
"test:a11y": "playwright test --project=a11y --project=a11y-mobile",
|
|
83
81
|
"eslint": "eslint .",
|
|
84
82
|
"eslint:fix": "eslint --fix .",
|
|
85
83
|
"prettier": "prettier --check \"**/*.{ts,tsx,md,vue}\"",
|
package/playwright.config.ts
CHANGED
|
@@ -36,6 +36,17 @@ export default defineConfig<ConfigOptions>({
|
|
|
36
36
|
name: "chromium",
|
|
37
37
|
use: { ...devices["Desktop Chrome"] },
|
|
38
38
|
},
|
|
39
|
+
/* Accessibility checks of the preset pages (#446), no login needed. */
|
|
40
|
+
{
|
|
41
|
+
name: "a11y",
|
|
42
|
+
testDir: "./test/a11y",
|
|
43
|
+
use: { ...devices["Desktop Chrome"] },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "a11y-mobile",
|
|
47
|
+
testDir: "./test/a11y",
|
|
48
|
+
use: { ...devices["Pixel 7"] },
|
|
49
|
+
},
|
|
39
50
|
|
|
40
51
|
// {
|
|
41
52
|
// name: "firefox",
|
|
@@ -20,6 +20,9 @@ const BASE_CRITERIA = {
|
|
|
20
20
|
"available",
|
|
21
21
|
// Product deep link (#289); the request sends `sw-include-seo-urls`.
|
|
22
22
|
"seoUrls",
|
|
23
|
+
// A parent with variants needs a choice in the quick view; the others
|
|
24
|
+
// can be added from the menu directly (#441).
|
|
25
|
+
"childCount",
|
|
23
26
|
],
|
|
24
27
|
seo_url: ["seoPathInfo", "isCanonical"],
|
|
25
28
|
// The entity is `property_group`: under `property` the groups came back
|