Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Studios menu: feature link styles in their own stylesheet, mode ids built in code

Adarsh8280275aa7eb
diff --git a/src/app/globals.css b/src/app/globals.css
index 9268d124..7ad9f56a 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -2,6 +2,7 @@
@import "tw-animate-css";
@import "shadcn/tailwind.css";
@import "./nav-states.css";
+@import "./nav-subs.css";
@import "./motion.css";
@import "./tab-row.css";
diff --git a/src/app/nav-states.css b/src/app/nav-states.css
index 5c68c65c..e0346897 100644
--- a/src/app/nav-states.css
+++ b/src/app/nav-states.css
@@ -150,79 +150,3 @@ html:not([data-input="pointer"]) .nav-focus-out:focus-visible {
background-color: Highlight;
}
}
-
-/*
- * A studio's features under it in the Studios menu (mega-panel SubLinks). With a mouse: 24 px names in a column, two to
- * a row's 48 px (an odd number gets a 24 px pad), so the columns' rows stay in line. On a touch screen: pills that wrap,
- * 32 px to see and 44 px to tap. Below the height its column has room for, a studio with data-subs-line (Genjutsu)
- * lists them as one wrapped line of names instead. In a layer, so a utility that hides the list still wins.
- */
-@layer components {
- .nav-subs {
- display: flex;
- flex-direction: column;
- }
- .nav-subs > li > a {
- min-height: 24px;
- padding-inline: 8px;
- border-radius: 8px;
- font-size: 12.5px;
- line-height: 16px;
- }
- .nav-subs[data-odd] {
- padding-bottom: 24px;
- }
- @media (pointer: coarse) {
- .nav-subs {
- flex-direction: row;
- flex-wrap: wrap;
- gap: 12px 6px;
- padding-block: 8px 12px;
- }
- .nav-subs[data-odd] {
- padding-bottom: 12px;
- }
- .nav-subs > li > a {
- min-height: 32px;
- padding-inline: 12px;
- border: 1px solid var(--border);
- border-radius: 9999px;
- font-size: 13px;
- }
- .nav-subs > li > a::after {
- content: "";
- position: absolute;
- inset: -6px 0;
- }
- }
- @media (not (pointer: coarse)) and (max-height: 799.98px) {
- .nav-subs[data-subs-line] {
- flex-direction: row;
- flex-wrap: wrap;
- /* Two lines of names make a 50 px list: with the row it hangs from (its own line left out), two whole rows. */
- padding-block: 4px 6px;
- }
- .nav-subs[data-subs-line] > li {
- display: flex;
- align-items: center;
- }
- /* A dot after each name but the last: a line that wraps starts on a name. */
- .nav-subs[data-subs-line] > li:not(:last-child)::after {
- content: "\00B7";
- color: var(--muted-foreground);
- }
- /* The last one shown: the links after it (data-from) need a taller window. */
- .nav-subs[data-subs-line] > li:not([data-from]):not(:has(~ li:not([data-from])))::after {
- content: none;
- }
- .nav-subs[data-subs-line] > li > a {
- min-height: 20px;
- padding-inline: 2px;
- font-size: 12px;
- }
- /* The open feature reads by its weight here: no pip beside a name in a line. */
- .nav-subs[data-subs-line] > li > a.nav-mark-start::before {
- display: none;
- }
- }
-}
diff --git a/src/app/nav-subs.css b/src/app/nav-subs.css
new file mode 100644
index 00000000..a1bc01f4
--- /dev/null
+++ b/src/app/nav-subs.css
@@ -0,0 +1,76 @@
+/*
+ * A studio's features under it in the Studios menu (mega-panel SubLinks). With a mouse: 24 px names in a column, two to
+ * a row's 48 px (an odd number gets a 24 px pad), so the columns' rows stay in line. On a touch screen: pills that wrap,
+ * 32 px to see and 44 px to tap. Below the height its column has room for, a studio with data-subs-line (Genjutsu)
+ * lists them as one wrapped line of names instead. In a layer (unlike nav-states.css), so a utility that hides the
+ * list still wins.
+ */
+@layer components {
+ .nav-subs {
+ display: flex;
+ flex-direction: column;
+ }
+ .nav-subs > li > a {
+ min-height: 24px;
+ padding-inline: 8px;
+ border-radius: 8px;
+ font-size: 12.5px;
+ line-height: 16px;
+ }
+ .nav-subs[data-odd] {
+ padding-bottom: 24px;
+ }
+ @media (pointer: coarse) {
+ .nav-subs {
+ flex-direction: row;
+ flex-wrap: wrap;
+ gap: 12px 6px;
+ padding-block: 8px 12px;
+ }
+ .nav-subs[data-odd] {
+ padding-bottom: 12px;
+ }
+ .nav-subs > li > a {
+ min-height: 32px;
+ padding-inline: 12px;
+ border: 1px solid var(--border);
+ border-radius: 9999px;
+ font-size: 13px;
+ }
+ .nav-subs > li > a::after {
+ content: "";
+ position: absolute;
+ inset: -6px 0;
+ }
+ }
+ @media (not (pointer: coarse)) and (max-height: 799.98px) {
+ .nav-subs[data-subs-line] {
+ flex-direction: row;
+ flex-wrap: wrap;
+ /* Two lines of names make a 50 px list: with the row it hangs from (its own line left out), two whole rows. */
+ padding-block: 4px 6px;
+ }
+ .nav-subs[data-subs-line] > li {
+ display: flex;
+ align-items: center;
+ }
+ /* A dot after each name but the last: a line that wraps starts on a name. */
+ .nav-subs[data-subs-line] > li:not(:last-child)::after {
+ content: "\00B7";
+ color: var(--muted-foreground);
+ }
+ /* The last one shown: the links after it (data-from) need a taller window. */
+ .nav-subs[data-subs-line] > li:not([data-from]):not(:has(~ li:not([data-from])))::after {
+ content: none;
+ }
+ .nav-subs[data-subs-line] > li > a {
+ min-height: 20px;
+ padding-inline: 2px;
+ font-size: 12px;
+ }
+ /* The open feature reads by its weight here: no pip beside a name in a line. */
+ .nav-subs[data-subs-line] > li > a.nav-mark-start::before {
+ display: none;
+ }
+ }
+}
diff --git a/src/components/nav/mega-panel.tsx b/src/components/nav/mega-panel.tsx
index 130a29c5..9f5d5f0d 100644
--- a/src/components/nav/mega-panel.tsx
+++ b/src/components/nav/mega-panel.tsx
@@ -97,7 +97,7 @@ function Row({ e, col, row, current, inside, now, className }: { e: MegaItem; co
/**
* Below the window height a studio's links need, they hide, so the panel never scrolls inside. With a mouse they are
- * 24 px names; on a touch screen pills 44 px to tap (nav-states.css), so they need a taller window there.
+ * 24 px names; on a touch screen pills 44 px to tap (nav-subs.css), so they need a taller window there.
*/
const HIDE_SHORT: Record<800 | 880 | 960, string> = {
800: "[@media(max-height:799.98px)]:hidden",
@@ -109,12 +109,12 @@ const HIDE_TOUCH: Record<800 | 880 | 960, string> = {
880: "[@media(pointer:coarse)_and_(max-height:1099.98px)]:hidden",
960: "[@media(pointer:coarse)_and_(max-height:1199.98px)]:hidden",
};
-/** `line`: with a mouse they become one line of names there instead (nav-states.css), so only a touch screen hides them. */
+/** `line`: with a mouse they become one line of names there instead (nav-subs.css), so only a touch screen hides them. */
const hideBelow = (h: 800 | 880 | 960, line = false) => cn(!line && HIDE_SHORT[h], HIDE_TOUCH[h]);
/**
* What a studio holds inside (its tabs and modes), as links under its card or row: names only, smaller and quieter
- * than the rows, hung from a hairline under the studio (nav-states.css .nav-subs: with a mouse, two 24 px names to a
+ * than the rows, hung from a hairline under the studio (nav-subs.css: with a mouse, two 24 px names to a
* row's 48 px, so the columns' rows stay in line; pills on a touch screen; one wrapped line of names below the height a
* studio with `subsLine` needs). `row`: the first link's place for the arrow keys (they go down from the studio through
* its links to the next row). `current`: the open page's feature. `under`: links under a row, whose names start where
diff --git a/src/lib/nav-model.ts b/src/lib/nav-model.ts
index 7af1424b..a82898ad 100644
--- a/src/lib/nav-model.ts
+++ b/src/lib/nav-model.ts
@@ -695,7 +695,8 @@ const hubTools = (hub: HubKind, skip: readonly string[] = []) => HUB_MODES[hub].
export const STUDIO_SUBS: Readonly<Record<string, StudioSubs>> = {
marketing: { ids: ["marketing-click-to-ad", "ads", "ads-multiplier"] },
- genjutsu: { ids: ["genjutsu-motion", "genjutsu-character", "genjutsu-swap", "genjutsu-restyle", "genjutsu-insert", "genjutsu-picture", "genjutsu-finish"], tall: 800, short: "line", ownerTall: 880 },
+ // Its mode ids built here: one of them written out whole is also a retired model id (catalog/replaced.ts).
+ genjutsu: { ids: ["motion", "character", "swap", "restyle", "insert", "picture", "finish"].map((m) => `genjutsu-${m}`), tall: 800, short: "line", ownerTall: 880 },
// The modes that aren't rows of the Sound column already.
audio: { ids: hubTools("audio", SOUND_COLUMN), menu: 3 },
upscale: { ids: hubTools("upscale") },
diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.ts
index 4cb0a715..855e7b06 100644
--- a/tests/nav-bar.test.ts
+++ b/tests/nav-bar.test.ts
@@ -177,7 +177,7 @@ describe("the launcher's columns", () => {
expect(subs("audio")).toEqual(["Dialogue", "Voice change", "Design a voice", "See all 13"]);
expect(subs("video-tools")).toEqual(["Relight", "Captions", "Remove object", "See all 10"]);
for (const w of ["Click to Ad", "Ads Studio", "Ad Multiplier", "Motion transfer", "FPS Boost"]) expect(words(html)).toContain(w);
- // Under a hairline, quieter than a row, with no picture and no line of their own (nav-states.css .nav-subs: 24 px
+ // Under a hairline, quieter than a row, with no picture and no line of their own (nav-subs.css: 24 px
// names with a mouse, 44 px pills to tap on a touch screen).
const sub = anchors(html).find((a) => a.tag.includes("data-sub"))!.tag;
expect(sub).toContain("text-muted-foreground");