@streamscloud/kit 0.92.0 → 0.93.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.
|
@@ -8,29 +8,30 @@ export {};
|
|
|
8
8
|
|
|
9
9
|
<!--
|
|
10
10
|
@component
|
|
11
|
-
A scoped style wrapper for arbitrary HTML —
|
|
12
|
-
|
|
13
|
-
markdown renderer, server-rendered email body).
|
|
14
|
-
|
|
11
|
+
A scoped style wrapper for arbitrary HTML — gives reading typography, vertical rhythm, list markers, tables,
|
|
12
|
+
blockquotes, inline code, code blocks and `hr` to the markup of an external HTML source (rich-text editor,
|
|
13
|
+
markdown renderer, server-rendered email body). All spacing scales with the base font size; a wide table is
|
|
14
|
+
not scrolled horizontally.
|
|
15
15
|
|
|
16
16
|
### CSS Custom Properties
|
|
17
17
|
| Property | Description | Default |
|
|
18
18
|
|---|---|---|
|
|
19
|
+
| `--sc-kit--html-block--font-size` | Base font size | `0.875em` |
|
|
19
20
|
| `--sc-kit--html-block--text-color` | Body text color | `--sc-kit--color--text--primary` |
|
|
20
21
|
| `--sc-kit--html-block--link-color` | Anchor color | `--sc-kit--color--accent` |
|
|
21
|
-
| `--sc-kit--html-block--code-font` | Monospace font for `pre` | `--sc-kit--font--mono` |
|
|
22
|
+
| `--sc-kit--html-block--code-font` | Monospace font for `pre` and `code` | `--sc-kit--font--mono` |
|
|
22
23
|
-->
|
|
23
24
|
|
|
24
25
|
<style>.html-block {
|
|
25
26
|
--_html-block--text: var(--sc-kit--html-block--text-color, var(--sc-kit--color--text--primary));
|
|
26
27
|
--_html-block--link: var(--sc-kit--html-block--link-color, var(--sc-kit--color--accent));
|
|
27
28
|
--_html-block--code-font: var(--sc-kit--html-block--code-font, var(--sc-kit--font--mono));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
font-size:
|
|
31
|
-
line-height: var(--sc-kit--leading--
|
|
32
|
-
font-weight: normal;
|
|
29
|
+
--_html-block--font-size: var(--sc-kit--html-block--font-size, 0.875em);
|
|
30
|
+
display: block;
|
|
31
|
+
font-size: var(--_html-block--font-size);
|
|
32
|
+
line-height: var(--sc-kit--leading--relaxed);
|
|
33
33
|
color: var(--_html-block--text);
|
|
34
|
+
overflow-wrap: anywhere;
|
|
34
35
|
}
|
|
35
36
|
.html-block :global(p),
|
|
36
37
|
.html-block :global(h1),
|
|
@@ -41,99 +42,143 @@ unaffected.
|
|
|
41
42
|
.html-block :global(h6) {
|
|
42
43
|
overflow-wrap: inherit;
|
|
43
44
|
}
|
|
45
|
+
.html-block :global(p),
|
|
46
|
+
.html-block :global(ul),
|
|
47
|
+
.html-block :global(ol),
|
|
48
|
+
.html-block :global(table),
|
|
49
|
+
.html-block :global(blockquote),
|
|
50
|
+
.html-block :global(pre),
|
|
51
|
+
.html-block :global(hr) {
|
|
52
|
+
margin: 0 0 1em;
|
|
53
|
+
}
|
|
54
|
+
.html-block :global(h1),
|
|
55
|
+
.html-block :global(h2),
|
|
56
|
+
.html-block :global(h3),
|
|
57
|
+
.html-block :global(h4),
|
|
58
|
+
.html-block :global(h5),
|
|
59
|
+
.html-block :global(h6) {
|
|
60
|
+
margin: 1.5em 0 0.5em;
|
|
61
|
+
font-size: 1em;
|
|
62
|
+
font-weight: var(--sc-kit--font-weight--semibold);
|
|
63
|
+
line-height: var(--sc-kit--leading--tight);
|
|
64
|
+
color: var(--_html-block--text);
|
|
65
|
+
}
|
|
44
66
|
.html-block :global(h1) {
|
|
67
|
+
margin: 1em 0 0.3333333333em;
|
|
45
68
|
font-size: 1.5em;
|
|
46
|
-
line-height: var(--sc-kit--leading--normal);
|
|
47
|
-
font-weight: 600;
|
|
48
|
-
color: var(--_html-block--text);
|
|
49
69
|
}
|
|
50
70
|
.html-block :global(h2) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
font-weight: 600;
|
|
54
|
-
color: var(--_html-block--text);
|
|
71
|
+
margin: 1.2em 0 0.4em;
|
|
72
|
+
font-size: 1.25em;
|
|
55
73
|
}
|
|
56
74
|
.html-block :global(h3) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
font-weight: 600;
|
|
60
|
-
color: var(--_html-block--text);
|
|
75
|
+
margin: 1.3333333333em 0 0.4444444444em;
|
|
76
|
+
font-size: 1.125em;
|
|
61
77
|
}
|
|
62
78
|
.html-block :global(h4) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
font-weight: 500;
|
|
66
|
-
color: var(--_html-block--text);
|
|
79
|
+
margin: 1.5em 0 0.5em;
|
|
80
|
+
font-size: 1em;
|
|
67
81
|
}
|
|
68
82
|
.html-block :global(h5) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
font-weight: 500;
|
|
72
|
-
color: var(--_html-block--text);
|
|
83
|
+
margin: 1.7142857143em 0 0.5714285714em;
|
|
84
|
+
font-size: 0.875em;
|
|
73
85
|
}
|
|
74
86
|
.html-block :global(h6) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
margin: 1.7142857143em 0 0.5714285714em;
|
|
88
|
+
font-size: 0.875em;
|
|
89
|
+
}
|
|
90
|
+
.html-block :global(h6) {
|
|
91
|
+
color: var(--sc-kit--color--text--secondary);
|
|
92
|
+
}
|
|
93
|
+
.html-block > :global(:first-child) {
|
|
94
|
+
margin-top: 0;
|
|
95
|
+
}
|
|
96
|
+
.html-block > :global(:last-child),
|
|
97
|
+
.html-block :global(li > :last-child),
|
|
98
|
+
.html-block :global(blockquote > :last-child) {
|
|
99
|
+
margin-bottom: 0;
|
|
79
100
|
}
|
|
80
101
|
.html-block :global(a) {
|
|
81
|
-
font-size: 1em;
|
|
82
|
-
line-height: var(--sc-kit--leading--normal);
|
|
83
|
-
font-weight: normal;
|
|
84
|
-
color: var(--_html-block--text);
|
|
85
102
|
color: var(--_html-block--link);
|
|
86
103
|
}
|
|
87
|
-
.html-block :global(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
margin: 1em 0;
|
|
91
|
-
font-size: 1em;
|
|
92
|
-
line-height: var(--sc-kit--leading--tight);
|
|
93
|
-
font-weight: normal;
|
|
94
|
-
color: var(--_html-block--text);
|
|
104
|
+
.html-block :global(ul),
|
|
105
|
+
.html-block :global(ol) {
|
|
106
|
+
padding-left: 1.5em;
|
|
95
107
|
}
|
|
96
|
-
.html-block :global(ul)
|
|
97
|
-
|
|
98
|
-
list-style: inherit;
|
|
99
|
-
margin-left: 1em;
|
|
100
|
-
position: relative;
|
|
101
|
-
font-size: 1em;
|
|
102
|
-
line-height: var(--sc-kit--leading--normal);
|
|
103
|
-
font-weight: normal;
|
|
104
|
-
color: var(--_html-block--text);
|
|
108
|
+
.html-block :global(ul) {
|
|
109
|
+
list-style-type: disc;
|
|
105
110
|
}
|
|
106
111
|
.html-block :global(ol) {
|
|
107
112
|
list-style-type: decimal;
|
|
108
113
|
}
|
|
109
|
-
.html-block :global(
|
|
114
|
+
.html-block :global(li) {
|
|
115
|
+
list-style: inherit;
|
|
116
|
+
}
|
|
117
|
+
.html-block :global(li + li) {
|
|
118
|
+
margin-top: 0.25em;
|
|
119
|
+
}
|
|
120
|
+
.html-block :global(li > ul),
|
|
121
|
+
.html-block :global(li > ol) {
|
|
122
|
+
margin-top: 0.125em;
|
|
123
|
+
}
|
|
124
|
+
.html-block :global(ul ul) {
|
|
125
|
+
list-style-type: circle;
|
|
126
|
+
}
|
|
127
|
+
.html-block :global(ol ol) {
|
|
110
128
|
list-style-type: lower-alpha;
|
|
111
129
|
}
|
|
112
130
|
.html-block :global(table) {
|
|
113
131
|
max-width: 100%;
|
|
132
|
+
border-collapse: collapse;
|
|
114
133
|
}
|
|
115
|
-
.html-block :global(table),
|
|
116
|
-
.html-block :global(tbody),
|
|
117
|
-
.html-block :global(thead),
|
|
118
|
-
.html-block :global(tr),
|
|
119
134
|
.html-block :global(th),
|
|
120
135
|
.html-block :global(td) {
|
|
121
|
-
border
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
border: 1px solid var(--sc-kit--color--border);
|
|
137
|
+
padding: 0.5em 0.75em;
|
|
138
|
+
line-height: var(--sc-kit--leading--normal);
|
|
139
|
+
text-align: start;
|
|
140
|
+
vertical-align: top;
|
|
141
|
+
}
|
|
142
|
+
.html-block :global(th) {
|
|
143
|
+
padding: 0.4285714286em 0.8571428571em;
|
|
144
|
+
background: var(--sc-kit--color--bg--field-alt);
|
|
145
|
+
color: var(--sc-kit--color--text--secondary);
|
|
146
|
+
font-size: 0.875em;
|
|
147
|
+
font-weight: var(--sc-kit--font-weight--semibold);
|
|
148
|
+
vertical-align: middle;
|
|
149
|
+
}
|
|
150
|
+
.html-block :global(blockquote) {
|
|
151
|
+
border-left: 3px solid var(--sc-kit--color--border--strong);
|
|
152
|
+
padding-left: 1em;
|
|
153
|
+
color: var(--sc-kit--color--text--secondary);
|
|
154
|
+
}
|
|
155
|
+
.html-block :global(code) {
|
|
156
|
+
font-family: var(--_html-block--code-font);
|
|
157
|
+
font-size: 0.875em;
|
|
158
|
+
background: var(--sc-kit--color--bg--element);
|
|
159
|
+
padding: 0.125em 0.375em;
|
|
160
|
+
border-radius: var(--sc-kit--radius--sm);
|
|
161
|
+
}
|
|
162
|
+
.html-block :global(pre) {
|
|
163
|
+
font-family: var(--_html-block--code-font);
|
|
164
|
+
font-size: 0.875em;
|
|
165
|
+
line-height: var(--sc-kit--leading--normal);
|
|
166
|
+
background: var(--sc-kit--color--bg--element);
|
|
167
|
+
padding: 0.8571428571em 1.1428571429em;
|
|
168
|
+
border-radius: var(--sc-kit--radius--md);
|
|
169
|
+
overflow-x: auto;
|
|
170
|
+
white-space: pre;
|
|
171
|
+
overflow-wrap: normal;
|
|
172
|
+
}
|
|
173
|
+
.html-block :global(pre) :global(code) {
|
|
174
|
+
font-size: inherit;
|
|
175
|
+
background: none;
|
|
176
|
+
padding: 0;
|
|
177
|
+
border-radius: 0;
|
|
178
|
+
}
|
|
179
|
+
.html-block :global(hr) {
|
|
180
|
+
border: none;
|
|
181
|
+
border-top: 1px solid var(--sc-kit--color--border);
|
|
182
|
+
margin-top: 1.5em;
|
|
183
|
+
margin-bottom: 1.5em;
|
|
139
184
|
}</style>
|
|
@@ -3,17 +3,18 @@ type Props = {
|
|
|
3
3
|
children: Snippet;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
-
* A scoped style wrapper for arbitrary HTML —
|
|
7
|
-
*
|
|
8
|
-
* markdown renderer, server-rendered email body).
|
|
9
|
-
*
|
|
6
|
+
* A scoped style wrapper for arbitrary HTML — gives reading typography, vertical rhythm, list markers, tables,
|
|
7
|
+
* blockquotes, inline code, code blocks and `hr` to the markup of an external HTML source (rich-text editor,
|
|
8
|
+
* markdown renderer, server-rendered email body). All spacing scales with the base font size; a wide table is
|
|
9
|
+
* not scrolled horizontally.
|
|
10
10
|
*
|
|
11
11
|
* ### CSS Custom Properties
|
|
12
12
|
* | Property | Description | Default |
|
|
13
13
|
* |---|---|---|
|
|
14
|
+
* | `--sc-kit--html-block--font-size` | Base font size | `0.875em` |
|
|
14
15
|
* | `--sc-kit--html-block--text-color` | Body text color | `--sc-kit--color--text--primary` |
|
|
15
16
|
* | `--sc-kit--html-block--link-color` | Anchor color | `--sc-kit--color--accent` |
|
|
16
|
-
* | `--sc-kit--html-block--code-font` | Monospace font for `pre` | `--sc-kit--font--mono` |
|
|
17
|
+
* | `--sc-kit--html-block--code-font` | Monospace font for `pre` and `code` | `--sc-kit--font--mono` |
|
|
17
18
|
*/
|
|
18
19
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
19
20
|
type Cmp = ReturnType<typeof Cmp>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import { showInTopLayer } from '../_internal/top-layer';
|
|
2
2
|
import { arrow as arrowMiddleware, autoUpdate, computePosition, flip, hide as hideMiddleware, offset, shift } from '@floating-ui/dom';
|
|
3
3
|
import { tick } from 'svelte';
|
|
4
|
-
const { text, placement = 'top', delay = 250, fillHeight = false, children } = $props();
|
|
4
|
+
const { text, placement = 'top', delay = 250, fillHeight = false, shrink = false, children } = $props();
|
|
5
5
|
let triggerEl = $state.raw(undefined);
|
|
6
6
|
let bubbleEl = $state.raw(undefined);
|
|
7
7
|
let arrowEl = $state.raw(undefined);
|
|
@@ -71,6 +71,7 @@ $effect(() => () => {
|
|
|
71
71
|
bind:this={triggerEl}
|
|
72
72
|
class="tooltip"
|
|
73
73
|
class:tooltip--fill-height={fillHeight}
|
|
74
|
+
class:tooltip--shrink={shrink}
|
|
74
75
|
onmouseenter={show}
|
|
75
76
|
onmouseleave={hide}
|
|
76
77
|
onfocusin={show}
|
|
@@ -116,6 +117,10 @@ or plain text. Bubble flips and shifts on viewport collision; an arrow points to
|
|
|
116
117
|
.tooltip--fill-height {
|
|
117
118
|
block-size: 100%;
|
|
118
119
|
}
|
|
120
|
+
.tooltip--shrink {
|
|
121
|
+
min-inline-size: 0;
|
|
122
|
+
max-inline-size: 100%;
|
|
123
|
+
}
|
|
119
124
|
.tooltip__description {
|
|
120
125
|
position: absolute;
|
|
121
126
|
width: 1px;
|
|
@@ -9,6 +9,8 @@ type Props = {
|
|
|
9
9
|
delay?: number;
|
|
10
10
|
/** Stretch the trigger to the parent's full height (content stays vertically centered). @default false */
|
|
11
11
|
fillHeight?: boolean;
|
|
12
|
+
/** Let the trigger shrink below its content width to fit its container, so an ellipsized child can truncate. */
|
|
13
|
+
shrink?: boolean;
|
|
12
14
|
/**
|
|
13
15
|
* Wrapped element — anything passed becomes the tooltip trigger (icon, button, link, plain text). Receives
|
|
14
16
|
* `aria-describedby` pointing at the tooltip text: spread it onto an interactive trigger so screen readers announce the text.
|