@molecule/app-typing-indicator-svelte 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/TypingIndicator.svelte +22 -5
- package/dist/TypingIndicator.svelte.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-21T12:47:41.646Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-typing-indicator-svelte
|
|
@@ -56,7 +56,10 @@ interface TypingIndicatorProps {
|
|
|
56
56
|
dotSize?: number
|
|
57
57
|
/** Animation duration in ms. Defaults to 1200. */
|
|
58
58
|
durationMs?: number
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Accessible label. Overrides the translated / `defaultValue` `'Typing…'`
|
|
61
|
+
* (prop > `t()` > default).
|
|
62
|
+
*/
|
|
60
63
|
ariaLabel?: string
|
|
61
64
|
/** Extra classes. */
|
|
62
65
|
className?: string
|
|
@@ -91,9 +94,13 @@ Peer dependencies:
|
|
|
91
94
|
|
|
92
95
|
Dots use `currentColor`, so the indicator inherits the surrounding text
|
|
93
96
|
color — wrap it in a muted-text container to dim it. The default
|
|
94
|
-
`ariaLabel` is
|
|
95
|
-
|
|
96
|
-
Each instance injects its own `<style>` tag for the
|
|
97
|
-
chat view; avoid hundreds at once). Props (documented
|
|
98
|
-
`TypingIndicatorProps` interface): visible (default true),
|
|
99
|
-
default 6), durationMs (default 1200), ariaLabel, className.
|
|
97
|
+
`ariaLabel` is the translated `typingIndicator.aria.label` (English
|
|
98
|
+
`'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
|
|
99
|
+
prop overrides it. Each instance injects its own `<style>` tag for the
|
|
100
|
+
keyframes (fine for a chat view; avoid hundreds at once). Props (documented
|
|
101
|
+
on the exported `TypingIndicatorProps` interface): visible (default true),
|
|
102
|
+
dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
|
|
103
|
+
|
|
104
|
+
## Translations
|
|
105
|
+
|
|
106
|
+
Translation strings are provided by `@molecule/app-locales-typing-indicator`.
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
again on every re-mount, and the element leaves the DOM with the span.
|
|
9
9
|
-->
|
|
10
10
|
<script lang="ts">
|
|
11
|
+
import { useTranslation } from '@molecule/app-svelte'
|
|
11
12
|
import { getClassMap } from '@molecule/app-ui'
|
|
12
13
|
|
|
13
14
|
import type { TypingIndicatorProps } from './types.js'
|
|
@@ -16,22 +17,38 @@
|
|
|
16
17
|
visible = true,
|
|
17
18
|
dotSize = 6,
|
|
18
19
|
durationMs = 1200,
|
|
19
|
-
ariaLabel
|
|
20
|
+
ariaLabel,
|
|
20
21
|
className,
|
|
21
22
|
}: TypingIndicatorProps = $props()
|
|
22
23
|
|
|
24
|
+
const { t } = useTranslation()
|
|
25
|
+
|
|
23
26
|
const cm = $derived(getClassMap())
|
|
24
27
|
|
|
25
28
|
const keyName = 'molecule-typing-pulse'
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
31
|
+
* The label: the prop when given, else the translated default (read in the
|
|
32
|
+
* template, so a locale switch re-renders it).
|
|
33
|
+
* @returns The label text.
|
|
34
|
+
*/
|
|
35
|
+
const label = (): string =>
|
|
36
|
+
ariaLabel ?? t('typingIndicator.aria.label', undefined, { defaultValue: 'Typing…' })
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Inserts the `<style>` element with the keyframes and the reduced-motion
|
|
40
|
+
* opt-out as the span's first child.
|
|
41
|
+
*
|
|
42
|
+
* The host stylesheet's global 0.01ms collapse still leaves the per-dot
|
|
43
|
+
* stagger delay, so the dots flash in sequence for a reduced-motion user and
|
|
44
|
+
* the rendered frame depends on when it is painted; the component's own rule
|
|
45
|
+
* turns the pulse off entirely instead.
|
|
29
46
|
*
|
|
30
47
|
* @param el - The indicator span.
|
|
31
48
|
*/
|
|
32
49
|
const injectKeyframes = (el: HTMLElement): void => {
|
|
33
50
|
const style = document.createElement('style')
|
|
34
|
-
style.textContent = `@keyframes ${keyName} { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }`
|
|
51
|
+
style.textContent = `@keyframes ${keyName} { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } } @media (prefers-reduced-motion: reduce) { [data-typing-dot] { animation: none !important; } }`
|
|
35
52
|
el.insertBefore(style, el.firstChild)
|
|
36
53
|
}
|
|
37
54
|
|
|
@@ -43,11 +60,11 @@
|
|
|
43
60
|
<span
|
|
44
61
|
use:injectKeyframes
|
|
45
62
|
role="status"
|
|
46
|
-
aria-label={
|
|
63
|
+
aria-label={label()}
|
|
47
64
|
class={cm.cn(cm.flex({ align: 'center', gap: 'xs' }), className)}
|
|
48
65
|
>
|
|
49
66
|
{#each [0, 1, 2] as i (i)}
|
|
50
|
-
<span aria-hidden="true" style={styleAttr(i)}></span>
|
|
67
|
+
<span aria-hidden="true" data-typing-dot style={styleAttr(i)}></span>
|
|
51
68
|
{/each}
|
|
52
69
|
</span>
|
|
53
70
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypingIndicator.svelte.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TypingIndicator.svelte.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA8DvD,QAAA,MAAM,eAAe,0DAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* @remarks
|
|
20
20
|
* Dots use `currentColor`, so the indicator inherits the surrounding text
|
|
21
21
|
* color — wrap it in a muted-text container to dim it. The default
|
|
22
|
-
* `ariaLabel` is
|
|
23
|
-
*
|
|
24
|
-
* Each instance injects its own `<style>` tag for the
|
|
25
|
-
* chat view; avoid hundreds at once). Props (documented
|
|
26
|
-
* `TypingIndicatorProps` interface): visible (default true),
|
|
27
|
-
* default 6), durationMs (default 1200), ariaLabel, className.
|
|
22
|
+
* `ariaLabel` is the translated `typingIndicator.aria.label` (English
|
|
23
|
+
* `'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
|
|
24
|
+
* prop overrides it. Each instance injects its own `<style>` tag for the
|
|
25
|
+
* keyframes (fine for a chat view; avoid hundreds at once). Props (documented
|
|
26
|
+
* on the exported `TypingIndicatorProps` interface): visible (default true),
|
|
27
|
+
* dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
|
|
28
28
|
*
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
package/dist/index.js
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* @remarks
|
|
20
20
|
* Dots use `currentColor`, so the indicator inherits the surrounding text
|
|
21
21
|
* color — wrap it in a muted-text container to dim it. The default
|
|
22
|
-
* `ariaLabel` is
|
|
23
|
-
*
|
|
24
|
-
* Each instance injects its own `<style>` tag for the
|
|
25
|
-
* chat view; avoid hundreds at once). Props (documented
|
|
26
|
-
* `TypingIndicatorProps` interface): visible (default true),
|
|
27
|
-
* default 6), durationMs (default 1200), ariaLabel, className.
|
|
22
|
+
* `ariaLabel` is the translated `typingIndicator.aria.label` (English
|
|
23
|
+
* `'Typing…'`, via `@molecule/app-locales-typing-indicator`); the `ariaLabel`
|
|
24
|
+
* prop overrides it. Each instance injects its own `<style>` tag for the
|
|
25
|
+
* keyframes (fine for a chat view; avoid hundreds at once). Props (documented
|
|
26
|
+
* on the exported `TypingIndicatorProps` interface): visible (default true),
|
|
27
|
+
* dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.
|
|
28
28
|
*
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -11,7 +11,10 @@ export interface TypingIndicatorProps {
|
|
|
11
11
|
dotSize?: number;
|
|
12
12
|
/** Animation duration in ms. Defaults to 1200. */
|
|
13
13
|
durationMs?: number;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Accessible label. Overrides the translated / `defaultValue` `'Typing…'`
|
|
16
|
+
* (prop > `t()` > default).
|
|
17
|
+
*/
|
|
15
18
|
ariaLabel?: string;
|
|
16
19
|
/** Extra classes. */
|
|
17
20
|
className?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-typing-indicator-svelte",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Three-dot animated typing indicator for chat UIs",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-typing-indicator-svelte",
|
|
6
6
|
"type": "module",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
58
58
|
"@molecule/app-i18n": "1.2.2",
|
|
59
59
|
"@molecule/app-icons": "1.0.4",
|
|
60
|
-
"@molecule/app-svelte": "3.
|
|
61
|
-
"@molecule/app-ui": "1.
|
|
62
|
-
"@molecule/app-ui-svelte": "1.1
|
|
60
|
+
"@molecule/app-svelte": "3.9.0",
|
|
61
|
+
"@molecule/app-ui": "1.5.0",
|
|
62
|
+
"@molecule/app-ui-svelte": "1.2.1",
|
|
63
63
|
"@sveltejs/package": "3.0.2",
|
|
64
64
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
65
65
|
"@types/node": "26.6.5",
|