@zoreal/oauth2-js 0.1.10 → 0.1.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.d.cts CHANGED
@@ -289,7 +289,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
289
289
  * auth-code mode leaves it to the RP backend.
290
290
  */
291
291
  declare const WIRE_VERSION = 1;
292
- declare const SDK_VERSION = "0.1.10";
292
+ declare const SDK_VERSION = "0.1.12";
293
293
  declare const SDK_NAME = "@zoreal/oauth2-js";
294
294
  declare const DEFAULT_ISSUER = "https://id.zoreal.com";
295
295
  /** Pending TTL is short. Poll gently; over-polling cancels the request. */
package/dist/index.d.ts CHANGED
@@ -289,7 +289,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
289
289
  * auth-code mode leaves it to the RP backend.
290
290
  */
291
291
  declare const WIRE_VERSION = 1;
292
- declare const SDK_VERSION = "0.1.10";
292
+ declare const SDK_VERSION = "0.1.12";
293
293
  declare const SDK_NAME = "@zoreal/oauth2-js";
294
294
  declare const DEFAULT_ISSUER = "https://id.zoreal.com";
295
295
  /** Pending TTL is short. Poll gently; over-polling cancels the request. */
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ function unsafeClaims(idToken) {
14
14
 
15
15
  // src/wire.ts
16
16
  var WIRE_VERSION = 1;
17
- var SDK_VERSION = "0.1.10";
17
+ var SDK_VERSION = "0.1.12";
18
18
  var SDK_NAME = "@zoreal/oauth2-js";
19
19
  var DEFAULT_ISSUER = "https://id.zoreal.com";
20
20
  var POLL_INTERVAL_MS = 2e3;
@@ -977,9 +977,111 @@ var CSS = `
977
977
  margin: 20px auto 0;
978
978
  padding: 12px;
979
979
  border: 1px solid var(--zrl-line);
980
- border-radius: 16px;
980
+ border-radius: var(--zrl-radius);
981
981
  background: var(--zrl-qr-bg);
982
+ /* The light on the edge takes its shape and colour from here. The colour
983
+ is fixed, not themed: the brand blue on both grounds, a lighter tint of
984
+ it at the head, no other hue. */
985
+ --zrl-radius: 16px;
986
+ --zrl-beam: #00b4d9;
987
+ --zrl-beam-head: #7fe0f4;
988
+ --zrl-beam-size: 100px;
989
+ --zrl-beam-time: 4s;
990
+ --zrl-glow-reach: 20px;
991
+ --zrl-glow-core: 3px;
992
+ }
993
+
994
+ /* The light on the well's edge: a short comet running along the border, with
995
+ a soft glow outside it. Three overlays inside the well, each masked so the
996
+ comet can only ever paint where its mask allows, and the white interior lies
997
+ outside every mask: nothing here can reach the quiet zone a camera needs,
998
+ whatever the comet is doing. The mask is the padding box cut out of the
999
+ border box, a transparent layer clipped to the padding box intersected
1000
+ with a solid one clipped to the border box. The prefixed form is for Chrome
1001
+ before 120 and Safari before 15.4; the unprefixed one, declared after it,
1002
+ wins everywhere else.
1003
+
1004
+ qr-beam keeps a 1px ring on the border line: the comet itself.
1005
+ qr-beam-glow is the glow: a wide band outside the well that blurs whatever
1006
+ is inside it, and inside it qr-beam-glow-band keeps a 3px ring with a
1007
+ second copy of the comet. The blur has to sit on the parent because a
1008
+ filter is applied before a mask: blurred on the band itself, the glow
1009
+ would be cut back to the band's own edge. On the parent it runs after the
1010
+ band has clipped the comet thin and before the parent's mask cuts away the
1011
+ inward half, which is what makes it fade outward and never over the QR.
1012
+ All three share one containing block, the well's padding box, so the two
1013
+ comets ride the same path; the spent badge is a later sibling and paints
1014
+ above them. */
1015
+ .${PREFIX}-qr-beam,
1016
+ .${PREFIX}-qr-beam-glow,
1017
+ .${PREFIX}-qr-beam-glow-band {
1018
+ position: absolute;
1019
+ inset: -1px;
1020
+ border: 1px solid transparent;
1021
+ border-radius: var(--zrl-radius);
1022
+ pointer-events: none;
1023
+ -webkit-mask: linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);
1024
+ -webkit-mask-clip: padding-box, border-box;
1025
+ -webkit-mask-composite: source-in;
1026
+ mask: linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);
1027
+ mask-clip: padding-box, border-box;
1028
+ mask-composite: intersect;
1029
+ }
1030
+ .${PREFIX}-qr-beam-glow {
1031
+ inset: calc(0px - var(--zrl-glow-reach));
1032
+ border-width: var(--zrl-glow-reach);
1033
+ border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-glow-reach));
1034
+ filter: blur(6px);
1035
+ opacity: 0.7;
1036
+ }
1037
+ .${PREFIX}-qr-beam-glow-band {
1038
+ inset: calc(0px - var(--zrl-glow-core));
1039
+ border-width: var(--zrl-glow-core);
1040
+ border-radius: calc(var(--zrl-radius) - 1px + var(--zrl-glow-core));
1041
+ }
1042
+
1043
+ /* At rest the edge holds a dim, even blue: a 1px line on the border and, from
1044
+ the glow band, a soft halo outside it. Hidden while the comet runs, so the
1045
+ border reads as the well's own line with a light passing over it; shown
1046
+ once the light has stopped. Every path below ends here, which is what
1047
+ makes them look the same at rest. */
1048
+ .${PREFIX}-qr-beam::before,
1049
+ .${PREFIX}-qr-beam-glow-band::before {
1050
+ content: '';
1051
+ position: absolute;
1052
+ inset: -50%;
1053
+ background: var(--zrl-beam);
1054
+ opacity: 0;
1055
+ transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
1056
+ }
1057
+
1058
+ /* The moving light. Declared bottom-up: the transform fallback here, and each
1059
+ @supports block further down replaces it where the browser allows. */
1060
+ .${PREFIX}-qr-beam::after,
1061
+ .${PREFIX}-qr-beam-glow-band::after {
1062
+ content: '';
1063
+ position: absolute;
1064
+ inset: -50%;
1065
+ background: conic-gradient(
1066
+ from var(--zrl-angle, 0deg),
1067
+ transparent 0deg 245deg,
1068
+ var(--zrl-beam) 332deg 346deg,
1069
+ transparent 356deg 360deg
1070
+ );
1071
+ animation: ${PREFIX}-orbit 3s linear infinite;
1072
+ transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1);
1073
+ }
1074
+
1075
+ /* Spent: the light stops where it is and fades, and the edge settles to the
1076
+ dim glow. Paused rather than removed, so it does not jump back to its start
1077
+ on the way out. */
1078
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam::after,
1079
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam-glow-band::after {
1080
+ animation-play-state: paused;
1081
+ opacity: 0;
982
1082
  }
1083
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam::before { opacity: 0.55; }
1084
+ .${PREFIX}-qr-well[data-spent="true"] .${PREFIX}-qr-beam-glow-band::before { opacity: 0.7; }
983
1085
 
984
1086
  .${PREFIX}-qr {
985
1087
  display: block;
@@ -1123,6 +1225,54 @@ var CSS = `
1123
1225
  70%, 100% { transform: scale(2.6); opacity: 0 }
1124
1226
  }
1125
1227
 
1228
+ /* Three ways to move the light, one look at rest.
1229
+ Where offset-path takes a rect() (Chrome 116, Firefox 122, Safari 18) the
1230
+ comet rides the edge. Before that, a conic gradient turns inside the same
1231
+ masks instead: on a registered custom property where @property exists, and
1232
+ by rotating an oversized square where it does not, since an untyped custom
1233
+ property cannot interpolate and the light would snap once a cycle.
1234
+ There is no direct query for @property support. transition-behavior
1235
+ shipped after it in every engine (Chrome 117 vs 85, Firefox 129 vs 128,
1236
+ Safari 17.4 vs 16.4), so it stands in: a yes is never wrong, and a no only
1237
+ sends a capable browser down the transform tier, which looks the same.
1238
+ inherits: false so the angle stays on the element that animates it and
1239
+ never reaches the host page or the well. */
1240
+ @property --zrl-angle {
1241
+ syntax: '<angle>';
1242
+ inherits: false;
1243
+ initial-value: 0deg;
1244
+ }
1245
+ @keyframes ${PREFIX}-orbit { to { transform: rotate(360deg) } }
1246
+ @keyframes ${PREFIX}-orbit-angle { to { --zrl-angle: 360deg } }
1247
+ @keyframes ${PREFIX}-beam { to { offset-distance: 100% } }
1248
+ @supports (transition-behavior: allow-discrete) {
1249
+ .${PREFIX}-qr-beam::after {
1250
+ inset: -1px;
1251
+ animation-name: ${PREFIX}-orbit-angle;
1252
+ }
1253
+ .${PREFIX}-qr-beam-glow-band::after {
1254
+ inset: calc(0px - var(--zrl-glow-core));
1255
+ animation-name: ${PREFIX}-orbit-angle;
1256
+ }
1257
+ }
1258
+ /* The comet: a square that rides the well's edge on a rounded-rect path, its
1259
+ anchor a little ahead of centre, turned to face the way it travels, and
1260
+ masked down to what its overlay allows. The gradient runs against the
1261
+ direction of travel: a light head, the blue body, nothing behind. One lap
1262
+ in 4s, linear: continuous motion has no ease. */
1263
+ @supports (offset-path: rect(0 auto auto 0)) {
1264
+ .${PREFIX}-qr-beam::after,
1265
+ .${PREFIX}-qr-beam-glow-band::after {
1266
+ inset: auto;
1267
+ width: var(--zrl-beam-size);
1268
+ height: var(--zrl-beam-size);
1269
+ background: linear-gradient(to left, var(--zrl-beam-head), var(--zrl-beam), transparent);
1270
+ offset-path: rect(0 auto auto 0 round calc(var(--zrl-radius) - 1px));
1271
+ offset-anchor: 60% 50%;
1272
+ animation: ${PREFIX}-beam var(--zrl-beam-time) linear infinite;
1273
+ }
1274
+ }
1275
+
1126
1276
  @media (prefers-reduced-motion: reduce) {
1127
1277
  .${PREFIX}-scrim,
1128
1278
  .${PREFIX}-card,
@@ -1132,6 +1282,11 @@ var CSS = `
1132
1282
  .${PREFIX}-cancel,
1133
1283
  .${PREFIX}-close,
1134
1284
  .${PREFIX}-timer { transition: none }
1285
+ /* No travelling light; the edge keeps its dim static glow instead. */
1286
+ .${PREFIX}-qr-beam::after,
1287
+ .${PREFIX}-qr-beam-glow-band::after { animation: none; opacity: 0 }
1288
+ .${PREFIX}-qr-beam::before { opacity: 0.55 }
1289
+ .${PREFIX}-qr-beam-glow-band::before { opacity: 0.7 }
1135
1290
  }
1136
1291
  `;
1137
1292
  function ensureStyles() {
@@ -1237,6 +1392,12 @@ function mountPairingModal(state, options) {
1237
1392
  title.id = titleId;
1238
1393
  const bodyText = el("p", cx("body-text"));
1239
1394
  const well = el("div", cx("qr-well"));
1395
+ const glow = el("span", cx("qr-beam-glow"));
1396
+ glow.setAttribute("aria-hidden", "true");
1397
+ glow.appendChild(el("span", cx("qr-beam-glow-band")));
1398
+ const beam = el("span", cx("qr-beam"));
1399
+ beam.setAttribute("aria-hidden", "true");
1400
+ well.append(glow, beam);
1240
1401
  const qr = el("img", cx("qr"));
1241
1402
  qr.alt = t.qrAlt;
1242
1403
  qr.width = 180;
@@ -1295,6 +1456,7 @@ function mountPairingModal(state, options) {
1295
1456
  bodyText.textContent = s.status === "enrolling" ? t.bodyEnrolling : settled ? t.bodyApprove : t.bodyScan;
1296
1457
  statusLabel.textContent = settled ? t.waitingApproval : t.waiting;
1297
1458
  qr.dataset.spent = String(settled);
1459
+ well.dataset.spent = String(settled);
1298
1460
  overlay.style.display = settled ? "" : "none";
1299
1461
  if (s.qrUrl) showFrame(s.qrUrl);
1300
1462
  };