@supersuit/components 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.
Files changed (60) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE +21 -0
  3. package/README.md +250 -2
  4. package/bin/supersuit-theme.mjs +116 -0
  5. package/dist/check/depth/bar.d.ts +27 -0
  6. package/dist/check/depth/bar.js +40 -0
  7. package/dist/check/depth/check.d.ts +40 -0
  8. package/dist/check/depth/check.js +50 -0
  9. package/dist/check/depth/crop.d.ts +24 -0
  10. package/dist/check/depth/crop.js +126 -0
  11. package/dist/check/depth/index.d.ts +3 -0
  12. package/dist/check/depth/index.js +5 -0
  13. package/dist/check/depth/measure.d.ts +42 -0
  14. package/dist/check/depth/measure.js +141 -0
  15. package/dist/check/depth/parts-page.d.ts +6 -0
  16. package/dist/check/depth/parts-page.js +69 -0
  17. package/dist/check/depth/playwright.d.ts +4 -0
  18. package/dist/check/depth/playwright.js +10 -0
  19. package/dist/check/depth/png.d.ts +3 -0
  20. package/dist/check/depth/png.js +12 -0
  21. package/dist/check/depth/shoot.d.ts +37 -0
  22. package/dist/check/depth/shoot.js +30 -0
  23. package/dist/index.d.ts +4 -0
  24. package/dist/index.js +11 -0
  25. package/dist/sound/engine.d.ts +59 -0
  26. package/dist/sound/engine.js +325 -0
  27. package/dist/sound/index.d.ts +18 -0
  28. package/dist/sound/index.js +10 -0
  29. package/dist/sound/synth.d.ts +24 -0
  30. package/dist/sound/synth.js +139 -0
  31. package/dist/theme/color.d.ts +29 -0
  32. package/dist/theme/color.js +116 -0
  33. package/dist/theme/compile.d.ts +23 -0
  34. package/dist/theme/compile.js +138 -0
  35. package/dist/theme/index.d.ts +3 -0
  36. package/dist/theme/index.js +4 -0
  37. package/dist/theme/record.d.ts +90 -0
  38. package/dist/theme/record.js +222 -0
  39. package/dist/voice-field/box-trace.d.ts +18 -0
  40. package/dist/voice-field/box-trace.js +87 -0
  41. package/dist/voice-field/index.d.ts +8 -0
  42. package/dist/voice-field/index.js +10 -0
  43. package/dist/voice-field/recorder.d.ts +71 -0
  44. package/dist/voice-field/recorder.js +211 -0
  45. package/dist/voice-field/rules.d.ts +27 -0
  46. package/dist/voice-field/rules.js +62 -0
  47. package/dist/voice-field/saved-take.d.ts +7 -0
  48. package/dist/voice-field/saved-take.js +66 -0
  49. package/dist/voice-field/store.d.ts +27 -0
  50. package/dist/voice-field/store.js +40 -0
  51. package/dist/voice-field/styles.css +161 -0
  52. package/dist/voice-field/toast.d.ts +13 -0
  53. package/dist/voice-field/toast.js +26 -0
  54. package/dist/voice-field/voice-field.d.ts +80 -0
  55. package/dist/voice-field/voice-field.js +259 -0
  56. package/dist/voice-field/words.d.ts +37 -0
  57. package/dist/voice-field/words.js +33 -0
  58. package/package.json +106 -4
  59. package/specs/brand-theme/v1/SPEC.md +130 -0
  60. package/specs/brand-theme/v1/default-bar.json +1196 -0
package/package.json CHANGED
@@ -1,6 +1,108 @@
1
1
  {
2
2
  "name": "@supersuit/components",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "The Supersuit component library: brand themes compiled to CSS (theme), one sound engine (sound), a measured depth check (check/depth), the @supersuit shadcn registry, and components with an approved spec, a React implementation and a conformance test (voice-field).",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./voice-field": {
12
+ "types": "./dist/voice-field/index.d.ts",
13
+ "import": "./dist/voice-field/index.js"
14
+ },
15
+ "./voice-field/styles.css": "./dist/voice-field/styles.css",
16
+ "./sound": {
17
+ "types": "./dist/sound/index.d.ts",
18
+ "import": "./dist/sound/index.js"
19
+ },
20
+ "./theme": {
21
+ "types": "./dist/theme/index.d.ts",
22
+ "import": "./dist/theme/index.js"
23
+ },
24
+ "./check/depth": {
25
+ "types": "./dist/check/depth/index.d.ts",
26
+ "import": "./dist/check/depth/index.js"
27
+ },
28
+ "./check/depth/playwright": {
29
+ "types": "./dist/check/depth/playwright.d.ts",
30
+ "import": "./dist/check/depth/playwright.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "bin": {
35
+ "supersuit-theme": "bin/supersuit-theme.mjs"
36
+ },
37
+ "sideEffects": [
38
+ "*.css"
39
+ ],
40
+ "files": [
41
+ "dist/",
42
+ "bin/",
43
+ "specs/brand-theme/",
44
+ "README.md",
45
+ "CHANGELOG.md",
46
+ "LICENSE"
47
+ ],
48
+ "scripts": {
49
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/copy-css.mjs && node scripts/check-dist.mjs",
50
+ "prepack": "npm run build",
51
+ "test": "vitest run",
52
+ "typecheck": "tsc -p tsconfig.json --noEmit",
53
+ "check": "npm run typecheck && npm test && npm run build && npm run check:consumer",
54
+ "check:consumer": "bash scripts/smoke-install.sh",
55
+ "check:depth": "playwright test test/depth",
56
+ "registry": "node scripts/build-registry.mjs"
57
+ },
58
+ "engines": {
59
+ "node": ">=20.9"
60
+ },
61
+ "license": "MIT",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/SupersuitUp/components.git"
65
+ },
66
+ "publishConfig": {
67
+ "access": "public"
68
+ },
69
+ "keywords": [
70
+ "supersuit",
71
+ "components",
72
+ "voice",
73
+ "microphone",
74
+ "text-field",
75
+ "react",
76
+ "offline"
77
+ ],
78
+ "dependencies": {
79
+ "@supersuit/suggest-a-change": "^0.4.1"
80
+ },
81
+ "peerDependencies": {
82
+ "react": "^19.0.0",
83
+ "react-dom": "^19.0.0",
84
+ "pngjs": "^7.0.0"
85
+ },
86
+ "peerDependenciesMeta": {
87
+ "pngjs": {
88
+ "optional": true
89
+ }
90
+ },
91
+ "devDependencies": {
92
+ "@playwright/test": "1.63.0",
93
+ "@testing-library/dom": "^10.4.2",
94
+ "@testing-library/jest-dom": "^6.9.1",
95
+ "@testing-library/react": "^16.3.3",
96
+ "@types/node": "^20.19.43",
97
+ "@types/pngjs": "^6.0.5",
98
+ "@types/react": "^19.3.0",
99
+ "@types/react-dom": "^19.3.0",
100
+ "@vitejs/plugin-react": "^5.2.0",
101
+ "jsdom": "^27.4.0",
102
+ "pngjs": "^7.0.0",
103
+ "react": "^19.3.0",
104
+ "react-dom": "^19.3.0",
105
+ "typescript": "^5.9.3",
106
+ "vitest": "^4.1.11"
107
+ }
108
+ }
@@ -0,0 +1,130 @@
1
+ ---
2
+ format: spec
3
+ name: brand-theme
4
+ version: 1
5
+ essence: Everything a screen needs to look and sound like one brand.
6
+ approved: 2026-12-01 (component library on shadcn superarchitecture, call early-package)
7
+ ---
8
+
9
+ # brand-theme/v1
10
+
11
+ **Everything a screen needs to look and sound like one brand.**
12
+
13
+ **Where this spec lives.** This file is the spec: `specs/brand-theme/v1/SPEC.md` in the `@supersuit/components` repo, and the same path inside the installed package (`node_modules/@supersuit/components/specs/brand-theme/v1/SPEC.md`). It has no public URL yet: `standards.supersuit.co/brand-theme` does not exist. When the spec gets a public page, this line and `supersuit-theme --help` change to point at it.
14
+
15
+ One JSON file per theme. It holds no part: the parts read the variables it compiles to.
16
+ `validateTheme` (`@supersuit/components/theme`) checks a record; `supersuit-theme build` compiles it.
17
+
18
+ ## Fields
19
+
20
+ | Field | What it holds |
21
+ |---|---|
22
+ | `format` | `"brand-theme/v1"`. Any other value is refused as unknown. |
23
+ | `id` | kebab-case. The compiled scope is `.theme-<id>, [data-theme="<id>"]`. |
24
+ | `name` | The name a person reads. |
25
+ | `essence` | One line. |
26
+ | `ground` | `"light"` or `"dark"`. Dark grounds use the `raise` measure and the dark `sheen-tint`. |
27
+ | `tokens` | The brand's named colours, each a hex. **The only place a hex may appear.** |
28
+ | `colors` | Every role below, each a colour expression over the tokens. |
29
+ | `type` | `display`, `text` (font stacks), `displayWeight`, `displayTracking`. |
30
+ | `radius` | One corner, `px` or `rem`. |
31
+ | `depth` | Five settings and the glow (below). |
32
+ | `sounds` | A recipe, never files (below). |
33
+ | `depthBar` | `"default"` (Supersuit's bar, `default-bar.json`), `"flat"` (a brand flat on purpose, with its owner's yes in `approval`), or the brand's own thresholds. |
34
+ | `approval` | `by`, `at` (a date), `words` (their words), optional `pass` (the review pass id) and `hash`. |
35
+ | `contrastExceptions` | Optional. A text pair the owner approved under 4.5: `pair`, `contrast`, `why`. Refused when the measured contrast moves more than 0.01 from the recorded value, so it cannot get worse unseen. |
36
+
37
+ ### Roles
38
+
39
+ - The 19 shadcn roles: `background`, `foreground`, `card`, `card-foreground`, `popover`, `popover-foreground`, `primary`, `primary-foreground`, `secondary`, `secondary-foreground`, `muted`, `muted-foreground`, `accent`, `accent-foreground`, `destructive`, `destructive-foreground`, `border`, `input`, `ring`.
40
+ - The 10 extra roles: `field`, `raised`, `skeleton`, `scrim`, `placeholder`, `accent-ink`, `rec`, `rec-text`, `on-rec`, `eyebrow`.
41
+
42
+ A missing role is refused, naming it. A key that is not a role is refused.
43
+
44
+ ### The colour grammar
45
+
46
+ A colour value is one of:
47
+
48
+ - `name`: a token.
49
+ - `name / N%`: the token at N% opacity.
50
+ - `mix(a, b N%)`: an OKLab mix of two tokens, `b` at N%. It equals CSS `color-mix(in oklab, a, b N%)`.
51
+
52
+ A bare hex outside `tokens` is refused ("bare hex"), so a token change moves every role made from it.
53
+
54
+ ### Text contrast
55
+
56
+ Each text role must read at 4.5 or more on its ground, measured flat and with depth on (the lower counts):
57
+ `foreground` on `background`, `card-foreground` on `card`, `popover-foreground` on `popover`,
58
+ `primary-foreground` on `primary`, `secondary-foreground` on `secondary`, `muted-foreground` on `muted`,
59
+ `background` and `card`, `accent-foreground` on `accent`, `rec-text` on `background`.
60
+
61
+ ### depth
62
+
63
+ | Setting | What it is |
64
+ |---|---|
65
+ | `shade` | `color` (the ink of every shadow, a colour) and `strength` (1 on light grounds). |
66
+ | `lift` | `surface` and `button`: the 1px light on top of a raised surface and of a filled button. A number is white at that opacity; otherwise a colour. |
67
+ | `sheen` | `color` and `amount` (percent): the light mixed into the top of a raised face. |
68
+ | `edge` | `primary` (percent `primary` is mixed toward black for the filled button's ledge) and `quiet` (the ledge colour under quiet buttons). |
69
+ | `raise` | Dark grounds: the roles a raised surface lightens with depth on (`card`, `popover`, `raised`, `secondary`), each a colour. `0` when nothing is raised by colour. |
70
+ | `glow` | The tint of the filled button's drop. |
71
+
72
+ **Flat** is the same record with every depth setting at zero: every shadow a 1px hairline ring in the shade colour, no lights, no sheens, no ledge, `--press-move: 0px`, and `raise` not applied. It is round 1 of the vibe check, kept as the failing fixture.
73
+
74
+ ### sounds
75
+
76
+ `family` (`wood` or `bubble`), `pitch` (the base note, Hz), `brightness`, `success` (`marimba` or `bell`), `level` (peak, dBFS, default -12).
77
+
78
+ ## The compiled output
79
+
80
+ Under the scope: the role variables, `--radius`, `--font-display`, `--font-text`, `--display-weight`,
81
+ `--display-tracking`, the depth inputs (`--shade-rgb --shade --lift --btn-lift --sheen-color --sheen
82
+ --primary-glow-rgb --primary-edge --quiet-edge`) and the derived values (`--edge --top --elev-1 --elev-3
83
+ --btn-primary --btn-quiet --press --press-move --well --sheen-surface --sheen-popover --sheen-primary
84
+ --sheen-quiet --sheen-tint`), then the utilities `elev-1 elev-3 elev-primary elev-btn well pressed
85
+ sheen-surface sheen-popover sheen-primary sheen-quiet sheen-tint`: the round 3 recipe approved on 2026-12-01.
86
+
87
+ ## The depth check
88
+
89
+ Run in Playwright at 390 px wide, device scale 3, touch on, in Chromium and WebKit, on a parts page that
90
+ draws each raised part on its theme's ground. It reads the screenshot's pixels. Lightness is OKLab L,
91
+ 0 to 100, over the middle third of the part's width.
92
+
93
+ 1. **ledge** (buttons and the mic): the ground 12 px below the face minus the 2 px row under the face.
94
+ 2. **drop** (buttons, cards, menus): the ground 24 px away minus the band 3 to 10 px below the part. A menu's drop must be larger than the card's.
95
+ 3. **top** (raised faces): the face's top 1 px row minus its middle row.
96
+ 4. **raise** (dark grounds): the face minus the page ground.
97
+ 5. **well** (text fields): the field's middle row minus its top 3 px inside the border.
98
+ 6. **press**: `pressMove`, the pressed twin's face top minus the resting face top, in CSS px; `pressLedge`, the pressed twin's ledge, which must be under `pressLedgeOfLedge` (0.5) of the bar's `ledge`.
99
+
100
+ A failure names the theme, the part, the measure, the value and the threshold. A part missing from the page is a failure, never a skip.
101
+
102
+ **The crop check.** For each theme the check writes `depth-compare-<theme>.png`: the button row and a card, at 3 times, flat on the left and as compiled on the right, and measures the mean OKLab distance (x100) between the halves in the 12 px band around each part. It must be at least the bar's `diff`.
103
+
104
+ ## The bar
105
+
106
+ Each threshold is the midpoint between the round 1 (flat) and round 3 (approved) values, moved toward round 1 by no more than a third of the gap. For each measure: `hi` is the smallest round 3 value and `lo` the largest round 1 value, over the three themes and both engines. If `hi <= lo` the measure does not separate the rounds: the measure is fixed, never the threshold.
107
+
108
+ Supersuit's default bar is [`default-bar.json`](./default-bar.json), with its measured date and every value that produced it. It changes only with Gary's yes. A brand's own bar lives in its record (`depthBar`) and is its owner's to set.
109
+
110
+ **The default bar, measured 2026-11-30** (`node scripts/calibrate-depth.mjs --write`), Maison Dawn, Maison Night and Garden, Chromium and WebKit, 390 x 844, scale 3, touch:
111
+
112
+ | Measure | Round 1 max (lo) | Round 3 min (hi) | Threshold |
113
+ |---|---|---|---|
114
+ | ledge | 0 | 6.61 (Maison Night, secondary) | 3.3 |
115
+ | drop | 0 | 1.33 (Maison Night, primary, WebKit) | 0.6 |
116
+ | top | 0 | 1.42 (Maison Dawn, outline, WebKit) | 0.7 |
117
+ | well | 0 | 3.05 (Maison Night, field) | 1.5 |
118
+ | pressMove (CSS px) | 0 | 2 | 1 |
119
+ | raise (dark grounds) | 6.46 (Maison Night, secondary) | 7.28 (Maison Night, card) | 6.8 |
120
+
121
+ `pressLedge` must stay under 0.5 x ledge = 1.65; round 3's largest is 0.
122
+
123
+ **The crop check's `diff`, measured 2026-11-30:** flat beside flat is 0 for every theme and engine; flat beside compiled is 2.89 at the least (Garden, WebKit) and 3.63 at the most (Maison Night, Chromium). The threshold is 1.4. `npm run check:depth` writes the pictures to `depth-compare/<engine>/depth-compare-<theme>.png` (`DEPTH_OUT` moves them).
124
+
125
+ **How the measure reads a part** (each a fix the first calibration showed was needed, never a moved threshold):
126
+ the face is read in its side padding, not under its label; the ledge is the second pixel row under the face, so a 1px hairline ring is not a ledge, and it counts in either direction (a bronze ledge on a night page is lighter than the page); a white face (L 99.5 or more) cannot show a top light, so `top` is skipped for it and the skip is named; drop and raise read the bare page when the page gives a ground patch, because a menu's shadow still darkens the page 24 px below it. Filled and tinted faces (primary, a hand-drawn primary button, destructive) are not asked for `raise`. Maison Night's round 1 has no `raised` role of its own; the record sets it to the round 1 `secondary`, `mix(night, mist 10%)`.
127
+
128
+ ## Approval
129
+
130
+ A theme is approved by its owner, in their words, with the date. When a theme is added or its depth settings change, its crop picture goes on the owner's review page, and their yes goes into `approval`. They approve a picture, never prose.