@zoreal/oauth2-react 0.2.10 → 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.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.10";
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;
@@ -906,109 +906,121 @@ 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
-
928
909
  .${PREFIX}-qr-well {
929
910
  position: relative;
930
- z-index: 1;
931
911
  display: grid;
932
912
  place-items: center;
933
913
  box-sizing: border-box;
934
914
  width: 204px;
935
915
  height: 204px;
936
- margin: 0;
916
+ margin: 20px auto 0;
937
917
  padding: 12px;
938
918
  border: 1px solid var(--zrl-line);
939
- border-radius: 16px;
919
+ border-radius: var(--zrl-radius);
940
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;
941
931
  }
942
932
 
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 {
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 {
950
957
  position: absolute;
951
- inset: -2px;
958
+ inset: -1px;
959
+ border: 1px solid transparent;
960
+ border-radius: var(--zrl-radius);
952
961
  pointer-events: none;
953
- filter: drop-shadow(0 0 3px var(--zrl-accent)) drop-shadow(0 0 10px var(--zrl-accent));
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;
954
968
  }
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;
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));
971
980
  }
972
- .${PREFIX}-qr-arc::before,
973
- .${PREFIX}-qr-arc::after {
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 {
974
989
  content: '';
975
990
  position: absolute;
991
+ inset: -50%;
992
+ background: var(--zrl-beam);
993
+ opacity: 0;
976
994
  transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
977
995
  }
978
996
 
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 {
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;
986
1003
  inset: -50%;
987
1004
  background: conic-gradient(
988
1005
  from var(--zrl-angle, 0deg),
989
1006
  transparent 0deg 245deg,
990
- var(--zrl-accent) 332deg 346deg,
1007
+ var(--zrl-beam) 332deg 346deg,
991
1008
  transparent 356deg 360deg
992
1009
  );
993
1010
  animation: ${PREFIX}-orbit 3s linear infinite;
1011
+ transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
994
1012
  }
995
1013
 
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 {
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 {
1008
1019
  animation-play-state: paused;
1009
1020
  opacity: 0;
1010
1021
  }
1011
- .${PREFIX}-qr-halo[data-spent="true"] .${PREFIX}-qr-arc::after { opacity: 0.34; }
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; }
1012
1024
 
1013
1025
  .${PREFIX}-qr {
1014
1026
  display: block;
@@ -1152,17 +1164,16 @@ var CSS = `
1152
1164
  70%, 100% { transform: scale(2.6); opacity: 0 }
1153
1165
  }
1154
1166
 
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.
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.
1162
1173
  There is no direct query for @property support. transition-behavior
1163
1174
  shipped after it in every engine (Chrome 117 vs 85, Firefox 129 vs 128,
1164
1175
  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.
1176
+ sends a capable browser down the transform tier, which looks the same.
1166
1177
  inherits: false so the angle stays on the element that animates it and
1167
1178
  never reaches the host page or the well. */
1168
1179
  @property --zrl-angle {
@@ -1172,11 +1183,33 @@ var CSS = `
1172
1183
  }
1173
1184
  @keyframes ${PREFIX}-orbit { to { transform: rotate(360deg) } }
1174
1185
  @keyframes ${PREFIX}-orbit-angle { to { --zrl-angle: 360deg } }
1186
+ @keyframes ${PREFIX}-beam { to { offset-distance: 100% } }
1175
1187
  @supports (transition-behavior: allow-discrete) {
1176
- .${PREFIX}-qr-arc::before {
1177
- inset: 0;
1188
+ .${PREFIX}-qr-beam::after {
1189
+ inset: -1px;
1178
1190
  animation-name: ${PREFIX}-orbit-angle;
1179
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
+ }
1180
1213
  }
1181
1214
 
1182
1215
  @media (prefers-reduced-motion: reduce) {
@@ -1188,10 +1221,11 @@ var CSS = `
1188
1221
  .${PREFIX}-cancel,
1189
1222
  .${PREFIX}-close,
1190
1223
  .${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 }
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 }
1195
1229
  }
1196
1230
  `;
1197
1231
  function ensureStyles() {
@@ -1302,12 +1336,11 @@ function PairingModal({
1302
1336
  /* @__PURE__ */ jsx3(ZorealLockup, { height: 44, className: cx("lockup") }),
1303
1337
  /* @__PURE__ */ jsx3("h2", { id: titleId, className: cx("title"), children: settled ? t.titleApprove : t.title }),
1304
1338
  /* @__PURE__ */ jsx3("p", { className: cx("body-text"), children: body }),
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
- ] })
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 }),
1342
+ /* @__PURE__ */ jsx3("img", { className: cx("qr"), "data-spent": settled, src: frameUrl, alt: t.qrAlt, width: 180, height: 180 }),
1343
+ settled && /* @__PURE__ */ jsx3("span", { className: cx("qr-overlay"), children: /* @__PURE__ */ jsx3("span", { className: cx("qr-badge"), children: /* @__PURE__ */ jsx3(IconPhone, {}) }) })
1311
1344
  ] }),
1312
1345
  /* @__PURE__ */ jsxs3("div", { className: cx("status"), children: [
1313
1346
  /* @__PURE__ */ jsxs3("span", { className: cx("dot"), children: [