minecodex 0.1.10 → 0.1.11
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/features/hide-upsell-banner/codex-feature.json +1 -1
- package/features/hide-upsell-banner/src/hide-upsell-banner.mjs +19 -7
- package/features/images/codex-feature.json +1 -1
- package/features/model-slider/codex-feature.json +1 -1
- package/features/notes/codex-feature.json +1 -1
- package/package.json +1 -1
- package/packages/runtime-host/src/codex-runtime.mjs +8 -0
|
@@ -37,18 +37,30 @@ function hideVisibleBanners(root = document) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
let rescanQueued = false;
|
|
41
|
+
function rescanBanners() {
|
|
42
|
+
// React can render the banner in stages: an empty <aside> shell first, then
|
|
43
|
+
// text and style updates on the same element. A childList-only observer
|
|
44
|
+
// misses those later mutations, so every mutation triggers a full rescan
|
|
45
|
+
// instead of only inspecting freshly added nodes.
|
|
46
|
+
if (rescanQueued) return;
|
|
47
|
+
rescanQueued = true;
|
|
48
|
+
queueMicrotask(() => {
|
|
49
|
+
rescanQueued = false;
|
|
50
|
+
hideVisibleBanners(document);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
40
54
|
hideVisibleBanners();
|
|
41
|
-
const observer = new MutationObserver((
|
|
42
|
-
|
|
43
|
-
for (const node of record.addedNodes) {
|
|
44
|
-
if (node.nodeType !== Node.ELEMENT_NODE) continue;
|
|
45
|
-
hideVisibleBanners(node);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
55
|
+
const observer = new MutationObserver(() => {
|
|
56
|
+
rescanBanners();
|
|
48
57
|
});
|
|
49
58
|
observer.observe(document.documentElement, {
|
|
50
59
|
childList: true,
|
|
51
60
|
subtree: true,
|
|
61
|
+
attributes: true,
|
|
62
|
+
attributeFilter: ["style", "class", "hidden"],
|
|
63
|
+
characterData: true,
|
|
52
64
|
});
|
|
53
65
|
|
|
54
66
|
return () => {
|
package/package.json
CHANGED
|
@@ -105,6 +105,14 @@ export function createInjectionSource(features, {
|
|
|
105
105
|
} = {}) {
|
|
106
106
|
function install(config) {
|
|
107
107
|
if (window.top !== window) return;
|
|
108
|
+
if (!document.documentElement) {
|
|
109
|
+
// The document bootstrap runs before the root element exists. Defer the
|
|
110
|
+
// whole install until the DOM is ready instead of crashing on a null
|
|
111
|
+
// documentElement (which previously left the runtime permanently absent
|
|
112
|
+
// after a renderer reload).
|
|
113
|
+
document.addEventListener("DOMContentLoaded", () => install(config), { once: true });
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
108
116
|
const currentRuntime = window.__codexPersonalRuntime;
|
|
109
117
|
if (currentRuntime?.version === config.version && currentRuntime?.sessionId === config.sessionId) {
|
|
110
118
|
currentRuntime.ensure();
|