@marianmeres/stuic 3.190.0 → 3.192.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/AGENTS.md +2 -2
- package/API.md +29 -0
- package/dist/components/CodeBlock/CodeBlock.fixture.svelte +57 -0
- package/dist/components/CodeBlock/CodeBlock.fixture.svelte.d.ts +10 -0
- package/dist/components/CodeBlock/CodeBlock.svelte +441 -0
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +113 -0
- package/dist/components/CodeBlock/README.md +336 -0
- package/dist/components/CodeBlock/_internal/lines.d.ts +13 -0
- package/dist/components/CodeBlock/_internal/lines.js +37 -0
- package/dist/components/CodeBlock/_internal/normalize-code.d.ts +9 -0
- package/dist/components/CodeBlock/_internal/normalize-code.js +39 -0
- package/dist/components/CodeBlock/_internal/paint.d.ts +20 -0
- package/dist/components/CodeBlock/_internal/paint.js +81 -0
- package/dist/components/CodeBlock/highlight/http.d.ts +6 -0
- package/dist/components/CodeBlock/highlight/http.js +62 -0
- package/dist/components/CodeBlock/highlight/index.d.ts +14 -0
- package/dist/components/CodeBlock/highlight/index.js +29 -0
- package/dist/components/CodeBlock/highlight/json.d.ts +9 -0
- package/dist/components/CodeBlock/highlight/json.js +74 -0
- package/dist/components/CodeBlock/highlight/shell.d.ts +8 -0
- package/dist/components/CodeBlock/highlight/shell.js +230 -0
- package/dist/components/CodeBlock/highlight/types.d.ts +17 -0
- package/dist/components/CodeBlock/highlight/types.js +1 -0
- package/dist/components/CodeBlock/i18n-sk.d.ts +17 -0
- package/dist/components/CodeBlock/i18n-sk.js +22 -0
- package/dist/components/CodeBlock/i18n.d.ts +37 -0
- package/dist/components/CodeBlock/i18n.js +34 -0
- package/dist/components/CodeBlock/index.css +470 -0
- package/dist/components/CodeBlock/index.d.ts +4 -0
- package/dist/components/CodeBlock/index.js +4 -0
- package/dist/components/RangeSlider/README.md +22 -22
- package/dist/components/RangeSlider/RangeSlider.svelte +4 -4
- package/dist/components/RangeSlider/RangeSlider.svelte.d.ts +2 -2
- package/dist/components/RangeSlider/index.css +9 -6
- package/dist/components/Slider/README.md +23 -24
- package/dist/components/Slider/Slider.svelte +4 -4
- package/dist/components/Slider/Slider.svelte.d.ts +2 -2
- package/dist/components/Slider/index.css +6 -3
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/docs/domains/components.md +59 -1
- package/package.json +1 -1
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
CODE BLOCK COMPONENT TOKENS
|
|
3
|
+
Override globally: :root { --stuic-code-block-header-bg: transparent; }
|
|
4
|
+
Override locally: <CodeBlock style="--stuic-code-block-max-height: 20rem;">
|
|
5
|
+
The copy button and the collapse toggle ARE Buttons — theme them via
|
|
6
|
+
--stuic-button-* or `copyButtonProps`.
|
|
7
|
+
============================================================================ */
|
|
8
|
+
|
|
9
|
+
:root {
|
|
10
|
+
/* Box — radius and border width are read with a tier fallback at the usage site
|
|
11
|
+
(`--stuic-code-block-radius` → `--stuic-radius-container`,
|
|
12
|
+
`--stuic-code-block-border-width` → `--stuic-border-width`), never declared here. */
|
|
13
|
+
--stuic-code-block-bg: transparent;
|
|
14
|
+
--stuic-code-block-border-color: var(--stuic-color-border);
|
|
15
|
+
|
|
16
|
+
/* The rules under the header and above the footer. The component's own width (like
|
|
17
|
+
ListGroup), so a theme that zeroes box borders keeps them. */
|
|
18
|
+
--stuic-code-block-rule-color: var(--stuic-color-border);
|
|
19
|
+
--stuic-code-block-rule-width: 1px;
|
|
20
|
+
|
|
21
|
+
/* Code. `--stuic-code-block-text` is not declared: it falls back to the inherited
|
|
22
|
+
color at the usage site. */
|
|
23
|
+
--stuic-code-block-padding-x: 1rem;
|
|
24
|
+
--stuic-code-block-padding-y: 1rem;
|
|
25
|
+
--stuic-code-block-font-family: var(--font-mono, ui-monospace, monospace);
|
|
26
|
+
--stuic-code-block-font-size: var(--text-sm);
|
|
27
|
+
--stuic-code-block-line-height: 1.625;
|
|
28
|
+
--stuic-code-block-code-tab-size: 4;
|
|
29
|
+
--stuic-code-block-max-height: none;
|
|
30
|
+
|
|
31
|
+
/* Focus ring of a scrollable <pre> and of the tabs (drawn inset: the box clips) */
|
|
32
|
+
--stuic-code-block-ring-width: 2px;
|
|
33
|
+
--stuic-code-block-ring-color: var(--stuic-color-ring);
|
|
34
|
+
|
|
35
|
+
/* Header. `--stuic-code-block-header-padding-x` is deliberately NOT declared: it is
|
|
36
|
+
read with a `--stuic-code-block-padding-x` fallback at the usage site, so the label
|
|
37
|
+
and the code start at the same x, and a scoped override of the code padding
|
|
38
|
+
reaches the header too. */
|
|
39
|
+
--stuic-code-block-header-bg: var(--stuic-color-surface);
|
|
40
|
+
--stuic-code-block-header-padding-y: 0.25rem;
|
|
41
|
+
--stuic-code-block-header-gap: 0.5rem;
|
|
42
|
+
/* surface-foreground, NOT muted-foreground: the header sits on `surface`, and
|
|
43
|
+
muted-foreground on surface falls below 4.5:1 in 54/54 light and 51/54 dark themes
|
|
44
|
+
(surface-foreground: min 7.3:1 light, 5.7:1 dark). Same for the tabs. */
|
|
45
|
+
--stuic-code-block-title-text: var(--stuic-color-surface-foreground);
|
|
46
|
+
|
|
47
|
+
/* Tabs (`samples`). The active one is marked by an indicator bar and weight, not by
|
|
48
|
+
dimming the others — a dimmed surface-foreground drops below 4.5:1. */
|
|
49
|
+
--stuic-code-block-tab-text: var(--stuic-color-surface-foreground);
|
|
50
|
+
--stuic-code-block-tab-padding-x: 0.75rem;
|
|
51
|
+
--stuic-code-block-tab-bg-hover: color-mix(
|
|
52
|
+
in srgb,
|
|
53
|
+
var(--stuic-color-surface-foreground) 8%,
|
|
54
|
+
transparent
|
|
55
|
+
);
|
|
56
|
+
--stuic-code-block-tab-font-weight-active: var(--font-weight-semibold, 600);
|
|
57
|
+
--stuic-code-block-tab-indicator-color: var(--stuic-color-surface-foreground);
|
|
58
|
+
--stuic-code-block-tab-indicator-width: 2px;
|
|
59
|
+
|
|
60
|
+
/* Lines (`lineNumbers`, `highlightLines`). The number color is 65% foreground over
|
|
61
|
+
the background: >= 4.68:1 in every bundled theme (the plain muted-foreground is
|
|
62
|
+
below 4.5:1 in 12 light ones). */
|
|
63
|
+
--stuic-code-block-line-number-text: color-mix(
|
|
64
|
+
in srgb,
|
|
65
|
+
var(--stuic-color-foreground) 65%,
|
|
66
|
+
var(--stuic-color-background)
|
|
67
|
+
);
|
|
68
|
+
--stuic-code-block-line-number-gap: 1.25rem;
|
|
69
|
+
--stuic-code-block-line-bg-highlighted: color-mix(
|
|
70
|
+
in srgb,
|
|
71
|
+
var(--stuic-color-primary) 12%,
|
|
72
|
+
transparent
|
|
73
|
+
);
|
|
74
|
+
--stuic-code-block-line-marker-color: var(--stuic-color-primary);
|
|
75
|
+
--stuic-code-block-line-marker-width: 3px;
|
|
76
|
+
|
|
77
|
+
/* Collapse (`collapsedLines`): the height of the fade over the cut-off */
|
|
78
|
+
--stuic-code-block-fade-size: 2lh;
|
|
79
|
+
|
|
80
|
+
/* Syntax colors — a GitHub-like palette, tuned so every color keeps >= 4.5:1 on the
|
|
81
|
+
background of every bundled theme, light and dark. `punctuation` is tokenized but
|
|
82
|
+
left in the text color (style `::highlight(stuic-code-block-punctuation)` to
|
|
83
|
+
change that). */
|
|
84
|
+
--stuic-code-block-token-comment-text: #57606a;
|
|
85
|
+
--stuic-code-block-token-meta-text: #57606a;
|
|
86
|
+
--stuic-code-block-token-string-text: #0a3069;
|
|
87
|
+
--stuic-code-block-token-number-text: #0550ae;
|
|
88
|
+
--stuic-code-block-token-literal-text: #0550ae;
|
|
89
|
+
--stuic-code-block-token-parameter-text: #0550ae;
|
|
90
|
+
--stuic-code-block-token-keyword-text: #cf222e;
|
|
91
|
+
--stuic-code-block-token-operator-text: #cf222e;
|
|
92
|
+
--stuic-code-block-token-property-text: #116329;
|
|
93
|
+
--stuic-code-block-token-variable-text: #953800;
|
|
94
|
+
--stuic-code-block-token-function-text: #6639ba;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:root.dark {
|
|
98
|
+
--stuic-code-block-token-comment-text: #8b949e;
|
|
99
|
+
--stuic-code-block-token-meta-text: #8b949e;
|
|
100
|
+
--stuic-code-block-token-string-text: #a5d6ff;
|
|
101
|
+
--stuic-code-block-token-number-text: #79c0ff;
|
|
102
|
+
--stuic-code-block-token-literal-text: #79c0ff;
|
|
103
|
+
--stuic-code-block-token-parameter-text: #79c0ff;
|
|
104
|
+
--stuic-code-block-token-keyword-text: #ff7b72;
|
|
105
|
+
--stuic-code-block-token-operator-text: #ff7b72;
|
|
106
|
+
--stuic-code-block-token-property-text: #7ee787;
|
|
107
|
+
--stuic-code-block-token-variable-text: #ffa657;
|
|
108
|
+
--stuic-code-block-token-function-text: #d2a8ff;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@layer components {
|
|
112
|
+
/* ============================================================================
|
|
113
|
+
BOX
|
|
114
|
+
============================================================================ */
|
|
115
|
+
|
|
116
|
+
.stuic-code-block {
|
|
117
|
+
min-width: 0;
|
|
118
|
+
background: var(--stuic-code-block-bg);
|
|
119
|
+
border: var(--stuic-code-block-border-width, var(--stuic-border-width)) solid
|
|
120
|
+
var(--stuic-code-block-border-color);
|
|
121
|
+
border-radius: var(--stuic-code-block-radius, var(--stuic-radius-container));
|
|
122
|
+
/* The header background must follow the rounded corners. `clip`, not `hidden`: it
|
|
123
|
+
creates no scroll container (`hidden` stays as the fallback for browsers
|
|
124
|
+
without `clip`). The <pre> scrolls on its own. */
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
overflow: clip;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ============================================================================
|
|
130
|
+
HEADER
|
|
131
|
+
============================================================================ */
|
|
132
|
+
|
|
133
|
+
.stuic-code-block-header {
|
|
134
|
+
display: flex;
|
|
135
|
+
/* wraps only where a query below asks for it — every part's basis is 0 or fits */
|
|
136
|
+
flex-wrap: wrap;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: var(--stuic-code-block-header-gap);
|
|
139
|
+
/* the header's actual block padding — the tabs' negative margins follow it */
|
|
140
|
+
--_header-padding-y: var(--stuic-code-block-header-padding-y);
|
|
141
|
+
padding-block: var(--_header-padding-y);
|
|
142
|
+
padding-inline: var(
|
|
143
|
+
--stuic-code-block-header-padding-x,
|
|
144
|
+
var(--stuic-code-block-padding-x)
|
|
145
|
+
);
|
|
146
|
+
min-width: 0;
|
|
147
|
+
background: var(--stuic-code-block-header-bg);
|
|
148
|
+
border-bottom: var(--stuic-code-block-rule-width) solid
|
|
149
|
+
var(--stuic-code-block-rule-color);
|
|
150
|
+
/* its own width, not the page's, decides when a title gets its own row */
|
|
151
|
+
container: stuic-code-block-header / inline-size;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.stuic-code-block-title {
|
|
155
|
+
/* basis 0: a long file name truncates instead of pushing the button down */
|
|
156
|
+
flex: 1 1 0;
|
|
157
|
+
min-width: 0;
|
|
158
|
+
overflow: hidden;
|
|
159
|
+
text-overflow: ellipsis;
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
font-family: var(--stuic-code-block-font-family);
|
|
162
|
+
font-size: var(--stuic-code-block-font-size);
|
|
163
|
+
color: var(--stuic-code-block-title-text);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* stays at the end with or without a label or tabs */
|
|
167
|
+
.stuic-code-block-copy {
|
|
168
|
+
margin-inline-start: auto;
|
|
169
|
+
flex: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* The (borderless) copy button sits flush in the header's end corner: no padding
|
|
173
|
+
around it but on the start side, where the label or the tabs begin. Flush, it is
|
|
174
|
+
a square-cornered cell like a tab, and its focus ring is drawn inset (the box
|
|
175
|
+
clips). */
|
|
176
|
+
.stuic-code-block[data-copy="true"] .stuic-code-block-header {
|
|
177
|
+
--_header-padding-y: 0px;
|
|
178
|
+
padding-inline-end: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.stuic-code-block[data-copy="true"] .stuic-code-block-copy {
|
|
182
|
+
border-radius: 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.stuic-code-block[data-copy="true"] .stuic-code-block-copy:focus-visible {
|
|
186
|
+
outline-offset: calc(-1 * var(--stuic-button-ring-width));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* ============================================================================
|
|
190
|
+
TABS — they reach the header's top and bottom edges, so the active tab's
|
|
191
|
+
indicator sits on the header rule
|
|
192
|
+
============================================================================ */
|
|
193
|
+
|
|
194
|
+
/* with tabs, the title keeps its width and the tabs take the rest */
|
|
195
|
+
.stuic-code-block[data-samples="true"] .stuic-code-block-title {
|
|
196
|
+
flex: 0 1 auto;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.stuic-code-block-tabs {
|
|
200
|
+
display: flex;
|
|
201
|
+
align-self: stretch;
|
|
202
|
+
flex: 1 1 0;
|
|
203
|
+
min-width: 0;
|
|
204
|
+
margin-block: calc(-1 * var(--_header-padding-y));
|
|
205
|
+
/* many tabs in a narrow block scroll sideways rather than wrap */
|
|
206
|
+
overflow-x: auto;
|
|
207
|
+
scrollbar-width: thin;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* the first tab's text starts where a label would */
|
|
211
|
+
.stuic-code-block-tabs:first-child {
|
|
212
|
+
margin-inline-start: calc(-1 * var(--stuic-code-block-tab-padding-x));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* narrow: a title over the tabs gets its own row, so the tabs keep the width */
|
|
216
|
+
@container stuic-code-block-header (max-width: 36rem) {
|
|
217
|
+
.stuic-code-block[data-samples="true"] .stuic-code-block-title {
|
|
218
|
+
flex-basis: 100%;
|
|
219
|
+
padding-block-start: var(--stuic-code-block-header-padding-y);
|
|
220
|
+
}
|
|
221
|
+
.stuic-code-block-title + .stuic-code-block-tabs {
|
|
222
|
+
/* a real basis, so the (negative-margined) tabs can't squeeze onto the title's
|
|
223
|
+
row and push the button down instead */
|
|
224
|
+
flex-basis: 50%;
|
|
225
|
+
margin-block-start: 0;
|
|
226
|
+
margin-inline-start: calc(-1 * var(--stuic-code-block-tab-padding-x));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.stuic-code-block-tab {
|
|
231
|
+
flex: none;
|
|
232
|
+
display: inline-flex;
|
|
233
|
+
align-items: center;
|
|
234
|
+
margin: 0;
|
|
235
|
+
padding-block: var(--stuic-code-block-header-padding-y);
|
|
236
|
+
padding-inline: var(--stuic-code-block-tab-padding-x);
|
|
237
|
+
font-family: var(--stuic-code-block-font-family);
|
|
238
|
+
font-size: var(--stuic-code-block-font-size);
|
|
239
|
+
color: var(--stuic-code-block-tab-text);
|
|
240
|
+
white-space: nowrap;
|
|
241
|
+
background: none;
|
|
242
|
+
border: 0;
|
|
243
|
+
border-radius: 0;
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
-webkit-tap-highlight-color: transparent;
|
|
246
|
+
transition: background-color
|
|
247
|
+
var(--stuic-code-block-transition, var(--stuic-transition));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.stuic-code-block-tab:hover {
|
|
251
|
+
background: var(--stuic-code-block-tab-bg-hover);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.stuic-code-block-tab:focus-visible {
|
|
255
|
+
outline: var(--stuic-code-block-ring-width) solid var(--stuic-code-block-ring-color);
|
|
256
|
+
outline-offset: calc(-1 * var(--stuic-code-block-ring-width));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.stuic-code-block-tab[data-active="true"] {
|
|
260
|
+
font-weight: var(--stuic-code-block-tab-font-weight-active);
|
|
261
|
+
box-shadow: inset 0 calc(-1 * var(--stuic-code-block-tab-indicator-width)) 0
|
|
262
|
+
var(--stuic-code-block-tab-indicator-color);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* ============================================================================
|
|
266
|
+
CODE
|
|
267
|
+
============================================================================ */
|
|
268
|
+
|
|
269
|
+
.stuic-code-block-pre {
|
|
270
|
+
margin: 0;
|
|
271
|
+
padding-block: var(--stuic-code-block-padding-y);
|
|
272
|
+
padding-inline: var(--stuic-code-block-padding-x);
|
|
273
|
+
/* the max height is the box's, padding included — with or without preflight */
|
|
274
|
+
box-sizing: border-box;
|
|
275
|
+
max-height: var(--stuic-code-block-max-height);
|
|
276
|
+
overflow: auto;
|
|
277
|
+
font-family: var(--stuic-code-block-font-family);
|
|
278
|
+
font-size: var(--stuic-code-block-font-size);
|
|
279
|
+
line-height: var(--stuic-code-block-line-height);
|
|
280
|
+
tab-size: var(--stuic-code-block-code-tab-size);
|
|
281
|
+
/* `currentColor` for `color` is the inherited color */
|
|
282
|
+
color: var(--stuic-code-block-text, currentColor);
|
|
283
|
+
white-space: pre;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.stuic-code-block-pre:focus-visible {
|
|
287
|
+
outline: var(--stuic-code-block-ring-width) solid var(--stuic-code-block-ring-color);
|
|
288
|
+
outline-offset: calc(-1 * var(--stuic-code-block-ring-width));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.stuic-code-block[data-wrap="true"] .stuic-code-block-pre {
|
|
292
|
+
white-space: pre-wrap;
|
|
293
|
+
/* `anywhere`, not `break-word`: a long URL or token must not widen the box */
|
|
294
|
+
overflow-wrap: anywhere;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.stuic-code-block-code {
|
|
298
|
+
/* undo UA/preflight code styling — the <pre> carries the typography */
|
|
299
|
+
font: inherit;
|
|
300
|
+
color: inherit;
|
|
301
|
+
background: none;
|
|
302
|
+
padding: 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* ============================================================================
|
|
306
|
+
LINES — one block <span> per line, each keeping its own "\n" (the text,
|
|
307
|
+
the selection and the copy stay the plain sample). The inline padding
|
|
308
|
+
moves from the <pre> to the lines so a highlighted line's background
|
|
309
|
+
reaches both edges; the <code> grows to the longest line so it does so
|
|
310
|
+
while scrolled too.
|
|
311
|
+
============================================================================ */
|
|
312
|
+
|
|
313
|
+
.stuic-code-block[data-lines="true"] .stuic-code-block-pre {
|
|
314
|
+
padding-inline: 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.stuic-code-block[data-lines="true"] .stuic-code-block-code {
|
|
318
|
+
display: block;
|
|
319
|
+
width: max-content;
|
|
320
|
+
min-width: 100%;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.stuic-code-block[data-lines="true"][data-wrap="true"] .stuic-code-block-code {
|
|
324
|
+
width: auto;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.stuic-code-block-line {
|
|
328
|
+
display: block;
|
|
329
|
+
position: relative;
|
|
330
|
+
padding-inline: var(--stuic-code-block-padding-x);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.stuic-code-block[data-line-numbers="true"] .stuic-code-block-line {
|
|
334
|
+
/* a wrapped continuation stays in the code column */
|
|
335
|
+
padding-inline-start: calc(
|
|
336
|
+
var(--stuic-code-block-padding-x) + var(--_digits, 2) * 1ch +
|
|
337
|
+
var(--stuic-code-block-line-number-gap)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.stuic-code-block[data-line-numbers="true"] .stuic-code-block-line::before {
|
|
342
|
+
content: attr(data-line);
|
|
343
|
+
position: absolute;
|
|
344
|
+
inset-inline-start: var(--stuic-code-block-padding-x);
|
|
345
|
+
width: calc(var(--_digits, 2) * 1ch);
|
|
346
|
+
text-align: end;
|
|
347
|
+
font-variant-numeric: tabular-nums;
|
|
348
|
+
color: var(--stuic-code-block-line-number-text);
|
|
349
|
+
/* never selected, never copied */
|
|
350
|
+
user-select: none;
|
|
351
|
+
pointer-events: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.stuic-code-block-line[data-highlighted="true"] {
|
|
355
|
+
background: var(--stuic-code-block-line-bg-highlighted);
|
|
356
|
+
box-shadow: inset var(--stuic-code-block-line-marker-width) 0 0
|
|
357
|
+
var(--stuic-code-block-line-marker-color);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/* ============================================================================
|
|
361
|
+
COLLAPSED (`collapsedLines`) — N lines tall, padding included; the rest
|
|
362
|
+
is hidden behind a fade and the footer toggle
|
|
363
|
+
============================================================================ */
|
|
364
|
+
|
|
365
|
+
.stuic-code-block[data-collapsed="true"] .stuic-code-block-pre {
|
|
366
|
+
max-height: calc(
|
|
367
|
+
var(--_collapsed-lines) * 1lh + 2 * var(--stuic-code-block-padding-y)
|
|
368
|
+
);
|
|
369
|
+
overflow-y: hidden;
|
|
370
|
+
mask-image: linear-gradient(
|
|
371
|
+
to bottom,
|
|
372
|
+
#000 calc(100% - var(--stuic-code-block-fade-size)),
|
|
373
|
+
transparent
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.stuic-code-block-footer {
|
|
378
|
+
display: flex;
|
|
379
|
+
border-top: var(--stuic-code-block-rule-width) solid
|
|
380
|
+
var(--stuic-code-block-rule-color);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.stuic-code-block .stuic-code-block-toggle {
|
|
384
|
+
flex: 1 1 auto;
|
|
385
|
+
border-radius: 0;
|
|
386
|
+
font-size: var(--stuic-code-block-font-size);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.stuic-code-block-toggle-icon {
|
|
390
|
+
display: inline-flex;
|
|
391
|
+
transition: transform var(--stuic-code-block-transition, var(--stuic-transition));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.stuic-code-block-toggle-icon svg {
|
|
395
|
+
width: 1.25em;
|
|
396
|
+
height: 1.25em;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.stuic-code-block-toggle[aria-expanded="true"] .stuic-code-block-toggle-icon {
|
|
400
|
+
transform: rotate(180deg);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@media (prefers-reduced-motion: reduce) {
|
|
404
|
+
.stuic-code-block-toggle-icon {
|
|
405
|
+
transition: none;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* ============================================================================
|
|
410
|
+
SYNTAX COLORS — the CSS Custom Highlight API. The descendant form is
|
|
411
|
+
needed: Firefox styles a highlight by the element that holds the text,
|
|
412
|
+
which is a line <span> in the lined layout.
|
|
413
|
+
============================================================================ */
|
|
414
|
+
|
|
415
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
416
|
+
stuic-code-block-comment
|
|
417
|
+
) {
|
|
418
|
+
color: var(--stuic-code-block-token-comment-text);
|
|
419
|
+
}
|
|
420
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
421
|
+
stuic-code-block-meta
|
|
422
|
+
) {
|
|
423
|
+
color: var(--stuic-code-block-token-meta-text);
|
|
424
|
+
}
|
|
425
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
426
|
+
stuic-code-block-string
|
|
427
|
+
) {
|
|
428
|
+
color: var(--stuic-code-block-token-string-text);
|
|
429
|
+
}
|
|
430
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
431
|
+
stuic-code-block-number
|
|
432
|
+
) {
|
|
433
|
+
color: var(--stuic-code-block-token-number-text);
|
|
434
|
+
}
|
|
435
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
436
|
+
stuic-code-block-literal
|
|
437
|
+
) {
|
|
438
|
+
color: var(--stuic-code-block-token-literal-text);
|
|
439
|
+
}
|
|
440
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
441
|
+
stuic-code-block-parameter
|
|
442
|
+
) {
|
|
443
|
+
color: var(--stuic-code-block-token-parameter-text);
|
|
444
|
+
}
|
|
445
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
446
|
+
stuic-code-block-keyword
|
|
447
|
+
) {
|
|
448
|
+
color: var(--stuic-code-block-token-keyword-text);
|
|
449
|
+
}
|
|
450
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
451
|
+
stuic-code-block-operator
|
|
452
|
+
) {
|
|
453
|
+
color: var(--stuic-code-block-token-operator-text);
|
|
454
|
+
}
|
|
455
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
456
|
+
stuic-code-block-property
|
|
457
|
+
) {
|
|
458
|
+
color: var(--stuic-code-block-token-property-text);
|
|
459
|
+
}
|
|
460
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
461
|
+
stuic-code-block-variable
|
|
462
|
+
) {
|
|
463
|
+
color: var(--stuic-code-block-token-variable-text);
|
|
464
|
+
}
|
|
465
|
+
:is(.stuic-code-block-code, .stuic-code-block-code *)::highlight(
|
|
466
|
+
stuic-code-block-function
|
|
467
|
+
) {
|
|
468
|
+
color: var(--stuic-code-block-token-function-text);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as CodeBlock, type Props as CodeBlockProps, type CodeBlockSample, } from "./CodeBlock.svelte";
|
|
2
|
+
export { highlightCode, highlightJson, highlightHttp, highlightShell, HIGHLIGHT_CODE_LANGS, type CodeBlockHighlighter, type CodeBlockToken, type CodeBlockTokenType, } from "./highlight/index.js";
|
|
3
|
+
export { createCodeBlockT, CODE_BLOCK_MESSAGES_EN, type CodeBlockMessageKey, type CodeBlockMessages, } from "./i18n.js";
|
|
4
|
+
export { CODE_BLOCK_MESSAGES_SK } from "./i18n-sk.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as CodeBlock, } from "./CodeBlock.svelte";
|
|
2
|
+
export { highlightCode, highlightJson, highlightHttp, highlightShell, HIGHLIGHT_CODE_LANGS, } from "./highlight/index.js";
|
|
3
|
+
export { createCodeBlockT, CODE_BLOCK_MESSAGES_EN, } from "./i18n.js";
|
|
4
|
+
export { CODE_BLOCK_MESSAGES_SK } from "./i18n-sk.js";
|
|
@@ -25,7 +25,7 @@ shape `FieldDateRange` uses.
|
|
|
25
25
|
| `size` | `"sm" \| "md" \| "lg" \| string` | `"md"` | Cross-axis thickness preset |
|
|
26
26
|
| `intent` | `"primary" \| "accent" \| "success" \| "warning" \| "destructive"` | - | Semantic fill color |
|
|
27
27
|
| `thumb` | `boolean \| Snippet<[RangeSliderRenderCtx]>` | `true` | `false` hides both thumbs (fill-only look), a snippet renders inside each thumb (its context says which one) |
|
|
28
|
-
| `fillRounded` | `boolean` | `
|
|
28
|
+
| `fillRounded` | `boolean` | `true` | Round the fill's edges ("pill inside a pill"); `false` cuts them flat |
|
|
29
29
|
| `ticks` | `boolean \| number[]` | - | `true` = tick at every `step` (positive numeric step only; skipped above 101 auto ticks — pass an array), array = ticks at given in-range values |
|
|
30
30
|
| `valueLabel` | `Snippet<[RangeSliderRenderCtx]>` | - | Floating label per thumb, at its value along the track |
|
|
31
31
|
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
@@ -263,29 +263,29 @@ when `thumb={false}`).
|
|
|
263
263
|
|
|
264
264
|
## CSS Variables
|
|
265
265
|
|
|
266
|
-
| Variable | Default | Description
|
|
267
|
-
| --------------------------------------- | ----------------------------- |
|
|
268
|
-
| `--stuic-range-slider-track` | `--stuic-color-muted` | Track (pill background) color
|
|
269
|
-
| `--stuic-range-slider-fill` | `--stuic-color-primary` | Fill (selected range) color
|
|
270
|
-
| `--stuic-range-slider-thumb` | `--color-white` | Thumb background
|
|
271
|
-
| `--stuic-range-slider-thumb-foreground` | `--stuic-color-foreground` | Thumb content color
|
|
272
|
-
| `--stuic-range-slider-tick` | foreground 25% mix | Tick mark color (over the track)
|
|
273
|
-
| `--stuic-range-slider-tick-on-fill` | background 55% mix | Tick mark color (over the fill)
|
|
274
|
-
| `--stuic-range-slider-ring-width` | `4px` | Focus ring width
|
|
275
|
-
| `--stuic-range-slider-ring-color` | `--stuic-color-ring` | Focus ring color
|
|
276
|
-
| `--stuic-range-slider-thickness` | `2rem` (`sm` 1.25, `lg` 3) | Cross-axis size
|
|
277
|
-
| `--stuic-range-slider-length` | `10rem` | Main-axis size
|
|
278
|
-
| `--stuic-range-slider-thumb-inset` | `3px` | Gap between thumb and track edge
|
|
279
|
-
| `--stuic-range-slider-radius` | `9999px` | Track corner radius
|
|
280
|
-
| `--stuic-range-slider-fill-radius` | `--stuic-range-slider-radius` | Fill radius (
|
|
281
|
-
| `--stuic-range-slider-thumb-radius` | `9999px` | Thumb corner radius
|
|
282
|
-
| `--stuic-range-slider-thumb-shadow` | `--stuic-shadow` | Thumb shadow
|
|
283
|
-
| `--stuic-range-slider-tick-size` | `4px` | Tick mark diameter
|
|
284
|
-
| `--stuic-range-slider-value-gap` | `0.375rem` | Gap between track and value labels
|
|
285
|
-
| `--stuic-range-slider-transition` | `--stuic-transition` | Fill/thumb movement transition
|
|
266
|
+
| Variable | Default | Description |
|
|
267
|
+
| --------------------------------------- | ----------------------------- | ------------------------------------------ |
|
|
268
|
+
| `--stuic-range-slider-track` | `--stuic-color-muted` | Track (pill background) color |
|
|
269
|
+
| `--stuic-range-slider-fill` | `--stuic-color-primary` | Fill (selected range) color |
|
|
270
|
+
| `--stuic-range-slider-thumb` | `--color-white` | Thumb background |
|
|
271
|
+
| `--stuic-range-slider-thumb-foreground` | `--stuic-color-foreground` | Thumb content color |
|
|
272
|
+
| `--stuic-range-slider-tick` | foreground 25% mix | Tick mark color (over the track) |
|
|
273
|
+
| `--stuic-range-slider-tick-on-fill` | background 55% mix | Tick mark color (over the fill) |
|
|
274
|
+
| `--stuic-range-slider-ring-width` | `4px` | Focus ring width |
|
|
275
|
+
| `--stuic-range-slider-ring-color` | `--stuic-color-ring` | Focus ring color |
|
|
276
|
+
| `--stuic-range-slider-thickness` | `2rem` (`sm` 1.25, `lg` 3) | Cross-axis size |
|
|
277
|
+
| `--stuic-range-slider-length` | `10rem` | Main-axis size |
|
|
278
|
+
| `--stuic-range-slider-thumb-inset` | `3px` | Gap between thumb and track edge |
|
|
279
|
+
| `--stuic-range-slider-radius` | `9999px` | Track corner radius |
|
|
280
|
+
| `--stuic-range-slider-fill-radius` | `--stuic-range-slider-radius` | Fill radius (unless `fillRounded={false}`) |
|
|
281
|
+
| `--stuic-range-slider-thumb-radius` | `9999px` | Thumb corner radius |
|
|
282
|
+
| `--stuic-range-slider-thumb-shadow` | `--stuic-shadow` | Thumb shadow |
|
|
283
|
+
| `--stuic-range-slider-tick-size` | `4px` | Tick mark diameter |
|
|
284
|
+
| `--stuic-range-slider-value-gap` | `0.375rem` | Gap between track and value labels |
|
|
285
|
+
| `--stuic-range-slider-transition` | `--stuic-transition` | Fill/thumb movement transition |
|
|
286
286
|
|
|
287
287
|
Data attributes on the root, for custom CSS: `data-orientation`, `data-thumbs`
|
|
288
|
-
(`"true"` / `"false"`), `data-fill-rounded
|
|
288
|
+
(`"true"` / `"false"`), `data-fill-rounded` (`"true"` / `"false"`), `data-size`, `data-intent`,
|
|
289
289
|
`data-disabled`, `data-dragging` / `data-ring` / `data-active-thumb` (each naming a
|
|
290
290
|
thumb: `"start"` / `"end"`). Thumbs, value labels and the hidden inputs carry
|
|
291
291
|
`data-thumb="start|end"`; tick layers `data-layer="before|on-fill|after"`.
|
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
*/
|
|
121
121
|
thumb?: boolean | Snippet<[RangeSliderRenderCtx]>;
|
|
122
122
|
/**
|
|
123
|
-
* Round the fill's edges
|
|
124
|
-
*
|
|
123
|
+
* Round the fill's edges, giving the "pill inside a pill" look (the
|
|
124
|
+
* default). `false` cuts them flat.
|
|
125
125
|
*/
|
|
126
126
|
fillRounded?: boolean;
|
|
127
127
|
/**
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
tickClass,
|
|
184
184
|
valueClass,
|
|
185
185
|
thumb = true,
|
|
186
|
-
fillRounded =
|
|
186
|
+
fillRounded = true,
|
|
187
187
|
ticks,
|
|
188
188
|
valueLabel,
|
|
189
189
|
el = $bindable(),
|
|
@@ -670,7 +670,7 @@
|
|
|
670
670
|
data-stuic-range-slider=""
|
|
671
671
|
data-orientation={orientation}
|
|
672
672
|
data-thumbs={_thumbReserved ? "true" : "false"}
|
|
673
|
-
data-fill-rounded={fillRounded ? "true" :
|
|
673
|
+
data-fill-rounded={fillRounded ? "true" : "false"}
|
|
674
674
|
data-size={!unstyled ? size : undefined}
|
|
675
675
|
data-intent={!unstyled ? intent : undefined}
|
|
676
676
|
data-disabled={disabled ? "true" : undefined}
|
|
@@ -87,8 +87,8 @@ export interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "children" |
|
|
|
87
87
|
*/
|
|
88
88
|
thumb?: boolean | Snippet<[RangeSliderRenderCtx]>;
|
|
89
89
|
/**
|
|
90
|
-
* Round the fill's edges
|
|
91
|
-
*
|
|
90
|
+
* Round the fill's edges, giving the "pill inside a pill" look (the
|
|
91
|
+
* default). `false` cuts them flat.
|
|
92
92
|
*/
|
|
93
93
|
fillRounded?: boolean;
|
|
94
94
|
/**
|
|
@@ -174,6 +174,12 @@
|
|
|
174
174
|
.stuic-range-slider .fill {
|
|
175
175
|
position: absolute;
|
|
176
176
|
background: var(--_fill);
|
|
177
|
+
/* Rounded edges ("pill inside a pill") are the default;
|
|
178
|
+
`fillRounded={false}` cuts them flat below. */
|
|
179
|
+
border-radius: var(
|
|
180
|
+
--stuic-range-slider-fill-radius,
|
|
181
|
+
var(--stuic-range-slider-radius, 9999px)
|
|
182
|
+
);
|
|
177
183
|
}
|
|
178
184
|
/* With thumbs, the fill spans the thumb-center travel between the two values
|
|
179
185
|
plus one thumb: it reaches the outer edge of both thumbs and, when they
|
|
@@ -198,12 +204,9 @@
|
|
|
198
204
|
height: var(--_fill-len);
|
|
199
205
|
}
|
|
200
206
|
|
|
201
|
-
/*
|
|
202
|
-
.stuic-range-slider[data-fill-rounded="
|
|
203
|
-
border-radius:
|
|
204
|
-
--stuic-range-slider-fill-radius,
|
|
205
|
-
var(--stuic-range-slider-radius, 9999px)
|
|
206
|
-
);
|
|
207
|
+
/* Flat edges (opt out of the default pill) */
|
|
208
|
+
.stuic-range-slider[data-fill-rounded="false"] .fill {
|
|
209
|
+
border-radius: 0;
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
/* ============================================================================
|