@celestia-island/hikari 0.55.360 → 0.55.362
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/HkScrollContainer.dock.test.tsx +99 -6
- package/src/components/HkScrollContainer.fade.contract.test.ts +23 -10
- package/src/components/HkScrollContainer.scss +25 -25
- package/src/components/HkScrollContainer.tsx +76 -65
- package/src/components/HkTimePicker.scss +11 -49
- package/src/components/HkTimePicker.styles.test.ts +31 -0
- package/src/components/HkTimePicker.test.ts +103 -1
- package/src/components/HkTimePicker.tsx +52 -30
- package/src/components/HkTimeZonePicker.test.tsx +6 -0
- package/src/components/HkTimeZonePicker.tsx +10 -4
- package/src/components/HkWeekdayPicker.scss +5 -88
- package/src/components/HkWeekdayPicker.styles.test.ts +27 -0
- package/src/components/HkWeekdayPicker.test.tsx +54 -4
- package/src/components/HkWeekdayPicker.tsx +38 -14
- package/src/plugins/boot-landing-details.scss +43 -0
- package/src/plugins/boot-recovery.d.mts +208 -1
- package/src/plugins/boot-recovery.details.test.ts +622 -0
- package/src/plugins/boot-recovery.diagnostics.test.ts +628 -0
- package/src/plugins/boot-recovery.locales.test.ts +514 -0
- package/src/plugins/boot-recovery.mjs +1596 -32
- package/src/plugins/bootLandingCss.test.ts +21 -3
- package/src/plugins/bootLandingDetailsCss.d.mts +15 -0
- package/src/plugins/bootLandingDetailsCss.mjs +15 -0
- package/src/plugins/index.ts +11 -1
package/package.json
CHANGED
|
@@ -116,8 +116,8 @@ describe("HkScrollContainer dock slots", () => {
|
|
|
116
116
|
instance.value?.refresh();
|
|
117
117
|
await Promise.resolve();
|
|
118
118
|
expect(host.getAttribute("data-dir")).toBeNull();
|
|
119
|
-
// 280 still hidden below the fold: the
|
|
120
|
-
expect(host.style.getPropertyValue("--hk-scroll-
|
|
119
|
+
// 280 still hidden below the fold: the gate is republished lit.
|
|
120
|
+
expect(host.style.getPropertyValue("--hk-scroll-dock-gate-bottom")).toBe("1");
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
it("re-senses when dockFade flips at rest, without a manual refresh", async () => {
|
|
@@ -155,19 +155,112 @@ describe("HkScrollContainer dock slots", () => {
|
|
|
155
155
|
instance.value?.refresh();
|
|
156
156
|
await vi.advanceTimersByTimeAsync(60);
|
|
157
157
|
// 300 hidden below the fold: the gate is lit at full depth.
|
|
158
|
-
expect(host.style.getPropertyValue("--hk-scroll-
|
|
158
|
+
expect(host.style.getPropertyValue("--hk-scroll-dock-gate-bottom")).toBe("1");
|
|
159
159
|
|
|
160
160
|
props.dockFade = false;
|
|
161
161
|
// NO refresh: the watcher's own scheduled update must do the pass.
|
|
162
162
|
await vi.advanceTimersByTimeAsync(60);
|
|
163
163
|
// The dock branch no longer runs, the stale value was cleared and
|
|
164
164
|
// nothing republished it.
|
|
165
|
-
expect(host.style.getPropertyValue("--hk-scroll-
|
|
165
|
+
expect(host.style.getPropertyValue("--hk-scroll-dock-gate-bottom")).toBe("");
|
|
166
166
|
} finally {
|
|
167
167
|
vi.useRealTimers();
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
+
it("keeps the ramp and the gate apart when fade rides with a dock", async () => {
|
|
172
|
+
// THE case the two-var split exists for: with `fade` on, the ramp
|
|
173
|
+
// branch runs (not the dock branch), and at the scroll end it
|
|
174
|
+
// publishes the ramp's "1" — into ITS OWN var. The dock gate on its
|
|
175
|
+
// var retires to "0". One shared var could not hold both values;
|
|
176
|
+
// two can, and the sheet consumes the gate for the dock band, so the
|
|
177
|
+
// flush-parked last row stays visible even in this combination.
|
|
178
|
+
const instance = ref<{ refresh: () => void } | null>(null);
|
|
179
|
+
const container = document.createElement("div");
|
|
180
|
+
document.body.appendChild(container);
|
|
181
|
+
containers.push(container);
|
|
182
|
+
const app = createApp(defineComponent({
|
|
183
|
+
setup() {
|
|
184
|
+
return () =>
|
|
185
|
+
h(
|
|
186
|
+
HkScrollContainer,
|
|
187
|
+
{ ref: instance as never, fade: true, dockFade: true },
|
|
188
|
+
{
|
|
189
|
+
default: () => h("div", { class: "content" }, "rows"),
|
|
190
|
+
dockBottom: () => h("div", { class: "the-dock" }, "dock"),
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
}));
|
|
195
|
+
mounts.push(app);
|
|
196
|
+
const host = (app.mount(container) as unknown as { $el: HTMLElement }).$el;
|
|
197
|
+
const viewport = host.querySelector(".hk-scroll-container-viewport") as HTMLElement;
|
|
198
|
+
Object.defineProperty(viewport, "scrollHeight", { value: 400, configurable: true });
|
|
199
|
+
Object.defineProperty(viewport, "clientHeight", { value: 100, configurable: true });
|
|
200
|
+
Object.defineProperty(viewport, "scrollTop", { value: 300, configurable: true });
|
|
201
|
+
instance.value?.refresh();
|
|
202
|
+
await Promise.resolve();
|
|
203
|
+
// Parked at the end: the ramp (by its own design) says 1 — but that
|
|
204
|
+
// value now lives on the ramp's var and cannot reach the dock band…
|
|
205
|
+
expect(host.style.getPropertyValue("--hk-scroll-fade-strength-bottom")).toBe("1");
|
|
206
|
+
// …while the gate, on its own var, retires the band.
|
|
207
|
+
expect(host.style.getPropertyValue("--hk-scroll-dock-gate-bottom")).toBe("0");
|
|
208
|
+
// …AND the sense verdict has flipped to "start", which is what makes
|
|
209
|
+
// the fade state rules withdraw from the cascade at all — the dock
|
|
210
|
+
// rule then owns the edge and multiplies by the gate. The verdict
|
|
211
|
+
// flip and the gate share the same ≤1px deadband and the same sensing
|
|
212
|
+
// pass, but the cascade hinge is load-bearing enough to pin: if the
|
|
213
|
+
// verdict deadband ever drifted narrower than the gate's, the state
|
|
214
|
+
// rules would stay in the cascade at the end and paint the ramp's
|
|
215
|
+
// full band over the last row again (engine-verified cascade, R1).
|
|
216
|
+
expect(host.getAttribute("data-v-overflow")).toBe("start");
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("clears the gate family when the dock slot unmounts", async () => {
|
|
220
|
+
// Two independent lifecycles means two cleanup paths: fade-off clears
|
|
221
|
+
// the ramp (already pinned); DOCK-SLOT-UNMOUNT must clear the gate —
|
|
222
|
+
// the same render that un-stamps data-dock-fade drops the gate's only
|
|
223
|
+
// reader, and a stale inline value must not outlive it.
|
|
224
|
+
const instance = ref<{ refresh: () => void } | null>(null);
|
|
225
|
+
const container = document.createElement("div");
|
|
226
|
+
document.body.appendChild(container);
|
|
227
|
+
containers.push(container);
|
|
228
|
+
// The slot PRESENCE is what stamps data-dock-fade (a requested but
|
|
229
|
+
// empty dockBottom is legal), so the unmount is simulated by dropping
|
|
230
|
+
// the slot NAME — exactly what a consumer's v-if does to the slot.
|
|
231
|
+
const props = reactive({ docked: true });
|
|
232
|
+
const app = createApp(defineComponent({
|
|
233
|
+
setup() {
|
|
234
|
+
return () => {
|
|
235
|
+
const slots: Record<string, () => VNodeChild> = {
|
|
236
|
+
default: () => h("div", { class: "content" }, "rows"),
|
|
237
|
+
};
|
|
238
|
+
if (props.docked) slots.dockBottom = () => h("div", { class: "the-dock" }, "dock");
|
|
239
|
+
return h(HkScrollContainer, { ref: instance as never, dockFade: true }, slots);
|
|
240
|
+
};
|
|
241
|
+
},
|
|
242
|
+
}));
|
|
243
|
+
mounts.push(app);
|
|
244
|
+
const host = (app.mount(container) as unknown as { $el: HTMLElement }).$el;
|
|
245
|
+
const viewport = host.querySelector(".hk-scroll-container-viewport") as HTMLElement;
|
|
246
|
+
Object.defineProperty(viewport, "scrollHeight", { value: 400, configurable: true });
|
|
247
|
+
Object.defineProperty(viewport, "clientHeight", { value: 100, configurable: true });
|
|
248
|
+
Object.defineProperty(viewport, "scrollTop", { value: 0, configurable: true });
|
|
249
|
+
instance.value?.refresh();
|
|
250
|
+
await Promise.resolve();
|
|
251
|
+
expect(host.getAttribute("data-dock-fade")).toBe("bottom");
|
|
252
|
+
expect(host.style.getPropertyValue("--hk-scroll-dock-gate-bottom")).toBe("1");
|
|
253
|
+
|
|
254
|
+
props.docked = false;
|
|
255
|
+
await Promise.resolve();
|
|
256
|
+
await Promise.resolve();
|
|
257
|
+
instance.value?.refresh();
|
|
258
|
+
await Promise.resolve();
|
|
259
|
+
// Marker gone AND gate family cleared in the same transition.
|
|
260
|
+
expect(host.getAttribute("data-dock-fade")).toBeNull();
|
|
261
|
+
expect(host.style.getPropertyValue("--hk-scroll-dock-gate-bottom")).toBe("");
|
|
262
|
+
});
|
|
263
|
+
|
|
171
264
|
it("retires the dock band at the scroll end instead of covering the last row", async () => {
|
|
172
265
|
// 2026-11-12 user report: the cruise board's band kept painting over
|
|
173
266
|
// its own flush-parked last row at full scroll. Dock bands share the
|
|
@@ -195,7 +288,7 @@ describe("HkScrollContainer dock slots", () => {
|
|
|
195
288
|
mounts.push(app);
|
|
196
289
|
const host = (app.mount(container) as unknown as { $el: HTMLElement }).$el;
|
|
197
290
|
const viewport = host.querySelector(".hk-scroll-container-viewport") as HTMLElement;
|
|
198
|
-
const strength = () => host.style.getPropertyValue("--hk-scroll-
|
|
291
|
+
const strength = () => host.style.getPropertyValue("--hk-scroll-dock-gate-bottom");
|
|
199
292
|
|
|
200
293
|
const stub = (scrollTop: number) => {
|
|
201
294
|
Object.defineProperty(viewport, "scrollHeight", { value: 400, configurable: true });
|
|
@@ -244,7 +337,7 @@ describe("HkScrollContainer dock slots", () => {
|
|
|
244
337
|
mounts.push(app);
|
|
245
338
|
const host = (app.mount(container) as unknown as { $el: HTMLElement }).$el;
|
|
246
339
|
const viewport = host.querySelector(".hk-scroll-container-viewport") as HTMLElement;
|
|
247
|
-
const strength = () => host.style.getPropertyValue("--hk-scroll-
|
|
340
|
+
const strength = () => host.style.getPropertyValue("--hk-scroll-dock-gate-bottom");
|
|
248
341
|
const stub = (scrollTop: number) => {
|
|
249
342
|
Object.defineProperty(viewport, "scrollHeight", { value: 400, configurable: true });
|
|
250
343
|
Object.defineProperty(viewport, "clientHeight", { value: 100, configurable: true });
|
|
@@ -198,19 +198,32 @@ describe("scroll fade composition contract", () => {
|
|
|
198
198
|
).toBeNull();
|
|
199
199
|
});
|
|
200
200
|
|
|
201
|
-
it("
|
|
202
|
-
//
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
201
|
+
it("scales each dock band by ITS OWN gate, not the fade ramp", () => {
|
|
202
|
+
// The dock band is its own size TIMES a binary gate the component
|
|
203
|
+
// publishes — on a SEPARATE var family from the fade ramp. That split
|
|
204
|
+
// is load-bearing: with `fade` and a dock slot both on, the ramp
|
|
205
|
+
// branch publishes "1" at the scroll end by its own design, and a
|
|
206
|
+
// shared var let that value keep the dock band at full depth, painting
|
|
207
|
+
// over the flush-parked last row again. Two vars let the ramp keep its
|
|
208
|
+
// progressive value while the gate retires independently; this pin is
|
|
209
|
+
// the only consumer of the gate, so it is what keeps the fix real. The
|
|
208
210
|
// `1` fallback preserves the pre-fix band wherever nothing publishes.
|
|
209
211
|
const scaled = (side: "top" | "bottom") =>
|
|
210
212
|
new RegExp(
|
|
211
|
-
`--hk-scroll-fade-${side}:\\s*calc\\(\\s*var\\(--hk-scroll-dock-fade, 2rem\\)\\s*\\*\\s*var\\(--hk-scroll-
|
|
213
|
+
`--hk-scroll-fade-${side}:\\s*calc\\(\\s*var\\(--hk-scroll-dock-fade, 2rem\\)\\s*\\*\\s*var\\(--hk-scroll-dock-gate-${side}, 1\\)\\s*\\)`,
|
|
212
214
|
);
|
|
213
|
-
expect(sheet, "bottom dock band
|
|
214
|
-
expect(sheet, "top dock band
|
|
215
|
+
expect(sheet, "bottom dock band reads its own gate").toMatch(scaled("bottom"));
|
|
216
|
+
expect(sheet, "top dock band reads its own gate").toMatch(scaled("top"));
|
|
217
|
+
// And the DOCK rules themselves must not read the ramp's strengths —
|
|
218
|
+
// scoped to those rule bodies, since the fade state rules legitimately
|
|
219
|
+
// do (that is the ramp's own consumer).
|
|
220
|
+
for (const side of ["top", "bottom"] as const) {
|
|
221
|
+
const body =
|
|
222
|
+
new RegExp(`\\[data-dock-fade="${side}"\\]\\s*\\{([^}]*)\\}`).exec(sheet)?.[1] ?? "";
|
|
223
|
+
expect(body, `the ${side} dock rule exists`).not.toBe("");
|
|
224
|
+
expect(body, `the ${side} dock rule never reads the ramp strength`).not.toMatch(
|
|
225
|
+
/--hk-scroll-fade-strength-/,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
215
228
|
});
|
|
216
229
|
});
|
|
@@ -373,38 +373,38 @@
|
|
|
373
373
|
(opacity 100 -> 0 across --hk-scroll-dock-fade) reads as intentional
|
|
374
374
|
instead of a hard clip against the dock's top edge. Content never
|
|
375
375
|
sits under the dock, so this fades the viewport's last few pixels,
|
|
376
|
-
not the dock itself.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
fallback keeps the pre-fix full band wherever nothing is
|
|
397
|
-
(SSR, no JS pass yet). A ride dock does run the gate but
|
|
398
|
-
marker, so its published values have no reader. */
|
|
376
|
+
not the dock itself.
|
|
377
|
+
|
|
378
|
+
The dock band lives on its OWN gate var (2026-11-12, user direction:
|
|
379
|
+
two vars instead of one shared one). History: the band used to
|
|
380
|
+
multiply the SHARED fade strength, but the component never published
|
|
381
|
+
that var for a dock-only container (the `fade` prop owns the ramp), so
|
|
382
|
+
the band sat at full depth forever and a scroller parked at its END
|
|
383
|
+
kept painting over its own last row —
|
|
384
|
+
「拉到最底部仍然有渐变阴影覆盖最后一行」. Publishing the binary gate
|
|
385
|
+
into the shared var fixed the dock-only case but left `fade` + dock
|
|
386
|
+
broken: the ramp branch wins the branch chain and publishes "1" at the
|
|
387
|
+
end, so the band never retired there.
|
|
388
|
+
|
|
389
|
+
The composition now: the RAMP keeps
|
|
390
|
+
--hk-scroll-fade-strength-<side> (the state rules own the edge
|
|
391
|
+
mid-scroll, deepening with the pull per the 2026-11-06 note); the DOCK
|
|
392
|
+
publishes --hk-scroll-dock-gate-<side> (binary: lit while the edge
|
|
393
|
+
hides content, retired at the sense's own 1px deadband), and this rule
|
|
394
|
+
multiplies the dock size by the gate. At the scroll end the gate is 0
|
|
395
|
+
— with or without `fade` — so the flush-parked last row reads in
|
|
396
|
+
full. The `1` fallback keeps the pre-fix full band wherever nothing is
|
|
397
|
+
published (SSR, no JS pass yet). A ride dock does run the gate but
|
|
398
|
+
stamps no marker, so its published values have no reader. */
|
|
399
399
|
.hk-scroll-container[data-dock-fade="bottom"] {
|
|
400
400
|
--hk-scroll-fade-bottom: calc(
|
|
401
|
-
var(--hk-scroll-dock-fade, 2rem) * var(--hk-scroll-
|
|
401
|
+
var(--hk-scroll-dock-fade, 2rem) * var(--hk-scroll-dock-gate-bottom, 1)
|
|
402
402
|
);
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
.hk-scroll-container[data-dock-fade="top"] {
|
|
406
406
|
--hk-scroll-fade-top: calc(
|
|
407
|
-
var(--hk-scroll-dock-fade, 2rem) * var(--hk-scroll-
|
|
407
|
+
var(--hk-scroll-dock-fade, 2rem) * var(--hk-scroll-dock-gate-top, 1)
|
|
408
408
|
);
|
|
409
409
|
}
|
|
410
410
|
|
|
@@ -237,12 +237,14 @@ export default defineComponent({
|
|
|
237
237
|
* dissolve at all, because the air between content and dock is the
|
|
238
238
|
* dock's measured height (see `dockMode`). The band RETIRES at the
|
|
239
239
|
* scroll end (2026-11-12 user report): it is the dock size
|
|
240
|
-
* multiplied by a binary
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
240
|
+
* multiplied by a binary gate this component publishes for dock-fed
|
|
241
|
+
* edges on its OWN var family (--hk-scroll-dock-gate-<side>) — lit
|
|
242
|
+
* while content still hides past the edge, retired at the sense's
|
|
243
|
+
* own 1px deadband — so a flush-parked last row reads in full
|
|
244
|
+
* instead of sitting under a permanent gradient. With `fade` ALSO
|
|
245
|
+
* on, the two semantics coexist: the ramp keeps its progressive
|
|
246
|
+
* value mid-scroll (the state rules own the edge there) and the
|
|
247
|
+
* gate still retires the band at the end. */
|
|
246
248
|
dockFade: { type: Boolean, default: true },
|
|
247
249
|
/** Opt-in tail clearance for FLOATING docks (2026-10-12): a dock that
|
|
248
250
|
* lives OUTSIDE this container (a shell-level fixed plane — a page's
|
|
@@ -508,6 +510,12 @@ export default defineComponent({
|
|
|
508
510
|
// ancestor attribute (dir on the container, dir="auto") would
|
|
509
511
|
// light the wrong physical edge.
|
|
510
512
|
const lastFadeStrengths = new Map<string, string>();
|
|
513
|
+
/** The dock band's binary gate (see publishDockGates): a SEPARATE var
|
|
514
|
+
* family from the fade ramp's, so the two semantics can coexist — the
|
|
515
|
+
* ramp keeps its progressive value while the gate retires at the end,
|
|
516
|
+
* and the sheet composes them by cascade (fade state rules own the
|
|
517
|
+
* edge mid-scroll; the dock rule applies once nothing is hidden). */
|
|
518
|
+
const lastDockGates = new Map<string, string>();
|
|
511
519
|
let lastPublishedDir: string | null = null;
|
|
512
520
|
|
|
513
521
|
// Sensed selection edge hint (see the selectionHint prop doc),
|
|
@@ -895,18 +903,20 @@ export default defineComponent({
|
|
|
895
903
|
if (props.overflowGlow) {
|
|
896
904
|
publishOverflowGlowEdges(overflowGlowEdgesFor(h, v, rtl));
|
|
897
905
|
}
|
|
906
|
+
// Physical-side depths shared by both publishers: the normalized
|
|
907
|
+
// hPos counts the inline START, which is the visual RIGHT edge under
|
|
908
|
+
// RTL — swap there so --hk-scroll-fade-strength-left always means
|
|
909
|
+
// the left edge. Axis-gated edges never hide anything this
|
|
910
|
+
// container can fade, so they publish the unlit "1" rather than
|
|
911
|
+
// live geometry.
|
|
912
|
+
const hidden = {
|
|
913
|
+
left: hasH() ? (rtl ? hMax - hPos : hPos) : 0,
|
|
914
|
+
right: hasH() ? (rtl ? hPos : hMax - hPos) : 0,
|
|
915
|
+
top: hasV() ? vPos : 0,
|
|
916
|
+
bottom: hasV() ? vMax - vPos : 0,
|
|
917
|
+
};
|
|
898
918
|
if (props.fade) {
|
|
899
|
-
|
|
900
|
-
// START, which is the visual RIGHT edge under RTL — swap there
|
|
901
|
-
// so --hk-scroll-fade-strength-left always means the left edge.
|
|
902
|
-
// Axis-gated edges never hide anything this container can fade,
|
|
903
|
-
// so they publish the unlit "1" rather than live geometry.
|
|
904
|
-
publishFadeStrengths(root, {
|
|
905
|
-
left: hasH() ? (rtl ? hMax - hPos : hPos) : 0,
|
|
906
|
-
right: hasH() ? (rtl ? hPos : hMax - hPos) : 0,
|
|
907
|
-
top: hasV() ? vPos : 0,
|
|
908
|
-
bottom: hasV() ? vMax - vPos : 0,
|
|
909
|
-
});
|
|
919
|
+
publishFadeStrengths(root, hidden);
|
|
910
920
|
// Mirror the COMPUTED direction for the CSS band-slot swap (the
|
|
911
921
|
// SCSS RTL rules key on this attribute, not on [dir]): the
|
|
912
922
|
// depths above are physical, so the slot mapping must come from
|
|
@@ -927,33 +937,21 @@ export default defineComponent({
|
|
|
927
937
|
lastPublishedDir = dir;
|
|
928
938
|
root.setAttribute("data-dir", dir);
|
|
929
939
|
}
|
|
930
|
-
} else if (props.dockFade && (slots.dockBottom || slots.dockTop)) {
|
|
931
|
-
// The dir mirror belongs to the `fade` band-slot swap, which is
|
|
932
|
-
// off in this branch: drop a value a previous fade-on pass may
|
|
933
|
-
// have published, so "fade off removes it" holds for dock
|
|
934
|
-
// containers too (F4 in the 2026-11-12 review).
|
|
935
|
-
if (lastPublishedDir !== null) {
|
|
936
|
-
lastPublishedDir = null;
|
|
937
|
-
root.removeAttribute("data-dir");
|
|
938
|
-
}
|
|
939
|
-
// Dock-fed bands share the strength vars but never the `fade`
|
|
940
|
-
// ramp: gate them binary so the band retires at the scroll end
|
|
941
|
-
// instead of covering the flush-parked last row (see
|
|
942
|
-
// publishFadeStrengths' dock note). Depths reuse the same
|
|
943
|
-
// physical-side mapping the fade branch computes.
|
|
944
|
-
publishFadeStrengths(
|
|
945
|
-
root,
|
|
946
|
-
{
|
|
947
|
-
left: hasH() ? (rtl ? hMax - hPos : hPos) : 0,
|
|
948
|
-
right: hasH() ? (rtl ? hPos : hMax - hPos) : 0,
|
|
949
|
-
top: hasV() ? vPos : 0,
|
|
950
|
-
bottom: hasV() ? vMax - vPos : 0,
|
|
951
|
-
},
|
|
952
|
-
true,
|
|
953
|
-
);
|
|
954
940
|
} else {
|
|
955
941
|
clearPublishedFade(root);
|
|
956
942
|
}
|
|
943
|
+
// The dock gate is an INDEPENDENT lifecycle, no longer an else-if:
|
|
944
|
+
// with `fade` also on, the ramp keeps its progressive value on this
|
|
945
|
+
// edge (the state rules own it mid-scroll) while the gate — on its
|
|
946
|
+
// OWN var — retires the dock band at the end (2026-11-12 user
|
|
947
|
+
// direction: two vars instead of one shared one). Publishing into a
|
|
948
|
+
// separate family means the two semantics compose in the sheet
|
|
949
|
+
// instead of fighting in JS.
|
|
950
|
+
if (props.dockFade && (slots.dockBottom || slots.dockTop)) {
|
|
951
|
+
publishDockGates(root, hidden);
|
|
952
|
+
} else {
|
|
953
|
+
clearDockGates(root);
|
|
954
|
+
}
|
|
957
955
|
}
|
|
958
956
|
|
|
959
957
|
/** Drop every fade state the mirror published (fade prop off):
|
|
@@ -977,32 +975,15 @@ export default defineComponent({
|
|
|
977
975
|
* the band's 0..1 depth, so the fade grows with the pull and caps
|
|
978
976
|
* at the full band. An edge hiding nothing (the same ≤1px deadband
|
|
979
977
|
* computeOverflow uses) publishes 1 — with its 0px band that is
|
|
980
|
-
* invisible.
|
|
981
|
-
*
|
|
982
|
-
* `
|
|
983
|
-
*
|
|
984
|
-
|
|
985
|
-
* progressive value there made the band permanent, so a scroller
|
|
986
|
-
* parked at its end kept painting over its own last row ("拉到最底部
|
|
987
|
-
* 仍然有渐变阴影覆盖最后一行"). Dock mode therefore publishes a
|
|
988
|
-
* BINARY gate: lit (1) while that edge still hides content, retired
|
|
989
|
-
* (0) once the scroller has nothing left past it. The band then
|
|
990
|
-
* exists exactly while there is something to reveal, and vanishes at
|
|
991
|
-
* the end — for the stream it is the same full-depth band, so the
|
|
992
|
-
* mid-scroll dissolve the 2026-11-11 direction asked for is intact.
|
|
993
|
-
*/
|
|
994
|
-
function publishFadeStrengths(
|
|
995
|
-
root: HTMLElement,
|
|
996
|
-
hidden: { left: number; right: number; top: number; bottom: number },
|
|
997
|
-
dock = false,
|
|
998
|
-
) {
|
|
978
|
+
* invisible. This family is the RAMP's alone: dock bands read their
|
|
979
|
+
* own gate var (see publishDockGates), so a dock container mounted
|
|
980
|
+
* alongside `fade` can retire at the end without the ramp's
|
|
981
|
+
* end-of-scroll "1" leaking into it. */
|
|
982
|
+
function publishFadeStrengths(root: HTMLElement, hidden: { left: number; right: number; top: number; bottom: number }) {
|
|
999
983
|
const dist = Math.max(0, props.fadeDistance);
|
|
1000
984
|
for (const [side, depth] of Object.entries(hidden) as Array<[keyof typeof hidden, number]>) {
|
|
1001
|
-
const strength =
|
|
1002
|
-
|
|
1003
|
-
? "0"
|
|
1004
|
-
: "1"
|
|
1005
|
-
: depth <= 1 || dist === 0
|
|
985
|
+
const strength =
|
|
986
|
+
depth <= 1 || dist === 0
|
|
1006
987
|
? "1"
|
|
1007
988
|
: String(Math.min(1, Math.round((depth / dist) * 1000) / 1000));
|
|
1008
989
|
if (lastFadeStrengths.get(side) !== strength) {
|
|
@@ -1012,6 +993,36 @@ export default defineComponent({
|
|
|
1012
993
|
}
|
|
1013
994
|
}
|
|
1014
995
|
|
|
996
|
+
/** The dock band's BINARY gate, on its own var family
|
|
997
|
+
* (--hk-scroll-dock-gate-<side>): lit (1) while that edge still
|
|
998
|
+
* hides content, retired (0) once the scroller has nothing left past
|
|
999
|
+
* it (the sense's own ≤1px deadband). The sheet multiplies the dock
|
|
1000
|
+
* size by this gate, so a scroller parked at its end shows its
|
|
1001
|
+
* flush-parked last row in full (2026-11-12 user report:
|
|
1002
|
+
* 「拉到最底部仍然有渐变阴影覆盖最后一行」). Living on a separate
|
|
1003
|
+
* var from the fade ramp is the point: with `fade` also on, the ramp
|
|
1004
|
+
* keeps its progressive value AND the gate still retires at the end
|
|
1005
|
+
* — the two semantics no longer fight over one number. */
|
|
1006
|
+
function publishDockGates(root: HTMLElement, hidden: { left: number; right: number; top: number; bottom: number }) {
|
|
1007
|
+
for (const [side, depth] of Object.entries(hidden) as Array<[keyof typeof hidden, number]>) {
|
|
1008
|
+
const gate = depth <= 1 ? "0" : "1";
|
|
1009
|
+
if (lastDockGates.get(side) !== gate) {
|
|
1010
|
+
lastDockGates.set(side, gate);
|
|
1011
|
+
root.style.setProperty(`--hk-scroll-dock-gate-${side}`, gate);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/** Drop the dock gate family (dockFade off / no dock slot): a stale
|
|
1017
|
+
* inline gate must not outlive the feature that wrote it. */
|
|
1018
|
+
function clearDockGates(root: HTMLElement) {
|
|
1019
|
+
if (lastDockGates.size === 0) return;
|
|
1020
|
+
for (const side of ["left", "right", "top", "bottom"]) {
|
|
1021
|
+
root.style.removeProperty(`--hk-scroll-dock-gate-${side}`);
|
|
1022
|
+
}
|
|
1023
|
+
lastDockGates.clear();
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1015
1026
|
/** Selection edge hint (see the selectionHint prop doc): does any
|
|
1016
1027
|
* "selected" descendant lie fully outside the viewport's visible
|
|
1017
1028
|
* vertical band? Both rects are read in DRAWN space, so a zoomed
|
|
@@ -153,55 +153,17 @@
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
/* ── Day period (AM / PM) ─────────────────────────────────────── */
|
|
156
|
-
|
|
156
|
+
/* The segmented control is hikari's HkPillToggleGroup; only the clock
|
|
157
|
+
* panel's own alignment/icon scale lives here. */
|
|
157
158
|
.hk-tp-period {
|
|
158
|
-
display: grid;
|
|
159
|
-
grid-template-columns: 1fr 1fr;
|
|
160
|
-
gap: 2px;
|
|
161
|
-
padding: 2px;
|
|
162
|
-
background: color-mix(in srgb, rgb(var(--color-surface)) 70%, transparent);
|
|
163
|
-
border: 1px solid color-mix(in srgb, rgb(var(--color-text)) 12%, transparent);
|
|
164
|
-
border-radius: var(--radius-md, 8px);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.hk-tp-period-btn {
|
|
168
|
-
appearance: none;
|
|
169
|
-
border: 0;
|
|
170
|
-
background: transparent;
|
|
171
|
-
height: 2rem;
|
|
172
|
-
display: inline-flex;
|
|
173
|
-
align-items: center;
|
|
174
159
|
justify-content: center;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
font-weight: 600;
|
|
179
|
-
letter-spacing: 0.02em;
|
|
180
|
-
color: var(--hi-color-muted);
|
|
181
|
-
border-radius: var(--radius-sm, 4px);
|
|
182
|
-
cursor: pointer;
|
|
183
|
-
transition:
|
|
184
|
-
background-color var(--duration-fast, 0.15s) ease,
|
|
185
|
-
color var(--duration-fast, 0.15s) ease;
|
|
186
|
-
|
|
187
|
-
&:hover:not(.is-active) {
|
|
188
|
-
background: color-mix(in srgb, rgb(var(--color-text)) 6%, transparent);
|
|
189
|
-
color: var(--hi-color-text-primary);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
&.is-active {
|
|
193
|
-
background: rgb(var(--color-primary));
|
|
194
|
-
color: rgb(var(--color-on-solid));
|
|
195
|
-
|
|
196
|
-
svg {
|
|
197
|
-
color: rgb(var(--color-on-solid-icon, 255 255 255));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
160
|
+
cursor: default;
|
|
161
|
+
touch-action: manipulation;
|
|
162
|
+
}
|
|
200
163
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
164
|
+
.hk-tp-period .hk-pill-group-icon svg {
|
|
165
|
+
width: 13px;
|
|
166
|
+
height: 13px;
|
|
205
167
|
}
|
|
206
168
|
|
|
207
169
|
/* ── Readout ──────────────────────────────────────────────────── */
|
|
@@ -423,15 +385,15 @@
|
|
|
423
385
|
font-size: var(--text-sm, 0.875rem);
|
|
424
386
|
}
|
|
425
387
|
|
|
426
|
-
.hk-tp-panel.is-touch .hk-tp-period-
|
|
427
|
-
height: 2.35rem;
|
|
388
|
+
.hk-tp-panel.is-touch .hk-tp-period .hk-pill-group-pill {
|
|
389
|
+
min-height: 2.35rem;
|
|
428
390
|
font-size: var(--text-sm, 0.875rem);
|
|
429
391
|
}
|
|
430
392
|
|
|
431
393
|
@media (prefers-reduced-motion: reduce) {
|
|
432
394
|
.hk-tp-trigger,
|
|
433
395
|
.hk-tp-clear,
|
|
434
|
-
.hk-tp-period-
|
|
396
|
+
.hk-tp-period .hk-pill-group-pill,
|
|
435
397
|
.hk-tp-readout-btn,
|
|
436
398
|
.hk-tp-number {
|
|
437
399
|
transition: none;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
|
|
7
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const scss = readFileSync(resolve(here, "HkTimePicker.scss"), "utf8");
|
|
9
|
+
const tsx = readFileSync(resolve(here, "HkTimePicker.tsx"), "utf8");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Source-contract pins: the minute-mode metrics key (the number layer is
|
|
13
|
+
* a sibling of the slider, so `.hk-tp-face.is-minute` can never match —
|
|
14
|
+
* a regression pin even though the selector predates this PR) and the
|
|
15
|
+
* shared segmented period control introduced here. A SCSS-only edit
|
|
16
|
+
* reintroducing the old selector used to leave every behavioral test
|
|
17
|
+
* green; this file is the missing guard.
|
|
18
|
+
*/
|
|
19
|
+
describe("HkTimePicker source contracts", () => {
|
|
20
|
+
it("keys the minute-mode rules on the number layer, never the face", () => {
|
|
21
|
+
expect(scss).toContain(".hk-tp-numbers.is-minute .hk-tp-number");
|
|
22
|
+
expect(scss).toContain(".hk-tp-panel.is-touch .hk-tp-numbers.is-minute .hk-tp-number");
|
|
23
|
+
expect(scss).not.toContain(".hk-tp-face.is-minute");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("builds the day period on hikari's shared pill group", () => {
|
|
27
|
+
expect(tsx).toContain('from "./HkPillToggleGroup"');
|
|
28
|
+
expect(tsx).toContain("<HkPillToggleGroup");
|
|
29
|
+
expect(scss).not.toContain(".hk-tp-period-btn");
|
|
30
|
+
});
|
|
31
|
+
});
|