Commit Graph

16 Commits

Author SHA1 Message Date
CatsJuice
7d1d167858 chore: bump theme (#9732) 2025-01-17 09:22:15 +00:00
doouding
99717196c5 refactor: rewrite blocksuite dnd (#9595)
### Changed

- Refactored BlockSuite drag-and-drop using @atlaskit/pragmatic-drag-and-drop/element/adapter.
- Updated block dragging to use the new drag-and-drop infrastructure.

### BlockSuite DND API

Access the BlockSuite drag-and-drop API via `std.dnd`. This is a lightweight wrapper around pragmatic-drag-and-drop, offering convenient generic types and more intuitive option names.

#### Drag payload structure
There's some constrain about drag payload. The whole drag payload looks like this:

```typescript
type DragPayload = {
  entity: {
    type: string
  },
  from: {
    at: 'blocksuite',
    docId: string
  }
}
```
- The `from` field is auto-generated—no need for manual handling.
- The `entity` field is customizable, but it must include a `type`.

All drag-and-drop methods accept a generic type for entity, ensuring more accurate payloads in event handlers.

```typescript
type BlockEntity = {
  type: 'blocks',
  blockIds: string[]
}

dnd.draggable<BlockEntity>({
  element: someElement,
  setDragData: () => {
    // the return type must satisfy the generic type
    // in this case, it's BlockEntity
    return {
      type: 'blocks',
      blockIds: []
    }
  }
});

dnd.monitor<BlockEntity>({
  // the arguments is same for other event handler
  onDrag({ source }) {
    // the type of this is BlockEntity
    source.data.entity
  }
})
```

#### Drop payload
When hover on droppable target. You can set drop payload as well. All drag-and-drop methods accept a second generic type for drop payload.

The drop payload is customizable. Additionally, the DND system will add an `edge` field to the final payload object, indicating the nearest edge of the drop target relative to the current drag position.

```typescript
type DropPayload = {
  blockId: string;
}

dnd.dropTarget<BlockEntity, DropPayload>({
  getData() {
    // the type should be DropPayload
    return {
      blockId: 'someId'
    }
  }
});

dnd.monitor<BlockEntity, DropPayload>({
  // drag over on drop target
  onDrag({ location }) {
    const target = location.current.dropTargets[0];

    // the type is DropPayload
    target.data;
    // retrieve the nearest edge of the drop target relative to the current drop position.
    target.data.edge;
  }
})
```
2025-01-16 12:36:58 +00:00
renovate
908afe19ee chore: bump up file-type version to v20 (#9731)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [file-type](https://redirect.github.com/sindresorhus/file-type) | [`^19.6.0` -> `^20.0.0`](https://renovatebot.com/diffs/npm/file-type/19.6.0/20.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/file-type/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/file-type/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/file-type/19.6.0/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/file-type/19.6.0/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [file-type](https://redirect.github.com/sindresorhus/file-type) | [`^19.5.0` -> `^20.0.0`](https://renovatebot.com/diffs/npm/file-type/19.6.0/20.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/file-type/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/file-type/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/file-type/19.6.0/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/file-type/19.6.0/20.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>sindresorhus/file-type (file-type)</summary>

### [`v20.0.0`](https://redirect.github.com/sindresorhus/file-type/releases/tag/v20.0.0)

[Compare Source](https://redirect.github.com/sindresorhus/file-type/compare/v19.6.0...v20.0.0)

##### Breaking

-   Drop MIME-type and extension enumeration in types ([#&#8203;693](https://redirect.github.com/sindresorhus/file-type/issues/693))  [`0ff11c6`](https://redirect.github.com/sindresorhus/file-type/commit/0ff11c6)
-   Remove `NodeFileTypeParser` in favor of using `FileTypeParser` on all platforms ([#&#8203;707](https://redirect.github.com/sindresorhus/file-type/issues/707))  [`ff8eed8`](https://redirect.github.com/sindresorhus/file-type/commit/ff8eed8)

##### Improvements

-   Give API access to `FileTypeParser#detectors` ([#&#8203;704](https://redirect.github.com/sindresorhus/file-type/issues/704))  [`7e72bbc`](https://redirect.github.com/sindresorhus/file-type/commit/7e72bbc)
-   Improve Nikon RAW NEF (Tiff) format detection ([#&#8203;670](https://redirect.github.com/sindresorhus/file-type/issues/670))  [`cf6fc1e`](https://redirect.github.com/sindresorhus/file-type/commit/cf6fc1e)
-   Add support for Java archive (`.jar`) ([#&#8203;719](https://redirect.github.com/sindresorhus/file-type/issues/719))  [`8651809`](https://redirect.github.com/sindresorhus/file-type/commit/8651809)
-   Add support for MSOffice macro-enabled docs and templates ([#&#8203;720](https://redirect.github.com/sindresorhus/file-type/issues/720))  [`7fe5667`](https://redirect.github.com/sindresorhus/file-type/commit/7fe5667)
-   Add support for OpenDocument graphics and templates ([#&#8203;718](https://redirect.github.com/sindresorhus/file-type/issues/718))  [`4db407d`](https://redirect.github.com/sindresorhus/file-type/commit/4db407d)
-   Add support for Microsoft Excel template with macros (.xltm) ([#&#8203;714](https://redirect.github.com/sindresorhus/file-type/issues/714))  [`1fe621a`](https://redirect.github.com/sindresorhus/file-type/commit/1fe621a)
-   Add support for Microsoft Word template (.dotx) ([#&#8203;713](https://redirect.github.com/sindresorhus/file-type/issues/713))  [`643ef78`](https://redirect.github.com/sindresorhus/file-type/commit/643ef78)
-   Add support for Microsoft Excel template (`.xltx`) ([#&#8203;712](https://redirect.github.com/sindresorhus/file-type/issues/712))  [`0dab3e0`](https://redirect.github.com/sindresorhus/file-type/commit/0dab3e0)
-   Add support for Microsoft PowerPoint template ( `.potx`) ([#&#8203;710](https://redirect.github.com/sindresorhus/file-type/issues/710))  [`f978619`](https://redirect.github.com/sindresorhus/file-type/commit/f978619)
-   Add support for ZIP decompression using `@tokenizer/inflate` ([#&#8203;695](https://redirect.github.com/sindresorhus/file-type/issues/695))  [`399b0f1`](https://redirect.github.com/sindresorhus/file-type/commit/399b0f1)
-   Add support for `.lz4` file format ([#&#8203;706](https://redirect.github.com/sindresorhus/file-type/issues/706))  [`74acf94`](https://redirect.github.com/sindresorhus/file-type/commit/74acf94)
-   Add support for format `.drc`, Google's Draco 3D Data Compression ([#&#8203;702](https://redirect.github.com/sindresorhus/file-type/issues/702))  [`e99257d`](https://redirect.github.com/sindresorhus/file-type/commit/e99257d)

##### Fixes

-   Fix code sequence "File Type Box" detection ([#&#8203;705](https://redirect.github.com/sindresorhus/file-type/issues/705))  [`7d4dd8d`](https://redirect.github.com/sindresorhus/file-type/commit/7d4dd8d)

***

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->
2025-01-16 10:08:14 +00:00
fundon
0b3dba614d perf(editor): optimize the search for the closest element (#9587)
Closes: [BS-2275](https://linear.app/affine-design/issue/BS-2275/拖拽-indicator-查找优化)
2025-01-10 08:21:10 +00:00
Saul-Mirone
d21ef47ae8 chore(editor): rename std.doc to std.store (#9596) 2025-01-09 04:16:28 +00:00
forehalo
c0ed74dfed chore: standardize tsconfig (#9568) 2025-01-08 04:07:56 +00:00
Saul-Mirone
f778d1a28a refactor(editor): move extension to store (#9552) 2025-01-06 15:15:14 +00:00
Saul-Mirone
fc863e484c refactor(editor): remove selection global types (#9532)
Closes: [BS-2217](https://linear.app/affine-design/issue/BS-2217/remove-global-types-in-selection)
2025-01-06 03:45:11 +00:00
CatsJuice
09937a8e4d chore: bump icons with new design source (#9529) 2025-01-06 03:10:03 +00:00
Saul-Mirone
397a48380e refactor(editor): simplify tsconfig (#9439) 2024-12-30 16:15:34 +00:00
Saul-Mirone
a9f890017e fix(editor): missing dependencies (#9436) 2024-12-30 14:10:37 +00:00
fundon
a5641ae608 feat(editor): update edgeless color palette (#9243)
Closes: [BS-1475](https://linear.app/affine-design/issue/BS-1475/颜色主题更新) [BS-1803](https://linear.app/affine-design/issue/BS-1803/fill-color色板影响的yuan素) [BS-1804](https://linear.app/affine-design/issue/BS-1804/border-color色板影响的yuan素) [BS-1815](https://linear.app/affine-design/issue/BS-1815/连线文字配色略瞎)

### What's Changed

* refactor `EdgelessLineWidthPanel` component, the previous width is fixed and cannot be used in the new design
* refactor `EdgelessColorPanel` and `EdgelessColorButton` components, make them simple and reusable
* delete redundant `EdgelessOneRowColorPanel` component
* unity and update color palette, if the previously set color is not in the latest color palette, the custom color button will be selected
2024-12-30 03:36:34 +00:00
forehalo
12542f51f9 chore: bump base version to 0.19.0 2024-12-28 00:27:50 +08:00
fundon
6fcdd015aa fix(component): lit portal not re-rendering in inline links case (#9321)
* uses `portal.key` in templates
* updates `portal.id`  for use in queries
2024-12-27 15:43:13 +08:00
Saul-Mirone
3ae3ae98c8 refactor(editor): extract edgeless legacy slots (#9363) 2024-12-27 04:22:52 +00:00
Saul-Mirone
ebd97752bf refactor(editor): extract attachment block (#9308) 2024-12-25 12:19:58 +00:00