Skip to content

Commit 812672d

Browse files
committed
wor
1 parent aed9e54 commit 812672d

9 files changed

Lines changed: 123 additions & 30 deletions

File tree

dist/build/jsenv_core_packages.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7205,15 +7205,15 @@ const inferRuntimeCompatFromClosestPackage = async (
72057205
}
72067206

72077207
if (runtimeType === "browser") {
7208-
const browserlist = packageJSON.browserlist;
7209-
if (!browserlist) {
7208+
const browserslistQuery = packageJSON.browserslist;
7209+
if (!browserslistQuery) {
72107210
return null;
72117211
}
72127212
const namespace = await import("./browserslist_index/browserslist_index.js");
72137213
const browserslist = namespace.default;
7214-
const browserslistConfig = browserslist(browserlist);
7214+
const browserslistResult = browserslist(browserslistQuery);
72157215
const runtimeCompat = {};
7216-
for (const browserNameAndVersion of browserslistConfig) {
7216+
for (const browserNameAndVersion of browserslistResult) {
72177217
let [name, version] = browserNameAndVersion.split(" ");
72187218
if (name === "ios_saf") {
72197219
name = "ios_safari";

packages/frontend/navi/dist/jsenv_navi.js

Lines changed: 108 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37774,14 +37774,82 @@ const FIXED_BAR_SPACE_CSS = /* css */ `
3777437774
// they overlap: the room to give back is the largest of them, not their sum,
3777537775
// and one leaving must leave the others' room in place.
3777637776
const sizeMapByArea = new Map();
37777-
37777+
// What is currently on <html> for each area (absent = the variable is not set).
37778+
// Writing the value that is already there would invalidate layout for nothing,
37779+
// and several bars sharing an edge means most calls compute the same largest
37780+
// size again — the ones for the smaller bars, and the second half of a page
37781+
// transition.
37782+
const writtenValueByArea = new Map();
37783+
37784+
// A size that must land before the next paint: a render changed the bar, so
37785+
// the room it takes is given back in that same commit and the content is never
37786+
// painted under it.
3777837787
/**
3777937788
* @param {"top"|"bottom"|"left"|"right"} area
3778037789
* @param {Element} barElement - Which bar this size belongs to.
3778137790
* @param {number|null} size - In px; `null` gives that bar's room back to the
3778237791
* content.
3778337792
*/
3778437793
const setFixedBarSpace = (area, barElement, size) => {
37794+
dropPendingSize(area, barElement);
37795+
storeSize(area, barElement, size);
37796+
writeSpace(area);
37797+
};
37798+
37799+
// A size nothing asked for, coming from a ResizeObserver. Writing the variable
37800+
// resizes an ANCESTOR of the bars — the scroll container takes its padding
37801+
// from it — and mutating layout from inside a resize callback is what makes
37802+
// the browser report "ResizeObserver loop completed with undelivered
37803+
// notifications". So the write waits for the frame that resize produced.
37804+
// Queued here rather than deferred by each bar on its own, so the bars sharing
37805+
// an edge resolve to a single write instead of one per bar.
37806+
/**
37807+
* @param {"top"|"bottom"|"left"|"right"} area
37808+
* @param {Element} barElement - Which bar this size belongs to.
37809+
* @param {number} size - In px.
37810+
*/
37811+
const requestFixedBarSpace = (area, barElement, size) => {
37812+
let pendingSizeMap = pendingSizeMapByArea.get(area);
37813+
if (!pendingSizeMap) {
37814+
pendingSizeMap = new Map();
37815+
pendingSizeMapByArea.set(area, pendingSizeMap);
37816+
}
37817+
pendingSizeMap.set(barElement, size);
37818+
if (flushFrame !== null) {
37819+
return;
37820+
}
37821+
flushFrame = requestAnimationFrame(flushPendingSizes);
37822+
};
37823+
37824+
const pendingSizeMapByArea = new Map();
37825+
let flushFrame = null;
37826+
37827+
const flushPendingSizes = () => {
37828+
flushFrame = null;
37829+
for (const [area, pendingSizeMap] of pendingSizeMapByArea) {
37830+
for (const [barElement, size] of pendingSizeMap) {
37831+
storeSize(area, barElement, size);
37832+
}
37833+
writeSpace(area);
37834+
}
37835+
pendingSizeMapByArea.clear();
37836+
};
37837+
37838+
// What the bar itself just said wins over what its observer had queued about
37839+
// it: a bar unmounting gives its room back, and a size queued for it before
37840+
// that must not put it back.
37841+
const dropPendingSize = (area, barElement) => {
37842+
const pendingSizeMap = pendingSizeMapByArea.get(area);
37843+
if (!pendingSizeMap) {
37844+
return;
37845+
}
37846+
pendingSizeMap.delete(barElement);
37847+
if (pendingSizeMap.size === 0) {
37848+
pendingSizeMapByArea.delete(area);
37849+
}
37850+
};
37851+
37852+
const storeSize = (area, barElement, size) => {
3778537853
let sizeMap = sizeMapByArea.get(area);
3778637854
if (!sizeMap) {
3778737855
sizeMap = new Map();
@@ -37792,7 +37860,10 @@ const setFixedBarSpace = (area, barElement, size) => {
3779237860
} else {
3779337861
sizeMap.set(barElement, size);
3779437862
}
37863+
};
3779537864

37865+
const writeSpace = (area) => {
37866+
const sizeMap = sizeMapByArea.get(area);
3779637867
let largestSize = 0;
3779737868
for (const barSize of sizeMap.values()) {
3779837869
if (barSize > largestSize) {
@@ -37802,10 +37873,18 @@ const setFixedBarSpace = (area, barElement, size) => {
3780237873
const property = `--navi-fixed-bar-space-${area}`;
3780337874
const { style } = document.documentElement;
3780437875
if (sizeMap.size === 0) {
37805-
style.removeProperty(property);
37806-
} else {
37807-
style.setProperty(property, `${largestSize}px`);
37876+
if (writtenValueByArea.has(area)) {
37877+
writtenValueByArea.delete(area);
37878+
style.removeProperty(property);
37879+
}
37880+
return;
37881+
}
37882+
const value = `${largestSize}px`;
37883+
if (writtenValueByArea.get(area) === value) {
37884+
return;
3780837885
}
37886+
writtenValueByArea.set(area, value);
37887+
style.setProperty(property, value);
3780937888
};
3781037889

3781137890
installImportMetaCssBuild(import.meta);/**
@@ -37981,27 +38060,40 @@ const FixedBar = ({
3798138060
// rebuilt as a calc() expression, so a size coming from anywhere — a prop, a
3798238061
// theme variable, the content itself — is reserved just the same, and each
3798338062
// `env()` inset stays the browser's business alone.
37984-
// And measured again whenever it changes: a ResizeObserver on the bar covers
37985-
// in one go a size prop that changes, content arriving or leaving, a font
37986-
// loading late, a rotation moving the notch.
3798738063
const vertical = area === "left" || area === "right";
3798838064
const {
3798938065
ref
3799038066
} = props;
38067+
const measureSpace = barElement => {
38068+
const {
38069+
width,
38070+
height
38071+
} = barElement.getBoundingClientRect();
38072+
return vertical ? width : height;
38073+
};
38074+
38075+
// Anything a render can change — a size prop, the children, a theme variable
38076+
// — is measured in that same commit, before paint: no frame where the
38077+
// content sits under the bar, and nothing written from inside an observer.
38078+
useLayoutEffect(() => {
38079+
const barElement = ref.current;
38080+
if (!barElement) {
38081+
return;
38082+
}
38083+
setFixedBarSpace(area, barElement, measureSpace(barElement));
38084+
});
38085+
38086+
// What no render caused: a font loading late, content arriving from outside,
38087+
// a rotation moving the notch. Measuring here is safe; the write is what has
38088+
// to wait, and fixed_bar_space.js is the one that holds it back.
3799138089
useLayoutEffect(() => {
3799238090
const barElement = ref.current;
3799338091
if (!barElement) {
3799438092
return undefined;
3799538093
}
37996-
const publishSize = () => {
37997-
const {
37998-
width,
37999-
height
38000-
} = barElement.getBoundingClientRect();
38001-
setFixedBarSpace(area, barElement, vertical ? width : height);
38002-
};
38003-
publishSize();
38004-
const resizeObserver = new ResizeObserver(publishSize);
38094+
const resizeObserver = new ResizeObserver(() => {
38095+
requestFixedBarSpace(area, barElement, measureSpace(barElement));
38096+
});
3800538097
resizeObserver.observe(barElement);
3800638098
return () => {
3800738099
resizeObserver.disconnect();

packages/frontend/navi/dist/jsenv_navi.js.map

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/related/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsenv/cli",
3-
"version": "0.3.134",
3+
"version": "0.3.135",
44
"type": "module",
55
"description": "Command Line Interface for jsenv",
66
"repository": {

packages/related/cli/template-node-package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"@jsenv/assert": "4.5.7",
16-
"@jsenv/core": "41.4.8",
16+
"@jsenv/core": "41.4.9",
1717
"@jsenv/eslint-config-relax": "1.8.9",
1818
"@jsenv/test": "3.7.30",
1919
"eslint": "9.39.2",

packages/related/cli/template-web-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@babel/plugin-syntax-import-attributes": "7.28.6",
1919
"@jsenv/custom-elements-redefine": "0.1.0",
2020
"@jsenv/assert": "4.5.7",
21-
"@jsenv/core": "41.4.8",
21+
"@jsenv/core": "41.4.9",
2222
"@jsenv/plugin-bundling": "2.10.16",
2323
"@jsenv/plugin-minification": "1.7.6",
2424
"@jsenv/eslint-config-relax": "1.8.9",

packages/related/cli/template-web-preact/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@babel/plugin-syntax-import-attributes": "7.28.6",
2222
"@babel/plugin-transform-react-jsx": "7.28.6",
2323
"@jsenv/assert": "4.5.7",
24-
"@jsenv/core": "41.4.8",
24+
"@jsenv/core": "41.4.9",
2525
"@jsenv/plugin-preact": "1.7.40",
2626
"@jsenv/plugin-bundling": "2.10.16",
2727
"@jsenv/plugin-minification": "1.7.6",

packages/related/cli/template-web-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@babel/plugin-syntax-import-attributes": "7.28.6",
2323
"@babel/plugin-transform-react-jsx": "7.28.6",
2424
"@jsenv/assert": "4.5.7",
25-
"@jsenv/core": "41.4.8",
25+
"@jsenv/core": "41.4.9",
2626
"@jsenv/plugin-react": "1.7.45",
2727
"@jsenv/plugin-bundling": "2.10.16",
2828
"@jsenv/plugin-minification": "1.7.6",

packages/related/cli/template-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"devDependencies": {
1717
"@babel/plugin-syntax-import-attributes": "7.28.6",
1818
"@jsenv/assert": "4.5.7",
19-
"@jsenv/core": "41.4.8",
19+
"@jsenv/core": "41.4.9",
2020
"@jsenv/eslint-config-relax": "1.8.9",
2121
"@jsenv/plugin-bundling": "2.10.16",
2222
"@jsenv/plugin-minification": "1.7.6",

0 commit comments

Comments
 (0)