@celestia-island/hikari 0.55.414 → 0.55.416
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/HkAffixPicker.scss +2 -2
- package/src/components/HkAlert.scss +12 -12
- package/src/components/HkAuthSubmitButton.scss +1 -1
- package/src/components/HkBlockingToast.scss +7 -7
- package/src/components/HkBreadcrumb.scss +3 -3
- package/src/components/HkCardList.scss +3 -3
- package/src/components/HkColorSchemeEditor.test.ts +179 -0
- package/src/components/HkColorSchemeEditor.tsx +57 -2
- package/src/components/HkCookieConsent.scss +1 -1
- package/src/components/HkCurrencySelect.scss +2 -2
- package/src/components/HkDiffViewer.scss +5 -5
- package/src/components/HkEditableTable.scss +1 -1
- package/src/components/HkEmergencySnoozeTray.scss +2 -2
- package/src/components/HkFileBrowserDialog.scss +2 -2
- package/src/components/HkFileField.scss +3 -3
- package/src/components/HkFilePickerField.scss +2 -2
- package/src/components/HkFilterPanel.scss +1 -1
- package/src/components/HkIcon.scss +3 -3
- package/src/components/HkIconButtonGroup.scss +1 -1
- package/src/components/HkIconChip.scss +4 -4
- package/src/components/HkInput.scss +3 -3
- package/src/components/HkLogWindow.scss +2 -2
- package/src/components/HkMenu.scss +1 -1
- package/src/components/HkMessageBox.scss +2 -2
- package/src/components/HkMoneyInput.scss +2 -2
- package/src/components/HkNotificationBell.scss +3 -3
- package/src/components/HkOtpInput.scss +2 -2
- package/src/components/HkPasswordSurface.scss +12 -12
- package/src/components/HkPersistentToast.scss +3 -3
- package/src/components/HkPillToggleGroup.scss +6 -6
- package/src/components/HkPillToggleGroup.test.tsx +12 -7
- package/src/components/HkPopupSelect.scss +3 -3
- package/src/components/HkProgressBar.scss +1 -1
- package/src/components/HkProgressBar.styles.test.ts +1 -1
- package/src/components/HkProgressRing.scss +2 -2
- package/src/components/HkQuote.scss +3 -3
- package/src/components/HkRangeRibbon.scss +1 -1
- package/src/components/HkSecretRevealModal.scss +1 -1
- package/src/components/HkSelect.scss +3 -3
- package/src/components/HkSelectionGrid.scss +24 -12
- package/src/components/HkSelectionGrid.test.tsx +486 -0
- package/src/components/HkSelectionGrid.tsx +5 -3
- package/src/components/HkSelectionWaterfall.scss +4 -4
- package/src/components/HkStatCard.scss +4 -4
- package/src/components/HkStatusBar.tsx +9 -9
- package/src/components/HkStatusRow.scss +3 -3
- package/src/components/HkStepGuide.scss +2 -2
- package/src/components/HkSwitch.scss +1 -1
- package/src/components/HkTag.scss +12 -12
- package/src/components/HkTemplateField.scss +1 -1
- package/src/components/HkTextarea.scss +1 -1
- package/src/components/HkToast.scss +5 -5
- package/src/components/HkTree.scss +2 -2
- package/src/components/_menu-item.scss +4 -4
- package/src/plugins/boot-recovery.details.test.ts +1 -1
- package/src/plugins/boot-recovery.diagnostics.test.ts +1 -1
- package/src/plugins/boot-recovery.error-context.test.ts +1 -1
- package/src/plugins/boot-recovery.locales.test.ts +1 -1
- package/src/plugins/bootLandingCss.js +1 -1
- package/src/plugins/bootLandingDetailsCss.js +1 -1
- package/src/styles/admin-tokens.scss +16 -16
- package/src/styles/theme/channels.scss +23 -13
- package/src/styles/theme/scrollbar.scss +3 -3
- package/src/styles/tokenInventory.test.ts +19 -0
- package/src/theme/_field.scss +3 -3
- package/src/theme/index.ts +1 -1
- package/src/theme/presets.ts +72 -8
- package/src/theme/solidInk.contract.test.ts +65 -6
- package/src/tokens.scss +23 -13
package/package.json
CHANGED
|
@@ -207,11 +207,11 @@
|
|
|
207
207
|
&:focus-visible {
|
|
208
208
|
color: var(
|
|
209
209
|
--hi-icon-button-icon-color-active,
|
|
210
|
-
rgb(var(--color-error,
|
|
210
|
+
rgb(var(--color-error, 166 41 55))
|
|
211
211
|
);
|
|
212
212
|
background: var(
|
|
213
213
|
--hi-icon-button-bg-hover,
|
|
214
|
-
rgb(var(--color-error,
|
|
214
|
+
rgb(var(--color-error, 166 41 55) / 12%)
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
/* ── Variants ──────────────────────────────────── */
|
|
42
42
|
|
|
43
43
|
.hk-alert-error {
|
|
44
|
-
background: color-mix(in srgb, var(--hi-color-danger, #
|
|
45
|
-
border-color: color-mix(in srgb, var(--hi-color-danger, #
|
|
46
|
-
border-inline-start-color: var(--hi-color-danger, #
|
|
44
|
+
background: color-mix(in srgb, var(--hi-color-danger, #a62937) 8%, transparent);
|
|
45
|
+
border-color: color-mix(in srgb, var(--hi-color-danger, #a62937) 15%, transparent);
|
|
46
|
+
border-inline-start-color: var(--hi-color-danger, #a62937);
|
|
47
47
|
|
|
48
|
-
.hk-alert-icon { color: var(--hi-color-danger, #
|
|
48
|
+
.hk-alert-icon { color: var(--hi-color-danger-fg, #a62937); }
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.hk-alert-warning {
|
|
52
|
-
background: color-mix(in srgb, var(--hi-color-warning, #
|
|
53
|
-
border-color: color-mix(in srgb, var(--hi-color-warning, #
|
|
54
|
-
border-inline-start-color: var(--hi-color-warning, #
|
|
52
|
+
background: color-mix(in srgb, var(--hi-color-warning, #894800) 8%, transparent);
|
|
53
|
+
border-color: color-mix(in srgb, var(--hi-color-warning, #894800) 15%, transparent);
|
|
54
|
+
border-inline-start-color: var(--hi-color-warning, #894800);
|
|
55
55
|
|
|
56
|
-
.hk-alert-icon { color: var(--hi-color-warning, #
|
|
56
|
+
.hk-alert-icon { color: var(--hi-color-warning-fg, #894800); }
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.hk-alert-info {
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.hk-alert-success {
|
|
68
|
-
background: color-mix(in srgb, var(--hi-color-success, #
|
|
69
|
-
border-color: color-mix(in srgb, var(--hi-color-success, #
|
|
70
|
-
border-inline-start-color: var(--hi-color-success, #
|
|
68
|
+
background: color-mix(in srgb, var(--hi-color-success, #1f6530) 8%, transparent);
|
|
69
|
+
border-color: color-mix(in srgb, var(--hi-color-success, #1f6530) 15%, transparent);
|
|
70
|
+
border-inline-start-color: var(--hi-color-success, #1f6530);
|
|
71
71
|
|
|
72
|
-
.hk-alert-icon { color: var(--hi-color-success, #
|
|
72
|
+
.hk-alert-icon { color: var(--hi-color-success-fg, #1f6530); }
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/* ── Icon ──────────────────────────────────────── */
|
|
@@ -87,17 +87,17 @@
|
|
|
87
87
|
// itself from its OWN fill via --hi-color-text-on-<tone> (the theme derives
|
|
88
88
|
// it per tone: white on saturated fills, black on the light ones).
|
|
89
89
|
.hk-blocking-toast-info {
|
|
90
|
-
background: var(--hi-color-info, #
|
|
90
|
+
background: var(--hi-color-info, #006274);
|
|
91
91
|
color: var(--hi-color-text-on-info, #fff);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.hk-blocking-toast-warning {
|
|
95
|
-
background: var(--hi-color-warning, #
|
|
95
|
+
background: var(--hi-color-warning, #894800);
|
|
96
96
|
color: var(--hi-color-text-on-warning, #1c1c1e);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.hk-blocking-toast-danger {
|
|
100
|
-
background: var(--hi-color-danger, #
|
|
100
|
+
background: var(--hi-color-danger, #a62937);
|
|
101
101
|
color: var(--hi-color-text-on-danger, #fff);
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -112,15 +112,15 @@
|
|
|
112
112
|
// cancel quiets to a translucent outline in the card's own ink (the
|
|
113
113
|
// house grammar for quiet controls on tinted toast surfaces).
|
|
114
114
|
.hk-blocking-toast-info {
|
|
115
|
-
--hk-blocking-toast-ink: var(--hi-color-info, #
|
|
115
|
+
--hk-blocking-toast-ink: var(--hi-color-info, #006274);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
.hk-blocking-toast-warning {
|
|
119
|
-
--hk-blocking-toast-ink: var(--hi-color-warning, #
|
|
119
|
+
--hk-blocking-toast-ink: var(--hi-color-warning, #894800);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
.hk-blocking-toast-danger {
|
|
123
|
-
--hk-blocking-toast-ink: var(--hi-color-danger, #
|
|
123
|
+
--hk-blocking-toast-ink: var(--hi-color-danger, #a62937);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/* The confirm arrives as .hk-btn-primary (info/warning cards) or
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
.hk-blocking-toast-actions .hk-btn-danger {
|
|
133
133
|
background: #fff;
|
|
134
134
|
border-color: transparent;
|
|
135
|
-
color: color-mix(in srgb, var(--hk-blocking-toast-ink, #
|
|
135
|
+
color: color-mix(in srgb, var(--hk-blocking-toast-ink, #006274) 55%, #000);
|
|
136
136
|
|
|
137
137
|
svg {
|
|
138
138
|
color: inherit;
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
.hk-breadcrumb-success {
|
|
400
400
|
.hk-breadcrumb-link {
|
|
401
401
|
&[href]:hover {
|
|
402
|
-
color: var(--hi-color-success);
|
|
402
|
+
color: var(--hi-color-success-fg);
|
|
403
403
|
text-shadow: 0 0 8px var(--hi-color-success);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
.hk-breadcrumb-warning {
|
|
409
409
|
.hk-breadcrumb-link {
|
|
410
410
|
&[href]:hover {
|
|
411
|
-
color: var(--hi-color-warning);
|
|
411
|
+
color: var(--hi-color-warning-fg);
|
|
412
412
|
text-shadow: 0 0 8px var(--hi-color-warning);
|
|
413
413
|
}
|
|
414
414
|
}
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
.hk-breadcrumb-danger {
|
|
418
418
|
.hk-breadcrumb-link {
|
|
419
419
|
&[href]:hover {
|
|
420
|
-
color: var(--hi-color-danger);
|
|
420
|
+
color: var(--hi-color-danger-fg);
|
|
421
421
|
text-shadow: 0 0 8px var(--hi-color-danger);
|
|
422
422
|
}
|
|
423
423
|
}
|
|
@@ -169,11 +169,11 @@
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
&[data-danger] {
|
|
172
|
-
color: rgb(var(--color-error,
|
|
172
|
+
color: rgb(var(--color-error, 166 41 55) / 90%);
|
|
173
173
|
|
|
174
174
|
&:hover:not(:disabled) {
|
|
175
|
-
background: rgb(var(--color-error,
|
|
176
|
-
color: rgb(var(--color-error
|
|
175
|
+
background: rgb(var(--color-error, 166 41 55) / 10%);
|
|
176
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -529,3 +529,182 @@ describe("HkColorSchemeEditor slot kinds", () => {
|
|
|
529
529
|
expect(draft.groups!.light!["editor-kinds"].density).toBe("cozy");
|
|
530
530
|
});
|
|
531
531
|
});
|
|
532
|
+
|
|
533
|
+
describe("HkColorSchemeEditor tone inks follow their fill", () => {
|
|
534
|
+
// editableTokens order: 0 primary, 1 secondary, 2 accent, 3 success,
|
|
535
|
+
// 4 error, 5 warning, 6 info.
|
|
536
|
+
const ERROR_SWATCH = 4;
|
|
537
|
+
|
|
538
|
+
it("re-derives a stale on-tone ink when its fill is retuned", async () => {
|
|
539
|
+
// The prefill carries the DERIVED ink for the old fill (this is what the
|
|
540
|
+
// consumer's seam emits), so it must follow the fill rather than be
|
|
541
|
+
// mistaken for a hand-picked override.
|
|
542
|
+
const { ref } = mountEditor({
|
|
543
|
+
initialDark: {
|
|
544
|
+
primary: { r: 24, g: 24, b: 37 },
|
|
545
|
+
secondary: { r: 167, g: 153, b: 167 },
|
|
546
|
+
accent: { r: 190, g: 149, b: 190 },
|
|
547
|
+
success: { r: 108, g: 177, b: 119 },
|
|
548
|
+
error: { r: 245, g: 115, b: 119 },
|
|
549
|
+
warning: { r: 219, g: 137, b: 69 },
|
|
550
|
+
info: { r: 83, g: 173, b: 193 },
|
|
551
|
+
background: { r: 17, g: 17, b: 27 },
|
|
552
|
+
surface: { r: 49, g: 50, b: 68 },
|
|
553
|
+
text: { r: 205, g: 214, b: 244 },
|
|
554
|
+
muted: { r: 127, g: 132, b: 156 },
|
|
555
|
+
border: { r: 88, g: 91, b: 112 },
|
|
556
|
+
focusedBorder: { r: 137, g: 180, b: 250 },
|
|
557
|
+
selectedBackground: { r: 88, g: 91, b: 112 },
|
|
558
|
+
selectedText: { r: 205, g: 214, b: 244 },
|
|
559
|
+
statusBarBackground: { r: 49, g: 50, b: 68 },
|
|
560
|
+
onDanger: { r: 0, g: 0, b: 0 },
|
|
561
|
+
} as never,
|
|
562
|
+
});
|
|
563
|
+
await nextTick();
|
|
564
|
+
await settle();
|
|
565
|
+
|
|
566
|
+
// Retune error to a deep red: white becomes the readable ink.
|
|
567
|
+
await setSwatchHex(ERROR_SWATCH, "8b0000");
|
|
568
|
+
const draft = ref.value!.getDraft();
|
|
569
|
+
expect(draft.dark.error).toEqual({ r: 0x8b, g: 0, b: 0 });
|
|
570
|
+
expect(draft.dark.onDanger).toEqual({ r: 255, g: 255, b: 255 });
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
it("keeps a hand-picked ink that still READS across a fill retune", async () => {
|
|
574
|
+
// A mid-grey fill is the one case where both inks clear AA, so a pick can
|
|
575
|
+
// differ from the house answer and still be a legitimate design choice.
|
|
576
|
+
const { ref } = mountEditor({
|
|
577
|
+
initialDark: {
|
|
578
|
+
primary: { r: 24, g: 24, b: 37 },
|
|
579
|
+
secondary: { r: 167, g: 153, b: 167 },
|
|
580
|
+
accent: { r: 190, g: 149, b: 190 },
|
|
581
|
+
success: { r: 108, g: 177, b: 119 },
|
|
582
|
+
error: { r: 128, g: 128, b: 128 },
|
|
583
|
+
warning: { r: 219, g: 137, b: 69 },
|
|
584
|
+
info: { r: 83, g: 173, b: 193 },
|
|
585
|
+
background: { r: 17, g: 17, b: 27 },
|
|
586
|
+
surface: { r: 49, g: 50, b: 68 },
|
|
587
|
+
text: { r: 205, g: 214, b: 244 },
|
|
588
|
+
muted: { r: 127, g: 132, b: 156 },
|
|
589
|
+
border: { r: 88, g: 91, b: 112 },
|
|
590
|
+
focusedBorder: { r: 137, g: 180, b: 250 },
|
|
591
|
+
selectedBackground: { r: 88, g: 91, b: 112 },
|
|
592
|
+
selectedText: { r: 205, g: 214, b: 244 },
|
|
593
|
+
statusBarBackground: { r: 49, g: 50, b: 68 },
|
|
594
|
+
onDanger: { r: 0, g: 0, b: 0 }, // house answer is white; black reads too
|
|
595
|
+
} as never,
|
|
596
|
+
});
|
|
597
|
+
await nextTick();
|
|
598
|
+
await settle();
|
|
599
|
+
|
|
600
|
+
await setSwatchHex(ERROR_SWATCH, "8a8a8a");
|
|
601
|
+
const draft = ref.value!.getDraft();
|
|
602
|
+
expect(draft.dark.onDanger).toEqual({ r: 0, g: 0, b: 0 });
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
describe("HkColorSchemeEditor keeps the ONE ink rule (2026-11-12)", () => {
|
|
607
|
+
// editableTokens: 0 primary, 1 secondary, 2 accent, 3 success, 4 error,
|
|
608
|
+
// 5 warning, 6 info.
|
|
609
|
+
const SUCCESS_SWATCH = 3;
|
|
610
|
+
const WARNING_SWATCH = 5;
|
|
611
|
+
|
|
612
|
+
const basePrefill = {
|
|
613
|
+
primary: { r: 24, g: 24, b: 37 },
|
|
614
|
+
secondary: { r: 167, g: 153, b: 167 },
|
|
615
|
+
accent: { r: 190, g: 149, b: 190 },
|
|
616
|
+
error: { r: 245, g: 115, b: 119 },
|
|
617
|
+
info: { r: 83, g: 173, b: 193 },
|
|
618
|
+
background: { r: 17, g: 17, b: 27 },
|
|
619
|
+
surface: { r: 49, g: 50, b: 68 },
|
|
620
|
+
text: { r: 205, g: 214, b: 244 },
|
|
621
|
+
muted: { r: 127, g: 132, b: 156 },
|
|
622
|
+
border: { r: 88, g: 91, b: 112 },
|
|
623
|
+
focusedBorder: { r: 137, g: 180, b: 250 },
|
|
624
|
+
selectedBackground: { r: 88, g: 91, b: 112 },
|
|
625
|
+
selectedText: { r: 205, g: 214, b: 244 },
|
|
626
|
+
statusBarBackground: { r: 49, g: 50, b: 68 },
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
it("re-derives the ink when a retune makes it unreadable", async () => {
|
|
630
|
+
// The stored ink reads on the old fill; only the NEW fill makes it
|
|
631
|
+
// unreadable (white on a pale amber ≈1.1:1), so the house rule takes over.
|
|
632
|
+
const { ref } = mountEditor({
|
|
633
|
+
initialDark: {
|
|
634
|
+
...basePrefill,
|
|
635
|
+
success: { r: 16, g: 185, b: 129 },
|
|
636
|
+
warning: { r: 245, g: 158, b: 11 },
|
|
637
|
+
onSuccess: { r: 255, g: 255, b: 255 }, // solidInk(#10B981)
|
|
638
|
+
} as never,
|
|
639
|
+
});
|
|
640
|
+
await nextTick();
|
|
641
|
+
await settle();
|
|
642
|
+
|
|
643
|
+
// A LIGHT fill: the house rule flips to black here.
|
|
644
|
+
await setSwatchHex(SUCCESS_SWATCH, "ffe08a");
|
|
645
|
+
const draft = ref.value!.getDraft();
|
|
646
|
+
expect(draft.dark.success).toEqual({ r: 0xff, g: 0xe0, b: 0x8a });
|
|
647
|
+
expect(draft.dark.onSuccess).toEqual({ r: 0, g: 0, b: 0 });
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
it("heals to the HOUSE answer even where it is under AA", async () => {
|
|
651
|
+
// Mid greys are the known gap: solidInk says white (3.95:1 on #808080)
|
|
652
|
+
// while black measures 5.32:1. The editor does NOT override the house
|
|
653
|
+
// rule here — `tokensToCSSVars` derives the same fill through solidInk, so
|
|
654
|
+
// a second rule would make the stored and derived paths disagree. Fixing
|
|
655
|
+
// this band means fixing the FILL, not the ink rule.
|
|
656
|
+
const { ref } = mountEditor({
|
|
657
|
+
initialDark: {
|
|
658
|
+
...basePrefill,
|
|
659
|
+
success: { r: 16, g: 185, b: 129 },
|
|
660
|
+
warning: { r: 245, g: 158, b: 11 },
|
|
661
|
+
error: { r: 128, g: 128, b: 128 },
|
|
662
|
+
onDanger: { r: 255, g: 255, b: 255 },
|
|
663
|
+
} as never,
|
|
664
|
+
});
|
|
665
|
+
await nextTick();
|
|
666
|
+
await settle();
|
|
667
|
+
|
|
668
|
+
const draft = ref.value!.getDraft();
|
|
669
|
+
expect(draft.dark.onDanger).toEqual({ r: 255, g: 255, b: 255 });
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
it("leaves an ABSENT ink absent (never materialises the house rule)", async () => {
|
|
673
|
+
// Stock presets omit the inks; tokensToCSSVars derives them downstream.
|
|
674
|
+
// Writing one here would freeze the MUST_STAY_WHITE set into the draft.
|
|
675
|
+
const { ref } = mountEditor({
|
|
676
|
+
initialDark: {
|
|
677
|
+
...basePrefill,
|
|
678
|
+
success: { r: 16, g: 185, b: 129 },
|
|
679
|
+
warning: { r: 245, g: 158, b: 11 },
|
|
680
|
+
} as never,
|
|
681
|
+
});
|
|
682
|
+
await nextTick();
|
|
683
|
+
await settle();
|
|
684
|
+
|
|
685
|
+
await setSwatchHex(WARNING_SWATCH, "8a4b00");
|
|
686
|
+
const draft = ref.value!.getDraft();
|
|
687
|
+
expect(draft.dark.warning).toEqual({ r: 0x8a, g: 0x4b, b: 0 });
|
|
688
|
+
expect(draft.dark.onWarning).toBeUndefined();
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
it("heals an ink saved in the BROKEN state (unreadable on its fill)", async () => {
|
|
692
|
+
// A theme written while the stale-ink bug was live carries black on a deep
|
|
693
|
+
// red (2.10:1). The editor renders no picker for these slots, so without a
|
|
694
|
+
// heal it would stay unreadable forever. Any re-derivation pass fixes it.
|
|
695
|
+
const { ref } = mountEditor({
|
|
696
|
+
initialDark: {
|
|
697
|
+
...basePrefill,
|
|
698
|
+
success: { r: 16, g: 185, b: 129 },
|
|
699
|
+
warning: { r: 245, g: 158, b: 11 },
|
|
700
|
+
error: { r: 0x8b, g: 0, b: 0 },
|
|
701
|
+
onDanger: { r: 0, g: 0, b: 0 },
|
|
702
|
+
} as never,
|
|
703
|
+
});
|
|
704
|
+
await nextTick();
|
|
705
|
+
await settle();
|
|
706
|
+
|
|
707
|
+
const draft = ref.value!.getDraft();
|
|
708
|
+
expect(draft.dark.onDanger).toEqual({ r: 255, g: 255, b: 255 });
|
|
709
|
+
});
|
|
710
|
+
});
|
|
@@ -28,7 +28,10 @@ import {
|
|
|
28
28
|
// the preset table through "@celestia-island/hikari" would close a loop whose
|
|
29
29
|
// module-init order decides whether the table exists yet. Theme-internal
|
|
30
30
|
// modules never import components, so this edge cannot loop.
|
|
31
|
-
import { stockDefaultPreset, themePresets } from "../theme";
|
|
31
|
+
import { solidInk, stockDefaultPreset, themePresets } from "../theme";
|
|
32
|
+
// The ONE contrast implementation lives in the derivation module; the editor
|
|
33
|
+
// must not grow a second copy of it.
|
|
34
|
+
import { contrastRatio } from "../theme/semanticPalette";
|
|
32
35
|
|
|
33
36
|
import "./HkColorSchemeDialog.scss";
|
|
34
37
|
|
|
@@ -81,6 +84,28 @@ const toneInkTokens: Array<"onDanger" | "onSuccess" | "onWarning" | "onInfo"> =
|
|
|
81
84
|
];
|
|
82
85
|
const WHITE: ThemeTokenRGB = { r: 255, g: 255, b: 255 };
|
|
83
86
|
|
|
87
|
+
/** Each per-tone ink follows the tone fill it reads on. */
|
|
88
|
+
const toneFillOf: Record<(typeof toneInkTokens)[number], RequiredTokenKey> = {
|
|
89
|
+
onDanger: "error",
|
|
90
|
+
onSuccess: "success",
|
|
91
|
+
onWarning: "warning",
|
|
92
|
+
onInfo: "info",
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The ink for a tone fill — the HOUSE rule (`solidInk`, user direction
|
|
98
|
+
* 2026-11-12): white by default, black only when the fill is light enough to
|
|
99
|
+
* need it. Deliberately NOT "whichever side wins the WCAG ratio"; the
|
|
100
|
+
* contract test in presets owns that decision, and this editor must not
|
|
101
|
+
* grow a second ink rule.
|
|
102
|
+
*/
|
|
103
|
+
function toneInkOn(fill: ThemeTokenRGB): ThemeTokenRGB {
|
|
104
|
+
return solidInk(fill);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
84
109
|
function clamp(v: number): number {
|
|
85
110
|
return Math.max(0, Math.min(255, v));
|
|
86
111
|
}
|
|
@@ -202,6 +227,25 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
202
227
|
}
|
|
203
228
|
}
|
|
204
229
|
|
|
230
|
+
function rederiveToneInks(mode: "dark" | "light"): void {
|
|
231
|
+
const target = mode === "dark" ? dark : light;
|
|
232
|
+
for (const inkKey of toneInkTokens) {
|
|
233
|
+
const fillKey = toneFillOf[inkKey];
|
|
234
|
+
const fill = target[fillKey];
|
|
235
|
+
if (!fill) continue;
|
|
236
|
+
const stored = target[inkKey];
|
|
237
|
+
// ABSENT stays absent: `tokensToCSSVars` already derives it through
|
|
238
|
+
// solidInk, and materialising one here would freeze the house rule's
|
|
239
|
+
// output into the draft (the MUST_STAY_WHITE set).
|
|
240
|
+
if (stored == null) continue;
|
|
241
|
+
// A stored ink survives as long as it still READS on its fill. Once it
|
|
242
|
+
// does not (a retune moved the fill, or the theme was saved while the
|
|
243
|
+
// stale-ink bug was live), it is not a design choice — it is an
|
|
244
|
+
// unreadable label — so the house-rule ink takes over.
|
|
245
|
+
if (contrastRatio(stored, fill) < 4.5) target[inkKey] = toneInkOn(fill);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
205
249
|
function rederiveSurface() {
|
|
206
250
|
const target = modeTab.value === "dark" ? dark : light;
|
|
207
251
|
const derived = deriveSurface(target, modeTab.value === "dark");
|
|
@@ -210,6 +254,12 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
210
254
|
});
|
|
211
255
|
}
|
|
212
256
|
|
|
257
|
+
function rederiveAllDerived(): void {
|
|
258
|
+
rederiveToneInks("dark");
|
|
259
|
+
rederiveToneInks("light");
|
|
260
|
+
rederiveSurface();
|
|
261
|
+
}
|
|
262
|
+
|
|
213
263
|
function reset(): void {
|
|
214
264
|
modeTab.value = useTheme().effectiveMode.value;
|
|
215
265
|
themeName.value = props.initialName ?? t("hikari::theme.customThemeName");
|
|
@@ -230,6 +280,11 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
230
280
|
}
|
|
231
281
|
seedGroups(groupDark, "dark", props.initialGroups?.dark);
|
|
232
282
|
seedGroups(groupLight, "light", props.initialGroups?.light);
|
|
283
|
+
// Heal any stored ink that no longer reads on its fill (the bug's saved
|
|
284
|
+
// state). Readable inks — including a consumer's own derivation — are
|
|
285
|
+
// left exactly as they are.
|
|
286
|
+
rederiveToneInks("dark");
|
|
287
|
+
rederiveToneInks("light");
|
|
233
288
|
rederiveSurface();
|
|
234
289
|
}
|
|
235
290
|
|
|
@@ -246,7 +301,7 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
246
301
|
dark.primary, dark.secondary, dark.accent, dark.success, dark.error, dark.warning, dark.info,
|
|
247
302
|
light.primary, light.secondary, light.accent, light.success, light.error, light.warning, light.info,
|
|
248
303
|
],
|
|
249
|
-
() =>
|
|
304
|
+
() => rederiveAllDerived(),
|
|
250
305
|
{ deep: true },
|
|
251
306
|
);
|
|
252
307
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
.hk-currency-select-required {
|
|
28
28
|
margin-inline-start: var(--space-2);
|
|
29
|
-
color: rgb(var(--color-error));
|
|
29
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.hk-currency-select-trigger {
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
.hk-currency-select-error {
|
|
135
135
|
margin-top: var(--space-4);
|
|
136
136
|
font-size: var(--text-xs);
|
|
137
|
-
color: rgb(var(--color-error));
|
|
137
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/* ── opened surface content ──────────────────────────────────────── */
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
background: rgb(var(--color-success) / 12%);
|
|
41
41
|
|
|
42
42
|
.hk-diff-viewer__sign {
|
|
43
|
-
color: rgb(var(--color-success));
|
|
43
|
+
color: var(--hi-color-success-fg, rgb(var(--color-success)));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
background: rgb(var(--color-error) / 12%);
|
|
49
49
|
|
|
50
50
|
.hk-diff-viewer__sign {
|
|
51
|
-
color: rgb(var(--color-error));
|
|
51
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -131,11 +131,11 @@
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
em[data-kind="add"] {
|
|
134
|
-
color: rgb(var(--color-success));
|
|
134
|
+
color: var(--hi-color-success-fg, rgb(var(--color-success)));
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
em[data-kind="del"] {
|
|
138
|
-
color: rgb(var(--color-error));
|
|
138
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
|
|
172
172
|
&[data-state="failed"] {
|
|
173
173
|
background: rgb(var(--color-error) / 8%);
|
|
174
|
-
color: rgb(var(--color-error));
|
|
174
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// Without a loadContext fetcher the row is a passive divider.
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
padding: var(--space-12, 0.75rem);
|
|
18
18
|
|
|
19
19
|
&__icon {
|
|
20
|
-
color: var(--hi-color-warning, rgb(var(--color-warning
|
|
20
|
+
color: var(--hi-color-warning-fg, rgb(var(--color-warning)));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&.is-danger &__icon {
|
|
24
|
-
color: var(--hi-color-
|
|
24
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&__title {
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
.hk-file-browser-rename-error {
|
|
320
320
|
flex-basis: 100%;
|
|
321
321
|
font-size: var(--text-xs);
|
|
322
|
-
color: rgb(var(--color-error));
|
|
322
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// ------
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
border: 1px solid var(--c-error-strong);
|
|
365
365
|
border-radius: var(--radius-md);
|
|
366
366
|
background: var(--c-error-dim);
|
|
367
|
-
color: rgb(var(--color-error));
|
|
367
|
+
color: var(--hi-color-danger-fg, rgb(var(--color-error)));
|
|
368
368
|
font-size: var(--text-sm);
|
|
369
369
|
}
|
|
370
370
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
.hk-file-field-required {
|
|
15
15
|
margin-inline-start: var(--space-4);
|
|
16
|
-
color: var(--hi-color-danger, #
|
|
16
|
+
color: var(--hi-color-danger-fg, #a62937);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.hk-file-box {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&[data-error] {
|
|
37
|
-
border-color: var(--hi-color-danger, #
|
|
37
|
+
border-color: var(--hi-color-danger, #a62937);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
&[data-disabled] {
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
.hk-file-field-error {
|
|
128
|
-
color: var(--hi-color-danger, #
|
|
128
|
+
color: var(--hi-color-danger-fg, #a62937);
|
|
129
129
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&[data-error] {
|
|
38
|
-
border-color: var(--hi-color-danger, #
|
|
38
|
+
border-color: var(--hi-color-danger, #a62937);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
&[data-disabled] {
|
|
@@ -94,6 +94,6 @@
|
|
|
94
94
|
color: rgb(var(--color-text) / 60%);
|
|
95
95
|
|
|
96
96
|
&[data-error] {
|
|
97
|
-
color: var(--hi-color-danger, #
|
|
97
|
+
color: var(--hi-color-danger-fg, #a62937);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
|
|
102
102
|
// Use theme success color
|
|
103
103
|
.hk-icon-success {
|
|
104
|
-
color: var(--hi-color-success);
|
|
104
|
+
color: var(--hi-color-success-fg);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Use theme warning color
|
|
108
108
|
.hk-icon-warning {
|
|
109
|
-
color: var(--hi-color-warning);
|
|
109
|
+
color: var(--hi-color-warning-fg);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// Use theme danger color
|
|
113
113
|
.hk-icon-danger {
|
|
114
|
-
color: var(--hi-color-danger);
|
|
114
|
+
color: var(--hi-color-danger-fg);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// Use secondary text color
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
height: var(--space-24, 1.5rem);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.hk-icon-chip-tone-success { background: rgb(var(--color-success) / 12%); color: rgb(var(--color-success)); }
|
|
23
|
-
.hk-icon-chip-tone-warning { background: rgb(var(--color-warning) / 12%); color: rgb(var(--color-warning)); }
|
|
24
|
-
.hk-icon-chip-tone-error { background: rgb(var(--color-error) / 12%); color: rgb(var(--color-error)); }
|
|
25
|
-
.hk-icon-chip-tone-info { background: rgb(var(--color-info, rgb(var(--color-primary))) / 12%); color:
|
|
22
|
+
.hk-icon-chip-tone-success { background: rgb(var(--color-success) / 12%); color: var(--hi-color-success-fg, rgb(var(--color-success))); }
|
|
23
|
+
.hk-icon-chip-tone-warning { background: rgb(var(--color-warning) / 12%); color: var(--hi-color-warning-fg, rgb(var(--color-warning))); }
|
|
24
|
+
.hk-icon-chip-tone-error { background: rgb(var(--color-error) / 12%); color: var(--hi-color-danger-fg, rgb(var(--color-error))); }
|
|
25
|
+
.hk-icon-chip-tone-info { background: rgb(var(--color-info, rgb(var(--color-primary))) / 12%); color: var(--hi-color-info-fg, rgb(var(--color-info))); }
|
|
26
26
|
.hk-icon-chip-tone-primary { background: rgb(var(--color-primary) / 12%); color: rgb(var(--color-primary)); }
|
|
27
27
|
.hk-icon-chip-tone-muted { background: rgb(var(--color-muted) / 12%); color: rgb(var(--color-muted)); }
|