@mark1russell7/site-pages 0.2.14 → 0.2.18
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 +10 -1
- package/build/chunks/build.js +3 -1
- package/build/chunks/build.js.map +1 -1
- package/build/chunks/freshness.d.ts +2 -0
- package/build/chunks/freshness.d.ts.map +1 -1
- package/build/chunks/freshness.js +5 -3
- package/build/chunks/freshness.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/vite.d.ts +13 -0
- package/build/vite.d.ts.map +1 -1
- package/build/vite.js +23 -1
- package/build/vite.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -397,6 +397,14 @@ The class sets `overflow-x: auto` and the background color of the box. Set `--sc
|
|
|
397
397
|
}
|
|
398
398
|
```
|
|
399
399
|
|
|
400
|
+
Markdown has no way to set the class of a table. For a Markdown page, add the plugin `rehypeScrollCue` of the entry `@mark1russell7/site-pages/vite`. It gives the class, a tab stop and a label to each table:
|
|
401
|
+
|
|
402
|
+
```js
|
|
403
|
+
import { rehypeScrollCue } from "@mark1russell7/site-pages/vite";
|
|
404
|
+
|
|
405
|
+
export default defineConfig({ markdown: { rehypePlugins: [rehypeScrollCue] } });
|
|
406
|
+
```
|
|
407
|
+
|
|
400
408
|
## The page helpers
|
|
401
409
|
|
|
402
410
|
The entry `@mark1russell7/site-pages/chrome` has small helpers for the script of a page. It imports no Node.js module, so a site can bundle it for the browser. The package root does not export these helpers. Thus a Node.js program that imports the root gets no DOM types.
|
|
@@ -452,13 +460,14 @@ interface KpiFile {
|
|
|
452
460
|
project: string;
|
|
453
461
|
at: string; // the ISO time of the data in UTC, never the time of the build
|
|
454
462
|
commit: string; // the full commit of the build
|
|
455
|
-
measures: Array<{ id: string; value: number; unit?: string; at?: string }>;
|
|
463
|
+
measures: Array<{ id: string; value: number; unit?: string; at?: string; notCounted?: string }>;
|
|
456
464
|
engines?: Array<{ name: string; version: string }>; // the Status page shows them
|
|
457
465
|
}
|
|
458
466
|
```
|
|
459
467
|
|
|
460
468
|
- Give `at` from the record of the data. The writer has no default for this field, because a build time hides old data.
|
|
461
469
|
- Give `at` on a measure when its data is from another time than the file. The Status page then shows a date for each measure.
|
|
470
|
+
- Give `notCounted` on a count of faults, for example a count of old text. The text names what the count does not read, so a 0 does not seem to tell more than it measured. The Status page shows the text.
|
|
462
471
|
- Without `commit`, the plugin takes `GITHUB_SHA`, else the head of the repository.
|
|
463
472
|
- A fault in the data stops the build, and the old site stays. A fault is a wrong form, a value that is not finite, a repeated id or a time after the check. The time rules apply to the file and to each measure.
|
|
464
473
|
- A site with no Vite build calls `writeKpi(out, input)` from the root entry, before `site-pages build`.
|
package/build/chunks/build.js
CHANGED
|
@@ -1997,6 +1997,7 @@ function openWork(data) {
|
|
|
1997
1997
|
/**
|
|
1998
1998
|
* This function renders the measures of `kpi.json`: their values, the date of the data and the engines that made it.
|
|
1999
1999
|
* A measure with its own date shows that date in a column, so that the line above the table stays true.
|
|
2000
|
+
* A measure that names what it does not count shows that text under the table.
|
|
2000
2001
|
*/
|
|
2001
2002
|
function measures(data) {
|
|
2002
2003
|
const { kpi } = data;
|
|
@@ -2004,9 +2005,10 @@ function measures(data) {
|
|
|
2004
2005
|
const ownDates = kpi.measures.some((measure) => measure.at !== void 0);
|
|
2005
2006
|
const dateCell = (at) => ownDates ? `<td><time datetime="${escapeHtml(at)}">${escapeHtml(longDate(at))}</time></td>` : "";
|
|
2006
2007
|
const rows = kpi.measures.map((measure) => `<tr><th scope="row">${escapeHtml(measure.id)}</th><td>${measure.value}${measure.unit === void 0 ? "" : ` ${escapeHtml(measure.unit)}`}</td>${dateCell(measure.at ?? kpi.at)}</tr>`).join("");
|
|
2008
|
+
const limits = kpi.measures.filter((measure) => measure.notCounted !== void 0).map((measure) => `<p><code>${escapeHtml(measure.id)}</code> does not count: ${escapeHtml(measure.notCounted ?? "")}</p>`).join("");
|
|
2007
2009
|
const engines = kpi.engines ?? [];
|
|
2008
2010
|
const commit = link(`https://github.com/${data.source.github}/commit/${kpi.commit}`, `<code>${kpi.commit.slice(0, 7)}</code>`);
|
|
2009
|
-
return `<section class="sp-section" aria-labelledby="measures"><h2 id="measures">Measures</h2><p>${ownDates ? "The data date of the file is" : "The data of these numbers is from"} <time datetime="${escapeHtml(kpi.at)}" data-sp-data-date>${escapeHtml(longDate(kpi.at))}</time>. The build of ${commit} published them.</p>` + (engines.length > 0 ? `<p>The engines of the data: ${listText(engines.map((engine) => `<code>${escapeHtml(engine.name)}</code> ${escapeHtml(engine.version)}`))}.</p>` : "") + `<div class="sp-table-box" tabindex="0" role="region" aria-label="Measures"><table class="sp-table"><thead><tr><th scope="col">Measure</th><th scope="col">Value</th>${ownDates ? "<th scope=\"col\">Data date</th>" : ""}</tr></thead><tbody>${rows}</tbody></table></div
|
|
2011
|
+
return `<section class="sp-section" aria-labelledby="measures"><h2 id="measures">Measures</h2><p>${ownDates ? "The data date of the file is" : "The data of these numbers is from"} <time datetime="${escapeHtml(kpi.at)}" data-sp-data-date>${escapeHtml(longDate(kpi.at))}</time>. The build of ${commit} published them.</p>` + (engines.length > 0 ? `<p>The engines of the data: ${listText(engines.map((engine) => `<code>${escapeHtml(engine.name)}</code> ${escapeHtml(engine.version)}`))}.</p>` : "") + `<div class="sp-table-box" tabindex="0" role="region" aria-label="Measures"><table class="sp-table"><thead><tr><th scope="col">Measure</th><th scope="col">Value</th>${ownDates ? "<th scope=\"col\">Data date</th>" : ""}</tr></thead><tbody>${rows}</tbody></table></div>` + limits + "</section>";
|
|
2010
2012
|
}
|
|
2011
2013
|
function when(date) {
|
|
2012
2014
|
const text = escapeHtml(longDate(date));
|