@puzzmo/cli 1.0.53 → 1.0.54
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/package.json
CHANGED
|
@@ -17,13 +17,14 @@ const stateSchema = defineSchema<State>({
|
|
|
17
17
|
const escapeXml = (s: string) => s.replace(/[<>&"']/g, (c) => `&#${c.charCodeAt(0)};`)
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Renders a small SVG preview of the puzzle
|
|
21
|
-
*
|
|
20
|
+
* Renders a small SVG preview of the puzzle plus its pixel dimensions, so the host can size
|
|
21
|
+
* the thumbnail without parsing the SVG. When an `inputStr` is supplied the preview reflects
|
|
22
|
+
* the player's progress; otherwise it shows a blank board.
|
|
22
23
|
*
|
|
23
24
|
* The host renders this in lists/share cards/completion screens — there's no DOM,
|
|
24
25
|
* no animation, no theme variables. We bake colors from `config.theme` directly.
|
|
25
26
|
*/
|
|
26
|
-
export const renderThumbnail: AppBundle["renderThumbnail"] = (puzzleStr: string, inputStr?: string, config?: ThumbnailConfig)
|
|
27
|
+
export const renderThumbnail: AppBundle["renderThumbnail"] = (puzzleStr: string, inputStr?: string, config?: ThumbnailConfig) => {
|
|
27
28
|
const puzzle = JSON.parse(puzzleStr) as Puzzle
|
|
28
29
|
const { rows, cols } = puzzle
|
|
29
30
|
const cells = rows * cols
|
|
@@ -102,7 +103,7 @@ export const renderThumbnail: AppBundle["renderThumbnail"] = (puzzleStr: string,
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
parts.push(`</svg>`)
|
|
105
|
-
return parts.join("")
|
|
106
|
+
return { svg: parts.join(""), width: size, height: size }
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
const countAdjacent = (mineSet: Set<number>, i: number, rows: number, cols: number): number => {
|