nnw-theme 0.0.0 → 0.1.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.
Files changed (60) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -1
  3. package/THIRD_PARTY_NOTICES.md +14 -0
  4. package/assets/fixtures/article.toml +24 -0
  5. package/assets/fixtures/kitchen-sink.toml +36 -0
  6. package/assets/footnotes.js +174 -0
  7. package/assets/guide/design-checklist.md +19 -0
  8. package/assets/guide/fixtures.md +42 -0
  9. package/assets/guide/publishing.md +29 -0
  10. package/assets/guide/skill.md +44 -0
  11. package/assets/guide/theme-format.md +52 -0
  12. package/assets/netnewswire/LICENSE +21 -0
  13. package/assets/netnewswire/Mac/main_mac.js +43 -0
  14. package/assets/netnewswire/Mac/page.html +12 -0
  15. package/assets/netnewswire/Shared/core.css +186 -0
  16. package/assets/netnewswire/Shared/main.js +221 -0
  17. package/assets/netnewswire/Shared/newsfoot.js +173 -0
  18. package/assets/netnewswire/iOS/main_ios.js +520 -0
  19. package/assets/netnewswire/iOS/page.html +19 -0
  20. package/assets/netnewswire/netnewswire.json +46 -0
  21. package/assets/stubs/.agents/skills/creating-nnw-themes/SKILL.md +22 -0
  22. package/assets/stubs/.agents/skills/creating-nnw-themes/agents/openai.yaml +4 -0
  23. package/assets/stubs/.github/workflows/check.yml +14 -0
  24. package/assets/stubs/.github/workflows/pages.yml +24 -0
  25. package/assets/stubs/.github/workflows/release.yml +24 -0
  26. package/assets/stubs/.github/workflows/screenshot.yml +27 -0
  27. package/assets/stubs/AGENTS.md +24 -0
  28. package/dist/browser.js +227 -0
  29. package/dist/cli.js +3 -0
  30. package/dist/commands/bump.js +23 -0
  31. package/dist/commands/capture.js +26 -0
  32. package/dist/commands/check.js +67 -0
  33. package/dist/commands/completion.js +8 -0
  34. package/dist/commands/guide.js +9 -0
  35. package/dist/commands/init.js +155 -0
  36. package/dist/commands/marketplace.js +22 -0
  37. package/dist/commands/package.js +16 -0
  38. package/dist/commands/preview.js +49 -0
  39. package/dist/commands/progress.js +31 -0
  40. package/dist/commands/release-check.js +45 -0
  41. package/dist/commands/render.js +17 -0
  42. package/dist/commands/screenshot.js +36 -0
  43. package/dist/commands/setup.js +4 -0
  44. package/dist/commands/update.js +7 -0
  45. package/dist/commands.js +175 -0
  46. package/dist/completion.js +203 -0
  47. package/dist/interactive.js +32 -0
  48. package/dist/main.js +229 -0
  49. package/dist/netnewswire.js +84 -0
  50. package/dist/package.js +28 -0
  51. package/dist/plist.js +175 -0
  52. package/dist/project.js +195 -0
  53. package/dist/pyformat.js +82 -0
  54. package/dist/render.js +516 -0
  55. package/dist/stubs.js +49 -0
  56. package/dist/urlparse.js +32 -0
  57. package/dist/validate.js +259 -0
  58. package/dist/zip.js +72 -0
  59. package/lldb/nnwdump.py +151 -0
  60. package/package.json +55 -2
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1 +1,75 @@
1
- Placeholder. See https://github.com/dave-atx/nnw-theme
1
+ # nnw-theme
2
+
3
+ Tools for building [NetNewsWire](https://netnewswire.com) themes. `nnw-theme` renders a
4
+ theme into a live preview gallery, checks it in WebKit on Mac, iPhone, and iPad in light
5
+ and dark, and packages it for release.
6
+
7
+ Start a theme from
8
+ [netnewswire-theme-template](https://github.com/dave-atx/netnewswire-theme-template)
9
+ (**Use this template**). The repository you get holds only the theme; the tooling runs
10
+ from npm, so it never needs updating by hand.
11
+
12
+ Not affiliated with or endorsed by Ranchero Software or the NetNewsWire project.
13
+
14
+ ## Usage
15
+
16
+ Run it with `npx`, from anywhere inside the theme repository. It needs Node 24 or newer.
17
+
18
+ ```sh
19
+ npx nnw-theme@1 init # once: name the theme and choose its permanent identifier
20
+ npx nnw-theme@1 setup # once per machine: install the WebKit build checks use
21
+ npx nnw-theme@1 preview # live gallery that rebuilds on save
22
+ npx nnw-theme@1 check # the release gate: package, render, and test every case
23
+ ```
24
+
25
+ `@1` picks the newest 1.x release, so fixes arrive on their own and a breaking 2.0 never
26
+ does. Don't install it globally or add it to a theme repository. To use one exact
27
+ version, name it: `npx nnw-theme@1.4.2 check`.
28
+
29
+ | Command | What it does |
30
+ | --- | --- |
31
+ | `init` | Personalize a fresh copy of the template (run once) |
32
+ | `setup` | Install the WebKit browser that `check` and `screenshot` use (`--with-deps` on Linux CI) |
33
+ | `preview` | Serve the gallery on localhost, open it, and rebuild on save |
34
+ | `render [fixtures…]` | Write the gallery to `build/preview/` once |
35
+ | `check` | Validate and package, then render and test every case in WebKit |
36
+ | `screenshot` | Check one case and save its image; `--promote` makes it the marketplace card |
37
+ | `package` | Validate and build `dist/<Name>.nnwtheme.zip` |
38
+ | `capture` | Explain how to capture a real article from NetNewsWire as a fixture |
39
+ | `bump` | Increase the `Info.plist` `Version` before a release |
40
+ | `marketplace enable` | Add the marketplace discovery topic on GitHub |
41
+ | `guide [topic]` | Print the authoring guide: `skill`, `theme-format`, `fixtures`, `design-checklist`, `publishing` |
42
+ | `completion <shell>` | Print shell completion for `fish`, `zsh`, or `bash` |
43
+
44
+ Every command takes `--help`.
45
+
46
+ ## Shell completion
47
+
48
+ `completion` prints a script that completes commands, options, and fixture names. It
49
+ also defines an `nnw-theme` command that runs `npx --yes nnw-theme@1`, so you can type
50
+ `nnw-theme check`. The wrapper is skipped when a real `nnw-theme` is already installed.
51
+
52
+ ```sh
53
+ # fish
54
+ npx nnw-theme@1 completion fish > ~/.config/fish/conf.d/nnw-theme.fish
55
+ # zsh (~/.zshrc, after compinit)
56
+ source <(npx --yes nnw-theme@1 completion zsh)
57
+ # bash (~/.bashrc)
58
+ source <(npx --yes nnw-theme@1 completion bash)
59
+ ```
60
+
61
+ Fish loads a file rather than running npx at every shell start. Zsh and bash users can
62
+ do the same with a file in `~/.zsh/` or `~/.local/share/bash-completion/completions/`.
63
+ Regenerate it when commands change.
64
+
65
+ ## GitHub workflows
66
+
67
+ Theme repositories call this repository's reusable workflows, pinned to `@v1`:
68
+ `theme-check.yml` (the release gate on every push), `theme-pages.yml` (publishes the
69
+ checked gallery), `theme-release.yml` (manual release), and `theme-screenshot.yml`
70
+ (refreshes the marketplace image). The template carries the ten-line callers.
71
+
72
+ ## Developing
73
+
74
+ See [AGENTS.md](AGENTS.md). Report problems at
75
+ https://github.com/dave-atx/nnw-theme/issues with the version line `check` prints.
@@ -0,0 +1,14 @@
1
+ # Third-party notices
2
+
3
+ The published package includes rendering files from
4
+ [NetNewsWire](https://github.com/Ranchero-Software/NetNewsWire), release `mac-7.1.3`,
5
+ commit `f2daca0f24f29c08d9cb16e1bdc56293fd6fe286`, under `assets/netnewswire/`.
6
+ `netnewswire.json` in the source repository records the SHA-256 of every file, and the
7
+ build verifies each one, including NetNewsWire’s MIT license, which ships beside them as
8
+ `assets/netnewswire/LICENSE`. These files are used only to preview themes; they are
9
+ never added to a theme's release archive.
10
+
11
+ nnw-theme is not affiliated with or endorsed by Ranchero Software or the NetNewsWire
12
+ project.
13
+
14
+ The npm dependencies listed in `package.json` are distributed under their own licenses.
@@ -0,0 +1,24 @@
1
+ title = "A Walk Through the Quiet City"
2
+ preferred_link = "https://example.org/articles/quiet-city"
3
+ external_link = "https://example.org/articles/quiet-city"
4
+ external_link_label = "Read on Example Journal"
5
+ external_link_stripped = "example.org"
6
+ feed_link = "https://example.org/"
7
+ feed_link_title = "Example Journal"
8
+ byline = "Mara Bell"
9
+ date_long = "September 17, 2026"
10
+ date_medium = "Sep 17, 2026"
11
+ date_short = "9/17/26"
12
+ datetime_long = "2026-09-17T08:30:00-07:00"
13
+ datetime_medium = "Sep 17, 2026 at 8:30 AM"
14
+ datetime_short = "9/17/26, 8:30 AM"
15
+ time_long = "8:30:00 AM PDT"
16
+ time_medium = "8:30:00 AM"
17
+ time_short = "8:30 AM"
18
+ avatar_src = ""
19
+ body = """
20
+ <p class="standfirst">Before the doors opened, the city belonged to bakers, bus drivers, and the first warm light on the brickwork.</p>
21
+ <p>I took the long route toward the river. A row of plane trees made a shifting pattern on the pavement, and every open window seemed to hold a different morning.</p>
22
+ <blockquote><p>A familiar street becomes new when you give it enough time.</p></blockquote>
23
+ <p>By nine, the cafés had filled and the spell had softened. I wrote down three small details so I would remember: green tiles, the sound of a broom, and a paper boat turning under the bridge.</p>
24
+ """
@@ -0,0 +1,36 @@
1
+ title = "A Deliberately Long Headline for Testing How a Theme Handles Narrow Screens and Patient Readers"
2
+ preferred_link = "https://example.org/guides/kitchen-sink"
3
+ external_link = "https://example.org/guides/kitchen-sink"
4
+ external_link_label = "Continue reading on Example Journal"
5
+ external_link_stripped = "example.org"
6
+ feed_link = "https://example.org/"
7
+ feed_link_title = "Example Journal With a Long Publication Name"
8
+ byline = "Alexandra Example and the Editorial Systems Working Group"
9
+ date_long = "September 17, 2026"
10
+ date_medium = "Sep 17, 2026"
11
+ date_short = "9/17/26"
12
+ datetime_long = "2026-09-17T08:30:00-07:00"
13
+ datetime_medium = "Sep 17, 2026 at 8:30 AM"
14
+ datetime_short = "9/17/26, 8:30 AM"
15
+ time_long = "8:30:00 AM PDT"
16
+ time_medium = "8:30:00 AM"
17
+ time_short = "8:30 AM"
18
+ avatar_src = ""
19
+ body = """
20
+ <p>This synthetic article checks <strong>strong text</strong>, <em>emphasis</em>, <del>deletions</del>, <mark>highlights</mark>, <a href="https://example.org/reference">ordinary links</a>, and inline <code>code()</code>.</p>
21
+ <h2>Lists and quotations</h2>
22
+ <ul><li>A short item</li><li>A nested list<ul><li>with another level</li></ul></li><li>An item containing aSuperLongUnbrokenIdentifierDesignedToRevealHorizontalOverflowProblemsImmediately</li></ul>
23
+ <ol><li>Measure the readable column.</li><li>Check the rhythm.</li><li>Try large text.</li></ol>
24
+ <blockquote><p>Good defaults should remain calm when the content is not.</p><footer>— A synthetic quotation</footer></blockquote>
25
+ <h2>Code and tabular data</h2>
26
+ <pre><code>def greet(reader: str) -&gt; str:
27
+ return f"Welcome, {reader}. This line is intentionally wider than a phone viewport."
28
+ </code></pre>
29
+ <table><thead><tr><th>Viewport</th><th>Purpose</th><th>Expected behavior</th></tr></thead><tbody><tr><td>macOS</td><td>Reading</td><td>Comfortable measure</td></tr><tr><td>iPhone</td><td>Small screen</td><td>No document overflow</td></tr><tr><td>iPad</td><td>Large text</td><td>Stable hierarchy</td></tr></tbody></table>
30
+ <h2>Media and footnotes</h2>
31
+ <figure><img alt="Abstract green and cream test pattern" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='675' viewBox='0 0 1200 675'%3E%3Crect width='1200' height='675' fill='%23d8d2c6'/%3E%3Ccircle cx='380' cy='337' r='240' fill='%232f6655'/%3E%3Cpath d='M0 560L1200 180V675H0Z' fill='%23f7f5f0'/%3E%3C/svg%3E"><figcaption>A synthetic image checks wide-media scaling.</figcaption></figure>
32
+ <p>The note marker uses common generated markup.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>
33
+ <div class="footnotes"><ol><li id="fn:1"><p>Footnote content should remain readable in place and in NetNewsWire’s popover. <a href="#fnref:1" class="reversefootnote">↩</a></p></li></ol></div>
34
+ <h3>Final heading</h3>
35
+ <p>End of the fixture.</p>
36
+ """
@@ -0,0 +1,174 @@
1
+ // Footnote checks, evaluated in each rendered page after its screenshot. Returns a
2
+ // list of failure messages. NetNewsWire's newsfoot.js opens a popover for any
3
+ // a.footnote whose hash names an element; main.js adds that class to local
4
+ // sup > a[href*='#fn'] links, and a theme script may add it to other formats.
5
+ //
6
+ // expect is the fixture's [expect.footnotes] table: notes maps each marker's text to
7
+ // its note text, plain_links lists selectors for links that are not footnotes, and
8
+ // keep_with_word requires a marker written against its word to stay on its line.
9
+ async ({notes = null, plain_links = [], keep_with_word = false} = {}) => {
10
+ const failures = [];
11
+ const fail = message => failures.push(message);
12
+ const article = document.querySelector(".articleBody");
13
+ if (!article) return failures;
14
+ const text = element => element.textContent.replace(/\s+/g, " ").trim();
15
+ const pause = ms => new Promise(resolve => setTimeout(resolve, ms));
16
+
17
+ // Markers the reader can see; a theme may hide the source's originals.
18
+ const markers = [...article.querySelectorAll("a.footnote")]
19
+ .filter(marker => marker.getClientRects().length);
20
+ const label = marker => text(marker) || marker.getAttribute("href");
21
+
22
+ // Every marker resolves, as newsfoot does, to one non-empty note.
23
+ const noteFor = new Map();
24
+ for (const marker of markers) {
25
+ const id = marker.hash ? decodeURIComponent(marker.hash.slice(1)) : "";
26
+ const target = id && document.getElementById(id);
27
+ if (!target) {
28
+ fail(`footnote ${label(marker)}: ${marker.getAttribute("href")} names no note`);
29
+ continue;
30
+ }
31
+ if (document.querySelectorAll(`[id="${CSS.escape(id)}"]`).length > 1) {
32
+ fail(`footnote ${label(marker)}: more than one element has id ${id}`);
33
+ }
34
+ const note = text(target);
35
+ if (note) noteFor.set(marker, note);
36
+ else fail(`footnote ${label(marker)}: note is empty`);
37
+ }
38
+
39
+ if (notes) {
40
+ const byLabel = new Map(markers.map(marker => [text(marker), marker]));
41
+ for (const [expected, note] of Object.entries(notes)) {
42
+ const marker = byLabel.get(expected);
43
+ if (!marker) fail(`footnote ${expected}: no marker with this text`);
44
+ else if (noteFor.has(marker) && noteFor.get(marker) !== note) {
45
+ fail(`footnote ${expected}: note reads ${JSON.stringify(noteFor.get(marker))}, ` +
46
+ `expected ${JSON.stringify(note)}`);
47
+ }
48
+ }
49
+ for (const found of byLabel.keys()) {
50
+ if (!Object.hasOwn(notes, found)) fail(`unexpected footnote marker ${JSON.stringify(found)}`);
51
+ }
52
+ }
53
+
54
+ for (const selector of plain_links) {
55
+ let links = [];
56
+ try {
57
+ links = [...document.querySelectorAll(selector)];
58
+ } catch {
59
+ fail(`plain link ${selector}: invalid selector`);
60
+ continue;
61
+ }
62
+ if (!links.length) fail(`plain link ${selector}: not found`);
63
+ if (links.some(link => link.matches(".footnote"))) {
64
+ fail(`plain link ${selector}: treated as a footnote`);
65
+ }
66
+ }
67
+
68
+ // The numeral must stand out from what it sits on. A marker's fill may be a
69
+ // tint, so flatten the backgrounds under it before comparing.
70
+ const rgba = value => {
71
+ const n = (value.match(/[\d.]+/g) || []).map(Number);
72
+ return n.length ? [n[0], n[1], n[2], n.length > 3 ? n[3] : 1] : [0, 0, 0, 0];
73
+ };
74
+ const backdrop = element => {
75
+ const layers = [];
76
+ for (let node = element; node; node = node.parentElement) {
77
+ const layer = rgba(getComputedStyle(node).backgroundColor);
78
+ if (!layer[3]) continue;
79
+ layers.push(layer);
80
+ if (layer[3] === 1) break;
81
+ }
82
+ let base = layers.pop() || [255, 255, 255, 1];
83
+ while (layers.length) {
84
+ const top = layers.pop();
85
+ base = [0, 1, 2].map(i => top[i] * top[3] + base[i] * (1 - top[3]));
86
+ }
87
+ return base.slice(0, 3);
88
+ };
89
+ const distance = (a, b) => [0, 1, 2].reduce((sum, i) => sum + Math.abs(a[i] - b[i]), 0);
90
+ for (const marker of markers) {
91
+ // The deepest element carrying the numeral is what actually gets painted.
92
+ const glyph = [...marker.querySelectorAll("*")].filter(e => text(e)).pop() || marker;
93
+ const color = rgba(getComputedStyle(glyph).color);
94
+ const ground = backdrop(marker);
95
+ if (distance(color, ground) <= 60) {
96
+ fail(`footnote ${label(marker)}: numeral ${color.slice(0, 3)} is illegible on ${ground}`);
97
+ }
98
+ const box = marker.getBoundingClientRect();
99
+ const inner = glyph.getBoundingClientRect();
100
+ if (inner.top < box.top - 1 || inner.bottom > box.bottom + 1) {
101
+ fail(`footnote ${label(marker)}: numeral spills out of its marker`);
102
+ }
103
+ }
104
+
105
+ // A marker written against its word, with no space between, stays on that
106
+ // word's line: a line that starts with a marker has lost what it annotates.
107
+ // Opt-in: core.css makes a.footnote inline-block, so a line may break before any
108
+ // marker, and only a theme script can hold the pair together.
109
+ for (const marker of keep_with_word ? markers : []) {
110
+ let box = marker;
111
+ while (box.parentElement && box.parentElement !== article &&
112
+ box.parentElement.childNodes.length === 1) box = box.parentElement;
113
+ // Empty elements, such as an anchor landmark for return links, don't count.
114
+ let before = box.previousSibling;
115
+ while (before && !before.textContent) before = before.previousSibling;
116
+ if (before?.nodeType !== Node.TEXT_NODE || !before.data || /\s$/.test(before.data)) continue;
117
+ const range = document.createRange();
118
+ range.setStart(before, before.data.length - 1);
119
+ range.setEnd(before, before.data.length);
120
+ if (marker.getBoundingClientRect().top >= range.getBoundingClientRect().bottom - 1) {
121
+ fail(`footnote ${label(marker)}: wraps onto a new line, apart from its word`);
122
+ }
123
+ }
124
+
125
+ // Every marker presents alike, whatever markup the source used. Seat is measured
126
+ // against a probe on the marker's own line, so it holds across lines. The probe
127
+ // is a zero-width word joiner: it always fits, so it never wraps to the next line
128
+ // or pushes an unbreakable group there, and the marker is measured beside it.
129
+ const geometry = markers.map(marker => {
130
+ const probe = document.createElement("span");
131
+ probe.textContent = "\u2060";
132
+ marker.after(probe);
133
+ const box = marker.getBoundingClientRect();
134
+ const seat = box.bottom - probe.getBoundingClientRect().bottom;
135
+ probe.remove();
136
+ return {marker, height: box.height, seat, size: parseFloat(getComputedStyle(marker).fontSize)};
137
+ });
138
+ const [first] = geometry;
139
+ for (const g of geometry.slice(1)) {
140
+ const name = `footnote ${label(g.marker)}`;
141
+ const reference = label(first.marker);
142
+ if (Math.abs(g.height - first.height) >= 0.5) {
143
+ fail(`${name}: ${g.height}px tall, footnote ${reference} is ${first.height}px`);
144
+ }
145
+ if (Math.abs(g.seat - first.seat) >= 0.5) {
146
+ fail(`${name}: sits ${g.seat}px from its baseline, footnote ${reference} ${first.seat}px`);
147
+ }
148
+ if (Math.abs(g.size - first.size) >= 0.1) {
149
+ fail(`${name}: font-size ${g.size}px, footnote ${reference} is ${first.size}px`);
150
+ }
151
+ }
152
+
153
+ // End to end: a click opens newsfoot's popover with the note, and moving the
154
+ // marker into newsfoot's container does not restyle it.
155
+ for (const marker of markers) {
156
+ const note = noteFor.get(marker);
157
+ if (note === undefined) continue;
158
+ const resting = marker.getBoundingClientRect();
159
+ marker.dispatchEvent(new MouseEvent("click", {bubbles: true, cancelable: true, view: window}));
160
+ await pause(60);
161
+ const opened = marker.getBoundingClientRect();
162
+ if (Math.abs(resting.width - opened.width) >= 0.5 ||
163
+ Math.abs(resting.height - opened.height) >= 0.5) {
164
+ fail(`footnote ${label(marker)}: ${resting.width}x${resting.height} marker became ` +
165
+ `${opened.width}x${opened.height} when opened`);
166
+ }
167
+ const popover = document.querySelector(".newsfoot-footnote-popover");
168
+ const shown = popover ? text(popover) : null;
169
+ if (shown !== note) fail(`footnote ${label(marker)}: popover showed ${JSON.stringify(shown)}`);
170
+ document.body.dispatchEvent(new MouseEvent("click", {bubbles: true, cancelable: true, view: window}));
171
+ await pause(30);
172
+ }
173
+ return failures;
174
+ }
@@ -0,0 +1,19 @@
1
+ # Visual review checklist
2
+
3
+ Use this after the design direction is established; it is an inspection guide, not a
4
+ prescribed aesthetic.
5
+
6
+ - Read the pleasant article at ordinary size before judging edge cases.
7
+ - Check hierarchy, measure, paragraph rhythm, link recognition, and muted-text
8
+ contrast in both light and dark appearance.
9
+ - Check long title/byline wrapping on macOS, iPhone, and iPad.
10
+ - Check lists, quotations, inline code, preformatted code, tables, captions, media,
11
+ and footnotes in the kitchen-sink article and any fixtures the theme added. `check`
12
+ verifies footnote popovers and marker consistency; judge how they look.
13
+ - Confirm wide media and long tokens do not create document-level horizontal scroll.
14
+ - Check large-text macOS and iPhone renders for clipping, overlap, and lost hierarchy.
15
+ These exercise the real mechanisms: a macOS size class and an iOS Dynamic Type size.
16
+ - Check JavaScript-off macOS and iPhone renders for readable content and usable links.
17
+ - Inspect a real WebKit screenshot, not only the live gallery or Chromium fallback.
18
+ - Promote `screenshots/theme-preview.png` only when the 16:10 macOS article image is
19
+ an intentional representation of the release.
@@ -0,0 +1,42 @@
1
+ # Fixtures
2
+
3
+ Read this when adding, capturing, or changing the articles previews render.
4
+
5
+ Each `fixtures/*.toml` is one article: keys are the template macros, and any omitted
6
+ key renders empty. `article` and `kitchen-sink` are built into `nnw-theme` and get the
7
+ full matrix plus the large-text and Article-JavaScript-off cases; a repository's own
8
+ `fixtures/article.toml` or `fixtures/kitchen-sink.toml` replaces the built-in one. Every other fixture is
9
+ checked on macOS and iPhone in light and dark. Names used by check scenarios
10
+ (`large-text`, `article-javascript-off`) are reserved. Use `'''literal'''` strings for
11
+ HTML bodies so they need no escaping.
12
+
13
+ Prefer real articles for content a theme must handle. `npx nnw-theme@1 capture`
14
+ prints the steps for saving the selected article from a NetNewsWire debug build with
15
+ the `nnwdump` lldb command; it needs Xcode and a NetNewsWire clone, so the person
16
+ usually runs it. Rendering swaps every image that would load over the network for a
17
+ same-size placeholder and a network feed icon for a generated one; do not inline or
18
+ fetch the originals.
19
+
20
+ Footnote markers are the links NetNewsWire's `newsfoot.js` handles: `a.footnote`.
21
+ Its `main.js` adds that class to local `sup > a[href*='#fn']` links; a theme script
22
+ may add it to other formats. `check` requires every visible marker to resolve to a
23
+ non-empty note with a unique id, stay legible on its background, match the other
24
+ markers' height, font size, and baseline offset, and open a popover with its note
25
+ without resizing. A fixture may declare exact expectations after its other keys:
26
+
27
+ ```toml
28
+ [expect.footnotes]
29
+ plain_links = ["#ordinary-sup-link"] # CSS selectors that must not become markers
30
+ keep_with_word = true # markers must not wrap apart from their word
31
+
32
+ [expect.footnotes.notes]
33
+ "1" = "First note." # marker text as rendered = note text
34
+ ```
35
+
36
+ With `notes`, every listed marker must exist and any other marker fails. With
37
+ `keep_with_word`, a marker written against its word, with no space, must not wrap
38
+ onto a new line apart from it. NetNewsWire's `core.css` makes `a.footnote`
39
+ `inline-block`, which allows that break, and CSS alone cannot remove it: a theme
40
+ script must hold the pair together, for example in a `white-space: nowrap` span.
41
+ Expectations describe the theme's own scripts, so they are skipped with Article
42
+ JavaScript off.
@@ -0,0 +1,29 @@
1
+ # Publishing and marketplace listing
2
+
3
+ Read this before versioning, promoting the marketplace screenshot, changing GitHub
4
+ metadata, or releasing.
5
+
6
+ Run `npx nnw-theme@1 bump`, commit the new integer `Version`, and run
7
+ `npx nnw-theme@1 check`. The bundle filename and `ThemeIdentifier` cannot change
8
+ after the first release. Release tags may use any valid Git ref beginning with `v`;
9
+ semantic tags such as `v1.0.0` are the suggested default and are independent of the
10
+ plist version.
11
+
12
+ Publishing is manual: use **Actions → Publish theme → Run workflow** or an equivalent
13
+ explicitly authorized GitHub CLI action. Tag pushes do not publish. The workflow uses
14
+ the current default-branch HEAD, refuses an existing tag/release, compares identity
15
+ and version to the previous stable release, and uploads one
16
+ `<Name>.nnwtheme.zip` asset. Notes are optional; when they are empty and
17
+ `.github/cliff.toml` exists, git-cliff generates them from the commits since the
18
+ previous tag.
19
+
20
+ Marketplace participation is optional. Automatic discovery expects a public,
21
+ non-archived, non-fork repository; the `netnewswire-theme` or `netnewswire` topic; a
22
+ stable GitHub release; and the valid ZIP asset. A useful repository description and
23
+ `screenshots/theme-preview.png` improve the card. Missing optional marketplace/card
24
+ metadata warns but does not block publication. `npx nnw-theme@1 marketplace enable`
25
+ adds the recommended topic through the author’s authenticated `gh` session.
26
+
27
+ Creating releases, topics, branches, pull requests, or other GitHub state is external
28
+ mutation. Confirm the person’s intent immediately before doing it. Ordinary edits,
29
+ local previews, checks, and packages do not need that additional confirmation.