Release 0.2.1

This commit is contained in:
Kur0mi 2026-06-24 15:39:05 +02:00
parent 53e2eb95c7
commit 53cc944d25
9 changed files with 238 additions and 206 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 0.2.1
- Add default day/night map background fallbacks when the active Obsidian theme cannot provide a matching background color.
- Refresh explicit 3D day/night backgrounds after Obsidian CSS changes.
## 0.2.0
- Add the Galaxy-derived 3D map mode based on [Longwind1984/galaxy-view](https://github.com/Longwind1984/galaxy-view).

381
main.js

File diff suppressed because one or more lines are too long

View file

@ -1,10 +1,10 @@
{
"id": "mini-world-map",
"name": "Mini World Map",
"version": "0.2.0",
"minAppVersion": "1.5.0",
"description": "Visualize your vault as a hierarchy-first world map with internal links layered on top.",
"author": "Miro0o and Codex",
"authorUrl": "https://github.com/Miro0o",
"isDesktopOnly": false
"id": "mini-world-map",
"name": "Mini World Map",
"version": "0.2.1",
"minAppVersion": "1.5.0",
"description": "Visualize your vault as a hierarchy-first world map with internal links layered on top.",
"author": "Miro0o and Codex",
"authorUrl": "https://github.com/Miro0o",
"isDesktopOnly": false
}

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "mini-world-map",
"version": "0.2.0",
"version": "0.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mini-world-map",
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",
"dependencies": {
"3d-force-graph": "1.80.0",

View file

@ -1,6 +1,6 @@
{
"name": "mini-world-map",
"version": "0.2.0",
"version": "0.2.1",
"description": "Hierarchy-first 2D radial rings and 3D map views for your Obsidian vault",
"main": "main.js",
"type": "module",

View file

@ -300,7 +300,8 @@ export function colorSchemeOptions(language: Language): [ColorScheme, string][]
];
}
export function languageOptions(_language: Language): [Language, string][] {
export function languageOptions(language: Language): [Language, string][] {
void language;
return LANGUAGE_OPTIONS.map(([value, label]) => [value, label]);
}

View file

@ -1,6 +1,11 @@
export type ObsidianThemeScheme = 'day' | 'night';
export function resolveObsidianBackground(scheme: ObsidianThemeScheme, fallback: string | number): string {
export const DEFAULT_MAP_BACKGROUNDS: Record<ObsidianThemeScheme, string> = {
day: '#f8fafc',
night: '#1e1e1e',
};
export function resolveObsidianBackground(scheme: ObsidianThemeScheme, fallback: string | number = DEFAULT_MAP_BACKGROUNDS[scheme]): string {
const sampled = sampleObsidianBackground(scheme);
if (sampled && fitsScheme(sampled, scheme)) return sampled;
return colorFallbackToCss(fallback);
@ -55,16 +60,18 @@ function fitsScheme(color: string, scheme: ObsidianThemeScheme): boolean {
}
function rgbStringToHex(value: string): string | null {
if (value.trim().toLowerCase() === 'transparent') return null;
const match = value.match(/^rgba?\((.*)\)$/i);
if (!match) return expandHex(value);
const parts = match[1]
?.replaceAll(',', ' ')
.split(/[ /]+/)
.map((part) => part.trim())
.filter(Boolean)
.slice(0, 3);
.filter(Boolean);
if (!parts || parts.length < 3) return null;
const channels = parts.map(parseChannel);
const alpha = parts[3] === undefined ? 1 : parseAlpha(parts[3]);
if (alpha === null || alpha <= 0.05) return null;
const channels = parts.slice(0, 3).map(parseChannel);
if (channels.some((channel) => channel === null)) return null;
return `#${channels.map((channel) => channel!.toString(16).padStart(2, '0')).join('')}`;
}
@ -86,10 +93,23 @@ function parseChannel(value: string): number | null {
return Number.isFinite(channel) ? clampByte(channel) : null;
}
function parseAlpha(value: string): number | null {
if (value.endsWith('%')) {
const percent = Number.parseFloat(value);
return Number.isFinite(percent) ? clampUnit(percent / 100) : null;
}
const alpha = Number.parseFloat(value);
return Number.isFinite(alpha) ? clampUnit(alpha) : null;
}
function clampByte(value: number): number {
return Math.min(255, Math.max(0, Math.round(value)));
}
function clampUnit(value: number): number {
return Math.min(1, Math.max(0, value));
}
function hexToRgb(value: string): { r: number; g: number; b: number } | null {
const hex = expandHex(value);
if (!hex) return null;

View file

@ -394,7 +394,7 @@ export class GraphController {
/** workspace css-change由视图转发 */
onCssChange(): void {
if (this.settings.preset === 'auto') this.applyPreset();
if (this.settings.preset !== 'deep-space') this.applyPreset();
}
private resolveVisualTokens(): VisualTokens {

View file

@ -3,5 +3,6 @@
"0.1.1": "1.5.0",
"0.1.2": "1.5.0",
"0.1.3": "1.5.0",
"0.2.0": "1.5.0"
"0.2.0": "1.5.0",
"0.2.1": "1.5.0"
}