@grafctory/skin 0.0.0-stage → 0.3.1

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 (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +469 -2
  3. package/dist/index.core.d.ts +201 -0
  4. package/dist/index.core.d.ts.map +1 -0
  5. package/dist/index.core.js +17 -0
  6. package/dist/index.core.js.map +1 -0
  7. package/dist/index.css +126 -0
  8. package/dist/index.d.ts +432 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +184 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/markup/alerts.css +83 -0
  13. package/dist/markup/blocks.css +255 -0
  14. package/dist/markup/forms.css +551 -0
  15. package/dist/markup/headings.css +131 -0
  16. package/dist/markup/highlights.css +38 -0
  17. package/dist/markup/inlines.css +183 -0
  18. package/dist/markup/lists.css +206 -0
  19. package/dist/markup/reset.css +38 -0
  20. package/dist/markup/tables.css +78 -0
  21. package/dist/presets/inter.css +194 -0
  22. package/dist/presets/roboto.css +198 -0
  23. package/dist/tokens/borders.css +151 -0
  24. package/dist/tokens/borders.d.ts +57 -0
  25. package/dist/tokens/borders.d.ts.map +1 -0
  26. package/dist/tokens/borders.js +72 -0
  27. package/dist/tokens/borders.js.map +1 -0
  28. package/dist/tokens/colors.css +515 -0
  29. package/dist/tokens/colors.d.ts +171 -0
  30. package/dist/tokens/colors.d.ts.map +1 -0
  31. package/dist/tokens/colors.js +186 -0
  32. package/dist/tokens/colors.js.map +1 -0
  33. package/dist/tokens/elevations.css +110 -0
  34. package/dist/tokens/elevations.d.ts +54 -0
  35. package/dist/tokens/elevations.d.ts.map +1 -0
  36. package/dist/tokens/elevations.js +69 -0
  37. package/dist/tokens/elevations.js.map +1 -0
  38. package/dist/tokens/layers.css +57 -0
  39. package/dist/tokens/layers.d.ts +34 -0
  40. package/dist/tokens/layers.d.ts.map +1 -0
  41. package/dist/tokens/layers.js +49 -0
  42. package/dist/tokens/layers.js.map +1 -0
  43. package/dist/tokens/motions.css +91 -0
  44. package/dist/tokens/motions.d.ts +40 -0
  45. package/dist/tokens/motions.d.ts.map +1 -0
  46. package/dist/tokens/motions.js +55 -0
  47. package/dist/tokens/motions.js.map +1 -0
  48. package/dist/tokens/opacities.css +41 -0
  49. package/dist/tokens/opacities.d.ts +32 -0
  50. package/dist/tokens/opacities.d.ts.map +1 -0
  51. package/dist/tokens/opacities.js +47 -0
  52. package/dist/tokens/opacities.js.map +1 -0
  53. package/dist/tokens/palettes.css +546 -0
  54. package/dist/tokens/palettes.d.ts +140 -0
  55. package/dist/tokens/palettes.d.ts.map +1 -0
  56. package/dist/tokens/palettes.js +155 -0
  57. package/dist/tokens/palettes.js.map +1 -0
  58. package/dist/tokens/scalings.css +81 -0
  59. package/dist/tokens/scalings.d.ts +31 -0
  60. package/dist/tokens/scalings.d.ts.map +1 -0
  61. package/dist/tokens/scalings.js +46 -0
  62. package/dist/tokens/scalings.js.map +1 -0
  63. package/dist/tokens/spacings.css +78 -0
  64. package/dist/tokens/spacings.d.ts +34 -0
  65. package/dist/tokens/spacings.d.ts.map +1 -0
  66. package/dist/tokens/spacings.js +49 -0
  67. package/dist/tokens/spacings.js.map +1 -0
  68. package/dist/tokens/typography.css +156 -0
  69. package/dist/tokens/typography.d.ts +77 -0
  70. package/dist/tokens/typography.d.ts.map +1 -0
  71. package/dist/tokens/typography.js +92 -0
  72. package/dist/tokens/typography.js.map +1 -0
  73. package/dist/tokens/viewports.css +101 -0
  74. package/dist/tokens/viewports.d.ts +75 -0
  75. package/dist/tokens/viewports.d.ts.map +1 -0
  76. package/dist/tokens/viewports.js +90 -0
  77. package/dist/tokens/viewports.js.map +1 -0
  78. package/package.json +87 -4
@@ -0,0 +1,83 @@
1
+ /*
2
+ * Copyright © 2023-2026 Metreeca srl
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /*
18
+ * Markdown alerts, as a renderer supporting the > [!NOTE] syntax emits them: a block classed markdown-alert and its
19
+ * kind, opened by a markdown-alert-title paragraph. The classes are that published convention rather than names of
20
+ * the design system, so any Markdown pipeline emitting them gets alerts on the meaning scale.
21
+ *
22
+ * An alert sits on the page behind a bar in the stroke role of its step, which paints its title and any glyph beside
23
+ * it as well, while the body keeps the page text: the colour stands alongside the wording, never alone. The bar takes
24
+ * its width from the spacing scale, the scale holding no border width heavy enough to carry a mark on its own.
25
+ *
26
+ * A note states useful information without passing a verdict, which is what the note step says, and the important
27
+ * alert singles out what a reader must not miss, which is what the flag step says.
28
+ */
29
+
30
+ .markdown-alert {
31
+
32
+ padding: var(--skin--spacing-050) var(--skin--spacing-100);
33
+ margin-bottom: var(--skin--spacing-100);
34
+
35
+ border-left: var(--skin--spacing-025) var(--skin--border-style) var(--skin-alert);
36
+
37
+ /* Every stroke role holds AA contrast on the page in both schemes, as stated where they are declared. */
38
+
39
+ &.markdown-alert-note {
40
+ --skin-alert: var(--skin--color-note-stroke);
41
+ }
42
+
43
+ &.markdown-alert-important {
44
+ --skin-alert: var(--skin--color-flag-stroke);
45
+ }
46
+
47
+ &.markdown-alert-tip {
48
+ --skin-alert: var(--skin--color-pass-stroke);
49
+ }
50
+
51
+ &.markdown-alert-warning {
52
+ --skin-alert: var(--skin--color-warn-stroke);
53
+ }
54
+
55
+ &.markdown-alert-caution {
56
+ --skin-alert: var(--skin--color-fail-stroke);
57
+ }
58
+
59
+ & > .markdown-alert-title {
60
+
61
+ display: flex;
62
+ align-items: center;
63
+ column-gap: var(--skin--spacing-050);
64
+
65
+ margin-bottom: var(--skin--spacing-050);
66
+
67
+ font-weight: var(--skin--font-weight-strong);
68
+
69
+ color: var(--skin-alert);
70
+
71
+ & > svg {
72
+ width: var(--skin--scaling-100);
73
+ height: var(--skin--scaling-100);
74
+ fill: currentColor;
75
+ }
76
+
77
+ }
78
+
79
+ & > p:last-child {
80
+ margin-bottom: 0;
81
+ }
82
+
83
+ }
@@ -0,0 +1,255 @@
1
+ /*
2
+ * Copyright © 2023-2026 Metreeca srl
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ p {
18
+
19
+ margin-bottom: var(--skin--spacing-100);
20
+
21
+ &:has(img:only-child) {
22
+ margin: 0;
23
+ }
24
+
25
+ }
26
+
27
+ /*
28
+ * An image standing alone in a paragraph reads as a figure: centred in the measure, scaled down to fit it keeping its
29
+ * proportions, and set apart from what follows by the spacing a paragraph takes. The selector carries no weight, so
30
+ * an image lifted out of the text by the `active` attribute keeps the sizes and margins it is given there.
31
+ */
32
+
33
+ :where(p:has(img:only-child)) > :where(img) {
34
+
35
+ display: block;
36
+
37
+ max-width: 100%;
38
+ height: auto;
39
+
40
+ margin: 0 auto var(--skin--spacing-100);
41
+
42
+ }
43
+
44
+ blockquote {
45
+
46
+ padding: var(--skin--spacing-050) var(--skin--spacing-075);
47
+ margin-bottom: var(--skin--spacing-100);
48
+ background-color: var(--skin--background-color-stripe);
49
+
50
+ & > p {
51
+ margin-bottom: 0.1em; /* An optical nudge between quoted paragraphs, below the spacing scale. */
52
+ }
53
+
54
+ }
55
+
56
+ /*
57
+ * A preformatted block sits on the stripe like a quotation, keeping its breaks and scrolling past the measure. A block
58
+ * given a tabindex, so that a keyboard can scroll it, shows the focus mark the controls carry.
59
+ */
60
+
61
+ pre {
62
+
63
+ padding: var(--skin--spacing-050) var(--skin--spacing-075);
64
+ margin-bottom: var(--skin--spacing-100);
65
+ overflow-x: auto;
66
+ border-radius: var(--skin--border-radius-025);
67
+ background-color: var(--skin--background-color-stripe);
68
+
69
+ &:focus-visible {
70
+ outline: var(--skin--outline-focus);
71
+ outline-offset: var(--skin--border-width);
72
+ }
73
+
74
+ }
75
+
76
+ hr {
77
+
78
+ margin: var(--skin--spacing-150) 0;
79
+ border-bottom-style: var(--skin--border-style);
80
+ border-bottom-width: var(--skin--border-width);
81
+ border-bottom-color: var(--skin--border-color);
82
+
83
+ &:first-child, &:last-child {
84
+ display: none;
85
+ }
86
+
87
+ }
88
+
89
+ /*
90
+ * A picture, a video or an embedded frame never stands wider than the column it sits in. A picture or a video sized
91
+ * by both a width and a height keeps its proportions when scaled down, its height following the width; one sized by
92
+ * its height alone keeps that height, as a logo or an icon set to the line it stands in expects.
93
+ */
94
+
95
+ img, video, iframe {
96
+ max-width: 100%;
97
+ }
98
+
99
+ :is(img, video)[width] {
100
+ height: auto;
101
+ }
102
+
103
+ /*
104
+ * A picture floated beside the text by its `align` attribute stops floating on a narrow screen, where the column leaves
105
+ * too little room for text to run around it, and stretches across the column instead, keeping its proportions.
106
+ */
107
+
108
+ img:is([align="left" i], [align="right" i]) {
109
+ @container style(--skin--viewport-small: off) {
110
+ float: none;
111
+ display: block;
112
+ width: 100%;
113
+ height: auto;
114
+ }
115
+ }
116
+
117
+ /* A figure is set apart from the text as a block, its caption below it in the quieter size and colour of a label. */
118
+
119
+ figure {
120
+ margin-bottom: var(--skin--spacing-100);
121
+ }
122
+
123
+ figcaption {
124
+ margin-top: var(--skin--spacing-050);
125
+ font-size: var(--skin--font-size-small);
126
+ color: var(--skin--color-label);
127
+ }
128
+
129
+ /*
130
+ * A disclosure is set apart from the text as a block. Its summary is the control opening it, so it offers the pointer
131
+ * and owes the focus mark the reset takes away, and stands off what it discloses once open.
132
+ */
133
+
134
+ details {
135
+
136
+ margin-bottom: var(--skin--spacing-100);
137
+
138
+ &[open] > summary {
139
+
140
+ margin-bottom: var(--skin--spacing-050);
141
+
142
+ /*
143
+ * Turned up, the chevron fills only the upper half of its box, so it is lowered by a quarter of the box
144
+ * diagonal, the same distance it is raised by while it points down, and stays centred on the summary text.
145
+ */
146
+
147
+ &::before {
148
+ transform: translateY(calc(0.3536 * var(--skin--scaling-050))) rotate(-135deg);
149
+ }
150
+
151
+ }
152
+
153
+ }
154
+
155
+ /*
156
+ * A summary trades the platform triangle for a chevron drawn in the quiet stroke of a field border, which looks the
157
+ * same on every platform and leaves the wording of the summary to carry the weight. The chevron points down towards
158
+ * the content while the disclosure is closed and turns up once it is open, which reads the same in either writing
159
+ * direction. Turned down, it fills only the lower half of its box, so it is raised by a quarter of the box diagonal.
160
+ *
161
+ * The chevron stands at the end of the first line of every summary, wherever the disclosure sits, so a reader finds
162
+ * it in the same place throughout an interface. It floats there rather than taking a flex row, which would split the
163
+ * wording of a summary into separate items and lose the spaces between them, and is centred on the first line.
164
+ */
165
+
166
+ summary {
167
+
168
+ list-style-type: none;
169
+ cursor: pointer;
170
+
171
+ &::-webkit-details-marker {
172
+ display: none;
173
+ }
174
+
175
+ &::before {
176
+
177
+ content: "";
178
+
179
+ float: inline-end;
180
+ inline-size: var(--skin--scaling-050);
181
+ block-size: var(--skin--scaling-050);
182
+ margin-block-start: calc(0.5lh - var(--skin--scaling-025)); /* Centred on the first line. */
183
+ margin-inline: var(--skin--spacing-075) var(--skin--spacing-025);
184
+
185
+ border-right-style: var(--skin--border-style);
186
+ border-bottom-style: var(--skin--border-style);
187
+ border-width: var(--skin--border-width);
188
+ border-color: var(--skin--border-color-field);
189
+
190
+ transform: translateY(calc(-0.3536 * var(--skin--scaling-050))) rotate(45deg);
191
+ transition: transform var(--skin--duration-fast) var(--skin--easing-standard);
192
+
193
+ }
194
+
195
+ /*
196
+ * A summary worded as a single heading or paragraph sets its first line in that block, at a line height of its
197
+ * own, so the summary lays the block and the chevron out in a row instead and centres the chevron on the block.
198
+ * The row splits no wording, since the block is one item already, where the float would sit off its middle.
199
+ */
200
+
201
+ &:has(> :is(h1, h2, h3, h4, h5, h6, p):only-child) {
202
+
203
+ display: flex;
204
+ align-items: center;
205
+
206
+ & > :is(h1, h2, h3, h4, h5, h6, p) {
207
+ flex-grow: 1;
208
+ }
209
+
210
+ &::before {
211
+ order: 1;
212
+ flex-shrink: 0;
213
+ margin-block-start: 0;
214
+ }
215
+
216
+ }
217
+
218
+ &:focus-visible {
219
+ border-radius: var(--skin--border-radius-025);
220
+ outline: var(--skin--outline-focus);
221
+ outline-offset: var(--skin--border-width);
222
+ }
223
+
224
+ }
225
+
226
+ /*
227
+ * A focused block is lifted over the content following it, whose background would otherwise paint over the part of
228
+ * the ring drawn outside the box. The lift weighs nothing, so any rule positioning a block keeps its own value.
229
+ */
230
+
231
+ :where(pre:focus-visible, summary:focus-visible) {
232
+ position: relative;
233
+ }
234
+
235
+ /*
236
+ * A dialog is an overlay surface, lifted off the page with the shadow that pairs with it, outlined and rounded as a
237
+ * card is, and padded from its content. The reset takes the margin a modal dialog is centred by, so it is restored,
238
+ * and the page behind a modal is dimmed with the blanket, as it is behind an image enlarged out of the text.
239
+ */
240
+
241
+ dialog {
242
+
243
+ margin: auto;
244
+ padding: var(--skin--spacing-150);
245
+ border-style: var(--skin--border-style);
246
+ border-radius: var(--skin--border-radius-075);
247
+
248
+ background-color: var(--skin--background-color-overlay);
249
+ box-shadow: var(--skin--box-shadow-overlay);
250
+
251
+ &::backdrop {
252
+ background-color: var(--skin--background-color-blanket);
253
+ }
254
+
255
+ }