@zoreal/oauth2-react 0.2.9 → 0.2.11
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/dist/index.cjs +160 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +160 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createContext, useContext, useMemo, useState as useState2 } from "react
|
|
|
5
5
|
|
|
6
6
|
// src/wire.ts
|
|
7
7
|
var WIRE_VERSION = 1;
|
|
8
|
-
var SDK_VERSION = "0.2.
|
|
8
|
+
var SDK_VERSION = "0.2.11";
|
|
9
9
|
var DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
10
10
|
var POLL_INTERVAL_MS = 2e3;
|
|
11
11
|
var POLL_INTERVAL_ENROLLING_MS = 5e3;
|
|
@@ -916,10 +916,112 @@ var CSS = `
|
|
|
916
916
|
margin: 20px auto 0;
|
|
917
917
|
padding: 12px;
|
|
918
918
|
border: 1px solid var(--zrl-line);
|
|
919
|
-
border-radius:
|
|
919
|
+
border-radius: var(--zrl-radius);
|
|
920
920
|
background: var(--zrl-qr-bg);
|
|
921
|
+
/* The light on the edge takes its shape and colour from here. The colour
|
|
922
|
+
is fixed, not themed: the brand blue on both grounds, a lighter tint of
|
|
923
|
+
it at the head, no other hue. */
|
|
924
|
+
--zrl-radius: 16px;
|
|
925
|
+
--zrl-beam: #00b4d9;
|
|
926
|
+
--zrl-beam-head: #7fe0f4;
|
|
927
|
+
--zrl-beam-size: 100px;
|
|
928
|
+
--zrl-beam-time: 4s;
|
|
929
|
+
--zrl-glow-reach: 20px;
|
|
930
|
+
--zrl-glow-core: 3px;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/* The light on the well's edge: a short comet running along the border, with
|
|
934
|
+
a soft glow outside it. Three overlays inside the well, each masked so the
|
|
935
|
+
comet can only ever paint where its mask allows, and the white interior lies
|
|
936
|
+
outside every mask: nothing here can reach the quiet zone a camera needs,
|
|
937
|
+
whatever the comet is doing. The mask is the padding box cut out of the
|
|
938
|
+
border box, a transparent layer clipped to the padding box intersected
|
|
939
|
+
with a solid one clipped to the border box. The prefixed form is for Chrome
|
|
940
|
+
before 120 and Safari before 15.4; the unprefixed one, declared after it,
|
|
941
|
+
wins everywhere else.
|
|
942
|
+
|
|
943
|
+
qr-beam keeps a 1px ring on the border line: the comet itself.
|
|
944
|
+
qr-beam-glow is the glow: a wide band outside the well that blurs whatever
|
|
945
|
+
is inside it, and inside it qr-beam-glow-band keeps a 3px ring with a
|
|
946
|
+
second copy of the comet. The blur has to sit on the parent because a
|
|
947
|
+
filter is applied before a mask: blurred on the band itself, the glow
|
|
948
|
+
would be cut back to the band's own edge. On the parent it runs after the
|
|
949
|
+
band has clipped the comet thin and before the parent's mask cuts away the
|
|
950
|
+
inward half, which is what makes it fade outward and never over the QR.
|
|
951
|
+
All three share one containing block, the well's padding box, so the two
|
|
952
|
+
comets ride the same path; the spent badge is a later sibling and paints
|
|
953
|
+
above them. */
|
|
954
|
+
.${PREFIX}-qr-beam,
|
|
955
|
+
.${PREFIX}-qr-beam-glow,
|
|
956
|
+
.${PREFIX}-qr-beam-glow-band {
|
|
957
|
+
position: absolute;
|
|
958
|
+
inset: -1px;
|
|
959
|
+
border: 1px solid transparent;
|
|
960
|
+
border-radius: var(--zrl-radius);
|
|
961
|
+
pointer-events: none;
|
|
962
|
+
-webkit-mask: linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);
|
|
963
|
+
-webkit-mask-clip: padding-box, border-box;
|
|
964
|
+
-webkit-mask-composite: source-in;
|
|
965
|
+
mask: linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);
|
|
966
|
+
mask-clip: padding-box, border-box;
|
|
967
|
+
mask-composite: intersect;
|
|
968
|
+
}
|
|
969
|
+
.${PREFIX}-qr-beam-glow {
|
|
970
|
+
inset: calc(0px - var(--zrl-glow-reach));
|
|
971
|
+
border-width: var(--zrl-glow-reach);
|
|
972
|
+
border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-glow-reach));
|
|
973
|
+
filter: blur(6px);
|
|
974
|
+
opacity: 0.7;
|
|
975
|
+
}
|
|
976
|
+
.${PREFIX}-qr-beam-glow-band {
|
|
977
|
+
inset: calc(0px - var(--zrl-glow-core));
|
|
978
|
+
border-width: var(--zrl-glow-core);
|
|
979
|
+
border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-glow-core));
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/* At rest the edge holds a dim, even blue: a 1px line on the border and, from
|
|
983
|
+
the glow band, a soft halo outside it. Hidden while the comet runs, so the
|
|
984
|
+
border reads as the well's own line with a light passing over it; shown
|
|
985
|
+
once the light has stopped. Every path below ends here, which is what
|
|
986
|
+
makes them look the same at rest. */
|
|
987
|
+
.${PREFIX}-qr-beam::before,
|
|
988
|
+
.${PREFIX}-qr-beam-glow-band::before {
|
|
989
|
+
content: '';
|
|
990
|
+
position: absolute;
|
|
991
|
+
inset: -50%;
|
|
992
|
+
background: var(--zrl-beam);
|
|
993
|
+
opacity: 0;
|
|
994
|
+
transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
921
995
|
}
|
|
922
996
|
|
|
997
|
+
/* The moving light. Declared bottom-up: the transform fallback here, and each
|
|
998
|
+
@supports block further down replaces it where the browser allows. */
|
|
999
|
+
.${PREFIX}-qr-beam::after,
|
|
1000
|
+
.${PREFIX}-qr-beam-glow-band::after {
|
|
1001
|
+
content: '';
|
|
1002
|
+
position: absolute;
|
|
1003
|
+
inset: -50%;
|
|
1004
|
+
background: conic-gradient(
|
|
1005
|
+
from var(--zrl-angle, 0deg),
|
|
1006
|
+
transparent 0deg 245deg,
|
|
1007
|
+
var(--zrl-beam) 332deg 346deg,
|
|
1008
|
+
transparent 356deg 360deg
|
|
1009
|
+
);
|
|
1010
|
+
animation: ${PREFIX}-orbit 3s linear infinite;
|
|
1011
|
+
transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/* Spent: the light stops where it is and fades, and the edge settles to the
|
|
1015
|
+
dim glow. Paused rather than removed, so it does not jump back to its start
|
|
1016
|
+
on the way out. */
|
|
1017
|
+
.${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam::after,
|
|
1018
|
+
.${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam-glow-band::after {
|
|
1019
|
+
animation-play-state: paused;
|
|
1020
|
+
opacity: 0;
|
|
1021
|
+
}
|
|
1022
|
+
.${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam::before { opacity: 0.55; }
|
|
1023
|
+
.${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam-glow-band::before { opacity: 0.7; }
|
|
1024
|
+
|
|
923
1025
|
.${PREFIX}-qr {
|
|
924
1026
|
display: block;
|
|
925
1027
|
width: 100%;
|
|
@@ -1062,6 +1164,54 @@ var CSS = `
|
|
|
1062
1164
|
70%, 100% { transform: scale(2.6); opacity: 0 }
|
|
1063
1165
|
}
|
|
1064
1166
|
|
|
1167
|
+
/* Three ways to move the light, one look at rest.
|
|
1168
|
+
Where offset-path takes a rect() (Chrome 116, Firefox 122, Safari 18) the
|
|
1169
|
+
comet rides the edge. Before that, a conic gradient turns inside the same
|
|
1170
|
+
masks instead: on a registered custom property where @property exists, and
|
|
1171
|
+
by rotating an oversized square where it does not, since an untyped custom
|
|
1172
|
+
property cannot interpolate and the light would snap once a cycle.
|
|
1173
|
+
There is no direct query for @property support. transition-behavior
|
|
1174
|
+
shipped after it in every engine (Chrome 117 vs 85, Firefox 129 vs 128,
|
|
1175
|
+
Safari 17.4 vs 16.4), so it stands in: a yes is never wrong, and a no only
|
|
1176
|
+
sends a capable browser down the transform tier, which looks the same.
|
|
1177
|
+
inherits: false so the angle stays on the element that animates it and
|
|
1178
|
+
never reaches the host page or the well. */
|
|
1179
|
+
@property --zrl-angle {
|
|
1180
|
+
syntax: '<angle>';
|
|
1181
|
+
inherits: false;
|
|
1182
|
+
initial-value: 0deg;
|
|
1183
|
+
}
|
|
1184
|
+
@keyframes ${PREFIX}-orbit { to { transform: rotate(360deg) } }
|
|
1185
|
+
@keyframes ${PREFIX}-orbit-angle { to { --zrl-angle: 360deg } }
|
|
1186
|
+
@keyframes ${PREFIX}-beam { to { offset-distance: 100% } }
|
|
1187
|
+
@supports (transition-behavior: allow-discrete) {
|
|
1188
|
+
.${PREFIX}-qr-beam::after {
|
|
1189
|
+
inset: -1px;
|
|
1190
|
+
animation-name: ${PREFIX}-orbit-angle;
|
|
1191
|
+
}
|
|
1192
|
+
.${PREFIX}-qr-beam-glow-band::after {
|
|
1193
|
+
inset: calc(0px - var(--zrl-glow-core));
|
|
1194
|
+
animation-name: ${PREFIX}-orbit-angle;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
/* The comet: a square that rides the well's edge on a rounded-rect path, its
|
|
1198
|
+
anchor a little ahead of centre, turned to face the way it travels, and
|
|
1199
|
+
masked down to what its overlay allows. The gradient runs against the
|
|
1200
|
+
direction of travel: a light head, the blue body, nothing behind. One lap
|
|
1201
|
+
in 4s, linear: continuous motion has no ease. */
|
|
1202
|
+
@supports (offset-path: rect(0 auto auto 0)) {
|
|
1203
|
+
.${PREFIX}-qr-beam::after,
|
|
1204
|
+
.${PREFIX}-qr-beam-glow-band::after {
|
|
1205
|
+
inset: auto;
|
|
1206
|
+
width: var(--zrl-beam-size);
|
|
1207
|
+
height: var(--zrl-beam-size);
|
|
1208
|
+
background: linear-gradient(to left, var(--zrl-beam-head), var(--zrl-beam), transparent);
|
|
1209
|
+
offset-path: rect(0 auto auto 0 round calc(var(--zrl-radius) - 1px));
|
|
1210
|
+
offset-anchor: 60% 50%;
|
|
1211
|
+
animation: ${PREFIX}-beam var(--zrl-beam-time) linear infinite;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1065
1215
|
@media (prefers-reduced-motion: reduce) {
|
|
1066
1216
|
.${PREFIX}-scrim,
|
|
1067
1217
|
.${PREFIX}-card,
|
|
@@ -1071,6 +1221,11 @@ var CSS = `
|
|
|
1071
1221
|
.${PREFIX}-cancel,
|
|
1072
1222
|
.${PREFIX}-close,
|
|
1073
1223
|
.${PREFIX}-timer { transition: none }
|
|
1224
|
+
/* No travelling light; the edge keeps its dim static glow instead. */
|
|
1225
|
+
.${PREFIX}-qr-beam::after,
|
|
1226
|
+
.${PREFIX}-qr-beam-glow-band::after { animation: none; opacity: 0 }
|
|
1227
|
+
.${PREFIX}-qr-beam::before { opacity: 0.55 }
|
|
1228
|
+
.${PREFIX}-qr-beam-glow-band::before { opacity: 0.7 }
|
|
1074
1229
|
}
|
|
1075
1230
|
`;
|
|
1076
1231
|
function ensureStyles() {
|
|
@@ -1181,7 +1336,9 @@ function PairingModal({
|
|
|
1181
1336
|
/* @__PURE__ */ jsx3(ZorealLockup, { height: 44, className: cx("lockup") }),
|
|
1182
1337
|
/* @__PURE__ */ jsx3("h2", { id: titleId, className: cx("title"), children: settled ? t.titleApprove : t.title }),
|
|
1183
1338
|
/* @__PURE__ */ jsx3("p", { className: cx("body-text"), children: body }),
|
|
1184
|
-
/* @__PURE__ */ jsxs3("div", { className: cx("qr-well"), children: [
|
|
1339
|
+
/* @__PURE__ */ jsxs3("div", { className: cx("qr-well"), "data-spent": settled, children: [
|
|
1340
|
+
/* @__PURE__ */ jsx3("span", { className: cx("qr-beam-glow"), "aria-hidden": true, children: /* @__PURE__ */ jsx3("span", { className: cx("qr-beam-glow-band") }) }),
|
|
1341
|
+
/* @__PURE__ */ jsx3("span", { className: cx("qr-beam"), "aria-hidden": true }),
|
|
1185
1342
|
/* @__PURE__ */ jsx3("img", { className: cx("qr"), "data-spent": settled, src: frameUrl, alt: t.qrAlt, width: 180, height: 180 }),
|
|
1186
1343
|
settled && /* @__PURE__ */ jsx3("span", { className: cx("qr-overlay"), children: /* @__PURE__ */ jsx3("span", { className: cx("qr-badge"), children: /* @__PURE__ */ jsx3(IconPhone, {}) }) })
|
|
1187
1344
|
] }),
|