@quazardous/qdadm 2.51.0 → 2.53.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.
Files changed (129) hide show
  1. package/dist/node/cards/tools/cardsTool.d.ts +32 -0
  2. package/dist/node/cards/tools/cardsTool.js +151 -0
  3. package/dist/node/cards/tools/cli.d.ts +2 -0
  4. package/dist/node/cards/tools/cli.js +38 -0
  5. package/dist/node/cards/validate.d.ts +35 -0
  6. package/dist/node/cards/validate.js +94 -0
  7. package/dist/styles/qdadm.css +1 -1
  8. package/package.json +7 -2
  9. package/src/board/QdBoardBlock.vue +67 -0
  10. package/src/board/QdDomainBoard.vue +64 -0
  11. package/src/board/blocks/BreakdownBlock.vue +44 -0
  12. package/src/board/blocks/KpiBlock.vue +31 -0
  13. package/src/board/blocks/TimelineBlock.vue +63 -0
  14. package/src/board/blocks/TopBlock.vue +57 -0
  15. package/src/board/blocks/schemas.ts +107 -0
  16. package/src/board/index.ts +31 -0
  17. package/src/board/registry.ts +33 -0
  18. package/src/board/types.ts +32 -0
  19. package/src/cards/QdCard.vue +175 -0
  20. package/src/cards/QdCardView.vue +53 -0
  21. package/src/cards/QdCardsGallery.vue +103 -0
  22. package/src/cards/QdFavoritesCard.vue +50 -0
  23. package/src/cards/QdRecentCard.vue +44 -0
  24. package/src/cards/builtin/agenda/AgendaCard.vue +37 -0
  25. package/src/cards/builtin/agenda/meta.json +60 -0
  26. package/src/cards/builtin/agenda/schema.json +48 -0
  27. package/src/cards/builtin/bullet/BulletCard.vue +76 -0
  28. package/src/cards/builtin/bullet/meta.json +38 -0
  29. package/src/cards/builtin/bullet/schema.json +18 -0
  30. package/src/cards/builtin/cards-index.json +1694 -0
  31. package/src/cards/builtin/compare/CompareCard.vue +47 -0
  32. package/src/cards/builtin/compare/meta.json +79 -0
  33. package/src/cards/builtin/compare/schema.json +40 -0
  34. package/src/cards/builtin/favorites/FavoritesCard.vue +50 -0
  35. package/src/cards/builtin/favorites/meta.json +33 -0
  36. package/src/cards/builtin/favorites/schema.json +20 -0
  37. package/src/cards/builtin/feed/FeedCard.vue +39 -0
  38. package/src/cards/builtin/feed/meta.json +64 -0
  39. package/src/cards/builtin/feed/schema.json +54 -0
  40. package/src/cards/builtin/funnel/FunnelCard.vue +44 -0
  41. package/src/cards/builtin/funnel/meta.json +53 -0
  42. package/src/cards/builtin/funnel/schema.json +37 -0
  43. package/src/cards/builtin/goal/GoalCard.vue +73 -0
  44. package/src/cards/builtin/goal/meta.json +43 -0
  45. package/src/cards/builtin/goal/schema.json +12 -0
  46. package/src/cards/builtin/heat/HeatCard.vue +46 -0
  47. package/src/cards/builtin/heat/meta.json +101 -0
  48. package/src/cards/builtin/heat/schema.json +39 -0
  49. package/src/cards/builtin/index.ts +71 -0
  50. package/src/cards/builtin/metric/MetricCard.vue +82 -0
  51. package/src/cards/builtin/metric/meta.json +109 -0
  52. package/src/cards/builtin/metric/schema.json +35 -0
  53. package/src/cards/builtin/pills.ts +36 -0
  54. package/src/cards/builtin/queue/QueueCard.vue +65 -0
  55. package/src/cards/builtin/queue/meta.json +47 -0
  56. package/src/cards/builtin/queue/schema.json +32 -0
  57. package/src/cards/builtin/ranking/RankingCard.vue +37 -0
  58. package/src/cards/builtin/ranking/meta.json +71 -0
  59. package/src/cards/builtin/ranking/schema.json +35 -0
  60. package/src/cards/builtin/recent/RecentCard.vue +41 -0
  61. package/src/cards/builtin/recent/meta.json +32 -0
  62. package/src/cards/builtin/recent/schema.json +21 -0
  63. package/src/cards/builtin/shared.ts +83 -0
  64. package/src/cards/builtin/split/SplitCard.vue +52 -0
  65. package/src/cards/builtin/split/meta.json +72 -0
  66. package/src/cards/builtin/split/schema.json +40 -0
  67. package/src/cards/builtin/trend/TrendCard.vue +75 -0
  68. package/src/cards/builtin/trend/meta.json +81 -0
  69. package/src/cards/builtin/trend/schema.json +58 -0
  70. package/src/cards/index.ts +29 -0
  71. package/src/cards/registry.ts +57 -0
  72. package/src/cards/tools/cardsTool.ts +181 -0
  73. package/src/cards/tools/cli.ts +35 -0
  74. package/src/cards/types.ts +111 -0
  75. package/src/cards/validate.ts +111 -0
  76. package/src/components/edit/FormActions.vue +9 -5
  77. package/src/components/edit/FormPage.vue +17 -2
  78. package/src/components/layout/AppLayout.vue +4 -0
  79. package/src/components/layout/BaseLayout.vue +4 -0
  80. package/src/components/layout/CardParamsForm.vue +157 -0
  81. package/src/components/layout/CardsDashboard.vue +276 -57
  82. package/src/components/layout/PageHeader.vue +22 -1
  83. package/src/components/layout/QdFavoriteStar.vue +71 -0
  84. package/src/components/layout/Zone.vue +2 -1
  85. package/src/components/lists/ListPage.vue +9 -1
  86. package/src/components/lists/QdSaveSearch.vue +79 -0
  87. package/src/components/pages/NotFoundPage.vue +5 -2
  88. package/src/components/run/QdRunBar.vue +99 -0
  89. package/src/components/show/ShowPage.vue +10 -1
  90. package/src/composables/useBreadcrumb.ts +1 -1
  91. package/src/composables/useCardsArrangement.ts +297 -27
  92. package/src/composables/useEntityItemFormPage.ts +39 -3
  93. package/src/composables/useEntityItemFormPage.types.ts +8 -0
  94. package/src/composables/useEntityItemShowPage.ts +22 -0
  95. package/src/composables/useListPage.ts +71 -0
  96. package/src/composables/useListPage.types.ts +6 -0
  97. package/src/composables/useUnsavedChangesGuard.ts +17 -1
  98. package/src/domain/QdBadge.vue +36 -0
  99. package/src/domain/QdDomainBar.vue +213 -0
  100. package/src/domain/QdDomainBarZone.vue +19 -0
  101. package/src/domain/index.ts +6 -0
  102. package/src/domain/registry.ts +122 -0
  103. package/src/favorites/index.ts +7 -0
  104. package/src/favorites/store.ts +172 -0
  105. package/src/favorites/useFavorites.ts +217 -0
  106. package/src/i18n/defaults/core.en.generated.ts +132 -0
  107. package/src/i18n/defaults/core.en.yml +132 -0
  108. package/src/i18n/defaults/core.fr.generated.ts +132 -0
  109. package/src/i18n/defaults/core.fr.yml +132 -0
  110. package/src/index.ts +23 -0
  111. package/src/kernel/Kernel.routing.ts +4 -15
  112. package/src/kernel/Kernel.types.ts +5 -1
  113. package/src/kernel/Kernel.vue.ts +2 -2
  114. package/src/kernel/KernelContext.routing.ts +10 -1
  115. package/src/kernel/KernelContext.ts +7 -0
  116. package/src/kernel/KernelContext.types.ts +2 -0
  117. package/src/kernel/homeRoute.ts +45 -0
  118. package/src/module/moduleRegistry.ts +4 -0
  119. package/src/run/index.ts +6 -0
  120. package/src/run/run.ts +162 -0
  121. package/src/run/useRun.ts +207 -0
  122. package/src/styles/_cards-dashboard.scss +190 -0
  123. package/src/styles/_qd-board.scss +359 -0
  124. package/src/styles/_qd-cards.scss +1197 -0
  125. package/src/styles/_qd-domain-bar.scss +159 -0
  126. package/src/styles/_qd-run.scss +135 -0
  127. package/src/styles/index.scss +4 -0
  128. package/src/zones/ZoneRegistry.ts +16 -0
  129. package/src/zones/index.ts +1 -0
@@ -0,0 +1,43 @@
1
+ {
2
+ "type": "goal",
3
+ "title": "Goal",
4
+ "question": "Am I on time?",
5
+ "readings": [
6
+ "the big number and \"of 600 k€\": where it stands against the target",
7
+ "the bar's length: the share of the target reached",
8
+ "the tick on the bar: where the expected pace says it should be today",
9
+ "the words under it: the share reached, the expected share, ahead or behind"
10
+ ],
11
+ "strengths": [
12
+ "says at once whether the period will end on target",
13
+ "the pace makes a mid-month number readable"
14
+ ],
15
+ "avoid": [
16
+ "without a period (start and due): use bullet, which reads a value against a target and ranges",
17
+ "when the target moves every day: use metric"
18
+ ],
19
+ "sizes": ["s", "m"],
20
+ "options": {
21
+ "unit": { "type": "string", "description": "Written after the value and the target: \"k€\"" },
22
+ "decimals": { "type": "integer", "minimum": 0, "maximum": 4, "default": 0, "description": "Digits after the decimal point" }
23
+ },
24
+ "action": "mode list: open what is left to win (the open quotes, the late orders)",
25
+ "example": {
26
+ "envelope": {
27
+ "title": "Revenue this month (excl. tax)",
28
+ "status": "good",
29
+ "source": "sales",
30
+ "freshness": "2026-11-19T08:00:00Z",
31
+ "to": "/sales",
32
+ "size": "s"
33
+ },
34
+ "data": {
35
+ "value": 412,
36
+ "target": 600,
37
+ "start": "2026-11-01",
38
+ "due": "2026-11-30",
39
+ "now": "2026-11-19"
40
+ },
41
+ "options": { "unit": "k€" }
42
+ }
43
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "type": "object",
3
+ "required": ["value", "target"],
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "value": { "type": "number", "description": "Reached so far" },
7
+ "target": { "type": "number", "minimum": 0, "description": "The target of the period" },
8
+ "start": { "type": "string", "description": "The period's first day (ISO date)" },
9
+ "due": { "type": "string", "description": "The period's last day (ISO date)" },
10
+ "now": { "type": "string", "description": "Today, when it is not the browser's (ISO date)" }
11
+ }
12
+ }
@@ -0,0 +1,46 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * heat - when? (#5355)
4
+ *
5
+ * A grid (days × hours, weeks × days): each cell's shade is its value on a
6
+ * sequential scale of five steps, its value in its title and for screen
7
+ * readers; a legend gives the scale. See meta.json for the sheet.
8
+ */
9
+ import { computed } from 'vue'
10
+ import { useI18n } from '../../../i18n/useI18n'
11
+ import { formatNumber } from '../shared'
12
+ import type { CardSize } from '../../types'
13
+
14
+ const props = defineProps<{ data: { columns: string[]; rows: Array<{ label: string; cells: number[] }> }; options: Record<string, never>; size: CardSize }>()
15
+ const { t, locale } = useI18n()
16
+
17
+ const max = computed(() => Math.max(0, ...props.data.rows.flatMap((r) => r.cells)))
18
+ const level = (v: number) => (max.value ? Math.min(4, Math.round((v / max.value) * 4)) : 0)
19
+ const fmt = (v: number) => formatNumber(v, locale.value)
20
+ </script>
21
+
22
+ <template>
23
+ <div class="qd-heat">
24
+ <table>
25
+ <thead>
26
+ <tr>
27
+ <td></td>
28
+ <th v-for="c in data.columns" :key="c" scope="col">{{ c }}</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr v-for="r in data.rows" :key="r.label">
33
+ <th scope="row">{{ r.label }}</th>
34
+ <td v-for="(v, i) in r.cells" :key="i" :data-level="level(v)" :title="`${r.label} · ${data.columns[i] ?? ''}: ${fmt(v)}`">
35
+ <span class="qd-card-sr">{{ fmt(v) }}</span>
36
+ </td>
37
+ </tr>
38
+ </tbody>
39
+ </table>
40
+ <div class="qd-heat-legend" aria-hidden="true">
41
+ <span>{{ t('core.cards.heat.low') }}</span>
42
+ <span v-for="l in 5" :key="l" class="qd-heat-key" :data-level="l - 1"></span>
43
+ <span>{{ t('core.cards.heat.high', { max: fmt(max) }) }}</span>
44
+ </div>
45
+ </div>
46
+ </template>
@@ -0,0 +1,101 @@
1
+ {
2
+ "type": "heat",
3
+ "title": "Heat",
4
+ "question": "When?",
5
+ "readings": [
6
+ "the grid: rows and columns (days × hours, weeks × days)",
7
+ "each cell's shade: its value on a sequential scale, from the lightest to the darkest",
8
+ "the legend: what the lightest and the darkest mean; each cell gives its value in its title too"
9
+ ],
10
+ "strengths": [
11
+ "the busy hours of a week at a glance",
12
+ "patterns a curve hides"
13
+ ],
14
+ "avoid": [
15
+ "for exact values: use a ranking or a table",
16
+ "for one series over time: use trend"
17
+ ],
18
+ "sizes": [
19
+ "m",
20
+ "l"
21
+ ],
22
+ "options": {},
23
+ "action": "mode list: the items of a busy cell",
24
+ "example": {
25
+ "envelope": {
26
+ "title": "Orders by hour",
27
+ "status": "info",
28
+ "source": "shop",
29
+ "to": "/orders",
30
+ "size": "m"
31
+ },
32
+ "data": {
33
+ "columns": [
34
+ "8h",
35
+ "10h",
36
+ "12h",
37
+ "14h",
38
+ "16h",
39
+ "18h"
40
+ ],
41
+ "rows": [
42
+ {
43
+ "label": "Mon",
44
+ "cells": [
45
+ 3,
46
+ 8,
47
+ 12,
48
+ 9,
49
+ 7,
50
+ 4
51
+ ]
52
+ },
53
+ {
54
+ "label": "Tue",
55
+ "cells": [
56
+ 2,
57
+ 9,
58
+ 14,
59
+ 10,
60
+ 8,
61
+ 5
62
+ ]
63
+ },
64
+ {
65
+ "label": "Wed",
66
+ "cells": [
67
+ 4,
68
+ 7,
69
+ 11,
70
+ 12,
71
+ 6,
72
+ 3
73
+ ]
74
+ },
75
+ {
76
+ "label": "Thu",
77
+ "cells": [
78
+ 3,
79
+ 10,
80
+ 15,
81
+ 11,
82
+ 9,
83
+ 6
84
+ ]
85
+ },
86
+ {
87
+ "label": "Fri",
88
+ "cells": [
89
+ 5,
90
+ 12,
91
+ 18,
92
+ 13,
93
+ 11,
94
+ 2
95
+ ]
96
+ }
97
+ ]
98
+ },
99
+ "options": {}
100
+ }
101
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "type": "object",
3
+ "required": [
4
+ "columns",
5
+ "rows"
6
+ ],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "columns": {
10
+ "type": "array",
11
+ "items": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "rows": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "required": [
20
+ "label",
21
+ "cells"
22
+ ],
23
+ "additionalProperties": false,
24
+ "properties": {
25
+ "label": {
26
+ "type": "string"
27
+ },
28
+ "cells": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "number",
32
+ "minimum": 0
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * qdadm's generic cards (#5339): no business in them, only shapes of data.
3
+ * Each folder holds its sheet (meta.json), its schema (schema.json) and its
4
+ * body; the node tooling reads the same files for the index and the bestiary.
5
+ */
6
+ import { registerCard } from '../registry'
7
+ import type { CardMeta } from '../types'
8
+ import type { CardSchema } from '../validate'
9
+ import MetricCard from './metric/MetricCard.vue'
10
+ import metricMeta from './metric/meta.json'
11
+ import metricSchema from './metric/schema.json'
12
+ import QueueCard from './queue/QueueCard.vue'
13
+ import queueMeta from './queue/meta.json'
14
+ import queueSchema from './queue/schema.json'
15
+ import GoalCard from './goal/GoalCard.vue'
16
+ import goalMeta from './goal/meta.json'
17
+ import goalSchema from './goal/schema.json'
18
+ import BulletCard from './bullet/BulletCard.vue'
19
+ import bulletMeta from './bullet/meta.json'
20
+ import bulletSchema from './bullet/schema.json'
21
+ import CompareCard from './compare/CompareCard.vue'
22
+ import compareMeta from './compare/meta.json'
23
+ import compareSchema from './compare/schema.json'
24
+ import TrendCard from './trend/TrendCard.vue'
25
+ import trendMeta from './trend/meta.json'
26
+ import trendSchema from './trend/schema.json'
27
+ import RankingCard from './ranking/RankingCard.vue'
28
+ import rankingMeta from './ranking/meta.json'
29
+ import rankingSchema from './ranking/schema.json'
30
+ import SplitCard from './split/SplitCard.vue'
31
+ import splitMeta from './split/meta.json'
32
+ import splitSchema from './split/schema.json'
33
+ import FunnelCard from './funnel/FunnelCard.vue'
34
+ import funnelMeta from './funnel/meta.json'
35
+ import funnelSchema from './funnel/schema.json'
36
+ import HeatCard from './heat/HeatCard.vue'
37
+ import heatMeta from './heat/meta.json'
38
+ import heatSchema from './heat/schema.json'
39
+ import AgendaCard from './agenda/AgendaCard.vue'
40
+ import agendaMeta from './agenda/meta.json'
41
+ import agendaSchema from './agenda/schema.json'
42
+ import FeedCard from './feed/FeedCard.vue'
43
+ import feedMeta from './feed/meta.json'
44
+ import feedSchema from './feed/schema.json'
45
+ import FavoritesCard from './favorites/FavoritesCard.vue'
46
+ import favoritesMeta from './favorites/meta.json'
47
+ import favoritesSchema from './favorites/schema.json'
48
+ import RecentCard from './recent/RecentCard.vue'
49
+ import { PILLS } from './pills'
50
+ import recentMeta from './recent/meta.json'
51
+ import recentSchema from './recent/schema.json'
52
+
53
+ /** qdadm's card types, in the bestiary's order */
54
+ export const BUILTIN_CARDS = ['metric', 'queue', 'goal', 'bullet', 'compare', 'trend', 'ranking', 'split', 'funnel', 'heat', 'agenda', 'feed', 'favorites', 'recent'] as const
55
+
56
+ export function registerBuiltinCards(): void {
57
+ registerCard({ type: 'metric', component: MetricCard, meta: metricMeta as CardMeta, schema: metricSchema as CardSchema, pill: PILLS.metric })
58
+ registerCard({ type: 'queue', component: QueueCard, meta: queueMeta as CardMeta, schema: queueSchema as CardSchema, pill: PILLS.queue })
59
+ registerCard({ type: 'goal', component: GoalCard, meta: goalMeta as CardMeta, schema: goalSchema as CardSchema, pill: PILLS.goal })
60
+ registerCard({ type: 'bullet', component: BulletCard, meta: bulletMeta as CardMeta, schema: bulletSchema as CardSchema })
61
+ registerCard({ type: 'compare', component: CompareCard, meta: compareMeta as CardMeta, schema: compareSchema as CardSchema, pill: PILLS.compare })
62
+ registerCard({ type: 'trend', component: TrendCard, meta: trendMeta as CardMeta, schema: trendSchema as CardSchema })
63
+ registerCard({ type: 'ranking', component: RankingCard, meta: rankingMeta as CardMeta, schema: rankingSchema as CardSchema })
64
+ registerCard({ type: 'split', component: SplitCard, meta: splitMeta as CardMeta, schema: splitSchema as CardSchema, pill: PILLS.split })
65
+ registerCard({ type: 'funnel', component: FunnelCard, meta: funnelMeta as CardMeta, schema: funnelSchema as CardSchema })
66
+ registerCard({ type: 'heat', component: HeatCard, meta: heatMeta as CardMeta, schema: heatSchema as CardSchema })
67
+ registerCard({ type: 'agenda', component: AgendaCard, meta: agendaMeta as CardMeta, schema: agendaSchema as CardSchema })
68
+ registerCard({ type: 'feed', component: FeedCard, meta: feedMeta as CardMeta, schema: feedSchema as CardSchema })
69
+ registerCard({ type: 'favorites', component: FavoritesCard, meta: favoritesMeta as CardMeta, schema: favoritesSchema as CardSchema })
70
+ registerCard({ type: 'recent', component: RecentCard, meta: recentMeta as CardMeta, schema: recentSchema as CardSchema })
71
+ }
@@ -0,0 +1,82 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * metric - how many, and is it going up? (#5339)
4
+ *
5
+ * The value, its change over the period (sign + tone from `higherIs`), the
6
+ * recent curve with its last point, and the hot lines behind the number,
7
+ * each opening its item. See meta.json for the sheet.
8
+ */
9
+ import { computed } from 'vue'
10
+ import { RouterLink, type RouteLocationRaw } from 'vue-router'
11
+ import { useI18n } from '../../../i18n/useI18n'
12
+ import { formatNumber, formatDelta, seriesPaths, seriesPoints, deltaTone } from '../shared'
13
+ import type { CardSize, CardStatus } from '../../types'
14
+
15
+ interface MetricData {
16
+ value: number
17
+ label?: string
18
+ badge?: string
19
+ delta?: { value: number; period?: string }
20
+ series?: number[]
21
+ hot?: Array<{ label: string; tag?: string; tagStatus?: CardStatus; to?: RouteLocationRaw }>
22
+ }
23
+ interface MetricOptions {
24
+ unit?: string
25
+ decimals?: number
26
+ higherIs?: 'better' | 'worse' | 'neutral'
27
+ hotCount?: number
28
+ }
29
+
30
+ const props = defineProps<{ data: MetricData; options: MetricOptions; size: CardSize }>()
31
+ const { locale } = useI18n()
32
+
33
+ const W = 100
34
+ const H = 28
35
+ const value = computed(() => formatNumber(props.data.value, locale.value, { decimals: props.options.decimals, unit: props.options.unit }))
36
+ const delta = computed(() => {
37
+ const d = props.data.delta
38
+ if (!d) return null
39
+ return {
40
+ text: formatDelta(d.value, locale.value, props.options.decimals) + (props.options.unit ? `\u202f${props.options.unit}` : ''),
41
+ period: d.period,
42
+ tone: deltaTone(d.value, props.options.higherIs),
43
+ }
44
+ })
45
+ const paths = computed(() => seriesPaths(props.data.series ?? [], W, H))
46
+ const last = computed(() => {
47
+ const pts = seriesPoints(props.data.series ?? [], W, H)
48
+ const p = pts[pts.length - 1]
49
+ return p ? { left: `${p[0]}%`, top: `${(p[1] / H) * 100}%` } : null
50
+ })
51
+ const hot = computed(() => (props.data.hot ?? []).slice(0, props.options.hotCount ?? 2))
52
+ </script>
53
+
54
+ <template>
55
+ <div class="qd-metric">
56
+ <div class="qd-metric-line">
57
+ <span class="qd-card-value">{{ value }}</span>
58
+ <span v-if="data.label" class="qd-card-unit">{{ data.label }}</span>
59
+ <span v-if="data.badge" class="qd-card-badge">{{ data.badge }}</span>
60
+ <span v-if="delta" class="qd-card-delta" :class="`qd-tone--${delta.tone}`">
61
+ {{ delta.text }}<template v-if="delta.period"> / {{ delta.period }}</template>
62
+ </span>
63
+ </div>
64
+
65
+ <div v-if="paths.line" class="qd-metric-spark" aria-hidden="true">
66
+ <svg :viewBox="`0 0 ${W} ${H}`" preserveAspectRatio="none">
67
+ <path :d="paths.area" class="qd-spark-area" />
68
+ <path :d="paths.line" class="qd-spark-line" vector-effect="non-scaling-stroke" />
69
+ </svg>
70
+ <span v-if="last" class="qd-spark-dot" :style="last"></span>
71
+ </div>
72
+
73
+ <ul v-if="hot.length" class="qd-card-hot">
74
+ <li v-for="(item, i) in hot" :key="i">
75
+ <component :is="item.to ? RouterLink : 'span'" :to="item.to" class="qd-card-hot-line">
76
+ <span class="qd-card-hot-label">{{ item.label }}</span>
77
+ <span v-if="item.tag" class="qd-card-tag" :class="item.tagStatus ? `qd-tone--${item.tagStatus}` : null">{{ item.tag }}</span>
78
+ </component>
79
+ </li>
80
+ </ul>
81
+ </div>
82
+ </template>
@@ -0,0 +1,109 @@
1
+ {
2
+ "type": "metric",
3
+ "title": "Metric",
4
+ "question": "How many, and is it going up?",
5
+ "readings": [
6
+ "the big number: the value now",
7
+ "the change chip: how much it moved over the period, its sign and its tone (good or bad news, from higherIs)",
8
+ "the curve: the recent series, the last point marked",
9
+ "the hot lines: the few items behind the number that need a look, each one opening its item"
10
+ ],
11
+ "strengths": [
12
+ "one glance gives the level and the direction",
13
+ "the hot lines lead straight to the items that matter",
14
+ "fits the smallest size"
15
+ ],
16
+ "avoid": [
17
+ "when the number only means something against a target: use goal or bullet",
18
+ "when the point is a list of things to process, one gesture each: use queue",
19
+ "when several values compete: use a ranking or a split"
20
+ ],
21
+ "sizes": [
22
+ "s",
23
+ "m",
24
+ "l"
25
+ ],
26
+ "options": {
27
+ "unit": {
28
+ "type": "string",
29
+ "description": "Written after the value and the change: \"%\", \"k€\""
30
+ },
31
+ "decimals": {
32
+ "type": "integer",
33
+ "minimum": 0,
34
+ "maximum": 4,
35
+ "default": 0,
36
+ "description": "Digits after the decimal point"
37
+ },
38
+ "higherIs": {
39
+ "type": "string",
40
+ "enum": [
41
+ "better",
42
+ "worse",
43
+ "neutral"
44
+ ],
45
+ "default": "better",
46
+ "description": "Whether a rise is good news (sales) or bad news (open returns)"
47
+ },
48
+ "hotCount": {
49
+ "type": "integer",
50
+ "minimum": 0,
51
+ "maximum": 5,
52
+ "default": 2,
53
+ "description": "How many hot lines to show"
54
+ }
55
+ },
56
+ "action": "mode next: open the most urgent of the items behind the number (\"Process the 1st\")",
57
+ "example": {
58
+ "envelope": {
59
+ "title": "Orders to process",
60
+ "status": "critical",
61
+ "source": "shop",
62
+ "freshness": "2026-11-19T09:57:00Z",
63
+ "to": "/orders",
64
+ "action": {
65
+ "verb": "Process the 1st",
66
+ "count": 14,
67
+ "mode": "next",
68
+ "to": "/orders/575806"
69
+ },
70
+ "size": "s"
71
+ },
72
+ "data": {
73
+ "value": 14,
74
+ "label": "orders",
75
+ "badge": "5 urgent",
76
+ "delta": {
77
+ "value": 4,
78
+ "period": "week"
79
+ },
80
+ "series": [
81
+ 9,
82
+ 10,
83
+ 8,
84
+ 11,
85
+ 10,
86
+ 12,
87
+ 14
88
+ ],
89
+ "hot": [
90
+ {
91
+ "label": "575806 · Amazon · ships tonight",
92
+ "tag": "urgent",
93
+ "tagStatus": "critical",
94
+ "to": "/orders/575806"
95
+ },
96
+ {
97
+ "label": "City of Lyon · 24 k€ · transfer",
98
+ "tag": "approve",
99
+ "tagStatus": "watch",
100
+ "to": "/orders/575811"
101
+ }
102
+ ]
103
+ },
104
+ "options": {
105
+ "higherIs": "worse",
106
+ "hotCount": 2
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "type": "object",
3
+ "required": ["value"],
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "value": { "type": "number", "description": "The value now" },
7
+ "label": { "type": "string", "description": "What is counted, after the value: \"orders\"" },
8
+ "badge": { "type": "string", "description": "A short word beside the value, in the card's status tone: \"5 urgent\"" },
9
+ "delta": {
10
+ "type": "object",
11
+ "required": ["value"],
12
+ "additionalProperties": false,
13
+ "properties": {
14
+ "value": { "type": "number", "description": "The change over the period, signed" },
15
+ "period": { "type": "string", "description": "The period: \"week\", \"vs yesterday\"" }
16
+ }
17
+ },
18
+ "series": { "type": "array", "items": { "type": "number" }, "description": "The recent values, oldest first" },
19
+ "hot": {
20
+ "type": "array",
21
+ "description": "The items behind the number that need a look",
22
+ "items": {
23
+ "type": "object",
24
+ "required": ["label"],
25
+ "additionalProperties": false,
26
+ "properties": {
27
+ "label": { "type": "string" },
28
+ "tag": { "type": "string", "description": "A short word on the right: \"urgent\"" },
29
+ "tagStatus": { "type": "string", "enum": ["critical", "watch", "good", "info"] },
30
+ "to": { "type": ["string", "object"], "description": "The item's route" }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The pill form of the generic cards (#5389): the one figure the domain bar
3
+ * keeps of each, and the count its badge shows.
4
+ */
5
+ import type { CardPill } from '../types'
6
+ import { formatNumber } from './shared'
7
+
8
+ type Opts = Record<string, unknown>
9
+ const fmt = (n: number, o: Opts, locale: string): string =>
10
+ formatNumber(n, locale, { decimals: typeof o.decimals === 'number' ? o.decimals : undefined, unit: typeof o.unit === 'string' ? o.unit : undefined })
11
+ const count = (n: unknown): number | null => (typeof n === 'number' && Number.isFinite(n) ? n : null)
12
+
13
+ export const PILLS: Record<string, (data: unknown, options: Opts, locale: string) => CardPill> = {
14
+ metric: (d, o, l) => {
15
+ const v = (d as { value: number }).value
16
+ return { value: fmt(v, o, l), count: count(v) }
17
+ },
18
+ queue: (d, _o, l) => {
19
+ const q = d as { total?: number; items: unknown[] }
20
+ const n = q.total ?? q.items.length
21
+ return { value: formatNumber(n, l), count: n }
22
+ },
23
+ goal: (d, o, l) => {
24
+ const g = d as { value: number; target: number }
25
+ return { value: `${fmt(g.value, o, l)} / ${fmt(g.target, o, l)}`, count: null }
26
+ },
27
+ compare: (d, o, l) => {
28
+ const v = (d as { now: { value: number } }).now.value
29
+ return { value: fmt(v, o, l), count: null }
30
+ },
31
+ split: (d, o, l) => {
32
+ const s = d as { total?: number; parts: Array<{ value: number }> }
33
+ const n = s.total ?? s.parts.reduce((sum, p) => sum + p.value, 0)
34
+ return { value: fmt(n, o, l), count: count(n) }
35
+ },
36
+ }
@@ -0,0 +1,65 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * queue - what do I have to do? (#5339)
4
+ *
5
+ * How many wait, then one line per item, each with its gesture. The
6
+ * background under a line advances with its age against the promised delay,
7
+ * warmer as it nears it; the age is written too, so warmth is never alone.
8
+ * See meta.json for the sheet.
9
+ */
10
+ import { computed } from 'vue'
11
+ import { RouterLink, type RouteLocationRaw } from 'vue-router'
12
+ import { useI18n } from '../../../i18n/useI18n'
13
+ import { formatNumber } from '../shared'
14
+ import type { CardSize } from '../../types'
15
+
16
+ interface QueueItem {
17
+ label: string
18
+ age?: number
19
+ due?: number
20
+ to?: RouteLocationRaw
21
+ action?: { verb: string; to: RouteLocationRaw }
22
+ }
23
+ interface QueueData {
24
+ total?: number
25
+ note?: string
26
+ items: QueueItem[]
27
+ }
28
+
29
+ const props = defineProps<{ data: QueueData; options: { ageUnit?: 'min' | 'h' | 'd'; maxItems?: number }; size: CardSize }>()
30
+ const { t, locale } = useI18n()
31
+
32
+ const total = computed(() => props.data.total ?? props.data.items.length)
33
+ const unit = computed(() => t(`core.cards.ageUnit.${props.options.ageUnit ?? 'd'}`))
34
+
35
+ const lines = computed(() =>
36
+ props.data.items.slice(0, props.options.maxItems ?? 3).map((item) => {
37
+ const ratio = item.age !== undefined && item.due ? item.age / item.due : null
38
+ return {
39
+ ...item,
40
+ fill: ratio === null ? 0 : Math.min(ratio, 1) * 100,
41
+ warmth: ratio === null ? 'none' : ratio >= 1 ? 'overdue' : ratio >= 0.6 ? 'warm' : 'cool',
42
+ ageText: item.age === undefined ? null : `${formatNumber(item.age, locale.value, { decimals: 0 })}\u202f${unit.value}`,
43
+ }
44
+ })
45
+ )
46
+ </script>
47
+
48
+ <template>
49
+ <div class="qd-queue">
50
+ <div class="qd-metric-line">
51
+ <span class="qd-card-value">{{ formatNumber(total, locale) }}</span>
52
+ <span v-if="data.note" class="qd-card-unit">{{ data.note }}</span>
53
+ </div>
54
+ <ul class="qd-queue-items">
55
+ <li v-for="(line, i) in lines" :key="i" class="qd-queue-item" :data-warmth="line.warmth">
56
+ <span class="qd-queue-age-bg" :style="{ width: `${line.fill}%` }" aria-hidden="true"></span>
57
+ <component :is="line.to ? RouterLink : 'span'" :to="line.to" class="qd-queue-label">{{ line.label }}</component>
58
+ <span v-if="line.ageText" class="qd-queue-age" :title="line.warmth === 'overdue' ? t('core.cards.overdue') : undefined">
59
+ {{ line.ageText }}<span v-if="line.warmth === 'overdue'" class="qd-card-sr"> · {{ t('core.cards.overdue') }}</span>
60
+ </span>
61
+ <RouterLink v-if="line.action" :to="line.action.to" class="qd-queue-gesture">{{ line.action.verb }}</RouterLink>
62
+ </li>
63
+ </ul>
64
+ </div>
65
+ </template>