@redspartanlabs/spartacss 1.0.3 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
7
7
  per ADR-0001.
8
8
 
9
+ ## [1.0.4] - 2026-10-09
10
+
11
+ ### Added
12
+
13
+ - [ADR-0007](docs/adr/0007-documentation-preview-contract.md), which defines
14
+ how a documentation page designates one HTML example for optional live
15
+ rendering: the fence info string `html preview`. The marker grants
16
+ permission and requires nothing of a consumer, a page has at most one, and
17
+ consumers must not infer a live example any other way.
18
+ - Section 15.8 of the component standard, stating the authoring rule for the
19
+ marker.
20
+ - `scripts/verify-docs-preview.mjs`, run by `npm run verify`, which checks the
21
+ marker, the one-per-page limit and the content rules. `RELEASING.md` runs it
22
+ against the extracted release package.
23
+
24
+ ### Changed
25
+
26
+ - The Size example on the Button page carries the marker. The page renders as
27
+ before.
28
+ - The Decisions table in the documentation index now lists ADR-0005, ADR-0006
29
+ and ADR-0007.
30
+
31
+ This release changes documentation and the release procedure only. No public
32
+ class selector, modifier, design token, markup contract or `exports` entry
33
+ point changed, no shipped CSS output changed, and the package whitelist is
34
+ unchanged — a non-breaking, patch-level change per ADR-0002. The package gains
35
+ ADR-0007 under `docs/adr/`.
36
+
9
37
  ## [1.0.3] - 2026-10-09
10
38
 
11
39
  ### Added
@@ -481,7 +509,8 @@ output changed — a non-breaking, patch-level change per ADR-0002.
481
509
  system; ownership confirmed as belonging to the icon system, duplicate
482
510
  block removed from core.
483
511
 
484
- [Unreleased]: https://github.com/redspartanlabs/spartacss/compare/v1.0.3...HEAD
512
+ [Unreleased]: https://github.com/redspartanlabs/spartacss/compare/v1.0.4...HEAD
513
+ [1.0.4]: https://github.com/redspartanlabs/spartacss/compare/v1.0.3...v1.0.4
485
514
  [1.0.3]: https://github.com/redspartanlabs/spartacss/compare/v1.0.2...v1.0.3
486
515
  [1.0.2]: https://github.com/redspartanlabs/spartacss/compare/v1.0.1...v1.0.2
487
516
  [1.0.1]: https://github.com/redspartanlabs/spartacss/compare/v1.0.0...v1.0.1
package/README.md CHANGED
@@ -10,7 +10,7 @@ no framework bindings, usable from any site or app regardless of stack.
10
10
  **[→ Documentation index](docs/README.md)** — components, tokens, theming,
11
11
  layout, motion, accessibility, and the architecture decisions behind them.
12
12
 
13
- **Status:** the package is at `1.0.3`. Its intended registry is npm, as
13
+ **Status:** the package is at `1.0.4`. Its intended registry is npm, as
14
14
  `@redspartanlabs/spartacss`
15
15
  ([ADR-0006](docs/adr/0006-npm-registry-distribution.md)), and `1.0.3` is the
16
16
  first release intended for it; `1.0.2` was a GitHub-only release, not intended
@@ -31,7 +31,7 @@ none of that documentation is repeated here.
31
31
  **1. Install.** A tag-pinned git dependency (see [Installation](#installation)):
32
32
 
33
33
  ```
34
- npm install github:redspartanlabs/spartacss#v1.0.3
34
+ npm install github:redspartanlabs/spartacss#v1.0.4
35
35
  ```
36
36
 
37
37
  **2. Import a bundle.** One line gets you the default bundle — tokens,
@@ -74,7 +74,7 @@ SpartaCSS is intended for distribution on npm as `@redspartanlabs/spartacss`
74
74
  a tag-pinned git dependency, per ADR-0001's phased distribution plan:
75
75
 
76
76
  ```
77
- npm install github:redspartanlabs/spartacss#v1.0.3
77
+ npm install github:redspartanlabs/spartacss#v1.0.4
78
78
  ```
79
79
 
80
80
  `1.0.3` is the first release intended for npm. Where the registry has it,
package/RELEASING.md CHANGED
@@ -191,6 +191,18 @@ every file that Git tracks at the tag under the paths in `package.json`'s
191
191
  node -e "const{execSync}=require('child_process'),fs=require('fs');const j=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));const p=Array.isArray(j)?j[0]:Object.values(j)[0];const actual=p.files.map(f=>f.path).sort();const pj=JSON.parse(execSync('git show '+process.argv[2]+':package.json',{encoding:'utf8'}));const paths=[...new Set([...pj.files,'package.json','README.md','LICENSE'])];const expected=execSync('git ls-tree -r --name-only '+process.argv[2]+' -- '+paths.join(' '),{encoding:'utf8'}).split(/\r?\n/).filter(Boolean).sort();const missing=expected.filter(f=>!actual.includes(f)),unexpected=actual.filter(f=>!expected.includes(f));console.log('expected',expected.length,'packed',actual.length,'missing',JSON.stringify(missing),'unexpected',JSON.stringify(unexpected));process.exit(missing.length||unexpected.length?1:0)" <directory>/pack.json vX.Y.Z
192
192
  ```
193
193
 
194
+ **Check the documentation contract.** `npm run verify` has already checked the
195
+ working tree. Check the package itself too: extract the tarball into an empty
196
+ directory outside the repository (for example by running
197
+ `tar -xzf <tarball>` from inside that directory), then run this from the
198
+ repository root:
199
+
200
+ ```
201
+ node scripts/verify-docs-preview.mjs <empty directory>/package
202
+ ```
203
+
204
+ It must print `OK`. Any other result means stop and report.
205
+
194
206
  It prints the expected and packed counts, the files missing from the package
195
207
  and the unexpected files in it, and exits non-zero unless both lists are empty.
196
208
  Any missing or unexpected file means stop. Because `npm pack` also packs
package/docs/README.md CHANGED
@@ -98,6 +98,9 @@ above does not settle.
98
98
  | [ADR-0002](adr/0002-versioning-and-stability-policy.md) | What counts as a breaking change for a pure-CSS design system. Read this before depending on a class name. |
99
99
  | [ADR-0003](adr/0003-independent-iconography-system.md) | Why the iconography system is SpartaCSS's own. |
100
100
  | [ADR-0004](adr/0004-git-tag-artifact-distribution.md) | Why release tags carry prebuilt `dist/` artifacts. |
101
+ | [ADR-0005](adr/0005-canonical-ui-component-standard.md) | The canonical UI component standard: why it exists and what it leaves open. Still Proposed. |
102
+ | [ADR-0006](adr/0006-npm-registry-distribution.md) | npm as the intended registry, under `@redspartanlabs/spartacss`, with GitHub as the canonical home. |
103
+ | [ADR-0007](adr/0007-documentation-preview-contract.md) | How a documentation page designates one HTML example for optional live rendering. |
101
104
 
102
105
  Release history lives in [CHANGELOG.md](../CHANGELOG.md); the procedure for
103
106
  cutting a release is [RELEASING.md](../RELEASING.md).
@@ -0,0 +1,106 @@
1
+ # ADR-0007: Documentation Preview Contract
2
+
3
+ **Status:** Accepted (2026-10-09)
4
+
5
+ ---
6
+
7
+ ## Context
8
+
9
+ SpartaCSS documentation pages show HTML examples in fenced code blocks. A
10
+ consumer of the documentation, such as a documentation site, may want to render
11
+ one of those examples live beside its source. Nothing in the documentation says
12
+ which example is meant for that. A consumer left to guess would infer it from
13
+ fence order, headings or metadata of its own, and each of those changes
14
+ silently when a page is edited.
15
+
16
+ This record lets a page designate an example explicitly, in the page itself. It
17
+ is a documentation convention. It changes no CSS, selector, token or export
18
+ (see ADR-0002), and it requires nothing of any consumer.
19
+
20
+ ---
21
+
22
+ ## Decision
23
+
24
+ 1. **The marker.** A fenced code block is designated for optional live
25
+ rendering when its info string is the language identifier `html` followed by
26
+ the token `preview`:
27
+
28
+ ````markdown
29
+ ```html preview
30
+ <button class="sp-button sp-button--primary sp-button--sm">Small</button>
31
+ <button class="sp-button sp-button--primary sp-button--md">Medium (default)</button>
32
+ <button class="sp-button sp-button--primary sp-button--lg">Large</button>
33
+ ```
34
+ ````
35
+
36
+ Whitespace between the two words is not significant. A fence is a marker
37
+ only in this form. A `preview` token in any other form is malformed: a
38
+ different language, a different letter case, or any additional token.
39
+ Verification rejects a malformed marker instead of ignoring it. Other
40
+ tokens in the info string are reserved.
41
+ 2. **Permission, not requirement.** The marker permits a consumer to render the
42
+ example live. It does not require any consumer to do so, and a consumer that
43
+ does not is unaffected.
44
+ 3. **One per page.** A page contains at most one marked example.
45
+ 4. **Content.** A marked example is a standalone HTML fragment. It is
46
+ non-empty, it is not a whole document (`<!doctype>`, `<html>`, `<head>` or
47
+ `<body>`), it contains no `<script>` element, and none of its link targets
48
+ (`href`, `src`, `action`, `formaction`, `poster`) is site-relative. A link
49
+ target is site-relative when it is neither an absolute URL with a scheme nor
50
+ a fragment-only reference. It also depends on no other content of its page.
51
+ 5. **Rendering is unchanged.** The marker extends only the info string. The
52
+ language remains `html`, so a conforming Markdown renderer presents the block
53
+ as it did before.
54
+ 6. **No inference.** A consumer must not infer a live example from fence
55
+ position, from headings, or from metadata it keeps itself. An example is
56
+ eligible for live rendering only if it carries the marker.
57
+ 7. **Enforcement and first use.** `scripts/verify-docs-preview.mjs`, run by
58
+ `npm run verify`, applies decisions 1, 3 and 4 to every Markdown page under
59
+ `docs/`, except that it cannot check by machine that an example depends on
60
+ no other content of its page. It also requires the pages it names to carry
61
+ their marker. The first is the Size example on the Button page. The release
62
+ procedure in `RELEASING.md` runs the same script against the extracted
63
+ release package.
64
+
65
+ ---
66
+
67
+ ## Relationship to other records
68
+
69
+ This record adds a documentation convention and does not change what ADR-0002
70
+ treats as a breaking change. Adding a marker to a page is a documentation
71
+ change. The authoring rule for component pages appears in section 15.8 of the
72
+ component standard (ADR-0005, still Proposed). That section states the rule,
73
+ and this record is the decision behind it. No existing record is amended.
74
+
75
+ ---
76
+
77
+ ## Consequences
78
+
79
+ **Benefits**
80
+ - A consumer can render a live example without guessing, and the choice is
81
+ visible in the page and reviewable in its diff.
82
+ - The marker survives edits that reorder a page, because it travels with the
83
+ example.
84
+ - Pages render as they did before.
85
+
86
+ **Tradeoffs**
87
+ - A page can designate only one example.
88
+ - Verification checks the properties listed in decisions 1, 3 and 4. Whether an
89
+ example is truly standalone, and whether it looks right when rendered, remain
90
+ the author's and reviewer's responsibility.
91
+ - A consumer whose Markdown tool treats the whole info string as the language
92
+ name must read only its first word.
93
+
94
+ **Maintenance implications**
95
+ - A page that gains a marker is added to the pages `scripts/verify-docs-preview.mjs`
96
+ requires only when a consumer depends on it.
97
+
98
+ ---
99
+
100
+ ## Future ADRs / Decisions
101
+
102
+ - **Other languages or several previews per page** — not decided. The marker
103
+ covers one `html` example per page.
104
+ - **Further info-string tokens** — reserved and not defined here.
105
+ - **Which further pages carry a marker** — decided page by page, not by this
106
+ record.
package/docs/button.md CHANGED
@@ -24,7 +24,7 @@ activation (see Accessibility below).
24
24
 
25
25
  ### Size
26
26
 
27
- ```html
27
+ ```html preview
28
28
  <button class="sp-button sp-button--primary sp-button--sm">Small</button>
29
29
  <button class="sp-button sp-button--primary sp-button--md">Medium (default)</button>
30
30
  <button class="sp-button sp-button--primary sp-button--lg">Large</button>
@@ -622,6 +622,33 @@ they apply**:
622
622
  Components consume global tokens and have no component token API to list;
623
623
  [`tokens.md`](../tokens.md) documents the tokens.
624
624
 
625
+ ### 15.8 Live examples
626
+
627
+ A page **MAY** designate one HTML example for optional live rendering by
628
+ consumers of the documentation. The decision is recorded in
629
+ [ADR-0007](../adr/0007-documentation-preview-contract.md).
630
+
631
+ - A page designates an example only with the marker: the info string of the
632
+ example's fenced code block is `html preview`.
633
+
634
+ ````markdown
635
+ ```html preview
636
+ <button class="sp-button sp-button--primary">Save</button>
637
+ ```
638
+ ````
639
+
640
+ - A page **MUST NOT** contain more than one marked example.
641
+ - A marked example **MUST** be a standalone HTML fragment: non-empty, not a
642
+ whole document, without a `<script>` element, and without site-relative link
643
+ targets. It **MUST NOT** depend on other content of its page.
644
+ - The marker grants permission and nothing more. A page **MUST** still present
645
+ the example's code and explanation as ordinary documentation, and **MUST
646
+ NOT** rely on any consumer rendering the example.
647
+ - A `preview` token in any other form (another language, another letter case,
648
+ or an additional token) is malformed and **MUST NOT** appear.
649
+ - `scripts/verify-docs-preview.mjs`, run by `npm run verify`, checks the
650
+ marker, the one-per-page limit and the content rules above.
651
+
625
652
  ---
626
653
 
627
654
  ## 16. Stability status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redspartanlabs/spartacss",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A framework-agnostic CSS design system built for systems that must last.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "build:bundle": "node -e \"require('fs').mkdirSync('dist',{recursive:true})\" && lightningcss --bundle src/sparta.css -o dist/sparta.css && lightningcss --bundle src/spartacss.css -o dist/spartacss.css && lightningcss --bundle src/sparta-all.css -o dist/sparta-all.css && node -e \"require('fs').copyFileSync('src/modules/icons/sparta-icons.css','dist/sparta-icons.css')\" && node -e \"require('fs').copyFileSync('src/modules/feedback/sparta-notifications.css','dist/sparta-notifications.css')\"",
43
43
  "build:minify": "lightningcss --bundle --minify src/sparta.css -o dist/sparta.min.css && lightningcss --bundle --minify src/spartacss.css -o dist/spartacss.min.css && lightningcss --bundle --minify src/sparta-all.css -o dist/sparta-all.min.css && lightningcss --minify src/modules/icons/sparta-icons.css -o dist/sparta-icons.min.css && lightningcss --minify src/modules/feedback/sparta-notifications.css -o dist/sparta-notifications.min.css",
44
44
  "build": "npm run build:bundle && npm run build:minify",
45
- "verify": "node scripts/verify-legacy-bundle.mjs",
45
+ "verify": "node scripts/verify-legacy-bundle.mjs && node scripts/verify-docs-preview.mjs",
46
46
  "verify:artifact": "node scripts/verify-release-artifact.mjs"
47
47
  },
48
48
  "devDependencies": {