Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d68c4a6c3d | |||
| 23c9137985 | |||
| c3ddadeb17 | |||
| 36b0c18370 | |||
| 943c045a65 | |||
| 27a1ce38fb |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "vue-nonograms-solid",
|
||||
"version": "1.9.1",
|
||||
"version": "1.9.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "vue-nonograms-solid",
|
||||
"version": "1.9.1",
|
||||
"version": "1.9.4",
|
||||
"dependencies": {
|
||||
"fireworks-js": "^2.10.8",
|
||||
"flag-icons": "^7.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-nonograms-solid",
|
||||
"version": "1.9.1",
|
||||
"version": "1.9.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -190,6 +190,7 @@ onUnmounted(() => {
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
padding-bottom: 50px;
|
||||
padding-top: 100px; /* Space for fixed NavBar */
|
||||
}
|
||||
|
||||
.install-banner {
|
||||
@@ -204,6 +205,9 @@ onUnmounted(() => {
|
||||
max-width: 600px;
|
||||
margin: 0 auto 20px auto; /* Center it manually */
|
||||
box-shadow: var(--banner-shadow);
|
||||
position: sticky;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.install-text {
|
||||
@@ -239,6 +243,9 @@ onUnmounted(() => {
|
||||
margin-right: auto;
|
||||
max-width: 1200px; /* Keep constraint for panels */
|
||||
width: 100%;
|
||||
position: sticky;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.board-section {
|
||||
|
||||
@@ -435,8 +435,10 @@ watch(isMobileMenuOpen, (val) => {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
z-index: 100;
|
||||
position: sticky;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.nav-left {
|
||||
|
||||
@@ -472,27 +472,27 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="share">
|
||||
<div class="share-title">{{ t('win.shareTitle') }}</div>
|
||||
<div class="share-buttons">
|
||||
<div class="social-section">
|
||||
<div class="social-header">{{ t('win.shareTitle') }}</div>
|
||||
<div class="social-grid">
|
||||
<!-- X (Twitter) -->
|
||||
<button class="btn-neon secondary share-btn" :disabled="shareInProgress" :aria-label="t('win.shareX')" @click="shareTo('x')">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" class="share-icon"><path d="M18.901 3H22l-7.21 8.26L23 21h-6.66L11.13 14.76 5.66 21H2.56l7.73-8.83L1 3h6.8l4.63 5.56L18.9 3h.001zm-1.2 15.9h1.77L6.44 5.1H4.44l13.26 13.8z"/></svg>
|
||||
<button class="btn-neon secondary social-item" :disabled="shareInProgress" :aria-label="t('win.shareX')" @click="shareTo('x')">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" class="social-icon"><path d="M18.901 3H22l-7.21 8.26L23 21h-6.66L11.13 14.76 5.66 21H2.56l7.73-8.83L1 3h6.8l4.63 5.56L18.9 3h.001zm-1.2 15.9h1.77L6.44 5.1H4.44l13.26 13.8z"/></svg>
|
||||
</button>
|
||||
<!-- Facebook -->
|
||||
<button class="btn-neon secondary share-btn" :disabled="shareInProgress" :aria-label="t('win.shareFacebook')" @click="shareTo('facebook')">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" class="share-icon"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.791-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>
|
||||
<button class="btn-neon secondary social-item" :disabled="shareInProgress" :aria-label="t('win.shareFacebook')" @click="shareTo('facebook')">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" class="social-icon"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.791-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>
|
||||
</button>
|
||||
<!-- WhatsApp -->
|
||||
<button class="btn-neon secondary share-btn" :disabled="shareInProgress" :aria-label="t('win.shareWhatsapp')" @click="shareTo('whatsapp')">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" class="share-icon"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.008-.57-.008-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>
|
||||
<button class="btn-neon secondary social-item" :disabled="shareInProgress" :aria-label="t('win.shareWhatsapp')" @click="shareTo('whatsapp')">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" class="social-icon"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.008-.57-.008-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>
|
||||
</button>
|
||||
<!-- Download Screenshot (Compact) -->
|
||||
<button class="btn-neon secondary share-btn" :disabled="shareInProgress" :aria-label="t('win.shareDownload')" @click="downloadShareImage">
|
||||
<button class="btn-neon secondary social-item" :disabled="shareInProgress" :aria-label="t('win.shareDownload')" @click="downloadShareImage">
|
||||
<Download :size="20" />
|
||||
</button>
|
||||
<!-- Download SVG (Compact) -->
|
||||
<button class="btn-neon secondary share-btn" :disabled="shareInProgress" aria-label="Download SVG" @click="downloadShareSVG">
|
||||
<button class="btn-neon secondary social-item" :disabled="shareInProgress" aria-label="Download SVG" @click="downloadShareSVG">
|
||||
<FileCode :size="20" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -575,14 +575,14 @@ p {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.share {
|
||||
.social-section {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.share-title {
|
||||
.social-header {
|
||||
font-size: 0.95rem;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
@@ -590,14 +590,14 @@ p {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.share-buttons {
|
||||
.social-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
.social-item {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
padding: 0;
|
||||
@@ -607,14 +607,14 @@ p {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.share-icon {
|
||||
.social-icon {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.share-download {
|
||||
.social-download {
|
||||
align-self: center;
|
||||
padding: 8px 18px;
|
||||
font-size: 0.85rem;
|
||||
|
||||
@@ -2,6 +2,34 @@ import { defineStore } from 'pinia';
|
||||
import { ref, computed } from 'vue';
|
||||
import { generateRandomGrid } from '@/utils/puzzleUtils';
|
||||
|
||||
// Helper: Calculate hints for a line (row or column)
|
||||
function calculateHints(line) {
|
||||
const hints = [];
|
||||
let currentRun = 0;
|
||||
|
||||
for (const cell of line) {
|
||||
if (cell === 1) {
|
||||
currentRun++;
|
||||
} else {
|
||||
if (currentRun > 0) {
|
||||
hints.push(currentRun);
|
||||
currentRun = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentRun > 0) {
|
||||
hints.push(currentRun);
|
||||
}
|
||||
return hints.length > 0 ? hints : [0];
|
||||
}
|
||||
|
||||
// Helper: Validate if a line matches its hints
|
||||
function validateLine(line, targetHints) {
|
||||
const currentHints = calculateHints(line);
|
||||
if (currentHints.length !== targetHints.length) return false;
|
||||
return currentHints.every((h, i) => h === targetHints[i]);
|
||||
}
|
||||
|
||||
// Definicje zagadek (Static Puzzles)
|
||||
const PUZZLES = {
|
||||
easy: {
|
||||
@@ -249,20 +277,32 @@ export const usePuzzleStore = defineStore('puzzle', () => {
|
||||
|
||||
function checkWin() {
|
||||
let correct = true;
|
||||
|
||||
// Calculate expected hints from solution (truth)
|
||||
// We do this dynamically to ensure we always check against the rules of the board
|
||||
const solutionRows = solution.value;
|
||||
const solutionCols = Array(size.value).fill().map((_, c) => solution.value.map(r => r[c]));
|
||||
|
||||
// Check Rows
|
||||
for (let r = 0; r < size.value; r++) {
|
||||
const targetHints = calculateHints(solutionRows[r]);
|
||||
const playerLine = playerGrid.value[r];
|
||||
if (!validateLine(playerLine, targetHints)) {
|
||||
correct = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (correct) {
|
||||
// Check Columns
|
||||
for (let c = 0; c < size.value; c++) {
|
||||
const playerCell = playerGrid.value[r][c];
|
||||
const solutionCell = solution.value[r][c];
|
||||
|
||||
const isFilled = playerCell === 1;
|
||||
const shouldBeFilled = solutionCell === 1;
|
||||
|
||||
if (isFilled !== shouldBeFilled) {
|
||||
const targetHints = calculateHints(solutionCols[c]);
|
||||
const playerLine = playerGrid.value.map(row => row[c]);
|
||||
if (!validateLine(playerLine, targetHints)) {
|
||||
correct = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!correct) break;
|
||||
}
|
||||
|
||||
if (correct) {
|
||||
|
||||
@@ -130,7 +130,6 @@
|
||||
}
|
||||
|
||||
html {
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -139,18 +138,18 @@ body {
|
||||
padding: 20px;
|
||||
font-family: 'Segoe UI', 'Roboto', Helvetica, Arial, sans-serif;
|
||||
background: var(--bg-gradient);
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
color: var(--text-color);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Ensure no other content is visible */
|
||||
#app {
|
||||
width: 100%;
|
||||
max-width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user