Skip to content

feat: simplify editor config API#31

Merged
WipeAir merged 3 commits intomainfrom
feat/refactor-editor-api
Mar 18, 2026
Merged

feat: simplify editor config API#31
WipeAir merged 3 commits intomainfrom
feat/refactor-editor-api

Conversation

@WipeAir
Copy link
Copy Markdown
Member

@WipeAir WipeAir commented Mar 18, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 18, 2026 14:33
@WipeAir WipeAir force-pushed the feat/refactor-editor-api branch from 30a0b36 to 3c65d55 Compare March 18, 2026 14:37
@WipeAir WipeAir merged commit 9a6ee3b into main Mar 18, 2026
11 checks passed
@WipeAir WipeAir deleted the feat/refactor-editor-api branch March 18, 2026 14:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the SEL editor configuration surface by centralizing diagnostics/types in @seljs/checker, introducing feature toggles and checkerOptions, and updating editor/React integrations to surface validity alongside value changes.

Changes:

  • Switch linting diagnostics types to @seljs/checker and simplify linting exports.
  • Update SELEditorConfig API: add features + checkerOptions, change onChange to (value, valid), and remove older validation/custom-extension knobs.
  • Update editor internals, tests, and React hook/stories to align with the new config API.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/sel-editor/src/linting/sel-linter.ts Imports SELDiagnostic from @seljs/checker; exports API as export const/interface.
packages/sel-editor/src/linting/sel-linter.spec.ts Updates test type import to @seljs/checker.
packages/sel-editor/src/linting/index.ts Re-exports linting modules via export *.
packages/sel-editor/src/linting/diagnostic-mapper.ts Makes mapCheckResult a direct named export and removes redundant exports.
packages/sel-editor/src/editor/types.ts Introduces SELEditorFeatures, replaces config fields with checkerOptions/features, and updates onChange signature.
packages/sel-editor/src/editor/type-display.ts Refactors to const exports and adjusts update triggering logic.
packages/sel-editor/src/editor/index.ts Removes buildExtensions export; exports new feature type.
packages/sel-editor/src/editor/editor-config.ts Builds extensions based on feature toggles; wires linting to SELChecker; computes validity on change.
packages/sel-editor/src/editor/create-editor.ts Refactors createSELEditor to export const.
packages/sel-editor/src/editor/create-editor.spec.ts Updates tests for new onChange signature and new config fields (checkerOptions, features).
packages/sel-editor-react/src/whatsabi-explorer.stories.tsx Updates story to new features.typeDisplay and adapts onChange.
packages/sel-editor-react/src/use-sel-editor.ts Tracks and returns valid from editor onChange.
packages/sel-editor-react/src/use-sel-editor.spec.ts Updates expectation for new onChange signature.
packages/sel-editor-react/src/sel-editor.stories.tsx Migrates stories from validate/showType to checkerOptions/features.
packages/sel-editor-react/src/sel-editor.spec.tsx Migrates component test from validate to checkerOptions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +64 to 73
// onChange listener with validity
if (config.onChange) {
const onChange = config.onChange;
extensions.push(
EditorView.updateListener.of((update) => {
if (update.docChanged) {
onChange(update.state.doc.toString());
const value = update.state.doc.toString();
const result = checker.check(value);
onChange(value, result.valid);
}
Comment on lines +50 to +58
/**
* Called on every expression change with the current value and validity
*/
onChange?: (value: string, valid: boolean) => void;

/** Debounce delay for validation (default: 300ms) */
validateDelay?: number;
/**
* Options for the internal SELChecker instance
*/
checkerOptions?: SELCheckerOptions;
@@ -1,5 +1,4 @@
export { createSELEditor } from "./create-editor";
@abi-releaser abi-releaser bot mentioned this pull request Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants