mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-27 00:55:16 -07:00
migrate subtitle style config to CSS declaration shape
- Flat style keys (fontFamily, fontSize, hoverTokenColor, etc.) consolidated into subtitleStyle.css, secondary.css, and subtitleSidebar.css objects - Hover token colors migrated to --subtitle-hover-token-color CSS custom properties - Plugin app-ping now checks result.status (0=running, 1=stopped) to avoid treating transient failures as stopped - Note-fields note type picker defaults to configured deck's note type before falling back to Kiku/Lapis - New migration for legacy ankiConnect N+1 config paths
This commit is contained in:
@@ -11,7 +11,8 @@ type WindowTrackerStub = {
|
||||
isTargetWindowMinimized?: () => boolean;
|
||||
};
|
||||
|
||||
function createMainWindowRecorder() {
|
||||
function createMainWindowRecorder(options: { emitShowImmediately?: boolean } = {}) {
|
||||
const emitShowImmediately = options.emitShowImmediately ?? true;
|
||||
const calls: string[] = [];
|
||||
const listeners = new Map<string, Array<() => void>>();
|
||||
let visible = false;
|
||||
@@ -25,6 +26,10 @@ function createMainWindowRecorder() {
|
||||
handler();
|
||||
}
|
||||
};
|
||||
const emitShow = (): void => {
|
||||
visible = true;
|
||||
emit('show');
|
||||
};
|
||||
const window = {
|
||||
webContents: {},
|
||||
isDestroyed: () => false,
|
||||
@@ -39,14 +44,16 @@ function createMainWindowRecorder() {
|
||||
calls.push('hide');
|
||||
},
|
||||
show: () => {
|
||||
visible = true;
|
||||
calls.push('show');
|
||||
emit('show');
|
||||
if (emitShowImmediately) {
|
||||
emitShow();
|
||||
}
|
||||
},
|
||||
showInactive: () => {
|
||||
visible = true;
|
||||
calls.push('show-inactive');
|
||||
emit('show');
|
||||
if (emitShowImmediately) {
|
||||
emitShow();
|
||||
}
|
||||
},
|
||||
focus: () => {
|
||||
focused = true;
|
||||
@@ -81,6 +88,7 @@ function createMainWindowRecorder() {
|
||||
window,
|
||||
calls,
|
||||
getOpacity: () => opacity,
|
||||
emitShow,
|
||||
setContentReady: (nextContentReady: boolean) => {
|
||||
contentReady = nextContentReady;
|
||||
(
|
||||
@@ -267,6 +275,50 @@ test('tracked non-macOS overlay reapplies bounds after first show', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('tracked non-macOS overlay queues only one first-show bounds refresh', () => {
|
||||
const { window, calls, emitShow } = createMainWindowRecorder({ emitShowImmediately: false });
|
||||
let width = 1280;
|
||||
const tracker: WindowTrackerStub = {
|
||||
isTracking: () => true,
|
||||
getGeometry: () => ({ x: 0, y: 0, width, height: 720 }),
|
||||
};
|
||||
const run = () =>
|
||||
updateVisibleOverlayVisibility({
|
||||
visibleOverlayVisible: true,
|
||||
mainWindow: window as never,
|
||||
windowTracker: tracker as never,
|
||||
trackerNotReadyWarningShown: false,
|
||||
setTrackerNotReadyWarningShown: () => {},
|
||||
updateVisibleOverlayBounds: (geometry: { width: number }) => {
|
||||
calls.push(`update-bounds:${geometry.width}`);
|
||||
},
|
||||
ensureOverlayWindowLevel: () => {
|
||||
calls.push('ensure-level');
|
||||
},
|
||||
syncPrimaryOverlayWindowLayer: () => {
|
||||
calls.push('sync-layer');
|
||||
},
|
||||
enforceOverlayLayerOrder: () => {
|
||||
calls.push('enforce-order');
|
||||
},
|
||||
syncOverlayShortcuts: () => {
|
||||
calls.push('sync-shortcuts');
|
||||
},
|
||||
isMacOSPlatform: false,
|
||||
isWindowsPlatform: false,
|
||||
} as never);
|
||||
|
||||
run();
|
||||
width = 1440;
|
||||
run();
|
||||
emitShow();
|
||||
|
||||
assert.deepEqual(
|
||||
calls.filter((call) => call.startsWith('update-bounds:')),
|
||||
['update-bounds:1280', 'update-bounds:1440', 'update-bounds:1440'],
|
||||
);
|
||||
});
|
||||
|
||||
test('Windows visible overlay stays click-through and binds to mpv while tracked', () => {
|
||||
const { window, calls } = createMainWindowRecorder();
|
||||
const tracker: WindowTrackerStub = {
|
||||
|
||||
Reference in New Issue
Block a user