@celestia-island/hikari 0.55.486 → 0.55.491
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/HkAdminHeader.d.ts +1 -1
- package/dist/types/components/HkAffixPicker.d.ts +2 -2
- package/dist/types/components/HkColorSchemeEditor.d.ts +50 -0
- package/dist/types/components/HkCurrencySelect.d.ts +1 -1
- package/dist/types/components/HkHeaderPicker.d.ts +1 -1
- package/dist/types/components/HkTable.d.ts +1 -1
- package/dist/types/components/HkTagInput.d.ts +1 -1
- package/dist/types/i18n/localeCatalog.d.ts +8 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/theme/index.d.ts +2 -0
- package/dist/types/theme/presets.d.ts +22 -17
- package/dist/types/theme/themeName.d.ts +13 -0
- package/dist/types/theme/themeVarsCss.d.ts +42 -0
- package/dist/types/theme/useTheme.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/HkColorSchemeEditor.test.ts +71 -0
- package/src/components/HkColorSchemeEditor.tsx +81 -7
- package/src/components/HkMenu.test.ts +39 -0
- package/src/components/HkMenu.tsx +43 -10
- package/src/components/HkThemePanelContent.names.test.ts +95 -0
- package/src/components/HkThemePanelContent.tsx +13 -6
- package/src/i18n/localeCatalog.parity.test.ts +41 -0
- package/src/i18n/localeCatalog.ts +34 -0
- package/src/i18n/locales/ar/components.json +1 -0
- package/src/i18n/locales/de/components.json +1 -0
- package/src/i18n/locales/en/components.json +1 -0
- package/src/i18n/locales/es/components.json +1 -0
- package/src/i18n/locales/fr/components.json +1 -0
- package/src/i18n/locales/ja/components.json +1 -0
- package/src/i18n/locales/ko/components.json +1 -0
- package/src/i18n/locales/pt/components.json +1 -0
- package/src/i18n/locales/ru/components.json +1 -0
- package/src/i18n/locales/zh-Hans/components.json +1 -0
- package/src/i18n/locales/zh-Hant/components.json +1 -0
- package/src/index.ts +6 -0
- package/src/styles/theme-vars.css +75 -73
- package/src/theme/index.ts +2 -0
- package/src/theme/presets.ts +28 -89
- package/src/theme/stock-preset.json +1 -0
- package/src/theme/stock-vars.json +1 -0
- package/src/theme/themeName.test.ts +69 -0
- package/src/theme/themeName.ts +80 -0
- package/src/theme/themeVarsCss.contract.test.ts +35 -1
- package/src/theme/themeVarsCss.ts +25 -9
|
@@ -500,8 +500,8 @@ export declare const HkAdminHeader: import("vue").DefineComponent<import("vue").
|
|
|
500
500
|
[key: string]: any;
|
|
501
501
|
}>[];
|
|
502
502
|
username: string;
|
|
503
|
-
currentLocale: string;
|
|
504
503
|
localeOptions: LocaleOption[];
|
|
504
|
+
currentLocale: string;
|
|
505
505
|
avatarUrl: string;
|
|
506
506
|
showHamburger: boolean;
|
|
507
507
|
chrome: boolean;
|
|
@@ -285,15 +285,15 @@ export declare const HkAffixPicker: import("vue").DefineComponent<import("vue").
|
|
|
285
285
|
disabled: boolean;
|
|
286
286
|
side: "suffix" | "prefix";
|
|
287
287
|
activeKey: string;
|
|
288
|
-
searchable: boolean;
|
|
289
|
-
emptyText: string;
|
|
290
288
|
selected: string | readonly string[];
|
|
289
|
+
searchable: boolean;
|
|
291
290
|
allowCustom: boolean;
|
|
292
291
|
confirmRemove: boolean;
|
|
293
292
|
tagValues: Record<string, string>;
|
|
294
293
|
tagUnsetText: string;
|
|
295
294
|
closeOnSelect: boolean;
|
|
296
295
|
searchPlaceholder: string;
|
|
296
|
+
emptyText: string;
|
|
297
297
|
chipClass: string;
|
|
298
298
|
chipLabel: string;
|
|
299
299
|
}, SlotsType<{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
2
|
import { type ThemeSchemeTokens, type ThemeTokenGroupModes } from "@celestia-island/hikari";
|
|
3
|
+
import { type HkLocaleOption } from "./HkLocalizedInput";
|
|
3
4
|
import "./HkColorSchemeDialog.scss";
|
|
4
5
|
/**
|
|
5
6
|
* HCustomTheme — custom color scheme payload, structurally identical to
|
|
@@ -9,6 +10,9 @@ import "./HkColorSchemeDialog.scss";
|
|
|
9
10
|
export interface HCustomTheme {
|
|
10
11
|
id: string;
|
|
11
12
|
name: string;
|
|
13
|
+
/** Per-locale name translations (2026-11-25 user direction: theme
|
|
14
|
+
* names are i18n citizens) — present when the author filled any. */
|
|
15
|
+
nameI18n?: Record<string, string>;
|
|
12
16
|
dark: ThemeSchemeTokens;
|
|
13
17
|
light: ThemeSchemeTokens;
|
|
14
18
|
/** Extension token group values (both modes), present when groups are registered. */
|
|
@@ -58,6 +62,28 @@ export declare const HkColorSchemeEditor: import("vue").DefineComponent<import("
|
|
|
58
62
|
type: StringConstructor;
|
|
59
63
|
default: string;
|
|
60
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Prefill the per-locale name translations (edit flows — the map a
|
|
67
|
+
* saved custom theme carries). Empty by default: a blank canvas has
|
|
68
|
+
* no translations yet.
|
|
69
|
+
*/
|
|
70
|
+
initialNameI18n: {
|
|
71
|
+
type: PropType<Record<string, string>>;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* The language catalog the localized-name editor offers. Defaults to
|
|
76
|
+
* hikari's own catalog (HK_LOCALE_CATALOG — every language hikari
|
|
77
|
+
* ships); hosts with an app-level i18n config pass the SAME list
|
|
78
|
+
* their global language switcher uses.
|
|
79
|
+
*/
|
|
80
|
+
localeOptions: {
|
|
81
|
+
type: PropType<HkLocaleOption[]>;
|
|
82
|
+
default: () => {
|
|
83
|
+
code: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}[];
|
|
86
|
+
};
|
|
61
87
|
/**
|
|
62
88
|
* Render the built-in name input. Hosts that own the name field
|
|
63
89
|
* elsewhere (e.g. a "basic" tab above the editor) hide it and feed the
|
|
@@ -88,6 +114,28 @@ export declare const HkColorSchemeEditor: import("vue").DefineComponent<import("
|
|
|
88
114
|
type: StringConstructor;
|
|
89
115
|
default: string;
|
|
90
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Prefill the per-locale name translations (edit flows — the map a
|
|
119
|
+
* saved custom theme carries). Empty by default: a blank canvas has
|
|
120
|
+
* no translations yet.
|
|
121
|
+
*/
|
|
122
|
+
initialNameI18n: {
|
|
123
|
+
type: PropType<Record<string, string>>;
|
|
124
|
+
default: undefined;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The language catalog the localized-name editor offers. Defaults to
|
|
128
|
+
* hikari's own catalog (HK_LOCALE_CATALOG — every language hikari
|
|
129
|
+
* ships); hosts with an app-level i18n config pass the SAME list
|
|
130
|
+
* their global language switcher uses.
|
|
131
|
+
*/
|
|
132
|
+
localeOptions: {
|
|
133
|
+
type: PropType<HkLocaleOption[]>;
|
|
134
|
+
default: () => {
|
|
135
|
+
code: string;
|
|
136
|
+
label: string;
|
|
137
|
+
}[];
|
|
138
|
+
};
|
|
91
139
|
/**
|
|
92
140
|
* Render the built-in name input. Hosts that own the name field
|
|
93
141
|
* elsewhere (e.g. a "basic" tab above the editor) hide it and feed the
|
|
@@ -98,9 +146,11 @@ export declare const HkColorSchemeEditor: import("vue").DefineComponent<import("
|
|
|
98
146
|
default: boolean;
|
|
99
147
|
};
|
|
100
148
|
}>> & Readonly<{}>, {
|
|
149
|
+
localeOptions: HkLocaleOption[];
|
|
101
150
|
initialDark: ThemeSchemeTokens;
|
|
102
151
|
initialLight: ThemeSchemeTokens;
|
|
103
152
|
initialGroups: ThemeTokenGroupModes;
|
|
104
153
|
initialName: string;
|
|
154
|
+
initialNameI18n: Record<string, string>;
|
|
105
155
|
showName: boolean;
|
|
106
156
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -143,7 +143,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
143
143
|
required: boolean;
|
|
144
144
|
modelValue: string;
|
|
145
145
|
placeholder: string;
|
|
146
|
-
currencies: HkCurrency[];
|
|
147
146
|
searchable: boolean;
|
|
147
|
+
currencies: HkCurrency[];
|
|
148
148
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
149
149
|
export default _default;
|
|
@@ -154,8 +154,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
154
154
|
};
|
|
155
155
|
}>> & Readonly<{
|
|
156
156
|
"onUpdate:modelValue"?: ((_value: string) => any) | undefined;
|
|
157
|
-
onReorder?: ((_fromIndex: number, _toIndex: number) => any) | undefined;
|
|
158
157
|
onRemove?: ((_value: string) => any) | undefined;
|
|
158
|
+
onReorder?: ((_fromIndex: number, _toIndex: number) => any) | undefined;
|
|
159
159
|
onEdit?: ((_value: string) => any) | undefined;
|
|
160
160
|
}>, {
|
|
161
161
|
options: HkPickerOption[];
|
|
@@ -287,6 +287,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
287
287
|
draggable: boolean;
|
|
288
288
|
hover: boolean;
|
|
289
289
|
rows: readonly object[];
|
|
290
|
+
emptyText: string;
|
|
290
291
|
rowKey: string;
|
|
291
292
|
bordered: boolean;
|
|
292
293
|
striped: boolean;
|
|
@@ -294,6 +295,5 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
294
295
|
selectable: boolean;
|
|
295
296
|
copyCells: boolean;
|
|
296
297
|
manageable: HkRowManageGate;
|
|
297
|
-
emptyText: string;
|
|
298
298
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
299
299
|
export default _default;
|
|
@@ -300,9 +300,9 @@ export declare const HkTagInput: import("vue").DefineComponent<import("vue").Ext
|
|
|
300
300
|
modelValue: readonly string[];
|
|
301
301
|
placeholder: string;
|
|
302
302
|
hint: string;
|
|
303
|
-
emptyText: string;
|
|
304
303
|
allowCustom: boolean;
|
|
305
304
|
searchPlaceholder: string;
|
|
305
|
+
emptyText: string;
|
|
306
306
|
maxTags: number;
|
|
307
307
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
308
308
|
export default HkTagInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** One catalog entry: the locale code (`setLocale` accepts it verbatim)
|
|
2
|
+
* and the language's endonym — its own name for itself, the SAME text a
|
|
3
|
+
* language switcher row shows. */
|
|
4
|
+
export interface HkLocaleCatalogEntry {
|
|
5
|
+
code: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const HK_LOCALE_CATALOG: readonly HkLocaleCatalogEntry[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ export { LightingRig, type Board3DLightingDescriptor, type Board3DLightPoint, ty
|
|
|
171
171
|
export { renderTrendChartSvg, trendGeometry, trendHeightPx, trendPenColor, trendWindowEnd, trendPolyline, trendAreaPath, TREND_CHART_WIDTH, TREND_CHART_HEIGHT, TREND_CHART_TIME_WINDOW_MS, TREND_CHART_GRID_LEFT, TREND_CHART_GRID_RIGHT, TREND_CHART_GRID_TOP, TREND_CHART_GRID_BOTTOM, TREND_THRESHOLD_DASHED, TREND_THRESHOLD_DOTTED, TREND_THRESHOLD_HH_COLOR, TREND_THRESHOLD_H_COLOR, TREND_THRESHOLD_L_COLOR, TREND_THRESHOLD_LL_COLOR, type RenderTrendChartOptions, type TrendPen, type TrendPoint, type AlarmThresholds, type TrendCoord, type TrendFrame, type TrendPenGeometry, type TrendThresholdLine, type TrendGeometry, } from "./components/trendGeometry";
|
|
172
172
|
export { type HkTreemapNode, type HkTreemapValueFormatter } from "./components/HkTreemap";
|
|
173
173
|
export { default as HkThemeDecor, type HkThemeDecorSize } from "./components/HkThemeDecor";
|
|
174
|
-
export { initTheme, useTheme, themePresets, tokensToCSSVars, getThemeTokens, loadCustomThemes, saveCustomThemes, addCustomTheme, removeCustomTheme, registerTokenGroup, getTokenGroups, resolveGroupTokens, clampToSlot, clampRgbToBands, clampHue, hueDelta, wrapHue, groupTokensToCSSVars, rgbToHsl, hslToRgb, tokenGroupsVersion, tokenGroupSlotKind, tokenGroupSlotCssVar, isColorSlot, isNumberSlot, isEnumSlot, registerStandardThemeGroups, STANDARD_SHAPE_GROUP_ID, registerStandardThemeDecor, STANDARD_THEME_DECOR_SLOTS, registerThemeDecor, registerThemeDecorBuiltin, getThemeDecor, themeDecorSlots, themeDecorVersion, isThemeDecorSlot, THEME_DECOR_SLOT_PATTERN, THEME_DECOR_WILDCARD, allGroupSlots, resolveLocalizedText, parseTokenGroupConfig, registerTokenGroupConfig, startLuminanceSampler, stopLuminanceSampler, sampleLuminanceNow, invalidateLuminanceCache, registerWallpaperSurfaceSources, resolveWallpaperSurfaceElement, retainLuminanceSampler, releaseLuminanceSampler, luminanceSamplerRefCount, type WallpaperSurfaceKind, type WallpaperSurfaceSources, getTimePeriod, getGeolocation, solarAltitude, DEFAULT_GEO_LOCATION, timezoneFallback, setGeolocationProvider, refreshThemeClock, stopThemeClock, SOLAR_LOCATION_STRATEGY_STORAGE_KEY, SOLAR_MANUAL_LOCATION_STORAGE_KEY, hydrateSolarLocationState, solarLocationStrategy, setSolarLocationStrategy, solarManualLocation, setSolarManualLocation, manualLocationOf, listTimeZones, systemTimeZoneId, initFontContext, applyFontContext, resetFontContext, useFontContext, HIKARI_FONT_SANS, HIKARI_FONT_MONO, HIKARI_FONT_READING, type ThemeTokenRGB, type ThemeSchemeTokens, type ThemePreset, type ThemeMode, type ThemeId, type ThemeTokens, type CustomThemePreset, type TimePeriod, type GeoLocation, type GeoLocationProvider, type SolarLocationStrategy, type SolarHemisphere, type SolarManualLocation, type ThemeTokenGroupValues, type ThemeTokenGroupModes, type ThemeTokenValue, type TokenGroupDefinition, type TokenGroupSlot, type TokenGroupSection, type HueClamp, type TokenGroupSlotKind, type TokenColorSlot, type TokenNumberSlot, type TokenEnumSlot, type ResolvedGroupTokens, type ColorHSL, type LocalizedText, type ParseTokenGroupResult, type ThemeDecorSlot, type ThemeDecorRegistration, type ThemeDecorBuiltinRegistration, type FontContextOverrides, } from "./theme";
|
|
174
|
+
export { initTheme, useTheme, themePresets, tokensToCSSVars, getThemeTokens, loadCustomThemes, saveCustomThemes, addCustomTheme, removeCustomTheme, registerTokenGroup, getTokenGroups, resolveGroupTokens, clampToSlot, clampRgbToBands, clampHue, hueDelta, wrapHue, groupTokensToCSSVars, rgbToHsl, hslToRgb, tokenGroupsVersion, tokenGroupSlotKind, tokenGroupSlotCssVar, isColorSlot, isNumberSlot, isEnumSlot, registerStandardThemeGroups, STANDARD_SHAPE_GROUP_ID, registerStandardThemeDecor, STANDARD_THEME_DECOR_SLOTS, registerThemeDecor, registerThemeDecorBuiltin, getThemeDecor, themeDecorSlots, themeDecorVersion, isThemeDecorSlot, THEME_DECOR_SLOT_PATTERN, THEME_DECOR_WILDCARD, allGroupSlots, resolveLocalizedText, parseTokenGroupConfig, registerTokenGroupConfig, startLuminanceSampler, stopLuminanceSampler, sampleLuminanceNow, invalidateLuminanceCache, registerWallpaperSurfaceSources, resolveWallpaperSurfaceElement, retainLuminanceSampler, releaseLuminanceSampler, luminanceSamplerRefCount, type WallpaperSurfaceKind, type WallpaperSurfaceSources, getTimePeriod, getGeolocation, solarAltitude, DEFAULT_GEO_LOCATION, timezoneFallback, setGeolocationProvider, refreshThemeClock, stopThemeClock, SOLAR_LOCATION_STRATEGY_STORAGE_KEY, SOLAR_MANUAL_LOCATION_STORAGE_KEY, hydrateSolarLocationState, solarLocationStrategy, setSolarLocationStrategy, solarManualLocation, setSolarManualLocation, manualLocationOf, listTimeZones, systemTimeZoneId, initFontContext, applyFontContext, resetFontContext, useFontContext, resolveThemeDisplayName, resolveThemeDisplayNameT, HIKARI_FONT_SANS, HIKARI_FONT_MONO, HIKARI_FONT_READING, type ThemeTokenRGB, type ThemeSchemeTokens, type ThemePreset, type ThemeMode, type ThemeId, type ThemeTokens, type CustomThemePreset, type TimePeriod, type ThemeNameI18n, type GeoLocation, type GeoLocationProvider, type SolarLocationStrategy, type SolarHemisphere, type SolarManualLocation, type ThemeTokenGroupValues, type ThemeTokenGroupModes, type ThemeTokenValue, type TokenGroupDefinition, type TokenGroupSlot, type TokenGroupSection, type HueClamp, type TokenGroupSlotKind, type TokenColorSlot, type TokenNumberSlot, type TokenEnumSlot, type ResolvedGroupTokens, type ColorHSL, type LocalizedText, type ParseTokenGroupResult, type ThemeDecorSlot, type ThemeDecorRegistration, type ThemeDecorBuiltinRegistration, type FontContextOverrides, } from "./theme";
|
|
175
175
|
export { deriveSemanticPalette, CANONICAL_SEMANTIC, contrastRatio, hueDistance, rgbToOklch, oklchToRgb } from "./theme/semanticPalette";
|
|
176
176
|
export type { SemanticPalette, SemanticFills, OKLCH } from "./theme/semanticPalette";
|
|
177
177
|
export { FALLBACK_WALLPAPER_ID, DEFAULT_WALLPAPER_ID, DEFAULT_PRESETS, DEFAULT_DISPLAY_SETTINGS, DEFAULT_WALLPAPER_STORAGE_PREFIX, registerWallpaperPack, configureWallpaperStorage, wallpaperStorageKey, isWallpaperSource, isTimeAware, loadActiveWallpaperId, hasStoredWallpaperId, saveActiveWallpaperId, loadCustomWallpapers, saveCustomWallpapers, addCustomWallpaper, removeCustomWallpaper, updateCustomWallpaper, loadCachedGeolocation, saveCachedGeolocation, loadDisplaySettings, saveDisplaySettings, getDisplaySettings, setDisplaySettings, buildWallpaperFilter, initWallpaper, destroyWallpaper, useWallpaper, ensureWallpaperState, configureWallpaper, registerWallpaperBrandDefaults, registerServerThemeWallpaper, brandDefaultWallpaperFor, resolveThemeFollowSwitch, setWallpaperPipelineLookup, geo, currentPeriod, hasStorage, readStorageItem, writeStorageItem, removeStorageItem, type WallpaperType, type SolidSource, type ImageSource, type VideoSource, type PipelineSource, type WallpaperSource, type TimeAwareWallpaper, type WallpaperPreset, type WallpaperPackEntry, type CustomWallpaper, type WallpaperPosition, type WallpaperScale, type WallpaperEffect, type WallpaperDisplaySettings, type WallpaperStorageSlot, type WallpaperStorageConfig, type WallpaperInitConfig, type WallpaperPipelineLookup, type WallpaperPipelinePreset, } from "./theme";
|
|
@@ -179,6 +179,7 @@ export { registerShaderPresets, getShaderPreset, listShaderPresetIds, SHADER_VER
|
|
|
179
179
|
export { default as HkWallpaperBackdrop, WALLPAPER_REDUCED_MOTION_QUERY, type HkWallpaperBackdropMode, type HkWallpaperSurface, type HkWallpaperSurfaceContext, type HkWallpaperSurfaceFactory, } from "./components/HkWallpaperBackdrop";
|
|
180
180
|
export { onFrame, onceFrame, scheduleFrame, scheduleEvery, scheduleAfter, scheduleCron, scheduleCronAfter, scheduleInterval, scheduleIntervalAfter, reportTransition, setReducedMotion, notifyScrollStart, useOverlay, hasLiveWindow, isWindowEntry, topWindowZ, usePopupManager, POPUP_Z_BANDS, POPUP_Z_STEP, useToast, useConfirm, useBlockingToast, showBlockingToast, resolveBlockingToast, clearBlockingToasts, useEmergencyAlert, raiseEmergencyAlert, clearEmergencyAlert, snoozeEmergencyAlert, unsnoozeEmergencyAlert, resetEmergencyAlerts, emergencySeverityRank, useNotificationCenter, recordNotification, setNotificationState, forgetNotification, markAllNotificationsRead, resetNotifications, MAX_NOTIFICATION_ENTRIES, type HkNotificationEntry, type HkNotificationKind, type HkNotificationRecordInput, type HkNotificationState, type HkNotificationTone, type EmergencyAlertItem, type EmergencyAlertOptions, type EmergencyAction, type EmergencySeverity, type BlockingToastItem, type BlockingToastOptions, type BlockingToastVariant, useScreenIdentify, showScreenIdentify, dismissScreenIdentify, SCREEN_IDENTIFY_DEFAULT_MS, SCREEN_IDENTIFY_TICK_MS, type ScreenIdentifyRequest, type ScreenIdentifyContext, useBreakpoint, useClipboard, useClipboardWithToast, useMediaQuery, releaseMediaQuery, usePageLifecycle, onPageLifecycle, pageLifecycleState, useSafeArea, applyViewportPolicy, parseViewportContent, type ApplyViewportPolicyOptions, type ViewportPolicyResult, closeAll, isOverlayOpen, TOAST_DURATION, createBackGuard, BACK_GUARD_MARKER, BACK_GUARD_DEPTH, type AnimationHandle, useReportedTransition, type ReportedTransition, type ReportedTransitionTrack, type CronHandle, type IntervalHandle, type FrameContext, type OverlayHandle, type PopupHandle, type PopupKind, type ToastAction, type ToastItem, type ToastMessage, type ToastType, type PageLifecycleState, type PageLifecycleListener, type SafeAreaInsets, type BackGuard, type BackGuardOptions, installHkTooltipBridge, type HkTooltipBridgeOptions, installHkImageFallback, type HkImageFallbackOptions, installHkTapHighlight, type HkTapHighlightOptions, type HkTapHighlightColor, installHkTouchHintBridge, showHkTouchHintBar, armTouchHint, type HkTouchHintOptions, type HkTouchHintArmOptions, reportHkRuntime, getHkRuntimeEntry, listHkRuntime, readHkRuntime, writeHkRuntime, hkRuntimeSnapshot, useHkRegistry, type HkRuntimeKind, type HkRuntimeStatus, type HkRuntimeMeta, type HkRuntimeEntryState, type HkRuntimeReport, type HkRuntimeHandle, type HkRuntimeWriteOp, type HkRuntimeSnapshot, type HkRuntimeSnapshotEntry, } from "./runtime";
|
|
181
181
|
export { useI18n, setLocale, activeLocale, mergeMessages, } from "./i18n/context";
|
|
182
|
+
export { HK_LOCALE_CATALOG, type HkLocaleCatalogEntry } from "./i18n/localeCatalog";
|
|
182
183
|
export { fuzzyScore, fuzzyScoreFields, fuzzySearch } from "./utils/fuzzy";
|
|
183
184
|
export type { FuzzyMatch } from "./utils/fuzzy";
|
|
184
185
|
export { validatePassword, passwordLevel } from "./utils/password";
|
|
@@ -2,6 +2,8 @@ export { initTheme, useTheme } from "./useTheme";
|
|
|
2
2
|
export { initFontContext, applyFontContext, resetFontContext, useFontContext, HIKARI_FONT_SANS, HIKARI_FONT_MONO, HIKARI_FONT_READING } from "./fontContext";
|
|
3
3
|
export type { FontContextOverrides } from "./fontContext";
|
|
4
4
|
export { themePresets, stockDefaultPreset, tokensToCSSVars, getThemeTokens, loadCustomThemes, saveCustomThemes, addCustomTheme, removeCustomTheme, solidInk } from "./presets";
|
|
5
|
+
export { resolveThemeDisplayName, resolveThemeDisplayNameT } from "./themeName";
|
|
6
|
+
export type { ThemeNameI18n } from "./themeName";
|
|
5
7
|
export { deriveSemanticPalette, CANONICAL_SEMANTIC, contrastRatio, hueDistance, rgbToOklch, oklchToRgb } from "./semanticPalette";
|
|
6
8
|
export type { SemanticPalette, SemanticFills, OKLCH } from "./semanticPalette";
|
|
7
9
|
export type { ThemeTokenRGB, ThemeSchemeTokens, ThemePreset, CustomThemePreset, ThemeId, ThemeMode, ThemeTokenValue, ThemeTokenGroupValues, ThemeTokenGroupModes } from "./presets";
|
|
@@ -72,6 +72,14 @@ export interface ThemePreset {
|
|
|
72
72
|
* literal preset names render unchanged while keyed built-ins localize.
|
|
73
73
|
*/
|
|
74
74
|
name: string;
|
|
75
|
+
/**
|
|
76
|
+
* Per-locale name translations (2026-11-25 user direction: theme names
|
|
77
|
+
* are i18n citizens everywhere). Authored through the scheme editor's
|
|
78
|
+
* localized-name input; rows resolve the map FIRST (family fallbacks:
|
|
79
|
+
* zh-Hans ⇄ zh-Hant → en → first non-empty) and fall back to `t(name)`.
|
|
80
|
+
* Optional: presets without a map resolve through the name alone.
|
|
81
|
+
*/
|
|
82
|
+
nameI18n?: Record<string, string>;
|
|
75
83
|
dark: ThemeSchemeTokens;
|
|
76
84
|
light: ThemeSchemeTokens;
|
|
77
85
|
groups?: ThemeTokenGroupModes;
|
|
@@ -81,6 +89,10 @@ export type ThemeMode = "system" | "light" | "dark";
|
|
|
81
89
|
export interface CustomThemePreset {
|
|
82
90
|
id: string;
|
|
83
91
|
name: string;
|
|
92
|
+
/** Per-locale name translations (see ThemePreset.nameI18n). Persisted
|
|
93
|
+
* with the theme in local storage; additive, so customs saved before
|
|
94
|
+
* the field existed keep loading. */
|
|
95
|
+
nameI18n?: Record<string, string>;
|
|
84
96
|
dark: ThemeSchemeTokens;
|
|
85
97
|
light: ThemeSchemeTokens;
|
|
86
98
|
groups?: ThemeTokenGroupModes;
|
|
@@ -111,24 +123,17 @@ export declare function saveCustomThemes(list: CustomThemePreset[]): void;
|
|
|
111
123
|
export declare function addCustomTheme(theme: CustomThemePreset): void;
|
|
112
124
|
export declare function removeCustomTheme(id: string): void;
|
|
113
125
|
/**
|
|
114
|
-
* The stock preset table holds exactly ONE theme
|
|
115
|
-
*
|
|
116
|
-
* `
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* that wants a distinct brand registers its own preset (chest's `sc` is the
|
|
122
|
-
* reference), and a user who wants another look edits this one through the
|
|
123
|
-
* theme dialog and keeps it as a custom scheme.
|
|
126
|
+
* The stock preset table holds exactly ONE theme, and its VALUES are no
|
|
127
|
+
* longer written here: they live in the Rust palette crate
|
|
128
|
+
* (`packages/palette/src/stock.rs`, hikari#1546 Phase 2) and arrive as the
|
|
129
|
+
* checked-in JSON artifact above. Editing a color means editing Rust and
|
|
130
|
+
* regenerating (`REGEN_STOCK_JSON=1 cargo test -p hikari-palette --test
|
|
131
|
+
* stock_snapshot`) — the artifact snapshot test in that crate keeps the
|
|
132
|
+
* two sides locked.
|
|
124
133
|
*
|
|
125
|
-
*
|
|
126
|
-
* `
|
|
127
|
-
*
|
|
128
|
-
* Water primary (#88C0D0) and, with it, the near-black on-solid ink slots
|
|
129
|
-
* that pale primary requires (white on it is ~1.9:1). A stored id from the
|
|
130
|
-
* retired set is no longer a known theme, so `storedThemeId()` drops it and
|
|
131
|
-
* the engine resolves this default instead.
|
|
134
|
+
* A consumer that wants a distinct brand still registers its own preset
|
|
135
|
+
* (chest's `sc` is the reference), and a user who wants another look edits
|
|
136
|
+
* the default through the theme dialog and keeps it as a custom scheme.
|
|
132
137
|
*/
|
|
133
138
|
export declare const themePresets: Record<ThemeId, ThemePreset>;
|
|
134
139
|
export type ThemeTokens = ThemeSchemeTokens;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Per-locale name translations, keyed by locale code (the app's locale
|
|
2
|
+
* codes; hikari's catalog codes when the host has no own list). */
|
|
3
|
+
export type ThemeNameI18n = Record<string, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a theme's DISPLAY name: per-locale translations first, then
|
|
6
|
+
* the message-key convention through `t()`, then the raw base name.
|
|
7
|
+
* `name` may be a literal or a catalog key; `nameI18n` may be null or
|
|
8
|
+
* empty (stock themes and untranslated customs) — both degrade to the
|
|
9
|
+
* base answer.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveThemeDisplayName(name: string, nameI18n: ThemeNameI18n | null | undefined, locale: string, t: (key: string) => string): string;
|
|
12
|
+
/** The `useI18n`-bound convenience wrapper most components want. */
|
|
13
|
+
export declare function resolveThemeDisplayNameT(name: string, nameI18n: ThemeNameI18n | null | undefined): string;
|
|
@@ -1 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PRE-RENDERED static form of the stock theme table (hikari#1546).
|
|
3
|
+
*
|
|
4
|
+
* `applyTheme()` injects the whole cssvar set from JS, which is why a
|
|
5
|
+
* phone's first paint used to flash the unthemed default: no JS, no vars.
|
|
6
|
+
* This module composes the SAME `tokensToCSSVars` output the runtime uses
|
|
7
|
+
* into plain CSS blocks keyed on the `data-mode` attribute — the SSR
|
|
8
|
+
* template ships it in `<head>`, and a tiny inline bootstrap only sets
|
|
9
|
+
* `data-theme`/`data-mode` (attribute writes, no computation) before body
|
|
10
|
+
* paint. The cascade picks the block instantly.
|
|
11
|
+
*
|
|
12
|
+
* Selectors are mode-keyed and deliberately NOT theme-keyed: a stored
|
|
13
|
+
* CUSTOM theme id cannot be pre-rendered (user-authored, lives in
|
|
14
|
+
* localStorage), so pre-hydration those users see the stock colors in the
|
|
15
|
+
* right MODE — strictly better than the previous unthemed flash — and
|
|
16
|
+
* `applyTheme()` replaces them the moment the bundle lands. Override
|
|
17
|
+
* mechanics: the runtime writes a managed `<style data-hikari-theme-vars>`
|
|
18
|
+
* block whose selector (`html:root`, 0-1-1) TIES with these `html[data-mode]`
|
|
19
|
+
* blocks — the runtime wins by head ORDER (its block is appended after the
|
|
20
|
+
* SSR sheet), so the static sheet must stay in the SSR head; a late/async
|
|
21
|
+
* -loaded copy would re-tie and could snap the theme back.
|
|
22
|
+
*
|
|
23
|
+
* Phase 2 (de-Vue): the table itself moves to the Rust palette crate
|
|
24
|
+
* (tairitsu lane) and this module consumes generated JSON — the CSS form
|
|
25
|
+
* and the bootstrap contract stay exactly as they are here.
|
|
26
|
+
*
|
|
27
|
+
* Group tokens (shape/radius) are intentionally NOT included: every
|
|
28
|
+
* component reads them with its own CSS fallback (e.g.
|
|
29
|
+
* `var(--hk-radius-sm, 4px)` in HkSkeleton, `var(--hk-z-*)`,
|
|
30
|
+
* `var(--hk-picker-*)`), so the pre-hydration window degrades to identical
|
|
31
|
+
* geometry, and the runtime emission covers them anyway.
|
|
32
|
+
*/
|
|
33
|
+
/** The typed view of the Rust artifact: the serde BTreeMap arrives as two
|
|
34
|
+
* string-keyed maps. Declared explicitly because the JSON import's literal
|
|
35
|
+
* type defeats `stockVarsJson[mode]` under the strict build (vue-tsc
|
|
36
|
+
* TS7053 — the release lane caught it, the esbuild test transform did not). */
|
|
37
|
+
export interface StockVarsArtifact {
|
|
38
|
+
dark: Record<string, string>;
|
|
39
|
+
light: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
declare const stockVars: StockVarsArtifact;
|
|
1
42
|
export declare function buildThemeVarsCss(): string;
|
|
43
|
+
export { stockVars };
|
|
@@ -34,6 +34,7 @@ export declare function useTheme(): {
|
|
|
34
34
|
customThemes: import("vue").Ref<{
|
|
35
35
|
id: string;
|
|
36
36
|
name: string;
|
|
37
|
+
nameI18n?: Record<string, string> | undefined;
|
|
37
38
|
dark: {
|
|
38
39
|
primary: {
|
|
39
40
|
r: number;
|
|
@@ -265,6 +266,7 @@ export declare function useTheme(): {
|
|
|
265
266
|
}[], CustomThemePreset[] | {
|
|
266
267
|
id: string;
|
|
267
268
|
name: string;
|
|
269
|
+
nameI18n?: Record<string, string> | undefined;
|
|
268
270
|
dark: {
|
|
269
271
|
primary: {
|
|
270
272
|
r: number;
|
package/package.json
CHANGED
|
@@ -83,6 +83,8 @@ const legacyDark: HCustomTheme["dark"] = {
|
|
|
83
83
|
interface EditorExpose {
|
|
84
84
|
reset: () => void;
|
|
85
85
|
getDraft: () => HCustomTheme;
|
|
86
|
+
setThemeName: (name: string) => void;
|
|
87
|
+
setThemeNameI18n: (map: Record<string, string>) => void;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
|
|
@@ -91,6 +93,8 @@ function mountEditor(initial?: {
|
|
|
91
93
|
initialDark?: HCustomTheme["dark"];
|
|
92
94
|
initialLight?: HCustomTheme["light"];
|
|
93
95
|
initialGroups?: HCustomTheme["groups"];
|
|
96
|
+
initialName?: string;
|
|
97
|
+
initialNameI18n?: Record<string, string>;
|
|
94
98
|
}): { ref: Ref<EditorExpose | null>; container: HTMLElement } {
|
|
95
99
|
const container = document.createElement("div");
|
|
96
100
|
document.body.appendChild(container);
|
|
@@ -102,6 +106,8 @@ function mountEditor(initial?: {
|
|
|
102
106
|
...(initial?.initialDark ? { initialDark: initial.initialDark } : {}),
|
|
103
107
|
...(initial?.initialLight ? { initialLight: initial.initialLight } : {}),
|
|
104
108
|
...(initial?.initialGroups ? { initialGroups: initial.initialGroups } : {}),
|
|
109
|
+
...(initial?.initialName ? { initialName: initial.initialName } : {}),
|
|
110
|
+
...(initial?.initialNameI18n ? { initialNameI18n: initial.initialNameI18n } : {}),
|
|
105
111
|
}),
|
|
106
112
|
});
|
|
107
113
|
app.mount(container);
|
|
@@ -708,3 +714,68 @@ describe("HkColorSchemeEditor keeps the ONE ink rule (2026-11-12)", () => {
|
|
|
708
714
|
expect(draft.dark.onDanger).toEqual({ r: 255, g: 255, b: 255 });
|
|
709
715
|
});
|
|
710
716
|
});
|
|
717
|
+
|
|
718
|
+
describe("HkColorSchemeEditor localized scheme naming (2026-11-25)", () => {
|
|
719
|
+
/** Type into the localized-name editor's field (the active language). */
|
|
720
|
+
async function typeNameTranslation(text: string): Promise<void> {
|
|
721
|
+
const input = document.body.querySelector(
|
|
722
|
+
".s-scheme-name-i18n input.hk-input-element",
|
|
723
|
+
) as HTMLInputElement | null;
|
|
724
|
+
input!.value = text;
|
|
725
|
+
input!.dispatchEvent(new Event("input", { bubbles: true }));
|
|
726
|
+
await nextTick();
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
it("typing a translation carries it into getDraft().nameI18n", async () => {
|
|
730
|
+
const { ref, container } = mountEditor();
|
|
731
|
+
await nextTick();
|
|
732
|
+
|
|
733
|
+
// The localized editor rides the name section; the base name input
|
|
734
|
+
// stays the language-agnostic fallback.
|
|
735
|
+
expect(container.querySelector(".s-scheme-name-i18n")).not.toBeNull();
|
|
736
|
+
const baseInput = container.querySelector(
|
|
737
|
+
".s-scheme-dialog input.hk-input-element",
|
|
738
|
+
) as HTMLInputElement;
|
|
739
|
+
baseInput.value = "Midnight";
|
|
740
|
+
baseInput.dispatchEvent(new Event("input", { bubbles: true }));
|
|
741
|
+
await nextTick();
|
|
742
|
+
|
|
743
|
+
await typeNameTranslation("Midnight (dark)");
|
|
744
|
+
const draft = ref.value!.getDraft();
|
|
745
|
+
expect(draft.name).toBe("Midnight");
|
|
746
|
+
expect(draft.nameI18n).toEqual({ en: "Midnight (dark)" });
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
it("drafts WITHOUT nameI18n while no translation was filled", async () => {
|
|
750
|
+
const { ref } = mountEditor();
|
|
751
|
+
await nextTick();
|
|
752
|
+
const draft = ref.value!.getDraft();
|
|
753
|
+
expect("nameI18n" in draft).toBe(false);
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
it("reset re-seeds translations from initialNameI18n; host pushes win until then", async () => {
|
|
757
|
+
const { ref } = mountEditor({
|
|
758
|
+
initialName: "Factory",
|
|
759
|
+
initialNameI18n: { en: "Factory", "zh-Hans": "出厂" },
|
|
760
|
+
});
|
|
761
|
+
await nextTick();
|
|
762
|
+
expect(ref.value!.getDraft().nameI18n).toEqual({ en: "Factory", "zh-Hans": "出厂" });
|
|
763
|
+
|
|
764
|
+
// A host-owned name UI can push a new map through the exposed setter
|
|
765
|
+
// (the same grammar setThemeName has always offered for the base). comment-gate-ok: prose note on the exposed API surface, not a behaviour claim — the behaviour pins are the four cases in this describe block (draft carries/drops nameI18n, reset re-seed, push).
|
|
766
|
+
ref.value!.setThemeNameI18n({ en: "Factory v2" });
|
|
767
|
+
expect(ref.value!.getDraft().nameI18n).toEqual({ en: "Factory v2" });
|
|
768
|
+
|
|
769
|
+
// reset() re-seeds from the initial props (the open-time contract).
|
|
770
|
+
ref.value!.reset();
|
|
771
|
+
await nextTick();
|
|
772
|
+
expect(ref.value!.getDraft().nameI18n).toEqual({ en: "Factory", "zh-Hans": "出厂" });
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
it("an all-empty pushed map drafts without the field", async () => {
|
|
776
|
+
const { ref } = mountEditor();
|
|
777
|
+
await nextTick();
|
|
778
|
+
ref.value!.setThemeNameI18n({ en: " ", "zh-Hans": "" });
|
|
779
|
+
expect("nameI18n" in ref.value!.getDraft()).toBe(false);
|
|
780
|
+
});
|
|
781
|
+
});
|
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
type TokenGroupSlot,
|
|
25
25
|
} from "@celestia-island/hikari";
|
|
26
26
|
|
|
27
|
+
import HkLocalizedInput, { type HkLocaleOption } from "./HkLocalizedInput";
|
|
28
|
+
import { HK_LOCALE_CATALOG } from "../i18n/localeCatalog";
|
|
29
|
+
|
|
27
30
|
// Relative on purpose. The package root re-exports this component, so reading
|
|
28
31
|
// the preset table through "@celestia-island/hikari" would close a loop whose
|
|
29
32
|
// module-init order decides whether the table exists yet. Theme-internal
|
|
@@ -140,6 +143,9 @@ interface HkTabItem {
|
|
|
140
143
|
export interface HCustomTheme {
|
|
141
144
|
id: string;
|
|
142
145
|
name: string;
|
|
146
|
+
/** Per-locale name translations (2026-11-25 user direction: theme
|
|
147
|
+
* names are i18n citizens) — present when the author filled any. */
|
|
148
|
+
nameI18n?: Record<string, string>;
|
|
143
149
|
dark: ThemeSchemeTokens;
|
|
144
150
|
light: ThemeSchemeTokens;
|
|
145
151
|
/** Extension token group values (both modes), present when groups are registered. */
|
|
@@ -180,6 +186,25 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
180
186
|
initialGroups: { type: Object as PropType<ThemeTokenGroupModes>, default: undefined },
|
|
181
187
|
/** Prefill the scheme name input (edit/fork flows); empty by default. */
|
|
182
188
|
initialName: { type: String, default: "" },
|
|
189
|
+
/**
|
|
190
|
+
* Prefill the per-locale name translations (edit flows — the map a
|
|
191
|
+
* saved custom theme carries). Empty by default: a blank canvas has
|
|
192
|
+
* no translations yet.
|
|
193
|
+
*/
|
|
194
|
+
initialNameI18n: {
|
|
195
|
+
type: Object as PropType<Record<string, string>>,
|
|
196
|
+
default: undefined,
|
|
197
|
+
},
|
|
198
|
+
/**
|
|
199
|
+
* The language catalog the localized-name editor offers. Defaults to
|
|
200
|
+
* hikari's own catalog (HK_LOCALE_CATALOG — every language hikari
|
|
201
|
+
* ships); hosts with an app-level i18n config pass the SAME list
|
|
202
|
+
* their global language switcher uses.
|
|
203
|
+
*/
|
|
204
|
+
localeOptions: {
|
|
205
|
+
type: Array as PropType<HkLocaleOption[]>,
|
|
206
|
+
default: () => HK_LOCALE_CATALOG.map((e) => ({ code: e.code, label: e.label })),
|
|
207
|
+
},
|
|
183
208
|
/**
|
|
184
209
|
* Render the built-in name input. Hosts that own the name field
|
|
185
210
|
* elsewhere (e.g. a "basic" tab above the editor) hide it and feed the
|
|
@@ -195,6 +220,20 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
195
220
|
const activeLocale = computed(() => useI18n().locale);
|
|
196
221
|
const modeTab = ref<string>("dark");
|
|
197
222
|
const themeName = ref(props.initialName ?? "");
|
|
223
|
+
// Per-locale name translations (2026-11-25 user direction: theme names
|
|
224
|
+
// are i18n citizens). `themeNameI18n` is the map the draft carries;
|
|
225
|
+
// `nameI18nText` is HkLocalizedInput's field mirror — the component
|
|
226
|
+
// owns committing the edited language's text into the map (every
|
|
227
|
+
// keystroke also emits update:translations), the mirror only keeps
|
|
228
|
+
// the field's value live across language switches. The base name
|
|
229
|
+
// above stays the required language-agnostic fallback; this map only
|
|
230
|
+
// adds translations.
|
|
231
|
+
const themeNameI18n = ref<Record<string, string>>({ ...(props.initialNameI18n ?? {}) });
|
|
232
|
+
// HkLocalizedInput contract: modelValue is ALWAYS the text of the
|
|
233
|
+
// language being edited — never prefill it with a cross-locale
|
|
234
|
+
// fallback (a language switch would commit the borrowed text into
|
|
235
|
+
// the current locale's key).
|
|
236
|
+
const nameI18nText = ref<string>((props.initialNameI18n ?? {})[activeLocale.value] ?? "");
|
|
198
237
|
|
|
199
238
|
const dark = reactive<ThemeSchemeTokens>({ ...seedScheme("dark") });
|
|
200
239
|
const light = reactive<ThemeSchemeTokens>({ ...seedScheme("light") });
|
|
@@ -263,6 +302,8 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
263
302
|
function reset(): void {
|
|
264
303
|
modeTab.value = useTheme().effectiveMode.value;
|
|
265
304
|
themeName.value = props.initialName ?? t("hikari::theme.customThemeName");
|
|
305
|
+
themeNameI18n.value = { ...(props.initialNameI18n ?? {}) };
|
|
306
|
+
nameI18nText.value = (props.initialNameI18n ?? {})[activeLocale.value] ?? "";
|
|
266
307
|
Object.assign(dark, props.initialDark ?? seedScheme("dark"));
|
|
267
308
|
Object.assign(light, props.initialLight ?? seedScheme("light"));
|
|
268
309
|
// Optional slots: a legacy prefill omitting them must reset to white
|
|
@@ -294,7 +335,14 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
294
335
|
themeName.value = name;
|
|
295
336
|
}
|
|
296
337
|
|
|
297
|
-
|
|
338
|
+
/** Hosts that own the name UI (chest's basic tab) push their
|
|
339
|
+
* per-locale map through here; the built-in editor writes the same
|
|
340
|
+
* map directly from the localized input. */
|
|
341
|
+
function setThemeNameI18n(map: Record<string, string>): void {
|
|
342
|
+
themeNameI18n.value = { ...map };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
expose({ reset, getDraft, setThemeName, setThemeNameI18n });
|
|
298
346
|
|
|
299
347
|
watch(
|
|
300
348
|
() => [
|
|
@@ -341,9 +389,17 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
341
389
|
}
|
|
342
390
|
|
|
343
391
|
function getDraft(): HCustomTheme {
|
|
392
|
+
// Empty-string entries never enter the map (HkLocalizedInput prunes
|
|
393
|
+
// them), but a defensive sweep keeps a hand-pushed map from shipping
|
|
394
|
+
// blank keys; an all-empty map drafts without the field at all.
|
|
395
|
+
const nameI18n: Record<string, string> = {};
|
|
396
|
+
for (const [code, value] of Object.entries(themeNameI18n.value)) {
|
|
397
|
+
if (value.trim()) nameI18n[code] = value;
|
|
398
|
+
}
|
|
344
399
|
return {
|
|
345
400
|
id: `custom-theme-${Date.now()}`,
|
|
346
401
|
name: themeName.value || t("hikari::theme.customThemeName"),
|
|
402
|
+
...(Object.keys(nameI18n).length > 0 ? { nameI18n } : {}),
|
|
347
403
|
dark: { ...dark },
|
|
348
404
|
light: { ...light },
|
|
349
405
|
...(registeredGroups.value.length > 0
|
|
@@ -527,12 +583,30 @@ export const HkColorSchemeEditor = defineComponent({
|
|
|
527
583
|
return () => (
|
|
528
584
|
<div class="s-scheme-dialog">
|
|
529
585
|
{props.showName && (
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
586
|
+
<>
|
|
587
|
+
<HInput
|
|
588
|
+
modelValue={themeName.value}
|
|
589
|
+
onUpdate:modelValue={(v: string) => { themeName.value = v; }}
|
|
590
|
+
label={t("hikari::theme.themeName")}
|
|
591
|
+
placeholder={t("hikari::theme.customThemeName")}
|
|
592
|
+
/>
|
|
593
|
+
{/* Per-locale name translations riding the standard localized
|
|
594
|
+
input (2026-11-25 user direction): one field, a per-language
|
|
595
|
+
chip menu — the same grammar the hosts' name editors use.
|
|
596
|
+
The base name above stays the language-agnostic fallback;
|
|
597
|
+
this map only adds translations. */}
|
|
598
|
+
<HkLocalizedInput
|
|
599
|
+
class="s-scheme-name-i18n"
|
|
600
|
+
label={t("hikari::theme.nameTranslations")}
|
|
601
|
+
localeOptions={props.localeOptions}
|
|
602
|
+
modelValue={nameI18nText.value}
|
|
603
|
+
onUpdate:modelValue={(v: string) => { nameI18nText.value = v; }}
|
|
604
|
+
translations={themeNameI18n.value}
|
|
605
|
+
onUpdate:translations={(v: Record<string, string>) => { themeNameI18n.value = v; }}
|
|
606
|
+
sourceLang={activeLocale.value}
|
|
607
|
+
placeholder={themeName.value || t("hikari::theme.customThemeName")}
|
|
608
|
+
/>
|
|
609
|
+
</>
|
|
536
610
|
)}
|
|
537
611
|
<HTabs
|
|
538
612
|
variant="segmented"
|