@molecule/app-status-summary-svelte 0.0.1-stage → 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 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:57:00.655Z
6
+ Generated: 2026-11-21T12:47:27.699Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-status-summary-svelte
@@ -138,7 +138,7 @@ const StatusSummary: LegacyComponentType
138
138
  Peer dependencies:
139
139
 
140
140
  - `@molecule/app-svelte` ^3.5.0
141
- - `@molecule/app-ui` ^1.0.1
141
+ - `@molecule/app-ui` ^1.4.0
142
142
  - `@molecule/app-ui-svelte` ^1.1.0
143
143
  - `svelte` ^5.0.0
144
144
 
@@ -158,9 +158,9 @@ Peer dependencies:
158
158
  (green/yellow/orange/red/blue with white text) — they ignore the
159
159
  app theme and cannot be restyled via ClassMap; acceptable for
160
160
  status pages, but know they will not follow a rebrand.
161
- - Status labels use `status.operational` … `status.maintenance` i18n
162
- keys with English fallbacks; no locale bond currently ships these
163
- keys, so register your own translations if the app is multilingual.
161
+ - Status labels use the `status.operational` … `status.maintenance` i18n
162
+ keys, which the `common` locale bond ships in every language; the
163
+ English fallbacks in code match its en.ts.
164
164
  - `header` renders inside the overall banner (last-updated stamp,
165
165
  subscribe button); `footer` renders below the grid (incident list).
166
166
  Group and component names may be plain text or snippets.
@@ -3,34 +3,30 @@
3
3
  `StatusSummary` — grouped component list with colored badges and an overall
4
4
  banner derived from the worst child status. Same props, same DOM for the
5
5
  same input; `header` and `footer` are snippet slots, and a group or component
6
- name may be plain text or a snippet. The banner and badge colors are inline
7
- styles (React's fixed palette), and every label comes from the same i18n keys
6
+ name may be plain text or a snippet. The banner and badge colors come from
7
+ the ClassMap's semantic tones, and every label comes from the same i18n keys
8
8
  with the same English fallbacks.
9
9
  -->
10
10
  <script lang="ts">
11
11
  import type { Snippet } from 'svelte'
12
12
 
13
13
  import { useTranslation } from '@molecule/app-svelte'
14
+ import type { ColorVariant } from '@molecule/app-ui'
14
15
  import { getClassMap } from '@molecule/app-ui'
15
16
 
16
17
  import type { ComponentStatus, StatusSummaryProps } from './types.js'
17
18
 
18
- /** English label rendered for each status when no locale bond supplies the key. */
19
- const STATUS_LABEL: Record<ComponentStatus, string> = {
20
- operational: 'Operational',
21
- degraded: 'Degraded performance',
22
- 'partial-outage': 'Partial outage',
23
- 'major-outage': 'Major outage',
24
- maintenance: 'Under maintenance',
25
- }
26
-
27
- /** The fixed semantic hue of each status (React's inline-style palette). */
28
- const STATUS_COLOR: Record<ComponentStatus, string> = {
29
- operational: '#22c55e',
30
- degraded: '#eab308',
31
- 'partial-outage': '#f97316',
32
- 'major-outage': '#ef4444',
33
- maintenance: '#60a5fa',
19
+ /**
20
+ * The semantic tone colouring each status: the theme's success green for
21
+ * operational, its warning amber for degraded and partial outage, its error
22
+ * red for a major outage and its info blue for maintenance.
23
+ */
24
+ const STATUS_TONE: Record<ComponentStatus, ColorVariant> = {
25
+ operational: 'success',
26
+ degraded: 'warning',
27
+ 'partial-outage': 'warning',
28
+ 'major-outage': 'error',
29
+ maintenance: 'info',
34
30
  }
35
31
 
36
32
  /** The statuses from most to least severe (React's `worst` order). */
@@ -47,6 +43,28 @@
47
43
  const cm = $derived(getClassMap())
48
44
  const { t } = useTranslation()
49
45
 
46
+ /**
47
+ * The label for one status, through its literal i18n key with the English
48
+ * fallback (the same text the `common` locale bond's en.ts ships).
49
+ *
50
+ * @param status - The status to label.
51
+ * @returns The translated label.
52
+ */
53
+ function statusLabel(status: ComponentStatus): string {
54
+ switch (status) {
55
+ case 'operational':
56
+ return t('status.operational', {}, { defaultValue: 'Operational' })
57
+ case 'degraded':
58
+ return t('status.degraded', {}, { defaultValue: 'Degraded performance' })
59
+ case 'partial-outage':
60
+ return t('status.partial-outage', {}, { defaultValue: 'Partial outage' })
61
+ case 'major-outage':
62
+ return t('status.major-outage', {}, { defaultValue: 'Major outage' })
63
+ case 'maintenance':
64
+ return t('status.maintenance', {}, { defaultValue: 'Under maintenance' })
65
+ }
66
+ }
67
+
50
68
  /**
51
69
  * Returns the most severe status from an array of ComponentStatus values.
52
70
  *
@@ -75,20 +93,11 @@
75
93
  overallStatus ?? worst(groups.flatMap((group) => group.components.map((c) => c.status))),
76
94
  )
77
95
 
78
- /** The banner's inline style, in React's declaration order. */
79
- const bannerStyle = $derived(
80
- `background: ${STATUS_COLOR[overall]}; color: #fff; border-radius: 8px`,
81
- )
96
+ /** The banner's rounded corners, in React's declaration order. */
97
+ const bannerStyle = 'border-radius: 8px'
82
98
 
83
- /**
84
- * One badge's inline style, in React's declaration order.
85
- *
86
- * @param status - The component's status.
87
- * @returns The style attribute text.
88
- */
89
- function badgeStyle(status: ComponentStatus): string {
90
- return `border-radius: 4px; background: ${STATUS_COLOR[status]}; color: #fff`
91
- }
99
+ /** One badge's rounded corners, in React's declaration order. */
100
+ const badgeStyle = 'border-radius: 4px'
92
101
  </script>
93
102
 
94
103
  {#snippet field(value: Snippet | string | undefined)}
@@ -97,12 +106,15 @@
97
106
 
98
107
  <div class={cm.cn(cm.stack(4), className)}>
99
108
  <div
100
- class={cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'md' }), cm.sp('p', 3))}
109
+ class={cm.cn(
110
+ cm.flex({ align: 'center', justify: 'between', gap: 'md' }),
111
+ cm.sp('p', 3),
112
+ cm.bgTone(STATUS_TONE[overall]),
113
+ cm.textOnTone,
114
+ )}
101
115
  style={bannerStyle}
102
116
  >
103
- <span class={cm.cn(cm.textSize('lg'), cm.fontWeight('bold'))}
104
- >{t(`status.${overall}`, {}, { defaultValue: STATUS_LABEL[overall] })}</span
105
- >
117
+ <span class={cm.cn(cm.textSize('lg'), cm.fontWeight('bold'))}>{statusLabel(overall)}</span>
106
118
  {#if header}{@render header()}{/if}
107
119
  </div>
108
120
  {#each groups as group (group.id)}
@@ -121,15 +133,14 @@
121
133
  >{/if}
122
134
  </div>
123
135
  <span
124
- class={cm.cn(cm.sp('px', 2), cm.textSize('xs'), cm.fontWeight('semibold'))}
125
- style={badgeStyle(component.status)}
126
- >{t(
127
- `status.${component.status}`,
128
- {},
129
- {
130
- defaultValue: STATUS_LABEL[component.status],
131
- },
132
- )}</span
136
+ class={cm.cn(
137
+ cm.sp('px', 2),
138
+ cm.textSize('xs'),
139
+ cm.fontWeight('semibold'),
140
+ cm.bgTone(STATUS_TONE[component.status]),
141
+ cm.textOnTone,
142
+ )}
143
+ style={badgeStyle}>{statusLabel(component.status)}</span
133
144
  >
134
145
  </li>
135
146
  {/each}
@@ -1 +1 @@
1
- {"version":3,"file":"StatusSummary.svelte.d.ts","sourceRoot":"","sources":["../src/StatusSummary.svelte"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA4HtE,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"StatusSummary.svelte.d.ts","sourceRoot":"","sources":["../src/StatusSummary.svelte"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA0ItE,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
package/dist/index.d.ts CHANGED
@@ -43,9 +43,9 @@
43
43
  * (green/yellow/orange/red/blue with white text) — they ignore the
44
44
  * app theme and cannot be restyled via ClassMap; acceptable for
45
45
  * status pages, but know they will not follow a rebrand.
46
- * - Status labels use `status.operational` … `status.maintenance` i18n
47
- * keys with English fallbacks; no locale bond currently ships these
48
- * keys, so register your own translations if the app is multilingual.
46
+ * - Status labels use the `status.operational` … `status.maintenance` i18n
47
+ * keys, which the `common` locale bond ships in every language; the
48
+ * English fallbacks in code match its en.ts.
49
49
  * - `header` renders inside the overall banner (last-updated stamp,
50
50
  * subscribe button); `footer` renders below the grid (incident list).
51
51
  * Group and component names may be plain text or snippets.
package/dist/index.js CHANGED
@@ -43,9 +43,9 @@
43
43
  * (green/yellow/orange/red/blue with white text) — they ignore the
44
44
  * app theme and cannot be restyled via ClassMap; acceptable for
45
45
  * status pages, but know they will not follow a rebrand.
46
- * - Status labels use `status.operational` … `status.maintenance` i18n
47
- * keys with English fallbacks; no locale bond currently ships these
48
- * keys, so register your own translations if the app is multilingual.
46
+ * - Status labels use the `status.operational` … `status.maintenance` i18n
47
+ * keys, which the `common` locale bond ships in every language; the
48
+ * English fallbacks in code match its en.ts.
49
49
  * - `header` renders inside the overall banner (last-updated stamp,
50
50
  * subscribe button); `footer` renders below the grid (incident list).
51
51
  * Group and component names may be plain text or snippets.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-status-summary-svelte",
3
- "version": "0.0.1-stage",
3
+ "version": "1.1.1",
4
4
  "description": "Status-page summary: component grid with operational/degraded/outage badges + incident list",
5
5
  "homepage": "https://www.molecule.dev/packages/app-status-summary-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.4.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.1",
58
+ "@molecule/app-i18n": "1.2.2",
59
59
  "@molecule/app-icons": "1.0.4",
60
- "@molecule/app-svelte": "3.6.0",
61
- "@molecule/app-ui": "1.3.11",
62
- "@molecule/app-ui-svelte": "1.1.3",
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",