updated: package-lock.json
This commit is contained in:
+40
-2
@@ -12,6 +12,7 @@
|
||||
birthDate: "",
|
||||
tarotDeck: "ceremonial-magick",
|
||||
stellariumBackgroundEnabled: false,
|
||||
detailTextScale: 1,
|
||||
hasExplicitLocation: false
|
||||
},
|
||||
onSettingsApplied: null,
|
||||
@@ -40,6 +41,8 @@
|
||||
tarotDeckCacheProgressEl: document.getElementById("tarot-deck-cache-progress"),
|
||||
tarotDeckCacheProgressLabelEl: document.getElementById("tarot-deck-cache-progress-label"),
|
||||
tarotDeckCacheStatusEl: document.getElementById("tarot-deck-cache-status"),
|
||||
detailTextScaleEl: document.getElementById("detail-text-scale"),
|
||||
detailTextScaleValueEl: document.getElementById("detail-text-scale-value"),
|
||||
stellariumBackgroundEl: document.getElementById("stellarium-background"),
|
||||
stellariumBackgroundHintEl: document.getElementById("stellarium-background-hint"),
|
||||
apiBaseUrlEl: document.getElementById("api-base-url"),
|
||||
@@ -376,6 +379,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
function syncDetailTextScaleLabel(detailTextScale) {
|
||||
const { detailTextScaleValueEl } = getElements();
|
||||
if (!detailTextScaleValueEl) {
|
||||
return;
|
||||
}
|
||||
|
||||
detailTextScaleValueEl.textContent = `${Math.round(normalizeDetailTextScale(detailTextScale) * 100)}%`;
|
||||
}
|
||||
|
||||
function syncSky(geo, options) {
|
||||
if (typeof config.onSyncSkyBackground === "function") {
|
||||
config.onSyncSkyBackground(geo, options);
|
||||
@@ -394,6 +406,19 @@
|
||||
return "minutes";
|
||||
}
|
||||
|
||||
function clampNumber(value, min, max, fallback) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed)) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return Math.min(max, Math.max(min, parsed));
|
||||
}
|
||||
|
||||
function normalizeDetailTextScale(value) {
|
||||
return clampNumber(value, 0.85, 1.35, 1);
|
||||
}
|
||||
|
||||
function normalizeBirthDate(value) {
|
||||
const normalized = String(value || "").trim();
|
||||
if (!normalized) {
|
||||
@@ -493,6 +518,7 @@
|
||||
timeFormat: normalizeTimeFormat(settings?.timeFormat),
|
||||
birthDate: normalizeBirthDate(settings?.birthDate),
|
||||
tarotDeck: normalizeTarotDeck(settings?.tarotDeck),
|
||||
detailTextScale: normalizeDetailTextScale(settings?.detailTextScale),
|
||||
stellariumBackgroundEnabled: parseStoredBoolean(settings?.stellariumBackgroundEnabled, false) && hasExplicitLocation,
|
||||
hasExplicitLocation
|
||||
};
|
||||
@@ -649,7 +675,7 @@
|
||||
}
|
||||
|
||||
function applySettingsToInputs(settings) {
|
||||
const { latEl, lngEl, timeFormatEl, birthDateEl, tarotDeckEl, stellariumBackgroundEl } = getElements();
|
||||
const { latEl, lngEl, timeFormatEl, birthDateEl, tarotDeckEl, detailTextScaleEl, stellariumBackgroundEl } = getElements();
|
||||
syncTarotDeckInputOptions();
|
||||
syncConnectionInputs();
|
||||
const normalized = normalizeSettings(settings);
|
||||
@@ -657,6 +683,10 @@
|
||||
lngEl.value = String(normalized.longitude);
|
||||
timeFormatEl.value = normalized.timeFormat;
|
||||
birthDateEl.value = normalized.birthDate;
|
||||
if (detailTextScaleEl) {
|
||||
detailTextScaleEl.value = String(Math.round(normalized.detailTextScale * 100));
|
||||
}
|
||||
syncDetailTextScaleLabel(normalized.detailTextScale);
|
||||
if (tarotDeckEl) {
|
||||
tarotDeckEl.value = normalized.tarotDeck;
|
||||
}
|
||||
@@ -671,7 +701,7 @@
|
||||
}
|
||||
|
||||
function getSettingsFromInputs() {
|
||||
const { latEl, lngEl, timeFormatEl, birthDateEl, tarotDeckEl, stellariumBackgroundEl } = getElements();
|
||||
const { latEl, lngEl, timeFormatEl, birthDateEl, tarotDeckEl, detailTextScaleEl, stellariumBackgroundEl } = getElements();
|
||||
const latitudeText = String(latEl?.value || "").trim();
|
||||
const longitudeText = String(lngEl?.value || "").trim();
|
||||
|
||||
@@ -692,6 +722,7 @@
|
||||
timeFormat: normalizeTimeFormat(timeFormatEl.value),
|
||||
birthDate: normalizeBirthDate(birthDateEl.value),
|
||||
tarotDeck: normalizeTarotDeck(tarotDeckEl?.value),
|
||||
detailTextScale: normalizeDetailTextScale(Number(detailTextScaleEl?.value || 100) / 100),
|
||||
stellariumBackgroundEnabled: Boolean(stellariumBackgroundEl?.checked),
|
||||
hasExplicitLocation: hasExplicitLocationEntry()
|
||||
});
|
||||
@@ -839,6 +870,7 @@
|
||||
useLocationEl,
|
||||
openSettingsEl,
|
||||
closeSettingsEl,
|
||||
detailTextScaleEl,
|
||||
latEl,
|
||||
lngEl
|
||||
} = getElements();
|
||||
@@ -853,6 +885,12 @@
|
||||
useLocationEl.addEventListener("click", requestGeoLocation);
|
||||
}
|
||||
|
||||
if (detailTextScaleEl) {
|
||||
detailTextScaleEl.addEventListener("input", () => {
|
||||
syncDetailTextScaleLabel(Number(detailTextScaleEl.value) / 100);
|
||||
});
|
||||
}
|
||||
|
||||
[latEl, lngEl].forEach((inputEl) => {
|
||||
if (!inputEl) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user