@opsinjs/react 0.0.0-stage → 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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +114 -2
- package/dist/components/accordion.d.ts +82 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +154 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-banner.d.ts +291 -0
- package/dist/components/alert-banner.d.ts.map +1 -0
- package/dist/components/alert-banner.js +529 -0
- package/dist/components/alert-banner.js.map +1 -0
- package/dist/components/avatar.d.ts +45 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +159 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +78 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/body-map.d.ts +51 -0
- package/dist/components/body-map.d.ts.map +1 -0
- package/dist/components/body-map.js +190 -0
- package/dist/components/body-map.js.map +1 -0
- package/dist/components/button.d.ts +260 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +609 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/callout.d.ts +99 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +285 -0
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.d.ts +156 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +396 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/care-card.d.ts +182 -0
- package/dist/components/care-card.d.ts.map +1 -0
- package/dist/components/care-card.js +544 -0
- package/dist/components/care-card.js.map +1 -0
- package/dist/components/checkbox.d.ts +58 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +167 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/combobox.d.ts +71 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/components/combobox.js +204 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/consent-sheet.d.ts +186 -0
- package/dist/components/consent-sheet.d.ts.map +1 -0
- package/dist/components/consent-sheet.js +452 -0
- package/dist/components/consent-sheet.js.map +1 -0
- package/dist/components/dialog.d.ts +108 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +573 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/disclaimer-note.d.ts +144 -0
- package/dist/components/disclaimer-note.d.ts.map +1 -0
- package/dist/components/disclaimer-note.js +486 -0
- package/dist/components/disclaimer-note.js.map +1 -0
- package/dist/components/divider.d.ts +76 -0
- package/dist/components/divider.d.ts.map +1 -0
- package/dist/components/divider.js +101 -0
- package/dist/components/divider.js.map +1 -0
- package/dist/components/dose-tracker.d.ts +137 -0
- package/dist/components/dose-tracker.d.ts.map +1 -0
- package/dist/components/dose-tracker.js +154 -0
- package/dist/components/dose-tracker.js.map +1 -0
- package/dist/components/empty-state.d.ts +171 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +387 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/field.d.ts +195 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +282 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/goal-ring.d.ts +114 -0
- package/dist/components/goal-ring.d.ts.map +1 -0
- package/dist/components/goal-ring.js +254 -0
- package/dist/components/goal-ring.js.map +1 -0
- package/dist/components/icon-button.d.ts +124 -0
- package/dist/components/icon-button.d.ts.map +1 -0
- package/dist/components/icon-button.js +113 -0
- package/dist/components/icon-button.js.map +1 -0
- package/dist/components/link.d.ts +122 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +164 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/log-sheet.d.ts +259 -0
- package/dist/components/log-sheet.d.ts.map +1 -0
- package/dist/components/log-sheet.js +437 -0
- package/dist/components/log-sheet.js.map +1 -0
- package/dist/components/menu.d.ts +69 -0
- package/dist/components/menu.d.ts.map +1 -0
- package/dist/components/menu.js +190 -0
- package/dist/components/menu.js.map +1 -0
- package/dist/components/metric-tile.d.ts +301 -0
- package/dist/components/metric-tile.d.ts.map +1 -0
- package/dist/components/metric-tile.js +533 -0
- package/dist/components/metric-tile.js.map +1 -0
- package/dist/components/number-field.d.ts +62 -0
- package/dist/components/number-field.d.ts.map +1 -0
- package/dist/components/number-field.js +134 -0
- package/dist/components/number-field.js.map +1 -0
- package/dist/components/popover.d.ts +70 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +174 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +83 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +140 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/questionnaire.d.ts +123 -0
- package/dist/components/questionnaire.d.ts.map +1 -0
- package/dist/components/questionnaire.js +148 -0
- package/dist/components/questionnaire.js.map +1 -0
- package/dist/components/radio-group.d.ts +66 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +186 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/range-bar.d.ts +172 -0
- package/dist/components/range-bar.d.ts.map +1 -0
- package/dist/components/range-bar.js +578 -0
- package/dist/components/range-bar.js.map +1 -0
- package/dist/components/range-legend.d.ts +97 -0
- package/dist/components/range-legend.d.ts.map +1 -0
- package/dist/components/range-legend.js +166 -0
- package/dist/components/range-legend.js.map +1 -0
- package/dist/components/reading-input.d.ts +225 -0
- package/dist/components/reading-input.d.ts.map +1 -0
- package/dist/components/reading-input.js +651 -0
- package/dist/components/reading-input.js.map +1 -0
- package/dist/components/relative-time.d.ts +177 -0
- package/dist/components/relative-time.d.ts.map +1 -0
- package/dist/components/relative-time.js +603 -0
- package/dist/components/relative-time.js.map +1 -0
- package/dist/components/result-card.d.ts +319 -0
- package/dist/components/result-card.d.ts.map +1 -0
- package/dist/components/result-card.js +614 -0
- package/dist/components/result-card.js.map +1 -0
- package/dist/components/scale-input.d.ts +58 -0
- package/dist/components/scale-input.d.ts.map +1 -0
- package/dist/components/scale-input.js +170 -0
- package/dist/components/scale-input.js.map +1 -0
- package/dist/components/score-dial.d.ts +205 -0
- package/dist/components/score-dial.d.ts.map +1 -0
- package/dist/components/score-dial.js +728 -0
- package/dist/components/score-dial.js.map +1 -0
- package/dist/components/scroll-area.d.ts +38 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +138 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/segmented-control.d.ts +69 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +259 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/select.d.ts +72 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +205 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sheet.d.ts +192 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +952 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.d.ts +104 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +266 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +55 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +170 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/source-citation.d.ts +127 -0
- package/dist/components/source-citation.d.ts.map +1 -0
- package/dist/components/source-citation.js +391 -0
- package/dist/components/source-citation.js.map +1 -0
- package/dist/components/spinner.d.ts +86 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +97 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/status-pill.d.ts +90 -0
- package/dist/components/status-pill.d.ts.map +1 -0
- package/dist/components/status-pill.js +259 -0
- package/dist/components/status-pill.js.map +1 -0
- package/dist/components/stepper.d.ts +99 -0
- package/dist/components/stepper.d.ts.map +1 -0
- package/dist/components/stepper.js +152 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/surface.d.ts +92 -0
- package/dist/components/surface.d.ts.map +1 -0
- package/dist/components/surface.js +261 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.d.ts +48 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +152 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/symptom-picker.d.ts +69 -0
- package/dist/components/symptom-picker.d.ts.map +1 -0
- package/dist/components/symptom-picker.js +170 -0
- package/dist/components/symptom-picker.js.map +1 -0
- package/dist/components/tab-bar.d.ts +110 -0
- package/dist/components/tab-bar.d.ts.map +1 -0
- package/dist/components/tab-bar.js +118 -0
- package/dist/components/tab-bar.js.map +1 -0
- package/dist/components/table.d.ts +117 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +65 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +106 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +136 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/term.d.ts +243 -0
- package/dist/components/term.d.ts.map +1 -0
- package/dist/components/term.js +562 -0
- package/dist/components/term.js.map +1 -0
- package/dist/components/textarea.d.ts +157 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +66 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/timeline-entry.d.ts +99 -0
- package/dist/components/timeline-entry.d.ts.map +1 -0
- package/dist/components/timeline-entry.js +47 -0
- package/dist/components/timeline-entry.js.map +1 -0
- package/dist/components/toast.d.ts +80 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +266 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/tooltip.d.ts +48 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +159 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/trend-sparkline.d.ts +188 -0
- package/dist/components/trend-sparkline.d.ts.map +1 -0
- package/dist/components/trend-sparkline.js +796 -0
- package/dist/components/trend-sparkline.js.map +1 -0
- package/dist/components/value.d.ts +150 -0
- package/dist/components/value.d.ts.map +1 -0
- package/dist/components/value.js +402 -0
- package/dist/components/value.js.map +1 -0
- package/dist/components/visually-hidden.d.ts +61 -0
- package/dist/components/visually-hidden.d.ts.map +1 -0
- package/dist/components/visually-hidden.js +172 -0
- package/dist/components/visually-hidden.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/opsinjs.d.ts +443 -0
- package/dist/opsinjs.d.ts.map +1 -0
- package/dist/opsinjs.js +906 -0
- package/dist/opsinjs.js.map +1 -0
- package/dist/status.d.ts +111 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +125 -0
- package/dist/status.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +82 -0
- package/dist/utils.js.map +1 -0
- package/package.json +86 -3
- package/styles/base.css +132 -0
- package/styles/roles.css +412 -0
- package/styles/standalone.css +20 -0
- package/styles/tailwind.css +18 -0
- package/styles/theme.css +309 -0
package/package.json
CHANGED
|
@@ -1,6 +1,89 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opsinjs/react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React components for consumer health apps: readings, ranges, clinical status and the controls around them, built on Base UI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"opsinjs",
|
|
7
|
+
"design-system",
|
|
8
|
+
"health",
|
|
9
|
+
"healthcare",
|
|
10
|
+
"accessibility",
|
|
11
|
+
"react",
|
|
12
|
+
"components",
|
|
13
|
+
"base-ui",
|
|
14
|
+
"tailwindcss"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://opsinjs.pensievelabs.org/docs/components",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/prashantonomy/opsinjs/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/prashantonomy/opsinjs.git",
|
|
23
|
+
"directory": "packages/react"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"author": "the opsinjs authors",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": [
|
|
29
|
+
"*.css"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./styles.css": "./dist/styles.css",
|
|
37
|
+
"./tailwind.css": "./styles/tailwind.css",
|
|
38
|
+
"./base.css": "./styles/base.css",
|
|
39
|
+
"./roles.css": "./styles/roles.css",
|
|
40
|
+
"./theme.css": "./styles/theme.css",
|
|
41
|
+
"./package.json": "./package.json",
|
|
42
|
+
"./*": {
|
|
43
|
+
"types": "./dist/components/*.d.ts",
|
|
44
|
+
"default": "./dist/components/*.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"main": "./dist/index.js",
|
|
48
|
+
"types": "./dist/index.d.ts",
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"styles",
|
|
52
|
+
"README.md",
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"CHANGELOG.md"
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@base-ui/react": "^1.8.0",
|
|
58
|
+
"clsx": "^2.1.1",
|
|
59
|
+
"lucide-react": "^1.52.0",
|
|
60
|
+
"tailwind-merge": "^3.7.0",
|
|
61
|
+
"@opsinjs/tokens": "^0.1.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": "^19.0.0",
|
|
65
|
+
"react-dom": "^19.0.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
69
|
+
"@tailwindcss/cli": "4.3.3",
|
|
70
|
+
"@types/react": "19.3.0",
|
|
71
|
+
"@types/react-dom": "19.3.0",
|
|
72
|
+
"publint": "0.3.25",
|
|
73
|
+
"react": "19.3.0",
|
|
74
|
+
"react-dom": "19.3.0",
|
|
75
|
+
"tailwindcss": "4.3.3",
|
|
76
|
+
"typescript": "5.9.3"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=20.19.0"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build": "node ../../scripts/clean.mts dist && tsc -p tsconfig.build.json && tailwindcss -i styles/standalone.css -o dist/styles.css --minify",
|
|
86
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
87
|
+
"lint:package": "publint --strict && attw --pack . --profile esm-only --exclude-entrypoints styles.css tailwind.css base.css roles.css theme.css"
|
|
88
|
+
}
|
|
6
89
|
}
|
package/styles/base.css
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
base.css holds the opsinjs element rules, and it is opt-in.
|
|
3
|
+
|
|
4
|
+
These rules select elements rather than components: every border takes the
|
|
5
|
+
border role, a selection is a wash of the brand light, focus draws the
|
|
6
|
+
opsinjs ring, a measurement uses tabular figures, and anything tappable
|
|
7
|
+
clears the target floor. Load it when opsinjs is the design system of the
|
|
8
|
+
whole page. Leave it out when opsinjs components sit inside an app with its
|
|
9
|
+
own base styles, because these rules reach every element on the page and
|
|
10
|
+
not only opsinjs ones.
|
|
11
|
+
========================================================================== */
|
|
12
|
+
|
|
13
|
+
@layer base {
|
|
14
|
+
html {
|
|
15
|
+
font-family: var(--font-sans);
|
|
16
|
+
-webkit-text-size-adjust: 100%;
|
|
17
|
+
text-size-adjust: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
background-color: var(--background);
|
|
22
|
+
color: var(--foreground);
|
|
23
|
+
-webkit-font-smoothing: antialiased;
|
|
24
|
+
-moz-osx-font-smoothing: grayscale;
|
|
25
|
+
}
|
|
26
|
+
* {
|
|
27
|
+
border-color: var(--border);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/* A selection is a wash of the brand light under the ink, never a fill the
|
|
33
|
+
ink has to fight: the text keeps its own colour, so a selected reading
|
|
34
|
+
stays as legible as an unselected one. */
|
|
35
|
+
::selection {
|
|
36
|
+
background-color: color-mix(in oklab, var(--brand) 24%, transparent);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Squircle. The theme intentionally does not stamp a `data-opsin-shape`
|
|
40
|
+
attribute to deliver this, so there is no rule here. The squircle is set
|
|
41
|
+
per component instead, as the arbitrary property
|
|
42
|
+
`[corner-shape:var(--opsin-corner-shape)]` on the shape role of Card,
|
|
43
|
+
Callout and Dialog. Two reasons, both stated on those components: a
|
|
44
|
+
`data-opsin-shape` attribute would be a fifth member of a data-attribute
|
|
45
|
+
vocabulary that is closed at four, and this stylesheet is opt-in, so a rule
|
|
46
|
+
here would never reach a product that leaves it out.
|
|
47
|
+
An engine without `corner-shape` drops the inline declaration and draws an
|
|
48
|
+
ordinary rounded corner, which is the fallback tokens/shape.json specifies.
|
|
49
|
+
`--opsin-corner-shape` stays declared above because those components read
|
|
50
|
+
it. See foundations/shape. */
|
|
51
|
+
|
|
52
|
+
/* The width and the offset read the generated tokens, so the stryk theme's
|
|
53
|
+
3px ring reaches every control that falls back on this rule. */
|
|
54
|
+
:focus-visible {
|
|
55
|
+
outline: var(--opsin-border-focus, 2px) solid var(--ring);
|
|
56
|
+
outline-offset: var(--opsin-border-focus-offset, 2px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Tap-highlight, restored. Tailwind v4 preflight zeroes
|
|
60
|
+
-webkit-tap-highlight-color globally, so without this rule a tap on a
|
|
61
|
+
control produces no native flash at all. This puts one back. It is honoured only by WebKit and
|
|
62
|
+
Chromium and only on touch, so it does nothing with a mouse or a keyboard,
|
|
63
|
+
and it is a backstop rather than a substitute for the per-component press
|
|
64
|
+
state, which lands as interaction-and-accessibility-09. The value is built
|
|
65
|
+
from --ring with color-mix rather than a literal so the flash follows the
|
|
66
|
+
theme in both light and dark, and it stays deliberately faint at 20 percent
|
|
67
|
+
so it reads as an acknowledgement and not as a selection. The selector list
|
|
68
|
+
tracks the target-floor rule below so the two stay in step, with plain
|
|
69
|
+
anchors, summary and label added because those are tapped too. No global
|
|
70
|
+
:active fill is added: a page-level press treatment would fight the
|
|
71
|
+
per-component press states, and this file is opt-in, so a press state that
|
|
72
|
+
lived here would be missing from every app that leaves it out. */
|
|
73
|
+
a,
|
|
74
|
+
button,
|
|
75
|
+
[role="button"],
|
|
76
|
+
summary,
|
|
77
|
+
label,
|
|
78
|
+
select,
|
|
79
|
+
textarea,
|
|
80
|
+
input:not([type="hidden"]) {
|
|
81
|
+
-webkit-tap-highlight-color: color-mix(in oklab, var(--ring) 20%, transparent);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Numbers a person reads as a measurement line up column-wise, so a change
|
|
85
|
+
between two readings is a change in the digits and not in the kerning.
|
|
86
|
+
`data-opsinjs-value` is the component anatomy attribute closed by ADR 0011
|
|
87
|
+
and is what every opsinjs component emits. `data-opsin-value` is accepted
|
|
88
|
+
alongside it so a consumer who reaches for the theme prefix by analogy with
|
|
89
|
+
`data-opsin-shape` and `data-opsin-target` still gets tabular figures
|
|
90
|
+
rather than silently losing them on a reading. */
|
|
91
|
+
[data-opsinjs-value],
|
|
92
|
+
[data-opsin-value] {
|
|
93
|
+
font-variant-numeric: tabular-nums;
|
|
94
|
+
font-feature-settings: "tnum" 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Anything tappable clears the product floor. This is a backstop, not a
|
|
98
|
+
substitute for sizing the component correctly.
|
|
99
|
+
|
|
100
|
+
The token is `--opsin-target-minimum`, generated from tokens/space.json,
|
|
101
|
+
and the unit is the point. It is 2.75rem, not 44px: [data-text-size="200"]
|
|
102
|
+
changes the ROOT FONT SIZE for real rather than applying a transform, so a
|
|
103
|
+
rem floor grows with the type and a control that sat exactly on the floor
|
|
104
|
+
still sits exactly on it. A px floor would stay at 44 device-independent
|
|
105
|
+
pixels while the label inside it doubled, which turns a control that was
|
|
106
|
+
merely at the limit into one that overflows or clips. This rule previously
|
|
107
|
+
read `--opsin-target-min`, a name nothing generated, so the measured floor
|
|
108
|
+
never reached it.
|
|
109
|
+
|
|
110
|
+
The var() fallback is the same 2.75rem rather than 44px, for the same
|
|
111
|
+
reason: if tokens.css is missing, the backstop still has to scale.
|
|
112
|
+
|
|
113
|
+
TEXT ENTRY IS IN THE LIST. It used to name only buttons, links carrying
|
|
114
|
+
`data-opsin-target`, checkboxes and radios, which left every text input,
|
|
115
|
+
`<select>` and `<textarea>` outside the floor. A hand-rolled `<input>` next
|
|
116
|
+
to a correctly sized `<Field>` therefore reproduced the sub-floor target in
|
|
117
|
+
silence, and a text field is the control a reader with a tremor has the
|
|
118
|
+
hardest time hitting. `input` is matched by exclusion rather than by listing
|
|
119
|
+
the twenty-odd type values, so a type nobody thought about is inside the
|
|
120
|
+
floor rather than outside it. `[type="hidden"]` is excluded because it has
|
|
121
|
+
no box at all, and a minimum size on a box that does not render is noise in
|
|
122
|
+
the cascade rather than a rule. */
|
|
123
|
+
button,
|
|
124
|
+
[role="button"],
|
|
125
|
+
a[data-opsin-target],
|
|
126
|
+
select,
|
|
127
|
+
textarea,
|
|
128
|
+
input:not([type="hidden"]) {
|
|
129
|
+
min-block-size: var(--opsin-target-minimum, 2.75rem);
|
|
130
|
+
min-inline-size: var(--opsin-target-minimum, 2.75rem);
|
|
131
|
+
}
|
|
132
|
+
}
|
package/styles/roles.css
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
roles.css is the opsinjs role layer, in plain CSS.
|
|
3
|
+
|
|
4
|
+
It maps the generated tokens in @opsinjs/tokens onto the role names every
|
|
5
|
+
opsinjs component reads (--background, --foreground, --primary, the state
|
|
6
|
+
fills, the placeholder triple), for light, for dark and for every accent
|
|
7
|
+
scope. It also owns the reduced-motion and print rules. It assumes
|
|
8
|
+
@opsinjs/tokens/tokens.css is loaded first, and both styles.css and
|
|
9
|
+
tailwind.css load them in that order.
|
|
10
|
+
|
|
11
|
+
The roles apply to `:root` and to any element carrying `opsin-product`,
|
|
12
|
+
and their dark half to `.dark`.
|
|
13
|
+
========================================================================== */
|
|
14
|
+
|
|
15
|
+
/* --------------------------------------------------------------------------
|
|
16
|
+
Surface roles. Deliberately few: a health screen that needs nine background
|
|
17
|
+
roles has a layout problem, not a token problem.
|
|
18
|
+
|
|
19
|
+
Every chrome role now resolves through a token, `var(--opsin-chrome-*)`,
|
|
20
|
+
declared once in tokens/color.json and emitted into the imported
|
|
21
|
+
@opsinjs/tokens/tokens.css. This matters for one reason above the others: the
|
|
22
|
+
audited page and the rendered page have to be the same page, or every
|
|
23
|
+
published contrast figure describes a screen nobody sees. The roles used to be
|
|
24
|
+
raw oklch values here, at three grey hues (250, 255 and 260) and at
|
|
25
|
+
lightnesses that were not ladder steps, so the gate measured neutral-0 and
|
|
26
|
+
neutral-950 while the screen showed something else. There is one grey hue
|
|
27
|
+
across the ladder-derived roles now, and one declaration site. The one
|
|
28
|
+
exception is named rather than absorbed: dark --primary-foreground stays at
|
|
29
|
+
hue 260, where D5 fixes it, and at chroma 0.01 it reads as a grey; it is
|
|
30
|
+
the ink of every primary fill in dark. A custom property resolves where it is
|
|
31
|
+
used rather than where it is declared, so a role here may point at any step
|
|
32
|
+
@opsinjs/tokens/tokens.css declares.
|
|
33
|
+
|
|
34
|
+
`--muted-foreground` is `--opsin-chrome-muted-foreground`, which resolves to
|
|
35
|
+
neutral-600 in light and neutral-300 in dark, the two steps the audit records
|
|
36
|
+
as clearing the Lc 75 floor. It used to be oklch(0.505 0.012 260) in light and
|
|
37
|
+
oklch(0.712 0.01 255) in dark, neither of which is a ladder step, and the dark
|
|
38
|
+
value sat below the APCA body floor while WCAG still passed, which is how the
|
|
39
|
+
miss stayed invisible to a ratio-only check.
|
|
40
|
+
|
|
41
|
+
Two shifts are expected here and are not regressions: the light page moves
|
|
42
|
+
from L 0.991 to L 0.985, and the dark page from L 0.162 to the darker L 0.145.
|
|
43
|
+
-------------------------------------------------------------------------- */
|
|
44
|
+
|
|
45
|
+
:root,
|
|
46
|
+
.opsin-product {
|
|
47
|
+
/* Tell the browser the theme, so native controls follow it: the unit <select>
|
|
48
|
+
popup in ReadingInput, the text caret, the autofill fill, the scrollbars
|
|
49
|
+
and the date picker. Plain `light`, not `only light`, so a reader's forced
|
|
50
|
+
colours or user-agent preference still comes through. */
|
|
51
|
+
color-scheme: light;
|
|
52
|
+
--background: var(--opsin-chrome-background);
|
|
53
|
+
--foreground: var(--opsin-chrome-foreground);
|
|
54
|
+
--card: var(--opsin-chrome-card);
|
|
55
|
+
--card-foreground: var(--opsin-chrome-card-foreground);
|
|
56
|
+
--muted: var(--opsin-chrome-muted);
|
|
57
|
+
--muted-foreground: var(--opsin-chrome-muted-foreground);
|
|
58
|
+
/* Hairline on the neutral ladder, so the one elevation cue a shadowless card
|
|
59
|
+
has is measured and visible. neutral-500 reads Lc 69.75 / WCAG 4.52 on a
|
|
60
|
+
neutral-50 page and Lc 72.83 / WCAG 4.72 on a neutral-0 card, both clearing
|
|
61
|
+
the Lc 45 non-text floor and the 3:1 WCAG floor. It replaces oklch(0.905),
|
|
62
|
+
which measured about Lc 13 / 1.29:1 and vanished at low screen brightness. */
|
|
63
|
+
--border: var(--opsin-chrome-border);
|
|
64
|
+
--input: var(--opsin-chrome-input);
|
|
65
|
+
/* The decorative edge of a sheet that is not a control, from tokens/color.json
|
|
66
|
+
(ADR 0028). `--edge` draws around a card, a tile or a table; a control keeps
|
|
67
|
+
`--border`, its 3:1 boundary. */
|
|
68
|
+
--edge: var(--opsin-chrome-edge);
|
|
69
|
+
/* The accent roles, from tokens/accent.json (ADR 0029). Each one points at an
|
|
70
|
+
`--opsin-accent-*` token, which carries the default theme's default accent
|
|
71
|
+
here and whatever theme and accent the page chose under `data-accent-theme`
|
|
72
|
+
and `data-accent`. The block further down re-declares all of them on any
|
|
73
|
+
element that starts an accent scope.
|
|
74
|
+
|
|
75
|
+
`--primary` is the one filled action, ink in the normal theme. `--brand` is
|
|
76
|
+
the selected state of a selection control and `--brand-foreground` the tick
|
|
77
|
+
or label on it. `--brand-ink` is accent-coloured text on the page or a card.
|
|
78
|
+
The two `-edge` roles are transparent unless a bright fill needs a rim to
|
|
79
|
+
separate from the page, and `--brand-glow` is light the action throws, which
|
|
80
|
+
only the vibes theme casts. None of them ever fills a surface that reports a
|
|
81
|
+
result, and none carries a status or a category. */
|
|
82
|
+
--ring: var(--opsin-accent-ring);
|
|
83
|
+
--primary: var(--opsin-accent-action);
|
|
84
|
+
--primary-foreground: var(--opsin-accent-action-foreground);
|
|
85
|
+
--primary-edge: var(--opsin-accent-action-edge);
|
|
86
|
+
--brand: var(--opsin-accent-fill);
|
|
87
|
+
--brand-foreground: var(--opsin-accent-fill-foreground);
|
|
88
|
+
--brand-edge: var(--opsin-accent-fill-edge);
|
|
89
|
+
--brand-ink: var(--opsin-accent-ink);
|
|
90
|
+
--brand-glow: var(--opsin-accent-glow);
|
|
91
|
+
|
|
92
|
+
/* Interaction state fills. interaction-states.mdx:35-37 asks for a state that
|
|
93
|
+
is a fixed OKLCH lightness step off the role it derives from, darker in
|
|
94
|
+
light and lighter in dark, and until now no such token existed, so Button
|
|
95
|
+
hand-picked hover:bg-muted, which measured about 1.08:1 and did not
|
|
96
|
+
register. These are opaque and not alpha: an alpha fill resolves to a
|
|
97
|
+
different colour on --background than on --card, and a derived state token
|
|
98
|
+
is not allowed to depend on what is behind it.
|
|
99
|
+
|
|
100
|
+
Measured with @opsinjs/color. The two neutral fills sit just under their
|
|
101
|
+
surfaces: --state-hover reads 1.13:1 against --background and 1.18:1
|
|
102
|
+
against --card, --state-press 1.21:1 and 1.26:1. --foreground stays above
|
|
103
|
+
12:1 on all four of these fills and --primary, which is quiet's ink, stays
|
|
104
|
+
at 4.53:1 or better, so the label never dims when the surface does. The
|
|
105
|
+
trade is stated rather than hidden: the light neutral fills do not reach the
|
|
106
|
+
report's 1.5:1 floor, and cannot, because --background sits at L 0.985 and
|
|
107
|
+
--card at L 1.0, and a fill dark enough for 1.5:1 pushes --primary ink below
|
|
108
|
+
the 4.5 body floor. 1.21:1 for press is a real and visible lift on 1.08:1,
|
|
109
|
+
not a pass against a floor.
|
|
110
|
+
|
|
111
|
+
The two primary fills carry a filled label, so they come from the accent
|
|
112
|
+
layer with the action itself: `--opsin-accent-action-hover` and `-press`.
|
|
113
|
+
In the normal theme they are the next two neutral steps up from the ink
|
|
114
|
+
action, white on neutral-800 and on neutral-700; in every theme they move
|
|
115
|
+
away from the label, and scripts/build-tokens.mts refuses a state whose
|
|
116
|
+
label falls below the body floor, so a hover or a press never costs the
|
|
117
|
+
label its contrast. */
|
|
118
|
+
--state-hover: oklch(0.945 0.004 252);
|
|
119
|
+
--state-press: oklch(0.920 0.005 252);
|
|
120
|
+
--state-primary-hover: var(--opsin-accent-action-hover);
|
|
121
|
+
--state-primary-press: var(--opsin-accent-action-press);
|
|
122
|
+
|
|
123
|
+
/* --- Placeholder. A dedicated opaque neutral triple for the loading
|
|
124
|
+
Skeleton, because --muted over a --border hairline is barely perceivable on
|
|
125
|
+
a light page: the fill measured 1.08:1 and the hairline 1.29:1 against the
|
|
126
|
+
page, both under the 3:1 non-text floor, and the pulse dropped them further.
|
|
127
|
+
`-fill` is the block, `-line` is its boundary and `-sheen` is the lighter
|
|
128
|
+
shimmer stop. All three are opaque steps of the neutral ramp rather than an
|
|
129
|
+
alpha, because an alpha resolves to a different colour on --background than
|
|
130
|
+
on --card and a published figure would then never match the rendered one.
|
|
131
|
+
Measured over these steps: the fill reads about 1.18:1 on the page and
|
|
132
|
+
1.23:1 on a card, the hairline 4.72:1 on a card at Lc 72.83, and the
|
|
133
|
+
hairline against its own fill 3.84:1. The values reference the imported
|
|
134
|
+
@opsinjs/tokens/tokens.css ramp, which is safe because a custom property resolves
|
|
135
|
+
where it is used. --- */
|
|
136
|
+
--opsin-placeholder-fill: var(--opsin-neutral-200);
|
|
137
|
+
--opsin-placeholder-line: var(--opsin-neutral-500);
|
|
138
|
+
--opsin-placeholder-sheen: var(--opsin-neutral-300);
|
|
139
|
+
|
|
140
|
+
/* --- Type. The platform UI font, not a brand face. A patient-facing app
|
|
141
|
+
inherits the reader's Dynamic Type / font-scale settings; shipping a
|
|
142
|
+
webfont that ignores them is how "200% text" stops working. --- */
|
|
143
|
+
--font-sans:
|
|
144
|
+
ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text",
|
|
145
|
+
"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
146
|
+
--font-mono:
|
|
147
|
+
ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
|
|
148
|
+
"Liberation Mono", monospace;
|
|
149
|
+
|
|
150
|
+
/* --- Space. Tailwind derives its whole spacing scale from --spacing, so one
|
|
151
|
+
value tunes every utility at once. The product theme takes the same 0.25rem
|
|
152
|
+
base step as the docs chrome, which is the 4px grid at a 16px root, so p-4
|
|
153
|
+
is 16px and p-5 is 20px, and each of those is a published opsin step. The
|
|
154
|
+
theme buys its generosity from the fixed opsin steps and from the type
|
|
155
|
+
scale, not from an off-grid base. */
|
|
156
|
+
--spacing: 0.25rem;
|
|
157
|
+
|
|
158
|
+
/* The comfortable density is the unstamped default, which tokens/space.json
|
|
159
|
+
publishes at scale 1. Declaring the multiplier here gives every consumer of
|
|
160
|
+
--opsin-density-scale a defined value of 1 at the default density; only the
|
|
161
|
+
[data-density="compact"] block below moves it. That keeps one definition of
|
|
162
|
+
the multiplier and stops a component reading an undefined property when the
|
|
163
|
+
reader has not asked for a denser view. */
|
|
164
|
+
--opsin-density-scale: 1;
|
|
165
|
+
|
|
166
|
+
/* --- Shape. Squircle where the browser supports corner-shape; a plain
|
|
167
|
+
rounded rectangle at the same radius where it does not. The degradation is
|
|
168
|
+
a matter of taste and never of function. See foundations/shape. --- */
|
|
169
|
+
--radius: var(--opsin-radius-base);
|
|
170
|
+
|
|
171
|
+
/* --- Targets. There is deliberately NO authored target token in this block.
|
|
172
|
+
The floor is `--opsin-target-minimum`, generated from tokens/space.json
|
|
173
|
+
into @opsinjs/tokens/tokens.css, which loads before this file.
|
|
174
|
+
|
|
175
|
+
This block used to author `--opsin-target-min: 44px`. That is a different
|
|
176
|
+
property name from the generated one, so the two never met: the generated
|
|
177
|
+
floor could not supersede the authored one, and the authored one was a hard
|
|
178
|
+
pixel value that does not grow when a reader asks for 200% text, while
|
|
179
|
+
`2.75rem` does. Re-adding a `-min` spelling would silently reintroduce
|
|
180
|
+
both halves of that. A minimum for anything a person taps while
|
|
181
|
+
distracted, one-handed or with a tremor is deliberately above the
|
|
182
|
+
WCAG 2.2 SC 2.5.8 minimum; accessibility/target-size-and-motor states
|
|
183
|
+
which figure comes from where. --- */
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.dark {
|
|
188
|
+
/* The dark counterpart, so the same native controls, scrollbars, caret and
|
|
189
|
+
date picker render dark rather than in the light platform style over a
|
|
190
|
+
near-black surface. Plain `dark` for the same reason as the root above. */
|
|
191
|
+
color-scheme: dark;
|
|
192
|
+
--background: var(--opsin-chrome-background);
|
|
193
|
+
--foreground: var(--opsin-chrome-foreground);
|
|
194
|
+
--card: var(--opsin-chrome-card);
|
|
195
|
+
--card-foreground: var(--opsin-chrome-card-foreground);
|
|
196
|
+
--muted: var(--opsin-chrome-muted);
|
|
197
|
+
--muted-foreground: var(--opsin-chrome-muted-foreground);
|
|
198
|
+
/* Hairline on the ladder for the same reason as the light half, and opaque
|
|
199
|
+
rather than the old oklch(1 0 0 / 0.11) alpha, which composited to a
|
|
200
|
+
different figure on every backdrop. neutral-500 reads WCAG 4.19 against the
|
|
201
|
+
dark page, clearing the 3:1 WCAG floor. It falls short of the Lc 45 non-text
|
|
202
|
+
floor at Lc -28.72, and that shortfall is stated rather than implied; an
|
|
203
|
+
alpha at 0.18 was measured too and read no better, at Lc 0.00 / WCAG 1.64. */
|
|
204
|
+
--border: var(--opsin-chrome-border);
|
|
205
|
+
--input: var(--opsin-chrome-input);
|
|
206
|
+
--edge: var(--opsin-chrome-edge);
|
|
207
|
+
--ring: var(--opsin-accent-ring);
|
|
208
|
+
--primary: var(--opsin-accent-action);
|
|
209
|
+
--primary-foreground: var(--opsin-accent-action-foreground);
|
|
210
|
+
--primary-edge: var(--opsin-accent-action-edge);
|
|
211
|
+
--brand: var(--opsin-accent-fill);
|
|
212
|
+
--brand-foreground: var(--opsin-accent-fill-foreground);
|
|
213
|
+
--brand-edge: var(--opsin-accent-fill-edge);
|
|
214
|
+
--brand-ink: var(--opsin-accent-ink);
|
|
215
|
+
--brand-glow: var(--opsin-accent-glow);
|
|
216
|
+
|
|
217
|
+
/* Interaction state fills, dark half. Lighter than their surfaces here, which
|
|
218
|
+
is the direction interaction-states.mdx:35-37 specifies for a dark theme
|
|
219
|
+
and the direction the old alpha fills were getting backwards. Opaque for
|
|
220
|
+
the same reason as the light half. Measured with @opsinjs/color:
|
|
221
|
+
--state-hover reads 1.42:1 against --background and 1.29:1 against --card,
|
|
222
|
+
--state-press 1.65:1 and 1.50:1, so press clears the report's 1.5:1 mark
|
|
223
|
+
on both surfaces in dark where the light theme cannot. The primary pair
|
|
224
|
+
comes from the accent layer, as in the light half. */
|
|
225
|
+
--state-hover: oklch(0.300 0.008 260);
|
|
226
|
+
--state-press: oklch(0.345 0.009 260);
|
|
227
|
+
--state-primary-hover: var(--opsin-accent-action-hover);
|
|
228
|
+
--state-primary-press: var(--opsin-accent-action-press);
|
|
229
|
+
|
|
230
|
+
/* Placeholder, dark half. Opaque steps for the same reason the hairline
|
|
231
|
+
above is opaque: the alpha the old dark --border carried, oklch(1 0 0 /
|
|
232
|
+
0.11), composited to a different figure on every backdrop it landed on, so
|
|
233
|
+
its published figure and its rendered figure were never the same number,
|
|
234
|
+
and that alpha is gone now. Measured over these steps, the dark hairline
|
|
235
|
+
reads 7.62:1 against the dark page at Lc 51.00 and 4.01:1 against its own
|
|
236
|
+
fill. */
|
|
237
|
+
--opsin-placeholder-fill: var(--opsin-neutral-700);
|
|
238
|
+
--opsin-placeholder-line: var(--opsin-neutral-400);
|
|
239
|
+
--opsin-placeholder-sheen: var(--opsin-neutral-600);
|
|
240
|
+
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* Accent scopes (ADR 0029). A role is resolved where it is declared, so a role
|
|
244
|
+
inherited from `:root` keeps the root's accent even inside an element that
|
|
245
|
+
chose another one. Every element carrying `data-accent-theme` or
|
|
246
|
+
`data-accent` therefore re-declares every chrome and accent role, and they
|
|
247
|
+
resolve against that element's own tokens from @opsinjs/tokens/tokens.css. On
|
|
248
|
+
`<html>` this repeats the root block; on a card or a preview it is what makes
|
|
249
|
+
a scope a scope. */
|
|
250
|
+
[data-accent],
|
|
251
|
+
[data-accent-theme] {
|
|
252
|
+
--background: var(--opsin-chrome-background);
|
|
253
|
+
--foreground: var(--opsin-chrome-foreground);
|
|
254
|
+
--card: var(--opsin-chrome-card);
|
|
255
|
+
--card-foreground: var(--opsin-chrome-card-foreground);
|
|
256
|
+
--muted: var(--opsin-chrome-muted);
|
|
257
|
+
--muted-foreground: var(--opsin-chrome-muted-foreground);
|
|
258
|
+
--border: var(--opsin-chrome-border);
|
|
259
|
+
--input: var(--opsin-chrome-input);
|
|
260
|
+
--edge: var(--opsin-chrome-edge);
|
|
261
|
+
--ring: var(--opsin-accent-ring);
|
|
262
|
+
--primary: var(--opsin-accent-action);
|
|
263
|
+
--primary-foreground: var(--opsin-accent-action-foreground);
|
|
264
|
+
--primary-edge: var(--opsin-accent-action-edge);
|
|
265
|
+
--brand: var(--opsin-accent-fill);
|
|
266
|
+
--brand-foreground: var(--opsin-accent-fill-foreground);
|
|
267
|
+
--brand-edge: var(--opsin-accent-fill-edge);
|
|
268
|
+
--brand-ink: var(--opsin-accent-ink);
|
|
269
|
+
--brand-glow: var(--opsin-accent-glow);
|
|
270
|
+
--state-primary-hover: var(--opsin-accent-action-hover);
|
|
271
|
+
--state-primary-press: var(--opsin-accent-action-press);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Density. Set `data-density="compact"` on any element to tighten what is
|
|
275
|
+
inside it; the documentation's preview toolbar drives the same attribute.
|
|
276
|
+
Only spacing moves. Type size and target minimum do not move, because "compact"
|
|
277
|
+
must never become "harder to hit". Comfortable is the unstamped default and
|
|
278
|
+
has no block of its own, so it can never drift from the base. Compact is one
|
|
279
|
+
multiplier, 0.875, carried by `--opsin-density-scale`; at that scale `p-4`
|
|
280
|
+
renders 14px and leaves the 4px grid on purpose, because no single multiplier
|
|
281
|
+
can hold the grid for both `p-4` and `p-5` at once. The 4px guarantee is on
|
|
282
|
+
the fixed `--opsin-space-*` steps, which density never moves. */
|
|
283
|
+
[data-density="compact"] {
|
|
284
|
+
--opsin-density-scale: 0.875;
|
|
285
|
+
--spacing: calc(0.25rem * var(--opsin-density-scale));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* Reduced motion. Declared after @opsinjs/tokens/tokens.css on purpose:
|
|
289
|
+
`@media` adds no specificity, so this block wins only because it comes
|
|
290
|
+
later than the generated durations it collapses. All five standalone
|
|
291
|
+
durations go to 1ms. The four sampled springs are not collapsed here; they
|
|
292
|
+
collapse inside tokens.css's own reduced-motion block, per token, to the
|
|
293
|
+
settle times tokens/motion.json declares for each of them, which is a better
|
|
294
|
+
answer than 1ms for a cue whose job is to say that a value changed. */
|
|
295
|
+
@media (prefers-reduced-motion: reduce) {
|
|
296
|
+
:root,
|
|
297
|
+
.opsin-product {
|
|
298
|
+
--opsin-duration-instant: 1ms;
|
|
299
|
+
--opsin-duration-fast: 1ms;
|
|
300
|
+
--opsin-duration-base: 1ms;
|
|
301
|
+
--opsin-duration-slow: 1ms;
|
|
302
|
+
--opsin-duration-deliberate: 1ms;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* Print. The theme layer owns the printed palette; a component owns only
|
|
307
|
+
whether its own boundary is drawn with a property a printer keeps.
|
|
308
|
+
|
|
309
|
+
There was no `@media print` block here at all, and several downstream files
|
|
310
|
+
each worked around its absence a different way. This is the one block, so they
|
|
311
|
+
no longer have to. It does four things and no more.
|
|
312
|
+
|
|
313
|
+
First, it forces ink. A product screen printed from the dark theme prints
|
|
314
|
+
near-white text on white paper, because `--foreground` is a near-white and
|
|
315
|
+
`--border` is a faint neutral, both invisible on a page. Redeclaring the roles
|
|
316
|
+
a printed page reads as ink on paper closes, for every component at once, the
|
|
317
|
+
dark-theme failure callout.tsx documents and names as unclosable from inside a
|
|
318
|
+
component, and makes `print:border-border` in card.tsx and metric-tile.tsx,
|
|
319
|
+
and `print:border-foreground` in callout.tsx, resolve to a line a printer
|
|
320
|
+
can draw. So Card and Callout carry a printed boundary through the palette
|
|
321
|
+
roles alone.
|
|
322
|
+
|
|
323
|
+
Second, it lands the third convergent path. The materials doctrine promises
|
|
324
|
+
that reduced transparency, a missing backdrop-filter and print all end at the
|
|
325
|
+
same opaque fallback. The first two are emitted into @opsinjs/tokens/tokens.css;
|
|
326
|
+
print was never written, so a translucent rung printed as a fill-less block.
|
|
327
|
+
Every rung in the ladder, the token-only `inset` rung included, is taken to its
|
|
328
|
+
opaque fallback here, with its tint alpha at 1, its blur at 0 and its saturation
|
|
329
|
+
back at 1, written out per rung because this file is authored rather than
|
|
330
|
+
generated, mirroring the reduced-transparency block in @opsinjs/tokens/tokens.css.
|
|
331
|
+
Resetting saturation matters: without it a printed sheet still runs the
|
|
332
|
+
sheet and overlay backdrop saturation over whatever is behind the paper.
|
|
333
|
+
|
|
334
|
+
Both the light and the dark selector groups are covered for the reason that
|
|
335
|
+
reduced-transparency block gives: `.opsin-product.dark` is (0,2,0) and a media
|
|
336
|
+
query adds no specificity, so a light-only rule here would leave a page
|
|
337
|
+
printed from the dark theme still near-white on white. Paper is paper, so all
|
|
338
|
+
four selectors carry identical values.
|
|
339
|
+
|
|
340
|
+
Third, it does NOT force `print-color-adjust: exact` globally. The fill is the
|
|
341
|
+
reader's setting to make; the boundary is the system's job and is now carried
|
|
342
|
+
by a border a printer keeps, so forcing every scrim to print solid would spend
|
|
343
|
+
the reader's toner on a dimmer that carries no information.
|
|
344
|
+
|
|
345
|
+
Fourth, it carries the edged rungs' border tokens to that same neutral ink.
|
|
346
|
+
The primitive Surface draws its boundary as an outline whose colour is
|
|
347
|
+
`--opsin-material-<rung>-border`, and every rung publishes that token at a
|
|
348
|
+
faint alpha in light and at a near-white alpha in dark, so on paper the
|
|
349
|
+
outline is there but invisible. Redeclaring the four edged rungs (card,
|
|
350
|
+
raised, sheet and overlay) to the same `#767676` the border role takes gives
|
|
351
|
+
the surface edge a line a printer draws, in both themes, without spending a
|
|
352
|
+
rung tint on paper. The three edgeless rungs (canvas, inset and scrim) keep
|
|
353
|
+
their `none` and gain no boundary they were specified not to have, so a
|
|
354
|
+
full-screen scrim still prints as no box at all. This is what closes the two
|
|
355
|
+
surfaces the palette roles could not reach: Dialog and Sheet are each a bare
|
|
356
|
+
`Surface rung="sheet"`, so both now print with a real boundary drawn by the
|
|
357
|
+
surface edge and no `print:` rule of their own. Ink and a neutral border
|
|
358
|
+
only: no category colour and no status colour reaches paper here. */
|
|
359
|
+
@media print {
|
|
360
|
+
:root,
|
|
361
|
+
.opsin-product,
|
|
362
|
+
.dark,
|
|
363
|
+
.opsin-product.dark {
|
|
364
|
+
--background: #fff;
|
|
365
|
+
--card: #fff;
|
|
366
|
+
--foreground: #000;
|
|
367
|
+
--card-foreground: #000;
|
|
368
|
+
--muted-foreground: #333;
|
|
369
|
+
--border: #767676;
|
|
370
|
+
|
|
371
|
+
/* The primitive Surface edge, and with it the Dialog popup and the Sheet
|
|
372
|
+
panel that are each a bare `Surface rung="sheet"`, draws its boundary as
|
|
373
|
+
an outline coloured `--opsin-material-<rung>-border`. Carry the four
|
|
374
|
+
edged rungs to the neutral border ink so that outline reaches paper in
|
|
375
|
+
both themes; leave canvas, inset and scrim at their `none` so an
|
|
376
|
+
edgeless rung prints no box. Card and Callout are already covered above
|
|
377
|
+
through `--border` and `--foreground`. */
|
|
378
|
+
--opsin-material-card-border: #767676;
|
|
379
|
+
--opsin-material-raised-border: #767676;
|
|
380
|
+
--opsin-material-sheet-border: #767676;
|
|
381
|
+
--opsin-material-overlay-border: #767676;
|
|
382
|
+
|
|
383
|
+
--opsin-material-canvas-tint: var(--opsin-material-canvas-opaque);
|
|
384
|
+
--opsin-material-canvas-tint-alpha: 1;
|
|
385
|
+
--opsin-material-canvas-blur: 0px;
|
|
386
|
+
--opsin-material-canvas-saturation: 1;
|
|
387
|
+
--opsin-material-inset-tint: var(--opsin-material-inset-opaque);
|
|
388
|
+
--opsin-material-inset-tint-alpha: 1;
|
|
389
|
+
--opsin-material-inset-blur: 0px;
|
|
390
|
+
--opsin-material-inset-saturation: 1;
|
|
391
|
+
--opsin-material-card-tint: var(--opsin-material-card-opaque);
|
|
392
|
+
--opsin-material-card-tint-alpha: 1;
|
|
393
|
+
--opsin-material-card-blur: 0px;
|
|
394
|
+
--opsin-material-card-saturation: 1;
|
|
395
|
+
--opsin-material-raised-tint: var(--opsin-material-raised-opaque);
|
|
396
|
+
--opsin-material-raised-tint-alpha: 1;
|
|
397
|
+
--opsin-material-raised-blur: 0px;
|
|
398
|
+
--opsin-material-raised-saturation: 1;
|
|
399
|
+
--opsin-material-sheet-tint: var(--opsin-material-sheet-opaque);
|
|
400
|
+
--opsin-material-sheet-tint-alpha: 1;
|
|
401
|
+
--opsin-material-sheet-blur: 0px;
|
|
402
|
+
--opsin-material-sheet-saturation: 1;
|
|
403
|
+
--opsin-material-overlay-tint: var(--opsin-material-overlay-opaque);
|
|
404
|
+
--opsin-material-overlay-tint-alpha: 1;
|
|
405
|
+
--opsin-material-overlay-blur: 0px;
|
|
406
|
+
--opsin-material-overlay-saturation: 1;
|
|
407
|
+
--opsin-material-scrim-tint: var(--opsin-material-scrim-opaque);
|
|
408
|
+
--opsin-material-scrim-tint-alpha: 1;
|
|
409
|
+
--opsin-material-scrim-blur: 0px;
|
|
410
|
+
--opsin-material-scrim-saturation: 1;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
standalone.css is the build input for dist/styles.css, the stylesheet for
|
|
3
|
+
an app that does not use Tailwind.
|
|
4
|
+
|
|
5
|
+
It takes Tailwind's theme and utility layers and leaves preflight out, so
|
|
6
|
+
loading opsinjs never resets the rest of a page. The utilities are
|
|
7
|
+
generated from the component sources and nothing else, and they sit in
|
|
8
|
+
cascade layers, so an app's own unlayered CSS still wins.
|
|
9
|
+
========================================================================== */
|
|
10
|
+
|
|
11
|
+
@layer theme, base, components, utilities;
|
|
12
|
+
|
|
13
|
+
@import "tailwindcss/theme.css" layer(theme);
|
|
14
|
+
@import "tailwindcss/utilities.css" layer(utilities);
|
|
15
|
+
|
|
16
|
+
@import "@opsinjs/tokens/tokens.css";
|
|
17
|
+
@import "./roles.css";
|
|
18
|
+
@import "./theme.css";
|
|
19
|
+
|
|
20
|
+
@source "../src";
|