@molecule/app-typing-indicator-solid 1.1.1 → 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.520Z
6
+ Generated: 2026-11-25T10:06:46.514Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-typing-indicator-solid
@@ -74,6 +74,10 @@ that pulse in sequence. The stylesheet also turns the pulse off under
74
74
  `prefers-reduced-motion: reduce`, so the dots stay still for users who ask
75
75
  for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.
76
76
 
77
+ The motion comes from the ClassMap's `typingPulse` recipe, read when the
78
+ component renders as React's `PulseDots` reads it, and falls back to
79
+ `DEFAULT_TYPING_PULSE`.
80
+
77
81
  ```typescript
78
82
  function TypingIndicator(props: TypingIndicatorProps): JSX.Element
79
83
  ```
@@ -89,7 +93,7 @@ function TypingIndicator(props: TypingIndicatorProps): JSX.Element
89
93
  Peer dependencies:
90
94
 
91
95
  - `@molecule/app-solid` ^3.5.0
92
- - `@molecule/app-ui` ^1.0.1
96
+ - `@molecule/app-ui` ^1.9.0
93
97
  - `@molecule/app-ui-solid` ^1.1.0
94
98
  - `solid-js` ^1.8.0
95
99
 
@@ -16,6 +16,10 @@ import type { TypingIndicatorProps } from './types.js';
16
16
  * `prefers-reduced-motion: reduce`, so the dots stay still for users who ask
17
17
  * for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.
18
18
  *
19
+ * The motion comes from the ClassMap's `typingPulse` recipe, read when the
20
+ * component renders as React's `PulseDots` reads it, and falls back to
21
+ * `DEFAULT_TYPING_PULSE`.
22
+ *
19
23
  * @param props - Component props (see {@link TypingIndicatorProps}).
20
24
  * @returns The rendered typing indicator.
21
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,UAAU,CAAA;AAKpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAQtD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,oBAAoB,CAiC3D,CAAA"}
1
+ {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,UAAU,CAAA;AAKpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAKtD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,oBAAoB,CAwD3D,CAAA"}
@@ -9,11 +9,9 @@
9
9
  */
10
10
  import { For, Show } from 'solid-js';
11
11
  import { useTranslation } from '@molecule/app-solid';
12
- import { getClassMap } from '@molecule/app-ui';
13
- /** The shared `@keyframes` rule the dots animate with. */
12
+ import { DEFAULT_TYPING_PULSE, getClassMap } from '@molecule/app-ui';
13
+ /** The shared `@keyframes` rule the standard pulse curve animates with. */
14
14
  const KEYFRAMES_NAME = 'molecule-typing-pulse';
15
- /** The stylesheet the indicator injects: the pulse and its reduced-motion opt-out. */
16
- const keyframesCss = `@keyframes ${KEYFRAMES_NAME} { 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; } }`;
17
15
  /**
18
16
  * Three-dot "typing…" animation. CSS-only (no library dependency) —
19
17
  * uses `@keyframes` defined via inline style tag. Renders three dots
@@ -21,14 +19,40 @@ const keyframesCss = `@keyframes ${KEYFRAMES_NAME} { 0%, 80%, 100% { opacity: 0.
21
19
  * `prefers-reduced-motion: reduce`, so the dots stay still for users who ask
22
20
  * for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.
23
21
  *
22
+ * The motion comes from the ClassMap's `typingPulse` recipe, read when the
23
+ * component renders as React's `PulseDots` reads it, and falls back to
24
+ * `DEFAULT_TYPING_PULSE`.
25
+ *
24
26
  * @param props - Component props (see {@link TypingIndicatorProps}).
25
27
  * @returns The rendered typing indicator.
26
28
  */
27
29
  export const TypingIndicator = (props) => {
28
30
  const { t } = useTranslation();
29
31
  const cm = getClassMap();
32
+ const { peakAt, restAt, stagger, dimOpacity, dimScale } = cm.typingPulse ?? DEFAULT_TYPING_PULSE;
33
+ // Keyframes are document-wide. A custom curve must coexist with a mounted standard pulse.
34
+ const keyName = peakAt === DEFAULT_TYPING_PULSE.peakAt &&
35
+ restAt === DEFAULT_TYPING_PULSE.restAt &&
36
+ dimOpacity === DEFAULT_TYPING_PULSE.dimOpacity &&
37
+ dimScale === DEFAULT_TYPING_PULSE.dimScale
38
+ ? KEYFRAMES_NAME
39
+ : `${KEYFRAMES_NAME}-${[peakAt, restAt, dimOpacity, dimScale].join('-').replaceAll('.', '_')}`;
40
+ /** The stylesheet the indicator injects: the pulse and its reduced-motion opt-out. */
41
+ const keyframesCss = `@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; } }`;
30
42
  /** The label: the prop when given, else the translated default. */
31
43
  const label = () => props.ariaLabel ?? t('typingIndicator.aria.label', undefined, { defaultValue: 'Typing…' });
44
+ /**
45
+ * One dot's animation shorthand.
46
+ * @param index - The dot's position (0–2); each dot's delay staggers it.
47
+ * @returns The `animation` value.
48
+ */
49
+ const animation = (index) => {
50
+ const durationMs = props.durationMs ?? 1200;
51
+ // The original division preserves the exact serialized delay for fractional values.
52
+ const elapsed = index * durationMs;
53
+ const delay = stagger === DEFAULT_TYPING_PULSE.stagger ? elapsed / 6 : elapsed * stagger;
54
+ return `${keyName} ${durationMs}ms ease-in-out ${delay}ms infinite`;
55
+ };
32
56
  return (<Show when={props.visible ?? true}>
33
57
  <span role="status" aria-label={label()} class={cm.cn(cm.flex({ align: 'center', gap: 'xs' }), props.className)}>
34
58
  <style>{keyframesCss}</style>
@@ -39,7 +63,7 @@ export const TypingIndicator = (props) => {
39
63
  height: `${props.dotSize ?? 6}px`,
40
64
  'border-radius': '50%',
41
65
  background: 'currentColor',
42
- animation: `${KEYFRAMES_NAME} ${props.durationMs ?? 1200}ms ease-in-out ${(i * (props.durationMs ?? 1200)) / 6}ms infinite`,
66
+ animation: animation(i),
43
67
  }}/>)}
44
68
  </For>
45
69
  </span>
@@ -1 +1 @@
1
- {"version":3,"file":"TypingIndicator.jsx","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,0DAA0D;AAC1D,MAAM,cAAc,GAAG,uBAAuB,CAAA;AAE9C,sFAAsF;AACtF,MAAM,YAAY,GAAG,cAAc,cAAc,oMAAoM,CAAA;AAErP;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoC,CAAC,KAAK,EAAE,EAAE;IACxE,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,mEAAmE;IACnE,MAAM,KAAK,GAAG,GAAW,EAAE,CACzB,KAAK,CAAC,SAAS,IAAI,CAAC,CAA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KAAK,CAAC,OAAO,IAAI,CAAC,IAAI;gBACjC,eAAe,EAAE,KAAK;gBACtB,UAAU,EAAE,cAAc;gBAC1B,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;aACxB,CAAC,EACF,CACH,CACH;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-typing-indicator-solid",
3
- "version": "1.1.1",
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-solid",
6
6
  "type": "module",
@@ -43,19 +43,19 @@
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@molecule/app-solid": "^3.5.0",
46
- "@molecule/app-ui": "^1.0.1",
46
+ "@molecule/app-ui": "^1.9.0",
47
47
  "@molecule/app-ui-solid": "^1.1.0",
48
48
  "solid-js": "^1.8.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@molecule/app-framework-conformance": "0.0.0",
52
- "@molecule/app-i18n": "1.2.2",
52
+ "@molecule/app-i18n": "1.3.0",
53
53
  "@molecule/app-icons": "1.0.4",
54
- "@molecule/app-solid": "3.9.0",
55
- "@molecule/app-ui": "1.5.0",
56
- "@molecule/app-ui-solid": "1.2.1",
54
+ "@molecule/app-solid": "3.17.0",
55
+ "@molecule/app-ui": "1.13.0",
56
+ "@molecule/app-ui-solid": "1.9.0",
57
57
  "@types/node": "26.6.5",
58
- "jsdom": "30.1.3",
58
+ "jsdom": "31.0.1",
59
59
  "solid-js": "1.9.17",
60
60
  "typescript": "6.0.3",
61
61
  "vite-plugin-solid": "2.11.15",