@profullstack/footer 0.2.0 → 0.2.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/README.md CHANGED
@@ -72,6 +72,7 @@ npx @profullstack/footer html --site https://example.com/ --link Docs=/docs
72
72
  | `ring` | `{ slug: 'profullstack', name: 'Profullstack', host: 'https://rssamplifier.com' }` | |
73
73
  | `css` | `true` | `false` drops the `<style>`; style `.pfs-footer*` yourself |
74
74
  | `houseLinks` | `true` | `false` hides links the template adds for every site |
75
+ | `nonce` | | CSP nonce for the inline `<style>`; or `css: false` and style `.pfs-footer*` yourself |
75
76
 
76
77
  Theme it with `--pfs-footer-muted`, `--pfs-footer-gap` and `--pfs-footer-size` on
77
78
  `.pfs-footer`; colors otherwise inherit from the page.
package/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export interface FooterOptions {
18
18
  css?: boolean;
19
19
  /** false hides the template's house links. */
20
20
  houseLinks?: boolean;
21
+ /** CSP nonce for the inline <style> (style-src 'nonce-...'). */
22
+ nonce?: string;
21
23
  }
22
24
  export interface FooterTemplate {
23
25
  version: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/footer",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "One footer for every Profullstack site: links, copyright and the << Profullstack >> webring nav with Random. Sites render the @latest template from the CDN at runtime, so a release updates every site without a redeploy.",
6
6
  "keywords": ["footer", "webring", "openwebring", "copyright", "react", "nextjs", "hono", "ssr"],
package/src/render.js CHANGED
@@ -109,6 +109,7 @@ export function fill(tpl, vars) {
109
109
  * ring?: { slug?: string, name?: string, host?: string },
110
110
  * css?: boolean,
111
111
  * houseLinks?: boolean,
112
+ * nonce?: string,
112
113
  * }} FooterOptions
113
114
  * @typedef {{ version: string, renderer: number, css: string, link: string, footer: string, houseLinks?: FooterLink[] }} FooterTemplate
114
115
  */
@@ -141,6 +142,7 @@ export function renderFooter(template, opts) {
141
142
  tagline: opts.tagline ?? '',
142
143
  site: canonicalSite(opts.site),
143
144
  name: opts.name ?? '',
145
+ nonce: opts.nonce ?? '',
144
146
  });
145
147
  }
146
148
 
package/src/template.js CHANGED
@@ -21,7 +21,7 @@ const RANDOM = glyph(
21
21
  const VOTE = glyph("<path d='M12 4 21 19H3z'/>");
22
22
 
23
23
  export default {
24
- version: '0.2.0',
24
+ version: '0.2.1',
25
25
  renderer: 1,
26
26
  css: [
27
27
  '.pfs-footer{--pfs-footer-muted:color-mix(in srgb,currentColor 62%,transparent);--pfs-footer-gap:.5rem 1.25rem;--pfs-footer-size:.875rem;',
@@ -41,7 +41,7 @@ export default {
41
41
  link: '<a href="{{href}}"{{#rel}} rel="{{rel}}"{{/rel}}>{{label}}</a>',
42
42
  footer: [
43
43
  '<footer class="pfs-footer" data-pfs-footer="{{version}}">',
44
- '{{#css}}<style>{{{css}}}</style>{{/css}}',
44
+ '{{#css}}<style{{#nonce}} nonce="{{nonce}}"{{/nonce}}>{{{css}}}</style>{{/css}}',
45
45
  '<div class="pfs-footer__inner">',
46
46
  '{{#links}}<nav class="pfs-footer__links" aria-label="Footer">{{{links}}}</nav>{{/links}}',
47
47
  '<nav class="webring pfs-footer__ring" aria-label="{{ring_name}} webring">',
package/template.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.2.0",
2
+ "version": "0.2.1",
3
3
  "renderer": 1,
4
4
  "css": ".pfs-footer{--pfs-footer-muted:color-mix(in srgb,currentColor 62%,transparent);--pfs-footer-gap:.5rem 1.25rem;--pfs-footer-size:.875rem;border-top:1px solid color-mix(in srgb,currentColor 14%,transparent);font-size:var(--pfs-footer-size);line-height:1.5;color:inherit}.pfs-footer__inner{max-width:72rem;margin:0 auto;padding:1.5rem 1rem;display:flex;flex-direction:column;align-items:center;gap:.75rem;text-align:center}.pfs-footer a{color:var(--pfs-footer-muted);text-decoration:none}.pfs-footer a:hover,.pfs-footer a:focus-visible{color:inherit;text-decoration:underline}.pfs-footer__links{display:flex;flex-wrap:wrap;justify-content:center;gap:var(--pfs-footer-gap)}.pfs-footer__ring{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:.6rem}.pfs-footer__icon{display:inline-block;width:1em;height:1em;vertical-align:-.125em;background-color:currentColor;-webkit-mask:var(--pfs-footer-glyph) center/contain no-repeat;mask:var(--pfs-footer-glyph) center/contain no-repeat}.pfs-footer__icon--random{--pfs-footer-glyph:url(\"data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke%3D'black'%20stroke-width%3D'2'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Crect%20x%3D'3'%20y%3D'3'%20width%3D'18'%20height%3D'18'%20rx%3D'3'%2F%3E%3Ccircle%20cx%3D'8'%20cy%3D'8'%20r%3D'1'%2F%3E%3Ccircle%20cx%3D'16'%20cy%3D'8'%20r%3D'1'%2F%3E%3Ccircle%20cx%3D'12'%20cy%3D'12'%20r%3D'1'%2F%3E%3Ccircle%20cx%3D'8'%20cy%3D'16'%20r%3D'1'%2F%3E%3Ccircle%20cx%3D'16'%20cy%3D'16'%20r%3D'1'%2F%3E%3C%2Fsvg%3E\")}.pfs-footer__icon--vote{--pfs-footer-glyph:url(\"data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke%3D'black'%20stroke-width%3D'2'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M12%204%2021%2019H3z'%2F%3E%3C%2Fsvg%3E\")}.pfs-footer__copy{margin:0;color:var(--pfs-footer-muted)}.pfs-footer__copy a{color:inherit}",
5
5
  "link": "<a href=\"{{href}}\"{{#rel}} rel=\"{{rel}}\"{{/rel}}>{{label}}</a>",
6
- "footer": "<footer class=\"pfs-footer\" data-pfs-footer=\"{{version}}\">{{#css}}<style>{{{css}}}</style>{{/css}}<div class=\"pfs-footer__inner\">{{#links}}<nav class=\"pfs-footer__links\" aria-label=\"Footer\">{{{links}}}</nav>{{/links}}<nav class=\"webring pfs-footer__ring\" aria-label=\"{{ring_name}} webring\"><a href=\"{{previous}}\" rel=\"prev\" title=\"Previous site\">&lt;&lt;</a><a href=\"{{ring}}\">{{ring_name}}</a><a href=\"{{next}}\" rel=\"next\" title=\"Next site\">&gt;&gt;</a><a href=\"{{random}}\" title=\"Random site\" aria-label=\"Random site\"><span class=\"pfs-footer__icon pfs-footer__icon--random\" aria-hidden=\"true\"></span></a><a href=\"{{ring}}/vote\" referrerpolicy=\"origin\" title=\"Vote for this site\" aria-label=\"Vote for this site\"><span class=\"pfs-footer__icon pfs-footer__icon--vote\" aria-hidden=\"true\"></span></a></nav><p class=\"pfs-footer__copy\">&copy; {{years}} <a href=\"{{owner_url}}\">{{owner_name}}</a>{{#tagline}} &middot; {{tagline}}{{/tagline}}</p></div></footer>",
6
+ "footer": "<footer class=\"pfs-footer\" data-pfs-footer=\"{{version}}\">{{#css}}<style{{#nonce}} nonce=\"{{nonce}}\"{{/nonce}}>{{{css}}}</style>{{/css}}<div class=\"pfs-footer__inner\">{{#links}}<nav class=\"pfs-footer__links\" aria-label=\"Footer\">{{{links}}}</nav>{{/links}}<nav class=\"webring pfs-footer__ring\" aria-label=\"{{ring_name}} webring\"><a href=\"{{previous}}\" rel=\"prev\" title=\"Previous site\">&lt;&lt;</a><a href=\"{{ring}}\">{{ring_name}}</a><a href=\"{{next}}\" rel=\"next\" title=\"Next site\">&gt;&gt;</a><a href=\"{{random}}\" title=\"Random site\" aria-label=\"Random site\"><span class=\"pfs-footer__icon pfs-footer__icon--random\" aria-hidden=\"true\"></span></a><a href=\"{{ring}}/vote\" referrerpolicy=\"origin\" title=\"Vote for this site\" aria-label=\"Vote for this site\"><span class=\"pfs-footer__icon pfs-footer__icon--vote\" aria-hidden=\"true\"></span></a></nav><p class=\"pfs-footer__copy\">&copy; {{years}} <a href=\"{{owner_url}}\">{{owner_name}}</a>{{#tagline}} &middot; {{tagline}}{{/tagline}}</p></div></footer>",
7
7
  "houseLinks": []
8
8
  }