diff --git a/modules/rflows/components/flows.css b/modules/rflows/components/flows.css index 8468809..5360fb2 100644 --- a/modules/rflows/components/flows.css +++ b/modules/rflows/components/flows.css @@ -1,7 +1,8 @@ /* ── Flows module theme ───────────────────────────────── */ /* ── rFlows color tokens (dark defaults) ─────────────── */ -:root { +/* Use :host so vars apply inside shadow DOM (flows.css is loaded via in shadow root) */ +:host { /* Source node */ --rflows-source-bg: #064e3b; --rflows-source-border: #10b981; @@ -872,7 +873,7 @@ .edge-splash { pointer-events: none; } /* ── Light theme overrides ──────────────────────────── */ -[data-theme="light"] { +:host([data-theme="light"]) { --rflows-source-text: #059669; --rflows-source-hover-bg: #d1fae5; --rflows-funnel-text: #2563eb; @@ -926,7 +927,7 @@ --rflows-modal-border: #e2e8f0; } @media (prefers-color-scheme: light) { - :root:not([data-theme]) { + :host:not([data-theme]) { --rflows-source-text: #059669; --rflows-source-hover-bg: #d1fae5; --rflows-funnel-text: #2563eb; diff --git a/modules/rflows/components/folk-flows-app.ts b/modules/rflows/components/folk-flows-app.ts index 5be02ee..78c03ca 100644 --- a/modules/rflows/components/folk-flows-app.ts +++ b/modules/rflows/components/folk-flows-app.ts @@ -161,6 +161,12 @@ class FolkFlowsApp extends HTMLElement { this.flowId = this.getAttribute("flow-id") || ""; this.isDemo = this.getAttribute("mode") === "demo" || this.space === "demo"; + // Mirror document theme to host for shadow DOM CSS selectors + this._syncTheme(); + document.addEventListener("theme-change", () => this._syncTheme()); + new MutationObserver(() => this._syncTheme()) + .observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] }); + // Canvas-first: always open in detail (canvas) view this.view = "detail"; @@ -176,6 +182,11 @@ class FolkFlowsApp extends HTMLElement { } } + private _syncTheme() { + const theme = document.documentElement.getAttribute("data-theme") || "dark"; + this.setAttribute("data-theme", theme); + } + private loadDemoOrLocalFlow() { const activeId = localStorage.getItem('rflows:local:active') || ''; if (activeId) { diff --git a/website/canvas.html b/website/canvas.html index 2cbec8c..3e3cd06 100644 --- a/website/canvas.html +++ b/website/canvas.html @@ -56,17 +56,23 @@ } .toolbar-group-toggle { - padding: 7px 10px; + padding: 6px; border: none; border-radius: 8px; background: var(--rs-toolbar-btn-bg); color: var(--rs-toolbar-btn-text); cursor: pointer; - font-size: 13px; + font-size: 18px; + line-height: 1; transition: background 0.2s; white-space: nowrap; - text-align: left; + text-align: center; touch-action: manipulation; + width: 36px; + height: 36px; + display: flex; + align-items: center; + justify-content: center; } .toolbar-group-toggle:hover { @@ -91,6 +97,17 @@ z-index: 1001; } + .toolbar-dropdown-header { + padding: 6px 12px 4px; + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.04em; + color: var(--rs-text-muted); + border-bottom: 1px solid var(--rs-toolbar-panel-border, rgba(255,255,255,0.08)); + margin-bottom: 4px; + } + .toolbar-group.open > .toolbar-dropdown { display: flex; flex-direction: column; @@ -245,30 +262,36 @@ text-align: left; } - /* Collapse/expand toggle — chevron at bottom of toolbar */ + /* Collapse/expand toggle — at top of toolbar */ #toolbar-collapse { - padding: 4px 0 !important; - background: transparent !important; - font-size: 16px !important; + padding: 6px; + background: transparent; + border: none; + border-radius: 8px; line-height: 1; - opacity: 0.4; - transition: opacity 0.2s; + opacity: 0.5; + transition: opacity 0.2s, background 0.15s; text-align: center; - letter-spacing: 0; color: var(--rs-text-muted); - order: 999; /* always last */ - margin-top: auto; + cursor: pointer; + order: -1; /* always first */ + width: 36px; + height: 36px; + display: flex; + align-items: center; + justify-content: center; } #toolbar-collapse:hover { opacity: 1; - background: var(--rs-toolbar-btn-bg) !important; + background: var(--rs-toolbar-btn-bg); color: var(--rs-text-primary); } + #toolbar-collapse svg { pointer-events: none; } + #toolbar.collapsed .toolbar-group, - #toolbar.collapsed .toolbar-sep, - #toolbar.collapsed > button:not(#toolbar-collapse) { + #toolbar.collapsed .toolbar-sep { display: none; } @@ -278,9 +301,7 @@ } #toolbar.collapsed #toolbar-collapse { - opacity: 0.7; - font-size: 14px !important; - padding: 4px 6px !important; + opacity: 0.8; } /* ── Bottom toolbar — basic canvas tools ── */ @@ -1536,7 +1557,15 @@ padding: 14px 16px; font-size: 16px; min-height: 48px; + height: auto; overflow: visible; + justify-content: flex-start; + } + /* Show group name on mobile via title attr */ + #toolbar .toolbar-group-toggle::after { + content: attr(title); + margin-left: 8px; + font-size: 15px; } #toolbar .toolbar-dropdown { @@ -1838,10 +1867,13 @@