svelte-ant-design 0.8.0 → 0.9.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/README.md CHANGED
@@ -18,7 +18,7 @@ Ant Design.
18
18
 
19
19
  ## Status
20
20
 
21
- Version `0.8.0`. Available components: `Button`, `Checkbox` (with `CheckboxGroup`), `Grid` (`Row`, `Col` and `Breakpoints`), `Input` (with `InputTextArea`, `InputPassword`, `InputSearch` and `InputOTP`), `Radio` (with `RadioButton` and `RadioGroup`), `Select` (with `SelectOption` and `SelectOptGroup`), `Switch`, `Tooltip`. More components are planned.
21
+ Version `0.9.0`. Available components: `Button`, `Checkbox` (with `CheckboxGroup`), `Grid` (`Row`, `Col` and `Breakpoints`), `Input` (with `InputTextArea`, `InputPassword`, `InputSearch` and `InputOTP`), `Radio` (with `RadioButton` and `RadioGroup`), `Select` (with `SelectOption` and `SelectOptGroup`), `Switch`, `Tooltip`, `Message` (the `message` calls and `MessageHost`). More components are planned.
22
22
 
23
23
  ## Browser support
24
24
 
@@ -63,16 +63,18 @@ See the [Button](https://prostreyd.github.io/ant-design-svelte/components/button
63
63
  [Input](https://prostreyd.github.io/ant-design-svelte/components/input/),
64
64
  [Radio](https://prostreyd.github.io/ant-design-svelte/components/radio/),
65
65
  [Select](https://prostreyd.github.io/ant-design-svelte/components/select/),
66
- [Switch](https://prostreyd.github.io/ant-design-svelte/components/switch/) and
67
- [Tooltip](https://prostreyd.github.io/ant-design-svelte/components/tooltip/) pages of the documentation site for
66
+ [Switch](https://prostreyd.github.io/ant-design-svelte/components/switch/),
67
+ [Tooltip](https://prostreyd.github.io/ant-design-svelte/components/tooltip/) and
68
+ [Message](https://prostreyd.github.io/ant-design-svelte/components/message/) pages of the documentation site for
68
69
  examples and the API tables, or [`src/lib/Button/README.md`](./src/lib/Button/README.md),
69
70
  [`src/lib/Checkbox/README.md`](./src/lib/Checkbox/README.md),
70
71
  [`src/lib/Grid/README.md`](./src/lib/Grid/README.md),
71
72
  [`src/lib/Input/README.md`](./src/lib/Input/README.md),
72
73
  [`src/lib/Radio/README.md`](./src/lib/Radio/README.md),
73
74
  [`src/lib/Select/README.md`](./src/lib/Select/README.md),
74
- [`src/lib/Switch/README.md`](./src/lib/Switch/README.md) and
75
- [`src/lib/Tooltip/README.md`](./src/lib/Tooltip/README.md) in the repository.
75
+ [`src/lib/Switch/README.md`](./src/lib/Switch/README.md),
76
+ [`src/lib/Tooltip/README.md`](./src/lib/Tooltip/README.md) and
77
+ [`src/lib/Message/README.md`](./src/lib/Message/README.md) in the repository.
76
78
 
77
79
  ### Colors and contrast
78
80
 
@@ -86,7 +88,7 @@ import 'svelte-ant-design/tokens.css';
86
88
  import 'svelte-ant-design/tokens-accessible.css';
87
89
  ```
88
90
 
89
- It darkens the fills, the link and text colors, the switch tracks, the checkbox border and the input border, placeholder and count; every text pair is then at least 4.5:1.
91
+ It darkens the fills, the link and text colors, the switch tracks, the checkbox border and the input border, placeholder and count, and the green and amber icons of the `Message`; every text pair is then at least 4.5:1.
90
92
  The dark theme needs no extra file. The contrast tests run with the accessible file.
91
93
 
92
94
  ### Dark theme
@@ -0,0 +1,70 @@
1
+ <script lang="ts">
2
+ import { untrack } from 'svelte';
3
+ import { isProduction } from '../internal/env.js';
4
+ import MessageLayer from './MessageLayer.svelte';
5
+ import { getSnapshot, registerHost, subscribe, type HostRegistration } from './store.js';
6
+ import type {
7
+ MessageConfigClassNames,
8
+ MessageConfigStyles,
9
+ MessageContainer,
10
+ MessageLabels,
11
+ MessageStack
12
+ } from './types.js';
13
+
14
+ /**
15
+ * Draws the messages. Place it once, near the root of the app; `message.success(...)` and the other calls, from
16
+ * anywhere, then show up in it. Its props are the settings of every message it draws and win over `message.config()`.
17
+ */
18
+ type MessageHostProps = {
19
+ /** Distance of the first message from the top of the window. A number is pixels. Default 8. */
20
+ top?: number | string;
21
+ /** Default duration in seconds. Default 3. */
22
+ duration?: number;
23
+ /** At most this many open messages; the oldest is closed to make room. Default: no limit. */
24
+ maxCount?: number;
25
+ /** Where the layer is moved to. Default `document.body`. */
26
+ container?: MessageContainer;
27
+ /** Shows a close button on every message that does not say otherwise. */
28
+ closable?: boolean;
29
+ /** The type word read before the text, and the name of the close button. Pass a translation here. */
30
+ labels?: MessageLabels;
31
+ classNames?: MessageConfigClassNames;
32
+ styles?: MessageConfigStyles;
33
+ /** Turns the pile on: past 3 messages the rows lie behind the newest; `{ threshold }` sets the number. */
34
+ stack?: MessageStack;
35
+ };
36
+
37
+ let { top, duration, maxCount, container, closable, labels, classNames, styles, stack }: MessageHostProps = $props();
38
+
39
+ const settings = () => ({ top, duration, maxCount, container, closable, labels, classNames, styles, stack });
40
+
41
+ // Registered while the component lives, and only in a browser: module state on a server is shared by every request.
42
+ // The host mounted last is the active one; another renders nothing, and says so once while developing.
43
+ let registration = $state.raw<HostRegistration | null>(null);
44
+ $effect(() => {
45
+ const host = registerHost(untrack(settings));
46
+ registration = host;
47
+ let warned = false;
48
+ const check = () => {
49
+ if (getSnapshot().activeHost !== host.id && !warned && !isProduction()) {
50
+ warned = true;
51
+ console.warn('MessageHost: another MessageHost is mounted and draws the messages; this one draws nothing.');
52
+ }
53
+ };
54
+ check();
55
+ const stop = subscribe(check);
56
+ return () => {
57
+ stop();
58
+ registration = null;
59
+ host.dispose();
60
+ };
61
+ });
62
+
63
+ $effect(() => {
64
+ registration?.update(settings());
65
+ });
66
+ </script>
67
+
68
+ {#if registration}
69
+ <MessageLayer hostId={registration.id} />
70
+ {/if}
@@ -0,0 +1,26 @@
1
+ import type { MessageConfigClassNames, MessageConfigStyles, MessageContainer, MessageLabels, MessageStack } from './types.js';
2
+ /**
3
+ * Draws the messages. Place it once, near the root of the app; `message.success(...)` and the other calls, from
4
+ * anywhere, then show up in it. Its props are the settings of every message it draws and win over `message.config()`.
5
+ */
6
+ type MessageHostProps = {
7
+ /** Distance of the first message from the top of the window. A number is pixels. Default 8. */
8
+ top?: number | string;
9
+ /** Default duration in seconds. Default 3. */
10
+ duration?: number;
11
+ /** At most this many open messages; the oldest is closed to make room. Default: no limit. */
12
+ maxCount?: number;
13
+ /** Where the layer is moved to. Default `document.body`. */
14
+ container?: MessageContainer;
15
+ /** Shows a close button on every message that does not say otherwise. */
16
+ closable?: boolean;
17
+ /** The type word read before the text, and the name of the close button. Pass a translation here. */
18
+ labels?: MessageLabels;
19
+ classNames?: MessageConfigClassNames;
20
+ styles?: MessageConfigStyles;
21
+ /** Turns the pile on: past 3 messages the rows lie behind the newest; `{ threshold }` sets the number. */
22
+ stack?: MessageStack;
23
+ };
24
+ declare const MessageHost: import("svelte").Component<MessageHostProps, {}, "">;
25
+ type MessageHost = ReturnType<typeof MessageHost>;
26
+ export default MessageHost;
@@ -0,0 +1,74 @@
1
+ <script lang="ts">
2
+ /*
3
+ * The icons of a message, drawn here from plain geometry: a disc with the sign cut out of it (the sign shows what is
4
+ * behind the icon), a spinner, and a cross. They are decorative: the text, the hidden type word and the name of the
5
+ * close button carry the meaning.
6
+ */
7
+ type IconName = 'info' | 'success' | 'error' | 'warning' | 'loading' | 'close';
8
+
9
+ let { name }: { name: IconName } = $props();
10
+
11
+ // The id of the mask that cuts the sign out of the disc: one per icon, so two icons never share it.
12
+ const uid = $props.id();
13
+ </script>
14
+
15
+ <svg class={`ads-message-svg ads-message-svg-${name}`} viewBox="0 0 16 16" width="1em" height="1em" aria-hidden="true" focusable="false">
16
+ {#if name === 'loading'}
17
+ <circle class="track" cx="8" cy="8" r="6" />
18
+ <path class="arc" d="M8 2a6 6 0 0 1 6 6" />
19
+ {:else if name === 'close'}
20
+ <path d="M4.4 4.4l7.2 7.2M11.6 4.4l-7.2 7.2" />
21
+ {:else}
22
+ <mask id="{uid}-cut" maskUnits="userSpaceOnUse" x="0" y="0" width="16" height="16">
23
+ <rect width="16" height="16" fill="#fff" stroke="none" />
24
+ {#if name === 'info'}
25
+ <circle cx="8" cy="4.9" r="1" fill="#000" stroke="none" />
26
+ <path d="M8 7.4v4" stroke="#000" stroke-width="1.6" />
27
+ {:else if name === 'success'}
28
+ <path d="M4.8 8.2l2.3 2.3 4.2-4.6" stroke="#000" stroke-width="1.6" />
29
+ {:else if name === 'error'}
30
+ <path d="M5.5 5.5l5 5M10.5 5.5l-5 5" stroke="#000" stroke-width="1.6" />
31
+ {:else}
32
+ <path d="M8 4.4v4.2" stroke="#000" stroke-width="1.6" />
33
+ <circle cx="8" cy="11.2" r="1" fill="#000" stroke="none" />
34
+ {/if}
35
+ </mask>
36
+ <circle cx="8" cy="8" r="7" fill="currentColor" stroke="none" mask="url(#{uid}-cut)" />
37
+ {/if}
38
+ </svg>
39
+
40
+ <style>
41
+ .ads-message-svg {
42
+ display: block;
43
+ flex: none;
44
+ fill: none;
45
+ stroke: currentColor;
46
+ stroke-width: 1.4;
47
+ stroke-linecap: round;
48
+ stroke-linejoin: round;
49
+ }
50
+
51
+ .ads-message-svg-loading {
52
+ animation: ads-message-spin var(--ads-motion-duration-spinner) linear infinite;
53
+ }
54
+
55
+ .ads-message-svg-loading .track {
56
+ opacity: 0.25;
57
+ }
58
+
59
+ .ads-message-svg-loading .arc {
60
+ stroke-width: 2;
61
+ }
62
+
63
+ @keyframes ads-message-spin {
64
+ to {
65
+ transform: rotate(360deg);
66
+ }
67
+ }
68
+
69
+ @media (prefers-reduced-motion: reduce) {
70
+ .ads-message-svg-loading {
71
+ animation-duration: var(--ads-motion-duration-spinner-reduced);
72
+ }
73
+ }
74
+ </style>
@@ -0,0 +1,7 @@
1
+ type IconName = 'info' | 'success' | 'error' | 'warning' | 'loading' | 'close';
2
+ type $$ComponentProps = {
3
+ name: IconName;
4
+ };
5
+ declare const MessageIcon: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type MessageIcon = ReturnType<typeof MessageIcon>;
7
+ export default MessageIcon;
@@ -0,0 +1,330 @@
1
+ <script lang="ts">
2
+ import { onMount, untrack } from 'svelte';
3
+ import { classList, styleText } from '../internal/semantic.js';
4
+ import MessageIcon from './MessageIcon.svelte';
5
+ import { playEnter, playLeave } from './motion.js';
6
+ import { closeById, finalize, setPaused, type MessageRecord, type MessageSettings } from './store.js';
7
+
8
+ /** One message: the slot it takes in the list, and the box inside it. */
9
+ type ItemProps = {
10
+ record: MessageRecord;
11
+ /** Its place in the list as shown: 0 is the first row (the newest, when `stack` is on). */
12
+ index: number;
13
+ settings: MessageSettings;
14
+ /** The list is a collapsed pile: the messages lie behind the first one. */
15
+ piled: boolean;
16
+ /** `stack` is on, so a new message pushes the others down. */
17
+ stacked: boolean;
18
+ };
19
+
20
+ let { record, index, settings, piled, stacked }: ItemProps = $props();
21
+
22
+ let slot = $state<HTMLElement | null>(null);
23
+ let item = $state<HTMLElement | null>(null);
24
+
25
+ const iconName = $derived(record.type);
26
+ const word = $derived(settings.labels[record.type]);
27
+ // A failure interrupts a screen reader (`alert`); the rest wait for it to finish (`status`).
28
+ const role = $derived(record.type === 'error' || record.type === 'warning' ? 'alert' : 'status');
29
+ const closable = $derived(record.closable ?? settings.closable);
30
+ // The older messages of a collapsed pile cannot be seen, so they cannot take focus or be read again.
31
+ const buried = $derived(piled && index > 0);
32
+ const depth = $derived(Math.min(index, 2));
33
+
34
+ // Where a part gets its class or style: the message's own wins over the one of the host or `message.config()`.
35
+ const own = $derived(record.classNames);
36
+ const ownStyles = $derived(record.styles);
37
+ const part = (name: 'root' | 'wrapper' | 'icon' | 'title' | 'close') => own?.[name] ?? settings.classNames[name];
38
+ const partStyle = (name: 'root' | 'wrapper' | 'icon' | 'title' | 'close') => ownStyles?.[name] ?? settings.styles[name];
39
+
40
+ // Comes in once. A message that was already on the page when its layer was created (the layer of the library
41
+ // handing over to a `MessageHost`) has no motion of its own.
42
+ onMount(() => {
43
+ // `shift`: the first row of a stacked list pushes the ones behind it down, so its slot grows instead of jumping.
44
+ if (slot && item && Date.now() - record.createdAt < 150) playEnter(slot, item, stacked && index === 0 && slot.nextElementSibling !== null);
45
+ });
46
+
47
+ let leaving = false;
48
+ $effect(() => {
49
+ if (record.state !== 'closing' || leaving || !slot || !item) return;
50
+ leaving = true;
51
+ const id = record.id;
52
+ const [s, i] = [slot, item];
53
+ untrack(() => {
54
+ void playLeave(s, i).then(() => finalize(id));
55
+ });
56
+ });
57
+
58
+ // The box is made again by an update with the same key (so that a screen reader reads it as new). A focused element
59
+ // inside it is gone then, and no `focusout` tells; without this the timer would wait for a focus that is not there.
60
+ $effect(() => {
61
+ void record.revision;
62
+ const id = untrack(() => record.id);
63
+ if (item && !item.contains(document.activeElement)) setPaused(id, 'focus', false);
64
+ });
65
+
66
+ // The attribute, not the property: a browser without `inert` ignores a property it does not know. There only the
67
+ // close button is kept out of the Tab order (its `tabindex`); links and buttons that a snippet put inside stay in it.
68
+ function inert(node: HTMLElement): void {
69
+ node.toggleAttribute('inert', buried);
70
+ }
71
+
72
+ const hover = (on: boolean) => (event: PointerEvent) => {
73
+ if (event.pointerType === 'touch') return;
74
+ if (record.pauseOnHover) setPaused(record.id, 'hover', on);
75
+ };
76
+
77
+ function onfocusout(event: FocusEvent): void {
78
+ if (!item?.contains(event.relatedTarget as Node | null)) setPaused(record.id, 'focus', false);
79
+ }
80
+
81
+ function onkeydown(event: KeyboardEvent): void {
82
+ if (event.key === 'Escape' && !event.isComposing) closeById(record.id);
83
+ }
84
+
85
+ function close(event: MouseEvent): void {
86
+ event.stopPropagation();
87
+ closeById(record.id);
88
+ }
89
+ </script>
90
+
91
+ <div
92
+ class="ads-message-slot"
93
+ class:ads-message-slot-stack={stacked}
94
+ data-message-id={`${record.id}`}
95
+ data-depth={piled ? depth : undefined}
96
+ style={`--ads-message-i: ${index}`}
97
+ style:z-index={piled ? 100 - index : undefined}
98
+ bind:this={slot}
99
+ >
100
+ <div
101
+ class="ads-message-item"
102
+ {@attach inert}
103
+ aria-hidden={buried ? 'true' : undefined}
104
+ bind:this={item}
105
+ onpointerenter={hover(true)}
106
+ onpointerleave={hover(false)}
107
+ onfocusin={() => setPaused(record.id, 'focus', true)}
108
+ {onfocusout}
109
+ {onkeydown}
110
+ >
111
+ {#key record.revision}
112
+ <div
113
+ class={classList('ads-message', `ads-message-${record.type}`, record.class, part('root'))}
114
+ style={styleText(record.style, partStyle('root'))}
115
+ {role}
116
+ onclick={(event) => record.onclick?.(event)}
117
+ >
118
+ <span class={classList('ads-message-wrapper', part('wrapper'))} style={styleText(partStyle('wrapper'))}>
119
+ {#if record.icon !== false}
120
+ <span class={classList('ads-message-icon', part('icon'))} style={styleText(partStyle('icon'))} aria-hidden="true">
121
+ {#if record.icon === undefined}
122
+ <MessageIcon name={iconName} />
123
+ {:else if typeof record.icon === 'function'}
124
+ {@render record.icon()}
125
+ {:else}
126
+ {record.icon}
127
+ {/if}
128
+ </span>
129
+ {/if}
130
+ <span class={classList('ads-message-title', part('title'))} style={styleText(partStyle('title'))}>
131
+ {#if word}<span class="ads-message-word">{`${word}: `}</span>{/if}
132
+ {#if typeof record.content === 'function'}{@render record.content()}{:else}{record.content}{/if}
133
+ </span>
134
+ </span>
135
+ {#if closable}
136
+ <button
137
+ type="button"
138
+ class={classList('ads-message-close', part('close'))}
139
+ style={styleText(partStyle('close'))}
140
+ aria-label={settings.labels.close}
141
+ tabindex={buried ? -1 : undefined}
142
+ onclick={close}
143
+ >
144
+ <MessageIcon name="close" />
145
+ </button>
146
+ {/if}
147
+ </div>
148
+ {/key}
149
+ </div>
150
+ </div>
151
+
152
+ <style>
153
+ /* One row of the list. Its bottom padding is the gap to the next row, so that a leaving row takes the gap with it. */
154
+ .ads-message-slot {
155
+ box-sizing: border-box;
156
+ max-width: 100%;
157
+ padding-block-end: var(--ads-message-gap);
158
+ pointer-events: none;
159
+ }
160
+
161
+ /* With `stack` the rows and the gaps between them count as the pile: the pointer must not fall through a gap. */
162
+ .ads-message-slot-stack {
163
+ pointer-events: auto;
164
+ }
165
+
166
+ .ads-message-item {
167
+ max-width: 100%;
168
+ pointer-events: none;
169
+ transition:
170
+ transform var(--ads-motion-duration) var(--ads-motion-ease),
171
+ opacity var(--ads-motion-duration) var(--ads-motion-ease);
172
+ }
173
+
174
+ /* Behind the first message of a collapsed pile: lowered, smaller, and only the first of them peeks out below. */
175
+ :global(.ads-message-piled) .ads-message-item {
176
+ transform-origin: bottom center;
177
+ transform: translateY(calc(var(--ads-message-i) * var(--ads-message-stack-offset)))
178
+ scale(calc(1 - var(--ads-message-i) * var(--ads-message-stack-scale-step)));
179
+ }
180
+
181
+ /* In a pile every row lies on the first one. */
182
+ :global(.ads-message-piled) .ads-message-slot {
183
+ grid-area: 1 / 1;
184
+ justify-self: center;
185
+ }
186
+
187
+ /* The third and the rows behind it are not shown, and must not catch the pointer. */
188
+ :global(.ads-message-piled) .ads-message-slot[data-depth='2'] {
189
+ pointer-events: none;
190
+ }
191
+
192
+ :global(.ads-message-piled) .ads-message-slot[data-depth='2'] .ads-message-item {
193
+ opacity: 0;
194
+ }
195
+
196
+ .ads-message {
197
+ box-sizing: border-box;
198
+ display: flex;
199
+ align-items: flex-start;
200
+ gap: var(--ads-message-icon-gap);
201
+ max-width: 100%;
202
+ padding: var(--ads-message-padding);
203
+ border-radius: var(--ads-message-radius);
204
+ color: var(--ads-message-color);
205
+ background: var(--ads-message-bg);
206
+ box-shadow: var(--ads-message-shadow);
207
+ font-family: var(--ads-font-family);
208
+ font-size: var(--ads-font-size);
209
+ line-height: var(--ads-message-line-height);
210
+ text-align: start;
211
+ pointer-events: auto;
212
+ }
213
+
214
+ .ads-message-wrapper {
215
+ display: flex;
216
+ flex: 1 1 auto;
217
+ align-items: flex-start;
218
+ gap: var(--ads-message-icon-gap);
219
+ min-width: 0;
220
+ }
221
+
222
+ /* As tall as a line of text, so the box is the same height with or without an icon, whatever the icon's size. */
223
+ .ads-message-icon {
224
+ display: flex;
225
+ flex: none;
226
+ align-items: center;
227
+ height: var(--ads-message-line-height);
228
+ }
229
+
230
+ .ads-message-icon :global(svg) {
231
+ font-size: var(--ads-message-icon-size);
232
+ }
233
+
234
+ .ads-message-info .ads-message-icon {
235
+ color: var(--ads-message-icon-info);
236
+ }
237
+
238
+ .ads-message-loading .ads-message-icon {
239
+ color: var(--ads-message-icon-info);
240
+ }
241
+
242
+ .ads-message-success .ads-message-icon {
243
+ color: var(--ads-message-icon-success);
244
+ }
245
+
246
+ .ads-message-error .ads-message-icon {
247
+ color: var(--ads-message-icon-error);
248
+ }
249
+
250
+ .ads-message-warning .ads-message-icon {
251
+ color: var(--ads-message-icon-warning);
252
+ }
253
+
254
+ .ads-message-title {
255
+ min-width: 0;
256
+ overflow-wrap: anywhere;
257
+ }
258
+
259
+ /* The type, for a screen reader only. */
260
+ .ads-message-word {
261
+ position: absolute;
262
+ width: 1px;
263
+ height: 1px;
264
+ margin: -1px;
265
+ padding: 0;
266
+ overflow: hidden;
267
+ clip-path: inset(50%);
268
+ white-space: nowrap;
269
+ border: 0;
270
+ }
271
+
272
+ .ads-message-close {
273
+ display: flex;
274
+ flex: none;
275
+ align-items: center;
276
+ justify-content: center;
277
+ box-sizing: border-box;
278
+ width: var(--ads-message-close-size);
279
+ height: var(--ads-message-close-size);
280
+ margin: calc((var(--ads-message-line-height) - var(--ads-message-close-size)) / 2) 0;
281
+ margin-inline-start: var(--ads-message-icon-gap);
282
+ padding: 0;
283
+ border: 0;
284
+ border-radius: var(--ads-radius-sm);
285
+ color: var(--ads-message-close-color);
286
+ background: transparent;
287
+ font-size: 12px;
288
+ cursor: pointer;
289
+ transition:
290
+ color var(--ads-motion-duration) var(--ads-motion-ease),
291
+ background-color var(--ads-motion-duration) var(--ads-motion-ease);
292
+ }
293
+
294
+ .ads-message-close:hover {
295
+ color: var(--ads-message-close-color-hover);
296
+ background: var(--ads-message-close-bg-hover);
297
+ }
298
+
299
+ .ads-message-close:focus-visible {
300
+ outline: var(--ads-focus-outline-width) solid var(--ads-color-focus-outline);
301
+ outline-offset: 1px;
302
+ }
303
+
304
+ @media (prefers-reduced-motion: reduce) {
305
+ .ads-message-item,
306
+ .ads-message-close {
307
+ transition: none;
308
+ }
309
+ }
310
+
311
+ /* The shadow and the colors are replaced by the system ones: without a border the box would melt into the page. */
312
+ @media (forced-colors: active) {
313
+ .ads-message {
314
+ border: 1px solid CanvasText;
315
+ }
316
+
317
+ .ads-message-icon {
318
+ color: CanvasText;
319
+ }
320
+
321
+ .ads-message-close {
322
+ border: 1px solid ButtonText;
323
+ color: ButtonText;
324
+ }
325
+
326
+ .ads-message-close:focus-visible {
327
+ outline-color: Highlight;
328
+ }
329
+ }
330
+ </style>
@@ -0,0 +1,15 @@
1
+ import { type MessageRecord, type MessageSettings } from './store.js';
2
+ /** One message: the slot it takes in the list, and the box inside it. */
3
+ type ItemProps = {
4
+ record: MessageRecord;
5
+ /** Its place in the list as shown: 0 is the first row (the newest, when `stack` is on). */
6
+ index: number;
7
+ settings: MessageSettings;
8
+ /** The list is a collapsed pile: the messages lie behind the first one. */
9
+ piled: boolean;
10
+ /** `stack` is on, so a new message pushes the others down. */
11
+ stacked: boolean;
12
+ };
13
+ declare const MessageItem: import("svelte").Component<ItemProps, {}, "">;
14
+ type MessageItem = ReturnType<typeof MessageItem>;
15
+ export default MessageItem;