@celestia-island/hikari 0.55.392 → 0.55.395
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/HkModalBreadcrumb.motion.contract.test.ts +85 -15
- package/src/components/HkModalBreadcrumb.overflow.contract.test.ts +3 -2
- package/src/components/HkModalBreadcrumb.scss +18 -6
- package/src/components/HkThemePanelContent.lane.contract.test.ts +25 -0
- package/src/components/HkThemePanelContent.tsx +1 -0
package/package.json
CHANGED
|
@@ -99,6 +99,11 @@ const reducedBreadcrumb = topBlock(breadcrumb, "@media (prefers-reduced-motion:
|
|
|
99
99
|
const reducedList = topBlock(list, "@media (prefers-reduced-motion: reduce)");
|
|
100
100
|
|
|
101
101
|
const MODAL_POSE = "translateY(10px) scale(0.97)";
|
|
102
|
+
/** The strip's own ride legs — px only; the centering sits on the
|
|
103
|
+
* `translate` longhand (see the carrier test below). */
|
|
104
|
+
const POSE_FROM = "translateY(-10px) scale(0.97)";
|
|
105
|
+
const POSE_TO = "translateY(0) scale(1)";
|
|
106
|
+
const CENTERING = "-50% -50%";
|
|
102
107
|
const EASE_OUT = "cubic-bezier(0.33, 1, 0.68, 1)";
|
|
103
108
|
const EASE_IN = "cubic-bezier(0.45, 0, 0.55, 1)";
|
|
104
109
|
|
|
@@ -121,10 +126,10 @@ describe("strip surface enter/leave (window choreography)", () => {
|
|
|
121
126
|
expect(enter).toContain(`transform var(--duration-normal, 0.3s) ${EASE_OUT}`);
|
|
122
127
|
const from = rule(breadcrumb, ".hk-modal-breadcrumb-enter-from");
|
|
123
128
|
expect(from).toContain("opacity: 0");
|
|
124
|
-
expect(from).toContain(
|
|
129
|
+
expect(from).toContain(`transform: ${POSE_FROM}`);
|
|
125
130
|
const to = rule(breadcrumb, ".hk-modal-breadcrumb-enter-to");
|
|
126
131
|
expect(to).toContain("opacity: 1");
|
|
127
|
-
expect(to).toContain(
|
|
132
|
+
expect(to).toContain(`transform: ${POSE_TO}`);
|
|
128
133
|
});
|
|
129
134
|
|
|
130
135
|
it("leaves as the true reverse, quicker than the windows it names", () => {
|
|
@@ -133,21 +138,86 @@ describe("strip surface enter/leave (window choreography)", () => {
|
|
|
133
138
|
expect(leave).toContain(`transform var(--duration-short, 0.15s) ${EASE_IN}`);
|
|
134
139
|
const to = rule(breadcrumb, ".hk-modal-breadcrumb-leave-to");
|
|
135
140
|
expect(to).toContain("opacity: 0");
|
|
136
|
-
expect(to).toContain(
|
|
141
|
+
expect(to).toContain(`transform: ${POSE_FROM}`);
|
|
137
142
|
});
|
|
138
143
|
|
|
139
|
-
it("
|
|
140
|
-
// The
|
|
141
|
-
//
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
it("carries the centring on the translate longhand, never in an animated transform", () => {
|
|
145
|
+
// The strip's box changes WHILE it is up (the keyed crumb list folds its
|
|
146
|
+
// tail, a late webfont reflows the labels, a crumb is re-inserted), and
|
|
147
|
+
// those changes land mid-entrance. A -50% inside the transitioned
|
|
148
|
+
// `transform` freezes its composited matrix against the mount-time box,
|
|
149
|
+
// re-seating the strip against a stale height — the modal-frame defect
|
|
150
|
+
// family hikari #1325 removed. The centring therefore rides the
|
|
151
|
+
// individual `translate` longhand, which re-resolves every frame.
|
|
152
|
+
//
|
|
153
|
+
// BOTH carriers are guarded, because the defect can return through
|
|
154
|
+
// either one: a `translate: none` (or a re-created `translate`) on a ride
|
|
155
|
+
// rule un-centres / double-centres the strip for the whole ride, and a
|
|
156
|
+
// `-50%` re-appended to a ride transform restores the frozen matrix. The
|
|
157
|
+
// first revision of this test swept only `transform:` and let both
|
|
158
|
+
// `translate:` variants pass green (R2 mutation, 2026-11-15). Comments are
|
|
159
|
+
// stripped before matching: sass keeps loud `/* */` comments in expanded
|
|
160
|
+
// output, and a regex would otherwise read a comment's prose as a
|
|
161
|
+
// declaration.
|
|
162
|
+
const stripComments = (text: string): string => text.replace(/\/\*[\s\S]*?\*\//g, " ");
|
|
163
|
+
// EVERY declaration of a property, case-insensitively. Both halves are
|
|
164
|
+
// load-bearing: CSS property names are case-insensitive (`Translate:` is
|
|
165
|
+
// the same property), and a duplicate declaration is last-wins — a second
|
|
166
|
+
// `translate: none` appended to the base rule paints un-centred while a
|
|
167
|
+
// first-match-only reader still sees the good pair (independent delta
|
|
168
|
+
// round, 2026-11-15: both bypasses survived the first-match sweep).
|
|
169
|
+
// Split on `;` and test each segment: a boundary-consuming regex cannot
|
|
170
|
+
// see two consecutive declarations of the same property (the match eats
|
|
171
|
+
// the preceding `;`, so the second segment starts without a boundary and
|
|
172
|
+
// only the LAST one is found — measured, 2026-11-15).
|
|
173
|
+
const decls = (body: string, prop: string): string[] => {
|
|
174
|
+
// Vendor prefixes are the same painting: `-webkit-transform` would
|
|
175
|
+
// otherwise slip past an exact-name anchor (closure round, 2026-11-15).
|
|
176
|
+
const re = new RegExp(`^\\s*(?:-webkit-|-moz-|-ms-)?${prop}\\s*:\\s*([\\s\\S]*)$`, "i");
|
|
177
|
+
return body
|
|
178
|
+
.split(";")
|
|
179
|
+
.map((segment) => segment.match(re))
|
|
180
|
+
.filter((m): m is RegExpMatchArray => m !== null)
|
|
181
|
+
.map((m) => m[1].trim().replace(/\s+/g, " "));
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const offenders: string[] = [];
|
|
185
|
+
/** The FIRST base-matching frame in source order — the top-level rule
|
|
186
|
+
* (sass emits media blocks after it). Only its declarations decide
|
|
187
|
+
* whether the strip is centred everywhere: parking the pair solely in
|
|
188
|
+
* an @media override would leave every wider viewport un-centred. */
|
|
189
|
+
let topLevelBaseTranslate: string[] | null = null;
|
|
190
|
+
for (const frame of frames(breadcrumb)) {
|
|
191
|
+
const body = stripComments(frame.body);
|
|
192
|
+
const label = frame.selectors.join(", ");
|
|
193
|
+
const isBase = frame.selectors.includes(".hk-modal-breadcrumb");
|
|
194
|
+
const translates = decls(body, "translate");
|
|
195
|
+
if (isBase && topLevelBaseTranslate === null) topLevelBaseTranslate = translates;
|
|
196
|
+
for (const transform of decls(body, "transform")) {
|
|
197
|
+
if (transform !== "none" && transform.includes("%")) {
|
|
198
|
+
offenders.push(`${label} { transform: ${transform} }`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
for (const translate of translates) {
|
|
202
|
+
if (!isBase) {
|
|
203
|
+
offenders.push(`${label} { translate: ${translate} } (only the base rule may set the centring longhand)`);
|
|
204
|
+
} else if (translate !== CENTERING) {
|
|
205
|
+
offenders.push(`${label} { translate: ${translate} }`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
expect(offenders, "the centring carrier must stay the base rule's translate longhand").toEqual([]);
|
|
210
|
+
expect(topLevelBaseTranslate, "the top-level base rule must exist").not.toBeNull();
|
|
211
|
+
expect(topLevelBaseTranslate, "the top-level base rule must declare exactly the centring pair").toEqual([
|
|
212
|
+
CENTERING,
|
|
213
|
+
]);
|
|
214
|
+
|
|
215
|
+
// Known-positive probe: the sweep is worthless if it matches no rule at
|
|
216
|
+
// all (hikari #1325's first sweep shipped vacuous exactly that way), so
|
|
217
|
+
// assert the ride rules really are in the compiled sheet.
|
|
218
|
+
for (const sel of [".hk-modal-breadcrumb-enter-from", ".hk-modal-breadcrumb-leave-to"]) {
|
|
219
|
+
expect(rule(breadcrumb, sel)).toContain("transform:");
|
|
220
|
+
}
|
|
151
221
|
});
|
|
152
222
|
|
|
153
223
|
it("has no keyframe animation on the base class (no double entrance)", () => {
|
|
@@ -27,8 +27,9 @@ function rule(selector: string): string {
|
|
|
27
27
|
describe("HkModalBreadcrumb overflow fence", () => {
|
|
28
28
|
it("fences the strip against the viewport, not against its content", () => {
|
|
29
29
|
const block = rule(".hk-modal-breadcrumb");
|
|
30
|
-
// The strip is centred
|
|
31
|
-
//
|
|
30
|
+
// The strip is centred on the individual `translate` longhand (see the
|
|
31
|
+
// motion contract) and lives outside the page flow: without a
|
|
32
|
+
// viewport-derived cap its width IS its content width.
|
|
32
33
|
expect(block).toContain("max-width: calc(100vw - 2 * var(--viewport-gutter");
|
|
33
34
|
expect(block).toContain("box-sizing: border-box");
|
|
34
35
|
// Last-resort clip: the script folds the leading layers, this keeps a
|
|
@@ -3,7 +3,17 @@
|
|
|
3
3
|
.hk-modal-breadcrumb {
|
|
4
4
|
position: fixed;
|
|
5
5
|
left: 50%;
|
|
6
|
-
|
|
6
|
+
/* The centering pair lives on the individual `translate` property —
|
|
7
|
+
NEVER inside the animated `transform` (see the choreography block
|
|
8
|
+
below). The strip's box changes while it is up: the keyed crumb list
|
|
9
|
+
folds its tail, labels wrap when a late webfont lands, and the script
|
|
10
|
+
side re-inserts a crumb — all mid-flight during an entrance. A -50%
|
|
11
|
+
frozen inside a running ride's matrices would then re-seat the strip
|
|
12
|
+
against its mount-time height, the exact defect family hikari #1325
|
|
13
|
+
removed from the modal frame; the longhand re-resolves against the
|
|
14
|
+
live box on every frame. `translate` composes before `transform`, so
|
|
15
|
+
the painted order (centre, then the ride legs) is unchanged. */
|
|
16
|
+
translate: -50% -50%;
|
|
7
17
|
/* Above every popup band's scrim (modal 1000+, dropdown 2000+; in-band
|
|
8
18
|
steps of 2 keep real stacks far below this) so multi-layer windows
|
|
9
19
|
never bury the strip; still below tooltip (3000) / toast (4000). */
|
|
@@ -48,9 +58,11 @@
|
|
|
48
58
|
(opacity + transform only; nothing layout ever animates — the
|
|
49
59
|
backdrop-filtered layer never re-rasters mid-motion).
|
|
50
60
|
|
|
51
|
-
The centering
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
The centering pair rides the individual `translate` property only;
|
|
62
|
+
the ride states below animate px legs (translateY + scale) and carry
|
|
63
|
+
no percentage at all, so a mid-flight box change can never freeze a
|
|
64
|
+
stale -50% into the strip's composited matrices (the carrier split
|
|
65
|
+
the modal frame adopted in hikari #1325).
|
|
54
66
|
|
|
55
67
|
Vue drives these classes (<Transition name="hk-modal-breadcrumb"
|
|
56
68
|
appear> in the tsx); there is no keyframe animation on the base class —
|
|
@@ -73,13 +85,13 @@
|
|
|
73
85
|
.hk-modal-breadcrumb-enter-from,
|
|
74
86
|
.hk-modal-breadcrumb-leave-to {
|
|
75
87
|
opacity: 0;
|
|
76
|
-
transform:
|
|
88
|
+
transform: translateY(-10px) scale(0.97);
|
|
77
89
|
}
|
|
78
90
|
|
|
79
91
|
.hk-modal-breadcrumb-enter-to,
|
|
80
92
|
.hk-modal-breadcrumb-leave-from {
|
|
81
93
|
opacity: 1;
|
|
82
|
-
transform:
|
|
94
|
+
transform: translateY(0) scale(1);
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
/* ── The keyed crumb list ────────────────────────────────────────────
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source contract: the theme panel rows use a PERSISTENT action lane.
|
|
3
|
+
* The default "overlay" mode parks the edit/delete actions out of flow
|
|
4
|
+
* and covers the row's right content on hover — which swallowed the
|
|
5
|
+
* plugin badge on plugin-sourced themes (2026-11-14 user screenshot:
|
|
6
|
+
* the SquarePen edit button covering the badge on Arcaea). Persistent
|
|
7
|
+
* keeps the lane in the flow: badge and actions coexist, nothing gets
|
|
8
|
+
* covered.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { dirname, join } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
|
|
14
|
+
import { describe, expect, it } from "vitest";
|
|
15
|
+
|
|
16
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const src = readFileSync(join(here, "HkThemePanelContent.tsx"), "utf-8")
|
|
18
|
+
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
19
|
+
.replace(/^[ \t]*\/\/.*$/gm, "");
|
|
20
|
+
|
|
21
|
+
describe("HkThemePanelContent action lane contract", () => {
|
|
22
|
+
it("pins persistent action lane on the theme rows", () => {
|
|
23
|
+
expect(src).toContain('actionsMode="persistent"');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -331,6 +331,7 @@ export const HkThemePanelContent = defineComponent({
|
|
|
331
331
|
data-active={isActive || undefined}
|
|
332
332
|
aria-current={isActive ? "true" : undefined}
|
|
333
333
|
actions={actions}
|
|
334
|
+
actionsMode="persistent"
|
|
334
335
|
actionsLabel={t("hikari::theme.rowActionsLabel")}
|
|
335
336
|
onClick={() => onSelectTheme(th.id)}
|
|
336
337
|
>
|