@supersuit/artifacts 0.31.0 → 0.31.1
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/CHANGELOG.md +14 -0
- package/lib/reader/artifact-reader.js +15 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
`@supersuit/artifacts`. One entry per version, newest first. Each entry says what changed, how a
|
|
4
4
|
host can tell whether it is affected (DETECTOR), what a host does about it (REMEDY), and the tests.
|
|
5
5
|
|
|
6
|
+
## 0.31.1
|
|
7
|
+
|
|
8
|
+
**Play from here stays inside the page card, not only the screen.** 0.30.2 kept the bar inside
|
|
9
|
+
the screen, but the company host draws the page in a rounded card that clips its content, so the
|
|
10
|
+
bar's right end was still cut off at the card's edge.
|
|
11
|
+
|
|
12
|
+
- The bar is bounded by every ancestor that clips (any overflow other than visible) as well as the
|
|
13
|
+
screen.
|
|
14
|
+
- DETECTOR: at iPhone width on the company host, pause and tap a word at the right edge. A pill
|
|
15
|
+
whose right end is cut off means 0.30.2.
|
|
16
|
+
- REMEDY: update the dependency.
|
|
17
|
+
- Tests: `artifact-reader-controls.test.tsx` (a clipping card 10 to 380px keeps the bar's right edge
|
|
18
|
+
at 372px or less).
|
|
19
|
+
|
|
6
20
|
## 0.31.0
|
|
7
21
|
|
|
8
22
|
**The owner and admins change a page's share and comment settings from the page menu, and a later
|
|
@@ -173,10 +173,23 @@ export function ArtifactReader({ src, words, rootId, label, accent, ground, }) {
|
|
|
173
173
|
const el = offerRef.current;
|
|
174
174
|
if (!offer || !el || offer.nudged)
|
|
175
175
|
return;
|
|
176
|
-
|
|
176
|
+
// Inside the screen AND inside whatever box clips the bar (a host's rounded page card).
|
|
177
|
+
let lo = 0;
|
|
178
|
+
let hi = document.documentElement.clientWidth || window.innerWidth;
|
|
179
|
+
for (let p = el.parentElement; p && p !== document.body; p = p.parentElement) {
|
|
180
|
+
const o = getComputedStyle(p);
|
|
181
|
+
if (o.overflowX !== 'visible' || o.overflow !== 'visible') {
|
|
182
|
+
const b = p.getBoundingClientRect();
|
|
183
|
+
if (b.width > 0) {
|
|
184
|
+
lo = Math.max(lo, b.left);
|
|
185
|
+
hi = Math.min(hi, b.right);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const vw = hi;
|
|
177
190
|
const r = el.getBoundingClientRect();
|
|
178
191
|
// No layout to measure (a server render, a test DOM): leave the placement as computed.
|
|
179
|
-
const shift = r.width === 0 ? 0 : r.right > vw - 8 ? vw - 8 - r.right : r.left < 8 ? 8 - r.left : 0;
|
|
192
|
+
const shift = r.width === 0 ? 0 : r.right > vw - 8 ? vw - 8 - r.right : r.left < lo + 8 ? lo + 8 - r.left : 0;
|
|
180
193
|
// Once per tap: measured again, an element with no layout would move forever.
|
|
181
194
|
setOffer({ ...offer, left: offer.left + (Math.abs(shift) >= 1 ? shift : 0), nudged: true });
|
|
182
195
|
}, [offer]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersuit/artifacts",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Publish markdown as branded, read-aloud pages from a Next.js app: the artifacts store, the route factory, the read-along reader, brand packs, password and confidential pages, and share cards.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|