@molecule/app-typing-indicator-svelte 1.1.2 → 1.2.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
@@ -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-21T12:47:41.646Z
6
+ Generated: 2026-11-25T10:06:46.697Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-typing-indicator-svelte
@@ -81,7 +81,7 @@ const TypingIndicator: LegacyComponentType
81
81
  Peer dependencies:
82
82
 
83
83
  - `@molecule/app-svelte` ^3.5.0
84
- - `@molecule/app-ui` ^1.0.1
84
+ - `@molecule/app-ui` ^1.9.0
85
85
  - `@molecule/app-ui-svelte` ^1.1.0
86
86
  - `svelte` ^5.0.0
87
87
 
@@ -3,14 +3,15 @@
3
3
  `TypingIndicator` — three-dot CSS-only pulse animation. Same props, same DOM
4
4
  for the same input; the dots use `currentColor` so the indicator inherits the
5
5
  surrounding text color. Each instance renders its own `<style>` element with
6
- the shared keyframes: it is written as `<svelte:element this={'style'}>` so
6
+ the keyframes of its motion recipe (the ClassMap's `typingPulse`, else the
7
+ standard curve): it is written as `<svelte:element this={'style'}>` so
7
8
  Svelte treats it as an ordinary element (a literal `<style>` in markup is
8
9
  component CSS), and it is part of the template, so it mounts, updates and
9
10
  unmounts with the span.
10
11
  -->
11
12
  <script lang="ts">
12
13
  import { useTranslation } from '@molecule/app-svelte'
13
- import { getClassMap } from '@molecule/app-ui'
14
+ import { DEFAULT_TYPING_PULSE, getClassMap } from '@molecule/app-ui'
14
15
 
15
16
  import type { TypingIndicatorProps } from './types.js'
16
17
 
@@ -26,7 +27,19 @@
26
27
 
27
28
  const cm = $derived(getClassMap())
28
29
 
29
- const keyName = 'molecule-typing-pulse'
30
+ // React's `PulseDots` reads the recipe on each render; a Svelte component's
31
+ // script runs once per instance, so this is the recipe the instance mounts with.
32
+ const { peakAt, restAt, stagger, dimOpacity, dimScale } =
33
+ getClassMap().typingPulse ?? DEFAULT_TYPING_PULSE
34
+
35
+ // Keyframes are document-wide. A custom curve must coexist with a mounted standard pulse.
36
+ const keyName =
37
+ peakAt === DEFAULT_TYPING_PULSE.peakAt &&
38
+ restAt === DEFAULT_TYPING_PULSE.restAt &&
39
+ dimOpacity === DEFAULT_TYPING_PULSE.dimOpacity &&
40
+ dimScale === DEFAULT_TYPING_PULSE.dimScale
41
+ ? 'molecule-typing-pulse'
42
+ : `molecule-typing-pulse-${[peakAt, restAt, dimOpacity, dimScale].join('-').replaceAll('.', '_')}`
30
43
 
31
44
  /**
32
45
  * The label: the prop when given, else the translated default (read in the
@@ -40,10 +53,18 @@
40
53
  // stagger delay, so the dots flash in sequence for a reduced-motion user and
41
54
  // the rendered frame depends on when it is painted; the component's own rule
42
55
  // turns the pulse off entirely instead.
43
- const css = `@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; } }`
56
+ const css = `@keyframes ${keyName} { 0%, ${restAt * 100}%, 100% { opacity: ${dimOpacity}; transform: scale(${dimScale}); } ${peakAt * 100}% { opacity: 1; transform: scale(1); } } @media (prefers-reduced-motion: reduce) { [data-typing-dot] { animation: none !important; } }`
44
57
 
45
- const styleAttr = (i: number): string =>
46
- `display:inline-block;width:${dotSize}px;height:${dotSize}px;border-radius:50%;background:currentColor;animation:${keyName} ${durationMs}ms ease-in-out ${(i * durationMs) / 6}ms infinite`
58
+ /**
59
+ * One dot's inline styles. The original division preserves the exact serialized delay for fractional values.
60
+ * @param i - The dot's position (0–2); each dot's delay staggers it.
61
+ * @returns The style attribute text.
62
+ */
63
+ const styleAttr = (i: number): string => {
64
+ const elapsed = i * durationMs
65
+ const delay = stagger === DEFAULT_TYPING_PULSE.stagger ? elapsed / 6 : elapsed * stagger
66
+ return `display:inline-block;width:${dotSize}px;height:${dotSize}px;border-radius:50%;background:currentColor;animation:${keyName} ${durationMs}ms ease-in-out ${delay}ms infinite`
67
+ }
47
68
  </script>
48
69
 
49
70
  {#if visible}
@@ -1 +1 @@
1
- {"version":3,"file":"TypingIndicator.svelte.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAoDvD,QAAA,MAAM,eAAe,0DAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"TypingIndicator.svelte.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAwEvD,QAAA,MAAM,eAAe,0DAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-typing-indicator-svelte",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
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",
@@ -49,17 +49,17 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@molecule/app-svelte": "^3.5.0",
52
- "@molecule/app-ui": "^1.0.1",
52
+ "@molecule/app-ui": "^1.9.0",
53
53
  "@molecule/app-ui-svelte": "^1.1.0",
54
54
  "svelte": "^5.0.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@molecule/app-framework-conformance": "0.0.0",
58
- "@molecule/app-i18n": "1.2.2",
58
+ "@molecule/app-i18n": "1.3.0",
59
59
  "@molecule/app-icons": "1.0.4",
60
- "@molecule/app-svelte": "3.13.0",
61
- "@molecule/app-ui": "1.5.0",
62
- "@molecule/app-ui-svelte": "1.4.1",
60
+ "@molecule/app-svelte": "3.16.0",
61
+ "@molecule/app-ui": "1.13.0",
62
+ "@molecule/app-ui-svelte": "1.9.0",
63
63
  "@sveltejs/package": "3.0.2",
64
64
  "@sveltejs/vite-plugin-svelte": "7.1.2",
65
65
  "@types/node": "26.6.5",