@7365admin1/layer-common 4.2.24 → 4.2.25
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/CHANGELOG.md +24 -4
- package/assets/css/screens.css +132 -0
- package/assets/css/shell.css +4 -0
- package/components/VisitorSocketPopUp.vue +71 -36
- package/composables/useVisitorSocket.ts +31 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.2.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 332119d: Redraw the ANPR "New plate detected" toast on the product's own card surface
|
|
8
|
+
|
|
9
|
+
The realtime plate toast was Vuetify's default: a flat `color="info"` slab with
|
|
10
|
+
the plate concatenated onto the label at the same weight, an underlined
|
|
11
|
+
uppercase text link for the action and a bare 24px cross. It matched nothing
|
|
12
|
+
else in the product.
|
|
13
|
+
|
|
14
|
+
It is now the design's card - `--card` on a `--border` rule at `--r-card` with
|
|
15
|
+
the menu shadow - with the plate set at 21px above a 13.5px label, a
|
|
16
|
+
`directions_car` glyph, `AppButton`'s ghost variant for the action and a 44px
|
|
17
|
+
close button with an accessible name. The message sits in a polite live region
|
|
18
|
+
and Escape dismisses it.
|
|
19
|
+
|
|
20
|
+
Presentation only: when the toast fires, where it links and how long it stays
|
|
21
|
+
are unchanged.
|
|
22
|
+
|
|
3
23
|
## 4.2.24
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -765,11 +785,11 @@
|
|
|
765
785
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
766
786
|
own rule from two endpoints the console already calls, unprojected:
|
|
767
787
|
|
|
768
|
-
|
|
769
|
-
|
|
788
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
789
|
+
GET /api/roles/id/:role that membership's role document
|
|
770
790
|
|
|
771
|
-
|
|
772
|
-
|
|
791
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
792
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
773
793
|
|
|
774
794
|
`role.default` is the marker because it is the only property of a platform
|
|
775
795
|
staff role no API caller can set - `role.controller.ts` validates create and
|
package/assets/css/screens.css
CHANGED
|
@@ -896,6 +896,138 @@
|
|
|
896
896
|
text-transform: none;
|
|
897
897
|
}
|
|
898
898
|
|
|
899
|
+
/* ------------------------------------------------------------------ */
|
|
900
|
+
/* The ANPR plate toast (`components/VisitorSocketPopUp.vue`). */
|
|
901
|
+
/* */
|
|
902
|
+
/* The generic toast above is a coloured slab with a sentence on it, */
|
|
903
|
+
/* which is the wrong shape for this one: it carries a PAYLOAD - the */
|
|
904
|
+
/* plate the camera read - and the operator reads the number, not the */
|
|
905
|
+
/* sentence. So it is the design's own CARD instead: `--card` on a */
|
|
906
|
+
/* `--border` rule at `--r-card`, the menu shadow, and the plate set */
|
|
907
|
+
/* two steps above the label. */
|
|
908
|
+
/* */
|
|
909
|
+
/* No colour is written down here. The tint is `--info` over */
|
|
910
|
+
/* `--info-bg`, the same pair `.tone-info` paints a chip with, so the */
|
|
911
|
+
/* toast follows the theme instead of Vuetify's flat `color="info"` */
|
|
912
|
+
/* fill - which is what the owner was shown and what this replaces. */
|
|
913
|
+
/* ------------------------------------------------------------------ */
|
|
914
|
+
.anpr-toast .v-snackbar__wrapper {
|
|
915
|
+
background: var(--card);
|
|
916
|
+
color: var(--text);
|
|
917
|
+
border: 1px solid var(--border);
|
|
918
|
+
border-radius: var(--r-card);
|
|
919
|
+
box-shadow: var(--shadow-menu);
|
|
920
|
+
/* One width for every read, so the toast does not resize between plates.
|
|
921
|
+
Vuetify's own 344px minimum is left behind deliberately: a plate set at
|
|
922
|
+
21px needs the room, and a long read wraps inside this box. Vuetify's own
|
|
923
|
+
344px minimum is zeroed first, or a narrow phone gets a toast wider than
|
|
924
|
+
the screen. */
|
|
925
|
+
min-width: 0;
|
|
926
|
+
width: min(92vw, 400px);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.anpr-toast .v-snackbar__content {
|
|
930
|
+
width: 100%;
|
|
931
|
+
padding: 14px 14px 16px 16px;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
.anpr-toast__row {
|
|
935
|
+
display: flex;
|
|
936
|
+
align-items: flex-start;
|
|
937
|
+
gap: 12px;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/* The leading glyph says WHAT was detected - a vehicle, not "information".
|
|
941
|
+
`mdi-car` resolves to `directions_car` through `utils/materialSymbols.ts`. */
|
|
942
|
+
.anpr-toast__icon {
|
|
943
|
+
flex: 0 0 auto;
|
|
944
|
+
display: inline-flex;
|
|
945
|
+
align-items: center;
|
|
946
|
+
justify-content: center;
|
|
947
|
+
width: 34px;
|
|
948
|
+
height: 34px;
|
|
949
|
+
border-radius: var(--r-pill);
|
|
950
|
+
background: var(--info-bg);
|
|
951
|
+
color: var(--info);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.anpr-toast__text {
|
|
955
|
+
flex: 1 1 auto;
|
|
956
|
+
/* Without this a long read stretches the flex item instead of wrapping. */
|
|
957
|
+
min-width: 0;
|
|
958
|
+
display: flex;
|
|
959
|
+
flex-direction: column;
|
|
960
|
+
gap: 2px;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/* The label is the SMALL half. `--fs-btn` is the size the generic toast
|
|
964
|
+
already uses, so nothing here is set smaller than the product's own toast
|
|
965
|
+
text - the plate is what got bigger. */
|
|
966
|
+
/* `--text2`, not `--muted`. `utils/theme.ts` measures `--muted` at 3.24:1 on a
|
|
967
|
+
card - below AA - and this is real text, not a graphical mark. */
|
|
968
|
+
.anpr-toast__label {
|
|
969
|
+
font-size: var(--fs-btn);
|
|
970
|
+
font-weight: var(--fw-btn);
|
|
971
|
+
line-height: 1.3;
|
|
972
|
+
color: var(--text2);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/* The payload. Tabular figures so `0`/`8` and `1`/`7` cannot be mistaken for
|
|
976
|
+
one another at a barrier, and `anywhere` so a malformed read wraps inside
|
|
977
|
+
the card rather than widening it. */
|
|
978
|
+
.anpr-toast__plate {
|
|
979
|
+
font-size: 21px;
|
|
980
|
+
font-weight: var(--fw-h1);
|
|
981
|
+
letter-spacing: 0.05em;
|
|
982
|
+
line-height: 1.25;
|
|
983
|
+
color: var(--text);
|
|
984
|
+
font-variant-numeric: tabular-nums;
|
|
985
|
+
overflow-wrap: anywhere;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/* 44px, the touch minimum - the bare 24px Vuetify cross this replaces was
|
|
989
|
+
under half that. Pulled out by its own padding so the glyph still sits on
|
|
990
|
+
the card's optical edge. */
|
|
991
|
+
.anpr-toast__close {
|
|
992
|
+
flex: 0 0 auto;
|
|
993
|
+
display: inline-flex;
|
|
994
|
+
align-items: center;
|
|
995
|
+
justify-content: center;
|
|
996
|
+
width: 44px;
|
|
997
|
+
height: 44px;
|
|
998
|
+
margin: -10px -10px 0 0;
|
|
999
|
+
padding: 0;
|
|
1000
|
+
border: 0;
|
|
1001
|
+
border-radius: var(--r-inner-sm);
|
|
1002
|
+
background: transparent;
|
|
1003
|
+
color: var(--muted);
|
|
1004
|
+
cursor: pointer;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.anpr-toast__close:hover {
|
|
1008
|
+
background: var(--hover);
|
|
1009
|
+
color: var(--text);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.anpr-toast__close:focus-visible {
|
|
1013
|
+
outline: 2px solid var(--accent);
|
|
1014
|
+
outline-offset: 2px;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/* Indented to the text column, so the button reads as belonging to the plate
|
|
1018
|
+
above it rather than to the card's edge. */
|
|
1019
|
+
.anpr-toast__actions {
|
|
1020
|
+
display: flex;
|
|
1021
|
+
margin: 12px 0 0 46px;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/* `AppButton`'s ghost is 40px everywhere else in the product; in a toast the
|
|
1025
|
+
operator is often on a tablet at a gate, so it is raised to the touch
|
|
1026
|
+
minimum here rather than changed for every screen. */
|
|
1027
|
+
.anpr-toast__actions .app-btn {
|
|
1028
|
+
min-height: 44px;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
899
1031
|
/* ------------------------------------------------------------------ */
|
|
900
1032
|
/* The "Back" link that sits above a page title. */
|
|
901
1033
|
/* `SpecificAttr.vue` (17 caller files) and `Container/Standard.vue`. */
|
package/assets/css/shell.css
CHANGED
|
@@ -284,8 +284,12 @@
|
|
|
284
284
|
pointer-events: none;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/* `button` is on the list because the design's own controls - `AppButton` and
|
|
288
|
+
the plate toast's close - are plain `<button>` elements, not `v-btn`. Left
|
|
289
|
+
off, a redesigned toast draws a button that cannot be clicked. */
|
|
287
290
|
.v-snackbar .v-snackbar__wrapper .v-btn,
|
|
288
291
|
.v-snackbar .v-snackbar__wrapper a,
|
|
292
|
+
.v-snackbar .v-snackbar__wrapper button,
|
|
289
293
|
.v-snackbar .v-snackbar__wrapper [role="button"] {
|
|
290
294
|
pointer-events: auto;
|
|
291
295
|
}
|
|
@@ -31,38 +31,54 @@
|
|
|
31
31
|
</ul>
|
|
32
32
|
</section> -->
|
|
33
33
|
|
|
34
|
+
<!--
|
|
35
|
+
THE PLATE TOAST.
|
|
36
|
+
|
|
37
|
+
The estate's own toast surface (`.app-toast`, `assets/css/screens.css`)
|
|
38
|
+
rather than Vuetify's flat `color="info"` slab, and the plate is set
|
|
39
|
+
apart from the label because the plate IS the payload - a guard reads the
|
|
40
|
+
number, not the sentence around it. Nothing here changes when the toast
|
|
41
|
+
fires, what it links to, or how long it stays; only how it is drawn.
|
|
42
|
+
-->
|
|
34
43
|
<v-snackbar
|
|
35
44
|
v-if="!isUnregisteredVisitorRoute && enableUnregisteredSnackbar && canViewVisitor"
|
|
36
45
|
v-model="snackBarMessage.modal"
|
|
37
|
-
:color="snackBarMessage.color"
|
|
38
46
|
:timeout="snackBarMessage.timeout"
|
|
39
47
|
location="bottom center"
|
|
40
|
-
class="
|
|
48
|
+
class="app-toast anpr-toast"
|
|
41
49
|
multi-line
|
|
42
50
|
:z-index="100000000"
|
|
43
51
|
>
|
|
44
|
-
<div class="
|
|
45
|
-
<
|
|
46
|
-
<
|
|
52
|
+
<div class="anpr-toast__row">
|
|
53
|
+
<span class="anpr-toast__icon" aria-hidden="true">
|
|
54
|
+
<v-icon icon="mdi-car" :size="20" />
|
|
55
|
+
</span>
|
|
56
|
+
|
|
57
|
+
<!--
|
|
58
|
+
One live region for both halves, so a screen reader announces
|
|
59
|
+
"New plate detected SLD7537A" as a single message. `polite`: a plate
|
|
60
|
+
read must not interrupt whatever the operator is being told.
|
|
61
|
+
-->
|
|
62
|
+
<div class="anpr-toast__text" role="status" aria-live="polite">
|
|
63
|
+
<span class="anpr-toast__label">{{ plateCopy.label }}</span>
|
|
64
|
+
<span class="anpr-toast__plate">{{ plateCopy.plate }}</span>
|
|
47
65
|
</div>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@click="
|
|
66
|
+
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
class="anpr-toast__close"
|
|
70
|
+
aria-label="Dismiss plate notification"
|
|
71
|
+
@click="handleCloseSnackbar"
|
|
54
72
|
>
|
|
55
|
-
|
|
56
|
-
</
|
|
73
|
+
<v-icon icon="mdi-close" :size="18" />
|
|
74
|
+
</button>
|
|
57
75
|
</div>
|
|
58
76
|
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/>
|
|
65
|
-
</template>
|
|
77
|
+
<div class="anpr-toast__actions">
|
|
78
|
+
<AppButton variant="ghost" @click="goToUnregistered">
|
|
79
|
+
Go to Unregistered
|
|
80
|
+
</AppButton>
|
|
81
|
+
</div>
|
|
66
82
|
</v-snackbar>
|
|
67
83
|
|
|
68
84
|
<!--
|
|
@@ -138,12 +154,13 @@ const lastPlateNumber = ref("");
|
|
|
138
154
|
|
|
139
155
|
const snackBarMessage = reactive({
|
|
140
156
|
timeout: 3000,
|
|
141
|
-
|
|
142
|
-
|
|
157
|
+
/** The camera's raw read. `plateToast` decides what is drawn for it. */
|
|
158
|
+
plateNumber: "",
|
|
143
159
|
modal: false,
|
|
144
|
-
isUnregistered: false,
|
|
145
160
|
});
|
|
146
161
|
|
|
162
|
+
const plateCopy = computed(() => plateToast(snackBarMessage.plateNumber));
|
|
163
|
+
|
|
147
164
|
const permanentMessageDialog = reactive({
|
|
148
165
|
modal: false,
|
|
149
166
|
text: "",
|
|
@@ -226,20 +243,21 @@ const handleCloseSnackbar = () => {
|
|
|
226
243
|
|
|
227
244
|
};
|
|
228
245
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
246
|
+
/*
|
|
247
|
+
* Several reads in quick succession REPLACE each other in this one toast -
|
|
248
|
+
* they have never stacked, and they still do not. At a busy gate a queue of
|
|
249
|
+
* toasts would put the operator several plates behind the barrier; the newest
|
|
250
|
+
* read is the one that matters, and the ones before it are on the Unregistered
|
|
251
|
+
* tab the toast links to.
|
|
252
|
+
*/
|
|
253
|
+
const showPlate = (plateNumber: string) => {
|
|
234
254
|
if (!enableUnregisteredSnackbar.value) {
|
|
235
255
|
return;
|
|
236
256
|
}
|
|
237
257
|
|
|
238
|
-
snackBarMessage.
|
|
239
|
-
snackBarMessage.color = color;
|
|
258
|
+
snackBarMessage.plateNumber = plateNumber;
|
|
240
259
|
snackBarMessage.modal = true;
|
|
241
260
|
snackBarMessage.timeout = 20000;
|
|
242
|
-
snackBarMessage.isUnregistered = isUnregistered;
|
|
243
261
|
};
|
|
244
262
|
|
|
245
263
|
const connectSocket = () => {
|
|
@@ -270,11 +288,7 @@ const connectSocket = () => {
|
|
|
270
288
|
newVisitor.value = data;
|
|
271
289
|
|
|
272
290
|
if (isCheckIn) {
|
|
273
|
-
|
|
274
|
-
`New plate detected: ${plateNumber}`,
|
|
275
|
-
"info",
|
|
276
|
-
true
|
|
277
|
-
);
|
|
291
|
+
showPlate(plateNumber);
|
|
278
292
|
lastPlateNumber.value = plateNumber;
|
|
279
293
|
return;
|
|
280
294
|
}
|
|
@@ -359,7 +373,28 @@ watch(enableUnregisteredSnackbar, (enabled) => {
|
|
|
359
373
|
}
|
|
360
374
|
});
|
|
361
375
|
|
|
376
|
+
/*
|
|
377
|
+
* Escape closes it. The close button is a real `<button>` and is reachable by
|
|
378
|
+
* tab, so the toast was already dismissible from the keyboard; Escape is what
|
|
379
|
+
* anyone actually reaches for, and it is bound only while the toast is up.
|
|
380
|
+
*/
|
|
381
|
+
const onEscape = (event: KeyboardEvent) => {
|
|
382
|
+
if (event.key === "Escape") handleCloseSnackbar();
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
watch(
|
|
386
|
+
() => snackBarMessage.modal,
|
|
387
|
+
(open) => {
|
|
388
|
+
if (typeof document === "undefined") return;
|
|
389
|
+
if (open) document.addEventListener("keydown", onEscape);
|
|
390
|
+
else document.removeEventListener("keydown", onEscape);
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
|
|
362
394
|
onUnmounted(() => {
|
|
395
|
+
if (typeof document !== "undefined") {
|
|
396
|
+
document.removeEventListener("keydown", onEscape);
|
|
397
|
+
}
|
|
363
398
|
disconnectSocket();
|
|
364
399
|
});
|
|
365
400
|
|
|
@@ -33,6 +33,37 @@ export const cameraAlertMessage = (messages: string[]): string => {
|
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The two halves of the plate toast.
|
|
38
|
+
*
|
|
39
|
+
* The camera's read is the payload, so it is returned SEPARATELY from the
|
|
40
|
+
* label rather than concatenated into one sentence - the toast sets it at its
|
|
41
|
+
* own size and weight, and a run-on `"New plate detected: SLD7537A"` cannot be
|
|
42
|
+
* typeset that way.
|
|
43
|
+
*
|
|
44
|
+
* `plate` is never empty: the socket only raises this toast when a plate was
|
|
45
|
+
* read, but a build that ever calls it without one gets a word rather than a
|
|
46
|
+
* dangling label. A read is a handful of characters - anything past
|
|
47
|
+
* `MAX_PLATE_CHARS` is a malformed payload, not a number plate, and is cut so
|
|
48
|
+
* it cannot stretch the toast off the screen.
|
|
49
|
+
*/
|
|
50
|
+
export const MAX_PLATE_CHARS = 24;
|
|
51
|
+
|
|
52
|
+
export const plateToast = (
|
|
53
|
+
plateNumber?: string | null,
|
|
54
|
+
): { label: string; plate: string } => {
|
|
55
|
+
const plate = (plateNumber ?? "").trim();
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
label: "New plate detected",
|
|
59
|
+
plate: plate
|
|
60
|
+
? plate.length > MAX_PLATE_CHARS
|
|
61
|
+
? `${plate.slice(0, MAX_PLATE_CHARS)}…`
|
|
62
|
+
: plate
|
|
63
|
+
: "Unknown",
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
36
67
|
export const useVisitorSocket = () => {
|
|
37
68
|
const socketUnregisteredVisitorTrigger = useState(
|
|
38
69
|
"socketUnregisteredVisitorTrigger",
|
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.2.
|
|
5
|
+
"version": "4.2.25",
|
|
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.",
|