Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/codex-plus-manager/src/dream-skin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ describe("dream skin theme helpers", () => {
assert.match(css, /\[data-codex-terminal="true"\]/);
});

it("keeps transient new-chat drafts on native geometry", async () => {
const renderer = await readFile(
new URL("../../../assets/inject/upstream/dream-skin/windows/renderer-inject.js", import.meta.url),
"utf8",
);
const css = await readFile(
new URL("../../../assets/inject/upstream/dream-skin/windows/dream-skin.css", import.meta.url),
"utf8",
);

assert.match(renderer, /homeHasClassicChrome/);
assert.match(renderer, /data-dream-home-layout/);
assert.match(renderer, /data-dream-home-layout.*soft/);
assert.match(css, /data-dream-home-layout.*structured/);
assert.match(css, /overflow-y: auto !important/);
assert.match(css, /\.composer-surface-chrome/);
});

it("exposes companion image controls in the theme editor", async () => {
const app = await readFile(new URL("./App.tsx", import.meta.url), "utf8");

Expand Down
32 changes: 28 additions & 4 deletions assets/inject/renderer-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -1943,21 +1943,45 @@
ensureDreamSkinCompanion(theme);

const homeIndicator = document.querySelector('[data-testid="home-icon"]');
const home = homeIndicator?.closest('[role="main"]')
const homeCandidate = homeIndicator?.closest('[role="main"]')
|| [...document.querySelectorAll('[role="main"]')].find((candidate) =>
candidate.querySelector('[data-feature="game-source"]')
&& candidate.querySelector('.group\\/home-suggestions'))
|| null;
const homeHasClassicChrome = !!(
homeCandidate
&& homeCandidate.querySelector('[data-feature="game-source"]')
&& (
homeCandidate.querySelector('.group\\/home-suggestions')
|| homeCandidate.querySelector('[class*="home-suggestions"]')
|| homeCandidate.querySelector('[class*="_homeUtilityBar_"]')
)
);
const home = homeHasClassicChrome ? homeCandidate : null;
for (const candidate of document.querySelectorAll(`[role="main"].${descriptor.homeClass}`)) {
if (candidate !== home) candidate.classList.remove(descriptor.homeClass);
if (candidate !== home && candidate !== homeCandidate) candidate.classList.remove(descriptor.homeClass);
}
if (home) home.classList.add(descriptor.homeClass);
else if (homeCandidate && descriptor.homeClass) {
// Soft home: keep mild class for tinting, avoid structural shell when possible.
homeCandidate.classList.add(descriptor.homeClass);
}
if (descriptor.taskClass) {
for (const candidate of document.querySelectorAll('[role="main"]')) {
candidate.classList.toggle(descriptor.taskClass, candidate !== home);
candidate.classList.toggle(descriptor.taskClass, candidate !== home && candidate !== homeCandidate);
}
}
// Only mark structured layout for classic home trees.
for (const candidate of document.querySelectorAll('[role="main"]')) {
if (candidate === home) {
const hero = candidate.querySelector(':scope > div > div > div');
const structured = !!(hero && hero.querySelector('[data-feature="game-source"], [data-testid="home-icon"]'));
candidate.setAttribute('data-dream-home-layout', structured ? 'structured' : 'soft');
} else {
candidate.setAttribute('data-dream-home-layout', 'soft');
}
}
shellMain.classList.toggle(descriptor.shellClass, Boolean(home));
shellMain.classList.toggle(descriptor.shellClass, Boolean(homeCandidate));
if (descriptor.taskShellClass) shellMain.classList.toggle(descriptor.taskShellClass, !home);

let chrome = document.getElementById(descriptor.chromeId);
Expand Down
46 changes: 46 additions & 0 deletions assets/inject/upstream/cidala-tiger/macos/dream-skin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1323,3 +1323,49 @@ html.codex-dream-skin [data-message-author-role] { border-radius: 16px; }
animation-iteration-count: 1 !important;
}
}

/* codex-plus new-chat interaction safeguards */
html.codex-dream-skin aside.app-shell-left-panel,
html.codex-dream-skin aside.app-shell-left-panel button,
html.codex-dream-skin aside.app-shell-left-panel a,
html.codex-dream-skin button[aria-label^="Start new chat in "],
html.codex-dream-skin [data-app-action-sidebar-project-row],
html.codex-dream-skin .composer-surface-chrome,
html.codex-dream-skin .composer-footer,
html.codex-dream-skin .ProseMirror,
html.codex-dream-skin [role="main"] {
pointer-events: auto !important;
}
html.codex-dream-skin button[aria-label^="Start new chat in "],
html.codex-dream-skin [data-app-action-sidebar-project-row] button {
position: relative !important;
z-index: 6 !important;
}
html.codex-dream-skin .composer-surface-chrome,
html.codex-dream-skin .composer-footer {
position: relative !important;
z-index: 4 !important;
opacity: 1 !important;
visibility: visible !important;
}
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) {
background: transparent !important;
}
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) {
min-height: 0 !important;
overflow-y: auto !important;
}
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child > div:first-child > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child {
height: auto !important;
min-height: 0 !important;
max-height: none !important;
flex: 0 1 auto !important;
overflow: visible !important;
background: transparent !important;
border: 0 !important;
box-shadow: none !important;
}
16 changes: 15 additions & 1 deletion assets/inject/upstream/cidala-tiger/macos/renderer-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,28 @@
shell ||= root.getAttribute(SHELL_ATTR) || resolvedShell();
const shellMain = document.querySelector("main.main-surface") || document.querySelector("main");
const homeIndicator = document.querySelector('[data-testid="home-icon"]');
const home = homeIndicator?.closest('[role="main"]') ||
const homeCandidate = homeIndicator?.closest('[role="main"]') ||
[...document.querySelectorAll('[role="main"]')].find((candidate) =>
candidate.querySelector('[data-feature="game-source"]') &&
candidate.querySelector('.group\\\\/home-suggestions')) || null;
const homeHasClassicChrome = !!(
homeCandidate
&& homeCandidate.querySelector('[data-feature="game-source"]')
&& (
homeCandidate.querySelector('.group\\\\/home-suggestions')
|| homeCandidate.querySelector('[class*="_homeUtilityBar_"]')
)
);
const home = homeHasClassicChrome ? homeCandidate : null;
for (const candidate of document.querySelectorAll('[role="main"].dream-skin-home')) {
if (candidate !== home) candidate.classList.remove("dream-skin-home");
}
if (home) home.classList.add("dream-skin-home");
for (const candidate of document.querySelectorAll('[role="main"]')) {
if (candidate === home) candidate.setAttribute("data-dream-home-layout", "structured");
else if (candidate === homeCandidate) candidate.setAttribute("data-dream-home-layout", "soft");
else candidate.removeAttribute("data-dream-home-layout");
}
const homeUtilityBars = new Set(home
? home.querySelectorAll('[class*="_homeUtilityBar_"]')
: []);
Expand Down
79 changes: 63 additions & 16 deletions assets/inject/upstream/cidala-tiger/windows/dream-skin.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,24 @@ html.codex-dream-skin .dream-home {
padding-top: 24px !important;
}

.dream-home > div:first-child > div:first-child {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
flex: 0 0 clamp(390px, 42cqw, 510px) !important;
min-height: 390px !important;
align-items: flex-start !important;
padding-bottom: 0 !important;
}

.dream-home > div:first-child > div:first-child > div:first-child {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
position: relative !important;
isolation: isolate;
width: calc(100% - 56px) !important;
max-width: 1180px !important;
height: clamp(230px, 27cqw, 326px) !important;
min-height: 230px !important;
height: auto !important;
min-height: clamp(180px, 22cqw, 280px) !important;
max-height: none !important;
flex: 0 1 auto !important;
padding: 0 !important;
overflow: hidden !important;
overflow: visible !important;
border: 1px solid var(--dream-line) !important;
border-radius: 20px !important;
background-image: var(--dream-art) !important;
Expand All @@ -216,11 +217,11 @@ html.codex-dream-skin .dream-home {
box-shadow: var(--dream-shadow) !important;
}

html.codex-dream-skin.dream-art-wide .dream-home > div:first-child > div:first-child > div:first-child {
html.codex-dream-skin.dream-art-wide .dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
background-size: cover !important;
}

.dream-home > div:first-child > div:first-child > div:first-child::before {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"])::before {
content: "";
position: absolute;
z-index: 0;
Expand All @@ -229,15 +230,15 @@ html.codex-dream-skin.dream-art-wide .dream-home > div:first-child > div:first-c
background: linear-gradient(90deg, var(--dream-hero-shade) 0 32%, transparent 70%);
}

html.codex-dream-skin.dream-safe-right .dream-home > div:first-child > div:first-child > div:first-child::before {
html.codex-dream-skin.dream-safe-right .dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"])::before {
background: linear-gradient(270deg, var(--dream-hero-shade) 0 32%, transparent 70%);
}

html.codex-dream-skin.dream-safe-center .dream-home > div:first-child > div:first-child > div:first-child::before {
html.codex-dream-skin.dream-safe-center .dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"])::before {
background: radial-gradient(ellipse at center, var(--dream-hero-shade) 0 23%, transparent 72%);
}

html.codex-dream-skin.dream-safe-none .dream-home > div:first-child > div:first-child > div:first-child::before {
html.codex-dream-skin.dream-safe-none .dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"])::before {
background: transparent;
}

Expand Down Expand Up @@ -459,15 +460,15 @@ html.codex-dream-skin.dream-art-wide main.main-surface [role="main"] {
}

html.codex-dream-skin.dream-art-wide main.main-surface.dream-home-shell
.dream-home > div:first-child > div:first-child > div:first-child {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
border: 0 !important;
border-radius: 0 !important;
background: transparent !important;
box-shadow: none !important;
}

html.codex-dream-skin.dream-art-wide main.main-surface.dream-home-shell
.dream-home > div:first-child > div:first-child > div:first-child::before {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"])::before {
content: none !important;
}

Expand Down Expand Up @@ -555,7 +556,7 @@ html.codex-dream-skin.dream-art-wide main.main-surface
--thread-content-max-width: min(940px, calc(100cqw - 36px)) !important;
}

.dream-home > div:first-child > div:first-child > div:first-child {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
width: calc(100% - 36px) !important;
}
}
Expand All @@ -565,12 +566,12 @@ html.codex-dream-skin.dream-art-wide main.main-surface
padding-top: 16px !important;
}

.dream-home > div:first-child > div:first-child {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
flex-basis: 370px !important;
min-height: 370px !important;
}

.dream-home > div:first-child > div:first-child > div:first-child {
.dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"]) {
height: 220px !important;
min-height: 220px !important;
border-radius: 16px !important;
Expand Down Expand Up @@ -598,7 +599,7 @@ html.codex-dream-skin.dream-art-wide main.main-surface
@media (max-width: 680px) {
.dream-home > div:first-child > div:first-child > div:first-child::before,
html.codex-dream-skin.dream-safe-right .dream-home > div:first-child > div:first-child > div:first-child::before,
html.codex-dream-skin.dream-safe-center .dream-home > div:first-child > div:first-child > div:first-child::before {
html.codex-dream-skin.dream-safe-center .dream-home[data-dream-home-layout="structured"] > div:first-child > div:first-child > div:first-child:has([data-feature="game-source"], [data-testid="home-icon"])::before {
background: color-mix(in oklab, var(--dream-surface) 78%, transparent);
}

Expand All @@ -625,3 +626,49 @@ html.codex-dream-skin.dream-art-wide main.main-surface
transition-duration: .01ms !important;
}
}

/* codex-plus new-chat interaction safeguards */
html.codex-dream-skin aside.app-shell-left-panel,
html.codex-dream-skin aside.app-shell-left-panel button,
html.codex-dream-skin aside.app-shell-left-panel a,
html.codex-dream-skin button[aria-label^="Start new chat in "],
html.codex-dream-skin [data-app-action-sidebar-project-row],
html.codex-dream-skin .composer-surface-chrome,
html.codex-dream-skin .composer-footer,
html.codex-dream-skin .ProseMirror,
html.codex-dream-skin [role="main"] {
pointer-events: auto !important;
}
html.codex-dream-skin button[aria-label^="Start new chat in "],
html.codex-dream-skin [data-app-action-sidebar-project-row] button {
position: relative !important;
z-index: 6 !important;
}
html.codex-dream-skin .composer-surface-chrome,
html.codex-dream-skin .composer-footer {
position: relative !important;
z-index: 4 !important;
opacity: 1 !important;
visibility: visible !important;
}
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) {
background: transparent !important;
}
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) {
min-height: 0 !important;
overflow-y: auto !important;
}
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child > div:first-child > div:first-child,
html.codex-dream-skin .dream-home:not([data-dream-home-layout="structured"]) > div:first-child > div:first-child > div:first-child > div:first-child > div:first-child {
height: auto !important;
min-height: 0 !important;
max-height: none !important;
flex: 0 1 auto !important;
overflow: visible !important;
background: transparent !important;
border: 0 !important;
box-shadow: none !important;
}
37 changes: 30 additions & 7 deletions assets/inject/upstream/cidala-tiger/windows/renderer-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
const root = document.documentElement;
root?.classList.remove(...ROOT_CLASSES);
for (const property of ROOT_PROPERTIES) root?.style.removeProperty(property);
document.querySelectorAll(".dream-home").forEach((node) => node.classList.remove("dream-home"));
document.querySelectorAll(".dream-home").forEach((node) => { node.classList.remove("dream-home"); node.removeAttribute("data-dream-home-layout"); });
document.querySelectorAll(".dream-task").forEach((node) => node.classList.remove("dream-task"));
document.querySelectorAll(".dream-home-shell").forEach((node) => node.classList.remove("dream-home-shell"));
document.querySelectorAll(`.${HOME_UTILITY_CLASS}`).forEach((node) => node.classList.remove(HOME_UTILITY_CLASS));
Expand Down Expand Up @@ -347,17 +347,40 @@
style.dataset.dreamVersion = "3";
}

const home = document.querySelector('[role="main"]:has([data-testid="home-icon"])');
const homeCandidate = document.querySelector('[role="main"]:has([data-testid="home-icon"])');
const homeHasClassicChrome = !!(
homeCandidate
&& homeCandidate.querySelector('[data-feature="game-source"]')
&& (
homeCandidate.querySelector('.group\\/home-suggestions')
|| homeCandidate.querySelector('[class*="home-suggestions"]')
|| homeCandidate.querySelector('[class*="_homeUtilityBar_"]')
)
);
const home = homeHasClassicChrome ? homeCandidate : null;
for (const candidate of document.querySelectorAll('[role="main"]')) {
candidate.classList.toggle("dream-home", candidate === home);
candidate.classList.toggle("dream-task", candidate !== home);
const isStructuredHome = candidate === home;
const isSoftHome = candidate === homeCandidate && !home;
candidate.classList.toggle("dream-home", isStructuredHome || isSoftHome);
candidate.classList.toggle("dream-task", !(isStructuredHome || isSoftHome));
if (isStructuredHome) {
const hero = candidate.querySelector(":scope > div > div > div");
const structured = !!(
hero
&& candidate.querySelector('[data-feature="game-source"]')
&& hero.querySelector('[data-feature="game-source"], [data-testid="home-icon"]')
);
candidate.setAttribute("data-dream-home-layout", structured ? "structured" : "soft");
} else {
candidate.setAttribute("data-dream-home-layout", "soft");
}
}
const utilityBars = new Set(home ? home.querySelectorAll('[class*="_homeUtilityBar_"]') : []);
for (const candidate of document.querySelectorAll(`.${HOME_UTILITY_CLASS}`)) {
if (!utilityBars.has(candidate)) candidate.classList.remove(HOME_UTILITY_CLASS);
}
for (const candidate of utilityBars) candidate.classList.add(HOME_UTILITY_CLASS);
shellMain.classList.toggle("dream-home-shell", Boolean(home));
shellMain.classList.toggle("dream-home-shell", Boolean(homeCandidate));

let chrome = document.getElementById(CHROME_ID);
if (!chrome || chrome.parentElement !== document.body) {
Expand Down Expand Up @@ -403,7 +426,7 @@
});
const timer = setInterval(ensure, 5000);
window[STATE_KEY] = {
ensure, cleanup, observer, timer, scheduler, artUrl, profile, config, installToken, version: "1.2.0",
ensure, cleanup, observer, timer, scheduler, artUrl, profile, config, installToken, version: "1.2.1-newchat-fix",
};
ensure();
analyzeArt().then((result) => {
Expand All @@ -413,5 +436,5 @@
state.profile = result;
ensure();
});
return { installed: true, version: "1.2.0", adaptive: true };
return { installed: true, version: "1.2.1-newchat-fix", adaptive: true };
})(__DREAM_CSS_JSON__, __DREAM_ART_JSON__, __DREAM_THEME_JSON__)
Loading
Loading