@puzzmo/cli 1.0.38 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/game/create.js +187 -71
- package/lib/commands/game/create.js.map +1 -1
- package/lib/commands/upload.js +49 -2
- package/lib/commands/upload.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/skills/runner.d.ts +2 -0
- package/lib/skills/runner.js +33 -0
- package/lib/skills/runner.js.map +1 -1
- package/lib/util/api.d.ts +5 -0
- package/lib/util/api.js +18 -1
- package/lib/util/api.js.map +1 -1
- package/lib/util/createGame.d.ts +13 -0
- package/lib/util/createGame.js +36 -0
- package/lib/util/createGame.js.map +1 -0
- package/package.json +1 -1
- package/src/commands/game/create.ts +186 -74
- package/src/commands/upload.ts +52 -2
- package/src/index.ts +4 -2
- package/src/skills/runner.ts +35 -0
- package/src/util/api.ts +24 -7
- package/src/util/createGame.ts +60 -0
- package/templates/minesweeper/README.md +13 -0
- package/templates/minesweeper/fixtures/puzzles/easy/9x9.json +16 -0
- package/templates/minesweeper/fixtures/puzzles/hard/16x16.json +46 -0
- package/templates/minesweeper/index.html +19 -0
- package/templates/minesweeper/package.json +17 -0
- package/templates/minesweeper/puzzmo.json +11 -0
- package/templates/minesweeper/src/appBundle.ts +122 -0
- package/templates/minesweeper/src/main.ts +236 -0
- package/templates/minesweeper/src/style.css +160 -0
- package/templates/minesweeper/tsconfig.json +14 -0
- package/templates/minesweeper/vite.config.ts +10 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* Puzzmo subset fonts. ASCII-only — always pair with a system fallback. */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: "Poppins-SemiBold";
|
|
4
|
+
src: url("https://www.puzzmo.com/assets/fonts-subset/Poppins-SemiBold-subset.ttf");
|
|
5
|
+
font-display: swap;
|
|
6
|
+
}
|
|
7
|
+
@font-face {
|
|
8
|
+
font-family: "RedHatMono-Bold";
|
|
9
|
+
src: url("https://www.puzzmo.com/assets/fonts-subset/RedHatMono-Bold-subset.ttf");
|
|
10
|
+
font-display: swap;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Defaults are fallbacks for the simulator before the host sends a theme.
|
|
14
|
+
Real values are set on :root from the Puzzmo Theme object in applyTheme(). */
|
|
15
|
+
:root {
|
|
16
|
+
--bg: #1a1a1a;
|
|
17
|
+
--panel: #2a2a2a;
|
|
18
|
+
--cell: #3a3a3a;
|
|
19
|
+
--cell-revealed: #1f1f1f;
|
|
20
|
+
--border: #4a4a4a;
|
|
21
|
+
--text: #f0f0f0;
|
|
22
|
+
--text-on-cell: #1b1b28;
|
|
23
|
+
--accent: #f0c040;
|
|
24
|
+
--mine: #ff5555;
|
|
25
|
+
--flag: #ffaa55;
|
|
26
|
+
--n1: #6cf;
|
|
27
|
+
--n2: #6f9;
|
|
28
|
+
--n3: #fc6;
|
|
29
|
+
--n4: #f96;
|
|
30
|
+
--n5: #f66;
|
|
31
|
+
--n6: #c6f;
|
|
32
|
+
--n7: #fcf;
|
|
33
|
+
--n8: #fff;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
* {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
body {
|
|
41
|
+
margin: 0;
|
|
42
|
+
min-height: 100vh;
|
|
43
|
+
background: var(--bg);
|
|
44
|
+
color: var(--text);
|
|
45
|
+
font-family: "Poppins-SemiBold", system-ui, sans-serif;
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
padding: 16px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
gap: 12px;
|
|
56
|
+
align-items: center;
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
h1 {
|
|
61
|
+
margin: 0;
|
|
62
|
+
font-size: 18px;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
letter-spacing: 0.5px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
header {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
gap: 8px;
|
|
71
|
+
align-items: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.hud {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 16px;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
background: var(--panel);
|
|
79
|
+
padding: 6px 12px;
|
|
80
|
+
border-radius: 6px;
|
|
81
|
+
min-width: 200px;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.board {
|
|
86
|
+
/* Square board: prefer the smaller of (viewport width minus body padding) and
|
|
87
|
+
(viewport height minus header allowance), clamped to a sane range so the
|
|
88
|
+
board never disappears on tiny screens nor overwhelms huge ones.
|
|
89
|
+
Stored as a custom property so `.cell` can reuse the same length expression
|
|
90
|
+
to size its font without measuring anything in JS. */
|
|
91
|
+
--board-size: clamp(280px, min(100vw - 32px, 100vh - 200px), 900px);
|
|
92
|
+
display: grid;
|
|
93
|
+
grid-template-columns: repeat(var(--cols, 9), 1fr);
|
|
94
|
+
grid-template-rows: repeat(var(--rows, 9), 1fr);
|
|
95
|
+
gap: 2px;
|
|
96
|
+
background: var(--panel);
|
|
97
|
+
padding: 6px;
|
|
98
|
+
border-radius: 6px;
|
|
99
|
+
user-select: none;
|
|
100
|
+
touch-action: manipulation;
|
|
101
|
+
width: var(--board-size);
|
|
102
|
+
aspect-ratio: 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.cell {
|
|
106
|
+
background: var(--cell);
|
|
107
|
+
border: 1px solid var(--border);
|
|
108
|
+
border-radius: 3px;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
font-family: "RedHatMono-Bold", ui-monospace, monospace;
|
|
113
|
+
font-weight: 700;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
color: var(--text-on-cell);
|
|
116
|
+
/* Cell width ≈ board-size / cols. Glyph at ~55% of cell width. CSS variables
|
|
117
|
+
inherit from `.board`, so no JS measurement needed. */
|
|
118
|
+
font-size: calc(var(--board-size) * 0.55 / var(--cols, 9));
|
|
119
|
+
padding: 0;
|
|
120
|
+
line-height: 1;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.cell.revealed {
|
|
125
|
+
background: var(--cell-revealed);
|
|
126
|
+
cursor: default;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.cell.flagged {
|
|
130
|
+
color: var(--flag);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.cell.mine {
|
|
134
|
+
color: var(--mine);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.cell[data-n="1"] {
|
|
138
|
+
color: var(--n1);
|
|
139
|
+
}
|
|
140
|
+
.cell[data-n="2"] {
|
|
141
|
+
color: var(--n2);
|
|
142
|
+
}
|
|
143
|
+
.cell[data-n="3"] {
|
|
144
|
+
color: var(--n3);
|
|
145
|
+
}
|
|
146
|
+
.cell[data-n="4"] {
|
|
147
|
+
color: var(--n4);
|
|
148
|
+
}
|
|
149
|
+
.cell[data-n="5"] {
|
|
150
|
+
color: var(--n5);
|
|
151
|
+
}
|
|
152
|
+
.cell[data-n="6"] {
|
|
153
|
+
color: var(--n6);
|
|
154
|
+
}
|
|
155
|
+
.cell[data-n="7"] {
|
|
156
|
+
color: var(--n7);
|
|
157
|
+
}
|
|
158
|
+
.cell[data-n="8"] {
|
|
159
|
+
color: var(--n8);
|
|
160
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"types": ["vite/client"]
|
|
12
|
+
},
|
|
13
|
+
"include": ["src", "vite.config.ts"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import { puzzmoSimulator, appBundlePlugin } from "@puzzmo/sdk/vite"
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [puzzmoSimulator({ fixturesGlob: "/fixtures/puzzles/**/*.json" }), appBundlePlugin()],
|
|
6
|
+
build: {
|
|
7
|
+
outDir: "dist",
|
|
8
|
+
assetsDir: "assets",
|
|
9
|
+
},
|
|
10
|
+
})
|