@reactwright/template-report 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Reactwright contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # @reactwright/template-report
2
+
3
+ Technical and business report template for the Reactwright document
4
+ engine. US Letter, single-column, Times 11pt with comfortable line
5
+ spacing, optional executive-summary box, decimal section numbering
6
+ (`1.`, `1.1`, `1.1.1`), auto-numbered figure and table captions, and
7
+ a numeric `[N]` bibliography at the back.
8
+
9
+ ## When to use this over alternatives
10
+
11
+ - Pick `@reactwright/template-report` for internal company reports,
12
+ consulting deliverables, white papers, lab write-ups, or any
13
+ professional document that wants decimal section numbering and a
14
+ cover-page-style title block but does not need IEEE branding.
15
+ - Pick `@reactwright/template-ieee-report` for IEEE-branded long-form
16
+ reports (Times serif, Roman section numbers, "Fig. 1." captions).
17
+ - Pick `@reactwright/template-ieee` for two-column IEEE conference
18
+ papers.
19
+ - Pick `@reactwright/template-essay` for short MLA-style essays.
20
+
21
+ ## Format conventions
22
+
23
+ - US Letter paper, 1" top/bottom margins, 1.25" left/right margins.
24
+ - Body: Times New Roman 11pt, line-height 1.4, justified.
25
+ - Title: 18pt bold centered.
26
+ - Author / date: 11pt italic centered below the title.
27
+ - Executive summary / abstract (`role="abstract"`): tinted box with
28
+ bold uppercase heading and justified body inside.
29
+ - Section heads (depth 1): 13pt bold left-aligned, decimal numbering
30
+ (`1.`, `2.`, `3.`, …). The numbering counter is reset for each
31
+ top-level section; subsection counter resets on each new section.
32
+ - Subsection heads (depth 2): 11pt bold left-aligned, decimal
33
+ numbering (`1.1`, `1.2`, `2.1`, …).
34
+ - Body paragraphs: block style — no first-line indent, 6pt top
35
+ margin between paragraphs, justified. The first paragraph after a
36
+ heading has its top margin suppressed (sits flush against the
37
+ heading).
38
+ - Figure captions: 10pt italic centered "Figure N. …" below the
39
+ figure, auto-numbered via the `report-figure` counter.
40
+ - Table captions: 10pt italic left-aligned "Table N. …" above the
41
+ table, auto-numbered via the `report-table` counter.
42
+ - Tables: full-width, fixed-layout, 10pt, light grey rules around
43
+ cells, bold header row on a grey tint with bolder top and bottom
44
+ rules.
45
+ - Citations: `[N]` numeric via `target-counter`.
46
+ - Bibliography (`role="bibliography"`): 10pt with hanging indent and
47
+ `[N]` numeric prefix.
48
+ - Running header on page 2+: document title italic top-left, page
49
+ number top-right (both 9pt).
50
+ - Footer: `page-number / page-count` centered 9pt.
51
+
52
+ ## Usage
53
+
54
+ ```tsx
55
+ import "reactwright/jsx";
56
+ import { Template } from "@reactwright/template-report";
57
+
58
+ export { Template };
59
+
60
+ export default function MyReport() {
61
+ return (
62
+ <document title="Q3 Engineering Review" author="A. Author">
63
+ <section role="abstract" title="Executive Summary">
64
+ <p>
65
+ Three-sentence digest of the report. The template renders
66
+ this in a tinted box at the top of the body.
67
+ </p>
68
+ </section>
69
+
70
+ <section title="Background">
71
+ <p>
72
+ Section-1 prose. Top-level headings auto-number as
73
+ "1. Background", "2. Findings", and so on.
74
+ </p>
75
+
76
+ <section title="Prior work">
77
+ <p>Subsection prose; depth-2 headings number as "1.1".</p>
78
+ </section>
79
+ </section>
80
+
81
+ <section title="Findings">
82
+ <p>
83
+ Body prose with a citation <cite cite="kuhn1962" /> and a
84
+ reference to the figure below.
85
+ </p>
86
+
87
+ <figure src="./build-times.png" caption="Build times by commit" />
88
+ </section>
89
+
90
+ <section title="Recommendations">
91
+ <p>Closing paragraph.</p>
92
+ </section>
93
+
94
+ <refs>
95
+ <ref-entry refKey="kuhn1962">
96
+ T. S. Kuhn, <em>The Structure of Scientific Revolutions</em>,
97
+ University of Chicago Press, 1962.
98
+ </ref-entry>
99
+ </refs>
100
+ </document>
101
+ );
102
+ }
103
+ ```
104
+
105
+ ## Implementation notes
106
+
107
+ Styling is expressed entirely via the styling dialect (`<styles>` +
108
+ `<rule>`). The exported `REPORT_STYLES` is the CSS-dialect source the
109
+ template binds; there is no engine-bypass CSS.
110
+
111
+ Section numbering is implemented through the dialect's `numbering`
112
+ declaration on the section-head classes — the engine emits the
113
+ counter machinery and the `report-subsection` counter resets when a
114
+ new `report-section` increment fires.
115
+
116
+ The bibliography is rendered by the userland `<Bibliography>` helper
117
+ that the template includes after the body slot (titled "References"
118
+ in this template). Author-side, supply entries via a `<refs>` block.
119
+
120
+ ## Limitations
121
+
122
+ - **No cover page.** Title and author render at the top of page 1
123
+ above the body, not on a dedicated cover. Authors who need a cover
124
+ page can add a separate first section with the cover content and a
125
+ `page-break` after it, or extend the template to register a
126
+ cover-page regime.
127
+ - **No table of contents.** A TOC is not part of the default chrome.
128
+ Authors who need one can add `<toc />` (deprecated, but functional)
129
+ or compose a TOC from `<toc-data>` per the styling spec.
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@reactwright/template-report",
3
+ "version": "0.1.0",
4
+ "description": "Business/technical report template for the Reactwright document engine.",
5
+ "license": "MIT",
6
+ "author": "Reactwright contributors",
7
+ "homepage": "https://github.com/PurpleReverie/reactwright/tree/main/packages/template-report#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/PurpleReverie/reactwright.git",
11
+ "directory": "packages/template-report"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/PurpleReverie/reactwright/issues"
15
+ },
16
+ "keywords": ["reactwright", "template", "report", "technical", "business"],
17
+ "type": "module",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./src/index.ts",
21
+ "default": "./src/index.ts"
22
+ }
23
+ },
24
+ "files": [
25
+ "src",
26
+ "LICENSE",
27
+ "README.md"
28
+ ],
29
+ "scripts": {
30
+ "check": "tsc --noEmit"
31
+ },
32
+ "peerDependencies": {
33
+ "reactwright": "workspace:*",
34
+ "react": "^18 || ^19"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^22.15.18",
38
+ "@types/react": "^19.1.2",
39
+ "react": "^19.1.0",
40
+ "reactwright": "workspace:*",
41
+ "typescript": "^5.8.3"
42
+ }
43
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Business/technical report helper package. Exports a Template plus
2
+ // the raw styles string so authors can compose it into their own
3
+ // templates.
4
+ export { Template, REPORT_STYLES } from "./template.js";
@@ -0,0 +1,334 @@
1
+ import "reactwright/jsx";
2
+ import { Bibliography } from "../../reactwright/src/userland/Bibliography.js";
3
+
4
+ // Business/technical report template, packaged as a reusable module.
5
+ // Templates that want the same report styling can:
6
+ //
7
+ // import { Template, REPORT_STYLES } from "./report";
8
+ //
9
+ // Rules captured:
10
+ // • US Letter paper, 1" top/bottom, 1.25" left/right margins
11
+ // • Body: Times 11pt, line-height 1.4 (NOT double-spaced)
12
+ // • Title: 18pt bold centered; Author/Date block below
13
+ // • Section headings: decimal-numbered ("1.", "2.", ...)
14
+ // • Subsections: nested decimal ("1.1", "2.1", ...)
15
+ // • Paragraphs: block style (no indent, 6pt top margin)
16
+ // • Figure captions: "Figure 1." auto-numbered
17
+ // • Table captions: "Table 1." auto-numbered
18
+ // • Page header (page 2+): document title left, page number right
19
+ // • Bibliography: IEEE-style [1], [2] numeric
20
+ //
21
+ // Slice-1+ dialect only. customCss is empty.
22
+
23
+ export const REPORT_STYLES = `
24
+ .report-title {
25
+ font-size: 18pt;
26
+ font-weight: bold;
27
+ font-family: 'Times New Roman', Times, serif;
28
+ text-align: center;
29
+ margin: 0 0 6pt 0;
30
+ line-height: 1.2;
31
+ text-indent: 0;
32
+ }
33
+
34
+ .report-author {
35
+ font-size: 11pt;
36
+ font-style: italic;
37
+ font-weight: normal;
38
+ text-align: center;
39
+ margin: 0 0 18pt 0;
40
+ text-indent: 0;
41
+ }
42
+
43
+ .report-abstract {
44
+ margin: 0 0 12pt 0;
45
+ padding: 8pt 12pt;
46
+ background-color: #f5f5f5;
47
+ }
48
+
49
+ .report-abstract-heading {
50
+ font-size: 11pt;
51
+ font-weight: bold;
52
+ text-transform: uppercase;
53
+ letter-spacing: 0.04em;
54
+ margin: 0 0 4pt 0;
55
+ text-indent: 0;
56
+ text-align: left;
57
+ }
58
+
59
+ .report-abstract-p {
60
+ margin: 0;
61
+ text-indent: 0;
62
+ text-align: justify;
63
+ }
64
+
65
+ .report-section-head {
66
+ font-size: 13pt;
67
+ font-weight: bold;
68
+ font-family: 'Times New Roman', Times, serif;
69
+ text-align: left;
70
+ text-transform: none;
71
+ letter-spacing: 0;
72
+ margin: 14pt 0 4pt 0;
73
+ text-indent: 0;
74
+ numbering: counter(report-section) "$report-section. ";
75
+ numbering-reset: report-subsection;
76
+ break: after(avoid);
77
+ }
78
+
79
+ .report-subsection-head {
80
+ font-size: 11pt;
81
+ font-weight: bold;
82
+ font-style: normal;
83
+ font-family: 'Times New Roman', Times, serif;
84
+ text-align: left;
85
+ margin: 10pt 0 2pt 0;
86
+ text-indent: 0;
87
+ numbering: counter(report-subsection) "$report-section.$report-subsection. ";
88
+ break: after(avoid);
89
+ }
90
+
91
+ .report-body-p {
92
+ margin: 6pt 0 0 0;
93
+ text-indent: 0;
94
+ text-align: justify;
95
+ }
96
+
97
+ .report-heading-adjacent-p {
98
+ margin-top: 0;
99
+ }
100
+
101
+ .report-figure {
102
+ margin: 10pt 0;
103
+ text-align: center;
104
+ break: inside(avoid);
105
+ }
106
+
107
+ .report-figure-img {
108
+ max-width: 100%;
109
+ height: auto;
110
+ display: block;
111
+ margin: 0 auto 4pt auto;
112
+ }
113
+
114
+ .report-fig-caption {
115
+ font-size: 10pt;
116
+ font-style: italic;
117
+ font-family: 'Times New Roman', Times, serif;
118
+ text-align: center;
119
+ line-height: 1.3;
120
+ text-indent: 0;
121
+ numbering: counter(report-figure) "Figure $report-figure. ";
122
+ }
123
+
124
+ .report-table {
125
+ margin: 10pt 0;
126
+ border-collapse: collapse;
127
+ font-size: 10pt;
128
+ width: 100%;
129
+ table-layout: fixed;
130
+ break: inside(avoid);
131
+ }
132
+
133
+ .report-table-cell {
134
+ padding: 3pt 6pt;
135
+ text-align: left;
136
+ text-indent: 0;
137
+ border: 0.5pt solid #888;
138
+ }
139
+
140
+ .report-table-header-cell {
141
+ font-weight: bold;
142
+ background-color: #eeeeee;
143
+ border-top: 0.75pt solid #000;
144
+ border-bottom: 0.75pt solid #000;
145
+ }
146
+
147
+ .report-table-caption {
148
+ font-size: 10pt;
149
+ font-style: italic;
150
+ font-family: 'Times New Roman', Times, serif;
151
+ text-align: left;
152
+ line-height: 1.3;
153
+ text-indent: 0;
154
+ margin-bottom: 4pt;
155
+ caption-side: top;
156
+ numbering: counter(report-table) "Table $report-table. ";
157
+ }
158
+
159
+ .report-cell-p {
160
+ margin: 0;
161
+ text-indent: 0;
162
+ font-size: inherit;
163
+ }
164
+
165
+ .report-cite {
166
+ color: inherit;
167
+ text-decoration: none;
168
+ prefix: "[";
169
+ suffix: target-counter(attr(href url), reactwright-bib) "]";
170
+ }
171
+
172
+ .report-bibliography {
173
+ font-size: 10pt;
174
+ margin-top: 18pt;
175
+ }
176
+
177
+ .report-bib-heading {
178
+ font-size: 13pt;
179
+ font-weight: bold;
180
+ font-style: normal;
181
+ text-align: left;
182
+ margin: 0 0 6pt 0;
183
+ text-indent: 0;
184
+ break: after(avoid);
185
+ }
186
+
187
+ .report-bib-list {
188
+ list-style: none;
189
+ padding-left: 0;
190
+ margin: 0;
191
+ }
192
+
193
+ .report-bib-entry {
194
+ margin-bottom: 3pt;
195
+ }
196
+
197
+ .report-bib-entry-p {
198
+ margin: 0;
199
+ text-align: left;
200
+ text-indent: -1.6em;
201
+ padding-left: 1.6em;
202
+ prefix: "[" counter(reactwright-bib) "] ";
203
+ }
204
+
205
+ .report-code-inline {
206
+ background: none;
207
+ padding: 0;
208
+ border-radius: 0;
209
+ font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
210
+ font-size: 0.92em;
211
+ }
212
+ `;
213
+
214
+ export function Template() {
215
+ return (
216
+ <page
217
+ page={{
218
+ size: "letter",
219
+ marginTop: "1in",
220
+ marginBottom: "1in",
221
+ marginLeft: "1.25in",
222
+ marginRight: "1.25in"
223
+ }}
224
+ typography={{
225
+ fontFamily: "'Times New Roman', Times, serif",
226
+ fontSize: "11pt",
227
+ lineHeight: 1.4,
228
+ textAlign: "justify"
229
+ }}
230
+ >
231
+ <styles>{REPORT_STYLES}</styles>
232
+
233
+ <rule match={{ kind: "title" }} className="report-title" />
234
+ <rule match={{ kind: "author" }} className="report-author" />
235
+ <rule match={{ kind: "code" }} className="report-code-inline" />
236
+
237
+ {/* Abstract / Executive Summary */}
238
+ <rule match={{ kind: "section", role: "abstract" }} className="report-abstract" />
239
+ <rule
240
+ match={{ kind: "section-heading", within: { kind: "section", role: "abstract" } }}
241
+ className="report-abstract-heading"
242
+ />
243
+ <rule
244
+ match={{ kind: "paragraph", within: { kind: "section", role: "abstract" } }}
245
+ className="report-abstract-p"
246
+ />
247
+
248
+ {/* Numbered top-level section headings (skip abstract + bibliography) */}
249
+ <rule
250
+ match={{
251
+ kind: "section-heading",
252
+ depth: 1,
253
+ not: {
254
+ or: [
255
+ { within: { kind: "section", role: "bibliography" } },
256
+ { within: { kind: "section", role: "abstract" } }
257
+ ]
258
+ }
259
+ }}
260
+ className="report-section-head"
261
+ />
262
+ <rule match={{ kind: "section-heading", depth: 2 }} className="report-subsection-head" />
263
+
264
+ {/* Body paragraphs — exclude abstract/blockquote/bibliography/cell */}
265
+ <rule
266
+ match={{
267
+ kind: "paragraph",
268
+ not: {
269
+ or: [
270
+ { within: { kind: "section", role: "bibliography" } },
271
+ { within: { kind: "section", role: "abstract" } },
272
+ { within: { kind: "cell" } }
273
+ ]
274
+ }
275
+ }}
276
+ className="report-body-p"
277
+ />
278
+ <rule
279
+ match={{ kind: "paragraph", follows: { kind: "section-heading" } }}
280
+ className="report-heading-adjacent-p"
281
+ />
282
+
283
+ {/* Figures + tables */}
284
+ <rule match={{ kind: "figure" }} className="report-figure" />
285
+ <rule match={{ kind: "figure-image" }} className="report-figure-img" />
286
+ <rule match={{ kind: "caption", parent: { kind: "figure" } }} className="report-fig-caption" />
287
+ <rule match={{ kind: "table" }} className="report-table" />
288
+ <rule match={{ kind: "caption", parent: { kind: "table" } }} className="report-table-caption" />
289
+ <rule match={{ kind: "cell" }} className="report-table-cell" />
290
+ <rule match={{ kind: "cell", attr: { header: true } }} className="report-table-header-cell" />
291
+ <rule match={{ kind: "paragraph", within: { kind: "cell" } }} className="report-cell-p" />
292
+
293
+ {/* Cites + IEEE-style numeric bibliography (via userland Bibliography) */}
294
+ <rule match={{ kind: "cite" }} className="report-cite" />
295
+ <rule match={{ kind: "section", role: "bibliography" }} className="report-bibliography" />
296
+ <rule
297
+ match={{ kind: "section-heading", within: { kind: "section", role: "bibliography" } }}
298
+ className="report-bib-heading"
299
+ />
300
+ <rule
301
+ match={{ kind: "list", within: { kind: "section", role: "bibliography" } }}
302
+ className="report-bib-list"
303
+ />
304
+ <rule
305
+ match={{ kind: "item", within: { kind: "section", role: "bibliography" } }}
306
+ className="report-bib-entry"
307
+ />
308
+ <rule
309
+ match={{ kind: "paragraph", within: { kind: "section", role: "bibliography" } }}
310
+ className="report-bib-entry-p"
311
+ />
312
+
313
+ <header anchor="top-left" when="not-first-page" typography={{ fontSize: "9pt", fontStyle: "italic" }}>
314
+ <running name="document-title" />
315
+ </header>
316
+ <header anchor="top-right" when="not-first-page" typography={{ fontSize: "9pt" }}>
317
+ <page-number />
318
+ </header>
319
+ <footer anchor="bottom-center" typography={{ fontSize: "9pt" }}>
320
+ <page-number /> / <page-count />
321
+ </footer>
322
+
323
+ <stack gap="0">
324
+ <region>
325
+ <slot name="title" />
326
+ <slot name="author" />
327
+ <slot name="abstract" />
328
+ <slot name="body" />
329
+ <Bibliography title="References" />
330
+ </region>
331
+ </stack>
332
+ </page>
333
+ );
334
+ }