@hagicode/hagilight-core 0.10.1-dev.125.1.c1264bb → 0.11.1-dev.129.1.ea757b8
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/PostHog.astro +11 -0
- package/README.md +103 -1
- package/RootTransit.astro +552 -0
- package/data/comparison-articles/de-DE/codebuddy-vs-hagicode.json +10 -10
- package/data/comparison-articles/de-DE/codex-vs-hagicode.json +6 -6
- package/data/comparison-articles/de-DE/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/de-DE/gemini-vs-hagicode.json +15 -15
- package/data/comparison-articles/de-DE/kimi-vs-hagicode.json +15 -15
- package/data/comparison-articles/de-DE/kiro-vs-hagicode.json +12 -12
- package/data/comparison-articles/de-DE/pi-vs-hagicode.json +10 -10
- package/data/comparison-articles/de-DE/qoder-vs-hagicode.json +13 -13
- package/data/comparison-articles/de-DE/reasonix-vs-hagicode.json +10 -10
- package/data/comparison-articles/en-US/claude-vs-hagicode.json +1 -1
- package/data/comparison-articles/en-US/codebuddy-vs-hagicode.json +1 -1
- package/data/comparison-articles/en-US/codex-vs-hagicode.json +18 -18
- package/data/comparison-articles/en-US/copilot-vs-hagicode.json +29 -29
- package/data/comparison-articles/en-US/deepagents-vs-hagicode.json +4 -4
- package/data/comparison-articles/en-US/gemini-vs-hagicode.json +32 -32
- package/data/comparison-articles/en-US/junie-vs-hagicode.json +19 -19
- package/data/comparison-articles/en-US/kimi-vs-hagicode.json +24 -24
- package/data/comparison-articles/en-US/kiro-vs-hagicode.json +25 -25
- package/data/comparison-articles/en-US/omp-vs-hagicode.json +1 -1
- package/data/comparison-articles/en-US/opencode-vs-hagicode.json +1 -1
- package/data/comparison-articles/en-US/pi-vs-hagicode.json +1 -1
- package/data/comparison-articles/en-US/qoder-vs-hagicode.json +45 -45
- package/data/comparison-articles/en-US/reasonix-vs-hagicode.json +1 -1
- package/data/comparison-articles/es-ES/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/es-ES/codex-vs-hagicode.json +6 -6
- package/data/comparison-articles/es-ES/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/es-ES/gemini-vs-hagicode.json +15 -15
- package/data/comparison-articles/es-ES/kimi-vs-hagicode.json +15 -15
- package/data/comparison-articles/es-ES/kiro-vs-hagicode.json +12 -12
- package/data/comparison-articles/es-ES/pi-vs-hagicode.json +10 -10
- package/data/comparison-articles/es-ES/qoder-vs-hagicode.json +12 -12
- package/data/comparison-articles/es-ES/reasonix-vs-hagicode.json +10 -10
- package/data/comparison-articles/fr-FR/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/fr-FR/codex-vs-hagicode.json +6 -6
- package/data/comparison-articles/fr-FR/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/fr-FR/gemini-vs-hagicode.json +15 -15
- package/data/comparison-articles/fr-FR/kimi-vs-hagicode.json +15 -15
- package/data/comparison-articles/fr-FR/kiro-vs-hagicode.json +12 -12
- package/data/comparison-articles/fr-FR/pi-vs-hagicode.json +10 -10
- package/data/comparison-articles/fr-FR/qoder-vs-hagicode.json +12 -12
- package/data/comparison-articles/fr-FR/reasonix-vs-hagicode.json +10 -10
- package/data/comparison-articles/ja-JP/claude-vs-hagicode.json +1 -1
- package/data/comparison-articles/ja-JP/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/ja-JP/codex-vs-hagicode.json +7 -7
- package/data/comparison-articles/ja-JP/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/ja-JP/gemini-vs-hagicode.json +16 -16
- package/data/comparison-articles/ja-JP/kimi-vs-hagicode.json +16 -16
- package/data/comparison-articles/ja-JP/kiro-vs-hagicode.json +13 -13
- package/data/comparison-articles/ja-JP/pi-vs-hagicode.json +11 -11
- package/data/comparison-articles/ja-JP/qoder-vs-hagicode.json +13 -13
- package/data/comparison-articles/ja-JP/reasonix-vs-hagicode.json +11 -11
- package/data/comparison-articles/ko-KR/claude-vs-hagicode.json +1 -1
- package/data/comparison-articles/ko-KR/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/ko-KR/codex-vs-hagicode.json +7 -7
- package/data/comparison-articles/ko-KR/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/ko-KR/gemini-vs-hagicode.json +15 -15
- package/data/comparison-articles/ko-KR/kimi-vs-hagicode.json +15 -15
- package/data/comparison-articles/ko-KR/kiro-vs-hagicode.json +12 -12
- package/data/comparison-articles/ko-KR/pi-vs-hagicode.json +11 -11
- package/data/comparison-articles/ko-KR/qoder-vs-hagicode.json +12 -12
- package/data/comparison-articles/ko-KR/reasonix-vs-hagicode.json +11 -11
- package/data/comparison-articles/pt-BR/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/pt-BR/codex-vs-hagicode.json +6 -6
- package/data/comparison-articles/pt-BR/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/pt-BR/gemini-vs-hagicode.json +15 -15
- package/data/comparison-articles/pt-BR/kimi-vs-hagicode.json +15 -15
- package/data/comparison-articles/pt-BR/kiro-vs-hagicode.json +12 -12
- package/data/comparison-articles/pt-BR/pi-vs-hagicode.json +10 -10
- package/data/comparison-articles/pt-BR/qoder-vs-hagicode.json +12 -12
- package/data/comparison-articles/pt-BR/reasonix-vs-hagicode.json +10 -10
- package/data/comparison-articles/ru-RU/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/ru-RU/codex-vs-hagicode.json +6 -6
- package/data/comparison-articles/ru-RU/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/ru-RU/gemini-vs-hagicode.json +15 -15
- package/data/comparison-articles/ru-RU/kimi-vs-hagicode.json +15 -15
- package/data/comparison-articles/ru-RU/kiro-vs-hagicode.json +12 -12
- package/data/comparison-articles/ru-RU/pi-vs-hagicode.json +10 -10
- package/data/comparison-articles/ru-RU/qoder-vs-hagicode.json +45 -45
- package/data/comparison-articles/ru-RU/reasonix-vs-hagicode.json +10 -10
- package/data/comparison-articles/zh-CN/claude-vs-hagicode.json +1 -1
- package/data/comparison-articles/zh-CN/codebuddy-vs-hagicode.json +1 -1
- package/data/comparison-articles/zh-CN/codex-vs-hagicode.json +18 -18
- package/data/comparison-articles/zh-CN/copilot-vs-hagicode.json +29 -29
- package/data/comparison-articles/zh-CN/deepagents-vs-hagicode.json +4 -4
- package/data/comparison-articles/zh-CN/gemini-vs-hagicode.json +32 -32
- package/data/comparison-articles/zh-CN/junie-vs-hagicode.json +19 -19
- package/data/comparison-articles/zh-CN/kimi-vs-hagicode.json +25 -25
- package/data/comparison-articles/zh-CN/kiro-vs-hagicode.json +26 -26
- package/data/comparison-articles/zh-CN/omp-vs-hagicode.json +1 -1
- package/data/comparison-articles/zh-CN/pi-vs-hagicode.json +1 -1
- package/data/comparison-articles/zh-CN/qoder-vs-hagicode.json +45 -45
- package/data/comparison-articles/zh-CN/reasonix-vs-hagicode.json +1 -1
- package/data/comparison-articles/zh-Hant/claude-vs-hagicode.json +1 -1
- package/data/comparison-articles/zh-Hant/codebuddy-vs-hagicode.json +11 -11
- package/data/comparison-articles/zh-Hant/codex-vs-hagicode.json +6 -6
- package/data/comparison-articles/zh-Hant/copilot-vs-hagicode.json +2 -2
- package/data/comparison-articles/zh-Hant/gemini-vs-hagicode.json +16 -16
- package/data/comparison-articles/zh-Hant/kimi-vs-hagicode.json +16 -16
- package/data/comparison-articles/zh-Hant/kiro-vs-hagicode.json +13 -13
- package/data/comparison-articles/zh-Hant/pi-vs-hagicode.json +11 -11
- package/data/comparison-articles/zh-Hant/qoder-vs-hagicode.json +12 -12
- package/data/comparison-articles/zh-Hant/reasonix-vs-hagicode.json +11 -11
- package/dist/posthog.d.ts +6 -0
- package/dist/posthog.js +17 -0
- package/dist/root-transit.d.ts +12 -0
- package/dist/root-transit.js +104 -0
- package/package.json +11 -1
package/PostHog.astro
ADDED
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ attribution by itself. Plain-Astro sites that want the literal
|
|
|
29
29
|
`@hagicode/hagilight/Footer`; that component reads the exact build-time version
|
|
30
30
|
from `@hagicode/hagilight`'s own manifest, not from Astro.
|
|
31
31
|
|
|
32
|
-
Other entry points include `Copyright`, `PromotoBanner`, `GoogleAnalytics`, and `Analytics51LA` Astro components; `links`, `favicon`, `seo`, `seo-schema`, `rss`, `rss-ownership`, `promotions`, and `analytics-events` utilities; and `logo.png` and `favicon.ico` assets. For example:
|
|
32
|
+
Other entry points include `Copyright`, `PromotoBanner`, `GoogleAnalytics`, `PostHog`, and `Analytics51LA` Astro components; `links`, `favicon`, `seo`, `seo-schema`, `rss`, `rss-ownership`, `promotions`, and `analytics-events` utilities; and `logo.png` and `favicon.ico` assets. For example:
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
35
|
import { resolveSiteLinks } from '@hagicode/hagilight-core/links';
|
|
@@ -37,6 +37,70 @@ import { resolveSiteLinks } from '@hagicode/hagilight-core/links';
|
|
|
37
37
|
const links = resolveSiteLinks('en-US');
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
## Root transit (explicit opt-in)
|
|
41
|
+
|
|
42
|
+
Use this full-page component in an Astro root route (`src/pages/index.astro`):
|
|
43
|
+
|
|
44
|
+
```astro
|
|
45
|
+
---
|
|
46
|
+
import RootTransit from '@hagicode/hagilight-core/RootTransit';
|
|
47
|
+
---
|
|
48
|
+
<RootTransit destination="/en-US/" siteName="My site" />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Create the destination page first, for example `src/pages/en-US/index.astro`.
|
|
52
|
+
The component includes the official root transit's layout, dark/light colors,
|
|
53
|
+
system font stacks, outline-to-solid route sweep, beam, staggered trace and
|
|
54
|
+
continuation chip. It bundles its logo and favicon locally; no custom CSS,
|
|
55
|
+
animation setup, feature package, third-party resource or analytics is required.
|
|
56
|
+
The trace shows the actual configured destination, base and origin rather than
|
|
57
|
+
performing the official website's locale detection. Installing core alone never
|
|
58
|
+
changes routes. Consumers that do not import this page keep their current root.
|
|
59
|
+
|
|
60
|
+
`destination` and nonblank `siteName` are required. Optional `locale` (default
|
|
61
|
+
`en-US`), `heading`, `message`, and `continueLabel` supply the site's translated
|
|
62
|
+
copy. `links={[{ destination: '/zh-CN/', label: '简体中文', lang: 'zh-CN' }]}`
|
|
63
|
+
adds native alternative-language links without introducing locale selection or
|
|
64
|
+
storage rules. Named `head` and `footer` slots accept site-owned metadata and
|
|
65
|
+
quick links. Hagilight's demo is an adoption example with English at `/en-US/`
|
|
66
|
+
and Chinese at `/zh-CN/`; its separate Starlight demo does not opt in.
|
|
67
|
+
|
|
68
|
+
The deployment base comes from Astro's `BASE_URL`. Local `en-US/` or `/en-US/`
|
|
69
|
+
is relative to that base; an already based `/manual/en-US/` stays unchanged.
|
|
70
|
+
An absolute HTTP(S) URL must match `Astro.site` (or the request origin if absent)
|
|
71
|
+
and already lie within the base. Missing/blank destinations, external origins,
|
|
72
|
+
unsupported schemes, traversal outside the base and root aliases (including
|
|
73
|
+
`index.html`) throw `TypeError` prefixed `Hagilight RootTransit` during rendering
|
|
74
|
+
or static generation. Choose a supported content route, not the transit root.
|
|
75
|
+
The browser-safe `@hagicode/hagilight-core/root-transit` entry point exposes the
|
|
76
|
+
same destination resolver, navigation resolver, mount helper and interval.
|
|
77
|
+
|
|
78
|
+
After mounting, the page replaces the current history entry after **1,570 ms**:
|
|
79
|
+
the reference's 1,250 ms sweep plus 320 ms hold. Motion preferences suppress
|
|
80
|
+
animation without changing forwarding. The clock does not wait for animation
|
|
81
|
+
events, fonts or images. A normal continuation activation replaces immediately;
|
|
82
|
+
modified clicks retain native behavior. Leaving the document or an Astro
|
|
83
|
+
`astro:before-swap` event cancels the timer; `astro:page-load` mounts a newly
|
|
84
|
+
rendered transit page once. Back therefore does not re-enter an automatic loop.
|
|
85
|
+
|
|
86
|
+
With scripting, incoming search and fragment replace their configured counterparts
|
|
87
|
+
when nonempty, and the continuation anchor and timer share the resulting URL.
|
|
88
|
+
For example, `/manual/?utm=a#features` forwards to
|
|
89
|
+
`/manual/en-US/?utm=a#features`. A `?lang=` or `?next=` value is preserved as data
|
|
90
|
+
and never selects the destination. Without JavaScript (or if the script fails),
|
|
91
|
+
initial HTML still contains the heading, message and a working native link to the
|
|
92
|
+
configured landing page. Static HTML cannot carry a browser-only fragment or
|
|
93
|
+
request query into that link; automatic forwarding requires scripting.
|
|
94
|
+
|
|
95
|
+
Run `node --test test/root-transit.test.mjs` after building for URL/timer checks,
|
|
96
|
+
and `node test/root-transit-browser.mjs` for the minimal-consumer, responsive,
|
|
97
|
+
no-script, reduced-motion, base and history checks.
|
|
98
|
+
The latter also runs through `npm run test:viewport`. To compare a locally built
|
|
99
|
+
reference without changing it, set `HAGILIGHT_TRANSIT_REFERENCE_DIR` to the
|
|
100
|
+
official site's `dist` directory. Matching 1440/375 px captures at 625/1,250 ms
|
|
101
|
+
are written to `HAGILIGHT_ARTIFACT_DIR` (default `/tmp/hagilight-root-transit`),
|
|
102
|
+
alongside 320/375/1440 px light/dark, minimal-consumer and base-path captures.
|
|
103
|
+
|
|
40
104
|
## Build info
|
|
41
105
|
|
|
42
106
|
`@hagicode/hagilight-core/build-info` is browser-safe. It exports the `BuildInfo` type, `normalizeBuildInfo`, `shortCommit`, and `buildInfoItems`, which turn a resolved value into the footer's Branch, Commit, and Built items. `@hagicode/hagilight-core/build-info-resolver` is Node-only: `resolveBuildInfo({ root, env, now })` reads the value for one project. Keep Node-only code out of any module that a browser bundle imports.
|
|
@@ -168,6 +232,44 @@ Decision, recorded 2026-10-15 under the `first-party-link-policy-and-attribution
|
|
|
168
232
|
- Constraints that any future linker must respect: one `gtag('config', id)` call per page, so a `linker` setting is added to that single call in `GoogleAnalytics.astro`; the sites with their own inline `gtag` copies would each need the same change; and `_gl` must never reach canonical or sitemap URLs.
|
|
169
233
|
- Revisit this decision when a HagiCode-owned site runs the shared `gtag` on a registrable domain other than `hagicode.com`, or when a first-party destination on another domain also runs HagiCode's `gtag` and needs session continuity. Then list the host, add it to the linker in the single `config` call, and update the GA reference document, which lives in the monorepo root and needs its owner's follow-up edit.
|
|
170
234
|
|
|
235
|
+
## PostHog
|
|
236
|
+
|
|
237
|
+
Render the component once in the global layout's `<head>`, alongside Google Analytics when configured:
|
|
238
|
+
|
|
239
|
+
```astro
|
|
240
|
+
---
|
|
241
|
+
import PostHog from '@hagicode/hagilight-core/PostHog';
|
|
242
|
+
import GoogleAnalytics from '@hagicode/hagilight-core/GoogleAnalytics';
|
|
243
|
+
---
|
|
244
|
+
<html>
|
|
245
|
+
<head>
|
|
246
|
+
<PostHog />
|
|
247
|
+
<GoogleAnalytics measurementId="G-EN03FMT2Q4" />
|
|
248
|
+
</head>
|
|
249
|
+
<body><slot /></body>
|
|
250
|
+
</html>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
`<PostHog />` needs no enabled flag or project key. It uses `phc_qiVVihsL925ovhPYNdLJWz4k7aoKVMwYCevgZPE6PER5`, API host `https://us.i.posthog.com`, and SDK defaults `2026-05-30`. It emits no loader or initialization outside production. The SDK is loaded asynchronously with anonymous cross-origin mode from `https://us-assets.i.posthog.com/static/array.js`.
|
|
254
|
+
|
|
255
|
+
For a different project, pass `<PostHog apiKey="phc_Custom123" />`. Keys must match `^phc_[A-Za-z0-9]+$`; invalid values fail rendering before a script is emitted. The host and defaults version stay fixed.
|
|
256
|
+
|
|
257
|
+
Non-Astro integrations can import the browser-safe ESM generator and its declarations without installing Astro:
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
import {
|
|
261
|
+
posthogInitScript,
|
|
262
|
+
DEFAULT_POSTHOG_API_KEY,
|
|
263
|
+
POSTHOG_API_HOST,
|
|
264
|
+
POSTHOG_DEFAULTS,
|
|
265
|
+
POSTHOG_API_KEY_PATTERN,
|
|
266
|
+
} from '@hagicode/hagilight-core/posthog';
|
|
267
|
+
|
|
268
|
+
const script = posthogInitScript(); // optional custom key as the only argument
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Initialization runs once per document, including when the script is re-executed before or after the SDK loads. Fresh documents initialize independently. SDK defaults own navigation tracking; Hagilight adds no PostHog capture calls or route listeners. Choose one initialization owner: omit this component when another integration initializes PostHog, or disable the plugin provider when composing it yourself. The plain Astro integration does not inject analytics automatically; the demo composes this component in its shared head (and in its transit page's head slot).
|
|
272
|
+
|
|
171
273
|
## Google Analytics click events
|
|
172
274
|
|
|
173
275
|
`GoogleAnalytics` also reports clicks on the key links and download buttons that the shared components render. There is nothing to configure: events follow the same rules as page views, so they are sent only on production pages where Google Analytics is enabled, never on the Starlight 404 page, and silently skipped when `gtag` is missing (development builds, blocked scripts).
|
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
---
|
|
2
|
+
import logo from './logo.png';
|
|
3
|
+
import favicon from './favicon.ico';
|
|
4
|
+
import { resolveTransitDestination } from './dist/root-transit.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
destination: string;
|
|
8
|
+
siteName: string;
|
|
9
|
+
locale?: string;
|
|
10
|
+
heading?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
continueLabel?: string;
|
|
13
|
+
links?: { destination: string; label: string; lang?: string }[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
destination, siteName, locale = 'en-US',
|
|
18
|
+
heading = `Opening ${siteName}`,
|
|
19
|
+
message = 'You will continue automatically. You can also continue now.',
|
|
20
|
+
continueLabel = `Continue to ${siteName}`,
|
|
21
|
+
links = [],
|
|
22
|
+
} = Astro.props;
|
|
23
|
+
if (!siteName?.trim()) throw new TypeError('Hagilight RootTransit: siteName is required.');
|
|
24
|
+
const base = import.meta.env.BASE_URL;
|
|
25
|
+
const site = Astro.site ?? Astro.url;
|
|
26
|
+
const href = resolveTransitDestination(destination, { site, base });
|
|
27
|
+
const localeLinks = links.map((link) => ({ ...link, href: resolveTransitDestination(link.destination, { site, base }) }));
|
|
28
|
+
const route = new URL(href, site).pathname;
|
|
29
|
+
const trace = [
|
|
30
|
+
['destination', route],
|
|
31
|
+
['base', base],
|
|
32
|
+
['origin', new URL(site).origin],
|
|
33
|
+
['source', 'site configuration'],
|
|
34
|
+
];
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
<!doctype html>
|
|
38
|
+
<html lang={locale} data-hagilight-transit>
|
|
39
|
+
<head>
|
|
40
|
+
<meta charset="UTF-8" />
|
|
41
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
42
|
+
<title>{heading} — {siteName}</title>
|
|
43
|
+
<meta name="description" content={message} />
|
|
44
|
+
<meta name="robots" content="noindex,follow" />
|
|
45
|
+
<link rel="canonical" href={new URL(href, site).href} />
|
|
46
|
+
<link rel="icon" type="image/x-icon" href={favicon} />
|
|
47
|
+
<slot name="head" />
|
|
48
|
+
<script is:inline>
|
|
49
|
+
(() => {
|
|
50
|
+
let stored = null;
|
|
51
|
+
try { stored = localStorage.getItem('starlight-theme'); } catch {}
|
|
52
|
+
const system = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
53
|
+
document.documentElement.setAttribute('data-theme', stored || system);
|
|
54
|
+
})();
|
|
55
|
+
</script>
|
|
56
|
+
<script>
|
|
57
|
+
import { mountRootTransit } from './dist/root-transit.js';
|
|
58
|
+
mountRootTransit();
|
|
59
|
+
document.addEventListener('astro:page-load', () => mountRootTransit());
|
|
60
|
+
</script>
|
|
61
|
+
<style>
|
|
62
|
+
:global(:root[data-hagilight-transit]) {
|
|
63
|
+
color-scheme: dark;
|
|
64
|
+
--bg: #030712;
|
|
65
|
+
--ink: #f8fafc;
|
|
66
|
+
--muted: #94a3b8;
|
|
67
|
+
--line: rgba(255, 255, 255, 0.12);
|
|
68
|
+
--line-strong: rgba(255, 255, 255, 0.28);
|
|
69
|
+
--accent: #00cccc;
|
|
70
|
+
--accent-ink: #031316;
|
|
71
|
+
--beam-a: #0080ff;
|
|
72
|
+
--beam-b: #00cccc;
|
|
73
|
+
--beam-c: #22c55e;
|
|
74
|
+
--font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", "Segoe UI", system-ui, sans-serif;
|
|
75
|
+
--font-mono: "SF Mono", Menlo, "Cascadia Code", Consolas, "Roboto Mono", "JetBrains Mono", monospace;
|
|
76
|
+
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:global(:root[data-hagilight-transit][data-theme='light']) {
|
|
80
|
+
color-scheme: light;
|
|
81
|
+
--bg: #f5f5f7;
|
|
82
|
+
--ink: #0f172a;
|
|
83
|
+
--muted: #475569;
|
|
84
|
+
--line: rgba(0, 0, 0, 0.12);
|
|
85
|
+
--line-strong: rgba(0, 0, 0, 0.3);
|
|
86
|
+
--accent: #0060cc;
|
|
87
|
+
--accent-ink: #ffffff;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* 提案 → 执行:--run (0 → 1) 同时驱动轮廓、实心字、光束,三层不会错位 */
|
|
91
|
+
@property --run {
|
|
92
|
+
syntax: '<number>';
|
|
93
|
+
inherits: true;
|
|
94
|
+
initial-value: 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@property --chip-fill {
|
|
98
|
+
syntax: '<number>';
|
|
99
|
+
inherits: true;
|
|
100
|
+
initial-value: 1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
*,
|
|
104
|
+
*::before,
|
|
105
|
+
*::after {
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:global(html[data-hagilight-transit]) {
|
|
110
|
+
background: var(--bg);
|
|
111
|
+
scrollbar-color: var(--line-strong) transparent;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:global(body:has([data-root-transit])) {
|
|
115
|
+
margin: 0;
|
|
116
|
+
min-height: 100dvh;
|
|
117
|
+
background: var(--bg);
|
|
118
|
+
color: var(--ink);
|
|
119
|
+
font-family: var(--font-sans);
|
|
120
|
+
font-size: 1rem;
|
|
121
|
+
line-height: 1.6;
|
|
122
|
+
-webkit-font-smoothing: antialiased;
|
|
123
|
+
-moz-osx-font-smoothing: grayscale;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
::selection {
|
|
127
|
+
background: color-mix(in srgb, var(--accent) 34%, transparent);
|
|
128
|
+
color: inherit;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
a {
|
|
132
|
+
color: inherit;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
a:focus-visible {
|
|
136
|
+
outline: 2px solid var(--accent);
|
|
137
|
+
outline-offset: 3px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* ── 页面骨架 ── */
|
|
141
|
+
.page {
|
|
142
|
+
display: grid;
|
|
143
|
+
grid-template-rows: auto 1fr auto;
|
|
144
|
+
gap: clamp(1.5rem, 5vh, 3rem);
|
|
145
|
+
width: min(100%, 78rem);
|
|
146
|
+
min-height: 100dvh;
|
|
147
|
+
margin-inline: auto;
|
|
148
|
+
padding: clamp(1.25rem, 4vw, 3rem);
|
|
149
|
+
transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:global(html[data-transit-state='leaving']) .page {
|
|
153
|
+
opacity: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.brand {
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
gap: 0.625rem;
|
|
160
|
+
font-size: 1.0625rem;
|
|
161
|
+
font-weight: 700;
|
|
162
|
+
letter-spacing: -0.01em;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.brand img {
|
|
166
|
+
width: 28px;
|
|
167
|
+
height: 28px;
|
|
168
|
+
border-radius: 6px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.stage {
|
|
172
|
+
display: grid;
|
|
173
|
+
align-self: center;
|
|
174
|
+
gap: clamp(2rem, 5vh, 3.5rem);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@media (min-width: 64rem) {
|
|
178
|
+
.stage {
|
|
179
|
+
grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
|
|
180
|
+
column-gap: clamp(3rem, 6vw, 6rem);
|
|
181
|
+
align-items: end;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.locales {
|
|
185
|
+
grid-column: 1 / -1;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Route sweep copied from the official root transit. */
|
|
190
|
+
.route {
|
|
191
|
+
margin: 0 0 0.12em;
|
|
192
|
+
font-size: clamp(2.75rem, 7.2vw, 6rem);
|
|
193
|
+
font-weight: 800;
|
|
194
|
+
line-height: 0.95;
|
|
195
|
+
letter-spacing: -0.03em;
|
|
196
|
+
overflow-wrap: anywhere;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.route-origin {
|
|
200
|
+
color: var(--ink);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.route-target {
|
|
204
|
+
display: inline-block;
|
|
205
|
+
max-width: calc(100% - 0.5em);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.run {
|
|
209
|
+
--run: 1;
|
|
210
|
+
--edge: 0.1em;
|
|
211
|
+
position: relative;
|
|
212
|
+
display: inline-grid;
|
|
213
|
+
max-width: 100%;
|
|
214
|
+
min-width: 0;
|
|
215
|
+
vertical-align: top;
|
|
216
|
+
padding-bottom: 0.12em;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
:global(html[data-transit-ready]) .run {
|
|
220
|
+
animation: routeRun var(--run-dur, 1250ms) cubic-bezier(0.3, 0.55, 0.15, 1) both;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@keyframes routeRun {
|
|
224
|
+
from {
|
|
225
|
+
--run: 0;
|
|
226
|
+
}
|
|
227
|
+
to {
|
|
228
|
+
--run: 1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.run-ghost,
|
|
233
|
+
.run-solid {
|
|
234
|
+
grid-area: 1 / 1;
|
|
235
|
+
display: block;
|
|
236
|
+
white-space: normal;
|
|
237
|
+
overflow-wrap: anywhere;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.run-solid {
|
|
241
|
+
color: var(--accent);
|
|
242
|
+
clip-path: inset(-0.3em calc((1 - var(--run)) * 100% - var(--run) * var(--edge)) -0.3em -0.3em);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* 尚未执行的字形:只有轮廓,光束走过后消失 */
|
|
246
|
+
.run-ghost {
|
|
247
|
+
color: transparent;
|
|
248
|
+
user-select: none;
|
|
249
|
+
-webkit-text-stroke: max(1.5px, 0.012em) color-mix(in srgb, var(--accent) 82%, transparent);
|
|
250
|
+
clip-path: inset(-0.3em -0.3em -0.3em calc(var(--run) * (100% + var(--edge))));
|
|
251
|
+
opacity: min(1, calc((1 - var(--run)) * 10));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.run-beam {
|
|
255
|
+
position: absolute;
|
|
256
|
+
top: -0.04em;
|
|
257
|
+
bottom: 0.1em;
|
|
258
|
+
left: calc(var(--run) * (100% + var(--edge)));
|
|
259
|
+
width: max(2px, 0.02em);
|
|
260
|
+
margin-left: calc(max(2px, 0.02em) / -2);
|
|
261
|
+
background: linear-gradient(180deg, var(--beam-a), var(--beam-b) 52%, var(--beam-c));
|
|
262
|
+
opacity: min(1, calc(var(--run) * 14), calc((1 - var(--run)) * 14));
|
|
263
|
+
pointer-events: none;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/* 光束尾迹:刚刚执行过的地方 */
|
|
267
|
+
.run-beam::before {
|
|
268
|
+
content: '';
|
|
269
|
+
position: absolute;
|
|
270
|
+
inset: 0 100% 0 auto;
|
|
271
|
+
width: 0.7em;
|
|
272
|
+
background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--beam-b) 24%, transparent));
|
|
273
|
+
mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
|
|
274
|
+
-webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* ── 标题与状态 ── */
|
|
278
|
+
.headline {
|
|
279
|
+
margin: 1rem 0 0;
|
|
280
|
+
font-size: 1.5rem;
|
|
281
|
+
font-weight: 700;
|
|
282
|
+
line-height: 1.2;
|
|
283
|
+
text-wrap: balance;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.status {
|
|
287
|
+
max-width: 38ch;
|
|
288
|
+
/* 两行的高度:提示与「已停止」文案互换时,整个版面不跳动 */
|
|
289
|
+
min-height: 3em;
|
|
290
|
+
margin: 0.75rem 0 0;
|
|
291
|
+
color: var(--muted);
|
|
292
|
+
font-size: 0.9375rem;
|
|
293
|
+
line-height: 1.5;
|
|
294
|
+
text-wrap: pretty;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:global(html[data-transit-state='paused']) .status {
|
|
298
|
+
color: var(--ink);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* ── 解析过程:每一行都是真实输入 ── */
|
|
302
|
+
.trace {
|
|
303
|
+
margin: 0;
|
|
304
|
+
border-bottom: 1px solid var(--line);
|
|
305
|
+
font-family: var(--font-mono);
|
|
306
|
+
font-size: 0.8125rem;
|
|
307
|
+
line-height: 1.4;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.trace-row {
|
|
311
|
+
display: grid;
|
|
312
|
+
grid-template-areas: 'label verdict' 'value value';
|
|
313
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
314
|
+
gap: 0.125rem 1rem;
|
|
315
|
+
padding: 0.75rem 0;
|
|
316
|
+
border-top: 1px solid var(--line);
|
|
317
|
+
color: var(--muted);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
@media (min-width: 40rem) {
|
|
321
|
+
.trace-row {
|
|
322
|
+
grid-template-areas: 'label value verdict';
|
|
323
|
+
grid-template-columns: minmax(0, 11.5rem) minmax(0, 1fr) 4.5rem;
|
|
324
|
+
gap: 0 1rem;
|
|
325
|
+
align-items: baseline;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.trace-row dt {
|
|
330
|
+
grid-area: label;
|
|
331
|
+
overflow-wrap: anywhere;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.trace-value {
|
|
335
|
+
grid-area: value;
|
|
336
|
+
margin: 0;
|
|
337
|
+
overflow-wrap: anywhere;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.trace-verdict {
|
|
341
|
+
grid-area: verdict;
|
|
342
|
+
margin: 0;
|
|
343
|
+
font-family: var(--font-sans);
|
|
344
|
+
font-size: 0.8125rem;
|
|
345
|
+
font-weight: 600;
|
|
346
|
+
text-align: right;
|
|
347
|
+
white-space: nowrap;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.trace-verdict:empty {
|
|
351
|
+
display: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.trace-row[data-state='used'] {
|
|
355
|
+
color: var(--ink);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.trace-row[data-state='used'] .trace-value {
|
|
359
|
+
color: var(--accent);
|
|
360
|
+
font-weight: 600;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.trace-row[data-state='used'] .trace-verdict {
|
|
364
|
+
color: var(--accent);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.trace-row[data-state='used'] .trace-verdict::before {
|
|
368
|
+
content: '';
|
|
369
|
+
display: inline-block;
|
|
370
|
+
width: 0.4375rem;
|
|
371
|
+
height: 0.4375rem;
|
|
372
|
+
margin-right: 0.4375rem;
|
|
373
|
+
border-radius: 50%;
|
|
374
|
+
background: var(--accent);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
:global(html[data-transit-ready]) .trace-row {
|
|
378
|
+
animation: traceIn 520ms var(--ease-out) both;
|
|
379
|
+
animation-delay: calc(var(--run-dur, 1250ms) * 0.12 * var(--i, 0));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
:global(html[data-transit-ready]) .trace-row[data-state='used'] .trace-verdict {
|
|
383
|
+
animation: verdictIn 360ms var(--ease-out) both;
|
|
384
|
+
animation-delay: calc(var(--run-dur, 1250ms) * 0.78);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
@keyframes traceIn {
|
|
388
|
+
from {
|
|
389
|
+
opacity: 0;
|
|
390
|
+
transform: translateY(8px);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@keyframes verdictIn {
|
|
395
|
+
from {
|
|
396
|
+
opacity: 0;
|
|
397
|
+
transform: translateX(-6px);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* ── 语言列表:真实链接,也是手动选择入口 ── */
|
|
402
|
+
.locales-label {
|
|
403
|
+
margin: 0 0 0.75rem;
|
|
404
|
+
color: var(--muted);
|
|
405
|
+
font-size: 0.8125rem;
|
|
406
|
+
font-weight: 600;
|
|
407
|
+
letter-spacing: 0.01em;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.locales ul {
|
|
411
|
+
display: flex;
|
|
412
|
+
flex-wrap: wrap;
|
|
413
|
+
gap: 0.5rem;
|
|
414
|
+
margin: 0;
|
|
415
|
+
padding: 0;
|
|
416
|
+
list-style: none;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.locales a {
|
|
420
|
+
display: inline-flex;
|
|
421
|
+
align-items: center;
|
|
422
|
+
min-height: 2.75rem;
|
|
423
|
+
padding: 0 1rem;
|
|
424
|
+
border: 1px solid var(--line-strong);
|
|
425
|
+
border-radius: 9999px;
|
|
426
|
+
background: linear-gradient(var(--accent), var(--accent)) no-repeat left / 0% 100%;
|
|
427
|
+
font-size: 0.9375rem;
|
|
428
|
+
font-weight: 600;
|
|
429
|
+
line-height: 1.3;
|
|
430
|
+
letter-spacing: 0.01em;
|
|
431
|
+
text-decoration: none;
|
|
432
|
+
transition:
|
|
433
|
+
border-color 150ms ease,
|
|
434
|
+
transform 150ms ease;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.locales a:hover {
|
|
438
|
+
border-color: var(--accent);
|
|
439
|
+
transform: translateY(-1px);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.locales a[aria-current='true'] {
|
|
443
|
+
--chip-fill: 1;
|
|
444
|
+
display: inline-grid;
|
|
445
|
+
border-color: var(--accent);
|
|
446
|
+
background-size: calc(var(--chip-fill) * 100%) 100%;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.chip-label, .chip-filled {
|
|
450
|
+
grid-area: 1 / 1;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.chip-label {
|
|
454
|
+
color: var(--accent);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/* Keep each text color over its matching surface while the chip fills. */
|
|
458
|
+
.chip-filled {
|
|
459
|
+
color: var(--accent-ink);
|
|
460
|
+
clip-path: inset(-0.2em calc((1 - var(--chip-fill)) * (100% + 2rem) - 1rem) -0.2em -1rem);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/* 选中的语言在光束走完时被填满:同一次执行的落点 */
|
|
464
|
+
:global(html[data-transit-ready]) .locales a[aria-current='true'] {
|
|
465
|
+
animation: chipFill 420ms var(--ease-out) both;
|
|
466
|
+
animation-delay: calc(var(--run-dur, 1250ms) * 0.92);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
@keyframes chipFill {
|
|
470
|
+
from {
|
|
471
|
+
--chip-fill: 0;
|
|
472
|
+
}
|
|
473
|
+
to {
|
|
474
|
+
--chip-fill: 1;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/* ── 页脚 ── */
|
|
479
|
+
.quick-links {
|
|
480
|
+
display: flex;
|
|
481
|
+
flex-wrap: wrap;
|
|
482
|
+
gap: 0 1.5rem;
|
|
483
|
+
font-size: 0.8125rem;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.quick-links :global(a) {
|
|
487
|
+
padding: 0.5rem 0;
|
|
488
|
+
color: var(--muted);
|
|
489
|
+
text-underline-offset: 0.2em;
|
|
490
|
+
text-decoration-color: transparent;
|
|
491
|
+
transition: color 150ms ease, text-decoration-color 150ms ease;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.quick-links :global(a:hover) {
|
|
495
|
+
color: var(--ink);
|
|
496
|
+
text-decoration-color: currentColor;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.quick-links :global(a:focus-visible) {
|
|
500
|
+
outline: 2px solid var(--accent);
|
|
501
|
+
outline-offset: 3px;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
@media (prefers-reduced-motion: reduce) {
|
|
505
|
+
*, *::before, *::after { animation: none !important; transition: none !important; }
|
|
506
|
+
.run { --run: 1; }
|
|
507
|
+
.locales a:hover {
|
|
508
|
+
transform: none;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
@media (forced-colors: active) {
|
|
513
|
+
.locales a[aria-current='true'] {
|
|
514
|
+
outline: 2px solid Highlight;
|
|
515
|
+
forced-color-adjust: none;
|
|
516
|
+
color: HighlightText;
|
|
517
|
+
background: Highlight;
|
|
518
|
+
}
|
|
519
|
+
.chip-label, .chip-filled { color: HighlightText; }
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
</style>
|
|
523
|
+
</head>
|
|
524
|
+
<body>
|
|
525
|
+
<div class="page" data-root-transit data-base={base}>
|
|
526
|
+
<header>
|
|
527
|
+
<span class="brand"><img src={logo.src} width="28" height="28" alt="" />{siteName}</span>
|
|
528
|
+
</header>
|
|
529
|
+
<main class="stage">
|
|
530
|
+
<div class="intro">
|
|
531
|
+
<p class="route" aria-hidden="true"><span class="route-origin">/</span><span class="route-target"><span class="run"><span class="run-ghost">{route.slice(1)}</span><span class="run-solid">{route.slice(1)}</span><span class="run-beam"></span></span></span></p>
|
|
532
|
+
<h1 class="headline">{heading}</h1>
|
|
533
|
+
<p class="status">{message}</p>
|
|
534
|
+
</div>
|
|
535
|
+
<dl class="trace" aria-hidden="true">
|
|
536
|
+
{trace.map(([label, value], index) => (
|
|
537
|
+
<div class="trace-row" data-state={index === 0 ? 'used' : 'idle'} style={`--i: ${index}`}>
|
|
538
|
+
<dt>{label}</dt><dd class="trace-value">{value}</dd><dd class="trace-verdict">{index === 0 ? 'configured' : ''}</dd>
|
|
539
|
+
</div>
|
|
540
|
+
))}
|
|
541
|
+
</dl>
|
|
542
|
+
<nav class="locales" aria-label={continueLabel}>
|
|
543
|
+
<ul>
|
|
544
|
+
<li><a href={href} data-transit-continue aria-current="true"><span class="chip-label">{continueLabel}</span><span class="chip-filled" aria-hidden="true">{continueLabel}</span></a></li>
|
|
545
|
+
{localeLinks.map((link) => <li><a href={link.href} lang={link.lang} data-transit-alternative>{link.label}</a></li>)}
|
|
546
|
+
</ul>
|
|
547
|
+
</nav>
|
|
548
|
+
</main>
|
|
549
|
+
<footer><nav class="quick-links"><slot name="footer" /></nav></footer>
|
|
550
|
+
</div>
|
|
551
|
+
</body>
|
|
552
|
+
</html>
|