agent-tasks 1.6.9 → 1.6.10
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.
- package/dist/ui/app.js +165 -0
- package/package.json +1 -1
package/dist/ui/app.js
CHANGED
|
@@ -1955,6 +1955,171 @@ function copyArtifact(btn) {
|
|
|
1955
1955
|
});
|
|
1956
1956
|
}
|
|
1957
1957
|
|
|
1958
|
+
// ---- Theme sync from parent (agent-desk) via executeJavaScript ----
|
|
1959
|
+
|
|
1960
|
+
window.addEventListener('message', function (event) {
|
|
1961
|
+
if (!event.data || event.data.type !== 'theme-sync') return;
|
|
1962
|
+
var colors = event.data.colors;
|
|
1963
|
+
if (!colors) return;
|
|
1964
|
+
|
|
1965
|
+
// Contrast enforcement: ensure text is readable against background
|
|
1966
|
+
function ensureContrast(bg, fg) {
|
|
1967
|
+
var lum = function (hex) {
|
|
1968
|
+
if (!hex || hex.charAt(0) !== '#' || hex.length < 7) return 0.5;
|
|
1969
|
+
var r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
1970
|
+
var g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
1971
|
+
var b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
1972
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
1973
|
+
};
|
|
1974
|
+
var bgLum = lum(bg);
|
|
1975
|
+
return bgLum < 0.5 ? (lum(fg) < 0.4 ? '#e0e0e0' : fg) : lum(fg) > 0.6 ? '#333333' : fg;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
var root = document.documentElement;
|
|
1979
|
+
var bgColor = colors.bg || null;
|
|
1980
|
+
|
|
1981
|
+
// Core backgrounds
|
|
1982
|
+
if (colors.bg) root.style.setProperty('--bg', colors.bg);
|
|
1983
|
+
if (colors.bgSurface) root.style.setProperty('--bg-surface', colors.bgSurface);
|
|
1984
|
+
if (colors.bgElevated) root.style.setProperty('--bg-elevated', colors.bgElevated);
|
|
1985
|
+
if (colors.bgHover) root.style.setProperty('--bg-hover', colors.bgHover);
|
|
1986
|
+
if (colors.bgInset) root.style.setProperty('--bg-inset', colors.bgInset);
|
|
1987
|
+
|
|
1988
|
+
// Borders
|
|
1989
|
+
if (colors.border) root.style.setProperty('--border', colors.border);
|
|
1990
|
+
if (colors.borderLight) root.style.setProperty('--border-light', colors.borderLight);
|
|
1991
|
+
|
|
1992
|
+
// Text colors (with contrast enforcement)
|
|
1993
|
+
if (colors.text)
|
|
1994
|
+
root.style.setProperty('--text', bgColor ? ensureContrast(bgColor, colors.text) : colors.text);
|
|
1995
|
+
if (colors.textSecondary)
|
|
1996
|
+
root.style.setProperty(
|
|
1997
|
+
'--text-secondary',
|
|
1998
|
+
bgColor ? ensureContrast(bgColor, colors.textSecondary) : colors.textSecondary,
|
|
1999
|
+
);
|
|
2000
|
+
if (colors.textMuted)
|
|
2001
|
+
root.style.setProperty(
|
|
2002
|
+
'--text-muted',
|
|
2003
|
+
bgColor ? ensureContrast(bgColor, colors.textMuted) : colors.textMuted,
|
|
2004
|
+
);
|
|
2005
|
+
if (colors.textDim)
|
|
2006
|
+
root.style.setProperty(
|
|
2007
|
+
'--text-dim',
|
|
2008
|
+
bgColor ? ensureContrast(bgColor, colors.textDim) : colors.textDim,
|
|
2009
|
+
);
|
|
2010
|
+
|
|
2011
|
+
// Accent colors
|
|
2012
|
+
if (colors.accent) root.style.setProperty('--accent', colors.accent);
|
|
2013
|
+
if (colors.accentHover) root.style.setProperty('--accent-hover', colors.accentHover);
|
|
2014
|
+
if (colors.accentDim) root.style.setProperty('--accent-dim', colors.accentDim);
|
|
2015
|
+
if (colors.accentSolid) root.style.setProperty('--accent-solid', colors.accentSolid);
|
|
2016
|
+
if (colors.accentGlow) root.style.setProperty('--accent-glow', colors.accentGlow);
|
|
2017
|
+
|
|
2018
|
+
// Semantic colors
|
|
2019
|
+
if (colors.green) root.style.setProperty('--green', colors.green);
|
|
2020
|
+
if (colors.greenDim) root.style.setProperty('--green-dim', colors.greenDim);
|
|
2021
|
+
if (colors.yellow) root.style.setProperty('--yellow', colors.yellow);
|
|
2022
|
+
if (colors.yellowDim) root.style.setProperty('--yellow-dim', colors.yellowDim);
|
|
2023
|
+
if (colors.orange) root.style.setProperty('--orange', colors.orange);
|
|
2024
|
+
if (colors.orangeDim) root.style.setProperty('--orange-dim', colors.orangeDim);
|
|
2025
|
+
if (colors.red) root.style.setProperty('--red', colors.red);
|
|
2026
|
+
if (colors.redDim) root.style.setProperty('--red-dim', colors.redDim);
|
|
2027
|
+
if (colors.purple) root.style.setProperty('--purple', colors.purple);
|
|
2028
|
+
if (colors.purpleDim) root.style.setProperty('--purple-dim', colors.purpleDim);
|
|
2029
|
+
if (colors.blue) root.style.setProperty('--blue', colors.blue);
|
|
2030
|
+
if (colors.blueDim) root.style.setProperty('--blue-dim', colors.blueDim);
|
|
2031
|
+
if (colors.indigo) root.style.setProperty('--indigo', colors.indigo);
|
|
2032
|
+
if (colors.indigoDim) root.style.setProperty('--indigo-dim', colors.indigoDim);
|
|
2033
|
+
if (colors.amber) root.style.setProperty('--amber', colors.amber);
|
|
2034
|
+
if (colors.amberDim) root.style.setProperty('--amber-dim', colors.amberDim);
|
|
2035
|
+
if (colors.gray) root.style.setProperty('--gray', colors.gray);
|
|
2036
|
+
if (colors.grayDim) root.style.setProperty('--gray-dim', colors.grayDim);
|
|
2037
|
+
|
|
2038
|
+
// Stage colors
|
|
2039
|
+
if (colors.stageBacklog) root.style.setProperty('--stage-backlog', colors.stageBacklog);
|
|
2040
|
+
if (colors.stageSpec) root.style.setProperty('--stage-spec', colors.stageSpec);
|
|
2041
|
+
if (colors.stagePlan) root.style.setProperty('--stage-plan', colors.stagePlan);
|
|
2042
|
+
if (colors.stageImplement) root.style.setProperty('--stage-implement', colors.stageImplement);
|
|
2043
|
+
if (colors.stageTest) root.style.setProperty('--stage-test', colors.stageTest);
|
|
2044
|
+
if (colors.stageReview) root.style.setProperty('--stage-review', colors.stageReview);
|
|
2045
|
+
if (colors.stageDone) root.style.setProperty('--stage-done', colors.stageDone);
|
|
2046
|
+
if (colors.stageCancelled) root.style.setProperty('--stage-cancelled', colors.stageCancelled);
|
|
2047
|
+
|
|
2048
|
+
// Focus ring
|
|
2049
|
+
if (colors.focusRing) root.style.setProperty('--focus-ring', colors.focusRing);
|
|
2050
|
+
|
|
2051
|
+
// Shadows (adapt for dark/light)
|
|
2052
|
+
if (colors.isDark !== undefined) {
|
|
2053
|
+
if (colors.isDark) {
|
|
2054
|
+
root.style.setProperty(
|
|
2055
|
+
'--shadow-1',
|
|
2056
|
+
'0px 1px 2px 0px rgba(0,0,0,0.6), 0px 1px 3px 1px rgba(0,0,0,0.3)',
|
|
2057
|
+
);
|
|
2058
|
+
root.style.setProperty(
|
|
2059
|
+
'--shadow-2',
|
|
2060
|
+
'0px 1px 2px 0px rgba(0,0,0,0.6), 0px 2px 6px 2px rgba(0,0,0,0.3)',
|
|
2061
|
+
);
|
|
2062
|
+
root.style.setProperty(
|
|
2063
|
+
'--shadow-3',
|
|
2064
|
+
'0px 1px 3px 0px rgba(0,0,0,0.6), 0px 4px 8px 3px rgba(0,0,0,0.3)',
|
|
2065
|
+
);
|
|
2066
|
+
root.style.setProperty(
|
|
2067
|
+
'--shadow-hover',
|
|
2068
|
+
'0px 2px 4px 0px rgba(0,0,0,0.5), 0px 6px 16px 4px rgba(0,0,0,0.4)',
|
|
2069
|
+
);
|
|
2070
|
+
root.style.setProperty(
|
|
2071
|
+
'--shadow-drag',
|
|
2072
|
+
'0px 4px 8px 0px rgba(0,0,0,0.5), 0px 12px 32px 6px rgba(0,0,0,0.4)',
|
|
2073
|
+
);
|
|
2074
|
+
root.style.setProperty(
|
|
2075
|
+
'--shadow-panel',
|
|
2076
|
+
'-2px 0px 8px 0px rgba(0,0,0,0.5), -4px 0px 16px 2px rgba(0,0,0,0.3)',
|
|
2077
|
+
);
|
|
2078
|
+
} else {
|
|
2079
|
+
root.style.setProperty(
|
|
2080
|
+
'--shadow-1',
|
|
2081
|
+
'0px 1px 2px 0px rgba(0,0,0,0.3), 0px 1px 3px 1px rgba(0,0,0,0.15)',
|
|
2082
|
+
);
|
|
2083
|
+
root.style.setProperty(
|
|
2084
|
+
'--shadow-2',
|
|
2085
|
+
'0px 1px 2px 0px rgba(0,0,0,0.3), 0px 2px 6px 2px rgba(0,0,0,0.15)',
|
|
2086
|
+
);
|
|
2087
|
+
root.style.setProperty(
|
|
2088
|
+
'--shadow-3',
|
|
2089
|
+
'0px 1px 3px 0px rgba(0,0,0,0.3), 0px 4px 8px 3px rgba(0,0,0,0.15)',
|
|
2090
|
+
);
|
|
2091
|
+
root.style.setProperty(
|
|
2092
|
+
'--shadow-hover',
|
|
2093
|
+
'0px 2px 4px 0px rgba(0,0,0,0.25), 0px 4px 12px 4px rgba(0,0,0,0.15)',
|
|
2094
|
+
);
|
|
2095
|
+
root.style.setProperty(
|
|
2096
|
+
'--shadow-drag',
|
|
2097
|
+
'0px 4px 8px 0px rgba(0,0,0,0.3), 0px 12px 32px 6px rgba(0,0,0,0.25)',
|
|
2098
|
+
);
|
|
2099
|
+
root.style.setProperty(
|
|
2100
|
+
'--shadow-panel',
|
|
2101
|
+
'-2px 0px 8px 0px rgba(0,0,0,0.3), -4px 0px 16px 2px rgba(0,0,0,0.15)',
|
|
2102
|
+
);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
// Apply theme attribute and hide the toggle (agent-desk controls the theme)
|
|
2107
|
+
if (colors.isDark !== undefined) {
|
|
2108
|
+
var theme = colors.isDark ? 'dark' : 'light';
|
|
2109
|
+
if (colors.isDark) {
|
|
2110
|
+
document.documentElement.setAttribute('data-theme', 'dark');
|
|
2111
|
+
} else {
|
|
2112
|
+
document.documentElement.removeAttribute('data-theme');
|
|
2113
|
+
}
|
|
2114
|
+
localStorage.setItem('agent-tasks-theme', theme);
|
|
2115
|
+
updateThemeIcon(theme);
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
// Hide the local theme toggle — agent-desk controls the theme
|
|
2119
|
+
var themeToggle = document.getElementById('theme-toggle');
|
|
2120
|
+
if (themeToggle) themeToggle.style.display = 'none';
|
|
2121
|
+
});
|
|
2122
|
+
|
|
1958
2123
|
// ---- Boot ----
|
|
1959
2124
|
|
|
1960
2125
|
connect();
|
package/package.json
CHANGED