diff --git a/CHANGELOG.md b/CHANGELOG.md index abd9ef15b..350ce7fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log for SD.Next -## Update for 2024-05-15 +## Update for 2024-05-16 - **Features**: - **ModernUI** preview of the new [ModernUI](https://github.com/BinaryQuantumSoul/sdnext-modernui) @@ -116,6 +116,7 @@ - Updated all system requirements - UI log monitor will auto-reconnect to server on server restart - UI styles includes indicator for active styles + - UI reduce load on browser - Secondary sampler add option "same as primary" - Change attention mechanism on-the-fly without model reload, thanks @Disty0 - Update stable-fast with support for torch 2.2.2 and 2.3.0, thanks @Aptronymist diff --git a/TODO.md b/TODO.md index 092e44fad..5778fe358 100644 --- a/TODO.md +++ b/TODO.md @@ -64,6 +64,7 @@ For more details see: [Changelog](https://github.com/vladmandic/automatic/blob/d - animatediff-sdxl - async lowvram: - fp8: +- profiling: - init latents: variations, img2img - diffusers public callbacks - include reference styles diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 5080f4ade..4e4466c86 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 5080f4ade379d37d09791c1c4df3e7c13286a8f7 +Subproject commit 4e4466c86201101de4ae56026869999d1847fa73 diff --git a/javascript/progressBar.js b/javascript/progressBar.js index 91908bd2d..7fe68d3bd 100644 --- a/javascript/progressBar.js +++ b/javascript/progressBar.js @@ -59,9 +59,11 @@ function setProgress(res) { const el = document.getElementById(elId); if (el) { el.innerText = (res ? `${job} ${perc} ${eta}` : 'Generate'); - el.style.background = res && (progress > 0) - ? `linear-gradient(to right, var(--primary-500) 0%, var(--primary-800) ${perc}, var(--neutral-700) ${perc})` - : 'var(--button-primary-background-fill)'; + if (!window.waitForUiReady) { + el.style.background = res && (progress > 0) + ? `linear-gradient(to right, var(--primary-500) 0%, var(--primary-800) ${perc}, var(--neutral-700) ${perc})` + : 'var(--button-primary-background-fill)'; + } } } } diff --git a/javascript/script.js b/javascript/script.js index 4a14b255c..6f52f4a3d 100644 --- a/javascript/script.js +++ b/javascript/script.js @@ -96,27 +96,35 @@ let executedOnLoaded = false; const ignoreElements = ['logMonitorData', 'logWarnings', 'logErrors', 'tooltip-container', 'logger']; const ignoreClasses = ['wrap']; +let mutationTimer = null; +let validMutations = []; async function mutationCallback(mutations) { - let validMutations = mutations; - validMutations = validMutations.filter((m) => m.target.nodeName !== 'LABEL'); - validMutations = validMutations.filter((m) => ignoreElements.indexOf(m.target.id) === -1); - validMutations = validMutations.filter((m) => m.target.id !== 'logWarnings' && m.target.id !== 'logErrors'); - validMutations = validMutations.filter((m) => !m.target.classList?.contains('wrap')); + let newMutations = mutations; + if (newMutations.length > 0) newMutations = newMutations.filter((m) => m.target.nodeName !== 'LABEL'); + if (newMutations.length > 0) newMutations = newMutations.filter((m) => ignoreElements.indexOf(m.target.id) === -1); + if (newMutations.length > 0) newMutations = newMutations.filter((m) => m.target.id !== 'logWarnings' && m.target.id !== 'logErrors'); + if (newMutations.length > 0) newMutations = newMutations.filter((m) => !m.target.classList?.contains('wrap')); + if (newMutations.length > 0) validMutations = validMutations.concat(newMutations); if (validMutations.length < 1) return; - if (!executedOnLoaded && gradioApp().getElementById('txt2img_prompt')) { // execute once - executedOnLoaded = true; - executeCallbacks(uiLoadedCallbacks); - } - if (executedOnLoaded) { // execute on each mutation - executeCallbacks(uiUpdateCallbacks, mutations); - scheduleAfterUiUpdateCallbacks(); - } - const newTab = getUICurrentTab(); - if (newTab && (newTab !== uiCurrentTab)) { - uiCurrentTab = newTab; - executeCallbacks(uiTabChangeCallbacks); - } + if (mutationTimer) clearTimeout(mutationTimer); + mutationTimer = setTimeout(async () => { + if (!executedOnLoaded && gradioApp().getElementById('txt2img_prompt')) { // execute once + executedOnLoaded = true; + executeCallbacks(uiLoadedCallbacks); + } + if (executedOnLoaded) { // execute on each mutation + executeCallbacks(uiUpdateCallbacks, mutations); + scheduleAfterUiUpdateCallbacks(); + } + const newTab = getUICurrentTab(); + if (newTab && (newTab !== uiCurrentTab)) { + uiCurrentTab = newTab; + executeCallbacks(uiTabChangeCallbacks); + } + validMutations = []; + mutationTimer = null; + }, 50); } document.addEventListener('DOMContentLoaded', () => {