@7365admin1/layer-common 4.35.1-staging.370 → 4.35.1-staging.372
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/assets/css/robot-hero.css +42 -5
- package/components/Robot/BuildingMap.vue +16 -9
- package/components/Robot/LiftQueue.vue +9 -4
- package/components/Robot/MapEditor.vue +314 -64
- package/composables/useRobotBuilding.ts +22 -3
- package/composables/useRobots.ts +13 -0
- package/package.json +2 -2
- package/utils/robot-building.ts +472 -36
- package/utils/robot-fleet-core.ts +57 -0
|
@@ -951,6 +951,7 @@
|
|
|
951
951
|
.hero-bmap__wall { stroke: var(--hero-text); stroke-width: 3; opacity: 0.8; }
|
|
952
952
|
.hero-bmap__zone { fill: color-mix(in srgb, var(--hero-text) 10%, transparent); stroke: var(--hero-text); stroke-width: 1; stroke-dasharray: 4 3; }
|
|
953
953
|
.hero-bmap__doorline { stroke: var(--hero-accent); stroke-width: 3; }
|
|
954
|
+
.hero-bmap__doorline--open { stroke: rgb(var(--v-theme-success)); stroke-dasharray: 2 2; }
|
|
954
955
|
.hero-bmap__anchor { position: absolute; width: 0; height: 0; transform-style: preserve-3d; }
|
|
955
956
|
.hero-bmap__routetag { position: absolute; left: -6px; top: -30px; transform-origin: 0 0; white-space: nowrap; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 800; padding: 1px 6px; background: var(--hero-accent); color: #fff; }
|
|
956
957
|
.hero-bmap__cp { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; box-sizing: border-box; border: 2px solid var(--hero-accent); background: var(--hero-bg); display: grid; place-items: center; font-size: 7px; font-weight: 800; color: var(--hero-accent); }
|
|
@@ -985,6 +986,7 @@
|
|
|
985
986
|
.hero-bmap__legend { position: absolute; left: 14px; bottom: 12px; z-index: 3; font-size: 11px; opacity: 0.65; display: flex; gap: 14px; white-space: nowrap; }
|
|
986
987
|
.hero-bmap__key { display: inline-block; width: 8px; height: 8px; vertical-align: middle; margin-right: 5px; }
|
|
987
988
|
.hero-bmap__key--door { background: var(--hero-accent); }
|
|
989
|
+
.hero-bmap__key--dooropen { background: rgb(var(--v-theme-success)); }
|
|
988
990
|
.hero-bmap__key--shaft { background: color-mix(in srgb, var(--hero-accent) 30%, transparent); border: 1px solid var(--hero-accent); box-sizing: border-box; }
|
|
989
991
|
.hero-bmap__key--bot { background: var(--hero-text); }
|
|
990
992
|
.hero-bmap__key--route { width: 12px; height: 0; border-top: 2px dashed var(--hero-accent); }
|
|
@@ -1009,14 +1011,13 @@
|
|
|
1009
1011
|
.hero-seg__kbd { opacity: 0.55; }
|
|
1010
1012
|
.hero .hero-input.hero-editor__floor { width: auto; min-height: 32px; padding: 4px 26px 4px 8px; }
|
|
1011
1013
|
.hero .hero-input.hero-editor__zone { width: 220px; min-height: 32px; }
|
|
1012
|
-
.hero-editor__hint { font-size: 12px; opacity: 0.7; }
|
|
1013
|
-
.hero .v-btn.hero-editor__fs { margin-left: auto; }
|
|
1014
|
-
.hero .v-btn.hero-editor__fs .v-btn__content { gap: 8px; }
|
|
1014
|
+
.hero-editor__hint { font-size: 12px; opacity: 0.7; order: 1; flex-basis: 100%; } /* own line: switching tools never moves the plan */
|
|
1015
1015
|
.hero-editor__notice { padding: 10px 12px; font-size: 12.5px; border-left: 2px solid var(--hero-accent); background: var(--hero-surface); }
|
|
1016
1016
|
.hero-editor__notice--ok { border-left-color: rgb(var(--v-theme-success)); }
|
|
1017
1017
|
.hero-editor__split { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; flex: 1; }
|
|
1018
1018
|
.hero-editor__plan {
|
|
1019
1019
|
flex: 999 1 460px;
|
|
1020
|
+
align-self: flex-start; /* a taller side list must not stretch the plan under the pointer */
|
|
1020
1021
|
min-width: 0;
|
|
1021
1022
|
position: relative;
|
|
1022
1023
|
min-height: max(480px, calc(100vh - 330px));
|
|
@@ -1027,6 +1028,18 @@
|
|
|
1027
1028
|
border: 1px solid var(--hero-divider);
|
|
1028
1029
|
overflow: hidden;
|
|
1029
1030
|
cursor: crosshair;
|
|
1031
|
+
touch-action: none; /* a finger drags shapes, not the page */
|
|
1032
|
+
user-select: none;
|
|
1033
|
+
}
|
|
1034
|
+
.hero-editor__plan--default { cursor: default; }
|
|
1035
|
+
.hero-editor__plan--pointer { cursor: pointer; }
|
|
1036
|
+
.hero-editor__plan--move { cursor: move; }
|
|
1037
|
+
.hero-editor__plan--ns { cursor: ns-resize; }
|
|
1038
|
+
.hero-editor__plan--ew { cursor: ew-resize; }
|
|
1039
|
+
.hero-editor__plan--nwse { cursor: nwse-resize; }
|
|
1040
|
+
.hero-editor__plan--nesw { cursor: nesw-resize; }
|
|
1041
|
+
.hero-editor__plan--rotate, .hero-editor__handle--rotate {
|
|
1042
|
+
cursor: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5%27 fill=%27none%27 stroke=%27%23fff%27 stroke-width=%274%27/%3E%3Cpath d=%27M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5%27 fill=%27none%27 stroke=%27%23000%27 stroke-width=%272%27/%3E%3C/svg%3E") 12 12, grab;
|
|
1030
1043
|
}
|
|
1031
1044
|
.hero-editor__plan:focus-visible { outline: 2px solid var(--hero-accent); outline-offset: 0; }
|
|
1032
1045
|
.hero-editor__room { position: absolute; border: 2px solid var(--hero-text); opacity: 0.4; pointer-events: none; }
|
|
@@ -1038,11 +1051,35 @@ polygon.hero-editor__sel { stroke: var(--hero-accent); stroke-width: 2; stroke-d
|
|
|
1038
1051
|
div.hero-editor__sel { outline: 2px solid var(--hero-accent); }
|
|
1039
1052
|
.hero-editor__label { position: absolute; display: grid; place-items: center; font-size: 10px; font-weight: 600; pointer-events: none; }
|
|
1040
1053
|
.hero-editor__lift { position: absolute; box-sizing: border-box; display: grid; place-items: center; font-size: 10px; font-weight: 600; background: color-mix(in srgb, var(--hero-accent) 30%, transparent); border: 1px solid var(--hero-accent); }
|
|
1041
|
-
.hero-editor__door {
|
|
1054
|
+
.hero-editor__door { stroke: var(--hero-accent); stroke-width: 4; stroke-linecap: square; }
|
|
1055
|
+
line.hero-editor__door.hero-editor__sel { stroke: var(--hero-text); }
|
|
1056
|
+
.hero-editor__swing { fill: none; stroke: var(--hero-text); stroke-width: 1; stroke-dasharray: 3 2; opacity: 0.7; }
|
|
1057
|
+
.hero-editor__rotline { stroke: var(--hero-accent); stroke-width: 1; stroke-dasharray: 3 2; }
|
|
1058
|
+
/* Handles: 24px to hit (36px for a finger), a 10px square to see. */
|
|
1059
|
+
.hero-editor__handle { position: absolute; z-index: 2; width: 24px; height: 24px; margin: -12px 0 0 -12px; display: grid; place-items: center; touch-action: none; }
|
|
1060
|
+
.hero-editor__handle::before { content: ""; box-sizing: border-box; width: 10px; height: 10px; background: var(--hero-surface); border: 2px solid var(--hero-accent); }
|
|
1061
|
+
.hero-editor__handle--vertex::before { background: var(--hero-accent); border-color: var(--hero-surface); outline: 1px solid var(--hero-accent); }
|
|
1062
|
+
.hero-editor__handle--on::before { background: var(--hero-text); outline-color: var(--hero-text); }
|
|
1063
|
+
.hero-editor__handle--rotate::before { width: 11px; height: 11px; background: var(--hero-accent); border-color: var(--hero-surface); transform: rotate(45deg); }
|
|
1064
|
+
@media (pointer: coarse) {
|
|
1065
|
+
.hero-editor__handle { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
|
|
1066
|
+
.hero-editor__handle::before { width: 14px; height: 14px; }
|
|
1067
|
+
}
|
|
1068
|
+
.hero-editor__marquee { position: absolute; border: 1px dashed var(--hero-accent); background: color-mix(in srgb, var(--hero-accent) 8%, transparent); pointer-events: none; }
|
|
1069
|
+
.hero-editor .hero-seg__opt--redo { font-weight: 400; }
|
|
1070
|
+
.hero-editor__grid { font: inherit; font-size: 12px; padding: 7px 8px; color: inherit; background: transparent; border: 0; border-left: 1px solid var(--hero-divider); cursor: pointer; }
|
|
1071
|
+
.hero-editor__grid option { color: var(--hero-text); background: var(--hero-surface); }
|
|
1072
|
+
.hero-editor__actions { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
1073
|
+
.hero-editor__act { font: inherit; font-size: 12px; padding: 6px 10px; min-height: 32px; color: inherit; background: transparent; border: 1px solid var(--hero-divider); cursor: pointer; }
|
|
1074
|
+
.hero-editor__act:hover { background: color-mix(in srgb, var(--hero-text) 7%, transparent); }
|
|
1075
|
+
.hero-editor__act:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
1076
|
+
.hero-editor__act--del { color: var(--hero-accent); }
|
|
1042
1077
|
.hero-editor__cursor { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid var(--hero-accent); pointer-events: none; }
|
|
1043
1078
|
.hero-editor__aside { font-size: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 260px; max-width: 360px; min-width: 0; align-self: stretch; }
|
|
1044
1079
|
.hero-editor__asidetitle { border-top: 2px solid var(--hero-divider); padding-top: 8px; }
|
|
1045
|
-
.hero-editor__row { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--hero-divider); padding: 4px 0; }
|
|
1080
|
+
.hero-editor__row { display: flex; justify-content: space-between; gap: 8px; border: 0; border-bottom: 1px solid var(--hero-divider); padding: 4px 0; font: inherit; color: inherit; background: transparent; text-align: left; cursor: pointer; }
|
|
1081
|
+
.hero-editor__row:hover { background: color-mix(in srgb, var(--hero-text) 5%, transparent); }
|
|
1082
|
+
.hero-editor__row--sel { box-shadow: inset 2px 0 0 var(--hero-accent); padding-left: 6px; font-weight: 600; }
|
|
1046
1083
|
.hero-editor__pos { opacity: 0.55; font-variant-numeric: tabular-nums; }
|
|
1047
1084
|
.hero-editor__note { opacity: 0.6; margin-top: auto; }
|
|
1048
1085
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" /></svg>
|
|
19
19
|
Full screen
|
|
20
20
|
</v-btn>
|
|
21
|
-
<v-btn v-if="canEditMap" :variant="editing ? 'outlined' : 'flat'" :color="editing ? undefined : 'primary'" @click="editing = !editing">
|
|
21
|
+
<v-btn v-if="canEditMap && !fleet" :variant="editing ? 'outlined' : 'flat'" :color="editing ? undefined : 'primary'" @click="editing = !editing">
|
|
22
22
|
{{ editing ? "Exit edit mode" : "Edit map" }}
|
|
23
23
|
</v-btn>
|
|
24
24
|
</div>
|
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
<div v-if="error" class="hero-notice" role="alert">{{ error }}</div>
|
|
27
27
|
<div v-else-if="!loading && emptyNote" class="hero-notice">{{ emptyNote }}</div>
|
|
28
28
|
|
|
29
|
+
<div v-if="fleet" class="hero-notice" role="status">Live building from HERO Fleet Core - doors and lifts update every few seconds. It is managed by the fleet, so it cannot be edited here.</div>
|
|
30
|
+
|
|
29
31
|
<RobotMapEditor
|
|
30
|
-
v-if="editing && canEditMap"
|
|
32
|
+
v-if="editing && canEditMap && !fleet"
|
|
31
33
|
ref="editor"
|
|
32
34
|
:map="map"
|
|
33
35
|
:floors="floors"
|
|
@@ -105,9 +107,11 @@
|
|
|
105
107
|
class="hero-bmap__floor"
|
|
106
108
|
:style="{ transform: `translateZ(${i * FLOOR_GAP_PX}px)`, opacity: f.dim, '--hero-fill': look.fill }"
|
|
107
109
|
>
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
<template v-if="!fleet">
|
|
111
|
+
<span class="hero-bmap__room" style="left: 8%; top: 10%; width: 34%; height: 30%" aria-hidden="true" />
|
|
112
|
+
<span class="hero-bmap__room" style="left: 58%; top: 10%; width: 34%; height: 44%" aria-hidden="true" />
|
|
113
|
+
<span class="hero-bmap__room" style="left: 8%; top: 62%; width: 60%; height: 28%" aria-hidden="true" />
|
|
114
|
+
</template>
|
|
111
115
|
<template v-if="!map">
|
|
112
116
|
<span class="hero-bmap__door" style="left: 42%; top: 22%" aria-hidden="true" />
|
|
113
117
|
<span class="hero-bmap__door" style="left: 58%; top: 30%" aria-hidden="true" />
|
|
@@ -116,7 +120,7 @@
|
|
|
116
120
|
<template v-for="s in f.shapes" :key="s.id">
|
|
117
121
|
<polygon v-if="s.kind === 'zone'" class="hero-bmap__zone" :points="svgPoints(s)" vector-effect="non-scaling-stroke" />
|
|
118
122
|
<line v-else-if="s.kind === 'wall'" class="hero-bmap__wall" :x1="s.points[0]!.x" :y1="s.points[0]!.y" :x2="s.points[1]!.x" :y2="s.points[1]!.y" vector-effect="non-scaling-stroke" />
|
|
119
|
-
<line v-else-if="s.kind === 'door'" class="hero-bmap__doorline" :x1="s.points[0]!.x" :y1="s.points[0]!.y" :x2="s.points[1]!.x" :y2="s.points[1]!.y" vector-effect="non-scaling-stroke" />
|
|
123
|
+
<line v-else-if="s.kind === 'door'" class="hero-bmap__doorline" :class="{ 'hero-bmap__doorline--open': openDoors.has(String(s.meta?.name)) }" :x1="s.points[0]!.x" :y1="s.points[0]!.y" :x2="s.points[1]!.x" :y2="s.points[1]!.y" vector-effect="non-scaling-stroke" />
|
|
120
124
|
</template>
|
|
121
125
|
</svg>
|
|
122
126
|
|
|
@@ -165,6 +169,7 @@
|
|
|
165
169
|
|
|
166
170
|
<div class="hero-bmap__legend">
|
|
167
171
|
<span><i class="hero-bmap__key hero-bmap__key--door" />Door</span>
|
|
172
|
+
<span v-if="fleet"><i class="hero-bmap__key hero-bmap__key--dooropen" />Door open</span>
|
|
168
173
|
<span><i class="hero-bmap__key hero-bmap__key--shaft" />Lift shaft</span>
|
|
169
174
|
<span><i class="hero-bmap__key hero-bmap__key--bot" />Robot (live)</span>
|
|
170
175
|
<span v-if="type === 'security'"><i class="hero-bmap__key hero-bmap__key--route" />Patrol route · numbered checkpoints</span>
|
|
@@ -197,6 +202,7 @@ import RobotMapEditor from "./MapEditor.vue";
|
|
|
197
202
|
import RobotReconnecting from "./Reconnecting.vue";
|
|
198
203
|
import useRobotBuilding from "../../composables/useRobotBuilding";
|
|
199
204
|
import useRobotLive, { siteStatesFeed } from "../../composables/useRobotLive";
|
|
205
|
+
import { openDoorNames } from "../../utils/robot-fleet-core";
|
|
200
206
|
import {
|
|
201
207
|
brandName,
|
|
202
208
|
floorName,
|
|
@@ -258,11 +264,12 @@ const emit = defineEmits<{
|
|
|
258
264
|
status: [status: { connected: boolean; faults: number; siteName: string; clientName: string }];
|
|
259
265
|
}>();
|
|
260
266
|
|
|
261
|
-
const { rows, map, names, loading, error, reload } = useRobotBuilding(
|
|
267
|
+
const { rows, map, fleet, names, loading, error, reload } = useRobotBuilding(
|
|
262
268
|
toRef(props, "organization"),
|
|
263
269
|
toRef(props, "site"),
|
|
264
270
|
toRef(props, "type"),
|
|
265
271
|
);
|
|
272
|
+
const openDoors = computed(() => openDoorNames(map.value));
|
|
266
273
|
const siteLabel = computed(() => props.siteName || names.value.siteName || "This site");
|
|
267
274
|
|
|
268
275
|
/* ---- live states + patrol routes of the robots on screen ---- */
|
|
@@ -381,8 +388,8 @@ function fullscreen(el?: HTMLElement | null) {
|
|
|
381
388
|
else el?.requestFullscreen?.();
|
|
382
389
|
}
|
|
383
390
|
const editing = ref(false);
|
|
384
|
-
watch(() => props.canEditMap, (can) => {
|
|
385
|
-
if (!can) editing.value = false;
|
|
391
|
+
watch([() => props.canEditMap, fleet], ([can, isFleet]) => {
|
|
392
|
+
if (!can || isFleet) editing.value = false;
|
|
386
393
|
});
|
|
387
394
|
/** The robot a first save is attached to (maps are stored per robot): one of this site's. */
|
|
388
395
|
const ownerRobotId = computed(() => String(map.value?.robotId ?? rows.value[0]?._id ?? ""));
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
<div v-if="error" class="hero-notice" role="alert">{{ error }}</div>
|
|
19
|
+
<div v-else-if="fleet" class="hero-notice" role="status">Live lifts from HERO Fleet Core - the fleet calls and releases lifts itself.</div>
|
|
19
20
|
<div v-else-if="!connected" class="hero-notice" role="status">Reconnecting… the lift queue shows its last reading.</div>
|
|
20
21
|
|
|
21
22
|
<div v-if="loading && !cards.length" class="hero-lifts" role="status" aria-label="Loading the lift queue">
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
<span class="hero-lift-row__wait">{{ q.wait }}</span>
|
|
76
77
|
<span class="hero-chip" :class="`hero-tone--${liftState(q.state).tone}`">{{ liftState(q.state).label }}</span>
|
|
77
78
|
<button
|
|
78
|
-
v-if="canCommand"
|
|
79
|
+
v-if="canCommand && !fleet"
|
|
79
80
|
type="button"
|
|
80
81
|
class="hero-lift-row__release"
|
|
81
82
|
:style="{ visibility: q.state === 'riding' || q.state === 'requested' ? 'visible' : 'hidden' }"
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
</div>
|
|
89
90
|
</div>
|
|
90
91
|
|
|
91
|
-
<form v-if="canCommand && demoRobots.length" class="hero-lift__ask" @submit.prevent="ask(l)">
|
|
92
|
+
<form v-if="canCommand && demoRobots.length && !fleet" class="hero-lift__ask" @submit.prevent="ask(l)">
|
|
92
93
|
<select v-model="askRobot[l.name]" class="hero-input hero-select hero-select--sm" aria-label="Robot">
|
|
93
94
|
<option value="" disabled>Robot</option>
|
|
94
95
|
<option v-for="r in demoRobots" :key="String(r._id)" :value="String(r._id)">{{ r.name }}</option>
|
|
@@ -115,6 +116,7 @@ import RobotToast from "./Toast.vue";
|
|
|
115
116
|
import useRobotBuilding from "../../composables/useRobotBuilding";
|
|
116
117
|
import { floorName, liftState, robotErrorMessage } from "../../utils/robot-display";
|
|
117
118
|
import { liftCard, type TLiftRowView } from "../../utils/robot-building";
|
|
119
|
+
import { fleetLiftItems } from "../../utils/robot-fleet-core";
|
|
118
120
|
|
|
119
121
|
const props = withDefaults(
|
|
120
122
|
defineProps<{
|
|
@@ -137,7 +139,7 @@ const emit = defineEmits<{
|
|
|
137
139
|
status: [status: { connected: boolean; faults: number; siteName: string; clientName: string }];
|
|
138
140
|
}>();
|
|
139
141
|
|
|
140
|
-
const { rows, map, names, loading: mapLoading, error: mapError } = useRobotBuilding(
|
|
142
|
+
const { rows, all, map, fleet, names, loading: mapLoading, error: mapError } = useRobotBuilding(
|
|
141
143
|
toRef(props, "organization"),
|
|
142
144
|
toRef(props, "site"),
|
|
143
145
|
toRef(props, "type"),
|
|
@@ -154,6 +156,8 @@ const loading = computed(() => mapLoading.value || queueLoading.value);
|
|
|
154
156
|
const error = computed(() => mapError.value);
|
|
155
157
|
|
|
156
158
|
async function poll() {
|
|
159
|
+
// The fleet building has no lift sessions of ours: its lifts come live with the building (5 s refresh).
|
|
160
|
+
if (fleet.value) return void (items.value = fleetLiftItems(map.value, all.value), (queueLoading.value = false));
|
|
157
161
|
const id = map.value?._id;
|
|
158
162
|
if (!id) return void (items.value = []);
|
|
159
163
|
if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
|
|
@@ -169,9 +173,10 @@ async function poll() {
|
|
|
169
173
|
}
|
|
170
174
|
let timer: ReturnType<typeof setInterval> | undefined;
|
|
171
175
|
watch(
|
|
172
|
-
() => map.value?._id,
|
|
176
|
+
() => (fleet.value ? map.value : map.value?._id),
|
|
173
177
|
(id) => {
|
|
174
178
|
clearInterval(timer);
|
|
179
|
+
if (fleet.value) return void poll();
|
|
175
180
|
items.value = [];
|
|
176
181
|
if (!id) return;
|
|
177
182
|
queueLoading.value = true;
|