Files
kaiser-natron/dist/assets/CartDrawer-BdjtcjVt.js
Dorian 0c9a0ccd95 bundles: locale-aware copy via i18n keys
Bundle data was carrying localized strings (name, usage, items,
description, imageAlt, badge) directly, so EN visitors saw German
copy on the bundle page and home grid. Strings are now keyed under
bundle.<id>.<field> in the i18n catalogue (DE + EN); src/api/bundles.js
keeps only structural data + i18n key references.

HomePage builds a localizedBundles computed that resolves the keys
through t() before passing to the Bundles design-system component,
so the existing component stays agnostic of i18n. BundlePage exposes
a `bundleCopy` computed for the same reason, and resolvedItems now
maps over `itemKeys` instead of static labels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 11:02:46 +01:00

1 line
6.0 KiB
JavaScript

import{A as e,B as t,C as n,G as r,T as i,b as ee,c as a,ft as o,i as te,j as s,l as c,m as l,o as u,p as d,r as ne,s as f,u as p,x as m}from"./runtime-core.esm-bundler-DTXUv7Wx.js";import{t as h}from"./runtime-dom.esm-bundler-CXLmyuFK.js";import{t as g}from"./Icon-BCo6-bGH.js";import{t as _}from"./IconButton-Cw1KbfUO.js";import{t as re}from"./i18n-XDSWEyNo.js";import{t as ie}from"./Badge-DiccZCC_.js";import{n as v}from"./products-BqW5PUnm.js";import"./api-DlB23x7f.js";import{t as y}from"./Button-D1Rp2Xe1.js";import{t as b}from"./QuantityStepper-7Y8q77T-.js";var x=[`aria-label`],S={class:`shrink-0 flex items-center justify-between px-6 py-5 border-b border-line`,style:{"padding-top":`calc(env(safe-area-inset-top) + 1.25rem)`}},C={class:`flex items-center gap-3 min-w-0`},w={class:`font-display text-2xl font-normal text-brand leading-none truncate`},T={class:`flex-1 overflow-y-auto`},E={key:0,class:`relative h-full flex flex-col items-center justify-center gap-4 px-8 py-16 text-center`},D={class:`w-16 h-16 rounded-full bg-brand-wash flex items-center justify-center text-brand`},O={class:`font-display text-xl text-brand`},k={class:`text-sm text-muted max-w-xs`},A={class:`md:hidden absolute bottom-5 right-5`,style:{"padding-bottom":`env(safe-area-inset-bottom)`}},j={key:1,class:`divide-y divide-line`},M=[`href`],N=[`src`,`alt`],P={class:`flex-1 min-w-0 flex flex-col gap-2`},F={class:`flex items-start justify-between gap-3`},ae={class:`min-w-0`},I={class:`text-[15px] font-semibold text-ink leading-tight truncate`},L={key:0,class:`text-[13px] text-muted mt-0.5 truncate`},R={class:`flex items-center justify-between gap-3`},z={class:`font-display text-lg text-brand tabular-nums`},B={key:0,class:`shrink-0 border-t border-line px-6 py-5 flex flex-col gap-4`,style:{"padding-bottom":`calc(env(safe-area-inset-bottom) + 1.25rem)`}},V={class:`flex items-baseline justify-between`},H={class:`eyebrow`},U={class:`font-display text-2xl text-brand tabular-nums`},W={class:`flex items-center gap-3`},G={class:`md:hidden shrink-0`},K={__name:`CartDrawer`,props:{modelValue:{type:Boolean,default:!1},items:{type:Array,default:()=>[]},subtotal:{type:Number,default:0},count:{type:Number,default:0}},emits:[`update:modelValue`,`update-quantity`,`remove`,`checkout`],setup(K,{emit:q}){let J=K,Y=q,{t:X}=re(),Z=t(null);function Q(){Y(`update:modelValue`,!1)}function oe(e){e.key===`Escape`&&(e.preventDefault(),Q())}e(()=>J.modelValue,e=>{typeof document>`u`||(document.documentElement.style.overflow=e?`hidden`:``,e&&ee(()=>Z.value?.focus()))}),m(()=>{typeof document<`u`&&(document.documentElement.style.overflow=``)});let $=u(()=>J.items.length>0);function se(e,t){Y(`update-quantity`,{productId:e.productId,quantity:t})}function ce(e){Y(`remove`,e.productId)}return(e,t)=>(n(),a(te,{to:`body`},[l(h,{"enter-active-class":`transition duration-base ease-out`,"enter-from-class":`opacity-0`,"enter-to-class":`opacity-100`,"leave-active-class":`transition duration-base ease-out`,"leave-from-class":`opacity-100`,"leave-to-class":`opacity-0`},{default:s(()=>[K.modelValue?(n(),p(`div`,{key:0,class:`fixed inset-0 z-[55] bg-ink/40`,"aria-hidden":`true`,onClick:Q})):c(``,!0)]),_:1}),l(h,{"enter-active-class":`transition-transform duration-slow ease-out`,"enter-from-class":`translate-x-full`,"enter-to-class":`translate-x-0`,"leave-active-class":`transition-transform duration-base ease-out`,"leave-from-class":`translate-x-0`,"leave-to-class":`translate-x-full`},{default:s(()=>[K.modelValue?(n(),p(`aside`,{key:0,ref_key:`panelRef`,ref:Z,tabindex:`-1`,role:`dialog`,"aria-modal":`true`,"aria-label":r(X)(`cart.label`),class:`fixed inset-y-0 right-0 z-[60] w-full md:max-w-[440px] bg-cream text-ink flex flex-col shadow-lg md:border-l md:border-line font-sans outline-none`,onKeydown:oe},[f(`header`,S,[f(`div`,C,[l(g,{name:`cart`,size:22,class:`text-brand shrink-0`}),f(`h2`,w,o(r(X)(`cart.label`)),1),K.count>0?(n(),a(ie,{key:0,variant:`subtle`,class:`shrink-0`},{default:s(()=>[d(o(K.count),1)]),_:1})):c(``,!0)]),l(_,{icon:`close`,variant:`ghost`,size:`sm`,"icon-size":20,"aria-label":r(X)(`menu.close`),class:`hidden md:inline-flex`,onClick:Q},null,8,[`aria-label`])]),f(`div`,T,[$.value?(n(),p(`ul`,j,[(n(!0),p(ne,null,i(K.items,e=>(n(),p(`li`,{key:e.productId,class:`flex gap-4 px-6 py-5`},[f(`a`,{href:e.product?.href||`#`,class:`shrink-0 w-20 h-20 rounded-sm overflow-hidden bg-paper flex items-center justify-center`},[e.product?.image?(n(),p(`img`,{key:0,src:e.product.image,alt:e.product.title,loading:`lazy`,decoding:`async`,class:`w-full h-full object-contain p-2`},null,8,N)):c(``,!0)],8,M),f(`div`,P,[f(`div`,F,[f(`div`,ae,[f(`p`,I,o(e.product?.title),1),e.product?.size?(n(),p(`p`,L,o(e.product.size),1)):c(``,!0)]),l(_,{icon:`trash`,variant:`ghost`,size:`xs`,"icon-size":18,"aria-label":r(X)(`cart.remove`),class:`shrink-0`,onClick:t=>ce(e)},null,8,[`aria-label`,`onClick`])]),f(`div`,R,[l(b,{"model-value":e.quantity,min:0,"decrease-label":r(X)(`cart.qty.decrease`),"increase-label":r(X)(`cart.qty.increase`),"onUpdate:modelValue":t=>se(e,t)},null,8,[`model-value`,`decrease-label`,`increase-label`,`onUpdate:modelValue`]),f(`span`,z,o(r(v)(e.lineTotal)),1)])])]))),128))])):(n(),p(`div`,E,[f(`div`,D,[l(g,{name:`cart`,size:28})]),f(`p`,O,o(r(X)(`cart.empty.title`)),1),f(`p`,k,o(r(X)(`cart.empty.subtitle`)),1),l(y,{variant:`secondary`,size:`md`,class:`mt-2`,onClick:Q},{default:s(()=>[d(o(r(X)(`ds.buttons.continueShopping`)),1)]),_:1}),f(`div`,A,[l(_,{icon:`close`,variant:`cream-dark`,size:`lg`,"icon-size":24,"icon-stroke-width":2,"aria-label":r(X)(`menu.close`),onClick:Q},null,8,[`aria-label`])])]))]),$.value?(n(),p(`footer`,B,[f(`div`,V,[f(`span`,H,o(r(X)(`cart.subtotal`)),1),f(`span`,U,o(r(v)(K.subtotal)),1)]),f(`div`,W,[l(y,{variant:`primary`,size:`lg`,block:``,class:`flex-1 min-w-0`,onClick:t[0]||=t=>e.$emit(`checkout`)},{after:s(()=>[l(g,{name:`arrow-right`,size:18})]),default:s(()=>[d(` `+o(r(X)(`cart.checkout`)),1)]),_:1}),f(`div`,G,[l(_,{icon:`close`,variant:`float`,size:`lg`,"icon-size":24,"icon-stroke-width":2,"aria-label":r(X)(`menu.close`),onClick:Q},null,8,[`aria-label`])])])])):c(``,!0)],40,x)):c(``,!0)]),_:1})]))}};export{K as t};