@zoreal/oauth2-react 0.2.9 → 0.2.10
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 +129 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +129 -5
- 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.10";
|
|
9
9
|
var DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
10
10
|
var POLL_INTERVAL_MS = 2e3;
|
|
11
11
|
var POLL_INTERVAL_ENROLLING_MS = 5e3;
|
|
@@ -906,20 +906,110 @@ var CSS = `
|
|
|
906
906
|
color: var(--zrl-ink-soft);
|
|
907
907
|
}
|
|
908
908
|
|
|
909
|
+
/* The light around the well: a thin ring in the accent, one bright arc
|
|
910
|
+
travelling round it, and a soft glow of the same colour bleeding a few
|
|
911
|
+
pixels outward. It says the pairing is live without a word.
|
|
912
|
+
|
|
913
|
+
It sits BELOW the well, which is why the well is wrapped instead of given a
|
|
914
|
+
pseudo-element. Anything drawn inside the well paints over the white quiet
|
|
915
|
+
zone the camera needs, and a negative z-index from inside the well lands
|
|
916
|
+
wherever the card's stacking context happens to be that frame (the card's
|
|
917
|
+
entrance animation makes and unmakes one). The wrapper is the well's old
|
|
918
|
+
box exactly, same size, same margin, so nothing moves; the well keeps its
|
|
919
|
+
own stacking order on top, and the ring cannot touch the QR. */
|
|
920
|
+
.${PREFIX}-qr-halo {
|
|
921
|
+
position: relative;
|
|
922
|
+
isolation: isolate;
|
|
923
|
+
width: 204px;
|
|
924
|
+
height: 204px;
|
|
925
|
+
margin: 20px auto 0;
|
|
926
|
+
}
|
|
927
|
+
|
|
909
928
|
.${PREFIX}-qr-well {
|
|
910
929
|
position: relative;
|
|
930
|
+
z-index: 1;
|
|
911
931
|
display: grid;
|
|
912
932
|
place-items: center;
|
|
913
933
|
box-sizing: border-box;
|
|
914
934
|
width: 204px;
|
|
915
935
|
height: 204px;
|
|
916
|
-
margin:
|
|
936
|
+
margin: 0;
|
|
917
937
|
padding: 12px;
|
|
918
938
|
border: 1px solid var(--zrl-line);
|
|
919
939
|
border-radius: 16px;
|
|
920
940
|
background: var(--zrl-qr-bg);
|
|
921
941
|
}
|
|
922
942
|
|
|
943
|
+
/* The glow is the ring's own alpha, blurred and drawn beneath it, so it
|
|
944
|
+
follows the arc round and fades with it. It has to be a parent of the
|
|
945
|
+
masked band: a filter is applied before a mask, so a shadow cast from the
|
|
946
|
+
band itself would be cut off at the band's edge. Two shadows because one
|
|
947
|
+
2px source blurred over 10px is too faint to read as light; the second
|
|
948
|
+
blurs the first. */
|
|
949
|
+
.${PREFIX}-qr-glow {
|
|
950
|
+
position: absolute;
|
|
951
|
+
inset: -2px;
|
|
952
|
+
pointer-events: none;
|
|
953
|
+
filter: drop-shadow(0 0 3px var(--zrl-accent)) drop-shadow(0 0 10px var(--zrl-accent));
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/* The band: a 2px ring just outside the well, cut with a mask that keeps the
|
|
957
|
+
padding and drops the content box. The gradient is on a pseudo-element
|
|
958
|
+
rather than on the band, because in the fallback it has to rotate as a
|
|
959
|
+
whole while the band stays put. The prefixed mask is for Chrome before 120;
|
|
960
|
+
the unprefixed one, declared after it, wins everywhere else. */
|
|
961
|
+
.${PREFIX}-qr-arc {
|
|
962
|
+
position: absolute;
|
|
963
|
+
inset: 0;
|
|
964
|
+
padding: 2px;
|
|
965
|
+
border-radius: 18px;
|
|
966
|
+
overflow: hidden;
|
|
967
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
968
|
+
-webkit-mask-composite: xor;
|
|
969
|
+
mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
970
|
+
mask-composite: exclude;
|
|
971
|
+
}
|
|
972
|
+
.${PREFIX}-qr-arc::before,
|
|
973
|
+
.${PREFIX}-qr-arc::after {
|
|
974
|
+
content: '';
|
|
975
|
+
position: absolute;
|
|
976
|
+
transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
/* The light. Mostly transparent, a tail that builds over a quarter turn, a
|
|
980
|
+
short full-strength head and a drop-off within a few degrees, so it reads
|
|
981
|
+
as travelling rather than blinking. One revolution every 3s, linear:
|
|
982
|
+
continuous motion has no ease. Oversized so its corners still cover the
|
|
983
|
+
band mid-rotation in the transform fallback; the property path shrinks it
|
|
984
|
+
back to the band. */
|
|
985
|
+
.${PREFIX}-qr-arc::before {
|
|
986
|
+
inset: -50%;
|
|
987
|
+
background: conic-gradient(
|
|
988
|
+
from var(--zrl-angle, 0deg),
|
|
989
|
+
transparent 0deg 245deg,
|
|
990
|
+
var(--zrl-accent) 332deg 346deg,
|
|
991
|
+
transparent 356deg 360deg
|
|
992
|
+
);
|
|
993
|
+
animation: ${PREFIX}-orbit 3s linear infinite;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/* The rest state: the same ring, evenly lit. Faint under the moving light so
|
|
997
|
+
the ring reads as a ring; stronger once the light has stopped. */
|
|
998
|
+
.${PREFIX}-qr-arc::after {
|
|
999
|
+
inset: 0;
|
|
1000
|
+
background: var(--zrl-accent);
|
|
1001
|
+
opacity: 0.16;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/* Spent: the light stops where it is and fades, and the ring settles to a
|
|
1005
|
+
dim, even glow. Paused rather than removed, so it does not jump back to
|
|
1006
|
+
its start on the way out. */
|
|
1007
|
+
.${PREFIX}-qr-halo[data-spent="true"] .${PREFIX}-qr-arc::before {
|
|
1008
|
+
animation-play-state: paused;
|
|
1009
|
+
opacity: 0;
|
|
1010
|
+
}
|
|
1011
|
+
.${PREFIX}-qr-halo[data-spent="true"] .${PREFIX}-qr-arc::after { opacity: 0.34; }
|
|
1012
|
+
|
|
923
1013
|
.${PREFIX}-qr {
|
|
924
1014
|
display: block;
|
|
925
1015
|
width: 100%;
|
|
@@ -1062,6 +1152,33 @@ var CSS = `
|
|
|
1062
1152
|
70%, 100% { transform: scale(2.6); opacity: 0 }
|
|
1063
1153
|
}
|
|
1064
1154
|
|
|
1155
|
+
/* Two ways to turn the light, one look.
|
|
1156
|
+
Where the browser can register a typed custom property, the gradient's own
|
|
1157
|
+
angle animates and the element never moves. Where it cannot (Firefox before
|
|
1158
|
+
128), an untyped custom property cannot interpolate and the light would
|
|
1159
|
+
snap once a cycle, so the oversized pseudo-element rotates instead and the
|
|
1160
|
+
band's mask keeps the ring in place. At rest the two are the same pixels:
|
|
1161
|
+
same gradient, same centre, angle zero.
|
|
1162
|
+
There is no direct query for @property support. transition-behavior
|
|
1163
|
+
shipped after it in every engine (Chrome 117 vs 85, Firefox 129 vs 128,
|
|
1164
|
+
Safari 17.4 vs 16.4), so it stands in: a yes is never wrong, and a no only
|
|
1165
|
+
sends a capable browser down the fallback, which looks the same.
|
|
1166
|
+
inherits: false so the angle stays on the element that animates it and
|
|
1167
|
+
never reaches the host page or the well. */
|
|
1168
|
+
@property --zrl-angle {
|
|
1169
|
+
syntax: '<angle>';
|
|
1170
|
+
inherits: false;
|
|
1171
|
+
initial-value: 0deg;
|
|
1172
|
+
}
|
|
1173
|
+
@keyframes ${PREFIX}-orbit { to { transform: rotate(360deg) } }
|
|
1174
|
+
@keyframes ${PREFIX}-orbit-angle { to { --zrl-angle: 360deg } }
|
|
1175
|
+
@supports (transition-behavior: allow-discrete) {
|
|
1176
|
+
.${PREFIX}-qr-arc::before {
|
|
1177
|
+
inset: 0;
|
|
1178
|
+
animation-name: ${PREFIX}-orbit-angle;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1065
1182
|
@media (prefers-reduced-motion: reduce) {
|
|
1066
1183
|
.${PREFIX}-scrim,
|
|
1067
1184
|
.${PREFIX}-card,
|
|
@@ -1071,6 +1188,10 @@ var CSS = `
|
|
|
1071
1188
|
.${PREFIX}-cancel,
|
|
1072
1189
|
.${PREFIX}-close,
|
|
1073
1190
|
.${PREFIX}-timer { transition: none }
|
|
1191
|
+
/* No travelling light. The ring keeps a still, soft glow instead, a step
|
|
1192
|
+
brighter than the spent state so pending and spent still read apart. */
|
|
1193
|
+
.${PREFIX}-qr-arc::before { animation: none; opacity: 0 }
|
|
1194
|
+
.${PREFIX}-qr-arc::after { opacity: 0.5 }
|
|
1074
1195
|
}
|
|
1075
1196
|
`;
|
|
1076
1197
|
function ensureStyles() {
|
|
@@ -1181,9 +1302,12 @@ function PairingModal({
|
|
|
1181
1302
|
/* @__PURE__ */ jsx3(ZorealLockup, { height: 44, className: cx("lockup") }),
|
|
1182
1303
|
/* @__PURE__ */ jsx3("h2", { id: titleId, className: cx("title"), children: settled ? t.titleApprove : t.title }),
|
|
1183
1304
|
/* @__PURE__ */ jsx3("p", { className: cx("body-text"), children: body }),
|
|
1184
|
-
/* @__PURE__ */ jsxs3("div", { className: cx("qr-
|
|
1185
|
-
/* @__PURE__ */ jsx3("
|
|
1186
|
-
|
|
1305
|
+
/* @__PURE__ */ jsxs3("div", { className: cx("qr-halo"), "data-spent": settled, children: [
|
|
1306
|
+
/* @__PURE__ */ jsx3("span", { className: cx("qr-glow"), "aria-hidden": true, children: /* @__PURE__ */ jsx3("span", { className: cx("qr-arc") }) }),
|
|
1307
|
+
/* @__PURE__ */ jsxs3("div", { className: cx("qr-well"), children: [
|
|
1308
|
+
/* @__PURE__ */ jsx3("img", { className: cx("qr"), "data-spent": settled, src: frameUrl, alt: t.qrAlt, width: 180, height: 180 }),
|
|
1309
|
+
settled && /* @__PURE__ */ jsx3("span", { className: cx("qr-overlay"), children: /* @__PURE__ */ jsx3("span", { className: cx("qr-badge"), children: /* @__PURE__ */ jsx3(IconPhone, {}) }) })
|
|
1310
|
+
] })
|
|
1187
1311
|
] }),
|
|
1188
1312
|
/* @__PURE__ */ jsxs3("div", { className: cx("status"), children: [
|
|
1189
1313
|
/* @__PURE__ */ jsxs3("span", { className: cx("dot"), children: [
|