astro-component-kit 0.4.1 → 0.5.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/README.md +35 -1
- package/bin/cli.js +67 -0
- package/bin/installer.js +179 -0
- package/package.json +22 -5
- package/src/components/lib/sections/ChangelogSection.astro +6 -0
- package/src/data/registry/app.ts +93 -0
- package/src/data/registry/buttons.ts +3279 -0
- package/src/data/registry/cards.ts +1753 -0
- package/src/data/registry/charts-svg.ts +557 -0
- package/src/data/registry/charts.ts +500 -0
- package/src/data/registry/data.ts +986 -0
- package/src/data/registry/ecommerce.ts +269 -0
- package/src/data/registry/feedback.ts +1824 -0
- package/src/data/registry/forms.ts +2513 -0
- package/src/data/registry/index.ts +64 -0
- package/src/data/registry/layout.ts +206 -0
- package/src/data/registry/navigation.ts +936 -0
- package/src/data/registry/overlays.ts +1133 -0
- package/src/data/registry/sections-extra.ts +397 -0
- package/src/data/registry/sections.ts +361 -0
- package/src/data/registry/sources.ts +41 -0
- package/src/data/registry/templates.ts +414 -0
- package/src/data/registry/types.ts +30 -0
- package/src/data/registry/typography.ts +777 -0
- package/src/mcp/http-server.ts +324 -0
- package/src/mcp/index.ts +67 -0
- package/src/mcp/installer.ts +178 -0
- package/src/mcp/registry-adapter.ts +278 -0
- package/src/mcp/stdio-server.ts +11 -0
- package/src/mcp/tools.ts +247 -0
- package/src/mcp/types.ts +53 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
// src/data/registry/ecommerce.ts
|
|
2
|
+
// E-commerce components. Source code is loaded from the real files via `source()`.
|
|
3
|
+
import type { ComponentDoc } from './types';
|
|
4
|
+
import { source } from './sources';
|
|
5
|
+
|
|
6
|
+
interface Meta {
|
|
7
|
+
slug: string;
|
|
8
|
+
name: string;
|
|
9
|
+
file: string;
|
|
10
|
+
description: string;
|
|
11
|
+
tags: string[];
|
|
12
|
+
featured?: boolean;
|
|
13
|
+
usage: string;
|
|
14
|
+
deps?: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SHARED = 'types.ts, cart-store.ts and product-icons.ts';
|
|
18
|
+
|
|
19
|
+
function item(meta: Meta): ComponentDoc {
|
|
20
|
+
const component = meta.file.replace('.astro', '');
|
|
21
|
+
const steps = [
|
|
22
|
+
'Zero runtime dependencies — the cart is a tiny localStorage store.',
|
|
23
|
+
`Copy the shared helpers (${SHARED}) from the "Cart Store" page into src/components/ecommerce/.`,
|
|
24
|
+
`Copy ${meta.file} next to them.`,
|
|
25
|
+
...(meta.deps?.length ? [`It also uses ${meta.deps.join(', ')} — copy those from their pages too.`] : []),
|
|
26
|
+
'Import the component and pass your products.',
|
|
27
|
+
];
|
|
28
|
+
return {
|
|
29
|
+
slug: meta.slug,
|
|
30
|
+
name: meta.name,
|
|
31
|
+
description: meta.description,
|
|
32
|
+
category: 'ecommerce',
|
|
33
|
+
tags: ['ecommerce', 'shop', ...meta.tags],
|
|
34
|
+
featured: meta.featured ?? false,
|
|
35
|
+
code: source(`ecommerce/${meta.file}`),
|
|
36
|
+
usage: `---
|
|
37
|
+
import { ${component} } from 'astro-component-kit/ecommerce';
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
${meta.usage.trim()}`,
|
|
41
|
+
installation: {
|
|
42
|
+
manual: steps.map((step, i) => `${i + 1}. ${step}`).join('\n'),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ecommerce: ComponentDoc[] = [
|
|
48
|
+
{
|
|
49
|
+
slug: 'cart-store',
|
|
50
|
+
name: 'Cart Store',
|
|
51
|
+
description: 'Framework-free cart state shared by every shop component: localStorage persistence, cross-tab sync, add-to-cart binding and money formatting.',
|
|
52
|
+
category: 'ecommerce',
|
|
53
|
+
tags: ['ecommerce', 'cart', 'state', 'localStorage', 'foundation'],
|
|
54
|
+
featured: false,
|
|
55
|
+
code: source('ecommerce/cart-store.ts'),
|
|
56
|
+
usage: `<script>
|
|
57
|
+
import { createCart, formatMoney } from 'astro-component-kit/ecommerce';
|
|
58
|
+
|
|
59
|
+
const cart = createCart('my-store');
|
|
60
|
+
cart.add({ id: 'aurora-headphones', name: 'Aurora Headphones', price: 189 });
|
|
61
|
+
cart.subscribe((items) => console.log(items.length, formatMoney(cart.subtotal())));
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<!-- Any button becomes an add-to-cart button -->
|
|
65
|
+
<button data-add-to-cart='{"id":"mug","name":"Ember Mug","price":34}' data-cart-key="my-store">
|
|
66
|
+
<span data-label>Add to cart</span>
|
|
67
|
+
</button>`,
|
|
68
|
+
installation: {
|
|
69
|
+
manual: `1. Copy cart-store.ts, types.ts and product-icons.ts into src/components/ecommerce/.
|
|
70
|
+
2. Import createCart() in any client <script>; components broadcast changes on the "ack:cart" event.
|
|
71
|
+
3. Call bindAddToCart() once to wire every [data-add-to-cart] button on the page.`,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
item({
|
|
75
|
+
slug: 'store-product-card', name: 'Store Product Card', file: 'StoreProductCard.astro', featured: true,
|
|
76
|
+
description: 'Shop product tile with illustration or photo, badge, star rating, colour swatches, compare-at price, wishlist toggle and add-to-cart.',
|
|
77
|
+
tags: ['card', 'product', 'add-to-cart', 'wishlist'], deps: ['Badge', 'Product Media', 'Product Rating'],
|
|
78
|
+
usage: `<StoreProductCard
|
|
79
|
+
href="/product/aurora-headphones/"
|
|
80
|
+
categoryLabel="Audio"
|
|
81
|
+
product={{
|
|
82
|
+
slug: 'aurora-headphones',
|
|
83
|
+
name: 'Aurora Wireless Headphones',
|
|
84
|
+
price: 189,
|
|
85
|
+
compareAt: 229,
|
|
86
|
+
category: 'audio',
|
|
87
|
+
rating: 4.8,
|
|
88
|
+
reviews: 312,
|
|
89
|
+
badge: '-18%',
|
|
90
|
+
icon: 'headphones',
|
|
91
|
+
hue: 38,
|
|
92
|
+
}}
|
|
93
|
+
/>`,
|
|
94
|
+
}),
|
|
95
|
+
item({
|
|
96
|
+
slug: 'product-grid', name: 'Product Grid', file: 'ProductGrid.astro',
|
|
97
|
+
description: 'Responsive grid of product cards with an empty state — the target of FilterSidebar and ProductToolbar.',
|
|
98
|
+
tags: ['grid', 'catalog', 'listing'], deps: ['Store Product Card'],
|
|
99
|
+
usage: `<ProductGrid products={products} productBase="/product/" columns={4} />`,
|
|
100
|
+
}),
|
|
101
|
+
item({
|
|
102
|
+
slug: 'store-header', name: 'Store Header', file: 'StoreHeader.astro', featured: true,
|
|
103
|
+
description: 'Shop navbar with category dropdowns, search, account and a cart button whose badge updates live; collapses to a mobile menu.',
|
|
104
|
+
tags: ['navbar', 'header', 'menu', 'cart'],
|
|
105
|
+
usage: `<StoreHeader
|
|
106
|
+
brand="Nova Store"
|
|
107
|
+
links={[
|
|
108
|
+
{ label: 'Shop', href: '/shop/', children: [
|
|
109
|
+
{ label: 'Audio', href: '/shop/?category=audio', description: 'Headphones & speakers' },
|
|
110
|
+
{ label: 'Bags', href: '/shop/?category=bags' },
|
|
111
|
+
] },
|
|
112
|
+
{ label: 'Sale', href: '/shop/?sort=price-asc' },
|
|
113
|
+
]}
|
|
114
|
+
/>`,
|
|
115
|
+
}),
|
|
116
|
+
item({
|
|
117
|
+
slug: 'cart-drawer', name: 'Cart Drawer', file: 'CartDrawer.astro', featured: true,
|
|
118
|
+
description: 'Slide-in cart with quantity steppers, remove, free-shipping progress and subtotal. Accessible modal with focus trap.',
|
|
119
|
+
tags: ['cart', 'drawer', 'overlay', 'checkout'],
|
|
120
|
+
usage: `<!-- Opens from StoreHeader's cart button or any [data-cart-open] element -->
|
|
121
|
+
<CartDrawer checkoutHref="/checkout/" freeShippingThreshold={75} />`,
|
|
122
|
+
}),
|
|
123
|
+
item({
|
|
124
|
+
slug: 'promo-bar', name: 'Promo Bar', file: 'PromoBar.astro',
|
|
125
|
+
description: 'Slim announcement bar with rotating messages, pause on hover and a dismiss button remembered per session.',
|
|
126
|
+
tags: ['announcement', 'banner', 'promo'],
|
|
127
|
+
usage: `<PromoBar messages={['Free shipping over $75', 'Code ASTRO10 = 10% off']} />`,
|
|
128
|
+
}),
|
|
129
|
+
item({
|
|
130
|
+
slug: 'store-hero', name: 'Store Hero', file: 'StoreHero.astro', featured: true,
|
|
131
|
+
description: 'Shop landing hero with gradient headline, CTAs, proof stats and a floating featured-product stage.',
|
|
132
|
+
tags: ['hero', 'landing', 'product'], deps: ['Product Media', 'Product Rating'],
|
|
133
|
+
usage: `<StoreHero
|
|
134
|
+
title="Gear that feels"
|
|
135
|
+
highlight="made for you"
|
|
136
|
+
primary={{ label: 'Shop now', href: '/shop/' }}
|
|
137
|
+
/>`,
|
|
138
|
+
}),
|
|
139
|
+
item({
|
|
140
|
+
slug: 'category-tiles', name: 'Category Tiles', file: 'CategoryTiles.astro',
|
|
141
|
+
description: 'Category grid with illustrated tiles, product counts and an animated arrow.',
|
|
142
|
+
tags: ['categories', 'grid', 'navigation'], deps: ['Product Media'],
|
|
143
|
+
usage: `<CategoryTiles categories={[
|
|
144
|
+
{ id: 'audio', name: 'Audio', href: '/shop/?category=audio', count: 18, icon: 'headphones', hue: 38 },
|
|
145
|
+
{ id: 'bags', name: 'Bags', href: '/shop/?category=bags', count: 9, icon: 'backpack', hue: 150 },
|
|
146
|
+
]} />`,
|
|
147
|
+
}),
|
|
148
|
+
item({
|
|
149
|
+
slug: 'trust-badges', name: 'Trust Badges', file: 'TrustBadges.astro',
|
|
150
|
+
description: 'Row of store guarantees — shipping, returns, secure payment and support — in card, inline or divided style.',
|
|
151
|
+
tags: ['trust', 'guarantee', 'features'],
|
|
152
|
+
usage: `<TrustBadges variant="divided" />`,
|
|
153
|
+
}),
|
|
154
|
+
item({
|
|
155
|
+
slug: 'filter-sidebar', name: 'Filter Sidebar', file: 'FilterSidebar.astro', featured: true,
|
|
156
|
+
description: 'Category, price, colour, rating and stock filters that filter and sort a ProductGrid instantly, synced with the URL.',
|
|
157
|
+
tags: ['filters', 'catalog', 'search', 'form'],
|
|
158
|
+
usage: `<FilterSidebar target="shop-grid" id="shop-filters" maxPrice={300} />
|
|
159
|
+
<ProductToolbar target="shop-grid" filtersId="shop-filters" total={products.length} />
|
|
160
|
+
<ProductGrid id="shop-grid" products={products} />`,
|
|
161
|
+
}),
|
|
162
|
+
item({
|
|
163
|
+
slug: 'product-toolbar', name: 'Product Toolbar', file: 'ProductToolbar.astro',
|
|
164
|
+
description: 'Catalogue heading with a live result count and a ModernSelect sort control wired to FilterSidebar.',
|
|
165
|
+
tags: ['toolbar', 'sort', 'catalog'], deps: ['Modern Select'],
|
|
166
|
+
usage: `<ProductToolbar title="All products" total={12} target="shop-grid" filtersId="shop-filters" />`,
|
|
167
|
+
}),
|
|
168
|
+
item({
|
|
169
|
+
slug: 'product-gallery', name: 'Product Gallery', file: 'ProductGallery.astro',
|
|
170
|
+
description: 'Product image viewer with large stage and keyboard-navigable thumbnails; generates illustrated angles when there are no photos.',
|
|
171
|
+
tags: ['gallery', 'images', 'product-page'], deps: ['Product Media'],
|
|
172
|
+
usage: `<ProductGallery images={['/img/p1.webp', '/img/p2.webp']} alt="Aurora headphones" />`,
|
|
173
|
+
}),
|
|
174
|
+
item({
|
|
175
|
+
slug: 'variant-picker', name: 'Variant Picker', file: 'VariantPicker.astro',
|
|
176
|
+
description: 'Colour swatches or size pills as a native radio group that keeps an add-to-cart button in sync.',
|
|
177
|
+
tags: ['variants', 'swatch', 'size', 'radio'],
|
|
178
|
+
usage: `<VariantPicker label="Size" type="pill" target="add-btn" options={[{ label: 'S' }, { label: 'M' }, { label: 'L', disabled: true }]} />`,
|
|
179
|
+
}),
|
|
180
|
+
item({
|
|
181
|
+
slug: 'product-buy-box', name: 'Product Buy Box', file: 'ProductBuyBox.astro', featured: true,
|
|
182
|
+
description: 'Product detail purchase panel: price, savings, colour/size pickers, quantity stepper, add to cart, buy now and expandable details.',
|
|
183
|
+
tags: ['product-page', 'add-to-cart', 'pdp'], deps: ['Badge', 'Stepper Input', 'Variant Picker', 'Product Rating', 'Trust Badges'],
|
|
184
|
+
usage: `<ProductBuyBox product={product} checkoutHref="/checkout/" />`,
|
|
185
|
+
}),
|
|
186
|
+
item({
|
|
187
|
+
slug: 'order-summary', name: 'Order Summary', file: 'OrderSummary.astro',
|
|
188
|
+
description: 'Checkout sidebar with cart lines, promo codes, shipping, tax and a live total that follows the chosen shipping method.',
|
|
189
|
+
tags: ['checkout', 'summary', 'totals', 'promo'],
|
|
190
|
+
usage: `<OrderSummary taxRate={0.08} promoCodes={{ ASTRO10: 10 }} />`,
|
|
191
|
+
}),
|
|
192
|
+
item({
|
|
193
|
+
slug: 'checkout-form', name: 'Checkout Form', file: 'CheckoutForm.astro', featured: true,
|
|
194
|
+
description: 'One-page checkout — contact, delivery, shipping and payment — with autocomplete hints, validation and an animated confirmation.',
|
|
195
|
+
tags: ['checkout', 'form', 'payment'], deps: ['Animated Input', 'Modern Select', 'Custom Radio Group', 'Animated Checkmark'],
|
|
196
|
+
usage: `<div class="checkout-layout">
|
|
197
|
+
<CheckoutForm continueHref="/" />
|
|
198
|
+
<OrderSummary />
|
|
199
|
+
</div>`,
|
|
200
|
+
}),
|
|
201
|
+
item({
|
|
202
|
+
slug: 'cart-toast', name: 'Cart Toast', file: 'CartToast.astro', featured: true,
|
|
203
|
+
description: 'Live stacked notifications: "Added to cart" with a View cart action, plus any custom notice sent through the ack:notify event.',
|
|
204
|
+
tags: ['toast', 'notification', 'alert', 'live'],
|
|
205
|
+
usage: `<CartToast position="bottom-right" />
|
|
206
|
+
|
|
207
|
+
<script>
|
|
208
|
+
// Any notice, from anywhere:
|
|
209
|
+
document.dispatchEvent(new CustomEvent('ack:notify', {
|
|
210
|
+
detail: { title: 'Price drop!', text: 'Aurora Headphones is now $169', tone: 'success' },
|
|
211
|
+
}));
|
|
212
|
+
</script>`,
|
|
213
|
+
}),
|
|
214
|
+
item({
|
|
215
|
+
slug: 'live-activity-toast', name: 'Live Activity Toast', file: 'LiveActivityToast.astro',
|
|
216
|
+
description: 'Rotating social-proof notice of recent purchases that slides in and out; pauses on hover and can be dismissed for the session.',
|
|
217
|
+
tags: ['social-proof', 'toast', 'notification', 'conversion'],
|
|
218
|
+
usage: `<LiveActivityToast items={[
|
|
219
|
+
{ name: 'Lucía', city: 'Madrid', product: 'Aurora Headphones', icon: 'headphones', hue: 38, ago: '2 min ago' },
|
|
220
|
+
{ name: 'Tom', city: 'Berlin', product: 'Trail Backpack', icon: 'backpack', hue: 150, ago: '6 min ago' },
|
|
221
|
+
]} />`,
|
|
222
|
+
}),
|
|
223
|
+
item({
|
|
224
|
+
slug: 'countdown-banner', name: 'Countdown Banner', file: 'CountdownBanner.astro', featured: true,
|
|
225
|
+
description: 'Live sale countdown with days, hours, minutes and seconds, a CTA and an ended state; fixed date or rolling per-visitor deadline.',
|
|
226
|
+
tags: ['countdown', 'timer', 'sale', 'banner', 'urgency'],
|
|
227
|
+
usage: `<CountdownBanner endsAt="2026-12-01T00:00:00Z" title="Black Friday ends soon" cta={{ label: 'Shop deals', href: '/shop/' }} />`,
|
|
228
|
+
}),
|
|
229
|
+
item({
|
|
230
|
+
slug: 'stock-indicator', name: 'Stock Indicator', file: 'StockIndicator.astro',
|
|
231
|
+
description: 'Low-stock urgency notice with a level bar and a live "people viewing" counter for product pages.',
|
|
232
|
+
tags: ['stock', 'urgency', 'inventory', 'product-page'],
|
|
233
|
+
usage: `<StockIndicator stock={3} viewers={14} />`,
|
|
234
|
+
}),
|
|
235
|
+
item({
|
|
236
|
+
slug: 'product-card-minimal', name: 'Product Card Minimal', file: 'ProductCardMinimal.astro', featured: true,
|
|
237
|
+
description: 'Editorial product card: tall media that swaps view on hover, quick-add sizes, name, price and colour count.',
|
|
238
|
+
tags: ['card', 'product', 'editorial', 'quick-add'], deps: ['Product Media'],
|
|
239
|
+
usage: `<ProductCardMinimal href="/product/linen-overshirt/" index={1} product={{
|
|
240
|
+
slug: 'linen-overshirt', name: 'Linen Overshirt', price: 145, category: 'clothing',
|
|
241
|
+
sizes: ['S', 'M', 'L'], icon: 'shirt', hue: 30,
|
|
242
|
+
}} />`,
|
|
243
|
+
}),
|
|
244
|
+
item({
|
|
245
|
+
slug: 'filter-bar', name: 'Filter Bar', file: 'FilterBar.astro',
|
|
246
|
+
description: 'Horizontal catalogue toolbar with category chips, a refine panel (price, colour, stock), sort and live count.',
|
|
247
|
+
tags: ['filters', 'toolbar', 'catalog', 'sort'],
|
|
248
|
+
usage: `<FilterBar target="grid" total={12} />
|
|
249
|
+
<ul id="grid">{products.map((p) => <li><ProductCardMinimal product={p} /></li>)}</ul>`,
|
|
250
|
+
}),
|
|
251
|
+
item({
|
|
252
|
+
slug: 'cart-page-list', name: 'Cart Page List', file: 'CartPageList.astro', featured: true,
|
|
253
|
+
description: 'Full shopping-bag page: line items with quantity and remove, gift note, free-shipping progress and checkout summary.',
|
|
254
|
+
tags: ['cart', 'bag', 'checkout', 'page'],
|
|
255
|
+
usage: `<CartPageList checkoutHref="/checkout/" continueHref="/shop/" freeShippingThreshold={150} />`,
|
|
256
|
+
}),
|
|
257
|
+
item({
|
|
258
|
+
slug: 'product-media', name: 'Product Media', file: 'ProductMedia.astro',
|
|
259
|
+
description: 'Product visual: a real photo, or a hue-tinted backdrop with one of 16 line-art product illustrations.',
|
|
260
|
+
tags: ['image', 'illustration', 'placeholder'],
|
|
261
|
+
usage: `<ProductMedia icon="sneaker" hue={0} ratio="4 / 3" />`,
|
|
262
|
+
}),
|
|
263
|
+
item({
|
|
264
|
+
slug: 'product-rating', name: 'Product Rating', file: 'ProductRating.astro',
|
|
265
|
+
description: 'Read-only star rating with fractional fill, value and review count, exposed as a single accessible label.',
|
|
266
|
+
tags: ['rating', 'stars', 'reviews'],
|
|
267
|
+
usage: `<ProductRating value={4.6} count={128} size="md" />`,
|
|
268
|
+
}),
|
|
269
|
+
];
|