@celestia-island/hikari 0.55.373 → 0.55.377
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 +1 -1
- package/src/components/HkEmergencyAlert.layering.contract.test.ts +24 -1
- package/src/components/HkEmergencyAlert.scss +33 -8
- package/src/components/HkEmergencyAlert.test.tsx +5 -0
- package/src/composables/useHighlight.ts +8 -0
- package/src/composables/wasmHighlight.ts +20 -0
- package/src/wasm/highlight/hikari_wasm_highlight.d.ts +21 -0
- package/src/wasm/highlight/hikari_wasm_highlight.js +6172 -0
- package/src/wasm/highlight/interfaces/hikari-highlight-types.d.ts +4 -0
- package/src/wasm/highlight/interfaces/wasi-cli-environment.d.ts +2 -0
- package/src/wasm/highlight/interfaces/wasi-cli-exit.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-cli-stderr.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-cli-stdin.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-cli-stdout.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-cli-terminal-input.d.ts +8 -0
- package/src/wasm/highlight/interfaces/wasi-cli-terminal-output.d.ts +8 -0
- package/src/wasm/highlight/interfaces/wasi-cli-terminal-stderr.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-cli-terminal-stdin.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-cli-terminal-stdout.d.ts +3 -0
- package/src/wasm/highlight/interfaces/wasi-clocks-monotonic-clock.d.ts +4 -0
- package/src/wasm/highlight/interfaces/wasi-io-error.d.ts +8 -0
- package/src/wasm/highlight/interfaces/wasi-io-poll.d.ts +10 -0
- package/src/wasm/highlight/interfaces/wasi-io-streams.d.ts +38 -0
package/package.json
CHANGED
|
@@ -123,7 +123,7 @@ describe("emergency alert layering contract", () => {
|
|
|
123
123
|
expect(root).not.toContain("var(--color-background");
|
|
124
124
|
// Dark-ink DIRECTION, not a literal: every RGB channel must be
|
|
125
125
|
// dark (<60) and the veil substantial (alpha >= 40%). A future
|
|
126
|
-
// retune (55%→52%,
|
|
126
|
+
// retune (55%→52%, 12 14 20 etc.) passes; a light recolor
|
|
127
127
|
// (200 210 220) fails on semantics, not on mismatched text.
|
|
128
128
|
// EXACTLY ONE declaration per property, counted by NAME in any
|
|
129
129
|
// value form: a later duplicate wins the cascade silently, so a
|
|
@@ -146,6 +146,29 @@ describe("emergency alert layering contract", () => {
|
|
|
146
146
|
expect(root).toMatch(/--hk-emergency-wash:\s*color-mix\(in srgb, var\(--hk-emergency-line\)/);
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
+
it("the warning action is a caution chip in the band's own ink", () => {
|
|
150
|
+
// The chip replaces the brand-primary blue: tone wash fill, tone
|
|
151
|
+
// border — and the TEXT follows the theme text ink (NOT
|
|
152
|
+
// --color-on-warning, whose dark ink only works on a solid tone
|
|
153
|
+
// surface; the chip sits on the theme band in both modes). The
|
|
154
|
+
// doctrine chain (line/wash, never solid fill) is what R2's
|
|
155
|
+
// rejected fill form got wrong.
|
|
156
|
+
const css = sheet();
|
|
157
|
+
rootBlock(css);
|
|
158
|
+
// EXACTLY ONE chip rule, counted by name in any value form — a
|
|
159
|
+
// later duplicate would win the cascade silently (the R7
|
|
160
|
+
// multi-root vector, at chip granularity).
|
|
161
|
+
expect(css.match(/\.is-warning \.hk-emergency-actions \.hk-btn-primary\s*{/g)?.length).toBe(1);
|
|
162
|
+
const chip = css.match(
|
|
163
|
+
/\.is-warning \.hk-emergency-actions \.hk-btn-primary\s*{([^}]*)}/,
|
|
164
|
+
);
|
|
165
|
+
expect(chip, "the warning chip rule must exist").not.toBeNull();
|
|
166
|
+
expect(chip![1]).toContain("background: var(--hk-emergency-wash);");
|
|
167
|
+
expect(chip![1]).toContain("border-color: var(--hk-emergency-line);");
|
|
168
|
+
expect(chip![1]).toContain("color: rgb(var(--color-text");
|
|
169
|
+
expect(chip![1]).not.toContain("--color-on-warning");
|
|
170
|
+
});
|
|
171
|
+
|
|
149
172
|
it("long content stays reachable: the layer scrolls and the band safe-centers", () => {
|
|
150
173
|
// A fixed full-height layer never grows the document, so clipped
|
|
151
174
|
// content would strand the actions forever (R2 finding 5). The
|
|
@@ -23,13 +23,16 @@
|
|
|
23
23
|
--hk-emergency-line-soft: color-mix(in srgb, var(--hk-emergency-line) 55%, transparent);
|
|
24
24
|
--hk-emergency-edge-glow: color-mix(in srgb, var(--hk-emergency-line) 22%, transparent);
|
|
25
25
|
--hk-emergency-wash: color-mix(in srgb, var(--hk-emergency-line) 14%, transparent);
|
|
26
|
-
--hk-emergency-band-bg: rgb(var(--color-surface,
|
|
26
|
+
--hk-emergency-band-bg: rgb(var(--color-surface, 255 255 255) / 96%);
|
|
27
27
|
// The scrim is DARK INK ON PURPOSE — theme-independent. Pointing it
|
|
28
28
|
// at --color-background (the 0.55.370 default) makes it a WHITE veil
|
|
29
29
|
// in light themes: the page never darkens, and the takeover reads as
|
|
30
30
|
// a pastel banner on plain paper (2026-11-14 field report). A scrim
|
|
31
|
-
// darkens what is behind it; that is mode-independent.
|
|
32
|
-
|
|
31
|
+
// darkens what is behind it; that is mode-independent. The ink is
|
|
32
|
+
// the house pure black (HkModal / HkDrawer scrims = rgba(0,0,0,α)
|
|
33
|
+
// behind their own --hk-*-overlay-bg vars); this takeover dims at
|
|
34
|
+
// 55% versus their 45% — a takeover sits above work, not beside it.
|
|
35
|
+
--hk-emergency-scrim: rgb(0 0 0 / 55%);
|
|
33
36
|
|
|
34
37
|
position: fixed;
|
|
35
38
|
// Chrome-band leg: in native hosts the window titlebar owns the top
|
|
@@ -95,9 +98,9 @@
|
|
|
95
98
|
// a deep soft shadow lifts it off the scrim so the takeover reads
|
|
96
99
|
// as layered, not pasted (0.55.370 field note: without this the
|
|
97
100
|
// light band floated flat on the light page).
|
|
98
|
-
box-shadow: 0 24px 72px rgb(
|
|
101
|
+
box-shadow: 0 24px 72px rgb(0 0 0 / 45%);
|
|
99
102
|
text-align: center;
|
|
100
|
-
color: rgb(var(--color-text,
|
|
103
|
+
color: rgb(var(--color-text, 30 32 36));
|
|
101
104
|
font-family: var(--font-sans, system-ui, sans-serif);
|
|
102
105
|
|
|
103
106
|
// FUI double line: a second, fainter signal line hugging each edge
|
|
@@ -183,7 +186,7 @@
|
|
|
183
186
|
font-weight: 700;
|
|
184
187
|
line-height: 1.2;
|
|
185
188
|
letter-spacing: 0.01em;
|
|
186
|
-
color: rgb(var(--color-text,
|
|
189
|
+
color: rgb(var(--color-text, 30 32 36));
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
.hk-emergency-desc {
|
|
@@ -191,7 +194,7 @@
|
|
|
191
194
|
max-width: 56ch;
|
|
192
195
|
font-size: clamp(1rem, 2vw, 1.125rem);
|
|
193
196
|
line-height: 1.6;
|
|
194
|
-
color: rgb(var(--color-muted,
|
|
197
|
+
color: rgb(var(--color-muted, 118 122 128));
|
|
195
198
|
white-space: pre-line;
|
|
196
199
|
}
|
|
197
200
|
|
|
@@ -200,7 +203,7 @@
|
|
|
200
203
|
font-family: var(--font-mono, ui-monospace, monospace);
|
|
201
204
|
font-size: 0.8125rem;
|
|
202
205
|
letter-spacing: 0.08em;
|
|
203
|
-
color: rgb(var(--color-muted,
|
|
206
|
+
color: rgb(var(--color-muted, 118 122 128));
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
.hk-emergency-actions {
|
|
@@ -211,6 +214,28 @@
|
|
|
211
214
|
margin-top: var(--space-14, 0.875rem);
|
|
212
215
|
}
|
|
213
216
|
|
|
217
|
+
// The band's own color language carries its primary action: on a
|
|
218
|
+
// WARNING band the brand-primary (blue) chip read as another app's
|
|
219
|
+
// chrome pasted onto the alert (2026-11-14 field report). Repaint it
|
|
220
|
+
// as a CAUTION CHIP — tone wash fill, tone border, theme text ink —
|
|
221
|
+
// which reads as the alert's own instrument button in both modes AND
|
|
222
|
+
// respects every shipped theme doctrine by construction: it is a line
|
|
223
|
+
// and a wash, never a solid fill (endfield's "yellow never fills",
|
|
224
|
+
// amphoreus's "gold ≤10%", arcaea's tracks-not-fills). DANGER bands
|
|
225
|
+
// keep the solid hk-btn-danger (red on red). Theme packages may still
|
|
226
|
+
// re-point tone/line to retune the chip's color wholesale.
|
|
227
|
+
.is-warning .hk-emergency-actions .hk-btn-primary {
|
|
228
|
+
background: var(--hk-emergency-wash);
|
|
229
|
+
border-color: var(--hk-emergency-line);
|
|
230
|
+
color: rgb(var(--color-text, 30 32 36));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.is-warning .hk-emergency-actions .hk-btn-primary:hover:not(:disabled):not(:focus-visible) {
|
|
234
|
+
filter: none;
|
|
235
|
+
background: color-mix(in srgb, var(--hk-emergency-line) 22%, transparent);
|
|
236
|
+
box-shadow: 0 0 14px var(--hk-emergency-edge-glow);
|
|
237
|
+
}
|
|
238
|
+
|
|
214
239
|
// ── Motion ────────────────────────────────────────────────────────────
|
|
215
240
|
// Enter/leave: the band draws its signal edges and lifts into place;
|
|
216
241
|
// leave mirrors it. Steady state stays ALIVE but quiet — the badge
|
|
@@ -122,6 +122,11 @@ describe("actions & snooze", () => {
|
|
|
122
122
|
const [primary, snooze] = buttons();
|
|
123
123
|
expect(primary.textContent).toBe("立即处理");
|
|
124
124
|
expect(snooze.textContent).toBe("Hide for now");
|
|
125
|
+
// The band's color language carries the primary action: a WARNING
|
|
126
|
+
// band paints the primary button in the severity tone (band-scoped
|
|
127
|
+
// rule) — it must NOT be the brand-primary blue chip.
|
|
128
|
+
expect(primary.className).toContain("hk-btn-primary");
|
|
129
|
+
expect(primary.className).not.toContain("hk-btn-danger");
|
|
125
130
|
|
|
126
131
|
primary.click();
|
|
127
132
|
expect(handle).toHaveBeenCalledTimes(1);
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
import hljs from "highlight.js/lib/core";
|
|
16
16
|
import { ref } from "vue";
|
|
17
17
|
|
|
18
|
+
import { wasmHighlight, wasmSupportedLanguages } from "./wasmHighlight";
|
|
19
|
+
|
|
18
20
|
import { LANGUAGE_LOADERS } from "./highlightLanguages";
|
|
19
21
|
|
|
20
22
|
// Bumped each time a grammar registers; read inside highlight() so reactive
|
|
@@ -216,6 +218,12 @@ export function highlight(code: string, lang?: string): string {
|
|
|
216
218
|
|
|
217
219
|
const name = lang ? normalize(lang) : "";
|
|
218
220
|
if (name) {
|
|
221
|
+
// Wasm component first: it is synchronous and always loaded (the
|
|
222
|
+
// grammars are compiled in), so languages it covers never hit the
|
|
223
|
+
// lazy hljs loader — no flash of unstyled code.
|
|
224
|
+
const wasmResult = wasmHighlight(code, name);
|
|
225
|
+
if (wasmResult !== null) return wasmResult;
|
|
226
|
+
|
|
219
227
|
if (loaded.has(name)) {
|
|
220
228
|
try {
|
|
221
229
|
return hljs.highlight(code, { language: name }).value;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// wasmHighlight.ts — the wasm-backed syntax highlighting engine.
|
|
2
|
+
//
|
|
3
|
+
// Wraps hikari-wasm-highlight (the pest-driven Rust component) and
|
|
4
|
+
// produces hljs-compatible HTML. When the wasm component supports the
|
|
5
|
+
// requested language, it takes over; otherwise the hljs fallback stays.
|
|
6
|
+
|
|
7
|
+
import { highlight as wasmHighlightFn, languages as wasmLanguages } from "../wasm/highlight/hikari_wasm_highlight.js";
|
|
8
|
+
|
|
9
|
+
export type HighlightResult = string | null;
|
|
10
|
+
|
|
11
|
+
/** The set of languages the wasm component currently supports. */
|
|
12
|
+
export function wasmSupportedLanguages(): Set<string> {
|
|
13
|
+
return new Set(wasmLanguages());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Highlight through the wasm component; null when unsupported. */
|
|
17
|
+
export function wasmHighlight(code: string, language: string): HighlightResult {
|
|
18
|
+
const result = wasmHighlightFn(code, language);
|
|
19
|
+
return result?.html ?? null;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// world root:component/root
|
|
2
|
+
export type HighlightResult = import('./interfaces/hikari-highlight-types.js').HighlightResult;
|
|
3
|
+
export type * as HikariHighlightTypes from './interfaces/hikari-highlight-types.js'; // import hikari:highlight/types
|
|
4
|
+
export type * as WasiCliEnvironment0212 from './interfaces/wasi-cli-environment.js'; // import wasi:cli/environment@0.2.12
|
|
5
|
+
export type * as WasiCliExit0212 from './interfaces/wasi-cli-exit.js'; // import wasi:cli/exit@0.2.12
|
|
6
|
+
export type * as WasiCliStderr0212 from './interfaces/wasi-cli-stderr.js'; // import wasi:cli/stderr@0.2.12
|
|
7
|
+
export type * as WasiCliStdin0212 from './interfaces/wasi-cli-stdin.js'; // import wasi:cli/stdin@0.2.12
|
|
8
|
+
export type * as WasiCliStdout0212 from './interfaces/wasi-cli-stdout.js'; // import wasi:cli/stdout@0.2.12
|
|
9
|
+
export type * as WasiCliTerminalInput0212 from './interfaces/wasi-cli-terminal-input.js'; // import wasi:cli/terminal-input@0.2.12
|
|
10
|
+
export type * as WasiCliTerminalOutput0212 from './interfaces/wasi-cli-terminal-output.js'; // import wasi:cli/terminal-output@0.2.12
|
|
11
|
+
export type * as WasiCliTerminalStderr0212 from './interfaces/wasi-cli-terminal-stderr.js'; // import wasi:cli/terminal-stderr@0.2.12
|
|
12
|
+
export type * as WasiCliTerminalStdin0212 from './interfaces/wasi-cli-terminal-stdin.js'; // import wasi:cli/terminal-stdin@0.2.12
|
|
13
|
+
export type * as WasiCliTerminalStdout0212 from './interfaces/wasi-cli-terminal-stdout.js'; // import wasi:cli/terminal-stdout@0.2.12
|
|
14
|
+
export type * as WasiClocksMonotonicClock0212 from './interfaces/wasi-clocks-monotonic-clock.js'; // import wasi:clocks/monotonic-clock@0.2.12
|
|
15
|
+
export type * as WasiIoError0212 from './interfaces/wasi-io-error.js'; // import wasi:io/error@0.2.12
|
|
16
|
+
export type * as WasiIoPoll0212 from './interfaces/wasi-io-poll.js'; // import wasi:io/poll@0.2.12
|
|
17
|
+
export type * as WasiIoStreams0212 from './interfaces/wasi-io-streams.js'; // import wasi:io/streams@0.2.12
|
|
18
|
+
export function highlight(code: string, language: string): HighlightResult;
|
|
19
|
+
export function languages(): Array<string>;
|
|
20
|
+
/** Permanently stop this instance and dispose guest-owned host resources. */
|
|
21
|
+
export const _util: { stop(): void; whenIdle(): Promise<void>; };
|