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

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,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,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,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,64 @@
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}: ${value}`">{{ 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
+ value: number;
28
+ /** What the tick bar is a ratio of. */
29
+ total?: number;
30
+ /** "faults" / "offline" turn accent when above zero. */
31
+ kind?: string;
32
+ split?: string;
33
+ duration?: number;
34
+ }>(),
35
+ { total: 0, kind: "", split: "", duration: 900 },
36
+ );
37
+
38
+ const filled = computed(() => summaryTicks(props.value, props.total));
39
+ const alert = computed(() => summaryAlert(props.kind, props.value));
40
+
41
+ // The count-up and the tick reveal share one clock.
42
+ const elapsed = ref(0);
43
+ const shown = computed(() => countUpValue(props.value, elapsed.value, props.duration));
44
+ const progress = computed(() => Math.min(1, elapsed.value / props.duration));
45
+
46
+ let frame = 0;
47
+ function run() {
48
+ cancelAnimationFrame(frame);
49
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
50
+ elapsed.value = props.duration;
51
+ return;
52
+ }
53
+ const start = performance.now();
54
+ elapsed.value = 0;
55
+ const step = (now: number) => {
56
+ elapsed.value = now - start;
57
+ if (elapsed.value < props.duration) frame = requestAnimationFrame(step);
58
+ };
59
+ frame = requestAnimationFrame(step);
60
+ }
61
+ onMounted(run);
62
+ watch(() => props.value, run);
63
+ onBeforeUnmount(() => cancelAnimationFrame(frame));
64
+ </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; total?: number; kind?: string; split?: string }>;
15
+ label?: string;
16
+ }>(),
17
+ { cells: () => [], label: "Fleet summary" },
18
+ );
19
+ </script>
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <!--
3
+ The robot table: server-side pages (never every robot at once), sortable
4
+ columns, optional grouping, skeleton rows while loading and a plain empty
5
+ state. Every v-data-table-server prop, event and item slot passes through.
6
+ -->
7
+ <div class="hero-table" :class="{ 'hero-table--compact': compact }">
8
+ <v-data-table-server
9
+ v-bind="$attrs"
10
+ :headers="columns"
11
+ :items="loading ? [] : items"
12
+ :items-length="itemsLength"
13
+ :page="range.page"
14
+ :items-per-page="itemsPerPage"
15
+ :loading="loading"
16
+ :group-by="groupBy"
17
+ hide-default-footer
18
+ @update:page="emit('update:page', $event)"
19
+ >
20
+ <template v-for="name in passSlots" #[name]="scope">
21
+ <slot :name="name" v-bind="scope ?? {}" />
22
+ </template>
23
+
24
+ <template #loading>
25
+ <div class="hero-skel" aria-label="Loading robots">
26
+ <div v-for="i in skeletonRows" :key="i" class="hero-skel__row" />
27
+ </div>
28
+ </template>
29
+
30
+ <template #no-data>
31
+ <slot name="no-data">
32
+ <div class="hero-empty">
33
+ <div class="hero-empty__title">{{ emptyTitle }}</div>
34
+ <div v-if="emptyHint" class="hero-empty__hint">{{ emptyHint }}</div>
35
+ </div>
36
+ </slot>
37
+ </template>
38
+
39
+ <template #group-header="scope">
40
+ <slot name="group-header" v-bind="scope">
41
+ <tr class="hero-table__group" @vue:mounted="openOnMount(scope)">
42
+ <td :colspan="scope.columns.length">
43
+ <button type="button" :aria-expanded="scope.isGroupOpen(scope.item)" @click="scope.toggleGroup(scope.item)">
44
+ {{ scope.item.value }} <span class="hero-muted">· {{ scope.item.items.length }} {{ noun }}</span>
45
+ </button>
46
+ </td>
47
+ </tr>
48
+ </slot>
49
+ </template>
50
+ </v-data-table-server>
51
+
52
+ <div v-if="!loading && range.total" class="hero-table__foot">
53
+ <span>{{ range.text }}</span>
54
+ <div v-if="range.pages > 1" class="hero-table__pager">
55
+ <v-btn variant="outlined" :disabled="!range.hasPrev" @click="emit('update:page', range.page - 1)">Prev</v-btn>
56
+ <v-btn variant="outlined" :disabled="!range.hasNext" @click="emit('update:page', range.page + 1)">Next</v-btn>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </template>
61
+
62
+ <script setup lang="ts">
63
+ import { computed, useSlots } from "vue";
64
+ import { pageRange } from "../../utils/robot-display";
65
+
66
+ defineOptions({ inheritAttrs: false });
67
+
68
+ const props = withDefaults(
69
+ defineProps<{
70
+ headers: any[];
71
+ items: any[];
72
+ /** The server's total, not the page's length. */
73
+ itemsLength: number;
74
+ /** 1-based, like Vuetify. */
75
+ page?: number;
76
+ itemsPerPage?: number;
77
+ loading?: boolean;
78
+ groupBy?: Array<{ key: string; order?: "asc" | "desc" }>;
79
+ noun?: string;
80
+ emptyTitle?: string;
81
+ emptyHint?: string;
82
+ skeletonRows?: number;
83
+ /** 12.5px rows, for the Network table. */
84
+ compact?: boolean;
85
+ }>(),
86
+ {
87
+ page: 1,
88
+ itemsPerPage: 25,
89
+ loading: false,
90
+ groupBy: () => [],
91
+ noun: "robots",
92
+ emptyTitle: "No robots match",
93
+ emptyHint: "",
94
+ skeletonRows: 6,
95
+ compact: false,
96
+ },
97
+ );
98
+ const emit = defineEmits<{ "update:page": [page: number] }>();
99
+
100
+ const OWN = new Set(["loading", "no-data", "group-header"]);
101
+ const slots = useSlots();
102
+ const passSlots = computed(() => Object.keys(slots).filter((n) => !OWN.has(n)));
103
+
104
+ // Vuetify adds its own "Group" column when grouping; the handoff has none, so
105
+ // an empty, zero-width one is supplied in its place.
106
+ const GROUP_COL = { key: "data-table-group", title: "", sortable: false, headerProps: { class: "hero-table__groupcol" }, cellProps: { class: "hero-table__groupcol" } };
107
+ const columns = computed(() => (props.groupBy.length ? [GROUP_COL, ...props.headers] : props.headers));
108
+
109
+ // The handoff lists grouped rows under their header, so a group starts open.
110
+ function openOnMount(scope: any) {
111
+ if (!scope.isGroupOpen(scope.item)) scope.toggleGroup(scope.item);
112
+ }
113
+
114
+ const range = computed(() => pageRange(props.page, props.itemsPerPage, props.itemsLength, props.noun));
115
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div v-if="modelValue" class="hero-toast" role="status" aria-live="polite">
3
+ <span class="hero-toast__square" aria-hidden="true" />{{ modelValue }}
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { onBeforeUnmount, watch } from "vue";
9
+
10
+ /** The message; the toast clears it after `timeout` ms (2.6s, the handoff's). */
11
+ const props = withDefaults(defineProps<{ modelValue?: string; timeout?: number }>(), {
12
+ modelValue: "",
13
+ timeout: 2600,
14
+ });
15
+ const emit = defineEmits<{ "update:modelValue": [value: string] }>();
16
+
17
+ let timer: ReturnType<typeof setTimeout> | undefined;
18
+ watch(
19
+ () => props.modelValue,
20
+ (msg) => {
21
+ clearTimeout(timer);
22
+ if (msg && props.timeout > 0) timer = setTimeout(() => emit("update:modelValue", ""), props.timeout);
23
+ },
24
+ { immediate: true },
25
+ );
26
+ onBeforeUnmount(() => clearTimeout(timer));
27
+ </script>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <div class="hero-notice" role="note">View-only access — commands and edits are not available for your role.</div>
3
+ </template>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.28.1-staging.359",
5
+ "version": "4.28.1-staging.360",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -42,7 +42,7 @@ import {
42
42
  } from "vuetify-pro-tiptap";
43
43
  import "vuetify-pro-tiptap/style.css";
44
44
 
45
- import { LIGHT_THEME, DARK_THEME } from "../utils/theme";
45
+ import { LIGHT_THEME, DARK_THEME, HERO_LIGHT_THEME, HERO_DARK_THEME } from "../utils/theme";
46
46
  import { MDI_TO_SYMBOL } from "../utils/materialSymbols";
47
47
  import { THEME_COOKIE } from "../composables/useThemePreference";
48
48
  import type { CookieOptions } from "#app";
@@ -175,6 +175,13 @@ export default defineNuxtPlugin((app) => {
175
175
  * theme rather than a blank one.
176
176
  */
177
177
  iservice365: LIGHT_THEME,
178
+ /**
179
+ * The robot fleet's HERO look (owner decision 2026-09-23). Never a
180
+ * default: only `components/Robot/Hero.vue` asks for these, through a
181
+ * `v-theme-provider`, so every other screen keeps the themes above.
182
+ */
183
+ "hero-light": HERO_LIGHT_THEME,
184
+ "hero-dark": HERO_DARK_THEME,
178
185
  },
179
186
  },
180
187
  icons: {