@mccaskie-labs/workbench-site 0.15.0 → 0.15.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @mccaskie-labs/workbench-site
2
2
 
3
+ ## 0.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - A page with a tool's own section names the words that section draws, in a comment beside the call, so the project's strings check finds them in use.
8
+ - A "needs you" count's word (such as Bookings' "Booking requests to answer") goes into the strings catalogue only with the admins' dashboard, where it is said. A site that adds Admin home later gets the words of the counts it already has.
9
+ - A tool's own section that ends the page has the same space under it as the site's sections, so it doesn't touch the footer.
10
+
3
11
  ## 0.15.0
4
12
 
5
13
  ### Minor Changes
package/dist/builder.js CHANGED
@@ -156,12 +156,21 @@ export function buildSite(o) {
156
156
  return fail();
157
157
  }
158
158
  const words = { ...strings };
159
+ // A "needs you" count's word is said only on the admins' dashboard (src/pages/needs.ts), so it comes with the dashboard.
160
+ const countWord = (r) => r.needsYou?.label;
159
161
  for (const id of added) {
160
162
  const r = byId.get(id);
161
163
  for (const k of recipeKeys(r))
162
- if (!(k in words))
164
+ if (!(k in words) && (dashboard || k !== countWord(r)))
163
165
  words[k] = r.words[k];
164
166
  }
167
+ if (dashboard)
168
+ for (const p of pages) {
169
+ const r = byId.get(p.recipe);
170
+ const k = r && countWord(r);
171
+ if (r && k && p.path !== null && !(k in words))
172
+ words[k] = r.words[k];
173
+ }
165
174
  writes[stringsPath] = `${JSON.stringify(words, null, 2)}\n`;
166
175
  // The dependency the page files import.
167
176
  let pkg;
@@ -306,7 +315,7 @@ function pageFile(r, version, base, pathOf) {
306
315
  if (s.kind !== "tool")
307
316
  return [s, sectionCode(s, pathOf, r.path)];
308
317
  n += 1;
309
- tools.push({ name: `tool${n}`, from: s.from, fn: s.fn });
318
+ tools.push({ name: `tool${n}`, from: s.from, fn: s.fn, words: s.words });
310
319
  return [s, `tool${n}(w)`];
311
320
  })
312
321
  .filter((x) => x[1] !== null);
@@ -325,7 +334,11 @@ function pageFile(r, version, base, pathOf) {
325
334
  ...(list ? [" const enquiries = await listEnquiries(env, ctx);"] : []),
326
335
  ...(needs ? [" // Each tool's count, read at once (src/pages/needs.ts).", " const needs = await readNeeds(env, ctx);"] : []),
327
336
  ...(guide ? [" // ?view=light, dark or admin: the switch at the top of the guide.", " const view = guideView(request.url);"] : []),
328
- ...tools.map((t) => ` const ${t.name} = await ${t.fn}(request, env, ctx);`),
337
+ ...tools.flatMap((t) => [
338
+ // The words the tool draws itself, named here so the strings check finds them in use.
339
+ ...(t.words.length ? [` // ${t.fn} draws its own words: ${t.words.map((k) => JSON.stringify(k)).join(", ")}.`] : []),
340
+ ` const ${t.name} = await ${t.fn}(request, env, ctx);`,
341
+ ]),
329
342
  ...(owned ? [" // The words the owner changed on the Settings page (\"Your pages' words\").", " const words = await ownerWords(env);"] : []),
330
343
  ];
331
344
  const block = pre.length > 0;
package/dist/styles.js CHANGED
@@ -74,6 +74,7 @@ export const SITE_STYLES = {
74
74
  states: [
75
75
  { selector: "[data-frame=\"landing\"]", about: "Landing frame: full width", css: `max-width:${v("width")}` },
76
76
  { selector: "[data-frame=\"column\"]", about: "Column frame: one reading-width column", css: `max-width:${v("reading")}` },
77
+ { selector: " > :last-child:not(.wb-site-section):not(.wb-site-columns)", about: "A tool's own section last on the page: the same space under it as under the site's sections", css: `margin-bottom:${v("section-space")}` },
77
78
  { selector: "[data-frame=\"two-columns\"]", about: "Two-columns frame: the first section across the top, the rest beside each other", css: `max-width:${v("width")}` },
78
79
  ],
79
80
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mccaskie-labs/workbench-site",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "A Workbench project's standard pages: page recipes, the builder that turns them into thin page files calling Workbench's tools, and the page frames and sections they are drawn with (wb-site-*, restylable, on the project's theme tokens).",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",