mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 09:21:24 +08:00
chore: migrate oxlint & oxfmt (#15464)
#### PR Dependency Tree * **PR #15464** 👈 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 * **Chores** * Replaced the project’s formatting and linting workflow with Oxfmt and Oxlint. * Added shared formatting and linting configuration, editor integration, and updated automated checks. * Updated generated files, scripts, and lint guidance to use the new tooling. * **Style** * Reformatted templates, source code, examples, and configuration files for consistent readability. * No user-facing functionality or rendering behavior changed. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* oxlint-disable @typescript-eslint/await-thenable */
|
||||
/* oxlint-disable typescript/await-thenable */
|
||||
import type {
|
||||
Template,
|
||||
TemplateCategory,
|
||||
|
||||
@@ -406,9 +406,9 @@ export class EdgelessTemplatePanel extends WithDisposable(LitElement) {
|
||||
cate => cate,
|
||||
cate => {
|
||||
return html`<div
|
||||
class="category-entry ${_currentCategory === cate
|
||||
? 'selected'
|
||||
: ''}"
|
||||
class="category-entry ${
|
||||
_currentCategory === cate ? 'selected' : ''
|
||||
}"
|
||||
@click=${() => {
|
||||
this._currentCategory = cate;
|
||||
this._updateTemplates();
|
||||
@@ -422,73 +422,81 @@ export class EdgelessTemplatePanel extends WithDisposable(LitElement) {
|
||||
<div class="template-viewport">
|
||||
<div class="template-scrollcontent" data-scrollable>
|
||||
<div class="template-list">
|
||||
${this._loading
|
||||
? html`<affine-template-loading
|
||||
style=${styleMap({
|
||||
position: 'absolute',
|
||||
left: '50%',
|
||||
top: '50%',
|
||||
})}
|
||||
></affine-template-loading>`
|
||||
: repeat(
|
||||
_templates,
|
||||
template => template.name,
|
||||
template => {
|
||||
const preview = template.preview
|
||||
? template.preview.startsWith('<svg')
|
||||
? html`<img
|
||||
src="${toSvgPreviewDataUrl(template.preview)}"
|
||||
class="template-preview"
|
||||
loading="lazy"
|
||||
/>`
|
||||
: html`<img
|
||||
src="${template.preview}"
|
||||
class="template-preview"
|
||||
loading="lazy"
|
||||
/>`
|
||||
: defaultPreview;
|
||||
${
|
||||
this._loading
|
||||
? html`<affine-template-loading
|
||||
style=${styleMap({
|
||||
position: 'absolute',
|
||||
left: '50%',
|
||||
top: '50%',
|
||||
})}
|
||||
></affine-template-loading>`
|
||||
: repeat(
|
||||
_templates,
|
||||
template => template.name,
|
||||
template => {
|
||||
const preview = template.preview
|
||||
? template.preview.startsWith('<svg')
|
||||
? html`<img
|
||||
src="${toSvgPreviewDataUrl(template.preview)}"
|
||||
class="template-preview"
|
||||
loading="lazy"
|
||||
/>`
|
||||
: html`<img
|
||||
src="${template.preview}"
|
||||
class="template-preview"
|
||||
loading="lazy"
|
||||
/>`
|
||||
: defaultPreview;
|
||||
|
||||
const isBeingDragged =
|
||||
draggingElement &&
|
||||
draggingElement.data.name === template.name;
|
||||
return html`
|
||||
<div
|
||||
class=${`template-item ${
|
||||
template === this._loadingTemplate ? 'loading' : ''
|
||||
}`}
|
||||
style=${styleMap({
|
||||
opacity: isBeingDragged ? '0' : '1',
|
||||
})}
|
||||
data-hover-text="Add"
|
||||
@mousedown=${(e: MouseEvent) =>
|
||||
this.draggableController.onMouseDown(e, {
|
||||
data: template,
|
||||
preview,
|
||||
const isBeingDragged =
|
||||
draggingElement &&
|
||||
draggingElement.data.name === template.name;
|
||||
return html`
|
||||
<div
|
||||
class=${`template-item ${
|
||||
template === this._loadingTemplate
|
||||
? 'loading'
|
||||
: ''
|
||||
}`}
|
||||
style=${styleMap({
|
||||
opacity: isBeingDragged ? '0' : '1',
|
||||
})}
|
||||
@touchstart=${(e: TouchEvent) => {
|
||||
this.draggableController.onTouchStart(e, {
|
||||
data: template,
|
||||
preview,
|
||||
});
|
||||
}}
|
||||
>
|
||||
${preview}
|
||||
${template === this._loadingTemplate
|
||||
? html`<affine-template-loading></affine-template-loading>`
|
||||
: nothing}
|
||||
${template.name
|
||||
? html`<affine-tooltip
|
||||
.offset=${12}
|
||||
.autoHide=${true}
|
||||
tip-position="top"
|
||||
>
|
||||
${template.name}
|
||||
</affine-tooltip>`
|
||||
: nothing}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
)}
|
||||
data-hover-text="Add"
|
||||
@mousedown=${(e: MouseEvent) =>
|
||||
this.draggableController.onMouseDown(e, {
|
||||
data: template,
|
||||
preview,
|
||||
})}
|
||||
@touchstart=${(e: TouchEvent) => {
|
||||
this.draggableController.onTouchStart(e, {
|
||||
data: template,
|
||||
preview,
|
||||
});
|
||||
}}
|
||||
>
|
||||
${preview}
|
||||
${
|
||||
template === this._loadingTemplate
|
||||
? html`<affine-template-loading></affine-template-loading>`
|
||||
: nothing
|
||||
}
|
||||
${
|
||||
template.name
|
||||
? html`<affine-tooltip
|
||||
.offset=${12}
|
||||
.autoHide=${true}
|
||||
tip-position="top"
|
||||
>
|
||||
${template.name}
|
||||
</affine-tooltip>`
|
||||
: nothing
|
||||
}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<overlay-scrollbar></overlay-scrollbar>
|
||||
|
||||
Reference in New Issue
Block a user