@rizom/site-rizom-ai 0.2.0-alpha.261 → 0.2.0-alpha.262

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rizom/site-rizom-ai",
3
- "version": "0.2.0-alpha.261",
3
+ "version": "0.2.0-alpha.262",
4
4
  "description": "Consolidated Rizom brand site, runtime, layouts, and chrome",
5
5
  "type": "module",
6
6
  "exports": {
@@ -214,13 +214,26 @@ export const storyRuntimeScript: string = `(function () {
214
214
  });
215
215
  return rows.length ? rows[rows.length - 1] : null;
216
216
  }
217
+ // A point is in view when no scrolling ancestor hides it and it is on screen.
218
+ function inView(element, middle) {
219
+ if (middle < 0 || middle > innerHeight) return false;
220
+ var parent = element.parentElement;
221
+ while (parent && parent !== document.body) {
222
+ var overflow = getComputedStyle(parent).overflowY;
223
+ if (overflow === "auto" || overflow === "scroll") {
224
+ var area = parent.getBoundingClientRect();
225
+ if (middle < area.top || middle > area.bottom) return false;
226
+ }
227
+ parent = parent.parentElement;
228
+ }
229
+ return true;
230
+ }
217
231
  function drawLeads() {
218
232
  if (!leadsLayer) return;
219
233
  while (leadsLayer.firstChild) leadsLayer.removeChild(leadsLayer.firstChild);
220
234
  if (narrow.matches || !askHost) return;
221
- // The layer's own box is the frame: coordinates are its, whatever positions it.
222
- var frame = leadsLayer.getBoundingClientRect();
223
- leadsLayer.setAttribute("viewBox", "0 0 " + frame.width + " " + frame.height);
235
+ // The layer is fixed to the viewport, so viewport coordinates are its own.
236
+ leadsLayer.setAttribute("viewBox", "0 0 " + innerWidth + " " + innerHeight);
224
237
  Object.keys(sourceBrain).forEach(function (key) {
225
238
  var mark = homeMarks.filter(function (m) { return m.getAttribute("data-brain") === sourceBrain[key]; })[0];
226
239
  var row = listedRow(askHost, key);
@@ -228,11 +241,12 @@ export const storyRuntimeScript: string = `(function () {
228
241
  var from = row.getBoundingClientRect();
229
242
  if (!from.height) return;
230
243
  var to = mark.getBoundingClientRect();
231
- var x1 = from.right + GAP - frame.left;
232
- var y1 = from.top + from.height / 2 - frame.top;
233
- var toward = to.left + to.width / 2 - frame.left;
244
+ var y1 = from.top + from.height / 2;
245
+ var y2 = to.top + to.height / 2;
246
+ if (!inView(row, y1) || !inView(mark, y2)) return;
247
+ var x1 = from.right + GAP;
248
+ var toward = to.left + to.width / 2;
234
249
  var x2 = toward > x1 ? toward - GLYPH : toward + GLYPH;
235
- var y2 = to.top + to.height / 2 - frame.top;
236
250
  var bend = Math.max(40, Math.abs(x2 - x1) / 2);
237
251
  var lead = document.createElementNS(SVG, "path");
238
252
  lead.setAttribute("data-lead", key);
package/src/story.css CHANGED
@@ -784,6 +784,35 @@
784
784
  width: min(100%, calc(100svh - var(--bar-height, 4.6rem) - 2rem));
785
785
  aspect-ratio: 1;
786
786
  }
787
+ /* On a wide screen the opening's drawing keeps its place beside the words
788
+ while the opening is read, an answer included, and leaves with the opening;
789
+ it fades once the reading has moved the figure on, as on a phone. In flow
790
+ with no height, so the words do not move; its width is the room right of
791
+ the words, as the absolute layer's was. */
792
+ @media not all and (max-width: 60rem) {
793
+ :where(.chapter--opening) > .net-layer {
794
+ position: sticky;
795
+ order: -1;
796
+ top: calc(
797
+ var(--bar-height, 4.6rem) + (100svh - var(--bar-height, 4.6rem)) / 2
798
+ );
799
+ height: 0;
800
+ margin-left: calc(var(--words) + var(--words-gap));
801
+ width: calc(
802
+ 100cqi - max(0px, (100cqi - 80rem) / 2) - clamp(1rem, 5vw, 5rem) -
803
+ var(--words) - var(--words-gap) - clamp(1rem, 6vw, 7rem)
804
+ );
805
+ transition: opacity 0.6s ease;
806
+ }
807
+ :where(.chapter--opening) > .net-layer > * {
808
+ translate: 0 -50%;
809
+ }
810
+ .story:has(.figure:not([data-stage="0"]))
811
+ :where(.chapter--opening)
812
+ > .net-layer {
813
+ opacity: 0;
814
+ }
815
+ }
787
816
  .net-svg {
788
817
  overflow: visible;
789
818
  }
@@ -1158,6 +1187,14 @@
1158
1187
  --ask-display: var(--font-display);
1159
1188
  --ask-muted: var(--color-text-light);
1160
1189
  }
1190
+ /* The page is the one scroller beside the drawing: the conversation grows in
1191
+ the opening instead of scrolling inside a band under the lede. */
1192
+ .opening__ask:not([data-ask-sheet]) .brain-box-scroll {
1193
+ max-height: none;
1194
+ overflow: visible;
1195
+ mask-image: none;
1196
+ padding-bottom: 0;
1197
+ }
1161
1198
  .ask__topics {
1162
1199
  list-style: none;
1163
1200
  margin: 1rem 0 0;
@@ -1422,12 +1459,13 @@
1422
1459
  the first item of its scroll, a slot holding its place meanwhile, and a
1423
1460
  tapped dot flashes its source. */
1424
1461
  .net-leads {
1425
- position: absolute;
1462
+ /* Leads join words to the drawing across the page, so the viewport is
1463
+ their frame; the runtime draws them in viewport coordinates. */
1464
+ position: fixed;
1426
1465
  inset: 0;
1427
1466
  z-index: 2;
1428
- width: 100%;
1429
- height: 100%;
1430
- /* The chapter is the words' width; a lead runs past it to the drawing. */
1467
+ width: 100vw;
1468
+ height: 100vh;
1431
1469
  overflow: visible;
1432
1470
  pointer-events: none;
1433
1471
  }