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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "hide-upsell-banner",
4
- "version": "0.1.10",
4
+ "version": "0.1.11",
5
5
  "label": {
6
6
  "en": "Hide Upsell Banner",
7
7
  "zh-CN": "隐藏用量横幅"
@@ -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((records) => {
42
- for (const record of records) {
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 () => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "images",
4
- "version": "0.1.10",
4
+ "version": "0.1.11",
5
5
  "label": {
6
6
  "en": "Images",
7
7
  "zh-CN": "图片"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "model-slider",
4
- "version": "0.1.10",
4
+ "version": "0.1.11",
5
5
  "label": {
6
6
  "en": "Model Slider",
7
7
  "zh-CN": "模型滑条"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "notes",
4
- "version": "0.1.10",
4
+ "version": "0.1.11",
5
5
  "label": {
6
6
  "en": "Notes",
7
7
  "zh-CN": "笔记"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecodex",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Lightweight, local-first plugins for the Codex desktop app.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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();