Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui): improve modularity, lifecycle, and types #1007

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

qwqcode
Copy link
Member

@qwqcode qwqcode commented Oct 18, 2024

  • Introduce a service dependency container for better management (feat(ui): add dependency injection container #1006).
    • Replace original services definitions with provide and inject methods.
    • Recommend calling inject at the beginning of ArtalkPlugin to explicitly inject required dependencies.
  • Replace load with mount for improved lifecycle handling.
    • Track local config.
    • Fix potential language setting not working issue. (Fixes i18n 有問題 #973)
  • Refine Type definitions for clarity and maintainability.
  • Enhance config logic with ConfigManager.
  • Improve event handling with EventManager refactor.
  • Update plugin and editor architecture for greater flexibility.
    • Further eliminate global variables and avoid directly passing the Context interface as a function parameter. Instead, use more explicit and specific types and parameters.
  • Remove deprecated and redundant code for a cleaner structure.

BREAKING CHANGE: This update changes the UI client's export Types. Although we aim to maintain backward compatibility, it may still affect downstream UI programs. Please refer to the TypeDoc.

- Introduce a service dependency container for better management (#1006).
  - Replace original `services` definitions with `provide` and `inject` methods.
  - Recommend calling `inject` at the beginning of `ArtalkPlugin` to explicitly inject required dependencies.
- Replace `load` with `mount` for improved lifecycle handling.
  - Track local config.
  - Fix potential language setting not working issue. (Fixes #973)
- Refine Type definitions for clarity and maintainability.
  - See [TypeDoc](https://artalk.js.org/typedoc/) for updates.
- Enhance config logic with `ConfigManager`.
  - Deprecate `ctx.conf` and `ctx.$root`; use `getConf()` and `getEl()` instead.
  - Update client default config settings. (Fixes #1001)
- Improve event handling with `EventManager` refactor.
- Update plugin and editor architecture for greater flexibility.
  - Further eliminate global variables and avoid directly passing the `Context` interface as a function parameter. Instead, use more explicit and specific types and parameters.
- Remove deprecated and redundant code for a cleaner structure.

BREAKING CHANGE: This update changes the UI client's export Types. Although we aim to maintain backward compatibility, it may still affect downstream UI programs. Please refer to the [TypeDoc](https://artalk.js.org/typedoc/).
@qwqcode qwqcode merged commit 20be96f into master Oct 18, 2024
3 of 11 checks passed
@qwqcode qwqcode deleted the refactor/ui branch October 18, 2024 08:40
qwqcode added a commit that referenced this pull request Oct 18, 2024
Since the client program already prioritizes local configuration over remote configuration by default, there's no need to use the `remoteConfModifier` magic function to alter the configuration priority.

The dependency injection function has changed from `get` to `inject`, or call a more specific method from the `Context` interface.

(The prerequisite PR is #1007)
qwqcode added a commit that referenced this pull request Oct 18, 2024
- Bump to new Artalk client export types
- Add `AuthContext` type definition for improved clarity
- Replace `ContextApi` with `AuthContext` for reducing the scope of variables
- Bump version to 0.0.2 for release

(The prerequisite PR is #1007)
qwqcode added a commit that referenced this pull request Oct 18, 2024
- Bump to new Artalk client export types
- Add `AuthContext` type definition for improved clarity
- Replace `ContextApi` with `AuthContext` for reducing the scope of variables
- Bump version to 0.0.2 for release

(The prerequisite PR is #1007)
qwqcode added a commit that referenced this pull request Oct 18, 2024
Add `preferRemoteConf` option (disabled by default).

Local config now takes priority, addressing the issue where remote config previously overrode local settings. (Closes #1000)

Updated config merging logic in `mount.ts`.

Deprecated `useBackendConf` in favor of `preferRemoteConf`.

(The prerequisite PR is #1007)

BREAKING CHANGE: The UI client now prioritizes local config in the latest version, whereas previously, the remote config would override it.
qwqcode added a commit that referenced this pull request Oct 18, 2024
Add `preferRemoteConf` option (disabled by default).

Local config now takes priority, addressing the issue where remote config previously overrode local settings. (Closes #1000)

Updated config merging logic in `mount.ts`.

Deprecated `useBackendConf` in favor of `preferRemoteConf`.

(The prerequisite PR is #1007)

BREAKING CHANGE: UI client now prioritizes local config in the latest version, whereas previously, the remote config would override it. (See #1011)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

评论区的图片不显示了 i18n 有問題
1 participant