@celestia-island/hikari 0.55.459 → 0.55.461
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/dist/types/components/HkLoginFlow.d.ts +42 -6
- package/dist/types/components/HkMarkdownEditor.d.ts +123 -0
- package/dist/types/components/HkSignInCard.d.ts +31 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/mermaid/wasmEngine.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/HkLoginFlow.test.tsx +225 -14
- package/src/components/HkLoginFlow.tsx +149 -97
- package/src/components/HkMarkdownEditor.barrel.test.ts +42 -0
- package/src/components/HkMarkdownEditor.scss +190 -0
- package/src/components/HkMarkdownEditor.test.tsx +404 -0
- package/src/components/HkMarkdownEditor.tsx +357 -0
- package/src/components/HkSignInCard.test.ts +43 -0
- package/src/components/HkSignInCard.tsx +96 -54
- package/src/i18n/locales/ar/components.json +14 -1
- package/src/i18n/locales/de/components.json +14 -1
- package/src/i18n/locales/en/components.json +14 -1
- package/src/i18n/locales/es/components.json +14 -1
- package/src/i18n/locales/fr/components.json +14 -1
- package/src/i18n/locales/ja/components.json +14 -1
- package/src/i18n/locales/ko/components.json +14 -1
- package/src/i18n/locales/pt/components.json +14 -1
- package/src/i18n/locales/ru/components.json +14 -1
- package/src/i18n/locales/zh-Hans/components.json +14 -1
- package/src/i18n/locales/zh-Hant/components.json +14 -1
- package/src/index.ts +2 -0
- package/src/mermaid/wasmEngine.ts +1 -1
- package/src/scene3d/wasmFleetSpec.ts +1 -1
- package/src/styles/admin-tokens.scss +15 -0
- package/src/utils/qr/qrEncoder.ts +6 -1
- package/src/wasm/highlight/hikari_wasm_highlight.d.ts +3 -2
- package/src/wasm/highlight/hikari_wasm_highlight.js +486 -160
- package/src/wasm/highlight/interfaces/celestia-hikari-highlight-types.d.ts +4 -0
- package/src/wasm/highlight/interfaces/wasi-cli-exit.d.ts +1 -0
- package/src/wasm/highlight/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
- package/src/wasm/highlight/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
- package/src/wasm/mermaid/hikari_wasm_mermaid.d.ts +3 -2
- package/src/wasm/mermaid/hikari_wasm_mermaid.js +487 -161
- package/src/wasm/mermaid/interfaces/celestia-hikari-mermaid-types.d.ts +4 -0
- package/src/wasm/mermaid/interfaces/wasi-cli-exit.d.ts +1 -0
- package/src/wasm/mermaid/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
- package/src/wasm/mermaid/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
- package/src/wasm/qr/hikari_wasm_qr.d.ts +4 -3
- package/src/wasm/qr/hikari_wasm_qr.js +475 -155
- package/src/wasm/qr/interfaces/{hikari-qr-types.d.ts → celestia-hikari-qr-types.d.ts} +1 -2
- package/src/wasm/qr/interfaces/wasi-cli-exit.d.ts +1 -0
- package/src/wasm/qr/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
- package/src/wasm/qr/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
- package/src/wasm/scene3d/hikari_wasm_scene3d.d.ts +4 -3
- package/src/wasm/scene3d/hikari_wasm_scene3d.js +482 -161
- package/src/wasm/scene3d/interfaces/{hikari-scene3d-types.d.ts → celestia-hikari-scene3d-types.d.ts} +1 -1
- package/src/wasm/scene3d/interfaces/wasi-cli-exit.d.ts +1 -0
- package/src/wasm/scene3d/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
- package/src/wasm/scene3d/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
- package/src/wasm/highlight/interfaces/hikari-highlight-types.d.ts +0 -4
- package/src/wasm/mermaid/interfaces/hikari-mermaid-types.d.ts +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineComponent, ref, type PropType } from "vue";
|
|
1
|
+
import { computed, defineComponent, ref, watch, type PropType } from "vue";
|
|
2
2
|
|
|
3
3
|
import { useI18n } from "../i18n/context";
|
|
4
4
|
import { asPropType } from "../utils/typing";
|
|
@@ -6,7 +6,6 @@ import { HkAuthCard } from "./HkAuthCard";
|
|
|
6
6
|
import { HkAuthChannelList, type HkAuthChannelListEntry } from "./HkAuthChannelList";
|
|
7
7
|
import { HkMfaVerifyCard, type HkMfaFactor } from "./HkMfaVerifyCard";
|
|
8
8
|
import { HkSignInCard } from "./HkSignInCard";
|
|
9
|
-
import HkStepFlow from "./HkStepFlow";
|
|
10
9
|
import HkTabs from "./HkTabs";
|
|
11
10
|
import HkTransitionContainer from "./HkTransitionContainer";
|
|
12
11
|
|
|
@@ -82,10 +81,12 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
82
81
|
* This is the business-level composition above the auth kit (extracted
|
|
83
82
|
* from shittim-chest's LoginView, 2026-11 user direction: the login
|
|
84
83
|
* screen had drifted into per-app reimplementations). It owns EVERYTHING
|
|
85
|
-
* visual —
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
84
|
+
* visual — ONE stable shell card (logo, header, the pill segment group
|
|
85
|
+
* hidden when a deployment offers a single channel; a lone dead segment
|
|
86
|
+
* reads as a broken switch) whose body below the tabs crossfades and
|
|
87
|
+
* height-morphs per channel through `HkTransitionContainer`, with the
|
|
88
|
+
* account→verify step as the same fade+height morph between the shell
|
|
89
|
+
* and the MFA card — while staying a CONTROLLED
|
|
89
90
|
* component: no endpoint, no URL building, no factor ladder policy.
|
|
90
91
|
* Each host (the chest migration plus the erp and arona login surfaces,
|
|
91
92
|
* landing as their own PRs) keeps its own auth client and drives the
|
|
@@ -144,8 +145,18 @@ export const HkLoginFlow = defineComponent({
|
|
|
144
145
|
step: { type: String as PropType<"account" | "verify">, default: "account" },
|
|
145
146
|
/** In-flight state of the credentials submit. */
|
|
146
147
|
loading: { type: Boolean, default: false },
|
|
147
|
-
/** Logo image URL forwarded to the
|
|
148
|
+
/** Logo image URL forwarded to the shell card's header. */
|
|
148
149
|
logoSrc: { type: String, default: undefined },
|
|
150
|
+
/** The SHELL card's header title — one stable header across every
|
|
151
|
+
* channel (2026-11-24 user direction: a channel switch must morph
|
|
152
|
+
* only the content below the tabs, never dissolve the card). Falls
|
|
153
|
+
* back to the ACTIVE channel's `title` (then the conventional
|
|
154
|
+
* sign-in copy) for hosts that still brand per channel; distinct
|
|
155
|
+
* per-channel fallbacks then swap as instant text, so multi-channel
|
|
156
|
+
* hosts should pass this once. */
|
|
157
|
+
title: { type: String, default: undefined },
|
|
158
|
+
/** The SHELL card's subtitle — same stability contract as `title`. */
|
|
159
|
+
subtitle: { type: String, default: undefined },
|
|
149
160
|
/** Seed for the credentials card's username field — survives the
|
|
150
161
|
* verify round-trip (see HkSignInCard.initialUsername). */
|
|
151
162
|
initialUsername: { type: String, default: "" },
|
|
@@ -196,6 +207,22 @@ export const HkLoginFlow = defineComponent({
|
|
|
196
207
|
props.channels[0],
|
|
197
208
|
);
|
|
198
209
|
|
|
210
|
+
// Anti-strobe on the channel swap (the chest round-22 field report
|
|
211
|
+
// HkStepFlow's dropFlowFocus used to cover): a field still focused
|
|
212
|
+
// INSIDE the leaving body re-anchors the Android autofill panel on
|
|
213
|
+
// every layout beat of the morph. The tab buttons are deliberately
|
|
214
|
+
// OUTSIDE the blur scope — the activated tab must keep focus
|
|
215
|
+
// (keyboard a11y).
|
|
216
|
+
watch(() => currentChannel.value?.key, () => {
|
|
217
|
+
const active = document.activeElement;
|
|
218
|
+
if (
|
|
219
|
+
active instanceof HTMLElement &&
|
|
220
|
+
active.closest(".hk-login-flow-body")
|
|
221
|
+
) {
|
|
222
|
+
active.blur();
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
199
226
|
/** Segment label precedence: explicit label > the conventional-key
|
|
200
227
|
* locale > the raw key. The conventional keys cover every Celestia
|
|
201
228
|
* deployment today, so most hosts pass no labels at all. */
|
|
@@ -229,14 +256,12 @@ export const HkLoginFlow = defineComponent({
|
|
|
229
256
|
/>
|
|
230
257
|
) : null;
|
|
231
258
|
|
|
232
|
-
function
|
|
259
|
+
function renderCredentialsBody(channel: HkLoginCredentialsChannel) {
|
|
233
260
|
const methods = channel.methods ?? [];
|
|
234
261
|
return (
|
|
235
262
|
<HkSignInCard
|
|
236
263
|
key={channel.key}
|
|
237
|
-
|
|
238
|
-
subtitle={channel.subtitle ?? t("hikari::loginFlow.signInSubtitle", "Welcome back")}
|
|
239
|
-
logoSrc={props.logoSrc}
|
|
264
|
+
bare
|
|
240
265
|
loading={props.loading}
|
|
241
266
|
passwordField={channel.passwordField ?? false}
|
|
242
267
|
usernameType={channel.usernameType ?? "text"}
|
|
@@ -249,10 +274,13 @@ export const HkLoginFlow = defineComponent({
|
|
|
249
274
|
}
|
|
250
275
|
>
|
|
251
276
|
{{
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
|
|
277
|
+
// Forward the icon slot ONLY when the host passed one — an
|
|
278
|
+
// unconditional lambda would shadow HkSignInCard's own
|
|
279
|
+
// <User> fallback and leave the field icon-less (the same
|
|
280
|
+
// dead-slot rule as methods/footer).
|
|
281
|
+
...(slots.usernameIcon
|
|
282
|
+
? { usernameIcon: () => slots.usernameIcon?.({ channel: channel.key }) }
|
|
283
|
+
: {}),
|
|
256
284
|
...(methods.length > 0
|
|
257
285
|
? {
|
|
258
286
|
methods: () => (
|
|
@@ -264,49 +292,32 @@ export const HkLoginFlow = defineComponent({
|
|
|
264
292
|
),
|
|
265
293
|
}
|
|
266
294
|
: {}),
|
|
267
|
-
footer
|
|
295
|
+
// The footer wrapper must not exist when no footer was
|
|
296
|
+
// passed (HkAuthCard's dead-space rule; the bare fragment
|
|
297
|
+
// renders the wrapper itself whenever the slot is present).
|
|
298
|
+
...(slots.footer
|
|
299
|
+
? { footer: () => slots.footer?.({ channel: channel.key }) }
|
|
300
|
+
: {}),
|
|
268
301
|
}}
|
|
269
302
|
</HkSignInCard>
|
|
270
303
|
);
|
|
271
304
|
}
|
|
272
305
|
|
|
273
|
-
function
|
|
306
|
+
function renderSsoBody(channel: HkLoginSsoChannel) {
|
|
274
307
|
return (
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/>
|
|
289
|
-
) : null,
|
|
290
|
-
default: () => (
|
|
291
|
-
<>
|
|
292
|
-
{tabsEl()}
|
|
293
|
-
<div class="hk-login-flow-sso">
|
|
294
|
-
<HkAuthChannelList
|
|
295
|
-
methods={[
|
|
296
|
-
{
|
|
297
|
-
key: channel.key,
|
|
298
|
-
label: channel.buttonLabel ?? channelLabel(channel),
|
|
299
|
-
icon: channel.icon,
|
|
300
|
-
disabled: channel.disabled,
|
|
301
|
-
},
|
|
302
|
-
]}
|
|
303
|
-
onSelect={() => emit("sso-click", channel.key)}
|
|
304
|
-
/>
|
|
305
|
-
</div>
|
|
306
|
-
</>
|
|
307
|
-
),
|
|
308
|
-
}}
|
|
309
|
-
</HkAuthCard>
|
|
308
|
+
<div key={channel.key} class="hk-login-flow-sso">
|
|
309
|
+
<HkAuthChannelList
|
|
310
|
+
methods={[
|
|
311
|
+
{
|
|
312
|
+
key: channel.key,
|
|
313
|
+
label: channel.buttonLabel ?? channelLabel(channel),
|
|
314
|
+
icon: channel.icon,
|
|
315
|
+
disabled: channel.disabled,
|
|
316
|
+
},
|
|
317
|
+
]}
|
|
318
|
+
onSelect={() => emit("sso-click", channel.key)}
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
310
321
|
);
|
|
311
322
|
}
|
|
312
323
|
|
|
@@ -314,54 +325,95 @@ export const HkLoginFlow = defineComponent({
|
|
|
314
325
|
const channel = currentChannel.value;
|
|
315
326
|
if (!channel) return null;
|
|
316
327
|
|
|
328
|
+
// The stable shell header: flow-level copy wins; per-channel
|
|
329
|
+
// fallbacks keep single-channel hosts working unchanged.
|
|
330
|
+
const shellTitle = props.title ?? channel.title ?? (channel.mode === "credentials"
|
|
331
|
+
? t("hikari::loginFlow.signInTitle", "Sign in")
|
|
332
|
+
: channelLabel(channel));
|
|
333
|
+
const shellSubtitle = props.subtitle ?? channel.subtitle ?? (channel.mode === "credentials"
|
|
334
|
+
? t("hikari::loginFlow.signInSubtitle", "Welcome back")
|
|
335
|
+
: "");
|
|
336
|
+
|
|
337
|
+
// The fail-safe of the old design, kept: verify only ever renders
|
|
338
|
+
// for a credentials channel (a redirect flow has no second step).
|
|
339
|
+
const verifying = props.step === "verify" && channel.mode === "credentials";
|
|
340
|
+
|
|
317
341
|
return (
|
|
318
342
|
<div class="hk-login-flow">
|
|
319
343
|
{slots.top?.()}
|
|
320
|
-
{/*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
344
|
+
{/* Two transition tiers (2026-11-24 user direction — "switching
|
|
345
|
+
* the top segment group only crossfades the content below it
|
|
346
|
+
* and morphs the height; use the library's existing component,
|
|
347
|
+
* do not destroy the whole card"):
|
|
348
|
+
*
|
|
349
|
+
* - the OUTER container is keyed on the STEP ("account" vs
|
|
350
|
+
* "verify"): the account generation is ONE stable shell card
|
|
351
|
+
* (logo + header + segment group), the verify generation is
|
|
352
|
+
* the MFA card — a step move morphs between the two cards.
|
|
353
|
+
* - the INNER container is keyed on the CHANNEL and lives in
|
|
354
|
+
* the shell's body BELOW the segment group: a channel switch
|
|
355
|
+
* crossfades only the credentials form / the sso row list
|
|
356
|
+
* and morphs the height — the shell, its header and the tabs
|
|
357
|
+
* are NOT inside the swapped region and never dissolve.
|
|
358
|
+
*
|
|
359
|
+
* The shell card opts out of its own smooth-height wrapper:
|
|
360
|
+
* inside this flow the inner container owns the height
|
|
361
|
+
* choreography, and a second measuring wrapper would chain its
|
|
362
|
+
* 300ms transition after the container's (a telescoping
|
|
363
|
+
* double-morph). */}
|
|
364
|
+
<HkTransitionContainer swapKey={verifying ? "verify" : "account"} axis="height">
|
|
365
|
+
{verifying ? (
|
|
366
|
+
<HkMfaVerifyCard
|
|
367
|
+
key="verify"
|
|
368
|
+
ref={mfaRef}
|
|
369
|
+
factors={props.verifyFactors}
|
|
370
|
+
proven={props.verifyProven}
|
|
371
|
+
accountName={props.verifyAccountName}
|
|
372
|
+
logoSrc={props.logoSrc}
|
|
373
|
+
loading={props.verifyLoading}
|
|
374
|
+
resending={props.verifyResending}
|
|
375
|
+
passkeyRetryHint={props.passkeyRetryHint}
|
|
376
|
+
autofocus
|
|
377
|
+
onVerify={(kind: HkMfaFactor, proof: string) => emit("verify", kind, proof)}
|
|
378
|
+
onResend={() => emit("verify-resend")}
|
|
379
|
+
onBack={() => emit("verify-back")}
|
|
380
|
+
/>
|
|
381
|
+
) : (
|
|
382
|
+
<HkAuthCard key="account" title={shellTitle} subtitle={shellSubtitle} smoothHeight={false}>
|
|
383
|
+
{{
|
|
384
|
+
logo: () =>
|
|
385
|
+
props.logoSrc ? (
|
|
386
|
+
<img
|
|
387
|
+
class="hk-logo-img"
|
|
388
|
+
src={props.logoSrc}
|
|
389
|
+
alt=""
|
|
390
|
+
style={{ width: "3.5rem", height: "3.5rem" }}
|
|
391
|
+
/>
|
|
392
|
+
) : null,
|
|
393
|
+
default: () => (
|
|
394
|
+
<>
|
|
395
|
+
{/* The segment group rides ABOVE the swapped body —
|
|
396
|
+
* stable across channel switches. */}
|
|
397
|
+
{tabsEl()}
|
|
398
|
+
<HkTransitionContainer
|
|
399
|
+
// The class lands on the container's root Tag
|
|
400
|
+
// because HkTransitionContainer does not set
|
|
401
|
+
// inheritAttrs:false — an implicit contract the
|
|
402
|
+
// blur scope above and its pin depend on: adding
|
|
403
|
+
// that flag there silently breaks both.
|
|
404
|
+
class="hk-login-flow-body"
|
|
405
|
+
swapKey={channel.key}
|
|
406
|
+
axis="height"
|
|
407
|
+
>
|
|
408
|
+
{channel.mode === "credentials"
|
|
409
|
+
? renderCredentialsBody(channel)
|
|
410
|
+
: renderSsoBody(channel)}
|
|
411
|
+
</HkTransitionContainer>
|
|
412
|
+
</>
|
|
413
|
+
),
|
|
414
|
+
}}
|
|
415
|
+
</HkAuthCard>
|
|
416
|
+
)}
|
|
365
417
|
</HkTransitionContainer>
|
|
366
418
|
{slots.below?.()}
|
|
367
419
|
</div>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
HkMarkdownEditor,
|
|
5
|
+
applyLinePrefix,
|
|
6
|
+
applyWrap,
|
|
7
|
+
type HkMarkdownEditorMode,
|
|
8
|
+
type MarkdownTextEdit,
|
|
9
|
+
} from "../index";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Public barrel guard for HkMarkdownEditor (R3 review: deleting the
|
|
13
|
+
* component's export block from src/index.ts kept the entire suite green
|
|
14
|
+
* — every other test reaches the module through the direct
|
|
15
|
+
* "./HkMarkdownEditor" path, so only an external consumer would have
|
|
16
|
+
* noticed). Same shape as HkRangeRibbon.barrel.test.ts.
|
|
17
|
+
*/
|
|
18
|
+
describe("the public barrel", () => {
|
|
19
|
+
it("re-exports the editor component under its public name", () => {
|
|
20
|
+
expect(HkMarkdownEditor, "HkMarkdownEditor must be re-exported").toBeTruthy();
|
|
21
|
+
expect(HkMarkdownEditor.name).toBe("HkMarkdownEditor");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("re-exports the pure toolbar helpers hosts share", () => {
|
|
25
|
+
expect(typeof applyWrap, "applyWrap must be re-exported").toBe("function");
|
|
26
|
+
expect(typeof applyLinePrefix, "applyLinePrefix must be re-exported").toBe("function");
|
|
27
|
+
expect(applyWrap("ab", 0, 2, "**").text).toBe("**ab**");
|
|
28
|
+
expect(applyLinePrefix("x", 0, 1, "- ").text).toBe("- x");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("re-exports the editor's public types", () => {
|
|
32
|
+
// Type-only exports vanish at runtime, so each one is CONSUMED here: a
|
|
33
|
+
// dropped `type …` line fails vue-tsc on this file instead of leaving
|
|
34
|
+
// the runtime suite green.
|
|
35
|
+
const mode: HkMarkdownEditorMode = "plain";
|
|
36
|
+
const edit: MarkdownTextEdit = applyWrap("hi", 0, 0, "`");
|
|
37
|
+
expect(edit.text).toBe("``hi");
|
|
38
|
+
expect(edit.selectionStart).toBe(1);
|
|
39
|
+
expect(edit.selectionEnd).toBe(1);
|
|
40
|
+
expect(mode).toBe("plain");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// HkMarkdownEditor chrome — the two-pane markdown/plain editor.
|
|
2
|
+
//
|
|
3
|
+
// All colors ride hikari's token triplets (`rgb(var(--color-*))`,
|
|
4
|
+
// `color-mix`), spacing/radius/motion ride the `--space-*` / `--radius-*`
|
|
5
|
+
// / `--duration-*` / `--ease-*` families — no hardcoded hex anywhere, so
|
|
6
|
+
// every theme layer restyles the editor with zero per-component overrides.
|
|
7
|
+
|
|
8
|
+
.hk-md-editor {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
width: 100%;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
border: 1px solid var(--border-faint);
|
|
14
|
+
border-radius: var(--radius-md, 8px);
|
|
15
|
+
background: color-mix(in srgb, rgb(var(--color-surface)) 55%, transparent);
|
|
16
|
+
color: rgb(var(--color-text));
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ── Toolbar row ──────────────────────────────────────────────────────────
|
|
21
|
+
// The markdown actions (left) and the mode segmented control (right). The
|
|
22
|
+
// mode control is part of the v-model:mode contract, not a toolbar action
|
|
23
|
+
// — it stays when `toolbar` is off and when the plain mode retires the
|
|
24
|
+
// markdown actions.
|
|
25
|
+
|
|
26
|
+
.hk-md-editor-toolbar {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: var(--space-8);
|
|
30
|
+
padding: var(--space-4) var(--space-8);
|
|
31
|
+
border-bottom: 1px solid var(--border-faint);
|
|
32
|
+
background: color-mix(in srgb, rgb(var(--color-background)) 35%, transparent);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.hk-md-editor-actions {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: var(--space-2);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Ghost icon button: the toolbar's smallest chrome step. Borderless and
|
|
42
|
+
// transparent until hovered — the label lives in `title`/`aria-label`.
|
|
43
|
+
.hk-md-editor-action {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
width: 1.75rem;
|
|
48
|
+
height: 1.75rem;
|
|
49
|
+
padding: 0;
|
|
50
|
+
border: none;
|
|
51
|
+
border-radius: var(--radius-sm);
|
|
52
|
+
background: transparent;
|
|
53
|
+
color: rgb(var(--color-muted));
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
transition-property: background-color, color;
|
|
56
|
+
transition-duration: var(--duration-short);
|
|
57
|
+
transition-timing-function: var(--ease-standard);
|
|
58
|
+
|
|
59
|
+
&:hover:not(:disabled) {
|
|
60
|
+
background: color-mix(in srgb, rgb(var(--color-text)) 10%, transparent);
|
|
61
|
+
color: rgb(var(--color-text));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:focus-visible {
|
|
65
|
+
outline: none;
|
|
66
|
+
box-shadow: var(--shadow-focus);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:disabled {
|
|
70
|
+
opacity: 0.5;
|
|
71
|
+
cursor: not-allowed;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Compact segmented control (right side of the row).
|
|
76
|
+
.hk-md-editor-modes {
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: var(--space-2);
|
|
80
|
+
margin-inline-start: auto;
|
|
81
|
+
padding: var(--space-2);
|
|
82
|
+
border: 1px solid var(--border-faint);
|
|
83
|
+
border-radius: var(--radius-full);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.hk-md-editor-mode {
|
|
87
|
+
border: none;
|
|
88
|
+
padding: var(--space-2) var(--space-8);
|
|
89
|
+
border-radius: var(--radius-full);
|
|
90
|
+
background: transparent;
|
|
91
|
+
color: rgb(var(--color-muted));
|
|
92
|
+
font-size: var(--text-xs);
|
|
93
|
+
line-height: 1.4;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
transition-property: background-color, color;
|
|
96
|
+
transition-duration: var(--duration-short);
|
|
97
|
+
transition-timing-function: var(--ease-standard);
|
|
98
|
+
|
|
99
|
+
&:hover:not(:disabled) {
|
|
100
|
+
color: rgb(var(--color-text));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// The active tint rides data-active (the segmented grammar shared with
|
|
104
|
+
// HkPillToggleGroup) — a wash of the primary channel under the ink.
|
|
105
|
+
&[data-active] {
|
|
106
|
+
background: rgb(var(--color-primary) / 16%);
|
|
107
|
+
color: rgb(var(--color-text));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:disabled {
|
|
111
|
+
opacity: 0.5;
|
|
112
|
+
cursor: not-allowed;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ── Two-pane body ────────────────────────────────────────────────────────
|
|
117
|
+
// ~50/50: each pane is flex-basis 50% with min-width 0 so long lines and
|
|
118
|
+
// wide tables scroll inside their own pane instead of pushing the split.
|
|
119
|
+
|
|
120
|
+
.hk-md-editor-body {
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: stretch;
|
|
123
|
+
flex: 1;
|
|
124
|
+
min-height: 12rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.hk-md-editor-input-pane {
|
|
128
|
+
position: relative;
|
|
129
|
+
display: flex;
|
|
130
|
+
flex: 1 1 50%;
|
|
131
|
+
min-width: 0;
|
|
132
|
+
|
|
133
|
+
// Drag-over highlight: an inset ring on the pane (the attribute comes
|
|
134
|
+
// from the component's dragging state; the look lives here).
|
|
135
|
+
&[data-dragging] {
|
|
136
|
+
box-shadow: inset 0 0 0 2px rgb(var(--color-focused-border));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.hk-md-editor-input {
|
|
141
|
+
box-sizing: border-box;
|
|
142
|
+
flex: 1;
|
|
143
|
+
width: 100%;
|
|
144
|
+
border: none;
|
|
145
|
+
outline: none;
|
|
146
|
+
resize: none;
|
|
147
|
+
background: transparent;
|
|
148
|
+
color: rgb(var(--color-text));
|
|
149
|
+
font-family: inherit;
|
|
150
|
+
font-size: var(--text-base);
|
|
151
|
+
line-height: 1.6;
|
|
152
|
+
padding: var(--space-8) var(--space-12);
|
|
153
|
+
|
|
154
|
+
&::placeholder {
|
|
155
|
+
color: rgb(var(--color-muted));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:disabled {
|
|
159
|
+
cursor: not-allowed;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// The preview pane carries the divider (border on the pane, not a gap) —
|
|
164
|
+
// in plain mode the renderer degrades to pre-wrapped plain text itself.
|
|
165
|
+
// Native scroll mechanics, no native bar (the house contract: the
|
|
166
|
+
// scrollbar-width/::-webkit-scrollbar suppression pair beside overflow).
|
|
167
|
+
.hk-md-editor-preview {
|
|
168
|
+
flex: 1 1 50%;
|
|
169
|
+
min-width: 0;
|
|
170
|
+
overflow: auto;
|
|
171
|
+
scrollbar-width: none;
|
|
172
|
+
&::-webkit-scrollbar {
|
|
173
|
+
display: none;
|
|
174
|
+
}
|
|
175
|
+
padding: var(--space-8) var(--space-12);
|
|
176
|
+
border-inline-start: 1px solid var(--border-faint);
|
|
177
|
+
background: color-mix(in srgb, rgb(var(--color-background)) 35%, transparent);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Narrow hosts stack the panes — the divider follows the block axis.
|
|
181
|
+
@media (max-width: 640px) {
|
|
182
|
+
.hk-md-editor-body {
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.hk-md-editor-preview {
|
|
187
|
+
border-inline-start: none;
|
|
188
|
+
border-block-start: 1px solid var(--border-faint);
|
|
189
|
+
}
|
|
190
|
+
}
|