@port60/template-kit 0.16.0 → 0.17.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/package.json +9 -3
- package/src/vendor/contract/v1/content-model.json +372 -76
- package/src/vendor/contract/v1/context.json +60 -3
- package/src/vendor/contract/v1/islands.json +50 -0
- package/src/vendor/contract/v1/manifest.schema.json +132 -25
- package/src/vendor/contract/v1/sections.json +18 -6
- package/src/vendor/validator/platform-base.css +294 -0
- package/src/vendor/validator/preview.mjs +11 -0
- package/src/vendor/validator/validate.mjs +15 -1
- package/starter/manifest.json +7 -2
- package/starter/sections/homeHero.liquid +9 -8
|
@@ -143,6 +143,17 @@ function islandSkeleton(name, ctx = {}, fx = STUDIO_FX) {
|
|
|
143
143
|
<label class="newsletter-label">Email address</label><div class="newsletter-fields"><input class="newsletter-email" type="email" disabled><button class="newsletter-submit" type="button" disabled>Join our newsletter</button></div>
|
|
144
144
|
<label class="newsletter-consent"><input type="checkbox" disabled><span>Email me about our work and appeals.</span></label>
|
|
145
145
|
</form>`;
|
|
146
|
+
case 'primary_action':
|
|
147
|
+
return islandSkeleton('donation_widget', ctx, fx).replace('data-p60-preview-island="donation_widget"', 'data-p60-preview-island="primary_action"');
|
|
148
|
+
case 'volunteer_signup':
|
|
149
|
+
return `<section class="donate-card vol-card" data-p60-preview-island="volunteer_signup">
|
|
150
|
+
${previewNote(name)}
|
|
151
|
+
<header class="donate-head"><h2>Volunteer with us</h2><p class="donate-sub">Where would you like to help?</p></header>
|
|
152
|
+
<div class="vol-list">
|
|
153
|
+
<div class="vol-group"><p class="vol-group-label">General</p><button class="vol-option" type="button" disabled><span class="vol-option-main"><strong>Help out where needed</strong><span class="vol-option-summary">A few hours a month, wherever the team needs a hand.</span></span><span class="vol-option-meta"><span class="vol-needed">Everyone welcome</span></span></button></div>
|
|
154
|
+
<div class="vol-group"><p class="vol-group-label">Events</p><button class="vol-option" type="button" disabled><span class="vol-option-main"><strong>Spring fair stewards</strong><span class="vol-option-summary">Welcome visitors and keep the day running.</span></span><span class="vol-option-meta"><span class="vol-needed">6 volunteers needed</span><span class="vol-shift-count">3 shifts</span></span></button></div>
|
|
155
|
+
</div>
|
|
156
|
+
</section>`;
|
|
146
157
|
case 'language_switch':
|
|
147
158
|
return `<label class="language-switch" data-p60-preview-island="language_switch">${previewNote(name)}<span class="language-switch-label">Language</span><select class="language-switch-select" disabled><option>English</option><option>Cymraeg</option><option>العربية</option></select></label>`;
|
|
148
159
|
case 'search':
|
|
@@ -99,7 +99,8 @@ export async function validateArtifact(files) {
|
|
|
99
99
|
locations: () => sections.has('locations'),
|
|
100
100
|
newsletter: () => islands.has('newsletter_signup'),
|
|
101
101
|
i18n: () => islands.has('language_switch'),
|
|
102
|
-
search: () => islands.has('search')
|
|
102
|
+
search: () => islands.has('search'),
|
|
103
|
+
volunteering: () => islands.has('volunteer_signup') || islands.has('primary_action')
|
|
103
104
|
};
|
|
104
105
|
for (const capability of manifest?.requiresCapabilities ?? []) {
|
|
105
106
|
if (!capabilitySurface[capability]?.()) {
|
|
@@ -108,6 +109,19 @@ export async function validateArtifact(files) {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
// Site focus honesty (docs/volunteering.md): a template that claims it can lead with
|
|
113
|
+
// volunteering must give the volunteer sign-up a way into the hero, either the composite
|
|
114
|
+
// primary_action island or the volunteer_signup island placed directly.
|
|
115
|
+
{
|
|
116
|
+
const focusKinds = new Set(manifest?.supports?.focus ?? []);
|
|
117
|
+
if (focusKinds.has('volunteer')) {
|
|
118
|
+
const liquidSource = Object.entries(files).filter(([path]) => path.endsWith('.liquid')).map(([, s]) => s).join('\n');
|
|
119
|
+
if (!/island\s+['"]primary_action['"]/.test(liquidSource) && !/island\s+['"]volunteer_signup['"]/.test(liquidSource)) {
|
|
120
|
+
errors.push("manifest: supports.focus lists 'volunteer' but no section places {% island 'primary_action' %} (or 'volunteer_signup'), so the site could never lead with volunteering");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
// Markup and attributes, NEVER code — the machine-enforced JavaScript ban over every liquid
|
|
112
126
|
// source (docs/template-behaviours.md). Behaviour is engine-owned; a template wanting motion
|
|
113
127
|
// declares supports.behaviors and uses the data-p60-* grammar.
|
package/starter/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"format": "port60-liquid@1",
|
|
5
5
|
"label": "Starter",
|
|
6
6
|
"description": "The reference template for the Port60 dialect, the developer docs' worked example and the base to copy when building your own. 1.1.0 adds the layout slot: the template owns the header, navigation and footer chrome.",
|
|
@@ -22,13 +22,18 @@
|
|
|
22
22
|
"donation_widget",
|
|
23
23
|
"member_menu",
|
|
24
24
|
"hero_carousel",
|
|
25
|
-
"map"
|
|
25
|
+
"map",
|
|
26
|
+
"primary_action"
|
|
26
27
|
],
|
|
27
28
|
"layout": true,
|
|
28
29
|
"heroImagery": true,
|
|
29
30
|
"behaviors": [
|
|
30
31
|
"reveal",
|
|
31
32
|
"carousel"
|
|
33
|
+
],
|
|
34
|
+
"focus": [
|
|
35
|
+
"donate",
|
|
36
|
+
"volunteer"
|
|
32
37
|
]
|
|
33
38
|
},
|
|
34
39
|
"settings": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
{% endif %}
|
|
32
32
|
{% assign heroFraming = section.photoFraming | default: 'fill' %}
|
|
33
33
|
{% if heroCount > 0 and heroFraming == 'whole' %}
|
|
34
|
-
{% if section.givingStyle == 'button' %}
|
|
34
|
+
{% if section.actionStyle == 'button' or section.givingStyle == 'button' %}
|
|
35
35
|
<section class="lq-homehero lq-homehero--vista{% if heroCount > 1 %} lq-homehero--carousel{% endif %}">
|
|
36
36
|
<div class="lq-vista">
|
|
37
37
|
<img class="lq-vista-sizer" src="{{ section.images.first.imageUrl }}" alt="{{ section.images.first.alt }}" style="object-position: {{ heroFocus }}" fetchpriority="high" decoding="async">
|
|
@@ -63,12 +63,13 @@
|
|
|
63
63
|
<h1>{{ section.title | default: site.brand.tagline | default: site.brand.name }}</h1>
|
|
64
64
|
{% if section.lead %}<p class="lq-homehero-lead">{{ section.lead }}</p>{% endif %}
|
|
65
65
|
<div class="lq-homehero-actions">
|
|
66
|
-
<a class="button button-primary" href="#donate">{{ section.primaryLabel | default: 'Donate now' }}</a>
|
|
66
|
+
{% if section.action or section.primaryLabel %}<a class="button button-primary" href="{{ section.primaryHref | default: section.action.href | default: '#donate' }}">{{ section.primaryLabel | default: section.action.label | default: 'Donate now' }}</a>{% endif %}
|
|
67
67
|
<a class="button" href="{{ section.secondaryHref | default: '/about' }}">{{ section.secondaryLabel | default: 'Our story' }}</a>
|
|
68
68
|
</div>
|
|
69
69
|
</div>
|
|
70
70
|
<aside id="donate">
|
|
71
|
-
{
|
|
71
|
+
{%- comment -%} The site focus decides which widget leads (section.primary); the composite island mounts it. {%- endcomment -%}
|
|
72
|
+
{% island 'primary_action' %}
|
|
72
73
|
</aside>
|
|
73
74
|
</div>
|
|
74
75
|
</section>
|
|
@@ -97,17 +98,17 @@
|
|
|
97
98
|
<h1>{{ section.title | default: site.brand.tagline | default: site.brand.name }}</h1>
|
|
98
99
|
{% if section.lead %}<p class="lq-homehero-lead">{{ section.lead }}</p>{% endif %}
|
|
99
100
|
<div class="lq-homehero-actions">
|
|
100
|
-
{% if section.givingStyle == 'button' %}
|
|
101
|
-
<a class="button button-primary" href="{{ section.primaryHref | default: '/donate' }}">{{ section.primaryLabel | default: 'Donate now' }}</a>
|
|
101
|
+
{% if section.actionStyle == 'button' or section.givingStyle == 'button' %}
|
|
102
|
+
{% if section.action or section.primaryLabel %}<a class="button button-primary" href="{{ section.primaryHref | default: section.action.href | default: '/donate' }}">{{ section.primaryLabel | default: section.action.label | default: 'Donate now' }}</a>{% endif %}
|
|
102
103
|
{% else %}
|
|
103
|
-
<a class="button button-primary" href="#donate">{{ section.primaryLabel | default: 'Donate now' }}</a>
|
|
104
|
+
{% if section.action or section.primaryLabel %}<a class="button button-primary" href="{{ section.primaryHref | default: section.action.href | default: '#donate' }}">{{ section.primaryLabel | default: section.action.label | default: 'Donate now' }}</a>{% endif %}
|
|
104
105
|
{% endif %}
|
|
105
106
|
<a class="button" href="{{ section.secondaryHref | default: '/about' }}">{{ section.secondaryLabel | default: 'Our story' }}</a>
|
|
106
107
|
</div>
|
|
107
108
|
</div>
|
|
108
|
-
{% unless section.givingStyle == 'button' %}
|
|
109
|
+
{% unless section.actionStyle == 'button' or section.givingStyle == 'button' %}
|
|
109
110
|
<aside id="donate">
|
|
110
|
-
{% island '
|
|
111
|
+
{% island 'primary_action' %}
|
|
111
112
|
</aside>
|
|
112
113
|
{% endunless %}
|
|
113
114
|
</div>
|