@dotvoid/textbit-styles 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/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 TT Nyhetsbyrån AB
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
9
+ ---
10
+
11
+ The fonts in fonts/ are not covered by the licence above. Petrona and Overused
12
+ Grotesk are each licensed under the SIL Open Font License, Version 1.1; see
13
+ fonts/Petrona-OFL.txt and fonts/OverusedGrotesk-OFL.txt.
package/README.md CHANGED
@@ -1,3 +1,70 @@
1
- # Temporary Holding Version
1
+ # @dotvoid/textbit-styles
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
+ A default look for [`@dotvoid/textbit`](https://github.com/dotvoid/textbit/tree/main/packages/textbit) and
4
+ [`@dotvoid/textbit-plugins`](https://github.com/dotvoid/textbit/tree/main/packages/plugins), in plain CSS. No build step and no
5
+ framework: import it, and adjust it with custom properties.
6
+
7
+ ```bash
8
+ npm install @dotvoid/textbit-styles
9
+ ```
10
+
11
+ ```ts
12
+ import '@dotvoid/textbit-styles'
13
+ ```
14
+
15
+ Or only the parts you want:
16
+
17
+ ```ts
18
+ import '@dotvoid/textbit-styles/fonts.css' // the default faces, optional
19
+ import '@dotvoid/textbit-styles/variables.css' // design tokens, needed by the others
20
+ import '@dotvoid/textbit-styles/editor.css' // textbit's menus, toolbar, pickers and spelling marks
21
+ import '@dotvoid/textbit-styles/plugins.css' // the plugins
22
+ ```
23
+
24
+ ## Fonts
25
+
26
+ Text is set in [Petrona](https://github.com/RingoSeeber/Petrona) and headings in
27
+ [Overused Grotesk](https://github.com/RandomMaerks/Overused-Grotesk), both
28
+ variable fonts under the SIL Open Font License 1.1, shipped in `fonts/` with
29
+ their licences. `fonts.css` declares them; browsers download a face only when a
30
+ page uses it. Without `fonts.css`, or when a face fails to load, text falls back
31
+ to system faces: Iowan Old Style and Avenir Next on macOS. To use your own,
32
+ override `--tb-font-text` and `--tb-font-heading`.
33
+
34
+ ## Scoped
35
+
36
+ Every rule targets textbit's own hooks: the `data-tb` attributes on textbit's UI,
37
+ the `tb-*` classes the plugins render, and the spelling attributes. Nothing else on
38
+ your page is touched. The package's tests check this.
39
+
40
+ ## Dark mode
41
+
42
+ Colours follow the page's `color-scheme` through CSS `light-dark()`. Set
43
+ `color-scheme: dark`, or `light dark` to follow the system, on the page or on an
44
+ element around the editor. The special characters pane opens at the end of
45
+ `<body>`, outside any element around the editor, so set it on the page (`:root`)
46
+ to have the pane follow too.
47
+
48
+ ## Tokens
49
+
50
+ Override any token on `:root`, or on an element around one editor.
51
+
52
+ | Token | Use |
53
+ |-------|-----|
54
+ | `--tb-font-text`, `--tb-font-text-weight` | Body text: Petrona, weight 440 |
55
+ | `--tb-font-heading`, `--tb-font-heading-weight` | Headings: Overused Grotesk, weight 700 |
56
+ | `--tb-font-ui` | Menus, labels and captions: the system's sans serif |
57
+ | `--tb-font-mono` | Code |
58
+ | `--tb-text-size`, `--tb-leading` | Text size and line height; headings, the lead-in and code scale with the size |
59
+ | `--tb-gap`, `--tb-gap-wide` | Space between paragraphs; around quotes, tables, code and media |
60
+ | `--tb-radius` | Corner radius |
61
+ | `--tb-text`, `--tb-muted` | Text, secondary text |
62
+ | `--tb-surface`, `--tb-subtle`, `--tb-border` | Popover background, quiet background, lines |
63
+ | `--tb-accent`, `--tb-accent-subtle` | Links, active items, focus |
64
+ | `--tb-shadow`, `--tb-focus` | Popover shadow, focus outline |
65
+ | `--tb-spelling-error-line`, `--tb-spelling-error-tint` | Spelling errors |
66
+ | `--tb-spelling-suggestion-line`, `--tb-spelling-suggestion-tint` | Spelling suggestions |
67
+
68
+ Spelling errors and suggestions differ in line shape (wavy against dashed) and in
69
+ tint strength, not only in colour, so they stay apart for people who do not tell
70
+ red from blue. In forced colours mode the tint goes and the shapes remain.
package/css/editor.css ADDED
@@ -0,0 +1,306 @@
1
+ /*
2
+ * textbit's own UI: the gutter menu, the selection toolbar, the context menu and
3
+ * the special characters pane, targeted through their data-tb attributes, plus
4
+ * spelling marks. Needs variables.css.
5
+ */
6
+
7
+ /* The editor: one surface around the gutter and the text */
8
+ [data-tb="editor"] {
9
+ box-sizing: border-box;
10
+ padding: 1.25rem 1.5rem;
11
+ color: var(--tb-text);
12
+ background: var(--tb-surface);
13
+ border: 1px solid var(--tb-border);
14
+ border-radius: calc(var(--tb-radius) * 1.5);
15
+ font-family: var(--tb-font-ui);
16
+ transition: border-color 0.15s, box-shadow 0.15s;
17
+ }
18
+
19
+ /* The focus ring sits on the whole editor, so the text itself needs none */
20
+ [data-tb="editor"]:focus-within {
21
+ border-color: var(--tb-accent);
22
+ box-shadow: 0 0 0 3px var(--tb-accent-subtle);
23
+ }
24
+
25
+ [data-tb="editable"] {
26
+ min-height: 6em;
27
+ font-family: var(--tb-font-text);
28
+ font-size: var(--tb-text-size);
29
+ font-weight: var(--tb-font-text-weight);
30
+ line-height: var(--tb-leading);
31
+ font-kerning: normal;
32
+ -webkit-font-smoothing: antialiased;
33
+ -moz-osx-font-smoothing: grayscale;
34
+ outline: none;
35
+ }
36
+
37
+ [data-tb="gutter"] {
38
+ color: var(--tb-muted);
39
+ }
40
+
41
+ /* Popovers shared by the menus */
42
+ [data-tb="menu-content"],
43
+ [data-tb="context-menu"],
44
+ [data-tb="toolbar"],
45
+ [data-tb="special-characters"] {
46
+ color: var(--tb-text);
47
+ background: var(--tb-surface);
48
+ border: 1px solid var(--tb-border);
49
+ border-radius: var(--tb-radius);
50
+ box-shadow: var(--tb-shadow);
51
+ font-family: var(--tb-font-ui);
52
+ font-size: 0.875rem;
53
+ }
54
+
55
+ /* Gutter menu */
56
+ [data-tb="menu"] {
57
+ line-height: 1;
58
+ }
59
+
60
+ [data-tb="menu-label"] {
61
+ white-space: nowrap;
62
+ }
63
+
64
+ [data-tb="menu-trigger"] {
65
+ display: inline-grid;
66
+ place-items: center;
67
+ box-sizing: border-box;
68
+ width: 1.875rem;
69
+ height: 1.875rem;
70
+ color: var(--tb-muted);
71
+ background: var(--tb-surface);
72
+ border: 1px solid color-mix(in srgb, var(--tb-muted) 35%, var(--tb-border));
73
+ border-radius: 50%;
74
+ box-shadow: 0 1px 2px light-dark(rgb(31 35 40 / 0.06), rgb(0 0 0 / 0.3));
75
+ font-size: 1.125rem;
76
+ cursor: pointer;
77
+ user-select: none;
78
+ transition: color 0.12s, background-color 0.12s, border-color 0.12s;
79
+ }
80
+
81
+ [data-tb="menu-trigger"]:hover,
82
+ [data-tb="menu-trigger"][aria-expanded="true"] {
83
+ color: var(--tb-text);
84
+ background: var(--tb-subtle);
85
+ border-color: color-mix(in srgb, var(--tb-accent) 45%, var(--tb-border));
86
+ }
87
+
88
+ [data-tb="menu-trigger"]:focus-visible {
89
+ outline: var(--tb-focus);
90
+ outline-offset: 2px;
91
+ }
92
+
93
+ [data-tb="menu-content"],
94
+ [data-tb="context-menu"] {
95
+ min-width: 15rem;
96
+ padding: 0.375rem;
97
+ }
98
+
99
+ [data-tb="menu-group"] + [data-tb="menu-group"],
100
+ [data-tb="context-menu-group"] + [data-tb="context-menu-group"] {
101
+ margin-top: 0.375rem;
102
+ padding-top: 0.375rem;
103
+ border-top: 1px solid var(--tb-border);
104
+ }
105
+
106
+ [data-tb="menu-item"],
107
+ [data-tb="context-menu-item"] {
108
+ display: grid;
109
+ grid-template-columns: 1.25rem 1fr auto;
110
+ align-items: center;
111
+ gap: 0.75rem;
112
+ padding: 0.5rem 0.75rem;
113
+ line-height: 1.25;
114
+ border-radius: calc(var(--tb-radius) - 2px);
115
+ color: inherit;
116
+ text-decoration: none;
117
+ cursor: pointer;
118
+ user-select: none;
119
+ }
120
+
121
+ [data-tb="context-menu-item"] {
122
+ grid-template-columns: 1fr;
123
+ }
124
+
125
+ [data-tb="menu-item"]:hover,
126
+ [data-tb="menu-item"]:focus-visible,
127
+ [data-tb="context-menu-item"]:hover,
128
+ [data-tb="context-menu-item"]:focus-visible {
129
+ background: var(--tb-subtle);
130
+ outline: none;
131
+ }
132
+
133
+ [data-tb="menu-item"][data-state="active"] {
134
+ color: var(--tb-accent);
135
+ }
136
+
137
+ [data-tb="menu-icon"] {
138
+ display: grid;
139
+ place-items: center;
140
+ color: var(--tb-muted);
141
+ }
142
+
143
+ [data-tb="menu-item"][data-state="active"] [data-tb="menu-icon"] {
144
+ color: inherit;
145
+ }
146
+
147
+ [data-tb="menu-hotkey"] {
148
+ padding-left: 1rem;
149
+ color: var(--tb-muted);
150
+ font-size: 0.75rem;
151
+ letter-spacing: 0.04em;
152
+ }
153
+
154
+ /* Selection toolbar */
155
+ [data-tb="toolbar"] {
156
+ display: flex;
157
+ padding: 0.25rem;
158
+ transition: opacity 0.12s;
159
+ }
160
+
161
+ [data-tb="toolbar-group"] {
162
+ display: flex;
163
+ gap: 0.125rem;
164
+ }
165
+
166
+ [data-tb="toolbar-group"] + [data-tb="toolbar-group"] {
167
+ margin-left: 0.25rem;
168
+ padding-left: 0.25rem;
169
+ border-left: 1px solid var(--tb-border);
170
+ }
171
+
172
+ [data-tb="toolbar-item"] {
173
+ display: grid;
174
+ place-items: center;
175
+ min-width: 1.75rem;
176
+ height: 1.75rem;
177
+ border-radius: calc(var(--tb-radius) - 2px);
178
+ cursor: pointer;
179
+ user-select: none;
180
+ }
181
+
182
+ [data-tb="toolbar-item"]:hover,
183
+ [data-tb="toolbar-item"]:focus-visible {
184
+ background: var(--tb-subtle);
185
+ outline: none;
186
+ }
187
+
188
+ [data-tb="toolbar-item"][aria-pressed="true"],
189
+ [data-tb="toolbar-item"][data-state="active"] {
190
+ color: var(--tb-accent);
191
+ background: var(--tb-accent-subtle);
192
+ }
193
+
194
+ /* Special characters pane */
195
+ [data-tb="special-characters"] {
196
+ width: 22rem;
197
+ padding: 0.625rem;
198
+ }
199
+
200
+ [data-tb="special-characters"] input {
201
+ box-sizing: border-box;
202
+ width: 100%;
203
+ padding: 0.5rem 0.625rem;
204
+ color: inherit;
205
+ background: var(--tb-surface);
206
+ border: 1px solid var(--tb-border);
207
+ border-radius: calc(var(--tb-radius) - 2px);
208
+ font: inherit;
209
+ transition: border-color 0.12s, box-shadow 0.12s;
210
+ }
211
+
212
+ [data-tb="special-characters"] input:focus {
213
+ border-color: var(--tb-accent);
214
+ outline: none;
215
+ box-shadow: 0 0 0 3px var(--tb-accent-subtle);
216
+ }
217
+
218
+ [data-tb="special-characters"] [role="listbox"] {
219
+ max-height: 15rem;
220
+ margin-top: 0.5rem;
221
+ overflow-y: auto;
222
+ }
223
+
224
+ [data-tb="special-characters"] [role="group"] {
225
+ display: grid;
226
+ grid-template-columns: repeat(8, 1fr);
227
+ gap: 0.25rem;
228
+ margin-bottom: 0.75rem;
229
+ }
230
+
231
+ [data-tb="special-characters"] [data-heading] {
232
+ grid-column: 1 / -1;
233
+ padding: 0.25rem 0.25rem 0;
234
+ color: var(--tb-muted);
235
+ font-size: 0.6875rem;
236
+ letter-spacing: 0.06em;
237
+ text-transform: uppercase;
238
+ }
239
+
240
+ [data-tb="special-characters"] [role="option"] {
241
+ display: grid;
242
+ place-items: center;
243
+ height: 2.25rem;
244
+ color: color-mix(in srgb, var(--tb-text) 80%, transparent);
245
+ border-radius: calc(var(--tb-radius) - 2px);
246
+ font-size: 1.0625rem;
247
+ font-weight: 400;
248
+ cursor: pointer;
249
+ transition: background-color 0.1s;
250
+ }
251
+
252
+ [data-tb="special-characters"] [role="option"]:hover {
253
+ background: var(--tb-subtle);
254
+ }
255
+
256
+ [data-tb="special-characters"] [role="option"][data-state="active"] {
257
+ color: var(--tb-accent);
258
+ background: var(--tb-accent-subtle);
259
+ }
260
+
261
+ /* Spaces and other characters that show nothing: their code point, quietly */
262
+ [data-tb="special-characters"] [role="option"][data-invisible] {
263
+ color: var(--tb-muted);
264
+ font-family: var(--tb-font-mono);
265
+ font-size: 0.5625rem;
266
+ background: var(--tb-subtle);
267
+ }
268
+
269
+ [data-tb="special-characters"] [data-name],
270
+ [data-tb="special-characters"] [data-empty] {
271
+ min-height: 1.25rem;
272
+ padding: 0.5rem 0.25rem 0;
273
+ color: var(--tb-muted);
274
+ font-size: 0.8rem;
275
+ }
276
+
277
+ [data-tb="special-characters"] [data-name] {
278
+ border-top: 1px solid var(--tb-border);
279
+ }
280
+
281
+ /*
282
+ * Spelling marks. The two levels differ in line shape (wavy against dashed) and
283
+ * in tint strength, so they stay apart without telling red from blue. In forced
284
+ * colours the tint goes and the line shapes remain.
285
+ */
286
+ [data-spelling-error] {
287
+ text-decoration-line: underline;
288
+ text-decoration-style: wavy;
289
+ text-decoration-thickness: 2px;
290
+ text-decoration-color: var(--tb-spelling-error-line);
291
+ text-decoration-skip-ink: none;
292
+ text-underline-offset: 3px;
293
+ background-color: var(--tb-spelling-error-tint);
294
+ border-radius: 2px;
295
+ }
296
+
297
+ [data-spelling-level="suggestion"] {
298
+ text-decoration-style: dashed;
299
+ text-decoration-color: var(--tb-spelling-suggestion-line);
300
+ background-color: var(--tb-spelling-suggestion-tint);
301
+ }
302
+
303
+ [data-spelling-accepted] {
304
+ text-decoration: none;
305
+ background-color: transparent;
306
+ }
package/css/fonts.css ADDED
@@ -0,0 +1,53 @@
1
+ /*
2
+ * The default faces: Petrona for text and Overused Grotesk for headings, both
3
+ * variable fonts under the SIL Open Font License 1.1 (see ../fonts). Leave this
4
+ * file out, or override --tb-font-text and --tb-font-heading, to use others.
5
+ * Browsers download a face only when text on the page uses it.
6
+ */
7
+
8
+ /* Petrona, latin-ext */
9
+ @font-face {
10
+ font-family: 'Petrona';
11
+ font-style: normal;
12
+ font-display: swap;
13
+ font-weight: 100 900;
14
+ src: url('../fonts/petrona-latin-ext-wght-normal.woff2') format('woff2-variations');
15
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
16
+ }
17
+
18
+ @font-face {
19
+ font-family: 'Petrona';
20
+ font-style: italic;
21
+ font-display: swap;
22
+ font-weight: 100 900;
23
+ src: url('../fonts/petrona-latin-ext-wght-italic.woff2') format('woff2-variations');
24
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
25
+ }
26
+
27
+ /* Petrona, latin */
28
+ @font-face {
29
+ font-family: 'Petrona';
30
+ font-style: normal;
31
+ font-display: swap;
32
+ font-weight: 100 900;
33
+ src: url('../fonts/petrona-latin-wght-normal.woff2') format('woff2-variations');
34
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
35
+ }
36
+
37
+ @font-face {
38
+ font-family: 'Petrona';
39
+ font-style: italic;
40
+ font-display: swap;
41
+ font-weight: 100 900;
42
+ src: url('../fonts/petrona-latin-wght-italic.woff2') format('woff2-variations');
43
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
44
+ }
45
+
46
+ /* Overused Grotesk */
47
+ @font-face {
48
+ font-family: 'Overused Grotesk';
49
+ font-style: normal;
50
+ font-display: swap;
51
+ font-weight: 300 900;
52
+ src: url('../fonts/overused-grotesk-vf.woff2') format('woff2-variations');
53
+ }
package/css/index.css ADDED
@@ -0,0 +1,5 @@
1
+ /* Everything: the default faces, tokens, textbit's own UI and the plugins */
2
+ @import './fonts.css';
3
+ @import './variables.css';
4
+ @import './editor.css';
5
+ @import './plugins.css';
@@ -0,0 +1,279 @@
1
+ /*
2
+ * The plugins in @dotvoid/textbit-plugins, targeted through their tb-* classes.
3
+ * Needs variables.css.
4
+ */
5
+
6
+ .tb-child-placeholder {
7
+ color: var(--tb-muted);
8
+ opacity: 0.7;
9
+ }
10
+
11
+ /* Text */
12
+ .tb-text {
13
+ margin: 0 0 var(--tb-gap);
14
+ text-wrap: pretty;
15
+ }
16
+
17
+ /*
18
+ * Headings are sans serif, beside serif text. Large type gets tight leading,
19
+ * and each heading sits close to the text it introduces: more space above
20
+ * than below
21
+ */
22
+ .tb-heading-1,
23
+ .tb-heading-2,
24
+ .tb-heading-3,
25
+ .tb-heading-4,
26
+ .tb-heading-5,
27
+ .tb-heading-6 {
28
+ font-family: var(--tb-font-heading);
29
+ font-weight: var(--tb-font-heading-weight);
30
+ text-wrap: balance;
31
+ }
32
+
33
+ .tb-heading-1 {
34
+ margin: 1.25em 0 0.5em;
35
+ font-size: 2em;
36
+ line-height: 1.12;
37
+ letter-spacing: -0.022em;
38
+ }
39
+
40
+ .tb-heading-2 {
41
+ margin: 1.6em 0 0.45em;
42
+ font-size: 1.375em;
43
+ line-height: 1.25;
44
+ letter-spacing: -0.012em;
45
+ }
46
+
47
+ .tb-heading-3 {
48
+ margin: 1.6em 0 0.4em;
49
+ font-size: 1.15em;
50
+ line-height: 1.3;
51
+ letter-spacing: -0.006em;
52
+ }
53
+
54
+ .tb-heading-4,
55
+ .tb-heading-5,
56
+ .tb-heading-6 {
57
+ margin: 1.5em 0 0.35em;
58
+ font-size: 1em;
59
+ line-height: 1.35;
60
+ }
61
+
62
+ /* The editor's padding alone frames the text: no margin above the first
63
+ block or below the last */
64
+ [data-tb="editable"] > :first-child > * > * {
65
+ margin-top: 0;
66
+ }
67
+
68
+ [data-tb="editable"] > :last-child > * > * {
69
+ margin-bottom: 0;
70
+ }
71
+
72
+ /* The lead-in: a step up in size and a touch more weight, with its own leading */
73
+ .tb-preamble {
74
+ font-size: 1.1875em;
75
+ font-weight: calc(var(--tb-font-text-weight) + 80);
76
+ line-height: 1.45;
77
+ letter-spacing: -0.003em;
78
+ }
79
+
80
+ /* Inline code: monospace runs large, so it steps down to sit with the serif */
81
+ .tb-code {
82
+ padding: 0.12em 0.32em;
83
+ font-family: var(--tb-font-mono);
84
+ font-size: 0.84em;
85
+ font-weight: 400;
86
+ background: var(--tb-subtle);
87
+ border-radius: 4px;
88
+ -webkit-box-decoration-break: clone;
89
+ box-decoration-break: clone;
90
+ }
91
+
92
+ /* Lists */
93
+ .tb-list {
94
+ margin: 0 0 var(--tb-gap);
95
+ padding-left: 1.4em;
96
+ }
97
+
98
+ .tb-list-item {
99
+ padding-left: 0.2em;
100
+ }
101
+
102
+ .tb-list-item + .tb-list-item {
103
+ margin-top: 0.2em;
104
+ }
105
+
106
+ .tb-list-item::marker {
107
+ color: var(--tb-muted);
108
+ font-variant-numeric: tabular-nums;
109
+ }
110
+
111
+ /* Code block */
112
+ .tb-code-block {
113
+ margin: var(--tb-gap-wide) 0;
114
+ padding: 0.85em 1.1em;
115
+ overflow-x: auto;
116
+ background: var(--tb-subtle);
117
+ border-radius: var(--tb-radius);
118
+ }
119
+
120
+ .tb-code-block-body {
121
+ font-family: var(--tb-font-mono);
122
+ font-size: 0.84em;
123
+ font-weight: 400;
124
+ line-height: 1.6;
125
+ }
126
+
127
+ /* Table: quieter, smaller text and lines than the page around it */
128
+ .tb-table {
129
+ width: 100%;
130
+ margin: var(--tb-gap-wide) 0;
131
+ border-collapse: collapse;
132
+ font-size: 0.9375em;
133
+ line-height: 1.4;
134
+ font-variant-numeric: tabular-nums;
135
+ }
136
+
137
+ .tb-table-cell {
138
+ min-width: 4em;
139
+ padding: 0.5em 0.75em;
140
+ vertical-align: top;
141
+ border: 1px solid var(--tb-border);
142
+ }
143
+
144
+ /* Link */
145
+ .tb-link {
146
+ color: var(--tb-accent);
147
+ text-decoration: underline;
148
+ text-underline-offset: 3px;
149
+ }
150
+
151
+ .tb-link[data-invalid] {
152
+ color: inherit;
153
+ text-decoration-style: wavy;
154
+ text-decoration-color: var(--tb-spelling-error-line);
155
+ }
156
+
157
+ .tb-link-editor {
158
+ display: flex;
159
+ align-items: center;
160
+ gap: 0.25rem;
161
+ }
162
+
163
+ .tb-link-address {
164
+ min-width: 14rem;
165
+ padding: 0.25rem 0.5rem;
166
+ color: inherit;
167
+ background: var(--tb-subtle);
168
+ border: 1px solid var(--tb-border);
169
+ border-radius: calc(var(--tb-radius) - 2px);
170
+ font: inherit;
171
+ }
172
+
173
+ .tb-link-remove,
174
+ .tb-link-open {
175
+ display: grid;
176
+ place-items: center;
177
+ width: 1.75rem;
178
+ height: 1.75rem;
179
+ padding: 0;
180
+ color: inherit;
181
+ background: none;
182
+ border: 0;
183
+ border-radius: calc(var(--tb-radius) - 2px);
184
+ cursor: pointer;
185
+ }
186
+
187
+ .tb-link-remove:hover,
188
+ .tb-link-open:hover {
189
+ background: var(--tb-subtle);
190
+ }
191
+
192
+ /* Figures: image, audio, quote */
193
+ .tb-image,
194
+ .tb-audio,
195
+ .tb-blockquote {
196
+ margin: var(--tb-gap-wide) 0;
197
+ }
198
+
199
+ /* Image and audio: a card with the media on top and labelled fields below */
200
+ .tb-image,
201
+ .tb-audio {
202
+ overflow: hidden;
203
+ background: var(--tb-surface);
204
+ border: 1px solid var(--tb-border);
205
+ border-radius: var(--tb-radius);
206
+ }
207
+
208
+ /* An image narrower than the card sits centred on a quiet band */
209
+ .tb-image-content {
210
+ display: flex;
211
+ justify-content: center;
212
+ background: var(--tb-subtle);
213
+ }
214
+
215
+ .tb-audio-content {
216
+ padding: 0.75rem;
217
+ background: var(--tb-subtle);
218
+ }
219
+
220
+ .tb-image-missing,
221
+ .tb-audio-missing {
222
+ display: grid;
223
+ place-items: center;
224
+ width: 100%;
225
+ min-height: 6rem;
226
+ color: var(--tb-muted);
227
+ background: var(--tb-subtle);
228
+ }
229
+
230
+ /* A labelled text field, e.g. a caption or alternative text */
231
+ .tb-field {
232
+ display: flex;
233
+ gap: 0.75rem;
234
+ align-items: baseline;
235
+ margin: 0;
236
+ padding: 0.55rem 0.875rem;
237
+ border-top: 1px solid var(--tb-border);
238
+ font-family: var(--tb-font-ui);
239
+ font-size: 0.8125em;
240
+ font-weight: 400;
241
+ line-height: 1.45;
242
+ }
243
+
244
+ .tb-field-label {
245
+ flex: 0 0 5.5rem;
246
+ color: var(--tb-muted);
247
+ font-size: 0.6875rem;
248
+ font-weight: 500;
249
+ letter-spacing: 0.06em;
250
+ text-transform: uppercase;
251
+ cursor: text;
252
+ }
253
+
254
+ .tb-field-text {
255
+ flex: 1;
256
+ min-width: 0;
257
+ }
258
+
259
+ /* Quote: a larger italic set off by a fine rule, the source in small sans */
260
+ .tb-blockquote {
261
+ padding-left: 1.1em;
262
+ border-left: 2px solid color-mix(in srgb, var(--tb-muted) 55%, transparent);
263
+ }
264
+
265
+ .tb-blockquote-body {
266
+ font-size: 1.125em;
267
+ font-style: italic;
268
+ line-height: 1.45;
269
+ text-wrap: pretty;
270
+ }
271
+
272
+ .tb-blockquote-citation {
273
+ margin-top: 0.5em;
274
+ color: var(--tb-muted);
275
+ font-family: var(--tb-font-ui);
276
+ font-size: 0.8125em;
277
+ font-weight: 400;
278
+ letter-spacing: 0.01em;
279
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Design tokens for @dotvoid/textbit-styles. Override any of them on :root, or
3
+ * on an element wrapping one editor. Colours follow the page's color-scheme:
4
+ * set `color-scheme: dark` (or `light dark`) and they switch.
5
+ */
6
+ :root {
7
+ /*
8
+ * Serif text and sans serif headings: Petrona and Overused Grotesk from
9
+ * fonts.css, then faces macOS ships (Iowan Old Style, Charter, Avenir Next),
10
+ * then Windows and Linux ones, then the generic family
11
+ */
12
+ --tb-font-text: Petrona, "Iowan Old Style", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
13
+ --tb-font-text-weight: 440;
14
+ --tb-font-heading: "Overused Grotesk", "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
15
+ --tb-font-heading-weight: 700;
16
+ /* Menus, labels and captions */
17
+ --tb-font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
18
+ --tb-font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
19
+ --tb-radius: 6px;
20
+
21
+ /*
22
+ * Type and rhythm. Headings, the lead-in and code are sized in em against
23
+ * the text size, so changing it scales the whole page
24
+ */
25
+ --tb-text-size: 1.0625rem;
26
+ --tb-leading: 1.55;
27
+ /* Between paragraphs, and around quotes, tables, code and media */
28
+ --tb-gap: 0.8em;
29
+ --tb-gap-wide: 1.4em;
30
+
31
+ --tb-text: light-dark(#1f2328, #e6e8eb);
32
+ --tb-muted: light-dark(#59636e, #9da7b3);
33
+ --tb-surface: light-dark(#ffffff, #1b1f24);
34
+ --tb-subtle: light-dark(#f3f4f6, #262b31);
35
+ --tb-border: light-dark(#d1d9e0, #3d444d);
36
+ --tb-accent: light-dark(#0969da, #4493f8);
37
+ --tb-accent-subtle: light-dark(#ddf4ff, #12263f);
38
+ --tb-shadow: 0 4px 16px light-dark(rgb(31 35 40 / 0.14), rgb(0 0 0 / 0.5));
39
+ --tb-focus: 2px solid var(--tb-accent);
40
+
41
+ /* Spelling: errors and suggestions differ in line shape, not only in colour */
42
+ --tb-spelling-error-line: light-dark(#cf222e, #ff8182);
43
+ --tb-spelling-error-tint: light-dark(rgb(207 34 46 / 0.12), rgb(255 129 130 / 0.18));
44
+ --tb-spelling-suggestion-line: light-dark(#0969da, #79c0ff);
45
+ --tb-spelling-suggestion-tint: light-dark(rgb(9 105 218 / 0.1), rgb(121 192 255 / 0.15));
46
+ }
@@ -0,0 +1,93 @@
1
+ Copyright (c) 2023-2026, Bao Nguyen/RandomMaerks (rmforbusiness@gmail.com).
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2019 The Petrona Project Authors (https://github.com/RingoSeeber/Petrona) Petrona-Italic[wght].ttf: Copyright 2019 The Petrona Project Authors (https://github.com/RingoSeeber/Petrona)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@dotvoid/textbit-styles",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "A default look for @dotvoid/textbit and @dotvoid/textbit-plugins, in plain CSS with custom properties.",
6
+ "author": {
7
+ "name": "Danne Lundqvist"
8
+ },
9
+ "type": "module",
10
+ "sideEffects": [
11
+ "**/*.css"
12
+ ],
13
+ "exports": {
14
+ ".": "./css/index.css",
15
+ "./fonts.css": "./css/fonts.css",
16
+ "./variables.css": "./css/variables.css",
17
+ "./editor.css": "./css/editor.css",
18
+ "./plugins.css": "./css/plugins.css"
19
+ },
20
+ "files": [
21
+ "css",
22
+ "fonts"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/dotvoid/textbit.git",
27
+ "directory": "packages/styles"
28
+ },
29
+ "homepage": "https://github.com/dotvoid/textbit/tree/main/packages/styles#readme",
30
+ "bugs": {
31
+ "url": "https://github.com/dotvoid/textbit/issues"
32
+ },
33
+ "scripts": {
34
+ "test": "vitest run",
35
+ "preversion": "vitest run",
36
+ "postversion": "node ../../scripts/commit-version.mjs textbit-styles@ && git push && git push --tags"
37
+ },
38
+ "devDependencies": {
39
+ "postcss": "*",
40
+ "vitest": "^4.0.8"
41
+ }
42
+ }