sacred-solid 0.0.0-stage → 0.2.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
@@ -1,3 +1,135 @@
1
- # Temporary Holding Version
1
+ # sacred-solid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ SolidJS port of [SRCL](https://github.com/internet-development/www-sacred), the Sacred Computer component library with terminal aesthetics. Same markup and behavior, with its own CSS and a role based theming vocabulary. A pixel diff against the React kitchen sink stays as the regression gate for refactors that must not change anything visible.
4
+
5
+ It targets Solid 2 and builds its interactive parts on [ui-sdk](https://ui-sdk.dev). Install `solid-js` and `@solidjs/web` 2.0.0-rc.21 or newer, and `@ui-sdk/solid` and `@ui-sdk/core`, next to it.
6
+
7
+ The library is client-only. Components build DOM templates at import time, so import it from browser code or a bundler that targets the client.
8
+
9
+ ## Use it
10
+
11
+ ```tsx
12
+ import "sacred-solid/global-fonts.css";
13
+ import "sacred-solid/global.css";
14
+ import "sacred-solid/style.css";
15
+
16
+ import { render } from "@solidjs/web";
17
+ import { Accordion, Card, DefaultActionBar, ModalStack, Providers } from "sacred-solid";
18
+
19
+ render(
20
+ () => (
21
+ <Providers>
22
+ <DefaultActionBar />
23
+ <ModalStack />
24
+ <Accordion title="HELLO" defaultValue>
25
+ <Card title="EXAMPLE">Terminal aesthetics.</Card>
26
+ </Accordion>
27
+ </Providers>
28
+ ),
29
+ document.body,
30
+ );
31
+ ```
32
+
33
+ Every stylesheet sits in the `sacred` cascade layers, so your own plain CSS beats the library whatever the load order, see [Why CSS layers](docs/explanation/why-css-layers.md). `global.css` defines the `--theme-*` and `--ansi-*` tokens every component reads. Put `class="theme-light"` on `<body>`. `Providers` mounts the hotkey scopes and the modal stack state that `DropdownMenuTrigger`, `ModalTrigger` and `DefaultActionBar` need.
34
+
35
+ ## What changed from React
36
+
37
+ | React | Solid |
38
+ | ---------------------------------------- | --------------------------------------------------------------------- |
39
+ | default exports | named exports, `Foo` and `FooProps` |
40
+ | `useHotkeys(keys, cb, options)` | `createHotkeys(keys, cb, options)`, keys and options may be accessors |
41
+ | `useModals()` returns `modalStack` array | `useModals()` returns `modalStack` accessor, call it |
42
+ | `className`, camelCase `style` keys | `class`, kebab-case `style` keys, units written out (`"8px"`) |
43
+ | `onChange` on text inputs | `onInput` fires per keystroke, `onChange` fires on commit |
44
+ | `DefaultMetaTags` | not ported, put the tags in your `index.html` |
45
+ | `Button theme="SECONDARY"` | `Button variant="SECONDARY"`, `theme` is the token override prop |
46
+ | hand-written keyboard, focus and ARIA | ui-sdk parts: menus, select, tabs, dialogs, tree, calendar and more |
47
+
48
+ The unused helpers in `common/utilities.ts` and the `API`, `Users`, `Tiers` constants were dropped. The Next.js routes, the `/llm` doc routes and the Simulacrum CLI (`scripts/cli`, `scripts/python`) stay in the React repo.
49
+
50
+ ## Styling
51
+
52
+ Most components take `aug`, a typed object that clips corners and draws a border or an inlay, and `theme`, an object of token overrides for the component and everything inside it. `Surface` adds a glow and a backdrop blur.
53
+
54
+ ```tsx
55
+ import { Button, Card, Surface } from "sacred-solid";
56
+
57
+ <Button aug={{ tl: "clip", br: "clip" }}>Save</Button>;
58
+
59
+ <Card theme={{ lineStrong: "hotpink", ink: "white" }}>Pink edges.</Card>;
60
+
61
+ <Surface glow="cyan" blur="8px" theme={{ surfaceFloat: "rgb(0 20 40 / 0.2)" }}>
62
+ Glass.
63
+ </Surface>;
64
+ ```
65
+
66
+ `sacred-solid/themes/holo.css` adds a translucent `theme-holo`, `sacred-solid/themes/acid.css` adds a lime on black `theme-acid`, and `sacred-solid/themes/redline.css` adds a red on maroon-black `theme-redline`. Switch themes with `Utilities.onHandleAppearanceChange("theme-holo")`.
67
+
68
+ The [documentation](docs/README.md) has a tutorial, how-to guides, reference, and two explanations.
69
+
70
+ - [Build a futuristic panel](docs/tutorial/build-a-futuristic-panel.md)
71
+ - [Apply an aug shape](docs/how-to/apply-an-aug-shape.md)
72
+ - [Switch and write a theme](docs/how-to/switch-and-write-a-theme.md)
73
+ - [Theme tokens](docs/reference/theme-tokens.md)
74
+ - [Why role tokens](docs/explanation/why-role-tokens.md)
75
+ - [Why CSS layers](docs/explanation/why-css-layers.md)
76
+
77
+ ## Develop
78
+
79
+ ```sh
80
+ vp install
81
+ vp check # format, lint, type check
82
+ vp test # unit tests under tests/
83
+ vp pack # build dist/ with declarations
84
+ vp dev # kitchen sink playground at http://localhost:5173
85
+ vp run chrome-strip # real browser check of the chrome strip, needs vp preview --port 4173
86
+ vp run check-layers # real browser check that caller CSS beats lib CSS, needs vp pack, vp build and vp preview --port 4173
87
+ vpx scripts/gen-docs.ts # rewrite the generated tables in docs/
88
+ vpx scripts/gen-aug.ts # rebuild src/aug/mixins.generated.ts after upgrading augmented-ui
89
+ SHOOT_OUT=shot.png vpx scripts/shoot.ts hacking # reference | ours PNG of /hacking/ or /journal/, needs vp dev
90
+ ```
91
+
92
+ `playground/` is the Solid kitchen sink, a port of `app/page.tsx` plus the two concept pages. `/hacking/` is a `theme-acid` recreation of a game hacking screen built from `Panel`, `KeyHint`, `BarProgress` and `Table`, with a small playable code matrix. `?paused` stops its countdown.
93
+
94
+ ## Release
95
+
96
+ Every push to `main` runs `.github/workflows/release.yml`. It runs `vp check`, `vp test` and `vp pack`, then `scripts/release.sh`. If changesets are pending, the script runs `changeset version`, commits the bump and changelog to `main`, and publishes to npm with provenance. It then pushes the git tag.
97
+
98
+ Publishing uses npm trusted publishing. The job gets a short-lived OIDC token from GitHub, so there is no npm token or secret to rotate. npm attaches the provenance attestation automatically.
99
+
100
+ - Describe a change with `npm run changeset` and commit the generated `.changeset/*.md` with the change.
101
+ - Every push also publishes any version in `package.json` that is not on npm yet, which finishes a release whose publish step failed after the version commit landed. Nothing is versioned twice.
102
+ - The package starts at `0.0.0`, which the script treats as never released. A push with no changeset does not publish it.
103
+ - The bot pushes the version commit to `main`. Branch protection must let `github-actions[bot]` push there.
104
+ - A push to `main` while a release job runs can make the version push fail. The job goes red, nothing is published, and the changesets stay for the next run.
105
+
106
+ ### One-time setup
107
+
108
+ npm lets you configure a trusted publisher only for a package that already exists, so the first version is published by hand.
109
+
110
+ 1. Publish the package once from your machine with `npm publish --access public`.
111
+ 2. On npmjs.com, open the package settings, Trusted Publisher, GitHub Actions. Set owner `sammccord`, repository `sacred-solid`, workflow filename `release.yml`. Leave the environment empty.
112
+ 3. Optionally set the package's publishing access to require 2FA and disallow tokens.
113
+
114
+ `package.json` carries the `repository` field provenance checks against. Keep it equal to the GitHub repo that runs the workflow.
115
+
116
+ `scripts/release.sh` takes `RELEASE_BRANCH` and `RELEASE_REMOTE`, so it runs against a local git remote and registry for a dry run.
117
+
118
+ ## Stay in sync with React
119
+
120
+ `react-sync.json` pins the www-sacred commit this port has reviewed. The agent skill `skills/sync-from-react/SKILL.md` moves it forward: `vpx scripts/react-sync.ts status --fetch` shows how far behind the port is, and `apply` copies `public/` assets, lists the stylesheets that changed in React as diverged without writing them, and prints what needs a hand port. This port owns its CSS, so a React stylesheet change is read and carried over by hand in role tokens. `mark` advances the pin only after the parity run is clean.
121
+
122
+ ## Visual parity
123
+
124
+ Pixel parity is the regression gate for refactors that must not change anything visible, such as the move to role tokens. A change that is meant to look different fails it by design, so recapture the affected baseline slices after reviewing the diff images. `scripts/parity.ts` drives Playwright against the React site and the Solid playground. Both sides get a paused fake clock, a seeded `Math.random`, and the same scripted interactions. Each accordion section, both concept pages and about 40 interactions (menus, modals, hotkeys, collapse) are compared pixel for pixel and by a canonical DOM dump.
125
+
126
+ ```sh
127
+ cd <copy of www-sacred> && npm install && npx next build && npx next start -p 10000
128
+ vp build && vp preview --port 4173
129
+ vpx scripts/parity.ts baseline # capture React, each scenario until two runs agree
130
+ vpx scripts/parity.ts check # capture Solid and diff against the baseline
131
+ ```
132
+
133
+ Output goes to `.parity/` (`baseline/`, `solid/`, `diff/`). A scenario whose React baseline never agrees with itself is reported as INCONCLUSIVE, not as a pass.
134
+
135
+ `tests/conventions.test.ts` greps `src/` for React leftovers and the silent Solid breakages: camelCase style keys and bare numeric pixel values. `tests/theme-roles.test.ts` pins the role vocabulary. `vpx scripts/computed-snapshot.ts snapshot <url> <out.json>` dumps computed colors and shadows for every element in several themes, and `diff <a.json> <b.json>` compares two dumps, which proves a token refactor kept every color.