@cogniplay/logic-games-sheet 0.5.0 → 0.6.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @cogniplay/logic-games-sheet
2
2
 
3
- Makes the child's printed sheet for a logic-game instance: a one-page PDF with the board at the exact size of the kit's pieces, the variant's title, the instance's instruction and the instance's code. For a Line Counts, a Build a Bridge, a Fill the Shape or a Build the Mirror Image board it also shows the pieces to place, and for a Fair Shares board the pieces to share. The same function serves the content repository's play-test prints in Node and, later, the `/edu` print button in the browser.
3
+ Makes the child's printed sheet for a logic-game instance: a PDF of one page (two for a Rearrange the Pieces board, whose second is the goal picture) with the board at the exact size of the kit's pieces, the variant's title, the instance's instruction and the instance's code. For a Line Counts, a Build a Bridge, a Fill the Shape or a Build the Mirror Image board it also shows the pieces to place, and for a Fair Shares board the pieces to share. The same function serves the content repository's play-test prints in Node and, later, the `/edu` print button in the browser.
4
4
 
5
5
  It builds on `@cogniplay/logic-games`, which draws the board, and on pdfmake 0.3, which lays the page out and embeds the font. The designs are in `docs/superpowers/specs/2026-11-05-logic-games-sheet-design.md`, `docs/superpowers/specs/2026-11-10-line-counts-drawing-design.md`, `docs/superpowers/specs/2026-11-11-fair-shares-drawing-design.md`, `docs/superpowers/specs/2026-11-17-build-a-bridge-drawing-design.md`, `docs/superpowers/specs/2026-11-24-fill-the-shape-drawing-design.md` and `docs/superpowers/specs/2026-11-26-build-the-mirror-image-drawing-design.md`.
6
6
 
@@ -52,19 +52,19 @@ import { renderSheets } from "@cogniplay/logic-games-sheet";
52
52
  const bytes = await renderSheets([first, second, third], { title: "Tuesday, year 3" });
53
53
  ```
54
54
 
55
- `renderSheets` takes a list of the same options and puts each sheet on a page of its own, in the order given, exactly as it prints alone: its own paper, turned its own way, with its own title, code and QR code. Each sheet is a pdfmake section, and `renderSheet` makes its one sheet the same way, so a sheet is the same alone or among others. `title` is the document's, which a viewer names a saved file by; there is none without it. A sheet that can't print fails the whole with a `SheetError`: its `code` is that sheet's code, its message is the code before the reason, and its `cause` is the sheet's own error, so a caller can name the board. An empty list is an error rather than an empty PDF. `renderSheet`'s errors are the sheet's own, without a code, since the caller knows which sheet it asked for. A hundred sheets of mixed games and orientations take about a second and a quarter in a browser on a recent laptop and make a PDF of under 1 MB.
55
+ `renderSheets` takes a list of the same options and puts each sheet on a page of its own (two for a Rearrange the Pieces board), in the order given, exactly as it prints alone: its own paper, turned its own way, with its own title, code and QR code. Each printed page is a pdfmake section, and `renderSheet` makes its one sheet the same way, so a sheet is the same alone or among others. `title` is the document's, which a viewer names a saved file by; there is none without it. A sheet that can't print fails the whole with a `SheetError`: its `code` is that sheet's code, its message is the code before the reason, and its `cause` is the sheet's own error, so a caller can name the board. An empty list is an error rather than an empty PDF. `renderSheet`'s errors are the sheet's own, without a code, since the caller knows which sheet it asked for. A hundred sheets of mixed games and orientations take about a second and a quarter in a browser on a recent laptop and make a PDF of under 1 MB.
56
56
 
57
57
  ### What the sheet holds
58
58
 
59
- One page, A4 or Letter, with 10 mm margins. From the top: the variant's title, when one is given; the instruction; the board, drawn by the renderer at the cell size and centred in the room left; and at the bottom the code with a label and, when a link is given, a QR code to the instance's page. The page is portrait when the board fits upright and landscape otherwise.
59
+ One page (a Rearrange the Pieces board two, below), A4 or Letter, with 10 mm margins. From the top: the variant's title, when one is given; the instruction; the board, drawn by the renderer at the cell size and centred in the room left; and at the bottom the code with a label and, when a link is given, a QR code to the instance's page. The page is portrait when the board fits upright and landscape otherwise.
60
60
 
61
- The pieces on the board print as ghosts, thin outlines with light stripes, since the child covers them with the real pieces. A Line Counts board's clues print beside it, and its pieces to place print under it at half scale, as tiles in the kit's colours or in grey: they say which pieces to take, and the child matches them by shape. A Fair Shares board's grids print at true size, as many side by side as fit, with its pieces to share above them at half scale in the same way. Nothing on its sheet marks a place for a piece to leave out, and nothing prints the shares' sizes or the difference to reach. A Build a Bridge board prints at true size with its circles and squares, any piece already in place solid grey, and its pieces to place under it at half scale as Line Counts' are; with two paths each carries its path's symbol. A Fill the Shape board prints as a Build a Bridge board does, without marks or symbols: the outline at true size with its holes hatched. A Build the Mirror Image board prints as a Fill the Shape board does, with the pattern's grid beside it: the grey pattern, the axis or the point O, the empty board and any piece already in place solid grey, at true size, and the pieces to place under both grids. A No Way Back board prints its start: the board with its holes hatched, the pieces at their starts as ghosts with their letters, A and B, and each target dashed with its piece's letter; no X.
61
+ The pieces on the board print as ghosts, thin outlines with light stripes, since the child covers them with the real pieces. A Line Counts board's clues print beside it, and its pieces to place print under it at half scale, as tiles in the kit's colours or in grey: they say which pieces to take, and the child matches them by shape. A Fair Shares board's grids print at true size, as many side by side as fit, with its pieces to share above them at half scale in the same way. Nothing on its sheet marks a place for a piece to leave out, and nothing prints the shares' sizes or the difference to reach. A Build a Bridge board prints at true size with its circles and squares, any piece already in place solid grey, and its pieces to place under it at half scale as Line Counts' are; with two paths each carries its path's symbol. A Fill the Shape board prints as a Build a Bridge board does, without marks or symbols: the outline at true size with its holes hatched. A Build the Mirror Image board prints as a Fill the Shape board does, with the pattern's grid beside it: the grey pattern, the axis or the point O, the empty board and any piece already in place solid grey, at true size, and the pieces to place under both grids. A No Way Back board prints its start: the board with its holes hatched, the pieces at their starts as ghosts with their letters, A and B, and each target dashed with its piece's letter; no X. A Rearrange the Pieces board prints two pages: its start as a No Way Back board's, the pieces lettered A to E; then its goal picture, the same board at the same size, at the same height and the same way up, with only the targeted pieces, each on its target with its letter, so the goal stays in view when the real pieces cover the start. The goal page is headed "Goal" ("Cél") where the first page has the title, has no instruction, and has the first page's footer.
62
62
 
63
63
  The PDF states its sizes in physical units and asks viewers not to scale it (`PrintScaling: None`). For viewers that ignore that, Edu tells the teacher to print at actual size.
64
64
 
65
65
  ### The limits
66
66
 
67
- A sheet holds a footprint of at most 190×219 mm upright or 259×150 mm sideways, the same numbers the content repository's validator and the backend's import assume. For Amoeba and No Way Back the footprint is the board: every No Way Back piece starts on it and its targets lie on it. For Line Counts it is:
67
+ A sheet holds a footprint of at most 190×219 mm upright or 259×150 mm sideways, the same numbers the content repository's validator and the backend's import assume. For Amoeba, No Way Back and Rearrange the Pieces the footprint is the board: every piece starts on it and the targets lie on it. A Rearrange the Pieces goal page has the same box, and its heading sits in the header, outside the area the footprint measures. For Line Counts it is:
68
68
 
69
69
  - width = (columns + 1 if any row has a clue) × cell size
70
70
  - height = (rows + 1 if any column has a clue + 2 if any piece is to place) × cell size
package/limits.d.ts CHANGED
@@ -49,9 +49,9 @@ export declare const trayBandCells = 2;
49
49
  */
50
50
  export declare function gridsAcross(instance: FairSharesInstance, cellSizeMm?: number): number;
51
51
  /**
52
- * What a board takes on a sheet, in millimetres. For Amoeba and No Way Back
53
- * that is the board: a No Way Back board's pieces start on it, and its
54
- * targets lie on it. For Line Counts: its cells, a cell more across when any row has a
52
+ * What a board takes on a sheet, in millimetres. For Amoeba, No Way Back and
53
+ * Rearrange the Pieces that is the board: their pieces start on it, and the
54
+ * targets lie on it; a Rearrange the Pieces goal page has the same box. For Line Counts: its cells, a cell more across when any row has a
55
55
  * clue, a cell more down when any column has one, and two cells more down
56
56
  * when any piece is to place. For Fair Shares: its grids in rows of
57
57
  * `gridsAcross`, a cell between two grids across and down, and two cells
package/limits.js CHANGED
@@ -81,9 +81,9 @@ export function gridsAcross(instance, cellSizeMm = defaultCellSizeMm) {
81
81
  return Math.ceil(Math.sqrt(instance.shares));
82
82
  }
83
83
  /**
84
- * What a board takes on a sheet, in millimetres. For Amoeba and No Way Back
85
- * that is the board: a No Way Back board's pieces start on it, and its
86
- * targets lie on it. For Line Counts: its cells, a cell more across when any row has a
84
+ * What a board takes on a sheet, in millimetres. For Amoeba, No Way Back and
85
+ * Rearrange the Pieces that is the board: their pieces start on it, and the
86
+ * targets lie on it; a Rearrange the Pieces goal page has the same box. For Line Counts: its cells, a cell more across when any row has a
87
87
  * clue, a cell more down when any column has one, and two cells more down
88
88
  * when any piece is to place. For Fair Shares: its grids in rows of
89
89
  * `gridsAcross`, a cell between two grids across and down, and two cells
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cogniplay/logic-games-sheet",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "pdfmake": "^0.3.13"
16
16
  },
17
17
  "peerDependencies": {
18
- "@cogniplay/logic-games": "^0.5.0"
18
+ "@cogniplay/logic-games": "^0.6.0"
19
19
  },
20
20
  "exports": {
21
21
  ".": {
package/sheet.d.ts CHANGED
@@ -9,11 +9,12 @@ export declare class SheetError extends Error {
9
9
  readonly code: string;
10
10
  constructor(code: string, cause: Error);
11
11
  }
12
- /** One instance's sheet as a one-page PDF. */
12
+ /** One instance's sheet as a PDF: one page, or two for a Rearrange the Pieces board, its start and its goal. */
13
13
  export declare function renderSheet(options: SheetOptions): Promise<Uint8Array>;
14
14
  /**
15
15
  * Several instances' sheets in one PDF, in the order given: each on a page
16
- * of its own, exactly as it prints alone, turned its own way. A sheet that
16
+ * of its own, two for a Rearrange the Pieces board, exactly as it prints
17
+ * alone, turned its own way. A sheet that
17
18
  * can't print fails the whole with a `SheetError` naming it; an empty list
18
19
  * is an error rather than an empty PDF.
19
20
  */
package/sheet.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["src/sheet.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAwVhE;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAKvC;AAuED,8CAA8C;AAC9C,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAE5E;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,EAAE,KAAK,EAAE,GAAE,eAAoB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAKrB"}
1
+ {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["src/sheet.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkahE;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAKvC;AAgGD,gHAAgH;AAChH,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAE5E;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,EAAE,KAAK,EAAE,GAAE,eAAoB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAKrB"}
package/sheet.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isFairShares, isFill, isLineCounts, isLinks, isMirror, renderBoard, } from "@cogniplay/logic-games";
1
+ import { isFairShares, isFill, isLineCounts, isLinks, isMirror, isRearrange, renderBoard, renderGoal, } from "@cogniplay/logic-games";
2
2
  import { boardLimitsMm, boardSizeMm, footprintMm, gridsAcross, sheetOrientation, } from "./limits.js";
3
3
  import { configuredPdfmake, fontName } from "./pdfmake.js";
4
4
  import { wording } from "./wording.js";
@@ -58,7 +58,7 @@ function prepare(options) {
58
58
  if (colour !== "colour" && colour !== "greyscale") {
59
59
  throw new Error(`Unknown colour "${String(colour)}": colour or greyscale`);
60
60
  }
61
- const { label } = known(wording, language, "language");
61
+ const { label, goal: goalHeading } = known(wording, language, "language");
62
62
  const size = boardSizeMm(instance, cellSizeMm);
63
63
  // What the board takes with its clues and its pieces to place; for Amoeba,
64
64
  // the board itself.
@@ -96,8 +96,9 @@ function prepare(options) {
96
96
  // and a Build the Mirror Image board as Fill the Shape's, with its
97
97
  // pattern's grid, its pattern and its axis beside it. A No Way Back board
98
98
  // prints its start: the pieces as ghosts with their letters, the targets
99
- // dashed, no X.
100
- const svg = renderBoard(instance, {
99
+ // dashed, no X. A Rearrange the Pieces board prints its start as No Way
100
+ // Back's, and on a second page its goal picture, the start's size.
101
+ const renderOptions = {
101
102
  cellSizeMm,
102
103
  marks,
103
104
  pieceStyle: "ghost",
@@ -107,8 +108,12 @@ function prepare(options) {
107
108
  ...(isFairShares(instance)
108
109
  ? { gridsPerRow: gridsAcross(instance, cellSizeMm) }
109
110
  : {}),
110
- });
111
+ };
112
+ const svg = renderBoard(instance, renderOptions);
111
113
  const drawing = drawingSizeMm(svg);
114
+ const goal = isRearrange(instance)
115
+ ? { heading: goalHeading, svg: renderGoal(instance, renderOptions) }
116
+ : undefined;
112
117
  // The limits count cells, but a piece or a mark off the board, or pieces to
113
118
  // place that need a second row, make the drawing larger than the count; it
114
119
  // must still fit the way up the footprint chose.
@@ -137,6 +142,7 @@ function prepare(options) {
137
142
  label,
138
143
  svg,
139
144
  drawing,
145
+ goal,
140
146
  pageSize,
141
147
  orientation,
142
148
  pageWidth,
@@ -153,17 +159,43 @@ function prepare(options) {
153
159
  * instance's page in the corner. The board is pushed down by the offset.
154
160
  */
155
161
  function section(sheet, offsetMm) {
156
- const { code, instruction, title, link, label, svg, drawing, pageWidth } = sheet;
162
+ const { instruction, title, svg, drawing } = sheet;
163
+ return page(sheet, [
164
+ { text: instruction },
165
+ {
166
+ svg,
167
+ width: mm(drawing.width),
168
+ height: mm(drawing.height),
169
+ alignment: "center",
170
+ margin: [0, mm(instructionGapMm + offsetMm), 0, 0],
171
+ },
172
+ ], title);
173
+ }
174
+ /**
175
+ * A Rearrange the Pieces sheet's second page: the goal picture, the start's
176
+ * size, under the heading "Goal" in the header's place, where the first
177
+ * page has the title, so it lies outside the area the footprint measures.
178
+ * No instruction; the offset sets the board at the start's height. The
179
+ * footer is the first page's.
180
+ */
181
+ function goalSection(sheet, goal, offsetMm) {
182
+ const { drawing } = sheet;
183
+ return page(sheet, [
184
+ {
185
+ svg: goal.svg,
186
+ width: mm(drawing.width),
187
+ height: mm(drawing.height),
188
+ alignment: "center",
189
+ margin: [0, mm(offsetMm), 0, 0],
190
+ },
191
+ ], goal.heading);
192
+ }
193
+ /** A page of a sheet: what it flows, its header's text if any, and the sheet's footer. */
194
+ function page(sheet, flow, heading) {
195
+ const { code, link, label, pageWidth } = sheet;
157
196
  return {
158
197
  section: [
159
- { text: instruction },
160
- {
161
- svg,
162
- width: mm(drawing.width),
163
- height: mm(drawing.height),
164
- alignment: "center",
165
- margin: [0, mm(instructionGapMm + offsetMm), 0, 0],
166
- },
198
+ ...flow,
167
199
  ...(link === undefined
168
200
  ? []
169
201
  : [
@@ -182,13 +214,13 @@ function section(sheet, offsetMm) {
182
214
  pageOrientation: sheet.orientation,
183
215
  // The header's box is the top margin and the band; the rule is placed
184
216
  // within it from the page's edge, the title flows from its margin.
185
- ...(title === undefined
217
+ ...(heading === undefined
186
218
  ? {}
187
219
  : {
188
220
  header: {
189
221
  stack: [
190
222
  {
191
- text: title,
223
+ text: heading,
192
224
  fontSize: 13,
193
225
  alignment: "center",
194
226
  margin: [mm(marginMm), mm(titleTopMm), mm(marginMm), 0],
@@ -224,10 +256,16 @@ function section(sheet, offsetMm) {
224
256
  },
225
257
  };
226
258
  }
259
+ function pagesOf(sheets) {
260
+ return sheets.flatMap((sheet, index) => [
261
+ { sheet: index, goal: false },
262
+ ...(sheet.goal === undefined ? [] : [{ sheet: index, goal: true }]),
263
+ ]);
264
+ }
227
265
  /**
228
- * The document for the sheets, each board pushed down by its offset, with
229
- * where each board landed reported to `measured` as the layout goes, in the
230
- * sheets' order.
266
+ * The document for the sheets' pages, each board pushed down by its page's
267
+ * offset, with where each board landed reported to `measured` as the layout
268
+ * goes, in the pages' order.
231
269
  */
232
270
  function definition(sheets, offsetsMm, title, measured) {
233
271
  const [first] = sheets;
@@ -247,7 +285,13 @@ function definition(sheets, offsetsMm, title, measured) {
247
285
  mm(marginMm + footerMm),
248
286
  ],
249
287
  defaultStyle: { font: fontName, fontSize: 11 },
250
- content: sheets.map((sheet, index) => section(sheet, offsetsMm[index] ?? 0)),
288
+ content: pagesOf(sheets).map(({ sheet: index, goal }, page) => {
289
+ const sheet = sheets[index];
290
+ const offset = offsetsMm[page] ?? 0;
291
+ return goal && sheet.goal !== undefined
292
+ ? goalSection(sheet, sheet.goal, offset)
293
+ : section(sheet, offset);
294
+ }),
251
295
  // pdfmake reports every node here with its properties, once each and in
252
296
  // the document's order, so the boards are the nodes with an svg.
253
297
  pageBreakBefore: (node) => {
@@ -276,7 +320,7 @@ export class SheetError extends Error {
276
320
  }
277
321
  }
278
322
  /**
279
- * The sheets in one PDF, a page each. A sheet that can't print fails the
323
+ * The sheets in one PDF, a page each, a Rearrange the Pieces board two. A sheet that can't print fails the
280
324
  * whole; with `named`, its error becomes a `SheetError` naming it, since
281
325
  * among many the caller can't tell which it was.
282
326
  */
@@ -294,23 +338,43 @@ async function render(sheets, title, named) {
294
338
  const prepared = sheets.map((sheet) => checked(sheet.code, () => prepare(sheet)));
295
339
  // pdfmake lays out top-down, so the sheets are laid out twice: once to
296
340
  // measure where each board lands under its instruction, and once with each
297
- // board pushed down by half the room left on its page.
341
+ // board pushed down by half the room left on its page. A goal page's board
342
+ // is pushed down to its start's height.
343
+ const pages = pagesOf(prepared);
298
344
  const measured = [];
299
345
  await configuredPdfmake()
300
- .createPdf(definition(prepared, prepared.map(() => 0), title, measured))
346
+ .createPdf(definition(prepared, pages.map(() => 0), title, measured))
301
347
  .getStream();
302
- const offsetsMm = prepared.map((sheet, index) => checked(sheet.code, () => {
303
- const board = measured[index];
304
- const room = board === undefined
305
- ? -1
306
- : sheet.areaBottom - board.boardTopMm - sheet.drawing.height;
307
- // Sheet n is page n, unless its instruction pushed its board onto the
308
- // next one.
309
- if (board?.boardPage !== index + 1 || room < 0) {
310
- throw new Error(`The instruction (${sheet.instruction.length} characters) is too long for a board this tall`);
348
+ const offsetsMm = [];
349
+ pages.forEach(({ sheet: index, goal }, page) => {
350
+ const sheet = prepared[index];
351
+ const board = measured[page];
352
+ // Page n holds the nth board, unless an instruction pushed a board onto
353
+ // the next page.
354
+ const landed = board !== undefined && board.boardPage === page + 1;
355
+ if (goal) {
356
+ offsetsMm.push(checked(sheet.code, () => {
357
+ const start = measured[page - 1];
358
+ const offset = landed && start !== undefined
359
+ ? start.boardTopMm + offsetsMm[page - 1] - board.boardTopMm
360
+ : -1;
361
+ if (offset < 0) {
362
+ throw new Error(`${sheet.code}: the goal page's board doesn't land at the start's height`);
363
+ }
364
+ return offset;
365
+ }));
366
+ return;
311
367
  }
312
- return room / 2;
313
- }));
368
+ offsetsMm.push(checked(sheet.code, () => {
369
+ const room = board === undefined
370
+ ? -1
371
+ : sheet.areaBottom - board.boardTopMm - sheet.drawing.height;
372
+ if (!landed || room < 0) {
373
+ throw new Error(`The instruction (${sheet.instruction.length} characters) is too long for a board this tall`);
374
+ }
375
+ return room / 2;
376
+ }));
377
+ });
314
378
  const created = configuredPdfmake().createPdf(definition(prepared, offsetsMm, title, []));
315
379
  const doc = (await created.getStream());
316
380
  // Ask viewers not to scale the page. PDFKit 0.20 ends the ViewerPreferences
@@ -320,13 +384,14 @@ async function render(sheets, title, named) {
320
384
  root.ViewerPreferences.data.PrintScaling = "None";
321
385
  return await created.getBuffer();
322
386
  }
323
- /** One instance's sheet as a one-page PDF. */
387
+ /** One instance's sheet as a PDF: one page, or two for a Rearrange the Pieces board, its start and its goal. */
324
388
  export async function renderSheet(options) {
325
389
  return await render([options], options.code, false);
326
390
  }
327
391
  /**
328
392
  * Several instances' sheets in one PDF, in the order given: each on a page
329
- * of its own, exactly as it prints alone, turned its own way. A sheet that
393
+ * of its own, two for a Rearrange the Pieces board, exactly as it prints
394
+ * alone, turned its own way. A sheet that
330
395
  * can't print fails the whole with a `SheetError` naming it; an empty list
331
396
  * is an error rather than an empty PDF.
332
397
  */
package/sheet.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.js","sourceRoot":"","sources":["src/sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,0EAA0E;AAC1E,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;AAElD,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB;;;;;;GAMG;AACH,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,gJAAgJ;AAChJ,MAAM,mBAAmB,GAAG,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC;AACtD,uHAAuH;AACvH,MAAM,QAAQ,GAAG,mBAAmB,GAAG,CAAC,GAAG,QAAQ,CAAC;AACpD,+FAA+F;AAC/F,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,2FAA2F;AAC3F,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACvC,0IAA0I;AAC1I,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,mIAAmI;AACnI,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,SAAS,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC3D,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;IACrD,OAAO,MAAM,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA+B,EAC/B,EAAE,KAAK,KAAsB,EAAE;IAE/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC"}
package/src/limits.ts CHANGED
@@ -122,9 +122,9 @@ export function gridsAcross(
122
122
  }
123
123
 
124
124
  /**
125
- * What a board takes on a sheet, in millimetres. For Amoeba and No Way Back
126
- * that is the board: a No Way Back board's pieces start on it, and its
127
- * targets lie on it. For Line Counts: its cells, a cell more across when any row has a
125
+ * What a board takes on a sheet, in millimetres. For Amoeba, No Way Back and
126
+ * Rearrange the Pieces that is the board: their pieces start on it, and the
127
+ * targets lie on it; a Rearrange the Pieces goal page has the same box. For Line Counts: its cells, a cell more across when any row has a
128
128
  * clue, a cell more down when any column has one, and two cells more down
129
129
  * when any piece is to place. For Fair Shares: its grids in rows of
130
130
  * `gridsAcross`, a cell between two grids across and down, and two cells
package/src/sheet.ts CHANGED
@@ -4,10 +4,16 @@ import {
4
4
  isLineCounts,
5
5
  isLinks,
6
6
  isMirror,
7
+ isRearrange,
7
8
  renderBoard,
9
+ renderGoal,
8
10
  } from "@cogniplay/logic-games";
9
11
 
10
- import type { ContentSection, TDocumentDefinitions } from "pdfmake/interfaces";
12
+ import type {
13
+ Content,
14
+ ContentSection,
15
+ TDocumentDefinitions,
16
+ } from "pdfmake/interfaces";
11
17
 
12
18
  import {
13
19
  boardLimitsMm,
@@ -52,7 +58,7 @@ const instructionGapMm = 3;
52
58
  /** The renderer's margin around the cells for the heavy outline, which may lie in the page margin. */
53
59
  const outlinePaddingMm = 1;
54
60
 
55
- /** What a layout pass reports: the page the board landed on, and where its top is. */
61
+ /** What a layout pass reports for each board drawn: the page it landed on, and where its top is. */
56
62
  interface Measured {
57
63
  boardPage: number;
58
64
  boardTopMm: number;
@@ -109,6 +115,11 @@ interface Prepared {
109
115
  label: string;
110
116
  svg: string;
111
117
  drawing: { width: number; height: number };
118
+ /**
119
+ * A Rearrange the Pieces board's goal page: its heading, and the goal
120
+ * picture, the start's size. None for the other games.
121
+ */
122
+ goal: { heading: string; svg: string } | undefined;
112
123
  pageSize: (typeof pageSizes)[keyof typeof pageSizes];
113
124
  orientation: "portrait" | "landscape";
114
125
  pageWidth: number;
@@ -134,7 +145,7 @@ function prepare(options: SheetOptions): Prepared {
134
145
  if (colour !== "colour" && colour !== "greyscale") {
135
146
  throw new Error(`Unknown colour "${String(colour)}": colour or greyscale`);
136
147
  }
137
- const { label } = known(wording, language, "language");
148
+ const { label, goal: goalHeading } = known(wording, language, "language");
138
149
 
139
150
  const size = boardSizeMm(instance, cellSizeMm);
140
151
  // What the board takes with its clues and its pieces to place; for Amoeba,
@@ -179,19 +190,24 @@ function prepare(options: SheetOptions): Prepared {
179
190
  // and a Build the Mirror Image board as Fill the Shape's, with its
180
191
  // pattern's grid, its pattern and its axis beside it. A No Way Back board
181
192
  // prints its start: the pieces as ghosts with their letters, the targets
182
- // dashed, no X.
183
- const svg = renderBoard(instance, {
193
+ // dashed, no X. A Rearrange the Pieces board prints its start as No Way
194
+ // Back's, and on a second page its goal picture, the start's size.
195
+ const renderOptions = {
184
196
  cellSizeMm,
185
197
  marks,
186
- pieceStyle: "ghost",
198
+ pieceStyle: "ghost" as const,
187
199
  pieceColours: colour === "colour" ? pieceColours : undefined,
188
200
  trayScale: 0.5,
189
201
  trayWidthMm: limit.width,
190
202
  ...(isFairShares(instance)
191
203
  ? { gridsPerRow: gridsAcross(instance, cellSizeMm) }
192
204
  : {}),
193
- });
205
+ };
206
+ const svg = renderBoard(instance, renderOptions);
194
207
  const drawing = drawingSizeMm(svg);
208
+ const goal = isRearrange(instance)
209
+ ? { heading: goalHeading, svg: renderGoal(instance, renderOptions) }
210
+ : undefined;
195
211
 
196
212
  // The limits count cells, but a piece or a mark off the board, or pieces to
197
213
  // place that need a second row, make the drawing larger than the count; it
@@ -227,6 +243,7 @@ function prepare(options: SheetOptions): Prepared {
227
243
  label,
228
244
  svg,
229
245
  drawing,
246
+ goal,
230
247
  pageSize,
231
248
  orientation,
232
249
  pageWidth,
@@ -244,10 +261,10 @@ function prepare(options: SheetOptions): Prepared {
244
261
  * instance's page in the corner. The board is pushed down by the offset.
245
262
  */
246
263
  function section(sheet: Prepared, offsetMm: number): ContentSection {
247
- const { code, instruction, title, link, label, svg, drawing, pageWidth } =
248
- sheet;
249
- return {
250
- section: [
264
+ const { instruction, title, svg, drawing } = sheet;
265
+ return page(
266
+ sheet,
267
+ [
251
268
  { text: instruction },
252
269
  {
253
270
  svg,
@@ -256,6 +273,49 @@ function section(sheet: Prepared, offsetMm: number): ContentSection {
256
273
  alignment: "center",
257
274
  margin: [0, mm(instructionGapMm + offsetMm), 0, 0],
258
275
  },
276
+ ],
277
+ title
278
+ );
279
+ }
280
+
281
+ /**
282
+ * A Rearrange the Pieces sheet's second page: the goal picture, the start's
283
+ * size, under the heading "Goal" in the header's place, where the first
284
+ * page has the title, so it lies outside the area the footprint measures.
285
+ * No instruction; the offset sets the board at the start's height. The
286
+ * footer is the first page's.
287
+ */
288
+ function goalSection(
289
+ sheet: Prepared,
290
+ goal: { heading: string; svg: string },
291
+ offsetMm: number
292
+ ): ContentSection {
293
+ const { drawing } = sheet;
294
+ return page(
295
+ sheet,
296
+ [
297
+ {
298
+ svg: goal.svg,
299
+ width: mm(drawing.width),
300
+ height: mm(drawing.height),
301
+ alignment: "center",
302
+ margin: [0, mm(offsetMm), 0, 0],
303
+ },
304
+ ],
305
+ goal.heading
306
+ );
307
+ }
308
+
309
+ /** A page of a sheet: what it flows, its header's text if any, and the sheet's footer. */
310
+ function page(
311
+ sheet: Prepared,
312
+ flow: Content[],
313
+ heading: string | undefined
314
+ ): ContentSection {
315
+ const { code, link, label, pageWidth } = sheet;
316
+ return {
317
+ section: [
318
+ ...flow,
259
319
  ...(link === undefined
260
320
  ? []
261
321
  : [
@@ -274,13 +334,13 @@ function section(sheet: Prepared, offsetMm: number): ContentSection {
274
334
  pageOrientation: sheet.orientation,
275
335
  // The header's box is the top margin and the band; the rule is placed
276
336
  // within it from the page's edge, the title flows from its margin.
277
- ...(title === undefined
337
+ ...(heading === undefined
278
338
  ? {}
279
339
  : {
280
340
  header: {
281
341
  stack: [
282
342
  {
283
- text: title,
343
+ text: heading,
284
344
  fontSize: 13,
285
345
  alignment: "center",
286
346
  margin: [mm(marginMm), mm(titleTopMm), mm(marginMm), 0],
@@ -318,9 +378,25 @@ function section(sheet: Prepared, offsetMm: number): ContentSection {
318
378
  }
319
379
 
320
380
  /**
321
- * The document for the sheets, each board pushed down by its offset, with
322
- * where each board landed reported to `measured` as the layout goes, in the
323
- * sheets' order.
381
+ * The pages each sheet prints, in order: its start, and a Rearrange the
382
+ * Pieces board's goal page after it.
383
+ */
384
+ interface Page {
385
+ sheet: number;
386
+ goal: boolean;
387
+ }
388
+
389
+ function pagesOf(sheets: readonly Prepared[]): Page[] {
390
+ return sheets.flatMap((sheet, index) => [
391
+ { sheet: index, goal: false },
392
+ ...(sheet.goal === undefined ? [] : [{ sheet: index, goal: true }]),
393
+ ]);
394
+ }
395
+
396
+ /**
397
+ * The document for the sheets' pages, each board pushed down by its page's
398
+ * offset, with where each board landed reported to `measured` as the layout
399
+ * goes, in the pages' order.
324
400
  */
325
401
  function definition(
326
402
  sheets: readonly Prepared[],
@@ -344,9 +420,13 @@ function definition(
344
420
  mm(marginMm + footerMm),
345
421
  ],
346
422
  defaultStyle: { font: fontName, fontSize: 11 },
347
- content: sheets.map((sheet, index) =>
348
- section(sheet, offsetsMm[index] ?? 0)
349
- ),
423
+ content: pagesOf(sheets).map(({ sheet: index, goal }, page) => {
424
+ const sheet = sheets[index]!;
425
+ const offset = offsetsMm[page] ?? 0;
426
+ return goal && sheet.goal !== undefined
427
+ ? goalSection(sheet, sheet.goal, offset)
428
+ : section(sheet, offset);
429
+ }),
350
430
  // pdfmake reports every node here with its properties, once each and in
351
431
  // the document's order, so the boards are the nodes with an svg.
352
432
  pageBreakBefore: (node) => {
@@ -378,7 +458,7 @@ export class SheetError extends Error {
378
458
  }
379
459
 
380
460
  /**
381
- * The sheets in one PDF, a page each. A sheet that can't print fails the
461
+ * The sheets in one PDF, a page each, a Rearrange the Pieces board two. A sheet that can't print fails the
382
462
  * whole; with `named`, its error becomes a `SheetError` naming it, since
383
463
  * among many the caller can't tell which it was.
384
464
  */
@@ -402,35 +482,60 @@ async function render(
402
482
 
403
483
  // pdfmake lays out top-down, so the sheets are laid out twice: once to
404
484
  // measure where each board lands under its instruction, and once with each
405
- // board pushed down by half the room left on its page.
485
+ // board pushed down by half the room left on its page. A goal page's board
486
+ // is pushed down to its start's height.
487
+ const pages = pagesOf(prepared);
406
488
  const measured: Measured[] = [];
407
489
  await configuredPdfmake()
408
490
  .createPdf(
409
491
  definition(
410
492
  prepared,
411
- prepared.map(() => 0),
493
+ pages.map(() => 0),
412
494
  title,
413
495
  measured
414
496
  )
415
497
  )
416
498
  .getStream();
417
- const offsetsMm = prepared.map((sheet, index) =>
418
- checked(sheet.code, () => {
419
- const board = measured[index];
420
- const room =
421
- board === undefined
422
- ? -1
423
- : sheet.areaBottom - board.boardTopMm - sheet.drawing.height;
424
- // Sheet n is page n, unless its instruction pushed its board onto the
425
- // next one.
426
- if (board?.boardPage !== index + 1 || room < 0) {
427
- throw new Error(
428
- `The instruction (${sheet.instruction.length} characters) is too long for a board this tall`
429
- );
430
- }
431
- return room / 2;
432
- })
433
- );
499
+ const offsetsMm: number[] = [];
500
+ pages.forEach(({ sheet: index, goal }, page) => {
501
+ const sheet = prepared[index]!;
502
+ const board = measured[page];
503
+ // Page n holds the nth board, unless an instruction pushed a board onto
504
+ // the next page.
505
+ const landed = board !== undefined && board.boardPage === page + 1;
506
+ if (goal) {
507
+ offsetsMm.push(
508
+ checked(sheet.code, () => {
509
+ const start = measured[page - 1];
510
+ const offset =
511
+ landed && start !== undefined
512
+ ? start.boardTopMm + offsetsMm[page - 1]! - board.boardTopMm
513
+ : -1;
514
+ if (offset < 0) {
515
+ throw new Error(
516
+ `${sheet.code}: the goal page's board doesn't land at the start's height`
517
+ );
518
+ }
519
+ return offset;
520
+ })
521
+ );
522
+ return;
523
+ }
524
+ offsetsMm.push(
525
+ checked(sheet.code, () => {
526
+ const room =
527
+ board === undefined
528
+ ? -1
529
+ : sheet.areaBottom - board.boardTopMm - sheet.drawing.height;
530
+ if (!landed || room < 0) {
531
+ throw new Error(
532
+ `The instruction (${sheet.instruction.length} characters) is too long for a board this tall`
533
+ );
534
+ }
535
+ return room / 2;
536
+ })
537
+ );
538
+ });
434
539
 
435
540
  const created = configuredPdfmake().createPdf(
436
541
  definition(prepared, offsetsMm, title, [])
@@ -446,14 +551,15 @@ async function render(
446
551
  return await created.getBuffer();
447
552
  }
448
553
 
449
- /** One instance's sheet as a one-page PDF. */
554
+ /** One instance's sheet as a PDF: one page, or two for a Rearrange the Pieces board, its start and its goal. */
450
555
  export async function renderSheet(options: SheetOptions): Promise<Uint8Array> {
451
556
  return await render([options], options.code, false);
452
557
  }
453
558
 
454
559
  /**
455
560
  * Several instances' sheets in one PDF, in the order given: each on a page
456
- * of its own, exactly as it prints alone, turned its own way. A sheet that
561
+ * of its own, two for a Rearrange the Pieces board, exactly as it prints
562
+ * alone, turned its own way. A sheet that
457
563
  * can't print fails the whole with a `SheetError` naming it; an empty list
458
564
  * is an error rather than an empty PDF.
459
565
  */
package/src/wording.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import type { SheetLanguage } from "./types.js";
2
2
 
3
3
  /**
4
- * The sheet's fixed wording, per language: the label before the code. Fixed
5
- * wording stays out of the database (backend decision 6), so it lives here.
4
+ * The sheet's fixed wording, per language: the label before the code, and
5
+ * the heading of a Rearrange the Pieces sheet's goal page. Fixed wording
6
+ * stays out of the database (backend decision 6), so it lives here.
6
7
  */
7
- export const wording: Record<SheetLanguage, { label: string }> = {
8
- hu: { label: "Feladat:" },
9
- en: { label: "Puzzle:" },
8
+ export const wording: Record<SheetLanguage, { label: string; goal: string }> = {
9
+ hu: { label: "Feladat:", goal: "Cél" },
10
+ en: { label: "Puzzle:", goal: "Goal" },
10
11
  };
package/wording.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { SheetLanguage } from "./types.js";
2
2
  /**
3
- * The sheet's fixed wording, per language: the label before the code. Fixed
4
- * wording stays out of the database (backend decision 6), so it lives here.
3
+ * The sheet's fixed wording, per language: the label before the code, and
4
+ * the heading of a Rearrange the Pieces sheet's goal page. Fixed wording
5
+ * stays out of the database (backend decision 6), so it lives here.
5
6
  */
6
7
  export declare const wording: Record<SheetLanguage, {
7
8
  label: string;
9
+ goal: string;
8
10
  }>;
9
11
  //# sourceMappingURL=wording.d.ts.map
package/wording.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"wording.d.ts","sourceRoot":"","sources":["src/wording.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAG5D,CAAC"}
1
+ {"version":3,"file":"wording.d.ts","sourceRoot":"","sources":["src/wording.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAG1E,CAAC"}
package/wording.js CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
- * The sheet's fixed wording, per language: the label before the code. Fixed
3
- * wording stays out of the database (backend decision 6), so it lives here.
2
+ * The sheet's fixed wording, per language: the label before the code, and
3
+ * the heading of a Rearrange the Pieces sheet's goal page. Fixed wording
4
+ * stays out of the database (backend decision 6), so it lives here.
4
5
  */
5
6
  export const wording = {
6
- hu: { label: "Feladat:" },
7
- en: { label: "Puzzle:" },
7
+ hu: { label: "Feladat:", goal: "Cél" },
8
+ en: { label: "Puzzle:", goal: "Goal" },
8
9
  };
9
10
  //# sourceMappingURL=wording.js.map
package/wording.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"wording.js","sourceRoot":"","sources":["src/wording.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAA6C;IAC/D,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;IACzB,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;CACzB,CAAC"}
1
+ {"version":3,"file":"wording.js","sourceRoot":"","sources":["src/wording.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAA2D;IAC7E,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE;IACtC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;CACvC,CAAC"}