@hagicode/hagilight-core 0.10.1-dev.124.1.93cbe18 → 0.11.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/Footer.astro CHANGED
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import Copyright from './Copyright.astro';
3
+ import FooterBrand from './FooterBrand.astro';
3
4
  import { siteLinkGaAttributes } from './dist/analytics-events.js';
4
5
  import { resolveSiteLinks, type SiteLinksOptions } from './dist/links.js';
5
6
  import { resolveRssFooterLinks } from './dist/rss-footer-context.js';
@@ -29,6 +30,7 @@ const resolvedLinks = resolveSiteLinks(locale, {
29
30
  ---
30
31
 
31
32
  <footer class="hagilight-footer">
33
+ <FooterBrand locale={resolvedLinks.locale} links={resolvedLinks.quick} />
32
34
  <div class="hagilight-footer__sections">
33
35
  {resolvedLinks.relatedSites.length > 0 && (
34
36
  <section>
@@ -0,0 +1,287 @@
1
+ ---
2
+ import { siteLinkGaAttributes } from './dist/analytics-events.js';
3
+ import type { SiteLink } from './dist/links.js';
4
+ import { pickFooterBrandLinks, resolveFooterBrand } from './dist/footer-brand.js';
5
+
6
+ interface Props {
7
+ /** The locale `resolveSiteLinks` returned, so copy and links always agree. */
8
+ locale?: string;
9
+ /** The footer's resolved quick links; the calls to action come from here. */
10
+ links: readonly SiteLink[];
11
+ }
12
+
13
+ const { locale, links } = Astro.props;
14
+ const brand = resolveFooterBrand(locale);
15
+ const { primary, secondary } = pickFooterBrandLinks(links);
16
+ ---
17
+
18
+ <section class="hagilight-brand" lang={brand.locale} aria-labelledby="hagilight-brand-title">
19
+ <div class="hagilight-brand__lead">
20
+ <h2 class="hagilight-brand__headline" id="hagilight-brand-title">{brand.headline}</h2>
21
+ <div class="hagilight-brand__body">
22
+ <p class="hagilight-brand__summary">{brand.summary}</p>
23
+ {(primary || secondary) && (
24
+ <div class="hagilight-brand__actions">
25
+ {primary && (
26
+ <a
27
+ class="hagilight-brand__primary"
28
+ href={primary.href}
29
+ target={primary.target}
30
+ rel={primary.rel}
31
+ aria-label={primary.ariaLabel}
32
+ {...siteLinkGaAttributes(primary, 'footer_brand')}
33
+ >
34
+ <span>{primary.label}</span>
35
+ <svg class="hagilight-brand__arrow" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false">
36
+ <path d="M2.5 8h10M8.5 3.5 13 8l-4.5 4.5" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" />
37
+ </svg>
38
+ </a>
39
+ )}
40
+ {secondary && (
41
+ <a
42
+ class="hagilight-brand__secondary"
43
+ href={secondary.href}
44
+ target={secondary.target}
45
+ rel={secondary.rel}
46
+ aria-label={secondary.ariaLabel}
47
+ {...siteLinkGaAttributes(secondary, 'footer_brand')}
48
+ >{secondary.label}</a>
49
+ )}
50
+ </div>
51
+ )}
52
+ </div>
53
+ </div>
54
+ <dl class="hagilight-brand__pillars">
55
+ {brand.pillars.map((pillar, index) => (
56
+ <div class="hagilight-brand__pillar" data-pillar={pillar.id} style={`--hagilight-brand-i: ${index}`}>
57
+ <dt>{pillar.label}</dt>
58
+ <dd>{pillar.description}</dd>
59
+ </div>
60
+ ))}
61
+ </dl>
62
+ </section>
63
+
64
+ <style>
65
+ .hagilight-brand {
66
+ --_heading: var(--sl-color-white, currentColor);
67
+ --_muted: var(--hagilight-footer-muted, var(--sl-color-gray-2, var(--ifm-color-emphasis-700, color-mix(in srgb, currentColor 72%, transparent))));
68
+ --_rule: var(--hagilight-footer-border, var(--sl-color-gray-5, var(--ifm-color-emphasis-300, color-mix(in srgb, currentColor 28%, transparent))));
69
+ container: hagilight-brand / inline-size;
70
+ display: grid;
71
+ gap: 2.25rem;
72
+ margin: 0 auto 2rem;
73
+ max-width: 72rem;
74
+ padding-block: 1rem 2.25rem;
75
+ border-bottom: 1px solid var(--_rule);
76
+ }
77
+
78
+ /* Korean breaks between words, not inside them. */
79
+ .hagilight-brand:lang(ko) {
80
+ overflow-wrap: break-word;
81
+ word-break: keep-all;
82
+ }
83
+
84
+ .hagilight-brand__lead {
85
+ display: grid;
86
+ grid-template-columns: minmax(0, 1fr);
87
+ gap: 1.5rem 3.5rem;
88
+ }
89
+
90
+ .hagilight-brand__headline {
91
+ margin: 0;
92
+ color: var(--_heading);
93
+ font-size: clamp(1.75rem, 1.1rem + 2.6vw, 3rem);
94
+ font-size: clamp(1.75rem, 1rem + 3.2cqi, 3rem);
95
+ font-weight: 700;
96
+ letter-spacing: -0.02em;
97
+ line-height: 1.12;
98
+ text-wrap: balance;
99
+ }
100
+
101
+ .hagilight-brand__headline:lang(zh),
102
+ .hagilight-brand__headline:lang(ja),
103
+ .hagilight-brand__headline:lang(ko) {
104
+ letter-spacing: 0;
105
+ line-height: 1.25;
106
+ }
107
+
108
+ .hagilight-brand__body {
109
+ display: grid;
110
+ gap: 1.25rem;
111
+ justify-items: start;
112
+ min-width: 0;
113
+ }
114
+
115
+ .hagilight-brand__summary {
116
+ margin: 0;
117
+ max-width: 62ch;
118
+ color: var(--_muted);
119
+ font-size: 1rem;
120
+ line-height: 1.65;
121
+ text-wrap: pretty;
122
+ }
123
+
124
+ .hagilight-brand__actions {
125
+ display: flex;
126
+ flex-wrap: wrap;
127
+ align-items: center;
128
+ gap: 0.25rem 1.5rem;
129
+ }
130
+
131
+ .hagilight-brand__primary,
132
+ .hagilight-brand__secondary {
133
+ display: inline-flex;
134
+ align-items: center;
135
+ min-height: 2.75rem;
136
+ color: var(--_heading);
137
+ text-decoration: none;
138
+ }
139
+
140
+ .hagilight-brand__primary {
141
+ gap: 0.6rem;
142
+ border: 2px solid currentColor;
143
+ border-radius: 0.5rem;
144
+ padding-inline: 1.1rem;
145
+ font-weight: 650;
146
+ transition: background-color 180ms ease-out;
147
+ }
148
+
149
+ .hagilight-brand__primary:hover {
150
+ background-color: color-mix(in srgb, currentColor 10%, transparent);
151
+ }
152
+
153
+ .hagilight-brand__arrow {
154
+ flex: none;
155
+ transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
156
+ }
157
+
158
+ .hagilight-brand__primary:hover .hagilight-brand__arrow,
159
+ .hagilight-brand__primary:focus-visible .hagilight-brand__arrow {
160
+ transform: translateX(0.3rem);
161
+ }
162
+
163
+ .hagilight-brand__secondary {
164
+ text-decoration: underline;
165
+ text-decoration-thickness: 1px;
166
+ text-underline-offset: 0.3em;
167
+ }
168
+
169
+ .hagilight-brand__secondary:hover {
170
+ text-decoration-thickness: 2px;
171
+ }
172
+
173
+ .hagilight-brand a:focus-visible {
174
+ border-radius: 0.25rem;
175
+ outline: 2px solid currentColor;
176
+ outline-offset: 0.25rem;
177
+ }
178
+
179
+ .hagilight-brand__pillars {
180
+ display: grid;
181
+ grid-template-columns: minmax(0, 1fr);
182
+ gap: 1.25rem;
183
+ margin: 0;
184
+ padding: 0;
185
+ }
186
+
187
+ .hagilight-brand__pillar {
188
+ position: relative;
189
+ margin: 0;
190
+ padding-top: 1rem;
191
+ border-top: 1px solid var(--_rule);
192
+ }
193
+
194
+ /* The heavy rule that the scroll-driven reveal draws over the hairline track. */
195
+ .hagilight-brand__pillar::before {
196
+ content: '';
197
+ position: absolute;
198
+ inset: -1px 0 auto;
199
+ height: 2px;
200
+ background: var(--_heading);
201
+ transform-origin: left center;
202
+ }
203
+
204
+ .hagilight-brand__pillar dt {
205
+ margin: 0 0 0.4rem;
206
+ color: var(--_heading);
207
+ font-size: 1.05rem;
208
+ font-weight: 650;
209
+ }
210
+
211
+ .hagilight-brand__pillar dd {
212
+ margin: 0;
213
+ max-width: none;
214
+ color: var(--_muted);
215
+ font-size: 0.9rem;
216
+ line-height: 1.6;
217
+ text-wrap: pretty;
218
+ }
219
+
220
+ /* Breakpoints follow the width the footer is given, not the viewport: Starlight's content pane is narrow. */
221
+ @container hagilight-brand (min-width: 40rem) {
222
+ .hagilight-brand__pillars {
223
+ grid-template-columns: repeat(3, minmax(0, 1fr));
224
+ gap: 1.5rem 2.5rem;
225
+ }
226
+
227
+ .hagilight-brand__pillar dd {
228
+ max-width: 34ch;
229
+ }
230
+ }
231
+
232
+ @container hagilight-brand (min-width: 52rem) {
233
+ .hagilight-brand__lead {
234
+ grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
235
+ align-items: end;
236
+ }
237
+ }
238
+
239
+ /*
240
+ * The one authored moment: as the footer scrolls into view the headline is uncovered from
241
+ * its baseline and the three pillar rules draw in left to right, one after another.
242
+ * Without scroll-driven animation, or with reduced motion, everything is simply shown.
243
+ */
244
+ @media (prefers-reduced-motion: no-preference) {
245
+ @supports (animation-timeline: view()) {
246
+ .hagilight-brand__headline {
247
+ animation-name: hagilight-brand-uncover;
248
+ animation-timing-function: linear;
249
+ animation-fill-mode: both;
250
+ animation-timeline: view();
251
+ animation-range: entry 0% entry 80%;
252
+ }
253
+
254
+ .hagilight-brand__pillar::before {
255
+ animation-name: hagilight-brand-draw;
256
+ animation-timing-function: linear;
257
+ animation-fill-mode: both;
258
+ animation-timeline: view();
259
+ animation-range:
260
+ entry calc(10% + var(--hagilight-brand-i, 0) * 14%)
261
+ entry calc(70% + var(--hagilight-brand-i, 0) * 14%);
262
+ }
263
+ }
264
+ }
265
+
266
+ @keyframes hagilight-brand-uncover {
267
+ from {
268
+ clip-path: inset(0 0 100% 0);
269
+ transform: translateY(0.4em);
270
+ }
271
+
272
+ to {
273
+ clip-path: inset(0 0 -0.2em 0);
274
+ transform: none;
275
+ }
276
+ }
277
+
278
+ @keyframes hagilight-brand-draw {
279
+ from {
280
+ transform: scaleX(0);
281
+ }
282
+
283
+ to {
284
+ transform: scaleX(1);
285
+ }
286
+ }
287
+ </style>
@@ -49,6 +49,7 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
49
49
  >
50
50
  <svg class="hagilight-promoto__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6.5 6.5l11 11M17.5 6.5l-11 11" /></svg>
51
51
  </button>
52
+ <span class="hagilight-promoto__progress" data-promoto-progress aria-hidden="true"></span>
52
53
  <span class="hagilight-promoto__status" data-promoto-status aria-live="polite"></span>
53
54
  </section>
54
55
  </hagilight-promoto-banner>
@@ -74,7 +75,28 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
74
75
  --promoto-cta-height: 2.25rem;
75
76
  --promoto-pad: 0.875rem;
76
77
  --promoto-pager-width: calc(3 * var(--promoto-control-size) + 2.25rem + 0.375rem);
77
- --promoto-muted: var(--sl-color-gray-2, #4b5563);
78
+ /* Muted copy follows the card's own text color when a theme maps no gray ramp, so a dark card never inherits a light-mode gray. */
79
+ --promoto-muted: var(--sl-color-gray-2, color-mix(in srgb, var(--sl-color-text, #1f2937) 72%, transparent));
80
+ /* Hover and emphasis: Starlight's text-high where defined, else its white/black pole, else a dark gray. */
81
+ --promoto-strong: var(--sl-color-text-high, var(--sl-color-white, #111827));
82
+ /* Call to action: Starlight's primary-button pairing (accent-toned text token on the inverse pole) keeps contrast on bright dark-mode accents. */
83
+ --promoto-cta-bg: var(--sl-color-text-accent, var(--sl-color-accent, #2563eb));
84
+ --promoto-cta-bg-hover: color-mix(in srgb, var(--promoto-cta-bg) 82%, var(--promoto-strong));
85
+ --promoto-cta-fg: var(--sl-color-black, #fff);
86
+ /* Motion: a damped spring where linear() exists, a long ease-out elsewhere. */
87
+ --promoto-ease: cubic-bezier(0.22, 1, 0.36, 1);
88
+ --promoto-rotation: 8000ms;
89
+ --promoto-shift: 1rem;
90
+ }
91
+
92
+ @supports (transition-timing-function: linear(0, 1)) {
93
+ .hagilight-promoto {
94
+ --promoto-ease: linear(0, 0.066, 0.22, 0.409, 0.597, 0.761, 0.89, 0.983, 1.042, 1.073, 1.083, 1.079, 1.067, 1.052, 1.036, 1.022, 1.011, 1.002, 0.997, 0.994, 0.993, 0.993, 1);
95
+ }
96
+ }
97
+
98
+ .hagilight-promoto[data-dir='prev'] {
99
+ --promoto-shift: -1rem;
78
100
  }
79
101
 
80
102
  .hagilight-promoto[hidden],
@@ -100,7 +122,18 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
100
122
  color: var(--sl-color-text, #1f2937);
101
123
  opacity: 1;
102
124
  visibility: visible;
103
- transition: opacity 0.24s ease, visibility 0s linear;
125
+ transform: none;
126
+ transition: opacity 0.24s ease, transform 0.62s var(--promoto-ease), visibility 0s linear;
127
+ }
128
+
129
+ /* Rises into place on first render and whenever it returns from the footer or the page top. */
130
+ .hagilight-promoto[data-state='ready'] .hagilight-promoto__shell {
131
+ animation: hagilight-promoto-rise 0.62s var(--promoto-ease) backwards;
132
+ }
133
+
134
+ @keyframes hagilight-promoto-rise {
135
+ from { opacity: 0; transform: translateY(1.25rem) scale(0.97); }
136
+ to { opacity: 1; transform: none; }
104
137
  }
105
138
 
106
139
  .hagilight-promoto[data-state='footer-hidden'] .hagilight-promoto__shell,
@@ -108,7 +141,58 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
108
141
  opacity: 0;
109
142
  visibility: hidden;
110
143
  pointer-events: none;
111
- transition: opacity 0.24s ease, visibility 0s linear 0.24s;
144
+ transform: translateY(1.25rem) scale(0.97);
145
+ /* Leaving is quick and does not bounce. */
146
+ transition: opacity 0.2s ease, transform 0.24s ease-in, visibility 0s linear 0.24s;
147
+ }
148
+
149
+ /* Time until the next card, drawn along the bottom edge; hovering the card or tabbing into it holds it (a mouse click that leaves focus on a button does not). */
150
+ .hagilight-promoto__progress {
151
+ position: absolute;
152
+ inset-block-end: 0;
153
+ inset-inline: 0;
154
+ block-size: 2px;
155
+ background: var(--sl-color-text-accent, var(--sl-color-accent, #2563eb));
156
+ opacity: 0;
157
+ pointer-events: none;
158
+ transform: scaleX(0);
159
+ transform-origin: left center;
160
+ }
161
+
162
+ .hagilight-promoto__progress:dir(rtl) {
163
+ transform-origin: right center;
164
+ }
165
+
166
+ .hagilight-promoto[data-rotating] .hagilight-promoto__progress {
167
+ opacity: 0.55;
168
+ animation-duration: var(--promoto-rotation);
169
+ animation-timing-function: linear;
170
+ animation-fill-mode: forwards;
171
+ }
172
+
173
+ /* Two names for one keyframe set: flipping between them restarts the fill without a forced reflow. */
174
+ .hagilight-promoto[data-rotating][data-tick='0'] .hagilight-promoto__progress {
175
+ animation-name: hagilight-promoto-fill-a;
176
+ }
177
+
178
+ .hagilight-promoto[data-rotating][data-tick='1'] .hagilight-promoto__progress {
179
+ animation-name: hagilight-promoto-fill-b;
180
+ }
181
+
182
+ .hagilight-promoto[data-paused] .hagilight-promoto__progress,
183
+ .hagilight-promoto__shell:hover .hagilight-promoto__progress,
184
+ .hagilight-promoto__shell:has(:focus-visible) .hagilight-promoto__progress {
185
+ animation-play-state: paused;
186
+ }
187
+
188
+ @keyframes hagilight-promoto-fill-a {
189
+ from { transform: scaleX(0); }
190
+ to { transform: scaleX(1); }
191
+ }
192
+
193
+ @keyframes hagilight-promoto-fill-b {
194
+ from { transform: scaleX(0); }
195
+ to { transform: scaleX(1); }
112
196
  }
113
197
 
114
198
  .hagilight-promoto__viewport {
@@ -119,7 +203,30 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
119
203
  display: flex;
120
204
  align-items: stretch;
121
205
  width: 100%;
122
- transition: transform 0.34s ease;
206
+ transition: transform 0.5s var(--promoto-ease);
207
+ }
208
+
209
+ /*
210
+ * Content settles after the track: the card being left fades out at once, the card
211
+ * arriving lands copy, then media, then the action, each a beat behind the last.
212
+ * Pushes toward the direction of travel (--promoto-shift flips for Previous).
213
+ */
214
+ .hagilight-promoto__slide > * {
215
+ transition: opacity 0.32s ease, transform 0.55s var(--promoto-ease);
216
+ }
217
+
218
+ .hagilight-promoto__slide[aria-hidden='true'] > * {
219
+ opacity: 0;
220
+ transform: translateX(var(--promoto-shift));
221
+ transition-duration: 0.18s, 0.18s;
222
+ }
223
+
224
+ .hagilight-promoto__slide[aria-hidden='false'] > .hagilight-promoto__copy {
225
+ transition-delay: 0.08s;
226
+ }
227
+
228
+ .hagilight-promoto__slide[aria-hidden='false'] > .hagilight-promoto__cta {
229
+ transition-delay: 0.14s;
123
230
  }
124
231
 
125
232
  /* Slide: media beside copy and cta, so a tall image never opens a gap above the cta. The pager overlays the end of the cta row. */
@@ -217,8 +324,8 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
217
324
  padding: 0.4rem 1rem;
218
325
  border: 1px solid color-mix(in srgb, var(--sl-color-accent-high, #1d4ed8) 30%, transparent);
219
326
  border-radius: 999px;
220
- background: var(--sl-color-accent, #2563eb);
221
- color: #fff;
327
+ background: var(--promoto-cta-bg);
328
+ color: var(--promoto-cta-fg);
222
329
  font-size: var(--sl-text-sm, 0.875rem);
223
330
  font-weight: 600;
224
331
  line-height: 1.2;
@@ -232,7 +339,7 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
232
339
 
233
340
  .hagilight-promoto__cta:hover,
234
341
  .hagilight-promoto__cta:focus-visible {
235
- background: var(--sl-color-accent-high, #1d4ed8);
342
+ background: var(--promoto-cta-bg-hover);
236
343
  }
237
344
 
238
345
  /* Pager + pause: bottom-right, on the same row as the call to action. */
@@ -335,7 +442,7 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
335
442
  .hagilight-promoto__dismiss:hover,
336
443
  .hagilight-promoto__control:hover:not(:disabled) {
337
444
  background: color-mix(in srgb, var(--sl-color-accent, #2563eb) 12%, transparent);
338
- color: var(--sl-color-text-high, #111827);
445
+ color: var(--promoto-strong);
339
446
  }
340
447
  }
341
448
 
@@ -457,9 +564,19 @@ const { fallback, locale = Astro.currentLocale ?? 'en', siteId } = Astro.props;
457
564
  @media (prefers-reduced-motion: reduce) {
458
565
  .hagilight-promoto__shell,
459
566
  .hagilight-promoto__track,
567
+ .hagilight-promoto__slide > *,
460
568
  .hagilight-promoto__dismiss,
461
569
  .hagilight-promoto__control {
462
570
  transition: none;
463
571
  }
572
+
573
+ .hagilight-promoto__shell {
574
+ transform: none !important;
575
+ animation: none !important;
576
+ }
577
+
578
+ .hagilight-promoto__progress {
579
+ display: none;
580
+ }
464
581
  }
465
582
  </style>
package/README.md CHANGED
@@ -21,6 +21,8 @@ import Footer from '@hagicode/hagilight-core/Footer';
21
21
  ```
22
22
 
23
23
  `Footer` renders localized site links and, when configured by a Hagilight RSS integration, feed links. Its `locale` and `links` props allow customization.
24
+
25
+ Above the links the footer states what HagiCode is: a one-line headline, the product summary, the Download and Product Docs calls to action, and the three pillars (smart, efficient, fun) in all ten locales. The calls to action are the `downloadClient` and `productDocs` quick links, so `overrides`, `removeLinks` and `siteId` apply to them and a removed link leaves no button behind; both report as `footer_brand` clicks with those ids, so the product statement can be told apart from the link lists. The block lays out by the width it is given (container queries), so it holds in a narrow Starlight content pane. As the footer scrolls into view the headline is uncovered and the pillar rules draw in, using scroll-driven animation; browsers without it, and visitors who prefer reduced motion, see the finished state. Copy comes from `@hagicode/hagilight-core/footer-brand` (`resolveFooterBrand`, `pickFooterBrandLinks`), and the Astro markup is exported as `@hagicode/hagilight-core/FooterBrand`.
24
26
  The core Footer stays independent of feature packages and does not add
25
27
  attribution by itself. Plain-Astro sites that want the literal
26
28
  `Powered By hagilight@<version>` package attribution can replace this import with
@@ -115,6 +117,8 @@ The banner is a fixed card at most `42rem` wide, centered between two insets: `-
115
117
 
116
118
  The shared banner (`PromotoBanner`, `loadActivePromotions`) displays only promotions whose `platforms` array in Index's `/promote.json` includes `web`, in addition to being enabled, inside their activation window, and matched with `/promote_content.json`. This follows the `platforms` flag documented in the Index README. An entry whose `platforms` is missing, empty, or not an array of strings is not displayed, other values such as `hagicode` are ignored, and matching is exact (`Web` does not match). When no promotion remains, the banner shows its site fallback or stays hidden, as before.
117
119
 
120
+ The card rises into place when it first appears and when it returns from the Footer or the page top, and sinks away when dismissed; browsers without `@starting-style` or `linear()` get the same movement with a plain ease-out or none, and `prefers-reduced-motion` turns all of it off along with automatic rotation. With more than one promotion, a thin line along the card's bottom edge fills over eight seconds and the next promotion arrives when it completes; hovering the card, tabbing into it, or pressing pause holds the line where it is. Slide content settles in the direction of travel (Previous reverses it). The call to action, muted copy and hover colors read Starlight tokens (`--sl-color-text-accent` on `--sl-color-black`, `--sl-color-gray-2`, `--sl-color-text-high`) and fall back to values derived from the card's own text color, so themes that map only part of the ramp stay legible on dark cards. Override `--promoto-cta-bg`, `--promoto-cta-fg`, `--promoto-muted`, `--promoto-strong` or `--promoto-rotation` on `.hagilight-promoto` to retune them.
121
+
118
122
  The banner stays hidden while the page is at the top during a domain's first 30 visits, and while the Footer is in view. Every page load, refresh, and page-to-page navigation counts as a visit; scrolling and hash changes do not. The per-domain counter is stored in the visitor's browser under `hagilight:promoto-banner:visit-count:<hostname>` and is never sent anywhere.
119
123
 
120
124
  A promotion's `image` may also carry `sources`, the alternative image files that Index publishes in the order AVIF, WebP, then the original. The banner renders them as a `<picture>` in that order, with the original as its `<img>`, and skips any entry whose `type` is not an `image/*` media type or whose URL is unsafe. Each `src` is resolved against `https://index.hagicode.com` when the promotion documents load. If the browser fails to load a tier, the banner removes it and the next tier is used. A card without `sources` renders the plain `<img>` as before, and `sources` never affect the dismissal signature, so a dismissed banner stays dismissed when only its image chain changes.
@@ -175,7 +179,7 @@ A click on a tagged link calls `gtag('event', <action>, …)` once:
175
179
  | Event name (action) | `download_click` for the `download` category, `store_visit` for the `store` category, `link_click` for every other category |
176
180
  | `event_category` | `download`, `store`, `navigation`, `community`, or `promotion` |
177
181
  | `event_label` | The link's stable id (for example `downloadClient`), never its localized text |
178
- | `link_location` | Where the link sits: `header`, `footer`, `article_promotion`, `promoto_banner`, or your own value |
182
+ | `link_location` | Where the link sits: `header`, `footer`, `footer_brand`, `article_promotion`, `promoto_banner`, or your own value |
179
183
  | `link_url` | The destination at click time |
180
184
  | `transport_type` | `beacon`, so same-tab navigations still deliver |
181
185
 
@@ -3,7 +3,7 @@ export declare const GA_CATEGORIES: readonly ["download", "store", "navigation",
3
3
  export type GaCategory = (typeof GA_CATEGORIES)[number];
4
4
  export type GaAction = 'download_click' | 'store_visit' | 'link_click';
5
5
  export declare const GA_CATEGORY_ACTIONS: Readonly<Record<GaCategory, GaAction>>;
6
- export declare const GA_LOCATIONS: readonly ["header", "footer", "article_promotion", "promoto_banner"];
6
+ export declare const GA_LOCATIONS: readonly ["header", "footer", "footer_brand", "article_promotion", "promoto_banner"];
7
7
  export type GaLocation = (typeof GA_LOCATIONS)[number];
8
8
  /** Shared links that report click events, keyed by `SiteLink.id`. Renaming a key changes its GA label. */
9
9
  export declare const TRACKED_SITE_LINKS: Readonly<Partial<Record<SiteLinkKey, GaCategory>>>;
@@ -7,7 +7,7 @@ export const GA_CATEGORY_ACTIONS = Object.freeze({
7
7
  community: 'link_click',
8
8
  promotion: 'link_click',
9
9
  });
10
- export const GA_LOCATIONS = ['header', 'footer', 'article_promotion', 'promoto_banner'];
10
+ export const GA_LOCATIONS = ['header', 'footer', 'footer_brand', 'article_promotion', 'promoto_banner'];
11
11
  /** Shared links that report click events, keyed by `SiteLink.id`. Renaming a key changes its GA label. */
12
12
  export const TRACKED_SITE_LINKS = Object.freeze({
13
13
  home: 'navigation',
@@ -0,0 +1,29 @@
1
+ import type { SiteLink } from './links.js';
2
+ export type FooterBrandPillarId = 'smart' | 'efficient' | 'fun';
3
+ export interface FooterBrandPillar {
4
+ id: FooterBrandPillarId;
5
+ label: string;
6
+ description: string;
7
+ }
8
+ export interface FooterBrandCopy {
9
+ name: string;
10
+ /** One display line: what HagiCode turns the reader's work into. */
11
+ headline: string;
12
+ /** What the product is, in the same words the article showcase uses. */
13
+ summary: string;
14
+ pillars: readonly FooterBrandPillar[];
15
+ }
16
+ export interface FooterBrandLinks {
17
+ primary?: SiteLink;
18
+ secondary?: SiteLink;
19
+ }
20
+ export declare const FOOTER_BRAND_LOCALES: readonly string[];
21
+ /** Resolves the footer's product statement. `locale` is the value `resolveSiteLinks` already normalized. */
22
+ export declare function resolveFooterBrand(locale?: string | null): FooterBrandCopy & {
23
+ locale: string;
24
+ };
25
+ /**
26
+ * Picks the two calls to action from the footer's already-resolved quick links, so consumer
27
+ * overrides and `removeLinks` apply and a removed link leaves no dead button behind.
28
+ */
29
+ export declare function pickFooterBrandLinks(quick: readonly SiteLink[]): FooterBrandLinks;
@@ -0,0 +1,86 @@
1
+ const NAME = 'HagiCode';
2
+ function copy(headline, summary, pillars) {
3
+ const ids = ['smart', 'efficient', 'fun'];
4
+ return {
5
+ name: NAME,
6
+ headline,
7
+ summary,
8
+ pillars: pillars.map(([label, description], index) => ({
9
+ id: ids[index],
10
+ label,
11
+ description,
12
+ })),
13
+ };
14
+ }
15
+ // Summaries and pillar labels mirror `repos/web` and the article showcase copy, so a reader
16
+ // sees the same description of HagiCode in the footer as in the article above it.
17
+ const catalog = {
18
+ 'en-US': copy('Turn ideas into shipped software.', 'HagiCode is an agentic coding workspace. OpenSpec workflows plan the change, multi-agent execution carries it out, and Hero Dungeon makes the long run visible, so ideas become shipped software.', [
19
+ ['Smart', 'OpenSpec workflows turn intent into a path from proposal to shipped change.'],
20
+ ['Efficient', 'Multi-agent execution runs research, build, and review in parallel.'],
21
+ ['Fun', 'Hero Dungeon makes long sessions visible, with heroes, progress, and achievements.'],
22
+ ]),
23
+ 'zh-CN': copy('让想法变成真正交付的软件。', 'HagiCode 是面向项目开发的 AI 编码工作台:用 OpenSpec 工作流规划变更,多 Agent 并行执行,再由 Hero Dungeon 让进度一目了然,把想法变成真正交付的软件。', [
24
+ ['智能', 'OpenSpec 工作流把意图变成从提案到交付的可执行路径。'],
25
+ ['高效', '多 Agent 并行推进调研、实现与审阅。'],
26
+ ['有趣', 'Hero Dungeon 让长时间编码看得见:英雄、进度与成就。'],
27
+ ]),
28
+ 'zh-Hant': copy('讓想法化為交付成果。', 'HagiCode 是面向專案開發的 AI 編碼工作台:以 OpenSpec 工作流程規劃變更,多 Agent 並行執行,再由 Hero Dungeon 讓進度一目了然,將想法化為交付成果。', [
29
+ ['智慧', 'OpenSpec 工作流程將意圖轉化為從提案到交付的可執行路徑。'],
30
+ ['高效', '多 Agent 並行推進研究、實作與審查。'],
31
+ ['有趣', 'Hero Dungeon 讓長時間編碼看得見:英雄、進度與成就。'],
32
+ ]),
33
+ 'ja-JP': copy('アイデアを、出荷できるソフトウェアへ。', 'HagiCode はエージェント型コーディングワークスペースです。OpenSpec ワークフローで変更を計画し、マルチエージェント実行で進め、Hero Dungeon で長い作業の進み具合を見える化して、アイデアを出荷できるソフトウェアにします。', [
34
+ ['スマート', 'OpenSpec ワークフローが、意図を提案からリリースまでの実行可能な道筋にします。'],
35
+ ['効率的', 'マルチエージェント実行で、調査・実装・レビューを並行して進めます。'],
36
+ ['楽しい', 'Hero Dungeon が長い作業を、ヒーロー・進行状況・実績で見える化します。'],
37
+ ]),
38
+ 'ko-KR': copy('아이디어를 실제로 배포되는 소프트웨어로.', 'HagiCode는 에이전트 코딩 작업 공간입니다. OpenSpec 워크플로로 변경을 계획하고, 다중 에이전트 실행으로 진행하며, Hero Dungeon으로 긴 작업의 진행 상황을 한눈에 보여 아이디어를 실제로 배포되는 소프트웨어로 만듭니다.', [
39
+ ['스마트', 'OpenSpec 워크플로는 의도를 제안부터 배포까지 이어지는 실행 가능한 경로로 바꿉니다.'],
40
+ ['효율적', '다중 에이전트 실행으로 조사, 구현, 검토를 병렬로 진행합니다.'],
41
+ ['즐거운', 'Hero Dungeon은 긴 세션을 영웅, 진행 상황, 업적으로 한눈에 보여 줍니다.'],
42
+ ]),
43
+ 'de-DE': copy('Aus Ideen wird ausgelieferte Software.', 'HagiCode ist ein agentischer Coding-Arbeitsplatz: OpenSpec-Workflows planen die Änderung, Multi-Agent-Ausführung setzt sie um, und Hero Dungeon macht den langen Weg sichtbar, bis aus der Idee ausgelieferte Software wird.', [
44
+ ['Intelligent', 'OpenSpec-Workflows machen aus einer Absicht einen Weg vom Vorschlag bis zur Auslieferung.'],
45
+ ['Effizient', 'Multi-Agent-Ausführung treibt Recherche, Umsetzung und Prüfung parallel voran.'],
46
+ ['Unterhaltsam', 'Hero Dungeon macht lange Sitzungen sichtbar: mit Helden, Fortschritt und Erfolgen.'],
47
+ ]),
48
+ 'fr-FR': copy('Transformez vos idées en logiciels livrés.', 'HagiCode est un espace de développement agentique : les workflows OpenSpec planifient le changement, l’exécution multi-agent le réalise et Hero Dungeon rend le long parcours visible, pour transformer vos idées en logiciels livrés.', [
49
+ ['Intelligent', 'Les workflows OpenSpec transforment une intention en parcours, de la proposition à la livraison.'],
50
+ ['Efficace', 'L’exécution multi-agent mène recherche, réalisation et revue en parallèle.'],
51
+ ['Ludique', 'Hero Dungeon rend les longues sessions visibles : héros, progression et succès.'],
52
+ ]),
53
+ 'es-ES': copy('Convierte ideas en software entregado.', 'HagiCode es un espacio de trabajo de programación con agentes: los flujos de trabajo de OpenSpec planifican el cambio, la ejecución multiagente lo lleva a cabo y Hero Dungeon hace visible el largo recorrido, para convertir ideas en software entregado.', [
54
+ ['Inteligente', 'Los flujos de OpenSpec convierten la intención en un camino de la propuesta a la entrega.'],
55
+ ['Eficiente', 'La ejecución multiagente avanza en paralelo con investigación, implementación y revisión.'],
56
+ ['Divertido', 'Hero Dungeon hace visibles las sesiones largas: héroes, progreso y logros.'],
57
+ ]),
58
+ 'pt-BR': copy('Transforme ideias em software entregue.', 'O HagiCode é um ambiente de programação com agentes: os fluxos de trabalho do OpenSpec planejam a mudança, a execução multiagente a realiza e o Hero Dungeon torna o longo percurso visível, para transformar ideias em software entregue.', [
59
+ ['Inteligente', 'Os fluxos do OpenSpec transformam a intenção em um caminho da proposta à entrega.'],
60
+ ['Eficiente', 'A execução multiagente conduz pesquisa, implementação e revisão em paralelo.'],
61
+ ['Divertido', 'O Hero Dungeon torna as sessões longas visíveis: heróis, progresso e conquistas.'],
62
+ ]),
63
+ 'ru-RU': copy('Превращайте идеи в готовое ПО.', 'HagiCode — агентная среда разработки: рабочие процессы OpenSpec планируют изменение, мультиагентное выполнение его реализует, а Hero Dungeon делает долгий путь наглядным, так что идеи становятся готовым ПО.', [
64
+ ['Умный', 'Рабочие процессы OpenSpec превращают намерение в путь от предложения до готового изменения.'],
65
+ ['Эффективный', 'Мультиагентное выполнение ведёт исследование, реализацию и проверку параллельно.'],
66
+ ['Увлекательный', 'Hero Dungeon делает долгие сессии наглядными: герои, прогресс и достижения.'],
67
+ ]),
68
+ };
69
+ export const FOOTER_BRAND_LOCALES = Object.freeze(Object.keys(catalog));
70
+ /** Resolves the footer's product statement. `locale` is the value `resolveSiteLinks` already normalized. */
71
+ export function resolveFooterBrand(locale) {
72
+ const resolved = locale && Object.hasOwn(catalog, locale) ? locale : 'en-US';
73
+ return { locale: resolved, ...catalog[resolved] };
74
+ }
75
+ /**
76
+ * Picks the two calls to action from the footer's already-resolved quick links, so consumer
77
+ * overrides and `removeLinks` apply and a removed link leaves no dead button behind.
78
+ */
79
+ export function pickFooterBrandLinks(quick) {
80
+ const primary = quick.find((link) => link.id === 'downloadClient');
81
+ const secondary = quick.find((link) => link.id === 'productDocs');
82
+ return {
83
+ ...(primary ? { primary } : {}),
84
+ ...(secondary ? { secondary } : {}),
85
+ };
86
+ }
@@ -7,6 +7,7 @@ const VISIT_COUNT_KEY_PREFIX = 'hagilight:promoto-banner:visit-count:';
7
7
  const VISIT_EVENT = 'hagilight:promoto-visit';
8
8
  const PAGE_TOP_VISIT_LIMIT = 30;
9
9
  const ROTATION_INTERVAL_MS = 8000;
10
+ const DISMISS_DURATION_MS = 220;
10
11
  const REFRESH_INTERVAL_MS = 5 * 60 * 1000;
11
12
  let lastCountedPage = null;
12
13
  let siteVisitCount = 0;
@@ -171,7 +172,8 @@ export function definePromotoBannerElement() {
171
172
  dismissedSignature = readDismissedSignature();
172
173
  paused = false;
173
174
  reducedMotion = false;
174
- rotationTimer;
175
+ tick = 0;
176
+ dismissing = false;
175
177
  refreshTimer;
176
178
  motionQuery;
177
179
  resizeObserver;
@@ -184,22 +186,48 @@ export function definePromotoBannerElement() {
184
186
  return;
185
187
  this.paused = !this.paused;
186
188
  this.updateControls();
187
- this.syncRotation();
189
+ // Pausing freezes the progress line where it is; resuming carries on from there.
190
+ this.syncRotation(false);
188
191
  };
189
192
  onDismiss = () => {
190
193
  const signature = getPromotionSetSignature(this.cards);
191
- if (!signature)
194
+ if (!signature || this.dismissing)
192
195
  return;
193
196
  this.dismissedSignature = signature;
194
197
  saveDismissedSignature(signature);
195
- this.updateVisibility();
196
198
  this.stopRotation();
199
+ const shell = this.querySelector('[data-promoto-shell]');
200
+ const finish = () => {
201
+ this.dismissing = false;
202
+ this.updateVisibility();
203
+ };
204
+ if (!shell || this.reducedMotion || typeof shell.animate !== 'function') {
205
+ finish();
206
+ return;
207
+ }
208
+ // Sink away before the card is removed; the filled animation is cancelled once it is hidden.
209
+ this.dismissing = true;
210
+ shell.inert = true;
211
+ const exit = shell.animate([
212
+ { opacity: 1, transform: 'none' },
213
+ { opacity: 0, transform: 'translateY(1rem) scale(0.97)' },
214
+ ], { duration: DISMISS_DURATION_MS, easing: 'ease-in', fill: 'forwards' });
215
+ const settle = () => {
216
+ finish();
217
+ exit.cancel();
218
+ };
219
+ exit.finished.then(settle, settle);
220
+ };
221
+ // The progress line's fill is the rotation clock, so hover, focus and pause hold the card with it.
222
+ onProgressEnd = (event) => {
223
+ if (event.target === event.currentTarget)
224
+ this.move(1);
197
225
  };
198
226
  onLayoutChange = () => {
199
227
  const previousState = this.dataset.state;
200
228
  this.updateVisibility();
201
229
  if (previousState !== this.dataset.state)
202
- this.syncRotation();
230
+ this.syncRotation(true);
203
231
  };
204
232
  onVisibilityChange = () => {
205
233
  if (document.visibilityState === 'hidden') {
@@ -207,14 +235,14 @@ export function definePromotoBannerElement() {
207
235
  this.stopRefresh();
208
236
  }
209
237
  else {
210
- this.syncRotation();
238
+ this.syncRotation(true);
211
239
  this.startRefresh();
212
240
  }
213
241
  };
214
242
  onMotionChange = () => {
215
243
  this.reducedMotion = this.motionQuery?.matches ?? false;
216
244
  this.updateControls();
217
- this.syncRotation();
245
+ this.syncRotation(true);
218
246
  };
219
247
  onPageLoad = () => {
220
248
  recordSiteVisit();
@@ -233,6 +261,8 @@ export function definePromotoBannerElement() {
233
261
  this.querySelector('[data-promoto-next]')?.addEventListener('click', this.onNext);
234
262
  this.querySelector('[data-promoto-pause]')?.addEventListener('click', this.onPause);
235
263
  this.querySelector('[data-promoto-dismiss]')?.addEventListener('click', this.onDismiss);
264
+ this.querySelector('[data-promoto-progress]')?.addEventListener('animationend', this.onProgressEnd);
265
+ this.style.setProperty('--promoto-rotation', `${ROTATION_INTERVAL_MS}ms`);
236
266
  window.addEventListener('scroll', this.onLayoutChange, { passive: true });
237
267
  window.addEventListener('resize', this.onLayoutChange);
238
268
  document.addEventListener('visibilitychange', this.onVisibilityChange);
@@ -255,6 +285,7 @@ export function definePromotoBannerElement() {
255
285
  this.querySelector('[data-promoto-next]')?.removeEventListener('click', this.onNext);
256
286
  this.querySelector('[data-promoto-pause]')?.removeEventListener('click', this.onPause);
257
287
  this.querySelector('[data-promoto-dismiss]')?.removeEventListener('click', this.onDismiss);
288
+ this.querySelector('[data-promoto-progress]')?.removeEventListener('animationend', this.onProgressEnd);
258
289
  window.removeEventListener('scroll', this.onLayoutChange);
259
290
  window.removeEventListener('resize', this.onLayoutChange);
260
291
  document.removeEventListener('visibilitychange', this.onVisibilityChange);
@@ -278,7 +309,7 @@ export function definePromotoBannerElement() {
278
309
  this.renderCards();
279
310
  this.updateVisibility();
280
311
  this.updateControls();
281
- this.syncRotation();
312
+ this.syncRotation(false);
282
313
  }
283
314
  readFallback() {
284
315
  const serialized = this.dataset.fallback;
@@ -411,8 +442,9 @@ export function definePromotoBannerElement() {
411
442
  if (this.cards.length < 2)
412
443
  return;
413
444
  this.currentIndex = getNextPromotionIndex(this.currentIndex, this.cards.length, direction);
445
+ this.dataset.dir = direction < 0 ? 'prev' : 'next';
414
446
  this.updateSlides();
415
- this.syncRotation();
447
+ this.syncRotation(true);
416
448
  }
417
449
  updateVisibility() {
418
450
  const signature = getPromotionSetSignature(this.cards);
@@ -434,19 +466,22 @@ export function definePromotoBannerElement() {
434
466
  const bounds = this.footer.getBoundingClientRect();
435
467
  return bounds.top < window.innerHeight && bounds.bottom > 0;
436
468
  }
437
- syncRotation() {
438
- this.stopRotation();
439
- const state = this.dataset.state;
440
- if (state !== 'ready' && state !== 'footer-hidden' && state !== 'top-hidden' && state !== 'hidden' && state !== 'dismissed')
441
- return;
442
- if (!shouldAutoRotate(this.cards.length, this.paused, this.reducedMotion, document.visibilityState !== 'hidden', state))
443
- return;
444
- this.rotationTimer = window.setInterval(() => this.move(1), ROTATION_INTERVAL_MS);
469
+ /**
470
+ * Mirrors the rotation state onto the host for CSS: `data-rotating` runs the progress line,
471
+ * `data-paused` holds it. `restart` begins a fresh cycle; without it a running one carries on.
472
+ */
473
+ syncRotation(restart) {
474
+ const rotating = shouldAutoRotate(this.cards.length, false, this.reducedMotion, document.visibilityState !== 'hidden', (this.dataset.state ?? 'hidden')) && !this.dismissing;
475
+ const wasRotating = this.hasAttribute('data-rotating');
476
+ this.toggleAttribute('data-rotating', rotating);
477
+ this.toggleAttribute('data-paused', this.paused);
478
+ if (rotating && (restart || !wasRotating)) {
479
+ this.tick = this.tick === 0 ? 1 : 0;
480
+ this.dataset.tick = String(this.tick);
481
+ }
445
482
  }
446
483
  stopRotation() {
447
- if (this.rotationTimer !== undefined)
448
- window.clearInterval(this.rotationTimer);
449
- this.rotationTimer = undefined;
484
+ this.removeAttribute('data-rotating');
450
485
  }
451
486
  startRefresh() {
452
487
  this.stopRefresh();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hagicode/hagilight-core",
3
- "version": "0.10.1-dev.124.1.93cbe18",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "description": "Shared TypeScript utilities, components, and assets for HagiCode Astro and Starlight sites",
6
6
  "repository": {
@@ -58,6 +58,10 @@
58
58
  "types": "./dist/content-images.d.ts",
59
59
  "default": "./dist/content-images.js"
60
60
  },
61
+ "./footer-brand": {
62
+ "types": "./dist/footer-brand.d.ts",
63
+ "default": "./dist/footer-brand.js"
64
+ },
61
65
  "./build-info": {
62
66
  "types": "./dist/build-info.d.ts",
63
67
  "default": "./dist/build-info.js"
@@ -76,6 +80,7 @@
76
80
  },
77
81
  "./comparison-articles-data/*.json": "./data/comparison-articles/*.json",
78
82
  "./Copyright": "./Copyright.astro",
83
+ "./FooterBrand": "./FooterBrand.astro",
79
84
  "./PromotoBanner": "./PromotoBanner.astro",
80
85
  "./GoogleAnalytics": "./GoogleAnalytics.astro",
81
86
  "./Analytics51LA": "./Analytics51LA.astro",