mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
feat(widgets): AI widget builder with live WorldMonitor data (#1732)
This commit is contained in:
@@ -18909,3 +18909,529 @@ body.has-breaking-alert .panels-grid {
|
||||
70% { transform: scale(2.5); opacity: 0; }
|
||||
100% { transform: scale(2.5); opacity: 0; }
|
||||
}
|
||||
|
||||
/* ─── Custom AI Widgets ─────────────────────────────────────────────────────── */
|
||||
|
||||
.ai-widget-block {
|
||||
border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border));
|
||||
background:
|
||||
radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%),
|
||||
linear-gradient(145deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 65%);
|
||||
color: var(--text);
|
||||
transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s;
|
||||
}
|
||||
|
||||
.ai-widget-block:hover {
|
||||
border-color: var(--accent);
|
||||
background:
|
||||
radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 42%),
|
||||
linear-gradient(145deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 68%);
|
||||
color: var(--text);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.custom-widget-panel {
|
||||
border-top: 2px solid var(--widget-accent, var(--accent));
|
||||
}
|
||||
|
||||
.custom-widget-panel .panel-content {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.widget-header-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
min-width: 32px;
|
||||
min-height: 32px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 1;
|
||||
border-radius: 999px;
|
||||
transition: transform 0.15s, border-color 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
.widget-header-btn:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.panel-widget-chat-btn {
|
||||
font-size: 15px;
|
||||
padding: 0;
|
||||
color: var(--text);
|
||||
background: color-mix(in srgb, var(--widget-accent, var(--accent)) 18%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--widget-accent, var(--accent)) 45%, var(--border));
|
||||
}
|
||||
|
||||
.panel-widget-chat-btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.widget-color-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid color-mix(in srgb, var(--widget-accent, var(--accent)) 40%, var(--border));
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: transform 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.widget-color-btn:hover {
|
||||
transform: scale(1.06);
|
||||
}
|
||||
|
||||
.wm-widget-shell {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
border: 1px solid color-mix(in srgb, var(--widget-accent, var(--accent)) 26%, var(--border));
|
||||
border-radius: 14px;
|
||||
background:
|
||||
linear-gradient(180deg, color-mix(in srgb, var(--widget-accent, var(--accent)) 10%, transparent), transparent 40%),
|
||||
color-mix(in srgb, var(--surface) 92%, var(--bg));
|
||||
box-shadow:
|
||||
inset 0 1px 0 color-mix(in srgb, white 6%, transparent),
|
||||
0 10px 28px color-mix(in srgb, black 14%, transparent);
|
||||
}
|
||||
|
||||
.wm-widget-shell::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0 auto 0 0;
|
||||
width: 3px;
|
||||
border-radius: 14px 0 0 14px;
|
||||
background: linear-gradient(180deg, var(--widget-accent, var(--accent)), transparent);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.wm-widget-body {
|
||||
position: relative;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.wm-widget-generated {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
contain: layout paint;
|
||||
overflow: clip;
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.wm-widget-generated > * {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.wm-widget-generated table,
|
||||
.wm-widget-generated svg {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wm-widget-generated .economic-footer {
|
||||
margin-top: 12px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid color-mix(in srgb, var(--widget-accent, var(--accent)) 18%, var(--border));
|
||||
}
|
||||
|
||||
.wm-widget-shell-preview {
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
/* ─── Widget Chat Modal ─────────────────────────────────────────────────────── */
|
||||
|
||||
.widget-chat-modal {
|
||||
width: min(1120px, 96vw);
|
||||
max-width: 1120px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 88vh;
|
||||
min-height: min(760px, 88vh);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.widget-chat-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1.05fr);
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.widget-chat-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
border-right: 1px solid var(--border);
|
||||
background: color-mix(in srgb, var(--surface) 88%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-main {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background:
|
||||
radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 42%),
|
||||
color-mix(in srgb, var(--bg) 96%, var(--surface));
|
||||
}
|
||||
|
||||
.widget-chat-readiness {
|
||||
margin: 12px 12px 0;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.widget-chat-readiness.is-checking {
|
||||
color: var(--text);
|
||||
background: color-mix(in srgb, var(--accent) 12%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-readiness.is-ready {
|
||||
color: color-mix(in srgb, #8cffc9 80%, var(--text));
|
||||
background: color-mix(in srgb, #44ff88 12%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-readiness.is-error {
|
||||
color: #ffb0b0;
|
||||
background: color-mix(in srgb, #ff4444 14%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-messages {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.widget-chat-msg {
|
||||
max-width: 92%;
|
||||
padding: 8px 11px;
|
||||
border-radius: 10px;
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.widget-chat-msg.user {
|
||||
align-self: flex-end;
|
||||
background: var(--accent-dim);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.widget-chat-msg.assistant {
|
||||
align-self: flex-start;
|
||||
background: color-mix(in srgb, var(--surface) 88%, var(--bg));
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.widget-chat-radar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.widget-chat-radar .panel-loading-radar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.widget-chat-tool-badge {
|
||||
font-size: 11px;
|
||||
color: var(--accent);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.widget-chat-examples {
|
||||
padding: 0 12px 12px;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.widget-chat-examples-label {
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.widget-chat-examples-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.widget-chat-example-chip {
|
||||
padding: 8px 12px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
|
||||
background: color-mix(in srgb, var(--surface) 92%, transparent);
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
line-height: 1.25;
|
||||
transition: border-color 0.15s, transform 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
.widget-chat-example-chip:hover {
|
||||
border-color: var(--accent);
|
||||
transform: translateY(-1px);
|
||||
background: color-mix(in srgb, var(--accent) 10%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-preview {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.widget-chat-preview-state,
|
||||
.widget-chat-preview-frame {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.widget-chat-preview-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.widget-chat-preview-kicker {
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.widget-chat-preview-heading {
|
||||
margin-top: 4px;
|
||||
font-size: 21px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.widget-chat-phase-badge {
|
||||
padding: 6px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: var(--accent);
|
||||
background: color-mix(in srgb, var(--accent) 14%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-preview-copy {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.widget-chat-preview-alert {
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
color: #ffb0b0;
|
||||
background: color-mix(in srgb, #ff4444 14%, transparent);
|
||||
}
|
||||
|
||||
.widget-chat-preview-skeleton {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-line,
|
||||
.widget-chat-skeleton-card {
|
||||
display: block;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--surface) 92%, transparent));
|
||||
background-size: 200% 100%;
|
||||
animation: widget-chat-shimmer 1.6s linear infinite;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-line {
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-line.is-title {
|
||||
height: 16px;
|
||||
width: 68%;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-line.is-short {
|
||||
width: 52%;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-card {
|
||||
height: 108px;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.widget-chat-preview-render {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.widget-chat-action-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 220px;
|
||||
padding: 10px 16px;
|
||||
background: var(--accent);
|
||||
color: var(--bg);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
transition: opacity 0.15s, transform 0.15s;
|
||||
}
|
||||
|
||||
.widget-chat-action-btn:hover {
|
||||
opacity: 0.85;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.widget-chat-action-btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.widget-chat-input-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
align-items: flex-end;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.widget-chat-input {
|
||||
flex: 1;
|
||||
resize: none;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
color: var(--text);
|
||||
padding: 7px 10px;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.widget-chat-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.widget-chat-send {
|
||||
min-width: 104px;
|
||||
padding: 10px 14px;
|
||||
background: var(--accent);
|
||||
color: var(--bg);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
transition: opacity 0.15s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.widget-chat-send:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.widget-chat-send:hover:not(:disabled) {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.widget-chat-footer {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
background: color-mix(in srgb, var(--surface) 94%, var(--bg));
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.widget-chat-footer-status {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.widget-chat-footer-status.is-error {
|
||||
color: #ffb0b0;
|
||||
}
|
||||
|
||||
@keyframes widget-chat-shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.widget-chat-modal {
|
||||
width: min(96vw, 720px);
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.widget-chat-layout {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.widget-chat-sidebar {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.widget-chat-messages {
|
||||
max-height: 220px;
|
||||
}
|
||||
|
||||
.widget-chat-footer {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.widget-chat-action-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.widget-chat-skeleton-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user