@molecule/app-presence-indicator-svelte 1.1.0 → 1.1.2

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-15T09:12:52.095Z
6
+ Generated: 2026-11-21T12:46:57.594Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-presence-indicator-svelte
@@ -68,7 +68,7 @@ interface PresenceDotProps {
68
68
  position?: 'inline' | 'overlay'
69
69
  /** Overlay corner when `position="overlay"`. Defaults to `'bottom-right'`. */
70
70
  corner?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left'
71
- /** Accessible label override. Defaults to `Presence: <status>`. */
71
+ /** Accessible label override; defaults to `t('presenceIndicator.aria.presence', …)`. */
72
72
  ariaLabel?: string
73
73
  /** Extra classes. */
74
74
  className?: string
@@ -148,3 +148,7 @@ identical in both themes; the overlay ring color follows
148
148
  `var(--color-surface)`. The decorated avatar is the default `children`
149
149
  snippet; a node prop (the React form) may also arrive as a same-named
150
150
  snippet.
151
+
152
+ ## Translations
153
+
154
+ Translation strings are provided by `@molecule/app-locales-presence-indicator`.
@@ -26,7 +26,7 @@
26
26
  them: React renders the two child nodes with nothing in between, so any
27
27
  literal whitespace here would show up as an extra text node. -->
28
28
  <span class={cm.cn(cm.position('relative'), className)} style="display: inline-block"
29
- >{#if children}{@render children()}{/if}{#if status}<PresenceDot
29
+ >{#if children}{@render children?.()}{/if}{#if status}<PresenceDot
30
30
  {status}
31
31
  position="overlay"
32
32
  {corner}
@@ -5,6 +5,7 @@
5
5
  style is applied through the CSSOM exactly as React applies it.
6
6
  -->
7
7
  <script lang="ts">
8
+ import { useTranslation } from '@molecule/app-svelte'
8
9
  import { getClassMap } from '@molecule/app-ui'
9
10
 
10
11
  import { type CSSStyle, reactStyle } from './style.js'
@@ -19,25 +20,53 @@
19
20
  className,
20
21
  }: PresenceDotProps = $props()
21
22
 
22
- const STATUS_COLOR: Record<PresenceStatus, string> = {
23
- online: '#22c55e',
24
- away: '#eab308',
25
- busy: '#ef4444',
26
- offline: '#94a3b8',
27
- }
28
-
29
23
  const cm = $derived(getClassMap())
30
- const label = $derived(ariaLabel ?? `Presence: ${status}`)
24
+ // The dot's fill is the theme's colour for the state, never a hardcoded hex:
25
+ // online/away/busy are the solid success/warning/error tones —
26
+ // `cm.progressColor`, the solid tone fill the package's app-ui peer floor
27
+ // (^1.0.1) already declares (`bgTone` is newer and would raise that floor) —
28
+ // offline the theme's neutral border grey.
29
+ const statusClass: Record<PresenceStatus, string> = $derived({
30
+ online: cm.progressColor('success'),
31
+ away: cm.progressColor('warning'),
32
+ busy: cm.progressColor('error'),
33
+ offline: cm.bgBorder,
34
+ })
35
+ const { t } = useTranslation()
36
+ // One literal `t()` call per status value: a runtime-built key is invisible
37
+ // to molecule's i18n gate. Every `presenceIndicator.status.*` key ships in
38
+ // the `@molecule/app-locales-presence-indicator` bond.
39
+ const statusWord = $derived.by(() => {
40
+ switch (status) {
41
+ case 'online':
42
+ return t('presenceIndicator.status.online', undefined, { defaultValue: 'online' })
43
+ case 'away':
44
+ return t('presenceIndicator.status.away', undefined, { defaultValue: 'away' })
45
+ case 'busy':
46
+ return t('presenceIndicator.status.busy', undefined, { defaultValue: 'busy' })
47
+ case 'offline':
48
+ return t('presenceIndicator.status.offline', undefined, { defaultValue: 'offline' })
49
+ }
50
+ })
51
+ const label = $derived(
52
+ ariaLabel ??
53
+ t(
54
+ 'presenceIndicator.aria.presence',
55
+ { status: statusWord },
56
+ {
57
+ defaultValue: 'Presence: {{status}}',
58
+ },
59
+ ),
60
+ )
31
61
  const style = $derived.by((): CSSStyle => {
32
62
  const styles: CSSStyle = {
33
63
  display: 'inline-block',
34
64
  width: `${size}px`,
35
65
  height: `${size}px`,
36
66
  borderRadius: '50%',
37
- background: STATUS_COLOR[status],
38
67
  }
39
68
  if (position === 'overlay') {
40
- styles.boxShadow = '0 0 0 2px var(--color-surface, #fff)'
69
+ styles.boxShadow = '0 0 0 2px var(--color-surface)'
41
70
  styles.position = 'absolute'
42
71
  if (corner.includes('top')) styles.top = '0px'
43
72
  if (corner.includes('bottom')) styles.bottom = '0px'
@@ -48,4 +77,9 @@
48
77
  })
49
78
  </script>
50
79
 
51
- <span role="status" aria-label={label} class={cm.cn(className)} use:reactStyle={style}></span>
80
+ <span
81
+ role="status"
82
+ aria-label={label}
83
+ class={cm.cn(statusClass[status], className)}
84
+ use:reactStyle={style}
85
+ ></span>
@@ -1 +1 @@
1
- {"version":3,"file":"PresenceDot.svelte.d.ts","sourceRoot":"","sources":["../src/PresenceDot.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,YAAY,CAAC;AAmDnE,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"PresenceDot.svelte.d.ts","sourceRoot":"","sources":["../src/PresenceDot.svelte"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,YAAY,CAAC;AAgFnE,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
package/dist/types.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface PresenceDotProps {
16
16
  position?: 'inline' | 'overlay';
17
17
  /** Overlay corner when `position="overlay"`. Defaults to `'bottom-right'`. */
18
18
  corner?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
19
- /** Accessible label override. Defaults to `Presence: <status>`. */
19
+ /** Accessible label override; defaults to `t('presenceIndicator.aria.presence', …)`. */
20
20
  ariaLabel?: string;
21
21
  /** Extra classes. */
22
22
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAA;IACtB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAA;IACtB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CAAA;IAClE,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-presence-indicator-svelte",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Online/offline dot + presence overlay for avatars and user chips",
5
5
  "homepage": "https://www.molecule.dev/packages/app-presence-indicator-svelte",
6
6
  "type": "module",
@@ -57,13 +57,13 @@
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.7.1",
61
- "@molecule/app-ui": "1.4.0",
62
- "@molecule/app-ui-svelte": "1.1.5",
60
+ "@molecule/app-svelte": "3.13.0",
61
+ "@molecule/app-ui": "1.5.0",
62
+ "@molecule/app-ui-svelte": "1.4.1",
63
63
  "@sveltejs/package": "3.0.2",
64
64
  "@sveltejs/vite-plugin-svelte": "7.1.2",
65
65
  "@types/node": "26.6.5",
66
- "jsdom": "30.1.3",
66
+ "jsdom": "31.0.1",
67
67
  "svelte": "5.57.2",
68
68
  "svelte-check": "4.7.7",
69
69
  "typescript": "6.0.3",