@7365admin1/layer-common 4.28.1-staging.359 → 4.28.1-staging.361

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.
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <!-- No reading renders nothing - never "0%". -->
3
+ <span v-if="reading" class="hero-battery" role="img" :aria-label="`Battery ${reading.text}`">
4
+ <span class="hero-battery__case" aria-hidden="true">
5
+ <span class="hero-battery__fill d-block" :class="`hero-tone--${reading.tone}`" :style="{ width: `${reading.pct}%` }" />
6
+ </span>
7
+ <span aria-hidden="true">{{ reading.text }}</span>
8
+ </span>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { computed } from "vue";
13
+ import { batteryReading } from "../../utils/robot-display";
14
+
15
+ /** `batteryPercent` from the robot's state; anything but a number renders nothing. */
16
+ const props = defineProps<{ value?: unknown }>();
17
+ const reading = computed(() => batteryReading(props.value));
18
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <!-- The header bell: open faults network-wide; accent while any are open. -->
3
+ <v-btn
4
+ variant="outlined"
5
+ class="hero-bell"
6
+ :class="{ 'hero-bell--on': count > 0 }"
7
+ :aria-label="`${count} open ${count === 1 ? 'fault' : 'faults'}`"
8
+ @click="emit('click')"
9
+ >
10
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
11
+ <path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
12
+ <path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
13
+ </svg>
14
+ <span>{{ count }}</span>
15
+ </v-btn>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ withDefaults(defineProps<{ count?: number }>(), { count: 0 });
20
+ const emit = defineEmits<{ click: [] }>();
21
+ </script>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <span class="hero-tag" :class="badge.variant === 'outline' ? 'hero-tag--outline' : 'hero-tag--neutral'">
3
+ <span :class="{ 'hero-tag--struck': badge.variant === 'struck' }">{{ badge.label }}</span>
4
+ </span>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { computed } from "vue";
9
+ import { capabilityBadge } from "../../utils/robot-display";
10
+
11
+ /** The brand's declared capabilities (`/robots/:id/state` or `/robots/brands`); the badge is their COMMAND level. */
12
+ const props = defineProps<{ capabilities?: Record<string, unknown> | null }>();
13
+ const badge = computed(() => capabilityBadge(props.capabilities));
14
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <!-- The compact robot card (mobile-like lists, Needs attention). -->
3
+ <article
4
+ class="hero-card"
5
+ :class="{ 'hero-card--click': clickable }"
6
+ :tabindex="clickable ? 0 : undefined"
7
+ :role="clickable ? 'button' : undefined"
8
+ @click="clickable && emit('open')"
9
+ @keydown.enter="clickable && emit('open')"
10
+ >
11
+ <div>
12
+ <div class="hero-card__name">{{ name }}</div>
13
+ <div class="hero-card__sub">
14
+ <template v-if="brandName">{{ brandName }} · </template>
15
+ <RobotFloorLabel :floor-no="state?.floorNo" :floor-known="state?.floorKnown" />
16
+ </div>
17
+ </div>
18
+ <RobotStatusChip :mode="state?.mode" :type="type" />
19
+ <div class="hero-card__row">
20
+ <RobotBattery :value="state?.batteryPercent" />
21
+ <RobotCapabilityTag v-if="capabilities !== undefined" :capabilities="capabilities" />
22
+ <RobotFaultBadge v-if="state?.fault" :code="state.fault.code" :message="state.fault.message" compact />
23
+ <span v-if="state?.online === false" class="hero-tag hero-tag--neutral">Offline</span>
24
+ <span v-if="lastSeen" class="hero-card__seen">{{ lastSeen }}</span>
25
+ </div>
26
+ </article>
27
+ </template>
28
+
29
+ <script setup lang="ts">
30
+ import RobotBattery from "./Battery.vue";
31
+ import RobotCapabilityTag from "./CapabilityTag.vue";
32
+ import RobotFaultBadge from "./FaultBadge.vue";
33
+ import RobotFloorLabel from "./FloorLabel.vue";
34
+ import RobotStatusChip from "./StatusChip.vue";
35
+
36
+ defineProps<{
37
+ name: string;
38
+ brandName?: string;
39
+ type?: string;
40
+ /** Brand's declared capabilities (null = none, "No interface"); omit to hide the capability badge. */
41
+ capabilities?: Record<string, unknown> | null;
42
+ /** The robot's live state (`/robots/:id/state`). */
43
+ state?: {
44
+ mode?: unknown;
45
+ online?: boolean;
46
+ batteryPercent?: unknown;
47
+ floorNo?: unknown;
48
+ floorKnown?: boolean;
49
+ fault?: { code?: string; message?: string } | null;
50
+ } | null;
51
+ /** Already formatted, e.g. "2 min ago". */
52
+ lastSeen?: string;
53
+ clickable?: boolean;
54
+ }>();
55
+ const emit = defineEmits<{ open: [] }>();
56
+ </script>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <!-- Clients · drill down: each client, its sites, robots per site and robots with open faults. -->
3
+ <section class="hero-aside" aria-label="Clients drill down">
4
+ <div class="hero-aside__head"><span class="hero-aside__title">Clients · drill down</span></div>
5
+ <div v-for="c in clients" :key="c._id" class="hero-drill">
6
+ <div class="hero-drill__client">
7
+ <span>{{ c.name || "Unknown client" }}</span><span class="hero-drill__n">{{ c.count }}</span>
8
+ </div>
9
+ <button
10
+ v-for="s in c.sites"
11
+ :key="s._id"
12
+ type="button"
13
+ class="hero-drill__site"
14
+ @click="emit('open', { client: c, site: s })"
15
+ >
16
+ <span class="hero-drill__name">{{ s.name || "Unknown site" }}</span>
17
+ <span class="hero-drill__n">{{ s.count }} {{ s.count === 1 ? "robot" : "robots" }}</span>
18
+ <span v-if="(s.faults ?? 0) > 0" class="hero-drill__faults" :aria-label="`${s.faults} with faults`">{{ s.faults }}</span>
19
+ <span class="hero-drill__go" aria-hidden="true">›</span>
20
+ </button>
21
+ </div>
22
+ <div v-if="!clients.length" class="hero-aside__empty">No robots at any client yet.</div>
23
+ </section>
24
+ </template>
25
+
26
+ <script setup lang="ts">
27
+ type TSite = { _id: string; name: string; count: number; faults?: number };
28
+ withDefaults(
29
+ defineProps<{
30
+ /** `[{ _id, name, count, sites: [{ _id, name, count, faults }] }]` */
31
+ clients?: Array<{ _id: string; name: string; count: number; sites: TSite[] }>;
32
+ }>(),
33
+ { clients: () => [] },
34
+ );
35
+ const emit = defineEmits<{ open: [target: { client: any; site: any }] }>();
36
+ </script>
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <!--
3
+ Only brand-declared commands, only for a Manager, only while online.
4
+ Anything else is HIDDEN, never greyed; with nothing to offer there is no bar.
5
+ -->
6
+ <div v-if="commands.length" class="hero-cmds" role="toolbar" aria-label="Robot commands">
7
+ <v-btn
8
+ v-for="c in commands"
9
+ :key="c.kind"
10
+ :variant="c.primary ? 'flat' : 'outlined'"
11
+ :color="c.primary ? 'primary' : undefined"
12
+ :loading="busy === c.kind"
13
+ :disabled="!!busy && busy !== c.kind"
14
+ @click="emit('command', c.kind)"
15
+ >
16
+ {{ c.label }}
17
+ </v-btn>
18
+ </div>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ import { computed } from "vue";
23
+ import { visibleCommands, type TRobotCommandKind } from "../../utils/robot-display";
24
+
25
+ const props = defineProps<{
26
+ /** The brand's declared capabilities (`/robots/brands`). */
27
+ capabilities?: Record<string, unknown> | null;
28
+ /** Manager role - the app's command permission. */
29
+ canCommand?: boolean;
30
+ online?: boolean;
31
+ mode?: unknown;
32
+ type?: string;
33
+ /** The command in flight, if any. */
34
+ busy?: TRobotCommandKind | null;
35
+ }>();
36
+ const emit = defineEmits<{ command: [kind: TRobotCommandKind] }>();
37
+
38
+ const commands = computed(() =>
39
+ visibleCommands({
40
+ capabilities: props.capabilities,
41
+ canCommand: props.canCommand,
42
+ online: props.online,
43
+ mode: props.mode,
44
+ type: props.type,
45
+ }),
46
+ );
47
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <!--
3
+ Write-only. The stored value is never sent to the browser, so it is never
4
+ shown: once saved the field only says so. Typing replaces it on save.
5
+ -->
6
+ <div class="hero-field">
7
+ <label :for="id">{{ label }}</label>
8
+ <input
9
+ :id="id"
10
+ class="hero-input"
11
+ type="password"
12
+ autocomplete="new-password"
13
+ spellcheck="false"
14
+ :placeholder="credentialPlaceholder(saved)"
15
+ :value="modelValue"
16
+ @input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
17
+ />
18
+ </div>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ import { useId } from "vue";
23
+ import { credentialPlaceholder } from "../../utils/robot-display";
24
+
25
+ withDefaults(
26
+ defineProps<{
27
+ label: string;
28
+ /** True once a value is stored server-side. */
29
+ saved?: boolean;
30
+ /** Only the NEW value being typed - never the stored one. */
31
+ modelValue?: string;
32
+ }>(),
33
+ { saved: false, modelValue: "" },
34
+ );
35
+ const emit = defineEmits<{ "update:modelValue": [value: string] }>();
36
+ const id = useId();
37
+ </script>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <span v-if="typeof count === 'number' && count > 0" class="hero-fault hero-fault--count">
3
+ {{ count }} {{ count === 1 ? "fault" : "faults" }}
4
+ </span>
5
+ <span
6
+ v-else-if="code || message"
7
+ class="hero-fault"
8
+ :class="{ 'hero-fault--compact': compact }"
9
+ :title="compact ? message : undefined"
10
+ >
11
+ {{ code || message }}
12
+ <span v-if="!compact && code && message" class="hero-fault__msg">{{ message }}</span>
13
+ </span>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ defineProps<{
18
+ /** The robot's fault code, e.g. E-204. */
19
+ code?: string;
20
+ message?: string;
21
+ /** A count instead of one fault ("3 faults"). */
22
+ count?: number;
23
+ /** Code only - for table cells and cards. */
24
+ compact?: boolean;
25
+ }>();
26
+ </script>
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <span :class="{ 'hero-floor--unknown': unknown }">{{ label }}</span>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { computed } from "vue";
7
+ import { floorLabel } from "../../utils/robot-display";
8
+
9
+ const props = defineProps<{ floorNo?: unknown; floorKnown?: boolean }>();
10
+ const label = computed(() => floorLabel({ floorNo: props.floorNo, floorKnown: props.floorKnown }));
11
+ const unknown = computed(() => label.value === "Floor unknown");
12
+ </script>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <!--
3
+ The HERO scope. Everything inside draws in the robot fleet's look
4
+ (Archivo, square corners, red accent); nothing outside changes. The theme
5
+ follows the app's own light/dark setting.
6
+ -->
7
+ <v-theme-provider :theme="themeName" with-background class="hero">
8
+ <slot />
9
+ </v-theme-provider>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { computed, onMounted } from "vue";
14
+ import { useTheme } from "vuetify";
15
+ import { heroThemeName } from "../../utils/robot-display";
16
+ import "../../assets/css/robot-hero.css";
17
+
18
+ const theme = useTheme();
19
+ const themeName = computed(() => heroThemeName(theme.current.value.dark));
20
+
21
+ // Archivo is requested the first time a HERO scope mounts, so the rest of the
22
+ // product never downloads it (Manrope stays in nuxt.config for everything else).
23
+ const FONT_ID = "hero-archivo-font";
24
+ onMounted(() => {
25
+ if (document.getElementById(FONT_ID)) return;
26
+ const link = document.createElement("link");
27
+ link.id = FONT_ID;
28
+ link.rel = "stylesheet";
29
+ link.href = "https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;800&display=swap";
30
+ document.head.appendChild(link);
31
+ });
32
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div class="hero-lift-row">
3
+ <span class="hero-lift-row__n">{{ n }}</span>
4
+ <div>
5
+ <b>{{ robot }}</b><span class="hero-lift-row__route"> · {{ from }} → {{ to }}</span>
6
+ </div>
7
+ <span class="hero-lift-row__wait">{{ wait }}</span>
8
+ <span class="hero-chip" :class="`hero-tone--${ls.tone}`">{{ ls.label }}</span>
9
+ <span v-if="ls.stripe !== 'none'" class="hero-lift-row__stripe" :class="`hero-lift-row__stripe--${ls.stripe}`" aria-hidden="true" />
10
+ </div>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { computed } from "vue";
15
+ import { liftState } from "../../utils/robot-display";
16
+
17
+ const props = defineProps<{
18
+ n: number | string;
19
+ robot: string;
20
+ from: string;
21
+ to: string;
22
+ /** Already formatted: "24 s", "on board", "done". */
23
+ wait?: string;
24
+ /** requested · riding · released · timed out */
25
+ state: string;
26
+ }>();
27
+ const ls = computed(() => liftState(props.state));
28
+ </script>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <!-- "Live · 16:18:15" with a pulsing square; "Connection lost · retrying" when the feed is down. -->
3
+ <div class="hero-live" role="status">
4
+ <span class="hero-live__dot" :class="{ 'hero-live__dot--off': !connected }" aria-hidden="true" />
5
+ <span>{{ connected ? `Live · ${clock}` : "Connection lost · retrying" }}</span>
6
+ </div>
7
+ </template>
8
+
9
+ <script setup lang="ts">
10
+ import { computed, onBeforeUnmount, onMounted, ref } from "vue";
11
+
12
+ withDefaults(defineProps<{ connected?: boolean }>(), { connected: true });
13
+ const now = ref(new Date());
14
+ let timer: ReturnType<typeof setInterval> | undefined;
15
+ onMounted(() => (timer = setInterval(() => (now.value = new Date()), 1000)));
16
+ onBeforeUnmount(() => clearInterval(timer));
17
+ const clock = computed(() => now.value.toTimeString().slice(0, 8));
18
+ </script>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="hero-maptools">
3
+ <div class="hero-seg" role="toolbar" aria-label="Map editor tools">
4
+ <button
5
+ v-for="t in MAP_TOOLS"
6
+ :key="t.id"
7
+ type="button"
8
+ class="hero-seg__opt"
9
+ :aria-pressed="modelValue === t.id"
10
+ @click="emit('update:modelValue', t.id)"
11
+ >
12
+ {{ t.label }}
13
+ </button>
14
+ <button type="button" class="hero-seg__opt hero-seg__opt--gap" :disabled="!canUndo" @click="emit('undo')">
15
+ Undo ⌃Z
16
+ </button>
17
+ <button type="button" class="hero-seg__opt hero-seg__opt--save" :disabled="saving" @click="emit('save')">
18
+ Save
19
+ </button>
20
+ </div>
21
+ <div v-if="modelValue === 'zone'" class="hero-field">
22
+ <input
23
+ class="hero-input"
24
+ style="width: 180px"
25
+ aria-label="Zone name"
26
+ placeholder="Zone name"
27
+ :value="zoneName"
28
+ @input="emit('update:zoneName', ($event.target as HTMLInputElement).value)"
29
+ />
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ import { MAP_TOOLS } from "../../utils/robot-display";
36
+
37
+ withDefaults(
38
+ defineProps<{
39
+ /** The active tool id: wall · zone · door · lift · move · delete. */
40
+ modelValue?: string;
41
+ zoneName?: string;
42
+ canUndo?: boolean;
43
+ saving?: boolean;
44
+ }>(),
45
+ { modelValue: "wall", zoneName: "", canUndo: true, saving: false },
46
+ );
47
+ const emit = defineEmits<{
48
+ "update:modelValue": [tool: string];
49
+ "update:zoneName": [name: string];
50
+ undo: [];
51
+ save: [];
52
+ }>();
53
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <!--
3
+ Needs attention (Super Admin network aside): open faults first, then robots
4
+ not reporting, longest-standing first - the order the API returns. Complete
5
+ network-wide: the background sweep records faults whether or not anybody
6
+ is looking.
7
+ -->
8
+ <section class="hero-aside" aria-label="Needs attention">
9
+ <div class="hero-aside__head">
10
+ <span class="hero-aside__title">Needs attention</span>
11
+ <span class="hero-aside__hint">most urgent first</span>
12
+ <span v-if="total > 0" class="hero-aside__count">{{ total }}</span>
13
+ </div>
14
+ <div v-if="loading && !items.length" class="hero-skel" aria-hidden="true">
15
+ <div v-for="i in 3" :key="i" class="hero-skel__row" />
16
+ </div>
17
+ <div v-else-if="!items.length" class="hero-aside__empty">Nothing needs attention.</div>
18
+ <div v-else class="hero-attn">
19
+ <button
20
+ v-for="item in items"
21
+ :key="item._id"
22
+ type="button"
23
+ class="hero-attn__item"
24
+ @click="emit('open', item)"
25
+ >
26
+ <b class="hero-attn__name">{{ item.robot?.name }}</b>
27
+ <span class="hero-attn__code">{{ attentionText(item).code }}</span>
28
+ <span class="hero-attn__msg">{{ attentionText(item).message }}</span>
29
+ <span class="hero-attn__where">
30
+ {{ item.client?.name }} · {{ item.site?.name }} · {{ item.offline ? agoText(item.since, now) : sinceText(item.since, now) }}
31
+ </span>
32
+ </button>
33
+ <button v-if="total > items.length" type="button" class="hero-attn__more" @click="emit('more')">
34
+ {{ total - items.length }} more · Faults &amp; alerts ›
35
+ </button>
36
+ </div>
37
+ </section>
38
+ </template>
39
+
40
+ <script setup lang="ts">
41
+ import { agoText, attentionText, sinceText } from "../../utils/robot-display";
42
+
43
+ withDefaults(
44
+ defineProps<{
45
+ /** Rows from `GET /robots/network/faults`. */
46
+ items?: any[];
47
+ /** Every open fault network-wide (the API's `total`), not just those shown. */
48
+ total?: number;
49
+ loading?: boolean;
50
+ /** Epoch ms the "since" text is measured from (the page's clock tick). */
51
+ now?: number;
52
+ }>(),
53
+ { items: () => [], total: 0, loading: false, now: () => Date.now() },
54
+ );
55
+ const emit = defineEmits<{ open: [item: any]; more: [] }>();
56
+ </script>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <!-- A no-interface brand: listed with its details, no live status, no controls. -->
3
+ <div class="hero-notice hero-notice--panel" role="note">
4
+ <div class="hero-notice__title">Monitoring not available for this model</div>
5
+ <div class="hero-notice__body">
6
+ <template v-if="brandName">{{ brandName }}<template v-if="model"> · {{ model }}</template> has no interface yet. </template>
7
+ Details are listed; live status and commands will appear when the brand integration ships.
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ defineProps<{ brandName?: string; model?: string }>();
14
+ </script>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <!--
3
+ Laid over a map or plan (the parent must be position: relative) when the
4
+ feed is lost, so a robot dot is never frozen as if it were live.
5
+ -->
6
+ <div class="hero-reconnecting" role="status" aria-live="polite">Reconnecting…</div>
7
+ </template>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <span class="hero-chip" :class="`hero-tone--${status.tone}`">
3
+ <span class="hero-chip__dot" :class="{ 'hero-chip__dot--blink': status.blink }" aria-hidden="true" />
4
+ {{ status.label }}
5
+ </span>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { computed } from "vue";
10
+ import { robotStatus } from "../../utils/robot-display";
11
+
12
+ /** `mode` is the API's state mode; `type` "security" turns Working into Patrolling. */
13
+ const props = defineProps<{ mode?: unknown; type?: string }>();
14
+ const status = computed(() => robotStatus(props.mode, props.type));
15
+ </script>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div class="hero-cell" :class="{ 'hero-cell--alert': alert }">
3
+ <span class="hero-cell__corner hero-cell__corner--tl" aria-hidden="true" />
4
+ <span class="hero-cell__corner hero-cell__corner--br" aria-hidden="true" />
5
+ <div class="hero-cell__label"><span class="hero-cell__square" aria-hidden="true" />{{ label }}</div>
6
+ <div class="hero-cell__value" :aria-label="`${label}: ${unknown ? 'not known yet' : value}`">{{ unknown ? "—" : shown }}</div>
7
+ <div class="hero-cell__ticks" aria-hidden="true">
8
+ <span
9
+ v-for="i in 20"
10
+ :key="i"
11
+ class="hero-cell__tick"
12
+ :class="{ 'hero-cell__tick--on': i <= filled, 'hero-cell__tick--shown': i <= filled && progress >= i / 20 }"
13
+ />
14
+ </div>
15
+ <div v-if="split" class="hero-cell__split">{{ split }}</div>
16
+ <span class="hero-cell__shimmer" aria-hidden="true" />
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
22
+ import { countUpValue, summaryAlert, summaryTicks } from "../../utils/robot-display";
23
+
24
+ const props = withDefaults(
25
+ defineProps<{
26
+ label: string;
27
+ /** null = not known (e.g. live counts before the first sweep): shows "—", never 0. */
28
+ value: number | null;
29
+ /** What the tick bar is a ratio of. */
30
+ total?: number;
31
+ /** "faults" / "offline" turn accent when above zero. */
32
+ kind?: string;
33
+ split?: string;
34
+ duration?: number;
35
+ }>(),
36
+ { total: 0, kind: "", split: "", duration: 900 },
37
+ );
38
+
39
+ const unknown = computed(() => typeof props.value !== "number");
40
+ const filled = computed(() => summaryTicks(props.value, props.total));
41
+ const alert = computed(() => summaryAlert(props.kind, props.value));
42
+
43
+ // The count-up and the tick reveal share one clock.
44
+ const elapsed = ref(0);
45
+ const shown = computed(() => countUpValue(props.value ?? 0, elapsed.value, props.duration));
46
+ const progress = computed(() => Math.min(1, elapsed.value / props.duration));
47
+
48
+ let frame = 0;
49
+ function run() {
50
+ cancelAnimationFrame(frame);
51
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
52
+ elapsed.value = props.duration;
53
+ return;
54
+ }
55
+ const start = performance.now();
56
+ elapsed.value = 0;
57
+ const step = (now: number) => {
58
+ elapsed.value = now - start;
59
+ if (elapsed.value < props.duration) frame = requestAnimationFrame(step);
60
+ };
61
+ frame = requestAnimationFrame(step);
62
+ }
63
+ onMounted(run);
64
+ watch(() => props.value, run);
65
+ onBeforeUnmount(() => cancelAnimationFrame(frame));
66
+ </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="hero-summary" role="group" :aria-label="label">
3
+ <slot>
4
+ <RobotSummaryCell v-for="c in cells" :key="c.label" v-bind="c" />
5
+ </slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script setup lang="ts">
10
+ import RobotSummaryCell from "./SummaryCell.vue";
11
+
12
+ withDefaults(
13
+ defineProps<{
14
+ cells?: Array<{ label: string; value: number | null; total?: number; kind?: string; split?: string }>;
15
+ label?: string;
16
+ }>(),
17
+ { cells: () => [], label: "Fleet summary" },
18
+ );
19
+ </script>