34 Commits
main ... v1.0.2

Author SHA1 Message Date
81ed97b263 1.0.2 2026-02-10 21:06:59 +01:00
61359e6665 style: fix footer position and visibility 2026-02-10 21:06:59 +01:00
8f8f6a6e8e fix: update guide panel colors to be readable in light mode 2026-02-10 21:00:21 +01:00
a02c17e462 fix: use theme variables for install banner readability 2026-02-10 20:56:04 +01:00
490ca6b4a5 revert: remove css filter inversion for share icons 2026-02-10 20:53:18 +01:00
10ed00b7b6 fix: refine share icon inversion to target only specific elements 2026-02-10 20:51:46 +01:00
a335adeca8 style: scope share icon color inversion to win modal only 2026-02-10 20:49:37 +01:00
72adab61c7 fix: ensure share icons are visible in light mode by inverting colors 2026-02-10 20:44:35 +01:00
2c892f3adc chore: bump version to 1.0.1 2026-02-10 17:43:17 +01:00
b6b289cd57 chore: enhance PWA cache invalidation logic 2026-02-10 17:35:05 +01:00
ea2e3c573b feat: display app version from package.json in footer 2026-02-10 17:24:19 +01:00
cf2e9de56d refactor: remove all guide usage checks from win modal logic 2026-02-10 17:18:17 +01:00
4313831e84 75% filled blocks 2026-02-10 09:54:56 +01:00
60ef352cda 10% more filled blocks 2026-02-10 09:39:05 +01:00
91c873ef97 feat: always show share buttons in win modal regardless of guide usage 2026-02-10 04:50:13 +01:00
c4764e9505 fix: allow horizontal scroll on desktop for large grids 2026-02-10 03:10:37 +01:00
423258ef17 chore: remove tracked build artifacts from dev-dist 2026-02-10 03:05:46 +01:00
0bd2b905a9 Fix desktop grid scroll issue: remove width limit and hide scrollbar 2026-02-10 02:59:10 +01:00
572acc3979 feat: complete translations for new game and guide buttons for all languages 2026-02-10 02:43:19 +01:00
7256809f0b fix: japanese translation for new game and guide buttons 2026-02-10 02:35:26 +01:00
9f89fe4340 feat: disable win fanfare and sharing if guide was used 2026-02-10 02:30:58 +01:00
7610a4a523 feat: localize new game and guide buttons 2026-02-10 01:54:34 +01:00
285c486c6e chore: add i18n update script 2026-02-10 01:40:09 +01:00
8a97cc5d0d feat: add traditional chinese language support 2026-02-10 01:37:50 +01:00
c287523fa5 feat: localize new game and guide buttons 2026-02-10 01:20:37 +01:00
eb6b69134f fix: persist language selection and enforce search keys 2026-02-10 00:54:29 +01:00
4d50eb97eb Fix Undo icon and improve mobile UX 2026-02-10 00:08:23 +01:00
a1df95d3d4 fix 2026-02-09 23:35:21 +01:00
4a7c088776 fix: update flag mappings and ignore dev artifacts 2026-02-09 23:25:50 +01:00
6f3ed143e5 feat: add system theme option to navbar 2026-02-09 23:17:52 +01:00
c5f9da81a9 Merge branch 'feature/upgrades' into main 2026-02-09 22:58:42 +01:00
0decf2324c Add vitest setup and puzzleUtils tests 2026-02-09 22:51:00 +01:00
96999f740c Fix flag display priority to prefer inline SVG when file is missing 2026-02-09 22:21:10 +01:00
4982e6ed49 Add Batch 3 and Batch 4 translations and improve language detection 2026-02-09 22:10:03 +01:00
24 changed files with 4916 additions and 3620 deletions

View File

@@ -1 +0,0 @@
if('serviceWorker' in navigator) navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'classic' })

View File

@@ -1,92 +0,0 @@
/**
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// If the loader is already loaded, just stop.
if (!self.define) {
let registry = {};
// Used for `eval` and `importScripts` where we can't get script URL by other means.
// In both cases, it's safe to use a global var because those functions are synchronous.
let nextDefineUri;
const singleRequire = (uri, parentUri) => {
uri = new URL(uri + ".js", parentUri).href;
return registry[uri] || (
new Promise(resolve => {
if ("document" in self) {
const script = document.createElement("script");
script.src = uri;
script.onload = resolve;
document.head.appendChild(script);
} else {
nextDefineUri = uri;
importScripts(uri);
resolve();
}
})
.then(() => {
let promise = registry[uri];
if (!promise) {
throw new Error(`Module ${uri} didnt register its module`);
}
return promise;
})
);
};
self.define = (depsNames, factory) => {
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
if (registry[uri]) {
// Module is already loading or loaded.
return;
}
let exports = {};
const require = depUri => singleRequire(depUri, uri);
const specialDeps = {
module: { uri },
exports,
require
};
registry[uri] = Promise.all(depsNames.map(
depName => specialDeps[depName] || require(depName)
)).then(deps => {
factory(...deps);
return exports;
});
};
}
define(['./workbox-5a5d9309'], (function (workbox) { 'use strict';
self.skipWaiting();
workbox.clientsClaim();
/**
* The precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
workbox.precacheAndRoute([{
"url": "registerSW.js",
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.eh0stsihuc8"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
allowlist: [/^\/$/]
}));
}));

File diff suppressed because it is too large Load Diff

2050
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,12 @@
{
"name": "vue-nonograms-solid",
"version": "1.0.0",
"version": "1.0.2",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"fireworks-js": "^2.10.8",
@@ -16,7 +17,10 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"@vue/test-utils": "^2.4.6",
"jsdom": "^28.0.0",
"vite": "^5.1.4",
"vite-plugin-pwa": "^0.20.5"
"vite-plugin-pwa": "^0.20.5",
"vitest": "^4.0.18"
}
}

View File

@@ -21,6 +21,7 @@ const installDismissed = ref(false);
const isCoarsePointer = ref(false);
const isStandalone = ref(false);
const themePreference = ref('system');
const appVersion = __APP_VERSION__;
let displayModeMedia = null;
let prefersColorSchemeMedia = null;
@@ -164,6 +165,10 @@ onUnmounted(() => {
</section>
</div>
<footer class="app-version">
v{{ appVersion }}
</footer>
<!-- Modals Teleport -->
<Teleport to="body">
<WinModal v-if="store.isGameWon" />
@@ -183,8 +188,8 @@ onUnmounted(() => {
}
.install-banner {
background: rgba(0, 242, 254, 0.1);
border: 1px solid var(--primary-neon);
background: var(--banner-bg);
border: 1px solid var(--banner-border);
border-radius: 8px;
padding: 10px 20px;
display: flex;
@@ -193,10 +198,11 @@ onUnmounted(() => {
width: 90%;
max-width: 600px;
margin-bottom: 20px;
box-shadow: var(--banner-shadow);
}
.install-text {
color: #fff;
color: var(--text-color);
}
.install-actions {
@@ -208,7 +214,7 @@ onUnmounted(() => {
.install-close {
background: transparent;
border: none;
color: #aaa;
color: var(--text-muted);
font-size: 1.5rem;
cursor: pointer;
}
@@ -238,4 +244,20 @@ onUnmounted(() => {
.fade-leave-to {
opacity: 0;
}
.app-version {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
padding: 10px;
font-size: 0.8rem;
color: var(--text-muted);
opacity: 0.8;
background: var(--panel-bg);
backdrop-filter: blur(5px);
border-top: 1px solid var(--panel-border);
z-index: 90;
}
</style>

View File

@@ -34,35 +34,30 @@ const clearLongPress = () => {
const handlePointerDown = (e) => {
if (e.pointerType === 'mouse') {
if (e.button === 0) emit('start-drag', props.r, props.c, false);
if (e.button === 2) emit('start-drag', props.r, props.c, true);
if (e.button === 0) emit('start-drag', props.r, props.c, false, false);
if (e.button === 2) emit('start-drag', props.r, props.c, true, false);
return;
}
longPressTriggered = false;
clearLongPress();
longPressTimer = setTimeout(() => {
longPressTriggered = true;
emit('start-drag', props.r, props.c, true);
}, 450);
// Touch logic
const now = Date.now();
if (now - lastTap < 300) {
// Double tap -> X (Force)
emit('start-drag', props.r, props.c, true, true);
lastTap = 0;
} else {
// Single tap / Start drag -> Fill
emit('start-drag', props.r, props.c, false, false);
lastTap = now;
}
};
const handlePointerUp = (e) => {
if (e.pointerType === 'mouse') return;
clearLongPress();
if (longPressTriggered) return;
const now = Date.now();
const isDoubleTap = now - lastTap < 300;
lastTap = now;
if (isDoubleTap) {
emit('start-drag', props.r, props.c, true);
} else {
emit('start-drag', props.r, props.c, false);
}
// Handled in pointerdown
};
const handlePointerCancel = (e) => {
if (e.pointerType === 'mouse') return;
clearLongPress();
// Handled in pointerdown
};
</script>

View File

@@ -15,6 +15,94 @@ const rowHintsRef = ref(null);
const activeRow = ref(null);
const activeCol = ref(null);
const isFinePointer = ref(false);
const scrollWrapper = ref(null);
const scrollTrack = ref(null);
const showScrollbar = ref(false);
const thumbWidth = ref(20);
const thumbLeft = ref(0);
let isDraggingScroll = false;
let dragStartX = 0;
let dragStartLeft = 0;
const checkScroll = () => {
const el = scrollWrapper.value;
if (!el) return;
const sw = el.scrollWidth;
const cw = el.clientWidth;
// Only show custom scrollbar on mobile/tablet (width < 768px) and if content overflows
const isMobile = window.innerWidth <= 768;
showScrollbar.value = isMobile && (sw > cw + 1);
if (showScrollbar.value) {
// Thumb width percentage = (viewport / total) * 100
const ratio = cw / sw;
thumbWidth.value = Math.max(10, ratio * 100);
}
};
const handleScroll = () => {
if (isDraggingScroll) return;
const el = scrollWrapper.value;
if (!el) return;
const sw = el.scrollWidth;
const cw = el.clientWidth;
const sl = el.scrollLeft;
const maxScroll = sw - cw;
if (maxScroll <= 0) return;
// Map scroll position to thumb position (0 to 100 - thumbWidth)
const maxThumb = 100 - thumbWidth.value;
thumbLeft.value = (sl / maxScroll) * maxThumb;
};
const startScrollDrag = (e) => {
isDraggingScroll = true;
dragStartX = e.clientX || e.touches[0].clientX;
dragStartLeft = thumbLeft.value;
document.addEventListener('mousemove', onScrollDrag);
document.addEventListener('mouseup', stopScrollDrag);
document.addEventListener('touchmove', onScrollDrag, { passive: false });
document.addEventListener('touchend', stopScrollDrag);
};
const onScrollDrag = (e) => {
if (!isDraggingScroll || !scrollTrack.value) return;
const clientX = e.clientX || (e.touches ? e.touches[0].clientX : 0);
const deltaX = clientX - dragStartX;
const trackWidth = scrollTrack.value.offsetWidth;
if (trackWidth === 0) return;
// Calculate delta as percentage of track
const deltaPercent = (deltaX / trackWidth) * 100;
// New thumb position
let newLeft = dragStartLeft + deltaPercent;
const maxThumb = 100 - thumbWidth.value;
newLeft = Math.max(0, Math.min(maxThumb, newLeft));
thumbLeft.value = newLeft;
// Sync scroll
const el = scrollWrapper.value;
if (el) {
const sw = el.scrollWidth;
const cw = el.clientWidth;
const maxScroll = sw - cw;
el.scrollLeft = (newLeft / maxThumb) * maxScroll;
}
};
const stopScrollDrag = () => {
isDraggingScroll = false;
document.removeEventListener('mousemove', onScrollDrag);
document.removeEventListener('mouseup', stopScrollDrag);
document.removeEventListener('touchmove', onScrollDrag);
document.removeEventListener('touchend', stopScrollDrag);
};
const getRowHintsWidth = () => {
const el = rowHintsRef.value?.$el;
@@ -23,17 +111,27 @@ const getRowHintsWidth = () => {
};
const computeCellSize = () => {
const vw = Math.min(window.innerWidth, 900);
const rootStyles = getComputedStyle(document.documentElement);
const hintWidth = getRowHintsWidth();
const gapRaw = rootStyles.getPropertyValue('--gap-size') || '2px';
const gridPadRaw = rootStyles.getPropertyValue('--grid-padding') || '5px';
const gap = parseFloat(gapRaw);
const gridPad = parseFloat(gridPadRaw);
const bodyStyles = getComputedStyle(document.body);
const bodyPadding = parseFloat(bodyStyles.paddingLeft) + parseFloat(bodyStyles.paddingRight);
const availableForGrid = vw - bodyPadding - hintWidth;
let containerWidth;
if (scrollWrapper.value) {
containerWidth = scrollWrapper.value.clientWidth;
} else {
// Fallback if wrapper not ready: window width minus estimated padding
// Body padding (40) + Layout padding (40) = 80
containerWidth = window.innerWidth - 80;
}
// Ensure we don't have negative space
const availableForGrid = Math.max(0, containerWidth - hintWidth);
const size = Math.floor((availableForGrid - gridPad * 2 - (store.size - 1) * gap) / store.size);
// Keep min 18, max 36
cellSize.value = Math.max(18, Math.min(36, size));
};
@@ -74,6 +172,7 @@ onMounted(() => {
});
isFinePointer.value = window.matchMedia('(pointer: fine)').matches;
window.addEventListener('resize', computeCellSize);
window.addEventListener('resize', checkScroll);
window.addEventListener('mouseup', handleGlobalMouseUp);
window.addEventListener('pointerup', handleGlobalPointerUp);
window.addEventListener('touchend', handleGlobalPointerUp, { passive: true });
@@ -81,6 +180,7 @@ onMounted(() => {
onUnmounted(() => {
window.removeEventListener('resize', computeCellSize);
window.removeEventListener('resize', checkScroll);
window.removeEventListener('mouseup', handleGlobalMouseUp);
window.removeEventListener('pointerup', handleGlobalPointerUp);
window.removeEventListener('touchend', handleGlobalPointerUp);
@@ -89,11 +189,12 @@ onUnmounted(() => {
watch(() => store.size, async () => {
await nextTick();
computeCellSize();
checkScroll();
});
</script>
<template>
<div class="game-board-wrapper">
<div class="game-board-wrapper" ref="scrollWrapper" @scroll="handleScroll">
<div class="game-container" :style="{ '--cell-size': `${cellSize}px` }">
<div class="corner-spacer"></div>
@@ -131,13 +232,39 @@ watch(() => store.size, async () => {
</div>
</div>
</div>
<Teleport to="body">
<div v-if="showScrollbar" class="fixed-scroll-bar">
<div class="fixed-scroll-track" ref="scrollTrack" @pointerdown="startScrollDrag">
<div
class="fixed-scroll-thumb"
:style="{ width: `${thumbWidth}%`, left: `${thumbLeft}%` }"
></div>
</div>
</div>
</Teleport>
</template>
<style scoped>
.game-board-wrapper {
display: flex;
flex-direction: column;
align-items: center;
align-items: flex-start;
overflow-x: auto;
width: 100%;
scrollbar-width: none; /* Hide default scrollbar */
}
/* Desktop: Remove scroll behavior to ensure full grid visibility */
@media (min-width: 769px) {
.game-board-wrapper {
overflow-x: auto; /* Allow scrolling if grid is too large (e.g. 80x80) */
align-items: center; /* Center the grid on desktop */
}
}
.game-board-wrapper::-webkit-scrollbar {
display: none;
}
.game-container {
@@ -145,17 +272,24 @@ watch(() => store.size, async () => {
grid-template-columns: auto auto;
grid-template-rows: auto auto;
gap: 0;
padding: 20px;
background: rgba(0, 0, 0, 0.2);
border-radius: 16px;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
padding: 0;
background: transparent;
box-shadow: none;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
position: relative;
}
.corner-spacer {
height: auto; /* Adapts to Col Hints height */
}
/* Row Hints */
.game-container > :nth-child(3) {
/* No special styles */
}
.grid {
display: grid;
gap: var(--gap-size);

View File

@@ -35,8 +35,8 @@ const { t } = useI18n();
<style scoped>
.guide-panel {
background: rgba(0, 0, 0, 0.25);
border: 1px solid rgba(0, 242, 254, 0.3);
background: var(--panel-bg);
border: 1px solid var(--panel-border);
border-radius: 12px;
padding: 15px;
margin-bottom: 20px;
@@ -46,6 +46,7 @@ const { t } = useI18n();
flex-direction: column;
align-items: center;
backdrop-filter: blur(5px);
box-shadow: var(--panel-shadow);
}
.status-text {
@@ -53,7 +54,7 @@ const { t } = useI18n();
text-align: center;
margin-bottom: 10px;
font-size: 0.9rem;
color: #ccc;
color: var(--text-muted);
min-height: 20px;
font-style: italic;
}

View File

@@ -2,7 +2,7 @@
import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
import { usePuzzleStore } from '@/stores/puzzle';
import { useI18n } from '@/composables/useI18n';
import { Gamepad2, Palette, CircleHelp, Sun, Moon, Menu, X, ChevronDown, ChevronUp } from 'lucide-vue-next';
import { Gamepad2, Palette, CircleHelp, Sun, Moon, Menu, X, ChevronDown, ChevronUp, Monitor } from 'lucide-vue-next';
const store = usePuzzleStore();
const { t, locale, setLocale, locales } = useI18n();
@@ -20,6 +20,7 @@ const searchTerm = ref('');
const langToCountry = {
en: 'gb',
zh: 'cn',
'zh-hant': 'tw',
hi: 'in',
es: 'es',
fr: 'fr',
@@ -61,7 +62,59 @@ const langToCountry = {
gl: 'es-ga',
cy: 'gb-wls',
gd: 'gb-sct',
eu: 'es-pv'
eu: 'es-pv',
af: 'za',
am: 'et',
hy: 'am',
az: 'az',
my: 'mm',
km: 'kh',
ceb: 'ph',
fa: 'ir',
gu: 'in',
ht: 'ht',
he: 'il',
ig: 'ng',
ilo: 'ph',
id: 'id',
ja: 'jp',
jv: 'id',
kn: 'in',
kk: 'kz',
rw: 'rw',
rn: 'bi',
ko: 'kr',
ku: 'tr',
ckb: 'iq',
ky: 'kg',
lo: 'la',
ms: 'my',
mr: 'in',
mn: 'mn',
ne: 'np',
om: 'et',
ps: 'af',
pa: 'in',
so: 'so',
sw: 'tz',
tl: 'ph',
ta: 'in',
te: 'in',
th: 'th',
bo: 'cn',
ti: 'er',
uz: 'uz',
vi: 'vn',
wo: 'sn',
yo: 'ng',
'pt-br': 'br',
'pt-pt': 'pt',
'fr-ca': 'ca',
'nl-be': 'be',
'es-es': 'es',
'es-419': 'mx',
'zh-hant': 'tw',
'zh-hans': 'cn'
};
const getFlagClass = (code) => {
@@ -188,7 +241,7 @@ watch(isMobileMenuOpen, (val) => {
<!-- Game Menu -->
<div class="nav-dropdown">
<button class="btn-neon nav-btn" @click.stop="toggleGameMenu">
<Gamepad2 :size="18" /> NEW GAME
<Gamepad2 :size="18" /> {{ t('nav.newGame') }}
</button>
<transition name="slide-fade">
<div v-if="isGameOpen" class="dropdown-menu">
@@ -210,15 +263,18 @@ watch(isMobileMenuOpen, (val) => {
<!-- Theme Menu -->
<div class="nav-dropdown">
<button class="btn-neon nav-btn" @click.stop="toggleThemeMenu">
<Palette :size="18" /> Theme
<Palette :size="18" /> {{ t('theme.label') }}
</button>
<transition name="slide-fade">
<div v-if="isThemeOpen" class="dropdown-menu theme-menu">
<button class="dropdown-item" @click="setTheme('system')">
<Monitor :size="16" /> {{ t('theme.system') }}
</button>
<button class="dropdown-item" @click="setTheme('light')">
<Sun :size="16" /> Light
<Sun :size="16" /> {{ t('theme.light') }}
</button>
<button class="dropdown-item" @click="setTheme('dark')">
<Moon :size="16" /> Dark
<Moon :size="16" /> {{ t('theme.dark') }}
</button>
</div>
</transition>
@@ -226,7 +282,7 @@ watch(isMobileMenuOpen, (val) => {
<!-- Guide Button -->
<button class="btn-neon nav-btn" @click="toggleGuide">
<CircleHelp :size="18" /> GUIDE
<CircleHelp :size="18" /> {{ t('nav.guide') }}
</button>
<!-- Language Menu -->
@@ -280,7 +336,7 @@ watch(isMobileMenuOpen, (val) => {
<!-- Mobile Game Menu -->
<div class="mobile-group">
<button class="mobile-item-trigger" @click="toggleGameMenu">
<span class="flex-center gap-10"><Gamepad2 :size="20" /> NEW GAME</span>
<span class="flex-center gap-10"><Gamepad2 :size="20" /> {{ t('nav.newGame') }}</span>
<component :is="isGameOpen ? ChevronUp : ChevronDown" :size="16" />
</button>
<div v-if="isGameOpen" class="mobile-sub-menu">
@@ -301,15 +357,18 @@ watch(isMobileMenuOpen, (val) => {
<!-- Mobile Theme Menu -->
<div class="mobile-group">
<button class="mobile-item-trigger" @click="toggleThemeMenu">
<span class="flex-center gap-10"><Palette :size="20" /> Theme</span>
<span class="flex-center gap-10"><Palette :size="20" /> {{ t('theme.label') }}</span>
<component :is="isThemeOpen ? ChevronUp : ChevronDown" :size="16" />
</button>
<div v-if="isThemeOpen" class="mobile-sub-menu">
<button class="mobile-sub-item" @click="setTheme('system')">
<Monitor :size="16" /> {{ t('theme.system') }}
</button>
<button class="mobile-sub-item" @click="setTheme('light')">
<Sun :size="16" /> Light
<Sun :size="16" /> {{ t('theme.light') }}
</button>
<button class="mobile-sub-item" @click="setTheme('dark')">
<Moon :size="16" /> Dark
<Moon :size="16" /> {{ t('theme.dark') }}
</button>
</div>
</div>
@@ -317,7 +376,7 @@ watch(isMobileMenuOpen, (val) => {
<!-- Mobile Guide -->
<div class="mobile-group">
<button class="mobile-item-trigger" @click="toggleGuide">
<span class="flex-center gap-10"><CircleHelp :size="20" /> GUIDE</span>
<span class="flex-center gap-10"><CircleHelp :size="20" /> {{ t('nav.guide') }}</span>
</button>
</div>
@@ -328,7 +387,7 @@ watch(isMobileMenuOpen, (val) => {
<span class="lang-flag-current mobile-flag">
<span :class="getFlagClass(locale)"></span>
</span>
Language
{{ t('language.label') }}
</span>
<component :is="isLangOpen ? ChevronUp : ChevronDown" :size="16" />
</button>
@@ -549,14 +608,14 @@ watch(isMobileMenuOpen, (val) => {
position: fixed;
top: 0;
left: 0;
width: 100vw;
width: 100%;
height: 100vh;
background: rgba(10, 10, 25, 0.98);
backdrop-filter: blur(20px);
z-index: 10000;
display: flex;
flex-direction: column;
padding: 20px;
padding: 0;
overflow-y: auto;
}
@@ -564,22 +623,24 @@ watch(isMobileMenuOpen, (val) => {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 40px;
padding-bottom: 20px;
padding: 10px 20px;
border-bottom: 1px solid rgba(0, 242, 254, 0.2);
flex-shrink: 0;
}
.mobile-title {
font-size: 1.5rem;
font-size: 1.8rem;
color: var(--primary-neon);
margin: 0;
letter-spacing: 2px;
letter-spacing: 3px;
font-weight: 300;
}
.mobile-menu-items {
display: flex;
flex-direction: column;
gap: 15px;
padding: 20px;
}
.mobile-group {

View File

@@ -3,7 +3,7 @@ import { computed } from 'vue';
import { usePuzzleStore } from '@/stores/puzzle';
import { useTimer } from '@/composables/useTimer';
import { useI18n } from '@/composables/useI18n';
import { RotateCcw, RefreshCw, Eye } from 'lucide-vue-next';
import { RotateCcw, RefreshCw, Eye, Undo } from 'lucide-vue-next';
const store = usePuzzleStore();
const { formatTime } = useTimer();
@@ -45,7 +45,7 @@ const progressText = computed(() => `${store.progressPercentage.toFixed(3)}%`);
</button>
<div class="action-separator"></div>
<button class="action-btn" @click="store.undo" :title="t('actions.undo')">
<RotateCcw :size="20" />
<Undo :size="20" />
</button>
</div>
</div>

View File

@@ -409,6 +409,7 @@ p {
display: block;
}
.share-download {
align-self: center;
padding: 8px 18px;

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@ export function useNonogram() {
const dragMode = ref(null); // 'fill', 'empty', 'cross'
const startCellState = ref(null);
const startDrag = (r, c, isRightClick = false) => {
const startDrag = (r, c, isRightClick = false, force = false) => {
if (store.isGameWon) return;
isDragging.value = true;
@@ -16,9 +16,7 @@ export function useNonogram() {
if (isRightClick) {
// Right click logic
// If current is 1 (filled), do nothing usually? Or ignore?
// Standard: Toggle 0 <-> 2
if (current === 1) {
if (!force && current === 1) {
dragMode.value = null; // invalid drag start
return;
}

View File

@@ -24,6 +24,7 @@ export function useSolver() {
return;
}
if (isProcessing.value) return;
store.markGuideUsed();
ensureWorker();
isProcessing.value = true;

View File

@@ -40,7 +40,11 @@ if ('serviceWorker' in navigator) {
}
navigator.serviceWorker.addEventListener('controllerchange', triggerReload)
const checkForUpdate = () => {
navigator.serviceWorker.getRegistration().then((registration) => registration?.update())
navigator.serviceWorker.getRegistration().then((registration) => {
if (registration) {
registration.update()
}
})
}
window.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') checkForUpdate()

View File

@@ -63,6 +63,7 @@ export const usePuzzleStore = defineStore('puzzle', () => {
const solution = ref([]);
const playerGrid = ref([]); // 0: empty, 1: filled, 2: cross
const isGameWon = ref(false);
const hasUsedGuide = ref(false);
const size = ref(5);
const startTime = ref(null);
const elapsedTime = ref(0);
@@ -116,6 +117,7 @@ export const usePuzzleStore = defineStore('puzzle', () => {
resetGrid();
isGameWon.value = false;
hasUsedGuide.value = false;
elapsedTime.value = 0;
startTimer();
}
@@ -130,6 +132,7 @@ export const usePuzzleStore = defineStore('puzzle', () => {
resetGrid();
isGameWon.value = false;
hasUsedGuide.value = false;
elapsedTime.value = 0;
startTimer();
}
@@ -238,6 +241,7 @@ export const usePuzzleStore = defineStore('puzzle', () => {
solution: solution.value,
playerGrid: playerGrid.value,
isGameWon: isGameWon.value,
hasUsedGuide: hasUsedGuide.value,
elapsedTime: elapsedTime.value,
moves: moves.value,
history: history.value
@@ -316,6 +320,7 @@ export const usePuzzleStore = defineStore('puzzle', () => {
if (currentLevelId.value === 'custom') {
resetGrid();
isGameWon.value = false;
hasUsedGuide.value = false;
elapsedTime.value = 0;
startTimer();
saveState();
@@ -324,6 +329,12 @@ export const usePuzzleStore = defineStore('puzzle', () => {
}
}
function markGuideUsed() {
if (isGameWon.value) return;
hasUsedGuide.value = true;
saveState();
}
function closeWinModal() {
if (!isGameWon.value) return;
isGameWon.value = false;
@@ -347,7 +358,9 @@ export const usePuzzleStore = defineStore('puzzle', () => {
loadState, // expose loadState
moves,
undo,
closeWinModal
closeWinModal,
hasUsedGuide,
markGuideUsed
};
});

View File

@@ -1,3 +1,5 @@
@import './scrollbar.css';
:root {
/* --- Glassmorphism Design System --- */
--bg-gradient: linear-gradient(135deg, #43C6AC 0%, #191654 100%);
@@ -52,6 +54,9 @@
--scroll-track: rgba(0, 0, 0, 0.1);
--scroll-thumb: rgba(255, 255, 255, 0.2);
--scroll-thumb-hover: var(--accent-cyan);
--fixed-bar-bg: rgba(0, 0, 0, 0.85);
--fixed-bar-thumb: rgba(0, 242, 255, 0.5);
--fixed-bar-thumb-hover: rgba(0, 242, 255, 0.8);
/* Rozmiary */
--cell-size: 30px;
@@ -113,6 +118,9 @@
--scroll-track: rgba(15, 23, 42, 0.08);
--scroll-thumb: rgba(15, 23, 42, 0.2);
--scroll-thumb-hover: #0ea5e9;
--fixed-bar-bg: rgba(248, 250, 255, 0.95);
--fixed-bar-thumb: rgba(14, 165, 233, 0.5);
--fixed-bar-thumb-hover: rgba(14, 165, 233, 0.8);
}
* {
@@ -121,6 +129,11 @@
-webkit-user-select: none;
}
html {
overflow-x: hidden;
width: 100%;
}
body {
margin: 0;
padding: 20px;

54
src/styles/scrollbar.css Normal file
View File

@@ -0,0 +1,54 @@
/* Fixed Scroll Bar */
.fixed-scroll-bar {
position: fixed;
bottom: 15px;
left: 50%;
transform: translateX(-50%);
width: 85%;
max-width: 400px;
height: 44px; /* Increased hit area */
background: transparent;
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
opacity: 0;
animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
pointer-events: none;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateX(-50%) translateY(10px); }
to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.fixed-scroll-track {
width: 100%;
height: 14px; /* Increased visual thickness */
background: rgba(15, 23, 42, 0.4);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
border-radius: 7px;
position: relative;
pointer-events: auto;
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.fixed-scroll-thumb {
position: absolute;
top: 0;
height: 100%;
background: var(--primary-accent);
border-radius: 7px;
cursor: grab;
box-shadow: 0 0 12px rgba(0, 242, 255, 0.5);
transition: background 0.2s ease, box-shadow 0.2s ease;
}
.fixed-scroll-thumb:active {
cursor: grabbing;
background: #fff;
box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

View File

@@ -45,8 +45,8 @@ export function generateRandomGrid(size) {
for (let i = 0; i < size; i++) {
const row = [];
for (let j = 0; j < size; j++) {
// ~50% chance of being filled
row.push(Math.random() > 0.5 ? 1 : 0);
// ~25% empty cells
row.push(Math.random() > 0.25 ? 1 : 0);
}
grid.push(row);
}

View File

@@ -0,0 +1,51 @@
import { describe, it, expect } from 'vitest'
import { calculateHints } from './puzzleUtils'
describe('puzzleUtils', () => {
it('calculateHints correctly calculates hints for a simple grid', () => {
const grid = [
[1, 0, 1],
[1, 1, 1],
[0, 1, 0]
]
// Row 0: 1, then space, then 1 -> [1, 1]
// Row 1: 1, 1, 1 -> [3]
// Row 2: space, 1, space -> [1]
// Col 0: 1, 1, 0 -> [2]
// Col 1: 0, 1, 1 -> [2] ? Wait. Col 1 is 0, 1, 1. So space, 1, 1 -> [2].
// Let's trace col 1 manually:
// r0,c1 = 0
// r1,c1 = 1 -> count=1
// r2,c1 = 1 -> count=2
// end -> push 2.
// So Col 1 is [2].
// Wait, my manual trace above for col 1:
// grid[0][1] is 0.
// grid[1][1] is 1.
// grid[2][1] is 1.
// Yes, [2].
// Col 2: 1, 1, 0 -> [2].
const expected = {
rowHints: [[1, 1], [3], [1]],
colHints: [[2], [2], [2]]
}
expect(calculateHints(grid)).toEqual(expected)
})
it('calculateHints handles empty rows/cols', () => {
const grid = [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
const expected = {
rowHints: [[0], [0], [0]],
colHints: [[0], [0], [0]]
}
expect(calculateHints(grid)).toEqual(expected)
})
})

60
update_i18n_guide.cjs Normal file
View File

@@ -0,0 +1,60 @@
const fs = require('fs');
const filePath = 'src/composables/useI18n.js';
let content = fs.readFileSync(filePath, 'utf8');
// 1. Add key to all language objects
const lines = content.split('\n');
const newLines = [];
let insideLang = false;
let currentLang = null;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const langStartMatch = line.match(/^\s{2}(['"]?[\w-]+['"]?): \{/);
if (langStartMatch) {
insideLang = true;
currentLang = langStartMatch[1].replace(/['"]/g, '');
}
if (insideLang && (line.trim() === '},' || line.trim() === '}')) {
let translation = 'GUIDE';
if (currentLang === 'pl') translation = 'PRZEWODNIK';
if (currentLang === 'es') translation = 'GUÍA';
if (currentLang === 'fr') translation = 'GUIDE';
if (currentLang === 'de') translation = 'ANLEITUNG';
if (currentLang === 'it') translation = 'GUIDA';
if (currentLang === 'pt' || currentLang === 'pt-br') translation = 'GUIA';
if (currentLang === 'ru') translation = 'РУКОВОДСТВО';
if (currentLang === 'zh') translation = '指南';
// Ensure previous line has comma
if (newLines.length > 0) {
const lastLine = newLines[newLines.length - 1];
if (!lastLine.trim().endsWith(',') && !lastLine.trim().endsWith('{')) {
newLines[newLines.length - 1] = lastLine + ',';
}
}
newLines.push(` 'nav.guide': '${translation}'`);
insideLang = false;
currentLang = null;
}
newLines.push(line);
}
content = newLines.join('\n');
// 2. Add to requiredKeys
// Find "const requiredKeys = ["
// We know it ends with 'nav.newGame' now.
content = content.replace(
"'nav.newGame'",
"'nav.newGame','nav.guide'"
);
fs.writeFileSync(filePath, content);
console.log('Updated useI18n.js with nav.guide');

View File

@@ -4,11 +4,19 @@ import { VitePWA } from 'vite-plugin-pwa'
import path from 'path'
export default defineConfig({
define: {
'__APP_VERSION__': JSON.stringify(process.env.npm_package_version)
},
plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
workbox: {
cleanupOutdatedCaches: true,
skipWaiting: true,
clientsClaim: true,
},
devOptions: {
enabled: true
},

16
vitest.config.js Normal file
View File

@@ -0,0 +1,16 @@
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
plugins: [vue()],
test: {
globals: true,
environment: 'jsdom',
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
}
})