fix(core): some artifact tools styling (#13152)

fix BS-3615, BS-3616, BS-3614

#### PR Dependency Tree


* **PR #13152** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Style**
* Improved consistency of horizontal padding and spacing in AI chat
components.
* Updated chat message containers to enable vertical scrolling and
adjust height behavior.
* Refined artifact tool card appearance with enhanced hover effects,
cursor placement, and updated card structure for a more polished look.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


#### PR Dependency Tree


* **PR #13152** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

Co-authored-by: fengmk2 <fengmk2@gmail.com>
This commit is contained in:
Peng Xiao
2025-07-11 16:48:56 +08:00
committed by GitHub
co-authored by fengmk2
parent 0f74e1fa0f
commit d65a7494a4
3 changed files with 36 additions and 22 deletions
@@ -66,7 +66,7 @@ export class AIChatContent extends SignalWatcher(
.ai-chat-title { .ai-chat-title {
background: var(--affine-background-primary-color); background: var(--affine-background-primary-color);
position: relative; position: relative;
padding: 8px 0px; padding: 8px var(--h-padding);
width: 100%; width: 100%;
height: 36px; height: 36px;
display: flex; display: flex;
@@ -83,7 +83,8 @@ export class AIChatContent extends SignalWatcher(
ai-chat-messages { ai-chat-messages {
flex: 1; flex: 1;
overflow-y: hidden; overflow-y: auto;
padding: 0 var(--h-padding);
transition: transition:
flex-grow 0.32s cubic-bezier(0.07, 0.83, 0.46, 1), flex-grow 0.32s cubic-bezier(0.07, 0.83, 0.46, 1),
padding-top 0.32s ease, padding-top 0.32s ease,
@@ -102,18 +103,25 @@ export class AIChatContent extends SignalWatcher(
container-name: chat-panel-split-view; container-name: chat-panel-split-view;
} }
.chat-panel-main { .chat-panel-main {
--h-padding: 8px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
width: 100%; width: 100%;
padding: 8px 24px 0 24px; padding: 8px calc(24px - var(--h-padding)) 0 calc(24px - var(--h-padding));
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }
ai-chat-composer {
padding: 0 var(--h-padding);
}
@container chat-panel-split-view (width < 540px) { @container chat-panel-split-view (width < 540px) {
.chat-panel-main { .chat-panel-main {
padding: 8px 12px 0 12px; padding: 8px calc(12px - var(--h-padding)) 0
calc(12px - var(--h-padding));
} }
} }
`; `;
@@ -46,9 +46,8 @@ export class AIChatMessages extends WithDisposable(ShadowlessElement) {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 24px; gap: 24px;
height: 100%; min-height: 100%;
position: relative; position: relative;
overflow-y: auto;
} }
chat-panel-assistant-message, chat-panel-assistant-message,
@@ -3,6 +3,7 @@ import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit';
import type { ColorScheme } from '@blocksuite/affine/model'; import type { ColorScheme } from '@blocksuite/affine/model';
import { ShadowlessElement } from '@blocksuite/affine/std'; import { ShadowlessElement } from '@blocksuite/affine/std';
import { type NotificationService } from '@blocksuite/affine-shared/services'; import { type NotificationService } from '@blocksuite/affine-shared/services';
import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
import type { Signal } from '@preact/signals-core'; import type { Signal } from '@preact/signals-core';
import { import {
css, css,
@@ -29,12 +30,17 @@ export abstract class ArtifactTool<
> extends SignalWatcher(WithDisposable(ShadowlessElement)) { > extends SignalWatcher(WithDisposable(ShadowlessElement)) {
static override styles = css` static override styles = css`
.artifact-tool-card { .artifact-tool-card {
cursor: pointer;
margin: 8px 0; margin: 8px 0;
} padding: 10px 0;
.artifact-tool-card:hover { .affine-embed-linked-doc-block {
opacity: 0.8; box-shadow: ${unsafeCSSVar('overlayPanelShadow')};
cursor: pointer;
}
.affine-embed-linked-doc-block:hover {
background-color: ${unsafeCSSVarV2('layer/background/hoverOverlay')};
}
} }
`; `;
@@ -119,23 +125,24 @@ export abstract class ArtifactTool<
return html` return html`
<div <div
class="affine-embed-linked-doc-block artifact-tool-card ${className ?? class="artifact-tool-card ${className ?? ''}"
''} horizontal"
@click=${this.onCardClick} @click=${this.onCardClick}
> >
<div class="affine-embed-linked-doc-content"> <div class="affine-embed-linked-doc-block horizontal">
<div class="affine-embed-linked-doc-content-title"> <div class="affine-embed-linked-doc-content">
<div class="affine-embed-linked-doc-content-title-icon"> <div class="affine-embed-linked-doc-content-title">
${resolvedIcon} <div class="affine-embed-linked-doc-content-title-icon">
</div> ${resolvedIcon}
<div class="affine-embed-linked-doc-content-title-text"> </div>
${title} <div class="affine-embed-linked-doc-content-title-text">
${title}
</div>
</div> </div>
</div> </div>
${banner
? html`<div class="affine-embed-linked-doc-banner">${banner}</div>`
: nothing}
</div> </div>
${banner
? html`<div class="affine-embed-linked-doc-banner">${banner}</div>`
: nothing}
</div> </div>
`; `;
} }