@mark1russell7/site-pages 0.5.4 → 0.7.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
@@ -558,9 +558,7 @@ A home page shows the package at work: a visitor types or clicks, and the page s
558
558
  | `examples(row, items, pick)` | Fills a row with one button for each example `[label, value]`. A click starts `pick` with the value. |
559
559
  | `verdict(pass, title, ...reason)` | Makes the line of a verdict: a check or a cross, a title in bold and a reason. The mark has the label "Pass" or "Fail". |
560
560
  | `setField(field, value)` | Sets the value of a field and sends an `input` event, as typing does. |
561
- | `partsAt(text, ranges)` | Divides a text into parts at ranges `[start, end)`. Ranges that overlap become one part. |
562
- | `partsOf(text, find)` | Divides a text into parts at each copy of `find`. |
563
- | `markedText(parts, label)` | Shows a text in a box, with a `mark` element on each part with `hit`. |
561
+ | `markedText(parts, label)` | Shows a text in a box, with a `mark` element on each part with `hit`. `partsAt` and `partsOf` of `@mark1russell7/text/parts` give the parts. |
564
562
 
565
563
  The style gives these classes:
566
564
 
@@ -576,7 +574,8 @@ The style gives these classes:
576
574
  ```ts
577
575
  import "@mark1russell7/site-pages/demo.css";
578
576
  import { byId } from "@mark1russell7/site-pages/chrome";
579
- import { examples, markedText, partsOf, setField, verdict } from "@mark1russell7/site-pages/demo";
577
+ import { examples, markedText, setField, verdict } from "@mark1russell7/site-pages/demo";
578
+ import { partsOf } from "@mark1russell7/text/parts";
580
579
 
581
580
  const input = byId<HTMLInputElement>("find");
582
581
  const result = byId("result");
@@ -640,6 +639,10 @@ The shell is the part of a page that is not its content. The package has two par
640
639
 
641
640
  The entry `@mark1russell7/site-pages/vite` is for `vite.config.ts`. The plugin `siteShell` sets `base` from `SITE_BASE`, sets `build.target` to `es2022`, defines `__BUILD__`, and adds the theme script to the `head` of each HTML page.
642
641
 
642
+ The plugin also adds an icon link to each HTML page with no icon link. Without an icon link, the browser asks for `/favicon.ico`. A project site on GitHub Pages has no such file, so the console shows a 404 error. The option `icon` sets the `href` of the icon. The value `false` adds no icon.
643
+
644
+ The releases page and the status page have the same icon. `PageOptions.icon` sets its `href`. The root entry exports `SITE_ICON_HREF`, `iconLink(href)` and `hasIconLink(html)`, for a page without the plugin.
645
+
643
646
  ```ts
644
647
  import { defineConfig } from "vite";
645
648
  import { siteShell } from "@mark1russell7/site-pages/vite";
@@ -661,7 +664,7 @@ showBuild(byId("build"), __BUILD__, "owner/my-site");
661
664
 
662
665
  | Export of `./vite` | Operation |
663
666
  | --- | --- |
664
- | `siteShell({ themeKey, packageFile })` | Makes the plugin. A `base` or a `build.target` in the config of the site has priority. |
667
+ | `siteShell({ themeKey, packageFile, icon })` | Makes the plugin. A `base` or a `build.target` in the config of the site has priority. |
665
668
  | `siteStamps(input)` | Makes the plugin of the data stamps of a site. |
666
669
  | `themeScript(storageKey)` | Gives the text of the theme script, for a page without the plugin. |
667
670
  | `siteBase(env)` | Gives `SITE_BASE` with one `/` at the end, or `/`. |
@@ -1,4 +1,4 @@
1
- import { A as headCommit, B as versionOfTag, E as readKpi, I as npmPublishTimes, L as compareVersions, M as isShallow, N as originRepository, R as kindOf, S as KpiError, _ as listText, b as KPI_FILE, g as link, h as inlineMarkdown, j as headingDate, k as gitTagDates, m as escapeHtml, v as plural, z as parseVersion } from "./freshness.js";
1
+ import { A as readKpi, B as npmPublishTimes, E as KpiError, F as headingDate, H as kindOf, I as isShallow, L as originRepository, N as gitTagDates, P as headCommit, S as plural, U as parseVersion, V as compareVersions, W as versionOfTag, _ as iconLink, b as link, v as escapeHtml, w as KPI_FILE, x as listText, y as inlineMarkdown } from "./freshness.js";
2
2
  import { stripTypeScriptTypes } from "node:module";
3
3
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
4
4
  import { basename, dirname, isAbsolute, join, posix, resolve } from "node:path";
@@ -1900,6 +1900,7 @@ function pageShell(parts, options) {
1900
1900
  <meta name="color-scheme" content="light dark">
1901
1901
  <title>${escapeHtml(`${parts.title} · ${name}`)}</title>
1902
1902
  <meta name="description" content="${escapeHtml(parts.description)}">
1903
+ ${iconLink(options.icon)}
1903
1904
  <style>${BASE_CSS}${options.extraCss ? `\n${options.extraCss}` : ""}</style>
1904
1905
  <noscript><style>${NO_SCRIPT_CSS}</style></noscript>
1905
1906
  </head>