@bytesbrains/weblocks 0.6.2 → 0.7.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/AGENT.md +5 -5
- package/CATALOG.md +66 -2
- package/CHANGELOG.md +49 -0
- package/README.md +54 -5
- package/catalog.json +412 -1
- package/lib/blocks/booking.d.ts +2 -0
- package/lib/blocks/booking.js +117 -0
- package/lib/blocks/hours.d.ts +2 -0
- package/lib/blocks/hours.js +97 -0
- package/lib/blocks/menu.d.ts +2 -0
- package/lib/blocks/menu.js +93 -0
- package/lib/blocks/product.d.ts +2 -0
- package/lib/blocks/product.js +92 -0
- package/lib/blocks/reviews.d.ts +2 -0
- package/lib/blocks/reviews.js +96 -0
- package/lib/generate.d.ts +19 -2
- package/lib/generate.js +43 -3
- package/lib/index.d.ts +3 -1
- package/lib/index.js +2 -0
- package/lib/islands/hours.d.ts +1 -0
- package/lib/islands/hours.js +69 -0
- package/lib/registry.js +9 -4
- package/lib/templates.d.ts +37 -0
- package/lib/templates.js +450 -0
- package/lib/verticals.d.ts +40 -0
- package/lib/verticals.js +117 -0
- package/package.json +2 -1
package/lib/verticals.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Business **verticals** (§ AiToolK.it#154 / weblocks#30) — a small, stable
|
|
3
|
+
* taxonomy that gives generation a sense of what KIND of site it's making.
|
|
4
|
+
*
|
|
5
|
+
* Each vertical maps to its recommended section set (in order), a design-token
|
|
6
|
+
* preset that fits the mood, a copy-tone hint, and whether it's booking-driven.
|
|
7
|
+
* Hosts should read `verticalNames()` rather than hardcode their own list, and
|
|
8
|
+
* generation can seed a brief's default sections + preset from the chosen one.
|
|
9
|
+
*
|
|
10
|
+
* Additive + stable: add verticals freely, but do NOT rename or repurpose an
|
|
11
|
+
* existing `id` — hosts persist it (e.g. as `businessType`). Every `blocks`
|
|
12
|
+
* entry must be a real catalog block type (see `verticals.test.ts`).
|
|
13
|
+
*/
|
|
14
|
+
const VERTICAL_DEFS = {
|
|
15
|
+
restaurant: {
|
|
16
|
+
id: 'restaurant', label: 'Restaurant & Café', icon: 'restaurant', preset: 'sand',
|
|
17
|
+
tone: 'warm, appetising, inviting',
|
|
18
|
+
blocks: ['nav', 'hero', 'services-catalogue', 'gallery', 'testimonials', 'contact-details', 'cta', 'footer'],
|
|
19
|
+
},
|
|
20
|
+
retail: {
|
|
21
|
+
id: 'retail', label: 'Retail Shop', icon: 'storefront', preset: 'sand',
|
|
22
|
+
tone: 'friendly, local, trustworthy',
|
|
23
|
+
blocks: ['nav', 'hero', 'gallery', 'services-catalogue', 'testimonials', 'contact-details', 'footer'],
|
|
24
|
+
},
|
|
25
|
+
salon: {
|
|
26
|
+
id: 'salon', label: 'Salon & Spa', icon: 'spa', preset: 'candy', booking: true,
|
|
27
|
+
tone: 'calm, pampering, premium',
|
|
28
|
+
blocks: ['nav', 'hero', 'services-catalogue', 'gallery', 'testimonials', 'contact-details', 'cta', 'footer'],
|
|
29
|
+
},
|
|
30
|
+
fitness: {
|
|
31
|
+
id: 'fitness', label: 'Gym & Fitness', icon: 'fitness_center', preset: 'midnight', booking: true,
|
|
32
|
+
tone: 'energetic, motivating, bold',
|
|
33
|
+
blocks: ['nav', 'hero', 'features', 'pricing', 'team', 'testimonials', 'cta', 'contact-details', 'footer'],
|
|
34
|
+
},
|
|
35
|
+
education: {
|
|
36
|
+
id: 'education', label: 'Education & Coaching', icon: 'school', preset: 'ocean',
|
|
37
|
+
tone: 'credible, encouraging, clear',
|
|
38
|
+
blocks: ['nav', 'hero', 'features', 'steps', 'pricing', 'faq', 'testimonials', 'cta', 'contact-details', 'footer'],
|
|
39
|
+
},
|
|
40
|
+
healthcare: {
|
|
41
|
+
id: 'healthcare', label: 'Healthcare & Clinic', icon: 'medical_services', preset: 'ocean', booking: true,
|
|
42
|
+
tone: 'reassuring, professional, calm',
|
|
43
|
+
blocks: ['nav', 'hero', 'services-catalogue', 'team', 'faq', 'cta', 'contact-details', 'footer'],
|
|
44
|
+
},
|
|
45
|
+
manufacturing: {
|
|
46
|
+
id: 'manufacturing', label: 'Manufacturing', icon: 'precision_manufacturing', preset: 'ocean',
|
|
47
|
+
tone: 'industrial, capable, precise',
|
|
48
|
+
blocks: ['nav', 'hero', 'features', 'stats', 'logos', 'services-catalogue', 'contact-details', 'footer'],
|
|
49
|
+
},
|
|
50
|
+
ecommerce: {
|
|
51
|
+
id: 'ecommerce', label: 'E-commerce', icon: 'shopping_bag', preset: 'midnight',
|
|
52
|
+
tone: 'punchy, product-first, converting',
|
|
53
|
+
blocks: ['nav', 'hero', 'gallery', 'features', 'pricing', 'testimonials', 'faq', 'cta', 'footer'],
|
|
54
|
+
},
|
|
55
|
+
service: {
|
|
56
|
+
id: 'service', label: 'Service Business', icon: 'handyman', preset: 'forest',
|
|
57
|
+
tone: 'dependable, straightforward, local',
|
|
58
|
+
blocks: ['nav', 'hero', 'features', 'steps', 'testimonials', 'faq', 'cta', 'contact-details', 'footer'],
|
|
59
|
+
},
|
|
60
|
+
franchise: {
|
|
61
|
+
id: 'franchise', label: 'Franchise', icon: 'hub', preset: 'ocean',
|
|
62
|
+
tone: 'proven, opportunity-led, confident',
|
|
63
|
+
blocks: ['nav', 'hero', 'stats', 'features', 'steps', 'testimonials', 'cta', 'contact-details', 'footer'],
|
|
64
|
+
},
|
|
65
|
+
hospitality: {
|
|
66
|
+
id: 'hospitality', label: 'Hotel & Hospitality', icon: 'hotel', preset: 'forest', booking: true,
|
|
67
|
+
tone: 'welcoming, restful, refined',
|
|
68
|
+
blocks: ['nav', 'hero', 'gallery', 'features', 'services-catalogue', 'testimonials', 'contact-details', 'cta', 'footer'],
|
|
69
|
+
},
|
|
70
|
+
realestate: {
|
|
71
|
+
id: 'realestate', label: 'Real Estate', icon: 'real_estate_agent', preset: 'ocean',
|
|
72
|
+
tone: 'aspirational, trustworthy, local',
|
|
73
|
+
blocks: ['nav', 'hero', 'gallery', 'features', 'stats', 'team', 'testimonials', 'contact-details', 'cta', 'footer'],
|
|
74
|
+
},
|
|
75
|
+
personal: {
|
|
76
|
+
id: 'personal', label: 'Personal / Portfolio', icon: 'person', preset: 'mono',
|
|
77
|
+
tone: 'personal, confident, uncluttered',
|
|
78
|
+
blocks: ['nav', 'profile-header', 'experience', 'skills', 'timeline', 'gallery', 'testimonials', 'contact-details', 'footer'],
|
|
79
|
+
},
|
|
80
|
+
tech: {
|
|
81
|
+
id: 'tech', label: 'Technology / SaaS', icon: 'rocket_launch', preset: 'midnight',
|
|
82
|
+
tone: 'sharp, modern, benefit-led',
|
|
83
|
+
blocks: ['nav', 'hero-app', 'features', 'stats', 'pricing', 'logos', 'faq', 'cta', 'footer'],
|
|
84
|
+
},
|
|
85
|
+
events: {
|
|
86
|
+
id: 'events', label: 'Events & Weddings', icon: 'celebration', preset: 'candy', booking: true,
|
|
87
|
+
tone: 'joyful, elegant, memorable',
|
|
88
|
+
blocks: ['nav', 'hero', 'timeline', 'gallery', 'faq', 'contact-details', 'cta', 'footer'],
|
|
89
|
+
},
|
|
90
|
+
nonprofit: {
|
|
91
|
+
id: 'nonprofit', label: 'Nonprofit / Community', icon: 'volunteer_activism', preset: 'forest',
|
|
92
|
+
tone: 'heartfelt, purposeful, mobilising',
|
|
93
|
+
blocks: ['nav', 'hero', 'about', 'stats', 'steps', 'team', 'testimonials', 'cta', 'footer'],
|
|
94
|
+
},
|
|
95
|
+
other: {
|
|
96
|
+
id: 'other', label: 'Other', icon: 'category', preset: 'sand',
|
|
97
|
+
tone: 'clear, neutral, professional',
|
|
98
|
+
blocks: ['nav', 'hero', 'features', 'contact-details', 'footer'],
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Deep-frozen so a vertical (which is interpolated into the AI system prompt)
|
|
103
|
+
* cannot be mutated at runtime — `getVertical` hands out an immutable snapshot,
|
|
104
|
+
* keeping the prompt's integrity even if a dependency tries to tamper with it.
|
|
105
|
+
*/
|
|
106
|
+
export const VERTICALS = Object.freeze(Object.fromEntries(Object.entries(VERTICAL_DEFS).map(([id, v]) => {
|
|
107
|
+
Object.freeze(v.blocks);
|
|
108
|
+
return [id, Object.freeze(v)];
|
|
109
|
+
})));
|
|
110
|
+
/** Vertical ids the AI / a host picker may choose from. */
|
|
111
|
+
export function verticalNames() {
|
|
112
|
+
return Object.keys(VERTICALS);
|
|
113
|
+
}
|
|
114
|
+
/** A vertical by id, or `undefined` if unknown (host should fall back to `other`). */
|
|
115
|
+
export function getVertical(id) {
|
|
116
|
+
return VERTICALS[id];
|
|
117
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytesbrains/weblocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Block engine for AI-composable web apps — the AI composes a SiteManifest from a fixed block catalog; the engine validates and renders it to static HTML. Snap-together \"Lego\" web building blocks, shareable across repos.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"test": "npm run build && node --test lib/*.test.js test/*.mjs",
|
|
63
63
|
"example": "tsc -p tsconfig.json && node lib/example.js",
|
|
64
64
|
"example:resume": "tsc -p tsconfig.json && node lib/example-resume.js",
|
|
65
|
+
"example:templates": "tsc -p tsconfig.json && node lib/example-templates.js",
|
|
65
66
|
"ai": "tsc -p tsconfig.json && node scripts/ai-run.mjs",
|
|
66
67
|
"prepare": "npm run build",
|
|
67
68
|
"prepublishOnly": "npm run build && npm run emit:catalog && npm test"
|