@celestia-island/hikari 0.55.519 → 0.55.521
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/HkDirectionalSwap.d.ts +53 -6
- package/dist/types/components/HkInput.d.ts +1 -1
- package/dist/types/components/HkMarkdownEditor.d.ts +33 -30
- package/dist/types/components/HkMenu.d.ts +1 -1
- package/dist/types/components/HkPillToggleGroup.d.ts +13 -0
- package/dist/types/components/HkRowActions.d.ts +1 -1
- package/dist/types/components/HkTable.d.ts +1 -1
- package/dist/types/components/HkTimePicker.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/HkDirectionalSwap.test.tsx +614 -23
- package/src/components/HkDirectionalSwap.tsx +219 -26
- package/src/components/HkMarkdownEditor.barrel.test.ts +3 -3
- package/src/components/HkMarkdownEditor.rails.test.tsx +103 -0
- package/src/components/HkMarkdownEditor.scss +72 -89
- package/src/components/HkMarkdownEditor.test.tsx +319 -45
- package/src/components/HkMarkdownEditor.tsx +152 -90
- package/src/components/HkPillToggleGroup.scss +9 -2
- package/src/components/HkPillToggleGroup.test.tsx +36 -0
- package/src/components/HkPillToggleGroup.tsx +11 -2
- package/src/components/HkScrollProgressDock.scss +71 -2
- package/src/components/HkScrollProgressDock.test.tsx +508 -1
- package/src/components/HkScrollProgressDock.tsx +424 -40
- package/src/components/HkThemeToggle.test.ts +32 -1
- package/src/errorLandingStandalone/error-landing.html +1 -1
- package/src/i18n/locales/ar/components.json +9 -3
- package/src/i18n/locales/de/components.json +9 -3
- package/src/i18n/locales/en/components.json +9 -3
- package/src/i18n/locales/es/components.json +9 -3
- package/src/i18n/locales/fr/components.json +9 -3
- package/src/i18n/locales/ja/components.json +9 -3
- package/src/i18n/locales/ko/components.json +9 -3
- package/src/i18n/locales/pt/components.json +9 -3
- package/src/i18n/locales/ru/components.json +9 -3
- package/src/i18n/locales/zh-Hans/components.json +9 -3
- package/src/i18n/locales/zh-Hant/components.json +9 -3
- package/src/index.ts +1 -1
- package/src/res/themeLoaderBehaviour.test.ts +27 -0
|
@@ -9,17 +9,28 @@ import {
|
|
|
9
9
|
Quote,
|
|
10
10
|
Strikethrough,
|
|
11
11
|
} from "lucide-vue-next";
|
|
12
|
-
import { h, nextTick, onBeforeUnmount, defineComponent, ref, watch, type Component } from "vue";
|
|
12
|
+
import { computed, h, nextTick, onBeforeUnmount, defineComponent, ref, watch, type Component } from "vue";
|
|
13
13
|
|
|
14
|
+
import HkIconButtonGroup from "./HkIconButtonGroup";
|
|
14
15
|
import HkMarkdownRenderer from "./HkMarkdownRenderer";
|
|
16
|
+
import HkPillToggleGroup from "./HkPillToggleGroup";
|
|
15
17
|
import { useI18n } from "../i18n/context";
|
|
16
18
|
import { attachOverlayScrollbars, type OverlayScrollbarHandle } from "../composables/useOverlayScrollbar";
|
|
17
19
|
import "./HkMarkdownEditor.scss";
|
|
18
20
|
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
21
|
+
/** Which panes the editor shows. The source textarea is the document;
|
|
22
|
+
* the preview is its live rendering (markdown is the convenient way to
|
|
23
|
+
* write it, not a mode the writer has to pick). `text` = the source
|
|
24
|
+
* alone, `both` = the split (source | preview), `preview` = the
|
|
25
|
+
* rendering alone. */
|
|
26
|
+
export type HkMarkdownEditorView = "text" | "both" | "preview";
|
|
27
|
+
|
|
28
|
+
/** The view order of the segmented control, left to right. */
|
|
29
|
+
const VIEW_ORDER: readonly HkMarkdownEditorView[] = ["text", "both", "preview"];
|
|
30
|
+
|
|
31
|
+
function isView(value: unknown): value is HkMarkdownEditorView {
|
|
32
|
+
return VIEW_ORDER.includes(value as HkMarkdownEditorView);
|
|
33
|
+
}
|
|
23
34
|
|
|
24
35
|
/** The result of one pure text transform: the rewritten source plus the
|
|
25
36
|
* selection the editor should restore afterwards. Selections are plain
|
|
@@ -137,12 +148,17 @@ const TOOLBAR: Array<{
|
|
|
137
148
|
{ id: "quote", icon: Quote, label: (t) => t("hikari::mdEditor.quote", "Quote") },
|
|
138
149
|
];
|
|
139
150
|
|
|
140
|
-
/**
|
|
151
|
+
/** View-segment label — every key at a literal `t(` call site for the same
|
|
141
152
|
* usage-surface reason as the toolbar closures above. */
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
153
|
+
function viewLabel(t: Translate, view: HkMarkdownEditorView): string {
|
|
154
|
+
switch (view) {
|
|
155
|
+
case "text":
|
|
156
|
+
return t("hikari::mdEditor.viewText", "Text only");
|
|
157
|
+
case "both":
|
|
158
|
+
return t("hikari::mdEditor.viewBoth", "Both");
|
|
159
|
+
case "preview":
|
|
160
|
+
return t("hikari::mdEditor.viewPreview", "Preview only");
|
|
161
|
+
}
|
|
146
162
|
}
|
|
147
163
|
|
|
148
164
|
/** One toolbar action as a pure string transform of the current source +
|
|
@@ -190,68 +206,102 @@ function imageFilesOf(list: FileList | null | undefined): File[] {
|
|
|
190
206
|
}
|
|
191
207
|
|
|
192
208
|
/**
|
|
193
|
-
* HkMarkdownEditor — the family's standard two-pane
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
209
|
+
* HkMarkdownEditor — the family's standard two-pane rich-text editor.
|
|
210
|
+
* Left: the textarea (every toolbar action a pure string transform over
|
|
211
|
+
* the current selection, refocused with a restored selection after each
|
|
212
|
+
* action). Right: the live rendering of that source through
|
|
213
|
+
* HkMarkdownRenderer. The right-hand segmented control (the family's
|
|
214
|
+
* HkPillToggleGroup, single-choice) picks which panes show — the source
|
|
215
|
+
* alone, both, or the rendering alone. Image drops/pastes are REPORTED
|
|
216
|
+
* (one `imageDrop` event per file) and never embedded or uploaded: the
|
|
217
|
+
* host owns the upload and inserts its own marker.
|
|
218
|
+
*
|
|
219
|
+
* Geometry: the root is `overflow: hidden` and every pane wrapper is a
|
|
220
|
+
* `min-height: 0` flex item, so a host that bounds the root (a
|
|
221
|
+
* `flex: 1` + `min-height: 0` chain, or an explicit height) gets two
|
|
222
|
+
* panes that scroll INSIDE themselves under the house overlay rail — a
|
|
223
|
+
* long rendering never grows the editor past its host. A host that
|
|
224
|
+
* leaves it content-sized gets a 12rem floor and may grow with the
|
|
225
|
+
* rendering.
|
|
201
226
|
*/
|
|
202
227
|
export default defineComponent({
|
|
203
228
|
name: "HkMarkdownEditor",
|
|
204
229
|
props: {
|
|
205
230
|
modelValue: { type: String, default: "" },
|
|
206
|
-
|
|
207
|
-
|
|
231
|
+
view: {
|
|
232
|
+
type: String as () => HkMarkdownEditorView,
|
|
233
|
+
default: "both",
|
|
234
|
+
// A stale binding (the retired `view="split"`) warns in dev instead
|
|
235
|
+
// of silently rendering no active pill.
|
|
236
|
+
validator: isView,
|
|
237
|
+
},
|
|
208
238
|
placeholder: { type: String, default: "" },
|
|
209
239
|
disabled: { type: Boolean, default: false },
|
|
210
|
-
/** Toolbar actions row
|
|
211
|
-
* markdown to insert). The mode segmented control always renders. */
|
|
240
|
+
/** Toolbar actions row. The view segmented control always renders. */
|
|
212
241
|
toolbar: { type: Boolean, default: true },
|
|
213
242
|
/** Report drag-dropped and pasted images through `imageDrop`. */
|
|
214
243
|
imageDrop: { type: Boolean, default: true },
|
|
215
244
|
},
|
|
216
245
|
emits: {
|
|
217
246
|
"update:modelValue": (_value: string) => true,
|
|
218
|
-
"update:
|
|
247
|
+
"update:view": (_view: HkMarkdownEditorView) => true,
|
|
219
248
|
imageDrop: (_file: File) => true,
|
|
220
249
|
},
|
|
221
250
|
setup(props, { emit }) {
|
|
222
251
|
const { t } = useI18n();
|
|
223
252
|
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
|
253
|
+
const previewRef = ref<HTMLDivElement | null>(null);
|
|
224
254
|
// Drag-over highlight state — an attribute so the SCSS owns the look
|
|
225
255
|
// and tests can read it without a computed style engine.
|
|
226
256
|
const dragging = ref(false);
|
|
227
|
-
// The
|
|
228
|
-
// scroll mechanics (a textarea cannot take an arbitrary wrapper)
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
257
|
+
// The two panes' house scrollbars. The textarea keeps its native
|
|
258
|
+
// scroll mechanics (a textarea cannot take an arbitrary wrapper); the
|
|
259
|
+
// preview is its own scroll viewport. Both suppress the native bar in
|
|
260
|
+
// the SCSS and ride the shared overlay chrome, whose tracks mount on
|
|
261
|
+
// each pane's wrapper (the box that wraps exactly that viewport) —
|
|
262
|
+
// the exact mount the master-detail rail uses.
|
|
263
|
+
let inputRail: OverlayScrollbarHandle | null = null;
|
|
264
|
+
let previewRail: OverlayScrollbarHandle | null = null;
|
|
265
|
+
// One sync per ref, so each rail follows only its own element: the
|
|
266
|
+
// source pane is mounted for the editor's whole life and its rail
|
|
267
|
+
// attaches exactly once; the preview pane mounts while the rendering
|
|
268
|
+
// shows, and its rail attaches then and retires when the pane goes.
|
|
269
|
+
function syncInputRail(): void {
|
|
270
|
+
inputRail?.detach();
|
|
271
|
+
inputRail = null;
|
|
272
|
+
const textarea = textareaRef.value;
|
|
273
|
+
const inputHost = textarea?.parentElement;
|
|
274
|
+
if (textarea && inputHost) {
|
|
275
|
+
inputRail = attachOverlayScrollbars(textarea, { axis: "vertical", host: inputHost });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function syncPreviewRail(): void {
|
|
279
|
+
previewRail?.detach();
|
|
280
|
+
previewRail = null;
|
|
281
|
+
// The preview's wrapper is its DOM parent by construction, which is
|
|
282
|
+
// the overlay engine's default host.
|
|
283
|
+
const preview = previewRef.value;
|
|
284
|
+
if (preview?.parentElement) {
|
|
285
|
+
previewRail = attachOverlayScrollbars(preview, { axis: "vertical" });
|
|
286
|
+
}
|
|
242
287
|
}
|
|
243
|
-
watch(textareaRef,
|
|
288
|
+
watch(textareaRef, syncInputRail, { flush: "post" });
|
|
289
|
+
watch(previewRef, syncPreviewRail, { flush: "post" });
|
|
244
290
|
onBeforeUnmount(() => {
|
|
245
|
-
|
|
246
|
-
|
|
291
|
+
inputRail?.detach();
|
|
292
|
+
inputRail = null;
|
|
293
|
+
previewRail?.detach();
|
|
294
|
+
previewRail = null;
|
|
247
295
|
});
|
|
248
296
|
|
|
249
297
|
function onInput(e: Event): void {
|
|
250
298
|
emit("update:modelValue", (e.target as HTMLTextAreaElement).value);
|
|
251
299
|
}
|
|
252
300
|
|
|
253
|
-
function runAction(
|
|
254
|
-
if (props.disabled) return;
|
|
301
|
+
function runAction(key: string): void {
|
|
302
|
+
if (props.disabled || props.view === "preview") return;
|
|
303
|
+
if (!TOOLBAR.some((action) => action.id === key)) return;
|
|
304
|
+
const id = key as ToolbarActionId;
|
|
255
305
|
const ta = textareaRef.value;
|
|
256
306
|
if (!ta) return;
|
|
257
307
|
const edit = toolbarEdit(id, props.modelValue, ta.selectionStart, ta.selectionEnd);
|
|
@@ -297,55 +347,64 @@ export default defineComponent({
|
|
|
297
347
|
for (const file of files) emit("imageDrop", file);
|
|
298
348
|
}
|
|
299
349
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
350
|
+
/** Single-choice pill host: the selected set holds exactly the one
|
|
351
|
+
* view and a toggle REPLACES it (HkPillToggleGroup is multi-select
|
|
352
|
+
* by contract — the family's idiom for a radio pill strip). */
|
|
353
|
+
function switchView(view: string): void {
|
|
354
|
+
if (props.disabled || props.view === view || !isView(view)) return;
|
|
355
|
+
emit("update:view", view);
|
|
303
356
|
}
|
|
304
357
|
|
|
358
|
+
// Labels are computed so a locale switch relabels the strip and the
|
|
359
|
+
// pills like every other string on the page (t reads the active
|
|
360
|
+
// locale; a plain array built once would freeze the mount-time one).
|
|
361
|
+
const viewOptions = computed(() =>
|
|
362
|
+
VIEW_ORDER.map((view) => ({ value: view, label: viewLabel(t, view) })),
|
|
363
|
+
);
|
|
364
|
+
const actionOptions = computed(() =>
|
|
365
|
+
TOOLBAR.map((action) => ({
|
|
366
|
+
key: action.id,
|
|
367
|
+
label: action.label(t),
|
|
368
|
+
icon: h(action.icon, { size: 16, "aria-hidden": "true" }),
|
|
369
|
+
})),
|
|
370
|
+
);
|
|
371
|
+
const selectedView = computed(() => new Set<string>([props.view]));
|
|
372
|
+
|
|
305
373
|
return () => {
|
|
306
|
-
const isMarkdown = props.mode === "markdown";
|
|
307
374
|
return (
|
|
308
|
-
<div class="hk-md-editor" data-
|
|
375
|
+
<div class="hk-md-editor" data-view={props.view}>
|
|
309
376
|
<div class="hk-md-editor-toolbar">
|
|
310
|
-
{props.toolbar &&
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
onClick={() => runAction(action.id)}
|
|
323
|
-
>
|
|
324
|
-
{h(action.icon, { size: 16, "aria-hidden": "true" })}
|
|
325
|
-
</button>
|
|
326
|
-
);
|
|
327
|
-
})}
|
|
328
|
-
</div>
|
|
377
|
+
{props.toolbar && (
|
|
378
|
+
// The formatting actions need a source to act on: with the
|
|
379
|
+
// source pane hidden (preview view) the strip reads inert.
|
|
380
|
+
<HkIconButtonGroup
|
|
381
|
+
class="hk-md-editor-actions"
|
|
382
|
+
mode="buttons"
|
|
383
|
+
variant="plain"
|
|
384
|
+
size="sm"
|
|
385
|
+
options={actionOptions.value}
|
|
386
|
+
disabled={props.disabled || props.view === "preview"}
|
|
387
|
+
onSelect={runAction}
|
|
388
|
+
/>
|
|
329
389
|
)}
|
|
330
|
-
<
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
disabled={props.disabled}
|
|
339
|
-
onClick={() => switchMode(mode)}
|
|
340
|
-
>
|
|
341
|
-
{modeLabel(t, mode)}
|
|
342
|
-
</button>
|
|
343
|
-
))}
|
|
344
|
-
</div>
|
|
390
|
+
<HkPillToggleGroup
|
|
391
|
+
class="hk-md-editor-views"
|
|
392
|
+
label={t("hikari::mdEditor.viewLabel", "View")}
|
|
393
|
+
options={viewOptions.value}
|
|
394
|
+
selected={selectedView.value}
|
|
395
|
+
disabled={props.disabled}
|
|
396
|
+
onToggle={switchView}
|
|
397
|
+
/>
|
|
345
398
|
</div>
|
|
346
|
-
<div class="hk-md-editor-body">
|
|
399
|
+
<div class="hk-md-editor-body" data-view={props.view}>
|
|
400
|
+
{/* The source pane stays MOUNTED and merely hides in preview
|
|
401
|
+
view: unmounting the textarea would throw away its undo
|
|
402
|
+
history, caret and scroll position on every round trip. The
|
|
403
|
+
rendering is stateless, so the preview pane mounts only
|
|
404
|
+
while it shows. */}
|
|
347
405
|
<div
|
|
348
406
|
class="hk-md-editor-input-pane"
|
|
407
|
+
hidden={props.view === "preview" || undefined}
|
|
349
408
|
data-dragging={dragging.value || undefined}
|
|
350
409
|
onDragover={onDragOver}
|
|
351
410
|
onDragleave={onDragLeave}
|
|
@@ -362,13 +421,16 @@ export default defineComponent({
|
|
|
362
421
|
onPaste={onPaste}
|
|
363
422
|
/>
|
|
364
423
|
</div>
|
|
365
|
-
{props.view
|
|
366
|
-
<div
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
424
|
+
{props.view !== "text" && (
|
|
425
|
+
<div class="hk-md-editor-preview-pane">
|
|
426
|
+
<div
|
|
427
|
+
ref={previewRef}
|
|
428
|
+
class="hk-md-editor-preview"
|
|
429
|
+
role="region"
|
|
430
|
+
aria-label={t("hikari::mdEditor.previewLabel", "Preview")}
|
|
431
|
+
>
|
|
432
|
+
<HkMarkdownRenderer content={props.modelValue} />
|
|
433
|
+
</div>
|
|
372
434
|
</div>
|
|
373
435
|
)}
|
|
374
436
|
</div>
|
|
@@ -101,14 +101,21 @@
|
|
|
101
101
|
outline: none;
|
|
102
102
|
transition: color var(--duration-short) ease, transform var(--duration-short) ease;
|
|
103
103
|
|
|
104
|
-
&:hover {
|
|
104
|
+
&:hover:not(:disabled) {
|
|
105
105
|
color: rgb(var(--color-text));
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
&:active {
|
|
108
|
+
&:active:not(:disabled) {
|
|
109
109
|
transform: scale(0.96);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/* A disabled pill reads inert, not live: no hover tint, no press, the
|
|
113
|
+
muted half-ink every disabled control in the family wears. */
|
|
114
|
+
&:disabled {
|
|
115
|
+
opacity: 0.5;
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
&[data-active] {
|
|
113
120
|
color: rgb(var(--color-primary));
|
|
114
121
|
background: rgb(var(--color-primary) / 12%);
|
|
@@ -89,6 +89,42 @@ describe("HkPillToggleGroup", () => {
|
|
|
89
89
|
expect(seen).toEqual(["openai"]);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
+
it("disabled turns every pill (the all-pill too) inert: no emit, no toggle", async () => {
|
|
93
|
+
const seen: string[] = [];
|
|
94
|
+
const c = mount(
|
|
95
|
+
h(HkPillToggleGroup, {
|
|
96
|
+
label: "Providers",
|
|
97
|
+
options: OPTIONS,
|
|
98
|
+
selected: new Set(["openai"]),
|
|
99
|
+
allLabel: "All",
|
|
100
|
+
disabled: true,
|
|
101
|
+
onToggle: (v: string) => seen.push(v),
|
|
102
|
+
onAll: () => seen.push("all"),
|
|
103
|
+
}),
|
|
104
|
+
);
|
|
105
|
+
const pills = [...c.querySelectorAll<HTMLButtonElement>(".hk-pill-group-pill")];
|
|
106
|
+
expect(pills).toHaveLength(4);
|
|
107
|
+
for (const pill of pills) {
|
|
108
|
+
expect(pill.disabled).toBe(true);
|
|
109
|
+
pill.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
110
|
+
}
|
|
111
|
+
await nextTick();
|
|
112
|
+
expect(seen).toEqual([]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("stylesheet contract: a disabled pill reads inert — no hover tint, no press, muted and not-allowed", () => {
|
|
116
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
117
|
+
const css = compile(join(here, "HkPillToggleGroup.scss"), { style: "expanded" }).css;
|
|
118
|
+
const pill = css.slice(css.indexOf(".hk-pill-group-pill {"));
|
|
119
|
+
// The live-state rules are gated on :not(:disabled)…
|
|
120
|
+
expect(pill).toMatch(/\.hk-pill-group-pill:hover:not\(:disabled\)\s*\{\s*color: rgb\(var\(--color-text\)\);/);
|
|
121
|
+
expect(pill).toMatch(/\.hk-pill-group-pill:active:not\(:disabled\)\s*\{\s*transform: scale\(0\.96\);/);
|
|
122
|
+
// …and an ungated hover/press would re-tint a disabled pill.
|
|
123
|
+
expect(pill).not.toMatch(/\.hk-pill-group-pill:hover\s*\{/);
|
|
124
|
+
expect(pill).not.toMatch(/\.hk-pill-group-pill:active\s*\{/);
|
|
125
|
+
expect(pill).toMatch(/\.hk-pill-group-pill:disabled\s*\{\s*opacity: 0\.5;\s*cursor: not-allowed;/);
|
|
126
|
+
});
|
|
127
|
+
|
|
92
128
|
it("normalizes option icons: components render, junk renders nothing, nothing stringifies", async () => {
|
|
93
129
|
const { h } = await import("vue");
|
|
94
130
|
const { Zap } = await import("lucide-vue-next");
|
|
@@ -75,6 +75,9 @@ export default defineComponent({
|
|
|
75
75
|
/** The leading all-pill's label; omit to hide the all-pill. The pill
|
|
76
76
|
* wears the active tint exactly when nothing is picked. */
|
|
77
77
|
allLabel: { type: String, default: undefined },
|
|
78
|
+
/** Disables every pill (the all-pill included): a disabled editor's
|
|
79
|
+
* view strip must not offer a switch its host would refuse. */
|
|
80
|
+
disabled: { type: Boolean, default: false },
|
|
78
81
|
/** Pill-suffix renderer (2026-11-19, the filter-chip sort arrows): one
|
|
79
82
|
* call per rendered pill — a null value scopes the ALL-pill, a value
|
|
80
83
|
* scopes that option — rendered UNWRAPPED after the label so the
|
|
@@ -109,7 +112,10 @@ export default defineComponent({
|
|
|
109
112
|
class="hk-pill-group-pill"
|
|
110
113
|
data-active={props.selected.size === 0 || undefined}
|
|
111
114
|
aria-pressed={props.selected.size === 0 ? "true" : "false"}
|
|
112
|
-
|
|
115
|
+
disabled={props.disabled}
|
|
116
|
+
onClick={() => {
|
|
117
|
+
if (!props.disabled) emit("all");
|
|
118
|
+
}}
|
|
113
119
|
>
|
|
114
120
|
{props.allLabel}
|
|
115
121
|
{props.renderTrailing?.(null)}
|
|
@@ -125,7 +131,10 @@ export default defineComponent({
|
|
|
125
131
|
data-tone={o.tone && o.tone !== "primary" ? o.tone : undefined}
|
|
126
132
|
data-active={props.selected.has(o.value) || undefined}
|
|
127
133
|
aria-pressed={props.selected.has(o.value) ? "true" : "false"}
|
|
128
|
-
|
|
134
|
+
disabled={props.disabled}
|
|
135
|
+
onClick={() => {
|
|
136
|
+
if (!props.disabled) emit("toggle", o.value);
|
|
137
|
+
}}
|
|
129
138
|
>
|
|
130
139
|
{icon != null && <span class="hk-pill-group-icon">{icon}</span>}
|
|
131
140
|
{o.label}
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
/* ── Scroll-progress dock (HkScrollProgressDock) ──────────────────
|
|
4
4
|
The localized range sentence floating near the bottom-center of a
|
|
5
5
|
scrolling list ("Rows 11 → 20 of 340" with the arrow glyph between
|
|
6
|
-
the two halves): the visible row band over the total.
|
|
6
|
+
the two halves): the visible row band over the total. Since the jump
|
|
7
|
+
surface (2026-11-30) the pill is a real trigger: hover/click opens a
|
|
8
|
+
HkPopover (mobile: bottom sheet) with the band, a scrub slider and a
|
|
9
|
+
row field — see the jump panel rules at the bottom of this file. The
|
|
10
|
+
pill
|
|
7
11
|
TELEPORTS to the container HOST (position: relative), never the
|
|
8
12
|
viewport — viewport-absolute chrome scrolls away with the content,
|
|
9
13
|
the same reason the autotag band and the selection-hint gradients
|
|
@@ -33,7 +37,13 @@
|
|
|
33
37
|
bottom: max(var(--space-10), env(safe-area-inset-bottom, 0px));
|
|
34
38
|
transform: translateX(-50%);
|
|
35
39
|
z-index: 6;
|
|
36
|
-
|
|
40
|
+
/* The pill is the jump surface's TRIGGER now (user direction
|
|
41
|
+
* 2026-11-30): it captures its own pointer events so clicks no longer
|
|
42
|
+
* fall through to the row underneath (the decorative pass-through
|
|
43
|
+
* that fired app copy-toasts from a pill click) — and so hover can
|
|
44
|
+
* surface it and the jump panel at all. */
|
|
45
|
+
pointer-events: auto;
|
|
46
|
+
cursor: pointer;
|
|
37
47
|
@include user-select(none);
|
|
38
48
|
display: inline-flex;
|
|
39
49
|
align-items: center;
|
|
@@ -62,6 +72,20 @@
|
|
|
62
72
|
opacity: 0.85;
|
|
63
73
|
}
|
|
64
74
|
|
|
75
|
+
/* Idle stays transparent to the EYE but not to the pointer: hover,
|
|
76
|
+
* keyboard focus and an open jump panel all reveal the pill — the
|
|
77
|
+
* trigger must be findable without a prior scroll. */
|
|
78
|
+
&:hover,
|
|
79
|
+
&:focus-visible,
|
|
80
|
+
&.is-open {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:focus-visible {
|
|
85
|
+
outline: 2px solid var(--hi-border-color-focus, rgb(var(--color-primary, 122 162 247)));
|
|
86
|
+
outline-offset: 2px;
|
|
87
|
+
}
|
|
88
|
+
|
|
65
89
|
/* A failed precondition (no registered list, no vertical overflow,
|
|
66
90
|
* a list whose rows are empty) removes the box outright — the pill
|
|
67
91
|
* must never linger as dead chrome. */
|
|
@@ -70,6 +94,51 @@
|
|
|
70
94
|
}
|
|
71
95
|
}
|
|
72
96
|
|
|
97
|
+
/* ── Jump panel (the HkPopover slot; desktop anchored above the pill,
|
|
98
|
+
mobile the sheet body) ──────────────────────────────────────────
|
|
99
|
+
Width is a readable scrub-strip width, not full-bleed; the sheet form
|
|
100
|
+
(`.hk-is-sheet` ancestor) spans the viewport instead. */
|
|
101
|
+
.hk-scroll-progress-dock-jump {
|
|
102
|
+
width: 264px;
|
|
103
|
+
max-width: calc(100vw - 2 * var(--viewport-gutter, 16px));
|
|
104
|
+
display: grid;
|
|
105
|
+
gap: var(--space-12, 12px);
|
|
106
|
+
padding: var(--space-8, 8px);
|
|
107
|
+
|
|
108
|
+
/* The sheet form spans the viewport: the pill-side strip width AND
|
|
109
|
+
* its viewport clamp must both go, or the sheet body shrinks back to
|
|
110
|
+
* a centred ≤(100vw−2·gutter) block with dead bands on both sides
|
|
111
|
+
* (the HkNotificationBell sheet precedent, #1333 round 2). */
|
|
112
|
+
.hk-is-sheet & {
|
|
113
|
+
width: 100%;
|
|
114
|
+
max-width: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.hk-scroll-progress-dock-jump-position {
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: var(--space-4, 4px);
|
|
122
|
+
font-family: var(--font-mono);
|
|
123
|
+
font-size: var(--text-sm, 0.8125rem);
|
|
124
|
+
font-variant-numeric: tabular-nums;
|
|
125
|
+
color: var(--hi-color-text-primary, currentColor);
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.hk-scroll-progress-dock-jump-row {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: flex-end;
|
|
132
|
+
gap: var(--space-8, 8px);
|
|
133
|
+
|
|
134
|
+
/* The field grows, the 跳转 button holds its ink; flex-end lines the
|
|
135
|
+
* button up with the FIELD row (the label stacks above it). */
|
|
136
|
+
> .hk-number-input {
|
|
137
|
+
flex: 1;
|
|
138
|
+
min-width: 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
73
142
|
/* Letter-spacing is INK tracking: it belongs on the text halves only,
|
|
74
143
|
* never on the arrow glyph between them. */
|
|
75
144
|
.hk-scroll-progress-dock-text {
|