@zoreal/oauth2-react 0.2.10 → 0.2.12

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 CHANGED
@@ -39,7 +39,7 @@ var import_react2 = require("react");
39
39
 
40
40
  // src/wire.ts
41
41
  var WIRE_VERSION = 1;
42
- var SDK_VERSION = "0.2.10";
42
+ var SDK_VERSION = "0.2.12";
43
43
  var DEFAULT_ISSUER = "https://id.zoreal.com";
44
44
  var POLL_INTERVAL_MS = 2e3;
45
45
  var POLL_INTERVAL_ENROLLING_MS = 5e3;
@@ -859,8 +859,20 @@ var LIGHT = `
859
859
  --zrl-accent-ink: #04698a;
860
860
  --zrl-urgent: #b4761a;
861
861
  --zrl-qr-bg: #ffffff;
862
+ --zrl-qr-filter: none;
863
+ --zrl-qr-spent-filter: blur(3px);
864
+ --zrl-qr-blend: normal;
862
865
  --zrl-shadow: 0 1px 2px rgba(16, 18, 27, 0.06), 0 20px 50px -12px rgba(16, 18, 27, 0.3);
863
866
  --zrl-ring: rgba(16, 18, 27, 0.07);
867
+ /* The light on the QR well's edge. Brand blue on both grounds, a lighter
868
+ tint at the head; only its strength is themed, see the dark block. */
869
+ --zrl-beam: #00b4d9;
870
+ --zrl-beam-head: #7fe0f4;
871
+ --zrl-beam-line: 2px;
872
+ --zrl-glow-core: 4px;
873
+ --zrl-glow-reach: 24px;
874
+ --zrl-glow-blur: 8px;
875
+ --zrl-glow-opacity: 0.6;
864
876
  `;
865
877
  var DARK = `
866
878
  --zrl-scrim: rgba(0, 0, 0, 0.62);
@@ -875,12 +887,24 @@ var DARK = `
875
887
  --zrl-accent-soft: #0d3b47;
876
888
  --zrl-accent-ink: #7fdcf0;
877
889
  --zrl-urgent: #e0a952;
878
- /* The QR well stays white in dark mode on purpose: a scanner needs the
879
- quiet-zone contrast, and an inverted QR fails on a good number of phone
880
- cameras. It reads as a deliberate light panel, not a theming miss. */
881
- --zrl-qr-bg: #ffffff;
890
+ /* The code is drawn light on the dark surface: the panel is transparent
891
+ and the image is inverted and screened, so only the modules and the
892
+ mark show. */
893
+ --zrl-qr-bg: transparent;
894
+ --zrl-qr-filter: invert(1);
895
+ --zrl-qr-spent-filter: invert(1) blur(3px);
896
+ --zrl-qr-blend: screen;
882
897
  --zrl-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 50px -12px rgba(0, 0, 0, 0.65);
883
898
  --zrl-ring: rgba(255, 255, 255, 0.1);
899
+ /* A glow that reads on a white card disappears on a dark one: the light
900
+ here is brighter and wider, and its halo reaches further out. */
901
+ --zrl-beam: #22c8ec;
902
+ --zrl-beam-head: #c2f3fc;
903
+ --zrl-beam-line: 3px;
904
+ --zrl-glow-core: 6px;
905
+ --zrl-glow-reach: 32px;
906
+ --zrl-glow-blur: 10px;
907
+ --zrl-glow-opacity: 0.85;
884
908
  `;
885
909
  var CSS = `
886
910
  .${PREFIX}-root { ${LIGHT} }
@@ -940,115 +964,128 @@ var CSS = `
940
964
  color: var(--zrl-ink-soft);
941
965
  }
942
966
 
943
- /* The light around the well: a thin ring in the accent, one bright arc
944
- travelling round it, and a soft glow of the same colour bleeding a few
945
- pixels outward. It says the pairing is live without a word.
946
-
947
- It sits BELOW the well, which is why the well is wrapped instead of given a
948
- pseudo-element. Anything drawn inside the well paints over the white quiet
949
- zone the camera needs, and a negative z-index from inside the well lands
950
- wherever the card's stacking context happens to be that frame (the card's
951
- entrance animation makes and unmakes one). The wrapper is the well's old
952
- box exactly, same size, same margin, so nothing moves; the well keeps its
953
- own stacking order on top, and the ring cannot touch the QR. */
954
- .${PREFIX}-qr-halo {
955
- position: relative;
956
- isolation: isolate;
957
- width: 204px;
958
- height: 204px;
959
- margin: 20px auto 0;
960
- }
961
-
962
967
  .${PREFIX}-qr-well {
963
968
  position: relative;
964
- z-index: 1;
965
969
  display: grid;
966
970
  place-items: center;
967
971
  box-sizing: border-box;
968
972
  width: 204px;
969
973
  height: 204px;
970
- margin: 0;
974
+ margin: 20px auto 0;
971
975
  padding: 12px;
972
976
  border: 1px solid var(--zrl-line);
973
- border-radius: 16px;
977
+ border-radius: var(--zrl-radius);
974
978
  background: var(--zrl-qr-bg);
979
+ /* The light on the edge takes its shape from here and its colour and
980
+ strength from the theme tokens above. One lap in 4s on every tier. */
981
+ --zrl-radius: 16px;
982
+ --zrl-beam-time: 4s;
975
983
  }
976
984
 
977
- /* The glow is the ring's own alpha, blurred and drawn beneath it, so it
978
- follows the arc round and fades with it. It has to be a parent of the
979
- masked band: a filter is applied before a mask, so a shadow cast from the
980
- band itself would be cut off at the band's edge. Two shadows because one
981
- 2px source blurred over 10px is too faint to read as light; the second
982
- blurs the first. */
983
- .${PREFIX}-qr-glow {
985
+ /* The light on the well's edge: a short comet running along the border, with
986
+ a soft glow outside it. Three overlays inside the well, each masked so the
987
+ comet can only ever paint where its mask allows, and the white interior lies
988
+ outside every mask: nothing here can reach the quiet zone a camera needs,
989
+ whatever the comet is doing. The mask is the padding box cut out of the
990
+ border box, a transparent layer clipped to the padding box intersected
991
+ with a solid one clipped to the border box. The prefixed form is for Chrome
992
+ before 120 and Safari before 15.4; the unprefixed one, declared after it,
993
+ wins everywhere else.
994
+
995
+ qr-beam keeps a thin ring on the border line: the comet itself.
996
+ qr-beam-glow is the glow: a wide band outside the well that blurs whatever
997
+ is inside it, and inside it qr-beam-glow-band keeps a 3px ring with a
998
+ second copy of the comet. The blur has to sit on the parent because a
999
+ filter is applied before a mask: blurred on the band itself, the glow
1000
+ would be cut back to the band's own edge. On the parent it runs after the
1001
+ band has clipped the comet thin and before the parent's mask cuts away the
1002
+ inward half, which is what makes it fade outward and never over the QR.
1003
+ All three share one containing block, the well's padding box, so the two
1004
+ comets ride the same path; the spent badge is a later sibling and paints
1005
+ above them. */
1006
+ .${PREFIX}-qr-beam,
1007
+ .${PREFIX}-qr-beam-glow,
1008
+ .${PREFIX}-qr-beam-glow-band {
984
1009
  position: absolute;
985
- inset: -2px;
1010
+ inset: calc(0px - var(--zrl-beam-line));
1011
+ border: var(--zrl-beam-line) solid transparent;
1012
+ border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-beam-line));
986
1013
  pointer-events: none;
987
- filter: drop-shadow(0 0 3px var(--zrl-accent)) drop-shadow(0 0 10px var(--zrl-accent));
1014
+ -webkit-mask: linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);
1015
+ -webkit-mask-clip: padding-box, border-box;
1016
+ -webkit-mask-composite: source-in;
1017
+ mask: linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);
1018
+ mask-clip: padding-box, border-box;
1019
+ mask-composite: intersect;
988
1020
  }
989
-
990
- /* The band: a 2px ring just outside the well, cut with a mask that keeps the
991
- padding and drops the content box. The gradient is on a pseudo-element
992
- rather than on the band, because in the fallback it has to rotate as a
993
- whole while the band stays put. The prefixed mask is for Chrome before 120;
994
- the unprefixed one, declared after it, wins everywhere else. */
995
- .${PREFIX}-qr-arc {
996
- position: absolute;
997
- inset: 0;
998
- padding: 2px;
999
- border-radius: 18px;
1000
- overflow: hidden;
1001
- -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
1002
- -webkit-mask-composite: xor;
1003
- mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
1004
- mask-composite: exclude;
1021
+ .${PREFIX}-qr-beam-glow {
1022
+ inset: calc(0px - var(--zrl-glow-reach));
1023
+ border-width: var(--zrl-glow-reach);
1024
+ border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-glow-reach));
1025
+ filter: blur(var(--zrl-glow-blur));
1026
+ opacity: var(--zrl-glow-opacity);
1027
+ will-change: filter;
1005
1028
  }
1006
- .${PREFIX}-qr-arc::before,
1007
- .${PREFIX}-qr-arc::after {
1029
+ .${PREFIX}-qr-beam-glow-band {
1030
+ inset: calc(0px - var(--zrl-glow-core));
1031
+ border-width: var(--zrl-glow-core);
1032
+ border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-glow-core));
1033
+ }
1034
+
1035
+ /* At rest the edge holds a dim, even blue: a 1px line on the border and, from
1036
+ the glow band, a soft halo outside it. Hidden while the comet runs, so the
1037
+ border reads as the well's own line with a light passing over it; shown
1038
+ once the light has stopped. Every path below ends here, which is what
1039
+ makes them look the same at rest. */
1040
+ .${PREFIX}-qr-beam::before,
1041
+ .${PREFIX}-qr-beam-glow-band::before {
1008
1042
  content: '';
1009
1043
  position: absolute;
1044
+ inset: -50%;
1045
+ background: var(--zrl-beam);
1046
+ opacity: 0;
1010
1047
  transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
1011
1048
  }
1012
1049
 
1013
- /* The light. Mostly transparent, a tail that builds over a quarter turn, a
1014
- short full-strength head and a drop-off within a few degrees, so it reads
1015
- as travelling rather than blinking. One revolution every 3s, linear:
1016
- continuous motion has no ease. Oversized so its corners still cover the
1017
- band mid-rotation in the transform fallback; the property path shrinks it
1018
- back to the band. */
1019
- .${PREFIX}-qr-arc::before {
1050
+ /* The moving light: an oversized square carrying a conic sweep, rotated
1051
+ whole. A transform animation runs on the compositor, so the light keeps
1052
+ moving while the page is busy; animating the gradient angle instead
1053
+ repaints every frame on the main thread and stutters. */
1054
+ .${PREFIX}-qr-beam::after,
1055
+ .${PREFIX}-qr-beam-glow-band::after {
1056
+ content: '';
1057
+ position: absolute;
1020
1058
  inset: -50%;
1021
1059
  background: conic-gradient(
1022
- from var(--zrl-angle, 0deg),
1023
- transparent 0deg 245deg,
1024
- var(--zrl-accent) 332deg 346deg,
1060
+ from 0deg,
1061
+ transparent 0deg 220deg,
1062
+ var(--zrl-beam) 330deg,
1063
+ var(--zrl-beam-head) 348deg,
1025
1064
  transparent 356deg 360deg
1026
1065
  );
1027
- animation: ${PREFIX}-orbit 3s linear infinite;
1028
- }
1029
-
1030
- /* The rest state: the same ring, evenly lit. Faint under the moving light so
1031
- the ring reads as a ring; stronger once the light has stopped. */
1032
- .${PREFIX}-qr-arc::after {
1033
- inset: 0;
1034
- background: var(--zrl-accent);
1035
- opacity: 0.16;
1066
+ animation: ${PREFIX}-orbit var(--zrl-beam-time) linear infinite;
1067
+ will-change: transform;
1068
+ transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
1036
1069
  }
1037
1070
 
1038
- /* Spent: the light stops where it is and fades, and the ring settles to a
1039
- dim, even glow. Paused rather than removed, so it does not jump back to
1040
- its start on the way out. */
1041
- .${PREFIX}-qr-halo[data-spent="true"] .${PREFIX}-qr-arc::before {
1071
+ /* Spent: the light stops where it is and fades, and the edge settles to the
1072
+ dim glow. Paused rather than removed, so it does not jump back to its start
1073
+ on the way out. */
1074
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam::after,
1075
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam-glow-band::after {
1042
1076
  animation-play-state: paused;
1043
1077
  opacity: 0;
1044
1078
  }
1045
- .${PREFIX}-qr-halo[data-spent="true"] .${PREFIX}-qr-arc::after { opacity: 0.34; }
1079
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam::before { opacity: 0.55; }
1080
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam-glow-band::before { opacity: 0.7; }
1046
1081
 
1047
1082
  .${PREFIX}-qr {
1048
1083
  display: block;
1049
1084
  width: 100%;
1050
1085
  height: 100%;
1051
1086
  border-radius: 8px;
1087
+ filter: var(--zrl-qr-filter);
1088
+ mix-blend-mode: var(--zrl-qr-blend);
1052
1089
  transition: filter 300ms cubic-bezier(0.23, 1, 0.32, 1),
1053
1090
  opacity 300ms cubic-bezier(0.23, 1, 0.32, 1),
1054
1091
  transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
@@ -1057,7 +1094,7 @@ var CSS = `
1057
1094
  /* Once the code is claimed the QR is spent. Blurring it out rather than
1058
1095
  swapping it keeps one object on screen through the state change, so the eye
1059
1096
  reads a transformation instead of two things trading places. */
1060
- .${PREFIX}-qr[data-spent="true"] { opacity: 0.2; filter: blur(3px); transform: scale(0.96); }
1097
+ .${PREFIX}-qr[data-spent="true"] { opacity: 0.2; filter: var(--zrl-qr-spent-filter); transform: scale(0.96); }
1061
1098
 
1062
1099
  .${PREFIX}-qr-overlay {
1063
1100
  position: absolute;
@@ -1186,32 +1223,7 @@ var CSS = `
1186
1223
  70%, 100% { transform: scale(2.6); opacity: 0 }
1187
1224
  }
1188
1225
 
1189
- /* Two ways to turn the light, one look.
1190
- Where the browser can register a typed custom property, the gradient's own
1191
- angle animates and the element never moves. Where it cannot (Firefox before
1192
- 128), an untyped custom property cannot interpolate and the light would
1193
- snap once a cycle, so the oversized pseudo-element rotates instead and the
1194
- band's mask keeps the ring in place. At rest the two are the same pixels:
1195
- same gradient, same centre, angle zero.
1196
- There is no direct query for @property support. transition-behavior
1197
- shipped after it in every engine (Chrome 117 vs 85, Firefox 129 vs 128,
1198
- Safari 17.4 vs 16.4), so it stands in: a yes is never wrong, and a no only
1199
- sends a capable browser down the fallback, which looks the same.
1200
- inherits: false so the angle stays on the element that animates it and
1201
- never reaches the host page or the well. */
1202
- @property --zrl-angle {
1203
- syntax: '<angle>';
1204
- inherits: false;
1205
- initial-value: 0deg;
1206
- }
1207
1226
  @keyframes ${PREFIX}-orbit { to { transform: rotate(360deg) } }
1208
- @keyframes ${PREFIX}-orbit-angle { to { --zrl-angle: 360deg } }
1209
- @supports (transition-behavior: allow-discrete) {
1210
- .${PREFIX}-qr-arc::before {
1211
- inset: 0;
1212
- animation-name: ${PREFIX}-orbit-angle;
1213
- }
1214
- }
1215
1227
 
1216
1228
  @media (prefers-reduced-motion: reduce) {
1217
1229
  .${PREFIX}-scrim,
@@ -1222,10 +1234,11 @@ var CSS = `
1222
1234
  .${PREFIX}-cancel,
1223
1235
  .${PREFIX}-close,
1224
1236
  .${PREFIX}-timer { transition: none }
1225
- /* No travelling light. The ring keeps a still, soft glow instead, a step
1226
- brighter than the spent state so pending and spent still read apart. */
1227
- .${PREFIX}-qr-arc::before { animation: none; opacity: 0 }
1228
- .${PREFIX}-qr-arc::after { opacity: 0.5 }
1237
+ /* No travelling light; the edge keeps its dim static glow instead. */
1238
+ .${PREFIX}-qr-beam::after,
1239
+ .${PREFIX}-qr-beam-glow-band::after { animation: none; opacity: 0 }
1240
+ .${PREFIX}-qr-beam::before { opacity: 0.55 }
1241
+ .${PREFIX}-qr-beam-glow-band::before { opacity: 0.7 }
1229
1242
  }
1230
1243
  `;
1231
1244
  function ensureStyles() {
@@ -1336,12 +1349,11 @@ function PairingModal({
1336
1349
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ZorealLockup, { height: 44, className: cx("lockup") }),
1337
1350
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: titleId, className: cx("title"), children: settled ? t.titleApprove : t.title }),
1338
1351
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: cx("body-text"), children: body }),
1339
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("qr-halo"), "data-spent": settled, children: [
1340
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-glow"), "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-arc") }) }),
1341
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("qr-well"), children: [
1342
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { className: cx("qr"), "data-spent": settled, src: frameUrl, alt: t.qrAlt, width: 180, height: 180 }),
1343
- settled && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-overlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-badge"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconPhone, {}) }) })
1344
- ] })
1352
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("qr-well"), "data-spent": settled, children: [
1353
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-beam-glow"), "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-beam-glow-band") }) }),
1354
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-beam"), "aria-hidden": true }),
1355
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { className: cx("qr"), "data-spent": settled, src: frameUrl, alt: t.qrAlt, width: 180, height: 180 }),
1356
+ settled && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-overlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("qr-badge"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconPhone, {}) }) })
1345
1357
  ] }),
1346
1358
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("status"), children: [
1347
1359
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: cx("dot"), children: [