Commit Graph

91 Commits

Author SHA1 Message Date
Ayush Agrawal
6fad241350
feat: bump blocksuite (#5845) 2024-02-20 20:49:41 +08:00
Peng Xiao
d1c4e6141a
refactor(component): cmdk ordering (#5722)
Replace internal CMDK command filtering/sorting logic.
The new implementation includes the following for command scoring:
- categories weights
- highlighted fragments
- original command score value

The new logic should be much cleaner and remove some hacks in the original implementation.

Not sure if this is optimal yet. Could be changed later.

fix https://github.com/toeverything/AFFiNE/issues/5699
2024-02-16 13:20:24 +00:00
DarkSky
25e8a2a22f
feat: sync client versioning (#5645)
after this pr, server will only accept client that have some major version
the client version <0.12 will be rejected by the server, >= 0.12 can receive outdated messages and notify users
2024-02-05 08:43:50 +00:00
EYHN
329fc19852
refactor(infra): migrate to new infra (#5565) 2024-01-30 07:16:39 +00:00
EYHN
1e3499c323
feat(infra): page infra (#5618) 2024-01-30 06:31:26 +00:00
EYHN
2e71c980cf
feat(infra): new workspace infra (#5617)
This PR copying @affine/workspace into common/infra, and adding definitions for services and unit tests.
2024-01-30 06:31:24 +00:00
EYHN
88cd83fed1
feat(infra): standard lifecycle service (#5564) 2024-01-30 06:31:19 +00:00
EYHN
b3a8e62984
feat(infra): standard storage service (#5563) 2024-01-30 06:31:15 +00:00
EYHN
48eb6c50e1
feat(infra): di container (#5497)
docs: https://insider.affine.pro/share/055f9c4b-497a-43ec-a1c9-29d5baf184b9/N785YJ__oLMb2fUaLOv-k
2024-01-30 06:31:13 +00:00
EYHN
c9f8e49f75
feat(infra): livedata (#5562)
LiveData is a reactive data type.

## basic usage

@example
```ts
const livedata = new LiveData(0); // create livedata with initial value

livedata.next(1); // update value

console.log(livedata.value); // get current value

livedata.subscribe(v => { // subscribe to value changes
 console.log(v); // 1
});
```

## observable

LiveData is a rxjs observable, you can use rxjs operators.

@example
```ts
new LiveData(0).pipe(
  map(v => v + 1),
  filter(v => v > 1),
  ...
)
```

NOTICE: different from normal observable, LiveData will always emit the latest value when you subscribe to it.

## from observable

LiveData can be created from observable or from other livedata.

@example
```ts
const A = LiveData.from(
  of(1, 2, 3, 4), // from observable
  0 // initial value
);

const B = LiveData.from(
  A.pipe(map(v => 'from a ' + v)), // from other livedata
  '' // initial value
);
```

NOTICE: LiveData.from will not complete when the observable completes, you can use `spreadComplete` option to change
this behavior.

## Why is it called LiveData

This API is very similar to LiveData in Android, as both are based on Observable, so I named it LiveData.
2024-01-30 06:31:11 +00:00
Chen
c566952e09
feat: bump blocksuite (#5673) 2024-01-24 15:13:12 +08:00
LongYinan
fa8655e43e
style: apply prefer-node-protocol lint rule (#5627)
it makes it perfectly clear that the package is a Node.js builtin module.
2024-01-19 03:47:08 +00:00
EYHN
4aae3cbba3
docs: initial api reference docs (#5352) 2024-01-02 12:46:27 +00:00
Peng Xiao
3978b2dfd2
refactor(core): onboarding using new transformer api (#5412)
Use new `transformer` to import onboarding json templates.

The json files are generated via this gist
https://gist.github.com/pengx17/ef92c305ac23123803a1a6a20e31f822

Not using the all-in-one `ZipTransformer` to import onboarding via a zip file.
1. The main concerns is that we still need to serve the blob resources via CDN to reduce user's blob usage. Otherwise the user will get the onboarding images being uploaded to cloud server every time he creates a new workspace. In this PR we extracted parts of the code from `ZipTransformer` in blocksuite and mute some code for uploading blobs.
2. it maybe not necessary to use zip for loading snapshots.

This PR is a short term solution. whether or not to tune the transformer api design may need further discussions.

fix TOV-264
2023-12-28 13:59:21 +00:00
EYHN
4e861d8118
refactor(electron): create electron api package (#5334) 2023-12-27 06:38:37 +00:00
EYHN
265ee81666
refactor(infra): remove old plugin system (#5411)
plugin system need redesign
2023-12-27 02:49:59 +00:00
EYHN
9493bd99f9
refactor(infra): move currentPageAtom to core (#5332)
Remove `currentPageAtom` from `infra` to `frontend/core.`
2023-12-25 03:34:28 +00:00
EYHN
05025bf59a
refactor(core): remove outline plugin and layout atom (#5326)
@affine/outline is no longer used, this PR deletes this plugin and deletes the code that is no longer used
2023-12-25 03:24:13 +00:00
EYHN
aa74b0617c
fix(workspace): dont upgrade subdoc on cloud (#5382) 2023-12-22 15:48:54 +08:00
Joooye_34
ec7f73f168
chore: catch and ignore page upgrade error (#5373) 2023-12-21 14:27:07 +00:00
Peng Xiao
128f8066c3
fix(electron): main window should be opened first before destroying onboard window (#5319)
The issue listed on the title will prevent main window from showing on windows.
2023-12-19 09:22:44 +00:00
Cats Juice
e10609276d
feat(core): add toggle workspace dialog (#5312) 2023-12-19 09:12:26 +00:00
Cats Juice
15dd20ef48
feat(electron): onboarding at first launch logic for client and web (#5183)
- Added a simple abstraction of persistent storage class.
- Different persistence solutions are provided for web and client.
    - web: stored in localStorage
    - client: stored in the application directory as `.json` file
- Define persistent app-config schema
- Add a new hook that can interactive with persistent-app-config reactively
2023-12-19 07:17:54 +00:00
EYHN
fe2851d3e9
refactor: workspace manager (#5060) 2023-12-15 07:20:50 +00:00
regischen
738302be40
fix(edgeless): remove stale template (#5275) 2023-12-13 12:54:26 +08:00
Joooye_34
c1bb467013
refactor(core): use debug log replace console when command registry (#5237) 2023-12-09 07:42:04 +00:00
Peng Xiao
fcd43033fe
fix(electron): sync settings from localStorage -> atom -> electron (#5020)
- moved `appSettingAtom` to infra since we now have different packages that depends on it. There is no better place to fit in for now
- use atomEffect to sync setting changes to updater related configs to Electron side
- refactored how Electron reacts to updater config changes.
2023-12-08 03:20:02 +00:00
Joooye_34
eb7d293aaa
fix(core): implement editor timeout and report error from boundary (#5105) (#5151)
fix(core): implement editor timeout and report error from boundary (#5105)

ci: add sentry env when frontend assets build (#5131)

fix(core): expose catched editor load error (#5133)

fix(infra): use blocksuite api to check compatibility (#5137)

fix(infra): compatibility logic follow blocksuite (#5143)

fix(core): rerender error boundary when route change and improve sentry report (#5147)
2023-12-01 07:25:08 +00:00
JimmFly
23518cae16
feat(core): add manual check for updates (#4957)
work for #4523

add `appBuildType` to `runtimeConfig`
add `useAppUpdater` to manage client updates

<!--
copilot:summary
-->
### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset) Generated by Copilot at cdd012c</samp>

This pull request refactors and enhances the update functionality for the frontend. It introduces a new custom hook `useAppUpdater` that simplifies the update logic and state management, and uses it in various components and commands. It also adds more options and feedback for the user to control and monitor the update process, such as manual download, auto-check, and auto-download toggles, and update status and progress indicators. It also updates the `AboutAffine` component to show the app icon, version, and build type. It also adds new translations, dependencies, types, and schemas related to the update functionality.

<img width="1073" alt="image" src="https://github.com/toeverything/AFFiNE/assets/102217452/16ae7a6a-0035-4e57-902b-6b8f63169501">
2023-11-29 13:31:25 +00:00
LongYinan
7a7cbc45d7
fix: add prefer-readonly rule (#5122) 2023-11-29 15:19:00 +08:00
LongYinan
923844f302
fix: add eqeqeq lint rule (#5106) 2023-11-29 04:43:31 +00:00
Peng Xiao
7463e87742
fix(electron): clone db file when enable cloud for desktop (#5028)
At the moment on desktop the user's local blob data will be lost after enable cloud.
This is because blob data is only synced from old idb to new idb, but not sync into sqlitedb.

This pr will simply clone the db file for desktop app. It should also speed up the time when enabling cloud for a large local workspace.
2023-11-23 07:23:16 +00:00
LongYinan
3499dbbb7f
feat: upgrade dependencies and lockfile (#5016)
- Close https://github.com/toeverything/AFFiNE/security/dependabot/47
2023-11-23 05:18:05 +00:00
Joooye_34
4c8d54b3a7
refactor(core): use manual upgrade to replace auto migration when web setup (#5022)
1. Split logic in `packages/common/infra/src/blocksuite/index.ts` to multiple single files
2. Move migration logic from setup to upgrade module, to prevent auto migration problems and loading problem
2023-11-23 02:26:06 +00:00
Peng Xiao
791eb75ca8
fix(infra): page id compat fix for page ids in workspace.meta (#4950)
since we strip `page:` in keys of workspacedoc.spaces, we should also strip the prefix in meta.pages as well.
2023-11-16 21:57:17 +08:00
Joooye_34
ea4f5ffc83
fix(infra): workspace migration without blockVersions (#4936) 2023-11-14 23:03:40 +08:00
Peng Xiao
16488d594c
fix(infra): compatibility fix for space prefix (#4912)
It seems there are some cases that [this upstream PR](https://github.com/toeverything/blocksuite/pull/4747) will cause data loss.

Because of some historical reasons, the page id could be different with its doc id.
It might be caused by subdoc migration in the following (not 100% sure if all white screen issue is caused by it) 0714c12703/packages/common/infra/src/blocksuite/index.ts (L538-L540)

In version 0.10, page id in spaces no longer has prefix "space:"
The data flow for fetching a doc's updates is:
- page id in `meta.pages` -> find `${page-id}` in `doc.spaces` -> `doc` -> `doc.guid`
if `doc` is not found in `doc.spaces`, a new doc will be created and its `doc.guid` is the same with its pageId
- because of guid logic change, the doc that previously prefixed with `space:` will not be found in `doc.spaces`
- when fetching the rows of this doc using the doc id === page id,
  it will return EMPTY since there is no updates associated with the page id

The provided fix in the PR will patch the `spaces` field of the root doc so that after 0.10 the page doc can still be found in the `spaces` map. It shall apply to both of the idb & sqlite datasources.

Special thanks to @lawvs 's db file for investigation!
2023-11-14 14:39:50 +08:00
Joooye_34
15b0c127f5
chore: disable outline, copilot and hello world plugin (#4894) 2023-11-09 14:53:45 +00:00
EYHN
b7edaab387
chore: fix code style issues (#4857) 2023-11-08 05:51:08 +00:00
JimmFly
5226d6c568
feat(core): add search result highlighting (#4667)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-10-24 05:54:37 +00:00
Joooye_34
bed9310519
refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00